feat: support ticket-based phase identifiers for team workflows (#1019)

Teams sharing a GSD repo collide on sequential phase numbers when multiple
people create phases concurrently. This adds support for arbitrary string
IDs (e.g. PROJ-42, AUTH-101) as phase identifiers.

New config option:
  { "phase_naming": "custom" }

Changes:
- core.cjs: normalizePhaseName() handles non-numeric IDs gracefully
- core.cjs: comparePhaseNum() falls back to string comparison for custom IDs
- core.cjs: searchPhaseInDir() matches custom ID prefixes case-insensitively
- core.cjs: getMilestonePhaseFilter() recognizes custom ID directory names
- core.cjs: getRoadmapPhaseInternal() matches Phase headers with any word chars
- core.cjs: loadConfig() adds phase_naming option (default: 'sequential')
- phase.cjs: cmdPhaseAdd() accepts --id flag for custom phase IDs
- verify.cjs: health check skips sequential numbering validation in custom mode
- gsd-tools.cjs: phase add --id PROJ-42 "description" wired up

Usage:
  # Sequential mode (default, backward compatible)
  gsd-tools phase add "User Authentication"  # → Phase 3

  # Custom mode (config: phase_naming: custom)
  gsd-tools phase add --id PROJ-42 "User Authentication"
  # Creates: .planning/phases/PROJ-42-user-authentication/
  # ROADMAP: ### Phase PROJ-42: User Authentication

All 755 existing tests pass.

Fixes #1019
This commit is contained in:
Tom Boucher
2026-03-17 08:01:12 -04:00
parent 5fd384f336
commit a4da216523
4 changed files with 90 additions and 39 deletions

View File

@@ -35,7 +35,7 @@
*
* Phase Operations:
* phase next-decimal <phase> Calculate next decimal phase number
* phase add <description> Append new phase to roadmap + create dir
* phase add <description> [--id ID] Append new phase to roadmap + create dir
* phase insert <after> <description> Insert decimal phase after existing
* phase remove <phase> [--force] Remove phase, renumber all subsequent
* phase complete <phase> Mark phase done, update state + roadmap
@@ -470,7 +470,18 @@ async function main() {
if (subcommand === 'next-decimal') {
phase.cmdPhaseNextDecimal(cwd, args[2], raw);
} else if (subcommand === 'add') {
phase.cmdPhaseAdd(cwd, args.slice(2).join(' '), raw);
const idIdx = args.indexOf('--id');
let customId = null;
const descArgs = [];
for (let i = 2; i < args.length; i++) {
if (args[i] === '--id' && i + 1 < args.length) {
customId = args[i + 1];
i++; // skip value
} else {
descArgs.push(args[i]);
}
}
phase.cmdPhaseAdd(cwd, descArgs.join(' '), raw, customId);
} else if (subcommand === 'insert') {
phase.cmdPhaseInsert(cwd, args[2], args.slice(3).join(' '), raw);
} else if (subcommand === 'remove') {