diff --git a/src/api/models.ts b/src/api/models.ts index c323b605..553a3163 100644 --- a/src/api/models.ts +++ b/src/api/models.ts @@ -42,6 +42,7 @@ export interface VersionRequest { } export interface VersionResponse { + doc_name: string doc_public_url?: string id: string } @@ -65,6 +66,7 @@ export interface DiffRequest { export interface DiffResponse { breaking?: boolean details?: DiffItem[] + doc_name?: string html?: string id: string markdown?: string @@ -92,4 +94,5 @@ export interface WorkflowVersionRequest { export interface WorkflowVersionResponse { id: string mcp_server_id: string + mcp_server_name: string } diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index b5bf198e..1ede87db 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -174,17 +174,18 @@ ${chalk.dim('$ bump deploy FILE --mcp-server --toke overlay, temporary, ) + const docName = response?.doc_name || documentation if (dryRun) { ux.stdout(ux.colorize('green', 'Definition is valid')) } else if (response) { - process.stdout.write(ux.colorize('green', `Your ${documentation} documentation...`)) + process.stdout.write(ux.colorize('green', `Your ${docName} documentation...`)) ux.stdout( ux.colorize('green', `has received a new ${temporary ? 'preview' : 'deployment'} which will soon be ready at:`), ) ux.stdout(ux.colorize('underline', response.doc_public_url!)) } else { - ux.warn(`Your ${documentation} documentation has not changed`) + ux.warn(`Your ${docName} documentation has not changed`) } } @@ -196,9 +197,10 @@ ${chalk.dim('$ bump deploy FILE --mcp-server --toke mcpServer, token, ) + const mcpServerName = response?.mcp_server_name || mcpServer if (response) { - process.stdout.write(ux.colorize('green', `Your ${mcpServer} MCP server...`)) + process.stdout.write(ux.colorize('green', `Your ${mcpServerName} MCP server...`)) ux.stdout(ux.colorize('green', `has received a new workflow definition which will soon be ready.`)) } else { ux.warn(`Your ${mcpServer} MCP server has not changed.`) diff --git a/src/core/diff.ts b/src/core/diff.ts index 0524315c..7fb3930f 100644 --- a/src/core/diff.ts +++ b/src/core/diff.ts @@ -113,6 +113,7 @@ export class Diff { return { breaking: versionWithDiff.diff_breaking, details: versionWithDiff.diff_details, + doc_name: versionWithDiff.doc_name, id: versionWithDiff.id, markdown: versionWithDiff.diff_markdown, public_url: versionWithDiff.diff_public_url, diff --git a/test/commands/deploy.test.ts b/test/commands/deploy.test.ts index 9837e8e2..e697b6ce 100644 --- a/test/commands/deploy.test.ts +++ b/test/commands/deploy.test.ts @@ -41,6 +41,20 @@ describe('deploy subcommand', () => { expect(stdout).to.contain('http://localhost/doc/1') }) + it('sends new version to Bump, and use docName from response', async () => { + nock('https://bump.sh') + .post('/api/v1/versions', (body) => body.documentation === '42' && !body.branch_name) + .reply(201, {doc_name: 'Cou Cou', doc_public_url: 'http://localhost/doc/1'}) + + const {stderr, stdout} = await runCommand(['deploy', 'examples/valid/openapi.v3.json', '--doc', '42'].join(' ')) + + expect(stderr).to.contain("Let's deploy on Bump.sh... done\n") + expect(stdout).to.contain( + 'Your Cou Cou documentation...has received a new deployment which will soon be ready at:', + ) + expect(stdout).to.contain('http://localhost/doc/1') + }) + it('sends new version to Bump on given branch', async () => { nock('https://bump.sh') .post('/api/v1/versions', (body) => body.documentation === 'coucou' && body.branch_name === 'next') @@ -125,6 +139,19 @@ describe('deploy subcommand', () => { ) }) + it('sends new workflow definition (flower) to Bump, and display doc name', async () => { + nock('https://bump.sh').post('/api/v1/mcp-servers/crab/deploy').reply(201, {mcp_server_name: 'Flower Power'}) + + const {stderr, stdout} = await runCommand( + ['deploy', 'examples/valid/flower/parking.yml', '--mcp-server', 'crab'].join(' '), + ) + + expect(stderr).to.contain("Let's deploy on Bump.sh... done\n") + expect(stdout).to.contain( + 'Your Flower Power MCP server...has received a new workflow definition which will soon be ready.', + ) + }) + it('sends new workflow definition with openapi sources (arazzo) to Bump', async () => { const [definition, references] = await ( await API.load('examples/valid/arazzo/wikimedia.json')