create-sdd-project 0.18.1 → 0.18.2

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.
@@ -91,6 +91,13 @@ const WORKFLOW_CORE_PROJECT_TYPE_RULES = {
91
91
  [/### UI Changes \(if applicable\)\n\n\[Components to add\/modify\. Reference `docs\/specs\/ui-components\.md`\.\]\n\n/, ''],
92
92
  [' / `ui-components.md`', ''],
93
93
  ],
94
+ // v0.18.2 (Codex R1 finding C4): pr-template.md is project-type adapted —
95
+ // moved from inline replaceInFileFn to this table so smart-diff fallback
96
+ // compare via adaptWorkflowCoreContentForProjectType produces a matching
97
+ // pristine target on backend/frontend installs (no false-preserve).
98
+ 'skills/development-workflow/references/pr-template.md': [
99
+ [' / ui-components.md', ''],
100
+ ],
94
101
  },
95
102
  frontend: {
96
103
  'skills/development-workflow/SKILL.md': [
@@ -101,6 +108,9 @@ const WORKFLOW_CORE_PROJECT_TYPE_RULES = {
101
108
  [/### API Changes \(if applicable\)\n\n\[Endpoints to add\/modify\. Reference[^\]]*\]\n\n/, ''],
102
109
  ['`api-spec.yaml` / ', ''],
103
110
  ],
111
+ 'skills/development-workflow/references/pr-template.md': [
112
+ ['api-spec.yaml / ', ''],
113
+ ],
104
114
  },
105
115
  };
106
116
 
@@ -243,25 +253,16 @@ function adaptAgentContentForProjectType(dest, config, replaceInFileFn) {
243
253
  replaceInFileFn(path.join(dest, 'AGENTS.md'), [
244
254
  [', `ui-ux-designer`', ''],
245
255
  ]);
246
- for (const dir of toolDirs) {
247
- // pr-template: remove ui-components from checklist (out of scope for
248
- // v0.17.1 see dev/ROADMAP.md "Known follow-ups" item 2)
249
- replaceInFileFn(path.join(dest, dir, 'skills', 'development-workflow', 'references', 'pr-template.md'), [
250
- [' / ui-components.md', ''],
251
- ]);
252
- }
256
+ // v0.18.2 (Codex R1 C4): pr-template.md rules moved to WORKFLOW_CORE_PROJECT_TYPE_RULES
257
+ // (handled by the wfRules loop above) so smart-diff fallback compare can
258
+ // produce a pristine adapted target via adaptWorkflowCoreContentForProjectType.
253
259
  // base-standards.mdc: remove ui-ux-designer table row (shared table above)
254
260
  replaceInFileFn(
255
261
  path.join(dest, 'ai-specs', 'specs', 'base-standards.mdc'),
256
262
  BASE_STANDARDS_PROJECT_TYPE_RULES.backend
257
263
  );
258
- } else if (config.projectType === 'frontend') {
259
- for (const dir of toolDirs) {
260
- replaceInFileFn(path.join(dest, dir, 'skills', 'development-workflow', 'references', 'pr-template.md'), [
261
- ['api-spec.yaml / ', ''],
262
- ]);
263
- }
264
264
  }
265
+ // v0.18.2: frontend pr-template rule also moved to WORKFLOW_CORE_PROJECT_TYPE_RULES.
265
266
  }
266
267
 
