pi-gitnexus-fork 0.7.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.
Files changed (117) hide show
  1. package/.github/workflows/ci.yml +20 -0
  2. package/.gitnexusignore +11 -0
  3. package/.sg-rules/async-function-must-await-or-return.yml +55 -0
  4. package/.sg-rules/catch-must-log-error.yml +78 -0
  5. package/.sg-rules/class-must-implement-or-extend.yml +61 -0
  6. package/.sg-rules/class-property-must-be-readonly.yml +61 -0
  7. package/.sg-rules/error-must-extend-base.yml +56 -0
  8. package/.sg-rules/generic-must-be-constrained.yml +60 -0
  9. package/.sg-rules/import-reexport-risk.yml +9 -0
  10. package/.sg-rules/missing-session-id-in-api.yml +16 -0
  11. package/.sg-rules/no-any-in-generic-args.yml +57 -0
  12. package/.sg-rules/no-await-in-promise-all.yml +28 -0
  13. package/.sg-rules/no-barrel-export.yml +17 -0
  14. package/.sg-rules/no-bq-write-in-module.yml +65 -0
  15. package/.sg-rules/no-console-except-error.yml +27 -0
  16. package/.sg-rules/no-console-in-server.yml +42 -0
  17. package/.sg-rules/no-empty-catch.yml +20 -0
  18. package/.sg-rules/no-empty-function.yml +24 -0
  19. package/.sg-rules/no-eval.yml +28 -0
  20. package/.sg-rules/no-explicit-any.yml +34 -0
  21. package/.sg-rules/no-hardcoded-placeholder-string.yml +23 -0
  22. package/.sg-rules/no-hardcoded-secrets.yml +32 -0
  23. package/.sg-rules/no-innerHTML.yml +22 -0
  24. package/.sg-rules/no-json-parse-without-trycatch.yml +33 -0
  25. package/.sg-rules/no-magic-numbers.yml +25 -0
  26. package/.sg-rules/no-nested-ternary.yml +21 -0
  27. package/.sg-rules/no-non-null-assertion.yml +25 -0
  28. package/.sg-rules/no-stub-implementation.yml +44 -0
  29. package/.sg-rules/no-throw-literal.yml +50 -0
  30. package/.sg-rules/no-todo-comment.yml +24 -0
  31. package/.sg-rules/no-ts-ignore-comment.yml +48 -0
  32. package/.sg-rules/no-type-assertion-in-jsx.yml +23 -0
  33. package/.sg-rules/no-unguarded-trim.yml +24 -0
  34. package/.sg-rules/no-unknown-without-narrowing.yml +76 -0
  35. package/.sg-rules/no-unsafe-bracket-access.yml +58 -0
  36. package/.sg-rules/no-unsafe-type-assertion.yml +45 -0
  37. package/.sg-rules/switch-must-be-exhaustive.yml +62 -0
  38. package/.sg-rules/zod-async-refine-without-abort.yml +62 -0
  39. package/.sg-rules/zod-enum-unsafe-access.yml +59 -0
  40. package/.sg-rules/zod-nested-object-deep-path.yml +70 -0
  41. package/.sg-rules/zod-optional-without-default-in-route.yml +50 -0
  42. package/.sg-rules/zod-parse-not-safe.yml +42 -0
  43. package/.sg-rules/zod-preprocess-without-fallback.yml +58 -0
  44. package/.sg-rules/zod-refine-no-return-undefined.yml +54 -0
  45. package/.sg-rules/zod-transform-without-output-type.yml +52 -0
  46. package/.sg-sha +1 -0
  47. package/.sgignore +4 -0
  48. package/AGENTS.md +1 -0
  49. package/CHANGELOG.md +99 -0
  50. package/LICENSE +21 -0
  51. package/README.md +113 -0
  52. package/biome.json +25 -0
  53. package/coverage/base.css +224 -0
  54. package/coverage/block-navigation.js +87 -0
  55. package/coverage/clover.xml +890 -0
  56. package/coverage/coverage-final.json +12 -0
  57. package/coverage/favicon.png +0 -0
  58. package/coverage/index.html +131 -0
  59. package/coverage/prettify.css +1 -0
  60. package/coverage/prettify.js +2 -0
  61. package/coverage/sort-arrow-sprite.png +0 -0
  62. package/coverage/sorter.js +210 -0
  63. package/coverage/src/augment-remote.ts.html +274 -0
  64. package/coverage/src/gitnexus.ts.html +1363 -0
  65. package/coverage/src/index.html +236 -0
  66. package/coverage/src/index.ts.html +1561 -0
  67. package/coverage/src/mcp-client-factory.ts.html +367 -0
  68. package/coverage/src/mcp-client-stdio.ts.html +736 -0
  69. package/coverage/src/mcp-client.ts.html +568 -0
  70. package/coverage/src/remote-mcp-client.ts.html +709 -0
  71. package/coverage/src/repo-resolver.ts.html +526 -0
  72. package/coverage/src/tools.ts.html +970 -0
  73. package/coverage/src/ui/index.html +131 -0
  74. package/coverage/src/ui/main-menu.ts.html +502 -0
  75. package/coverage/src/ui/settings-menu.ts.html +460 -0
  76. package/dist/augment-remote.d.ts +11 -0
  77. package/dist/augment-remote.js +55 -0
  78. package/dist/gitnexus.d.ts +103 -0
  79. package/dist/gitnexus.js +410 -0
  80. package/dist/index.d.ts +2 -0
  81. package/dist/index.js +479 -0
  82. package/dist/mcp-client-factory.d.ts +19 -0
  83. package/dist/mcp-client-factory.js +78 -0
  84. package/dist/mcp-client-stdio.d.ts +35 -0
  85. package/dist/mcp-client-stdio.js +186 -0
  86. package/dist/mcp-client.d.ts +45 -0
  87. package/dist/mcp-client.js +145 -0
  88. package/dist/remote-mcp-client.d.ts +43 -0
  89. package/dist/remote-mcp-client.js +181 -0
  90. package/dist/repo-resolver.d.ts +47 -0
  91. package/dist/repo-resolver.js +123 -0
  92. package/dist/tools.d.ts +6 -0
  93. package/dist/tools.js +230 -0
  94. package/dist/ui/main-menu.d.ts +33 -0
  95. package/dist/ui/main-menu.js +102 -0
  96. package/dist/ui/settings-menu.d.ts +16 -0
  97. package/dist/ui/settings-menu.js +95 -0
  98. package/docs/design/remote-mcp-backend.md +153 -0
  99. package/media/screenshot.png +0 -0
  100. package/package.json +61 -0
  101. package/sgconfig.yml +4 -0
  102. package/skills/gitnexus-debugging/SKILL.md +84 -0
  103. package/skills/gitnexus-exploring/SKILL.md +73 -0
  104. package/skills/gitnexus-impact-analysis/SKILL.md +93 -0
  105. package/skills/gitnexus-pr-review/SKILL.md +109 -0
  106. package/skills/gitnexus-refactoring/SKILL.md +85 -0
  107. package/src/augment-remote.ts +63 -0
  108. package/src/gitnexus.ts +426 -0
  109. package/src/index.ts +492 -0
  110. package/src/mcp-client-factory.ts +94 -0
  111. package/src/mcp-client-stdio.ts +217 -0
  112. package/src/mcp-client.ts +208 -0
  113. package/src/remote-mcp-client.ts +250 -0
  114. package/src/repo-resolver.ts +147 -0
  115. package/src/tools.ts +295 -0
  116. package/src/ui/main-menu.ts +139 -0
  117. package/src/ui/settings-menu.ts +125 -0
