Skip to content

fix: npm CLI accepts a bare spec path (#100) - #102

Merged
aswhitehouse merged 2 commits into
mainfrom
fix/100-npm-bare-spec-path
Aug 6, 2026
Merged

fix: npm CLI accepts a bare spec path (#100)#102
aswhitehouse merged 2 commits into
mainfrom
fix/100-npm-bare-spec-path

Conversation

@sgriffiths

Copy link
Copy Markdown
Contributor

What changed

oa validate <spec.yaml> and oa run <spec.yaml> now work without --spec in the npm CLI, closing the parity gap with the Python CLI's #98 fix. Commander-side this is simpler than the Python case (no aac subcommand to protect): each command gains an optional [spec] argument, --spec drops from required to optional, and an exported pure function (reconcileSpecArgs) reconciles the two with the same guardrails:

  • --spec alone: unchanged (and not suffix-gated, as before)
  • bare path + --spec together: explicit "not both" error
  • non-YAML bare argument: clear error naming both valid forms
  • neither: clear error naming both valid forms (previously commander's generic "required option" message)

npm README examples now lead with the short form, alongside the oa-clash note from #101.

Tests: first Jest tests in the package — jest.config.js (ts-jest ESM) plus 7 unit tests over reconcileSpecArgs. CI's npm job now runs npm test after the build, and npm-publish.yml gains the test step its typecheck comment promised. Also smoke-tested the built CLI end-to-end: bare path validates, run with a bare path routes through to the provider (fails only on the missing API key offline), and all three error cases print the intended messages with exit 1.

Why

Closes #100. The Python CLI advertises the short form in the main README since 1.6.0; the npm runtime should not dead-end on the same invocation.

How tested

  • All existing tests pass (pytest tests/ untouched by this change; npm run lint clean; conformance unaffected — no execution semantics changed)
  • New tests added — npm/tests/cli.test.ts (7 cases), now run in CI and the publish workflow

Type of change

  • Bug fix

Checklist

  • Code follows project style
  • Self-review completed
  • Version bumped if needed — not needed; changelog entry under Unreleased → Fixed, ships with the next release via the new CI publish path

oa validate <spec.yaml> and oa run <spec.yaml> now work without --spec,
matching the Python CLI. Reconciliation is a pure exported function with
the same guardrails as the Python fix: --spec unchanged, bare path plus
--spec is an explicit error, and a non-YAML bare argument gets a clear
error naming the valid forms.

First Jest tests land with this (jest.config.js + npm/tests/); CI runs
them in the npm job and the publish workflow's typecheck step gains the
test step its comment promised.
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
open-agent-spec Ready Ready Preview Jul 30, 2026 6:45am

Request Review

Removes the two auto-correction warnings npm prints on publish.
@sgriffiths

Copy link
Copy Markdown
Contributor Author

Also folded in npm pkg fix — the 1.6.0 publish surfaced two cosmetic auto-corrections (repository.url normalization, bin path cleaning); future publishes are warning-free. And for the record: npm 1.6.0 is live — Scott published it from the v1.6.0 tag via the new prime-vector org access (shasum matched the pre-verified dry-run byte-for-byte), so the registry side of the release is closed and this PR ships in the next version through the CI publish path.

@aswhitehouse aswhitehouse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aswhitehouse
aswhitehouse merged commit f317c05 into main Aug 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm CLI: accept bare spec path in oa-run/validate for parity with Python oa validate

3 participants