@getchomp/cli 0.0.0-stage → 0.2.42
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 +39 -2
- package/dist/commands/analyze.d.ts +49 -0
- package/dist/commands/analyze.js +280 -0
- package/dist/commands/connect.d.ts +12 -0
- package/dist/commands/connect.js +255 -0
- package/dist/commands/export.d.ts +29 -0
- package/dist/commands/export.js +356 -0
- package/dist/commands/health.d.ts +19 -0
- package/dist/commands/health.js +259 -0
- package/dist/commands/init.d.ts +40 -0
- package/dist/commands/init.js +654 -0
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.js +12 -0
- package/dist/commands/plugin.d.ts +8 -0
- package/dist/commands/plugin.js +198 -0
- package/dist/commands/ui.d.ts +20 -0
- package/dist/commands/ui.js +250 -0
- package/dist/commands/uninstall.d.ts +8 -0
- package/dist/commands/uninstall.js +238 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +37 -0
- package/dist/ports/portHydrator.d.ts +63 -0
- package/dist/ports/portHydrator.js +954 -0
- package/dist/ports/portHydratorWorker.d.ts +22 -0
- package/dist/ports/portHydratorWorker.js +75 -0
- package/dist/server/buildStatusTracker.d.ts +45 -0
- package/dist/server/buildStatusTracker.js +122 -0
- package/dist/server/graphLayoutState.d.ts +205 -0
- package/dist/server/graphLayoutState.js +930 -0
- package/dist/server/loopbackSecurity.d.ts +18 -0
- package/dist/server/loopbackSecurity.js +57 -0
- package/dist/server/routes/authSourceRoutes.d.ts +18 -0
- package/dist/server/routes/authSourceRoutes.js +231 -0
- package/dist/server/routes/layoutRoutes.d.ts +3 -0
- package/dist/server/routes/layoutRoutes.js +857 -0
- package/dist/server/routes/pluginRoutes.d.ts +3 -0
- package/dist/server/routes/pluginRoutes.js +368 -0
- package/dist/server/routes/viewRulesRoutes.d.ts +3 -0
- package/dist/server/routes/viewRulesRoutes.js +173 -0
- package/dist/server/uiHotkeys.d.ts +26 -0
- package/dist/server/uiHotkeys.js +160 -0
- package/dist/utils/branding.d.ts +126 -0
- package/dist/utils/branding.js +976 -0
- package/dist/utils/credentials.d.ts +22 -0
- package/dist/utils/credentials.js +126 -0
- package/dist/utils/git.d.ts +95 -0
- package/dist/utils/git.js +780 -0
- package/dist/utils/masterContext.d.ts +102 -0
- package/dist/utils/masterContext.js +559 -0
- package/dist/visualizer/cloudLayoutClient.d.ts +84 -0
- package/dist/visualizer/cloudLayoutClient.js +1200 -0
- package/dist/visualizer/layoutCache.d.ts +25 -0
- package/dist/visualizer/layoutCache.js +406 -0
- package/dist/visualizer/localEngineBridge.d.ts +50 -0
- package/dist/visualizer/localEngineBridge.js +80 -0
- package/dist/visualizer/pluginPresentationApi.d.ts +111 -0
- package/dist/visualizer/pluginPresentationApi.js +432 -0
- package/dist/visualizer/rulesConfig.d.ts +11 -0
- package/dist/visualizer/rulesConfig.js +266 -0
- package/dist/visualizer/sourceAccess.d.ts +45 -0
- package/dist/visualizer/sourceAccess.js +204 -0
- package/package.json +51 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/cli/src/visualizer/cloudLayoutClient.ts
|
|
3
|
+
*
|
|
4
|
+
* Stateless Skeleton-to-Coordinates Client & Server Pipeline (`api.getchomp.dev`).
|
|
5
|
+
*
|
|
6
|
+
* Architecture:
|
|
7
|
+
* 1. Local CLI (`chomp ui`) holds `.chomp/graph.db` and `.chomp/rules.json` 100% locally.
|
|
8
|
+
* 2. Before calling the remote Cloudflare Worker (`POST /v1/layout`), `anonymizeGraphForCloudLayout`
|
|
9
|
+
* strips all code snippets, business symbol names, and file paths — replacing them with
|
|
10
|
+
* deterministic, role- and length-preserving pseudonyms while pre-evaluating custom rules locally.
|
|
11
|
+
* 3. The stateless Cloudflare Worker executes `executeStatelessLayout` (`1-storyTracer` ->
|
|
12
|
+
* `2-zipMerge` -> `3-gridMapper` -> `visualLinter`) in memory with zero persistence.
|
|
13
|
+
* 4. `rehydrateCloudLayout` restores the user's real labels, relative `filePath:lineNumber`
|
|
14
|
+
* evidence (without code snippets), and overlays locally before serving `GET /api/layout`.
|
|
15
|
+
*/
|
|
16
|
+
import { type ChompRulesConfig, type ContractPortValves, type EntityOverlayItem, type GraphDelta, type LayoutData, type NodeEvidenceItem, type RepresentationGraph, type StatelessLayoutRequest, type StatelessLayoutResponse } from "@getchomp/core";
|
|
17
|
+
export type { StatelessLayoutRequest, StatelessLayoutResponse };
|
|
18
|
+
export interface OriginalNodeHydrationEntry {
|
|
19
|
+
id: string;
|
|
20
|
+
rawName: string;
|
|
21
|
+
cleanLabel: string;
|
|
22
|
+
humanLabel?: string;
|
|
23
|
+
parentLabel?: string;
|
|
24
|
+
realPackageLabel: string;
|
|
25
|
+
evidence?: NodeEvidenceItem[];
|
|
26
|
+
inputTypes?: string[];
|
|
27
|
+
outputType?: string;
|
|
28
|
+
portValves?: ContractPortValves;
|
|
29
|
+
portMismatchCount?: number;
|
|
30
|
+
overlays?: EntityOverlayItem[];
|
|
31
|
+
isShimmed?: boolean;
|
|
32
|
+
shimLabel?: string;
|
|
33
|
+
shimmedBadgeTargets?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface SkeletonHydrationMap {
|
|
36
|
+
/** Maps original node ID -> original human-readable labels, evidence, and overlays. */
|
|
37
|
+
nodesById: Map<string, OriginalNodeHydrationEntry>;
|
|
38
|
+
/** Maps real external receptor ID -> adapter shimLabel when shimmed. */
|
|
39
|
+
receptorShimLabelByRealId?: Map<string, string>;
|
|
40
|
+
/** Maps pseudonymized package label -> real package label. */
|
|
41
|
+
realPkgByPseudoPkg: Map<string, string>;
|
|
42
|
+
/** Maps real package label -> pseudonymized package label. */
|
|
43
|
+
pseudoPkgByRealPkg: Map<string, string>;
|
|
44
|
+
/** Maps real package label -> original display name (e.g. `@scope/pkg`). */
|
|
45
|
+
realDisplayNameByRealPkg: Map<string, string>;
|
|
46
|
+
/** Maps pseudonymized badge string -> real badge string. */
|
|
47
|
+
realBadgeByPseudoBadge: Map<string, string>;
|
|
48
|
+
/** Maps pseudonymized receptor ID -> real receptor ID. */
|
|
49
|
+
realReceptorIdByPseudoId: Map<string, string>;
|
|
50
|
+
/** Maps `${sourceId}::${lineNumber}::${pseudoCallName}` -> real unresolved call metadata. */
|
|
51
|
+
realUnresolvedByKey: Map<string, {
|
|
52
|
+
name: string;
|
|
53
|
+
filePath?: string;
|
|
54
|
+
lineNumber?: number;
|
|
55
|
+
importSpecifier?: string;
|
|
56
|
+
resolvedFilePath?: string;
|
|
57
|
+
targetSymbol?: string;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Strips raw source code `snippet` strings from a single evidence object or array,
|
|
62
|
+
* keeping only `{ filePath, lineNumber, evidenceRole }`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function sanitizeEvidenceItems(evidence: any): NodeEvidenceItem[] | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Returns a shallow copy of `RepresentationGraph` with all `evidence.snippet` fields removed.
|
|
67
|
+
*/
|
|
68
|
+
export declare function stripEvidenceSnippetsFromGraph(graph: RepresentationGraph): RepresentationGraph;
|
|
69
|
+
export declare function anonymizeGraphForCloudLayout(rawGraph: RepresentationGraph, diffDelta?: GraphDelta, rulesConfig?: ChompRulesConfig, overlays?: EntityOverlayItem[]): {
|
|
70
|
+
request: StatelessLayoutRequest;
|
|
71
|
+
hydrationMap: SkeletonHydrationMap;
|
|
72
|
+
};
|
|
73
|
+
export declare function rehydrateCloudLayout(response: StatelessLayoutResponse, hydrationMap: SkeletonHydrationMap, rawGraph: RepresentationGraph, repoName: string, overlays?: EntityOverlayItem[]): LayoutData;
|
|
74
|
+
export interface RequestCloudLayoutOptions {
|
|
75
|
+
/** Base URL of the stateless Cloudflare Layout Worker (e.g. `https://api.getchomp.dev`). */
|
|
76
|
+
cloudApiUrl?: string;
|
|
77
|
+
/** Optional API key / bearer token for authenticated rate-limit tiers. */
|
|
78
|
+
apiKey?: string;
|
|
79
|
+
/** Force calling the remote Cloud Layout Worker even inside the master monorepo (`--remote`). */
|
|
80
|
+
remote?: boolean;
|
|
81
|
+
/** Request timeout in milliseconds (default: 15000ms). */
|
|
82
|
+
timeoutMs?: number;
|
|
83
|
+
}
|
|
84
|
+
export declare function requestStatelessCloudLayout(rawGraph: RepresentationGraph, repoName: string, diffDelta?: GraphDelta, rulesConfig?: ChompRulesConfig, overlays?: EntityOverlayItem[], options?: RequestCloudLayoutOptions): Promise<LayoutData>;
|