mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
CLI: --version reports the npm package version (#731)
* CLI: --version reports the npm package version npx impeccable --version printed 3.6.0 after the 4.0.0 release because the shim handed every argument to the engine, whose baked-in CLI_VERSION still said 3.6.0. The shim now answers --version and -v from its own package.json, as docs/CLI-CONTRACT.md specifies, without locating or downloading a binary; a test covers both flags. The engine's CLI_VERSION moves to 4.0.0 for the next engine release, with the cli-version golden re-recorded and the delta noted. Co-Authored-By: Claude Code <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vau2X53xGTjjTCXWMVBoNY * CLI shim: --version wins whenever it leads, trailing arguments or not Co-Authored-By: Claude Code <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vau2X53xGTjjTCXWMVBoNY --------- Co-authored-by: Claude Code <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Code
parent
e74a311e40
commit
641ff95502
+9
-1
@@ -68,6 +68,14 @@ async function locate() {
|
||||
return download().catch((err) => { process.stderr.write(`impeccable: ${err.message}\n`); return null; });
|
||||
}
|
||||
|
||||
// `--version` / `-v` is answered by the shim itself: the number users mean
|
||||
// is this npm package's version, not the engine's (docs/CLI-CONTRACT.md).
|
||||
const argv = process.argv.slice(2);
|
||||
if (argv[0] === '--version' || argv[0] === '-v') {
|
||||
process.stdout.write(`${pkg.version}\n`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const bin = await locate();
|
||||
if (!bin) {
|
||||
process.stderr.write(
|
||||
@@ -76,7 +84,7 @@ if (!bin) {
|
||||
);
|
||||
process.exit(127);
|
||||
}
|
||||
const result = spawnSync(bin, process.argv.slice(2), {
|
||||
const result = spawnSync(bin, argv, {
|
||||
stdio: 'inherit',
|
||||
env: { IMPECCABLE_SELF: 'npx impeccable', ...process.env },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user