@locusai/cli 0.17.7 → 0.17.9
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/bin/locus.js +38 -49
- package/package.json +1 -1
package/bin/locus.js
CHANGED
|
@@ -7928,8 +7928,9 @@ async function handleAIPlan(projectRoot, config, directive, sprintName, flags) {
|
|
|
7928
7928
|
const plansDir = ensurePlansDir(projectRoot);
|
|
7929
7929
|
const planPath = join14(plansDir, `${id}.json`);
|
|
7930
7930
|
const planPathRelative = `.locus/plans/${id}.json`;
|
|
7931
|
+
const displayDirective = directive;
|
|
7931
7932
|
process.stderr.write(`
|
|
7932
|
-
${bold("Planning:")} ${cyan(
|
|
7933
|
+
${bold("Planning:")} ${cyan(displayDirective)}
|
|
7933
7934
|
`);
|
|
7934
7935
|
if (sprintName) {
|
|
7935
7936
|
process.stderr.write(` ${dim(`Sprint: ${sprintName}`)}
|
|
@@ -7938,8 +7939,25 @@ ${bold("Planning:")} ${cyan(directive)}
|
|
|
7938
7939
|
process.stderr.write(`
|
|
7939
7940
|
`);
|
|
7940
7941
|
const prompt = buildPlanningPrompt(projectRoot, config, directive, sprintName, id, planPathRelative);
|
|
7941
|
-
const
|
|
7942
|
-
|
|
7942
|
+
const aiResult = await runAI({
|
|
7943
|
+
prompt,
|
|
7944
|
+
provider: config.ai.provider,
|
|
7945
|
+
model: flags.model ?? config.ai.model,
|
|
7946
|
+
cwd: projectRoot,
|
|
7947
|
+
activity: "planning"
|
|
7948
|
+
});
|
|
7949
|
+
if (aiResult.interrupted) {
|
|
7950
|
+
process.stderr.write(`
|
|
7951
|
+
${yellow("⚡")} Planning interrupted.
|
|
7952
|
+
`);
|
|
7953
|
+
return;
|
|
7954
|
+
}
|
|
7955
|
+
if (!aiResult.success) {
|
|
7956
|
+
process.stderr.write(`
|
|
7957
|
+
${red("✗")} Planning failed: ${aiResult.error}
|
|
7958
|
+
`);
|
|
7959
|
+
return;
|
|
7960
|
+
}
|
|
7943
7961
|
if (!existsSync13(planPath)) {
|
|
7944
7962
|
process.stderr.write(`
|
|
7945
7963
|
${yellow("⚠")} Plan file was not created at ${bold(planPathRelative)}.
|
|
@@ -8279,6 +8297,7 @@ ${green("✓")} Created ${planned.length} issues.${milestoneTitle ? ` Sprint: ${
|
|
|
8279
8297
|
`);
|
|
8280
8298
|
}
|
|
8281
8299
|
var init_plan = __esm(() => {
|
|
8300
|
+
init_run_ai();
|
|
8282
8301
|
init_config();
|
|
8283
8302
|
init_github();
|
|
8284
8303
|
init_terminal();
|
|
@@ -8760,7 +8779,6 @@ import {
|
|
|
8760
8779
|
writeFileSync as writeFileSync9
|
|
8761
8780
|
} from "node:fs";
|
|
8762
8781
|
import { join as join16 } from "node:path";
|
|
8763
|
-
import { createInterface as createInterface2 } from "node:readline";
|
|
8764
8782
|
function printHelp4() {
|
|
8765
8783
|
process.stderr.write(`
|
|
8766
8784
|
${bold("locus discuss")} — AI-powered architectural discussions
|
|
@@ -8813,12 +8831,8 @@ async function discussCommand(projectRoot, args, flags = {}) {
|
|
|
8813
8831
|
return deleteDiscussion(projectRoot, args[1]);
|
|
8814
8832
|
}
|
|
8815
8833
|
if (args.length === 0) {
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
printHelp4();
|
|
8819
|
-
return;
|
|
8820
|
-
}
|
|
8821
|
-
return startDiscussion(projectRoot, topic2, flags);
|
|
8834
|
+
printHelp4();
|
|
8835
|
+
return;
|
|
8822
8836
|
}
|
|
8823
8837
|
const topic = args.join(" ").trim();
|
|
8824
8838
|
return startDiscussion(projectRoot, topic, flags);
|
|
@@ -8921,51 +8935,24 @@ async function convertDiscussionToPlan(projectRoot, id) {
|
|
|
8921
8935
|
return;
|
|
8922
8936
|
}
|
|
8923
8937
|
const content = readFileSync12(join16(dir, match), "utf-8");
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
`);
|
|
8938
|
+
const titleMatch = content.match(/^#\s+(.+)/m);
|
|
8939
|
+
const discussionTitle = titleMatch ? titleMatch[1].trim() : id;
|
|
8928
8940
|
await planCommand(projectRoot, [
|
|
8929
|
-
`Create
|
|
8941
|
+
`Create implementation plan from discussion: "${discussionTitle}"
|
|
8930
8942
|
|
|
8943
|
+
DISCUSSION CONTENT:
|
|
8931
8944
|
${content.slice(0, 8000)}`
|
|
8932
8945
|
], {});
|
|
8933
8946
|
}
|
|
8934
|
-
async function promptForTopic() {
|
|
8935
|
-
return new Promise((resolve2) => {
|
|
8936
|
-
const rl = createInterface2({
|
|
8937
|
-
input: process.stdin,
|
|
8938
|
-
output: process.stderr,
|
|
8939
|
-
terminal: true
|
|
8940
|
-
});
|
|
8941
|
-
process.stderr.write(`${bold("Discussion topic:")} `);
|
|
8942
|
-
rl.once("line", (line) => {
|
|
8943
|
-
rl.close();
|
|
8944
|
-
resolve2(line.trim());
|
|
8945
|
-
});
|
|
8946
|
-
rl.once("close", () => resolve2(""));
|
|
8947
|
-
});
|
|
8948
|
-
}
|
|
8949
8947
|
async function promptForAnswers() {
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
input: process.stdin,
|
|
8953
|
-
output: process.stderr,
|
|
8954
|
-
terminal: true
|
|
8955
|
-
});
|
|
8956
|
-
const lines = [];
|
|
8957
|
-
rl.on("line", (line) => {
|
|
8958
|
-
if (line.trim() === "" && lines.length > 0) {
|
|
8959
|
-
rl.close();
|
|
8960
|
-
resolve2(lines.join(`
|
|
8961
|
-
`).trim());
|
|
8962
|
-
} else {
|
|
8963
|
-
lines.push(line);
|
|
8964
|
-
}
|
|
8965
|
-
});
|
|
8966
|
-
rl.once("close", () => resolve2(lines.join(`
|
|
8967
|
-
`).trim()));
|
|
8948
|
+
const input = new InputHandler({
|
|
8949
|
+
prompt: `${cyan("you")} ${dim(">")} `
|
|
8968
8950
|
});
|
|
8951
|
+
const result = await input.readline();
|
|
8952
|
+
if (result.type === "submit") {
|
|
8953
|
+
return result.text.trim();
|
|
8954
|
+
}
|
|
8955
|
+
return "";
|
|
8969
8956
|
}
|
|
8970
8957
|
function isQuestionsResponse(output) {
|
|
8971
8958
|
const trimmed = output.trimStart();
|
|
@@ -9017,7 +9004,8 @@ ${red("✗")} Discussion failed: ${aiResult.error}
|
|
|
9017
9004
|
}
|
|
9018
9005
|
process.stderr.write(`
|
|
9019
9006
|
${dim("─".repeat(50))}
|
|
9020
|
-
${bold("Your answers:")} ${dim("(
|
|
9007
|
+
${bold("Your answers:")} ${dim("(Shift+Enter for newlines, Enter to submit)")}
|
|
9008
|
+
|
|
9021
9009
|
`);
|
|
9022
9010
|
const answers = await promptForAnswers();
|
|
9023
9011
|
if (!answers.trim()) {
|
|
@@ -9127,6 +9115,7 @@ var init_discuss = __esm(() => {
|
|
|
9127
9115
|
init_config();
|
|
9128
9116
|
init_progress();
|
|
9129
9117
|
init_terminal();
|
|
9118
|
+
init_input_handler();
|
|
9130
9119
|
init_plan();
|
|
9131
9120
|
});
|
|
9132
9121
|
|