fix: npm CLI accepts a bare spec path (#100) - #102
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Removes the two auto-correction warnings npm prints on publish.
Contributor
Author
|
Also folded in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
oa validate <spec.yaml>andoa run <spec.yaml>now work without--specin the npm CLI, closing the parity gap with the Python CLI's #98 fix. Commander-side this is simpler than the Python case (noaacsubcommand to protect): each command gains an optional[spec]argument,--specdrops from required to optional, and an exported pure function (reconcileSpecArgs) reconciles the two with the same guardrails:--specalone: unchanged (and not suffix-gated, as before)--spectogether: explicit "not both" errornpm 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 overreconcileSpecArgs. CI's npm job now runsnpm testafter the build, andnpm-publish.ymlgains the test step its typecheck comment promised. Also smoke-tested the built CLI end-to-end: bare path validates,runwith 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
pytest tests/untouched by this change;npm run lintclean; conformance unaffected — no execution semantics changed)npm/tests/cli.test.ts(7 cases), now run in CI and the publish workflowType of change
Checklist