Scalar CLI
$ scalar Official Low RiskScalar CLI (@scalar/cli) provides a modern developer workflow for OpenAPI/Swagger documents: validating specs, bundling multi-file $ref trees, formatting JSON/YAML, running a local mock server, and serving Scalar API Reference docs. Note that scalar document bundle overwrites the input file unless --output is passed.
npm install -g @scalar/cli Local OpenAPI validation, formatting, and bundling with scalar runs instantaneously on disk without an MCP round-trip.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
document validate, bundle, and format run headlessly with clear exit codes, though validation diagnostics are plain text without a native --json flag and mock/reference block as servers.
document validate/bundle/formatrun headlessly- No
--jsondiagnostics flag on validation;mock/referenceare blocking servers
validate is read-only, while bundle and format mutate the input file by default unless --output is explicitly specified.
scalar document bundleoverwrites the source file if--outputis omitted
Cross-platform Node package runnable via npm install -g @scalar/cli or npx @scalar/cli.
- Published on npm as
@scalar/cli
Convenient single CLI combining OpenAPI validation, Prettier-backed formatting, bundling, mocking, and API Reference previews.
- Covers full OpenAPI local lifecycle in one CLI
Official Scalar repository (scalar/scalar) actively maintained under the MIT license.
- Official
scalar/scalarGitHub repository
Clear official guides at guides.scalar.com/scalar/scalar-cli and structured subcommand --help.
- Official documentation at guides.scalar.com
Security, Auth & Guardrails
Local OpenAPI commands need no credentials; Scalar Registry login tokens are stored locally when publishing projects.
MIT open-source CLI; optional hosted Scalar Registry publishing has free and paid tiers.
# Scalar CLI Agent Rules - Always pass `--output <new-path>` with `scalar document bundle` so the source spec is not overwritten in place. - Do not invoke `scalar mock` or `scalar reference` in foreground turns without backgrounding—they run long-lived HTTP servers.
Agent-Ready Command Recipes
Safe Read-Only Queries
scalar document validate openapi.yaml
Checks Swagger 2.0 or OpenAPI 3.0/3.1 conformance without modifying openapi.yaml.
Controlled Writes & Previews
scalar document bundle openapi.yaml --output dist/openapi.bundled.yaml
Writes the resolved bundle to dist/openapi.bundled.yaml rather than overwriting openapi.yaml in place.
Strengths for Agents
- + Unified CLI for OpenAPI validation, bundling, formatting, local mocking, and Scalar Reference previews.
- + Instant zero-install execution via
npx @scalar/cli. - + Clean MIT-licensed codebase backed by Scalar.
Caveats & Pitfalls
- !
scalar document bundleoverwrites the input file in place when--outputis omitted. - !
scalar mockandscalar referencestart persistent HTTP servers that block unless backgrounded.