mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-07 08:26:11 +00:00
* Initial plan * feat(analyze): add --repair-fts and verify FTS index rebuilds Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/dccb3673-af86-43aa-aede-2e1449399775 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * refactor(fts): tighten repair/verify messaging and option naming Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/dccb3673-af86-43aa-aede-2e1449399775 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * docs: highlight analyze --repair-fts vs --force in READMEs Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/61edc967-debc-419f-9f51-aebf2ef08d22 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * fix(analyze): guard repair mode against missing graph store * fix(cli): reject --repair-fts with --force * test(analyze): document repair-store fixture intent * test(analyze): tidy repair failure fixtures and constants * test(analyze): clarify mock constants in repair tests * test(analyze): rename simulated missing-index constant * test(analyze): clarify mocked graph shape in full-verify test * refactor(analyze): finalize flag validation and test clarity * test(skip-git): avoid hard failing when FTS extension is unavailable * test(skip-git): log visible FTS-unavailable test skips * test(skip-git): tighten FTS-unavailable error detection * test(skip-git): simplify FTS-unavailable message checks * test(skip-git): avoid HOME pointing at parent repo in fixture env * fix(analyze): address Claude follow-up findings for repair guardrails Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/2f7243d3-ba16-4d83-86e5-17e6c58a3b0d * fix(repair-fts): clarify invalid graph-store preflight errors Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/2f7243d3-ba16-4d83-86e5-17e6c58a3b0d * test(analyze): strengthen assertions for conflict and missing-store errors Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/2f7243d3-ba16-4d83-86e5-17e6c58a3b0d * fix(repair-fts): make invalid graph-store type errors explicit Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/2f7243d3-ba16-4d83-86e5-17e6c58a3b0d * fix(repair-fts): improve graph-store type diagnostics Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/2f7243d3-ba16-4d83-86e5-17e6c58a3b0d --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
86 lines
3.2 KiB
TypeScript
86 lines
3.2 KiB
TypeScript
import { spawnSync } from 'node:child_process';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
const testDir = path.dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = path.resolve(testDir, '../..');
|
|
const cliEntry = path.join(repoRoot, 'src/cli/index.ts');
|
|
|
|
function runHelp(command: string) {
|
|
return spawnSync(process.execPath, ['--import', 'tsx', cliEntry, command, '--help'], {
|
|
cwd: repoRoot,
|
|
encoding: 'utf8',
|
|
});
|
|
}
|
|
|
|
describe('CLI help surface', () => {
|
|
it('query help keeps advanced search options without importing analyze deps', () => {
|
|
const result = runHelp('query');
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain('--context <text>');
|
|
expect(result.stdout).toContain('--goal <text>');
|
|
expect(result.stdout).toContain('--content');
|
|
expect(result.stderr).not.toContain('tree-sitter-kotlin');
|
|
});
|
|
|
|
it('context help keeps optional name and disambiguation flags', () => {
|
|
const result = runHelp('context');
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain('context [options] [name]');
|
|
expect(result.stdout).toContain('--uid <uid>');
|
|
expect(result.stdout).toContain('--file <path>');
|
|
});
|
|
|
|
it('impact help keeps repo and include-tests flags', () => {
|
|
const result = runHelp('impact');
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain('--depth <n>');
|
|
expect(result.stdout).toContain('--include-tests');
|
|
expect(result.stdout).toContain('--repo <name>');
|
|
});
|
|
|
|
it('detect-changes help exposes compare scope and base-ref flags', () => {
|
|
const result = runHelp('detect-changes');
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain('gitnexus detect-changes|detect_changes [options]');
|
|
expect(result.stdout).toContain('--scope <scope>');
|
|
expect(result.stdout).toContain('--base-ref <ref>');
|
|
expect(result.stdout).toContain('--repo <name>');
|
|
});
|
|
|
|
it('wiki help shows provider, review, and verbose flags', () => {
|
|
const result = runHelp('wiki');
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain('--provider <provider>');
|
|
expect(result.stdout).toContain('--review');
|
|
expect(result.stdout).toContain('-v, --verbose');
|
|
expect(result.stdout).toContain('--model <model>');
|
|
expect(result.stdout).toContain('--gist');
|
|
});
|
|
|
|
it('publish help names the registry, the token env var, and the opt-out behaviour', () => {
|
|
const result = runHelp('publish');
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain('--id <owner/repo>');
|
|
expect(result.stdout).toContain('--skip-git');
|
|
// Discoverability contract: a contributor scanning `--help` must see
|
|
// (a) which registry this dispatches to, and (b) the env var that
|
|
// gates the opt-in. Both are part of the no-token contract.
|
|
expect(result.stdout).toContain('understand-quickly');
|
|
expect(result.stdout).toContain('UNDERSTAND_QUICKLY_TOKEN');
|
|
});
|
|
|
|
it('analyze help includes the FTS repair option', () => {
|
|
const result = runHelp('analyze');
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toContain('--repair-fts');
|
|
});
|
|
});
|