@damper/cli 0.5.18 → 0.6.1
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 +4 -17
- package/dist/services/worktree.js +52 -8
- 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.
|
|
8
|
+
const VERSION = '0.6.1';
|
|
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
|
@@ -112,7 +112,9 @@ export async function launchClaude(options) {
|
|
|
112
112
|
// Build prompt - context is in TASK_CONTEXT.md, MCP is in .claude/settings.json
|
|
113
113
|
const initialPrompt = `IMPORTANT: Start by reading TASK_CONTEXT.md completely. It contains the task description, implementation plan, critical rules, and architecture context. Follow the implementation plan if one exists - do NOT start exploring the codebase until you've read it. Task #${taskId}: ${taskTitle}`;
|
|
114
114
|
console.log(pc.dim(`Launching Claude in ${cwd}...`));
|
|
115
|
-
// Launch Claude Code
|
|
115
|
+
// Launch Claude Code
|
|
116
|
+
// Use spawn with stdio: 'inherit' for proper TTY passthrough
|
|
117
|
+
// Signals (Ctrl+C, Escape) are handled naturally since child inherits the terminal
|
|
116
118
|
await new Promise((resolve) => {
|
|
117
119
|
const child = spawn('claude', [initialPrompt], {
|
|
118
120
|
cwd,
|
|
@@ -122,15 +124,6 @@ export async function launchClaude(options) {
|
|
|
122
124
|
DAMPER_API_KEY: apiKey,
|
|
123
125
|
},
|
|
124
126
|
});
|
|
125
|
-
// Forward signals to child process
|
|
126
|
-
const forwardSignal = (signal) => {
|
|
127
|
-
if (!child.killed) {
|
|
128
|
-
child.kill(signal);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
process.on('SIGINT', () => forwardSignal('SIGINT'));
|
|
132
|
-
process.on('SIGTERM', () => forwardSignal('SIGTERM'));
|
|
133
|
-
process.on('SIGHUP', () => forwardSignal('SIGHUP'));
|
|
134
127
|
child.on('error', (err) => {
|
|
135
128
|
if (err.code === 'ENOENT') {
|
|
136
129
|
console.log(pc.red('\nError: Claude Code CLI not found.'));
|
|
@@ -139,13 +132,7 @@ export async function launchClaude(options) {
|
|
|
139
132
|
}
|
|
140
133
|
resolve();
|
|
141
134
|
});
|
|
142
|
-
child.on('close', () =>
|
|
143
|
-
// Clean up signal listeners
|
|
144
|
-
process.removeAllListeners('SIGINT');
|
|
145
|
-
process.removeAllListeners('SIGTERM');
|
|
146
|
-
process.removeAllListeners('SIGHUP');
|
|
147
|
-
resolve();
|
|
148
|
-
});
|
|
135
|
+
child.on('close', () => resolve());
|
|
149
136
|
});
|
|
150
137
|
// Post-task flow
|
|
151
138
|
console.log(pc.dim('\n─────────────────────────────────────────'));
|
|
@@ -254,12 +254,8 @@ export async function createWorktree(options) {
|
|
|
254
254
|
await fs.promises.copyFile(source, target);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
// Create .
|
|
258
|
-
const
|
|
259
|
-
if (!fs.existsSync(claudeDir)) {
|
|
260
|
-
fs.mkdirSync(claudeDir, { recursive: true });
|
|
261
|
-
}
|
|
262
|
-
const claudeSettings = {
|
|
257
|
+
// Create .mcp.json with Damper MCP configured (project-level MCP config)
|
|
258
|
+
const mcpConfig = {
|
|
263
259
|
mcpServers: {
|
|
264
260
|
damper: {
|
|
265
261
|
command: 'npx',
|
|
@@ -270,8 +266,56 @@ export async function createWorktree(options) {
|
|
|
270
266
|
},
|
|
271
267
|
},
|
|
272
268
|
};
|
|
273
|
-
fs.writeFileSync(path.join(
|
|
274
|
-
console.log(pc.dim('Created .
|
|
269
|
+
fs.writeFileSync(path.join(worktreePath, '.mcp.json'), JSON.stringify(mcpConfig, null, 2));
|
|
270
|
+
console.log(pc.dim('Created .mcp.json with Damper MCP'));
|
|
271
|
+
// Create .claude/settings.local.json with permissions for Damper MCP tools
|
|
272
|
+
const claudeDir = path.join(worktreePath, '.claude');
|
|
273
|
+
if (!fs.existsSync(claudeDir)) {
|
|
274
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
275
|
+
}
|
|
276
|
+
const claudeSettings = {
|
|
277
|
+
permissions: {
|
|
278
|
+
allow: [
|
|
279
|
+
'mcp__damper__list_tasks',
|
|
280
|
+
'mcp__damper__get_task',
|
|
281
|
+
'mcp__damper__update_task',
|
|
282
|
+
'mcp__damper__create_task',
|
|
283
|
+
'mcp__damper__start_task',
|
|
284
|
+
'mcp__damper__add_note',
|
|
285
|
+
'mcp__damper__add_commit',
|
|
286
|
+
'mcp__damper__create_subtask',
|
|
287
|
+
'mcp__damper__update_subtask',
|
|
288
|
+
'mcp__damper__complete_task',
|
|
289
|
+
'mcp__damper__abandon_task',
|
|
290
|
+
'mcp__damper__get_agent_instructions',
|
|
291
|
+
'mcp__damper__list_context_sections',
|
|
292
|
+
'mcp__damper__get_context_section',
|
|
293
|
+
'mcp__damper__update_context_section',
|
|
294
|
+
'mcp__damper__delete_context_section',
|
|
295
|
+
'mcp__damper__sync_project_context',
|
|
296
|
+
'mcp__damper__get_project_context',
|
|
297
|
+
'mcp__damper__list_feedback',
|
|
298
|
+
'mcp__damper__get_feedback',
|
|
299
|
+
'mcp__damper__report_issue',
|
|
300
|
+
'mcp__damper__list_templates',
|
|
301
|
+
'mcp__damper__get_template',
|
|
302
|
+
'mcp__damper__update_template',
|
|
303
|
+
'mcp__damper__sync_templates',
|
|
304
|
+
'mcp__damper__list_modules',
|
|
305
|
+
'mcp__damper__get_module',
|
|
306
|
+
'mcp__damper__update_module',
|
|
307
|
+
'mcp__damper__sync_modules',
|
|
308
|
+
'mcp__damper__link_feedback_to_task',
|
|
309
|
+
'mcp__damper__list_changelogs',
|
|
310
|
+
'mcp__damper__create_changelog',
|
|
311
|
+
'mcp__damper__update_changelog',
|
|
312
|
+
'mcp__damper__add_to_changelog',
|
|
313
|
+
'mcp__damper__publish_changelog',
|
|
314
|
+
],
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
fs.writeFileSync(path.join(claudeDir, 'settings.local.json'), JSON.stringify(claudeSettings, null, 2));
|
|
318
|
+
console.log(pc.dim('Created .claude/settings.local.json with MCP permissions'));
|
|
275
319
|
// Save to state
|
|
276
320
|
const worktreeState = {
|
|
277
321
|
taskId,
|