@damper/cli 0.5.1 → 0.5.3
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 +30 -45
- 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.3';
|
|
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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import * as os from 'node:os';
|
|
4
|
-
import { spawn } from 'node:child_process';
|
|
5
4
|
import { execa } from 'execa';
|
|
6
5
|
import pc from 'picocolors';
|
|
7
6
|
const CLAUDE_SETTINGS_DIR = path.join(os.homedir(), '.claude');
|
|
@@ -109,28 +108,6 @@ export async function launchClaude(options) {
|
|
|
109
108
|
console.log(pc.cyan('Mode: Plan (will ask for approval)'));
|
|
110
109
|
}
|
|
111
110
|
console.log();
|
|
112
|
-
// Build initial prompt
|
|
113
|
-
const planModeNote = yolo ? '' : `
|
|
114
|
-
You're in PLAN MODE. First, read TASK_CONTEXT.md and create an implementation plan.
|
|
115
|
-
Do NOT log anything to Damper (no add_commit, add_note) until your plan is approved.
|
|
116
|
-
Once approved, switch to implementation and start logging your work.
|
|
117
|
-
`;
|
|
118
|
-
const initialPrompt = [
|
|
119
|
-
`I'm working on task #${taskId}: ${taskTitle}`,
|
|
120
|
-
planModeNote,
|
|
121
|
-
'Please read TASK_CONTEXT.md for full context, critical rules, and the implementation plan.',
|
|
122
|
-
'',
|
|
123
|
-
'Task workflow (after plan approval):',
|
|
124
|
-
'1. Use `add_commit` after each git commit',
|
|
125
|
-
'2. Use `add_note` for important decisions',
|
|
126
|
-
'3. Call `complete_task` when done or `abandon_task` if stopping early',
|
|
127
|
-
'',
|
|
128
|
-
'About this session: You were launched by @damper/cli.',
|
|
129
|
-
'The CLI created this worktree, bootstrapped TASK_CONTEXT.md, and configured Damper MCP.',
|
|
130
|
-
'',
|
|
131
|
-
'Self-improvement: If you encounter friction, bugs, or have ideas to improve the CLI/workflow,',
|
|
132
|
-
'use `report_issue` to log them. Your feedback improves tooling for all future tasks.',
|
|
133
|
-
].join('\n');
|
|
134
111
|
// Write MCP config to a temp file (more reliable than passing JSON on command line)
|
|
135
112
|
const mcpConfigPath = path.join(os.tmpdir(), `damper-mcp-${taskId}.json`);
|
|
136
113
|
const mcpConfig = {
|
|
@@ -143,35 +120,43 @@ Once approved, switch to implementation and start logging your work.
|
|
|
143
120
|
},
|
|
144
121
|
};
|
|
145
122
|
fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
146
|
-
// Build Claude args
|
|
123
|
+
// Build Claude args - keep it simple, context is in TASK_CONTEXT.md
|
|
124
|
+
const initialPrompt = `Read TASK_CONTEXT.md and work on task #${taskId}: ${taskTitle}`;
|
|
147
125
|
const claudeArgs = [
|
|
148
|
-
'--permission-mode', yolo ? 'acceptEdits' : 'plan',
|
|
149
126
|
'--mcp-config', mcpConfigPath,
|
|
150
127
|
initialPrompt,
|
|
151
128
|
];
|
|
152
|
-
//
|
|
129
|
+
// Debug: show what we're about to run
|
|
130
|
+
if (process.env.DEBUG) {
|
|
131
|
+
console.log(pc.dim(`Debug: claude ${claudeArgs.join(' ')}`));
|
|
132
|
+
console.log(pc.dim(`Debug: MCP config at ${mcpConfigPath}`));
|
|
133
|
+
}
|
|
134
|
+
// Launch Claude Code in interactive mode
|
|
153
135
|
try {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
reject(err);
|
|
171
|
-
});
|
|
136
|
+
// Use execSync for simpler, more reliable TTY passthrough
|
|
137
|
+
const { execSync } = await import('node:child_process');
|
|
138
|
+
// Build command with proper quoting
|
|
139
|
+
const quotedPrompt = initialPrompt.replace(/'/g, "'\\''");
|
|
140
|
+
const cmd = `claude --mcp-config '${mcpConfigPath}' '${quotedPrompt}'`;
|
|
141
|
+
if (process.env.DEBUG) {
|
|
142
|
+
console.log(pc.dim(`Debug: Running: ${cmd}`));
|
|
143
|
+
}
|
|
144
|
+
execSync(cmd, {
|
|
145
|
+
cwd,
|
|
146
|
+
stdio: 'inherit',
|
|
147
|
+
env: {
|
|
148
|
+
...process.env,
|
|
149
|
+
DAMPER_API_KEY: apiKey,
|
|
150
|
+
},
|
|
172
151
|
});
|
|
173
152
|
}
|
|
174
|
-
catch {
|
|
153
|
+
catch (err) {
|
|
154
|
+
const error = err;
|
|
155
|
+
if (error.code === 'ENOENT') {
|
|
156
|
+
console.log(pc.red('\nError: Claude Code CLI not found.'));
|
|
157
|
+
console.log(pc.dim('Install it with: npm install -g @anthropic-ai/claude-code\n'));
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
175
160
|
// Claude exited with error - still continue to post-task flow
|
|
176
161
|
}
|
|
177
162
|
finally {
|