homegraph 1.1.2 → 1.1.3
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 +243 -243
- package/dist/bin/homegraph.js +371 -9
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/db/migrations.js +18 -18
- package/dist/db/queries.js +140 -140
- package/dist/db/schema.sql +152 -152
- package/dist/directory.js +5 -5
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- 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/liveness-watchdog.js +16 -16
- package/dist/mcp/server-instructions.js +69 -69
- package/dist/mcp/tools.d.ts +17 -4
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +192 -22
- package/dist/mcp/tools.js.map +1 -1
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/spec/config.d.ts +43 -0
- package/dist/spec/config.d.ts.map +1 -0
- package/dist/spec/config.js +275 -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 +23 -0
- package/dist/spec/db/fragment-node.d.ts.map +1 -0
- package/dist/spec/db/fragment-node.js +120 -0
- package/dist/spec/db/fragment-node.js.map +1 -0
- package/dist/spec/db/fts.d.ts +60 -0
- package/dist/spec/db/fts.d.ts.map +1 -0
- package/dist/spec/db/fts.js +285 -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 +30 -0
- package/dist/spec/db/schema.d.ts.map +1 -0
- package/dist/spec/db/schema.js +87 -0
- package/dist/spec/db/schema.js.map +1 -0
- package/dist/spec/db/schema.sql +107 -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 +48 -0
- package/dist/spec/evolve/logic-checker.js.map +1 -0
- package/dist/spec/evolve/pipeline.d.ts +40 -0
- package/dist/spec/evolve/pipeline.d.ts.map +1 -0
- package/dist/spec/evolve/pipeline.js +314 -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 +254 -0
- package/dist/spec/evolve/spec-rewriter.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +58 -0
- package/dist/spec/graph/queries.d.ts.map +1 -0
- package/dist/spec/graph/queries.js +215 -0
- package/dist/spec/graph/queries.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 +91 -0
- package/dist/spec/mining/git-scanner.d.ts.map +1 -0
- package/dist/spec/mining/git-scanner.js +266 -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 +165 -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 +166 -0
- package/dist/spec/utils.d.ts.map +1 -0
- package/dist/spec/utils.js +461 -0
- package/dist/spec/utils.js.map +1 -0
- 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/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/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 +246 -246
- 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
package/dist/db/schema.sql
CHANGED
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
-- HomeGraph SQLite Schema
|
|
2
|
-
-- Version 1
|
|
3
|
-
|
|
4
|
-
-- Schema version tracking
|
|
5
|
-
CREATE TABLE IF NOT EXISTS schema_versions (
|
|
6
|
-
version INTEGER PRIMARY KEY,
|
|
7
|
-
applied_at INTEGER NOT NULL,
|
|
8
|
-
description TEXT
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
-- Insert initial version
|
|
12
|
-
INSERT INTO schema_versions (version, applied_at, description)
|
|
13
|
-
VALUES (1, strftime('%s', 'now') * 1000, 'Initial schema');
|
|
14
|
-
|
|
15
|
-
-- =============================================================================
|
|
16
|
-
-- Core Tables
|
|
17
|
-
-- =============================================================================
|
|
18
|
-
|
|
19
|
-
-- Nodes: Code symbols (functions, classes, variables, etc.)
|
|
20
|
-
CREATE TABLE IF NOT EXISTS nodes (
|
|
21
|
-
id TEXT PRIMARY KEY,
|
|
22
|
-
kind TEXT NOT NULL,
|
|
23
|
-
name TEXT NOT NULL,
|
|
24
|
-
qualified_name TEXT NOT NULL,
|
|
25
|
-
file_path TEXT NOT NULL,
|
|
26
|
-
language TEXT NOT NULL,
|
|
27
|
-
start_line INTEGER NOT NULL,
|
|
28
|
-
end_line INTEGER NOT NULL,
|
|
29
|
-
start_column INTEGER NOT NULL,
|
|
30
|
-
end_column INTEGER NOT NULL,
|
|
31
|
-
docstring TEXT,
|
|
32
|
-
signature TEXT,
|
|
33
|
-
visibility TEXT,
|
|
34
|
-
is_exported INTEGER DEFAULT 0,
|
|
35
|
-
is_async INTEGER DEFAULT 0,
|
|
36
|
-
is_static INTEGER DEFAULT 0,
|
|
37
|
-
is_abstract INTEGER DEFAULT 0,
|
|
38
|
-
decorators TEXT, -- JSON array
|
|
39
|
-
type_parameters TEXT, -- JSON array
|
|
40
|
-
return_type TEXT, -- normalized return/result type name (e.g. C++ method return, for receiver-type inference)
|
|
41
|
-
updated_at INTEGER NOT NULL
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
-- Edges: Relationships between nodes
|
|
45
|
-
CREATE TABLE IF NOT EXISTS edges (
|
|
46
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
47
|
-
source TEXT NOT NULL,
|
|
48
|
-
target TEXT NOT NULL,
|
|
49
|
-
kind TEXT NOT NULL,
|
|
50
|
-
metadata TEXT, -- JSON object
|
|
51
|
-
line INTEGER,
|
|
52
|
-
col INTEGER,
|
|
53
|
-
provenance TEXT DEFAULT NULL,
|
|
54
|
-
FOREIGN KEY (source) REFERENCES nodes(id) ON DELETE CASCADE,
|
|
55
|
-
FOREIGN KEY (target) REFERENCES nodes(id) ON DELETE CASCADE
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
-- Files: Tracked source files
|
|
59
|
-
CREATE TABLE IF NOT EXISTS files (
|
|
60
|
-
path TEXT PRIMARY KEY,
|
|
61
|
-
content_hash TEXT NOT NULL,
|
|
62
|
-
language TEXT NOT NULL,
|
|
63
|
-
size INTEGER NOT NULL,
|
|
64
|
-
modified_at INTEGER NOT NULL,
|
|
65
|
-
indexed_at INTEGER NOT NULL,
|
|
66
|
-
node_count INTEGER DEFAULT 0,
|
|
67
|
-
errors TEXT -- JSON array
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
-- Unresolved References: References that need resolution after full indexing
|
|
71
|
-
CREATE TABLE IF NOT EXISTS unresolved_refs (
|
|
72
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
73
|
-
from_node_id TEXT NOT NULL,
|
|
74
|
-
reference_name TEXT NOT NULL,
|
|
75
|
-
reference_kind TEXT NOT NULL,
|
|
76
|
-
line INTEGER NOT NULL,
|
|
77
|
-
col INTEGER NOT NULL,
|
|
78
|
-
candidates TEXT, -- JSON array
|
|
79
|
-
file_path TEXT NOT NULL DEFAULT '',
|
|
80
|
-
language TEXT NOT NULL DEFAULT 'unknown',
|
|
81
|
-
FOREIGN KEY (from_node_id) REFERENCES nodes(id) ON DELETE CASCADE
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
-- =============================================================================
|
|
85
|
-
-- Indexes for Query Performance
|
|
86
|
-
-- =============================================================================
|
|
87
|
-
|
|
88
|
-
-- Node indexes
|
|
89
|
-
CREATE INDEX IF NOT EXISTS idx_nodes_kind ON nodes(kind);
|
|
90
|
-
CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name);
|
|
91
|
-
CREATE INDEX IF NOT EXISTS idx_nodes_qualified_name ON nodes(qualified_name);
|
|
92
|
-
CREATE INDEX IF NOT EXISTS idx_nodes_file_path ON nodes(file_path);
|
|
93
|
-
CREATE INDEX IF NOT EXISTS idx_nodes_language ON nodes(language);
|
|
94
|
-
CREATE INDEX IF NOT EXISTS idx_nodes_file_line ON nodes(file_path, start_line);
|
|
95
|
-
CREATE INDEX IF NOT EXISTS idx_nodes_lower_name ON nodes(lower(name));
|
|
96
|
-
|
|
97
|
-
-- Full-text search index on node names, docstrings, and signatures
|
|
98
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS nodes_fts USING fts5(
|
|
99
|
-
id,
|
|
100
|
-
name,
|
|
101
|
-
qualified_name,
|
|
102
|
-
docstring,
|
|
103
|
-
signature,
|
|
104
|
-
content='nodes',
|
|
105
|
-
content_rowid='rowid'
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
-- Triggers to keep FTS index in sync
|
|
109
|
-
CREATE TRIGGER IF NOT EXISTS nodes_ai AFTER INSERT ON nodes BEGIN
|
|
110
|
-
INSERT INTO nodes_fts(rowid, id, name, qualified_name, docstring, signature)
|
|
111
|
-
VALUES (NEW.rowid, NEW.id, NEW.name, NEW.qualified_name, NEW.docstring, NEW.signature);
|
|
112
|
-
END;
|
|
113
|
-
|
|
114
|
-
CREATE TRIGGER IF NOT EXISTS nodes_ad AFTER DELETE ON nodes BEGIN
|
|
115
|
-
INSERT INTO nodes_fts(nodes_fts, rowid, id, name, qualified_name, docstring, signature)
|
|
116
|
-
VALUES ('delete', OLD.rowid, OLD.id, OLD.name, OLD.qualified_name, OLD.docstring, OLD.signature);
|
|
117
|
-
END;
|
|
118
|
-
|
|
119
|
-
CREATE TRIGGER IF NOT EXISTS nodes_au AFTER UPDATE ON nodes BEGIN
|
|
120
|
-
INSERT INTO nodes_fts(nodes_fts, rowid, id, name, qualified_name, docstring, signature)
|
|
121
|
-
VALUES ('delete', OLD.rowid, OLD.id, OLD.name, OLD.qualified_name, OLD.docstring, OLD.signature);
|
|
122
|
-
INSERT INTO nodes_fts(rowid, id, name, qualified_name, docstring, signature)
|
|
123
|
-
VALUES (NEW.rowid, NEW.id, NEW.name, NEW.qualified_name, NEW.docstring, NEW.signature);
|
|
124
|
-
END;
|
|
125
|
-
|
|
126
|
-
-- Edge indexes.
|
|
127
|
-
-- idx_edges_source / idx_edges_target are intentionally omitted —
|
|
128
|
-
-- the (source, kind) and (target, kind) composites below cover the
|
|
129
|
-
-- corresponding source-only / target-only lookups via SQLite's
|
|
130
|
-
-- left-prefix scan, so the narrow indexes are dead weight on writes.
|
|
131
|
-
-- Migration v4 drops them on existing databases.
|
|
132
|
-
CREATE INDEX IF NOT EXISTS idx_edges_kind ON edges(kind);
|
|
133
|
-
CREATE INDEX IF NOT EXISTS idx_edges_source_kind ON edges(source, kind);
|
|
134
|
-
CREATE INDEX IF NOT EXISTS idx_edges_target_kind ON edges(target, kind);
|
|
135
|
-
|
|
136
|
-
-- File indexes
|
|
137
|
-
CREATE INDEX IF NOT EXISTS idx_files_language ON files(language);
|
|
138
|
-
CREATE INDEX IF NOT EXISTS idx_files_modified_at ON files(modified_at);
|
|
139
|
-
|
|
140
|
-
-- Unresolved refs indexes
|
|
141
|
-
CREATE INDEX IF NOT EXISTS idx_unresolved_from_node ON unresolved_refs(from_node_id);
|
|
142
|
-
CREATE INDEX IF NOT EXISTS idx_unresolved_name ON unresolved_refs(reference_name);
|
|
143
|
-
CREATE INDEX IF NOT EXISTS idx_unresolved_file_path ON unresolved_refs(file_path);
|
|
144
|
-
CREATE INDEX IF NOT EXISTS idx_unresolved_from_name ON unresolved_refs(from_node_id, reference_name);
|
|
145
|
-
CREATE INDEX IF NOT EXISTS idx_edges_provenance ON edges(provenance);
|
|
146
|
-
|
|
147
|
-
-- Project metadata for version/provenance tracking
|
|
148
|
-
CREATE TABLE IF NOT EXISTS project_metadata (
|
|
149
|
-
key TEXT PRIMARY KEY,
|
|
150
|
-
value TEXT NOT NULL,
|
|
151
|
-
updated_at INTEGER NOT NULL
|
|
152
|
-
);
|
|
1
|
+
-- HomeGraph SQLite Schema
|
|
2
|
+
-- Version 1
|
|
3
|
+
|
|
4
|
+
-- Schema version tracking
|
|
5
|
+
CREATE TABLE IF NOT EXISTS schema_versions (
|
|
6
|
+
version INTEGER PRIMARY KEY,
|
|
7
|
+
applied_at INTEGER NOT NULL,
|
|
8
|
+
description TEXT
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
-- Insert initial version
|
|
12
|
+
INSERT INTO schema_versions (version, applied_at, description)
|
|
13
|
+
VALUES (1, strftime('%s', 'now') * 1000, 'Initial schema');
|
|
14
|
+
|
|
15
|
+
-- =============================================================================
|
|
16
|
+
-- Core Tables
|
|
17
|
+
-- =============================================================================
|
|
18
|
+
|
|
19
|
+
-- Nodes: Code symbols (functions, classes, variables, etc.)
|
|
20
|
+
CREATE TABLE IF NOT EXISTS nodes (
|
|
21
|
+
id TEXT PRIMARY KEY,
|
|
22
|
+
kind TEXT NOT NULL,
|
|
23
|
+
name TEXT NOT NULL,
|
|
24
|
+
qualified_name TEXT NOT NULL,
|
|
25
|
+
file_path TEXT NOT NULL,
|
|
26
|
+
language TEXT NOT NULL,
|
|
27
|
+
start_line INTEGER NOT NULL,
|
|
28
|
+
end_line INTEGER NOT NULL,
|
|
29
|
+
start_column INTEGER NOT NULL,
|
|
30
|
+
end_column INTEGER NOT NULL,
|
|
31
|
+
docstring TEXT,
|
|
32
|
+
signature TEXT,
|
|
33
|
+
visibility TEXT,
|
|
34
|
+
is_exported INTEGER DEFAULT 0,
|
|
35
|
+
is_async INTEGER DEFAULT 0,
|
|
36
|
+
is_static INTEGER DEFAULT 0,
|
|
37
|
+
is_abstract INTEGER DEFAULT 0,
|
|
38
|
+
decorators TEXT, -- JSON array
|
|
39
|
+
type_parameters TEXT, -- JSON array
|
|
40
|
+
return_type TEXT, -- normalized return/result type name (e.g. C++ method return, for receiver-type inference)
|
|
41
|
+
updated_at INTEGER NOT NULL
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
-- Edges: Relationships between nodes
|
|
45
|
+
CREATE TABLE IF NOT EXISTS edges (
|
|
46
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
47
|
+
source TEXT NOT NULL,
|
|
48
|
+
target TEXT NOT NULL,
|
|
49
|
+
kind TEXT NOT NULL,
|
|
50
|
+
metadata TEXT, -- JSON object
|
|
51
|
+
line INTEGER,
|
|
52
|
+
col INTEGER,
|
|
53
|
+
provenance TEXT DEFAULT NULL,
|
|
54
|
+
FOREIGN KEY (source) REFERENCES nodes(id) ON DELETE CASCADE,
|
|
55
|
+
FOREIGN KEY (target) REFERENCES nodes(id) ON DELETE CASCADE
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
-- Files: Tracked source files
|
|
59
|
+
CREATE TABLE IF NOT EXISTS files (
|
|
60
|
+
path TEXT PRIMARY KEY,
|
|
61
|
+
content_hash TEXT NOT NULL,
|
|
62
|
+
language TEXT NOT NULL,
|
|
63
|
+
size INTEGER NOT NULL,
|
|
64
|
+
modified_at INTEGER NOT NULL,
|
|
65
|
+
indexed_at INTEGER NOT NULL,
|
|
66
|
+
node_count INTEGER DEFAULT 0,
|
|
67
|
+
errors TEXT -- JSON array
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
-- Unresolved References: References that need resolution after full indexing
|
|
71
|
+
CREATE TABLE IF NOT EXISTS unresolved_refs (
|
|
72
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
73
|
+
from_node_id TEXT NOT NULL,
|
|
74
|
+
reference_name TEXT NOT NULL,
|
|
75
|
+
reference_kind TEXT NOT NULL,
|
|
76
|
+
line INTEGER NOT NULL,
|
|
77
|
+
col INTEGER NOT NULL,
|
|
78
|
+
candidates TEXT, -- JSON array
|
|
79
|
+
file_path TEXT NOT NULL DEFAULT '',
|
|
80
|
+
language TEXT NOT NULL DEFAULT 'unknown',
|
|
81
|
+
FOREIGN KEY (from_node_id) REFERENCES nodes(id) ON DELETE CASCADE
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
-- =============================================================================
|
|
85
|
+
-- Indexes for Query Performance
|
|
86
|
+
-- =============================================================================
|
|
87
|
+
|
|
88
|
+
-- Node indexes
|
|
89
|
+
CREATE INDEX IF NOT EXISTS idx_nodes_kind ON nodes(kind);
|
|
90
|
+
CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name);
|
|
91
|
+
CREATE INDEX IF NOT EXISTS idx_nodes_qualified_name ON nodes(qualified_name);
|
|
92
|
+
CREATE INDEX IF NOT EXISTS idx_nodes_file_path ON nodes(file_path);
|
|
93
|
+
CREATE INDEX IF NOT EXISTS idx_nodes_language ON nodes(language);
|
|
94
|
+
CREATE INDEX IF NOT EXISTS idx_nodes_file_line ON nodes(file_path, start_line);
|
|
95
|
+
CREATE INDEX IF NOT EXISTS idx_nodes_lower_name ON nodes(lower(name));
|
|
96
|
+
|
|
97
|
+
-- Full-text search index on node names, docstrings, and signatures
|
|
98
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS nodes_fts USING fts5(
|
|
99
|
+
id,
|
|
100
|
+
name,
|
|
101
|
+
qualified_name,
|
|
102
|
+
docstring,
|
|
103
|
+
signature,
|
|
104
|
+
content='nodes',
|
|
105
|
+
content_rowid='rowid'
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
-- Triggers to keep FTS index in sync
|
|
109
|
+
CREATE TRIGGER IF NOT EXISTS nodes_ai AFTER INSERT ON nodes BEGIN
|
|
110
|
+
INSERT INTO nodes_fts(rowid, id, name, qualified_name, docstring, signature)
|
|
111
|
+
VALUES (NEW.rowid, NEW.id, NEW.name, NEW.qualified_name, NEW.docstring, NEW.signature);
|
|
112
|
+
END;
|
|
113
|
+
|
|
114
|
+
CREATE TRIGGER IF NOT EXISTS nodes_ad AFTER DELETE ON nodes BEGIN
|
|
115
|
+
INSERT INTO nodes_fts(nodes_fts, rowid, id, name, qualified_name, docstring, signature)
|
|
116
|
+
VALUES ('delete', OLD.rowid, OLD.id, OLD.name, OLD.qualified_name, OLD.docstring, OLD.signature);
|
|
117
|
+
END;
|
|
118
|
+
|
|
119
|
+
CREATE TRIGGER IF NOT EXISTS nodes_au AFTER UPDATE ON nodes BEGIN
|
|
120
|
+
INSERT INTO nodes_fts(nodes_fts, rowid, id, name, qualified_name, docstring, signature)
|
|
121
|
+
VALUES ('delete', OLD.rowid, OLD.id, OLD.name, OLD.qualified_name, OLD.docstring, OLD.signature);
|
|
122
|
+
INSERT INTO nodes_fts(rowid, id, name, qualified_name, docstring, signature)
|
|
123
|
+
VALUES (NEW.rowid, NEW.id, NEW.name, NEW.qualified_name, NEW.docstring, NEW.signature);
|
|
124
|
+
END;
|
|
125
|
+
|
|
126
|
+
-- Edge indexes.
|
|
127
|
+
-- idx_edges_source / idx_edges_target are intentionally omitted —
|
|
128
|
+
-- the (source, kind) and (target, kind) composites below cover the
|
|
129
|
+
-- corresponding source-only / target-only lookups via SQLite's
|
|
130
|
+
-- left-prefix scan, so the narrow indexes are dead weight on writes.
|
|
131
|
+
-- Migration v4 drops them on existing databases.
|
|
132
|
+
CREATE INDEX IF NOT EXISTS idx_edges_kind ON edges(kind);
|
|
133
|
+
CREATE INDEX IF NOT EXISTS idx_edges_source_kind ON edges(source, kind);
|
|
134
|
+
CREATE INDEX IF NOT EXISTS idx_edges_target_kind ON edges(target, kind);
|
|
135
|
+
|
|
136
|
+
-- File indexes
|
|
137
|
+
CREATE INDEX IF NOT EXISTS idx_files_language ON files(language);
|
|
138
|
+
CREATE INDEX IF NOT EXISTS idx_files_modified_at ON files(modified_at);
|
|
139
|
+
|
|
140
|
+
-- Unresolved refs indexes
|
|
141
|
+
CREATE INDEX IF NOT EXISTS idx_unresolved_from_node ON unresolved_refs(from_node_id);
|
|
142
|
+
CREATE INDEX IF NOT EXISTS idx_unresolved_name ON unresolved_refs(reference_name);
|
|
143
|
+
CREATE INDEX IF NOT EXISTS idx_unresolved_file_path ON unresolved_refs(file_path);
|
|
144
|
+
CREATE INDEX IF NOT EXISTS idx_unresolved_from_name ON unresolved_refs(from_node_id, reference_name);
|
|
145
|
+
CREATE INDEX IF NOT EXISTS idx_edges_provenance ON edges(provenance);
|
|
146
|
+
|
|
147
|
+
-- Project metadata for version/provenance tracking
|
|
148
|
+
CREATE TABLE IF NOT EXISTS project_metadata (
|
|
149
|
+
key TEXT PRIMARY KEY,
|
|
150
|
+
value TEXT NOT NULL,
|
|
151
|
+
updated_at INTEGER NOT NULL
|
|
152
|
+
);
|
package/dist/directory.js
CHANGED
|
@@ -325,11 +325,11 @@ function planFrontload(cwd, prompt) {
|
|
|
325
325
|
* explicit allowlist that never listed `daemon.pid` or the socket, so those
|
|
326
326
|
* runtime files were silently committed.
|
|
327
327
|
*/
|
|
328
|
-
const GITIGNORE_CONTENT = `# HomeGraph data files — local to each machine, not for committing.
|
|
329
|
-
# Ignore everything in .homegraph/ except this file itself, so transient
|
|
330
|
-
# files (the database, daemon.pid, sockets, logs) never show up in git.
|
|
331
|
-
*
|
|
332
|
-
!.gitignore
|
|
328
|
+
const GITIGNORE_CONTENT = `# HomeGraph data files — local to each machine, not for committing.
|
|
329
|
+
# Ignore everything in .homegraph/ except this file itself, so transient
|
|
330
|
+
# files (the database, daemon.pid, sockets, logs) never show up in git.
|
|
331
|
+
*
|
|
332
|
+
!.gitignore
|
|
333
333
|
`;
|
|
334
334
|
/** Header line that prefixes every .gitignore HomeGraph has auto-generated. */
|
|
335
335
|
const GITIGNORE_MARKER = '# HomeGraph data files';
|
|
File without changes
|
|
File without changes
|
|
@@ -40,14 +40,14 @@ exports.HOMEGRAPH_SECTION_END = '<!-- HOMEGRAPH_END -->';
|
|
|
40
40
|
* indexed" claim would send subagents into failing homegraph calls (the
|
|
41
41
|
* noise the unindexed-session policy exists to prevent).
|
|
42
42
|
*/
|
|
43
|
-
exports.HOMEGRAPH_INSTRUCTIONS_BLOCK = `${exports.HOMEGRAPH_SECTION_START}
|
|
44
|
-
## HomeGraph
|
|
45
|
-
|
|
46
|
-
In repositories indexed by HomeGraph (a \`.homegraph/\` directory exists at the repo root), reach for it BEFORE grep/find or reading files when you need to understand or locate code:
|
|
47
|
-
|
|
48
|
-
- **MCP tool** (when available): \`homegraph_explore\` answers most code questions in one call — the relevant symbols' verbatim source plus the call paths between them, including dynamic-dispatch hops grep can't follow. Name a file or symbol in the query to read its current line-numbered source. If it's listed but deferred, load it by name via tool search.
|
|
49
|
-
- **Shell** (always works): \`homegraph explore "<symbol names or question>"\` prints the same output.
|
|
50
|
-
|
|
51
|
-
If there is no \`.homegraph/\` directory, skip HomeGraph entirely — indexing is the user's decision.
|
|
43
|
+
exports.HOMEGRAPH_INSTRUCTIONS_BLOCK = `${exports.HOMEGRAPH_SECTION_START}
|
|
44
|
+
## HomeGraph
|
|
45
|
+
|
|
46
|
+
In repositories indexed by HomeGraph (a \`.homegraph/\` directory exists at the repo root), reach for it BEFORE grep/find or reading files when you need to understand or locate code:
|
|
47
|
+
|
|
48
|
+
- **MCP tool** (when available): \`homegraph_explore\` answers most code questions in one call — the relevant symbols' verbatim source plus the call paths between them, including dynamic-dispatch hops grep can't follow. Name a file or symbol in the query to read its current line-numbered source. If it's listed but deferred, load it by name via tool search.
|
|
49
|
+
- **Shell** (always works): \`homegraph explore "<symbol names or question>"\` prints the same output.
|
|
50
|
+
|
|
51
|
+
If there is no \`.homegraph/\` directory, skip HomeGraph entirely — indexing is the user's decision.
|
|
52
52
|
${exports.HOMEGRAPH_SECTION_END}`;
|
|
53
53
|
//# sourceMappingURL=instructions-template.js.map
|
|
@@ -21,12 +21,11 @@ export declare function getMcpServerConfig(): {
|
|
|
21
21
|
* Permissions list for Claude `settings.json`. Other targets that
|
|
22
22
|
* have a permissions concept can compose this list directly.
|
|
23
23
|
*
|
|
24
|
-
* One server-scoped wildcard rather than a per-tool list.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* hand-editing settings.json), and future tools are covered too. Claude only
|
|
24
|
+
* One server-scoped wildcard rather than a per-tool list. All homegraph tools
|
|
25
|
+
* are listed by default, and the wildcard pre-approves every current and
|
|
26
|
+
* future tool (no permission prompt, no hand-editing settings.json). Users who
|
|
27
|
+
* trim the surface via HOMEGRAPH_MCP_TOOLS still get pre-approval for whatever
|
|
28
|
+
* remains listed. Claude only
|
|
30
29
|
* honors globs after a literal `mcp__<server>__` prefix, so this exact string
|
|
31
30
|
* is the way to allow-all for one server; a bare `mcp__homegraph` or `*` is
|
|
32
31
|
* ignored. The allowlist gates PROMPTING, not visibility, so a superset here
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/installer/targets/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAMtF;AAED
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/installer/targets/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAMtF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAelE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAa3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAE/E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAiB7D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CA2BlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAA;CAAE,CAQnH;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,SAAS,GAAG,WAAW,GAAG,MAAM,CAwBlC"}
|
|
@@ -70,12 +70,11 @@ function getMcpServerConfig() {
|
|
|
70
70
|
* Permissions list for Claude `settings.json`. Other targets that
|
|
71
71
|
* have a permissions concept can compose this list directly.
|
|
72
72
|
*
|
|
73
|
-
* One server-scoped wildcard rather than a per-tool list.
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* hand-editing settings.json), and future tools are covered too. Claude only
|
|
73
|
+
* One server-scoped wildcard rather than a per-tool list. All homegraph tools
|
|
74
|
+
* are listed by default, and the wildcard pre-approves every current and
|
|
75
|
+
* future tool (no permission prompt, no hand-editing settings.json). Users who
|
|
76
|
+
* trim the surface via HOMEGRAPH_MCP_TOOLS still get pre-approval for whatever
|
|
77
|
+
* remains listed. Claude only
|
|
79
78
|
* honors globs after a literal `mcp__<server>__` prefix, so this exact string
|
|
80
79
|
* is the way to allow-all for one server; a bare `mcp__homegraph` or `*` is
|
|
81
80
|
* ignored. The allowlist gates PROMPTING, not visibility, so a superset here
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/installer/targets/shared.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeH,gDAMC;
|
|
1
|
+
{"version":3,"file":"shared.js","source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,GAAG,KAAK,CAAC;IAEhE,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACzB,IAAI,CAAC;YAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -111,22 +111,22 @@ function debug(msg) {
|
|
|
111
111
|
* target pid + timeout from argv; an MSG built once at startup (the child is
|
|
112
112
|
* never wedged, so allocation here is fine).
|
|
113
113
|
*/
|
|
114
|
-
const CHILD_SOURCE = `
|
|
115
|
-
const fs = require('fs');
|
|
116
|
-
const parentPid = Number(process.argv[1]);
|
|
117
|
-
const timeoutMs = Number(process.argv[2]);
|
|
118
|
-
const secs = Math.round(timeoutMs / 1000);
|
|
119
|
-
const MSG = Buffer.from('[HomeGraph] Main thread unresponsive for ~' + secs + 's — killing the wedged process so a fresh one can start (#850). Disable with HOMEGRAPH_NO_WATCHDOG=1.\\n');
|
|
120
|
-
function kill() {
|
|
121
|
-
try { fs.writeSync(2, MSG); } catch (e) {}
|
|
122
|
-
try { process.kill(parentPid, 'SIGKILL'); } catch (e) {}
|
|
123
|
-
process.exit(0);
|
|
124
|
-
}
|
|
125
|
-
let timer = setTimeout(kill, timeoutMs);
|
|
126
|
-
process.stdin.on('data', () => { clearTimeout(timer); timer = setTimeout(kill, timeoutMs); });
|
|
127
|
-
process.stdin.on('end', () => process.exit(0)); // parent closed the pipe (exited) -> no orphan
|
|
128
|
-
process.stdin.on('error', () => process.exit(0)); // pipe broke -> parent gone
|
|
129
|
-
process.stdin.resume();
|
|
114
|
+
const CHILD_SOURCE = `
|
|
115
|
+
const fs = require('fs');
|
|
116
|
+
const parentPid = Number(process.argv[1]);
|
|
117
|
+
const timeoutMs = Number(process.argv[2]);
|
|
118
|
+
const secs = Math.round(timeoutMs / 1000);
|
|
119
|
+
const MSG = Buffer.from('[HomeGraph] Main thread unresponsive for ~' + secs + 's — killing the wedged process so a fresh one can start (#850). Disable with HOMEGRAPH_NO_WATCHDOG=1.\\n');
|
|
120
|
+
function kill() {
|
|
121
|
+
try { fs.writeSync(2, MSG); } catch (e) {}
|
|
122
|
+
try { process.kill(parentPid, 'SIGKILL'); } catch (e) {}
|
|
123
|
+
process.exit(0);
|
|
124
|
+
}
|
|
125
|
+
let timer = setTimeout(kill, timeoutMs);
|
|
126
|
+
process.stdin.on('data', () => { clearTimeout(timer); timer = setTimeout(kill, timeoutMs); });
|
|
127
|
+
process.stdin.on('end', () => process.exit(0)); // parent closed the pipe (exited) -> no orphan
|
|
128
|
+
process.stdin.on('error', () => process.exit(0)); // pipe broke -> parent gone
|
|
129
|
+
process.stdin.resume();
|
|
130
130
|
`;
|
|
131
131
|
/**
|
|
132
132
|
* Install the main-thread liveness watchdog for a long-lived process. Returns a
|
|
@@ -20,56 +20,56 @@ exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0
|
|
|
20
20
|
* tools (node/search/callers/…) stay defined and are re-enablable via
|
|
21
21
|
* HOMEGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
|
|
22
22
|
*/
|
|
23
|
-
exports.SERVER_INSTRUCTIONS = `# Codegraph — code intelligence over an indexed knowledge graph
|
|
24
|
-
|
|
25
|
-
Codegraph is a SQLite knowledge graph of every symbol, edge, and file in
|
|
26
|
-
the workspace — pre-computed structure you would otherwise re-derive by
|
|
27
|
-
reading files (cached intelligence: thousands of parse/trace decisions you
|
|
28
|
-
don't pay to re-reason each run). Reads are sub-millisecond; the index lags
|
|
29
|
-
writes by ~1s through the file watcher. Reach for it BEFORE *and* while
|
|
30
|
-
writing or editing code — not just for questions: one call returns the
|
|
31
|
-
verbatim source PLUS who calls it and what it affects, so you edit with the
|
|
32
|
-
blast radius in view. More accurate context, in far fewer tokens and
|
|
33
|
-
round-trips than reading files yourself.
|
|
34
|
-
|
|
35
|
-
## One tool: homegraph_explore — use it instead of reading files
|
|
36
|
-
|
|
37
|
-
There is a single tool, \`homegraph_explore\`, and it is Read-equivalent. It
|
|
38
|
-
takes either a natural-language question or a bag of symbol/file names and
|
|
39
|
-
returns the **verbatim, line-numbered source** of the relevant symbols
|
|
40
|
-
grouped by file — the same \`<n>\\t<line>\` shape \`Read\` gives you, safe to
|
|
41
|
-
\`Edit\` from — PLUS the call path among them (including dynamic-dispatch hops
|
|
42
|
-
like callbacks, React re-render, and JSX children that grep can't follow) and
|
|
43
|
-
a blast-radius summary of what depends on them.
|
|
44
|
-
|
|
45
|
-
Whether you're answering "how does X work" or implementing a change (fixing a
|
|
46
|
-
bug, adding a feature), call \`homegraph_explore\` before you Read. ONE call
|
|
47
|
-
usually answers the whole question. Codegraph IS the pre-built search index —
|
|
48
|
-
so running your own grep + read loop, or delegating the lookup to a separate
|
|
49
|
-
file-reading sub-task/agent, repeats work homegraph already did and costs more
|
|
50
|
-
for the same answer. A direct homegraph answer is typically one to a few
|
|
51
|
-
calls; a grep/read exploration is dozens.
|
|
52
|
-
|
|
53
|
-
## How to query
|
|
54
|
-
|
|
55
|
-
- **Almost any question — "how does X work", architecture, a bug, "what/where is X", or surveying an area** → \`homegraph_explore\` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.
|
|
56
|
-
- **"How does X reach/become Y? / the flow / the path from X to Y"** → \`homegraph_explore\`, naming the symbols that span the flow (e.g. \`mutateElement renderScene\`) — it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.
|
|
57
|
-
- **Reading or editing a file/symbol you can name** → put its name or file path in the \`homegraph_explore\` query — it returns that current line-numbered source (safe to \`Edit\` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.
|
|
58
|
-
- **Need more?** Call \`homegraph_explore\` again with more specific names — treat the source it returns as already Read.
|
|
59
|
-
|
|
60
|
-
## Anti-patterns
|
|
61
|
-
|
|
62
|
-
- **Trust homegraph's results — don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.
|
|
63
|
-
- **Don't grep or Read first** to find or understand indexed code — ONE \`homegraph_explore\` returns the relevant symbols' source together in a single round-trip. Reach for raw \`Read\`/\`Grep\` only to confirm a specific detail homegraph didn't cover, or for what homegraph doesn't index (configs, docs).
|
|
64
|
-
- **Don't reconstruct a flow by hand** — name the endpoints in one \`homegraph_explore\` and it surfaces the path between them, dynamic-dispatch hops included.
|
|
65
|
-
- **After editing, check the staleness banner.** When a tool response starts with "⚠️ Some files referenced below were edited since the last index sync…", the listed files are pending re-index — Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust homegraph. A different, rarer banner — "⚠️ HomeGraph auto-sync is DISABLED…" — means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.
|
|
66
|
-
|
|
67
|
-
## Limitations
|
|
68
|
-
|
|
69
|
-
- If a tool reports a project isn't indexed (no \`.homegraph/\`), stop calling homegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision — mention they can run \`homegraph init\` if it comes up, but don't run it yourself.
|
|
70
|
-
- Index lags file writes by ~1 second.
|
|
71
|
-
- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.
|
|
72
|
-
- No live correctness validation — that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.
|
|
23
|
+
exports.SERVER_INSTRUCTIONS = `# Codegraph — code intelligence over an indexed knowledge graph
|
|
24
|
+
|
|
25
|
+
Codegraph is a SQLite knowledge graph of every symbol, edge, and file in
|
|
26
|
+
the workspace — pre-computed structure you would otherwise re-derive by
|
|
27
|
+
reading files (cached intelligence: thousands of parse/trace decisions you
|
|
28
|
+
don't pay to re-reason each run). Reads are sub-millisecond; the index lags
|
|
29
|
+
writes by ~1s through the file watcher. Reach for it BEFORE *and* while
|
|
30
|
+
writing or editing code — not just for questions: one call returns the
|
|
31
|
+
verbatim source PLUS who calls it and what it affects, so you edit with the
|
|
32
|
+
blast radius in view. More accurate context, in far fewer tokens and
|
|
33
|
+
round-trips than reading files yourself.
|
|
34
|
+
|
|
35
|
+
## One tool: homegraph_explore — use it instead of reading files
|
|
36
|
+
|
|
37
|
+
There is a single tool, \`homegraph_explore\`, and it is Read-equivalent. It
|
|
38
|
+
takes either a natural-language question or a bag of symbol/file names and
|
|
39
|
+
returns the **verbatim, line-numbered source** of the relevant symbols
|
|
40
|
+
grouped by file — the same \`<n>\\t<line>\` shape \`Read\` gives you, safe to
|
|
41
|
+
\`Edit\` from — PLUS the call path among them (including dynamic-dispatch hops
|
|
42
|
+
like callbacks, React re-render, and JSX children that grep can't follow) and
|
|
43
|
+
a blast-radius summary of what depends on them.
|
|
44
|
+
|
|
45
|
+
Whether you're answering "how does X work" or implementing a change (fixing a
|
|
46
|
+
bug, adding a feature), call \`homegraph_explore\` before you Read. ONE call
|
|
47
|
+
usually answers the whole question. Codegraph IS the pre-built search index —
|
|
48
|
+
so running your own grep + read loop, or delegating the lookup to a separate
|
|
49
|
+
file-reading sub-task/agent, repeats work homegraph already did and costs more
|
|
50
|
+
for the same answer. A direct homegraph answer is typically one to a few
|
|
51
|
+
calls; a grep/read exploration is dozens.
|
|
52
|
+
|
|
53
|
+
## How to query
|
|
54
|
+
|
|
55
|
+
- **Almost any question — "how does X work", architecture, a bug, "what/where is X", or surveying an area** → \`homegraph_explore\` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.
|
|
56
|
+
- **"How does X reach/become Y? / the flow / the path from X to Y"** → \`homegraph_explore\`, naming the symbols that span the flow (e.g. \`mutateElement renderScene\`) — it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.
|
|
57
|
+
- **Reading or editing a file/symbol you can name** → put its name or file path in the \`homegraph_explore\` query — it returns that current line-numbered source (safe to \`Edit\` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.
|
|
58
|
+
- **Need more?** Call \`homegraph_explore\` again with more specific names — treat the source it returns as already Read.
|
|
59
|
+
|
|
60
|
+
## Anti-patterns
|
|
61
|
+
|
|
62
|
+
- **Trust homegraph's results — don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.
|
|
63
|
+
- **Don't grep or Read first** to find or understand indexed code — ONE \`homegraph_explore\` returns the relevant symbols' source together in a single round-trip. Reach for raw \`Read\`/\`Grep\` only to confirm a specific detail homegraph didn't cover, or for what homegraph doesn't index (configs, docs).
|
|
64
|
+
- **Don't reconstruct a flow by hand** — name the endpoints in one \`homegraph_explore\` and it surfaces the path between them, dynamic-dispatch hops included.
|
|
65
|
+
- **After editing, check the staleness banner.** When a tool response starts with "⚠️ Some files referenced below were edited since the last index sync…", the listed files are pending re-index — Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust homegraph. A different, rarer banner — "⚠️ HomeGraph auto-sync is DISABLED…" — means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.
|
|
66
|
+
|
|
67
|
+
## Limitations
|
|
68
|
+
|
|
69
|
+
- If a tool reports a project isn't indexed (no \`.homegraph/\`), stop calling homegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision — mention they can run \`homegraph init\` if it comes up, but don't run it yourself.
|
|
70
|
+
- Index lags file writes by ~1 second.
|
|
71
|
+
- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.
|
|
72
|
+
- No live correctness validation — that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.
|
|
73
73
|
`;
|
|
74
74
|
/**
|
|
75
75
|
* Instructions variant sent when the server's own root has NO homegraph index.
|
|
@@ -83,24 +83,24 @@ calls; a grep/read exploration is dozens.
|
|
|
83
83
|
* project playbook ({@link SERVER_INSTRUCTIONS}) is sent instead when the root
|
|
84
84
|
* IS indexed, so the common case stays tight.
|
|
85
85
|
*/
|
|
86
|
-
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# Codegraph — available (per-project; pass projectPath)
|
|
87
|
-
|
|
88
|
-
Codegraph is a SQLite knowledge graph of a codebase's symbols, edges, and
|
|
89
|
-
files: one \`homegraph_explore\` call returns the verbatim, line-numbered source
|
|
90
|
-
of the relevant symbols PLUS the call paths between them and a blast-radius
|
|
91
|
-
summary — replacing a grep + Read loop with one round-trip.
|
|
92
|
-
|
|
93
|
-
This server started somewhere with no \`.homegraph/\` of its own, so there is no
|
|
94
|
-
default project — but the tools are available and work **per project**:
|
|
95
|
-
|
|
96
|
-
- To query a project that HAS a \`.homegraph/\` index (e.g. a service inside a
|
|
97
|
-
monorepo, or a second repo), pass its path as \`projectPath\` to
|
|
98
|
-
\`homegraph_explore\` (and any other homegraph tool). Codegraph resolves the
|
|
99
|
-
nearest \`.homegraph/\` at or above that path and answers from it — for as many
|
|
100
|
-
projects as you like in one session.
|
|
101
|
-
- For a project with no \`.homegraph/\`, use your built-in tools (Read/Grep/Glob)
|
|
102
|
-
for that project. Indexing is the user's decision — don't run it yourself, but
|
|
103
|
-
if it comes up they can run \`homegraph init\` in a project to enable homegraph
|
|
104
|
-
there (a new index is picked up live, no restart).
|
|
86
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# Codegraph — available (per-project; pass projectPath)
|
|
87
|
+
|
|
88
|
+
Codegraph is a SQLite knowledge graph of a codebase's symbols, edges, and
|
|
89
|
+
files: one \`homegraph_explore\` call returns the verbatim, line-numbered source
|
|
90
|
+
of the relevant symbols PLUS the call paths between them and a blast-radius
|
|
91
|
+
summary — replacing a grep + Read loop with one round-trip.
|
|
92
|
+
|
|
93
|
+
This server started somewhere with no \`.homegraph/\` of its own, so there is no
|
|
94
|
+
default project — but the tools are available and work **per project**:
|
|
95
|
+
|
|
96
|
+
- To query a project that HAS a \`.homegraph/\` index (e.g. a service inside a
|
|
97
|
+
monorepo, or a second repo), pass its path as \`projectPath\` to
|
|
98
|
+
\`homegraph_explore\` (and any other homegraph tool). Codegraph resolves the
|
|
99
|
+
nearest \`.homegraph/\` at or above that path and answers from it — for as many
|
|
100
|
+
projects as you like in one session.
|
|
101
|
+
- For a project with no \`.homegraph/\`, use your built-in tools (Read/Grep/Glob)
|
|
102
|
+
for that project. Indexing is the user's decision — don't run it yourself, but
|
|
103
|
+
if it comes up they can run \`homegraph init\` in a project to enable homegraph
|
|
104
|
+
there (a new index is picked up live, no restart).
|
|
105
105
|
`;
|
|
106
106
|
//# sourceMappingURL=server-instructions.js.map
|