@stupidloud/codegraph 0.9.5 → 0.9.9
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/README.md +252 -116
- package/dist/bin/codegraph.js +52 -82
- package/dist/bin/codegraph.js.map +1 -1
- package/dist/context/formatter.d.ts.map +1 -1
- package/dist/context/formatter.js +25 -6
- package/dist/context/formatter.js.map +1 -1
- package/dist/context/index.d.ts +22 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +257 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/markers.d.ts +19 -0
- package/dist/context/markers.d.ts.map +1 -0
- package/dist/context/markers.js +22 -0
- package/dist/context/markers.js.map +1 -0
- package/dist/db/queries.d.ts +88 -0
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +251 -7
- package/dist/db/queries.js.map +1 -1
- package/dist/db/sqlite-adapter.d.ts +7 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.js +3 -0
- package/dist/db/sqlite-adapter.js.map +1 -1
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +6 -20
- package/dist/directory.js.map +1 -1
- package/dist/extraction/generated-detection.d.ts +30 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -0
- package/dist/extraction/generated-detection.js +80 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +17 -1
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +65 -1
- package/dist/extraction/grammars.js.map +1 -1
- package/dist/extraction/index.d.ts +15 -2
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +206 -98
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +45 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/dist/extraction/languages/csharp.js +2 -1
- package/dist/extraction/languages/csharp.js.map +1 -1
- package/dist/extraction/languages/go.d.ts.map +1 -1
- package/dist/extraction/languages/go.js +18 -2
- package/dist/extraction/languages/go.js.map +1 -1
- package/dist/extraction/languages/index.d.ts.map +1 -1
- package/dist/extraction/languages/index.js +2 -0
- package/dist/extraction/languages/index.js.map +1 -1
- package/dist/extraction/languages/java.d.ts.map +1 -1
- package/dist/extraction/languages/java.js +6 -0
- package/dist/extraction/languages/java.js.map +1 -1
- package/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/dist/extraction/languages/kotlin.js +6 -0
- package/dist/extraction/languages/kotlin.js.map +1 -1
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts.map +1 -0
- package/dist/extraction/languages/objc.js +133 -0
- package/dist/extraction/languages/objc.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/dist/extraction/mybatis-extractor.js +198 -0
- package/dist/extraction/mybatis-extractor.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +14 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +84 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +681 -20
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/vue-extractor.d.ts +15 -0
- package/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/dist/extraction/vue-extractor.js +88 -0
- package/dist/extraction/vue-extractor.js.map +1 -1
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/dist/extraction/wasm-runtime-flags.js +1 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +5 -2
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +66 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +105 -1
- package/dist/index.js.map +1 -1
- package/dist/installer/config-writer.d.ts +7 -8
- package/dist/installer/config-writer.d.ts.map +1 -1
- package/dist/installer/config-writer.js +7 -27
- package/dist/installer/config-writer.js.map +1 -1
- package/dist/installer/index.d.ts +3 -20
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +8 -39
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/instructions-template.d.ts +11 -21
- package/dist/installer/instructions-template.d.ts.map +1 -1
- package/dist/installer/instructions-template.js +12 -56
- package/dist/installer/instructions-template.js.map +1 -1
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/installer/targets/antigravity.js +308 -0
- package/dist/installer/targets/antigravity.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +10 -1
- package/dist/installer/targets/claude.d.ts.map +1 -1
- package/dist/installer/targets/claude.js +25 -40
- package/dist/installer/targets/claude.js.map +1 -1
- package/dist/installer/targets/codex.d.ts.map +1 -1
- package/dist/installer/targets/codex.js +15 -13
- package/dist/installer/targets/codex.js.map +1 -1
- package/dist/installer/targets/cursor.d.ts.map +1 -1
- package/dist/installer/targets/cursor.js +9 -38
- package/dist/installer/targets/cursor.js.map +1 -1
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/gemini.d.ts.map +1 -0
- package/dist/installer/targets/gemini.js +167 -0
- package/dist/installer/targets/gemini.js.map +1 -0
- package/dist/installer/targets/hermes.d.ts.map +1 -1
- package/dist/installer/targets/hermes.js +57 -3
- package/dist/installer/targets/hermes.js.map +1 -1
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/kiro.d.ts.map +1 -0
- package/dist/installer/targets/kiro.js +178 -0
- package/dist/installer/targets/kiro.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -1
- package/dist/installer/targets/opencode.js +15 -13
- package/dist/installer/targets/opencode.js.map +1 -1
- package/dist/installer/targets/registry.d.ts.map +1 -1
- package/dist/installer/targets/registry.js +6 -0
- package/dist/installer/targets/registry.js.map +1 -1
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +3 -2
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/installer/targets/types.d.ts +1 -16
- package/dist/installer/targets/types.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +46 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +125 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon.d.ts +161 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +403 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/engine.d.ts +105 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +270 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/index.d.ts +67 -53
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +315 -388
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/proxy.d.ts +81 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +510 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +21 -21
- package/dist/mcp/session.d.ts +77 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +294 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/tools.d.ts +160 -14
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1622 -322
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transport.d.ts +111 -29
- package/dist/mcp/transport.d.ts.map +1 -1
- package/dist/mcp/transport.js +181 -71
- package/dist/mcp/transport.js.map +1 -1
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +10 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +1300 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -1
- package/dist/resolution/frameworks/csharp.js +36 -8
- package/dist/resolution/frameworks/csharp.js.map +1 -1
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -1
- package/dist/resolution/frameworks/drupal.js +44 -12
- package/dist/resolution/frameworks/drupal.js.map +1 -1
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +143 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -1
- package/dist/resolution/frameworks/express.js +102 -19
- package/dist/resolution/frameworks/express.js.map +1 -1
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/dist/resolution/frameworks/go.js +6 -3
- package/dist/resolution/frameworks/go.js.map +1 -1
- package/dist/resolution/frameworks/index.d.ts +5 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/dist/resolution/frameworks/index.js +25 -1
- package/dist/resolution/frameworks/index.js.map +1 -1
- package/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/dist/resolution/frameworks/java.js +339 -12
- package/dist/resolution/frameworks/java.js.map +1 -1
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -1
- package/dist/resolution/frameworks/laravel.js +17 -8
- package/dist/resolution/frameworks/laravel.js.map +1 -1
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/dist/resolution/frameworks/nestjs.js +324 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -1
- package/dist/resolution/frameworks/python.js +134 -16
- package/dist/resolution/frameworks/python.js.map +1 -1
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +360 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/dist/resolution/frameworks/react.js +96 -3
- package/dist/resolution/frameworks/react.js.map +1 -1
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -1
- package/dist/resolution/frameworks/ruby.js +106 -2
- package/dist/resolution/frameworks/ruby.js.map +1 -1
- package/dist/resolution/frameworks/rust.d.ts.map +1 -1
- package/dist/resolution/frameworks/rust.js +102 -5
- package/dist/resolution/frameworks/rust.js.map +1 -1
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/dist/resolution/frameworks/swift.js +30 -6
- package/dist/resolution/frameworks/swift.js.map +1 -1
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +28 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +617 -5
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +11 -0
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +156 -3
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +212 -0
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/types.d.ts +44 -0
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/resolution/workspace-packages.d.ts +48 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/dist/resolution/workspace-packages.js +208 -0
- package/dist/resolution/workspace-packages.js.map +1 -0
- package/dist/search/query-utils.d.ts +18 -0
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +30 -0
- package/dist/search/query-utils.js.map +1 -1
- package/dist/sync/git-hooks.d.ts.map +1 -1
- package/dist/sync/git-hooks.js +2 -0
- package/dist/sync/git-hooks.js.map +1 -1
- package/dist/sync/index.d.ts +3 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/watcher.d.ts +212 -8
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +465 -51
- package/dist/sync/watcher.js.map +1 -1
- package/dist/sync/worktree.d.ts +54 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +137 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/types.d.ts +9 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +24 -11
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/pack-npm.sh +25 -1
- package/scripts/prepare-release.mjs +270 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Worktree Awareness
|
|
3
|
+
*
|
|
4
|
+
* A CodeGraph index lives in a `.codegraph/` directory and is resolved by
|
|
5
|
+
* walking up parent directories to the nearest one (see
|
|
6
|
+
* `findNearestCodeGraphRoot`). That walk is unaware of git worktrees: when a
|
|
7
|
+
* worktree is created *inside* the main checkout (e.g. some tools place them
|
|
8
|
+
* under `.gitignore`d paths like `.claude/worktrees/<name>/`), a command run
|
|
9
|
+
* from the worktree walks up and silently resolves the MAIN checkout's index.
|
|
10
|
+
*
|
|
11
|
+
* Every query then returns results from the main tree's code — usually a
|
|
12
|
+
* different branch — rather than the worktree the user is actually editing.
|
|
13
|
+
* Symbols added or changed only in the worktree are invisible. This module
|
|
14
|
+
* detects that "borrowed index" situation so callers can warn about it.
|
|
15
|
+
*
|
|
16
|
+
* Detection is best-effort: when git is unavailable or the path isn't a repo,
|
|
17
|
+
* it reports "no mismatch" and callers carry on unchanged.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Absolute, symlink-resolved toplevel of the git working tree that `dir`
|
|
21
|
+
* belongs to, or null when `dir` isn't inside a git repo (or git is missing).
|
|
22
|
+
*
|
|
23
|
+
* `git rev-parse --show-toplevel` returns the per-worktree root: the main
|
|
24
|
+
* checkout and each linked worktree report their own distinct directory, which
|
|
25
|
+
* is exactly the distinction this module relies on.
|
|
26
|
+
*/
|
|
27
|
+
export declare function gitWorktreeRoot(dir: string): string | null;
|
|
28
|
+
export interface WorktreeIndexMismatch {
|
|
29
|
+
/** The git working tree the command was run from. */
|
|
30
|
+
worktreeRoot: string;
|
|
31
|
+
/** The (different) working tree whose `.codegraph` index is being used. */
|
|
32
|
+
indexRoot: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Detect when `startPath` lives in one git working tree but the resolved
|
|
36
|
+
* CodeGraph index (`indexRoot`) belongs to a *different* working tree.
|
|
37
|
+
*
|
|
38
|
+
* Returns null — meaning "nothing to warn about" — when:
|
|
39
|
+
* - `startPath` isn't in a git repo (or git is unavailable),
|
|
40
|
+
* - the index already lives in `startPath`'s own working tree, or
|
|
41
|
+
* - `indexRoot` isn't itself a working-tree root (an unrelated parent dir
|
|
42
|
+
* that merely happens to contain a `.codegraph/`), which keeps non-git
|
|
43
|
+
* and monorepo-subdir layouts from producing false warnings.
|
|
44
|
+
*/
|
|
45
|
+
export declare function detectWorktreeIndexMismatch(startPath: string, indexRoot: string): WorktreeIndexMismatch | null;
|
|
46
|
+
/** One-line-per-fact warning describing a detected mismatch. */
|
|
47
|
+
export declare function worktreeMismatchWarning(m: WorktreeIndexMismatch): string;
|
|
48
|
+
/**
|
|
49
|
+
* Compact, single-line variant for prefixing a tool's result. Read tools
|
|
50
|
+
* return their answer inline, so the heads-up has to ride on the same payload
|
|
51
|
+
* the agent is already reading — a multi-line block would bury the result.
|
|
52
|
+
*/
|
|
53
|
+
export declare function worktreeMismatchNotice(m: WorktreeIndexMismatch): string;
|
|
54
|
+
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/sync/worktree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY1D;AAED,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,qBAAqB,GAAG,IAAI,CAa9B;AAED,gEAAgE;AAChE,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,qBAAqB,GAAG,MAAM,CASxE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAOvE"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Git Worktree Awareness
|
|
4
|
+
*
|
|
5
|
+
* A CodeGraph index lives in a `.codegraph/` directory and is resolved by
|
|
6
|
+
* walking up parent directories to the nearest one (see
|
|
7
|
+
* `findNearestCodeGraphRoot`). That walk is unaware of git worktrees: when a
|
|
8
|
+
* worktree is created *inside* the main checkout (e.g. some tools place them
|
|
9
|
+
* under `.gitignore`d paths like `.claude/worktrees/<name>/`), a command run
|
|
10
|
+
* from the worktree walks up and silently resolves the MAIN checkout's index.
|
|
11
|
+
*
|
|
12
|
+
* Every query then returns results from the main tree's code — usually a
|
|
13
|
+
* different branch — rather than the worktree the user is actually editing.
|
|
14
|
+
* Symbols added or changed only in the worktree are invisible. This module
|
|
15
|
+
* detects that "borrowed index" situation so callers can warn about it.
|
|
16
|
+
*
|
|
17
|
+
* Detection is best-effort: when git is unavailable or the path isn't a repo,
|
|
18
|
+
* it reports "no mismatch" and callers carry on unchanged.
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
+
}) : function(o, v) {
|
|
34
|
+
o["default"] = v;
|
|
35
|
+
});
|
|
36
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
37
|
+
var ownKeys = function(o) {
|
|
38
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
39
|
+
var ar = [];
|
|
40
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
return ownKeys(o);
|
|
44
|
+
};
|
|
45
|
+
return function (mod) {
|
|
46
|
+
if (mod && mod.__esModule) return mod;
|
|
47
|
+
var result = {};
|
|
48
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.gitWorktreeRoot = gitWorktreeRoot;
|
|
55
|
+
exports.detectWorktreeIndexMismatch = detectWorktreeIndexMismatch;
|
|
56
|
+
exports.worktreeMismatchWarning = worktreeMismatchWarning;
|
|
57
|
+
exports.worktreeMismatchNotice = worktreeMismatchNotice;
|
|
58
|
+
const fs = __importStar(require("fs"));
|
|
59
|
+
const path = __importStar(require("path"));
|
|
60
|
+
const child_process_1 = require("child_process");
|
|
61
|
+
/**
|
|
62
|
+
* Absolute, symlink-resolved toplevel of the git working tree that `dir`
|
|
63
|
+
* belongs to, or null when `dir` isn't inside a git repo (or git is missing).
|
|
64
|
+
*
|
|
65
|
+
* `git rev-parse --show-toplevel` returns the per-worktree root: the main
|
|
66
|
+
* checkout and each linked worktree report their own distinct directory, which
|
|
67
|
+
* is exactly the distinction this module relies on.
|
|
68
|
+
*/
|
|
69
|
+
function gitWorktreeRoot(dir) {
|
|
70
|
+
try {
|
|
71
|
+
const out = (0, child_process_1.execFileSync)('git', ['rev-parse', '--show-toplevel'], {
|
|
72
|
+
cwd: dir,
|
|
73
|
+
encoding: 'utf8',
|
|
74
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
75
|
+
windowsHide: true,
|
|
76
|
+
}).trim();
|
|
77
|
+
return out ? realpath(out) : null;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Detect when `startPath` lives in one git working tree but the resolved
|
|
85
|
+
* CodeGraph index (`indexRoot`) belongs to a *different* working tree.
|
|
86
|
+
*
|
|
87
|
+
* Returns null — meaning "nothing to warn about" — when:
|
|
88
|
+
* - `startPath` isn't in a git repo (or git is unavailable),
|
|
89
|
+
* - the index already lives in `startPath`'s own working tree, or
|
|
90
|
+
* - `indexRoot` isn't itself a working-tree root (an unrelated parent dir
|
|
91
|
+
* that merely happens to contain a `.codegraph/`), which keeps non-git
|
|
92
|
+
* and monorepo-subdir layouts from producing false warnings.
|
|
93
|
+
*/
|
|
94
|
+
function detectWorktreeIndexMismatch(startPath, indexRoot) {
|
|
95
|
+
const worktreeRoot = gitWorktreeRoot(startPath);
|
|
96
|
+
if (!worktreeRoot)
|
|
97
|
+
return null;
|
|
98
|
+
const resolvedIndexRoot = realpath(indexRoot);
|
|
99
|
+
if (worktreeRoot === resolvedIndexRoot)
|
|
100
|
+
return null;
|
|
101
|
+
// Only flag it when the index root is itself a real working-tree root. This
|
|
102
|
+
// distinguishes "borrowed another worktree's index" from "index sits in a
|
|
103
|
+
// plain ancestor directory", and avoids warning outside git entirely.
|
|
104
|
+
if (gitWorktreeRoot(resolvedIndexRoot) !== resolvedIndexRoot)
|
|
105
|
+
return null;
|
|
106
|
+
return { worktreeRoot, indexRoot: resolvedIndexRoot };
|
|
107
|
+
}
|
|
108
|
+
/** One-line-per-fact warning describing a detected mismatch. */
|
|
109
|
+
function worktreeMismatchWarning(m) {
|
|
110
|
+
return (`This CodeGraph index belongs to a different git working tree.\n` +
|
|
111
|
+
` Running in: ${m.worktreeRoot}\n` +
|
|
112
|
+
` Index from: ${m.indexRoot}\n` +
|
|
113
|
+
`Results reflect that tree's code (often a different branch), not this worktree — ` +
|
|
114
|
+
`symbols changed only here are missing. Run "codegraph init -i" in this worktree ` +
|
|
115
|
+
`for a worktree-local index.`);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Compact, single-line variant for prefixing a tool's result. Read tools
|
|
119
|
+
* return their answer inline, so the heads-up has to ride on the same payload
|
|
120
|
+
* the agent is already reading — a multi-line block would bury the result.
|
|
121
|
+
*/
|
|
122
|
+
function worktreeMismatchNotice(m) {
|
|
123
|
+
return (`⚠ CodeGraph results below come from a different git worktree (${m.indexRoot}), ` +
|
|
124
|
+
`not where you're working (${m.worktreeRoot}) — they may reflect another branch, ` +
|
|
125
|
+
`and symbols changed only here are missing. Run "codegraph init -i" here for a ` +
|
|
126
|
+
`worktree-local index.`);
|
|
127
|
+
}
|
|
128
|
+
/** Resolve symlinks where possible so tmp/realpath quirks don't break equality. */
|
|
129
|
+
function realpath(p) {
|
|
130
|
+
try {
|
|
131
|
+
return fs.realpathSync(path.resolve(p));
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return path.resolve(p);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/sync/worktree.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,0CAYC;AAoBD,kEAgBC;AAGD,0DASC;AAOD,wDAOC;AAtFD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAA6C;AAE7C;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,4BAAY,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE;YAChE,GAAG,EAAE,GAAG;YACR,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;YACnC,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AASD;;;;;;;;;;GAUG;AACH,SAAgB,2BAA2B,CACzC,SAAiB,EACjB,SAAiB;IAEjB,MAAM,YAAY,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IAChD,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAE/B,MAAM,iBAAiB,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,YAAY,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAEpD,4EAA4E;IAC5E,0EAA0E;IAC1E,sEAAsE;IACtE,IAAI,eAAe,CAAC,iBAAiB,CAAC,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAE1E,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;AACxD,CAAC;AAED,gEAAgE;AAChE,SAAgB,uBAAuB,CAAC,CAAwB;IAC9D,OAAO,CACL,iEAAiE;QACjE,iBAAiB,CAAC,CAAC,YAAY,IAAI;QACnC,iBAAiB,CAAC,CAAC,SAAS,IAAI;QAChC,mFAAmF;QACnF,kFAAkF;QAClF,6BAA6B,CAC9B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,CAAwB;IAC7D,OAAO,CACL,iEAAiE,CAAC,CAAC,SAAS,KAAK;QACjF,6BAA6B,CAAC,CAAC,YAAY,uCAAuC;QAClF,gFAAgF;QAChF,uBAAuB,CACxB,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,SAAS,QAAQ,CAAC,CAAS;IACzB,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type EdgeKind = 'contains' | 'calls' | 'imports' | 'exports' | 'extends'
|
|
|
20
20
|
* Supported programming languages. See NODE_KINDS for why this is a
|
|
21
21
|
* runtime-iterable const array.
|
|
22
22
|
*/
|
|
23
|
-
export declare const LANGUAGES: readonly ["typescript", "javascript", "tsx", "jsx", "python", "go", "rust", "java", "c", "cpp", "csharp", "php", "ruby", "swift", "kotlin", "dart", "svelte", "vue", "liquid", "pascal", "scala", "lua", "luau", "yaml", "twig", "unknown"];
|
|
23
|
+
export declare const LANGUAGES: readonly ["typescript", "javascript", "tsx", "jsx", "python", "go", "rust", "java", "c", "cpp", "csharp", "php", "ruby", "swift", "kotlin", "dart", "svelte", "vue", "liquid", "pascal", "scala", "lua", "luau", "objc", "yaml", "twig", "xml", "properties", "unknown"];
|
|
24
24
|
export type Language = (typeof LANGUAGES)[number];
|
|
25
25
|
/**
|
|
26
26
|
* A node in the knowledge graph representing a code symbol
|
|
@@ -169,6 +169,14 @@ export interface Subgraph {
|
|
|
169
169
|
edges: Edge[];
|
|
170
170
|
/** Root node IDs (entry points) */
|
|
171
171
|
roots: string[];
|
|
172
|
+
/**
|
|
173
|
+
* Retrieval confidence for context-style queries. `'low'` means the query
|
|
174
|
+
* resolved only to isolated common-word matches (no entry point corroborated
|
|
175
|
+
* by 2+ distinct query terms) — callers should surface an honest handoff to
|
|
176
|
+
* explore/trace rather than present the results as comprehensive. Undefined
|
|
177
|
+
* for graph traversals that don't run the search-ranking path.
|
|
178
|
+
*/
|
|
179
|
+
confidence?: 'high' | 'low';
|
|
172
180
|
}
|
|
173
181
|
/**
|
|
174
182
|
* Options for graph traversal
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,8PAuBb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,SAAS,GACT,cAAc,GACd,WAAW,GACX,WAAW,CAAC;AAEhB;;;GAGG;AACH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;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;IAC1B,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IAEd,2CAA2C;IAC3C,QAAQ,EAAE,QAAQ,CAAC;IAEnB,+CAA+C;IAC/C,WAAW,EAAE,IAAI,EAAE,CAAC;IAEpB,2CAA2C;IAC3C,UAAU,EAAE,SAAS,EAAE,CAAC;IAExB,qCAAqC;IACrC,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAEhB,mCAAmC;IACnC,KAAK,EAAE;QACL,+BAA+B;QAC/B,SAAS,EAAE,MAAM,CAAC;QAClB,+BAA+B;QAC/B,SAAS,EAAE,MAAM,CAAC;QAClB,8BAA8B;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,qCAAqC;QACrC,cAAc,EAAE,MAAM,CAAC;QACvB,sCAAsC;QACtC,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,yCAAyC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,wCAAwC;IACxC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEvB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB"}
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF;;;;;;GAMG;AACU,QAAA,UAAU,GAAG;IACxB,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,OAAO;IACP,UAAU;IACV,UAAU;IACV,MAAM;IACN,aAAa;IACb,YAAY;IACZ,WAAW;IACX,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,WAAW;CACH,CAAC;AAqBX;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,YAAY;IACZ,YAAY;IACZ,KAAK;IACL,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,GAAG;IACH,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;CACD,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF;;;;;;GAMG;AACU,QAAA,UAAU,GAAG;IACxB,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,OAAO;IACP,UAAU;IACV,UAAU;IACV,MAAM;IACN,aAAa;IACb,YAAY;IACZ,WAAW;IACX,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,WAAW;CACH,CAAC;AAqBX;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,YAAY;IACZ,YAAY;IACZ,KAAK;IACL,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,GAAG;IACH,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,QAAQ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U,EAAE,EAAE;IACd,WAAW,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM;IAChC,iBAAiB,EAAE,IAAI;IACvB,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE;QACd,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,oBAAoB;QAC3B,SAAS,EAAE,EAAE;KACd;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stupidloud/codegraph",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Supercharge Claude Code with semantic code intelligence. 94% fewer tool calls • 77% faster exploration • 100% local.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Arm F (body-inlining trace + trace-first steering) across the same 6 repos as
|
|
3
|
+
# arms-matrix.sh, so F vs B isolates the trace-enrichment effect (same surface,
|
|
4
|
+
# old thin trace in B vs body-inlining trace here).
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
H="$(cd "$(dirname "$0")" && pwd)"; RUNS="${RUNS:-2}"; C="${CORPUS:-/tmp/codegraph-corpus}"
|
|
7
|
+
ROWS=(
|
|
8
|
+
"$C/flutter-samples/add_to_app/books/flutter_module_books|How does the books UI build and what child widgets does it show?"
|
|
9
|
+
"$C/aspnet-realworld|How is creating an article handled? Trace the controller to the service."
|
|
10
|
+
"$C/spring-mall|How is a product-list request handled? Trace the controller to the service."
|
|
11
|
+
"$C/vapor-spi|How is a package-show request handled? Name the route and controller."
|
|
12
|
+
"$C/excalidraw|How does updating an element re-render the canvas on screen? Trace the flow."
|
|
13
|
+
"$C/spring-halo|How is publishing a post handled? Trace the controller to the service."
|
|
14
|
+
)
|
|
15
|
+
ARM="${ARM:-F}"
|
|
16
|
+
echo "### ARM $ARM START $(date) RUNS=$RUNS"
|
|
17
|
+
for row in "${ROWS[@]}"; do
|
|
18
|
+
repo="${row%%|*}"; q="${row#*|}"
|
|
19
|
+
for r in $(seq 1 "$RUNS"); do bash "$H/run-arms.sh" "$repo" "$q" "$ARM" "$r"; done
|
|
20
|
+
done
|
|
21
|
+
echo "### ARM $ARM COMPLETE $(date)"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Drive the tool-surface ablation across the chosen repos × arms (A–E).
|
|
3
|
+
# Arms A–D ask the canonical FLOW question; arm E asks a NON-flow survey
|
|
4
|
+
# question (the control probe — should degrade without explore+context).
|
|
5
|
+
# Output: /tmp/arms/<repo>/<arm>-r<n>.jsonl (parse with parse-arms.mjs).
|
|
6
|
+
set -uo pipefail
|
|
7
|
+
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
8
|
+
RUNS="${RUNS:-2}"
|
|
9
|
+
C="${CORPUS:-/tmp/codegraph-corpus}"
|
|
10
|
+
NFQ='What are the main modules/components of this codebase and what does each one do? Give an overview of how it is organized.'
|
|
11
|
+
|
|
12
|
+
# repo-path|flow-question (2 small, 2 medium, 2 large — spans the size range)
|
|
13
|
+
ROWS=(
|
|
14
|
+
"$C/flutter-samples/add_to_app/books/flutter_module_books|How does the books UI build and what child widgets does it show?"
|
|
15
|
+
"$C/aspnet-realworld|How is creating an article handled? Trace the controller to the service."
|
|
16
|
+
"$C/spring-mall|How is a product-list request handled? Trace the controller to the service."
|
|
17
|
+
"$C/vapor-spi|How is a package-show request handled? Name the route and controller."
|
|
18
|
+
"$C/excalidraw|How does updating an element re-render the canvas on screen? Trace the flow."
|
|
19
|
+
"$C/spring-halo|How is publishing a post handled? Trace the controller to the service."
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
echo "### ARMS MATRIX START $(date) RUNS=$RUNS"
|
|
23
|
+
for row in "${ROWS[@]}"; do
|
|
24
|
+
repo="${row%%|*}"; q="${row#*|}"
|
|
25
|
+
for arm in A B C D; do
|
|
26
|
+
for r in $(seq 1 "$RUNS"); do
|
|
27
|
+
bash "$HARNESS/run-arms.sh" "$repo" "$q" "$arm" "$r"
|
|
28
|
+
done
|
|
29
|
+
done
|
|
30
|
+
done
|
|
31
|
+
# E: non-flow control probe on two repos (must degrade without explore+context)
|
|
32
|
+
for repo in "$C/excalidraw" "$C/spring-mall"; do
|
|
33
|
+
for r in $(seq 1 "$RUNS"); do
|
|
34
|
+
bash "$HARNESS/run-arms.sh" "$repo" "$NFQ" E "$r"
|
|
35
|
+
done
|
|
36
|
+
done
|
|
37
|
+
echo "### ARMS MATRIX COMPLETE $(date)"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Re-run the README "Benchmark Results" A/B (with vs without codegraph) on the
|
|
3
|
+
# current build: the 7 README repos, same queries, RUNS per arm (default 4).
|
|
4
|
+
# Output → /tmp/ab-readme/<repo>/run<n>/run-headless-{with,without}.jsonl
|
|
5
|
+
# Aggregate with parse-bench-readme.mjs. Repos must be cloned + indexed under
|
|
6
|
+
# $CORPUS (default /tmp/codegraph-corpus) by the build under test.
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
H="$(cd "$(dirname "$0")" && pwd)"
|
|
9
|
+
C="${CORPUS:-/tmp/codegraph-corpus}"
|
|
10
|
+
RUNS="${RUNS:-4}"
|
|
11
|
+
ROWS=(
|
|
12
|
+
"vscode|How does the extension host communicate with the main process?"
|
|
13
|
+
"excalidraw|How does Excalidraw render and update canvas elements?"
|
|
14
|
+
"django|How does Django's ORM build and execute a query from a QuerySet?"
|
|
15
|
+
"tokio|How does tokio schedule and run async tasks on its runtime?"
|
|
16
|
+
"okhttp|How does OkHttp process a request through its interceptor chain?"
|
|
17
|
+
"gin|How does gin route requests through its middleware chain?"
|
|
18
|
+
"alamofire|How does Alamofire build, send, and validate a request?"
|
|
19
|
+
)
|
|
20
|
+
echo "### README A/B START $(date) RUNS=$RUNS"
|
|
21
|
+
for row in "${ROWS[@]}"; do
|
|
22
|
+
repo="${row%%|*}"; q="${row#*|}"
|
|
23
|
+
echo "===== $repo ====="
|
|
24
|
+
for run in $(seq 1 "$RUNS"); do
|
|
25
|
+
AGENT_EVAL_OUT="/tmp/ab-readme/$repo/run$run" bash "$H/run-all.sh" "$C/$repo" "$q" headless 2>&1 | grep -E "exit [0-9]" || echo " run$run: (no exit line)"
|
|
26
|
+
done
|
|
27
|
+
done
|
|
28
|
+
echo "### README A/B DONE $(date)"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# One README repo, WITH-codegraph only, N runs. Each run appends a why-Read
|
|
3
|
+
# diagnostic so the agent explains any Read/Grep. (The WITHOUT baseline is
|
|
4
|
+
# codegraph-independent and already in the README — no point re-running it.)
|
|
5
|
+
# Output -> /tmp/ab-why/<repo>/with<n>.jsonl
|
|
6
|
+
# Usage: bench-why-repo.sh <repo-path> "<query>" [N]
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
REPO="$1"; Q="$2"; N="${3:-4}"
|
|
9
|
+
NAME="$(basename "$REPO")"
|
|
10
|
+
CG="/Users/colby/Development/Personal/codegraph/dist/bin/codegraph.js"
|
|
11
|
+
OUT="/tmp/ab-why/$NAME"; mkdir -p "$OUT"
|
|
12
|
+
WHY=$'\n\nIMPORTANT — diagnostic: if you use the Read or Grep tool at ANY point, for EACH such call explain why codegraph_explore / codegraph_node did not already give you what you needed. End your entire answer with a section titled exactly "## Why I read" listing every Read and Grep you made and the precise reason codegraph fell short for it. If you used neither, write "## Why I read" then "none — codegraph was sufficient."'
|
|
13
|
+
printf '{"mcpServers":{"codegraph":{"command":"%s","args":["serve","--mcp","--path","%s"]}}}' "$CG" "$REPO" > "$OUT/cg.json"
|
|
14
|
+
|
|
15
|
+
for i in $(seq 1 "$N"); do
|
|
16
|
+
pkill -f "serve --mcp" 2>/dev/null; sleep 1; rm -f "$REPO/.codegraph/daemon.sock"
|
|
17
|
+
( cd "$REPO" && claude -p "$Q$WHY" --output-format stream-json --verbose \
|
|
18
|
+
--permission-mode bypassPermissions --model opus --effort "${EFFORT:-high}" --max-budget-usd 4 \
|
|
19
|
+
--strict-mcp-config --mcp-config "$OUT/cg.json" > "$OUT/with$i.jsonl" 2>"$OUT/with$i.err" )
|
|
20
|
+
echo "WITH run $i: exit $? ($(wc -l < "$OUT/with$i.jsonl" | tr -d ' ') lines)"
|
|
21
|
+
done
|
|
22
|
+
echo "DONE $NAME"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse hook (experiment): deny Read of codegraph-indexed source files and
|
|
3
|
+
# steer the agent to codegraph_explore/codegraph_node instead. Tests whether
|
|
4
|
+
# codegraph can FULLY replace Read for code-understanding once the escape hatch
|
|
5
|
+
# is removed. Non-source reads (config, .env, markdown, new files) pass through.
|
|
6
|
+
#
|
|
7
|
+
# Wire via: claude ... --settings scripts/agent-eval/hook-settings.json
|
|
8
|
+
set -uo pipefail
|
|
9
|
+
input="$(cat)"
|
|
10
|
+
fp="$(printf '%s' "$input" | jq -r '.tool_input.file_path // empty' 2>/dev/null)"
|
|
11
|
+
|
|
12
|
+
case "$fp" in
|
|
13
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.py|*.go|*.rs|*.java|*.rb|*.php|*.swift|*.kt|*.kts|*.c|*.cc|*.cpp|*.h|*.hpp|*.cs|*.lua|*.vue|*.svelte)
|
|
14
|
+
msg="Read is disabled for source files in this session — codegraph already has this file indexed (with line numbers, kept in sync on every change). Use codegraph_explore (several related symbols at once) or codegraph_node (one symbol's full source). If a symbol you need wasn't in a prior explore, run ANOTHER codegraph_explore with its exact name instead of reading the file."
|
|
15
|
+
jq -n --arg m "$msg" '{reason:$m, hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$m}}'
|
|
16
|
+
exit 0
|
|
17
|
+
;;
|
|
18
|
+
esac
|
|
19
|
+
exit 0
|
|
@@ -81,25 +81,38 @@ for _ in $(seq 1 120); do
|
|
|
81
81
|
done
|
|
82
82
|
[ "$started" = 1 ] || { echo "agent never started working"; cap; tmux kill-session -t "$SESSION" 2>/dev/null; exit 1; }
|
|
83
83
|
|
|
84
|
-
# Poll for idle:
|
|
85
|
-
#
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
# Poll for idle. CRITICAL: Opus 4.8 (extended thinking) renders NO spinner /
|
|
85
|
+
# "esc to interrupt" / timer while it STREAMS its final answer — those appear
|
|
86
|
+
# only during the thinking + tool-use phases ("✻ Marinating… (32s · ↓ 1.3k
|
|
87
|
+
# tokens · thinking with max effort)"). So BUSY_RE reads "not busy" for the whole
|
|
88
|
+
# 10-30s answer stream, and any short not-busy threshold kills the run mid-answer
|
|
89
|
+
# (the truncation bug). We therefore detect "done" by CONTENT STABILITY, not by a
|
|
90
|
+
# spinner string: while the agent streams, the captured pane changes every poll,
|
|
91
|
+
# so stability never accrues; it accrues only once the agent has finished and the
|
|
92
|
+
# static "✻ Brewed for 1m 9s" summary is all that is left. BUSY_RE still hard-
|
|
93
|
+
# resets stability (covers thinking/tool-use/live-timer, where text can briefly
|
|
94
|
+
# sit still). Need STABLE_NEEDED polls (~8s) of zero pane change + ❯ present.
|
|
95
|
+
# Content-stability is model-agnostic — it survives future spinner re-wordings.
|
|
96
|
+
STABLE_NEEDED=16
|
|
97
|
+
prev=""; stable=0
|
|
98
|
+
for _ in $(seq 1 2400); do # up to ~20 min
|
|
99
|
+
pane="$(cap)"
|
|
100
|
+
sig="$(printf '%s' "$pane" | tr -s '[:space:]' ' ')"
|
|
101
|
+
if printf '%s' "$pane" | grep -qE "$BUSY_RE"; then
|
|
102
|
+
stable=0 # thinking / tool use / live timer → busy
|
|
103
|
+
elif [ -n "$sig" ] && [ "$sig" = "$prev" ] && printf '%s' "$pane" | grep -q "❯"; then
|
|
104
|
+
stable=$((stable+1)); [ "$stable" -ge "$STABLE_NEEDED" ] && break
|
|
93
105
|
else
|
|
94
|
-
|
|
106
|
+
stable=0 # answer still streaming → pane changing
|
|
95
107
|
fi
|
|
108
|
+
prev="$sig"
|
|
96
109
|
sleep 0.5
|
|
97
110
|
done
|
|
98
111
|
sleep 1
|
|
99
112
|
|
|
100
113
|
tmux capture-pane -p -t "$SESSION" -S - > "$OUT"
|
|
101
114
|
echo "captured $(wc -l < "$OUT") lines -> $OUT"
|
|
102
|
-
grep -oE "Done \([^)]*\)" "$OUT" | tail -1
|
|
115
|
+
grep -oE "Done \([^)]*\)|[A-Z][a-z]+ for ([0-9]+m )?[0-9]+s" "$OUT" | tail -1
|
|
103
116
|
grep -oE "[0-9.]+k?/[0-9.]+M" "$OUT" | tail -1 | sed 's/^/Context /'
|
|
104
117
|
tmux kill-session -t "$SESSION" 2>/dev/null
|
|
105
118
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Analyze the tool-surface ablation (/tmp/arms/<repo>/<arm>-r<n>.jsonl).
|
|
3
|
+
// Compares arms A–E on trace adoption, Read/Grep fallback, codegraph payload,
|
|
4
|
+
// round-trips, and duration — averaged across runs per arm.
|
|
5
|
+
//
|
|
6
|
+
// The decisive signal is READS: if removing a tool raises Reads on a question
|
|
7
|
+
// class, that tool was load-bearing for it (not redundant). If removing it
|
|
8
|
+
// changes nothing, it was redundant.
|
|
9
|
+
//
|
|
10
|
+
// A control all tools no steering (baseline)
|
|
11
|
+
// B steer all tools trace-first (adoption)
|
|
12
|
+
// C no-explore hide explore trace-first (is explore redundant?)
|
|
13
|
+
// D trace-centric hide explore+context trace-first (is the survey pair redundant?)
|
|
14
|
+
// E control-probe hide explore+context trace-first (NON-flow Q — should degrade)
|
|
15
|
+
//
|
|
16
|
+
// Usage: node scripts/agent-eval/parse-arms.mjs [/tmp/arms]
|
|
17
|
+
import { readFileSync, readdirSync, existsSync, statSync } from 'fs';
|
|
18
|
+
import { join } from 'path';
|
|
19
|
+
|
|
20
|
+
const ROOT = process.argv[2] || '/tmp/arms';
|
|
21
|
+
const cgShort = (n) => n.replace('mcp__codegraph__codegraph_', '').replace('mcp__codegraph__', '');
|
|
22
|
+
|
|
23
|
+
function parse(file) {
|
|
24
|
+
if (!existsSync(file)) return null;
|
|
25
|
+
const lines = readFileSync(file, 'utf8').split('\n').filter(Boolean);
|
|
26
|
+
const calls = []; let result = null, initCg = 0;
|
|
27
|
+
for (const l of lines) {
|
|
28
|
+
let ev; try { ev = JSON.parse(l); } catch { continue; }
|
|
29
|
+
if (ev.type === 'system' && ev.subtype === 'init') initCg = (ev.tools || []).filter(t => /codegraph/.test(t)).length;
|
|
30
|
+
if (ev.type === 'assistant') for (const b of (ev.message?.content || [])) if (b.type === 'tool_use')
|
|
31
|
+
calls.push({ id: b.id, name: b.name, out: 0 });
|
|
32
|
+
if (ev.type === 'user') for (const b of (ev.message?.content || [])) if (b.type === 'tool_result') {
|
|
33
|
+
const c = b.content;
|
|
34
|
+
const txt = typeof c === 'string' ? c : Array.isArray(c) ? c.map(x => x?.text || '').join('') : '';
|
|
35
|
+
const call = calls.find(k => k.id === b.tool_use_id); if (call) call.out = txt.length;
|
|
36
|
+
}
|
|
37
|
+
if (ev.type === 'result') result = ev;
|
|
38
|
+
}
|
|
39
|
+
const cg = calls.filter(c => c.name.includes('codegraph'));
|
|
40
|
+
return {
|
|
41
|
+
initCg,
|
|
42
|
+
reads: calls.filter(c => c.name === 'Read').length,
|
|
43
|
+
greps: calls.filter(c => c.name === 'Grep').length + calls.filter(c => c.name === 'Glob').length,
|
|
44
|
+
cgCalls: cg.length,
|
|
45
|
+
cgSeq: cg.map(c => cgShort(c.name)),
|
|
46
|
+
cgOut: cg.reduce((s, c) => s + c.out, 0),
|
|
47
|
+
traceUsed: cg.some(c => c.name.includes('trace')),
|
|
48
|
+
turns: result?.num_turns ?? null,
|
|
49
|
+
dur: result?.duration_ms ? Math.round(result.duration_ms / 1000) : null,
|
|
50
|
+
cost: result?.total_cost_usd || 0,
|
|
51
|
+
ok: result?.subtype === 'success',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// repo -> arm -> [runs]
|
|
56
|
+
const data = {};
|
|
57
|
+
if (!existsSync(ROOT)) { console.error(`no ${ROOT}`); process.exit(1); }
|
|
58
|
+
for (const repo of readdirSync(ROOT)) {
|
|
59
|
+
const rdir = join(ROOT, repo);
|
|
60
|
+
if (!statSync(rdir).isDirectory()) continue;
|
|
61
|
+
for (const f of readdirSync(rdir)) {
|
|
62
|
+
const m = f.match(/^([A-I])-r(\d+)\.jsonl$/); if (!m) continue;
|
|
63
|
+
const p = parse(join(rdir, f)); if (!p || !p.ok) continue;
|
|
64
|
+
(((data[repo] ??= {})[m[1]]) ??= []).push(p);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const avg = (a, f) => a.length ? a.reduce((s, x) => s + (f(x) || 0), 0) / a.length : 0;
|
|
69
|
+
const k = (n) => (n / 1000).toFixed(1);
|
|
70
|
+
const pad = (s, n) => String(s).padEnd(n);
|
|
71
|
+
const ARMS = ['A', 'H', 'I', 'B', 'F', 'G', 'C', 'D', 'E'];
|
|
72
|
+
const LABEL = { A: 'A all/none(old)', H: 'H body-trace/none', I: 'I bodytrace+dest', B: 'B all/steer(thin)', F: 'F all/steer(body)', G: 'G ported(noprompt)', C: 'C no-explore', D: 'D trace-centric', E: 'E nonflow-probe' };
|
|
73
|
+
|
|
74
|
+
// ---- per repo × arm ----
|
|
75
|
+
console.log('\n=== PER REPO × ARM (avg over runs) ===');
|
|
76
|
+
console.log(pad('repo', 22), pad('arm', 16), 'tools', 'trace', pad('reads', 6), pad('cgOutK', 7), pad('turns', 6), 'dur');
|
|
77
|
+
for (const repo of Object.keys(data).sort()) {
|
|
78
|
+
for (const arm of ARMS) {
|
|
79
|
+
const runs = data[repo][arm]; if (!runs?.length) continue;
|
|
80
|
+
console.log(
|
|
81
|
+
pad(repo, 22), pad(LABEL[arm], 16),
|
|
82
|
+
pad(runs[0].initCg, 5),
|
|
83
|
+
pad(runs.filter(r => r.traceUsed).length + '/' + runs.length, 5),
|
|
84
|
+
pad(avg(runs, r => r.reads).toFixed(1), 6),
|
|
85
|
+
pad(k(avg(runs, r => r.cgOut)), 7),
|
|
86
|
+
pad(avg(runs, r => r.turns).toFixed(1), 6),
|
|
87
|
+
avg(runs, r => r.dur).toFixed(0) + 's',
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---- aggregate per arm (flow arms A–D over the flow repos; E shown apart) ----
|
|
93
|
+
console.log('\n=== AGGREGATE PER ARM (mean across repos) ===');
|
|
94
|
+
console.log(pad('arm', 16), pad('adoption', 9), pad('reads', 7), pad('greps', 7), pad('cgOutK', 8), pad('turns', 7), pad('dur', 6), 'cost');
|
|
95
|
+
for (const arm of ARMS) {
|
|
96
|
+
const all = [];
|
|
97
|
+
for (const repo of Object.keys(data)) for (const r of (data[repo][arm] || [])) all.push({ ...r, repo });
|
|
98
|
+
if (!all.length) continue;
|
|
99
|
+
const repos = new Set(all.map(r => r.repo)).size;
|
|
100
|
+
const adopt = all.filter(r => r.traceUsed).length;
|
|
101
|
+
console.log(
|
|
102
|
+
pad(LABEL[arm], 16),
|
|
103
|
+
pad(`${adopt}/${all.length}`, 9),
|
|
104
|
+
pad(avg(all, r => r.reads).toFixed(2), 7),
|
|
105
|
+
pad(avg(all, r => r.greps).toFixed(2), 7),
|
|
106
|
+
pad(k(avg(all, r => r.cgOut)), 8),
|
|
107
|
+
pad(avg(all, r => r.turns).toFixed(1), 7),
|
|
108
|
+
pad(avg(all, r => r.dur).toFixed(0) + 's', 6),
|
|
109
|
+
'$' + avg(all, r => r.cost).toFixed(3),
|
|
110
|
+
` (${repos} repos)`,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
console.log('\nRead the signal: B vs A = does steering alone fix adoption + cut payload.');
|
|
115
|
+
console.log('C vs B = is explore redundant (reads should NOT jump). D vs C = is context redundant.');
|
|
116
|
+
console.log('E = non-flow under trace-centric; reads SHOULD jump (proves survey tools are load-bearing).');
|