fix(phase-lifecycle): handle project-code-prefixed dirs in phaseAdd fallback scan

Filesystem fallback regex /^(\d+)-/ missed directories like CK-45-foundation
when project_code is configured. Updated to /^(?:[A-Z][A-Z0-9]*-)?(\d+)-/i.

Addresses coderabbit finding on PR #2737.
This commit is contained in:
Tom Boucher
2026-04-26 11:21:33 -04:00
parent 54cbc2ad96
commit 8270f17773
2 changed files with 24 additions and 1 deletions

View File

@@ -209,7 +209,7 @@ export const phaseAdd: QueryHandler = async (args, projectDir, workstream) => {
const entries = await readdir(phasesDir, { withFileTypes: true });
for (const entry of entries) {
if (!entry.isDirectory()) continue;
const dirMatch = /^(\d+)[A-Z]?(?:\.\d+)*-/.exec(entry.name);
const dirMatch = /^(?:[A-Z][A-Z0-9]*-)?(\d+)[A-Z]?(?:\.\d+)*-/i.exec(entry.name);
if (dirMatch) {
const num = parseInt(dirMatch[1], 10);
if (num >= 999) continue;