ac15999ac9b4
in a Koh 2 repo, refuse the commands Koh 2 reads differently or lacks, pointing at koh migrate, and keep remote and update Koh 3's (3.2.9)
- time
- 2026-09-28 18:20 UTC · 2 weeks ago
- machine
- Junes-MacBook-Pro.local
- agent
- claude-opus-5-5
- session
- clear feedback
- parent
- 8d1444aebca9
↓ koh-ac15999a.tar.gzatlas at this save
files changed4 files
VERSION+1 −1src/cli/handover.v+9 −1tests/cli_test.v+11 −0v.mod+1 −1src/cli/handover.v+9 −1
@@ -7,6 +7,8 @@77 //! Koh that owns it.88 //!99 //! `migrate` is the exception: it is how such a repo stops being a Koh 2 repo.10+//! Commands about the machine rather than the repo stay Koh 3's, and a command11+//! Koh 2 reads differently, or lacks, is refused with the way forward.1012 1113 module cli1214 @@ -20,11 +22,17 @@2022 return2123 }2224 command := argv[1]23- if command in ['migrate', 'man', 'help', '--help', '-h', '--version', '-v'] {25+ if command in ['migrate', 'man', 'help', '--help', '-h', '--version', '-v', 'remote', 'update'] {2426 return2527 }2628 if !inside_koh2_repo(os.getwd()) {2729 return30+ }31+ // Koh 2's `view` sets visibility, its `steal` downloads a URL, its `doctor`32+ // checks something else, and it has no `build` or `strip`.33+ if command in ['view', 'steal', 'doctor', 'build', 'strip'] {34+ eprintln(' ${fmt.red(fmt.glyph_fail)} this is a Koh 2 repo, where "koh ${command}" is not Koh 3\'s — run "koh migrate" to convert it')35+ exit(1)2836 }2937 target := koh2_binary()3038 if target == '' {tests/cli_test.v+11 −0
@@ -1321,6 +1321,17 @@13211321 assert handoff.err.contains('Koh 2 repo')13221322 assert handoff.err.trim_space().split_into_lines().len == 113231323 assert handoff.out.trim_space() == 'handoff:status --json'1324+ // A command Koh 2 reads differently, or lacks, is refused rather than handed off.1325+ for command in ['view', 'strip', 'build', 'doctor', 'steal'] {1326+ refused := run_home_with_path(legacy, home, fake, command)1327+ assert refused.code == 1, command1328+ assert !refused.out.contains('handoff'), command1329+ assert refused.err.contains('koh migrate'), refused.err1330+ }1331+ // And one that belongs to the machine, not the repo, is Koh 3's own.1332+ remote := run_home_with_path(legacy, home, fake, 'remote')1333+ assert !remote.out.contains('handoff'), remote.out1334+ assert remote.err.contains('needs a terminal'), remote.err13241335 }13251336 13261337 fn run_home_with_path(repo string, home string, bin_dir string, args ...string) Result {v.mod+1 −1
@@ -1,6 +1,6 @@11 Module {22 name: 'koh3'3- version: '3.2.8'3+ version: '3.2.9'44 description: 'One SQLite file per repo, one line of history.'55 license: 'MIT'66 }