@damper/cli 0.5.5 → 0.5.7

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
@@ -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.5';
8
+ const VERSION = '0.5.7';
9
9
  function showHelp() {
10
10
  console.log(`
11
11
  ${pc.bold('@damper/cli')} - Agent orchestration for Damper tasks
@@ -126,20 +126,47 @@ export async function launchClaude(options) {
126
126
  '--mcp-config', mcpConfigPath,
127
127
  initialPrompt,
128
128
  ];
129
- // Launch Claude Code using spawnSync for reliable TTY handling
129
+ // Launch Claude Code
130
130
  try {
131
131
  const { spawnSync } = await import('node:child_process');
132
- const result = spawnSync('claude', [
133
- '--mcp-config', mcpConfigPath,
134
- initialPrompt
135
- ], {
136
- cwd,
137
- stdio: 'inherit',
138
- env: {
139
- ...process.env,
140
- DAMPER_API_KEY: apiKey,
141
- },
142
- });
132
+ // Check if stdin is a TTY - if not, we may need special handling
133
+ const isTTY = process.stdin.isTTY;
134
+ if (process.env.DEBUG) {
135
+ console.log(pc.dim(`Debug: stdin.isTTY = ${isTTY}`));
136
+ }
137
+ // Use script command on macOS to ensure proper TTY allocation
138
+ // This is needed when running through npx which may not pass TTY properly
139
+ const isMac = process.platform === 'darwin';
140
+ let result;
141
+ if (isMac) {
142
+ // script -q /dev/null ensures TTY is allocated
143
+ result = spawnSync('script', [
144
+ '-q', '/dev/null',
145
+ 'claude',
146
+ '--mcp-config', mcpConfigPath,
147
+ initialPrompt
148
+ ], {
149
+ cwd,
150
+ stdio: 'inherit',
151
+ env: {
152
+ ...process.env,
153
+ DAMPER_API_KEY: apiKey,
154
+ },
155
+ });
156
+ }
157
+ else {
158
+ result = spawnSync('claude', [
159
+ '--mcp-config', mcpConfigPath,
160
+ initialPrompt
161
+ ], {
162
+ cwd,
163
+ stdio: 'inherit',
164
+ env: {
165
+ ...process.env,
166
+ DAMPER_API_KEY: apiKey,
167
+ },
168
+ });
169
+ }
143
170
  if (result.error) {
144
171
  const error = result.error;
145
172
  if (error.code === 'ENOENT') {
@@ -306,8 +333,38 @@ export async function postTaskFlow(options) {
306
333
  }
307
334
  }
308
335
  else if (taskStatus === 'in_progress') {
309
- console.log(pc.dim('Task is still in progress. Run `npx @damper/cli` to resume later.'));
310
- console.log(pc.dim('Run `npx @damper/cli cleanup` when ready to remove the worktree.\n'));
336
+ // Task not completed - offer options
337
+ const action = await select({
338
+ message: 'Task is still in progress. What would you like to do?',
339
+ choices: [
340
+ { name: 'Keep for later (resume with npx @damper/cli)', value: 'keep' },
341
+ { name: 'Release task and remove worktree', value: 'release' },
342
+ ],
343
+ });
344
+ if (action === 'release') {
345
+ // Release the task back to planned
346
+ try {
347
+ const api = createDamperApi(apiKey);
348
+ await api.abandonTask(taskId, 'Released via CLI');
349
+ console.log(pc.green(`✓ Task released back to planned status`));
350
+ }
351
+ catch (err) {
352
+ const error = err;
353
+ console.log(pc.yellow(`Could not release task: ${error.message}`));
354
+ }
355
+ // Remove worktree
356
+ try {
357
+ await removeWorktreeDir(cwd, projectRoot);
358
+ console.log(pc.green('✓ Worktree and branch removed\n'));
359
+ }
360
+ catch (err) {
361
+ const error = err;
362
+ console.log(pc.red(`Failed to remove worktree: ${error.message}\n`));
363
+ }
364
+ }
365
+ else {
366
+ console.log(pc.dim('\nRun `npx @damper/cli` to resume later.\n'));
367
+ }
311
368
  }
312
369
  }
313
370
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@damper/cli",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "CLI tool for orchestrating Damper task workflows with Claude Code",
5
5
  "author": "Damper <hello@usedamper.com>",
6
6
  "repository": {