@@ -0,0 +1,410 @@
1
+ import spawn from 'cross-spawn';
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
3
+ import { homedir } from 'os';
4
+ import { basename, extname, join, posix, relative, resolve, sep } from 'path';
5
+ /** Max output chars returned to the LLM. Prevents context flooding. JS strings are UTF-16 chars, not bytes. */
6
+ export const MAX_OUTPUT_CHARS = 8 * 1024;
7
+ /**
8
+ * Environment passed to all child processes.
9
+ * On session_start, the agent's PATH is merged with the login shell's PATH
10
+ * (via resolveShellPath) so that nvm/fnm/volta paths are picked up while
11
+ * preserving any directories the agent already had (e.g. ~/.local/share/nvm/…).
12
+ */
13
+ export let spawnEnv = process.env;
14
+ export function updateSpawnEnv(env) { spawnEnv = env; }
15
+ /**
16
+ * Resolved command prefix for invoking gitnexus.
17
+ * Defaults to ['gitnexus']; session_start may override it from the flag or saved config.
18
+ */
19
+ export let gitnexusCmd = ['gitnexus'];
20
+ export function setGitnexusCmd(cmd) { gitnexusCmd = cmd; }
21
+ const CONFIG_PATH = join(homedir(), '.pi', 'pi-gitnexus.json');
22
+ /** Validate and normalize a McpMode value. Returns 'auto' for invalid values. */
23
+ export function validateMcpMode(mode) {
24
+ if (mode === 'local' || mode === 'remote' || mode === 'auto')
25
+ return mode;
26
+ return 'auto';
27
+ }
28
+ /** Default remote MCP server URL. */
29
+ export const DEFAULT_SERVER_URL = 'http://100.114.135.99:4747/api/mcp';
30
+ export function loadSavedConfig() {
31
+ try {
32
+ const raw = JSON.parse(readFileSync(CONFIG_PATH, 'utf8'));
33
+ // Environment variables take highest precedence over file config
34
+ const envMode = process.env.GITNEXUS_MODE ? validateMcpMode(process.env.GITNEXUS_MODE) : undefined;
35
+ const envUrl = process.env.GITNEXUS_SERVER_URL || undefined;
36
+ return {
37
+ mode: envMode ?? validateMcpMode(raw.mode),
38
+ serverUrl: envUrl ?? (typeof raw.serverUrl === 'string' && raw.serverUrl.trim() ? raw.serverUrl.trim() : undefined),
39
+ cmd: typeof raw.cmd === 'string' ? raw.cmd : undefined,
40
+ autoAugment: typeof raw.autoAugment === 'boolean' ? raw.autoAugment : undefined,
41
+ augmentTimeout: typeof raw.augmentTimeout === 'number' ? raw.augmentTimeout : undefined,
42
+ maxAugmentsPerResult: typeof raw.maxAugmentsPerResult === 'number' ? raw.maxAugmentsPerResult : undefined,
43
+ maxSecondaryPatterns: typeof raw.maxSecondaryPatterns === 'number' ? raw.maxSecondaryPatterns : undefined,
44
+ };
45
+ }
46
+ catch {
47
+ return {};
48
+ }
49
+ }
50
+ export function saveConfig(config) {
51
+ try {
52
+ mkdirSync(join(homedir(), '.pi'), { recursive: true });
53
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\n');
54
+ }
55
+ catch { /* ignore write errors */ }
56
+ }
57
+ export function resolveGitNexusCmd(flag, saved) {
58
+ const cmd = flag?.trim() || saved?.trim() || 'gitnexus';
59
+ return cmd.split(/\s+/);
60
+ }
61
+ export function normalizePathArg(path) {
62
+ return path.startsWith('@') ? path.slice(1) : path;
63
+ }
64
+ export function expandUserPath(path) {
65
+ return path === '~' || path.startsWith('~/')
66
+ ? join(homedir(), path.slice(2))
67
+ : path;
68
+ }
69
+ /** Default augment subprocess timeout in ms. Overridden by config.augmentTimeout. */
70
+ const DEFAULT_AUGMENT_TIMEOUT = 8_000;
71
+ /** Current augment timeout in ms. Updated by setAugmentTimeout(). */
72
+ let augmentTimeout = DEFAULT_AUGMENT_TIMEOUT;
73
+ export function setAugmentTimeout(seconds) {
74
+ augmentTimeout = seconds * 1000;
75
+ }
76
+ /** Per-cwd cache: resolved repo root with .gitnexus, or null if none found. */
77
+ const indexRootCache = new Map();
78
+ /** Walk up ancestors looking for a .gitnexus/ directory. Result is cached per cwd. */
79
+ export function findGitNexusRoot(cwd) {
80
+ if (indexRootCache.has(cwd))
81
+ return indexRootCache.get(cwd);
82
+ let dir = cwd;
83
+ while (true) {
84
+ if (existsSync(resolve(dir, '.gitnexus'))) {
85
+ indexRootCache.set(cwd, dir);
86
+ return dir;
87
+ }
88
+ const parent = resolve(dir, '..');
89
+ if (parent === dir)
90
+ break;
91
+ dir = parent;
92
+ }
93
+ indexRootCache.set(cwd, null);
94
+ return null;
95
+ }
96
+ export function findGitNexusIndex(cwd) {
97
+ return findGitNexusRoot(cwd) != null;
98
+ }
99
+ /** Clear the index cache. Call on session_start when cwd may have changed. */
100
+ export function clearIndexCache() {
101
+ indexRootCache.clear();
102
+ }
103
+ /** File extensions worth augmenting when the agent reads a file. */
104
+ const CODE_EXTENSIONS = new Set([
105
+ '.sol', '.ts', '.tsx', '.js', '.jsx', '.py', '.go', '.rs', '.java',
106
+ '.kt', '.swift', '.c', '.cpp', '.h', '.hpp', '.cs', '.rb', '.php',
107
+ '.vy', '.fe', '.huff', '.md', '.mdx',
108
+ ]);
109
+ /**
110
+ * Extract the longest identifier-like literal from a regex pattern.
111
+ * Splits on metacharacters, returns the longest segment that looks like
112
+ * a code identifier (>= 3 chars, starts with letter/underscore).
113
+ */
114
+ export function extractLiteralFromRegex(raw) {
115
+ const segments = raw.split(/[\\^$.*+?()[\]{}|]+/);
116
+ let best = null;
117
+ for (const seg of segments) {
118
+ const clean = seg.replace(/['"]/g, '');
119
+ if (clean.length >= 3 && /^[a-zA-Z_]\w*$/.test(clean)) {
120
+ if (!best || clean.length > best.length)
121
+ best = clean;
122
+ }
123
+ }
124
+ return best;
125
+ }
126
+ /**
127
+ * Simple shell-aware tokenizer for bash commands.
128
+ * Respects single/double quotes. Inserts a '|' boundary token at
129
+ * pipe, &&, ||, and ; boundaries so extractPattern can reset state.
130
+ */
131
+ function tokenizeBashCmd(cmd) {
132
+ const tokens = [];
133
+ let current = '';
134
+ let inSingle = false;
135
+ let inDouble = false;
136
+ const flush = () => { if (current) {
137
+ tokens.push(current);
138
+ current = '';
139
+ } };
140
+ for (let i = 0; i < cmd.length; i++) {
141
+ const ch = cmd[i];
142
+ if (inSingle) {
143
+ if (ch === "'") {
144
+ inSingle = false;
145
+ }
146
+ else {
147
+ current += ch;
148
+ }
149
+ continue;
150
+ }
151
+ if (inDouble) {
152
+ if (ch === '"') {
153
+ inDouble = false;
154
+ }
155
+ else {
156
+ current += ch;
157
+ }
158
+ continue;
159
+ }
160
+ // Command boundaries: |, &&, ||, ;
161
+ if (ch === '|' || ch === ';') {
162
+ flush();
163
+ tokens.push('|'); // boundary marker
164
+ if (ch === '|' && cmd[i + 1] === '|')
165
+ i++; // skip ||
166
+ continue;
167
+ }
168
+ if (ch === '&' && cmd[i + 1] === '&') {
169
+ flush();
170
+ tokens.push('|'); // boundary marker
171
+ i++; // skip second &
172
+ continue;
173
+ }
174
+ if (ch === "'") {
175
+ inSingle = true;
176
+ continue;
177
+ }
178
+ if (ch === '"') {
179
+ inDouble = true;
180
+ continue;
181
+ }
182
+ if (/\s/.test(ch)) {
183
+ flush();
184
+ }
185
+ else {
186
+ current += ch;
187
+ }
188
+ }
189
+ flush();
190
+ return tokens;
191
+ }
192
+ /**
193
+ * Extract the primary search pattern from a tool's input object.
194
+ *
195
+ * grep → input.pattern
196
+ * find → basename of the glob pattern (e.g. "**\/foo.ts" → "foo")
197
+ * bash → grep/rg pattern, find -name value, or cat/head/tail filename
198
+ * read → basename of the file path (code files only)
199
+ *
200
+ * Returns null if pattern is missing or shorter than 3 chars.
201
+ */
202
+ export function extractPattern(toolName, input) {
203
+ let pattern = null;
204
+ if (toolName === 'grep') {
205
+ const raw = typeof input.pattern === 'string' ? input.pattern : null;
206
+ pattern = raw ? extractLiteralFromRegex(raw) : null;
207
+ }
208
+ else if (toolName === 'find') {
209
+ // pi's find tool field name is unconfirmed — try common variants
210
+ const raw = typeof input.pattern === 'string' ? input.pattern :
211
+ typeof input.glob === 'string' ? input.glob :
212
+ typeof input.path === 'string' ? input.path :
213
+ null;
214
+ if (raw) {
215
+ const seg = basename(raw).replace(/\.\w+$/, '').replace(/[*?[\]{}]/g, '');
216
+ pattern = seg || null;
217
+ }
218
+ }
219
+ else if (toolName === 'bash') {
220
+ const cmd = typeof input.command === 'string' ? input.command : '';
221
+ const tokens = tokenizeBashCmd(cmd);
222
+ let foundCmd = false;
223
+ let foundFileCmd = false;
224
+ for (let i = 0; i < tokens.length; i++) {
225
+ const tok = tokens[i];
226
+ // Reset state at command boundaries (pipe, &&, ||, ;)
227
+ if (tok === '|') {
228
+ foundCmd = false;
229
+ foundFileCmd = false;
230
+ continue;
231
+ }
232
+ // grep/rg: first non-flag arg after the command is the search pattern
233
+ if (tok === 'grep' || tok === 'rg') {
234
+ foundCmd = true;
235
+ foundFileCmd = false;
236
+ continue;
237
+ }
238
+ if (foundCmd) {
239
+ if (tok.startsWith('-'))
240
+ continue;
241
+ pattern = extractLiteralFromRegex(tok);
242
+ break;
243
+ }
244
+ // cat / head / tail / less / wc: next non-flag arg is a file path → use basename
245
+ if (tok === 'cat' || tok === 'head' || tok === 'tail' || tok === 'less' || tok === 'wc') {
246
+ foundFileCmd = true;
247
+ foundCmd = false;
248
+ continue;
249
+ }
250
+ if (foundFileCmd) {
251
+ if (tok.startsWith('-'))
252
+ continue;
253
+ const ext = extname(tok);
254
+ if (CODE_EXTENSIONS.has(ext)) {
255
+ pattern = basename(tok).replace(/\.\w+$/, '');
256
+ break;
257
+ }
258
+ // Non-code file — reset and keep scanning for grep/rg in later segments.
259
+ foundFileCmd = false;
260
+ continue;
261
+ }
262
+ // find -name / -iname: strip glob chars and extension from value
263
+ if (tok === 'find') {
264
+ foundCmd = false;
265
+ foundFileCmd = false;
266
+ continue;
267
+ }
268
+ if ((tok === '-name' || tok === '-iname') && tokens[i + 1]) {
269
+ const seg = basename(tokens[i + 1]).replace(/\.\w+$/, '').replace(/[*?[\]{}]/g, '');
270
+ if (seg.length >= 3) {
271
+ pattern = seg;
272
+ }
273
+ break;
274
+ }
275
+ }
276
+ }
277
+ else if (toolName === 'read') {
278
+ const raw = typeof input.path === 'string' ? input.path : null;
279
+ if (raw && CODE_EXTENSIONS.has(extname(raw))) {
280
+ pattern = basename(raw).replace(/\.\w+$/, '');
281
+ }
282
+ }
283
+ if (!pattern || pattern.length < 3)
284
+ return null;
285
+ return pattern;
286
+ }
287
+ /**
288
+ * Extract { path, pattern } pairs from a read_many tool input.
289
+ * read_many input is { files: Array<{ path: string, ... }> }.
290
+ * Falls back to scanning content for @path lines if input lacks a files array.
291
+ * Returns code files only, deduplicated by basename pattern.
292
+ */
293
+ export function extractFilesFromReadMany(input, content) {
294
+ const seen = new Set();
295
+ const results = [];
296
+ const add = (filePath) => {
297
+ const ext = extname(filePath);
298
+ if (!CODE_EXTENSIONS.has(ext))
299
+ return;
300
+ const pattern = basename(filePath).replace(/\.\w+$/, '');
301
+ if (pattern.length < 3 || seen.has(pattern))
302
+ return;
303
+ seen.add(pattern);
304
+ results.push({ path: filePath, pattern });
305
+ };
306
+ // Primary: extract from structured input
307
+ const files = Array.isArray(input.files) ? input.files : [];
308
+ for (const f of files) {
309
+ if (typeof f === 'object' && f !== null && typeof f.path === 'string') {
310
+ add(f.path);
311
+ }
312
+ }
313
+ // Fallback: parse @path lines from content (if input was empty/unknown)
314
+ if (results.length === 0) {
315
+ const text = content.map(c => c.text ?? '').join('\n');
316
+ for (const line of text.split('\n')) {
317
+ const m = line.match(/^@(.+)$/);
318
+ if (m)
319
+ add(m[1].trim());
320
+ }
321
+ }
322
+ return results;
323
+ }
324
+ /**
325
+ * Extract up to `limit` unique file basenames (without extension) from
326
+ * grep-style output lines of the form "path/to/file.ext:lineno:content".
327
+ * Used to augment secondary context from search results.
328
+ */
329
+ export function extractFilePatternsFromContent(content, limit = 2) {
330
+ const text = content.map(c => c.text ?? '').join('\n');
331
+ const seen = new Set();
332
+ const results = [];
333
+ for (const line of text.split('\n')) {
334
+ // Match "some/path/File.ext:digits:" at the start of a line
335
+ const m = line.match(/^([^\n:]+\.\w+):\d+:/);
336
+ if (!m)
337
+ continue;
338
+ const base = basename(m[1]).replace(/\.\w+$/, '');
339
+ if (base.length >= 3 && !seen.has(base)) {
340
+ seen.add(base);
341
+ results.push(base);
342
+ }
343
+ if (results.length >= limit)
344
+ break;
345
+ }
346
+ return results;
347
+ }
348
+ /**
349
+ * Validate that a file path stays within cwd (path traversal guard).
350
+ * Returns the resolved absolute path, or null if it escapes cwd.
351
+ */
352
+ export function safeResolvePath(file, cwd) {
353
+ const resolved = resolve(cwd, file);
354
+ return resolved.startsWith(cwd + sep) || resolved === cwd ? resolved : null;
355
+ }
356
+ export function toRepoRelativePath(file, repoRoot) {
357
+ const resolved = safeResolvePath(file, repoRoot);
358
+ if (!resolved)
359
+ return null;
360
+ return relative(repoRoot, resolved) || '.';
361
+ }
362
+ export function validateRepoRelativePath(file) {
363
+ const normalized = posix.normalize(file.replaceAll('\\', '/'));
364
+ if (normalized === '.' || normalized === '')
365
+ return null;
366
+ if (normalized.startsWith('../') || normalized === '..' || normalized.startsWith('/'))
367
+ return null;
368
+ return normalized;
369
+ }
370
+ /**
371
+ * Spawn `gitnexus augment <pattern>` and return its output.
372
+ * gitnexus augment writes results to stderr (not stdout).
373
+ * Used by the tool_result hook — not by registered tools (those use mcp-client).
374
+ * Returns output trimmed and truncated to MAX_OUTPUT_CHARS, or "" on any error.
375
+ */
376
+ export async function runAugment(pattern, cwd) {
377
+ return new Promise((resolve_) => {
378
+ // gitnexus augment writes results to stderr (not stdout)
379
+ let output = '';
380
+ let done = false;
381
+ const [bin, ...baseArgs] = gitnexusCmd;
382
+ const proc = spawn(bin, [...baseArgs, 'augment', pattern], {
383
+ cwd,
384
+ stdio: ['ignore', 'ignore', 'pipe'],
385
+ env: spawnEnv,
386
+ });
387
+ const timer = setTimeout(() => {
388
+ if (!done) {
389
+ done = true;
390
+ proc.kill('SIGTERM');
391
+ resolve_('');
392
+ }
393
+ }, augmentTimeout);
394
+ proc.stderr.on('data', (chunk) => { output += chunk.toString(); });
395
+ proc.on('close', (code) => {
396
+ if (done)
397
+ return;
398
+ done = true;
399
+ clearTimeout(timer);
400
+ resolve_(code === 0 ? output.trim().slice(0, MAX_OUTPUT_CHARS) : '');
401
+ });
402
+ proc.on('error', () => {
403
+ if (!done) {
404
+ done = true;
405
+ clearTimeout(timer);
406
+ resolve_('');
407
+ }
408
+ });
409
+ });
410
+ }
@@ -0,0 +1,2 @@
1
+ import type { ExtensionAPI } from '@mariozechner/pi-coding-agent';
2
+ export default function (pi: ExtensionAPI): void;