@colbymchenry/codegraph-win32-arm64 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/bin/codegraph.js +145 -29
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/context/formatter.d.ts +7 -1
- package/lib/dist/context/formatter.d.ts.map +1 -1
- package/lib/dist/context/formatter.js +12 -6
- package/lib/dist/context/formatter.js.map +1 -1
- package/lib/dist/context/index.d.ts +12 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +60 -14
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +37 -0
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +101 -1
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +25 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +160 -3
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +400 -33
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +16 -3
- package/lib/dist/directory.d.ts +29 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +52 -0
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +6 -0
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +48 -12
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +176 -11
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +38 -2
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +106 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +284 -53
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +19 -4
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/lib/dist/extraction/languages/erlang.js +58 -22
- package/lib/dist/extraction/languages/erlang.js.map +1 -1
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
- package/lib/dist/extraction/languages/objc.js +4 -0
- package/lib/dist/extraction/languages/objc.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts +20 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +47 -20
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +7 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +20 -1
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +2 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +5 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +106 -50
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -0
- package/lib/dist/graph/queries.js.map +1 -1
- package/lib/dist/graph/traversal.js +1 -1
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +22 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +117 -1
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +4 -3
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +8 -6
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +37 -5
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +22 -8
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +65 -48
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts +32 -0
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-cli.js +209 -0
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js +238 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts +47 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.js +219 -0
- package/lib/dist/installer/targets/copilot-vscode.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +6 -0
- package/lib/dist/installer/targets/registry.js.map +1 -1
- package/lib/dist/installer/targets/toml.d.ts +6 -5
- package/lib/dist/installer/targets/toml.d.ts.map +1 -1
- package/lib/dist/installer/targets/toml.js +99 -20
- package/lib/dist/installer/targets/toml.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +5 -5
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +1 -1
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +6 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +54 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +10 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +51 -3
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +9 -6
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +10 -8
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +3 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +45 -3
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +137 -0
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/lib/dist/mcp/explore-dedup.js +236 -0
- package/lib/dist/mcp/explore-dedup.js.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts +289 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.js +558 -0
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -0
- package/lib/dist/mcp/explore-session-state.d.ts +217 -0
- package/lib/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/lib/dist/mcp/explore-session-state.js +322 -0
- package/lib/dist/mcp/explore-session-state.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +24 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +67 -6
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +3 -1
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +6 -1
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +2 -2
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +8 -3
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +16 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +36 -13
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +276 -10
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +2402 -241
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +23 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +39 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +21 -19
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +39 -11
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +11 -1
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +18 -2
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +15 -4
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +30 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +295 -5
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/path-aliases.d.ts +6 -4
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
- package/lib/dist/resolution/path-aliases.js +125 -17
- package/lib/dist/resolution/path-aliases.js.map +1 -1
- package/lib/dist/search/identifier-segments.d.ts +10 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -1
- package/lib/dist/search/identifier-segments.js +29 -0
- package/lib/dist/search/identifier-segments.js.map +1 -1
- package/lib/dist/search/query-paths.d.ts +57 -0
- package/lib/dist/search/query-paths.d.ts.map +1 -0
- package/lib/dist/search/query-paths.js +298 -0
- package/lib/dist/search/query-paths.js.map +1 -0
- package/lib/dist/search/query-utils.d.ts +1 -1
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +13 -3
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +22 -0
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +51 -5
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/types.d.ts +20 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +1 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/kernel/codegraph-kernel.node +0 -0
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -392,6 +392,16 @@ function main() {
|
|
|
392
392
|
for (const w of result.errors.filter((e) => e.code === 'index_partial')) {
|
|
393
393
|
clack.log.warn(w.message);
|
|
394
394
|
}
|
|
395
|
+
// Files salvaged from comment-stripped source after repeated parser
|
|
396
|
+
// failures are indexed but possibly incomplete — say so here, or the run
|
|
397
|
+
// reads as fully clean and the index quietly disagrees with a later
|
|
398
|
+
// re-parse of the same bytes (#1565).
|
|
399
|
+
const salvaged = result.errors.filter((e) => e.code === 'salvaged_stripped');
|
|
400
|
+
if (salvaged.length > 0) {
|
|
401
|
+
const sample = salvaged.slice(0, 3).map((e) => e.filePath).filter(Boolean).join(', ');
|
|
402
|
+
const more = salvaged.length > 3 ? ', ...' : '';
|
|
403
|
+
clack.log.warn(`${formatNumber(salvaged.length)} file(s) indexed from comment-stripped source after repeated parse failures ${(0, glyphs_1.getGlyphs)().dash} symbols may be incomplete (${sample}${more})`);
|
|
404
|
+
}
|
|
395
405
|
}
|
|
396
406
|
else if (hasErrors) {
|
|
397
407
|
clack.log.error(`Indexing failed ${(0, glyphs_1.getGlyphs)().dash} all ${formatNumber(result.filesErrored)} files had errors`);
|
|
@@ -428,9 +438,17 @@ function main() {
|
|
|
428
438
|
}
|
|
429
439
|
}
|
|
430
440
|
else if (projectPath) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
441
|
+
// No hard errors. Salvaged-file warnings still belong in the log — it
|
|
442
|
+
// carries the per-file detail behind the one-line summary above.
|
|
443
|
+
if (result.errors.some((e) => e.code === 'salvaged_stripped')) {
|
|
444
|
+
writeErrorLog(projectPath, result.errors);
|
|
445
|
+
clack.log.info('See .codegraph/errors.log for details');
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
const logPath = path.join((0, directory_1.getCodeGraphDir)(projectPath), 'errors.log');
|
|
449
|
+
if (fs.existsSync(logPath)) {
|
|
450
|
+
fs.unlinkSync(logPath);
|
|
451
|
+
}
|
|
434
452
|
}
|
|
435
453
|
}
|
|
436
454
|
}
|
|
@@ -550,16 +568,14 @@ function main() {
|
|
|
550
568
|
// Commands
|
|
551
569
|
// =============================================================================
|
|
552
570
|
/**
|
|
553
|
-
* codegraph init
|
|
571
|
+
* The `init` flow — shared by `codegraph init` and `codegraph install --init`
|
|
572
|
+
* (#1578): refuse an unsafe root, create `.codegraph/`, build the initial
|
|
573
|
+
* index under supervision, then the post-index offers. `yes` makes every
|
|
574
|
+
* offer non-interactive (defaults only), so a container / CI bootstrap never
|
|
575
|
+
* blocks on a prompt. An unsafe root sets `process.exitCode = 1` and returns
|
|
576
|
+
* (no `--force` is implied by any caller); an index failure exits 1.
|
|
554
577
|
*/
|
|
555
|
-
|
|
556
|
-
.command('init [path]')
|
|
557
|
-
.description('Initialize CodeGraph in a project directory and build the initial index')
|
|
558
|
-
.option('-i, --index', 'Deprecated: indexing now runs by default; flag accepted for backward compatibility')
|
|
559
|
-
.option('-f, --force', 'Initialize even if the path looks like your home directory or a filesystem root')
|
|
560
|
-
.option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
|
|
561
|
-
.action(async (pathArg, options) => {
|
|
562
|
-
const projectPath = path.resolve(pathArg || process.cwd());
|
|
578
|
+
async function runInit(projectPath, options) {
|
|
563
579
|
const clack = await importESM('@clack/prompts');
|
|
564
580
|
clack.intro('Initializing CodeGraph');
|
|
565
581
|
try {
|
|
@@ -579,7 +595,7 @@ function main() {
|
|
|
579
595
|
clack.log.info('Use "codegraph index" to re-index or "codegraph sync" to update');
|
|
580
596
|
try {
|
|
581
597
|
const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
|
|
582
|
-
await offerWatchFallback(clack, projectPath);
|
|
598
|
+
await offerWatchFallback(clack, projectPath, { yes: options.yes });
|
|
583
599
|
}
|
|
584
600
|
catch { /* non-fatal */ }
|
|
585
601
|
clack.outro('');
|
|
@@ -619,12 +635,14 @@ function main() {
|
|
|
619
635
|
// An empty graph at a git super-repo usually means `.gitignore` excludes
|
|
620
636
|
// the child repos that hold the code — surface them and offer to opt in
|
|
621
637
|
// rather than leaving the user with a silent 0-node "Done". (#1156)
|
|
638
|
+
// Under --yes the offer prints its one-line opt-in snippet instead of
|
|
639
|
+
// prompting (same as a non-TTY run).
|
|
622
640
|
if (result.nodesCreated === 0) {
|
|
623
|
-
await offerIndexIgnoredRepos(clack, projectPath, runIndex, { interactive:
|
|
641
|
+
await offerIndexIgnoredRepos(clack, projectPath, runIndex, { interactive: !options.yes });
|
|
624
642
|
}
|
|
625
643
|
try {
|
|
626
644
|
const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
|
|
627
|
-
await offerWatchFallback(clack, projectPath);
|
|
645
|
+
await offerWatchFallback(clack, projectPath, { yes: options.yes });
|
|
628
646
|
}
|
|
629
647
|
catch { /* non-fatal */ }
|
|
630
648
|
clack.outro('Done');
|
|
@@ -634,6 +652,19 @@ function main() {
|
|
|
634
652
|
clack.log.error(`Failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
635
653
|
process.exit(1);
|
|
636
654
|
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* codegraph init [path]
|
|
658
|
+
*/
|
|
659
|
+
program
|
|
660
|
+
.command('init [path]')
|
|
661
|
+
.description('Initialize CodeGraph in a project directory and build the initial index')
|
|
662
|
+
.option('-i, --index', 'Deprecated: indexing now runs by default; flag accepted for backward compatibility')
|
|
663
|
+
.option('-f, --force', 'Initialize even if the path looks like your home directory or a filesystem root')
|
|
664
|
+
.option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
|
|
665
|
+
.option('-y, --yes', 'Non-interactive: skip every prompt and take the defaults (for scripts / CI / container bootstraps)')
|
|
666
|
+
.action(async (pathArg, options) => {
|
|
667
|
+
await runInit(path.resolve(pathArg || process.cwd()), options);
|
|
637
668
|
});
|
|
638
669
|
/**
|
|
639
670
|
* codegraph uninit [path]
|
|
@@ -889,6 +920,7 @@ function main() {
|
|
|
889
920
|
nodeCount: stats.nodeCount,
|
|
890
921
|
edgeCount: stats.edgeCount,
|
|
891
922
|
dbSizeBytes: stats.dbSizeBytes,
|
|
923
|
+
walSizeBytes: stats.walSizeBytes,
|
|
892
924
|
backend,
|
|
893
925
|
journalMode,
|
|
894
926
|
nodesByKind: stats.nodesByKind,
|
|
@@ -944,6 +976,19 @@ function main() {
|
|
|
944
976
|
console.log(` Nodes: ${formatNumber(stats.nodeCount)}`);
|
|
945
977
|
console.log(` Edges: ${formatNumber(stats.edgeCount)}`);
|
|
946
978
|
console.log(` DB Size: ${(stats.dbSizeBytes / 1024 / 1024).toFixed(2)} MB`);
|
|
979
|
+
// Surface the WAL sidecar (#1431): a WAL that dwarfs the DB at rest is
|
|
980
|
+
// the killed-session leak — invisible before this line, it only showed
|
|
981
|
+
// up as a mysteriously full disk. open() above already kicked off the
|
|
982
|
+
// automatic heal for the oversized case.
|
|
983
|
+
if (stats.walSizeBytes > 0) {
|
|
984
|
+
const { WAL_HEAL_THRESHOLD_BYTES } = await Promise.resolve().then(() => __importStar(require('../db/index')));
|
|
985
|
+
const oversized = stats.walSizeBytes > Math.max(WAL_HEAL_THRESHOLD_BYTES, stats.dbSizeBytes);
|
|
986
|
+
const walLabel = `${(stats.walSizeBytes / 1024 / 1024).toFixed(2)} MB`;
|
|
987
|
+
console.log(` WAL Size: ${oversized ? chalk.yellow(walLabel) : walLabel}`);
|
|
988
|
+
if (oversized) {
|
|
989
|
+
warn('The write-ahead log is larger than the database — killed sessions left it behind. It is reclaimed automatically on open; if it persists across runs, another live CodeGraph process is holding it.');
|
|
990
|
+
}
|
|
991
|
+
}
|
|
947
992
|
// Surface the active SQLite backend (node:sqlite — Node's built-in real
|
|
948
993
|
// SQLite, full WAL + FTS5, no native build).
|
|
949
994
|
const backendLabel = chalk.green(`node:sqlite ${(0, glyphs_1.getGlyphs)().dash} built-in (full WAL)`);
|
|
@@ -1036,10 +1081,10 @@ function main() {
|
|
|
1036
1081
|
// Mirror the MCP search down-rank so the CLI also surfaces the
|
|
1037
1082
|
// hand-written implementation before protobuf/gRPC scaffolding
|
|
1038
1083
|
// when both share a name. See extraction/generated-detection.ts.
|
|
1039
|
-
const
|
|
1084
|
+
const isGen = cg.generatedFilePredicate(rawResults.map((r) => r.node.filePath));
|
|
1040
1085
|
const results = [...rawResults].sort((a, b) => {
|
|
1041
|
-
const aGen =
|
|
1042
|
-
const bGen =
|
|
1086
|
+
const aGen = isGen(a.node.filePath) ? 1 : 0;
|
|
1087
|
+
const bGen = isGen(b.node.filePath) ? 1 : 0;
|
|
1043
1088
|
return aGen - bGen;
|
|
1044
1089
|
});
|
|
1045
1090
|
if (options.json) {
|
|
@@ -1115,6 +1160,60 @@ function main() {
|
|
|
1115
1160
|
process.exit(1);
|
|
1116
1161
|
}
|
|
1117
1162
|
});
|
|
1163
|
+
/**
|
|
1164
|
+
* codegraph context <task...>
|
|
1165
|
+
*
|
|
1166
|
+
* The CLI face of the public `buildContext` API (ContextBuilder): FTS entry
|
|
1167
|
+
* points + graph expansion + code blocks, formatted as markdown or JSON.
|
|
1168
|
+
* Advertised in the usage header since the first release but never actually
|
|
1169
|
+
* registered (#1611); external integrations (e.g. Memorix) invoke it as
|
|
1170
|
+
* `codegraph context --path <root> --format json --max-nodes 8 --no-code <task>`.
|
|
1171
|
+
*/
|
|
1172
|
+
program
|
|
1173
|
+
.command('context <task...>')
|
|
1174
|
+
.description('Build context for a task: relevant symbols, relationships, and code blocks')
|
|
1175
|
+
.option('-p, --path <path>', 'Project path')
|
|
1176
|
+
.option('-f, --format <format>', 'Output format: markdown or json', 'markdown')
|
|
1177
|
+
.option('-n, --max-nodes <number>', 'Maximum number of symbols to include')
|
|
1178
|
+
.option('--no-code', 'Omit code blocks (structure only)')
|
|
1179
|
+
.action(async (taskParts, options) => {
|
|
1180
|
+
const projectPath = resolveProjectPath(options.path);
|
|
1181
|
+
const format = options.format ?? 'markdown';
|
|
1182
|
+
if (format !== 'markdown' && format !== 'json') {
|
|
1183
|
+
error(`Unknown format "${options.format}" — use "markdown" or "json".`);
|
|
1184
|
+
process.exit(1);
|
|
1185
|
+
}
|
|
1186
|
+
let maxNodes;
|
|
1187
|
+
if (options.maxNodes !== undefined) {
|
|
1188
|
+
maxNodes = parseInt(options.maxNodes, 10);
|
|
1189
|
+
if (Number.isNaN(maxNodes) || maxNodes < 1) {
|
|
1190
|
+
error(`--max-nodes expects a positive integer, got "${options.maxNodes}".`);
|
|
1191
|
+
process.exit(1);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
try {
|
|
1195
|
+
if (!(0, directory_1.isInitialized)(projectPath)) {
|
|
1196
|
+
error(`CodeGraph not initialized in ${projectPath}`);
|
|
1197
|
+
process.exit(1);
|
|
1198
|
+
}
|
|
1199
|
+
const { default: CodeGraph } = await loadCodeGraph();
|
|
1200
|
+
const cg = await CodeGraph.open(projectPath);
|
|
1201
|
+
const result = await cg.buildContext(taskParts.join(' '), {
|
|
1202
|
+
format,
|
|
1203
|
+
includeCode: options.code !== false,
|
|
1204
|
+
...(maxNodes !== undefined ? { maxNodes } : {}),
|
|
1205
|
+
});
|
|
1206
|
+
// Both supported formats return a formatted string; print it verbatim so
|
|
1207
|
+
// `--format json` stays machine-parseable on stdout (error()/warnings go
|
|
1208
|
+
// to stderr only).
|
|
1209
|
+
console.log(typeof result === 'string' ? result : JSON.stringify(result, null, 2));
|
|
1210
|
+
cg.destroy();
|
|
1211
|
+
}
|
|
1212
|
+
catch (err) {
|
|
1213
|
+
error(`Context build failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1214
|
+
process.exit(1);
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1118
1217
|
/**
|
|
1119
1218
|
* codegraph prompt-hook (hidden)
|
|
1120
1219
|
*
|
|
@@ -1562,9 +1661,9 @@ function main() {
|
|
|
1562
1661
|
.aliases(['daemons'])
|
|
1563
1662
|
.description('Manage running CodeGraph background daemons — pick one and press enter to stop it')
|
|
1564
1663
|
.action(async () => {
|
|
1565
|
-
const {
|
|
1664
|
+
const { listVerifiedDaemons, stopDaemonAt, stopAllDaemons } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-registry')));
|
|
1566
1665
|
const { runDaemonPicker } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-manager')));
|
|
1567
|
-
const daemons =
|
|
1666
|
+
const daemons = await listVerifiedDaemons();
|
|
1568
1667
|
if (daemons.length === 0) {
|
|
1569
1668
|
info('No CodeGraph daemons running.');
|
|
1570
1669
|
return;
|
|
@@ -1591,7 +1690,7 @@ function main() {
|
|
|
1591
1690
|
const clack = await importESM('@clack/prompts');
|
|
1592
1691
|
clack.intro('CodeGraph daemons');
|
|
1593
1692
|
await runDaemonPicker({
|
|
1594
|
-
list:
|
|
1693
|
+
list: listVerifiedDaemons,
|
|
1595
1694
|
stop: stopDaemonAt,
|
|
1596
1695
|
stopAll: stopAllDaemons,
|
|
1597
1696
|
cwdRoot,
|
|
@@ -1693,12 +1792,17 @@ function main() {
|
|
|
1693
1792
|
return;
|
|
1694
1793
|
}
|
|
1695
1794
|
const lockPath = path.join((0, directory_1.getCodeGraphDir)(projectPath), 'codegraph.lock');
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1795
|
+
let removed = false;
|
|
1796
|
+
if (fs.existsSync(lockPath)) {
|
|
1797
|
+
fs.unlinkSync(lockPath);
|
|
1798
|
+
removed = true;
|
|
1799
|
+
}
|
|
1800
|
+
const { clearStaleDaemonArtifacts } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-registry')));
|
|
1801
|
+
removed = await clearStaleDaemonArtifacts(projectPath) || removed;
|
|
1802
|
+
if (removed)
|
|
1803
|
+
success('Removed stale lock artifacts. You can now run indexing again.');
|
|
1804
|
+
else
|
|
1805
|
+
info(`No stale lock files found ${(0, glyphs_1.getGlyphs)().dash} nothing to do`);
|
|
1702
1806
|
}
|
|
1703
1807
|
catch (err) {
|
|
1704
1808
|
error(`Failed to remove lock: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -2082,10 +2186,11 @@ function main() {
|
|
|
2082
2186
|
*/
|
|
2083
2187
|
program
|
|
2084
2188
|
.command('install')
|
|
2085
|
-
.description('Install codegraph MCP server into one or more agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent)')
|
|
2189
|
+
.description('Install codegraph MCP server into one or more agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro, GitHub Copilot)')
|
|
2086
2190
|
.option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "auto"|"all"|"none". Default: prompt')
|
|
2087
2191
|
.option('-l, --location <where>', 'Install location: "global" or "local". Default: prompt')
|
|
2088
2192
|
.option('-y, --yes', 'Non-interactive: defaults to --location=global --target=auto, auto-allow on')
|
|
2193
|
+
.option('-i, --init', 'After wiring agents, also run `codegraph init` in the current directory — builds this project’s index, so install + index is one command (combine with --yes for an unattended bootstrap)')
|
|
2089
2194
|
.option('--no-permissions', 'Skip writing the auto-allow permissions list (Claude Code only)')
|
|
2090
2195
|
.option('--print-config <id>', 'Print MCP config snippet for the named agent and exit (no file writes)')
|
|
2091
2196
|
.option('--refresh', 'Rewrite what previous installs configured, for already-configured agents only (never adds new ones). Run automatically by `codegraph upgrade`')
|
|
@@ -2161,6 +2266,17 @@ function main() {
|
|
|
2161
2266
|
error(err instanceof Error ? err.message : String(err));
|
|
2162
2267
|
process.exit(1);
|
|
2163
2268
|
}
|
|
2269
|
+
// --init: the one-shot "wire agents AND build this project's index"
|
|
2270
|
+
// bootstrap (#1578). The installer itself never indexes implicitly (a
|
|
2271
|
+
// surprise index of $HOME is the thing we refuse) — an explicit flag is
|
|
2272
|
+
// the user choosing. Runs after a successful install, including the
|
|
2273
|
+
// `--target none` / nothing-detected case (the installer returns normally
|
|
2274
|
+
// there), and shares every guard with `codegraph init`: an unsafe root
|
|
2275
|
+
// is refused (exit 1, no implied --force), an already-initialized
|
|
2276
|
+
// project just says so. `--yes` flows through so no offer prompts.
|
|
2277
|
+
if (opts.init) {
|
|
2278
|
+
await runInit(process.cwd(), { yes: opts.yes });
|
|
2279
|
+
}
|
|
2164
2280
|
});
|
|
2165
2281
|
/**
|
|
2166
2282
|
* codegraph uninstall
|
|
@@ -2172,7 +2288,7 @@ function main() {
|
|
|
2172
2288
|
*/
|
|
2173
2289
|
program
|
|
2174
2290
|
.command('uninstall')
|
|
2175
|
-
.description('Remove codegraph from your agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent)')
|
|
2291
|
+
.description('Remove codegraph from your agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro, GitHub Copilot)')
|
|
2176
2292
|
.option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "all". Default: all')
|
|
2177
2293
|
.option('-l, --location <where>', 'Uninstall location: "global" or "local". Default: prompt')
|
|
2178
2294
|
.option('-y, --yes', 'Non-interactive: defaults to --location=global --target=all')
|