@damper/cli 0.4.0 → 0.4.2

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.4.0';
7
+ const VERSION = '0.4.2';
8
8
  function showHelp() {
9
9
  console.log(`
10
10
  ${pc.bold('@damper/cli')} - Agent orchestration for Damper tasks
@@ -130,18 +130,22 @@ Once approved, switch to implementation and start logging your work.
130
130
  'Self-improvement: If you encounter friction, bugs, or have ideas to improve the CLI/workflow,',
131
131
  'use `report_issue` to log them. Your feedback improves tooling for all future tasks.',
132
132
  ].join('\n');
133
- // Build MCP config with API key so the Damper MCP server can authenticate
134
- const mcpConfig = JSON.stringify({
135
- damper: {
136
- command: 'npx',
137
- args: ['-y', '@damper/mcp'],
138
- env: { DAMPER_API_KEY: apiKey },
133
+ // Write MCP config to a temp file (more reliable than passing JSON on command line)
134
+ const mcpConfigPath = path.join(os.tmpdir(), `damper-mcp-${taskId}.json`);
135
+ const mcpConfig = {
136
+ mcpServers: {
137
+ damper: {
138
+ command: 'npx',
139
+ args: ['-y', '@damper/mcp'],
140
+ env: { DAMPER_API_KEY: apiKey },
141
+ },
139
142
  },
140
- });
143
+ };
144
+ fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
141
145
  // Build Claude args
142
146
  const claudeArgs = [
143
147
  '--permission-mode', yolo ? 'acceptEdits' : 'plan',
144
- '--mcp-config', mcpConfig,
148
+ '--mcp-config', mcpConfigPath,
145
149
  initialPrompt,
146
150
  ];
147
151
  // Launch Claude Code in interactive mode
@@ -164,6 +168,15 @@ Once approved, switch to implementation and start logging your work.
164
168
  }
165
169
  // Claude exited with error - still continue to post-task flow
166
170
  }
171
+ finally {
172
+ // Clean up temp MCP config file
173
+ try {
174
+ fs.unlinkSync(mcpConfigPath);
175
+ }
176
+ catch {
177
+ // Ignore cleanup errors
178
+ }
179
+ }
167
180
  // Post-task flow
168
181
  console.log(pc.dim('\n─────────────────────────────────────────'));
169
182
  console.log(pc.bold('\nClaude session ended.\n'));
@@ -236,21 +249,46 @@ export async function postTaskFlow(options) {
236
249
  console.log(pc.dim('You have uncommitted changes. Commit them before pushing.\n'));
237
250
  }
238
251
  if (hasUnpushedCommits && !hasUncommittedChanges) {
239
- const shouldPush = await confirm({
240
- message: 'Push commits to remote?',
241
- default: true,
252
+ const { select } = await import('@inquirer/prompts');
253
+ const mergeAction = await select({
254
+ message: 'How do you want to merge your changes?',
255
+ choices: [
256
+ { name: 'Create a pull request', value: 'pr' },
257
+ { name: 'Merge directly to main', value: 'merge' },
258
+ { name: 'Just push (decide later)', value: 'push' },
259
+ { name: 'Skip (keep local)', value: 'skip' },
260
+ ],
242
261
  });
243
- if (shouldPush) {
262
+ if (mergeAction === 'skip') {
263
+ console.log(pc.dim('Keeping changes local.\n'));
264
+ }
265
+ else if (mergeAction === 'merge') {
266
+ // Merge directly to main
267
+ try {
268
+ const { execa } = await import('execa');
269
+ console.log(pc.dim('Switching to main and merging...'));
270
+ // Fetch latest main
271
+ await execa('git', ['fetch', 'origin', 'main'], { cwd, stdio: 'pipe' });
272
+ // Checkout main in the main project root (not worktree)
273
+ await execa('git', ['checkout', 'main'], { cwd: projectRoot, stdio: 'pipe' });
274
+ // Merge the feature branch
275
+ await execa('git', ['merge', currentBranch, '--no-edit'], { cwd: projectRoot, stdio: 'inherit' });
276
+ // Push main
277
+ await execa('git', ['push', 'origin', 'main'], { cwd: projectRoot, stdio: 'inherit' });
278
+ console.log(pc.green('✓ Merged to main and pushed\n'));
279
+ }
280
+ catch (err) {
281
+ console.log(pc.red('Failed to merge. You may need to resolve conflicts manually.\n'));
282
+ }
283
+ }
284
+ else {
285
+ // Push first (needed for both 'pr' and 'push')
244
286
  try {
245
287
  const { execa } = await import('execa');
246
288
  await execa('git', ['push', '-u', 'origin', currentBranch], { cwd, stdio: 'inherit' });
247
289
  console.log(pc.green('✓ Pushed to remote\n'));
248
- // Offer to create PR
249
- const shouldCreatePR = await confirm({
250
- message: 'Create a pull request?',
251
- default: true,
252
- });
253
- if (shouldCreatePR) {
290
+ // Create PR if requested
291
+ if (mergeAction === 'pr') {
254
292
  try {
255
293
  await execa('gh', ['pr', 'create', '--fill'], { cwd, stdio: 'inherit' });
256
294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@damper/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "CLI tool for orchestrating Damper task workflows with Claude Code",
5
5
  "author": "Damper <hello@usedamper.com>",
6
6
  "repository": {