fix(cli): guard package version metadata#59
Conversation
advancedresearcharray
left a comment
There was a problem hiding this comment.
Rebased onto current main (2c27529) and re-validated locally — npm test -- test/version.test.ts test/cli.test.ts, npm run typecheck, and npm run build all pass on Node 20.
The PR branch was 2 commits behind main; the rebase is clean with no conflicts. A mirrored rebased branch is at advancedresearcharray/mex@codex/guard-package-version (6b49238) until the head branch is fast-forwarded.
@ai-hustle-bro To sync:
git fetch https://github.com/advancedresearcharray/mex codex/guard-package-version
git checkout codex/guard-package-version
git reset --hard FETCH_HEAD
git push --force-with-lease origin codex/guard-package-versionReady for maintainer review — this adds the version-field guard the maintainer requested in #58.
|
@theDakshJaitly This implements the version-field guard you asked for in #58 — ready for maintainer review. Status
Head branch sync git fetch https://github.com/advancedresearcharray/mex codex/guard-package-version
git checkout codex/guard-package-version
git reset --hard FETCH_HEAD
git push --force-with-lease origin codex/guard-package-versionAlternatively, you can merge from the rebased compare view: |
970c2e3 to
d9f25ce
Compare
|
Synced the PR head to current Validation rerun locally on Windows / Node 24: npm test -- test/version.test.ts
npm run typecheck
npm run build
git diff --check upstream/main...HEADResult:
Note: |
Add readVersionFromPackageJson() to validate that package.json contains a non-empty string version before the CLI reads it at runtime. Follow-up to the maintainer request in theDakshJaitly#58 after theDakshJaitly#48 landed.
d9f25ce to
5b24f37
Compare
Summary
readVersionFromPackageJson()guard so package metadata must contain a non-empty stringversion.fileURLToPath+path.joinruntime-read behavior from Fix hard-coded CLI version + add regression test #48 intact.Context
This is the small follow-up suggested in #58 (comment) after #48 landed first.
Validation
npm test -- test/version.test.ts test/cli.test.tsnpm run typechecknpm run buildnpm teststill has the same two Windows path-separator failures unrelated to this change:test/scanner.test.ts > scanEntryPoints > finds src/index.ts as main entrytest/heartbeat.test.ts > heartbeat > flags files with stale last_updated frontmatter