vralphy 0.8.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.
Files changed (158) hide show
  1. package/README.md +512 -0
  2. package/bin/vralphy.js +3 -0
  3. package/dist/commands/build.d.ts +9 -0
  4. package/dist/commands/build.d.ts.map +1 -0
  5. package/dist/commands/build.js +176 -0
  6. package/dist/commands/build.js.map +1 -0
  7. package/dist/commands/cleanup.d.ts +19 -0
  8. package/dist/commands/cleanup.d.ts.map +1 -0
  9. package/dist/commands/cleanup.js +159 -0
  10. package/dist/commands/cleanup.js.map +1 -0
  11. package/dist/commands/cleanup.test.d.ts +2 -0
  12. package/dist/commands/cleanup.test.d.ts.map +1 -0
  13. package/dist/commands/cleanup.test.js +389 -0
  14. package/dist/commands/cleanup.test.js.map +1 -0
  15. package/dist/commands/init.d.ts +13 -0
  16. package/dist/commands/init.d.ts.map +1 -0
  17. package/dist/commands/init.js +120 -0
  18. package/dist/commands/init.js.map +1 -0
  19. package/dist/commands/plan.d.ts +9 -0
  20. package/dist/commands/plan.d.ts.map +1 -0
  21. package/dist/commands/plan.js +147 -0
  22. package/dist/commands/plan.js.map +1 -0
  23. package/dist/commands/spec.d.ts +9 -0
  24. package/dist/commands/spec.d.ts.map +1 -0
  25. package/dist/commands/spec.js +111 -0
  26. package/dist/commands/spec.js.map +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +251 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/lib/agents.d.ts +32 -0
  32. package/dist/lib/agents.d.ts.map +1 -0
  33. package/dist/lib/agents.js +96 -0
  34. package/dist/lib/agents.js.map +1 -0
  35. package/dist/lib/config.d.ts +54 -0
  36. package/dist/lib/config.d.ts.map +1 -0
  37. package/dist/lib/config.js +199 -0
  38. package/dist/lib/config.js.map +1 -0
  39. package/dist/lib/config.test.d.ts +2 -0
  40. package/dist/lib/config.test.d.ts.map +1 -0
  41. package/dist/lib/config.test.js +57 -0
  42. package/dist/lib/config.test.js.map +1 -0
  43. package/dist/lib/context.d.ts +29 -0
  44. package/dist/lib/context.d.ts.map +1 -0
  45. package/dist/lib/context.js +175 -0
  46. package/dist/lib/context.js.map +1 -0
  47. package/dist/lib/engines/base.d.ts +75 -0
  48. package/dist/lib/engines/base.d.ts.map +1 -0
  49. package/dist/lib/engines/base.js +62 -0
  50. package/dist/lib/engines/base.js.map +1 -0
  51. package/dist/lib/engines/base.test.d.ts +2 -0
  52. package/dist/lib/engines/base.test.d.ts.map +1 -0
  53. package/dist/lib/engines/base.test.js +28 -0
  54. package/dist/lib/engines/base.test.js.map +1 -0
  55. package/dist/lib/engines/claude.d.ts +12 -0
  56. package/dist/lib/engines/claude.d.ts.map +1 -0
  57. package/dist/lib/engines/claude.js +156 -0
  58. package/dist/lib/engines/claude.js.map +1 -0
  59. package/dist/lib/engines/codex.d.ts +28 -0
  60. package/dist/lib/engines/codex.d.ts.map +1 -0
  61. package/dist/lib/engines/codex.js +177 -0
  62. package/dist/lib/engines/codex.js.map +1 -0
  63. package/dist/lib/engines/index.d.ts +19 -0
  64. package/dist/lib/engines/index.d.ts.map +1 -0
  65. package/dist/lib/engines/index.js +40 -0
  66. package/dist/lib/engines/index.js.map +1 -0
  67. package/dist/lib/engines/opencode.d.ts +14 -0
  68. package/dist/lib/engines/opencode.d.ts.map +1 -0
  69. package/dist/lib/engines/opencode.js +127 -0
  70. package/dist/lib/engines/opencode.js.map +1 -0
  71. package/dist/lib/events/index.d.ts +6 -0
  72. package/dist/lib/events/index.d.ts.map +1 -0
  73. package/dist/lib/events/index.js +5 -0
  74. package/dist/lib/events/index.js.map +1 -0
  75. package/dist/lib/events/types.d.ts +93 -0
  76. package/dist/lib/events/types.d.ts.map +1 -0
  77. package/dist/lib/events/types.js +7 -0
  78. package/dist/lib/events/types.js.map +1 -0
  79. package/dist/lib/events/writer.d.ts +68 -0
  80. package/dist/lib/events/writer.d.ts.map +1 -0
  81. package/dist/lib/events/writer.js +178 -0
  82. package/dist/lib/events/writer.js.map +1 -0
  83. package/dist/lib/events.d.ts +33 -0
  84. package/dist/lib/events.d.ts.map +1 -0
  85. package/dist/lib/events.js +81 -0
  86. package/dist/lib/events.js.map +1 -0
  87. package/dist/lib/events.test.d.ts +2 -0
  88. package/dist/lib/events.test.d.ts.map +1 -0
  89. package/dist/lib/events.test.js +123 -0
  90. package/dist/lib/events.test.js.map +1 -0
  91. package/dist/lib/file-injection.d.ts +32 -0
  92. package/dist/lib/file-injection.d.ts.map +1 -0
  93. package/dist/lib/file-injection.js +138 -0
  94. package/dist/lib/file-injection.js.map +1 -0
  95. package/dist/lib/file-injection.test.d.ts +2 -0
  96. package/dist/lib/file-injection.test.d.ts.map +1 -0
  97. package/dist/lib/file-injection.test.js +508 -0
  98. package/dist/lib/file-injection.test.js.map +1 -0
  99. package/dist/lib/init.d.ts +27 -0
  100. package/dist/lib/init.d.ts.map +1 -0
  101. package/dist/lib/init.js +363 -0
  102. package/dist/lib/init.js.map +1 -0
  103. package/dist/lib/init.test.d.ts +2 -0
  104. package/dist/lib/init.test.d.ts.map +1 -0
  105. package/dist/lib/init.test.js +315 -0
  106. package/dist/lib/init.test.js.map +1 -0
  107. package/dist/lib/plan.d.ts +11 -0
  108. package/dist/lib/plan.d.ts.map +1 -0
  109. package/dist/lib/plan.js +22 -0
  110. package/dist/lib/plan.js.map +1 -0
  111. package/dist/lib/plan.test.d.ts +2 -0
  112. package/dist/lib/plan.test.d.ts.map +1 -0
  113. package/dist/lib/plan.test.js +70 -0
  114. package/dist/lib/plan.test.js.map +1 -0
  115. package/dist/lib/prompts/codex.d.ts +18 -0
  116. package/dist/lib/prompts/codex.d.ts.map +1 -0
  117. package/dist/lib/prompts/codex.js +82 -0
  118. package/dist/lib/prompts/codex.js.map +1 -0
  119. package/dist/lib/prompts/opencode.d.ts +16 -0
  120. package/dist/lib/prompts/opencode.d.ts.map +1 -0
  121. package/dist/lib/prompts/opencode.js +71 -0
  122. package/dist/lib/prompts/opencode.js.map +1 -0
  123. package/dist/lib/prompts.d.ts +57 -0
  124. package/dist/lib/prompts.d.ts.map +1 -0
  125. package/dist/lib/prompts.js +255 -0
  126. package/dist/lib/prompts.js.map +1 -0
  127. package/dist/lib/prompts.test.d.ts +2 -0
  128. package/dist/lib/prompts.test.d.ts.map +1 -0
  129. package/dist/lib/prompts.test.js +128 -0
  130. package/dist/lib/prompts.test.js.map +1 -0
  131. package/dist/lib/skills.d.ts +36 -0
  132. package/dist/lib/skills.d.ts.map +1 -0
  133. package/dist/lib/skills.js +132 -0
  134. package/dist/lib/skills.js.map +1 -0
  135. package/dist/lib/slack.d.ts +43 -0
  136. package/dist/lib/slack.d.ts.map +1 -0
  137. package/dist/lib/slack.js +130 -0
  138. package/dist/lib/slack.js.map +1 -0
  139. package/dist/lib/slack.test.d.ts +2 -0
  140. package/dist/lib/slack.test.d.ts.map +1 -0
  141. package/dist/lib/slack.test.js +74 -0
  142. package/dist/lib/slack.test.js.map +1 -0
  143. package/dist/lib/templates/injections.d.ts +18 -0
  144. package/dist/lib/templates/injections.d.ts.map +1 -0
  145. package/dist/lib/templates/injections.js +32 -0
  146. package/dist/lib/templates/injections.js.map +1 -0
  147. package/dist/lib/templates/readme.d.ts +6 -0
  148. package/dist/lib/templates/readme.d.ts.map +1 -0
  149. package/dist/lib/templates/readme.js +168 -0
  150. package/dist/lib/templates/readme.js.map +1 -0
  151. package/docs/COMMANDS.md +664 -0
  152. package/docs/DESIGN.md +537 -0
  153. package/docs/EXAMPLES.md +812 -0
  154. package/docs/METHODOLOGY.md +390 -0
  155. package/docs/README.md +110 -0
  156. package/docs/WORKFLOWS.md +808 -0
  157. package/llms.txt +104 -0
  158. package/package.json +58 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * OpenCode-specific prompt templates
