@locusai/cli 0.11.7 → 0.12.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/bin/agent/worker.js +12 -46
- package/bin/locus.js +65 -127
- package/package.json +2 -2
package/bin/agent/worker.js
CHANGED
|
@@ -15532,9 +15532,7 @@ class ClaudeRunner {
|
|
|
15532
15532
|
"stream-json",
|
|
15533
15533
|
"--include-partial-messages",
|
|
15534
15534
|
"--model",
|
|
15535
|
-
this.model
|
|
15536
|
-
"--settings",
|
|
15537
|
-
SANDBOX_SETTINGS
|
|
15535
|
+
this.model
|
|
15538
15536
|
];
|
|
15539
15537
|
const env = getAugmentedEnv({
|
|
15540
15538
|
FORCE_COLOR: "1",
|
|
@@ -15783,9 +15781,7 @@ class ClaudeRunner {
|
|
|
15783
15781
|
"stream-json",
|
|
15784
15782
|
"--include-partial-messages",
|
|
15785
15783
|
"--model",
|
|
15786
|
-
this.model
|
|
15787
|
-
"--settings",
|
|
15788
|
-
SANDBOX_SETTINGS
|
|
15784
|
+
this.model
|
|
15789
15785
|
];
|
|
15790
15786
|
const env = getAugmentedEnv({
|
|
15791
15787
|
FORCE_COLOR: "1",
|
|
@@ -15887,21 +15883,11 @@ ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
|
|
|
15887
15883
|
return new Error(message);
|
|
15888
15884
|
}
|
|
15889
15885
|
}
|
|
15890
|
-
var
|
|
15886
|
+
var DEFAULT_TIMEOUT_MS;
|
|
15891
15887
|
var init_claude_runner = __esm(() => {
|
|
15892
15888
|
init_config();
|
|
15893
15889
|
init_colors();
|
|
15894
15890
|
init_resolve_bin();
|
|
15895
|
-
SANDBOX_SETTINGS = JSON.stringify({
|
|
15896
|
-
permissions: {
|
|
15897
|
-
deny: ["Read(../**)", "Edit(../**)"]
|
|
15898
|
-
},
|
|
15899
|
-
sandbox: {
|
|
15900
|
-
enabled: true,
|
|
15901
|
-
autoAllow: true,
|
|
15902
|
-
allowUnsandboxedCommands: false
|
|
15903
|
-
}
|
|
15904
|
-
});
|
|
15905
15891
|
DEFAULT_TIMEOUT_MS = 60 * 60 * 1000;
|
|
15906
15892
|
});
|
|
15907
15893
|
|
|
@@ -31830,14 +31816,10 @@ ${line}`;
|
|
|
31830
31816
|
}
|
|
31831
31817
|
getFullContext() {
|
|
31832
31818
|
const context2 = this.readContext();
|
|
31833
|
-
const progress = this.readProgress();
|
|
31834
31819
|
const parts = [];
|
|
31835
31820
|
if (context2.trim()) {
|
|
31836
31821
|
parts.push(context2.trim());
|
|
31837
31822
|
}
|
|
31838
|
-
if (progress.trim()) {
|
|
31839
|
-
parts.push(progress.trim());
|
|
31840
|
-
}
|
|
31841
31823
|
return parts.join(`
|
|
31842
31824
|
|
|
31843
31825
|
---
|
|
@@ -32229,13 +32211,6 @@ ${serverContext.context}
|
|
|
32229
32211
|
prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
|
|
32230
32212
|
|
|
32231
32213
|
`;
|
|
32232
|
-
const indexPath = getLocusPath(this.projectPath, "indexFile");
|
|
32233
|
-
if (existsSync4(indexPath)) {
|
|
32234
|
-
prompt += `## Codebase Overview
|
|
32235
|
-
There is an index file in the .locus/codebase-index.json and if you need you can check it.
|
|
32236
|
-
|
|
32237
|
-
`;
|
|
32238
|
-
}
|
|
32239
32214
|
if (task2.docs && task2.docs.length > 0) {
|
|
32240
32215
|
prompt += `## Attached Documents (Summarized)
|
|
32241
32216
|
`;
|
|
@@ -32265,19 +32240,17 @@ ${preview}${isTruncated ? `
|
|
|
32265
32240
|
`;
|
|
32266
32241
|
}
|
|
32267
32242
|
if (task2.comments && task2.comments.length > 0) {
|
|
32268
|
-
const
|
|
32269
|
-
|
|
32270
|
-
|
|
32271
|
-
prompt += `Review the following comments for context or rejection feedback:
|
|
32272
|
-
|
|
32243
|
+
const filteredComments = task2.comments.filter((comment) => comment.author !== "system");
|
|
32244
|
+
const comments = filteredComments.slice(0, 3);
|
|
32245
|
+
prompt += `## Task Comments & Feedback
|
|
32273
32246
|
`;
|
|
32274
32247
|
for (const comment of comments) {
|
|
32275
32248
|
const date5 = new Date(comment.createdAt).toLocaleString();
|
|
32276
|
-
prompt +=
|
|
32277
|
-
${comment.text}
|
|
32278
|
-
|
|
32249
|
+
prompt += `- ${comment.author} (${date5}): ${comment.text}
|
|
32279
32250
|
`;
|
|
32280
32251
|
}
|
|
32252
|
+
prompt += `
|
|
32253
|
+
`;
|
|
32281
32254
|
}
|
|
32282
32255
|
prompt += `## Instructions
|
|
32283
32256
|
1. Complete this task.
|
|
@@ -32342,13 +32315,6 @@ ${fallback}
|
|
|
32342
32315
|
prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
|
|
32343
32316
|
|
|
32344
32317
|
`;
|
|
32345
|
-
const indexPath = getLocusPath(this.projectPath, "indexFile");
|
|
32346
|
-
if (existsSync4(indexPath)) {
|
|
32347
|
-
prompt += `## Codebase Overview
|
|
32348
|
-
There is an index file in the .locus/codebase-index.json and if you need you can check it.
|
|
32349
|
-
|
|
32350
|
-
`;
|
|
32351
|
-
}
|
|
32352
32318
|
prompt += `## Instructions
|
|
32353
32319
|
1. Execute the prompt based on the provided project context.
|
|
32354
32320
|
2. **Paths**: Use relative paths from the project root at all times. Do NOT use absolute local paths (e.g., /Users/...).
|
|
@@ -32723,7 +32689,7 @@ class AgentWorker {
|
|
|
32723
32689
|
assignedTo: null
|
|
32724
32690
|
});
|
|
32725
32691
|
await this.client.tasks.addComment(task2.id, this.config.workspaceId, {
|
|
32726
|
-
author:
|
|
32692
|
+
author: "system",
|
|
32727
32693
|
text: `⚠️ Agent execution finished with no file changes, so no commit was created.
|
|
32728
32694
|
|
|
32729
32695
|
${result.summary}`
|
|
@@ -32738,7 +32704,7 @@ ${result.summary}`
|
|
|
32738
32704
|
|
|
32739
32705
|
Branch: \`${result.branch}\`` : "";
|
|
32740
32706
|
await this.client.tasks.addComment(task2.id, this.config.workspaceId, {
|
|
32741
|
-
author:
|
|
32707
|
+
author: "system",
|
|
32742
32708
|
text: `✅ ${result.summary}${branchInfo}`
|
|
32743
32709
|
});
|
|
32744
32710
|
this.tasksCompleted++;
|
|
@@ -32753,7 +32719,7 @@ Branch: \`${result.branch}\`` : "";
|
|
|
32753
32719
|
assignedTo: null
|
|
32754
32720
|
});
|
|
32755
32721
|
await this.client.tasks.addComment(task2.id, this.config.workspaceId, {
|
|
32756
|
-
author:
|
|
32722
|
+
author: "system",
|
|
32757
32723
|
text: `❌ ${result.summary}`
|
|
32758
32724
|
});
|
|
32759
32725
|
}
|
package/bin/locus.js
CHANGED
|
@@ -6324,9 +6324,6 @@ function extractJsonFromLLMOutput(raw) {
|
|
|
6324
6324
|
if (codeBlockMatch) {
|
|
6325
6325
|
return codeBlockMatch[1]?.trim() || "";
|
|
6326
6326
|
}
|
|
6327
|
-
if (trimmed.startsWith("{")) {
|
|
6328
|
-
return trimmed;
|
|
6329
|
-
}
|
|
6330
6327
|
const startIdx = trimmed.indexOf("{");
|
|
6331
6328
|
if (startIdx === -1) {
|
|
6332
6329
|
return trimmed;
|
|
@@ -6340,19 +6337,19 @@ function extractJsonFromLLMOutput(raw) {
|
|
|
6340
6337
|
escaped = false;
|
|
6341
6338
|
continue;
|
|
6342
6339
|
}
|
|
6343
|
-
if (
|
|
6344
|
-
|
|
6340
|
+
if (inString) {
|
|
6341
|
+
if (ch === "\\") {
|
|
6342
|
+
escaped = true;
|
|
6343
|
+
} else if (ch === '"') {
|
|
6344
|
+
inString = false;
|
|
6345
|
+
}
|
|
6345
6346
|
continue;
|
|
6346
6347
|
}
|
|
6347
6348
|
if (ch === '"') {
|
|
6348
|
-
inString =
|
|
6349
|
-
|
|
6350
|
-
}
|
|
6351
|
-
if (inString)
|
|
6352
|
-
continue;
|
|
6353
|
-
if (ch === "{")
|
|
6349
|
+
inString = true;
|
|
6350
|
+
} else if (ch === "{") {
|
|
6354
6351
|
depth++;
|
|
6355
|
-
else if (ch === "}") {
|
|
6352
|
+
} else if (ch === "}") {
|
|
6356
6353
|
depth--;
|
|
6357
6354
|
if (depth === 0) {
|
|
6358
6355
|
return trimmed.slice(startIdx, i + 1);
|
|
@@ -7123,9 +7120,7 @@ class ClaudeRunner {
|
|
|
7123
7120
|
"stream-json",
|
|
7124
7121
|
"--include-partial-messages",
|
|
7125
7122
|
"--model",
|
|
7126
|
-
this.model
|
|
7127
|
-
"--settings",
|
|
7128
|
-
SANDBOX_SETTINGS
|
|
7123
|
+
this.model
|
|
7129
7124
|
];
|
|
7130
7125
|
const env = getAugmentedEnv({
|
|
7131
7126
|
FORCE_COLOR: "1",
|
|
@@ -7374,9 +7369,7 @@ class ClaudeRunner {
|
|
|
7374
7369
|
"stream-json",
|
|
7375
7370
|
"--include-partial-messages",
|
|
7376
7371
|
"--model",
|
|
7377
|
-
this.model
|
|
7378
|
-
"--settings",
|
|
7379
|
-
SANDBOX_SETTINGS
|
|
7372
|
+
this.model
|
|
7380
7373
|
];
|
|
7381
7374
|
const env = getAugmentedEnv({
|
|
7382
7375
|
FORCE_COLOR: "1",
|
|
@@ -7478,21 +7471,11 @@ ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
|
|
|
7478
7471
|
return new Error(message);
|
|
7479
7472
|
}
|
|
7480
7473
|
}
|
|
7481
|
-
var
|
|
7474
|
+
var DEFAULT_TIMEOUT_MS;
|
|
7482
7475
|
var init_claude_runner = __esm(() => {
|
|
7483
7476
|
init_config();
|
|
7484
7477
|
init_colors();
|
|
7485
7478
|
init_resolve_bin();
|
|
7486
|
-
SANDBOX_SETTINGS = JSON.stringify({
|
|
7487
|
-
permissions: {
|
|
7488
|
-
deny: ["Read(../**)", "Edit(../**)"]
|
|
7489
|
-
},
|
|
7490
|
-
sandbox: {
|
|
7491
|
-
enabled: true,
|
|
7492
|
-
autoAllow: true,
|
|
7493
|
-
allowUnsandboxedCommands: false
|
|
7494
|
-
}
|
|
7495
|
-
});
|
|
7496
7479
|
DEFAULT_TIMEOUT_MS = 60 * 60 * 1000;
|
|
7497
7480
|
});
|
|
7498
7481
|
|
|
@@ -38798,14 +38781,10 @@ ${line}`;
|
|
|
38798
38781
|
}
|
|
38799
38782
|
getFullContext() {
|
|
38800
38783
|
const context2 = this.readContext();
|
|
38801
|
-
const progress = this.readProgress();
|
|
38802
38784
|
const parts = [];
|
|
38803
38785
|
if (context2.trim()) {
|
|
38804
38786
|
parts.push(context2.trim());
|
|
38805
38787
|
}
|
|
38806
|
-
if (progress.trim()) {
|
|
38807
|
-
parts.push(progress.trim());
|
|
38808
|
-
}
|
|
38809
38788
|
return parts.join(`
|
|
38810
38789
|
|
|
38811
38790
|
---
|
|
@@ -39179,13 +39158,6 @@ ${serverContext.context}
|
|
|
39179
39158
|
prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
|
|
39180
39159
|
|
|
39181
39160
|
`;
|
|
39182
|
-
const indexPath = getLocusPath(this.projectPath, "indexFile");
|
|
39183
|
-
if (existsSync6(indexPath)) {
|
|
39184
|
-
prompt += `## Codebase Overview
|
|
39185
|
-
There is an index file in the .locus/codebase-index.json and if you need you can check it.
|
|
39186
|
-
|
|
39187
|
-
`;
|
|
39188
|
-
}
|
|
39189
39161
|
if (task2.docs && task2.docs.length > 0) {
|
|
39190
39162
|
prompt += `## Attached Documents (Summarized)
|
|
39191
39163
|
`;
|
|
@@ -39215,19 +39187,17 @@ ${preview}${isTruncated ? `
|
|
|
39215
39187
|
`;
|
|
39216
39188
|
}
|
|
39217
39189
|
if (task2.comments && task2.comments.length > 0) {
|
|
39218
|
-
const
|
|
39219
|
-
|
|
39220
|
-
|
|
39221
|
-
prompt += `Review the following comments for context or rejection feedback:
|
|
39222
|
-
|
|
39190
|
+
const filteredComments = task2.comments.filter((comment) => comment.author !== "system");
|
|
39191
|
+
const comments = filteredComments.slice(0, 3);
|
|
39192
|
+
prompt += `## Task Comments & Feedback
|
|
39223
39193
|
`;
|
|
39224
39194
|
for (const comment of comments) {
|
|
39225
39195
|
const date5 = new Date(comment.createdAt).toLocaleString();
|
|
39226
|
-
prompt +=
|
|
39227
|
-
${comment.text}
|
|
39228
|
-
|
|
39196
|
+
prompt += `- ${comment.author} (${date5}): ${comment.text}
|
|
39229
39197
|
`;
|
|
39230
39198
|
}
|
|
39199
|
+
prompt += `
|
|
39200
|
+
`;
|
|
39231
39201
|
}
|
|
39232
39202
|
prompt += `## Instructions
|
|
39233
39203
|
1. Complete this task.
|
|
@@ -39292,13 +39262,6 @@ ${fallback}
|
|
|
39292
39262
|
prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
|
|
39293
39263
|
|
|
39294
39264
|
`;
|
|
39295
|
-
const indexPath = getLocusPath(this.projectPath, "indexFile");
|
|
39296
|
-
if (existsSync6(indexPath)) {
|
|
39297
|
-
prompt += `## Codebase Overview
|
|
39298
|
-
There is an index file in the .locus/codebase-index.json and if you need you can check it.
|
|
39299
|
-
|
|
39300
|
-
`;
|
|
39301
|
-
}
|
|
39302
39265
|
prompt += `## Instructions
|
|
39303
39266
|
1. Execute the prompt based on the provided project context.
|
|
39304
39267
|
2. **Paths**: Use relative paths from the project root at all times. Do NOT use absolute local paths (e.g., /Users/...).
|
|
@@ -39673,7 +39636,7 @@ class AgentWorker {
|
|
|
39673
39636
|
assignedTo: null
|
|
39674
39637
|
});
|
|
39675
39638
|
await this.client.tasks.addComment(task2.id, this.config.workspaceId, {
|
|
39676
|
-
author:
|
|
39639
|
+
author: "system",
|
|
39677
39640
|
text: `⚠️ Agent execution finished with no file changes, so no commit was created.
|
|
39678
39641
|
|
|
39679
39642
|
${result.summary}`
|
|
@@ -39688,7 +39651,7 @@ ${result.summary}`
|
|
|
39688
39651
|
|
|
39689
39652
|
Branch: \`${result.branch}\`` : "";
|
|
39690
39653
|
await this.client.tasks.addComment(task2.id, this.config.workspaceId, {
|
|
39691
|
-
author:
|
|
39654
|
+
author: "system",
|
|
39692
39655
|
text: `✅ ${result.summary}${branchInfo}`
|
|
39693
39656
|
});
|
|
39694
39657
|
this.tasksCompleted++;
|
|
@@ -39703,7 +39666,7 @@ Branch: \`${result.branch}\`` : "";
|
|
|
39703
39666
|
assignedTo: null
|
|
39704
39667
|
});
|
|
39705
39668
|
await this.client.tasks.addComment(task2.id, this.config.workspaceId, {
|
|
39706
|
-
author:
|
|
39669
|
+
author: "system",
|
|
39707
39670
|
text: `❌ ${result.summary}`
|
|
39708
39671
|
});
|
|
39709
39672
|
}
|
|
@@ -41011,7 +40974,14 @@ function plannedTasksToCreatePayloads(plan, sprintId) {
|
|
|
41011
40974
|
}
|
|
41012
40975
|
function parseSprintPlanFromAI(raw, directive) {
|
|
41013
40976
|
const jsonStr = extractJsonFromLLMOutput(raw);
|
|
41014
|
-
let parsed
|
|
40977
|
+
let parsed;
|
|
40978
|
+
try {
|
|
40979
|
+
parsed = JSON.parse(jsonStr);
|
|
40980
|
+
} catch (err) {
|
|
40981
|
+
const preview = jsonStr.slice(0, 200);
|
|
40982
|
+
throw new Error(`Failed to parse sprint plan JSON: ${err instanceof Error ? err.message : String(err)}
|
|
40983
|
+
Extracted JSON preview: ${preview}`);
|
|
40984
|
+
}
|
|
41015
40985
|
if (parsed.revisedPlan) {
|
|
41016
40986
|
parsed = parsed.revisedPlan;
|
|
41017
40987
|
}
|
|
@@ -41335,9 +41305,6 @@ IMPORTANT: Incorporate this feedback into your plan. The CEO has reviewed a prev
|
|
|
41335
41305
|
## Project Context
|
|
41336
41306
|
${input.projectContext || "No project context available."}
|
|
41337
41307
|
|
|
41338
|
-
## Codebase Structure
|
|
41339
|
-
${input.codebaseIndex || "No codebase index available."}
|
|
41340
|
-
|
|
41341
41308
|
## Your Task
|
|
41342
41309
|
|
|
41343
41310
|
Analyze the directive and produce a **complete sprint plan** with the following:
|
|
@@ -41420,8 +41387,6 @@ IMPORTANT: Tasks are executed sequentially by a single agent. The array order IS
|
|
|
41420
41387
|
}
|
|
41421
41388
|
|
|
41422
41389
|
// ../sdk/src/planning/planning-meeting.ts
|
|
41423
|
-
import { existsSync as existsSync10, readFileSync as readFileSync9 } from "node:fs";
|
|
41424
|
-
|
|
41425
41390
|
class PlanningMeeting {
|
|
41426
41391
|
projectPath;
|
|
41427
41392
|
aiRunner;
|
|
@@ -41435,14 +41400,13 @@ class PlanningMeeting {
|
|
|
41435
41400
|
}
|
|
41436
41401
|
async run(directive, feedback) {
|
|
41437
41402
|
const projectContext = this.getProjectContext();
|
|
41438
|
-
const codebaseIndex = this.getCodebaseIndex();
|
|
41439
41403
|
this.log("Phase 1/2: Planner building sprint plan...", "info");
|
|
41440
41404
|
const plannerPrompt = buildPlannerPrompt({
|
|
41441
41405
|
directive,
|
|
41442
41406
|
projectContext,
|
|
41443
|
-
codebaseIndex,
|
|
41444
41407
|
feedback
|
|
41445
41408
|
});
|
|
41409
|
+
console.log(plannerPrompt);
|
|
41446
41410
|
const plannerOutput = await this.aiRunner.run(plannerPrompt);
|
|
41447
41411
|
this.log("Planner phase complete.", "success");
|
|
41448
41412
|
this.log("Phase 2/2: Reviewer checking for conflicts and quality...", "info");
|
|
@@ -41470,34 +41434,8 @@ class PlanningMeeting {
|
|
|
41470
41434
|
const kb = new KnowledgeBase(this.projectPath);
|
|
41471
41435
|
return kb.getFullContext();
|
|
41472
41436
|
}
|
|
41473
|
-
getCodebaseIndex() {
|
|
41474
|
-
const indexPath = getLocusPath(this.projectPath, "indexFile");
|
|
41475
|
-
if (!existsSync10(indexPath)) {
|
|
41476
|
-
return "";
|
|
41477
|
-
}
|
|
41478
|
-
try {
|
|
41479
|
-
const raw = readFileSync9(indexPath, "utf-8");
|
|
41480
|
-
const index = JSON.parse(raw);
|
|
41481
|
-
const parts = [];
|
|
41482
|
-
if (index.responsibilities) {
|
|
41483
|
-
parts.push("### File Responsibilities");
|
|
41484
|
-
const entries = Object.entries(index.responsibilities);
|
|
41485
|
-
for (const [file2, summary] of entries.slice(0, 50)) {
|
|
41486
|
-
parts.push(`- \`${file2}\`: ${summary}`);
|
|
41487
|
-
}
|
|
41488
|
-
if (entries.length > 50) {
|
|
41489
|
-
parts.push(`... and ${entries.length - 50} more files`);
|
|
41490
|
-
}
|
|
41491
|
-
}
|
|
41492
|
-
return parts.join(`
|
|
41493
|
-
`);
|
|
41494
|
-
} catch {
|
|
41495
|
-
return "";
|
|
41496
|
-
}
|
|
41497
|
-
}
|
|
41498
41437
|
}
|
|
41499
41438
|
var init_planning_meeting = __esm(() => {
|
|
41500
|
-
init_config();
|
|
41501
41439
|
init_knowledge_base();
|
|
41502
41440
|
init_sprint_plan();
|
|
41503
41441
|
});
|
|
@@ -42580,7 +42518,7 @@ import { createInterface } from "node:readline";
|
|
|
42580
42518
|
|
|
42581
42519
|
// src/settings-manager.ts
|
|
42582
42520
|
init_index_node();
|
|
42583
|
-
import { existsSync as
|
|
42521
|
+
import { existsSync as existsSync10, readFileSync as readFileSync9, unlinkSync as unlinkSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
42584
42522
|
import { join as join10 } from "node:path";
|
|
42585
42523
|
function getSettingsPath(projectPath) {
|
|
42586
42524
|
return join10(projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG.settingsFile);
|
|
@@ -42593,10 +42531,10 @@ class SettingsManager {
|
|
|
42593
42531
|
}
|
|
42594
42532
|
load() {
|
|
42595
42533
|
const settingsPath = getSettingsPath(this.projectPath);
|
|
42596
|
-
if (!
|
|
42534
|
+
if (!existsSync10(settingsPath)) {
|
|
42597
42535
|
return {};
|
|
42598
42536
|
}
|
|
42599
|
-
return JSON.parse(
|
|
42537
|
+
return JSON.parse(readFileSync9(settingsPath, "utf-8"));
|
|
42600
42538
|
}
|
|
42601
42539
|
save(settings) {
|
|
42602
42540
|
const { $schema: _2, ...rest } = settings;
|
|
@@ -42614,12 +42552,12 @@ class SettingsManager {
|
|
|
42614
42552
|
}
|
|
42615
42553
|
remove() {
|
|
42616
42554
|
const settingsPath = getSettingsPath(this.projectPath);
|
|
42617
|
-
if (
|
|
42555
|
+
if (existsSync10(settingsPath)) {
|
|
42618
42556
|
unlinkSync3(settingsPath);
|
|
42619
42557
|
}
|
|
42620
42558
|
}
|
|
42621
42559
|
exists() {
|
|
42622
|
-
return
|
|
42560
|
+
return existsSync10(getSettingsPath(this.projectPath));
|
|
42623
42561
|
}
|
|
42624
42562
|
}
|
|
42625
42563
|
|
|
@@ -42885,7 +42823,7 @@ import { parseArgs } from "node:util";
|
|
|
42885
42823
|
// src/config-manager.ts
|
|
42886
42824
|
init_index_node();
|
|
42887
42825
|
import { execSync as execSync2 } from "node:child_process";
|
|
42888
|
-
import { existsSync as
|
|
42826
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "node:fs";
|
|
42889
42827
|
import { join as join11 } from "node:path";
|
|
42890
42828
|
var LOCUS_GITIGNORE_MARKER = "# Locus AI";
|
|
42891
42829
|
var DEFAULT_CONTEXT_MD = `# Project
|
|
@@ -42956,8 +42894,8 @@ function updateGitignore(projectPath) {
|
|
|
42956
42894
|
let content = "";
|
|
42957
42895
|
const locusBlock = LOCUS_GITIGNORE_PATTERNS.join(`
|
|
42958
42896
|
`);
|
|
42959
|
-
if (
|
|
42960
|
-
content =
|
|
42897
|
+
if (existsSync11(gitignorePath)) {
|
|
42898
|
+
content = readFileSync10(gitignorePath, "utf-8");
|
|
42961
42899
|
if (content.includes(LOCUS_GITIGNORE_MARKER)) {
|
|
42962
42900
|
const lines = content.split(`
|
|
42963
42901
|
`);
|
|
@@ -43038,7 +42976,7 @@ class ConfigManager {
|
|
|
43038
42976
|
async init(version2) {
|
|
43039
42977
|
const locusConfigDir = join11(this.projectPath, LOCUS_CONFIG.dir);
|
|
43040
42978
|
const locusConfigPath = getLocusPath(this.projectPath, "configFile");
|
|
43041
|
-
if (!
|
|
42979
|
+
if (!existsSync11(locusConfigDir)) {
|
|
43042
42980
|
mkdirSync6(locusConfigDir, { recursive: true });
|
|
43043
42981
|
}
|
|
43044
42982
|
const locusSubdirs = [
|
|
@@ -43051,23 +42989,23 @@ class ConfigManager {
|
|
|
43051
42989
|
];
|
|
43052
42990
|
for (const subdir of locusSubdirs) {
|
|
43053
42991
|
const subdirPath = join11(locusConfigDir, subdir);
|
|
43054
|
-
if (!
|
|
42992
|
+
if (!existsSync11(subdirPath)) {
|
|
43055
42993
|
mkdirSync6(subdirPath, { recursive: true });
|
|
43056
42994
|
}
|
|
43057
42995
|
}
|
|
43058
42996
|
const contextFilePath = getLocusPath(this.projectPath, "projectContextFile");
|
|
43059
|
-
if (!
|
|
42997
|
+
if (!existsSync11(contextFilePath)) {
|
|
43060
42998
|
writeFileSync7(contextFilePath, DEFAULT_CONTEXT_MD);
|
|
43061
42999
|
}
|
|
43062
43000
|
const progressFilePath = getLocusPath(this.projectPath, "projectProgressFile");
|
|
43063
|
-
if (!
|
|
43001
|
+
if (!existsSync11(progressFilePath)) {
|
|
43064
43002
|
writeFileSync7(progressFilePath, DEFAULT_PROGRESS_MD);
|
|
43065
43003
|
}
|
|
43066
43004
|
const locusMdPath = getLocusPath(this.projectPath, "contextFile");
|
|
43067
|
-
if (!
|
|
43005
|
+
if (!existsSync11(locusMdPath)) {
|
|
43068
43006
|
writeFileSync7(locusMdPath, LOCUS_MD_TEMPLATE);
|
|
43069
43007
|
}
|
|
43070
|
-
if (!
|
|
43008
|
+
if (!existsSync11(locusConfigPath)) {
|
|
43071
43009
|
const config2 = {
|
|
43072
43010
|
$schema: LOCUS_SCHEMAS.config,
|
|
43073
43011
|
version: version2,
|
|
@@ -43081,8 +43019,8 @@ class ConfigManager {
|
|
|
43081
43019
|
}
|
|
43082
43020
|
loadConfig() {
|
|
43083
43021
|
const path2 = getLocusPath(this.projectPath, "configFile");
|
|
43084
|
-
if (
|
|
43085
|
-
return JSON.parse(
|
|
43022
|
+
if (existsSync11(path2)) {
|
|
43023
|
+
return JSON.parse(readFileSync10(path2, "utf-8"));
|
|
43086
43024
|
}
|
|
43087
43025
|
return null;
|
|
43088
43026
|
}
|
|
@@ -43115,8 +43053,8 @@ class ConfigManager {
|
|
|
43115
43053
|
}
|
|
43116
43054
|
}
|
|
43117
43055
|
const settingsPath = join11(this.projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG.settingsFile);
|
|
43118
|
-
if (
|
|
43119
|
-
const raw =
|
|
43056
|
+
if (existsSync11(settingsPath)) {
|
|
43057
|
+
const raw = readFileSync10(settingsPath, "utf-8");
|
|
43120
43058
|
const settings = JSON.parse(raw);
|
|
43121
43059
|
if (settings.$schema !== LOCUS_SCHEMAS.settings) {
|
|
43122
43060
|
const { $schema: _2, ...rest } = settings;
|
|
@@ -43124,7 +43062,7 @@ class ConfigManager {
|
|
|
43124
43062
|
writeFileSync7(settingsPath, JSON.stringify(ordered, null, 2), "utf-8");
|
|
43125
43063
|
}
|
|
43126
43064
|
}
|
|
43127
|
-
const locusMdExisted =
|
|
43065
|
+
const locusMdExisted = existsSync11(locusMdPath);
|
|
43128
43066
|
writeFileSync7(locusMdPath, LOCUS_MD_TEMPLATE);
|
|
43129
43067
|
if (!locusMdExisted) {
|
|
43130
43068
|
result.directoriesCreated.push(".locus/LOCUS.md");
|
|
@@ -43139,25 +43077,25 @@ class ConfigManager {
|
|
|
43139
43077
|
];
|
|
43140
43078
|
for (const subdir of locusSubdirs) {
|
|
43141
43079
|
const subdirPath = join11(locusConfigDir, subdir);
|
|
43142
|
-
if (!
|
|
43080
|
+
if (!existsSync11(subdirPath)) {
|
|
43143
43081
|
mkdirSync6(subdirPath, { recursive: true });
|
|
43144
43082
|
result.directoriesCreated.push(`.locus/${subdir}`);
|
|
43145
43083
|
}
|
|
43146
43084
|
}
|
|
43147
43085
|
const contextFilePath = getLocusPath(this.projectPath, "projectContextFile");
|
|
43148
|
-
if (!
|
|
43086
|
+
if (!existsSync11(contextFilePath)) {
|
|
43149
43087
|
writeFileSync7(contextFilePath, DEFAULT_CONTEXT_MD);
|
|
43150
43088
|
result.directoriesCreated.push(".locus/project/context.md");
|
|
43151
43089
|
}
|
|
43152
43090
|
const progressFilePath = getLocusPath(this.projectPath, "projectProgressFile");
|
|
43153
|
-
if (!
|
|
43091
|
+
if (!existsSync11(progressFilePath)) {
|
|
43154
43092
|
writeFileSync7(progressFilePath, DEFAULT_PROGRESS_MD);
|
|
43155
43093
|
result.directoriesCreated.push(".locus/project/progress.md");
|
|
43156
43094
|
}
|
|
43157
43095
|
const gitignorePath = join11(this.projectPath, ".gitignore");
|
|
43158
|
-
const gitignoreBefore =
|
|
43096
|
+
const gitignoreBefore = existsSync11(gitignorePath) ? readFileSync10(gitignorePath, "utf-8") : "";
|
|
43159
43097
|
updateGitignore(this.projectPath);
|
|
43160
|
-
const gitignoreAfter =
|
|
43098
|
+
const gitignoreAfter = readFileSync10(gitignorePath, "utf-8");
|
|
43161
43099
|
if (gitignoreBefore !== gitignoreAfter) {
|
|
43162
43100
|
result.gitignoreUpdated = true;
|
|
43163
43101
|
}
|
|
@@ -43176,7 +43114,7 @@ class ConfigManager {
|
|
|
43176
43114
|
init_index_node();
|
|
43177
43115
|
|
|
43178
43116
|
// src/utils/version.ts
|
|
43179
|
-
import { existsSync as
|
|
43117
|
+
import { existsSync as existsSync12, readFileSync as readFileSync11 } from "node:fs";
|
|
43180
43118
|
import { dirname as dirname4, join as join12 } from "node:path";
|
|
43181
43119
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
43182
43120
|
function getVersion() {
|
|
@@ -43185,14 +43123,14 @@ function getVersion() {
|
|
|
43185
43123
|
const __dirname2 = dirname4(__filename2);
|
|
43186
43124
|
const bundledPath = join12(__dirname2, "..", "package.json");
|
|
43187
43125
|
const sourcePath = join12(__dirname2, "..", "..", "package.json");
|
|
43188
|
-
if (
|
|
43189
|
-
const pkg = JSON.parse(
|
|
43126
|
+
if (existsSync12(bundledPath)) {
|
|
43127
|
+
const pkg = JSON.parse(readFileSync11(bundledPath, "utf-8"));
|
|
43190
43128
|
if (pkg.name === "@locusai/cli") {
|
|
43191
43129
|
return pkg.version || "0.0.0";
|
|
43192
43130
|
}
|
|
43193
43131
|
}
|
|
43194
|
-
if (
|
|
43195
|
-
const pkg = JSON.parse(
|
|
43132
|
+
if (existsSync12(sourcePath)) {
|
|
43133
|
+
const pkg = JSON.parse(readFileSync11(sourcePath, "utf-8"));
|
|
43196
43134
|
if (pkg.name === "@locusai/cli") {
|
|
43197
43135
|
return pkg.version || "0.0.0";
|
|
43198
43136
|
}
|
|
@@ -43214,12 +43152,12 @@ function printBanner() {
|
|
|
43214
43152
|
}
|
|
43215
43153
|
// src/utils/helpers.ts
|
|
43216
43154
|
init_index_node();
|
|
43217
|
-
import { existsSync as
|
|
43155
|
+
import { existsSync as existsSync13 } from "node:fs";
|
|
43218
43156
|
import { join as join13 } from "node:path";
|
|
43219
43157
|
function isProjectInitialized(projectPath) {
|
|
43220
43158
|
const locusDir = join13(projectPath, LOCUS_CONFIG.dir);
|
|
43221
43159
|
const configPath = join13(locusDir, LOCUS_CONFIG.configFile);
|
|
43222
|
-
return
|
|
43160
|
+
return existsSync13(locusDir) && existsSync13(configPath);
|
|
43223
43161
|
}
|
|
43224
43162
|
function requireInitialization(projectPath, command) {
|
|
43225
43163
|
if (!isProjectInitialized(projectPath)) {
|
|
@@ -44394,7 +44332,7 @@ function showPlanHelp() {
|
|
|
44394
44332
|
}
|
|
44395
44333
|
// src/commands/review.ts
|
|
44396
44334
|
init_index_node();
|
|
44397
|
-
import { existsSync as
|
|
44335
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync7, writeFileSync as writeFileSync8 } from "node:fs";
|
|
44398
44336
|
import { join as join14 } from "node:path";
|
|
44399
44337
|
import { parseArgs as parseArgs5 } from "node:util";
|
|
44400
44338
|
async function reviewCommand(args) {
|
|
@@ -44535,7 +44473,7 @@ async function reviewLocalCommand(args) {
|
|
|
44535
44473
|
return;
|
|
44536
44474
|
}
|
|
44537
44475
|
const reviewsDir = join14(projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG.reviewsDir);
|
|
44538
|
-
if (!
|
|
44476
|
+
if (!existsSync14(reviewsDir)) {
|
|
44539
44477
|
mkdirSync7(reviewsDir, { recursive: true });
|
|
44540
44478
|
}
|
|
44541
44479
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
@@ -44632,7 +44570,7 @@ ${c.info(`Received ${signal}. Stopping agent and cleaning up...`)}`);
|
|
|
44632
44570
|
// src/commands/telegram.ts
|
|
44633
44571
|
init_index_node();
|
|
44634
44572
|
import { spawn as spawn4 } from "node:child_process";
|
|
44635
|
-
import { existsSync as
|
|
44573
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
44636
44574
|
import { join as join15 } from "node:path";
|
|
44637
44575
|
import { createInterface as createInterface3 } from "node:readline";
|
|
44638
44576
|
function ask2(question) {
|
|
@@ -44868,7 +44806,7 @@ function runBotCommand(projectPath) {
|
|
|
44868
44806
|
process.exit(1);
|
|
44869
44807
|
}
|
|
44870
44808
|
const monorepoTelegramEntry = join15(projectPath, "packages/telegram/src/index.ts");
|
|
44871
|
-
const isMonorepo =
|
|
44809
|
+
const isMonorepo = existsSync15(monorepoTelegramEntry);
|
|
44872
44810
|
let cmd;
|
|
44873
44811
|
let args;
|
|
44874
44812
|
if (isMonorepo) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locusai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "CLI for Locus - AI-native project management platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"author": "",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@locusai/sdk": "^0.
|
|
36
|
+
"@locusai/sdk": "^0.12.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {}
|
|
39
39
|
}
|