fix(cli): make backfill command reachable — add to CLI_ONLY (#3224) (#3529)

'backfill' had a fully implemented handler (case 'backfill' dispatching
to commands/backfill.ts) but was missing from the CLI_ONLY set, so
dispatch rejected every invocation with 'Unknown command: backfill'.
Same drift class as #2900 (reconcile-links) and #2035 (calibration).

Also lists backfill in the main --help TOOLS section.

Co-authored-by: Garry Tan <garrytan@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Time Attakc
2026-07-28 14:34:28 -07:00
committed by GitHub
co-authored by Garry Tan Claude Opus 5
parent 661f1f05cc
commit 5b9a87f1a3
2 changed files with 22 additions and 1 deletions
@@ -19,3 +19,23 @@ describe('CLI_ONLY command reachability (#2900)', () => {
expect(CLI_ONLY.has('reconcile-links')).toBe(true);
});
});
// #3224 — same drift class: `backfill` has a full `case 'backfill'` handler
// (cli.ts, dispatching to commands/backfill.ts) but was missing from CLI_ONLY,
// so every invocation hit the generic "Unknown command" branch.
describe('CLI_ONLY command reachability (#3224)', () => {
test('`backfill` is in CLI_ONLY so dispatch reaches its handler', () => {
expect(CLI_ONLY.has('backfill')).toBe(true);
});
test('`gbrain backfill --help` is dispatched, not rejected as unknown', () => {
const { spawnSync } = require('node:child_process') as typeof import('node:child_process');
const result = spawnSync('bun', ['run', 'src/cli.ts', 'backfill', '--help'], {
cwd: process.cwd(),
encoding: 'utf8',
env: { ...process.env, GBRAIN_HOME: '/tmp/gbrain-test-backfill-nonexistent' },
});
expect(result.stderr ?? '').not.toContain('Unknown command');
expect(result.status).toBe(0);
});
});