@locusai/sdk 0.7.1 → 0.7.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.
@@ -725,7 +725,6 @@ class ClaudeRunner {
725
725
  if (type === "content_block_start" && content_block) {
726
726
  if (content_block.type === "tool_use" && content_block.name) {
727
727
  this.log?.(`
728
-
729
728
  ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
730
729
  `, "info");
731
730
  }
@@ -1394,6 +1393,76 @@ ${comment.text}
1394
1393
  2. **Artifact Management**: If you create any high-level documentation (PRDs, technical drafts, architecture docs), you MUST save them in \`.locus/artifacts/\`. Do NOT create them in the root directory.
1395
1394
  3. **Paths**: Use relative paths from the project root at all times. Do NOT use absolute local paths (e.g., /Users/...).
1396
1395
  4. When finished successfully, output: <promise>COMPLETE</promise>
1396
+ `;
1397
+ return prompt;
1398
+ }
1399
+ async buildGenericPrompt(query) {
1400
+ let prompt = `# Direct Execution
1401
+
1402
+ `;
1403
+ prompt += `## Prompt
1404
+ ${query}
1405
+
1406
+ `;
1407
+ const projectConfig = this.getProjectConfig();
1408
+ if (projectConfig) {
1409
+ prompt += `## Project Metadata
1410
+ `;
1411
+ prompt += `- Version: ${projectConfig.version || "Unknown"}
1412
+ `;
1413
+ prompt += `- Created At: ${projectConfig.createdAt || "Unknown"}
1414
+
1415
+ `;
1416
+ }
1417
+ const contextPath = getLocusPath(this.projectPath, "contextFile");
1418
+ let hasLocalContext = false;
1419
+ if (import_node_fs4.existsSync(contextPath)) {
1420
+ try {
1421
+ const context = import_node_fs4.readFileSync(contextPath, "utf-8");
1422
+ if (context.trim().length > 20) {
1423
+ prompt += `## Project Context (Local)
1424
+ ${context}
1425
+
1426
+ `;
1427
+ hasLocalContext = true;
1428
+ }
1429
+ } catch (err) {
1430
+ console.warn(`Warning: Could not read context file: ${err}`);
1431
+ }
1432
+ }
1433
+ if (!hasLocalContext) {
1434
+ const fallback = this.getFallbackContext();
1435
+ if (fallback) {
1436
+ prompt += `## Project Context (README Fallback)
1437
+ ${fallback}
1438
+
1439
+ `;
1440
+ }
1441
+ }
1442
+ prompt += this.getProjectStructure();
1443
+ prompt += this.getSkillsInfo();
1444
+ prompt += `## Project Knowledge Base
1445
+ `;
1446
+ prompt += `You have access to the following documentation directories for context:
1447
+ `;
1448
+ prompt += `- Artifacts: \`.locus/artifacts\`
1449
+ `;
1450
+ prompt += `- Documents: \`.locus/documents\`
1451
+ `;
1452
+ prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
1453
+
1454
+ `;
1455
+ const indexPath = getLocusPath(this.projectPath, "indexFile");
1456
+ if (import_node_fs4.existsSync(indexPath)) {
1457
+ prompt += `## Codebase Overview
1458
+ There is an index file in the .locus/codebase-index.json and if you need you can check it.
1459
+
1460
+ `;
1461
+ }
1462
+ prompt += `## Instructions
1463
+ 1. Execute the prompt based on the provided project context.
1464
+ 2. **Paths**: Use relative paths from the project root at all times. Do NOT use absolute local paths (e.g., /Users/...).
1465
+ 3. When finished successfully, output: <promise>COMPLETE</promise>
1397
1466
  `;
1398
1467
  return prompt;
1399
1468
  }
@@ -6,6 +6,7 @@ export declare class PromptBuilder {
6
6
  private projectPath;
7
7
  constructor(projectPath: string);
8
8
  build(task: Task, options?: PromptOptions): Promise<string>;
9
+ buildGenericPrompt(query: string): Promise<string>;
9
10
  private getProjectConfig;
10
11
  private getFallbackContext;
11
12
  private getProjectStructure;
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/core/prompt-builder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAa;IACZ,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,MAAM;IAEjC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAsIrE,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,aAAa;IAyCrB,OAAO,CAAC,qBAAqB;IAmB7B,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,MAAM,GAAG,IAAI;CAoBtD"}
1
+ {"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/core/prompt-builder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAa;IACZ,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,MAAM;IAEjC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAsI/D,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA6DxD,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,aAAa;IAyCrB,OAAO,CAAC,qBAAqB;IAmB7B,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,MAAM,GAAG,IAAI;CAoBtD"}
@@ -725,7 +725,6 @@ class ClaudeRunner {
725
725
  if (type === "content_block_start" && content_block) {
726
726
  if (content_block.type === "tool_use" && content_block.name) {
727
727
  this.log?.(`
728
-
729
728
  ${c.primary("[Claude]")} ${c.bold(`Running ${content_block.name}...`)}
730
729
  `, "info");
731
730
  }
@@ -1394,6 +1393,76 @@ ${comment.text}
1394
1393
  2. **Artifact Management**: If you create any high-level documentation (PRDs, technical drafts, architecture docs), you MUST save them in \`.locus/artifacts/\`. Do NOT create them in the root directory.
1395
1394
  3. **Paths**: Use relative paths from the project root at all times. Do NOT use absolute local paths (e.g., /Users/...).
1396
1395
  4. When finished successfully, output: <promise>COMPLETE</promise>
1396
+ `;
1397
+ return prompt;
1398
+ }
1399
+ async buildGenericPrompt(query) {
1400
+ let prompt = `# Direct Execution
1401
+
1402
+ `;
1403
+ prompt += `## Prompt
1404
+ ${query}
1405
+
1406
+ `;
1407
+ const projectConfig = this.getProjectConfig();
1408
+ if (projectConfig) {
1409
+ prompt += `## Project Metadata
1410
+ `;
1411
+ prompt += `- Version: ${projectConfig.version || "Unknown"}
1412
+ `;
1413
+ prompt += `- Created At: ${projectConfig.createdAt || "Unknown"}
1414
+
1415
+ `;
1416
+ }
1417
+ const contextPath = getLocusPath(this.projectPath, "contextFile");
1418
+ let hasLocalContext = false;
1419
+ if (import_node_fs4.existsSync(contextPath)) {
1420
+ try {
1421
+ const context = import_node_fs4.readFileSync(contextPath, "utf-8");
1422
+ if (context.trim().length > 20) {
1423
+ prompt += `## Project Context (Local)
1424
+ ${context}
1425
+
1426
+ `;
1427
+ hasLocalContext = true;
1428
+ }
1429
+ } catch (err) {
1430
+ console.warn(`Warning: Could not read context file: ${err}`);
1431
+ }
1432
+ }
1433
+ if (!hasLocalContext) {
1434
+ const fallback = this.getFallbackContext();
1435
+ if (fallback) {
1436
+ prompt += `## Project Context (README Fallback)
1437
+ ${fallback}
1438
+
1439
+ `;
1440
+ }
1441
+ }
1442
+ prompt += this.getProjectStructure();
1443
+ prompt += this.getSkillsInfo();
1444
+ prompt += `## Project Knowledge Base
1445
+ `;
1446
+ prompt += `You have access to the following documentation directories for context:
1447
+ `;
1448
+ prompt += `- Artifacts: \`.locus/artifacts\`
1449
+ `;
1450
+ prompt += `- Documents: \`.locus/documents\`
1451
+ `;
1452
+ prompt += `If you need more information about the project strategies, plans, or architecture, please read files in these directories.
1453
+
1454
+ `;
1455
+ const indexPath = getLocusPath(this.projectPath, "indexFile");
1456
+ if (import_node_fs4.existsSync(indexPath)) {
1457
+ prompt += `## Codebase Overview
1458
+ There is an index file in the .locus/codebase-index.json and if you need you can check it.
1459
+
1460
+ `;
1461
+ }
1462
+ prompt += `## Instructions
1463
+ 1. Execute the prompt based on the provided project context.
1464
+ 2. **Paths**: Use relative paths from the project root at all times. Do NOT use absolute local paths (e.g., /Users/...).
1465
+ 3. When finished successfully, output: <promise>COMPLETE</promise>
1397
1466
  `;
1398
1467
  return prompt;
1399
1468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/sdk",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -30,7 +30,7 @@
30
30
  "clean": "rm -rf node_modules"
31
31
  },
32
32
  "dependencies": {
33
- "@locusai/shared": "^0.7.1",
33
+ "@locusai/shared": "^0.7.3",
34
34
  "axios": "^1.13.2",
35
35
  "events": "^3.3.0",
36
36
  "globby": "^14.0.2"