test(cli): add example regression coverage#34
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 238b8804a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { join, resolve } from "node:path"; | ||
| import { spawnSync } from "node:child_process"; | ||
|
|
||
| const root = resolve(new URL("..", import.meta.url).pathname); |
There was a problem hiding this comment.
Resolve script root with fileURLToPath
validate:examples computes root from new URL(...).pathname, which is not a safe filesystem path on non-POSIX setups: it keeps percent-encoding (e.g. spaces as %20) and produces /C:/...-style paths on Windows. In those environments, cwd/cli point to invalid locations and the script fails before running validations. Use fileURLToPath(new URL("..", import.meta.url)) (then path.resolve) so the npm script works reliably across developer machines.
Useful? React with 👍 / 👎.
Summary
Adds CLI regression coverage for public CLI behavior and copyable examples as post-v0.4.0 v1-readiness work.
Release / prior PR context
test(sdk): add public API contract coverage) has merged.test(scanner): add regression fixtures) has merged.docs: design signed manifests for v0.5.0) has merged.Claude / parallel work context
Claude may be implementing v0.5 core signing schemas/canonicalization. This PR is parallel-safe because it only touches CLI tests/docs, examples index text, root scripts, and changelog. It does not touch core source, spec files, signed-manifest design docs, or MCP runtime files.
Files added
packages/cli/src/tests/examples-regression.test.tsscripts/validate-examples.mjsFiles modified
CHANGELOG.mdexamples/README.mdpackage.jsonpackages/cli/README.mdCLI behaviors covered
agentbridge versionreports the CLI package metadata version.agentbridge mcp-configpreserves stdio, Codex, Claude Desktop, Cursor/generic JSON, and v0.4.0 HTTP transport snippets.mcp-configuses placeholder token references and does not leak env-provided tokens or real-looking bearer tokens.agentbridge validateaccepts adopter quickstart manifests.agentbridge validateaccepts scanner regression valid fixtures and fails safely for the invalid fixture.agentbridge generate openapigenerates and validates manifests for both OpenAPI examples.HEAD /reports/{reportId}/exportsoperation.scripts/validate-examples.mjsvalidates built-CLI behavior across valid JSON manifest examples, the intentional invalid fixture, SDK-basic generated output, and both OpenAPI generated manifests.Validation
npx vitest run packages/cli/src/testspassed: 2 files / 28 tests.npm run typecheck:cleanpassed.npm testpassed: 18 files / 216 tests.npm run buildpassed.npm run pack:dry-runpassed.npm run validate:examplespassed.node packages/cli/dist/bin.js versionprinted0.4.0.node packages/cli/dist/bin.js mcp-configpassed and showed stdio/Codex/Claude/Cursor/generic/HTTP snippets.node packages/cli/dist/bin.js validate examples/adopter-quickstart/manifest.basic.jsonpassed.node packages/cli/dist/bin.js generate openapi examples/openapi-regression/catalog-regression.openapi.json --out /tmp/agentbridge.openapi-regression.generated.jsonpassed and reported the skipped HEAD operation.node packages/cli/dist/bin.js validate /tmp/agentbridge.openapi-regression.generated.jsonpassed.Safety / release confirmations
package-lock.jsonchanges.