Bump CLI

2.10.0 · active · verified Wed Apr 22

The Bump CLI is a command-line interface tool designed to interact with the Bump.sh platform, enabling developers to manage their API documentation, hubs, and workflows directly from their development environments. It supports popular API description formats such as OpenAPI (v2.0, v3.x, and partially v3.2), Swagger, and AsyncAPI for documentation, as well as Flower and Arazzo for API workflows. The current stable version is 2.10.0, with releases occurring frequently, often on a monthly or bi-monthly basis, incorporating new features and bug fixes. Key functionalities include validating API documents, publishing them to Bump.sh documentation or hubs, generating human-readable diffs between API definitions, applying overlays, and deploying workflow documents to Managed Control Plane (MCP) servers. The CLI is built with the `oclif` framework in TypeScript and primarily interfaces with the `developers.bump.sh` API.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically deploy an OpenAPI definition to Bump.sh using the `bump-cli` via `npx` and environment variables for authentication. It creates a temporary OpenAPI file, deploys it, and then cleans up.

import { exec } from 'node:child_process';
import * as path from 'node:path';
import * as fs from 'node:fs';

const API_DEFINITION_FILE = 'openapi.yaml';
const BUMP_DOC_SLUG = process.env.BUMP_DOC_SLUG ?? 'my-api-documentation-test';
const BUMP_TOKEN = process.env.BUMP_TOKEN ?? ''; // Set BUMP_TOKEN environment variable

// Create a dummy OpenAPI file for demonstration
const openApiContent = `
openapi: 3.0.0
info:
  title: My Example API
  version: 1.0.0
paths:
  /hello:
    get:
      summary: Returns a greeting
      responses:
        '200':
          description: A successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Hello, World!
`;
fs.writeFileSync(API_DEFINITION_FILE, openApiContent.trim());

console.log(`Deploying ${API_DEFINITION_FILE} to Bump.sh documentation '${BUMP_DOC_SLUG}'...`);

const command = `npx bump deploy ${API_DEFINITION_FILE} --doc ${BUMP_DOC_SLUG} --token ${BUMP_TOKEN} --no-progress`;

exec(command, (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    console.error(`stderr: ${stderr}`);
    // Clean up the dummy file in case of error too
    fs.unlinkSync(API_DEFINITION_FILE);
    return;
  }
  console.log(`stdout: ${stdout}`);
  console.log('Deployment command finished. Check your Bump.sh dashboard!');
  
  // Clean up the dummy file
  fs.unlinkSync(API_DEFINITION_FILE);
});

view raw JSON →