3
+ *
4
+ * OpenCode uses Plan/Build modes for context isolation. It doesn't support
5
+ * parallel tool calls or native subagents, so prompts focus on sequential
6
+ * focused iterations with clear mode awareness.
7
+ */
8
+ /**
9
+ * Skills and agents lazy loading section for OpenCode
10
+ */
11
+ const OPENCODE_LAZY_LOADING_SECTION = `
12
+ ## Lazy Loading
13
+
14
+ Skills: \${skillsDir} - Load ONLY when stuck or task requires domain knowledge
15
+ Agents: \${agentsDir} - Load ONLY for deep specialized analysis
16
+
17
+ Do NOT preload - keep context focused on current task.
18
+ `;
19
+ /**
20
+ * OpenCode plan mode prompt
21
+ */
22
+ export const OPENCODE_PLAN_PROMPT = `0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.
23
+ 0b. Study specs/* systematically to learn the project specifications.
24
+ 0c. Study @IMPLEMENTATION_PLAN.md (if present) to understand the plan so far.
25
+ 0d. Study src/lib/* to understand shared utilities & components.
26
+ 0e. For reference, the application source code is in src/*.
27
+
28
+ 1. Study @IMPLEMENTATION_PLAN.md (if present; it may be incorrect) and study existing source code in src/* and compare it against specs/*. Analyze findings, prioritize tasks, and create/update @IMPLEMENTATION_PLAN.md as a bullet point list sorted in priority of items yet to be implemented. Consider searching for TODO, minimal implementations, placeholders, skipped/flaky tests, and inconsistent patterns.
29
+
30
+ IMPORTANT: Plan only. Do NOT implement anything. Do NOT assume functionality is missing; confirm with code search first. Treat src/lib as the project's standard library for shared utilities and components. Prefer consolidated, idiomatic implementations there over ad-hoc copies.
31
+
32
+ ## Mode Awareness
33
+
34
+ You are in PLAN mode. Focus on analysis and prioritization. Do NOT make code changes.
35
+ ${OPENCODE_LAZY_LOADING_SECTION}`;
36
+ /**
37
+ * OpenCode build mode prompt
38
+ */
39
+ export const OPENCODE_BUILD_PROMPT = `0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.
40
+ 0b. Study specs/* systematically to learn the project specifications.
41
+ 0c. Study @IMPLEMENTATION_PLAN.md.
42
+ 0d. For reference, the application source code is in src/*.
43
+
44
+ 1. Your task is to implement functionality per the specifications. Follow @IMPLEMENTATION_PLAN.md and choose the most important item to address. Before making changes, search the codebase thoroughly (don't assume not implemented). OpenCode executes sequentially - read related files in logical groups, start with critical path files first.
45
+
46
+ 2. After implementing functionality or resolving problems, run the tests for that unit of code that was improved. If functionality is missing then it's your job to add it as per the application specifications.
47
+
48
+ 3. When you discover issues, immediately update @IMPLEMENTATION_PLAN.md with your findings. When resolved, update and remove the item.
49
+
50
+ 4. When the tests pass, update @IMPLEMENTATION_PLAN.md, then git add -A then git commit with a message describing the changes. After the commit, git push.
51
+
52
+ ## Mode Awareness
53
+
54
+ You are in BUILD mode. Focus on implementation. If you need to analyze architecture or plan a major refactor, suggest switching to PLAN mode.
55
+
56
+ 99999. When authoring documentation, capture the why - tests and implementation importance.
57
+ 999999. Single sources of truth, no migrations/adapters. If tests unrelated to your work fail, resolve them as part of the increment.
58
+ 9999999. As soon as there are no build or test errors create a git tag. If there are no git tags start at 0.0.0 and increment patch by 1.
59
+ 99999999. You may add extra logging if required to debug issues.
60
+ 999999999. Keep @IMPLEMENTATION_PLAN.md current with learnings - future work depends on this.
61
+ 9999999999. When you learn something new about how to run the application, update .vralphy/AGENTS.md but keep it brief.
62
+ 99999999999. For any bugs you notice, resolve them or document them in @IMPLEMENTATION_PLAN.md even if unrelated to current work.
63
+ 999999999999. Implement functionality completely. Placeholders and stubs waste efforts and time redoing the same work.
64
+ 9999999999999. When @IMPLEMENTATION_PLAN.md becomes large periodically clean out the items that are completed.
65
+ 99999999999999. IMPORTANT: Keep .vralphy/AGENTS.md operational only - status updates belong in IMPLEMENTATION_PLAN.md. A bloated AGENTS.md pollutes every future loop's context.
66
+
67
+ ## Context Freshness
68
+
69
+ Complete one task fully before starting another. Update @IMPLEMENTATION_PLAN.md frequently - it persists across sessions. If overwhelmed, focus on single most important task.
70
+ ${OPENCODE_LAZY_LOADING_SECTION}`;
71
+ //# sourceMappingURL=opencode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../../src/lib/prompts/opencode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,6BAA6B,GAAG;;;;;;;CAOrC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;EAalC,6BAA6B,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BnC,6BAA6B,EAAE,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { EngineName } from './engines/index.js';
2
+ import { CODEX_DEFAULT_MAX_AGENTS, CODEX_DEFAULT_WORKER_TIMEOUT } from './prompts/codex.js';
3
+ export interface PromptContext {
4
+ planningModel: string;
5
+ executorModel: string;
6
+ engine: EngineName;
7
+ projectName?: string;
8
+ existingSpecs?: string[];
9
+ topic?: string;
10
+ maxAgents?: number;
11
+ workerTimeout?: number;
12
+ }
13
+ /**
14
+ * Get skill/agent locations for an engine
15
+ */
16
+ export declare function getEngineLocations(engine: EngineName): {
17
+ skills: string;
18
+ agents: string;
19
+ };
20
+ /**
21
+ * Load a prompt template from file
22
+ */
23
+ export declare function loadPromptTemplate(path: string): Promise<string>;
24
+ /**
25
+ * Interpolate variables in prompt template
26
+ */
27
+ export declare function interpolatePrompt(template: string, context: PromptContext): string;
28
+ /**
29
+ * Load and interpolate prompt
30
+ */
31
+ export declare function loadPrompt(path: string, context: PromptContext): Promise<string>;
32
+ /**
33
+ * Default plan mode prompt
34
+ */
35
+ export declare const DEFAULT_PLAN_PROMPT = "0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.\n0b. Study `specs/*` with up to 250 parallel ${executor} subagents to learn the project specifications.\n0c. Study @IMPLEMENTATION_PLAN.md (if present) to understand the plan so far.\n0d. Study `src/lib/*` with up to 250 parallel ${executor} subagents to understand shared utilities & components.\n0e. For reference, the application source code is in `src/*`.\n\n1. Study @IMPLEMENTATION_PLAN.md (if present; it may be incorrect) and use up to 500 ${executor} subagents to study existing source code in `src/*` and compare it against `specs/*`. Use an ${model} subagent to analyze findings, prioritize tasks, and create/update @IMPLEMENTATION_PLAN.md as a bullet point list sorted in priority of items yet to be implemented. Ultrathink. Consider searching for TODO, minimal implementations, placeholders, skipped/flaky tests, and inconsistent patterns. Study @IMPLEMENTATION_PLAN.md to determine starting point for research and keep it up to date with items considered complete/incomplete using subagents.\n\nIMPORTANT: Plan only. Do NOT implement anything. Do NOT assume functionality is missing; confirm with code search first. Treat `src/lib` as the project's standard library for shared utilities and components. Prefer consolidated, idiomatic implementations there over ad-hoc copies.\n\n## Skills & Agents (On-Demand Loading)\n\nSkills location: ${skillsDir}\nAgents location: ${agentsDir}\n\nIMPORTANT - Context is precious. DO NOT preload all skills/agents.\n\n### When to load a skill:\n- Current task requires domain-specific knowledge you lack\n- A spec explicitly references a framework/library that has a matching skill\n- You've attempted something twice and failed - check if a skill could help\n\n### When to spawn a specialized agent:\n- Task requires deep focused expertise (security audit, architecture review)\n- You need a second opinion on a complex decision\n- Parallel work that benefits from isolation\n\n### How to load:\n1. Use a ${executor} subagent to read the skill/agent file\n2. Extract only the relevant section for your current task\n3. Do NOT inject entire skill contents into main context\n\n### Available skills (check if directory exists):\nList files in ${skillsDir} only when you need domain knowledge.\n\n### Available agents (check if directory exists):\nList files in ${agentsDir} only when you need to spawn specialized help.\n";
36
+ /**
37
+ * Default build mode prompt
38
+ */
39
+ export declare const DEFAULT_BUILD_PROMPT = "0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.\n0b. Study `specs/*` with up to 500 parallel ${executor} subagents to learn the project specifications.\n0c. Study @IMPLEMENTATION_PLAN.md.\n0d. For reference, the application source code is in `src/*`.\n\n1. Your task is to implement functionality per the specifications using parallel subagents. Follow @IMPLEMENTATION_PLAN.md and choose the most important item to address. Before making changes, search the codebase (don't assume not implemented) using ${executor} subagents. You may use up to 500 parallel ${executor} subagents for searches/reads and only 1 ${executor} subagent for build/tests. Use ${model} subagents when complex reasoning is needed (debugging, architectural decisions).\n\n2. After implementing functionality or resolving problems, run the tests for that unit of code that was improved. If functionality is missing then it's your job to add it as per the application specifications. Ultrathink.\n\n3. When you discover issues, immediately update @IMPLEMENTATION_PLAN.md with your findings using a subagent. When resolved, update and remove the item.\n\n4. When the tests pass, update @IMPLEMENTATION_PLAN.md, then `git add -A` then `git commit` with a message describing the changes. After the commit, `git push`.\n\n99999. When authoring documentation, capture the why \u2014 tests and implementation importance.\n999999. Single sources of truth, no migrations/adapters. If tests unrelated to your work fail, resolve them as part of the increment.\n9999999. As soon as there are no build or test errors create a git tag. If there are no git tags start at 0.0.0 and increment patch by 1.\n99999999. You may add extra logging if required to debug issues.\n999999999. Keep @IMPLEMENTATION_PLAN.md current with learnings using a subagent \u2014 future work depends on this.\n9999999999. When you learn something new about how to run the application, update .vralphy/AGENTS.md using a subagent but keep it brief.\n99999999999. For any bugs you notice, resolve them or document them in @IMPLEMENTATION_PLAN.md even if unrelated to current work.\n999999999999. Implement functionality completely. Placeholders and stubs waste efforts and time redoing the same work.\n9999999999999. When @IMPLEMENTATION_PLAN.md becomes large periodically clean out the items that are completed using a subagent.\n99999999999999. IMPORTANT: Keep .vralphy/AGENTS.md operational only \u2014 status updates belong in `IMPLEMENTATION_PLAN.md`. A bloated AGENTS.md pollutes every future loop's context.\n\n## Skills & Agents (On-Demand Loading)\n\nSkills location: ${skillsDir}\nAgents location: ${agentsDir}\n\nIMPORTANT - Context is precious. DO NOT preload all skills/agents.\n\n### When to load a skill:\n- Current task requires domain-specific knowledge you lack\n- A spec explicitly references a framework/library that has a matching skill\n- You've attempted something twice and failed - check if a skill could help\n\n### When to spawn a specialized agent:\n- Task requires deep focused expertise (security audit, architecture review)\n- You need a second opinion on a complex decision\n- Parallel work that benefits from isolation\n\n### How to load:\n1. Use a ${executor} subagent to read the skill/agent file\n2. Extract only the relevant section for your current task\n3. Do NOT inject entire skill contents into main context\n\n### Available skills (check if directory exists):\nList files in ${skillsDir} only when you need domain knowledge.\n\n### Available agents (check if directory exists):\nList files in ${agentsDir} only when you need to spawn specialized help.\n";
40
+ /**
41
+ * Default init mode prompt for AI-powered AGENTS.md generation
42
+ */
43
+ export declare const DEFAULT_INIT_PROMPT = "You are initializing a project for AI-assisted development. Generate a lightweight AGENTS.md file.\n\n## Project Context\n${projectContext}\n\n## Requirements\n- Maximum 60 lines total\n- OPERATIONAL ONLY: build, run, test, lint, typecheck commands\n- Include project-specific patterns discovered from existing docs\n- Focus on commands that actually exist in the project\n- NO: changelogs, TODOs, verbose explanations, generic advice\n\n## Output Sections\n\nGenerate ONLY these sections (skip if no relevant commands):\n\n## Build & Run\n- Build: `command`\n- Dev: `command`\n\n## Validation\n- Tests: `command`\n- Typecheck: `command`\n- Lint: `command`\n\n## Tech Stack\n- Brief list of main technologies\n\n## Codebase Patterns\n- Bullet points of project-specific conventions (extracted from existing docs)\n\n## IMPORTANT\nIf critical information is missing (like how to run tests), ask UP TO 3 clarifying questions first.\nOutput ONLY the AGENTS.md content, no preamble or explanation.\n";
44
+ /**
45
+ * Default spec mode prompt
46
+ */
47
+ export declare const DEFAULT_SPEC_PROMPT = "You are helping define requirements for: ${topic}\n\n## Context\n- Project: ${projectName}\n- Existing specs: ${existingSpecs}\n\n## Your Task\n\n1. Ask clarifying questions to understand the requirement fully\n2. Consider edge cases and constraints\n3. Draft a complete specification\n4. Present for user approval\n\n## Question Guidelines\n\nAsk about:\n- User personas and use cases\n- Happy path and error cases\n- Integration points\n- Performance requirements\n- Security considerations\n\n## Output Format\n\nWhen ready, output the spec in this format:\n\n# ${topic}\n\n## Overview\n[Brief description]\n\n## Requirements\n- [ ] Requirement 1\n- [ ] Requirement 2\n\n## Acceptance Criteria\n- [ ] Criterion 1\n- [ ] Criterion 2\n\n## Edge Cases\n[List edge cases]\n\n## Dependencies\n[List dependencies]\n\n## Skills & Agents (On-Demand Loading)\n\nSkills location: ${skillsDir}\nAgents location: ${agentsDir}\n\nIMPORTANT - Context is precious. DO NOT preload all skills/agents.\n\n### When to load a skill:\n- Current task requires domain-specific knowledge you lack\n- A spec explicitly references a framework/library that has a matching skill\n- You've attempted something twice and failed - check if a skill could help\n\n### When to spawn a specialized agent:\n- Task requires deep focused expertise (security audit, architecture review)\n- You need a second opinion on a complex decision\n- Parallel work that benefits from isolation\n\n### How to load:\n1. Use a ${executor} subagent to read the skill/agent file\n2. Extract only the relevant section for your current task\n3. Do NOT inject entire skill contents into main context\n\n### Available skills (check if directory exists):\nList files in ${skillsDir} only when you need domain knowledge.\n\n### Available agents (check if directory exists):\nList files in ${agentsDir} only when you need to spawn specialized help.\n";
48
+ /**
49
+ * Get default build prompt for a specific engine
50
+ */
51
+ export declare function getDefaultBuildPrompt(engine: EngineName): string;
52
+ /**
53
+ * Get default plan prompt for a specific engine
54
+ */
55
+ export declare function getDefaultPlanPrompt(engine: EngineName): string;
56
+ export { CODEX_DEFAULT_MAX_AGENTS, CODEX_DEFAULT_WORKER_TIMEOUT };
57
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/lib/prompts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAGL,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAiBzF;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CA+BlF;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAGtF;AAmCD;;GAEG;AACH,eAAO,MAAM,mBAAmB,u5EASR,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,oBAAoB,+kHAuBT,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,mBAAmB,w+BAkC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,y2DA4CR,CAAC;AAEzB;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAShE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAS/D;AAGD,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,CAAC"}
@@ -0,0 +1,255 @@
1
+ import { readFile } from 'fs/promises';
2
+ import { existsSync } from 'fs';
3
+ import { CODEX_PLAN_PROMPT, CODEX_BUILD_PROMPT, CODEX_DEFAULT_MAX_AGENTS, CODEX_DEFAULT_WORKER_TIMEOUT, } from './prompts/codex.js';
4
+ import { OPENCODE_PLAN_PROMPT, OPENCODE_BUILD_PROMPT } from './prompts/opencode.js';
5
+ /**
6
+ * Get skill/agent locations for an engine
7
+ */
8
+ export function getEngineLocations(engine) {
9
+ const locations = {
10
+ claude: {
11
+ skills: '.claude/skills/',
12
+ agents: '.claude/agents/',
13
+ },
14
+ opencode: {
15
+ skills: '.opencode/skills/',
16
+ agents: '.opencode/agents/',
17
+ },
18
+ codex: {
19
+ skills: '.codex/skills/',
20
+ agents: '.codex/agents/',
21
+ },
22
+ };
23
+ return locations[engine];
24
+ }
25
+ /**
26
+ * Load a prompt template from file
27
+ */
28
+ export async function loadPromptTemplate(path) {
29
+ if (!existsSync(path)) {
30
+ throw new Error(`Prompt template not found: ${path}`);
31
+ }
32
+ return readFile(path, 'utf-8');
33
+ }
34
+ /**
35
+ * Interpolate variables in prompt template
36
+ */
37
+ export function interpolatePrompt(template, context) {
38
+ let result = template;
39
+ result = result.replace(/\$\{model\}/g, context.planningModel);
40
+ result = result.replace(/\$\{executor\}/g, context.executorModel);
41
+ result = result.replace(/\$\{primary\}/g, context.planningModel);
42
+ result = result.replace(/\$\{engine\}/g, context.engine);
43
+ const locations = getEngineLocations(context.engine);
44
+ result = result.replace(/\$\{skillsDir\}/g, locations.skills);
45
+ result = result.replace(/\$\{agentsDir\}/g, locations.agents);
46
+ if (context.projectName) {
47
+ result = result.replace(/\$\{projectName\}/g, context.projectName);
48
+ }
49
+ if (context.existingSpecs) {
50
+ result = result.replace(/\$\{existingSpecs\}/g, context.existingSpecs.join(', ') || 'none');
51
+ }
52
+ if (context.topic) {
53
+ result = result.replace(/\$\{topic\}/g, context.topic);
54
+ }
55
+ // Codex-specific interpolations
56
+ const maxAgents = context.maxAgents ?? CODEX_DEFAULT_MAX_AGENTS;
57
+ const workerTimeout = context.workerTimeout ?? CODEX_DEFAULT_WORKER_TIMEOUT;
58
+ result = result.replace(/\$\{maxAgents\}/g, String(maxAgents));
59
+ result = result.replace(/\$\{workerTimeout\}/g, String(workerTimeout));
60
+ return result;
61
+ }
62
+ /**
63
+ * Load and interpolate prompt
64
+ */
65
+ export async function loadPrompt(path, context) {
66
+ const template = await loadPromptTemplate(path);
67
+ return interpolatePrompt(template, context);
68
+ }
69
+ /**
70
+ * Skills and agents lazy loading section (appended to prompts)
71
+ */
72
+ const LAZY_LOADING_SECTION = `
73
+ ## Skills & Agents (On-Demand Loading)
74
+
75
+ Skills location: \${skillsDir}
76
+ Agents location: \${agentsDir}
77
+
78
+ IMPORTANT - Context is precious. DO NOT preload all skills/agents.
79
+
80
+ ### When to load a skill:
81
+ - Current task requires domain-specific knowledge you lack
82
+ - A spec explicitly references a framework/library that has a matching skill
83
+ - You've attempted something twice and failed - check if a skill could help
84
+
85
+ ### When to spawn a specialized agent:
86
+ - Task requires deep focused expertise (security audit, architecture review)
87
+ - You need a second opinion on a complex decision
88
+ - Parallel work that benefits from isolation
89
+
90
+ ### How to load:
91
+ 1. Use a \${executor} subagent to read the skill/agent file
92
+ 2. Extract only the relevant section for your current task
93
+ 3. Do NOT inject entire skill contents into main context
94
+
95
+ ### Available skills (check if directory exists):
96
+ List files in \${skillsDir} only when you need domain knowledge.
97
+
98
+ ### Available agents (check if directory exists):
99
+ List files in \${agentsDir} only when you need to spawn specialized help.
100
+ `;
101
+ /**
102
+ * Default plan mode prompt
103
+ */
104
+ export const DEFAULT_PLAN_PROMPT = `0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.
105
+ 0b. Study \`specs/*\` with up to 250 parallel \${executor} subagents to learn the project specifications.
106
+ 0c. Study @IMPLEMENTATION_PLAN.md (if present) to understand the plan so far.
107
+ 0d. Study \`src/lib/*\` with up to 250 parallel \${executor} subagents to understand shared utilities & components.
108
+ 0e. For reference, the application source code is in \`src/*\`.
109
+
110
+ 1. Study @IMPLEMENTATION_PLAN.md (if present; it may be incorrect) and use up to 500 \${executor} subagents to study existing source code in \`src/*\` and compare it against \`specs/*\`. Use an \${model} subagent to analyze findings, prioritize tasks, and create/update @IMPLEMENTATION_PLAN.md as a bullet point list sorted in priority of items yet to be implemented. Ultrathink. Consider searching for TODO, minimal implementations, placeholders, skipped/flaky tests, and inconsistent patterns. Study @IMPLEMENTATION_PLAN.md to determine starting point for research and keep it up to date with items considered complete/incomplete using subagents.
111
+
112
+ IMPORTANT: Plan only. Do NOT implement anything. Do NOT assume functionality is missing; confirm with code search first. Treat \`src/lib\` as the project's standard library for shared utilities and components. Prefer consolidated, idiomatic implementations there over ad-hoc copies.
113
+ ${LAZY_LOADING_SECTION}`;
114
+ /**
115
+ * Default build mode prompt
116
+ */
117
+ export const DEFAULT_BUILD_PROMPT = `0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.
118
+ 0b. Study \`specs/*\` with up to 500 parallel \${executor} subagents to learn the project specifications.
119
+ 0c. Study @IMPLEMENTATION_PLAN.md.
120
+ 0d. For reference, the application source code is in \`src/*\`.
121
+
122
+ 1. Your task is to implement functionality per the specifications using parallel subagents. Follow @IMPLEMENTATION_PLAN.md and choose the most important item to address. Before making changes, search the codebase (don't assume not implemented) using \${executor} subagents. You may use up to 500 parallel \${executor} subagents for searches/reads and only 1 \${executor} subagent for build/tests. Use \${model} subagents when complex reasoning is needed (debugging, architectural decisions).
123
+
124
+ 2. After implementing functionality or resolving problems, run the tests for that unit of code that was improved. If functionality is missing then it's your job to add it as per the application specifications. Ultrathink.
125
+
126
+ 3. When you discover issues, immediately update @IMPLEMENTATION_PLAN.md with your findings using a subagent. When resolved, update and remove the item.
127
+
128
+ 4. When the tests pass, update @IMPLEMENTATION_PLAN.md, then \`git add -A\` then \`git commit\` with a message describing the changes. After the commit, \`git push\`.
129
+
130
+ 99999. When authoring documentation, capture the why — tests and implementation importance.
131
+ 999999. Single sources of truth, no migrations/adapters. If tests unrelated to your work fail, resolve them as part of the increment.
132
+ 9999999. As soon as there are no build or test errors create a git tag. If there are no git tags start at 0.0.0 and increment patch by 1.
133
+ 99999999. You may add extra logging if required to debug issues.
134
+ 999999999. Keep @IMPLEMENTATION_PLAN.md current with learnings using a subagent — future work depends on this.
135
+ 9999999999. When you learn something new about how to run the application, update .vralphy/AGENTS.md using a subagent but keep it brief.
136
+ 99999999999. For any bugs you notice, resolve them or document them in @IMPLEMENTATION_PLAN.md even if unrelated to current work.
137
+ 999999999999. Implement functionality completely. Placeholders and stubs waste efforts and time redoing the same work.
138
+ 9999999999999. When @IMPLEMENTATION_PLAN.md becomes large periodically clean out the items that are completed using a subagent.
139
+ 99999999999999. IMPORTANT: Keep .vralphy/AGENTS.md operational only — status updates belong in \`IMPLEMENTATION_PLAN.md\`. A bloated AGENTS.md pollutes every future loop's context.
140
+ ${LAZY_LOADING_SECTION}`;
141
+ /**
142
+ * Default init mode prompt for AI-powered AGENTS.md generation
143
+ */
144
+ export const DEFAULT_INIT_PROMPT = `You are initializing a project for AI-assisted development. Generate a lightweight AGENTS.md file.
145
+
146
+ ## Project Context
147
+ \${projectContext}
148
+
149
+ ## Requirements
150
+ - Maximum 60 lines total
151
+ - OPERATIONAL ONLY: build, run, test, lint, typecheck commands
152
+ - Include project-specific patterns discovered from existing docs
153
+ - Focus on commands that actually exist in the project
154
+ - NO: changelogs, TODOs, verbose explanations, generic advice
155
+
156
+ ## Output Sections
157
+
158
+ Generate ONLY these sections (skip if no relevant commands):
159
+
160
+ ## Build & Run
161
+ - Build: \`command\`
162
+ - Dev: \`command\`
163
+
164
+ ## Validation
165
+ - Tests: \`command\`
166
+ - Typecheck: \`command\`
167
+ - Lint: \`command\`
168
+
169
+ ## Tech Stack
170
+ - Brief list of main technologies
171
+
172
+ ## Codebase Patterns
173
+ - Bullet points of project-specific conventions (extracted from existing docs)
174
+
175
+ ## IMPORTANT
176
+ If critical information is missing (like how to run tests), ask UP TO 3 clarifying questions first.
177
+ Output ONLY the AGENTS.md content, no preamble or explanation.
178
+ `;
179
+ /**
180
+ * Default spec mode prompt
181
+ */
182
+ export const DEFAULT_SPEC_PROMPT = `You are helping define requirements for: \${topic}
183
+
184
+ ## Context
185
+ - Project: \${projectName}
186
+ - Existing specs: \${existingSpecs}
187
+
188
+ ## Your Task
189
+
190
+ 1. Ask clarifying questions to understand the requirement fully
191
+ 2. Consider edge cases and constraints
192
+ 3. Draft a complete specification
193
+ 4. Present for user approval
194
+
195
+ ## Question Guidelines
196
+
197
+ Ask about:
198
+ - User personas and use cases
199
+ - Happy path and error cases
200
+ - Integration points
201
+ - Performance requirements
202
+ - Security considerations
203
+
204
+ ## Output Format
205
+
206
+ When ready, output the spec in this format:
207
+
208
+ # \${topic}
209
+
210
+ ## Overview
211
+ [Brief description]
212
+
213
+ ## Requirements
214
+ - [ ] Requirement 1
215
+ - [ ] Requirement 2
216
+
217
+ ## Acceptance Criteria
218
+ - [ ] Criterion 1
219
+ - [ ] Criterion 2
220
+
221
+ ## Edge Cases
222
+ [List edge cases]
223
+
224
+ ## Dependencies
225
+ [List dependencies]
226
+ ${LAZY_LOADING_SECTION}`;
227
+ /**
228
+ * Get default build prompt for a specific engine
229
+ */
230
+ export function getDefaultBuildPrompt(engine) {
231
+ switch (engine) {
232
+ case 'codex':
233
+ return CODEX_BUILD_PROMPT;
234
+ case 'opencode':
235
+ return OPENCODE_BUILD_PROMPT;
236
+ default:
237
+ return DEFAULT_BUILD_PROMPT;
238
+ }
239
+ }
240
+ /**
241
+ * Get default plan prompt for a specific engine
242
+ */
243
+ export function getDefaultPlanPrompt(engine) {
244
+ switch (engine) {
245
+ case 'codex':
246
+ return CODEX_PLAN_PROMPT;
247
+ case 'opencode':
248
+ return OPENCODE_PLAN_PROMPT;
249
+ default:
250
+ return DEFAULT_PLAN_PROMPT;
251
+ }
252
+ }
253
+ // Re-export Codex constants for external use
254
+ export { CODEX_DEFAULT_MAX_AGENTS, CODEX_DEFAULT_WORKER_TIMEOUT };
255
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/lib/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAapF;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAkB;IACnD,MAAM,SAAS,GAA2D;QACxE,MAAM,EAAE;YACN,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AoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuBlC,oBAAoB,EAAE,CAAC;AAEzB;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkClC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CjC,oBAAoB,EAAE,CAAC;AAEzB;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAkB;IACtD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,kBAAkB,CAAC;QAC5B,KAAK,UAAU;YACb,OAAO,qBAAqB,CAAC;QAC/B;YACE,OAAO,oBAAoB,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAkB;IACrD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,iBAAiB,CAAC;QAC3B,KAAK,UAAU;YACb,OAAO,oBAAoB,CAAC;QAC9B;YACE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;AACH,CAAC;AAED,6CAA6C;AAC7C,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prompts.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.test.d.ts","sourceRoot":"","sources":["../../src/lib/prompts.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,128 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { getDefaultBuildPrompt, getDefaultPlanPrompt, getEngineLocations, interpolatePrompt, } from './prompts.js';
3
+ import { CODEX_BUILD_PROMPT, CODEX_PLAN_PROMPT } from './prompts/codex.js';
4
+ import { OPENCODE_BUILD_PROMPT, OPENCODE_PLAN_PROMPT } from './prompts/opencode.js';
5
+ describe('getDefaultBuildPrompt', () => {
6
+ it('returns Codex-specific prompt for codex engine', () => {
7
+ const prompt = getDefaultBuildPrompt('codex');
8
+ expect(prompt).toBe(CODEX_BUILD_PROMPT);
9
+ });
10
+ it('returns OpenCode-specific prompt for opencode engine', () => {
11
+ const prompt = getDefaultBuildPrompt('opencode');
12
+ expect(prompt).toBe(OPENCODE_BUILD_PROMPT);
13
+ });
14
+ it('returns default prompt for claude engine', () => {
15
+ const prompt = getDefaultBuildPrompt('claude');
16
+ expect(prompt).not.toBe(CODEX_BUILD_PROMPT);
17
+ expect(prompt).not.toBe(OPENCODE_BUILD_PROMPT);
18
+ expect(prompt).toContain('subagent'); // Claude supports subagents
19
+ });
20
+ });
21
+ describe('getDefaultPlanPrompt', () => {
22
+ it('returns Codex-specific prompt for codex engine', () => {
23
+ const prompt = getDefaultPlanPrompt('codex');
24
+ expect(prompt).toBe(CODEX_PLAN_PROMPT);
25
+ });
26
+ it('returns OpenCode-specific prompt for opencode engine', () => {
27
+ const prompt = getDefaultPlanPrompt('opencode');
28
+ expect(prompt).toBe(OPENCODE_PLAN_PROMPT);
29
+ });
30
+ it('returns default prompt for claude engine', () => {
31
+ const prompt = getDefaultPlanPrompt('claude');
32
+ expect(prompt).not.toBe(CODEX_PLAN_PROMPT);
33
+ expect(prompt).not.toBe(OPENCODE_PLAN_PROMPT);
34
+ expect(prompt).toContain('subagent'); // Claude supports subagents
35
+ });
36
+ });
37
+ describe('getEngineLocations', () => {
38
+ it('returns claude-specific locations', () => {
39
+ const locations = getEngineLocations('claude');
40
+ expect(locations.skills).toBe('.claude/skills/');
41
+ expect(locations.agents).toBe('.claude/agents/');
42
+ });
43
+ it('returns opencode-specific locations', () => {
44
+ const locations = getEngineLocations('opencode');
45
+ expect(locations.skills).toBe('.opencode/skills/');
46
+ expect(locations.agents).toBe('.opencode/agents/');
47
+ });
48
+ it('returns codex-specific locations', () => {
49
+ const locations = getEngineLocations('codex');
50
+ expect(locations.skills).toBe('.codex/skills/');
51
+ expect(locations.agents).toBe('.codex/agents/');
52
+ });
53
+ });
54
+ describe('interpolatePrompt', () => {
55
+ it('interpolates model names correctly', () => {
56
+ const template = 'Model: ${model}, Executor: ${executor}';
57
+ const result = interpolatePrompt(template, {
58
+ planningModel: 'opus',
59
+ executorModel: 'sonnet',
60
+ engine: 'claude',
61
+ });
62
+ expect(result).toBe('Model: opus, Executor: sonnet');
63
+ });
64
+ it('interpolates engine-specific directories', () => {
65
+ const template = 'Skills: ${skillsDir}, Agents: ${agentsDir}';
66
+ const result = interpolatePrompt(template, {
67
+ planningModel: 'opus',
68
+ executorModel: 'sonnet',
69
+ engine: 'codex',
70
+ });
71
+ expect(result).toContain('.codex/skills/');
72
+ expect(result).toContain('.codex/agents/');
73
+ });
74
+ it('interpolates optional project context', () => {
75
+ const template = 'Project: ${projectName}, Topic: ${topic}';
76
+ const result = interpolatePrompt(template, {
77
+ planningModel: 'opus',
78
+ executorModel: 'sonnet',
79
+ engine: 'claude',
80
+ projectName: 'test-project',
81
+ topic: 'authentication',
82
+ });
83
+ expect(result).toBe('Project: test-project, Topic: authentication');
84
+ });
85
+ });
86
+ describe('Codex prompts (no subagent references)', () => {
87
+ it('CODEX_BUILD_PROMPT does not reference spawn_agent', () => {
88
+ expect(CODEX_BUILD_PROMPT).not.toContain('spawn_agent');
89
+ expect(CODEX_BUILD_PROMPT).not.toContain('wait');
90
+ expect(CODEX_BUILD_PROMPT).not.toContain('close_agent');
91
+ });
92
+ it('CODEX_BUILD_PROMPT contains multi_tool_use.parallel', () => {
93
+ expect(CODEX_BUILD_PROMPT).toContain('multi_tool_use.parallel');
94
+ });
95
+ it('CODEX_BUILD_PROMPT contains /compact instruction', () => {
96
+ expect(CODEX_BUILD_PROMPT).toContain('/compact');
97
+ });
98
+ it('CODEX_PLAN_PROMPT does not reference spawn_agent', () => {
99
+ expect(CODEX_PLAN_PROMPT).not.toContain('spawn_agent');
100
+ expect(CODEX_PLAN_PROMPT).not.toContain('wait');
101
+ expect(CODEX_PLAN_PROMPT).not.toContain('close_agent');
102
+ });
103
+ it('CODEX_PLAN_PROMPT contains multi_tool_use.parallel', () => {
104
+ expect(CODEX_PLAN_PROMPT).toContain('multi_tool_use.parallel');
105
+ });
106
+ });
107
+ describe('OpenCode prompts (mode awareness)', () => {
108
+ it('OPENCODE_BUILD_PROMPT contains mode awareness', () => {
109
+ expect(OPENCODE_BUILD_PROMPT).toContain('Mode Awareness');
110
+ expect(OPENCODE_BUILD_PROMPT).toContain('BUILD mode');
111
+ });
112
+ it('OPENCODE_BUILD_PROMPT does not reference subagents', () => {
113
+ expect(OPENCODE_BUILD_PROMPT).not.toContain('subagent');
114
+ expect(OPENCODE_BUILD_PROMPT).not.toContain('spawn_agent');
115
+ });
116
+ it('OPENCODE_BUILD_PROMPT uses sequential execution language', () => {
117
+ expect(OPENCODE_BUILD_PROMPT).toContain('systematically');
118
+ });
119
+ it('OPENCODE_PLAN_PROMPT contains mode awareness', () => {
120
+ expect(OPENCODE_PLAN_PROMPT).toContain('Mode Awareness');
121
+ expect(OPENCODE_PLAN_PROMPT).toContain('PLAN mode');
122
+ });
123
+ it('OPENCODE_PLAN_PROMPT does not reference subagents', () => {
124
+ expect(OPENCODE_PLAN_PROMPT).not.toContain('subagent');
125
+ expect(OPENCODE_PLAN_PROMPT).not.toContain('spawn_agent');
126
+ });
127
+ });
128
+ //# sourceMappingURL=prompts.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.test.js","sourceRoot":"","sources":["../../src/lib/prompts.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,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CAAmC,EAAE,GAAG,EAAE;IACjD,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAC1D,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACxD,MAAM,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,oBAAoB,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACzD,MAAM,CAAC,oBAAoB,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ export interface SkillMetadata {
2
+ name: string;
3
+ description?: string;
4
+ triggers?: string[];
5
+ alwaysInclude?: boolean;
6
+ }
7
+ export interface Skill {
8
+ name: string;
9
+ path: string;
10
+ metadata: SkillMetadata;
11
+ content: string;
12
+ }
13
+ /**
14
+ * Load all skills from a directory
15
+ */
16
+ export declare function loadSkills(dir: string): Promise<Skill[]>;
17
+ /**
18
+ * Filter skills by triggers matching text
19
+ */
20
+ export declare function filterSkillsByTriggers(skills: Skill[], text: string): Skill[];
21
+ /**
22
+ * Format skills for prompt injection
23
+ */
24
+ export declare function formatSkillsForPrompt(skills: Skill[]): string;
25
+ /**
26
+ * List available skills (for CLI command)
27
+ */
28
+ export declare function listSkills(dir: string): Promise<{
29
+ name: string;
30
+ description?: string;
31
+ }[]>;
32
+ /**
33
+ * Get skill by name
34
+ */
35
+ export declare function getSkill(dir: string, name: string): Promise<Skill | undefined>;
36
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/lib/skills.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAmED;;GAEG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAoB9D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,CAW7E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAkB7D;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAG/F;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAGpF"}