bump-cli 2.9.12 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -9
- package/dist/api/index.js +1 -1
- package/dist/api/models.d.ts +6 -2
- package/dist/commands/deploy.js +5 -3
- package/dist/core/diff.d.ts +7 -4
- package/dist/core/diff.js +12 -12
- package/dist/core/overlay.d.ts +1 -0
- package/dist/core/overlay.js +14 -4
- package/dist/core/schemas/arazzo-schemas/index.d.ts +7 -0
- package/dist/core/schemas/arazzo-schemas/index.js +8 -0
- package/dist/core/schemas/arazzo-schemas/v1.0/schema.json +792 -0
- package/dist/core/schemas/flower-schemas/v0.1/schema.json +146 -5
- package/dist/core/workflow-deploy.js +2 -3
- package/dist/definition.d.ts +22 -9
- package/dist/definition.js +129 -74
- package/dist/index.d.ts +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -9,14 +9,20 @@
|
|
|
9
9
|
<a href="https://bump.sh/users/sign_up">Sign up</a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
|
-
The Bump.sh CLI is used to interact with API documentation and
|
|
12
|
+
The Bump.sh CLI is used to interact with API documentation, hubs and workflows hosted on Bump.sh from your choice of popular API description formats: OpenAPI, Swagger, or AsyncAPI for API documentation. Flower or Arazzo for API workflows.
|
|
13
13
|
|
|
14
14
|
Using [OpenAPI](https://github.com/OAI/OpenAPI-Specification) (v3.x and v2.0) or [AsyncAPI](https://www.asyncapi.com/docs/reference/specification/latest) (2.x), you can do any of the following:
|
|
15
15
|
|
|
16
16
|
- Validate an API document before publishing to your documentation.
|
|
17
|
-
- Publish an API document to your Bump.sh documentation or hubs.
|
|
18
|
-
- Compare two API documents to generate a human-readable diff from your API definition.
|
|
19
|
-
Under the hood, it uses the API of [developers.bump.sh](https://developers.bump.sh). And is built with the [`oclif`](https://oclif.io) framework in Typescript.
|
|
17
|
+
- [Publish an API document](#the-deploy-command) to your Bump.sh documentation or hubs.
|
|
18
|
+
- [Compare two API documents](#the-diff-command) to generate a human-readable diff from your API definition.
|
|
19
|
+
Under the hood, it uses the workspace API of [developers.bump.sh](https://developers.bump.sh/doc/workspace/). And is built with the [`oclif`](https://oclif.io) framework in Typescript.
|
|
20
|
+
|
|
21
|
+
Using [Flower](https://docs.bump.sh/help/mcp-servers/specification-support/flower-support/) or [Arazzo](https://docs.bump.sh/arazzo/v1.0/), you can:
|
|
22
|
+
|
|
23
|
+
- [Deploy a workflow document](#deploy-a-workflow-document-on-your-mcp-server) to your Bump.sh MCP server
|
|
24
|
+
|
|
25
|
+
Have fun designing APIs ✨.
|
|
20
26
|
|
|
21
27
|
[](https://npmjs.org/package/bump-cli)
|
|
22
28
|
[](https://github.com/bump-sh/cli/actions/workflows/checks.yml)
|
|
@@ -77,7 +83,7 @@ npx bump --help
|
|
|
77
83
|
|
|
78
84
|
### Can I install Bump.sh CLI without using NodeJS?
|
|
79
85
|
|
|
80
|
-
Unfortunately, at the moment we only support the Node environment. However, you can download a standalone package directly from the [latest Github release](https://github.com/bump-sh/cli/releases) assets which you can run as a standalone binary. Or you can push your documentation using [our API](https://developers.bump.sh/) (advanced usage only).
|
|
86
|
+
Unfortunately, at the moment we only support the Node environment. However, you can download a standalone package directly from the [latest Github release](https://github.com/bump-sh/cli/releases) assets which you can run as a standalone binary. Or you can push your documentation using [our API](https://developers.bump.sh/doc/workspace/) (advanced usage only).
|
|
81
87
|
|
|
82
88
|
## Usage
|
|
83
89
|
|
|
@@ -177,15 +183,25 @@ Please check `bump deploy --help` for more usage details.
|
|
|
177
183
|
|
|
178
184
|
#### Deploy a workflow document on your MCP server
|
|
179
185
|
|
|
180
|
-
Use the `bump deploy` command with the `--mcp-server` flag to push a
|
|
186
|
+
Use the `bump deploy` command with the `--mcp-server` flag to push a
|
|
187
|
+
workflow definition to your MCP server.
|
|
188
|
+
|
|
189
|
+
Documents following either [Arazzo](https://docs.bump.sh/arazzo/v1.0/)
|
|
190
|
+
or
|
|
191
|
+
[Flower](https://docs.bump.sh/help/mcp-servers/specification-support/flower-support/)
|
|
192
|
+
specification are supported.
|
|
193
|
+
|
|
181
194
|
|
|
182
195
|
```shell
|
|
183
|
-
bump deploy path/to/flower-document.yml --mcp-server my-mcp-server-id-or-slug --token $BUMP_TOKEN
|
|
196
|
+
bump deploy path/to/flower-or-arazzo-document.yml --mcp-server my-mcp-server-id-or-slug --token $BUMP_TOKEN
|
|
184
197
|
```
|
|
185
198
|
|
|
186
199
|
> [!NOTE]
|
|
187
200
|
> You can find your own `mcp-server-id-or-slug` and `$BUMP_TOKEN` api key from your [MCP server settings](https://bump.sh/dashboard) at 'https://bump.sh/{your-organization}/workflow/set/{mcp-server-id}/tokens'.
|
|
188
201
|
|
|
202
|
+
More details about the MCP server feature are available on [this
|
|
203
|
+
dedicated help section](https://docs.bump.sh/help/mcp-servers/).
|
|
204
|
+
|
|
189
205
|
This feature is currently in closed beta.
|
|
190
206
|
Request an early access at hello@bump.sh
|
|
191
207
|
|
|
@@ -268,7 +284,7 @@ bump preview path/to/file.json
|
|
|
268
284
|
You can also preview a document available via a URL:
|
|
269
285
|
|
|
270
286
|
```shell
|
|
271
|
-
bump preview https://developers.bump.sh/source.yaml
|
|
287
|
+
bump preview https://developers.bump.sh/doc/workspace/source.yaml
|
|
272
288
|
```
|
|
273
289
|
|
|
274
290
|
#### Live preview
|
|
@@ -368,7 +384,7 @@ For example to generate a preview:
|
|
|
368
384
|
> Your preview is visible at: https://bump.sh/preview/42
|
|
369
385
|
```
|
|
370
386
|
|
|
371
|
-
Please note that even if CLI is running locally, by default requests are sent to [Bump.sh API](https://developers.bump.sh/).
|
|
387
|
+
Please note that even if CLI is running locally, by default requests are sent to [Bump.sh API](https://developers.bump.sh/doc/workspace/).
|
|
372
388
|
|
|
373
389
|
If you have a local version of the Bump.sh API, you can run CLI 100% in local environment
|
|
374
390
|
by setting the environment variable `BUMP_HOST`:
|
package/dist/api/index.js
CHANGED
|
@@ -12,7 +12,7 @@ class BumpApi {
|
|
|
12
12
|
headers: this.authorizationHeader(token),
|
|
13
13
|
});
|
|
14
14
|
postDiff = (body) => this.client.post('/diffs', body);
|
|
15
|
-
postMCPServerDeploy = (mcpServerIdOrSlug, body, token) => this.client.post(`/
|
|
15
|
+
postMCPServerDeploy = (mcpServerIdOrSlug, body, token) => this.client.post(`/mcp-servers/${mcpServerIdOrSlug}/deploy`, body, {
|
|
16
16
|
headers: this.authorizationHeader(token),
|
|
17
17
|
});
|
|
18
18
|
postPreview = (body) => this.client.post('/previews', body);
|
package/dist/api/models.d.ts
CHANGED
|
@@ -17,8 +17,9 @@ export interface PreviewRequest {
|
|
|
17
17
|
references?: Reference[];
|
|
18
18
|
}
|
|
19
19
|
export interface Reference {
|
|
20
|
-
content
|
|
21
|
-
location
|
|
20
|
+
content: string;
|
|
21
|
+
location: string;
|
|
22
|
+
name?: string;
|
|
22
23
|
}
|
|
23
24
|
export interface VersionRequest {
|
|
24
25
|
auto_create_documentation?: boolean;
|
|
@@ -33,6 +34,7 @@ export interface VersionRequest {
|
|
|
33
34
|
unpublished?: boolean;
|
|
34
35
|
}
|
|
35
36
|
export interface VersionResponse {
|
|
37
|
+
doc_name: string;
|
|
36
38
|
doc_public_url?: string;
|
|
37
39
|
id: string;
|
|
38
40
|
}
|
|
@@ -69,8 +71,10 @@ export interface DiffItem {
|
|
|
69
71
|
}
|
|
70
72
|
export interface WorkflowVersionRequest {
|
|
71
73
|
definition: string;
|
|
74
|
+
references?: Reference[];
|
|
72
75
|
}
|
|
73
76
|
export interface WorkflowVersionResponse {
|
|
74
77
|
id: string;
|
|
75
78
|
mcp_server_id: string;
|
|
79
|
+
mcp_server_name: string;
|
|
76
80
|
}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -110,23 +110,25 @@ ${chalk.dim('$ bump deploy FILE --mcp-server <your_mcp_server_id_or_slug> --toke
|
|
|
110
110
|
async deploySingleFile(api, dryRun, documentation, token, hub, autoCreate, documentationName, branch, overlay, temporary) {
|
|
111
111
|
ux.action.status = `...a new version to your ${documentation} documentation`;
|
|
112
112
|
const response = await new CoreDeploy(this.bump).run(api, dryRun, documentation, token, hub, autoCreate, documentationName, branch, overlay, temporary);
|
|
113
|
+
const docName = response?.doc_name || documentation;
|
|
113
114
|
if (dryRun) {
|
|
114
115
|
ux.stdout(ux.colorize('green', 'Definition is valid'));
|
|
115
116
|
}
|
|
116
117
|
else if (response) {
|
|
117
|
-
process.stdout.write(ux.colorize('green', `Your ${
|
|
118
|
+
process.stdout.write(ux.colorize('green', `Your ${docName} documentation...`));
|
|
118
119
|
ux.stdout(ux.colorize('green', `has received a new ${temporary ? 'preview' : 'deployment'} which will soon be ready at:`));
|
|
119
120
|
ux.stdout(ux.colorize('underline', response.doc_public_url));
|
|
120
121
|
}
|
|
121
122
|
else {
|
|
122
|
-
ux.warn(`Your ${
|
|
123
|
+
ux.warn(`Your ${docName} documentation has not changed`);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
async deploySingleWorkflowFile(workflowDefinition, mcpServer, token) {
|
|
126
127
|
ux.action.status = `...a new workflow definition to your ${mcpServer} MCP server`;
|
|
127
128
|
const response = await new CoreWorkflowDeploy(this.bump).run(workflowDefinition, mcpServer, token);
|
|
129
|
+
const mcpServerName = response?.mcp_server_name || mcpServer;
|
|
128
130
|
if (response) {
|
|
129
|
-
process.stdout.write(ux.colorize('green', `Your ${
|
|
131
|
+
process.stdout.write(ux.colorize('green', `Your ${mcpServerName} MCP server...`));
|
|
130
132
|
ux.stdout(ux.colorize('green', `has received a new workflow definition which will soon be ready.`));
|
|
131
133
|
}
|
|
132
134
|
else {
|
package/dist/core/diff.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Config } from '@oclif/core';
|
|
2
2
|
import { BumpApi } from '../api/index.js';
|
|
3
3
|
import { DiffResponse, VersionResponse, WithDiff } from '../api/models.js';
|
|
4
|
+
export interface DiffResult extends DiffResponse {
|
|
5
|
+
doc_name?: string;
|
|
6
|
+
}
|
|
4
7
|
export declare class Diff {
|
|
5
8
|
static readonly TIMEOUT = 120;
|
|
6
9
|
private _bump;
|
|
@@ -11,14 +14,14 @@ export declare class Diff {
|
|
|
11
14
|
createDiff(file1: string, file2: string, expires: string | undefined, overlays1?: string[] | undefined, overlays2?: string[] | undefined): Promise<DiffResponse | undefined>;
|
|
12
15
|
createVersion(file: string, documentation: string, token: string, hub: string | undefined, branch_name: string | undefined, previous_version_id?: string | undefined, overlays?: string[] | undefined): Promise<VersionResponse | undefined>;
|
|
13
16
|
d(formatter: any, ...args: any[]): void;
|
|
14
|
-
extractDiff(versionWithDiff: VersionResponse & WithDiff):
|
|
17
|
+
extractDiff(versionWithDiff: VersionResponse & WithDiff): DiffResult;
|
|
15
18
|
isVersion(result: DiffResponse | VersionResponse): result is VersionResponse;
|
|
16
19
|
isVersionWithDiff(result: DiffResponse | (VersionResponse & WithDiff)): result is VersionResponse & WithDiff;
|
|
17
20
|
pollingDelay(): Promise<void>;
|
|
18
|
-
run(file1: string, file2: string | undefined, documentation: string | undefined, hub: string | undefined, branch: string | undefined, token: string | undefined, format: string, expires?: string | undefined, overlays1?: string[] | undefined, overlays2?: string[] | undefined): Promise<
|
|
19
|
-
waitResult(
|
|
21
|
+
run(file1: string, file2: string | undefined, documentation: string | undefined, hub: string | undefined, branch: string | undefined, token: string | undefined, format: string, expires?: string | undefined, overlays1?: string[] | undefined, overlays2?: string[] | undefined): Promise<DiffResult | undefined>;
|
|
22
|
+
waitResult(apiResponse: DiffResponse | VersionResponse, token: string | undefined, opts: {
|
|
20
23
|
format: string;
|
|
21
24
|
timeout: number;
|
|
22
|
-
}): Promise<
|
|
25
|
+
}): Promise<DiffResult>;
|
|
23
26
|
private delay;
|
|
24
27
|
}
|
package/dist/core/diff.js
CHANGED
|
@@ -82,6 +82,7 @@ export class Diff {
|
|
|
82
82
|
return {
|
|
83
83
|
breaking: versionWithDiff.diff_breaking,
|
|
84
84
|
details: versionWithDiff.diff_details,
|
|
85
|
+
doc_name: versionWithDiff.doc_name,
|
|
85
86
|
id: versionWithDiff.id,
|
|
86
87
|
markdown: versionWithDiff.diff_markdown,
|
|
87
88
|
public_url: versionWithDiff.diff_public_url,
|
|
@@ -122,35 +123,34 @@ export class Diff {
|
|
|
122
123
|
}
|
|
123
124
|
return undefined;
|
|
124
125
|
}
|
|
125
|
-
async waitResult(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
async waitResult(apiResponse, token, opts) {
|
|
127
|
+
let diffResult = { id: apiResponse.id };
|
|
128
|
+
const pollingResponse = await (this.isVersion(apiResponse) && token
|
|
129
|
+
? this.bumpClient.getVersion(apiResponse.id, token)
|
|
130
|
+
: this.bumpClient.getDiff(apiResponse.id, opts.format));
|
|
129
131
|
if (opts.timeout <= 0) {
|
|
130
132
|
throw new CLIError('We were unable to compute your documentation diff. Sorry about that. Please try again later. If the error persists, please contact support at https://bump.sh.');
|
|
131
133
|
}
|
|
132
134
|
switch (pollingResponse.status) {
|
|
133
135
|
case 200: {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
diff = this.extractDiff(diff);
|
|
137
|
-
}
|
|
136
|
+
const diff = pollingResponse.data;
|
|
137
|
+
diffResult = this.isVersionWithDiff(diff) ? this.extractDiff(diff) : diff;
|
|
138
138
|
this.d('Received diff:');
|
|
139
|
-
this.d(
|
|
140
|
-
return
|
|
139
|
+
this.d(diffResult);
|
|
140
|
+
return diffResult;
|
|
141
141
|
break;
|
|
142
142
|
}
|
|
143
143
|
case 202: {
|
|
144
144
|
this.d('Waiting 1 sec before next poll');
|
|
145
145
|
await this.pollingDelay();
|
|
146
|
-
return this.waitResult(
|
|
146
|
+
return this.waitResult(apiResponse, token, {
|
|
147
147
|
format: opts.format,
|
|
148
148
|
timeout: opts.timeout - 1,
|
|
149
149
|
});
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
return
|
|
153
|
+
return diffResult;
|
|
154
154
|
}
|
|
155
155
|
async delay(ms) {
|
|
156
156
|
return new Promise((resolve) => {
|
package/dist/core/overlay.d.ts
CHANGED
package/dist/core/overlay.js
CHANGED
|
@@ -98,6 +98,18 @@ export class Overlay {
|
|
|
98
98
|
humanName(action) {
|
|
99
99
|
return action.description ? `Action '${action.description}'` : 'Action';
|
|
100
100
|
}
|
|
101
|
+
// Deep merge objects using a module (built-in spread operator is only shallow)
|
|
102
|
+
mergeWithEnumDedup(target, update) {
|
|
103
|
+
const merger = mergician({
|
|
104
|
+
afterEach(options) {
|
|
105
|
+
if (options.key === 'enum' && Array.isArray(options.mergeVal)) {
|
|
106
|
+
return [...new Set(options.mergeVal)];
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
appendArrays: true,
|
|
110
|
+
});
|
|
111
|
+
return merger(target, update);
|
|
112
|
+
}
|
|
101
113
|
// The last path entry (e.g. "'price']" or '0]') contains a final
|
|
102
114
|
// ']' so we need to remove it AND we need to replace single quotes
|
|
103
115
|
// to double quotes AND FINALLY parse the element to transform the
|
|
@@ -118,13 +130,11 @@ export class Overlay {
|
|
|
118
130
|
}
|
|
119
131
|
update(spec, parent, update, property_or_index) {
|
|
120
132
|
try {
|
|
121
|
-
// Deep merge objects using a module (built-in spread operator is only shallow)
|
|
122
|
-
const merger = mergician({ appendArrays: true });
|
|
123
133
|
if (property_or_index === '$') {
|
|
124
134
|
// You can't actually merge an update on a root object
|
|
125
135
|
// target with the jsonpathly lib, this is just us merging
|
|
126
136
|
// the given update with the whole spec.
|
|
127
|
-
spec =
|
|
137
|
+
spec = this.mergeWithEnumDedup(spec, update);
|
|
128
138
|
}
|
|
129
139
|
else if (property_or_index !== undefined) {
|
|
130
140
|
const targetObject = parent[property_or_index];
|
|
@@ -132,7 +142,7 @@ export class Overlay {
|
|
|
132
142
|
parent[property_or_index] =
|
|
133
143
|
Array.isArray(targetObject) && Array.isArray(update)
|
|
134
144
|
? [...targetObject, ...update]
|
|
135
|
-
:
|
|
145
|
+
: this.mergeWithEnumDedup(targetObject, update);
|
|
136
146
|
}
|
|
137
147
|
else {
|
|
138
148
|
parent[property_or_index] = update;
|