Skip to content

Commit 3d4a4d8

Browse files
committed
Improve docName and mcpServerName
We know commands bump deploy --doc (or --mcp-server) can receive an `id`, and we don't want this id to be used as CLI output So we can use the doc_name (for API version), and mcp_server_name (for MCP Server version), that can be returned by the Bump.sh workflow API: cf bump-sh/bump#8623
1 parent 750ea12 commit 3d4a4d8

4 files changed

Lines changed: 36 additions & 3 deletions

File tree

src/api/models.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface VersionRequest {
4242
}
4343

4444
export interface VersionResponse {
45+
doc_name?: string
4546
doc_public_url?: string
4647
id: string
4748
}
@@ -65,6 +66,7 @@ export interface DiffRequest {
6566
export interface DiffResponse {
6667
breaking?: boolean
6768
details?: DiffItem[]
69+
doc_name?: string
6870
html?: string
6971
id: string
7072
markdown?: string
@@ -92,4 +94,5 @@ export interface WorkflowVersionRequest {
9294
export interface WorkflowVersionResponse {
9395
id: string
9496
mcp_server_id: string
97+
mcp_server_name: string
9598
}

src/commands/deploy.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,18 @@ ${chalk.dim('$ bump deploy FILE --mcp-server <your_mcp_server_id_or_slug> --toke
174174
overlay,
175175
temporary,
176176
)
177+
const docName = response?.doc_name || documentation
177178

178179
if (dryRun) {
179180
ux.stdout(ux.colorize('green', 'Definition is valid'))
180181
} else if (response) {
181-
process.stdout.write(ux.colorize('green', `Your ${documentation} documentation...`))
182+
process.stdout.write(ux.colorize('green', `Your ${docName} documentation...`))
182183
ux.stdout(
183184
ux.colorize('green', `has received a new ${temporary ? 'preview' : 'deployment'} which will soon be ready at:`),
184185
)
185186
ux.stdout(ux.colorize('underline', response.doc_public_url!))
186187
} else {
187-
ux.warn(`Your ${documentation} documentation has not changed`)
188+
ux.warn(`Your ${docName} documentation has not changed`)
188189
}
189190
}
190191

@@ -196,9 +197,10 @@ ${chalk.dim('$ bump deploy FILE --mcp-server <your_mcp_server_id_or_slug> --toke
196197
mcpServer,
197198
token,
198199
)
200+
const mcpServerName = response?.mcp_server_name || mcpServer
199201

200202
if (response) {
201-
process.stdout.write(ux.colorize('green', `Your ${mcpServer} MCP server...`))
203+
process.stdout.write(ux.colorize('green', `Your ${mcpServerName} MCP server...`))
202204
ux.stdout(ux.colorize('green', `has received a new workflow definition which will soon be ready.`))
203205
} else {
204206
ux.warn(`Your ${mcpServer} MCP server has not changed.`)

src/core/diff.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export class Diff {
113113
return {
114114
breaking: versionWithDiff.diff_breaking,
115115
details: versionWithDiff.diff_details,
116+
doc_name: versionWithDiff.doc_name,
116117
id: versionWithDiff.id,
117118
markdown: versionWithDiff.diff_markdown,
118119
public_url: versionWithDiff.diff_public_url,

test/commands/deploy.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ describe('deploy subcommand', () => {
4141
expect(stdout).to.contain('http://localhost/doc/1')
4242
})
4343

44+
it('sends new version to Bump, and use docName from response', async () => {
45+
nock('https://bump.sh')
46+
.post('/api/v1/versions', (body) => body.documentation === '42' && !body.branch_name)
47+
.reply(201, {doc_name: 'Cou Cou', doc_public_url: 'http://localhost/doc/1'})
48+
49+
const {stderr, stdout} = await runCommand(['deploy', 'examples/valid/openapi.v3.json', '--doc', '42'].join(' '))
50+
51+
expect(stderr).to.contain("Let's deploy on Bump.sh... done\n")
52+
expect(stdout).to.contain(
53+
'Your Cou Cou documentation...has received a new deployment which will soon be ready at:',
54+
)
55+
expect(stdout).to.contain('http://localhost/doc/1')
56+
})
57+
4458
it('sends new version to Bump on given branch', async () => {
4559
nock('https://bump.sh')
4660
.post('/api/v1/versions', (body) => body.documentation === 'coucou' && body.branch_name === 'next')
@@ -125,6 +139,19 @@ describe('deploy subcommand', () => {
125139
)
126140
})
127141

142+
it('sends new workflow definition (flower) to Bump, and display doc name', async () => {
143+
nock('https://bump.sh').post('/api/v1/mcp-servers/crab/deploy').reply(201, {mcp_server_name: 'Flower Power'})
144+
145+
const {stderr, stdout} = await runCommand(
146+
['deploy', 'examples/valid/flower/parking.yml', '--mcp-server', 'crab'].join(' '),
147+
)
148+
149+
expect(stderr).to.contain("Let's deploy on Bump.sh... done\n")
150+
expect(stdout).to.contain(
151+
'Your Flower Power MCP server...has received a new workflow definition which will soon be ready.',
152+
)
153+
})
154+
128155
it('sends new workflow definition with openapi sources (arazzo) to Bump', async () => {
129156
const [definition, references] = await (
130157
await API.load('examples/valid/arazzo/wikimedia.json')

0 commit comments

Comments
 (0)