fix: forge-patterns bin entry pointed at non-existent dist/cli.js#202
Conversation
The package.json bin block declared "forge-patterns": "dist/cli.js" but no src/cli.ts ever existed and dist/cli.js was never built. Every npm consumer of v1.4.0..v1.14.0 that ran 'npx @forgespace/core forge-patterns' got an ENOENT — a silent breakage that has been live for over a month. The actual implementation is scripts/forge-patterns-cli.js, which is already published via pkg.files and has a node shebang. This commit: - points bin.forge-patterns at scripts/forge-patterns-cli.js - marks scripts/forge-patterns-cli.js as executable - adds src/bin-entries.test.js (parameterised over pkg.bin) to assert that every bin entry resolves to a real file, has a node shebang, and lives under a path declared in pkg.files - bumps VERSION + package.json to 1.14.1 - regenerates etc/core.api.md (api-extractor picked up VERSION change) - CHANGELOG entry under [1.14.1]
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughVersion 1.14.1 fixes a regression in the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.17.0)package.json┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m src/bin-entries.test.js┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m src/index.ts┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Project Scorecard |
Forge AI Quality Gate✅ Passed — Score 100/100 (A+) · Delta +0 · 0 new findings Category scores
Powered by Forge AI Action · forgespace.co |
|
Parameterised test (tests/bin-entries.test.ts) that iterates over every pkg.bin entry and asserts: - target file exists on disk - target starts with a node shebang - target lives under a directory declared in pkg.files This prevents the regression class that shipped in @forgespace/core v1.4.0-v1.14.0, where bin.forge-patterns pointed at a non-existent dist/cli.js for over a year. See Forge-Space/core#202 for the original incident. Mutation-tested locally: reverting bin.forge-ai-init to point at a non-existent path makes the test fail on the existence assertion, proving the guard catches real breakage.
Parameterised test (src/__tests__/bin-entries.test.ts) iterating over every pkg.bin entry to assert target existence, node shebang, and pkg.files coverage. Prevents the regression class that shipped in @forgespace/core v1.4.0-v1.14.0. See Forge-Space/core#202. Mutation-tested locally.
Parameterised test (src/__tests__/bin-entries.unit.test.ts) that iterates over every pkg.bin entry and asserts: - target file exists on disk - target starts with a node shebang - target lives under a directory declared in pkg.files Prevents the regression class that shipped in @forgespace/core v1.4.0-v1.14.0 where bin.forge-patterns pointed at a non-existent dist/cli.js for over a year. See Forge-Space/core#202. Mutation-tested locally: reverting the bin to point at a non-existent path makes the test fail, proving the guard catches real breakage.
* test: add bin-entries regression guard Parameterised test (tests/bin-entries.test.ts) that iterates over every pkg.bin entry and asserts: - target file exists on disk - target starts with a node shebang - target lives under a directory declared in pkg.files This prevents the regression class that shipped in @forgespace/core v1.4.0-v1.14.0, where bin.forge-patterns pointed at a non-existent dist/cli.js for over a year. See Forge-Space/core#202 for the original incident. Mutation-tested locally: reverting bin.forge-ai-init to point at a non-existent path makes the test fail on the existence assertion, proving the guard catches real breakage. * ci: build dist before jest so bin-entries test can resolve files Without pretest=build, bin-entries.test.ts asserts against dist/index.js that does not exist yet in CI (jest runs before the build step), producing a false-positive failure. A pretest hook guarantees dist/ exists in every invocation path (CI, local, validate).
* test: add bin-entries regression guard Parameterised test (src/__tests__/bin-entries.test.ts) iterating over every pkg.bin entry to assert target existence, node shebang, and pkg.files coverage. Prevents the regression class that shipped in @forgespace/core v1.4.0-v1.14.0. See Forge-Space/core#202. Mutation-tested locally. * ci: build dist before jest so bin-entries test can resolve files Without pretest=build, bin-entries.test.ts asserts against dist/index.js that does not exist yet in CI (jest runs before the build step), producing a false-positive failure. A pretest hook guarantees dist/ exists in every invocation path (CI, local, validate). * ci: also build before test:coverage so bin-entries resolves dist/ CI runs `npm run test:coverage` (not `npm test`) so the pretest hook did not fire and dist/ was still missing when bin-entries.test.ts asserted on dist/index.js. Add matching pretest:coverage hook to cover every test lifecycle invocation path.
* test: add bin-entries regression guard Parameterised test (src/__tests__/bin-entries.unit.test.ts) that iterates over every pkg.bin entry and asserts: - target file exists on disk - target starts with a node shebang - target lives under a directory declared in pkg.files Prevents the regression class that shipped in @forgespace/core v1.4.0-v1.14.0 where bin.forge-patterns pointed at a non-existent dist/cli.js for over a year. See Forge-Space/core#202. Mutation-tested locally: reverting the bin to point at a non-existent path makes the test fail, proving the guard catches real breakage. * ci: build dist before jest so bin-entries test can resolve files Without pretest=build, bin-entries.test.ts asserts against dist/index.js that does not exist yet in CI (jest runs before the build step), producing a false-positive failure. A pretest hook guarantees dist/ exists in every invocation path (CI, local, validate). * ci: also build before test:coverage so bin-entries resolves dist/ CI runs `npm run test:coverage` (not `npm test`) so the pretest hook did not fire and dist/ was still missing when bin-entries.unit.test.ts asserted on dist/index.js. Add matching pretest:coverage hook to cover every test lifecycle invocation path.



Summary
package.jsondeclaredbin.forge-patterns: "dist/cli.js", butsrc/cli.tswas never created anddist/cli.jswas never built. Every npm consumer of v1.4.0–v1.14.0 that rannpx @forgespace/core forge-patternsgot anENOENT— a silent breakage that has been live since March 6, 2026 (commit f0d1aa3).bin.forge-patternsat the existingscripts/forge-patterns-cli.js(already shipped underpkg.files, has a#!/usr/bin/env nodeshebang). Marked the script executable.src/bin-entries.test.js(parameterised overpkg.bin, 19 generated tests) that asserts every bin entry resolves to a real file, has a node shebang, and lives under a path declared inpkg.files. Verified locally that this test fails whenbin.forge-patternspoints back at the missingdist/cli.js, so it would have caught the original regression.1.14.0→1.14.1. Regeneratedetc/core.api.md(api-extractor picked up theVERSIONconstant change).How the bug slipped in
PR #76 (March 6) added three new bin entries (
forge-scorecard,forge-policy, …) but kept the pre-existingforge-patterns: dist/cli.jsline untouched. That line had been pointing at a non-existent target since the very first commit. There was no test asserting bin entries resolved, so npm published happily for a year.Test plan
npm run build— greennpm test— 29 suites, 674 tests pass (19 of which are the new bin-entries assertions)npm run lint:check— no errors (9 pre-existing magic-number warnings, untouched)npm run format:check— greennpm run api:check— greenbin.forge-patternstodist/cli.js, ran the new test, confirmed it fails on the existence assertion. Restored.Summary by CodeRabbit
Bug Fixes
forge-patternsCLI command resolution, which was pointing to a non-existent target file and is now properly configured.Tests