@fractary/faber-cli 1.3.13 → 1.3.16
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.
|
@@ -312,7 +312,12 @@ async function planSingleIssue(issue, config, repoClient, anthropicClient, optio
|
|
|
312
312
|
}
|
|
313
313
|
catch (error) {
|
|
314
314
|
// If worktree already exists, try to use it
|
|
315
|
-
|
|
315
|
+
// Check for both "already exists" and exit code 128 which indicates the path exists
|
|
316
|
+
if (error instanceof Error &&
|
|
317
|
+
(error.message.includes('already exists') ||
|
|
318
|
+
error.message.includes('exit code 128') ||
|
|
319
|
+
error.message.includes(`'${worktree}'`) ||
|
|
320
|
+
error.message.includes(worktree.replace('~', (await import('os')).homedir())))) {
|
|
316
321
|
if (outputFormat === 'text') {
|
|
317
322
|
console.log(chalk.yellow(` ⚠️ Worktree already exists, using existing worktree`));
|
|
318
323
|
}
|
|
@@ -341,6 +346,8 @@ async function planSingleIssue(issue, config, repoClient, anthropicClient, optio
|
|
|
341
346
|
console.log(chalk.gray(` → Plan written to ${planPath}`));
|
|
342
347
|
}
|
|
343
348
|
}
|
|
349
|
+
// Generate detailed comment for GitHub issue
|
|
350
|
+
const planSummary = generatePlanComment(plan, issue.workflow, worktreePath, planId);
|
|
344
351
|
// Update GitHub issue with plan_id
|
|
345
352
|
if (outputFormat === 'text') {
|
|
346
353
|
console.log(chalk.gray(` → Updating GitHub issue...`));
|
|
@@ -348,7 +355,7 @@ async function planSingleIssue(issue, config, repoClient, anthropicClient, optio
|
|
|
348
355
|
try {
|
|
349
356
|
await repoClient.updateIssue({
|
|
350
357
|
id: issue.number.toString(),
|
|
351
|
-
comment:
|
|
358
|
+
comment: planSummary,
|
|
352
359
|
addLabel: 'faber:planned',
|
|
353
360
|
});
|
|
354
361
|
}
|
|
@@ -363,7 +370,7 @@ async function planSingleIssue(issue, config, repoClient, anthropicClient, optio
|
|
|
363
370
|
}
|
|
364
371
|
await repoClient.updateIssue({
|
|
365
372
|
id: issue.number.toString(),
|
|
366
|
-
comment:
|
|
373
|
+
comment: planSummary,
|
|
367
374
|
});
|
|
368
375
|
}
|
|
369
376
|
else {
|
|
@@ -380,6 +387,47 @@ async function planSingleIssue(issue, config, repoClient, anthropicClient, optio
|
|
|
380
387
|
worktree: worktreePath,
|
|
381
388
|
};
|
|
382
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* Generate a detailed plan comment for GitHub issue
|
|
392
|
+
*/
|
|
393
|
+
function generatePlanComment(plan, workflow, worktreePath, planId) {
|
|
394
|
+
let comment = `🤖 **Workflow Plan Created**\n\n`;
|
|
395
|
+
comment += `**Plan ID:** \`${planId}\`\n`;
|
|
396
|
+
comment += `**Workflow:** \`${workflow}\`\n`;
|
|
397
|
+
// Add workflow inheritance info if available
|
|
398
|
+
if (plan.workflow_config?.inherits_from) {
|
|
399
|
+
comment += `**Inherits from:** \`${plan.workflow_config.inherits_from}\`\n`;
|
|
400
|
+
}
|
|
401
|
+
comment += `\n---\n\n`;
|
|
402
|
+
// Add plan summary by phase
|
|
403
|
+
if (plan.phases && Array.isArray(plan.phases)) {
|
|
404
|
+
comment += `### Workflow Phases\n\n`;
|
|
405
|
+
plan.phases.forEach((phase, index) => {
|
|
406
|
+
comment += `**${index + 1}. ${phase.name || phase.phase}**\n`;
|
|
407
|
+
if (phase.tasks && Array.isArray(phase.tasks)) {
|
|
408
|
+
phase.tasks.forEach((task) => {
|
|
409
|
+
comment += ` - ${task.description || task.name || task}\n`;
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
else if (phase.description) {
|
|
413
|
+
comment += ` - ${phase.description}\n`;
|
|
414
|
+
}
|
|
415
|
+
comment += `\n`;
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
comment += `---\n\n`;
|
|
419
|
+
comment += `### Plan Location\n\n`;
|
|
420
|
+
comment += `\`\`\`\n${worktreePath}/.fractary/plans/${planId}.json\n\`\`\`\n\n`;
|
|
421
|
+
comment += `### Next Steps\n\n`;
|
|
422
|
+
comment += `Execute the workflow plan:\n\n`;
|
|
423
|
+
comment += `\`\`\`bash\n`;
|
|
424
|
+
comment += `cd ${worktreePath}\n`;
|
|
425
|
+
comment += `claude\n`;
|
|
426
|
+
comment += `# Then in Claude Code:\n`;
|
|
427
|
+
comment += `/fractary-faber:workflow-run ${plan.issue_number || ''}\n`;
|
|
428
|
+
comment += `\`\`\`\n`;
|
|
429
|
+
return comment;
|
|
430
|
+
}
|
|
383
431
|
/**
|
|
384
432
|
* Get repository info from config
|
|
385
433
|
*/
|
|
@@ -268,8 +268,8 @@ export class GitHubAppAuth {
|
|
|
268
268
|
}
|
|
269
269
|
// Token refresh threshold (5 minutes before expiration)
|
|
270
270
|
GitHubAppAuth.REFRESH_THRESHOLD_MS = 5 * 60 * 1000;
|
|
271
|
-
// JWT validity period (
|
|
272
|
-
GitHubAppAuth.JWT_EXPIRY_SECONDS =
|
|
271
|
+
// JWT validity period (reduced to 5 minutes to handle clock skew)
|
|
272
|
+
GitHubAppAuth.JWT_EXPIRY_SECONDS = 300;
|
|
273
273
|
// GitHub API base URL
|
|
274
274
|
GitHubAppAuth.GITHUB_API_URL = 'https://api.github.com';
|
|
275
275
|
/**
|