Skip to content

fix(manifest): preserve dynamic TS arg metadata in help output#536

Merged
jackwener merged 2 commits intojackwener:mainfrom
pi-dal:codex/fix-manifest-help-output
Mar 28, 2026
Merged

fix(manifest): preserve dynamic TS arg metadata in help output#536
jackwener merged 2 commits intojackwener:mainfrom
pi-dal:codex/fix-manifest-help-output

Conversation

@pi-dal
Copy link
Copy Markdown
Contributor

@pi-dal pi-dal commented Mar 28, 2026

Description

This PR fixes a production-only manifest/help gap for TS adapters.

build-manifest currently relies on static source parsing for TS command metadata. That works for literal arg definitions, but it drops or corrupts metadata when adapters use runtime values such as shared choice arrays or computed help text. In practice this causes manifest-backed commands to lose choices, lose help text, or mis-parse defaults in dist even though the source adapter registers the correct metadata.

This change hydrates TS manifest entries from the runtime-registered command metadata during manifest compilation, while keeping YAML handling unchanged. It also shortens long choices lists in the appended help footer so manifest-backed help stays readable.

Concrete regressions covered by this PR:

  • chatgpt/model now keeps its MODEL_CHOICES in dist/cli-manifest.json
  • chatgpt/ask and chatgpt/send now keep their model choices in dist/cli-manifest.json
  • chatgpt/ask no longer mis-parses the timeout default as "30)"
  • help footers now summarize long choices lists instead of printing the entire array inline

Related issue:

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

Verified locally:

npm run build
npx vitest run src/build-manifest.test.ts src/serialization.test.ts

Observed results:

  • npm run build succeeded
  • npx vitest run src/build-manifest.test.ts src/serialization.test.ts passed (2 files, 8 tests)

Example output after the fix:

$ node dist/main.js chatgpt model --help
...
  <model>: auto, instant, thinking, 5.2-instant, ... (+1 more)

$ node dist/main.js chatgpt ask --help
...
  --model: auto, instant, thinking, 5.2-instant, ... (+1 more)

@jackwener jackwener force-pushed the codex/fix-manifest-help-output branch from 68715ad to 9d97797 Compare March 28, 2026 06:17
@jackwener jackwener merged commit 5ae9658 into jackwener:main Mar 28, 2026
11 checks passed
@jackwener jackwener mentioned this pull request Mar 28, 2026
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.

2 participants