267
268
  module.exports = {
package/lib/meta.js CHANGED
@@ -273,14 +273,41 @@ function expectedSmartDiffTrackedPaths(aiTools, projectType) {
273
273
  paths.add('ai-specs/specs/documentation-standards.mdc');
274
274
 
275
275
  // v0.17.1: development-workflow skill core files — filtered by aiTools.
276
- // bug-workflow, health-check, pm-orchestrator, project-memory are OUT OF
277
- // SCOPE for v0.17.1 (deferred — see dev/ROADMAP.md "Known follow-ups" item 2).
278
276
  for (const dir of toolDirs) {
279
277
  paths.add(`${dir}/skills/development-workflow/SKILL.md`);
280
278
  paths.add(`${dir}/skills/development-workflow/references/ticket-template.md`);
281
279
  paths.add(`${dir}/skills/development-workflow/references/merge-checklist.md`);
282
280
  }
283
281
 
282
+ // v0.18.2: extend smart-diff coverage to remaining SKILL.md entry points +
283
+ // 11 reference files (closes ROADMAP "Known follow-ups" item 1 — long-deferred
284
+ // since v0.17.1). Universal per aiTools (no project-type filtering — skills
285
+ // and reference templates are stack-agnostic except pr-template.md, which
286
+ // has project-type rules in WORKFLOW_CORE_PROJECT_TYPE_RULES so the
287
+ // fallback compare in upgrade-generator.js produces a pristine adapted
288
+ // target).
289
+ for (const dir of toolDirs) {
290
+ // 4 SKILL.md entry points
291
+ paths.add(`${dir}/skills/bug-workflow/SKILL.md`);
292
+ paths.add(`${dir}/skills/health-check/SKILL.md`);
293
+ paths.add(`${dir}/skills/pm-orchestrator/SKILL.md`);
294
+ paths.add(`${dir}/skills/project-memory/SKILL.md`);
295
+ // 7 development-workflow references
296
+ paths.add(`${dir}/skills/development-workflow/references/pr-template.md`);
297
+ paths.add(`${dir}/skills/development-workflow/references/branching-strategy.md`);
298
+ paths.add(`${dir}/skills/development-workflow/references/failure-handling.md`);
299
+ paths.add(`${dir}/skills/development-workflow/references/workflow-example.md`);
300
+ paths.add(`${dir}/skills/development-workflow/references/complexity-guide.md`);
301
+ paths.add(`${dir}/skills/development-workflow/references/add-feature-template.md`);
302
+ paths.add(`${dir}/skills/development-workflow/references/cross-model-review.md`);
303
+ // 1 pm-orchestrator reference
304
+ paths.add(`${dir}/skills/pm-orchestrator/references/pm-session-template.md`);
305
+ // 3 project-memory references
306
+ paths.add(`${dir}/skills/project-memory/references/bugs_template.md`);
307
+ paths.add(`${dir}/skills/project-memory/references/decisions_template.md`);
308
+ paths.add(`${dir}/skills/project-memory/references/key_facts_template.md`);
309
+ }
310
+
284
311
  // v0.18.1: shipped slash-commands — preserve user customizations across
285
312
  // upgrades. Closes v0.18.0 known limitation where audit-merge.md was
286
313
  // wholesale-overwritten (notable since teams may tune drift recipes for
@@ -305,21 +305,45 @@ function generateUpgrade(config) {
305
305
  const filesToAdapt = new Set();
306
306
 
307
307
  // v0.17.1: before the skills/ wholesale delete-and-copy, save the content
308
- // of the 6 workflow-core files so we can restore them if their hash tells
308
+ // of the workflow-core files so we can restore them if their hash tells
309
309
  // us they were customized. Map keyed by absolute path, value = string or
310
310
  // null (null = file didn't exist before upgrade).
311
+ // v0.18.2: extended from 6 paths to 21 paths × tool dirs (max 42 for
312
+ // fullstack-both). Adds 4 SKILL.md entry points + 11 reference files,
313
+ // closing ROADMAP "Known follow-ups" item 1.
311
314
  const workflowCoreBackup = new Map();
312
315
  const workflowCorePosixPaths = [];
313
316
  {
314
317
  const dirsForBackup = [];
315
318
  if (aiTools !== 'gemini') dirsForBackup.push('.claude');
316
319
  if (aiTools !== 'claude') dirsForBackup.push('.gemini');
320
+ const WORKFLOW_CORE_RELATIVE_PATHS = [
321
+ // v0.17.1 (3 files)
322
+ 'skills/development-workflow/SKILL.md',
323
+ 'skills/development-workflow/references/ticket-template.md',
324
+ 'skills/development-workflow/references/merge-checklist.md',
325
+ // v0.18.2: 4 SKILL.md entry points
326
+ 'skills/bug-workflow/SKILL.md',
327
+ 'skills/health-check/SKILL.md',
328
+ 'skills/pm-orchestrator/SKILL.md',
329
+ 'skills/project-memory/SKILL.md',
330
+ // v0.18.2: 7 development-workflow references
331
+ 'skills/development-workflow/references/pr-template.md',
332
+ 'skills/development-workflow/references/branching-strategy.md',
333
+ 'skills/development-workflow/references/failure-handling.md',
334
+ 'skills/development-workflow/references/workflow-example.md',
335
+ 'skills/development-workflow/references/complexity-guide.md',
336
+ 'skills/development-workflow/references/add-feature-template.md',
337
+ 'skills/development-workflow/references/cross-model-review.md',
338
+ // v0.18.2: 1 pm-orchestrator reference
339
+ 'skills/pm-orchestrator/references/pm-session-template.md',
340
+ // v0.18.2: 3 project-memory references
341
+ 'skills/project-memory/references/bugs_template.md',
342
+ 'skills/project-memory/references/decisions_template.md',
343
+ 'skills/project-memory/references/key_facts_template.md',
344
+ ];
317
345
  for (const dir of dirsForBackup) {
318
- for (const relSub of [
319
- 'skills/development-workflow/SKILL.md',
320
- 'skills/development-workflow/references/ticket-template.md',
321
- 'skills/development-workflow/references/merge-checklist.md',
322
- ]) {
346
+ for (const relSub of WORKFLOW_CORE_RELATIVE_PATHS) {
323
347
  const posix = `${dir}/${relSub}`;
324
348
  const abs = path.join(dest, ...posix.split('/'));
325
349
  workflowCorePosixPaths.push({ posix, abs });
@@ -370,13 +394,13 @@ function generateUpgrade(config) {
370
394
  fs.rmSync(subDir, { recursive: true, force: true });
371
395
  }
372
396
  }
373
- // For .gemini, also remove commands (SDD-owned Gemini TOML commands)
374
- if (dir === '.gemini') {
375
- const cmdDir = path.join(base, 'commands');
376
- if (fs.existsSync(cmdDir)) {
377
- fs.rmSync(cmdDir, { recursive: true, force: true });
378
- }
379
- }
397
+ // v0.18.2: do NOT wholesale-delete .gemini/commands. The smart-diff loop
398
+ // below iterates template command files individually and preserves user
399
+ // customizations of tracked paths (e.g. audit-merge.toml) — closing the
400
+ // v0.18.1 plumbing gap where these files were silently overwritten on
401
+ // every upgrade despite being tracked in expectedSmartDiffTrackedPaths.
402
+ // Custom Gemini commands (files NOT in the template) are left in place,
403
+ // mirroring the agent strategy from v0.16.10.
380
404
 
381
405
  // Copy fresh from template
382
406
  const templateToolDir = path.join(templateDir, dir);
@@ -522,16 +546,117 @@ function generateUpgrade(config) {
522
546
  continue;
523
547
  }
524
548
 
525
- // For .claude/commands, merge: overwrite SDD template commands, preserve user's custom commands
526
- if (dir === '.claude' && sub === 'commands') {
549
+ // v0.18.2: smart-diff loop for commands (closes v0.18.1 plumbing gap).
550
+ //
551
+ // Pre-v0.18.2: .claude/commands wholesale cpSync'd every file (line 525-531)
552
+ // and .gemini/commands wholesale rmSync'd + recursive cpSync'd (lines 374-378
553
+ // and the fallback at 532-533). Both branches overwrote user customizations
554
+ // silently despite the paths being added to expectedSmartDiffTrackedPaths in
555
+ // v0.18.1 (lib/meta.js:284-320).
556
+ //
557
+ // Now: iterate template command files individually. For each file:
558
+ // - If posix path is tracked → smart-diff decision tree (preserve customizations)
559
+ // - Else → unconditional overwrite (SDD-owned wrappers, e.g. add-feature.toml)
560
+ // Custom commands (files NOT in template) are NOT touched, mirroring the
561
+ // agent strategy from v0.16.10.
562
+ //
563
+ // Commands have NO project-type or stack adaptations — adapted target == raw template.
564
+ if (sub === 'commands') {
527
565
  fs.mkdirSync(destSub, { recursive: true });
528
- for (const file of fs.readdirSync(srcSub)) {
529
- // Always overwrite template-owned files (they may have been updated)
530
- fs.cpSync(path.join(srcSub, file), path.join(destSub, file));
566
+ const trackedSet = expectedSmartDiffTrackedPaths(aiTools, projectType);
567
+ const templateCmdFiles = fs
568
+ .readdirSync(srcSub, { withFileTypes: true })
569
+ .filter((e) => e.isFile())
570
+ .map((e) => e.name);
571
+
572
+ for (const file of templateCmdFiles) {
573
+ const templateCmdPath = path.join(srcSub, file);
574
+ const existingCmdPath = path.join(destSub, file);
575
+ const relativePath = path.relative(dest, existingCmdPath);
576
+ const posixPath = toPosix(relativePath);
577
+ const rawTemplate = fs.readFileSync(templateCmdPath, 'utf8');
578
+
579
+ if (!trackedSet.has(posixPath)) {
580
+ // SDD-owned (e.g. add-feature.toml, fix-bug.toml, next-task.toml,
581
+ // show-progress.toml, start-task.toml) — unconditional overwrite.
582
+ if (fs.existsSync(existingCmdPath)) {
583
+ backupBeforeReplace(dest, relativePath, backupTimestamp);
584
+ }
585
+ fs.writeFileSync(existingCmdPath, rawTemplate, 'utf8');
586
+ replaced++;
587
+ continue;
588
+ }
589
+
590
+ // --- v0.18.2 commands smart-diff decision tree (mirror of agents) ---
591
+ if (!fs.existsSync(existingCmdPath)) {
592
+ fs.writeFileSync(existingCmdPath, rawTemplate, 'utf8');
593
+ filesToAdapt.add(posixPath);
594
+ replaced++;
595
+ continue;
596
+ }
597
+
598
+ if (config.forceTemplate) {
599
+ backupBeforeReplace(dest, relativePath, backupTimestamp);
600
+ fs.writeFileSync(existingCmdPath, rawTemplate, 'utf8');
601
+ filesToAdapt.add(posixPath);
602
+ replaced++;
603
+ continue;
604
+ }
605
+
606
+ const existingContent = fs.readFileSync(existingCmdPath, 'utf8');
607
+ const storedHash = meta && meta.hashes[posixPath];
608
+
609
+ const preserveCmd = () => {
610
+ backupBeforeReplace(dest, relativePath, backupTimestamp);
611
+ const newBackupPath = path.join(
612
+ dest,
613
+ '.sdd-backup',
614
+ backupTimestamp,
615
+ `${relativePath}.new`
616
+ );
617
+ try {
618
+ fs.mkdirSync(path.dirname(newBackupPath), { recursive: true });
619
+ fs.writeFileSync(newBackupPath, rawTemplate, 'utf8');
620
+ } catch (e) {
621
+ console.warn(
622
+ ` ⚠ Failed to write .new backup for ${relativePath}: ${e.code || e.message}`
623
+ );
624
+ }
625
+ modifiedAgentsResults.push({ name: relativePath, modified: true });
626
+ preserved++;
627
+ // Codex M1 invariant: preserved files do NOT update newHashes.
628
+ };
629
+
630
+ if (storedHash) {
631
+ const currentHash = computeHash(existingContent);
632
+ if (currentHash === storedHash) {
633
+ // Pristine — replace + record new hash.
634
+ backupBeforeReplace(dest, relativePath, backupTimestamp);
635
+ fs.writeFileSync(existingCmdPath, rawTemplate, 'utf8');
636
+ filesToAdapt.add(posixPath);
637
+ replaced++;
638
+ continue;
639
+ }
640
+ // Hash mismatch → user customized → preserve.
641
+ preserveCmd();
642
+ continue;
643
+ }
644
+
645
+ // Fallback — no hash (e.g. pre-v0.18.1 install). Compare against
646
+ // raw template (commands have no adapters).
647
+ if (normalizedContentEquals(existingContent, rawTemplate)) {
648
+ backupBeforeReplace(dest, relativePath, backupTimestamp);
649
+ fs.writeFileSync(existingCmdPath, rawTemplate, 'utf8');
650
+ filesToAdapt.add(posixPath);
651
+ replaced++;
652
+ continue;
653
+ }
654
+ preserveCmd();
531
655
  }
532
- } else {
533
- fs.cpSync(srcSub, destSub, { recursive: true });
656
+ continue;
534
657
  }
658
+
659
+ fs.cpSync(srcSub, destSub, { recursive: true });
535
660
  replaced++;
536
661
  }
537
662
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sdd-project",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Create a new SDD DevFlow project with AI-assisted development workflow",
5
5
  "bin": {
6
6
  "create-sdd-project": "bin/cli.js"
@@ -169,9 +169,29 @@ esac
169
169
  && flag "P11 drift: ticket Status='$TICKET_STATUS' expects tracker='$EXPECTED' but tracker='$TRACKER_STATUS'"
170
170
  ```
171
171
 
172
+ **23. P12 — Tracker HEAD references stale (added v0.18.2).** The `**Last Updated:**` and `**Active Feature:**` lines may embed `HEAD <sha>` or `HEAD: <sha>` references that were correct when written but went stale as further commits landed (empirically observed in fx F-WEB-MENU-VISION-001 audit cycle 2026-05-06: tracker said `HEAD: fd752e4` while `git rev-parse HEAD` was `6fa801e` after the agent's own self-edit commit). Compare each extracted SHA against the active branch HEAD. Bidirectional prefix tolerance: a 7-char tracker SHA matches the full 40-char actual HEAD if it's a prefix; a full 40-char tracker SHA matches if its first 7 chars equal the actual short form. Scoped strictly to the two header lines so narrative SHAs in "Last Completed" prose never false-positive-fire.
173
+ ```bash
174
+ TRACKER=docs/project_notes/product-tracker.md
175
+ if [ -f "$TRACKER" ]; then
176
+ ACTUAL_HEAD=$(git rev-parse HEAD 2>/dev/null || true)
177
+ if [ -n "$ACTUAL_HEAD" ]; then
178
+ ACTUAL_SHORT=$(printf '%s' "$ACTUAL_HEAD" | cut -c1-7)
179
+ TRACKER_HEADS=$(grep -E '^\*\*(Last Updated|Active Feature):\*\*' "$TRACKER" 2>/dev/null \
180
+ | grep -oE 'HEAD[[:space:]:]+`?[a-f0-9]{7,40}`?' \
181
+ | grep -oE '[a-f0-9]{7,40}' \
182
+ | sort -u || true)
183
+ for sha in $TRACKER_HEADS; do
184
+ case "$ACTUAL_HEAD" in "$sha"*) continue ;; esac
185
+ case "$sha" in "$ACTUAL_SHORT"*) continue ;; esac
186
+ flag "P12 drift: tracker HEAD reference $sha does not match git rev-parse HEAD ($ACTUAL_HEAD); refresh tracker"
187
+ done
188
+ fi
189
+ fi
190
+ ```
191
+
172
192
  ### Execution discipline (added v0.18.1)
173
193
 
174
- For each of the 11 drift checks (P1–P11), if you declare PASS, **include the literal command output** (or its absence — explicit "no rows matched", "extracted: feature/foo", "FROZEN_COUNT=0") as evidence in your report. A bare "PASS" without supporting output is treated as **NOT EXECUTED** by the auditor — re-run with output captured.
194
+ For each of the 12 drift checks (P1–P12), if you declare PASS, **include the literal command output** (or its absence — explicit "no rows matched", "extracted: feature/foo", "FROZEN_COUNT=0") as evidence in your report. A bare "PASS" without supporting output is treated as **NOT EXECUTED** by the auditor — re-run with output captured.
175
195
 
176
196
  Recommended pattern:
177
197
 
@@ -208,7 +228,7 @@ Report two tables — one for **structural (blocking)** compliance, one for **dr
208
228
 
209
229
  **STRUCTURAL: READY FOR MERGE** (or **STRUCTURAL: NEEDS FIX — N blockers**)
210
230
 
211
- ### Drift (12-22) — advisory, refresh before user authorization
231
+ ### Drift (12-23) — advisory, refresh before user authorization
212
232
 
213
233
  | # | Pattern | Status | Detail |
214
234
  |---|---------|:------:|--------|
@@ -223,6 +243,7 @@ Report two tables — one for **structural (blocking)** compliance, one for **dr
223
243
  | 20 | P9 Tracker header stale | PASS | header = detail |
224
244
  | 21 | P10 Duplicate log rows | PASS | no duplicates |
225
245
  | 22 | P11 Tracker status mismatch | PASS | in-progress for Ready for Merge |
246
+ | 23 | P12 Tracker HEAD reference | PASS | tracker HEAD = git HEAD |
226
247
 
227
248
  **DRIFT: CLEAN** (or **DRIFT: N advisories — refresh before merge**)
228
249
 
@@ -254,6 +275,7 @@ Fix them directly:
254
275
  - **P9 (Tracker header stale)** → update `**Last Updated:**` line step reference to match Active Feature detail
255
276
  - **P10 (Duplicate log rows)** → remove duplicate rows
256
277
  - **P11 (Tracker status mismatch)** → sync tracker Features row status to ticket header Status
278
+ - **P12 (Tracker HEAD reference stale)** → update `**Last Updated:**` and `**Active Feature:**` `HEAD: <sha>` tokens to match `git rev-parse HEAD`. Use `git rev-parse --short HEAD` for the 7-char form.
257
279
 
258
280
  After fixing, re-run the audit to confirm all checks pass.
259
281
 
@@ -169,9 +169,29 @@ esac
169
169
  && flag "P11 drift: ticket Status='$TICKET_STATUS' expects tracker='$EXPECTED' but tracker='$TRACKER_STATUS'"
170
170
  ```
171
171
 
172
+ **23. P12 — Tracker HEAD references stale (added v0.18.2).** The `**Last Updated:**` and `**Active Feature:**` lines may embed `HEAD <sha>` or `HEAD: <sha>` references that were correct when written but went stale as further commits landed (empirically observed in fx F-WEB-MENU-VISION-001 audit cycle 2026-05-06: tracker said `HEAD: fd752e4` while `git rev-parse HEAD` was `6fa801e` after the agent's own self-edit commit). Compare each extracted SHA against the active branch HEAD. Bidirectional prefix tolerance: a 7-char tracker SHA matches the full 40-char actual HEAD if it's a prefix; a full 40-char tracker SHA matches if its first 7 chars equal the actual short form. Scoped strictly to the two header lines so narrative SHAs in "Last Completed" prose never false-positive-fire.
173
+ ```bash
174
+ TRACKER=docs/project_notes/product-tracker.md
175
+ if [ -f "$TRACKER" ]; then
176
+ ACTUAL_HEAD=$(git rev-parse HEAD 2>/dev/null || true)
177
+ if [ -n "$ACTUAL_HEAD" ]; then
178
+ ACTUAL_SHORT=$(printf '%s' "$ACTUAL_HEAD" | cut -c1-7)
179
+ TRACKER_HEADS=$(grep -E '^\*\*(Last Updated|Active Feature):\*\*' "$TRACKER" 2>/dev/null \
180
+ | grep -oE 'HEAD[[:space:]:]+`?[a-f0-9]{7,40}`?' \
181
+ | grep -oE '[a-f0-9]{7,40}' \
182
+ | sort -u || true)
183
+ for sha in $TRACKER_HEADS; do
184
+ case "$ACTUAL_HEAD" in "$sha"*) continue ;; esac
185
+ case "$sha" in "$ACTUAL_SHORT"*) continue ;; esac
186
+ flag "P12 drift: tracker HEAD reference $sha does not match git rev-parse HEAD ($ACTUAL_HEAD); refresh tracker"
187
+ done
188
+ fi
189
+ fi
190
+ ```
191
+
172
192
  ### Execution discipline (added v0.18.1)
173
193
 
174
- For each of the 11 drift checks (P1–P11), if you declare PASS, **include the literal command output** (or its absence — explicit "no rows matched", "extracted: feature/foo", "FROZEN_COUNT=0") as evidence in your report. A bare "PASS" without supporting output is treated as **NOT EXECUTED** by the auditor — re-run with output captured.
194
+ For each of the 12 drift checks (P1–P12), if you declare PASS, **include the literal command output** (or its absence — explicit "no rows matched", "extracted: feature/foo", "FROZEN_COUNT=0") as evidence in your report. A bare "PASS" without supporting output is treated as **NOT EXECUTED** by the auditor — re-run with output captured.
175
195
 
176
196
  Recommended pattern:
177
197
 
@@ -208,7 +228,7 @@ Report two tables — one for **structural (blocking)** compliance, one for **dr
208
228
 
209
229
  **STRUCTURAL: READY FOR MERGE** (or **STRUCTURAL: NEEDS FIX — N blockers**)
210
230
 
211
- ### Drift (12-22) — advisory, refresh before user authorization
231
+ ### Drift (12-23) — advisory, refresh before user authorization
212
232
 
213
233
  | # | Pattern | Status | Detail |
214
234
  |---|---------|:------:|--------|
@@ -223,6 +243,7 @@ Report two tables — one for **structural (blocking)** compliance, one for **dr
223
243
  | 20 | P9 Tracker header stale | PASS | header = detail |
224
244
  | 21 | P10 Duplicate log rows | PASS | no duplicates |
225
245
  | 22 | P11 Tracker status mismatch | PASS | status consistent |
246
+ | 23 | P12 Tracker HEAD reference | PASS | tracker HEAD = git HEAD |
226
247
 
227
248
  **DRIFT: CLEAN** (or **DRIFT: N advisories — refresh before merge**)
228
249
 
@@ -254,6 +275,7 @@ Fix them directly:
254
275
  - **P9** → refresh `**Last Updated:**` step reference
255
276
  - **P10** → remove duplicate rows
256
277
  - **P11** → sync tracker Features row status to ticket header Status
278
+ - **P12 (Tracker HEAD reference stale)** → update `**Last Updated:**` and `**Active Feature:**` `HEAD: <sha>` tokens to match `git rev-parse HEAD`. Use `git rev-parse --short HEAD` for the 7-char form.
257
279
 
258
280
  After fixing, re-run the audit to confirm all checks pass.
259
281