Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface VersionRequest {
}

export interface VersionResponse {
doc_name: string
doc_public_url?: string
id: string
}
Expand All @@ -65,6 +66,7 @@ export interface DiffRequest {
export interface DiffResponse {
breaking?: boolean
details?: DiffItem[]
doc_name?: string
html?: string
id: string
markdown?: string
Expand Down Expand Up @@ -92,4 +94,5 @@ export interface WorkflowVersionRequest {
export interface WorkflowVersionResponse {
id: string
mcp_server_id: string
mcp_server_name: string
}
8 changes: 5 additions & 3 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
token: flagsBuilder.token(),
}

protected async deployDirectory(

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4

Check warning on line 79 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'deployDirectory' has too many parameters (10). Maximum allowed is 4
dir: string,
dryRun: boolean,
token: string,
Expand Down Expand Up @@ -148,7 +148,7 @@
}
}

protected async deploySingleFile(

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4

Check warning on line 151 in src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'deploySingleFile' has too many parameters (10). Maximum allowed is 4
api: API,
dryRun: boolean,
documentation: string,
Expand All @@ -174,17 +174,18 @@
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`)
}
}

Expand All @@ -196,9 +197,10 @@
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.`)
Expand Down
1 change: 1 addition & 0 deletions src/core/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
return process.env.BUMP_POLLING_PERIOD ? Number(process.env.BUMP_POLLING_PERIOD) : 1000
}

async createDiff(

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4

Check warning on line 32 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'createDiff' has too many parameters (5). Maximum allowed is 4
file1: string,
file2: string,
expires: string | undefined,
Expand Down Expand Up @@ -64,7 +64,7 @@
}
}

async createVersion(

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4

Check warning on line 67 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'createVersion' has too many parameters (7). Maximum allowed is 4
file: string,
documentation: string,
token: string,
Expand Down Expand Up @@ -109,10 +109,11 @@
}

extractDiff(versionWithDiff: VersionResponse & WithDiff): DiffResponse {
// TODO: return a real diff_id in the GET /version API

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'

Check warning on line 112 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Unexpected 'todo' comment: 'TODO: return a real diff_id in the GET...'
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,
Expand All @@ -133,7 +134,7 @@
await this.delay(this.pollingPeriod)
}

public async run(

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4

Check warning on line 137 in src/core/diff.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Async method 'run' has too many parameters (10). Maximum allowed is 4
file1: string,
file2: string | undefined,
documentation: string | undefined,
Expand Down
27 changes: 27 additions & 0 deletions test/commands/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import {API} from '../../src/definition'

nock.disableNetConnect()

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

Check warning on line 8 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Caution: `nock` also has a named export `disableNetConnect`. Check if you meant to write `import {disableNetConnect} from 'nock'` instead

process.env.BUMP_TOKEN = process.env.BUMP_TOKEN || 'BAR'

Expand Down Expand Up @@ -41,6 +41,20 @@
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')
Expand Down Expand Up @@ -92,7 +106,7 @@

it("doesn't try to auto create a documentation", async () => {
nock('https://bump.sh')
.post('/api/v1/validations', (body) => !body.auto_create_documentation)

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on ubuntu-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on windows-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 23 - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node 20 - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4

Check warning on line 109 in test/commands/deploy.test.ts

View workflow job for this annotation

GitHub Actions / Node latest - x64 on macos-latest

Too many nested callbacks (5). Maximum allowed is 4
.reply(200)

await runCommand(
Expand Down Expand Up @@ -125,6 +139,19 @@
)
})

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')
Expand Down
Loading