@getchomp/cli 0.2.44 → 0.2.45
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/dist/commands/init.js
CHANGED
|
@@ -11,10 +11,10 @@ import { startUiServer } from "./ui.js";
|
|
|
11
11
|
export const HARNESS_TEXT = `
|
|
12
12
|
# --- BEGIN CHOMP HARNESS ---
|
|
13
13
|
You are working in a Chomp-enabled workspace. Use the live codebase map first instead of guessing structure with grep or blind file scans:
|
|
14
|
-
1. Resolve target node IDs with chomp_get_nodes (using search_term / packageName) BEFORE reading source files. When the user asks an architectural question, queries how a flow works, or requests a visual walkthrough, IMMEDIATELY call chomp_create_view (passing viewLevel: "system" | "package") to spotlight the flow on Chomp Map and share the returned viewUrl link. Do NOT call chomp_create_view on routine coding or implementation prompts.
|
|
14
|
+
1. Resolve target node IDs with chomp_get_nodes (using search_term / packageName) BEFORE reading source files. For frontend CSS, Tailwind, or React UI edits, call chomp_audit_design_system in parallel during initial discovery. When the user asks an architectural question, queries how a flow works, or requests a visual walkthrough, IMMEDIATELY call chomp_create_view (passing viewLevel: "system" | "package") to spotlight the flow on Chomp Map and share the returned viewUrl link. Do NOT call chomp_create_view on routine coding or implementation prompts.
|
|
15
15
|
2. Call chomp_get_blast_radius (with create_view: false during coding tasks, or create_view: true when answering impact questions) BEFORE modifying a function, class, or route to check upstream callers, downstream dependencies, and input/output types, and use chomp_get_edges to trace call paths.
|
|
16
|
-
3.
|
|
17
|
-
4.
|
|
16
|
+
3. Align new code with canonical workspace boundaries and shared packages (use chomp_get_conventions when unsure, and chomp_local_shims to add Bridges for dynamic or dependency-injected calls).
|
|
17
|
+
4. After finishing edits, run your verification gate IN PARALLEL IN A SINGLE TURN: call chomp_get_diff (which includes architecturalGate for newly introduced middlemen, duplicate flows, duplicate symbols, boundary violations, and cycles; or pass only_new: true to chomp_find_redundancies / chomp_check_boundaries) alongside chomp_diff_design_system when UI files changed. Only fix newly introduced middlemen, duplicate flows, boundary violations, or design-system regressions; do NOT chase pre-existing repo advisories or standard framework/hook unresolved call counts.
|
|
18
18
|
# --- END CHOMP HARNESS ---
|
|
19
19
|
`.trim() + "\n";
|
|
20
20
|
export const CHOMP_HOOK_BLOCK = `
|
|
@@ -47,6 +47,8 @@ export interface SkeletonHydrationMap {
|
|
|
47
47
|
realBadgeByPseudoBadge: Map<string, string>;
|
|
48
48
|
/** Maps pseudonymized receptor ID -> real receptor ID. */
|
|
49
49
|
realReceptorIdByPseudoId: Map<string, string>;
|
|
50
|
+
/** Maps `${sourceId}::${targetId}` -> original resolved edge name. */
|
|
51
|
+
realEdgeNameByPair?: Map<string, string>;
|
|
50
52
|
/** Maps `${sourceId}::${lineNumber}::${pseudoCallName}` -> real unresolved call metadata. */
|
|
51
53
|
realUnresolvedByKey: Map<string, {
|
|
52
54
|
name: string;
|
|
@@ -287,6 +287,7 @@ export function anonymizeGraphForCloudLayout(rawGraph, diffDelta, rulesConfig, o
|
|
|
287
287
|
const realDisplayNameByRealPkg = new Map();
|
|
288
288
|
const realBadgeByPseudoBadge = new Map();
|
|
289
289
|
const realReceptorIdByPseudoId = new Map();
|
|
290
|
+
const realEdgeNameByPair = new Map();
|
|
290
291
|
const realUnresolvedByKey = new Map();
|
|
291
292
|
const nodeById = new Map();
|
|
292
293
|
for (const n of rawGraph.nodes) {
|
|
@@ -667,19 +668,26 @@ export function anonymizeGraphForCloudLayout(rawGraph, diffDelta, rulesConfig, o
|
|
|
667
668
|
anonMetadata.dialect = inferred;
|
|
668
669
|
}
|
|
669
670
|
}
|
|
671
|
+
const { evidence: _rawNodeEv, metadata: _rawNodeMeta, ...nodeRest } = n;
|
|
670
672
|
return {
|
|
671
|
-
...
|
|
673
|
+
...nodeRest,
|
|
672
674
|
name: pseudoName,
|
|
673
|
-
|
|
675
|
+
evidence: anonEvidence ?? { filePath: "f_anon.ts" },
|
|
674
676
|
...(Object.keys(anonMetadata).length > 0 ? { metadata: anonMetadata } : {}),
|
|
675
677
|
};
|
|
676
678
|
});
|
|
677
|
-
// 5. Anonymize edges (including unresolved call edge names & evidence)
|
|
679
|
+
// 5. Anonymize edges (including resolved/unresolved call edge names, helper tags & evidence)
|
|
678
680
|
const anonymizedEdges = rawGraph.edges.map((e) => {
|
|
679
681
|
const ev = Array.isArray(e.evidence) ? e.evidence[0] : e.evidence;
|
|
680
682
|
const lineNumber = typeof ev?.lineNumber === "number" ? ev.lineNumber : undefined;
|
|
681
|
-
let anonEdgeName = e.
|
|
682
|
-
if (
|
|
683
|
+
let anonEdgeName = e.entityType ? `Edge: ${e.entityType}` : "call";
|
|
684
|
+
if (e.targetId && e.name) {
|
|
685
|
+
const pairKey = `${e.sourceId}::${e.targetId}`;
|
|
686
|
+
if (!realEdgeNameByPair.has(pairKey)) {
|
|
687
|
+
realEdgeNameByPair.set(pairKey, e.name);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
else if (!e.targetId && e.name) {
|
|
683
691
|
const rawCall = e.name.replace(/^Call:\s*/i, "").trim();
|
|
684
692
|
const pseudoCall = `call_${shortHash(`unres:${e.sourceId}:${rawCall}`).slice(0, 8)}`;
|
|
685
693
|
anonEdgeName = `Call: ${pseudoCall}`;
|
|
@@ -708,8 +716,9 @@ export function anonymizeGraphForCloudLayout(rawGraph, diffDelta, rulesConfig, o
|
|
|
708
716
|
anonEdgeMeta.source = "USER_SHIM";
|
|
709
717
|
if (e.metadata.shapeKey)
|
|
710
718
|
anonEdgeMeta.shapeKey = e.metadata.shapeKey;
|
|
711
|
-
if (e.metadata.viaHelper)
|
|
712
|
-
anonEdgeMeta.viaHelper = e.metadata.viaHelper
|
|
719
|
+
if (typeof e.metadata.viaHelper === "string" && e.metadata.viaHelper.trim()) {
|
|
720
|
+
anonEdgeMeta.viaHelper = `call_${shortHash(`unres:${e.sourceId}:${e.metadata.viaHelper.trim()}`).slice(0, 8)}`;
|
|
721
|
+
}
|
|
713
722
|
if (e.metadata.unresolvedReason) {
|
|
714
723
|
anonEdgeMeta.unresolvedReason = e.metadata.unresolvedReason;
|
|
715
724
|
}
|
|
@@ -823,7 +832,9 @@ export function anonymizeGraphForCloudLayout(rawGraph, diffDelta, rulesConfig, o
|
|
|
823
832
|
request: {
|
|
824
833
|
schemaVersion: "1.0",
|
|
825
834
|
graph: {
|
|
826
|
-
|
|
835
|
+
extractorVersion: rawGraph.extractorVersion ?? "1.0",
|
|
836
|
+
analyzedAt: rawGraph.analyzedAt ?? "1970-01-01T00:00:00.000Z",
|
|
837
|
+
...(rawGraph.version ? { version: rawGraph.version } : {}),
|
|
827
838
|
repoId: `repo_${shortHash(rawGraph.repoId || "local").slice(0, 8)}`,
|
|
828
839
|
nodes: anonymizedNodes,
|
|
829
840
|
edges: anonymizedEdges,
|
|
@@ -842,6 +853,7 @@ export function anonymizeGraphForCloudLayout(rawGraph, diffDelta, rulesConfig, o
|
|
|
842
853
|
realDisplayNameByRealPkg,
|
|
843
854
|
realBadgeByPseudoBadge,
|
|
844
855
|
realReceptorIdByPseudoId,
|
|
856
|
+
realEdgeNameByPair,
|
|
845
857
|
realUnresolvedByKey,
|
|
846
858
|
},
|
|
847
859
|
};
|
|
@@ -1023,11 +1035,15 @@ export function rehydrateCloudLayout(response, hydrationMap, rawGraph, repoName,
|
|
|
1023
1035
|
const rehydratedEdges = layout.edges.map((e) => {
|
|
1024
1036
|
const sourceId = mapLayoutNodeId(e.sourceId);
|
|
1025
1037
|
const targetId = mapLayoutNodeId(e.targetId);
|
|
1038
|
+
const srcOrig = extractBaseOriginalIdFromLayoutNodeId(e.sourceId).originalId.split("@")[0];
|
|
1039
|
+
const tgtOrig = extractBaseOriginalIdFromLayoutNodeId(e.targetId).originalId.split("@")[0];
|
|
1040
|
+
const realEdgeName = hydrationMap.realEdgeNameByPair?.get(`${srcOrig}::${tgtOrig}`) ?? e.name;
|
|
1026
1041
|
return {
|
|
1027
1042
|
...e,
|
|
1028
1043
|
id: `${sourceId}→${targetId}`,
|
|
1029
1044
|
sourceId,
|
|
1030
1045
|
targetId,
|
|
1046
|
+
...(realEdgeName ? { name: realEdgeName } : {}),
|
|
1031
1047
|
};
|
|
1032
1048
|
});
|
|
1033
1049
|
const rehydratedPackageBounds = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getchomp/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.45",
|
|
4
4
|
"description": "Chomp CLI and local server — map your codebase, check architecture health, and launch Chomp Map.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://getchomp.dev",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"express": "^5.2.1",
|
|
37
37
|
"typescript": "^5.3.0",
|
|
38
38
|
"zod": "^3.23.8",
|
|
39
|
-
"@getchomp/core": "0.2.
|
|
40
|
-
"@getchomp/
|
|
41
|
-
"@getchomp/
|
|
39
|
+
"@getchomp/core": "0.2.45",
|
|
40
|
+
"@getchomp/db": "0.2.45",
|
|
41
|
+
"@getchomp/mcp": "0.2.45"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/better-sqlite3": "^7.6.11",
|