claude-devloop 1.0.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 +340 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +90 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/config.d.ts +9 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +80 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/continue.d.ts +11 -0
- package/dist/commands/continue.d.ts.map +1 -0
- package/dist/commands/continue.js +167 -0
- package/dist/commands/continue.js.map +1 -0
- package/dist/commands/feature.d.ts +7 -0
- package/dist/commands/feature.d.ts.map +1 -0
- package/dist/commands/feature.js +123 -0
- package/dist/commands/feature.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +401 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/run.d.ts +12 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +82 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/shared.d.ts +22 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +32 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +305 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/workspace.d.ts +2 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +19 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +21 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/claude.d.ts +20 -0
- package/dist/core/claude.d.ts.map +1 -0
- package/dist/core/claude.js +401 -0
- package/dist/core/claude.js.map +1 -0
- package/dist/core/commit-format.d.ts +22 -0
- package/dist/core/commit-format.d.ts.map +1 -0
- package/dist/core/commit-format.js +148 -0
- package/dist/core/commit-format.js.map +1 -0
- package/dist/core/config.d.ts +30 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +130 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/feature-session.d.ts +8 -0
- package/dist/core/feature-session.d.ts.map +1 -0
- package/dist/core/feature-session.js +58 -0
- package/dist/core/feature-session.js.map +1 -0
- package/dist/core/git.d.ts +81 -0
- package/dist/core/git.d.ts.map +1 -0
- package/dist/core/git.js +475 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/loop.d.ts +3 -0
- package/dist/core/loop.d.ts.map +1 -0
- package/dist/core/loop.js +469 -0
- package/dist/core/loop.js.map +1 -0
- package/dist/core/session.d.ts +7 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +57 -0
- package/dist/core/session.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/progress.d.ts +7 -0
- package/dist/parser/progress.d.ts.map +1 -0
- package/dist/parser/progress.js +132 -0
- package/dist/parser/progress.js.map +1 -0
- package/dist/parser/requirements.d.ts +6 -0
- package/dist/parser/requirements.d.ts.map +1 -0
- package/dist/parser/requirements.js +126 -0
- package/dist/parser/requirements.js.map +1 -0
- package/dist/types/feature.d.ts +15 -0
- package/dist/types/feature.d.ts.map +1 -0
- package/dist/types/feature.js +2 -0
- package/dist/types/feature.js.map +1 -0
- package/dist/types/index.d.ts +78 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import * as readline from 'readline';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { resolveWorkspace, getRequirementsPath, resolveFeaturePath } from '../core/config.js';
|
|
7
|
+
import { createSession, readSession } from '../core/session.js';
|
|
8
|
+
import { createFeatureSession, readFeatureSession } from '../core/feature-session.js';
|
|
9
|
+
import { spawnClaudeInteractive } from '../core/claude.js';
|
|
10
|
+
import { requireClaudeInstalled } from './shared.js';
|
|
11
|
+
import { generateRequirementsTemplate } from '../parser/requirements.js';
|
|
12
|
+
import { detectCommitFormat } from '../core/commit-format.js';
|
|
13
|
+
import { ensureGitRepo, gitCommit, saveDevloopCommitFormat } from '../core/git.js';
|
|
14
|
+
function generateWorkspaceClaudeMd(workspace) {
|
|
15
|
+
const platform = os.platform() === 'win32' ? 'Windows' : os.platform() === 'darwin' ? 'macOS' : 'Linux';
|
|
16
|
+
return `# CLAUDE.md
|
|
17
|
+
|
|
18
|
+
This file provides guidance to Claude Code when working in this workspace.
|
|
19
|
+
|
|
20
|
+
## Environment
|
|
21
|
+
|
|
22
|
+
- **Platform**: ${platform}
|
|
23
|
+
- **Workspace**: ${workspace}
|
|
24
|
+
${platform === 'Windows' ? '- Use Windows-compatible commands (e.g., use backslashes in paths, no Unix-specific commands)\n' : ''}
|
|
25
|
+
## Current Task
|
|
26
|
+
|
|
27
|
+
You are helping the user create a **requirements.md** file for their project.
|
|
28
|
+
|
|
29
|
+
**IMPORTANT: Do NOT implement the project. Do NOT write code, create source files, install packages, or build anything. Your ONLY job right now is to write the requirements.md document. The actual implementation will happen later in a separate automated process.**
|
|
30
|
+
|
|
31
|
+
### Your Job
|
|
32
|
+
|
|
33
|
+
1. Ask the user what they want to build
|
|
34
|
+
2. Break down their project into small, manageable tasks (each ~30 minutes of work)
|
|
35
|
+
3. Write tasks to \`requirements.md\` in the format below
|
|
36
|
+
4. Ensure tasks have clear dependencies where needed
|
|
37
|
+
5. Stop when the requirements document is complete — do NOT start implementing tasks
|
|
38
|
+
|
|
39
|
+
### Task Format
|
|
40
|
+
|
|
41
|
+
Each task in requirements.md MUST follow this exact format:
|
|
42
|
+
|
|
43
|
+
\`\`\`markdown
|
|
44
|
+
### TASK-001: Task title here
|
|
45
|
+
- **Status**: pending
|
|
46
|
+
- **Priority**: high
|
|
47
|
+
- **Dependencies**: none
|
|
48
|
+
- **Description**: Clear description of what needs to be done.
|
|
49
|
+
|
|
50
|
+
### TASK-002: Another task
|
|
51
|
+
- **Status**: pending
|
|
52
|
+
- **Priority**: medium
|
|
53
|
+
- **Dependencies**: TASK-001
|
|
54
|
+
- **Description**: This task depends on TASK-001 completing first.
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
### Rules
|
|
58
|
+
|
|
59
|
+
- Task IDs must be sequential: TASK-001, TASK-002, TASK-003, etc.
|
|
60
|
+
- Status should always be \`pending\` for new tasks
|
|
61
|
+
- Priority: \`high\`, \`medium\`, or \`low\`
|
|
62
|
+
- Dependencies: \`none\` or comma-separated task IDs (e.g., \`TASK-001, TASK-002\`)
|
|
63
|
+
- Keep descriptions clear and actionable
|
|
64
|
+
- The requirements.md file already exists at: ${path.join(workspace, 'requirements.md')}
|
|
65
|
+
- **Do NOT create any files other than requirements.md** — no source code, no config files, no project scaffolding
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
async function promptUser(question) {
|
|
69
|
+
const rl = readline.createInterface({
|
|
70
|
+
input: process.stdin,
|
|
71
|
+
output: process.stdout
|
|
72
|
+
});
|
|
73
|
+
return new Promise((resolve) => {
|
|
74
|
+
rl.question(question, (answer) => {
|
|
75
|
+
rl.close();
|
|
76
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes' || answer === '');
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Prompt user for a string input
|
|
82
|
+
*/
|
|
83
|
+
async function promptForInput(question) {
|
|
84
|
+
const rl = readline.createInterface({
|
|
85
|
+
input: process.stdin,
|
|
86
|
+
output: process.stdout
|
|
87
|
+
});
|
|
88
|
+
return new Promise((resolve) => {
|
|
89
|
+
rl.question(question, (answer) => {
|
|
90
|
+
rl.close();
|
|
91
|
+
resolve(answer.trim());
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Attempt to commit with retry on hook failure
|
|
97
|
+
* Keeps asking for a new message until commit succeeds or user gives up
|
|
98
|
+
* Saves the format for future DevLoop commits before retrying
|
|
99
|
+
*/
|
|
100
|
+
async function commitWithRetry(workspace, initialMessage, action) {
|
|
101
|
+
let message = initialMessage;
|
|
102
|
+
while (true) {
|
|
103
|
+
const result = await gitCommit(workspace, message, false);
|
|
104
|
+
if (result.committed) {
|
|
105
|
+
console.log(chalk.green('Committed initial files to git.'));
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (result.isHookFailure) {
|
|
109
|
+
// Hook failure message already printed by gitCommit, ask for new message
|
|
110
|
+
console.log(chalk.gray(`\nTip: Use {action} as a placeholder for reusable formats.`));
|
|
111
|
+
console.log(chalk.gray(` Example: "chore(devloop): {action}" → "chore(devloop): ${action}"`));
|
|
112
|
+
const newMessage = await promptForInput(chalk.cyan('Enter a valid commit message (or press Enter to skip): '));
|
|
113
|
+
if (!newMessage) {
|
|
114
|
+
console.log(chalk.yellow('Skipping initial commit. You can commit manually later.'));
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
// Save the format BEFORE retrying so config.json is included in the commit
|
|
118
|
+
await saveDevloopCommitFormat(workspace, newMessage, action);
|
|
119
|
+
console.log(chalk.gray('Saved commit format for future DevLoop commits.'));
|
|
120
|
+
// Expand {action} placeholder if present
|
|
121
|
+
message = newMessage.replace(/\{action\}/g, action);
|
|
122
|
+
// Loop continues with new message
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Some other error, don't retry
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Detect and configure commit message format based on project hooks/config
|
|
132
|
+
* Returns the initial commit message to use and the action string for format saving
|
|
133
|
+
*/
|
|
134
|
+
async function detectAndConfigureCommitFormat(workspace, action) {
|
|
135
|
+
const detection = await detectCommitFormat(workspace);
|
|
136
|
+
const defaultMessage = `DevLoop: ${action}`;
|
|
137
|
+
if (detection.detected) {
|
|
138
|
+
// Ask user for initial commit message since hooks are present
|
|
139
|
+
console.log(chalk.yellow(`\nDetected commit message hooks (${detection.source}).`));
|
|
140
|
+
console.log(chalk.cyan('The default message may not pass validation.'));
|
|
141
|
+
console.log(chalk.gray(` Default: "${defaultMessage}"`));
|
|
142
|
+
console.log(chalk.gray(` Tip: Use {action} placeholder for reusable format, e.g., "chore(devloop): {action}"`));
|
|
143
|
+
const customMessage = await promptForInput(chalk.cyan('Commit message (press Enter for default): '));
|
|
144
|
+
if (customMessage) {
|
|
145
|
+
// Expand {action} placeholder
|
|
146
|
+
const expanded = customMessage.replace(/\{action\}/g, action);
|
|
147
|
+
// Save the format for future DevLoop commits
|
|
148
|
+
await saveDevloopCommitFormat(workspace, customMessage, action);
|
|
149
|
+
console.log(chalk.gray('Saved commit format for future DevLoop commits.'));
|
|
150
|
+
return { message: expanded, action, isCustom: true };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return { message: defaultMessage, action, isCustom: false };
|
|
154
|
+
}
|
|
155
|
+
function generateFeatureClaudeMd(workspace, featureName, requirementsPath) {
|
|
156
|
+
const platform = os.platform() === 'win32' ? 'Windows' : os.platform() === 'darwin' ? 'macOS' : 'Linux';
|
|
157
|
+
return `# CLAUDE.md
|
|
158
|
+
|
|
159
|
+
This file provides guidance to Claude Code when working in this workspace.
|
|
160
|
+
|
|
161
|
+
## Environment
|
|
162
|
+
|
|
163
|
+
- **Platform**: ${platform}
|
|
164
|
+
- **Workspace**: ${workspace}
|
|
165
|
+
- **Feature Mode**: ${featureName}
|
|
166
|
+
${platform === 'Windows' ? '- Use Windows-compatible commands (e.g., use backslashes in paths, no Unix-specific commands)\n' : ''}
|
|
167
|
+
## Current Task
|
|
168
|
+
|
|
169
|
+
You are helping the user create a **${requirementsPath}** file for the "${featureName}" feature.
|
|
170
|
+
|
|
171
|
+
**IMPORTANT: Do NOT implement the feature. Do NOT write code, create source files, install packages, or build anything. Your ONLY job right now is to write the requirements document. The actual implementation will happen later in a separate automated process.**
|
|
172
|
+
|
|
173
|
+
### Your Job
|
|
174
|
+
|
|
175
|
+
1. Ask the user what they want to build for this feature
|
|
176
|
+
2. Break down the feature into small, manageable tasks (each ~30 minutes of work)
|
|
177
|
+
3. Write tasks to \`${requirementsPath}\` in the format below
|
|
178
|
+
4. Ensure tasks have clear dependencies where needed
|
|
179
|
+
5. Stop when the requirements document is complete — do NOT start implementing tasks
|
|
180
|
+
|
|
181
|
+
### Task Format
|
|
182
|
+
|
|
183
|
+
Each task in ${requirementsPath} MUST follow this exact format:
|
|
184
|
+
|
|
185
|
+
\`\`\`markdown
|
|
186
|
+
### TASK-001: Task title here
|
|
187
|
+
- **Status**: pending
|
|
188
|
+
- **Priority**: high
|
|
189
|
+
- **Dependencies**: none
|
|
190
|
+
- **Description**: Clear description of what needs to be done.
|
|
191
|
+
|
|
192
|
+
### TASK-002: Another task
|
|
193
|
+
- **Status**: pending
|
|
194
|
+
- **Priority**: medium
|
|
195
|
+
- **Dependencies**: TASK-001
|
|
196
|
+
- **Description**: This task depends on TASK-001 completing first.
|
|
197
|
+
\`\`\`
|
|
198
|
+
|
|
199
|
+
### Rules
|
|
200
|
+
|
|
201
|
+
- Task IDs must be sequential: TASK-001, TASK-002, TASK-003, etc.
|
|
202
|
+
- Status should always be \`pending\` for new tasks
|
|
203
|
+
- Priority: \`high\`, \`medium\`, or \`low\`
|
|
204
|
+
- Dependencies: \`none\` or comma-separated task IDs (e.g., \`TASK-001, TASK-002\`)
|
|
205
|
+
- Keep descriptions clear and actionable
|
|
206
|
+
- The requirements file is at: ${requirementsPath}
|
|
207
|
+
- **Do NOT create any files other than the requirements file** — no source code, no config files, no project scaffolding
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
export async function initCommand(options) {
|
|
211
|
+
await requireClaudeInstalled();
|
|
212
|
+
const workspace = await resolveWorkspace(options.workspace);
|
|
213
|
+
// Feature mode
|
|
214
|
+
if (options.feature) {
|
|
215
|
+
try {
|
|
216
|
+
const { featureName, requirementsPath, progressPath } = resolveFeaturePath(workspace, options.feature);
|
|
217
|
+
console.log(chalk.blue.bold('\n=== DevLoop Init (Feature Mode) ===\n'));
|
|
218
|
+
// Show workflow guide
|
|
219
|
+
console.log(chalk.white('Feature workflow:'));
|
|
220
|
+
console.log(chalk.gray(` 1. devloop init --feature ${featureName} - Create feature requirements (this step)`));
|
|
221
|
+
console.log(chalk.gray(` 2. devloop status --feature ${featureName} - View feature tasks`));
|
|
222
|
+
console.log(chalk.gray(` 3. devloop run --feature ${featureName} - Execute feature tasks`));
|
|
223
|
+
console.log(chalk.gray(` 4. devloop feature list - List all features`));
|
|
224
|
+
console.log();
|
|
225
|
+
console.log(chalk.gray(`Workspace: ${workspace}`));
|
|
226
|
+
console.log(chalk.gray(`Feature: ${featureName}`));
|
|
227
|
+
// Check if feature file already exists
|
|
228
|
+
let requirementsExists = false;
|
|
229
|
+
let adoptExisting = false;
|
|
230
|
+
try {
|
|
231
|
+
await fs.access(requirementsPath);
|
|
232
|
+
requirementsExists = true;
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// File doesn't exist
|
|
236
|
+
}
|
|
237
|
+
// Check if feature session already exists
|
|
238
|
+
const existingSession = await readFeatureSession(workspace, featureName);
|
|
239
|
+
if (requirementsExists) {
|
|
240
|
+
if (existingSession && !options.force) {
|
|
241
|
+
// Both requirements and session exist - already initialized
|
|
242
|
+
console.log(chalk.yellow('\nFeature already initialized.'));
|
|
243
|
+
console.log(chalk.gray(`Use "devloop continue --feature ${featureName}" to resume, or --force to reinitialize.`));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
else if (!existingSession) {
|
|
247
|
+
// Feature file exists but no session - adopt the existing file
|
|
248
|
+
adoptExisting = true;
|
|
249
|
+
console.log(chalk.cyan(`\nFound existing ${requirementsPath} - adopting it.`));
|
|
250
|
+
console.log(chalk.gray('Setting up feature infrastructure...'));
|
|
251
|
+
}
|
|
252
|
+
// If --force is used, we'll overwrite below
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
// Feature file doesn't exist - prompt to create
|
|
256
|
+
console.log(chalk.yellow(`\nFeature file doesn't exist: ${requirementsPath}`));
|
|
257
|
+
const shouldCreate = await promptUser(chalk.cyan('Create it? (Y/n): '));
|
|
258
|
+
if (!shouldCreate) {
|
|
259
|
+
console.log(chalk.gray('Cancelled.'));
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
// Ensure requirements directory exists
|
|
263
|
+
const requirementsDir = path.dirname(requirementsPath);
|
|
264
|
+
await fs.mkdir(requirementsDir, { recursive: true });
|
|
265
|
+
}
|
|
266
|
+
// Create requirements template only if not adopting existing file
|
|
267
|
+
if (!adoptExisting && !requirementsExists) {
|
|
268
|
+
const template = generateRequirementsTemplate(featureName);
|
|
269
|
+
await fs.writeFile(requirementsPath, template, 'utf-8');
|
|
270
|
+
console.log(chalk.green(`Created: ${requirementsPath}`));
|
|
271
|
+
}
|
|
272
|
+
else if (adoptExisting) {
|
|
273
|
+
console.log(chalk.green(`Using existing: ${requirementsPath}`));
|
|
274
|
+
}
|
|
275
|
+
// Create workspace CLAUDE.md to give Claude context about environment and task
|
|
276
|
+
const claudeMdPath = path.join(workspace, 'CLAUDE.md');
|
|
277
|
+
const claudeMdContent = generateFeatureClaudeMd(workspace, featureName, requirementsPath);
|
|
278
|
+
await fs.writeFile(claudeMdPath, claudeMdContent, 'utf-8');
|
|
279
|
+
console.log(chalk.green(`Created: ${claudeMdPath}`));
|
|
280
|
+
// Create feature session for init phase
|
|
281
|
+
await createFeatureSession(workspace, featureName, 'init');
|
|
282
|
+
// Detect and configure commit message format, get initial commit message
|
|
283
|
+
const initAction = `Initialize feature "${featureName}"`;
|
|
284
|
+
const commitConfig = await detectAndConfigureCommitFormat(workspace, initAction);
|
|
285
|
+
console.log(chalk.yellow.bold('\n--- Tips ---'));
|
|
286
|
+
console.log(chalk.yellow(' Claude will ask to overwrite the requirements file — say yes (the placeholder is just a template).'));
|
|
287
|
+
console.log(chalk.yellow(' Describe what you want to build. Include any preferences for technologies or approaches.'));
|
|
288
|
+
console.log(chalk.yellow(' Do NOT ask Claude to build the feature — this session is only for planning.'));
|
|
289
|
+
console.log(chalk.yellow(' If Claude starts writing code or creating files, remind it to just write the requirements doc.'));
|
|
290
|
+
console.log(chalk.yellow(' Review the tasks before exiting. Ask Claude to adjust priorities or split large tasks.'));
|
|
291
|
+
console.log(chalk.yellow(' Exit with Ctrl+C or /exit when you\'re happy with the plan.'));
|
|
292
|
+
console.log(chalk.yellow(` Implementation happens later with "devloop run --feature ${featureName}".`));
|
|
293
|
+
console.log(chalk.yellow('------------\n'));
|
|
294
|
+
// Spawn interactive Claude (no initial prompt - let user drive)
|
|
295
|
+
const child = spawnClaudeInteractive(workspace, null);
|
|
296
|
+
// Handle process exit
|
|
297
|
+
child.on('close', async (code) => {
|
|
298
|
+
console.log(chalk.blue('\n\nSession ended.'));
|
|
299
|
+
if (code === 0) {
|
|
300
|
+
// Ensure git repo exists and make initial commit
|
|
301
|
+
await ensureGitRepo(workspace);
|
|
302
|
+
await commitWithRetry(workspace, commitConfig.message, commitConfig.action);
|
|
303
|
+
console.log(chalk.green('Feature requirements ready at:'), requirementsPath);
|
|
304
|
+
console.log(chalk.gray(`Run "devloop status --feature ${featureName}" to see your tasks.`));
|
|
305
|
+
console.log(chalk.gray(`Run "devloop run --feature ${featureName}" to start executing tasks.`));
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
if (error instanceof Error) {
|
|
312
|
+
console.log(chalk.red(error.message));
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
console.log(chalk.red(`Error: ${error}`));
|
|
316
|
+
}
|
|
317
|
+
process.exit(1);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
// Legacy mode (unchanged)
|
|
321
|
+
const requirementsPath = getRequirementsPath(workspace);
|
|
322
|
+
console.log(chalk.blue.bold('\n=== DevLoop Init ===\n'));
|
|
323
|
+
// Show workflow guide
|
|
324
|
+
console.log(chalk.white('Typical workflow:'));
|
|
325
|
+
console.log(chalk.gray(' 1. devloop init - Create requirements.md (this step)'));
|
|
326
|
+
console.log(chalk.gray(' 2. devloop status - View tasks and progress'));
|
|
327
|
+
console.log(chalk.gray(' 3. devloop run -n 10 - Execute tasks in a loop'));
|
|
328
|
+
console.log(chalk.gray(' 4. devloop continue - Resume requirements or run later'));
|
|
329
|
+
console.log();
|
|
330
|
+
console.log(chalk.gray(`Workspace: ${workspace}`));
|
|
331
|
+
// Check if requirements.md already exists
|
|
332
|
+
let requirementsExists = false;
|
|
333
|
+
let adoptExisting = false;
|
|
334
|
+
try {
|
|
335
|
+
await fs.access(requirementsPath);
|
|
336
|
+
requirementsExists = true;
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
// File doesn't exist
|
|
340
|
+
}
|
|
341
|
+
// Check if session already exists
|
|
342
|
+
const existingSession = await readSession(workspace);
|
|
343
|
+
if (requirementsExists) {
|
|
344
|
+
if (existingSession && !options.force) {
|
|
345
|
+
// Both requirements and session exist - already initialized
|
|
346
|
+
console.log(chalk.yellow('\nWorkspace already initialized.'));
|
|
347
|
+
console.log(chalk.gray('Use "devloop continue" to resume, or --force to reinitialize.'));
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
else if (!existingSession) {
|
|
351
|
+
// requirements.md exists but no session - adopt the existing file
|
|
352
|
+
adoptExisting = true;
|
|
353
|
+
console.log(chalk.cyan('\nFound existing requirements.md - adopting it.'));
|
|
354
|
+
console.log(chalk.gray('Setting up DevLoop infrastructure...'));
|
|
355
|
+
}
|
|
356
|
+
// If --force is used, we'll overwrite below
|
|
357
|
+
}
|
|
358
|
+
// Create requirements template only if not adopting existing file
|
|
359
|
+
if (!adoptExisting) {
|
|
360
|
+
const template = generateRequirementsTemplate('My Project');
|
|
361
|
+
await fs.writeFile(requirementsPath, template, 'utf-8');
|
|
362
|
+
console.log(chalk.green(`Created: ${requirementsPath}`));
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
console.log(chalk.green(`Using existing: ${requirementsPath}`));
|
|
366
|
+
}
|
|
367
|
+
// Create workspace CLAUDE.md to give Claude context about environment and task
|
|
368
|
+
const claudeMdPath = path.join(workspace, 'CLAUDE.md');
|
|
369
|
+
const claudeMdContent = generateWorkspaceClaudeMd(workspace);
|
|
370
|
+
await fs.writeFile(claudeMdPath, claudeMdContent, 'utf-8');
|
|
371
|
+
console.log(chalk.green(`Created: ${claudeMdPath}`));
|
|
372
|
+
// Create session for init phase
|
|
373
|
+
await createSession(workspace, 'init');
|
|
374
|
+
// Detect and configure commit message format, get initial commit message
|
|
375
|
+
const initAction = 'Initialize workspace';
|
|
376
|
+
const commitConfig = await detectAndConfigureCommitFormat(workspace, initAction);
|
|
377
|
+
console.log(chalk.yellow.bold('\n--- Tips ---'));
|
|
378
|
+
console.log(chalk.yellow(' Claude will ask to overwrite requirements.md — say yes (the placeholder is just a template).'));
|
|
379
|
+
console.log(chalk.yellow(' Describe what you want to build. Include any preferences for technologies or approaches.'));
|
|
380
|
+
console.log(chalk.yellow(' Do NOT ask Claude to build the project — this session is only for planning.'));
|
|
381
|
+
console.log(chalk.yellow(' If Claude starts writing code or creating files, remind it to just write the requirements doc.'));
|
|
382
|
+
console.log(chalk.yellow(' Review the tasks before exiting. Ask Claude to adjust priorities or split large tasks.'));
|
|
383
|
+
console.log(chalk.yellow(' Exit with Ctrl+C or /exit when you\'re happy with the plan.'));
|
|
384
|
+
console.log(chalk.yellow(' Implementation happens later with "devloop run".'));
|
|
385
|
+
console.log(chalk.yellow('------------\n'));
|
|
386
|
+
// Spawn interactive Claude (no initial prompt - let user drive)
|
|
387
|
+
const child = spawnClaudeInteractive(workspace, null);
|
|
388
|
+
// Handle process exit
|
|
389
|
+
child.on('close', async (code) => {
|
|
390
|
+
console.log(chalk.blue('\n\nSession ended.'));
|
|
391
|
+
if (code === 0) {
|
|
392
|
+
// Ensure git repo exists and make initial commit
|
|
393
|
+
await ensureGitRepo(workspace);
|
|
394
|
+
await commitWithRetry(workspace, commitConfig.message, commitConfig.action);
|
|
395
|
+
console.log(chalk.green('Requirements file is ready at:'), requirementsPath);
|
|
396
|
+
console.log(chalk.gray('Run "devloop status" to see your tasks.'));
|
|
397
|
+
console.log(chalk.gray('Run "devloop run" to start executing tasks.'));
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAA6C,MAAM,mBAAmB,CAAC;AACzI,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,kBAAkB,E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O,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC9C,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,iDAAiD;YACjD,MAAM,aAAa,CAAC,SAAS,CAAC,CAAC;YAC/B,MAAM,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;YAE5E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,gCAAgC,CAAC,EAAE,gBAAgB,CAAC,CAAC;YAC7E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC,CAAC;QACzE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface RunOptions {
|
|
2
|
+
workspace?: string;
|
|
3
|
+
feature?: string;
|
|
4
|
+
maxIterations?: string;
|
|
5
|
+
tokenLimit?: string;
|
|
6
|
+
costLimit?: string;
|
|
7
|
+
verbose?: boolean;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function runCommand(options: RunOptions): Promise<void>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAMA,UAAU,UAAU;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFnE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import * as fs from 'fs/promises';
|
|
3
|
+
import { resolveWorkspace, resolveFeaturePath } from '../core/config.js';
|
|
4
|
+
import { runLoop } from '../core/loop.js';
|
|
5
|
+
import { requireClaudeInstalled, buildRunConfig } from './shared.js';
|
|
6
|
+
export async function runCommand(options) {
|
|
7
|
+
await requireClaudeInstalled();
|
|
8
|
+
const workspace = await resolveWorkspace(options.workspace);
|
|
9
|
+
// Feature mode
|
|
10
|
+
if (options.feature) {
|
|
11
|
+
try {
|
|
12
|
+
const { featureName, requirementsPath, progressPath } = resolveFeaturePath(workspace, options.feature);
|
|
13
|
+
// Check if feature file exists
|
|
14
|
+
try {
|
|
15
|
+
await fs.access(requirementsPath);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
console.log(chalk.red(`Error: Feature file not found: ${requirementsPath}\n`));
|
|
19
|
+
console.log('Did you mean to:');
|
|
20
|
+
console.log(chalk.cyan(` 1. Create it: devloop init --feature ${featureName}`));
|
|
21
|
+
console.log(chalk.cyan(' 2. List features: devloop feature list'));
|
|
22
|
+
console.log(chalk.cyan(' 3. Run legacy mode: devloop run (without --feature)'));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const config = buildRunConfig({
|
|
26
|
+
workspace,
|
|
27
|
+
requirementsPath,
|
|
28
|
+
progressPath,
|
|
29
|
+
maxIterations: options.maxIterations,
|
|
30
|
+
tokenLimit: options.tokenLimit,
|
|
31
|
+
costLimit: options.costLimit,
|
|
32
|
+
verbose: options.verbose,
|
|
33
|
+
dryRun: options.dryRun,
|
|
34
|
+
featureName,
|
|
35
|
+
sessionAction: 'create-feature'
|
|
36
|
+
});
|
|
37
|
+
if (isNaN(config.maxIterations) || config.maxIterations < 1) {
|
|
38
|
+
console.log(chalk.red('Error: max-iterations must be a positive number'));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
await runLoop(config);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.log(chalk.red(`\nFatal error: ${error}`));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (error instanceof Error) {
|
|
52
|
+
console.log(chalk.red(error.message));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.log(chalk.red(`Error: ${error}`));
|
|
56
|
+
}
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Legacy mode
|
|
61
|
+
const config = buildRunConfig({
|
|
62
|
+
workspace,
|
|
63
|
+
maxIterations: options.maxIterations,
|
|
64
|
+
tokenLimit: options.tokenLimit,
|
|
65
|
+
costLimit: options.costLimit,
|
|
66
|
+
verbose: options.verbose,
|
|
67
|
+
dryRun: options.dryRun,
|
|
68
|
+
sessionAction: 'create'
|
|
69
|
+
});
|
|
70
|
+
if (isNaN(config.maxIterations) || config.maxIterations < 1) {
|
|
71
|
+
console.log(chalk.red('Error: max-iterations must be a positive number'));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
await runLoop(config);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.log(chalk.red(`\nFatal error: ${error}`));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,KA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OAAO,CAAC,aAAa;QACpC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,aAAa,EAAE,QAAQ;KACxB,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DevLoopConfig } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if Claude CLI is installed, exit with error if not.
|
|
4
|
+
*/
|
|
5
|
+
export declare function requireClaudeInstalled(): Promise<void>;
|
|
6
|
+
export interface RunConfigOptions {
|
|
7
|
+
workspace: string;
|
|
8
|
+
requirementsPath?: string;
|
|
9
|
+
progressPath?: string;
|
|
10
|
+
maxIterations?: string;
|
|
11
|
+
tokenLimit?: string;
|
|
12
|
+
costLimit?: string;
|
|
13
|
+
verbose?: boolean;
|
|
14
|
+
dryRun?: boolean;
|
|
15
|
+
featureName?: string;
|
|
16
|
+
sessionAction?: 'create' | 'update' | 'create-feature' | 'none';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build a DevLoopConfig from command options.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildRunConfig(options: RunConfigOptions): DevLoopConfig;
|
|
22
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAO5D;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,gBAAgB,GAAG,MAAM,CAAC;CACjE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAavE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { checkClaudeInstalled } from '../core/claude.js';
|
|
3
|
+
import { getRequirementsPath, getProgressPath } from '../core/config.js';
|
|
4
|
+
/**
|
|
5
|
+
* Check if Claude CLI is installed, exit with error if not.
|
|
6
|
+
*/
|
|
7
|
+
export async function requireClaudeInstalled() {
|
|
8
|
+
const claudeInstalled = await checkClaudeInstalled();
|
|
9
|
+
if (!claudeInstalled) {
|
|
10
|
+
console.log(chalk.red('Error: Claude CLI is not installed or not in PATH.'));
|
|
11
|
+
console.log(chalk.gray('Install it from: https://claude.ai/code'));
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Build a DevLoopConfig from command options.
|
|
17
|
+
*/
|
|
18
|
+
export function buildRunConfig(options) {
|
|
19
|
+
return {
|
|
20
|
+
maxIterations: parseInt(options.maxIterations || '10', 10),
|
|
21
|
+
requirementsPath: options.requirementsPath || getRequirementsPath(options.workspace),
|
|
22
|
+
progressPath: options.progressPath || getProgressPath(options.workspace),
|
|
23
|
+
workspacePath: options.workspace,
|
|
24
|
+
verbose: options.verbose || false,
|
|
25
|
+
dryRun: options.dryRun || false,
|
|
26
|
+
tokenLimit: options.tokenLimit ? parseInt(options.tokenLimit, 10) : undefined,
|
|
27
|
+
costLimit: options.costLimit ? parseFloat(options.costLimit) : undefined,
|
|
28
|
+
featureName: options.featureName,
|
|
29
|
+
sessionAction: options.sessionAction
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,MAAM,eAAe,GAAG,MAAM,oBAAoB,EAAE,CAAC;IACrD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;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