diff --git a/CHANGELOG.md b/CHANGELOG.md index 39fc4654..f65bbb60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ## [Unreleased] +### Fixed +- **A `--help`/`-h` flag never executes a side-effectful subcommand.** `kit memory --help` (e.g. `kit memory install --help`) previously ran the subcommand instead of printing help, so `kit memory install --help` would actually install the hooks. It now shows help and does nothing else. + ## [1.3.1] - 2026-06-17 ### Security diff --git a/src/commands/memory.ts b/src/commands/memory.ts index e7db8382..be84d4ff 100644 --- a/src/commands/memory.ts +++ b/src/commands/memory.ts @@ -43,6 +43,9 @@ import { export async function cmdMemory(): Promise { const subcommand = process.argv[3]; if (!subcommand || subcommand === "--help" || subcommand === "-h") return memHelp(); + // A --help/-h flag after a subcommand means "show help", never run a + // side-effectful subcommand (e.g. `kit memory install --help` must not install). + if (hasFlag(process.argv, "--help") || hasFlag(process.argv, "-h")) return memHelp(); // One handler per subcommand — keeps this dispatcher flat (was a complexity-132 // if-chain). Each handler reads process.argv itself, so no args thread through.