[fix] nopy: --no-save-history, so -H keeps its id

Closes DOCS-AUDIT §6.2.

Commander derives an option's destination from its long flag with `no-`
stripped, so `--no-history` wrote to the same `options.history` that
`-H, --history <id>` reads. `nopy install -H abc --no-history` set it to
`false`, the id was discarded without a word, and the run fell through to a
full interactive session instead of replaying anything.

The two cannot share a destination, so one spelling had to change, and it is
the boolean that moved: `-H <id>` is what the help text, the README and
`docs/API.md` all use, and "save history" is what the flag actually suppresses
— next to `-s, --save-session`. The old spelling now fails loudly instead of
silently.

Verified by running the CLI, since `nopy.cli.ts` is argv wiring and excluded
from coverage:

    install --no-history                          -> error: unknown option '--no-history'
    install -H nonexistent-id --no-save-history   -> Session not found: nonexistent-id

The second line is the finding: the id used to be destroyed there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCzYTAm9QUhvLNr2EpdagJ
This commit is contained in:
Benjamin Diedrichsen
2026-09-01 12:48:44 +02:00
co-authored by Claude Opus 5
parent 09554b6785
commit 89450cb7bc
+7 -2
View File
@@ -92,7 +92,12 @@ program
.option('-n, --dry-run', 'Show execution plan without running')
.option('-P, --print-only', 'Print deploy commands and exit (no execution)')
.option('-c, --continue-on-error', 'Continue executing after failures')
.option('--no-history', 'Do not save this session to history')
// `--no-save-history`, not `--no-history`: Commander derives the destination
// from the long flag with the `no-` stripped, so `--no-history` wrote to the
// same `options.history` that `-H <id>` does. `-H abc --no-history` set it to
// `false`, the id was silently discarded, and the run fell through to a full
// interactive session instead of replaying anything.
.option('--no-save-history', 'Do not save this session to history')
.action(async (options) => {
await printUpdateNotice();
@@ -139,7 +144,7 @@ program
dryRun: options.dryRun,
printOnly: options.printOnly,
continueOnError,
saveToHistory: options.history !== false && !options.dryRun,
saveToHistory: options.saveHistory !== false && !options.dryRun,
});
// Exit with error code if deployment failed