@jakkrichm/create-nexus-devflow 2.16.4 → 2.17.0

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.
Files changed (92) hide show
  1. package/dist/bin/create-nexus-devflow.d.ts +1 -1
  2. package/dist/bin/create-nexus-devflow.js +41 -2
  3. package/dist/bin/create-nexus-devflow.js.map +1 -1
  4. package/dist/lib/project-status-engine.d.ts +11 -3
  5. package/dist/lib/project-status-engine.js +99 -17
  6. package/dist/lib/project-status-engine.js.map +1 -1
  7. package/dist/lib/review.d.ts +1 -0
  8. package/dist/lib/review.js +58 -3
  9. package/dist/lib/review.js.map +1 -1
  10. package/dist/lib/skill-registry-engine.js +1 -1
  11. package/dist/lib/skill-registry-engine.js.map +1 -1
  12. package/dist/lib/status.d.ts +3 -3
  13. package/dist/lib/status.js +2 -2
  14. package/dist/lib/status.js.map +1 -1
  15. package/dist/lib/tooling/commands/migrate-structure.d.ts +8 -0
  16. package/dist/lib/tooling/commands/migrate-structure.js +197 -0
  17. package/dist/lib/tooling/commands/migrate-structure.js.map +1 -0
  18. package/dist/lib/tooling/commands/summarize-run-status.js +3 -1
  19. package/dist/lib/tooling/commands/summarize-run-status.js.map +1 -1
  20. package/dist/lib/tooling/registry.js +2 -0
  21. package/dist/lib/tooling/registry.js.map +1 -1
  22. package/dist/lib/update.d.ts +29 -3
  23. package/dist/lib/update.js +76 -0
  24. package/dist/lib/update.js.map +1 -1
  25. package/dist/lib/workspace-paths.d.ts +15 -0
  26. package/dist/lib/workspace-paths.js +61 -0
  27. package/dist/lib/workspace-paths.js.map +1 -0
  28. package/dist/scripts/prepare-template.js +75 -15
  29. package/dist/scripts/prepare-template.js.map +1 -1
  30. package/package.json +1 -1
  31. package/template/.agents/skills/analyze/SKILL.md +21 -21
  32. package/template/.agents/skills/audit/SKILL.md +36 -18
  33. package/template/.agents/skills/audit/reference/independent-review.md +58 -2
  34. package/template/.agents/skills/brainstorm/SKILL.md +1 -1
  35. package/template/.agents/skills/complete/SKILL.md +23 -1
  36. package/template/.agents/skills/complete/reference/completion-recovery.md +248 -0
  37. package/template/.agents/skills/continuous/SKILL.md +156 -82
  38. package/template/.agents/skills/feature/SKILL.md +6 -0
  39. package/template/.agents/skills/feature/reference/build-history.md +79 -0
  40. package/template/.agents/skills/idea/SKILL.md +14 -14
  41. package/template/.agents/skills/rollback/SKILL.md +23 -10
  42. package/template/.claude/skills/analyze/SKILL.md +21 -21
  43. package/template/.claude/skills/audit/SKILL.md +33 -16
  44. package/template/.claude/skills/audit/reference/independent-review.md +58 -2
  45. package/template/.claude/skills/brainstorm/SKILL.md +1 -1
  46. package/template/.claude/skills/complete/SKILL.md +23 -1
  47. package/template/.claude/skills/complete/reference/completion-recovery.md +248 -0
  48. package/template/.claude/skills/continuous/SKILL.md +156 -82
  49. package/template/.claude/skills/feature/SKILL.md +6 -0
  50. package/template/.claude/skills/feature/reference/build-history.md +79 -0
  51. package/template/.claude/skills/idea/SKILL.md +14 -14
  52. package/template/.claude/skills/rollback/SKILL.md +23 -10
  53. package/template/AGENTS.md +11 -10
  54. package/template/devflow/{context → 00-context}/ai-interaction.md +1 -1
  55. package/template/devflow/{build-plan.md → 30-planning/build-plan.md} +24 -0
  56. package/template/devflow/40-tasks/.gitkeep +0 -0
  57. package/template/devflow/40-tasks/README.md +11 -0
  58. package/template/devflow/60-docs/migration-guide-decade-numbered.md +93 -0
  59. /package/template/devflow/{context → 00-context}/coding-standards.md +0 -0
  60. /package/template/devflow/{context → 00-context}/glossary.md +0 -0
  61. /package/template/devflow/{context → 00-context}/project-overview.md +0 -0
  62. /package/template/devflow/{ideas.md → 10-ideation/ideas.md} +0 -0
  63. /package/template/devflow/{reference → 10-ideation/reference}/build-plan-template.md +0 -0
  64. /package/template/devflow/{reference → 10-ideation/reference}/feature-spec-template.md +0 -0
  65. /package/template/devflow/{reference → 10-ideation/reference}/mockup.html +0 -0
  66. /package/template/devflow/{reference → 10-ideation/reference}/project-overview-template.md +0 -0
  67. /package/template/devflow/{reference → 10-ideation/reference}/project-plan-template.md +0 -0
  68. /package/template/devflow/{reference → 10-ideation/reference}/running-id-contract.md +0 -0
  69. /package/template/devflow/{decisions → 20-discovery/decisions}/.gitkeep +0 -0
  70. /package/template/devflow/{decisions → 20-discovery/decisions}/README.md +0 -0
  71. /package/template/devflow/{discoveries → 20-discovery/discoveries}/.gitkeep +0 -0
  72. /package/template/devflow/{project-plan.md → 30-planning/project-plan.md} +0 -0
  73. /package/template/devflow/{history → 50-history}/HISTORY.md +0 -0
  74. /package/template/devflow/{history → 50-history}/features/README.md +0 -0
  75. /package/template/devflow/{history → 50-history}/fixes/README.md +0 -0
  76. /package/template/devflow/{history → 50-history}/rollbacks/README.md +0 -0
  77. /package/template/devflow/{docs → 60-docs}/USAGE.md +0 -0
  78. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-architecture.html +0 -0
  79. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-architecture.json +0 -0
  80. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-lifecycle.html +0 -0
  81. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-lifecycle.json +0 -0
  82. /package/template/devflow/{docs → 60-docs}/examples/living-spec/adr.example.md +0 -0
  83. /package/template/devflow/{docs → 60-docs}/examples/living-spec/current-feature.example.md +0 -0
  84. /package/template/devflow/{docs → 60-docs}/examples/living-spec/discovery.example.md +0 -0
  85. /package/template/devflow/{docs → 60-docs}/examples/living-spec/ideas.example.md +0 -0
  86. /package/template/devflow/{docs → 60-docs}/governance-rules.md +0 -0
  87. /package/template/devflow/{docs → 60-docs}/manual-review-workflow-spec.md +0 -0
  88. /package/template/devflow/{docs → 60-docs}/markdown-metadata-contract.md +0 -0
  89. /package/template/devflow/{docs → 60-docs}/quickstart.md +0 -0
  90. /package/template/devflow/{docs → 60-docs}/release-process.md +0 -0
  91. /package/template/devflow/{docs → 60-docs}/skill-selection-policy.md +0 -0
  92. /package/template/devflow/{docs → 60-docs}/workflow-surface-map.md +0 -0
