@damper/cli 0.5.13 → 0.5.15
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/dist/index.js +1 -1
- package/dist/services/claude.js +19 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { statusCommand } from './commands/status.js';
|
|
|
5
5
|
import { cleanupCommand } from './commands/cleanup.js';
|
|
6
6
|
import { setupCommand } from './commands/setup.js';
|
|
7
7
|
import { releaseCommand } from './commands/release.js';
|
|
8
|
-
const VERSION = '0.5.
|
|
8
|
+
const VERSION = '0.5.15';
|
|
9
9
|
function showHelp() {
|
|
10
10
|
console.log(`
|
|
11
11
|
${pc.bold('@damper/cli')} - Agent orchestration for Damper tasks
|
package/dist/services/claude.js
CHANGED
|
@@ -108,35 +108,11 @@ export async function launchClaude(options) {
|
|
|
108
108
|
console.log(pc.cyan('Mode: Plan (will ask for approval)'));
|
|
109
109
|
}
|
|
110
110
|
console.log();
|
|
111
|
-
//
|
|
112
|
-
const mcpConfigPath = path.join(os.tmpdir(), `damper-mcp-${taskId}.json`);
|
|
113
|
-
const mcpConfig = {
|
|
114
|
-
mcpServers: {
|
|
115
|
-
damper: {
|
|
116
|
-
command: 'npx',
|
|
117
|
-
args: ['-y', '@damper/mcp'],
|
|
118
|
-
env: { DAMPER_API_KEY: apiKey },
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
123
|
-
// Build Claude args - keep it simple, context is in TASK_CONTEXT.md
|
|
111
|
+
// Build prompt - context is in TASK_CONTEXT.md, MCP is in .claude/settings.json
|
|
124
112
|
const initialPrompt = `Read TASK_CONTEXT.md and work on task #${taskId}: ${taskTitle}`;
|
|
125
|
-
const claudeArgs = [
|
|
126
|
-
'--mcp-config', mcpConfigPath,
|
|
127
|
-
initialPrompt,
|
|
128
|
-
];
|
|
129
113
|
// Launch Claude Code
|
|
130
|
-
// Note: MCP config is set globally via 'setup' command
|
|
131
|
-
// We just pass the API key via environment variable
|
|
132
114
|
const { spawnSync } = await import('node:child_process');
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
fs.unlinkSync(mcpConfigPath);
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
// Ignore cleanup errors
|
|
139
|
-
}
|
|
115
|
+
console.log(pc.dim(`Launching Claude in ${cwd}...`));
|
|
140
116
|
const result = spawnSync('claude', [initialPrompt], {
|
|
141
117
|
cwd,
|
|
142
118
|
stdio: 'inherit',
|
|
@@ -298,26 +274,23 @@ export async function postTaskFlow(options) {
|
|
|
298
274
|
}
|
|
299
275
|
}
|
|
300
276
|
else if (taskStatus === 'in_progress') {
|
|
301
|
-
// Task not completed -
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
277
|
+
// Task not completed - always release the lock, optionally remove worktree
|
|
278
|
+
console.log(pc.dim('\nReleasing task lock...'));
|
|
279
|
+
try {
|
|
280
|
+
const api = createDamperApi(apiKey);
|
|
281
|
+
await api.abandonTask(taskId, 'Session ended via CLI');
|
|
282
|
+
console.log(pc.green(`✓ Task released back to planned status`));
|
|
283
|
+
}
|
|
284
|
+
catch (err) {
|
|
285
|
+
const error = err;
|
|
286
|
+
console.log(pc.yellow(`Could not release task: ${error.message}`));
|
|
287
|
+
}
|
|
288
|
+
// Ask about worktree cleanup
|
|
289
|
+
const shouldRemove = await confirm({
|
|
290
|
+
message: 'Remove worktree and branch?',
|
|
291
|
+
default: false,
|
|
308
292
|
});
|
|
309
|
-
if (
|
|
310
|
-
// Release the task back to planned
|
|
311
|
-
try {
|
|
312
|
-
const api = createDamperApi(apiKey);
|
|
313
|
-
await api.abandonTask(taskId, 'Released via CLI');
|
|
314
|
-
console.log(pc.green(`✓ Task released back to planned status`));
|
|
315
|
-
}
|
|
316
|
-
catch (err) {
|
|
317
|
-
const error = err;
|
|
318
|
-
console.log(pc.yellow(`Could not release task: ${error.message}`));
|
|
319
|
-
}
|
|
320
|
-
// Remove worktree
|
|
293
|
+
if (shouldRemove) {
|
|
321
294
|
try {
|
|
322
295
|
await removeWorktreeDir(cwd, projectRoot);
|
|
323
296
|
console.log(pc.green('✓ Worktree and branch removed\n'));
|
|
@@ -328,7 +301,7 @@ export async function postTaskFlow(options) {
|
|
|
328
301
|
}
|
|
329
302
|
}
|
|
330
303
|
else {
|
|
331
|
-
console.log(pc.dim('\
|
|
304
|
+
console.log(pc.dim('\nWorktree kept. Run `npx @damper/cli cleanup` to remove later.\n'));
|
|
332
305
|
}
|
|
333
306
|
}
|
|
334
307
|
}
|