@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,238 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, rmdirSync, rmSync, statSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { ansi } from "../utils/branding.js";
|
|
4
|
+
import { getChompMasterRoot, readMasterContext, setActiveChompTarget, } from "../utils/masterContext.js";
|
|
5
|
+
const HOOK_FILES = [
|
|
6
|
+
".husky/post-commit",
|
|
7
|
+
".husky/post-merge",
|
|
8
|
+
".husky/post-checkout",
|
|
9
|
+
".husky/pre-commit",
|
|
10
|
+
".git/hooks/post-commit",
|
|
11
|
+
".git/hooks/post-merge",
|
|
12
|
+
".git/hooks/post-checkout",
|
|
13
|
+
".git/hooks/pre-commit",
|
|
14
|
+
];
|
|
15
|
+
const RULE_FILES = [
|
|
16
|
+
".cursorrules",
|
|
17
|
+
".windsurfrules",
|
|
18
|
+
"AGENTS.md",
|
|
19
|
+
"CLAUDE.md",
|
|
20
|
+
".kiro/steering/chomp-architecture.md",
|
|
21
|
+
];
|
|
22
|
+
const MCP_FILES = [
|
|
23
|
+
".cursor/mcp.json",
|
|
24
|
+
".mcp.json",
|
|
25
|
+
".kiro/settings/mcp.json",
|
|
26
|
+
];
|
|
27
|
+
function isDefaultKiroSteeringRemainder(text) {
|
|
28
|
+
const withoutFrontmatter = text
|
|
29
|
+
.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "")
|
|
30
|
+
.replace(/^#\s+Chomp Architecture & Structural Navigation\s*$/m, "")
|
|
31
|
+
.trim();
|
|
32
|
+
return withoutFrontmatter.length === 0;
|
|
33
|
+
}
|
|
34
|
+
function pruneEmptyDir(dirPath) {
|
|
35
|
+
if (!existsSync(dirPath))
|
|
36
|
+
return false;
|
|
37
|
+
try {
|
|
38
|
+
if (!statSync(dirPath).isDirectory())
|
|
39
|
+
return false;
|
|
40
|
+
const entries = readdirSync(dirPath);
|
|
41
|
+
if (entries.length === 0) {
|
|
42
|
+
rmdirSync(dirPath);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Ignore filesystem errors
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
function resolveGitExcludePaths(repoRoot) {
|
|
52
|
+
const dotGit = resolve(repoRoot, ".git");
|
|
53
|
+
if (!existsSync(dotGit))
|
|
54
|
+
return [];
|
|
55
|
+
const candidates = new Set();
|
|
56
|
+
try {
|
|
57
|
+
const stat = statSync(dotGit);
|
|
58
|
+
if (stat.isDirectory()) {
|
|
59
|
+
candidates.add(resolve(dotGit, "info", "exclude"));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const pointer = readFileSync(dotGit, "utf8").trim();
|
|
63
|
+
const match = /^gitdir:\s*(.+)$/i.exec(pointer);
|
|
64
|
+
if (match) {
|
|
65
|
+
const gitDir = resolve(repoRoot, match[1].trim());
|
|
66
|
+
candidates.add(resolve(gitDir, "info", "exclude"));
|
|
67
|
+
const commondirFile = resolve(gitDir, "commondir");
|
|
68
|
+
if (existsSync(commondirFile)) {
|
|
69
|
+
const commonRel = readFileSync(commondirFile, "utf8").trim();
|
|
70
|
+
if (commonRel) {
|
|
71
|
+
candidates.add(resolve(gitDir, commonRel, "info", "exclude"));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Ignore
|
|
79
|
+
}
|
|
80
|
+
return [...candidates];
|
|
81
|
+
}
|
|
82
|
+
export function runUninstall(inputPath, options) {
|
|
83
|
+
const quiet = Boolean(options?.quiet);
|
|
84
|
+
const log = (msg) => {
|
|
85
|
+
if (!quiet)
|
|
86
|
+
console.log(msg);
|
|
87
|
+
};
|
|
88
|
+
const removed = [];
|
|
89
|
+
const updated = [];
|
|
90
|
+
const baseDir = process.env.INIT_CWD ?? process.cwd();
|
|
91
|
+
const cwd = resolve(baseDir, inputPath ?? ".");
|
|
92
|
+
const chompDir = resolve(cwd, ".chomp");
|
|
93
|
+
if (existsSync(chompDir)) {
|
|
94
|
+
rmSync(chompDir, { recursive: true, force: true });
|
|
95
|
+
removed.push(".chomp/");
|
|
96
|
+
log(` ${ansi.green("✓")} Removed ${ansi.cyan(".chomp/")}`);
|
|
97
|
+
}
|
|
98
|
+
// 1. Strip Chomp Harness blocks from rule & steering files
|
|
99
|
+
const harnessRegex = /# --- BEGIN CHOMP HARNESS ---\r?\n[\s\S]*?# --- END CHOMP HARNESS ---\r?\n?/g;
|
|
100
|
+
for (const file of RULE_FILES) {
|
|
101
|
+
const filePath = resolve(cwd, file);
|
|
102
|
+
if (existsSync(filePath)) {
|
|
103
|
+
const content = readFileSync(filePath, "utf8");
|
|
104
|
+
if (content.includes("# --- BEGIN CHOMP HARNESS ---")) {
|
|
105
|
+
const newContent = content.replace(harnessRegex, "").trim();
|
|
106
|
+
const isEmptySteering = file === ".kiro/steering/chomp-architecture.md" &&
|
|
107
|
+
isDefaultKiroSteeringRemainder(newContent);
|
|
108
|
+
if (newContent === "" || isEmptySteering) {
|
|
109
|
+
unlinkSync(filePath);
|
|
110
|
+
removed.push(file);
|
|
111
|
+
log(` ${ansi.green("✓")} Removed ${ansi.cyan(file)}`);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
writeFileSync(filePath, newContent + "\n", "utf8");
|
|
115
|
+
updated.push(file);
|
|
116
|
+
log(` ${ansi.green("✓")} Stripped Chomp Harness from ${ansi.cyan(file)}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// 2. Remove Kiro hook & Power bundle if present
|
|
122
|
+
const kiroHookRel = ".kiro/hooks/chomp-sync.kiro.hook";
|
|
123
|
+
const kiroHookPath = resolve(cwd, kiroHookRel);
|
|
124
|
+
if (existsSync(kiroHookPath)) {
|
|
125
|
+
unlinkSync(kiroHookPath);
|
|
126
|
+
removed.push(kiroHookRel);
|
|
127
|
+
log(` ${ansi.green("✓")} Removed ${ansi.cyan(kiroHookRel)}`);
|
|
128
|
+
}
|
|
129
|
+
const kiroPowerRel = ".kiro/powers/chomp";
|
|
130
|
+
const kiroPowerPath = resolve(cwd, kiroPowerRel);
|
|
131
|
+
if (existsSync(kiroPowerPath)) {
|
|
132
|
+
rmSync(kiroPowerPath, { recursive: true, force: true });
|
|
133
|
+
removed.push(kiroPowerRel);
|
|
134
|
+
log(` ${ansi.green("✓")} Removed ${ansi.cyan(kiroPowerRel)}`);
|
|
135
|
+
}
|
|
136
|
+
// 3. Strip Chomp Hook blocks from .husky/ and .git/hooks/
|
|
137
|
+
const hookRegex = /# --- BEGIN CHOMP HOOK ---\r?\n[\s\S]*?# --- END CHOMP HOOK ---\r?\n?/g;
|
|
138
|
+
for (const relHook of HOOK_FILES) {
|
|
139
|
+
const hookPath = resolve(cwd, relHook);
|
|
140
|
+
if (existsSync(hookPath)) {
|
|
141
|
+
const content = readFileSync(hookPath, "utf8");
|
|
142
|
+
if (content.includes("# --- BEGIN CHOMP HOOK ---")) {
|
|
143
|
+
const newContent = content.replace(hookRegex, "").trim();
|
|
144
|
+
if (newContent === "" ||
|
|
145
|
+
newContent === "#!/bin/sh" ||
|
|
146
|
+
newContent === "#!/usr/bin/env sh") {
|
|
147
|
+
unlinkSync(hookPath);
|
|
148
|
+
removed.push(relHook);
|
|
149
|
+
log(` ${ansi.green("✓")} Removed Chomp hook ${ansi.cyan(relHook)}`);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
writeFileSync(hookPath, newContent + "\n", "utf8");
|
|
153
|
+
updated.push(relHook);
|
|
154
|
+
log(` ${ansi.green("✓")} Stripped Chomp hook block from ${ansi.cyan(relHook)}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// 4. Remove chomp-server from workspace MCP config files (.cursor/mcp.json, .mcp.json, .kiro/settings/mcp.json)
|
|
160
|
+
for (const relMcp of MCP_FILES) {
|
|
161
|
+
const mcpPath = resolve(cwd, relMcp);
|
|
162
|
+
if (existsSync(mcpPath)) {
|
|
163
|
+
try {
|
|
164
|
+
const parsed = JSON.parse(readFileSync(mcpPath, "utf8"));
|
|
165
|
+
if (parsed?.mcpServers?.["chomp-server"]) {
|
|
166
|
+
delete parsed.mcpServers["chomp-server"];
|
|
167
|
+
const remainingKeys = Object.keys(parsed.mcpServers);
|
|
168
|
+
if (remainingKeys.length === 0 && Object.keys(parsed).length === 1) {
|
|
169
|
+
unlinkSync(mcpPath);
|
|
170
|
+
removed.push(relMcp);
|
|
171
|
+
log(` ${ansi.green("✓")} Removed empty ${ansi.cyan(relMcp)}`);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
writeFileSync(mcpPath, JSON.stringify(parsed, null, 2) + "\n", "utf8");
|
|
175
|
+
updated.push(relMcp);
|
|
176
|
+
log(` ${ansi.green("✓")} Removed chomp-server from ${ansi.cyan(relMcp)}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// ignore malformed JSON
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Prune empty IDE directories (.kiro/*, .kiro, .cursor)
|
|
186
|
+
for (const relDir of [
|
|
187
|
+
".kiro/settings",
|
|
188
|
+
".kiro/steering",
|
|
189
|
+
".kiro/hooks",
|
|
190
|
+
".kiro/powers",
|
|
191
|
+
".kiro",
|
|
192
|
+
".cursor",
|
|
193
|
+
]) {
|
|
194
|
+
pruneEmptyDir(resolve(cwd, relDir));
|
|
195
|
+
}
|
|
196
|
+
// 5. Clean up Chomp block in .gitignore and .git/info/exclude
|
|
197
|
+
const ignoreRegex = /\n?# --- BEGIN CHOMP IGNORE ---\r?\n[\s\S]*?# --- END CHOMP IGNORE ---\r?\n?/g;
|
|
198
|
+
const gitignorePath = resolve(cwd, ".gitignore");
|
|
199
|
+
if (existsSync(gitignorePath)) {
|
|
200
|
+
const gitignoreContent = readFileSync(gitignorePath, "utf8");
|
|
201
|
+
if (gitignoreContent.includes("# --- BEGIN CHOMP IGNORE ---")) {
|
|
202
|
+
const cleaned = gitignoreContent.replace(ignoreRegex, "\n").trimEnd();
|
|
203
|
+
writeFileSync(gitignorePath, cleaned ? cleaned + "\n" : "", "utf8");
|
|
204
|
+
updated.push(".gitignore");
|
|
205
|
+
log(` ${ansi.green("✓")} Cleaned up ${ansi.cyan(".gitignore")}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
for (const gitExcludePath of resolveGitExcludePaths(cwd)) {
|
|
209
|
+
if (existsSync(gitExcludePath)) {
|
|
210
|
+
const excludeContent = readFileSync(gitExcludePath, "utf8");
|
|
211
|
+
if (excludeContent.includes("# --- BEGIN CHOMP IGNORE ---")) {
|
|
212
|
+
const cleaned = excludeContent.replace(ignoreRegex, "\n").trimEnd();
|
|
213
|
+
writeFileSync(gitExcludePath, cleaned ? cleaned + "\n" : "", "utf8");
|
|
214
|
+
updated.push(".git/info/exclude");
|
|
215
|
+
log(` ${ansi.green("✓")} Cleaned up ${ansi.cyan(".git/info/exclude")}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// 6. If this repo was the active Master Tether, reset tether back to Chomp master
|
|
220
|
+
const ctx = readMasterContext();
|
|
221
|
+
if (ctx?.activeRepoPath && resolve(ctx.activeRepoPath) === resolve(cwd)) {
|
|
222
|
+
const masterRoot = getChompMasterRoot();
|
|
223
|
+
if (resolve(masterRoot) !== resolve(cwd)) {
|
|
224
|
+
setActiveChompTarget(masterRoot);
|
|
225
|
+
log(` ${ansi.green("✓")} Switched active repo back to ${ansi.cyan(masterRoot)}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
log(`\n ${ansi.yellowBold("◆")} ${ansi.bold("Chomp has been cleanly removed. We left no trace.")}\n`);
|
|
229
|
+
return { removed, updated };
|
|
230
|
+
}
|
|
231
|
+
export function registerUninstallCommand(program) {
|
|
232
|
+
program
|
|
233
|
+
.command("uninstall [path]")
|
|
234
|
+
.description("Cleanly remove Chomp (.chomp/, agent harnesses, MCP entries, and git hooks) from the workspace.")
|
|
235
|
+
.action((inputPath) => {
|
|
236
|
+
runUninstall(inputPath);
|
|
237
|
+
});
|
|
238
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// packages/cli/src/index.ts
|
|
3
|
+
// Chomp CLI entry point.
|
|
4
|
+
// Load .env from the package root, anchored to this file's location so it
|
|
5
|
+
// works whether invoked via `pnpm --filter @getchomp/cli dev` from the repo root
|
|
6
|
+
// or directly from inside packages/cli/.
|
|
7
|
+
import { config as dotenvConfig } from 'dotenv';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { dirname, resolve } from 'node:path';
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
dotenvConfig({ path: resolve(__dirname, '../.env') }); // packages/cli/.env
|
|
12
|
+
import { Command } from "commander";
|
|
13
|
+
import { registerAnalyzeCommand } from "./commands/analyze.js";
|
|
14
|
+
import { registerHealthCommand } from "./commands/health.js";
|
|
15
|
+
import { registerMcpCommand } from "./commands/mcp.js";
|
|
16
|
+
import { registerUiCommand } from "./commands/ui.js";
|
|
17
|
+
import { registerExportCommand } from "./commands/export.js";
|
|
18
|
+
import { registerInitCommand } from "./commands/init.js";
|
|
19
|
+
import { registerConnectCommand } from "./commands/connect.js";
|
|
20
|
+
import { registerUninstallCommand } from "./commands/uninstall.js";
|
|
21
|
+
import { registerPluginCommand } from "./commands/plugin.js";
|
|
22
|
+
import { CORE_EXTRACTOR_VERSION, } from "@getchomp/core";
|
|
23
|
+
const program = new Command();
|
|
24
|
+
program
|
|
25
|
+
.name("chomp")
|
|
26
|
+
.description("Chomp CLI — The live map of your codebase")
|
|
27
|
+
.version(CORE_EXTRACTOR_VERSION);
|
|
28
|
+
registerAnalyzeCommand(program);
|
|
29
|
+
registerHealthCommand(program);
|
|
30
|
+
registerMcpCommand(program);
|
|
31
|
+
registerUiCommand(program);
|
|
32
|
+
registerExportCommand(program);
|
|
33
|
+
registerInitCommand(program);
|
|
34
|
+
registerConnectCommand(program);
|
|
35
|
+
registerUninstallCommand(program);
|
|
36
|
+
registerPluginCommand(program);
|
|
37
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Speed 2 Incremental Port Valve Hydrator (`[PAT-VIS-14]`, `[PAT-DB-03]`, `[PAT-DB-05]`).
|
|
3
|
+
*
|
|
4
|
+
* Uses TypeScript's `ts.createIncrementalProgram` (persisting `.tsbuildinfo` inside `.chomp/cache/`)
|
|
5
|
+
* to resolve inferred return types, cross-file interface/type fields, and boundary port diagnostics
|
|
6
|
+
* (`TS_CALL_MISMATCH`, `TS_RETURN_MISMATCH`) into `entity_overlays` (`layer: "L1_PORTS"`,
|
|
7
|
+
* `source: "chomp-ports"`, `derivation: "EXTRACTED"`).
|
|
8
|
+
*
|
|
9
|
+
* Unchanged contracts (`stale === false` on both `bodyHash` and referenced `inputs` file hashes)
|
|
10
|
+
* are skipped in `<2ms` without constructing a TypeScript `Program`.
|
|
11
|
+
*/
|
|
12
|
+
import type { RepresentationGraph } from '@getchomp/core';
|
|
13
|
+
import type { ChompStorage } from '@getchomp/db';
|
|
14
|
+
export declare const CHOMP_PORTS_LAYER = "L1_PORTS";
|
|
15
|
+
export declare const CHOMP_PORTS_SOURCE = "chomp-ports";
|
|
16
|
+
export interface HydratePortValvesOptions {
|
|
17
|
+
repoPath: string;
|
|
18
|
+
repoId: string;
|
|
19
|
+
storage: ChompStorage;
|
|
20
|
+
graph: RepresentationGraph;
|
|
21
|
+
/** Re-verify all contracts even when existing `L1_PORTS` cache rows are non-stale. */
|
|
22
|
+
force?: boolean;
|
|
23
|
+
/** Optional custom `.tsbuildinfo` directory, or `false` to disable writing `.tsbuildinfo` (e.g. in unit tests). */
|
|
24
|
+
cacheDir?: string | false;
|
|
25
|
+
}
|
|
26
|
+
export interface HydratePortValvesResult {
|
|
27
|
+
hydratedCount: number;
|
|
28
|
+
cachedCount: number;
|
|
29
|
+
prunedCount: number;
|
|
30
|
+
diagnosticCount: number;
|
|
31
|
+
durationMs: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Runs Speed 2 incremental TypeScript Port Valve verification on `graph` and persists
|
|
35
|
+
* `L1_PORTS` (`source: "chomp-ports"`) cache rows to `storage`.
|
|
36
|
+
*
|
|
37
|
+
* @param options Repository path, ID, storage adapter, and extracted Layer 0 `RepresentationGraph`.
|
|
38
|
+
* @returns Counts of hydrated, cached, and pruned `L1_PORTS` overlays plus boundary diagnostic totals.
|
|
39
|
+
*/
|
|
40
|
+
export declare function hydrateRepositoryPortValves(options: HydratePortValvesOptions): Promise<HydratePortValvesResult>;
|
|
41
|
+
export interface RunPortHydrationInChildProcessOptions {
|
|
42
|
+
dbPath: string;
|
|
43
|
+
repoPath?: string;
|
|
44
|
+
force?: boolean;
|
|
45
|
+
cacheDir?: string | false;
|
|
46
|
+
timeoutMs?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface PortHydrationChildHandle {
|
|
49
|
+
promise: Promise<HydratePortValvesResult | null>;
|
|
50
|
+
cancel: () => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Filters `process.execArgv` down to safe loader/runtime flags (`--require`, `--import`,
|
|
54
|
+
* `--loader`, `--conditions`, `--max-old-space-size`, etc.) so forked child workers inherit
|
|
55
|
+
* `tsx` loaders in dev mode without inheriting `--test`, `--eval`, or `--inspect` flags.
|
|
56
|
+
*/
|
|
57
|
+
export declare function filterExecArgvForChild(execArgv?: readonly string[]): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Runs Speed 2 Port Valve hydration inside an isolated forked child process so heavy
|
|
60
|
+
* TypeScript `Program` creation and semantic diagnostics never block the `chomp ui`
|
|
61
|
+
* main event loop, HTTP polling, or raw-mode terminal input (`[q]` / `Ctrl+C`).
|
|
62
|
+
*/
|
|
63
|
+
export declare function runPortHydrationInChildProcess(options: RunPortHydrationInChildProcessOptions): PortHydrationChildHandle;
|