fix: extract human-readable title from spec.md when feature field is spec ID
When the implementation_plan.json feature field contains the spec directory name (e.g., "054-version-2-5-5-displays-version-2-5-0-in-updater") instead of a human-readable title, the task card and modal showed the ugly spec ID. Now detects when the feature field looks like a spec ID (starts with 3 digits and a dash) and extracts the actual title from spec.md's first heading, handling prefixes like "Quick Spec:" and "Specification:". Example: "054-version..." → "Fix Version 2.5.5 Display in Updater" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -326,11 +326,30 @@ export class ProjectStore {
|
||||
const stagedInMainProject = planWithStaged?.stagedInMainProject;
|
||||
const stagedAt = planWithStaged?.stagedAt;
|
||||
|
||||
// Determine title - check if feature looks like a spec ID (e.g., "054-something-something")
|
||||
let title = plan?.feature || plan?.title || dir.name;
|
||||
const looksLikeSpecId = /^\d{3}-/.test(title);
|
||||
if (looksLikeSpecId && existsSync(specFilePath)) {
|
||||
try {
|
||||
const specContent = readFileSync(specFilePath, 'utf-8');
|
||||
// Extract title from first # line, handling patterns like:
|
||||
// "# Quick Spec: Title" -> "Title"
|
||||
// "# Specification: Title" -> "Title"
|
||||
// "# Title" -> "Title"
|
||||
const titleMatch = specContent.match(/^#\s+(?:Quick Spec:|Specification:)?\s*(.+)$/m);
|
||||
if (titleMatch && titleMatch[1]) {
|
||||
title = titleMatch[1].trim();
|
||||
}
|
||||
} catch {
|
||||
// Keep the original title on error
|
||||
}
|
||||
}
|
||||
|
||||
tasks.push({
|
||||
id: dir.name, // Use spec directory name as ID
|
||||
specId: dir.name,
|
||||
projectId,
|
||||
title: plan?.feature || plan?.title || dir.name,
|
||||
title,
|
||||
description,
|
||||
status,
|
||||
reviewReason,
|
||||
|
||||
Reference in New Issue
Block a user