gauss-ai 4.0.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.
- package/CHANGELOG.md +489 -0
- package/LICENSE +21 -0
- package/README.md +269 -0
- package/dist/a2a/index.cjs +7 -0
- package/dist/a2a/index.cjs.map +1 -0
- package/dist/a2a/index.d.cts +30 -0
- package/dist/a2a/index.d.ts +30 -0
- package/dist/a2a/index.js +7 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/agent-UIQDSYCE.js +16 -0
- package/dist/agent-UIQDSYCE.js.map +1 -0
- package/dist/agent-builder-8W3mBR-N.d.ts +1075 -0
- package/dist/agent-builder-GEMYdb1p.d.cts +1075 -0
- package/dist/agent-graph-AMQYAWNF.js +1422 -0
- package/dist/agent-graph-AMQYAWNF.js.map +1 -0
- package/dist/ai-sdk-mcp.adapter-SEN6KHNU.js +124 -0
- package/dist/ai-sdk-mcp.adapter-SEN6KHNU.js.map +1 -0
- package/dist/browser/index.js +10 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/bun-runtime.adapter-MQDAJLQM.js +8 -0
- package/dist/bun-runtime.adapter-MQDAJLQM.js.map +1 -0
- package/dist/bun-runtime.adapter-XKOUXVAK.cjs +8 -0
- package/dist/bun-runtime.adapter-XKOUXVAK.cjs.map +1 -0
- package/dist/chat-A3XMRPJL.js +129 -0
- package/dist/chat-A3XMRPJL.js.map +1 -0
- package/dist/chunk-2ZRU47NC.js +91 -0
- package/dist/chunk-2ZRU47NC.js.map +1 -0
- package/dist/chunk-3LD3JTH4.cjs +18 -0
- package/dist/chunk-3LD3JTH4.cjs.map +1 -0
- package/dist/chunk-5FE5TG2W.cjs +16 -0
- package/dist/chunk-5FE5TG2W.cjs.map +1 -0
- package/dist/chunk-6XF673YC.cjs +436 -0
- package/dist/chunk-6XF673YC.cjs.map +1 -0
- package/dist/chunk-7CKWZJNS.js +230 -0
- package/dist/chunk-7CKWZJNS.js.map +1 -0
- package/dist/chunk-BI2G665F.js +4588 -0
- package/dist/chunk-BI2G665F.js.map +1 -0
- package/dist/chunk-C5NLWJS2.js +139 -0
- package/dist/chunk-C5NLWJS2.js.map +1 -0
- package/dist/chunk-CJZ66SU3.cjs +4321 -0
- package/dist/chunk-CJZ66SU3.cjs.map +1 -0
- package/dist/chunk-DAMT2CXW.cjs +91 -0
- package/dist/chunk-DAMT2CXW.cjs.map +1 -0
- package/dist/chunk-E7WG3MO5.js +18 -0
- package/dist/chunk-E7WG3MO5.js.map +1 -0
- package/dist/chunk-EFDM6R4J.js +99 -0
- package/dist/chunk-EFDM6R4J.js.map +1 -0
- package/dist/chunk-F7WIPPEO.js +256 -0
- package/dist/chunk-F7WIPPEO.js.map +1 -0
- package/dist/chunk-FAYDE67N.js +6927 -0
- package/dist/chunk-FAYDE67N.js.map +1 -0
- package/dist/chunk-GAE2KKCM.js +21 -0
- package/dist/chunk-GAE2KKCM.js.map +1 -0
- package/dist/chunk-INLNGRXM.cjs +130 -0
- package/dist/chunk-INLNGRXM.cjs.map +1 -0
- package/dist/chunk-JKXKXB5O.js +130 -0
- package/dist/chunk-JKXKXB5O.js.map +1 -0
- package/dist/chunk-K6SAETGP.js +375 -0
- package/dist/chunk-K6SAETGP.js.map +1 -0
- package/dist/chunk-KEASLAYR.js +157 -0
- package/dist/chunk-KEASLAYR.js.map +1 -0
- package/dist/chunk-KKJVNM6O.js +436 -0
- package/dist/chunk-KKJVNM6O.js.map +1 -0
- package/dist/chunk-KYIMVRIM.js +16 -0
- package/dist/chunk-KYIMVRIM.js.map +1 -0
- package/dist/chunk-MB7NXIZD.js +4321 -0
- package/dist/chunk-MB7NXIZD.js.map +1 -0
- package/dist/chunk-MHHDXPGE.js +209 -0
- package/dist/chunk-MHHDXPGE.js.map +1 -0
- package/dist/chunk-NE6JJA5W.js +401 -0
- package/dist/chunk-NE6JJA5W.js.map +1 -0
- package/dist/chunk-PF46XZBF.cjs +6927 -0
- package/dist/chunk-PF46XZBF.cjs.map +1 -0
- package/dist/chunk-PSJIAGDE.cjs +375 -0
- package/dist/chunk-PSJIAGDE.cjs.map +1 -0
- package/dist/chunk-PWOQDXNQ.js +16 -0
- package/dist/chunk-PWOQDXNQ.js.map +1 -0
- package/dist/chunk-QYOMQBBZ.cjs +230 -0
- package/dist/chunk-QYOMQBBZ.cjs.map +1 -0
- package/dist/chunk-UDFXLC4J.cjs +16 -0
- package/dist/chunk-UDFXLC4J.cjs.map +1 -0
- package/dist/chunk-UO4NGXRT.cjs +259 -0
- package/dist/chunk-UO4NGXRT.cjs.map +1 -0
- package/dist/chunk-UPFDFLEW.js +40 -0
- package/dist/chunk-UPFDFLEW.js.map +1 -0
- package/dist/chunk-V55JSQS7.cjs +16 -0
- package/dist/chunk-V55JSQS7.cjs.map +1 -0
- package/dist/chunk-VJADHXZL.cjs +16 -0
- package/dist/chunk-VJADHXZL.cjs.map +1 -0
- package/dist/chunk-VRWD7LCI.js +59 -0
- package/dist/chunk-VRWD7LCI.js.map +1 -0
- package/dist/chunk-WKKQ443C.js +487 -0
- package/dist/chunk-WKKQ443C.js.map +1 -0
- package/dist/chunk-X2GHUHAF.js +436 -0
- package/dist/chunk-X2GHUHAF.js.map +1 -0
- package/dist/chunk-XLGW3XNI.cjs +256 -0
- package/dist/chunk-XLGW3XNI.cjs.map +1 -0
- package/dist/chunk-ZFJKX4DP.js +16 -0
- package/dist/chunk-ZFJKX4DP.js.map +1 -0
- package/dist/chunk-ZM2OEWM2.js +259 -0
- package/dist/chunk-ZM2OEWM2.js.map +1 -0
- package/dist/chunk-ZNAIP2XV.js +16 -0
- package/dist/chunk-ZNAIP2XV.js.map +1 -0
- package/dist/chunk-ZYFAZYSL.js +42 -0
- package/dist/chunk-ZYFAZYSL.js.map +1 -0
- package/dist/cli/index.js +421 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config-4MHT6TQW.js +153 -0
- package/dist/config-4MHT6TQW.js.map +1 -0
- package/dist/config-REERQFK4.cjs +153 -0
- package/dist/config-REERQFK4.cjs.map +1 -0
- package/dist/cost-tracker-JLOU7IZJ.js +7 -0
- package/dist/cost-tracker-JLOU7IZJ.js.map +1 -0
- package/dist/demo-C52GMSYH.js +188 -0
- package/dist/demo-C52GMSYH.js.map +1 -0
- package/dist/deno/index.js +306 -0
- package/dist/deno/index.js.map +1 -0
- package/dist/deno-runtime.adapter-F744HY7K.js +8 -0
- package/dist/deno-runtime.adapter-F744HY7K.js.map +1 -0
- package/dist/deno-runtime.adapter-RFEVNSCV.cjs +8 -0
- package/dist/deno-runtime.adapter-RFEVNSCV.cjs.map +1 -0
- package/dist/dev-D7DDVDA4.js +218 -0
- package/dist/dev-D7DDVDA4.js.map +1 -0
- package/dist/edge/index.js +10 -0
- package/dist/edge/index.js.map +1 -0
- package/dist/edge-runtime.adapter-UQCW2F7X.js +8 -0
- package/dist/edge-runtime.adapter-UQCW2F7X.js.map +1 -0
- package/dist/edge-runtime.adapter-YED6F3AY.cjs +8 -0
- package/dist/edge-runtime.adapter-YED6F3AY.cjs.map +1 -0
- package/dist/graph-MGFAQZ5W.js +50 -0
- package/dist/graph-MGFAQZ5W.js.map +1 -0
- package/dist/graph-visualization-HBSVQXJK.js +9 -0
- package/dist/graph-visualization-HBSVQXJK.js.map +1 -0
- package/dist/index-BRgqNnh3.d.cts +982 -0
- package/dist/index-CZxpYUxZ.d.ts +982 -0
- package/dist/index.cjs +14789 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10275 -0
- package/dist/index.d.ts +10275 -0
- package/dist/index.js +14789 -0
- package/dist/index.js.map +1 -0
- package/dist/init-CFWXTQ35.js +133 -0
- package/dist/init-CFWXTQ35.js.map +1 -0
- package/dist/llm-VWO4MC7J.cjs +17 -0
- package/dist/llm-VWO4MC7J.cjs.map +1 -0
- package/dist/llm-XLXVSPBI.js +17 -0
- package/dist/llm-XLXVSPBI.js.map +1 -0
- package/dist/logging-WRAK5ZXT.js +33 -0
- package/dist/logging-WRAK5ZXT.js.map +1 -0
- package/dist/metrics-FAHZVVD4.js +47 -0
- package/dist/metrics-FAHZVVD4.js.map +1 -0
- package/dist/node/index.cjs +280 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +51 -0
- package/dist/node/index.d.ts +51 -0
- package/dist/node/index.js +280 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node-runtime.adapter-5L7PJ6W2.js +8 -0
- package/dist/node-runtime.adapter-5L7PJ6W2.js.map +1 -0
- package/dist/node-runtime.adapter-CCRZVGHB.cjs +8 -0
- package/dist/node-runtime.adapter-CCRZVGHB.cjs.map +1 -0
- package/dist/persist-usage-WTBTCWEF.js +7 -0
- package/dist/persist-usage-WTBTCWEF.js.map +1 -0
- package/dist/plugin-RCPBWUUA.js +207 -0
- package/dist/plugin-RCPBWUUA.js.map +1 -0
- package/dist/plugins/index.cjs +75 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +8 -0
- package/dist/plugins/index.d.ts +8 -0
- package/dist/plugins/index.js +75 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins-L4ING3CX.js +4625 -0
- package/dist/plugins-L4ING3CX.js.map +1 -0
- package/dist/providers/index.cjs +189 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +168 -0
- package/dist/providers/index.d.ts +168 -0
- package/dist/providers/index.js +189 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers-3RNQ5CKZ.js +59 -0
- package/dist/providers-3RNQ5CKZ.js.map +1 -0
- package/dist/providers-66GPXUGQ.cjs +59 -0
- package/dist/providers-66GPXUGQ.cjs.map +1 -0
- package/dist/repl-K6QN4I2S.js +678 -0
- package/dist/repl-K6QN4I2S.js.map +1 -0
- package/dist/rest/index.cjs +17 -0
- package/dist/rest/index.cjs.map +1 -0
- package/dist/rest/index.d.cts +102 -0
- package/dist/rest/index.d.ts +102 -0
- package/dist/rest/index.js +17 -0
- package/dist/rest/index.js.map +1 -0
- package/dist/runtime-deno.js +15 -0
- package/dist/runtime-deno.js.map +1 -0
- package/dist/runtime-edge.js +15 -0
- package/dist/runtime-edge.js.map +1 -0
- package/dist/runtime-node.js +15 -0
- package/dist/runtime-node.js.map +1 -0
- package/dist/scraping/index.cjs +11 -0
- package/dist/scraping/index.cjs.map +1 -0
- package/dist/scraping/index.d.cts +17 -0
- package/dist/scraping/index.d.ts +17 -0
- package/dist/scraping/index.js +11 -0
- package/dist/scraping/index.js.map +1 -0
- package/dist/semantic-scraping.port-CZWUea88.d.cts +54 -0
- package/dist/semantic-scraping.port-CZWUea88.d.ts +54 -0
- package/dist/server/index.js +166 -0
- package/dist/server/index.js.map +1 -0
- package/dist/testing/index.cjs +25 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +63 -0
- package/dist/testing/index.d.ts +63 -0
- package/dist/testing/index.js +25 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/token-counter.port-CRgxZZGe.d.ts +334 -0
- package/dist/token-counter.port-D7BHMCRR.d.cts +334 -0
- package/dist/tools-BZM33OBZ.js +10 -0
- package/dist/tools-BZM33OBZ.js.map +1 -0
- package/dist/tracing-XA3TEWP4.js +48 -0
- package/dist/tracing-XA3TEWP4.js.map +1 -0
- package/dist/types-CVsP7gFI.d.cts +235 -0
- package/dist/types-CVsP7gFI.d.ts +235 -0
- package/dist/virtual-fs.adapter-BBLS-3AY.d.ts +26 -0
- package/dist/virtual-fs.adapter-nb0CTYOj.d.cts +26 -0
- package/dist/workflow/index.cjs +9 -0
- package/dist/workflow/index.cjs.map +1 -0
- package/dist/workflow/index.d.cts +62 -0
- package/dist/workflow/index.d.ts +62 -0
- package/dist/workflow/index.js +9 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow.port-BaCttxrw.d.cts +153 -0
- package/dist/workflow.port-BaCttxrw.d.ts +153 -0
- package/package.json +230 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/cli/format.ts
|
|
2
|
+
var CODES = {
|
|
3
|
+
reset: "\x1B[0m",
|
|
4
|
+
bold: "\x1B[1m",
|
|
5
|
+
dim: "\x1B[2m",
|
|
6
|
+
red: "\x1B[31m",
|
|
7
|
+
green: "\x1B[32m",
|
|
8
|
+
yellow: "\x1B[33m",
|
|
9
|
+
blue: "\x1B[34m",
|
|
10
|
+
magenta: "\x1B[35m",
|
|
11
|
+
cyan: "\x1B[36m",
|
|
12
|
+
white: "\x1B[37m",
|
|
13
|
+
gray: "\x1B[90m"
|
|
14
|
+
};
|
|
15
|
+
function color(name, text) {
|
|
16
|
+
if (!process.stdout.isTTY) return text;
|
|
17
|
+
return `${CODES[name]}${text}${CODES.reset}`;
|
|
18
|
+
}
|
|
19
|
+
function bold(text) {
|
|
20
|
+
if (!process.stdout.isTTY) return text;
|
|
21
|
+
return `${CODES.bold}${text}${CODES.reset}`;
|
|
22
|
+
}
|
|
23
|
+
function createSpinner(text) {
|
|
24
|
+
if (!process.stdout.isTTY) {
|
|
25
|
+
process.stdout.write(`${text}...
|
|
26
|
+
`);
|
|
27
|
+
return { stop: () => {
|
|
28
|
+
} };
|
|
29
|
+
}
|
|
30
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
31
|
+
let i = 0;
|
|
32
|
+
const timer = setInterval(() => {
|
|
33
|
+
process.stdout.write(`\r${CODES.cyan}${frames[i++ % frames.length]} ${text}${CODES.reset}`);
|
|
34
|
+
}, 80);
|
|
35
|
+
return {
|
|
36
|
+
stop(finalText) {
|
|
37
|
+
clearInterval(timer);
|
|
38
|
+
process.stdout.write(`\r${" ".repeat(text.length + 4)}\r`);
|
|
39
|
+
if (finalText) process.stdout.write(finalText);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function maskKey(key) {
|
|
44
|
+
if (key.length <= 12) return key.slice(0, 4) + "****";
|
|
45
|
+
return key.slice(0, 8) + "..." + key.slice(-4);
|
|
46
|
+
}
|
|
47
|
+
function formatDuration(ms) {
|
|
48
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
49
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
color,
|
|
54
|
+
bold,
|
|
55
|
+
createSpinner,
|
|
56
|
+
maskKey,
|
|
57
|
+
formatDuration
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=chunk-VRWD7LCI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/format.ts"],"sourcesContent":["// =============================================================================\n// CLI Format — ANSI color helpers (zero dependencies)\n// =============================================================================\n\nconst CODES: Record<string, string> = {\n reset: \"\\x1b[0m\",\n bold: \"\\x1b[1m\",\n dim: \"\\x1b[2m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n white: \"\\x1b[37m\",\n gray: \"\\x1b[90m\",\n};\n\nexport function color(name: keyof typeof CODES, text: string): string {\n if (!process.stdout.isTTY) return text;\n return `${CODES[name]}${text}${CODES.reset}`;\n}\n\nexport function bold(text: string): string {\n if (!process.stdout.isTTY) return text;\n return `${CODES.bold}${text}${CODES.reset}`;\n}\n\n// Spinner for \"thinking\" indicator\nexport function createSpinner(text: string): { stop: (finalText?: string) => void } {\n if (!process.stdout.isTTY) {\n process.stdout.write(`${text}...\\n`);\n return { stop: () => {} };\n }\n const frames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n let i = 0;\n const timer = setInterval(() => {\n process.stdout.write(`\\r${CODES.cyan}${frames[i++ % frames.length]} ${text}${CODES.reset}`);\n }, 80);\n return {\n stop(finalText?: string) {\n clearInterval(timer);\n process.stdout.write(`\\r${\" \".repeat(text.length + 4)}\\r`);\n if (finalText) process.stdout.write(finalText);\n },\n };\n}\n\n// Mask API key for display — shared masking logic\nexport function maskKey(key: string): string {\n if (key.length <= 12) return key.slice(0, 4) + \"****\";\n return key.slice(0, 8) + \"...\" + key.slice(-4);\n}\n\n// Format elapsed time\nexport function formatDuration(ms: number): string {\n if (ms < 1000) return `${ms}ms`;\n return `${(ms / 1000).toFixed(1)}s`;\n}\n\nconst CODE_BLOCK_RE = /```(\\w*)\\n([\\s\\S]*?)```/g;\nconst INLINE_CODE_RE = /`([^`]+)`/g;\nconst BOLD_RE = /\\*\\*([^*]+)\\*\\*/g;\nconst HEADER_RE = /^(#{1,3})\\s+(.+)$/gm;\n\n// Simple markdown formatting for terminal output\nexport function formatMarkdown(text: string): string {\n return text\n // Code blocks\n .replace(CODE_BLOCK_RE, (_match, lang: string, code: string) => {\n const header = lang ? color(\"dim\", ` ─── ${lang} ───`) : \"\";\n return `${header}\\n${color(\"cyan\", code.trimEnd())}\\n${color(\"dim\", \" ─────────\")}`;\n })\n // Inline code\n .replace(INLINE_CODE_RE, (_match, code: string) => color(\"cyan\", code))\n // Bold\n .replace(BOLD_RE, (_match, text: string) => bold(text))\n // Headers\n .replace(HEADER_RE, (_match, _hashes: string, text: string) =>\n bold(color(\"yellow\", text)),\n );\n}\n\n// Box drawing for nice output\nexport function box(title: string, content: string): string {\n const lines = content.split(\"\\n\");\n const maxLen = Math.max(title.length, ...lines.map(l => l.length));\n const hr = \"─\".repeat(maxLen + 2);\n const top = `┌${hr}┐`;\n const bottom = `└${hr}┘`;\n const titleLine = `│ ${title.padEnd(maxLen)} │`;\n const sep = `├${hr}┤`;\n const body = lines.map(l => `│ ${l.padEnd(maxLen)} │`).join(\"\\n\");\n return `${top}\\n${titleLine}\\n${sep}\\n${body}\\n${bottom}`;\n}\n"],"mappings":";AAIA,IAAM,QAAgC;AAAA,EACpC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,E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QAAO,GAAG,EAAE;AAC3B,SAAO,IAAI,KAAK,KAAM,QAAQ,CAAC,CAAC;AAClC;","names":[]}
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readFile,
|
|
3
|
+
runBash,
|
|
4
|
+
writeFile
|
|
5
|
+
} from "./chunk-ZYFAZYSL.js";
|
|
6
|
+
import {
|
|
7
|
+
color
|
|
8
|
+
} from "./chunk-VRWD7LCI.js";
|
|
9
|
+
import {
|
|
10
|
+
tool
|
|
11
|
+
} from "./chunk-K6SAETGP.js";
|
|
12
|
+
|
|
13
|
+
// src/cli/tools.ts
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { readFileSync as readFileSync2, readdirSync, realpathSync, existsSync as existsSync2 } from "fs";
|
|
16
|
+
import { execSync, spawnSync } from "child_process";
|
|
17
|
+
import { resolve, join as join2, relative } from "path";
|
|
18
|
+
|
|
19
|
+
// src/cli/diff-utils.ts
|
|
20
|
+
function generateUnifiedDiff(oldContent, newContent, filePath) {
|
|
21
|
+
const oldLines = oldContent.split("\n");
|
|
22
|
+
const newLines = newContent.split("\n");
|
|
23
|
+
const MAX_DIFF_LINES = 1e3;
|
|
24
|
+
if (oldLines.length > MAX_DIFF_LINES || newLines.length > MAX_DIFF_LINES) {
|
|
25
|
+
const removed = oldLines.length;
|
|
26
|
+
const added = newLines.length;
|
|
27
|
+
return color("dim", `(file too large for inline diff \u2014 ${removed} old lines, ${added} new lines)`);
|
|
28
|
+
}
|
|
29
|
+
const ops = computeEditOps(oldLines, newLines);
|
|
30
|
+
if (ops.every((op) => op.type === "equal")) return "";
|
|
31
|
+
const hunks = buildHunks(ops, 3);
|
|
32
|
+
const lines = [
|
|
33
|
+
color("dim", `--- a/${filePath}`),
|
|
34
|
+
color("dim", `+++ b/${filePath}`)
|
|
35
|
+
];
|
|
36
|
+
for (const hunk of hunks) {
|
|
37
|
+
lines.push(
|
|
38
|
+
color("cyan", `@@ -${hunk.oldStart + 1},${hunk.oldCount} +${hunk.newStart + 1},${hunk.newCount} @@`)
|
|
39
|
+
);
|
|
40
|
+
for (const op of hunk.ops) {
|
|
41
|
+
if (op.type === "equal") {
|
|
42
|
+
lines.push(` ${op.line}`);
|
|
43
|
+
} else if (op.type === "delete") {
|
|
44
|
+
lines.push(color("red", `-${op.line}`));
|
|
45
|
+
} else {
|
|
46
|
+
lines.push(color("green", `+${op.line}`));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return lines.join("\n");
|
|
51
|
+
}
|
|
52
|
+
function computeEditOps(oldLines, newLines) {
|
|
53
|
+
const m = oldLines.length;
|
|
54
|
+
const n = newLines.length;
|
|
55
|
+
const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
|
|
56
|
+
for (let i2 = 1; i2 <= m; i2++) {
|
|
57
|
+
for (let j2 = 1; j2 <= n; j2++) {
|
|
58
|
+
if (oldLines[i2 - 1] === newLines[j2 - 1]) {
|
|
59
|
+
dp[i2][j2] = dp[i2 - 1][j2 - 1] + 1;
|
|
60
|
+
} else {
|
|
61
|
+
dp[i2][j2] = Math.max(dp[i2 - 1][j2], dp[i2][j2 - 1]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const ops = [];
|
|
66
|
+
let i = m;
|
|
67
|
+
let j = n;
|
|
68
|
+
while (i > 0 || j > 0) {
|
|
69
|
+
if (i > 0 && j > 0 && oldLines[i - 1] === newLines[j - 1]) {
|
|
70
|
+
ops.push({ type: "equal", line: oldLines[i - 1], oldIdx: i - 1, newIdx: j - 1 });
|
|
71
|
+
i--;
|
|
72
|
+
j--;
|
|
73
|
+
} else if (j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])) {
|
|
74
|
+
ops.push({ type: "insert", line: newLines[j - 1], oldIdx: i, newIdx: j - 1 });
|
|
75
|
+
j--;
|
|
76
|
+
} else {
|
|
77
|
+
ops.push({ type: "delete", line: oldLines[i - 1], oldIdx: i - 1, newIdx: j });
|
|
78
|
+
i--;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
ops.reverse();
|
|
82
|
+
return ops;
|
|
83
|
+
}
|
|
84
|
+
function buildHunks(ops, context) {
|
|
85
|
+
const changeIndices = [];
|
|
86
|
+
for (let i = 0; i < ops.length; i++) {
|
|
87
|
+
if (ops[i].type !== "equal") changeIndices.push(i);
|
|
88
|
+
}
|
|
89
|
+
if (changeIndices.length === 0) return [];
|
|
90
|
+
const ranges = [];
|
|
91
|
+
let start = Math.max(0, changeIndices[0] - context);
|
|
92
|
+
let end = Math.min(ops.length - 1, changeIndices[0] + context);
|
|
93
|
+
for (let k = 1; k < changeIndices.length; k++) {
|
|
94
|
+
const cs = Math.max(0, changeIndices[k] - context);
|
|
95
|
+
const ce = Math.min(ops.length - 1, changeIndices[k] + context);
|
|
96
|
+
if (cs <= end + 1) {
|
|
97
|
+
end = ce;
|
|
98
|
+
} else {
|
|
99
|
+
ranges.push([start, end]);
|
|
100
|
+
start = cs;
|
|
101
|
+
end = ce;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
ranges.push([start, end]);
|
|
105
|
+
return ranges.map(([s, e]) => {
|
|
106
|
+
const hunkOps = ops.slice(s, e + 1);
|
|
107
|
+
let oldStart = 0;
|
|
108
|
+
let newStart = 0;
|
|
109
|
+
for (let i = 0; i < s; i++) {
|
|
110
|
+
if (ops[i].type === "equal" || ops[i].type === "delete") oldStart++;
|
|
111
|
+
if (ops[i].type === "equal" || ops[i].type === "insert") newStart++;
|
|
112
|
+
}
|
|
113
|
+
let oldCount = 0;
|
|
114
|
+
let newCount = 0;
|
|
115
|
+
for (const op of hunkOps) {
|
|
116
|
+
if (op.type === "equal" || op.type === "delete") oldCount++;
|
|
117
|
+
if (op.type === "equal" || op.type === "insert") newCount++;
|
|
118
|
+
}
|
|
119
|
+
return { oldStart, newStart, oldCount, newCount, ops: hunkOps };
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/cli/gauss-ignore.ts
|
|
124
|
+
import { existsSync, readFileSync } from "fs";
|
|
125
|
+
import { join } from "path";
|
|
126
|
+
var DEFAULT_PATTERNS = [
|
|
127
|
+
"node_modules",
|
|
128
|
+
".git",
|
|
129
|
+
"dist",
|
|
130
|
+
"build",
|
|
131
|
+
"__pycache__",
|
|
132
|
+
"target",
|
|
133
|
+
".next",
|
|
134
|
+
".nuxt",
|
|
135
|
+
"coverage",
|
|
136
|
+
".turbo",
|
|
137
|
+
".cache"
|
|
138
|
+
];
|
|
139
|
+
function loadIgnorePatterns(cwd) {
|
|
140
|
+
const dir = cwd || process.cwd();
|
|
141
|
+
const ignorePath = join(dir, ".gaussignore");
|
|
142
|
+
if (!existsSync(ignorePath)) {
|
|
143
|
+
return [...DEFAULT_PATTERNS];
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const content = readFileSync(ignorePath, "utf-8");
|
|
147
|
+
const patterns = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
148
|
+
return patterns.length > 0 ? patterns : [...DEFAULT_PATTERNS];
|
|
149
|
+
} catch {
|
|
150
|
+
return [...DEFAULT_PATTERNS];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function shouldIgnore(filePath, patterns) {
|
|
154
|
+
const segments = filePath.split(/[/\\]/);
|
|
155
|
+
for (const pattern of patterns) {
|
|
156
|
+
if (segments.includes(pattern)) return true;
|
|
157
|
+
if (filePath === pattern || filePath.startsWith(pattern + "/") || filePath.startsWith(pattern + "\\")) return true;
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/cli/tools.ts
|
|
163
|
+
var GIT_EXEC_OPTS = { encoding: "utf8", maxBuffer: 10 * 1024 * 1024 };
|
|
164
|
+
function listDir(dirPath, pattern, ignorePatterns) {
|
|
165
|
+
const absDir = resolve(dirPath);
|
|
166
|
+
const results = [];
|
|
167
|
+
try {
|
|
168
|
+
const entries = readdirSync(absDir, { withFileTypes: true });
|
|
169
|
+
for (const entry of entries) {
|
|
170
|
+
if (pattern && !entry.name.includes(pattern)) continue;
|
|
171
|
+
const rel = relative(process.cwd(), join2(absDir, entry.name));
|
|
172
|
+
if (ignorePatterns && shouldIgnore(rel, ignorePatterns)) continue;
|
|
173
|
+
results.push(entry.isDirectory() ? `${rel}/` : rel);
|
|
174
|
+
}
|
|
175
|
+
} catch {
|
|
176
|
+
}
|
|
177
|
+
return results.slice(0, 50);
|
|
178
|
+
}
|
|
179
|
+
function searchInFiles(searchPattern, dirPath, maxResults = 50, ignorePatterns) {
|
|
180
|
+
const absDir = resolve(dirPath);
|
|
181
|
+
const results = [];
|
|
182
|
+
const visited = /* @__PURE__ */ new Set();
|
|
183
|
+
const MAX_DEPTH = 10;
|
|
184
|
+
function walk(dir, depth) {
|
|
185
|
+
if (results.length >= maxResults || depth > MAX_DEPTH) return;
|
|
186
|
+
try {
|
|
187
|
+
const realDir = realpathSync(dir);
|
|
188
|
+
if (visited.has(realDir)) return;
|
|
189
|
+
visited.add(realDir);
|
|
190
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
191
|
+
for (const entry of entries) {
|
|
192
|
+
if (results.length >= maxResults) return;
|
|
193
|
+
const fullPath = join2(dir, entry.name);
|
|
194
|
+
const relPath = relative(process.cwd(), fullPath);
|
|
195
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
196
|
+
if (ignorePatterns && shouldIgnore(relPath, ignorePatterns)) continue;
|
|
197
|
+
if (entry.isDirectory()) {
|
|
198
|
+
walk(fullPath, depth + 1);
|
|
199
|
+
} else if (entry.isFile()) {
|
|
200
|
+
try {
|
|
201
|
+
const content = readFileSync2(fullPath, "utf-8");
|
|
202
|
+
const lines = content.split("\n");
|
|
203
|
+
for (let i = 0; i < lines.length; i++) {
|
|
204
|
+
if (lines[i].includes(searchPattern)) {
|
|
205
|
+
results.push(`${relative(process.cwd(), fullPath)}:${i + 1}:${lines[i]}`);
|
|
206
|
+
if (results.length >= maxResults) return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
} catch {
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
} catch {
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
walk(absDir, 0);
|
|
217
|
+
return results;
|
|
218
|
+
}
|
|
219
|
+
function createCliTools(options) {
|
|
220
|
+
const ignorePatterns = loadIgnorePatterns();
|
|
221
|
+
return {
|
|
222
|
+
readFile: tool({
|
|
223
|
+
description: "Read a file from the filesystem",
|
|
224
|
+
parameters: z.object({
|
|
225
|
+
path: z.string().describe("Path to the file to read")
|
|
226
|
+
}),
|
|
227
|
+
execute: async ({ path }) => {
|
|
228
|
+
const result = readFile(path);
|
|
229
|
+
return { content: result.content, path: result.path };
|
|
230
|
+
}
|
|
231
|
+
}),
|
|
232
|
+
writeFile: tool({
|
|
233
|
+
description: "Write content to a file (creates or overwrites)",
|
|
234
|
+
parameters: z.object({
|
|
235
|
+
path: z.string().describe("Path to write to"),
|
|
236
|
+
content: z.string().describe("Content to write")
|
|
237
|
+
}),
|
|
238
|
+
execute: async ({ path, content }) => {
|
|
239
|
+
if (!options.yolo) {
|
|
240
|
+
const absPath2 = resolve(path);
|
|
241
|
+
let desc;
|
|
242
|
+
if (existsSync2(absPath2)) {
|
|
243
|
+
const existing = readFileSync2(absPath2, "utf-8");
|
|
244
|
+
const diff = generateUnifiedDiff(existing, content, path);
|
|
245
|
+
const diffLines = diff.split("\n");
|
|
246
|
+
const preview = diffLines.length > 30 ? diffLines.slice(0, 30).join("\n") + "\n..." : diff;
|
|
247
|
+
desc = `Write to ${path}
|
|
248
|
+
${preview}`;
|
|
249
|
+
} else {
|
|
250
|
+
const lineCount = content.split("\n").length;
|
|
251
|
+
desc = `Write to ${path} (new file, ${lineCount} lines)`;
|
|
252
|
+
}
|
|
253
|
+
const ok = await options.confirm(desc);
|
|
254
|
+
if (!ok) return { error: "User cancelled" };
|
|
255
|
+
}
|
|
256
|
+
const absPath = writeFile(path, content);
|
|
257
|
+
return { path: absPath, bytesWritten: content.length };
|
|
258
|
+
}
|
|
259
|
+
}),
|
|
260
|
+
bash: tool({
|
|
261
|
+
description: "Execute a bash command",
|
|
262
|
+
parameters: z.object({
|
|
263
|
+
command: z.string().describe("The bash command to execute")
|
|
264
|
+
}),
|
|
265
|
+
execute: async ({ command }) => {
|
|
266
|
+
if (!options.yolo) {
|
|
267
|
+
const ok = await options.confirm(`Run: ${command}`);
|
|
268
|
+
if (!ok) return { error: "User cancelled" };
|
|
269
|
+
}
|
|
270
|
+
return runBash(command);
|
|
271
|
+
}
|
|
272
|
+
}),
|
|
273
|
+
listFiles: tool({
|
|
274
|
+
description: "List files in a directory",
|
|
275
|
+
parameters: z.object({
|
|
276
|
+
path: z.string().describe("Directory path").default("."),
|
|
277
|
+
pattern: z.string().describe("Filename substring filter").optional()
|
|
278
|
+
}),
|
|
279
|
+
execute: async ({ path, pattern }) => {
|
|
280
|
+
const files = listDir(path, pattern, ignorePatterns);
|
|
281
|
+
return { files, count: files.length };
|
|
282
|
+
}
|
|
283
|
+
}),
|
|
284
|
+
searchFiles: tool({
|
|
285
|
+
description: "Search for a text pattern in files (recursive)",
|
|
286
|
+
parameters: z.object({
|
|
287
|
+
pattern: z.string().describe("The text pattern to search for"),
|
|
288
|
+
path: z.string().describe("Directory to search in").default(".")
|
|
289
|
+
}),
|
|
290
|
+
execute: async ({ pattern, path }) => {
|
|
291
|
+
const matches = searchInFiles(pattern, path, 50, ignorePatterns);
|
|
292
|
+
return { matches, count: matches.length };
|
|
293
|
+
}
|
|
294
|
+
}),
|
|
295
|
+
editFile: tool({
|
|
296
|
+
description: "Edit a file by replacing specific text. Use this instead of writeFile when making targeted changes to existing files. The old_str must match exactly one occurrence in the file.",
|
|
297
|
+
parameters: z.object({
|
|
298
|
+
path: z.string().describe("Path to the file to edit"),
|
|
299
|
+
old_str: z.string().min(1).describe("The exact text to find and replace (must match exactly one occurrence)"),
|
|
300
|
+
new_str: z.string().describe("The replacement text")
|
|
301
|
+
}),
|
|
302
|
+
execute: async ({ path, old_str, new_str }) => {
|
|
303
|
+
let content;
|
|
304
|
+
try {
|
|
305
|
+
content = readFile(path).content;
|
|
306
|
+
} catch (err) {
|
|
307
|
+
return { error: `Failed to read file: ${err.message}` };
|
|
308
|
+
}
|
|
309
|
+
let count = 0;
|
|
310
|
+
let idx = 0;
|
|
311
|
+
while ((idx = content.indexOf(old_str, idx)) !== -1) {
|
|
312
|
+
count++;
|
|
313
|
+
idx += old_str.length;
|
|
314
|
+
}
|
|
315
|
+
if (count === 0) {
|
|
316
|
+
return { error: `old_str not found in ${path}` };
|
|
317
|
+
}
|
|
318
|
+
if (count > 1) {
|
|
319
|
+
return { error: `old_str found ${count} times in ${path} \u2014 must match exactly once` };
|
|
320
|
+
}
|
|
321
|
+
const replaceIdx = content.indexOf(old_str);
|
|
322
|
+
const newContent = content.slice(0, replaceIdx) + new_str + content.slice(replaceIdx + old_str.length);
|
|
323
|
+
const diff = generateUnifiedDiff(content, newContent, path);
|
|
324
|
+
if (!options.yolo) {
|
|
325
|
+
const ok = await options.confirm(`Edit ${path}
|
|
326
|
+
${diff}`);
|
|
327
|
+
if (!ok) return { error: "User cancelled" };
|
|
328
|
+
}
|
|
329
|
+
const absPath = writeFile(path, newContent);
|
|
330
|
+
return { path: absPath };
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
createFile: tool({
|
|
334
|
+
description: "Create a new file. Fails if the file already exists. Use editFile for existing files.",
|
|
335
|
+
parameters: z.object({
|
|
336
|
+
path: z.string().describe("Path for the new file"),
|
|
337
|
+
content: z.string().describe("Content for the new file")
|
|
338
|
+
}),
|
|
339
|
+
execute: async ({ path, content }) => {
|
|
340
|
+
const absPath = resolve(path);
|
|
341
|
+
if (existsSync2(absPath)) {
|
|
342
|
+
return { error: `File already exists: ${absPath}. Use editFile to modify it.` };
|
|
343
|
+
}
|
|
344
|
+
if (!options.yolo) {
|
|
345
|
+
const lineCount = content.split("\n").length;
|
|
346
|
+
const ok = await options.confirm(`Create ${path} (${lineCount} lines)`);
|
|
347
|
+
if (!ok) return { error: "User cancelled" };
|
|
348
|
+
}
|
|
349
|
+
const written = writeFile(path, content);
|
|
350
|
+
return { path: written, bytesWritten: content.length };
|
|
351
|
+
}
|
|
352
|
+
}),
|
|
353
|
+
// ─── Git tools ────────────────────────────────────────────────────────
|
|
354
|
+
gitStatus: tool({
|
|
355
|
+
description: "Show git repository status including staged, unstaged, and untracked files",
|
|
356
|
+
parameters: z.object({}),
|
|
357
|
+
execute: async () => {
|
|
358
|
+
try {
|
|
359
|
+
const raw = execSync("git status --porcelain=v1", GIT_EXEC_OPTS).trim();
|
|
360
|
+
if (!raw) return { staged: [], unstaged: [], untracked: [], summary: "Clean working tree" };
|
|
361
|
+
const staged = [];
|
|
362
|
+
const unstaged = [];
|
|
363
|
+
const untracked = [];
|
|
364
|
+
for (const line of raw.split("\n")) {
|
|
365
|
+
const x = line[0];
|
|
366
|
+
const y = line[1];
|
|
367
|
+
const file = line.slice(3);
|
|
368
|
+
if (x === "?") {
|
|
369
|
+
untracked.push(file);
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (x !== " " && x !== "?") staged.push(`${x} ${file}`);
|
|
373
|
+
if (y !== " " && y !== "?") unstaged.push(`${y} ${file}`);
|
|
374
|
+
}
|
|
375
|
+
return { staged, unstaged, untracked, summary: `${staged.length} staged, ${unstaged.length} unstaged, ${untracked.length} untracked` };
|
|
376
|
+
} catch (err) {
|
|
377
|
+
return { error: err.message };
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}),
|
|
381
|
+
gitDiff: tool({
|
|
382
|
+
description: "Show git diff. By default shows unstaged changes. Use staged:true for staged changes, or provide a file path.",
|
|
383
|
+
parameters: z.object({
|
|
384
|
+
staged: z.boolean().optional().describe("Show staged changes instead of unstaged"),
|
|
385
|
+
path: z.string().optional().describe("Limit diff to a specific file")
|
|
386
|
+
}),
|
|
387
|
+
execute: async ({ staged, path: filePath }) => {
|
|
388
|
+
try {
|
|
389
|
+
const args = ["diff"];
|
|
390
|
+
if (staged) args.push("--cached");
|
|
391
|
+
if (filePath) args.push("--", filePath);
|
|
392
|
+
const result = spawnSync("git", args, { encoding: "utf8", maxBuffer: 10 * 1024 * 1024 });
|
|
393
|
+
if (result.status !== 0) return { error: result.stderr || "git diff failed" };
|
|
394
|
+
const output = (result.stdout || "").trim();
|
|
395
|
+
return { diff: output || "(no changes)" };
|
|
396
|
+
} catch (err) {
|
|
397
|
+
return { error: err.message };
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}),
|
|
401
|
+
gitCommit: tool({
|
|
402
|
+
description: "Stage files and create a git commit. Requires confirmation unless in yolo mode.",
|
|
403
|
+
parameters: z.object({
|
|
404
|
+
message: z.string().describe("Commit message"),
|
|
405
|
+
files: z.array(z.string()).optional().describe("Files to stage. If omitted, stages all changes.")
|
|
406
|
+
}),
|
|
407
|
+
execute: async ({ message, files }) => {
|
|
408
|
+
try {
|
|
409
|
+
const prevStaged = execSync("git diff --cached --name-only", GIT_EXEC_OPTS).trim();
|
|
410
|
+
if (files && files.length > 0) {
|
|
411
|
+
const addResult = spawnSync("git", ["add", "--", ...files], { encoding: "utf8", maxBuffer: 10 * 1024 * 1024 });
|
|
412
|
+
if (addResult.status !== 0) return { error: addResult.stderr || "git add failed" };
|
|
413
|
+
} else {
|
|
414
|
+
execSync("git add -A", GIT_EXEC_OPTS);
|
|
415
|
+
}
|
|
416
|
+
const stagedSummary = execSync("git diff --cached --stat", GIT_EXEC_OPTS).trim();
|
|
417
|
+
if (!stagedSummary) return { error: "Nothing to commit after staging" };
|
|
418
|
+
if (!options.yolo) {
|
|
419
|
+
const ok = await options.confirm(`Git commit: "${message}"
|
|
420
|
+
${stagedSummary}`);
|
|
421
|
+
if (!ok) {
|
|
422
|
+
execSync("git reset HEAD --quiet", GIT_EXEC_OPTS);
|
|
423
|
+
if (prevStaged) {
|
|
424
|
+
const prevFiles = prevStaged.split("\n").filter(Boolean);
|
|
425
|
+
spawnSync("git", ["add", "--", ...prevFiles], { encoding: "utf8" });
|
|
426
|
+
}
|
|
427
|
+
return { error: "User cancelled" };
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const result = spawnSync("git", ["commit", "-m", message], { encoding: "utf8", maxBuffer: 10 * 1024 * 1024 });
|
|
431
|
+
if (result.status !== 0) return { error: result.stderr || result.stdout || "Commit failed" };
|
|
432
|
+
return { output: result.stdout.trim() };
|
|
433
|
+
} catch (err) {
|
|
434
|
+
return { error: err.message };
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}),
|
|
438
|
+
gitLog: tool({
|
|
439
|
+
description: "Show recent git commit history",
|
|
440
|
+
parameters: z.object({
|
|
441
|
+
count: z.number().optional().default(10).describe("Number of commits to show")
|
|
442
|
+
}),
|
|
443
|
+
execute: async ({ count = 10 }) => {
|
|
444
|
+
try {
|
|
445
|
+
const output = execSync(`git log --oneline -${count}`, GIT_EXEC_OPTS).trim();
|
|
446
|
+
return { log: output || "(no commits)" };
|
|
447
|
+
} catch (err) {
|
|
448
|
+
return { error: err.message };
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}),
|
|
452
|
+
gitBranch: tool({
|
|
453
|
+
description: "List, create, or switch git branches",
|
|
454
|
+
parameters: z.object({
|
|
455
|
+
action: z.enum(["list", "create", "switch"]).optional().default("list"),
|
|
456
|
+
name: z.string().optional().describe("Branch name (required for create/switch)")
|
|
457
|
+
}),
|
|
458
|
+
execute: async ({ action = "list", name }) => {
|
|
459
|
+
try {
|
|
460
|
+
if (action === "list") {
|
|
461
|
+
const output = execSync("git branch -a", GIT_EXEC_OPTS).trim();
|
|
462
|
+
return { branches: output };
|
|
463
|
+
}
|
|
464
|
+
if (!name) return { error: "Branch name is required for create/switch" };
|
|
465
|
+
if (!options.yolo) {
|
|
466
|
+
const desc = action === "create" ? `Create branch: ${name}` : `Switch to branch: ${name}`;
|
|
467
|
+
const ok = await options.confirm(desc);
|
|
468
|
+
if (!ok) return { error: "User cancelled" };
|
|
469
|
+
}
|
|
470
|
+
if (action === "create") {
|
|
471
|
+
execSync(`git checkout -b '${name.replace(/'/g, "'\\''")}'`, GIT_EXEC_OPTS);
|
|
472
|
+
return { output: `Created and switched to branch '${name}'` };
|
|
473
|
+
}
|
|
474
|
+
execSync(`git checkout '${name.replace(/'/g, "'\\''")}'`, GIT_EXEC_OPTS);
|
|
475
|
+
return { output: `Switched to branch '${name}'` };
|
|
476
|
+
} catch (err) {
|
|
477
|
+
return { error: err.message };
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
})
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export {
|
|
485
|
+
createCliTools
|
|
486
|
+
};
|
|
487
|
+
//# sourceMappingURL=chunk-WKKQ443C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/tools.ts","../src/cli/diff-utils.ts","../src/cli/gauss-ignore.ts"],"sourcesContent":["// =============================================================================\n// CLI Tools — AI-driven tool definitions for agentic mode\n// =============================================================================\n\nimport { z } from \"zod\";\nimport { tool } from \"../core/llm/index.js\";\nimport { readFileSync, readdirSync, realpathSync, existsSync } from \"node:fs\";\nimport { execSync, spawnSync } from \"node:child_process\";\nimport { resolve, join, relative } from \"node:path\";\nimport { readFile, writeFile } from \"./commands/files.js\";\nimport { runBash } from \"./commands/bash.js\";\nimport { generateUnifiedDiff } from \"./diff-utils.js\";\nimport { loadIgnorePatterns, shouldIgnore } from \"./gauss-ignore.js\";\n\nconst GIT_EXEC_OPTS = { encoding: \"utf8\" as const, maxBuffer: 10 * 1024 * 1024 };\n\nfunction listDir(dirPath: string, pattern?: string, ignorePatterns?: string[]): string[] {\n const absDir = resolve(dirPath);\n const results: string[] = [];\n try {\n const entries = readdirSync(absDir, { withFileTypes: true });\n for (const entry of entries) {\n if (pattern && !entry.name.includes(pattern)) continue;\n const rel = relative(process.cwd(), join(absDir, entry.name));\n if (ignorePatterns && shouldIgnore(rel, ignorePatterns)) continue;\n results.push(entry.isDirectory() ? `${rel}/` : rel);\n }\n } catch {\n // directory not readable\n }\n return results.slice(0, 50);\n}\n\nfunction searchInFiles(searchPattern: string, dirPath: string, maxResults = 50, ignorePatterns?: string[]): string[] {\n const absDir = resolve(dirPath);\n const results: string[] = [];\n const visited = new Set<string>();\n const MAX_DEPTH = 10;\n\n function walk(dir: string, depth: number): void {\n if (results.length >= maxResults || depth > MAX_DEPTH) return;\n try {\n const realDir = realpathSync(dir);\n if (visited.has(realDir)) return;\n visited.add(realDir);\n\n const entries = readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (results.length >= maxResults) return;\n const fullPath = join(dir, entry.name);\n const relPath = relative(process.cwd(), fullPath);\n if (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n if (ignorePatterns && shouldIgnore(relPath, ignorePatterns)) continue;\n if (entry.isDirectory()) {\n walk(fullPath, depth + 1);\n } else if (entry.isFile()) {\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n for (let i = 0; i < lines.length; i++) {\n if (lines[i]!.includes(searchPattern)) {\n results.push(`${relative(process.cwd(), fullPath)}:${i + 1}:${lines[i]}`);\n if (results.length >= maxResults) return;\n }\n }\n } catch {\n // skip binary or unreadable files\n }\n }\n }\n } catch {\n // directory not readable\n }\n }\n\n walk(absDir, 0);\n return results;\n}\n\nexport function createCliTools(options: {\n yolo: boolean;\n confirm: (description: string) => Promise<boolean>;\n}) {\n const ignorePatterns = loadIgnorePatterns();\n\n return {\n readFile: tool({\n description: \"Read a file from the filesystem\",\n parameters: z.object({\n path: z.string().describe(\"Path to the file to read\"),\n }),\n execute: async ({ path }) => {\n const result = readFile(path);\n return { content: result.content, path: result.path };\n },\n }),\n writeFile: tool({\n description: \"Write content to a file (creates or overwrites)\",\n parameters: z.object({\n path: z.string().describe(\"Path to write to\"),\n content: z.string().describe(\"Content to write\"),\n }),\n execute: async ({ path, content }) => {\n if (!options.yolo) {\n const absPath = resolve(path);\n let desc: string;\n if (existsSync(absPath)) {\n const existing = readFileSync(absPath, \"utf-8\");\n const diff = generateUnifiedDiff(existing, content, path);\n const diffLines = diff.split(\"\\n\");\n const preview = diffLines.length > 30\n ? diffLines.slice(0, 30).join(\"\\n\") + \"\\n...\"\n : diff;\n desc = `Write to ${path}\\n${preview}`;\n } else {\n const lineCount = content.split(\"\\n\").length;\n desc = `Write to ${path} (new file, ${lineCount} lines)`;\n }\n const ok = await options.confirm(desc);\n if (!ok) return { error: \"User cancelled\" };\n }\n const absPath = writeFile(path, content);\n return { path: absPath, bytesWritten: content.length };\n },\n }),\n bash: tool({\n description: \"Execute a bash command\",\n parameters: z.object({\n command: z.string().describe(\"The bash command to execute\"),\n }),\n execute: async ({ command }) => {\n if (!options.yolo) {\n const ok = await options.confirm(`Run: ${command}`);\n if (!ok) return { error: \"User cancelled\" };\n }\n return runBash(command);\n },\n }),\n listFiles: tool({\n description: \"List files in a directory\",\n parameters: z.object({\n path: z.string().describe(\"Directory path\").default(\".\"),\n pattern: z.string().describe(\"Filename substring filter\").optional(),\n }),\n execute: async ({ path, pattern }) => {\n const files = listDir(path, pattern, ignorePatterns);\n return { files, count: files.length };\n },\n }),\n searchFiles: tool({\n description: \"Search for a text pattern in files (recursive)\",\n parameters: z.object({\n pattern: z.string().describe(\"The text pattern to search for\"),\n path: z.string().describe(\"Directory to search in\").default(\".\"),\n }),\n execute: async ({ pattern, path }) => {\n const matches = searchInFiles(pattern, path, 50, ignorePatterns);\n return { matches, count: matches.length };\n },\n }),\n editFile: tool({\n description:\n \"Edit a file by replacing specific text. Use this instead of writeFile when making targeted changes to existing files. The old_str must match exactly one occurrence in the file.\",\n parameters: z.object({\n path: z.string().describe(\"Path to the file to edit\"),\n old_str: z.string().min(1).describe(\"The exact text to find and replace (must match exactly one occurrence)\"),\n new_str: z.string().describe(\"The replacement text\"),\n }),\n execute: async ({ path, old_str, new_str }) => {\n let content: string;\n try {\n content = readFile(path).content;\n } catch (err) {\n return { error: `Failed to read file: ${(err as Error).message}` };\n }\n\n // Count occurrences\n let count = 0;\n let idx = 0;\n while ((idx = content.indexOf(old_str, idx)) !== -1) {\n count++;\n idx += old_str.length;\n }\n\n if (count === 0) {\n return { error: `old_str not found in ${path}` };\n }\n if (count > 1) {\n return { error: `old_str found ${count} times in ${path} — must match exactly once` };\n }\n\n const replaceIdx = content.indexOf(old_str);\n const newContent = content.slice(0, replaceIdx) + new_str + content.slice(replaceIdx + old_str.length);\n const diff = generateUnifiedDiff(content, newContent, path);\n\n if (!options.yolo) {\n const ok = await options.confirm(`Edit ${path}\\n${diff}`);\n if (!ok) return { error: \"User cancelled\" };\n }\n\n const absPath = writeFile(path, newContent);\n return { path: absPath };\n },\n }),\n createFile: tool({\n description: \"Create a new file. Fails if the file already exists. Use editFile for existing files.\",\n parameters: z.object({\n path: z.string().describe(\"Path for the new file\"),\n content: z.string().describe(\"Content for the new file\"),\n }),\n execute: async ({ path, content }) => {\n const absPath = resolve(path);\n if (existsSync(absPath)) {\n return { error: `File already exists: ${absPath}. Use editFile to modify it.` };\n }\n\n if (!options.yolo) {\n const lineCount = content.split(\"\\n\").length;\n const ok = await options.confirm(`Create ${path} (${lineCount} lines)`);\n if (!ok) return { error: \"User cancelled\" };\n }\n\n const written = writeFile(path, content);\n return { path: written, bytesWritten: content.length };\n },\n }),\n\n // ─── Git tools ────────────────────────────────────────────────────────\n\n gitStatus: tool({\n description: \"Show git repository status including staged, unstaged, and untracked files\",\n parameters: z.object({}),\n execute: async () => {\n try {\n const raw = execSync(\"git status --porcelain=v1\", GIT_EXEC_OPTS).trim();\n if (!raw) return { staged: [], unstaged: [], untracked: [], summary: \"Clean working tree\" };\n const staged: string[] = [];\n const unstaged: string[] = [];\n const untracked: string[] = [];\n for (const line of raw.split(\"\\n\")) {\n const x = line[0]!;\n const y = line[1]!;\n const file = line.slice(3);\n if (x === \"?\") { untracked.push(file); continue; }\n if (x !== \" \" && x !== \"?\") staged.push(`${x} ${file}`);\n if (y !== \" \" && y !== \"?\") unstaged.push(`${y} ${file}`);\n }\n return { staged, unstaged, untracked, summary: `${staged.length} staged, ${unstaged.length} unstaged, ${untracked.length} untracked` };\n } catch (err) {\n return { error: (err as Error).message };\n }\n },\n }),\n\n gitDiff: tool({\n description: \"Show git diff. By default shows unstaged changes. Use staged:true for staged changes, or provide a file path.\",\n parameters: z.object({\n staged: z.boolean().optional().describe(\"Show staged changes instead of unstaged\"),\n path: z.string().optional().describe(\"Limit diff to a specific file\"),\n }),\n execute: async ({ staged, path: filePath }) => {\n try {\n const args = [\"diff\"];\n if (staged) args.push(\"--cached\");\n if (filePath) args.push(\"--\", filePath);\n const result = spawnSync(\"git\", args, { encoding: \"utf8\", maxBuffer: 10 * 1024 * 1024 });\n if (result.status !== 0) return { error: result.stderr || \"git diff failed\" };\n const output = (result.stdout || \"\").trim();\n return { diff: output || \"(no changes)\" };\n } catch (err) {\n return { error: (err as Error).message };\n }\n },\n }),\n\n gitCommit: tool({\n description: \"Stage files and create a git commit. Requires confirmation unless in yolo mode.\",\n parameters: z.object({\n message: z.string().describe(\"Commit message\"),\n files: z.array(z.string()).optional().describe(\"Files to stage. If omitted, stages all changes.\"),\n }),\n execute: async ({ message, files }) => {\n try {\n // Capture pre-existing staged files for rollback\n const prevStaged = execSync(\"git diff --cached --name-only\", GIT_EXEC_OPTS).trim();\n\n // Stage\n if (files && files.length > 0) {\n const addResult = spawnSync(\"git\", [\"add\", \"--\", ...files], { encoding: \"utf8\", maxBuffer: 10 * 1024 * 1024 });\n if (addResult.status !== 0) return { error: addResult.stderr || \"git add failed\" };\n } else {\n execSync(\"git add -A\", GIT_EXEC_OPTS);\n }\n\n const stagedSummary = execSync(\"git diff --cached --stat\", GIT_EXEC_OPTS).trim();\n if (!stagedSummary) return { error: \"Nothing to commit after staging\" };\n\n if (!options.yolo) {\n const ok = await options.confirm(`Git commit: \"${message}\"\\n${stagedSummary}`);\n if (!ok) {\n // Restore original staging state: unstage all, then re-stage previous\n execSync(\"git reset HEAD --quiet\", GIT_EXEC_OPTS);\n if (prevStaged) {\n const prevFiles = prevStaged.split(\"\\n\").filter(Boolean);\n spawnSync(\"git\", [\"add\", \"--\", ...prevFiles], { encoding: \"utf8\" });\n }\n return { error: \"User cancelled\" };\n }\n }\n\n // Use spawnSync to avoid shell injection with the message\n const result = spawnSync(\"git\", [\"commit\", \"-m\", message], { encoding: \"utf8\", maxBuffer: 10 * 1024 * 1024 });\n if (result.status !== 0) return { error: result.stderr || result.stdout || \"Commit failed\" };\n return { output: result.stdout.trim() };\n } catch (err) {\n return { error: (err as Error).message };\n }\n },\n }),\n\n gitLog: tool({\n description: \"Show recent git commit history\",\n parameters: z.object({\n count: z.number().optional().default(10).describe(\"Number of commits to show\"),\n }),\n execute: async ({ count = 10 }) => {\n try {\n const output = execSync(`git log --oneline -${count}`, GIT_EXEC_OPTS).trim();\n return { log: output || \"(no commits)\" };\n } catch (err) {\n return { error: (err as Error).message };\n }\n },\n }),\n\n gitBranch: tool({\n description: \"List, create, or switch git branches\",\n parameters: z.object({\n action: z.enum([\"list\", \"create\", \"switch\"]).optional().default(\"list\"),\n name: z.string().optional().describe(\"Branch name (required for create/switch)\"),\n }),\n execute: async ({ action = \"list\", name }) => {\n try {\n if (action === \"list\") {\n const output = execSync(\"git branch -a\", GIT_EXEC_OPTS).trim();\n return { branches: output };\n }\n if (!name) return { error: \"Branch name is required for create/switch\" };\n\n if (!options.yolo) {\n const desc = action === \"create\" ? `Create branch: ${name}` : `Switch to branch: ${name}`;\n const ok = await options.confirm(desc);\n if (!ok) return { error: \"User cancelled\" };\n }\n\n if (action === \"create\") {\n execSync(`git checkout -b '${name.replace(/'/g, \"'\\\\''\")}'`, GIT_EXEC_OPTS);\n return { output: `Created and switched to branch '${name}'` };\n }\n // switch\n execSync(`git checkout '${name.replace(/'/g, \"'\\\\''\")}'`, GIT_EXEC_OPTS);\n return { output: `Switched to branch '${name}'` };\n } catch (err) {\n return { error: (err as Error).message };\n }\n },\n }),\n };\n}\n","// =============================================================================\n// CLI Diff Utils — Unified diff generator (zero dependencies)\n// =============================================================================\n\nimport { color } from \"./format.js\";\n\n/**\n * Generate a colored unified diff between two strings.\n * Uses a simple LCS-based line diff with 3 lines of context.\n */\nexport function generateUnifiedDiff(\n oldContent: string,\n newContent: string,\n filePath: string,\n): string {\n const oldLines = oldContent.split(\"\\n\");\n const newLines = newContent.split(\"\\n\");\n\n const MAX_DIFF_LINES = 1000;\n if (oldLines.length > MAX_DIFF_LINES || newLines.length > MAX_DIFF_LINES) {\n const removed = oldLines.length;\n const added = newLines.length;\n return color(\"dim\", `(file too large for inline diff — ${removed} old lines, ${added} new lines)`);\n }\n\n // Compute edit script using simple LCS\n const ops = computeEditOps(oldLines, newLines);\n\n if (ops.every((op) => op.type === \"equal\")) return \"\";\n\n const hunks = buildHunks(ops, 3);\n const lines: string[] = [\n color(\"dim\", `--- a/${filePath}`),\n color(\"dim\", `+++ b/${filePath}`),\n ];\n\n for (const hunk of hunks) {\n lines.push(\n color(\"cyan\", `@@ -${hunk.oldStart + 1},${hunk.oldCount} +${hunk.newStart + 1},${hunk.newCount} @@`),\n );\n for (const op of hunk.ops) {\n if (op.type === \"equal\") {\n lines.push(` ${op.line}`);\n } else if (op.type === \"delete\") {\n lines.push(color(\"red\", `-${op.line}`));\n } else {\n lines.push(color(\"green\", `+${op.line}`));\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\ninterface EditOp {\n type: \"equal\" | \"delete\" | \"insert\";\n line: string;\n oldIdx: number;\n newIdx: number;\n}\n\nfunction computeEditOps(oldLines: string[], newLines: string[]): EditOp[] {\n const m = oldLines.length;\n const n = newLines.length;\n\n // Build LCS table\n const dp: number[][] = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));\n for (let i = 1; i <= m; i++) {\n for (let j = 1; j <= n; j++) {\n if (oldLines[i - 1] === newLines[j - 1]) {\n dp[i]![j] = dp[i - 1]![j - 1]! + 1;\n } else {\n dp[i]![j] = Math.max(dp[i - 1]![j]!, dp[i]![j - 1]!);\n }\n }\n }\n\n // Backtrack to produce edit ops\n const ops: EditOp[] = [];\n let i = m;\n let j = n;\n while (i > 0 || j > 0) {\n if (i > 0 && j > 0 && oldLines[i - 1] === newLines[j - 1]) {\n ops.push({ type: \"equal\", line: oldLines[i - 1]!, oldIdx: i - 1, newIdx: j - 1 });\n i--;\n j--;\n } else if (j > 0 && (i === 0 || dp[i]![j - 1]! >= dp[i - 1]![j]!)) {\n ops.push({ type: \"insert\", line: newLines[j - 1]!, oldIdx: i, newIdx: j - 1 });\n j--;\n } else {\n ops.push({ type: \"delete\", line: oldLines[i - 1]!, oldIdx: i - 1, newIdx: j });\n i--;\n }\n }\n ops.reverse();\n return ops;\n}\n\ninterface Hunk {\n oldStart: number;\n oldCount: number;\n newStart: number;\n newCount: number;\n ops: EditOp[];\n}\n\nfunction buildHunks(ops: EditOp[], context: number): Hunk[] {\n // Find ranges of changes, expand by context, merge overlapping\n const changeIndices: number[] = [];\n for (let i = 0; i < ops.length; i++) {\n if (ops[i]!.type !== \"equal\") changeIndices.push(i);\n }\n if (changeIndices.length === 0) return [];\n\n // Build ranges with context\n const ranges: Array<[number, number]> = [];\n let start = Math.max(0, changeIndices[0]! - context);\n let end = Math.min(ops.length - 1, changeIndices[0]! + context);\n\n for (let k = 1; k < changeIndices.length; k++) {\n const cs = Math.max(0, changeIndices[k]! - context);\n const ce = Math.min(ops.length - 1, changeIndices[k]! + context);\n if (cs <= end + 1) {\n end = ce;\n } else {\n ranges.push([start, end]);\n start = cs;\n end = ce;\n }\n }\n ranges.push([start, end]);\n\n // Convert ranges to hunks\n return ranges.map(([s, e]) => {\n const hunkOps = ops.slice(s, e + 1);\n let oldStart = 0;\n let newStart = 0;\n // Count old/new positions up to hunk start\n for (let i = 0; i < s; i++) {\n if (ops[i]!.type === \"equal\" || ops[i]!.type === \"delete\") oldStart++;\n if (ops[i]!.type === \"equal\" || ops[i]!.type === \"insert\") newStart++;\n }\n let oldCount = 0;\n let newCount = 0;\n for (const op of hunkOps) {\n if (op.type === \"equal\" || op.type === \"delete\") oldCount++;\n if (op.type === \"equal\" || op.type === \"insert\") newCount++;\n }\n return { oldStart, newStart, oldCount, newCount, ops: hunkOps };\n });\n}\n","// =============================================================================\n// .gaussignore — Load and apply ignore patterns\n// =============================================================================\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nconst DEFAULT_PATTERNS = [\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \"__pycache__\",\n \"target\",\n \".next\",\n \".nuxt\",\n \"coverage\",\n \".turbo\",\n \".cache\",\n];\n\nexport function loadIgnorePatterns(cwd?: string): string[] {\n const dir = cwd || process.cwd();\n const ignorePath = join(dir, \".gaussignore\");\n\n if (!existsSync(ignorePath)) {\n return [...DEFAULT_PATTERNS];\n }\n\n try {\n const content = readFileSync(ignorePath, \"utf-8\");\n const patterns = content\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line.length > 0 && !line.startsWith(\"#\"));\n\n return patterns.length > 0 ? patterns : [...DEFAULT_PATTERNS];\n } catch {\n return [...DEFAULT_PATTERNS];\n }\n}\n\nexport function shouldIgnore(filePath: string, patterns: string[]): boolean {\n const segments = filePath.split(/[/\\\\]/);\n for (const pattern of patterns) {\n // Check if any path segment matches the pattern exactly\n if (segments.includes(pattern)) return true;\n // Check if the full path starts with the pattern as a complete segment\n if (filePath === pattern || filePath.startsWith(pattern + \"/\") || filePath.startsWith(pattern + \"\\\\\")) return true;\n }\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;AAIA,SAAS,SAAS;AAElB,SAAS,gBAAAA,eAAc,aAAa,cAAc,cAAAC,mBAAkB;AACpE,SAAS,UAAU,iBAAiB;AACpC,SAAS,SAAS,QAAAC,OAAM,gBAAgB;;;ACEjC,S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