@getchomp/cli 0.2.43 → 0.2.44
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/analyze.js +19 -2
- package/dist/commands/ui.d.ts +1 -0
- package/dist/commands/ui.js +44 -3
- package/dist/commands/uninstall.js +8 -2
- package/dist/ports/portHydrator.d.ts +5 -0
- package/dist/ports/portHydrator.js +175 -9
- package/dist/server/graphLayoutState.js +0 -2
- package/dist/server/hostedUiProxy.d.ts +13 -0
- package/dist/server/hostedUiProxy.js +137 -0
- package/dist/server/routes/authSourceRoutes.js +11 -0
- package/dist/server/routes/layoutRoutes.d.ts +5 -0
- package/dist/server/routes/layoutRoutes.js +32 -14
- package/dist/utils/branding.d.ts +56 -13
- package/dist/utils/branding.js +405 -216
- package/dist/visualizer/cloudLayoutClient.d.ts +6 -1
- package/dist/visualizer/cloudLayoutClient.js +15 -1
- package/package.json +5 -5
|
@@ -11,6 +11,33 @@ import { computePluginFingerprint } from "../../visualizer/pluginPresentationApi
|
|
|
11
11
|
import { getRulesFingerprint, loadRulesConfig, } from "../../visualizer/rulesConfig.js";
|
|
12
12
|
import { buildLayout, getActiveUiTarget, getAuthModeFingerprint, getCurrentDbMtime, getLocalShimsFileFp, getPluginRegistryMeta, hasGitCommitForDiff, hydratePluginRunsForRepo, invalidateAllServerCaches, loadBaseGraphCached, readGitBlobForDiff, resolveCommittedRefGraph, resolveScopedDiffPaths, resolveWorkingTreeSnapshotGraph, scheduleBackgroundPortHydration, triggerInitialPortHydrationAfterLayout, } from "../graphLayoutState.js";
|
|
13
13
|
import { buildAuthStatusPayload } from "./authSourceRoutes.js";
|
|
14
|
+
/**
|
|
15
|
+
* Coalesces concurrent layout computations for the same `cacheKey` onto a single
|
|
16
|
+
* in-flight Promise and removes the entry inside `finally` once settled.
|
|
17
|
+
*/
|
|
18
|
+
export function runSingleFlightLayoutBuild(inFlightMap, cacheKey, factory) {
|
|
19
|
+
const existing = inFlightMap.get(cacheKey);
|
|
20
|
+
if (existing) {
|
|
21
|
+
return existing;
|
|
22
|
+
}
|
|
23
|
+
let settled = false;
|
|
24
|
+
let promise;
|
|
25
|
+
promise = (async () => {
|
|
26
|
+
try {
|
|
27
|
+
return await factory();
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
settled = true;
|
|
31
|
+
if (promise && inFlightMap.get(cacheKey) === promise) {
|
|
32
|
+
inFlightMap.delete(cacheKey);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
if (!settled) {
|
|
37
|
+
inFlightMap.set(cacheKey, promise);
|
|
38
|
+
}
|
|
39
|
+
return promise;
|
|
40
|
+
}
|
|
14
41
|
export function registerLayoutRoutes(app, state) {
|
|
15
42
|
// GET /api/status — JSON snapshot or Server-Sent Events stream
|
|
16
43
|
app.get("/api/status", (req, res) => {
|
|
@@ -301,13 +328,13 @@ export function registerLayoutRoutes(app, state) {
|
|
|
301
328
|
};
|
|
302
329
|
}
|
|
303
330
|
else {
|
|
304
|
-
cacheKey = `${activeDbPath}:${dbMtime}:${rulesFp}:${authModeFp}:normal`;
|
|
331
|
+
cacheKey = `${activeDbPath}:${structureFp || dbMtime}:${rulesFp}:${authModeFp}:normal`;
|
|
305
332
|
}
|
|
306
333
|
}
|
|
307
334
|
else {
|
|
308
335
|
cacheKey = diffMode
|
|
309
|
-
? `${activeDbPath}:${dbMtime}:${rulesFp}:${authModeFp}:diff:fallback`
|
|
310
|
-
: `${activeDbPath}:${dbMtime}:${rulesFp}:${authModeFp}:normal`;
|
|
336
|
+
? `${activeDbPath}:${structureFp || dbMtime}:${rulesFp}:${authModeFp}:diff:fallback`
|
|
337
|
+
: `${activeDbPath}:${structureFp || dbMtime}:${rulesFp}:${authModeFp}:normal`;
|
|
311
338
|
}
|
|
312
339
|
const stampLiveGitMetadata = (targetLayout) => {
|
|
313
340
|
if (!diffMode &&
|
|
@@ -403,12 +430,7 @@ export function registerLayoutRoutes(app, state) {
|
|
|
403
430
|
return res.json(diskHit);
|
|
404
431
|
}
|
|
405
432
|
}
|
|
406
|
-
|
|
407
|
-
const pending = await state.layoutInFlight.get(cacheKey);
|
|
408
|
-
triggerInitialPortHydrationAfterLayout(state);
|
|
409
|
-
return res.json(pending);
|
|
410
|
-
}
|
|
411
|
-
const buildPromise = (async () => {
|
|
433
|
+
const resultLayout = await runSingleFlightLayoutBuild(state.layoutInFlight, cacheKey, async () => {
|
|
412
434
|
if (hydrateRefGraphsForBuild) {
|
|
413
435
|
await hydrateRefGraphsForBuild();
|
|
414
436
|
}
|
|
@@ -476,7 +498,7 @@ export function registerLayoutRoutes(app, state) {
|
|
|
476
498
|
state.layoutCache.delete(oldestKey);
|
|
477
499
|
}
|
|
478
500
|
state.layoutCache.set(cacheKey, layout);
|
|
479
|
-
const revisionLogKey = `${activeDbPath}:${dbMtime}:${rulesFp}:${authModeFp}`;
|
|
501
|
+
const revisionLogKey = `${activeDbPath}:${structureFp || dbMtime}:${rulesFp}:${authModeFp}`;
|
|
480
502
|
if (state.debug || process.env.CHOMP_DEBUG_LAYOUT === "1") {
|
|
481
503
|
console.log(`✅ Layout complete — ${layout.nodes.length} positioned nodes, ` +
|
|
482
504
|
`${layout.islandNodes.length} islands, ${layout.badgeNodes.length} badge hubs`);
|
|
@@ -523,11 +545,7 @@ export function registerLayoutRoutes(app, state) {
|
|
|
523
545
|
}
|
|
524
546
|
}
|
|
525
547
|
return layout;
|
|
526
|
-
})().finally(() => {
|
|
527
|
-
state.layoutInFlight.delete(cacheKey);
|
|
528
548
|
});
|
|
529
|
-
state.layoutInFlight.set(cacheKey, buildPromise);
|
|
530
|
-
const resultLayout = await buildPromise;
|
|
531
549
|
triggerInitialPortHydrationAfterLayout(state);
|
|
532
550
|
return res.json(resultLayout);
|
|
533
551
|
}
|
package/dist/utils/branding.d.ts
CHANGED
|
@@ -20,11 +20,20 @@ export declare const CHOMP_UNICODE_LOGO_LINES: readonly string[];
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const CHOMP_CHOMPING_FRAME_LINES: readonly string[];
|
|
22
22
|
export type ChompLogoFrame = "open" | "chomp";
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the safe horizontal column budget for stacked CLI sections so output
|
|
25
|
+
* never wraps on default 80-column terminals (while adapting down to narrower panes).
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveMaxTerminalCols(overrideCols?: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Truncates an ANSI-colored string so its visible terminal column width never exceeds `maxCols`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function truncateAnsiToCols(str: string, maxCols: number): string;
|
|
23
32
|
/**
|
|
24
33
|
* Renders the Chomp Unicode logo mark (or chomping frame) in brand yellow
|
|
25
|
-
*
|
|
34
|
+
* stacked cleanly above the wordmark and tagline so output stays <80 columns.
|
|
26
35
|
*/
|
|
27
|
-
export declare function renderChompBanner(subtitle?: string, frame?: ChompLogoFrame): string;
|
|
36
|
+
export declare function renderChompBanner(subtitle?: string, frame?: ChompLogoFrame, maxColsOverride?: number): string;
|
|
28
37
|
export declare function printChompBanner(subtitle?: string, frame?: ChompLogoFrame): void;
|
|
29
38
|
/**
|
|
30
39
|
* Plays a live terminal chomping animation that alternates between the open-mouth
|
|
@@ -85,31 +94,65 @@ export declare function printWelcomeMessage(repoName: string, isDryRun?: boolean
|
|
|
85
94
|
export declare function runDiscoveryTicker(repoName: string, customMessages?: string[]): Promise<void>;
|
|
86
95
|
/**
|
|
87
96
|
* Renders the detected repository & package configuration inside a structured
|
|
88
|
-
* read-only box table
|
|
97
|
+
* read-only box table constrained to <80 terminal columns.
|
|
98
|
+
*/
|
|
99
|
+
export declare function printDetectedWorkspaceTable(repoName: string, packages: DetectedWorkspacePackage[], vaultNotes?: string[], maxColsOverride?: number): void;
|
|
100
|
+
export declare const LARGE_REPO_FILE_THRESHOLD = 150;
|
|
101
|
+
export declare const LARGE_REPO_PACKAGE_THRESHOLD = 6;
|
|
102
|
+
/**
|
|
103
|
+
* Fast pre-flight file discovery (~5–15ms) matching `analyzeTarget`'s workspace exclusion rules.
|
|
89
104
|
*/
|
|
90
|
-
export declare function
|
|
91
|
-
export
|
|
105
|
+
export declare function countAnalyzableFiles(targetPath: string, excludeWorkspaces?: string[]): number;
|
|
106
|
+
export declare function shouldShowLargeRepoScaleNotice(fileCount: number, packageCount: number): boolean;
|
|
107
|
+
export declare function formatLargeRepoScaleNotice(fileCount: number, packageCount: number, maxColsOverride?: number): string;
|
|
108
|
+
export interface ChompExtractionAnimationOptions<T extends {
|
|
109
|
+
graph: RepresentationGraph;
|
|
110
|
+
durationMs: number;
|
|
111
|
+
} = {
|
|
112
|
+
graph: RepresentationGraph;
|
|
113
|
+
durationMs: number;
|
|
114
|
+
}> {
|
|
92
115
|
repoName: string;
|
|
93
116
|
repoPath: string;
|
|
117
|
+
targetPath?: string;
|
|
118
|
+
preFlightFileCount?: number;
|
|
94
119
|
dbPath: string;
|
|
95
120
|
commitSha?: string;
|
|
96
121
|
branchName?: string;
|
|
97
122
|
excludeWorkspaces?: string[];
|
|
98
123
|
isSandbox?: boolean;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
durationMs: number;
|
|
102
|
-
}>;
|
|
124
|
+
writeOutput?: (payload: string) => void;
|
|
125
|
+
executeExtraction: (onProgress?: (statusText: string) => void) => Promise<T>;
|
|
103
126
|
}
|
|
127
|
+
export interface CompletedBiteSummaryInput {
|
|
128
|
+
repoName: string;
|
|
129
|
+
repoPath: string;
|
|
130
|
+
dbPath: string;
|
|
131
|
+
gitTag: string;
|
|
132
|
+
fileCount: number;
|
|
133
|
+
packagesToDisplay: DetectedWorkspacePackage[];
|
|
134
|
+
graph: RepresentationGraph;
|
|
135
|
+
durationMs: number;
|
|
136
|
+
maxColsOverride?: number;
|
|
137
|
+
timestamp?: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Renders the settled open-mouth Chomp logo mark stacked vertically above the
|
|
141
|
+
* package progress breakdown and Bite Report summary (<80 columns per line).
|
|
142
|
+
*/
|
|
143
|
+
export declare function renderCompletedBiteSummary(input: CompletedBiteSummaryInput): string;
|
|
104
144
|
/**
|
|
105
145
|
* Runs the 2-frame Chomp mouth animation continuously during code analysis
|
|
106
|
-
*
|
|
107
|
-
*
|
|
146
|
+
* using a fixed-height <80-column animated block (preventing terminal line-wrap cursor drift)
|
|
147
|
+
* and settles onto a clean vertically stacked Bite Report summary.
|
|
108
148
|
*/
|
|
109
|
-
export declare function runChompExtractionWithAnimation
|
|
149
|
+
export declare function runChompExtractionWithAnimation<T extends {
|
|
150
|
+
graph: RepresentationGraph;
|
|
151
|
+
durationMs: number;
|
|
152
|
+
} = {
|
|
110
153
|
graph: RepresentationGraph;
|
|
111
154
|
durationMs: number;
|
|
112
|
-
}>;
|
|
155
|
+
}>(opts: ChompExtractionAnimationOptions<T>): Promise<T>;
|
|
113
156
|
export declare function confirmPrompt(question: string, defaultYes?: boolean, description?: string): Promise<boolean>;
|
|
114
157
|
export interface MultiSelectOption<T = string> {
|
|
115
158
|
value: T;
|