@damper/cli 0.3.2 → 0.3.4
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
CHANGED
|
@@ -4,7 +4,7 @@ import { startCommand } from './commands/start.js';
|
|
|
4
4
|
import { statusCommand } from './commands/status.js';
|
|
5
5
|
import { cleanupCommand } from './commands/cleanup.js';
|
|
6
6
|
import { setupCommand } from './commands/setup.js';
|
|
7
|
-
const VERSION = '0.3.
|
|
7
|
+
const VERSION = '0.3.4';
|
|
8
8
|
function showHelp() {
|
|
9
9
|
console.log(`
|
|
10
10
|
${pc.bold('@damper/cli')} - Agent orchestration for Damper tasks
|
package/dist/services/claude.js
CHANGED
|
@@ -114,13 +114,21 @@ Once approved, switch to implementation and start logging your work.
|
|
|
114
114
|
'Self-improvement: If you encounter friction, bugs, or have ideas to improve the CLI/workflow,',
|
|
115
115
|
'use `report_issue` to log them. Your feedback improves tooling for all future tasks.',
|
|
116
116
|
].join('\n');
|
|
117
|
+
// Build MCP config with API key so the Damper MCP server can authenticate
|
|
118
|
+
const mcpConfig = JSON.stringify({
|
|
119
|
+
damper: {
|
|
120
|
+
command: 'npx',
|
|
121
|
+
args: ['-y', '@damper/mcp'],
|
|
122
|
+
env: { DAMPER_API_KEY: apiKey },
|
|
123
|
+
},
|
|
124
|
+
});
|
|
117
125
|
// Build Claude args
|
|
118
126
|
const claudeArgs = [
|
|
119
127
|
'--permission-mode', yolo ? 'acceptEdits' : 'plan',
|
|
128
|
+
'--mcp-config', mcpConfig,
|
|
120
129
|
initialPrompt,
|
|
121
130
|
];
|
|
122
131
|
// Launch Claude Code in interactive mode
|
|
123
|
-
// Pass API key so MCP server gets it
|
|
124
132
|
try {
|
|
125
133
|
await execa('claude', claudeArgs, {
|
|
126
134
|
cwd,
|
|
@@ -13,7 +13,7 @@ export interface WorktreeResult {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function createWorktree(options: WorktreeOptions): Promise<WorktreeResult>;
|
|
15
15
|
/**
|
|
16
|
-
* Remove a git worktree
|
|
16
|
+
* Remove a git worktree and its branch
|
|
17
17
|
*/
|
|
18
18
|
export declare function removeWorktreeDir(worktreePath: string, projectRoot: string): Promise<void>;
|
|
19
19
|
/**
|
|
@@ -257,10 +257,22 @@ export async function createWorktree(options) {
|
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
|
-
* Remove a git worktree
|
|
260
|
+
* Remove a git worktree and its branch
|
|
261
261
|
*/
|
|
262
262
|
export async function removeWorktreeDir(worktreePath, projectRoot) {
|
|
263
263
|
console.log(pc.dim(`Removing worktree at ${worktreePath}...`));
|
|
264
|
+
// Get branch name before removing worktree
|
|
265
|
+
let branchName;
|
|
266
|
+
try {
|
|
267
|
+
const { stdout } = await execa('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
|
|
268
|
+
cwd: worktreePath,
|
|
269
|
+
stdio: 'pipe',
|
|
270
|
+
});
|
|
271
|
+
branchName = stdout.trim();
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
// Ignore - might not be able to get branch
|
|
275
|
+
}
|
|
264
276
|
// Remove symlinks first to avoid issues
|
|
265
277
|
const nodeModulesDirs = findNodeModulesDirs(projectRoot);
|
|
266
278
|
for (const dir of nodeModulesDirs) {
|
|
@@ -279,6 +291,29 @@ export async function removeWorktreeDir(worktreePath, projectRoot) {
|
|
|
279
291
|
cwd: projectRoot,
|
|
280
292
|
stdio: 'pipe',
|
|
281
293
|
});
|
|
294
|
+
// Delete the branch if it's a feature branch
|
|
295
|
+
if (branchName && branchName.startsWith('feature/')) {
|
|
296
|
+
try {
|
|
297
|
+
await execa('git', ['branch', '-d', branchName], {
|
|
298
|
+
cwd: projectRoot,
|
|
299
|
+
stdio: 'pipe',
|
|
300
|
+
});
|
|
301
|
+
console.log(pc.dim(`Deleted branch: ${branchName}`));
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
// Branch might not be fully merged - try force delete
|
|
305
|
+
try {
|
|
306
|
+
await execa('git', ['branch', '-D', branchName], {
|
|
307
|
+
cwd: projectRoot,
|
|
308
|
+
stdio: 'pipe',
|
|
309
|
+
});
|
|
310
|
+
console.log(pc.dim(`Force deleted branch: ${branchName}`));
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
console.log(pc.yellow(`Could not delete branch: ${branchName}`));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
282
317
|
// Get the worktree state to find the task ID
|
|
283
318
|
const state = await import('./state.js');
|
|
284
319
|
const worktree = state.getWorktreeByPath(worktreePath);
|
|
@@ -33,13 +33,12 @@ export function generateTaskContext(options) {
|
|
|
33
33
|
lines.push('- Generated this TASK_CONTEXT.md from Damper API');
|
|
34
34
|
lines.push('- Configured Damper MCP tools for task lifecycle');
|
|
35
35
|
lines.push('');
|
|
36
|
-
lines.push('**
|
|
37
|
-
lines.push('
|
|
38
|
-
lines.push('
|
|
39
|
-
lines.push('- Ideas to improve the workflow or prompts');
|
|
36
|
+
lines.push('**Cleanup:** When done, call `complete_task` or `abandon_task`. The user will run');
|
|
37
|
+
lines.push('`npx @damper/cli cleanup` to remove the worktree and branch - you don\'t need to');
|
|
38
|
+
lines.push('provide manual cleanup instructions.');
|
|
40
39
|
lines.push('');
|
|
41
|
-
lines.push('
|
|
42
|
-
lines.push('Your feedback
|
|
40
|
+
lines.push('**Help improve the tooling:** If you encounter friction, bugs, or have ideas,');
|
|
41
|
+
lines.push('use `report_issue` to log them. Your feedback improves tooling for all future tasks.');
|
|
43
42
|
lines.push('');
|
|
44
43
|
// Task Description
|
|
45
44
|
if (task.description) {
|