@@ -0,0 +1,79 @@
1
+ # Build history identity
2
+
3
+ Read metadata from the archived original spec, not appended findings or review.
4
+ Read the feature ID from its `**From build-plan:**` or supported legacy
5
+ feature field, not its title or filename. Normalize the numeric part by removing
6
+ leading zeros and the optional letter to lowercase (`012A` becomes `12a`). Match
7
+ that complete ID, never a substring. Use the archived spec's positive integer
8
+ `**Build attempt:**`; duplicate or malformed fields stop selection. A legacy
9
+ first-build archive without it counts as attempt 1 only when its spec identity
10
+ and unsuffixed `NN-name.md` path agree unambiguously. Derive the expected name
11
+ from its own spec, not today's renamed plan title. Text such as `Build 2` in a
12
+ title proves no attempt.
13
+ For new paths, pad the numeric part to at least two digits, keep its letter, and
14
+ use the spec title's lowercase kebab-case slug. Append `--build-N` only for N > 1.
15
+ An archive declaring an attempt must agree with that computed path.
16
+ The double hyphen is reserved: slug normalization collapses punctuation runs to
17
+ one hyphen, so a first build titled `Export Build 2` uses `04-export-build-2.md`,
18
+ while a later attempt 2 titled `Export` uses `04-export--build-2.md`.
19
+
20
+ Before freezing a new spec, check its exact planned archive path in `devflow/history/features/` and branch.
21
+ Require `lstat` to return `ENOENT` for the archive leaf; any existing entry,
22
+ including a dangling symlink, blocks it. Present parents must be ordinary
23
+ directories. Require a valid branch name and no existing or namespace-conflicting
24
+ local branch ref (inspect `git for-each-ref refs/heads/`, including packed refs).
25
+ Also require no prior use of the archive path in available Git history:
26
+
27
+ ```bash
28
+ git log --all --reflog --full-history --format=%H -- <planned-archive-path>
29
+ ```
30
+
31
+ Any result or inspection failure stops before spec review with the exact collision.
32
+ Do not auto-bump the attempt or rename reviewed work to avoid it. These checks
33
+ apply to new specs; existing completion must run its recovery routing first so
34
+ its own archive is reconciled rather than rejected. Preserve already-reviewed
35
+ legacy spec bytes, branch, and any proven recovery destination.
36
+
37
+ A legacy rebuild can preserve a reviewed spec without this field. Its completion
38
+ annotation must freeze the original `baseCommit`: resolve only prior builds and
39
+ their completed reversals present at that base, derive `max(attempts) + 1`, and
40
+ require the exact resulting archive path. For an integrated archive, its unique
41
+ introducing commit's sole parent must equal that base. For unfinished completion,
42
+ use Complete's phase proof. The path checks this derived attempt; it never supplies
43
+ the number. Missing or ambiguous proof stops without rewriting the archived spec.
44
+ Settled history numbering and rollback selection do not require the annotation's
45
+ historical `head` or `sourceTree`; actual completion recovery still requires them.
46
+
47
+ Before using prior builds or reversals, prove each selected record on the local
48
+ default branch. Resolve the unique introducing commit with:
49
+
50
+ ```bash
51
+ git log --full-history --diff-filter=A --format=%H <local-default> -- <archive-path>
52
+ git log --full-history --format=%H <introducing-commit>..<local-default> -- <archive-path>
53
+ ```
54
+
55
+ The first result must contain exactly one commit which actually adds the path;
56
+ the second must be empty. Confirm the current blob and mode equal that addition
57
+ (use Git's normal EOL normalization for a working-file comparison). Inspect the
58
+ record at that commit, not an uncommitted replacement. Reject orphan, overwritten,
59
+ deleted/re-added, renamed, multiply-added, or conflicting records. Never choose
60
+ the newest commit, file count, or timestamp to resolve ambiguity.
61
+
62
+ A build is reversed only by a completed `**Type:** Rollback` record in `devflow/history/rollbacks/` with its exact
63
+ `**Target archive:**` and full `**Target commit:**`, matching feature ID, verified
64
+ or complete status and finished steps. Its `Target parent` must match the target's
65
+ sole parent. Prove that rollback record's unique unchanged addition
66
+ by the same procedure, reachable on the local default after the target build.
67
+ Require a non-merge rollback commit containing that record and its completed
68
+ plan bookkeeping. Uncommitted, malformed, changed, or merely rollback-looking
69
+ files are not completed reversals. Conflicting or duplicate reversals stop.
70
+
71
+ Include exact rollback references retained on the selected plan line; missing
72
+ referenced records are a blocker, not an empty history. For a new unchecked feature,
73
+ use 1 when there are no prior records; otherwise
74
+ require every prior build to have one proven completed reversal and allocate
75
+ `max(attempts) + 1`. Duplicate attempts or inconsistent/missing history stop with
76
+ the exact paths and missing proof. Search only this feature's records and their
77
+ exact reversal references. Ignored local-only history without introducing-commit
78
+ proof cannot establish a rebuild or rollback target; stop without force-adding or
79
+ migrating it. Ordinary first builds do not require prior history.
@@ -26,32 +26,32 @@ When invoked:
26
26
  3. Allocate the next sequential ID (e.g. `IDEA-001`, `IDEA-002`).
27
27
 
28
28
  ### 2. AI Feasibility & Value Analysis
29
- Evaluate the user's raw idea and generate an enriched summary in **Thai (`th`)**:
30
- - **ไอเดียตั้งต้น (Raw Idea)**: ข้อความที่ผู้ใช้ระบุ
31
- - **AI Feasibility & Tech**: ประเมินความเป็นไปได้ (ง่าย / ปานกลาง / ซับซ้อน) พร้อมแนะนำ Library, API, หรือแนวทางเทคนิคเบื้องต้น
32
- - **Value & Potential**: คุณค่า ประโยชน์ และความน่าสนใจของฟีเจอร์นี้
33
- - **Quick Seed (สรุปประเด็นกันลืม)**: 2-3 ประเด็นทางเทคนิคหรือแนวทางการต่อยอด เพื่อให้กลับมาอ่านทีหลังแล้วจำบริบทได้ทันที
29
+ Evaluate the user's raw idea and generate an enriched entry in Thai (`th` per user communication rules):
30
+ - **Raw Idea**: The user's input description
31
+ - **AI Feasibility & Tech**: Feasibility rating (Easy / Medium / Complex) along with recommended libraries, APIs, or architectural approaches
32
+ - **Value & Potential**: Business value, user benefits, and strategic impact
33
+ - **Quick Seed**: 2-3 key technical nuances or seed points to preserve context for later pickup
34
34
 
35
35
  ### 3. Append to `devflow/ideas.md`
36
36
  Insert the new idea block directly under `## 📌 Pending Ideas` in `devflow/ideas.md`:
37
37
 
38
38
  ```markdown
39
- ### [IDEA-001] {หัวข้อไอเดียสั้นๆ}
39
+ ### [IDEA-001] {Brief idea title}
40
40
  - **บันทึกเมื่อ**: {YYYY-MM-DD}
41
- - **ไอเดียตั้งต้น**: {ข้อความที่ผู้ใช้ป้อน}
42
- - **AI Feasibility & Tech**: {บทวิเคราะห์ความเป็นไปได้และเครื่องมือ}
43
- - **Value & Potential**: {บทวิเคราะห์คุณค่าและความน่าสนใจ}
41
+ - **ไอเดียตั้งต้น**: {User's raw idea text}
42
+ - **AI Feasibility & Tech**: {Feasibility and tooling analysis}
43
+ - **Value & Potential**: {Value and impact analysis}
44
44
  - **Quick Seed (กันลืม)**:
45
- 1. {ประเด็นสำคัญที่ 1}
46
- 2. {ประเด็นสำคัญที่ 2}
47
- - **สถานะ**: `Pending` (หยิบไปทำได้ด้วย `/feature IDEA-001` หรือ `/discovery IDEA-001`)
45
+ 1. {Key point 1}
46
+ 2. {Key point 2}
47
+ - **สถานะ**: `Pending` (Ready for pickup via `/feature IDEA-001` or `/discovery IDEA-001`)
48
48
  ```
49
49
 
50
- *(หากมีข้อความ `*(ยังไม่มีไอเดียค้างอยู่...)*` ให้ลบออกเมื่อมีไอเดียแรก)*
50
+ *(If placeholder `*(ยังไม่มีไอเดียค้างอยู่...)*` exists, remove it upon recording the first idea)*
51
51
 
52
52
  ### 4. Output Summary
53
53
  Report to the user:
54
54
  - Allocated Idea ID: `[IDEA-xxx]`
55
55
  - Summary of Feasibility & Value analysis
56
56
  - Seed points saved
57
- - Instructions for promotion: "เมื่อพร้อมลงมือทำ สามารถพิมพ์ `/feature IDEA-xxx` หรือ `/discovery IDEA-xxx` ได้ทันที"
57
+ - Instructions for promotion: "Ready to implement? Run `/feature IDEA-xxx` or `/discovery IDEA-xxx` anytime."
@@ -53,16 +53,23 @@ skill.
53
53
 
54
54
  ## Step 1 - resolve the exact feature
55
55
 
56
- Match the requested number or name against both the checked build-plan items and
57
- `devflow/history/features/*.md`. Exclude the directory README.
58
-
59
- Use the archive path to locate the commit that added it:
60
-
61
- git log --diff-filter=A --format="%H %s" HEAD -- <archive-path>
62
-
63
- Use the newest matching commit reachable from the current branch. Confirm the
64
- archive was added by that commit and its subject and diff are consistent with the
65
- requested feature. If the target is a merge commit, stop before Step 2 and before
56
+ Resolve the requested number or name to one checked build-plan ID; for an archive
57
+ path, read its exact spec identity first and match that checked item. Then gather
58
+ all exact-ID feature archive candidates using `../feature/reference/build-history.md`.
59
+ Normalize the stable ID, retaining its letter, and read attempts from verified
60
+ spec metadata/history proof, never arbitrary title or filename suffixes.
61
+
62
+ For each candidate, require its unique introducing commit on the local default
63
+ and prove the archive blob and mode have not changed since that addition. Exclude
64
+ builds with a proven completed reachable rollback naming that exact archive and
65
+ introducing commit. The checked item must have exactly one unreversed build.
66
+ An explicit archive request stays bound to that exact path: reject it if already
67
+ reversed, rather than silently choosing another build. Ambiguous, orphan,
68
+ overwritten, multiply-added, or missing records stop with their exact paths and
69
+ missing proof. Do not select by newest commit, filename order, or rollback date.
70
+
71
+ Confirm the selected commit's diff is consistent with the requested feature.
72
+ If the target is a merge commit, stop before Step 2 and before
66
73
  writing or changing `devflow/context/{xxx-slug}/spec.md`. Do not record a
67
74
  target parent or choose a mainline. Publish `blocked` to
68
75
  `devflow/.state/run.json`, explain that DevFlow cannot safely infer which
@@ -129,6 +136,12 @@ Allocate sequential ID (`xxx-slug`) and create `devflow/context/{xxx-slug}/`. Wr
129
136
  - compatibility work that is allowed, if any
130
137
  - exact verification commands and observable removal criteria
131
138
 
139
+ Before freezing a new rollback spec, apply the archive-path and branch-availability
140
+ checks in `../feature/reference/build-history.md` to its planned branch and
141
+ `YYYY-MM-DD-<exact-target-archive-stem>.md` destination. Retain `--build-N` in the
142
+ target stem when present. A collision stops for an explicit decision; never
143
+ renumber the target or silently rename reviewed work. Existing completion recovery runs first.
144
+
132
145
  The first build step must apply the target commit's product diff in reverse using
133
146
  the guarded Type: Rollback behavior in `/implement`. Later steps may repair only
134
147
  the specific downstream compatibility issues named in the spec. Do not use a
@@ -21,10 +21,10 @@ contract in `AGENTS.md`.
21
21
  ```text
22
22
  # 1. Ingest specific file from any path (PDF, DOCX, XLSX, Image, CSV, Text)
23
23
  /analyze C:\Users\...\Downloads\customer-spec.pdf
24
- /analyze ./mockup.png ./schema.xlsx "ระบบสะสมแต้มสมาชิก"
24
+ /analyze ./mockup.png ./schema.xlsx "Loyalty point system"
25
25
 
26
26
  # 2. Ingest raw text or requirement from chat
27
- /analyze "ลูกค้าต้องการระบบผ่อนชำระ 0% เชื่อมกับ KBank Payment Gateway..."
27
+ /analyze "Customer requested 0% installment plan connected to KBank Payment Gateway..."
28
28
 
29
29
  # 3. Scan pending unassigned files in devflow/inbox/
30
30
  /analyze
@@ -46,50 +46,50 @@ contract in `AGENTS.md`.
46
46
 
47
47
  ---
48
48
 
49
- ### Step 1: Auto-Allocate Workspace & Ingestion (Frictionless Ingest)
49
+ ## Step 1: Auto-Allocate Workspace & Ingestion (Frictionless Ingest)
50
50
  1. **Allocate REQ-ID**: Generate sequential ID format `REQ-YYYYMMDD-NNN` (e.g. `REQ-20260903-001-point-system`).
51
51
  2. **Create Request Workspace**:
52
52
  ```text
53
53
  devflow/inbox/{REQ-ID}/
54
- ├── raw/ # เก็บไฟล์ต้นฉบับ (PDF, Word, Excel, Images, Email)
55
- ├── parsed.md # ข้อความ/ตารางที่สกัดออกมาแล้ว (Clean Markdown)
56
- └── clarifications.md # รายการคำถามที่ต้องไปถาม Stakeholder เพิ่ม
54
+ ├── raw/ # Original source files (PDF, Word, Excel, Images, Email)
55
+ ├── parsed.md # Extracted structured text/tables (Clean Markdown)
56
+ └── clarifications.md # Questions and clarifications checklist for stakeholders
57
57
  ```
58
58
  3. Copy or save incoming files into `devflow/inbox/{REQ-ID}/raw/`.
59
59
 
60
60
  ---
61
61
 
62
- ### Step 2: Parse & Normalize Requirement (`parsed.md`)
62
+ ## Step 2: Parse & Normalize Requirement (`parsed.md`)
63
63
  1. Extract text and tables from all raw files:
64
64
  - For Office/PDF docs: Invoke `convert-any-to-md` or document extractor.
65
65
  - For Web URLs / Confluence / Notion: Invoke `defuddle`.
66
66
  - For Images / Wireframes / Screenshots: Conduct Multimodal Vision OCR and describe layout and fields.
67
67
  2. Structure into `devflow/inbox/{REQ-ID}/parsed.md`:
68
- - **Executive Summary**: วัตถุประสงค์หลักของ Requirement
69
- - **Target Persona & User Stories**: ใครทำอะไร เพื่ออะไร
70
- - **Functional Requirements (FR)**: รายการฟังก์ชันและ Business Rules
71
- - **Non-Functional Requirements (NFR)**: Performance, Security, PDPA, Retention
72
- - **Data Entities & Fields**: ฟิลด์ข้อมูลและชนิดข้อมูลเบื้องต้น
68
+ - **Executive Summary**: Core purpose and business objective of the requirement
69
+ - **Target Persona & User Stories**: Who performs what action and why
70
+ - **Functional Requirements (FR)**: List of functions and business rules
71
+ - **Non-Functional Requirements (NFR)**: Performance, Security, PDPA/Privacy, Data Retention
72
+ - **Data Entities & Fields**: Data fields, schemas, and initial types
73
73
 
74
74
  ---
75
75
 
76
- ### Step 3: Codebase Impact & Blast Radius Analysis (`codebase-impact.md`)
77
- *(ดำเนินการเมื่อเป็นระบบเดิม / Brownfield Codebase)*
76
+ ## Step 3: Codebase Impact & Blast Radius Analysis (`codebase-impact.md`)
77
+ *(Execute when operating on an existing system / brownfield codebase)*
78
78
 
79
79
  1. Search codebase patterns using `grep_search`, `rg`, and AST analysis for affected models, controllers, APIs, and routes.
80
80
  2. Calculate **Blast Radius & Complexity Score**:
81
- - **Affected Files & Modules**: รายการไฟล์ที่ต้องแก้ไขหรือสร้างใหม่
82
- - **API & Contract Breaking Risk**: ตรวจสอบว่ากระทบกับ API เดิมหรือ Third-Party หรือไม่
83
- - **Complexity Rating**: `Low` | `Medium` | `High` | `Extreme` พร้อมเหตุผล
81
+ - **Affected Files & Modules**: List of files to be modified or newly created
82
+ - **API & Contract Breaking Risk**: Check if existing APIs or third-party contracts are impacted
83
+ - **Complexity Rating**: `Low` | `Medium` | `High` | `Extreme` with rationale
84
84
  3. Save analysis report to `devflow/analysis/{REQ-ID}/codebase-impact.md`.
85
85
 
86
86
  ---
87
87
 
88
- ### Step 4: Socratic Gap Detection & Clarification Checklist (`clarifications.md`)
88
+ ## Step 4: Socratic Gap Detection & Clarification Checklist (`clarifications.md`)
89
89
  1. Apply `grilling` and `domain-modeling` lenses to detect gaps:
90
- - **Missing Edge Cases**: เงื่อนไขขอบ, กรณีข้อมูลผิดพลาด, เน็ตหลุด, Concurrent Requests
91
- - **Ambiguous Business Rules**: กฎที่ยังคลุมเครือ ไม่ระบุ SLA หรือขั้นตอนที่ชัดเจน
92
- - **Security & Authorization**: การกำหนด Role, สิทธิ์การเข้าถึงข้อมูล, ข้อมูลส่วนบุคคล (PII)
90
+ - **Missing Edge Cases**: Boundary conditions, error states, network drops, concurrent requests
91
+ - **Ambiguous Business Rules**: Unclear policies, unspecified SLAs, or undefined workflows
92
+ - **Security & Authorization**: Role definitions, access permissions, personal identifiable data (PII)
93
93
  2. Generate an actionable checklist in `devflow/inbox/{REQ-ID}/clarifications.md` for the SA to take directly into stakeholder meetings.
94
94
 
95
95
  ---
@@ -110,14 +110,22 @@ the fresh-session handoff; Phase B must omit `Actual execution` so the legacy
110
110
  request and receipt keep both execution fields absent.
111
111
 
112
112
  1. Require an active spec with every build step checked and status `verified`, a
113
- non-default work branch, a reliable merge base, and a clean working tree.
113
+ non-default work branch, a reliable merge base, and a working tree matching
114
+ the target except existing `devflow/context/{xxx-slug}/review.md` and
115
+ `devflow/context/{xxx-slug}/findings.md` evidence.
114
116
  Independent mode accepts only a locally recorded remote default branch,
115
117
  local `main`, or local `master` as its enforceable base ref. Stop when none
116
118
  reliably covers the active work.
117
- The current full `HEAD` must be the approved review checkpoint, including the
118
- verified spec. Never create that commit inside Audit. If work is dirty, stop
119
- and ask the user to approve a review checkpoint through `/implement`, even
120
- when normal checkpoint commits are disabled.
119
+ The current full `HEAD` must be the approved application-code checkpoint.
120
+ Include the verified spec when tracked; for a new ignored-spec request, prepare
121
+ the exact local `Spec snapshot` under the reference contract. Never force-add
122
+ it or change ignore visibility. Never create a commit inside Audit. If any
123
+ tracked, staged, unstaged, or untracked path other than those two evidence
124
+ paths differs from the target, stop and ask the user to approve a review
125
+ checkpoint through `/implement`, even when normal checkpoint commits are
126
+ disabled. Do not create a checkpoint solely for review/findings changes.
127
+ This normal Phase A exception never allows snapshot Git differences or
128
+ overwriting conflicting completion-recovery evidence.
121
129
  2. Read installed adapters from `.nexus/nexus-devflow.json` or manifest when valid.
122
130
  Detect `.agents/skills` as `antigravity`/`codex`/`copilot` and `.claude/skills`
123
131
  as `claude`.
@@ -139,26 +147,30 @@ request and receipt keep both execution fields absent.
139
147
  used to calculate it, exact spec SHA-256, current adapter and model,
140
148
  requested reviewer adapter and model, requested execution from
141
149
  `review.independentExecution`, workflow, and
142
- whether the configured Check gate is required. Write the pending template
143
- into `devflow/context/{xxx-slug}/review.md`.
150
+ whether the configured Check gate is required. For a new ignored-spec request,
151
+ create or reuse the exact snapshot first and record `Spec snapshot` as defined
152
+ in the reference. Never add that field to an existing pending or completed
153
+ record. Write the pending template into `devflow/context/{xxx-slug}/review.md`.
144
154
  5. Execute the configured path:
145
155
  - For `manual`, set dashboard activity to `ready` and give the exact handoff
146
156
  command for the selected adapter. Claude Code uses
147
157
  `/audit independent current`; Google Antigravity uses
148
158
  `/audit independent current`; Codex uses `$audit independent current`;
149
159
  Copilot and OpenCode receive the equivalent plain-language instruction.
150
- Tell the user to open a fresh session with only the handoff, not the builder
151
- chat.
160
+ Tell the user to open a fresh session in the original checkout with only the
161
+ handoff, not the builder chat. Include target/base SHAs and, when present,
162
+ the exact snapshot path and spec hash.
152
163
  - For `automatic`, freeze all parent product, test, spec, and config changes.
153
164
  Start one generic isolated child without the builder transcript. Instruct
154
165
  it to read the project-local Audit skill and
155
166
  `reference/independent-review.md` from the current adapter tree, then
156
- execute Phase B against the prepared request. All review instructions come
157
- from that installed DevFlow project. The reviewer may write only
158
- `devflow/context/{xxx-slug}/findings.md` and `devflow/context/{xxx-slug}/review.md`; it must
159
- not repair code, change the spec, commit, or perform external actions. Wait
160
- for completion, then reread and validate the normal receipt before
161
- continuing. Record `fresh subagent` as its reviewer context.
167
+ execute Phase B using the same local spec/snapshot inputs against the
168
+ prepared request. All review instructions come from that installed DevFlow
169
+ project. The reviewer may write only `devflow/context/{xxx-slug}/findings.md`
170
+ and `devflow/context/{xxx-slug}/review.md`; it must not repair code, change
171
+ the spec, commit, or perform external actions. Wait for completion, then
172
+ reread and validate the normal receipt before continuing. Record `fresh subagent`
173
+ as its reviewer context.
162
174
 
163
175
  If automatic execution fails or any required property becomes uncertain, keep
164
176
  the pending request intact, set activity to `ready`, and stop with the existing
@@ -177,7 +189,9 @@ Use this phase when a current pending request exists in `devflow/context/{xxx-sl
177
189
  `HEAD` matches `Target commit`, the recorded base ref still produces the
178
190
  recorded merge base, the exact spec hash matches, and no path differs from
179
191
  the target except `devflow/context/{xxx-slug}/review.md` and
180
- `devflow/context/{xxx-slug}/findings.md`. Stop on any mismatch or stale state.
192
+ `devflow/context/{xxx-slug}/findings.md`. When `Spec snapshot` is present, verify
193
+ both raw spec/snapshot hashes and every path, visibility, and Git condition in
194
+ the reference. Stop on any mismatch or stale state.
181
195
  2. Proceed only from the fresh reviewer handoff. Record `fresh session` for a
182
196
  manual reviewer or `fresh subagent` for an automatic isolated reviewer. This
183
197
  is a declaration, never cryptographic proof. If the reviewer has the builder
@@ -206,6 +220,9 @@ Use this phase when a current pending request exists in `devflow/context/{xxx-sl
206
220
  After changes are requested, the builder repairs through `/implement`, obtains
207
221
  approval for a new checkpoint, and prepares a new request. The next reviewer
208
222
  pass reviews the complete new delta, not only the old findings.
223
+ A local-spec-only revision may reuse the same approved product HEAD after normal
224
+ spec and verification gates, with a new snapshot/request and full fresh review;
225
+ it never requires an empty commit.
209
226
 
210
227
  ## Step 1 - gather context
211
228
 
@@ -68,6 +68,56 @@ work branch, and `Base commit` cannot equal `Target commit`. If none of those
68
68
  base refs reliably covers the active work, stop instead of creating a receipt
69
69
  whose review range cannot be re-derived.
70
70
 
71
+ ## Local spec snapshot
72
+
73
+ For a new request whose verified spec is intentionally ignored, keep application
74
+ code in the approved checkpoint and freeze the spec outside Git. Add exactly one
75
+ field after `Spec hash`, using a plain path with no backticks:
76
+
77
+ ```markdown
78
+ **Spec snapshot:** devflow/.state/review-specs/<Target commit>-<Spec hash>.md
79
+ ```
80
+
81
+ Substitute the request's full lowercase target SHA and lowercase spec hash. This
82
+ is the only permitted snapshot path; duplicate fields or another path are
83
+ malformed. Tracked-spec requests do not need this field. Existing requests and
84
+ receipts without it retain their previous hash, freshness, and execution rules.
85
+ Never retroactively add `Spec snapshot` to a pending or completed record.
86
+
87
+ Phase A prepares the copy before publishing a new pending request:
88
+
89
+ 1. Read the verified active spec as raw bytes and calculate its SHA-256 without
90
+ decoding, trimming, or normalizing line endings. Use that digest as `Spec hash`.
91
+ 2. Use `lstat` on the selected project root and every directory below it leading
92
+ to the spec and snapshot. Require ordinary directories, a regular spec file,
93
+ and a regular file for any existing snapshot. Reject symbolic links, including
94
+ dangling links. Ancestor aliases above the selected root are not inspected.
95
+ Create missing snapshot directories only beneath verified ordinary parents;
96
+ a missing snapshot leaf is allowed only for exclusive creation below them.
97
+ 3. Require both paths to be ignored and untracked, absent from the index and
98
+ `Target commit`. Check ignore status separately for each path, require no
99
+ entries from `git ls-files --stage -- <spec-path> <snapshot-path>` or
100
+ `git ls-tree -r --name-only <target> -- <spec-path> <snapshot-path>`, and
101
+ distinguish expected absence from Git failure. Never force-add files or
102
+ change ignore visibility to make these checks pass.
103
+ 4. Create the snapshot exclusively, for example with Node's `fs.open` using
104
+ `wx`, then write the raw byte buffer and close the handle. If it already
105
+ exists, reuse only an ordinary file whose bytes exactly match the spec.
106
+ Conflicting bytes, unsafe paths, or a failed write stop preparation; never
107
+ overwrite or repair the existing snapshot in place.
108
+ 5. Read both files back and require identical raw bytes and the recorded hash.
109
+ Recheck their path and Git conditions before writing the request. Keep the
110
+ snapshot unchanged through review and completion; do not automatically delete
111
+ or regenerate it to make an existing receipt pass.
112
+
113
+ The target/base fields bind application code; `Spec hash` binds both local files.
114
+ The snapshot is an input, never another allowed dirty Git path. Manual handoff
115
+ names the original checkout, target/base SHAs, snapshot path, and hash. An
116
+ automatic child must be able to read those same ignored inputs and installed
117
+ project-local skills. If that access cannot be confirmed, retain the request and
118
+ use the manual fresh-session handoff in the original checkout. Do not copy local
119
+ inputs externally or substitute a clone/worktree that lacks them.
120
+
71
121
  ## Completed receipt
72
122
 
73
123
  Keep the request fields unchanged and replace `pending` with `passed` or
@@ -131,6 +181,9 @@ A receipt is current only when all of these hold:
131
181
  equals `Base commit`, and it remains a locally recorded remote default branch,
132
182
  local `main`, or local `master`.
133
183
  - The exact task spec bytes still match `Spec hash`.
184
+ - When `Spec snapshot` is present, both raw files match that hash and every
185
+ snapshot path, visibility, and Git condition above still holds. Missing or
186
+ changed snapshot inputs make the record stale; Git failure never passes.
134
187
  - No tracked, staged, unstaged, or untracked path differs from the target except
135
188
  `devflow/context/{xxx-slug}/review.md` and `devflow/context/{xxx-slug}/findings.md`.
136
189
  - The completed reviewer adapter matches `Requested reviewer`.
@@ -149,8 +202,11 @@ A receipt is current only when all of these hold:
149
202
  record the actual value.
150
203
 
151
204
  Any other code, test, configuration, spec, or acceptance-criteria change makes
152
- the receipt stale. A stale receipt never proves the new state. Prepare a new
153
- request against a new approved checkpoint and review the whole delta again.
205
+ the receipt stale. A stale receipt never proves the new state. Product changes
206
+ need a new approved checkpoint. A local-spec-only revision may reuse the same
207
+ approved product HEAD after normal spec and verification gates, with a new
208
+ snapshot, a new request, and a full fresh review. Never create an empty commit
209
+ just to capture ignored spec changes or edit a passed receipt into a new review.
154
210
 
155
211
  The adapter, model, and context fields are declared metadata. DevFlow proves
156
212
  the target and staleness, but it cannot cryptographically prove that a separate
@@ -37,7 +37,7 @@ Provide at least 2-3 materially distinct approaches:
37
37
  ### 3. Trade-off Comparison Matrix
38
38
  Construct a structured evaluation table:
39
39
 
40
- | Option | Pros (ข้อดี) | Cons (ข้อเสีย) | Effort & Complexity | Verdict / Status |
40
+ | Option | Pros | Cons | Effort & Complexity | Verdict / Status |
41
41
  | :--- | :--- | :--- | :--- | :--- |
42
42
  | **Option A** | ... | ... | Low / Med / High | ... |
43
43
  | **Option B** | ... | ... | Low / Med / High | **Recommended** |
@@ -33,6 +33,15 @@ passes.
33
33
  Read `devflow/config.json`. A missing file means the built-in defaults apply.
34
34
  If the file exists but is invalid, stop and point the user to `/doctor`.
35
35
 
36
+ Before requiring a real active spec, check for pending completion using
37
+ `reference/completion-recovery.md`. A matching archive may mean archival was
38
+ interrupted, the work commit awaits merge, or the merge already finished. Follow
39
+ that phase instead of restarting logging. Missing or ambiguous evidence stops
40
+ with concrete recovery steps; an archive or clean context never authorizes selecting new work.
41
+ Recovery uses archive and Git proof, never dashboard activity as authority.
42
+
43
+ For a normal completion with no recovery in progress, continue below.
44
+
36
45
  Confirm the target work is actually finished: `devflow/context/{xxx-slug}/spec.md`
37
46
  holds a real spec, its steps are built on a branch, and `Verify`, or the fallback
38
47
  build and tests, passes. If any of the
@@ -45,6 +54,7 @@ Read `devflow/context/{xxx-slug}/review.md` (or `devflow/context/review.md`) whe
45
54
  changes-requested, malformed, or stale record is always a blocker because the
46
55
  user already initiated that gate, even when its configured policy is `manual`.
47
56
 
57
+
48
58
  ## Configured regular quality gates
49
59
 
50
60
  Use `qualityGates.regular` for this work item:
@@ -103,6 +113,15 @@ evidence is missing.
103
113
 
104
114
  ## Step 1 - log the work
105
115
 
116
+ Follow `reference/completion-recovery.md` to capture the source tree and compact
117
+ archive annotation before any logging edits. Preserve the exact verified spec
118
+ prefix, its UTF-8 byte length and SHA-256, branch, original HEAD, and local base.
119
+ Record the reference's narrow `absentOptional` proof before creating any optional
120
+ findings/review stub on an older installation; tree absence alone is insufficient.
121
+ Prepare the entire archive, including the sections below and any generated try
122
+ guide, before placing it at its destination in `devflow/history/features/`, `fixes/`, or `rollbacks/`. An existing matching archive
123
+ enters recovery; never overwrite it or append duplicate sections.
124
+
106
125
  Check whether the spec is a feature, fix, or rollback. A fix is marked
107
126
  `Type: Fix` and has no build-plan number. A rollback is marked `Type: Rollback`
108
127
  and records the exact target feature, archive, commit, and parent.
@@ -122,11 +141,14 @@ delete the `prototypes/` folder now.
122
141
 
123
142
  ## Step 2 - make the work commit on feature branch
124
143
 
125
- Stage everything on the branch (any uncommitted step work plus the Step 1 logging
144
+ Show the complete product and logging diff with the proposed commit message,
145
+ then obtain explicit commit approval. Only then stage the reviewed branch work
146
+ (any uncommitted step work plus the Step 1 logging
126
147
  changes) and make one conventional work commit on the active branch (for example `feat: <feature>`,
127
148
  `fix: <name>`, or `revert: roll back <feature>`). `Verify`, or the fallback build
128
149
  and tests, must pass first.
129
150
 
151
+
130
152
  ## Step 3 - Mandatory Delivery Gate (Ask User First)
131
153
 
132
154
  > [!IMPORTANT]