{"library":"rollbar-cli","title":"Rollbar CLI","description":"The `rollbar-cli` package provides a command-line interface for interacting with the Rollbar API, focusing on critical development and deployment tasks. Its primary functions include uploading JavaScript source maps and notifying Rollbar of new code deployments. The current stable version is 0.2.1, which primarily includes an internal dependency security fix. While a formal release cadence isn't explicitly defined, updates appear to be driven by feature additions or security patches as needed. Key differentiators lie in its direct integration with the Rollbar platform, simplifying the workflow for developers needing to associate minified production code with its original source for debugging, and to track deployment lifecycles. It offers both traditional source map uploads and a newer method (since v0.2.0) for zipping and uploading multiple maps as a single file.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install rollbar-cli"],"cli":{"name":"rollbar-cli","version":null}},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { execSync } from 'child_process';\nimport path from 'path';\n\nconst ROLLBAR_ACCESS_TOKEN = process.env.ROLLBAR_ACCESS_TOKEN ?? '';\nconst ROLLBAR_URL_PREFIX = 'https://cdn.example.com/assets/'; // Must match your asset host\nconst ROLLBAR_CODE_VERSION = process.env.GIT_SHA ?? '1.0.0'; // Unique version for your code\nconst BUILD_DIR = path.resolve(__dirname, './dist'); // Your compiled output directory\nconst ROLLBAR_ENVIRONMENT = 'production';\n\nif (!ROLLBAR_ACCESS_TOKEN) {\n  console.error('Error: ROLLBAR_ACCESS_TOKEN environment variable is not set.');\n  process.exit(1);\n}\n\nfunction runCliCommand(command: string) {\n  try {\n    console.log(`Executing: rollbar-cli ${command}`);\n    const output = execSync(`rollbar-cli ${command}`, { encoding: 'utf8', stdio: 'inherit' });\n    console.log(output);\n  } catch (error: any) {\n    console.error(`Failed to execute Rollbar CLI command: ${command}`);\n    console.error(error.message);\n    process.exit(1);\n  }\n}\n\n// 1. Upload source maps\nrunCliCommand(`upload-sourcemaps ${BUILD_DIR} \\\n  --access-token ${ROLLBAR_ACCESS_TOKEN} \\\n  --url-prefix '${ROLLBAR_URL_PREFIX}' \\\n  --code-version ${ROLLBAR_CODE_VERSION} \\\n  --next`); // Using the --next option for zip upload\n\n// 2. Notify Rollbar of a successful deployment\nrunCliCommand(`notify-deploy \\\n  --access-token ${ROLLBAR_ACCESS_TOKEN} \\\n  --code-version ${ROLLBAR_CODE_VERSION} \\\n  --environment ${ROLLBAR_ENVIRONMENT} \\\n  --status succeeded`);\n\nconsole.log('\\nRollbar CLI operations completed successfully.');","lang":"typescript","description":"Demonstrates how to programmatically execute `rollbar-cli` commands to upload source maps and notify a deployment from a Node.js script, suitable for CI/CD pipelines.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}