orquesta-cli 0.1.26 → 0.1.27

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.
@@ -1,6 +1,7 @@
1
1
  import { logger } from '../../utils/logger.js';
2
2
  import { buildPlanningSystemPrompt } from '../../prompts/agents/planning.js';
3
3
  import { toolRegistry } from '../../tools/registry.js';
4
+ import { getProjectContext } from '../../core/project-context.js';
4
5
  export class PlanningLLM {
5
6
  llmClient;
6
7
  askUserCallback = null;
@@ -18,7 +19,8 @@ export class PlanningLLM {
18
19
  async generateTODOList(userRequest, contextMessages) {
19
20
  const toolSummary = toolRegistry.getToolSummaryForPlanning();
20
21
  const optionalToolsInfo = toolRegistry.getEnabledOptionalToolsInfo();
21
- const systemPrompt = buildPlanningSystemPrompt(toolSummary, optionalToolsInfo);
22
+ const projectContext = getProjectContext();
23
+ const systemPrompt = buildPlanningSystemPrompt(toolSummary, optionalToolsInfo) + projectContext;
22
24
  const clarificationMessages = [];
23
25
  const messages = [
24
26
  {
@@ -0,0 +1,3 @@
1
+ export declare function getProjectContext(cwd?: string): string;
2
+ export declare function invalidateProjectContext(): void;
3
+ //# sourceMappingURL=project-context.d.ts.map
@@ -0,0 +1,54 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { logger } from '../utils/logger.js';
4
+ const MAX_BYTES = 32_000;
5
+ const CANDIDATE_PATHS = [
6
+ 'CLAUDE.md',
7
+ '.claude/CLAUDE.md',
8
+ 'AGENT.md',
9
+ 'agent.md',
10
+ ];
11
+ let cachedContext;
12
+ function readFirstAvailable(cwd) {
13
+ for (const rel of CANDIDATE_PATHS) {
14
+ const abs = path.join(cwd, rel);
15
+ try {
16
+ const stat = fs.statSync(abs);
17
+ if (!stat.isFile())
18
+ continue;
19
+ let content = fs.readFileSync(abs, 'utf-8');
20
+ if (Buffer.byteLength(content, 'utf-8') > MAX_BYTES) {
21
+ content = content.slice(0, MAX_BYTES) + '\n\n[...truncated for context window]';
22
+ }
23
+ return { path: rel, content };
24
+ }
25
+ catch {
26
+ continue;
27
+ }
28
+ }
29
+ return null;
30
+ }
31
+ export function getProjectContext(cwd = process.cwd()) {
32
+ if (cachedContext !== undefined)
33
+ return cachedContext ?? '';
34
+ const hit = readFirstAvailable(cwd);
35
+ if (!hit) {
36
+ cachedContext = null;
37
+ logger.debug('No CLAUDE.md / AGENT.md found in cwd', { cwd });
38
+ return '';
39
+ }
40
+ logger.info(`Loaded project context from ${hit.path} (${hit.content.length} chars)`);
41
+ cachedContext = [
42
+ '',
43
+ '## PROJECT CONTEXT',
44
+ `(from ${hit.path} — treat as authoritative project conventions)`,
45
+ '',
46
+ hit.content,
47
+ '',
48
+ ].join('\n');
49
+ return cachedContext;
50
+ }
51
+ export function invalidateProjectContext() {
52
+ cachedContext = undefined;
53
+ }
54
+ //# sourceMappingURL=project-context.js.map
@@ -8,6 +8,7 @@ import { setDocsSearchLLMClientGetter, clearDocsSearchLLMClientGetter, } from '.
8
8
  import { emitPlanCreated, emitTodoStart, emitTodoComplete, emitTodoFail, emitCompact, emitAssistantResponse, } from '../tools/llm/simple/file-tools.js';
9
9
  import { toolRegistry } from '../tools/registry.js';
10
10
  import { PLAN_EXECUTE_SYSTEM_PROMPT as PLAN_PROMPT } from '../prompts/system/plan-execute.js';
11
+ import { getProjectContext } from '../core/project-context.js';
11
12
  import { GIT_COMMIT_RULES } from '../prompts/shared/git-rules.js';
12
13
  import { logger } from '../utils/logger.js';
13
14
  import { getStreamLogger } from '../utils/json-stream-logger.js';
@@ -15,10 +16,9 @@ import { detectGitRepo } from '../utils/git-utils.js';
15
16
  import { formatErrorMessage, buildTodoContext, findActiveTodo, getTodoStats } from './utils.js';
16
17
  function buildSystemPrompt() {
17
18
  const isGitRepo = detectGitRepo();
18
- if (isGitRepo) {
19
- return `${PLAN_PROMPT}\n\n${GIT_COMMIT_RULES}`;
20
- }
21
- return PLAN_PROMPT;
19
+ const projectContext = getProjectContext();
20
+ const base = isGitRepo ? `${PLAN_PROMPT}\n\n${GIT_COMMIT_RULES}` : PLAN_PROMPT;
21
+ return base + projectContext;
22
22
  }
23
23
  export class PlanExecutor {
24
24
  currentLLMClient = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquesta-cli",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Orquesta CLI - AI-powered coding assistant with team collaboration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",