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.
- package/README.md +512 -0
- package/bin/vralphy.js +3 -0
- package/dist/commands/build.d.ts +9 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +176 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/cleanup.d.ts +19 -0
- package/dist/commands/cleanup.d.ts.map +1 -0
- package/dist/commands/cleanup.js +159 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/cleanup.test.d.ts +2 -0
- package/dist/commands/cleanup.test.d.ts.map +1 -0
- package/dist/commands/cleanup.test.js +389 -0
- package/dist/commands/cleanup.test.js.map +1 -0
- package/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +120 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/plan.d.ts +9 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +147 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/spec.d.ts +9 -0
- package/dist/commands/spec.d.ts.map +1 -0
- package/dist/commands/spec.js +111 -0
- package/dist/commands/spec.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +251 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agents.d.ts +32 -0
- package/dist/lib/agents.d.ts.map +1 -0
- package/dist/lib/agents.js +96 -0
- package/dist/lib/agents.js.map +1 -0
- package/dist/lib/config.d.ts +54 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +199 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/config.test.d.ts +2 -0
- package/dist/lib/config.test.d.ts.map +1 -0
- package/dist/lib/config.test.js +57 -0
- package/dist/lib/config.test.js.map +1 -0
- package/dist/lib/context.d.ts +29 -0
- package/dist/lib/context.d.ts.map +1 -0
- package/dist/lib/context.js +175 -0
- package/dist/lib/context.js.map +1 -0
- package/dist/lib/engines/base.d.ts +75 -0
- package/dist/lib/engines/base.d.ts.map +1 -0
- package/dist/lib/engines/base.js +62 -0
- package/dist/lib/engines/base.js.map +1 -0
- package/dist/lib/engines/base.test.d.ts +2 -0
- package/dist/lib/engines/base.test.d.ts.map +1 -0
- package/dist/lib/engines/base.test.js +28 -0
- package/dist/lib/engines/base.test.js.map +1 -0
- package/dist/lib/engines/claude.d.ts +12 -0
- package/dist/lib/engines/claude.d.ts.map +1 -0
- package/dist/lib/engines/claude.js +156 -0
- package/dist/lib/engines/claude.js.map +1 -0
- package/dist/lib/engines/codex.d.ts +28 -0
- package/dist/lib/engines/codex.d.ts.map +1 -0
- package/dist/lib/engines/codex.js +177 -0
- package/dist/lib/engines/codex.js.map +1 -0
- package/dist/lib/engines/index.d.ts +19 -0
- package/dist/lib/engines/index.d.ts.map +1 -0
- package/dist/lib/engines/index.js +40 -0
- package/dist/lib/engines/index.js.map +1 -0
- package/dist/lib/engines/opencode.d.ts +14 -0
- package/dist/lib/engines/opencode.d.ts.map +1 -0
- package/dist/lib/engines/opencode.js +127 -0
- package/dist/lib/engines/opencode.js.map +1 -0
- package/dist/lib/events/index.d.ts +6 -0
- package/dist/lib/events/index.d.ts.map +1 -0
- package/dist/lib/events/index.js +5 -0
- package/dist/lib/events/index.js.map +1 -0
- package/dist/lib/events/types.d.ts +93 -0
- package/dist/lib/events/types.d.ts.map +1 -0
- package/dist/lib/events/types.js +7 -0
- package/dist/lib/events/types.js.map +1 -0
- package/dist/lib/events/writer.d.ts +68 -0
- package/dist/lib/events/writer.d.ts.map +1 -0
- package/dist/lib/events/writer.js +178 -0
- package/dist/lib/events/writer.js.map +1 -0
- package/dist/lib/events.d.ts +33 -0
- package/dist/lib/events.d.ts.map +1 -0
- package/dist/lib/events.js +81 -0
- package/dist/lib/events.js.map +1 -0
- package/dist/lib/events.test.d.ts +2 -0
- package/dist/lib/events.test.d.ts.map +1 -0
- package/dist/lib/events.test.js +123 -0
- package/dist/lib/events.test.js.map +1 -0
- package/dist/lib/file-injection.d.ts +32 -0
- package/dist/lib/file-injection.d.ts.map +1 -0
- package/dist/lib/file-injection.js +138 -0
- package/dist/lib/file-injection.js.map +1 -0
- package/dist/lib/file-injection.test.d.ts +2 -0
- package/dist/lib/file-injection.test.d.ts.map +1 -0
- package/dist/lib/file-injection.test.js +508 -0
- package/dist/lib/file-injection.test.js.map +1 -0
- package/dist/lib/init.d.ts +27 -0
- package/dist/lib/init.d.ts.map +1 -0
- package/dist/lib/init.js +363 -0
- package/dist/lib/init.js.map +1 -0
- package/dist/lib/init.test.d.ts +2 -0
- package/dist/lib/init.test.d.ts.map +1 -0
- package/dist/lib/init.test.js +315 -0
- package/dist/lib/init.test.js.map +1 -0
- package/dist/lib/plan.d.ts +11 -0
- package/dist/lib/plan.d.ts.map +1 -0
- package/dist/lib/plan.js +22 -0
- package/dist/lib/plan.js.map +1 -0
- package/dist/lib/plan.test.d.ts +2 -0
- package/dist/lib/plan.test.d.ts.map +1 -0
- package/dist/lib/plan.test.js +70 -0
- package/dist/lib/plan.test.js.map +1 -0
- package/dist/lib/prompts/codex.d.ts +18 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -0
- package/dist/lib/prompts/codex.js +82 -0
- package/dist/lib/prompts/codex.js.map +1 -0
- package/dist/lib/prompts/opencode.d.ts +16 -0
- package/dist/lib/prompts/opencode.d.ts.map +1 -0
- package/dist/lib/prompts/opencode.js +71 -0
- package/dist/lib/prompts/opencode.js.map +1 -0
- package/dist/lib/prompts.d.ts +57 -0
- package/dist/lib/prompts.d.ts.map +1 -0
- package/dist/lib/prompts.js +255 -0
- package/dist/lib/prompts.js.map +1 -0
- package/dist/lib/prompts.test.d.ts +2 -0
- package/dist/lib/prompts.test.d.ts.map +1 -0
- package/dist/lib/prompts.test.js +128 -0
- package/dist/lib/prompts.test.js.map +1 -0
- package/dist/lib/skills.d.ts +36 -0
- package/dist/lib/skills.d.ts.map +1 -0
- package/dist/lib/skills.js +132 -0
- package/dist/lib/skills.js.map +1 -0
- package/dist/lib/slack.d.ts +43 -0
- package/dist/lib/slack.d.ts.map +1 -0
- package/dist/lib/slack.js +130 -0
- package/dist/lib/slack.js.map +1 -0
- package/dist/lib/slack.test.d.ts +2 -0
- package/dist/lib/slack.test.d.ts.map +1 -0
- package/dist/lib/slack.test.js +74 -0
- package/dist/lib/slack.test.js.map +1 -0
- package/dist/lib/templates/injections.d.ts +18 -0
- package/dist/lib/templates/injections.d.ts.map +1 -0
- package/dist/lib/templates/injections.js +32 -0
- package/dist/lib/templates/injections.js.map +1 -0
- package/dist/lib/templates/readme.d.ts +6 -0
- package/dist/lib/templates/readme.d.ts.map +1 -0
- package/dist/lib/templates/readme.js +168 -0
- package/dist/lib/templates/readme.js.map +1 -0
- package/docs/COMMANDS.md +664 -0
- package/docs/DESIGN.md +537 -0
- package/docs/EXAMPLES.md +812 -0
- package/docs/METHODOLOGY.md +390 -0
- package/docs/README.md +110 -0
- package/docs/WORKFLOWS.md +808 -0
- package/llms.txt +104 -0
- package/package.json +58 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { mkdir, writeFile, readFile, rm } from 'fs/promises';
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { templateBasedInit } from './init.js';
|
|
6
|
+
import { INJECTION_MARKERS } from './templates/injections.js';
|
|
7
|
+
const TEST_DIR = '/tmp/vralphy-init-test';
|
|
8
|
+
describe('init', () => {
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
if (existsSync(TEST_DIR)) {
|
|
11
|
+
await rm(TEST_DIR, { recursive: true, force: true });
|
|
12
|
+
}
|
|
13
|
+
await mkdir(TEST_DIR, { recursive: true });
|
|
14
|
+
});
|
|
15
|
+
afterEach(async () => {
|
|
16
|
+
if (existsSync(TEST_DIR)) {
|
|
17
|
+
await rm(TEST_DIR, { recursive: true, force: true });
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
describe('templateBasedInit', () => {
|
|
21
|
+
it('should create .vralphy directory structure', async () => {
|
|
22
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
23
|
+
expect(existsSync(join(TEST_DIR, '.vralphy'))).toBe(true);
|
|
24
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'README.md'))).toBe(true);
|
|
25
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'AGENTS.md'))).toBe(true);
|
|
26
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'prompts'))).toBe(true);
|
|
27
|
+
expect(result.created).toContain('.vralphy/README.md');
|
|
28
|
+
expect(result.created).toContain('.vralphy/AGENTS.md');
|
|
29
|
+
});
|
|
30
|
+
it('should create specs directory', async () => {
|
|
31
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
32
|
+
expect(existsSync(join(TEST_DIR, 'specs'))).toBe(true);
|
|
33
|
+
expect(result.created).toContain('specs/');
|
|
34
|
+
});
|
|
35
|
+
it('should create IMPLEMENTATION_PLAN.md', async () => {
|
|
36
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
37
|
+
expect(existsSync(join(TEST_DIR, 'IMPLEMENTATION_PLAN.md'))).toBe(true);
|
|
38
|
+
expect(result.created).toContain('IMPLEMENTATION_PLAN.md');
|
|
39
|
+
});
|
|
40
|
+
it('should create prompt files', async () => {
|
|
41
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
42
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'prompts', 'plan.md'))).toBe(true);
|
|
43
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'prompts', 'build.md'))).toBe(true);
|
|
44
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'prompts', 'spec.md'))).toBe(true);
|
|
45
|
+
expect(result.created).toContain('.vralphy/prompts/plan.md');
|
|
46
|
+
expect(result.created).toContain('.vralphy/prompts/build.md');
|
|
47
|
+
expect(result.created).toContain('.vralphy/prompts/spec.md');
|
|
48
|
+
});
|
|
49
|
+
it('should skip existing files', async () => {
|
|
50
|
+
// Create some files first
|
|
51
|
+
await mkdir(join(TEST_DIR, '.vralphy'), { recursive: true });
|
|
52
|
+
await writeFile(join(TEST_DIR, '.vralphy', 'AGENTS.md'), '# Existing');
|
|
53
|
+
await mkdir(join(TEST_DIR, 'specs'), { recursive: true });
|
|
54
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
55
|
+
expect(result.skipped).toContain('.vralphy/AGENTS.md');
|
|
56
|
+
expect(result.skipped).toContain('specs/');
|
|
57
|
+
expect(result.created).not.toContain('.vralphy/AGENTS.md');
|
|
58
|
+
expect(result.created).not.toContain('specs/');
|
|
59
|
+
});
|
|
60
|
+
it('should return injected array in result', async () => {
|
|
61
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
62
|
+
expect(result).toHaveProperty('injected');
|
|
63
|
+
expect(Array.isArray(result.injected)).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
describe('injection into existing files', () => {
|
|
66
|
+
it('should inject into CLAUDE.md when it exists', async () => {
|
|
67
|
+
const claudeMdPath = join(TEST_DIR, 'CLAUDE.md');
|
|
68
|
+
await writeFile(claudeMdPath, `# Project
|
|
69
|
+
|
|
70
|
+
## Commands
|
|
71
|
+
|
|
72
|
+
\`\`\`bash
|
|
73
|
+
npm test
|
|
74
|
+
\`\`\`
|
|
75
|
+
`);
|
|
76
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
77
|
+
expect(result.injected).toContain('CLAUDE.md');
|
|
78
|
+
const content = await readFile(claudeMdPath, 'utf-8');
|
|
79
|
+
expect(content).toContain(INJECTION_MARKERS.start);
|
|
80
|
+
expect(content).toContain('## vralphy Integration');
|
|
81
|
+
expect(content).toContain('@.vralphy/README.md');
|
|
82
|
+
expect(content).toContain(INJECTION_MARKERS.end);
|
|
83
|
+
// Original content preserved
|
|
84
|
+
expect(content).toContain('# Project');
|
|
85
|
+
expect(content).toContain('npm test');
|
|
86
|
+
});
|
|
87
|
+
it('should inject into AGENTS.md when it exists', async () => {
|
|
88
|
+
const agentsMdPath = join(TEST_DIR, 'AGENTS.md');
|
|
89
|
+
await writeFile(agentsMdPath, `# AGENTS.md
|
|
90
|
+
|
|
91
|
+
## Guidelines
|
|
92
|
+
|
|
93
|
+
Be helpful.
|
|
94
|
+
`);
|
|
95
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
96
|
+
expect(result.injected).toContain('AGENTS.md');
|
|
97
|
+
const content = await readFile(agentsMdPath, 'utf-8');
|
|
98
|
+
expect(content).toContain(INJECTION_MARKERS.start);
|
|
99
|
+
expect(content).toContain('## vralphy');
|
|
100
|
+
expect(content).toContain('.vralphy/README.md');
|
|
101
|
+
expect(content).toContain(INJECTION_MARKERS.end);
|
|
102
|
+
// Original content preserved
|
|
103
|
+
expect(content).toContain('# AGENTS.md');
|
|
104
|
+
expect(content).toContain('Guidelines');
|
|
105
|
+
});
|
|
106
|
+
it('should inject into both CLAUDE.md and AGENTS.md', async () => {
|
|
107
|
+
await writeFile(join(TEST_DIR, 'CLAUDE.md'), '# Project\n');
|
|
108
|
+
await writeFile(join(TEST_DIR, 'AGENTS.md'), '# Agents\n');
|
|
109
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
110
|
+
expect(result.injected).toContain('CLAUDE.md');
|
|
111
|
+
expect(result.injected).toContain('AGENTS.md');
|
|
112
|
+
expect(result.injected.length).toBe(2);
|
|
113
|
+
});
|
|
114
|
+
it('should not inject when files do not exist', async () => {
|
|
115
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
116
|
+
expect(result.injected).not.toContain('CLAUDE.md');
|
|
117
|
+
expect(result.injected).not.toContain('AGENTS.md');
|
|
118
|
+
expect(result.injected.length).toBe(0);
|
|
119
|
+
});
|
|
120
|
+
it('should replace existing injection if markers present', async () => {
|
|
121
|
+
const claudeMdPath = join(TEST_DIR, 'CLAUDE.md');
|
|
122
|
+
await writeFile(claudeMdPath, `# Project
|
|
123
|
+
|
|
124
|
+
${INJECTION_MARKERS.start}
|
|
125
|
+
## Old Injection
|
|
126
|
+
|
|
127
|
+
Old content.
|
|
128
|
+
${INJECTION_MARKERS.end}
|
|
129
|
+
|
|
130
|
+
## Footer
|
|
131
|
+
`);
|
|
132
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
133
|
+
expect(result.injected).toContain('CLAUDE.md');
|
|
134
|
+
const content = await readFile(claudeMdPath, 'utf-8');
|
|
135
|
+
expect(content).toContain('## vralphy Integration');
|
|
136
|
+
expect(content).not.toContain('Old Injection');
|
|
137
|
+
expect(content).not.toContain('Old content.');
|
|
138
|
+
expect(content).toContain('## Footer');
|
|
139
|
+
});
|
|
140
|
+
it('should not inject into root AGENTS.md if it is the same as .vralphy/AGENTS.md', async () => {
|
|
141
|
+
// Root AGENTS.md should be different from .vralphy/AGENTS.md
|
|
142
|
+
// The init creates .vralphy/AGENTS.md, and can inject into root AGENTS.md
|
|
143
|
+
await writeFile(join(TEST_DIR, 'AGENTS.md'), '# Root Agents\n');
|
|
144
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
145
|
+
// Both should exist
|
|
146
|
+
expect(existsSync(join(TEST_DIR, 'AGENTS.md'))).toBe(true);
|
|
147
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'AGENTS.md'))).toBe(true);
|
|
148
|
+
// Root should have injection
|
|
149
|
+
const rootContent = await readFile(join(TEST_DIR, 'AGENTS.md'), 'utf-8');
|
|
150
|
+
expect(rootContent).toContain(INJECTION_MARKERS.start);
|
|
151
|
+
// .vralphy should NOT have injection markers (it's generated content)
|
|
152
|
+
const internalContent = await readFile(join(TEST_DIR, '.vralphy', 'AGENTS.md'), 'utf-8');
|
|
153
|
+
expect(internalContent).not.toContain(INJECTION_MARKERS.start);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
describe('--no-inject option', () => {
|
|
157
|
+
it('should not inject when noInject is true', async () => {
|
|
158
|
+
await writeFile(join(TEST_DIR, 'CLAUDE.md'), '# Project\n');
|
|
159
|
+
await writeFile(join(TEST_DIR, 'AGENTS.md'), '# Agents\n');
|
|
160
|
+
const result = await templateBasedInit(TEST_DIR, { noInject: true });
|
|
161
|
+
expect(result.injected.length).toBe(0);
|
|
162
|
+
const claudeContent = await readFile(join(TEST_DIR, 'CLAUDE.md'), 'utf-8');
|
|
163
|
+
expect(claudeContent).not.toContain(INJECTION_MARKERS.start);
|
|
164
|
+
const agentsContent = await readFile(join(TEST_DIR, 'AGENTS.md'), 'utf-8');
|
|
165
|
+
expect(agentsContent).not.toContain(INJECTION_MARKERS.start);
|
|
166
|
+
});
|
|
167
|
+
it('should still create all files when noInject is true', async () => {
|
|
168
|
+
const result = await templateBasedInit(TEST_DIR, { noInject: true });
|
|
169
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'README.md'))).toBe(true);
|
|
170
|
+
expect(existsSync(join(TEST_DIR, '.vralphy', 'AGENTS.md'))).toBe(true);
|
|
171
|
+
expect(existsSync(join(TEST_DIR, 'IMPLEMENTATION_PLAN.md'))).toBe(true);
|
|
172
|
+
expect(result.created.length).toBeGreaterThan(0);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
describe('README.md content', () => {
|
|
176
|
+
it('should create README.md with comprehensive documentation', async () => {
|
|
177
|
+
await templateBasedInit(TEST_DIR);
|
|
178
|
+
const content = await readFile(join(TEST_DIR, '.vralphy', 'README.md'), 'utf-8');
|
|
179
|
+
// Check key sections exist
|
|
180
|
+
expect(content).toContain('# vralphy');
|
|
181
|
+
expect(content).toContain('Ralph Playbook');
|
|
182
|
+
expect(content).toContain('## What is vralphy?');
|
|
183
|
+
expect(content).toContain('## The Workflow Loop');
|
|
184
|
+
expect(content).toContain('## Writing Specifications');
|
|
185
|
+
expect(content).toContain('## Key Commands');
|
|
186
|
+
expect(content).toContain('## Loop Mechanics');
|
|
187
|
+
expect(content).toContain('## Key Files');
|
|
188
|
+
expect(content).toContain('## Event Logging');
|
|
189
|
+
expect(content).toContain('## Configuration');
|
|
190
|
+
});
|
|
191
|
+
it('should document vralphy commands', async () => {
|
|
192
|
+
await templateBasedInit(TEST_DIR);
|
|
193
|
+
const content = await readFile(join(TEST_DIR, '.vralphy', 'README.md'), 'utf-8');
|
|
194
|
+
expect(content).toContain('vralphy plan');
|
|
195
|
+
expect(content).toContain('vralphy build');
|
|
196
|
+
expect(content).toContain('vralphy spec');
|
|
197
|
+
expect(content).toContain('vralphy init');
|
|
198
|
+
expect(content).toContain('vralphy cleanup');
|
|
199
|
+
});
|
|
200
|
+
it('should document key files', async () => {
|
|
201
|
+
await templateBasedInit(TEST_DIR);
|
|
202
|
+
const content = await readFile(join(TEST_DIR, '.vralphy', 'README.md'), 'utf-8');
|
|
203
|
+
expect(content).toContain('IMPLEMENTATION_PLAN.md');
|
|
204
|
+
expect(content).toContain('.vralphy/AGENTS.md');
|
|
205
|
+
expect(content).toContain('specs/*.md');
|
|
206
|
+
expect(content).toContain('events.jsonl');
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
describe('node project detection', () => {
|
|
210
|
+
it('should detect npm scripts from package.json', async () => {
|
|
211
|
+
await writeFile(join(TEST_DIR, 'package.json'), JSON.stringify({
|
|
212
|
+
name: 'test-project',
|
|
213
|
+
scripts: {
|
|
214
|
+
build: 'tsc',
|
|
215
|
+
test: 'vitest',
|
|
216
|
+
lint: 'eslint',
|
|
217
|
+
typecheck: 'tsc --noEmit',
|
|
218
|
+
},
|
|
219
|
+
}));
|
|
220
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
221
|
+
expect(result.agentsMdContent).toContain('npm run build');
|
|
222
|
+
expect(result.agentsMdContent).toContain('npm test');
|
|
223
|
+
expect(result.agentsMdContent).toContain('npm run lint');
|
|
224
|
+
expect(result.agentsMdContent).toContain('npm run typecheck');
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
describe('rust project detection', () => {
|
|
228
|
+
it('should detect Cargo.toml', async () => {
|
|
229
|
+
await writeFile(join(TEST_DIR, 'Cargo.toml'), '[package]\nname = "test"\nversion = "0.1.0"');
|
|
230
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
231
|
+
expect(result.agentsMdContent).toContain('cargo build');
|
|
232
|
+
expect(result.agentsMdContent).toContain('cargo test');
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
describe('go project detection', () => {
|
|
236
|
+
it('should detect go.mod', async () => {
|
|
237
|
+
await writeFile(join(TEST_DIR, 'go.mod'), 'module example.com/test\n\ngo 1.21');
|
|
238
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
239
|
+
expect(result.agentsMdContent).toContain('go build');
|
|
240
|
+
expect(result.agentsMdContent).toContain('go test');
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
describe('complete init flow', () => {
|
|
244
|
+
it('should handle complete project setup with CLAUDE.md and AGENTS.md', async () => {
|
|
245
|
+
// Set up a project structure similar to vralphy itself
|
|
246
|
+
await writeFile(join(TEST_DIR, 'package.json'), JSON.stringify({
|
|
247
|
+
name: 'my-project',
|
|
248
|
+
scripts: {
|
|
249
|
+
build: 'tsc',
|
|
250
|
+
test: 'vitest',
|
|
251
|
+
typecheck: 'tsc --noEmit',
|
|
252
|
+
lint: 'eslint src',
|
|
253
|
+
},
|
|
254
|
+
}));
|
|
255
|
+
await writeFile(join(TEST_DIR, 'CLAUDE.md'), `# my-project
|
|
256
|
+
|
|
257
|
+
CLI tool for doing things.
|
|
258
|
+
|
|
259
|
+
## Commands
|
|
260
|
+
|
|
261
|
+
\`\`\`bash
|
|
262
|
+
npm run build
|
|
263
|
+
npm test
|
|
264
|
+
\`\`\`
|
|
265
|
+
|
|
266
|
+
## Architecture
|
|
267
|
+
|
|
268
|
+
- \`src/\` - Source code
|
|
269
|
+
|
|
270
|
+
## Rules
|
|
271
|
+
|
|
272
|
+
- Run tests before committing
|
|
273
|
+
`);
|
|
274
|
+
await writeFile(join(TEST_DIR, 'AGENTS.md'), `# AGENTS.md
|
|
275
|
+
|
|
276
|
+
Guide for AI agents.
|
|
277
|
+
|
|
278
|
+
## Build
|
|
279
|
+
|
|
280
|
+
\`\`\`bash
|
|
281
|
+
npm install
|
|
282
|
+
npm run build
|
|
283
|
+
\`\`\`
|
|
284
|
+
`);
|
|
285
|
+
const result = await templateBasedInit(TEST_DIR);
|
|
286
|
+
// Check created files
|
|
287
|
+
expect(result.created).toContain('.vralphy/README.md');
|
|
288
|
+
expect(result.created).toContain('.vralphy/AGENTS.md');
|
|
289
|
+
expect(result.created).toContain('IMPLEMENTATION_PLAN.md');
|
|
290
|
+
// Check injections
|
|
291
|
+
expect(result.injected).toContain('CLAUDE.md');
|
|
292
|
+
expect(result.injected).toContain('AGENTS.md');
|
|
293
|
+
// Verify CLAUDE.md has injection but original content preserved
|
|
294
|
+
const claudeContent = await readFile(join(TEST_DIR, 'CLAUDE.md'), 'utf-8');
|
|
295
|
+
expect(claudeContent).toContain('# my-project');
|
|
296
|
+
expect(claudeContent).toContain('CLI tool for doing things');
|
|
297
|
+
expect(claudeContent).toContain('Run tests before committing');
|
|
298
|
+
expect(claudeContent).toContain('## vralphy Integration');
|
|
299
|
+
expect(claudeContent).toContain('@.vralphy/README.md');
|
|
300
|
+
// Verify AGENTS.md has injection but original content preserved
|
|
301
|
+
const agentsContent = await readFile(join(TEST_DIR, 'AGENTS.md'), 'utf-8');
|
|
302
|
+
expect(agentsContent).toContain('# AGENTS.md');
|
|
303
|
+
expect(agentsContent).toContain('Guide for AI agents');
|
|
304
|
+
expect(agentsContent).toContain('npm install');
|
|
305
|
+
expect(agentsContent).toContain('## vralphy');
|
|
306
|
+
expect(agentsContent).toContain('.vralphy/README.md');
|
|
307
|
+
// Verify .vralphy/AGENTS.md was generated with project info
|
|
308
|
+
const internalAgents = await readFile(join(TEST_DIR, '.vralphy', 'AGENTS.md'), 'utf-8');
|
|
309
|
+
expect(internalAgents).toContain('npm run build');
|
|
310
|
+
expect(internalAgents).toContain('npm test');
|
|
311
|
+
});
|
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box tasks
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadPlanSnapshot(path?: string): Promise<PlanSnapshot | null>;
|
|
11
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/lib/plan.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,MAAiC,GACtC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAkB9B"}
|
package/dist/lib/plan.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readFile } from 'fs/promises';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
/**
|
|
4
|
+
* Parse IMPLEMENTATION_PLAN.md and count checkbox tasks
|
|
5
|
+
*/
|
|
6
|
+
export async function loadPlanSnapshot(path = 'IMPLEMENTATION_PLAN.md') {
|
|
7
|
+
if (!existsSync(path))
|
|
8
|
+
return null;
|
|
9
|
+
const content = await readFile(path, 'utf-8');
|
|
10
|
+
// Count checkboxes: - [x] or - [ ]
|
|
11
|
+
const completedMatches = content.match(/^-\s*\[x\]/gim) || [];
|
|
12
|
+
const incompleteMatches = content.match(/^-\s*\[ \]/gm) || [];
|
|
13
|
+
const completedTasks = completedMatches.length;
|
|
14
|
+
const incompleteTasks = incompleteMatches.length;
|
|
15
|
+
return {
|
|
16
|
+
totalTasks: completedTasks + incompleteTasks,
|
|
17
|
+
completedTasks,
|
|
18
|
+
incompleteTasks,
|
|
19
|
+
timestamp: Date.now(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/lib/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAShC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAe,wBAAwB;IAEvC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAEnC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9C,mCAAmC;IACnC,MAAM,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IAC9D,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAE9D,MAAM,cAAc,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAC/C,MAAM,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC;IAEjD,OAAO;QACL,UAAU,EAAE,cAAc,GAAG,eAAe;QAC5C,cAAc;QACd,eAAe;QACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.test.d.ts","sourceRoot":"","sources":["../../src/lib/plan.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
+
import { writeFile, rm } from 'fs/promises';
|
|
3
|
+
import { loadPlanSnapshot } from './plan.js';
|
|
4
|
+
describe('loadPlanSnapshot', () => {
|
|
5
|
+
const testPlanPath = 'TEST_PLAN.md';
|
|
6
|
+
afterEach(async () => {
|
|
7
|
+
try {
|
|
8
|
+
await rm(testPlanPath);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// Ignore if file doesn't exist
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
it('returns null when file does not exist', async () => {
|
|
15
|
+
const result = await loadPlanSnapshot('NONEXISTENT_PLAN.md');
|
|
16
|
+
expect(result).toBeNull();
|
|
17
|
+
});
|
|
18
|
+
it('counts completed and incomplete tasks', async () => {
|
|
19
|
+
await writeFile(testPlanPath, `# Test Plan
|
|
20
|
+
|
|
21
|
+
- [x] Completed task 1
|
|
22
|
+
- [x] Completed task 2
|
|
23
|
+
- [ ] Incomplete task 1
|
|
24
|
+
- [ ] Incomplete task 2
|
|
25
|
+
- [ ] Incomplete task 3
|
|
26
|
+
`);
|
|
27
|
+
const result = await loadPlanSnapshot(testPlanPath);
|
|
28
|
+
expect(result).not.toBeNull();
|
|
29
|
+
expect(result.completedTasks).toBe(2);
|
|
30
|
+
expect(result.incompleteTasks).toBe(3);
|
|
31
|
+
expect(result.totalTasks).toBe(5);
|
|
32
|
+
});
|
|
33
|
+
it('handles case-insensitive completed checkboxes', async () => {
|
|
34
|
+
await writeFile(testPlanPath, `# Test Plan
|
|
35
|
+
|
|
36
|
+
- [X] Completed with uppercase X
|
|
37
|
+
- [x] Completed with lowercase x
|
|
38
|
+
- [ ] Incomplete
|
|
39
|
+
`);
|
|
40
|
+
const result = await loadPlanSnapshot(testPlanPath);
|
|
41
|
+
expect(result.completedTasks).toBe(2);
|
|
42
|
+
expect(result.incompleteTasks).toBe(1);
|
|
43
|
+
});
|
|
44
|
+
it('handles empty plan file', async () => {
|
|
45
|
+
await writeFile(testPlanPath, '# Empty Plan\n\nNo tasks here.');
|
|
46
|
+
const result = await loadPlanSnapshot(testPlanPath);
|
|
47
|
+
expect(result.totalTasks).toBe(0);
|
|
48
|
+
expect(result.completedTasks).toBe(0);
|
|
49
|
+
expect(result.incompleteTasks).toBe(0);
|
|
50
|
+
});
|
|
51
|
+
it('handles all tasks completed', async () => {
|
|
52
|
+
await writeFile(testPlanPath, `# Test Plan
|
|
53
|
+
|
|
54
|
+
- [x] Task 1
|
|
55
|
+
- [x] Task 2
|
|
56
|
+
`);
|
|
57
|
+
const result = await loadPlanSnapshot(testPlanPath);
|
|
58
|
+
expect(result.incompleteTasks).toBe(0);
|
|
59
|
+
expect(result.completedTasks).toBe(2);
|
|
60
|
+
});
|
|
61
|
+
it('includes timestamp', async () => {
|
|
62
|
+
await writeFile(testPlanPath, '- [ ] Task');
|
|
63
|
+
const before = Date.now();
|
|
64
|
+
const result = await loadPlanSnapshot(testPlanPath);
|
|
65
|
+
const after = Date.now();
|
|
66
|
+
expect(result.timestamp).toBeGreaterThanOrEqual(before);
|
|
67
|
+
expect(result.timestamp).toBeLessThanOrEqual(after);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=plan.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.test.js","sourceRoot":"","sources":["../../src/lib/plan.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAc,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,YAAY,GAAG,cAAc,CAAC;IAEpC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,YAAY,CAAC,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,+BAA+B;QACjC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;QAC7D,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC,CAAC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AC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,SAAS,CAAC,YAAY,EAAE;;;;CAIjC,CAAC,CAAC;QAEC,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACpD,MAAM,CAAC,MAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,CAAC,MAAO,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEzB,MAAM,CAAC,MAAO,CAAC,SAAS,CAAC,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACzD,MAAM,CAAC,MAAO,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex-specific prompt templates
|
|
3
|
+
*
|
|
4
|
+
* Codex CLI mode uses multi_tool_use.parallel for batched operations and
|
|
5
|
+
* /compact for context management. The MCP server mode (future) would use
|
|
6
|
+
* spawn_agent/wait/close_agent tools.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Codex plan mode prompt using parallel tool calls pattern
|
|
10
|
+
*/
|
|
11
|
+
export declare const CODEX_PLAN_PROMPT = "0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.\n0b. Use multi_tool_use.parallel to batch read specs/* (10-15 files per batch) to learn the project specifications.\n0c. Study IMPLEMENTATION_PLAN.md (if present) to understand the plan so far.\n0d. Use multi_tool_use.parallel to study src/lib/* 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 multi_tool_use.parallel to 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.\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## Parallel Tool Calls (multi_tool_use.parallel)\n\nCodex CLI supports batched parallel operations:\n- File reads: 10-15 files per batch (not 100+)\n- Code searches: 3-5 grep patterns per batch\n\nNote: This is modest parallelism for efficiency, not massive concurrency.\n\n## Lazy Loading\n\nSkills: ${skillsDir} - Load ONLY when stuck or task requires domain knowledge\nAgents: ${agentsDir} - Load ONLY for deep specialized analysis\n\nDo NOT preload - context is precious.\n";
|
|
12
|
+
/**
|
|
13
|
+
* Codex build mode prompt using parallel tool calls pattern
|
|
14
|
+
*/
|
|
15
|
+
export declare const CODEX_BUILD_PROMPT = "0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.\n0b. Use multi_tool_use.parallel to batch read specs/* (10-15 files per batch) 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. Follow IMPLEMENTATION_PLAN.md and choose the most important item to address. Before making changes, use multi_tool_use.parallel to search the codebase (batch 3-5 grep patterns together). Do NOT assume functionality is missing - confirm with search first.\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.\n\n3. When you discover issues, immediately update IMPLEMENTATION_PLAN.md with your findings. 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\n## Parallel Tool Calls (multi_tool_use.parallel)\n\nCodex CLI supports batched parallel operations:\n- File reads: 10-15 files per batch (not 100+)\n- Code searches: 3-5 grep patterns per batch\n\nNote: This is NOT 500 concurrent agents like Claude. Expect modest parallelism.\n\n99999. When authoring documentation, capture the why - 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 - future work depends on this.\n9999999999. When you learn something new about how to run the application, update .vralphy/AGENTS.md 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.\n99999999999999. IMPORTANT: Keep .vralphy/AGENTS.md operational only - status updates belong in IMPLEMENTATION_PLAN.md. A bloated AGENTS.md pollutes every future loop's context.\n\n## Context Management (/compact)\n\nWhen context reaches ~70%, use /compact. Preserve: IMPLEMENTATION_PLAN.md content, .vralphy/AGENTS.md, active file, recent errors. After compaction, continue from IMPLEMENTATION_PLAN.md.\n\n## Lazy Loading\n\nSkills: ${skillsDir} - Load ONLY when stuck or task requires domain knowledge\nAgents: ${agentsDir} - Load ONLY for deep specialized analysis\n\nDo NOT preload - context is precious.\n";
|
|
16
|
+
export declare const CODEX_DEFAULT_MAX_AGENTS = 8;
|
|
17
|
+
export declare const CODEX_DEFAULT_WORKER_TIMEOUT = 300;
|
|
18
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/lib/prompts/codex.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH;;GAEG;AACH,eAAO,MAAM,iBAAiB,qmDAiBA,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,kBAAkB,q9FAmCD,CAAC;AAG/B,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,4BAA4B,MAAM,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex-specific prompt templates
|
|
3
|
+
*
|
|
4
|
+
* Codex CLI mode uses multi_tool_use.parallel for batched operations and
|
|
5
|
+
* /compact for context management. The MCP server mode (future) would use
|
|
6
|
+
* spawn_agent/wait/close_agent tools.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Skills and agents lazy loading section for Codex
|
|
10
|
+
*/
|
|
11
|
+
const CODEX_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 - context is precious.
|
|
18
|
+
`;
|
|
19
|
+
/**
|
|
20
|
+
* Codex plan mode prompt using parallel tool calls pattern
|
|
21
|
+
*/
|
|
22
|
+
export const CODEX_PLAN_PROMPT = `0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.
|
|
23
|
+
0b. Use multi_tool_use.parallel to batch read specs/* (10-15 files per batch) to learn the project specifications.
|
|
24
|
+
0c. Study IMPLEMENTATION_PLAN.md (if present) to understand the plan so far.
|
|
25
|
+
0d. Use multi_tool_use.parallel to 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 use multi_tool_use.parallel to 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
|
+
## Parallel Tool Calls (multi_tool_use.parallel)
|
|
33
|
+
|
|
34
|
+
Codex CLI supports batched parallel operations:
|
|
35
|
+
- File reads: 10-15 files per batch (not 100+)
|
|
36
|
+
- Code searches: 3-5 grep patterns per batch
|
|
37
|
+
|
|
38
|
+
Note: This is modest parallelism for efficiency, not massive concurrency.
|
|
39
|
+
${CODEX_LAZY_LOADING_SECTION}`;
|
|
40
|
+
/**
|
|
41
|
+
* Codex build mode prompt using parallel tool calls pattern
|
|
42
|
+
*/
|
|
43
|
+
export const CODEX_BUILD_PROMPT = `0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.
|
|
44
|
+
0b. Use multi_tool_use.parallel to batch read specs/* (10-15 files per batch) to learn the project specifications.
|
|
45
|
+
0c. Study IMPLEMENTATION_PLAN.md.
|
|
46
|
+
0d. For reference, the application source code is in src/*.
|
|
47
|
+
|
|
48
|
+
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, use multi_tool_use.parallel to search the codebase (batch 3-5 grep patterns together). Do NOT assume functionality is missing - confirm with search first.
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
3. When you discover issues, immediately update IMPLEMENTATION_PLAN.md with your findings. When resolved, update and remove the item.
|
|
53
|
+
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
## Parallel Tool Calls (multi_tool_use.parallel)
|
|
57
|
+
|
|
58
|
+
Codex CLI supports batched parallel operations:
|
|
59
|
+
- File reads: 10-15 files per batch (not 100+)
|
|
60
|
+
- Code searches: 3-5 grep patterns per batch
|
|
61
|
+
|
|
62
|
+
Note: This is NOT 500 concurrent agents like Claude. Expect modest parallelism.
|
|
63
|
+
|
|
64
|
+
99999. When authoring documentation, capture the why - tests and implementation importance.
|
|
65
|
+
999999. Single sources of truth, no migrations/adapters. If tests unrelated to your work fail, resolve them as part of the increment.
|
|
66
|
+
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.
|
|
67
|
+
99999999. You may add extra logging if required to debug issues.
|
|
68
|
+
999999999. Keep IMPLEMENTATION_PLAN.md current with learnings - future work depends on this.
|
|
69
|
+
9999999999. When you learn something new about how to run the application, update .vralphy/AGENTS.md but keep it brief.
|
|
70
|
+
99999999999. For any bugs you notice, resolve them or document them in IMPLEMENTATION_PLAN.md even if unrelated to current work.
|
|
71
|
+
999999999999. Implement functionality completely. Placeholders and stubs waste efforts and time redoing the same work.
|
|
72
|
+
9999999999999. When IMPLEMENTATION_PLAN.md becomes large periodically clean out the items that are completed.
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
## Context Management (/compact)
|
|
76
|
+
|
|
77
|
+
When context reaches ~70%, use /compact. Preserve: IMPLEMENTATION_PLAN.md content, .vralphy/AGENTS.md, active file, recent errors. After compaction, continue from IMPLEMENTATION_PLAN.md.
|
|
78
|
+
${CODEX_LAZY_LOADING_SECTION}`;
|
|
79
|
+
// Keep these for backwards compatibility but they're less relevant in CLI mode
|
|
80
|
+
export const CODEX_DEFAULT_MAX_AGENTS = 8;
|
|
81
|
+
export const CODEX_DEFAULT_WORKER_TIMEOUT = 300;
|
|
82
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../src/lib/prompts/codex.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,0BAA0B,GAAG;;;;;;;CAOlC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;EAiB/B,0BAA0B,EAAE,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmChC,0BAA0B,EAAE,CAAC;AAE/B,+EAA+E;AAC/E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* OpenCode plan mode prompt
|
|
10
|
+
*/
|
|
11
|
+
export declare const OPENCODE_PLAN_PROMPT = "0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.\n0b. Study specs/* systematically to learn the project specifications.\n0c. Study @IMPLEMENTATION_PLAN.md (if present) to understand the plan so far.\n0d. Study src/lib/* 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 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.\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## Mode Awareness\n\nYou are in PLAN mode. Focus on analysis and prioritization. Do NOT make code changes.\n\n## Lazy Loading\n\nSkills: ${skillsDir} - Load ONLY when stuck or task requires domain knowledge\nAgents: ${agentsDir} - Load ONLY for deep specialized analysis\n\nDo NOT preload - keep context focused on current task.\n";
|
|
12
|
+
/**
|
|
13
|
+
* OpenCode build mode prompt
|
|
14
|
+
*/
|
|
15
|
+
export declare const OPENCODE_BUILD_PROMPT = "0a. Study .vralphy/AGENTS.md to understand how to build/test/run this project.\n0b. Study specs/* systematically 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. 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.\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.\n\n3. When you discover issues, immediately update @IMPLEMENTATION_PLAN.md with your findings. 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\n## Mode Awareness\n\nYou are in BUILD mode. Focus on implementation. If you need to analyze architecture or plan a major refactor, suggest switching to PLAN mode.\n\n99999. When authoring documentation, capture the why - 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 - future work depends on this.\n9999999999. When you learn something new about how to run the application, update .vralphy/AGENTS.md 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.\n99999999999999. IMPORTANT: Keep .vralphy/AGENTS.md operational only - status updates belong in IMPLEMENTATION_PLAN.md. A bloated AGENTS.md pollutes every future loop's context.\n\n## Context Freshness\n\nComplete one task fully before starting another. Update @IMPLEMENTATION_PLAN.md frequently - it persists across sessions. If overwhelmed, focus on single most important task.\n\n## Lazy Loading\n\nSkills: ${skillsDir} - Load ONLY when stuck or task requires domain knowledge\nAgents: ${agentsDir} - Load ONLY for deep specialized analysis\n\nDo NOT preload - keep context focused on current task.\n";
|
|
16
|
+
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../../src/lib/prompts/opencode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH;;GAEG;AACH,eAAO,MAAM,oBAAoB,02CAaA,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,qBAAqB,u0FA+BD,CAAC"}
|