usemint-cli 0.2.0-beta.2 → 0.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +157 -68
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4474,7 +4474,7 @@ function InputBox({
|
|
|
4474
4474
|
),
|
|
4475
4475
|
/* @__PURE__ */ jsxs6(Box6, { borderStyle: "single", borderColor: "cyan", paddingX: 1, flexDirection: "row", children: [
|
|
4476
4476
|
/* @__PURE__ */ jsx6(Box6, { flexGrow: 1, children: value.length === 0 ? /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
4477
|
-
'Ask anything\u2026 or try "
|
|
4477
|
+
'Ask anything\u2026 or try "add a pricing section"',
|
|
4478
4478
|
/* @__PURE__ */ jsx6(Text6, { inverse: true, children: " " })
|
|
4479
4479
|
] }) : /* @__PURE__ */ jsxs6(Text6, { children: [
|
|
4480
4480
|
before,
|
|
@@ -4560,7 +4560,7 @@ function StatusBar({
|
|
|
4560
4560
|
/* @__PURE__ */ jsxs7(Box7, { flexShrink: 0, gap: 0, children: [
|
|
4561
4561
|
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: " \u2502 " }),
|
|
4562
4562
|
/* @__PURE__ */ jsx7(Text7, { color: modeColor(agentMode), children: agentMode }),
|
|
4563
|
-
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: " \u2502 v0.2.0" }),
|
|
4563
|
+
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: " \u2502 v0.2.0-beta" }),
|
|
4564
4564
|
inspectorHint && /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
4565
4565
|
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: " \u2502 " }),
|
|
4566
4566
|
/* @__PURE__ */ jsx7(Text7, { dimColor: true, children: inspectorHint })
|
|
@@ -4577,69 +4577,57 @@ var init_StatusBar = __esm({
|
|
|
4577
4577
|
// src/tui/components/WelcomeScreen.tsx
|
|
4578
4578
|
import { Box as Box8, Text as Text8 } from "ink";
|
|
4579
4579
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4580
|
-
function WelcomeScreen({
|
|
4581
|
-
modelCount = 18,
|
|
4582
|
-
agentCount = 4,
|
|
4583
|
-
savingsLabel = "97%"
|
|
4584
|
-
}) {
|
|
4580
|
+
function WelcomeScreen() {
|
|
4585
4581
|
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", alignItems: "center", flexGrow: 1, paddingTop: 1, children: [
|
|
4586
4582
|
/* @__PURE__ */ jsx8(Box8, { flexDirection: "column", alignItems: "center", children: MINT_LOGO.map((line, i) => /* @__PURE__ */ jsx8(Text8, { color: "cyan", children: line }, i)) }),
|
|
4587
|
-
/* @__PURE__ */ jsx8(Box8, { marginTop: 0, children: /* @__PURE__ */ jsx8(Text8, {
|
|
4583
|
+
/* @__PURE__ */ jsx8(Box8, { marginTop: 0, children: /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " AI coding assistant \xB7 under a penny per task" }) }),
|
|
4588
4584
|
/* @__PURE__ */ jsxs8(Box8, { marginTop: 1, gap: 4, children: [
|
|
4589
4585
|
/* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", alignItems: "center", children: [
|
|
4590
|
-
/* @__PURE__ */ jsx8(Text8, { color: "cyan", bold: true, children:
|
|
4591
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "
|
|
4586
|
+
/* @__PURE__ */ jsx8(Text8, { color: "cyan", bold: true, children: "13" }),
|
|
4587
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "tools" })
|
|
4592
4588
|
] }),
|
|
4593
4589
|
/* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", alignItems: "center", children: [
|
|
4594
|
-
/* @__PURE__ */ jsx8(Text8, { color: "cyan", bold: true, children:
|
|
4595
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "
|
|
4590
|
+
/* @__PURE__ */ jsx8(Text8, { color: "cyan", bold: true, children: "8" }),
|
|
4591
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "providers" })
|
|
4596
4592
|
] }),
|
|
4597
4593
|
/* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", alignItems: "center", children: [
|
|
4598
|
-
/* @__PURE__ */ jsx8(Text8, { color: "cyan", bold: true, children:
|
|
4594
|
+
/* @__PURE__ */ jsx8(Text8, { color: "cyan", bold: true, children: "98%" }),
|
|
4599
4595
|
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "cheaper" })
|
|
4600
4596
|
] })
|
|
4601
4597
|
] }),
|
|
4602
4598
|
/* @__PURE__ */ jsxs8(Box8, { marginTop: 1, gap: 2, children: [
|
|
4603
4599
|
/* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 1, width: 30, children: [
|
|
4604
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, bold: true, children: "
|
|
4600
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, bold: true, children: "COMMANDS" }),
|
|
4605
4601
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4606
|
-
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "
|
|
4607
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2014
|
|
4602
|
+
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "/help " }),
|
|
4603
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2014 show all commands" })
|
|
4608
4604
|
] }),
|
|
4609
4605
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4610
|
-
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "/
|
|
4611
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2014
|
|
4606
|
+
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "/auto " }),
|
|
4607
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2014 skip approvals" })
|
|
4612
4608
|
] }),
|
|
4613
4609
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4614
|
-
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "/
|
|
4615
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2014
|
|
4610
|
+
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "/yolo " }),
|
|
4611
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2014 full autonomy" })
|
|
4616
4612
|
] }),
|
|
4617
4613
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4618
|
-
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "/usage
|
|
4614
|
+
/* @__PURE__ */ jsx8(Text8, { color: "cyan", children: "/usage " }),
|
|
4619
4615
|
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2014 session stats" })
|
|
4620
4616
|
] })
|
|
4621
4617
|
] }),
|
|
4622
4618
|
/* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 1, width: 30, children: [
|
|
4623
4619
|
/* @__PURE__ */ jsx8(Text8, { dimColor: true, bold: true, children: "KEYBOARD" }),
|
|
4624
|
-
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4625
|
-
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "Esc " }),
|
|
4626
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2192 normal mode" })
|
|
4627
|
-
] }),
|
|
4628
4620
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4629
4621
|
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "i " }),
|
|
4630
4622
|
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2192 insert mode" })
|
|
4631
4623
|
] }),
|
|
4632
4624
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4633
|
-
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "
|
|
4634
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2192
|
|
4635
|
-
] }),
|
|
4636
|
-
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4637
|
-
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "Tab " }),
|
|
4638
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2192 live inspector" })
|
|
4625
|
+
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "Esc " }),
|
|
4626
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2192 normal mode" })
|
|
4639
4627
|
] }),
|
|
4640
4628
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4641
|
-
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "
|
|
4642
|
-
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2192
|
|
4629
|
+
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "Enter " }),
|
|
4630
|
+
/* @__PURE__ */ jsx8(Text8, { dimColor: true, children: " \u2192 send message" })
|
|
4643
4631
|
] }),
|
|
4644
4632
|
/* @__PURE__ */ jsxs8(Text8, { children: [
|
|
4645
4633
|
/* @__PURE__ */ jsx8(Text8, { color: "yellow", children: "Ctrl+C" }),
|
|
@@ -11107,9 +11095,9 @@ function updateMemory(cwd, update) {
|
|
|
11107
11095
|
sessionSummaries: []
|
|
11108
11096
|
};
|
|
11109
11097
|
if (update.editedFiles) {
|
|
11110
|
-
const combined = [.../* @__PURE__ */ new Set([...update.editedFiles, ...existing.recentFiles])];
|
|
11098
|
+
const combined = [.../* @__PURE__ */ new Set([...update.editedFiles, ...existing.recentFiles ?? []])];
|
|
11111
11099
|
existing.recentFiles = combined.slice(0, MAX_RECENT_FILES);
|
|
11112
|
-
const dirs = new Set(existing.activeDirectories);
|
|
11100
|
+
const dirs = new Set(existing.activeDirectories ?? []);
|
|
11113
11101
|
for (const f of update.editedFiles) {
|
|
11114
11102
|
const parts = f.split("/");
|
|
11115
11103
|
if (parts.length > 1) dirs.add(parts.slice(0, -1).join("/"));
|
|
@@ -11119,7 +11107,7 @@ function updateMemory(cwd, update) {
|
|
|
11119
11107
|
if (update.sessionSummary) {
|
|
11120
11108
|
existing.sessionSummaries = [
|
|
11121
11109
|
update.sessionSummary,
|
|
11122
|
-
...existing.sessionSummaries
|
|
11110
|
+
...existing.sessionSummaries ?? []
|
|
11123
11111
|
].slice(0, MAX_SUMMARIES);
|
|
11124
11112
|
}
|
|
11125
11113
|
if (update.projectDescription) existing.projectDescription = update.projectDescription;
|
|
@@ -11135,13 +11123,13 @@ function formatMemoryForPrompt(memory) {
|
|
|
11135
11123
|
if (memory.language) {
|
|
11136
11124
|
parts.push(`Language: ${memory.language}`);
|
|
11137
11125
|
}
|
|
11138
|
-
if (memory.recentFiles
|
|
11126
|
+
if (memory.recentFiles?.length > 0) {
|
|
11139
11127
|
parts.push(`Recently edited files: ${memory.recentFiles.slice(0, 10).join(", ")}`);
|
|
11140
11128
|
}
|
|
11141
|
-
if (memory.activeDirectories
|
|
11129
|
+
if (memory.activeDirectories?.length > 0) {
|
|
11142
11130
|
parts.push(`Active directories: ${memory.activeDirectories.join(", ")}`);
|
|
11143
11131
|
}
|
|
11144
|
-
if (memory.sessionSummaries
|
|
11132
|
+
if (memory.sessionSummaries?.length > 0) {
|
|
11145
11133
|
parts.push(`Recent session: ${memory.sessionSummaries[0]}`);
|
|
11146
11134
|
}
|
|
11147
11135
|
return parts.length > 0 ? `
|
|
@@ -11149,7 +11137,7 @@ function formatMemoryForPrompt(memory) {
|
|
|
11149
11137
|
${parts.join("\n")}
|
|
11150
11138
|
</project_memory>` : "";
|
|
11151
11139
|
}
|
|
11152
|
-
function loadProjectInstructions(cwd) {
|
|
11140
|
+
async function loadProjectInstructions(cwd) {
|
|
11153
11141
|
const candidates = [
|
|
11154
11142
|
"MINT.md",
|
|
11155
11143
|
".mint/MINT.md",
|
|
@@ -11173,7 +11161,7 @@ ${content}`);
|
|
|
11173
11161
|
const rulesDir = join18(cwd, ".mint", "rules");
|
|
11174
11162
|
if (existsSync10(rulesDir)) {
|
|
11175
11163
|
try {
|
|
11176
|
-
const { readdirSync: readdirSync4 } =
|
|
11164
|
+
const { readdirSync: readdirSync4 } = await import("fs");
|
|
11177
11165
|
const files = readdirSync4(rulesDir);
|
|
11178
11166
|
for (const file of files) {
|
|
11179
11167
|
if (!file.endsWith(".md")) continue;
|
|
@@ -11811,15 +11799,18 @@ async function runOrchestrator(task, cwd, callbacks, signal, previousMessages) {
|
|
|
11811
11799
|
resetWriteCodeCost();
|
|
11812
11800
|
const memory = loadMemory(cwd);
|
|
11813
11801
|
const memoryBlock = memory ? formatMemoryForPrompt(memory) : "";
|
|
11814
|
-
const projectInstructions = loadProjectInstructions(cwd);
|
|
11802
|
+
const projectInstructions = await loadProjectInstructions(cwd);
|
|
11815
11803
|
const instructionsBlock = projectInstructions ? `
|
|
11816
11804
|
|
|
11817
11805
|
${MEMORY_INSTRUCTION}
|
|
11818
11806
|
|
|
11819
11807
|
${projectInstructions}` : "";
|
|
11820
11808
|
const systemPrompt = ORCHESTRATOR_PROMPT + memoryBlock + instructionsBlock;
|
|
11809
|
+
const safeHistory = (previousMessages ?? []).filter(
|
|
11810
|
+
(m) => m && typeof m.role === "string" && (typeof m.content === "string" || m.content === null || m.content === void 0)
|
|
11811
|
+
);
|
|
11821
11812
|
const messages = [
|
|
11822
|
-
...
|
|
11813
|
+
...safeHistory,
|
|
11823
11814
|
{ role: "user", content: task }
|
|
11824
11815
|
];
|
|
11825
11816
|
const toolCtx = {
|
|
@@ -11861,7 +11852,8 @@ ${projectInstructions}` : "";
|
|
|
11861
11852
|
}
|
|
11862
11853
|
} catch (err) {
|
|
11863
11854
|
const errMsg2 = formatError(err);
|
|
11864
|
-
|
|
11855
|
+
const stack = err instanceof Error ? err.stack?.split("\n").slice(0, 3).join("\n") : "";
|
|
11856
|
+
callbacks?.onLog?.(`${errMsg2}${stack ? "\n" + stack : ""}`);
|
|
11865
11857
|
fullOutput += `
|
|
11866
11858
|
${errMsg2}`;
|
|
11867
11859
|
break;
|
|
@@ -12819,34 +12811,42 @@ async function runOrchestratorCLI(task) {
|
|
|
12819
12811
|
console.log(chalk9.dim(`
|
|
12820
12812
|
Task: ${task}
|
|
12821
12813
|
`));
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12814
|
+
try {
|
|
12815
|
+
const result = await runOrchestrator(task, cwd, {
|
|
12816
|
+
onLog: (msg) => {
|
|
12817
|
+
process.stdout.write(chalk9.dim(` ${msg}
|
|
12825
12818
|
`));
|
|
12826
|
-
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12819
|
+
},
|
|
12820
|
+
onText: (text) => {
|
|
12821
|
+
process.stdout.write(text);
|
|
12822
|
+
},
|
|
12823
|
+
onToolCall: (name, input) => {
|
|
12824
|
+
const preview = name === "write_code" ? `task: "${String(input.task ?? "").slice(0, 60)}..."` : name === "read_file" ? String(input.path ?? "") : name === "search_files" ? String(input.query ?? "") : name === "run_command" ? String(input.command ?? "").slice(0, 60) : name === "apply_diff" ? "(applying...)" : JSON.stringify(input).slice(0, 60);
|
|
12825
|
+
console.log(chalk9.cyan(` > ${name}`) + chalk9.dim(` ${preview}`));
|
|
12826
|
+
},
|
|
12827
|
+
onToolResult: (name, result2) => {
|
|
12828
|
+
if (name === "search_files" || name === "list_files") {
|
|
12829
|
+
console.log(chalk9.dim(` ${result2.split("\n").length} results`));
|
|
12830
|
+
} else if (name === "apply_diff") {
|
|
12831
|
+
console.log(chalk9.green(` ${result2.slice(0, 100)}`));
|
|
12832
|
+
}
|
|
12839
12833
|
}
|
|
12834
|
+
});
|
|
12835
|
+
const duration = (result.duration / 1e3).toFixed(1);
|
|
12836
|
+
const opusCost = result.totalCost * 50;
|
|
12837
|
+
console.log("");
|
|
12838
|
+
console.log(chalk9.dim(` ${result.iterations} steps \xB7 ${duration}s \xB7 $${result.totalCost.toFixed(4)} (orchestrator: $${result.orchestratorCost.toFixed(4)} + code: $${result.writeCodeCost.toFixed(4)})`));
|
|
12839
|
+
if (opusCost > result.totalCost * 2) {
|
|
12840
|
+
console.log(chalk9.dim(` Opus equivalent: $${opusCost.toFixed(2)} \u2014 saved ${Math.round((1 - result.totalCost / opusCost) * 100)}%`));
|
|
12841
|
+
}
|
|
12842
|
+
console.log("");
|
|
12843
|
+
} catch (err) {
|
|
12844
|
+
console.error(chalk9.red(`
|
|
12845
|
+
Error: ${err instanceof Error ? err.message : String(err)}`));
|
|
12846
|
+
if (err instanceof Error && err.stack) {
|
|
12847
|
+
console.error(chalk9.dim(err.stack.split("\n").slice(1, 5).join("\n")));
|
|
12840
12848
|
}
|
|
12841
|
-
});
|
|
12842
|
-
const duration = (result.duration / 1e3).toFixed(1);
|
|
12843
|
-
const opusCost = result.totalCost * 50;
|
|
12844
|
-
console.log("");
|
|
12845
|
-
console.log(chalk9.dim(` ${result.iterations} steps \xB7 ${duration}s \xB7 $${result.totalCost.toFixed(4)} (orchestrator: $${result.orchestratorCost.toFixed(4)} + code: $${result.writeCodeCost.toFixed(4)})`));
|
|
12846
|
-
if (opusCost > result.totalCost * 2) {
|
|
12847
|
-
console.log(chalk9.dim(` Opus equivalent: $${opusCost.toFixed(2)} \u2014 saved ${Math.round((1 - result.totalCost / opusCost) * 100)}%`));
|
|
12848
12849
|
}
|
|
12849
|
-
console.log("");
|
|
12850
12850
|
}
|
|
12851
12851
|
var init_orchestrator = __esm({
|
|
12852
12852
|
"src/cli/commands/orchestrator.ts"() {
|
|
@@ -13708,6 +13708,16 @@ program.command("init").description("Scan project and build search index").actio
|
|
|
13708
13708
|
depCount = Object.keys(pkg.dependencies ?? {}).length + Object.keys(pkg.devDependencies ?? {}).length;
|
|
13709
13709
|
} catch {
|
|
13710
13710
|
}
|
|
13711
|
+
const { existsSync: existsSync12, readFileSync: readFs, writeFileSync: writeFs, mkdirSync: mkFs } = await import("fs");
|
|
13712
|
+
const { join: joinPath } = await import("path");
|
|
13713
|
+
const mintMdPath = joinPath(cwd, "MINT.md");
|
|
13714
|
+
if (!existsSync12(mintMdPath)) {
|
|
13715
|
+
const mintMd = await generateMintMd(cwd, index, topLangs, depCount);
|
|
13716
|
+
writeFs(mintMdPath, mintMd, "utf-8");
|
|
13717
|
+
console.log(chalk10.dim(` Generated MINT.md`));
|
|
13718
|
+
} else {
|
|
13719
|
+
console.log(chalk10.dim(` MINT.md already exists \u2014 skipped`));
|
|
13720
|
+
}
|
|
13711
13721
|
console.log(chalk10.green(`
|
|
13712
13722
|
Ready.`));
|
|
13713
13723
|
console.log(chalk10.dim(` ${index.totalFiles} files \xB7 ${index.totalLOC.toLocaleString()} lines of code`));
|
|
@@ -13766,6 +13776,85 @@ function parseHumanInLoopEnv(raw) {
|
|
|
13766
13776
|
if (["0", "false", "no", "off"].includes(normalized)) return false;
|
|
13767
13777
|
return true;
|
|
13768
13778
|
}
|
|
13779
|
+
async function generateMintMd(cwd, index, topLangs, depCount) {
|
|
13780
|
+
const fs = await import("fs");
|
|
13781
|
+
const path = await import("path");
|
|
13782
|
+
const lines = ["# Project Instructions for Mint CLI", ""];
|
|
13783
|
+
let framework = "";
|
|
13784
|
+
let buildCmd = "";
|
|
13785
|
+
let testCmd = "";
|
|
13786
|
+
let lintCmd = "";
|
|
13787
|
+
try {
|
|
13788
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf-8"));
|
|
13789
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
13790
|
+
if (deps["next"]) {
|
|
13791
|
+
framework = "Next.js";
|
|
13792
|
+
buildCmd = "npm run build";
|
|
13793
|
+
} else if (deps["vite"]) {
|
|
13794
|
+
framework = "Vite";
|
|
13795
|
+
buildCmd = "npm run build";
|
|
13796
|
+
} else if (deps["react"]) {
|
|
13797
|
+
framework = "React";
|
|
13798
|
+
buildCmd = "npm run build";
|
|
13799
|
+
} else if (deps["vue"]) {
|
|
13800
|
+
framework = "Vue";
|
|
13801
|
+
buildCmd = "npm run build";
|
|
13802
|
+
} else if (deps["svelte"]) {
|
|
13803
|
+
framework = "Svelte";
|
|
13804
|
+
buildCmd = "npm run build";
|
|
13805
|
+
} else if (deps["express"] || deps["hono"] || deps["fastify"]) {
|
|
13806
|
+
framework = "Node.js server";
|
|
13807
|
+
buildCmd = "npm run build";
|
|
13808
|
+
}
|
|
13809
|
+
if (pkg.scripts?.build) buildCmd = "npm run build";
|
|
13810
|
+
if (pkg.scripts?.test && pkg.scripts.test !== 'echo "Error: no test specified" && exit 1') testCmd = "npm test";
|
|
13811
|
+
if (pkg.scripts?.lint) lintCmd = "npm run lint";
|
|
13812
|
+
if (deps["typescript"] || deps["tsup"] || deps["tsc"]) {
|
|
13813
|
+
if (!buildCmd) buildCmd = "npx tsc --noEmit";
|
|
13814
|
+
}
|
|
13815
|
+
lines.push(`## Project`);
|
|
13816
|
+
lines.push(`- **Name**: ${pkg.name ?? "unnamed"}`);
|
|
13817
|
+
if (framework) lines.push(`- **Framework**: ${framework}`);
|
|
13818
|
+
lines.push(`- **Language**: ${index.language}`);
|
|
13819
|
+
lines.push(`- **Files**: ${index.totalFiles} (${index.totalLOC.toLocaleString()} LOC)`);
|
|
13820
|
+
if (depCount > 0) lines.push(`- **Dependencies**: ${depCount}`);
|
|
13821
|
+
lines.push("");
|
|
13822
|
+
} catch {
|
|
13823
|
+
lines.push(`## Project`);
|
|
13824
|
+
lines.push(`- **Language**: ${index.language}`);
|
|
13825
|
+
lines.push(`- **Files**: ${index.totalFiles} (${index.totalLOC.toLocaleString()} LOC)`);
|
|
13826
|
+
lines.push("");
|
|
13827
|
+
}
|
|
13828
|
+
lines.push(`## Commands`);
|
|
13829
|
+
if (buildCmd) lines.push(`- **Build**: \`${buildCmd}\``);
|
|
13830
|
+
if (testCmd) lines.push(`- **Test**: \`${testCmd}\``);
|
|
13831
|
+
if (lintCmd) lines.push(`- **Lint**: \`${lintCmd}\``);
|
|
13832
|
+
if (!buildCmd && !testCmd && !lintCmd) lines.push("- No build/test/lint scripts detected");
|
|
13833
|
+
lines.push("");
|
|
13834
|
+
lines.push(`## Conventions`);
|
|
13835
|
+
lines.push(`- Match existing code style (indentation, naming, imports)`);
|
|
13836
|
+
if (index.language === "typescript") {
|
|
13837
|
+
lines.push(`- Use TypeScript types \u2014 no \`any\` unless necessary`);
|
|
13838
|
+
lines.push(`- Prefer \`const\` over \`let\``);
|
|
13839
|
+
}
|
|
13840
|
+
lines.push(`- Keep changes minimal and focused`);
|
|
13841
|
+
lines.push(`- Run build after changes to verify`);
|
|
13842
|
+
lines.push("");
|
|
13843
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
13844
|
+
for (const filePath of Object.keys(index.files)) {
|
|
13845
|
+
const parts = filePath.split("/");
|
|
13846
|
+
if (parts.length > 1) dirs.add(parts[0]);
|
|
13847
|
+
}
|
|
13848
|
+
if (dirs.size > 0) {
|
|
13849
|
+
lines.push(`## Key Directories`);
|
|
13850
|
+
for (const dir of [...dirs].sort().slice(0, 10)) {
|
|
13851
|
+
const count = Object.keys(index.files).filter((f) => f.startsWith(dir + "/")).length;
|
|
13852
|
+
lines.push(`- \`${dir}/\` (${count} files)`);
|
|
13853
|
+
}
|
|
13854
|
+
lines.push("");
|
|
13855
|
+
}
|
|
13856
|
+
return lines.join("\n");
|
|
13857
|
+
}
|
|
13769
13858
|
async function runOneShotPipeline(task, options) {
|
|
13770
13859
|
const { runPipeline: runPipeline2, formatDiffs: formatDiffs2, formatCostSummary: formatCostSummary2 } = await Promise.resolve().then(() => (init_pipeline(), pipeline_exports));
|
|
13771
13860
|
const { createUsageTracker: createUsageTracker2 } = await Promise.resolve().then(() => (init_tracker(), tracker_exports));
|