{"library":"rdme","title":"ReadMe CLI","description":"rdme is the official command-line interface (CLI) and GitHub Action for ReadMe, designed to streamline API documentation workflows. It enables users to manage and synchronize API definitions (supporting OpenAPI, Swagger, and Postman specifications) with their API reference documentation hosted on ReadMe.com. Beyond ReadMe-specific integrations, it provides robust API definition validation tools that can be used independently, without requiring a ReadMe account. The current stable version is v10.6.2, with active development indicated by frequent patch and minor releases, often with pre-release (`-next`) versions for upcoming features. A key differentiator is its dual functionality as both a local development tool and an automation agent for CI/CD environments, specifically via GitHub Actions. It has a notable distinction between v9 and v10 regarding compatibility with 'ReadMe Refactored' documentation experiences.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install rdme"],"cli":{"name":"rdme","version":null}},"imports":["import { run } from 'rdme'","import { upload } from 'rdme'","import { validate } from 'rdme'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { validate, run } from 'rdme';\n\nasync function quickstart() {\n  console.log('--- Validating an OpenAPI specification programmatically ---');\n  try {\n    // Assuming 'openapi.yaml' exists in the current directory\n    await validate(['openapi.yaml']); \n    console.log('OpenAPI specification is valid!');\n  } catch (error) {\n    console.error('Validation failed:', error.message);\n    // For a real application, you might exit with an error code here.\n  }\n\n  console.log('\\n--- Running a CLI command programmatically ---');\n  try {\n    // Simulate `rdme openapi validate openapi.yaml`\n    // Note: 'run' may suppress console output for success by default,\n    // or throw on error. Error handling is crucial.\n    console.log('Attempting to run `rdme openapi validate` via `run()`...');\n    await run(['openapi', 'validate', 'openapi.yaml']);\n    console.log('CLI command executed successfully via `run()`.');\n  } catch (error) {\n    console.error('CLI command failed:', error.message);\n  }\n\n  console.log('\\n--- Typical CLI usage via npm ---');\n  console.log('To install globally: npm install -g rdme');\n  console.log('Then, validate: rdme openapi validate openapi.yaml');\n}\n\n// Create a dummy openapi.yaml for demonstration purposes\nimport * as fs from 'node:fs';\nif (!fs.existsSync('openapi.yaml')) {\n  fs.writeFileSync('openapi.yaml', `\nopenapi: 3.0.0\ninfo:\n  title: My API\n  version: 1.0.0\npaths:\n  /items:\n    get:\n      summary: Retrieve items\n      responses:\n        '200':\n          description: A list of items\n`)\n}\n\nquickstart();","lang":"typescript","description":"Demonstrates programmatic usage of `rdme` for OpenAPI validation and general CLI execution, alongside typical command line installation and usage.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}