homegraph 1.1.2 → 1.2.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/LICENSE +21 -21
- package/README.md +268 -243
- package/dist/arkts/ohos-api-index.d.ts +15 -0
- package/dist/arkts/ohos-api-index.d.ts.map +1 -0
- package/dist/arkts/ohos-api-index.js +190 -0
- package/dist/arkts/ohos-api-index.js.map +1 -0
- package/dist/arkts/ohos-sdk-input.d.ts +36 -0
- package/dist/arkts/ohos-sdk-input.d.ts.map +1 -0
- package/dist/arkts/ohos-sdk-input.js +214 -0
- package/dist/arkts/ohos-sdk-input.js.map +1 -0
- package/dist/bin/command-supervision.d.ts +12 -0
- package/dist/bin/command-supervision.d.ts.map +1 -0
- package/dist/bin/command-supervision.js +86 -0
- package/dist/bin/command-supervision.js.map +1 -0
- package/dist/bin/homegraph.d.ts +1 -1
- package/dist/bin/homegraph.js +971 -71
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/db/index.d.ts +20 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +39 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +58 -19
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +14 -0
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +314 -143
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +172 -152
- package/dist/directory.d.ts +32 -0
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +88 -5
- package/dist/directory.js.map +1 -1
- package/dist/extraction/arkts-batch-worker.d.ts +2 -0
- package/dist/extraction/arkts-batch-worker.d.ts.map +1 -0
- package/dist/extraction/arkts-batch-worker.js +28 -0
- package/dist/extraction/arkts-batch-worker.js.map +1 -0
- package/dist/extraction/context.d.ts +11 -0
- package/dist/extraction/context.d.ts.map +1 -1
- package/dist/extraction/context.js +20 -0
- package/dist/extraction/context.js.map +1 -1
- package/dist/extraction/index.d.ts +16 -2
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +619 -380
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts-state-decorators.d.ts +13 -0
- package/dist/extraction/languages/arkts-state-decorators.d.ts.map +1 -0
- package/dist/extraction/languages/arkts-state-decorators.js +26 -0
- package/dist/extraction/languages/arkts-state-decorators.js.map +1 -0
- package/dist/extraction/languages/arkts-viewtree.d.ts +4 -2
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.js +21 -6
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +98 -2
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1290 -61
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts +56 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +198 -1
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/ohos-api-consumer.d.ts +34 -0
- package/dist/extraction/languages/ohos-api-consumer.d.ts.map +1 -0
- package/dist/extraction/languages/ohos-api-consumer.js +283 -0
- package/dist/extraction/languages/ohos-api-consumer.js.map +1 -0
- package/dist/extraction/parse-pool.d.ts +126 -0
- package/dist/extraction/parse-pool.d.ts.map +1 -0
- package/dist/extraction/parse-pool.js +319 -0
- package/dist/extraction/parse-pool.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +17 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +21 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +198 -27
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +76 -17
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -4
- package/dist/index.js.map +1 -1
- package/dist/installer/instructions-template.js +9 -9
- package/dist/installer/targets/shared.d.ts +5 -6
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +5 -6
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +30 -3
- package/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.js +50 -10
- package/dist/mcp/daemon-paths.js.map +1 -1
- package/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/dist/mcp/daemon-registry.js +7 -3
- package/dist/mcp/daemon-registry.js.map +1 -1
- package/dist/mcp/daemon.d.ts +48 -0
- package/dist/mcp/daemon.d.ts.map +1 -1
- package/dist/mcp/daemon.js +196 -32
- package/dist/mcp/daemon.js.map +1 -1
- package/dist/mcp/engine.d.ts +17 -0
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +73 -1
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +25 -43
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/liveness-watchdog.js +16 -16
- package/dist/mcp/ppid-watchdog.d.ts +18 -0
- package/dist/mcp/ppid-watchdog.d.ts.map +1 -1
- package/dist/mcp/ppid-watchdog.js +37 -0
- package/dist/mcp/ppid-watchdog.js.map +1 -1
- package/dist/mcp/query-cache.d.ts +25 -0
- package/dist/mcp/query-cache.d.ts.map +1 -0
- package/dist/mcp/query-cache.js +191 -0
- package/dist/mcp/query-cache.js.map +1 -0
- package/dist/mcp/query-pool.d.ts +94 -0
- package/dist/mcp/query-pool.d.ts.map +1 -0
- package/dist/mcp/query-pool.js +297 -0
- package/dist/mcp/query-pool.js.map +1 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/query-worker.d.ts.map +1 -0
- package/dist/mcp/query-worker.js +87 -0
- package/dist/mcp/query-worker.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +5 -7
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +72 -74
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/tools.d.ts +94 -4
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +877 -71
- package/dist/mcp/tools.js.map +1 -1
- package/dist/project-config.d.ts +20 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +42 -2
- package/dist/project-config.js.map +1 -1
- package/dist/reasoning/login.js +1 -1
- package/dist/reasoning/login.js.map +1 -1
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/resolution/c-fnptr-synthesizer.d.ts +0 -28
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.js +765 -79
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +72 -11
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/cooperative-yield.d.ts +32 -0
- package/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/dist/resolution/cooperative-yield.js +42 -0
- package/dist/resolution/cooperative-yield.js.map +1 -0
- package/dist/resolution/index.d.ts +11 -2
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +72 -4
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/name-matcher.d.ts +22 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +317 -20
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/spec/config.d.ts +39 -0
- package/dist/spec/config.d.ts.map +1 -0
- package/dist/spec/config.js +304 -0
- package/dist/spec/config.js.map +1 -0
- package/dist/spec/db/commit-node.d.ts +23 -0
- package/dist/spec/db/commit-node.d.ts.map +1 -0
- package/dist/spec/db/commit-node.js +62 -0
- package/dist/spec/db/commit-node.js.map +1 -0
- package/dist/spec/db/fragment-node.d.ts +24 -0
- package/dist/spec/db/fragment-node.d.ts.map +1 -0
- package/dist/spec/db/fragment-node.js +128 -0
- package/dist/spec/db/fragment-node.js.map +1 -0
- package/dist/spec/db/fts.d.ts +74 -0
- package/dist/spec/db/fts.d.ts.map +1 -0
- package/dist/spec/db/fts.js +324 -0
- package/dist/spec/db/fts.js.map +1 -0
- package/dist/spec/db/index.d.ts +13 -0
- package/dist/spec/db/index.d.ts.map +1 -0
- package/dist/spec/db/index.js +50 -0
- package/dist/spec/db/index.js.map +1 -0
- package/dist/spec/db/relations.d.ts +55 -0
- package/dist/spec/db/relations.d.ts.map +1 -0
- package/dist/spec/db/relations.js +158 -0
- package/dist/spec/db/relations.js.map +1 -0
- package/dist/spec/db/schema.d.ts +33 -0
- package/dist/spec/db/schema.d.ts.map +1 -0
- package/dist/spec/db/schema.js +119 -0
- package/dist/spec/db/schema.js.map +1 -0
- package/dist/spec/db/schema.sql +117 -0
- package/dist/spec/db/spec-node.d.ts +41 -0
- package/dist/spec/db/spec-node.d.ts.map +1 -0
- package/dist/spec/db/spec-node.js +114 -0
- package/dist/spec/db/spec-node.js.map +1 -0
- package/dist/spec/evolve/impact-locator.d.ts +13 -0
- package/dist/spec/evolve/impact-locator.d.ts.map +1 -0
- package/dist/spec/evolve/impact-locator.js +25 -0
- package/dist/spec/evolve/impact-locator.js.map +1 -0
- package/dist/spec/evolve/llm-client.d.ts +50 -0
- package/dist/spec/evolve/llm-client.d.ts.map +1 -0
- package/dist/spec/evolve/llm-client.js +176 -0
- package/dist/spec/evolve/llm-client.js.map +1 -0
- package/dist/spec/evolve/logic-checker.d.ts +12 -0
- package/dist/spec/evolve/logic-checker.d.ts.map +1 -0
- package/dist/spec/evolve/logic-checker.js +24 -0
- package/dist/spec/evolve/logic-checker.js.map +1 -0
- package/dist/spec/evolve/pipeline.d.ts +42 -0
- package/dist/spec/evolve/pipeline.d.ts.map +1 -0
- package/dist/spec/evolve/pipeline.js +567 -0
- package/dist/spec/evolve/pipeline.js.map +1 -0
- package/dist/spec/evolve/spec-rewriter.d.ts +42 -0
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -0
- package/dist/spec/evolve/spec-rewriter.js +230 -0
- package/dist/spec/evolve/spec-rewriter.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +155 -0
- package/dist/spec/graph/queries.d.ts.map +1 -0
- package/dist/spec/graph/queries.js +440 -0
- package/dist/spec/graph/queries.js.map +1 -0
- package/dist/spec/llm/client.d.ts +29 -0
- package/dist/spec/llm/client.d.ts.map +1 -0
- package/dist/spec/llm/client.js +123 -0
- package/dist/spec/llm/client.js.map +1 -0
- package/dist/spec/llm/index.d.ts +3 -0
- package/dist/spec/llm/index.d.ts.map +1 -0
- package/dist/spec/llm/index.js +11 -0
- package/dist/spec/llm/index.js.map +1 -0
- package/dist/spec/llm/prompts.d.ts +13 -0
- package/dist/spec/llm/prompts.d.ts.map +1 -0
- package/dist/spec/llm/prompts.js +75 -0
- package/dist/spec/llm/prompts.js.map +1 -0
- package/dist/spec/mining/diff-parser.d.ts +33 -0
- package/dist/spec/mining/diff-parser.d.ts.map +1 -0
- package/dist/spec/mining/diff-parser.js +166 -0
- package/dist/spec/mining/diff-parser.js.map +1 -0
- package/dist/spec/mining/git-scanner.d.ts +103 -0
- package/dist/spec/mining/git-scanner.d.ts.map +1 -0
- package/dist/spec/mining/git-scanner.js +307 -0
- package/dist/spec/mining/git-scanner.js.map +1 -0
- package/dist/spec/mining/pipeline.d.ts +53 -0
- package/dist/spec/mining/pipeline.d.ts.map +1 -0
- package/dist/spec/mining/pipeline.js +178 -0
- package/dist/spec/mining/pipeline.js.map +1 -0
- package/dist/spec/mining/scope-resolver.d.ts +45 -0
- package/dist/spec/mining/scope-resolver.d.ts.map +1 -0
- package/dist/spec/mining/scope-resolver.js +103 -0
- package/dist/spec/mining/scope-resolver.js.map +1 -0
- package/dist/spec/mining/spec-extractor.d.ts +69 -0
- package/dist/spec/mining/spec-extractor.d.ts.map +1 -0
- package/dist/spec/mining/spec-extractor.js +369 -0
- package/dist/spec/mining/spec-extractor.js.map +1 -0
- package/dist/spec/types.d.ts +149 -0
- package/dist/spec/types.d.ts.map +1 -0
- package/dist/spec/types.js +15 -0
- package/dist/spec/types.js.map +1 -0
- package/dist/spec/utils.d.ts +167 -0
- package/dist/spec/utils.d.ts.map +1 -0
- package/dist/spec/utils.js +463 -0
- package/dist/spec/utils.js.map +1 -0
- package/dist/sync/worktree.d.ts +9 -0
- package/dist/sync/worktree.d.ts.map +1 -1
- package/dist/sync/worktree.js +40 -0
- package/dist/sync/worktree.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.d.ts +2 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.js +19 -2
- package/dist/ui/shimmer-progress.js.map +1 -1
- package/dist/upgrade/index.js +1 -1
- package/dist/upgrade/index.js.map +1 -1
- package/package.json +58 -57
- package/scripts/add-lang/bench.sh +60 -60
- package/scripts/add-lang/check-grammar.mjs +75 -75
- package/scripts/add-lang/dump-ast.mjs +103 -103
- package/scripts/add-lang/verify-extraction.mjs +70 -70
- package/scripts/agent-eval/ab-adoption.sh +91 -91
- package/scripts/agent-eval/ab-hook.sh +86 -86
- package/scripts/agent-eval/ab-impl.sh +78 -78
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
- package/scripts/agent-eval/ab-sufficiency.sh +78 -78
- package/scripts/agent-eval/arms-F.sh +21 -21
- package/scripts/agent-eval/arms-matrix.sh +37 -37
- package/scripts/agent-eval/audit.sh +68 -68
- package/scripts/agent-eval/bench-readme.sh +28 -28
- package/scripts/agent-eval/bench-why-repo.sh +22 -22
- package/scripts/agent-eval/block-read-hook.sh +19 -19
- package/scripts/agent-eval/hook-settings.json +15 -15
- package/scripts/agent-eval/itrun.sh +120 -120
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
- package/scripts/agent-eval/offload-eval-setup.sh +24 -24
- package/scripts/agent-eval/offload-eval-styles.sh +71 -71
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
- package/scripts/agent-eval/offload-eval.md +76 -76
- package/scripts/agent-eval/parse-arms.mjs +116 -116
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
- package/scripts/agent-eval/parse-run.mjs +45 -45
- package/scripts/agent-eval/parse-session.mjs +93 -93
- package/scripts/agent-eval/probe-context.mjs +21 -21
- package/scripts/agent-eval/probe-explore.mjs +40 -40
- package/scripts/agent-eval/probe-node.mjs +20 -20
- package/scripts/agent-eval/probe-sweep.mjs +119 -119
- package/scripts/agent-eval/probe-trace.mjs +20 -20
- package/scripts/agent-eval/redirect-read-hook.sh +38 -38
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +69 -69
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/build-bundle.sh +118 -118
- package/scripts/exp_boundary_eval/README.md +247 -0
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -0
- package/scripts/exp_boundary_eval/_test_stdin.py +8 -0
- package/scripts/exp_boundary_eval/_utils.py +1116 -0
- package/scripts/exp_boundary_eval/analyze.py +1313 -0
- package/scripts/exp_boundary_eval/data/agents.json +109 -0
- package/scripts/exp_boundary_eval/data/experiments.json +140 -0
- package/scripts/exp_boundary_eval/deveco_arm.py +519 -0
- package/scripts/exp_boundary_eval/run_all.py +378 -0
- package/scripts/exp_boundary_eval/run_one.py +165 -0
- package/scripts/exp_boundary_eval/run_session.py +158 -0
- package/scripts/exp_boundary_eval/setup.py +120 -0
- package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -0
- package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -0
- package/scripts/exp_boundary_eval/win_node_launcher.py +24 -0
- package/scripts/extract-release-notes.mjs +130 -130
- package/scripts/local-install.sh +41 -41
- package/scripts/npm-sdk.js +75 -75
- package/scripts/npm-shim.js +268 -246
- package/scripts/ohos-sdk-publish.mjs +133 -0
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/qa_eval/README.md +407 -404
- package/scripts/qa_eval/_test_deveco_probe.py +41 -41
- package/scripts/qa_eval/agent_runner.py +526 -526
- package/scripts/qa_eval/data/.gitignore +4 -4
- package/scripts/qa_eval/data/test-set.jsonl +2 -22
- package/scripts/qa_eval/eval_metrics.py +274 -233
- package/scripts/qa_eval/external_agent.py +976 -671
- package/scripts/qa_eval/llm_config.py +92 -92
- package/scripts/qa_eval/memory_monitor.py +132 -132
- package/scripts/qa_eval/my_answer_accuracy.py +187 -187
- package/scripts/qa_eval/requirements.txt +2 -2
- package/scripts/qa_eval/run_pipeline.py +804 -711
- package/scripts/qa_eval/stats_efficiency.py +279 -279
- package/scripts/qa_eval/stats_scores.py +207 -207
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Sufficiency A/B: on a real understanding/flow question, WHEN the agent uses
|
|
3
|
-
# homegraph (explore/node), does it still Read? Premise under test: explore/node
|
|
4
|
-
# return source WITH line numbers, so a Read should not be needed.
|
|
5
|
-
#
|
|
6
|
-
# WITH homegraph (pre-warmed daemon, reliable nested attach) vs WITHOUT (empty
|
|
7
|
-
# MCP, Read/Grep only), N runs each, on a throwaway copy of the repo. Reports
|
|
8
|
-
# explore/node vs Read/Grep, and LISTS the files Read in the WITH arm so a true
|
|
9
|
-
# sufficiency gap (an indexed source file) is distinguishable from out-of-scope
|
|
10
|
-
# (configs, docs, a file homegraph didn't index).
|
|
11
|
-
#
|
|
12
|
-
# Usage: ab-sufficiency.sh <indexed-repo> "<question>" [runs-per-arm]
|
|
13
|
-
# Env: AGENT_EVAL_OUT (default: /tmp/ab-sufficiency)
|
|
14
|
-
set -uo pipefail
|
|
15
|
-
REPO="${1:?usage: ab-sufficiency.sh <indexed-repo> \"<question>\" [runs]}"
|
|
16
|
-
Q="${2:?question required}"
|
|
17
|
-
RUNS="${3:-2}"
|
|
18
|
-
ENGINE="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
19
|
-
BIN="$ENGINE/dist/bin/homegraph.js"
|
|
20
|
-
OUT="${AGENT_EVAL_OUT:-/tmp/ab-sufficiency}"
|
|
21
|
-
TGT="$OUT/target"
|
|
22
|
-
command -v claude >/dev/null || { echo "claude CLI not on PATH"; exit 1; }
|
|
23
|
-
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO"; exit 1; }
|
|
24
|
-
cleanup(){ pkill -9 -f "serve --mcp --path $TGT" 2>/dev/null; }
|
|
25
|
-
trap cleanup EXIT
|
|
26
|
-
mkdir -p "$OUT"
|
|
27
|
-
( cd "$ENGINE" && npm run build >/dev/null 2>&1 ) && echo "built"
|
|
28
|
-
|
|
29
|
-
# Throwaway copy + fresh index (the agent works here; a read-only question won't
|
|
30
|
-
# edit, but isolate anyway). Excludes the source repo's index/build/vcs.
|
|
31
|
-
rm -rf "$TGT"
|
|
32
|
-
rsync -a --exclude node_modules --exclude .git --exclude dist --exclude .homegraph "$REPO/" "$TGT/"
|
|
33
|
-
node "$BIN" init "$TGT" >/dev/null 2>&1 && echo "indexed copy ($(node "$BIN" status --json 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{console.log(JSON.parse(s).fileCount+" files")}catch{console.log("?")}})' 2>/dev/null || echo '?'))"
|
|
34
|
-
|
|
35
|
-
echo "###### repo=$REPO runs/arm=$RUNS"
|
|
36
|
-
echo "###### Q=$Q"; echo
|
|
37
|
-
echo '{"mcpServers":{}}' > "$OUT/mcp-empty.json"
|
|
38
|
-
printf '{"mcpServers":{"homegraph":{"command":"env","args":["HOMEGRAPH_WASM_RELAUNCHED=1","node","%s","serve","--mcp","--path","%s"]}}}' "$BIN" "$TGT" > "$OUT/mcp-cg.json"
|
|
39
|
-
|
|
40
|
-
prewarm(){
|
|
41
|
-
pkill -9 -f "serve --mcp --path $TGT" 2>/dev/null
|
|
42
|
-
HOMEGRAPH_DAEMON_IDLE_TIMEOUT_MS=1800000 node "$BIN" serve --mcp --path "$TGT" </dev/null >/dev/null 2>&1 &
|
|
43
|
-
node -e 'const fs=require("fs");let n=0;const t=setInterval(()=>{if(fs.existsSync(process.argv[1]+"/.homegraph/daemon.sock")){clearInterval(t);process.exit(0)}if(n++>150){clearInterval(t);process.exit(1)}},100)' "$TGT" >/dev/null 2>&1
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
analyze(){
|
|
47
|
-
node -e '
|
|
48
|
-
const fs=require("fs");
|
|
49
|
-
const L=fs.readFileSync(process.argv[1],"utf8").split("\n").filter(Boolean);
|
|
50
|
-
let ex=0,nf=0,ns=0,oc=0,gr=0,exposed="?";const reads=[];
|
|
51
|
-
for(const l of L){try{const o=JSON.parse(l);
|
|
52
|
-
if(o.type==="system"&&o.subtype==="init")exposed=(o.tools||[]).filter(t=>/homegraph/.test(t)).length;
|
|
53
|
-
for(const b of (o.message?.content||[])){if(b.type!=="tool_use")continue;
|
|
54
|
-
if(b.name==="mcp__homegraph__homegraph_explore")ex++;
|
|
55
|
-
else if(b.name==="mcp__homegraph__homegraph_node"){if(b.input&&b.input.symbol)ns++;else nf++;}
|
|
56
|
-
else if(/mcp__homegraph__/.test(b.name))oc++;
|
|
57
|
-
else if(b.name==="Read")reads.push((b.input?.file_path||"").split("/").pop());
|
|
58
|
-
else if(b.name==="Grep")gr++;
|
|
59
|
-
}}catch{}}
|
|
60
|
-
console.log(` explore=${ex} node[sym]=${ns} node[file]=${nf} other_cg=${oc} | Read=${reads.length}${reads.length?" ("+reads.join(", ")+")":""} Grep=${gr} [cg exposed=${exposed}]`);
|
|
61
|
-
' "$1"
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
run(){ # label, cfg, prewarm(0/1)
|
|
65
|
-
local label="$1" cfg="$2" pw="$3"
|
|
66
|
-
for i in $(seq 1 "$RUNS"); do
|
|
67
|
-
[ "$pw" = "1" ] && prewarm
|
|
68
|
-
( cd "$TGT" && claude -p "$Q" --output-format stream-json --verbose \
|
|
69
|
-
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" --max-budget-usd 4 \
|
|
70
|
-
--strict-mcp-config --mcp-config "$cfg" </dev/null > "$OUT/$label-$i.jsonl" 2>"$OUT/$label-$i.err" )
|
|
71
|
-
echo "[$label] run $i:"; analyze "$OUT/$label-$i.jsonl"
|
|
72
|
-
done
|
|
73
|
-
echo
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
echo "== WITH homegraph (premise: explore/node used -> Read ~0) =="; run with "$OUT/mcp-cg.json" 1
|
|
77
|
-
echo "== WITHOUT (Read/Grep only — the contrast) =="; run without "$OUT/mcp-empty.json" 0
|
|
78
|
-
echo "###### DONE. In the WITH arm: are explore/node>0 and Read~0? Any Read of an INDEXED source file = sufficiency gap. Logs: $OUT"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Sufficiency A/B: on a real understanding/flow question, WHEN the agent uses
|
|
3
|
+
# homegraph (explore/node), does it still Read? Premise under test: explore/node
|
|
4
|
+
# return source WITH line numbers, so a Read should not be needed.
|
|
5
|
+
#
|
|
6
|
+
# WITH homegraph (pre-warmed daemon, reliable nested attach) vs WITHOUT (empty
|
|
7
|
+
# MCP, Read/Grep only), N runs each, on a throwaway copy of the repo. Reports
|
|
8
|
+
# explore/node vs Read/Grep, and LISTS the files Read in the WITH arm so a true
|
|
9
|
+
# sufficiency gap (an indexed source file) is distinguishable from out-of-scope
|
|
10
|
+
# (configs, docs, a file homegraph didn't index).
|
|
11
|
+
#
|
|
12
|
+
# Usage: ab-sufficiency.sh <indexed-repo> "<question>" [runs-per-arm]
|
|
13
|
+
# Env: AGENT_EVAL_OUT (default: /tmp/ab-sufficiency)
|
|
14
|
+
set -uo pipefail
|
|
15
|
+
REPO="${1:?usage: ab-sufficiency.sh <indexed-repo> \"<question>\" [runs]}"
|
|
16
|
+
Q="${2:?question required}"
|
|
17
|
+
RUNS="${3:-2}"
|
|
18
|
+
ENGINE="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
19
|
+
BIN="$ENGINE/dist/bin/homegraph.js"
|
|
20
|
+
OUT="${AGENT_EVAL_OUT:-/tmp/ab-sufficiency}"
|
|
21
|
+
TGT="$OUT/target"
|
|
22
|
+
command -v claude >/dev/null || { echo "claude CLI not on PATH"; exit 1; }
|
|
23
|
+
[ -d "$REPO/.homegraph" ] || { echo "no .homegraph index at $REPO"; exit 1; }
|
|
24
|
+
cleanup(){ pkill -9 -f "serve --mcp --path $TGT" 2>/dev/null; }
|
|
25
|
+
trap cleanup EXIT
|
|
26
|
+
mkdir -p "$OUT"
|
|
27
|
+
( cd "$ENGINE" && npm run build >/dev/null 2>&1 ) && echo "built"
|
|
28
|
+
|
|
29
|
+
# Throwaway copy + fresh index (the agent works here; a read-only question won't
|
|
30
|
+
# edit, but isolate anyway). Excludes the source repo's index/build/vcs.
|
|
31
|
+
rm -rf "$TGT"
|
|
32
|
+
rsync -a --exclude node_modules --exclude .git --exclude dist --exclude .homegraph "$REPO/" "$TGT/"
|
|
33
|
+
node "$BIN" init "$TGT" >/dev/null 2>&1 && echo "indexed copy ($(node "$BIN" status --json 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{console.log(JSON.parse(s).fileCount+" files")}catch{console.log("?")}})' 2>/dev/null || echo '?'))"
|
|
34
|
+
|
|
35
|
+
echo "###### repo=$REPO runs/arm=$RUNS"
|
|
36
|
+
echo "###### Q=$Q"; echo
|
|
37
|
+
echo '{"mcpServers":{}}' > "$OUT/mcp-empty.json"
|
|
38
|
+
printf '{"mcpServers":{"homegraph":{"command":"env","args":["HOMEGRAPH_WASM_RELAUNCHED=1","node","%s","serve","--mcp","--path","%s"]}}}' "$BIN" "$TGT" > "$OUT/mcp-cg.json"
|
|
39
|
+
|
|
40
|
+
prewarm(){
|
|
41
|
+
pkill -9 -f "serve --mcp --path $TGT" 2>/dev/null
|
|
42
|
+
HOMEGRAPH_DAEMON_IDLE_TIMEOUT_MS=1800000 node "$BIN" serve --mcp --path "$TGT" </dev/null >/dev/null 2>&1 &
|
|
43
|
+
node -e 'const fs=require("fs");let n=0;const t=setInterval(()=>{if(fs.existsSync(process.argv[1]+"/.homegraph/daemon.sock")){clearInterval(t);process.exit(0)}if(n++>150){clearInterval(t);process.exit(1)}},100)' "$TGT" >/dev/null 2>&1
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
analyze(){
|
|
47
|
+
node -e '
|
|
48
|
+
const fs=require("fs");
|
|
49
|
+
const L=fs.readFileSync(process.argv[1],"utf8").split("\n").filter(Boolean);
|
|
50
|
+
let ex=0,nf=0,ns=0,oc=0,gr=0,exposed="?";const reads=[];
|
|
51
|
+
for(const l of L){try{const o=JSON.parse(l);
|
|
52
|
+
if(o.type==="system"&&o.subtype==="init")exposed=(o.tools||[]).filter(t=>/homegraph/.test(t)).length;
|
|
53
|
+
for(const b of (o.message?.content||[])){if(b.type!=="tool_use")continue;
|
|
54
|
+
if(b.name==="mcp__homegraph__homegraph_explore")ex++;
|
|
55
|
+
else if(b.name==="mcp__homegraph__homegraph_node"){if(b.input&&b.input.symbol)ns++;else nf++;}
|
|
56
|
+
else if(/mcp__homegraph__/.test(b.name))oc++;
|
|
57
|
+
else if(b.name==="Read")reads.push((b.input?.file_path||"").split("/").pop());
|
|
58
|
+
else if(b.name==="Grep")gr++;
|
|
59
|
+
}}catch{}}
|
|
60
|
+
console.log(` explore=${ex} node[sym]=${ns} node[file]=${nf} other_cg=${oc} | Read=${reads.length}${reads.length?" ("+reads.join(", ")+")":""} Grep=${gr} [cg exposed=${exposed}]`);
|
|
61
|
+
' "$1"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
run(){ # label, cfg, prewarm(0/1)
|
|
65
|
+
local label="$1" cfg="$2" pw="$3"
|
|
66
|
+
for i in $(seq 1 "$RUNS"); do
|
|
67
|
+
[ "$pw" = "1" ] && prewarm
|
|
68
|
+
( cd "$TGT" && claude -p "$Q" --output-format stream-json --verbose \
|
|
69
|
+
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --effort "${EFFORT:-high}" --max-budget-usd 4 \
|
|
70
|
+
--strict-mcp-config --mcp-config "$cfg" </dev/null > "$OUT/$label-$i.jsonl" 2>"$OUT/$label-$i.err" )
|
|
71
|
+
echo "[$label] run $i:"; analyze "$OUT/$label-$i.jsonl"
|
|
72
|
+
done
|
|
73
|
+
echo
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
echo "== WITH homegraph (premise: explore/node used -> Read ~0) =="; run with "$OUT/mcp-cg.json" 1
|
|
77
|
+
echo "== WITHOUT (Read/Grep only — the contrast) =="; run without "$OUT/mcp-empty.json" 0
|
|
78
|
+
echo "###### DONE. In the WITH arm: are explore/node>0 and Read~0? Any Read of an INDEXED source file = sufficiency gap. Logs: $OUT"
|
|
@@ -1,21 +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/homegraph-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)"
|
|
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/homegraph-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)"
|
|
@@ -1,37 +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/homegraph-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)"
|
|
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/homegraph-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)"
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# One-shot HomeGraph quality audit:
|
|
3
|
-
# set version -> ensure corpus repo -> wipe+reindex with that version ->
|
|
4
|
-
# run with/without A/B -> restore the local dev link.
|
|
5
|
-
#
|
|
6
|
-
# Usage: audit.sh <version> <repo-name> <repo-url> "<question>" [headless|all]
|
|
7
|
-
# <version> "local" (build + npm link this repo) | "latest" | a version (e.g. 0.7.10)
|
|
8
|
-
# <repo-name> dir name under the corpus dir
|
|
9
|
-
# <repo-url> git URL (cloned --depth 1 when the repo dir is missing)
|
|
10
|
-
# [mode] headless (default) | all (also the interactive tmux arms)
|
|
11
|
-
# Env: CORPUS corpus dir (default: /tmp/homegraph-corpus)
|
|
12
|
-
set -uo pipefail
|
|
13
|
-
|
|
14
|
-
VERSION="${1:?usage: audit.sh <version> <repo-name> <repo-url> \"<question>\" [mode]}"
|
|
15
|
-
NAME="${2:?repo-name required}"
|
|
16
|
-
URL="${3:?repo-url required}"
|
|
17
|
-
Q="${4:?question required}"
|
|
18
|
-
MODE="${5:-headless}"
|
|
19
|
-
|
|
20
|
-
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
21
|
-
REPO_ROOT="$(cd "$HARNESS/../.." && pwd)" # homegraph repo root
|
|
22
|
-
CORPUS="${CORPUS:-/tmp/homegraph-corpus}"
|
|
23
|
-
REPO="$CORPUS/$NAME"
|
|
24
|
-
PKG="homegraph"
|
|
25
|
-
|
|
26
|
-
echo "==================== HomeGraph audit ===================="
|
|
27
|
-
echo "version=$VERSION repo=$NAME mode=$MODE corpus=$CORPUS"
|
|
28
|
-
echo
|
|
29
|
-
|
|
30
|
-
# 1. Set the homegraph version under test (mutates the global install).
|
|
31
|
-
if [ "$VERSION" = local ]; then
|
|
32
|
-
echo "→ [1/4] building + linking local dev build (local-install.sh)"
|
|
33
|
-
( cd "$REPO_ROOT" && ./scripts/local-install.sh ) || { echo "local-install.sh failed"; exit 1; }
|
|
34
|
-
else
|
|
35
|
-
echo "→ [1/4] installing $PKG@$VERSION globally"
|
|
36
|
-
npm install -g "$PKG@$VERSION" || { echo "npm install -g $PKG@$VERSION failed"; exit 1; }
|
|
37
|
-
fi
|
|
38
|
-
ACTUAL="$(homegraph --version 2>/dev/null || echo '?')"
|
|
39
|
-
echo " homegraph on PATH: $(command -v homegraph) -> $ACTUAL"
|
|
40
|
-
|
|
41
|
-
# 2. Ensure the corpus repo exists (clone shallow if missing, reuse if present).
|
|
42
|
-
mkdir -p "$CORPUS"
|
|
43
|
-
if [ -d "$REPO/.git" ]; then
|
|
44
|
-
echo "→ [2/4] reusing existing checkout: $REPO"
|
|
45
|
-
else
|
|
46
|
-
echo "→ [2/4] cloning $URL"
|
|
47
|
-
git clone --depth 1 "$URL" "$REPO" || { echo "git clone failed"; exit 1; }
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
|
-
# 3. Wipe + re-index with THIS version (the index must be built by the same
|
|
51
|
-
# binary that serves it — different versions extract differently).
|
|
52
|
-
echo "→ [3/4] wiping .homegraph and re-indexing with $ACTUAL"
|
|
53
|
-
rm -rf "$REPO/.homegraph"
|
|
54
|
-
( cd "$REPO" && homegraph init -i ) || { echo "indexing failed"; exit 1; }
|
|
55
|
-
|
|
56
|
-
# 4. Run the with/without A/B.
|
|
57
|
-
echo "→ [4/4] running A/B harness (mode=$MODE)"
|
|
58
|
-
bash "$HARNESS/run-all.sh" "$REPO" "$Q" "$MODE"
|
|
59
|
-
|
|
60
|
-
# Restore the dev link (the normal working state in this repo).
|
|
61
|
-
echo
|
|
62
|
-
echo "→ restoring local dev link (local-install.sh)"
|
|
63
|
-
if ( cd "$REPO_ROOT" && ./scripts/local-install.sh >/dev/null 2>&1 ); then
|
|
64
|
-
echo " global homegraph restored to dev build"
|
|
65
|
-
else
|
|
66
|
-
echo " WARN: restore failed — run ./scripts/local-install.sh manually"
|
|
67
|
-
fi
|
|
68
|
-
echo "==================== audit complete ===================="
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# One-shot HomeGraph quality audit:
|
|
3
|
+
# set version -> ensure corpus repo -> wipe+reindex with that version ->
|
|
4
|
+
# run with/without A/B -> restore the local dev link.
|
|
5
|
+
#
|
|
6
|
+
# Usage: audit.sh <version> <repo-name> <repo-url> "<question>" [headless|all]
|
|
7
|
+
# <version> "local" (build + npm link this repo) | "latest" | a version (e.g. 0.7.10)
|
|
8
|
+
# <repo-name> dir name under the corpus dir
|
|
9
|
+
# <repo-url> git URL (cloned --depth 1 when the repo dir is missing)
|
|
10
|
+
# [mode] headless (default) | all (also the interactive tmux arms)
|
|
11
|
+
# Env: CORPUS corpus dir (default: /tmp/homegraph-corpus)
|
|
12
|
+
set -uo pipefail
|
|
13
|
+
|
|
14
|
+
VERSION="${1:?usage: audit.sh <version> <repo-name> <repo-url> \"<question>\" [mode]}"
|
|
15
|
+
NAME="${2:?repo-name required}"
|
|
16
|
+
URL="${3:?repo-url required}"
|
|
17
|
+
Q="${4:?question required}"
|
|
18
|
+
MODE="${5:-headless}"
|
|
19
|
+
|
|
20
|
+
HARNESS="$(cd "$(dirname "$0")" && pwd)"
|
|
21
|
+
REPO_ROOT="$(cd "$HARNESS/../.." && pwd)" # homegraph repo root
|
|
22
|
+
CORPUS="${CORPUS:-/tmp/homegraph-corpus}"
|
|
23
|
+
REPO="$CORPUS/$NAME"
|
|
24
|
+
PKG="homegraph"
|
|
25
|
+
|
|
26
|
+
echo "==================== HomeGraph audit ===================="
|
|
27
|
+
echo "version=$VERSION repo=$NAME mode=$MODE corpus=$CORPUS"
|
|
28
|
+
echo
|
|
29
|
+
|
|
30
|
+
# 1. Set the homegraph version under test (mutates the global install).
|
|
31
|
+
if [ "$VERSION" = local ]; then
|
|
32
|
+
echo "→ [1/4] building + linking local dev build (local-install.sh)"
|
|
33
|
+
( cd "$REPO_ROOT" && ./scripts/local-install.sh ) || { echo "local-install.sh failed"; exit 1; }
|
|
34
|
+
else
|
|
35
|
+
echo "→ [1/4] installing $PKG@$VERSION globally"
|
|
36
|
+
npm install -g "$PKG@$VERSION" || { echo "npm install -g $PKG@$VERSION failed"; exit 1; }
|
|
37
|
+
fi
|
|
38
|
+
ACTUAL="$(homegraph --version 2>/dev/null || echo '?')"
|
|
39
|
+
echo " homegraph on PATH: $(command -v homegraph) -> $ACTUAL"
|
|
40
|
+
|
|
41
|
+
# 2. Ensure the corpus repo exists (clone shallow if missing, reuse if present).
|
|
42
|
+
mkdir -p "$CORPUS"
|
|
43
|
+
if [ -d "$REPO/.git" ]; then
|
|
44
|
+
echo "→ [2/4] reusing existing checkout: $REPO"
|
|
45
|
+
else
|
|
46
|
+
echo "→ [2/4] cloning $URL"
|
|
47
|
+
git clone --depth 1 "$URL" "$REPO" || { echo "git clone failed"; exit 1; }
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# 3. Wipe + re-index with THIS version (the index must be built by the same
|
|
51
|
+
# binary that serves it — different versions extract differently).
|
|
52
|
+
echo "→ [3/4] wiping .homegraph and re-indexing with $ACTUAL"
|
|
53
|
+
rm -rf "$REPO/.homegraph"
|
|
54
|
+
( cd "$REPO" && homegraph init -i ) || { echo "indexing failed"; exit 1; }
|
|
55
|
+
|
|
56
|
+
# 4. Run the with/without A/B.
|
|
57
|
+
echo "→ [4/4] running A/B harness (mode=$MODE)"
|
|
58
|
+
bash "$HARNESS/run-all.sh" "$REPO" "$Q" "$MODE"
|
|
59
|
+
|
|
60
|
+
# Restore the dev link (the normal working state in this repo).
|
|
61
|
+
echo
|
|
62
|
+
echo "→ restoring local dev link (local-install.sh)"
|
|
63
|
+
if ( cd "$REPO_ROOT" && ./scripts/local-install.sh >/dev/null 2>&1 ); then
|
|
64
|
+
echo " global homegraph restored to dev build"
|
|
65
|
+
else
|
|
66
|
+
echo " WARN: restore failed — run ./scripts/local-install.sh manually"
|
|
67
|
+
fi
|
|
68
|
+
echo "==================== audit complete ===================="
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Re-run the README "Benchmark Results" A/B (with vs without homegraph) 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/homegraph-corpus) by the build under test.
|
|
7
|
-
set -uo pipefail
|
|
8
|
-
H="$(cd "$(dirname "$0")" && pwd)"
|
|
9
|
-
C="${CORPUS:-/tmp/homegraph-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)"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Re-run the README "Benchmark Results" A/B (with vs without homegraph) 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/homegraph-corpus) by the build under test.
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
H="$(cd "$(dirname "$0")" && pwd)"
|
|
9
|
+
C="${CORPUS:-/tmp/homegraph-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)"
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# One README repo, WITH-homegraph only, N runs. Each run appends a why-Read
|
|
3
|
-
# diagnostic so the agent explains any Read/Grep. (The WITHOUT baseline is
|
|
4
|
-
# homegraph-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/homegraph/dist/bin/homegraph.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 homegraph_explore / homegraph_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 homegraph fell short for it. If you used neither, write "## Why I read" then "none — homegraph was sufficient."'
|
|
13
|
-
printf '{"mcpServers":{"homegraph":{"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/.homegraph/daemon.sock"
|
|
17
|
-
( cd "$REPO" && claude -p "$Q$WHY" --output-format stream-json --verbose \
|
|
18
|
-
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --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"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# One README repo, WITH-homegraph only, N runs. Each run appends a why-Read
|
|
3
|
+
# diagnostic so the agent explains any Read/Grep. (The WITHOUT baseline is
|
|
4
|
+
# homegraph-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/homegraph/dist/bin/homegraph.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 homegraph_explore / homegraph_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 homegraph fell short for it. If you used neither, write "## Why I read" then "none — homegraph was sufficient."'
|
|
13
|
+
printf '{"mcpServers":{"homegraph":{"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/.homegraph/daemon.sock"
|
|
17
|
+
( cd "$REPO" && claude -p "$Q$WHY" --output-format stream-json --verbose \
|
|
18
|
+
--permission-mode bypassPermissions --model "${MODEL:-sonnet}" --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"
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# PreToolUse hook (experiment): deny Read of homegraph-indexed source files and
|
|
3
|
-
# steer the agent to homegraph_explore/homegraph_node instead. Tests whether
|
|
4
|
-
# homegraph 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 — homegraph already has this file indexed (with line numbers, kept in sync on every change). Use homegraph_explore (several related symbols at once) or homegraph_node (one symbol's full source). If a symbol you need wasn't in a prior explore, run ANOTHER homegraph_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
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse hook (experiment): deny Read of homegraph-indexed source files and
|
|
3
|
+
# steer the agent to homegraph_explore/homegraph_node instead. Tests whether
|
|
4
|
+
# homegraph 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 — homegraph already has this file indexed (with line numbers, kept in sync on every change). Use homegraph_explore (several related symbols at once) or homegraph_node (one symbol's full source). If a symbol you need wasn't in a prior explore, run ANOTHER homegraph_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
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hooks": {
|
|
3
|
-
"PreToolUse": [
|
|
4
|
-
{
|
|
5
|
-
"matcher": "Read",
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "bash /Users/colby/Development/Personal/homegraph/scripts/agent-eval/block-read-hook.sh"
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PreToolUse": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "Read",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "bash /Users/colby/Development/Personal/homegraph/scripts/agent-eval/block-read-hook.sh"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|