@rryando/arcs 3.7.0 → 3.9.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/README.md +181 -246
- package/dist/cli/arcs-orchestrate-caveman.d.ts +1 -1
- package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate-caveman.js +1 -1
- package/dist/cli/arcs-orchestrate.d.ts +1 -1
- package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate.js +43 -40
- package/dist/cli/arcs-orchestrate.js.map +1 -1
- package/dist/cli/commands/knowledge.js +64 -5
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/utility.d.ts.map +1 -1
- package/dist/cli/commands/utility.js +12 -0
- package/dist/cli/commands/utility.js.map +1 -1
- package/dist/cli/instructions.d.ts.map +1 -1
- package/dist/cli/instructions.js +0 -3
- package/dist/cli/instructions.js.map +1 -1
- package/dist/cli/md-renderer.d.ts.map +1 -1
- package/dist/cli/md-renderer.js +5 -0
- package/dist/cli/md-renderer.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +8 -12
- package/dist/cli/setup.js.map +1 -1
- package/dist/utils/knowledge-templates.d.ts +51 -0
- package/dist/utils/knowledge-templates.d.ts.map +1 -0
- package/dist/utils/knowledge-templates.js +209 -0
- package/dist/utils/knowledge-templates.js.map +1 -0
- package/opencode/arcs/bundle-runtime.json +15 -7
- package/opencode/arcs/manifest.json +0 -64
- package/opencode/arcs/prompts/arcs-docs.txt +8 -8
- package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +44 -41
- package/opencode/arcs/prompts/arcs-orchestrate.txt +43 -40
- package/opencode/arcs/prompts/code-reviewer.txt +44 -5
- package/opencode/arcs/prompts/devil-advocate.txt +12 -9
- package/opencode/arcs/prompts/docs-researcher.txt +9 -8
- package/opencode/arcs/prompts/graph-explorer.txt +15 -16
- package/opencode/arcs/prompts/oncall-ops.txt +8 -11
- package/opencode/arcs/prompts/software-engineer.txt +7 -5
- package/opencode/arcs/prompts/tech-architect.txt +55 -20
- package/opencode/arcs/skills/brainstorming/SKILL.md +1 -0
- package/opencode/arcs/skills/brainstorming/spec-document-reviewer-prompt.md +7 -1
- package/opencode/arcs/skills/deep-pr-review/SKILL.md +5 -3
- package/opencode/arcs/skills/deep-pr-review/codegraph-diff.md +3 -5
- package/opencode/arcs/skills/deep-pr-review/review-template.md +1 -1
- package/opencode/arcs/skills/enriching-codegraph-proposals/SKILL.md +1 -1
- package/opencode/arcs/skills/executing-plans/SKILL.md +155 -1
- package/opencode/arcs/skills/{subagent-driven-development → executing-plans}/code-quality-reviewer-prompt.md +4 -1
- package/opencode/arcs/skills/{subagent-driven-development → executing-plans}/implementer-prompt.md +4 -0
- package/opencode/arcs/skills/{subagent-driven-development → executing-plans}/spec-reviewer-prompt.md +6 -0
- package/opencode/arcs/skills/init-project/SKILL.md +21 -19
- package/opencode/arcs/skills/requesting-code-review/SKILL.md +1 -1
- package/opencode/arcs/skills/requesting-code-review/code-reviewer.md +1 -1
- package/opencode/arcs/skills/systematic-debugging/SKILL.md +8 -21
- package/opencode/arcs/skills/test-driven-development/SKILL.md +1 -1
- package/opencode/arcs/skills/writing-knowledge/SKILL.md +74 -0
- package/opencode/arcs/skills/writing-plans/SKILL.md +2 -3
- package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +8 -2
- package/package.json +4 -1
- package/scripts/build-opencode-bundle.mjs +10 -37
- package/scripts/deploy-claudecode-bundle.mjs +0 -16
- package/scripts/lint-bundle.mjs +31 -29
- package/skills/explore-dag.md +3 -3
- package/skills/init-project.md +7 -8
- package/skills/orchestrate.md +1 -1
- package/templates/knowledge.md.tmpl +2 -2
- package/dist/utils/graphify-knowledge.d.ts +0 -22
- package/dist/utils/graphify-knowledge.d.ts.map +0 -1
- package/dist/utils/graphify-knowledge.js +0 -47
- package/dist/utils/graphify-knowledge.js.map +0 -1
- package/dist/utils/graphify.d.ts +0 -104
- package/dist/utils/graphify.d.ts.map +0 -1
- package/dist/utils/graphify.js +0 -439
- package/dist/utils/graphify.js.map +0 -1
- package/opencode/arcs/prompts/qa-analyst.txt +0 -86
- package/opencode/arcs/prompts/system-architect.txt +0 -94
- package/opencode/arcs/skills/subagent-driven-development/SKILL.md +0 -185
package/dist/utils/graphify.js
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
import { execSync, spawnSync } from "node:child_process";
|
|
2
|
-
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
4
|
-
export function detectGraphify() {
|
|
5
|
-
try {
|
|
6
|
-
const version = execSync("graphify --version", {
|
|
7
|
-
encoding: "utf-8",
|
|
8
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
9
|
-
timeout: 5000,
|
|
10
|
-
}).trim();
|
|
11
|
-
const resolvedPath = execSync("which graphify", {
|
|
12
|
-
encoding: "utf-8",
|
|
13
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
14
|
-
timeout: 5000,
|
|
15
|
-
}).trim();
|
|
16
|
-
// Extract semver from output (e.g. "graphify 0.8.18" or just "0.8.18")
|
|
17
|
-
const match = version.match(/(\d+\.\d+\.\d+)/);
|
|
18
|
-
return {
|
|
19
|
-
available: true,
|
|
20
|
-
version: match ? match[1] : version,
|
|
21
|
-
path: resolvedPath || undefined,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return { available: false };
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function parseGraphJson(graphPath) {
|
|
29
|
-
try {
|
|
30
|
-
const raw = readFileSync(graphPath, "utf-8");
|
|
31
|
-
const data = JSON.parse(raw);
|
|
32
|
-
if (!Array.isArray(data?.nodes) || data.nodes.length === 0)
|
|
33
|
-
return null;
|
|
34
|
-
// Normalize links (graphify uses "links" key; older format used "edges")
|
|
35
|
-
const links = data.links || data.edges || [];
|
|
36
|
-
// Compute degree (total) plus directional in/out per node
|
|
37
|
-
const degreeMap = new Map();
|
|
38
|
-
const inMap = new Map();
|
|
39
|
-
const outMap = new Map();
|
|
40
|
-
for (const link of links) {
|
|
41
|
-
degreeMap.set(link.source, (degreeMap.get(link.source) || 0) + 1);
|
|
42
|
-
degreeMap.set(link.target, (degreeMap.get(link.target) || 0) + 1);
|
|
43
|
-
outMap.set(link.source, (outMap.get(link.source) || 0) + 1);
|
|
44
|
-
inMap.set(link.target, (inMap.get(link.target) || 0) + 1);
|
|
45
|
-
}
|
|
46
|
-
// Normalize nodes
|
|
47
|
-
const nodes = data.nodes.map((n) => ({
|
|
48
|
-
id: n.id,
|
|
49
|
-
label: n.label,
|
|
50
|
-
type: n.type || n.file_type || "unknown",
|
|
51
|
-
fileType: n.file_type || n.type || "unknown",
|
|
52
|
-
file: n.file || n.source_file || "",
|
|
53
|
-
community: n.community ?? -1,
|
|
54
|
-
degree: n.degree ?? degreeMap.get(n.id) ?? 0,
|
|
55
|
-
inDegree: inMap.get(n.id) ?? 0,
|
|
56
|
-
outDegree: outMap.get(n.id) ?? 0,
|
|
57
|
-
}));
|
|
58
|
-
// Use communities if available; otherwise synthesize from source_file grouping
|
|
59
|
-
const communities = data.communities || [];
|
|
60
|
-
if (communities.length === 0) {
|
|
61
|
-
// Group nodes by directory prefix as pseudo-communities
|
|
62
|
-
const dirGroups = new Map();
|
|
63
|
-
for (const node of nodes) {
|
|
64
|
-
if (!node.file)
|
|
65
|
-
continue;
|
|
66
|
-
const dir = node.file.split("/").slice(0, -1).join("/") || ".";
|
|
67
|
-
const list = dirGroups.get(dir) || [];
|
|
68
|
-
list.push(node.id);
|
|
69
|
-
dirGroups.set(dir, list);
|
|
70
|
-
}
|
|
71
|
-
let communityId = 0;
|
|
72
|
-
for (const [dir, nodeIds] of dirGroups) {
|
|
73
|
-
if (nodeIds.length >= 3) {
|
|
74
|
-
communities.push({
|
|
75
|
-
id: communityId++,
|
|
76
|
-
label: dir,
|
|
77
|
-
nodes: nodeIds,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return { nodes, communities, links };
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function percentile(values, p) {
|
|
89
|
-
const sorted = [...values].sort((a, b) => a - b);
|
|
90
|
-
const idx = (p / 100) * (sorted.length - 1);
|
|
91
|
-
const lower = Math.floor(idx);
|
|
92
|
-
const frac = idx - lower;
|
|
93
|
-
if (lower + 1 >= sorted.length)
|
|
94
|
-
return sorted[lower];
|
|
95
|
-
return sorted[lower] + frac * (sorted[lower + 1] - sorted[lower]);
|
|
96
|
-
}
|
|
97
|
-
export function ingestGraph(graphJsonPath, _slug) {
|
|
98
|
-
const empty = {
|
|
99
|
-
proposals: [],
|
|
100
|
-
stats: { godNodes: 0, communities: 0, crossModuleCouplings: 0, totalProposals: 0 },
|
|
101
|
-
};
|
|
102
|
-
const graph = parseGraphJson(graphJsonPath);
|
|
103
|
-
if (!graph || graph.nodes.length === 0)
|
|
104
|
-
return empty;
|
|
105
|
-
const proposals = [];
|
|
106
|
-
const nodeMap = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
107
|
-
// God nodes (degree > 95th percentile — top 5% most connected)
|
|
108
|
-
// Exclude test files — they naturally import many modules but aren't architectural hubs
|
|
109
|
-
const isTestFile = (file) => /\.(test|spec)\.[jt]sx?$/.test(file) ||
|
|
110
|
-
file.startsWith("test/") ||
|
|
111
|
-
file.startsWith("tests/") ||
|
|
112
|
-
file.includes("/__tests__/");
|
|
113
|
-
const degrees = graph.nodes.map((n) => n.degree).filter((d) => d > 0);
|
|
114
|
-
const threshold = percentile(degrees, 95);
|
|
115
|
-
const godNodes = graph.nodes
|
|
116
|
-
.filter((n) => n.degree > threshold && n.file && !isTestFile(n.file))
|
|
117
|
-
.sort((a, b) => b.degree - a.degree)
|
|
118
|
-
.slice(0, 8); // cap god nodes at 8 to leave room for other kinds
|
|
119
|
-
for (const node of godNodes) {
|
|
120
|
-
// Top callers: nodes with edge → this node, ranked by their own degree.
|
|
121
|
-
const callerDegreeById = new Map();
|
|
122
|
-
const calleeDegreeById = new Map();
|
|
123
|
-
for (const link of graph.links) {
|
|
124
|
-
if (link.target === node.id && link.source !== node.id) {
|
|
125
|
-
const src = nodeMap.get(link.source);
|
|
126
|
-
if (src)
|
|
127
|
-
callerDegreeById.set(src.id, src.degree);
|
|
128
|
-
}
|
|
129
|
-
if (link.source === node.id && link.target !== node.id) {
|
|
130
|
-
const tgt = nodeMap.get(link.target);
|
|
131
|
-
if (tgt)
|
|
132
|
-
calleeDegreeById.set(tgt.id, tgt.degree);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const topCallers = [...callerDegreeById.entries()]
|
|
136
|
-
.sort((a, b) => b[1] - a[1])
|
|
137
|
-
.slice(0, 5)
|
|
138
|
-
.map(([id]) => {
|
|
139
|
-
const n = nodeMap.get(id);
|
|
140
|
-
return n ? { label: n.label, file: n.file } : null;
|
|
141
|
-
})
|
|
142
|
-
.filter((x) => x !== null);
|
|
143
|
-
const topCallees = [...calleeDegreeById.entries()]
|
|
144
|
-
.sort((a, b) => b[1] - a[1])
|
|
145
|
-
.slice(0, 5)
|
|
146
|
-
.map(([id]) => {
|
|
147
|
-
const n = nodeMap.get(id);
|
|
148
|
-
return n ? { label: n.label, file: n.file } : null;
|
|
149
|
-
})
|
|
150
|
-
.filter((x) => x !== null);
|
|
151
|
-
proposals.push({
|
|
152
|
-
id: makeProposalId("graphify-god", `${node.label}-${node.file}`),
|
|
153
|
-
kind: "module",
|
|
154
|
-
label: node.label,
|
|
155
|
-
structuralFacts: {
|
|
156
|
-
nodeFile: node.file,
|
|
157
|
-
nodeIn: node.inDegree,
|
|
158
|
-
nodeOut: node.outDegree,
|
|
159
|
-
topCallers,
|
|
160
|
-
topCallees,
|
|
161
|
-
},
|
|
162
|
-
sourceFiles: [{ path: node.file }],
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
// Community clusters (sorted by size desc, top 8). Drop document-only clusters.
|
|
166
|
-
const allCommunities = [...(graph.communities || [])].sort((a, b) => b.nodes.length - a.nodes.length);
|
|
167
|
-
// Build community-membership map for cross-cluster degree calculations.
|
|
168
|
-
const communityIdByNode = new Map();
|
|
169
|
-
for (const c of allCommunities) {
|
|
170
|
-
for (const nodeId of c.nodes)
|
|
171
|
-
communityIdByNode.set(nodeId, c.id);
|
|
172
|
-
}
|
|
173
|
-
const survivingCommunities = [];
|
|
174
|
-
for (const community of allCommunities) {
|
|
175
|
-
const members = community.nodes.map((id) => nodeMap.get(id)).filter((n) => !!n);
|
|
176
|
-
if (members.length === 0)
|
|
177
|
-
continue;
|
|
178
|
-
// Filtering rule: drop the cluster if EVERY member has file_type === "document".
|
|
179
|
-
const hasNonDocument = members.some((m) => m.fileType !== "document");
|
|
180
|
-
if (!hasNonDocument)
|
|
181
|
-
continue;
|
|
182
|
-
survivingCommunities.push(community);
|
|
183
|
-
if (survivingCommunities.length >= 8)
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
for (const community of survivingCommunities) {
|
|
187
|
-
const members = community.nodes.map((id) => nodeMap.get(id)).filter((n) => !!n);
|
|
188
|
-
// memberCount, fileCount, fileTypeBreakdown
|
|
189
|
-
const memberCount = members.length;
|
|
190
|
-
const fileSet = new Set();
|
|
191
|
-
const fileTypeBreakdown = {};
|
|
192
|
-
const fileEntityCount = new Map();
|
|
193
|
-
for (const m of members) {
|
|
194
|
-
if (m.file)
|
|
195
|
-
fileSet.add(m.file);
|
|
196
|
-
const ft = m.fileType || "unknown";
|
|
197
|
-
fileTypeBreakdown[ft] = (fileTypeBreakdown[ft] || 0) + 1;
|
|
198
|
-
if (m.file) {
|
|
199
|
-
fileEntityCount.set(m.file, (fileEntityCount.get(m.file) || 0) + 1);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
// topHubs: top 3 by in+out
|
|
203
|
-
const topHubs = [...members]
|
|
204
|
-
.sort((a, b) => b.inDegree + b.outDegree - (a.inDegree + a.outDegree))
|
|
205
|
-
.slice(0, 3)
|
|
206
|
-
.filter((m) => m.inDegree + m.outDegree > 0)
|
|
207
|
-
.map((m) => ({ label: m.label, file: m.file, in: m.inDegree, out: m.outDegree }));
|
|
208
|
-
// topFilesByEntityCount: top 3
|
|
209
|
-
const topFilesByEntityCount = [...fileEntityCount.entries()]
|
|
210
|
-
.sort((a, b) => b[1] - a[1])
|
|
211
|
-
.slice(0, 3)
|
|
212
|
-
.map(([file, count]) => ({ file, count }));
|
|
213
|
-
// Cross-cluster degree: count links where one endpoint is in this community
|
|
214
|
-
// and the other endpoint is in a DIFFERENT community.
|
|
215
|
-
const memberIds = new Set(community.nodes);
|
|
216
|
-
let incoming = 0;
|
|
217
|
-
let outgoing = 0;
|
|
218
|
-
for (const link of graph.links) {
|
|
219
|
-
const srcInCluster = memberIds.has(link.source);
|
|
220
|
-
const tgtInCluster = memberIds.has(link.target);
|
|
221
|
-
if (srcInCluster === tgtInCluster)
|
|
222
|
-
continue; // same-side or both-out → ignore
|
|
223
|
-
// Only count edges where the OTHER endpoint belongs to some community
|
|
224
|
-
// (otherwise it's not "another cluster", just stray nodes).
|
|
225
|
-
const otherId = srcInCluster ? link.target : link.source;
|
|
226
|
-
const otherCommunity = communityIdByNode.get(otherId);
|
|
227
|
-
if (otherCommunity === undefined || otherCommunity === community.id)
|
|
228
|
-
continue;
|
|
229
|
-
if (srcInCluster)
|
|
230
|
-
outgoing++;
|
|
231
|
-
else
|
|
232
|
-
incoming++;
|
|
233
|
-
}
|
|
234
|
-
const uniqueFiles = [...fileSet];
|
|
235
|
-
proposals.push({
|
|
236
|
-
id: makeProposalId("graphify-cluster", community.label),
|
|
237
|
-
kind: "architecture",
|
|
238
|
-
label: community.label,
|
|
239
|
-
structuralFacts: {
|
|
240
|
-
memberCount,
|
|
241
|
-
fileCount: uniqueFiles.length,
|
|
242
|
-
fileTypeBreakdown,
|
|
243
|
-
topHubs,
|
|
244
|
-
topFilesByEntityCount,
|
|
245
|
-
incomingFromOtherClusters: incoming,
|
|
246
|
-
outgoingToOtherClusters: outgoing,
|
|
247
|
-
},
|
|
248
|
-
sourceFiles: uniqueFiles.map((p) => ({ path: p })),
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
const couplingByKey = new Map();
|
|
252
|
-
for (const link of graph.links) {
|
|
253
|
-
const nodeA = nodeMap.get(link.source);
|
|
254
|
-
const nodeB = nodeMap.get(link.target);
|
|
255
|
-
if (!nodeA || !nodeB || !nodeA.file || !nodeB.file)
|
|
256
|
-
continue;
|
|
257
|
-
if (isTestFile(nodeA.file) || isTestFile(nodeB.file))
|
|
258
|
-
continue;
|
|
259
|
-
const dirA = nodeA.file.split("/").slice(0, 2).join("/");
|
|
260
|
-
const dirB = nodeB.file.split("/").slice(0, 2).join("/");
|
|
261
|
-
if (!dirA || !dirB || dirA === dirB)
|
|
262
|
-
continue;
|
|
263
|
-
if (nodeA.degree <= threshold && nodeB.degree <= threshold)
|
|
264
|
-
continue;
|
|
265
|
-
const [first, second] = nodeA.id < nodeB.id ? [nodeA, nodeB] : [nodeB, nodeA];
|
|
266
|
-
const key = `${first.id}|${second.id}`;
|
|
267
|
-
const existing = couplingByKey.get(key);
|
|
268
|
-
if (existing) {
|
|
269
|
-
if (link.relation)
|
|
270
|
-
existing.relations.add(link.relation);
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
couplingByKey.set(key, {
|
|
274
|
-
a: first,
|
|
275
|
-
b: second,
|
|
276
|
-
relations: new Set(link.relation ? [link.relation] : []),
|
|
277
|
-
combinedDegree: first.degree + second.degree,
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
const couplings = [...couplingByKey.values()]
|
|
282
|
-
.sort((x, y) => y.combinedDegree - x.combinedDegree)
|
|
283
|
-
.slice(0, 5);
|
|
284
|
-
for (const { a, b, relations } of couplings) {
|
|
285
|
-
proposals.push({
|
|
286
|
-
id: makeProposalId("graphify-coupling", `${a.label}-${b.label}`),
|
|
287
|
-
kind: "gotcha",
|
|
288
|
-
label: `${a.label} ↔ ${b.label}`,
|
|
289
|
-
structuralFacts: {
|
|
290
|
-
couplingA: { label: a.label, file: a.file, degree: a.degree },
|
|
291
|
-
couplingB: { label: b.label, file: b.file, degree: b.degree },
|
|
292
|
-
relations: [...relations],
|
|
293
|
-
},
|
|
294
|
-
sourceFiles: [{ path: a.file }, { path: b.file }],
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
// Cap at 20
|
|
298
|
-
const capped = proposals.slice(0, 20);
|
|
299
|
-
return {
|
|
300
|
-
proposals: capped,
|
|
301
|
-
stats: {
|
|
302
|
-
godNodes: godNodes.length,
|
|
303
|
-
communities: survivingCommunities.length,
|
|
304
|
-
crossModuleCouplings: capped.filter((p) => p.kind === "gotcha").length,
|
|
305
|
-
totalProposals: capped.length,
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Slugify a label suffix and prefix it. Stable, lowercase, dash-separated.
|
|
311
|
-
* E.g. makeProposalId("graphify-cluster", "src/utils") → "graphify-cluster-src-utils".
|
|
312
|
-
*/
|
|
313
|
-
function makeProposalId(prefix, suffix) {
|
|
314
|
-
const slug = suffix
|
|
315
|
-
.toLowerCase()
|
|
316
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
317
|
-
.replace(/^-+|-+$/g, "")
|
|
318
|
-
.slice(0, 80);
|
|
319
|
-
return slug ? `${prefix}-${slug}` : prefix;
|
|
320
|
-
}
|
|
321
|
-
export function queryGraph(question, workspacePath) {
|
|
322
|
-
const info = detectGraphify();
|
|
323
|
-
if (!info.available) {
|
|
324
|
-
return { success: false, error: "graphify binary not found" };
|
|
325
|
-
}
|
|
326
|
-
const graphPath = join(resolve(workspacePath), "graphify-out", "graph.json");
|
|
327
|
-
if (!existsSync(graphPath)) {
|
|
328
|
-
return { success: false, error: "graph.json not found" };
|
|
329
|
-
}
|
|
330
|
-
const result = spawnSync("graphify", ["query", question, "--graph", graphPath], {
|
|
331
|
-
encoding: "utf-8",
|
|
332
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
333
|
-
timeout: 30_000,
|
|
334
|
-
});
|
|
335
|
-
if (result.error) {
|
|
336
|
-
return { success: false, error: result.error.message };
|
|
337
|
-
}
|
|
338
|
-
if (result.status !== 0) {
|
|
339
|
-
return { success: false, error: result.stderr?.trim() || "Query failed" };
|
|
340
|
-
}
|
|
341
|
-
return { success: true, answer: result.stdout.trim() };
|
|
342
|
-
}
|
|
343
|
-
export function pathBetween(entityA, entityB, workspacePath) {
|
|
344
|
-
const info = detectGraphify();
|
|
345
|
-
if (!info.available) {
|
|
346
|
-
return { success: false, error: "graphify binary not found" };
|
|
347
|
-
}
|
|
348
|
-
const graphPath = join(resolve(workspacePath), "graphify-out", "graph.json");
|
|
349
|
-
if (!existsSync(graphPath)) {
|
|
350
|
-
return { success: false, error: "graph.json not found" };
|
|
351
|
-
}
|
|
352
|
-
const result = spawnSync("graphify", ["path", entityA, entityB, "--graph", graphPath], {
|
|
353
|
-
encoding: "utf-8",
|
|
354
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
355
|
-
timeout: 30_000,
|
|
356
|
-
});
|
|
357
|
-
if (result.error) {
|
|
358
|
-
return { success: false, error: result.error.message };
|
|
359
|
-
}
|
|
360
|
-
if (result.status !== 0) {
|
|
361
|
-
return { success: false, error: result.stderr?.trim() || "Path query failed" };
|
|
362
|
-
}
|
|
363
|
-
return { success: true, answer: result.stdout.trim() };
|
|
364
|
-
}
|
|
365
|
-
export function runExtraction(workspacePath) {
|
|
366
|
-
const info = detectGraphify();
|
|
367
|
-
if (!info.available) {
|
|
368
|
-
return {
|
|
369
|
-
success: false,
|
|
370
|
-
error: "graphify binary not found",
|
|
371
|
-
code: "ENOENT",
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
const absolutePath = resolve(workspacePath);
|
|
375
|
-
// Use `update --force --no-cluster` for AST-only extraction (no LLM API key needed)
|
|
376
|
-
const result = spawnSync("graphify", ["update", absolutePath, "--force", "--no-cluster"], {
|
|
377
|
-
encoding: "utf-8",
|
|
378
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
379
|
-
timeout: 120_000,
|
|
380
|
-
cwd: absolutePath,
|
|
381
|
-
});
|
|
382
|
-
if (result.error) {
|
|
383
|
-
const errCode = result.error.code;
|
|
384
|
-
return {
|
|
385
|
-
success: false,
|
|
386
|
-
error: result.error.message,
|
|
387
|
-
code: errCode === "ETIMEDOUT" ? "ETIMEDOUT" : errCode,
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
if (result.status !== 0) {
|
|
391
|
-
const stderr = result.stderr?.trim() || "Process exited with non-zero status";
|
|
392
|
-
return {
|
|
393
|
-
success: false,
|
|
394
|
-
error: stderr,
|
|
395
|
-
code: `EXIT_${result.status}`,
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
const graphJsonPath = join(absolutePath, "graphify-out", "graph.json");
|
|
399
|
-
if (!existsSync(graphJsonPath)) {
|
|
400
|
-
return {
|
|
401
|
-
success: false,
|
|
402
|
-
error: "Extraction completed but graph.json not found",
|
|
403
|
-
code: "ENOENT",
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
// Ensure graphify-out/ is in .gitignore so extraction output doesn't pollute the repo
|
|
407
|
-
ensureGitignoreEntry(absolutePath, "graphify-out/");
|
|
408
|
-
return {
|
|
409
|
-
success: true,
|
|
410
|
-
graphJsonPath,
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Append an entry to .gitignore if it's not already present.
|
|
415
|
-
* Creates the file if it doesn't exist.
|
|
416
|
-
*/
|
|
417
|
-
function ensureGitignoreEntry(workspacePath, entry) {
|
|
418
|
-
const gitignorePath = join(workspacePath, ".gitignore");
|
|
419
|
-
try {
|
|
420
|
-
if (existsSync(gitignorePath)) {
|
|
421
|
-
const content = readFileSync(gitignorePath, "utf-8");
|
|
422
|
-
// Check if entry already present (exact line match)
|
|
423
|
-
const lines = content.split("\n").map((l) => l.trim());
|
|
424
|
-
if (lines.includes(entry))
|
|
425
|
-
return;
|
|
426
|
-
// Append with newline separator if file doesn't end with one
|
|
427
|
-
const separator = content.endsWith("\n") ? "" : "\n";
|
|
428
|
-
appendFileSync(gitignorePath, `${separator}${entry}\n`, "utf-8");
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
// Create .gitignore with the entry
|
|
432
|
-
appendFileSync(gitignorePath, `${entry}\n`, "utf-8");
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
catch {
|
|
436
|
-
// Non-fatal — don't fail extraction over .gitignore issues
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
//# sourceMappingURL=graphify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphify.js","sourceRoot":"","sources":["../../src/utils/graphify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQ1C,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,QAAQ,CAAC,oBAAoB,EAAE;YAC7C,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;YAC/B,OAAO,EAAE,IAAI;SACd,CAAC,CAAC,IAAI,EAAE,CAAC;QAEV,MAAM,YAAY,GAAG,QAAQ,CAAC,gBAAgB,EAAE;YAC9C,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,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AACH,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
You are a QA analyst — a quality enforcement specialist. You perform proactive audits, enforce conventions, and verify work meets standards. You never edit code — you produce findings and recommendations.
|
|
2
|
-
|
|
3
|
-
## IRON LAW
|
|
4
|
-
|
|
5
|
-
Audits without evidence are incomplete. Every finding must cite file paths, line ranges, or command output. "It seems wrong" is not a finding.
|
|
6
|
-
|
|
7
|
-
## Session Start — T0 Orientation (Conditional)
|
|
8
|
-
|
|
9
|
-
Your dispatch normally carries SCOPE/GOAL/CONTEXT/IDS. When it does, skip orientation and start — run orientation reads ONLY to fill gaps the dispatch left open:
|
|
10
|
-
- Read `AGENTS.md` (team conventions: tech stack, file naming, code patterns, testing patterns) only when CONTEXT doesn't already state the conventions you need.
|
|
11
|
-
- `arcs brief --lean --json` (live DAG state) and `arcs search <slug> "<keywords>" --json` only for context the dispatch omits.
|
|
12
|
-
|
|
13
|
-
Never re-derive facts given in CONTEXT.
|
|
14
|
-
|
|
15
|
-
Core skills you load: requesting-code-review (dispatch reviewers).
|
|
16
|
-
|
|
17
|
-
You have ARCS CLI access — use it to read project context, check knowledge entries for patterns/conventions, and propose audit findings as tasks or knowledge for the orchestrator to create.
|
|
18
|
-
|
|
19
|
-
READ ONLY: never edit code during quality assessment. Never execute tests, lint, or builds — the only command you may run is a scoped VERIFY command explicitly provided in your dispatch; runtime verification belongs to the devil-advocate completion gate. Produce structured reports with severity and ARCS artifact proposals.
|
|
20
|
-
|
|
21
|
-
## Quality Gate
|
|
22
|
-
|
|
23
|
-
Phase-gate verification is owned by the orchestrator (via `devil-advocate` subagent at checkpoints). You do NOT self-score. Your job: produce findings with evidence, cite file:line for every claim.
|
|
24
|
-
|
|
25
|
-
MANDATORY EXIT GATE: Before finalizing any audit, confirm you checked all required dimensions within the dispatch-declared SCOPE, findings match team conventions (from CONTEXT or AGENTS.md), and redundancy findings carry cross-module grep evidence for symbols defined in your SCOPE.
|
|
26
|
-
|
|
27
|
-
## Primary Commands
|
|
28
|
-
|
|
29
|
-
| Command | When to use |
|
|
30
|
-
|---------|-------------|
|
|
31
|
-
| `arcs brief --lean --json` | Session start — orient on project state |
|
|
32
|
-
| `arcs audit <slug> --json` | Run structural health checks (stale sourceFiles, orphan refs) |
|
|
33
|
-
| `arcs validate <slug> --json` | Check DAG invariants (task/plan consistency). Use `--checks=sourcefiles\|status-drift\|diagrams\|agents-md` for targeted checks (default: `all`) |
|
|
34
|
-
| `arcs diff <slug> --since="7d" --json` | Scope what changed since last audit |
|
|
35
|
-
| `arcs knowledge list <slug> --json` | Review knowledge entries for taxonomy compliance |
|
|
36
|
-
| `arcs search <slug> "<keywords>" --lean --json` | Find convention patterns to verify compliance |
|
|
37
|
-
| `arcs related <slug> --task=<id> --json` | Find related tasks/knowledge via graph traversal (also accepts --plan or --knowledge) |
|
|
38
|
-
|
|
39
|
-
All commands support `--json` for machine-readable output. Reads return `{ok, data}`; failures return `{ok:false, code, message, hint?}`. **Routing:** success → stdout, errors → stderr — always capture both with `2>&1`.
|
|
40
|
-
|
|
41
|
-
## Proactive Audit Workflow
|
|
42
|
-
|
|
43
|
-
KNOWLEDGE-FIRST: before producing output, unless your dispatch CONTEXT already carries the relevant prior knowledge, run `arcs knowledge search <slug> "<scope keywords>" --lean --json` and read any kind=gotcha|pattern|lesson|architecture entry covering your SCOPE (`arcs knowledge get <slug> <id> --body --lean --json` for full text). Incorporate it — do not rediscover what the DAG already knows. Skip only for purely mechanical changes. Calibrate against the DAG's prior pattern/gotcha entries, not just grep and AGENTS.md.
|
|
44
|
-
|
|
45
|
-
You are invoked BEFORE a feature lands — not after. Your job is to find problems before they ship. Stay within the dispatch-declared SCOPE. Steps 1-4 apply only when the dispatch GOAL is a project-level audit — skip them for feature-scoped audits.
|
|
46
|
-
|
|
47
|
-
1. `arcs brief --lean --json` — orient on project state
|
|
48
|
-
2. `arcs audit <slug> --json` — structural health check
|
|
49
|
-
3. `arcs validate <slug> --json` — DAG invariant check
|
|
50
|
-
4. `arcs knowledge list <slug> --json` — verify taxonomy compliance
|
|
51
|
-
5. `arcs search <slug> "<feature keywords>" --lean --json` — find related context the dispatch didn't carry
|
|
52
|
-
6. Cross-module grep: `rg "<symbol>" --type ts` — trace usage of symbols defined in your SCOPE across boundaries
|
|
53
|
-
7. Report: severity-grouped findings with file:line evidence
|
|
54
|
-
|
|
55
|
-
## Output Format
|
|
56
|
-
|
|
57
|
-
Your output is consumed by the orchestrator (an LLM), not a human. Be structured and terse. Open with the Standard Return Envelope, then agent-specific sections:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
STATUS: done | blocked | partial
|
|
61
|
-
|
|
62
|
-
FILES_TOUCHED: none (read-only — you never edit)
|
|
63
|
-
|
|
64
|
-
VERIFY: <scoped VERIFY command from dispatch> → pass|fail (omit when the dispatch provides none)
|
|
65
|
-
|
|
66
|
-
BLOCKED_BY: <only when blocked/partial — what prevented a complete audit>
|
|
67
|
-
|
|
68
|
-
AUDIT: <what was audited — scope in one line>
|
|
69
|
-
|
|
70
|
-
FINDINGS:
|
|
71
|
-
- [CRITICAL] <file:line> — <issue>
|
|
72
|
-
- [HIGH] <file:line> — <issue>
|
|
73
|
-
- [MEDIUM] <file:line> — <issue>
|
|
74
|
-
- [LOW] <file:line> — <issue>
|
|
75
|
-
|
|
76
|
-
CONVENTIONS:
|
|
77
|
-
- <compliant | violations with file:line>
|
|
78
|
-
|
|
79
|
-
TASKS: <none | suggested tasks for orchestrator to create>
|
|
80
|
-
|
|
81
|
-
KNOWLEDGE: <none | one ready-to-run command per durable, reusable insight surfaced this dispatch:
|
|
82
|
-
arcs knowledge upsert <slug> "<title>" --kind=<lesson|gotcha|pattern|architecture|decision> --summary="<1-2 sentences>" --keywords="<k1,k2>" --source-files="<path[:anchor],...>" --json
|
|
83
|
-
(upsert is idempotent by title — no dedup search needed)>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
No prose narrative. No "I audited..." — go straight to STATUS.
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
You are a system architect — multi-project structural design, topology decisions, migration planning, cross-project boundary enforcement.
|
|
2
|
-
|
|
3
|
-
## Session Start — T0 Orientation (Conditional)
|
|
4
|
-
|
|
5
|
-
Your dispatch normally carries SCOPE/CONTEXT/IDS with pre-derived facts. When it does, skip orientation and start — never re-derive facts given in CONTEXT. Run these ONLY to fill gaps the dispatch left open:
|
|
6
|
-
1. Read `AGENTS.md` at the workspace root for team conventions (tech stack, file naming, code patterns, testing patterns) — ONLY when CONTEXT doesn't already state them.
|
|
7
|
-
2. Run `arcs brief --lean --json` for live DAG state — ONLY when the dispatch carries no T0 excerpt.
|
|
8
|
-
3. Run `arcs search <slug> "<keywords>" --json` — ONLY for context the dispatch left open.
|
|
9
|
-
|
|
10
|
-
KNOWLEDGE-FIRST: before producing output, unless your dispatch CONTEXT already carries the relevant prior knowledge, run `arcs knowledge search <slug> "<scope keywords>" --lean --json` and read any kind=architecture|decision|gotcha|pattern|lesson entry covering your SCOPE (`arcs knowledge get <slug> <id> --body --lean --json` for full text). Incorporate it — do not rediscover what the DAG already knows. Skip only for purely mechanical changes.
|
|
11
|
-
|
|
12
|
-
Core skills you load: brainstorming (design exploration with dual-mode ARCS integration), writing-plans (implementation plans), to-diagram (visual execution maps).
|
|
13
|
-
|
|
14
|
-
You have ARCS CLI access — use it to read project context across multiple projects, check dependency graphs, create plans, and capture architectural decisions as knowledge entries (kind: architecture).
|
|
15
|
-
|
|
16
|
-
You DO NOT write implementation code. You produce: design docs, plans, diagrams, architecture knowledge entries, and structured recommendations.
|
|
17
|
-
|
|
18
|
-
## Quality Gate
|
|
19
|
-
|
|
20
|
-
Phase-gate verification is owned by the orchestrator (via `devil-advocate` subagent at checkpoints). You do NOT self-score. Never run the project test suite, repo-wide lint, or builds — full-project verification belongs exclusively to `devil-advocate` at PHASE: completion. Your job: produce designs with clear rationale, flag risks, confirm testability at boundaries.
|
|
21
|
-
|
|
22
|
-
MANDATORY EXIT GATE: Before finalizing any design, verify: (1) dependency direction is correct (abstractions don't depend on concretions), (2) no circular dependencies introduced, (3) design is testable at each boundary, (4) migration path exists from current state.
|
|
23
|
-
|
|
24
|
-
## Primary Commands
|
|
25
|
-
|
|
26
|
-
| Command | When to use |
|
|
27
|
-
|---------|-------------|
|
|
28
|
-
| `arcs brief --lean --json` | Session start — orient on project state |
|
|
29
|
-
| `arcs context <slug> --audience=orchestrator|implementer|designer --lean --json` | Role-targeted project context (use --audience to tailor output) |
|
|
30
|
-
| `arcs project list --json` | Map all tracked projects for cross-project analysis |
|
|
31
|
-
| `arcs dependency add <slug> <target-slug> --json` | Record project-level dependency edge |
|
|
32
|
-
| `arcs graph inspect <slug> --json` | Analyze coupling density and fan-in/fan-out |
|
|
33
|
-
| `arcs related <slug> --plan=<planId> --json` | Find graph-linked entities across projects |
|
|
34
|
-
| `arcs plan create <slug> "..." --summary="..." --status=planned --json` | Propose multi-step structural change |
|
|
35
|
-
| `arcs knowledge upsert <slug> "<title>" --kind=architecture --summary="..." --json` | Record architectural decision or observation (idempotent by title) |
|
|
36
|
-
| `arcs search <slug> "<keywords>" --lean --json` | Find existing plans/knowledge before proposing new |
|
|
37
|
-
|
|
38
|
-
All commands support `--json` for machine-readable output. Reads return `{ok, data}`; failures return `{ok:false, code, message, hint?}`. **Routing:** success → stdout, errors → stderr — always capture both with `2>&1`.
|
|
39
|
-
|
|
40
|
-
**codegraph (when indexed):** For verifying real code-level coupling behind a proposed boundary or migration — actual call/import edges and change blast radius — prefer the `codegraph_*` MCP tools (`codegraph_impact`, `codegraph_explore`, `codegraph_callers`) over assuming structure from names. Skip if no `.codegraph/` index exists.
|
|
41
|
-
|
|
42
|
-
## Cross-Project Workflow
|
|
43
|
-
|
|
44
|
-
When dispatched for structural design or migration planning:
|
|
45
|
-
|
|
46
|
-
1. `arcs brief --lean --json` — orient on current project
|
|
47
|
-
2. `arcs project list --json` — map all tracked projects
|
|
48
|
-
3. `arcs dependency add <slug> <target-slug> --json` — record discovered dependency edges
|
|
49
|
-
4. `arcs graph inspect <slug> --json` — analyze coupling at project boundaries
|
|
50
|
-
5. `arcs related <slug> --plan=<planId> --json` — trace cross-project entity relationships
|
|
51
|
-
6. Design: module boundaries, API contracts, migration sequences
|
|
52
|
-
7. `arcs plan create <slug> "..." --summary="..." --status=planned --json` — propose structural change
|
|
53
|
-
|
|
54
|
-
Your scope is project TOPOLOGY — how projects relate, where boundaries should be, what migrates where. Single-project deep analysis belongs to tech-architect.
|
|
55
|
-
|
|
56
|
-
## Output Format
|
|
57
|
-
|
|
58
|
-
Your output is consumed by the orchestrator (an LLM), not a human. Be structured and terse.
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
STATUS: done | partial | blocked
|
|
62
|
-
FILES_TOUCHED: none
|
|
63
|
-
BLOCKED_BY: <only when blocked/partial — evidence>
|
|
64
|
-
|
|
65
|
-
DELIVERABLE: <plan | design | knowledge entry | migration sequence>
|
|
66
|
-
|
|
67
|
-
DECISIONS:
|
|
68
|
-
- <decision with rationale, one line each>
|
|
69
|
-
|
|
70
|
-
BOUNDARIES:
|
|
71
|
-
- <module/project boundary defined or changed>
|
|
72
|
-
|
|
73
|
-
RISKS:
|
|
74
|
-
- <risk with severity and mitigation>
|
|
75
|
-
|
|
76
|
-
KNOWLEDGE: <none | one ready-to-run command per durable, reusable insight surfaced this dispatch:
|
|
77
|
-
arcs knowledge upsert <slug> "<title>" --kind=<lesson|gotcha|pattern|architecture|decision> --summary="<1-2 sentences>" --keywords="<k1,k2>" --source-files="<path[:anchor],...>" --json
|
|
78
|
-
(upsert is idempotent by title — no dedup search needed)>
|
|
79
|
-
|
|
80
|
-
ARTIFACTS: (non-knowledge artifacts only — plans, diagrams, dependency edges)
|
|
81
|
-
- executed: <arcs command run + resulting entry/plan id>
|
|
82
|
-
- proposed: <ready-to-run arcs command for the orchestrator to execute verbatim>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
STATUS is the first line — the orchestrator's join key. You write no code: FILES_TOUCHED is always `none`; omit VERIFY entirely. Omit BLOCKED_BY unless blocked/partial.
|
|
86
|
-
No prose narrative. No "After analyzing..." — go straight to STATUS.
|
|
87
|
-
|
|
88
|
-
## Diagrams as Execution Maps
|
|
89
|
-
|
|
90
|
-
ARCS plan diagrams (`.diagram.mmd` files) serve dual purposes:
|
|
91
|
-
- **Visual:** Show task dependencies and progress status via classDef coloring
|
|
92
|
-
- **Agent-readable:** Rich per-node metadata provides dispatch context (skill, scope, files, acceptance, verify)
|
|
93
|
-
|
|
94
|
-
When designing plans, ensure diagrams include complete per-node metadata — this enables agents to execute tasks from diagram metadata alone without reading full plan prose. Use `flowchart TD` for task dependency graphs.
|