@jakkrichm/create-nexus-devflow 2.2.1 → 2.5.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 (61) hide show
  1. package/dist/bin/create-nexus-devflow.js +9 -1
  2. package/dist/bin/create-nexus-devflow.js.map +1 -1
  3. package/dist/lib/command-catalog.js +1 -1
  4. package/dist/lib/command-catalog.js.map +1 -1
  5. package/dist/lib/dashboard-page.d.ts +1 -1
  6. package/dist/lib/dashboard-page.js +42 -20
  7. package/dist/lib/dashboard-page.js.map +1 -1
  8. package/dist/lib/dashboard-snapshot.js +16 -12
  9. package/dist/lib/dashboard-snapshot.js.map +1 -1
  10. package/dist/lib/dashboard.js +10 -1
  11. package/dist/lib/dashboard.js.map +1 -1
  12. package/dist/lib/doctor.js +1 -1
  13. package/dist/lib/gatekeeper.d.ts +8 -0
  14. package/dist/lib/gatekeeper.js +15 -3
  15. package/dist/lib/gatekeeper.js.map +1 -1
  16. package/dist/lib/git-status.d.ts +10 -2
  17. package/dist/lib/git-status.js +57 -29
  18. package/dist/lib/git-status.js.map +1 -1
  19. package/dist/lib/swarm-orchestrator.d.ts +4 -1
  20. package/dist/lib/swarm-orchestrator.js +2 -2
  21. package/dist/lib/swarm-orchestrator.js.map +1 -1
  22. package/dist/lib/version-check.js +1 -1
  23. package/dist/lib/workflow-state.js +19 -32
  24. package/dist/lib/workflow-state.js.map +1 -1
  25. package/package.json +1 -1
  26. package/template/.agents/skills/check/SKILL.md +19 -11
  27. package/template/.agents/skills/complete/SKILL.md +47 -36
  28. package/template/.agents/skills/debug/SKILL.md +4 -8
  29. package/template/.agents/skills/devflow/SKILL.md +51 -79
  30. package/template/.agents/skills/feature/SKILL.md +8 -4
  31. package/template/.agents/skills/implement/SKILL.md +12 -8
  32. package/template/.claude/skills/check/SKILL.md +19 -11
  33. package/template/.claude/skills/complete/SKILL.md +47 -36
  34. package/template/.claude/skills/debug/SKILL.md +4 -8
  35. package/template/.claude/skills/devflow/SKILL.md +51 -79
  36. package/template/.claude/skills/feature/SKILL.md +8 -4
  37. package/template/.claude/skills/implement/SKILL.md +12 -8
  38. package/template/AGENTS.md +21 -30
  39. package/template/devflow/build-plan.md +19 -0
  40. package/template/devflow/context/ai-interaction.md +54 -39
  41. package/template/devflow/context/coding-standards.md +17 -6
  42. package/template/devflow/context/findings.md +8 -11
  43. package/template/devflow/context/glossary.md +31 -0
  44. package/template/devflow/reference/build-plan-template.md +65 -0
  45. package/template/devflow/reference/feature-spec-template.md +110 -0
  46. package/template/devflow/reference/project-plan-template.md +128 -0
  47. package/template/devflow/reference/running-id-contract.md +12 -11
  48. package/template/.agents/skills/10-define/SKILL.md +0 -54
  49. package/template/.agents/skills/20-spec/SKILL.md +0 -155
  50. package/template/.agents/skills/30-plan/SKILL.md +0 -220
  51. package/template/.agents/skills/40-execute/SKILL.md +0 -161
  52. package/template/.agents/skills/50-verify/SKILL.md +0 -55
  53. package/template/.agents/skills/60-report/SKILL.md +0 -57
  54. package/template/.agents/skills/70-deliver/SKILL.md +0 -72
  55. package/template/.claude/skills/10-define/SKILL.md +0 -54
  56. package/template/.claude/skills/20-spec/SKILL.md +0 -155
  57. package/template/.claude/skills/30-plan/SKILL.md +0 -220
  58. package/template/.claude/skills/40-execute/SKILL.md +0 -161
  59. package/template/.claude/skills/50-verify/SKILL.md +0 -55
  60. package/template/.claude/skills/60-report/SKILL.md +0 -57
  61. package/template/.claude/skills/70-deliver/SKILL.md +0 -72
@@ -27,59 +27,74 @@ Format every response for fast scanning and readability:
27
27
 
28
28
  ---
29
29
 
30
- ## 3. Dual-Track Workflow Lifecycle (The 3-Pillars Model)
30
+ ## 3. The 3-Pillars Unified Architecture (DevFlow 2.5.0)
31
31
 
32
32
  ```text
33
33
  devflow/
34
- ├── 🔮 ideas.md # [Future] Idea Inbox
35
- ├── ⚡ context/ # [Present] Living Spec (current-feature.md) & Active State
34
+ ├── 🔮 ideas.md # [Future] Idea Inbox with AI Feasibility Scoring
35
+ ├── ⚡ context/ # [Present] Single Living Spec (current-feature.md) & Active State
36
36
  └── 📦 history/ # [Past] features/, fixes/, rollbacks/, and HISTORY.md
37
37
  ```
38
38
 
39
- ### 🏎️ Track 1: Fast-Track (Blueprint Mode — 4 Steps)
40
- *Recommended for 85% of daily engineering work (features, bug fixes, UI improvements, iterative refactoring).*
41
-
42
- The entire lifecycle is driven by the **Single Living Spec (`devflow/context/current-feature.md`)**:
43
-
44
- 1. **Spec (`/feature` or `/fix`)**:
45
- - Checks **Single Active Run Guardrail** (rejects if an uncompleted task is still active).
46
- - Analyzes request (or consumes `IDEA-xxx` from `devflow/ideas.md`).
47
- - Allocates sequential ID without prefix (e.g. `022-{slug}`) and creates branch `feature/{xxx-slug}` or `fix/{xxx-slug}`.
48
- - Generates `devflow/context/current-feature.md` containing **Section 1 (Scope & AC)**, **Section 2 (Plan & Test Strategy)**, and **Section 3 (Checklist)**.
49
- 2. **Implement (`/implement`)**:
50
- - Executes checklist tasks incrementally one small diff at a time using **TDD (Red-Green-Refactor)**.
51
- - Updates `## 4. Implementation Record` and marks tasks `- [x]` in `current-feature.md`.
52
- 3. **Check (`/check`)**:
53
- - Senior QA multi-lane verification (Lane 1: Typecheck/Lint, Lane 2: Test Suites, Lane 3: Manual Proof).
54
- - Records empirical proof under `## 5. Verification Evidence` in `current-feature.md`.
55
- 4. **Complete (`/complete`)**:
56
- - Final safety pass, updates `## 6. Release & Handoff` digest in `current-feature.md`.
57
- - Automatically archives `current-feature.md` `devflow/history/{features|fixes|rollbacks}/{xxx-slug}.md`.
58
- - Appends resolved findings and cleans `findings.md`.
59
- - Resets `current-feature.md` back to the idle stub.
60
- - Performs Git squash-merge into `main`, updates `devflow/history/HISTORY.md`, and sets workspace to Idle.
39
+ ### The Unified 4-Stage Living Spec Lifecycle
40
+ *ขับเคลื่อนการพัฒนาทุกระดับ (ตั้งแต่ Fast Fix จนถึง Architectural Epic) ด้วยเอกสารฉบับเดียว **Single Living Spec (`devflow/context/current-feature.md`)** ที่รวมความลึกระดับ Architect Mode เข้ากับความคล่องตัวระดับ Lean Velocity:*
41
+
42
+ ```text
43
+ /feature (หรือ /fix) ──▶ /implement ──▶ /check ──▶ /complete
44
+ ```
45
+
46
+ 1. **Stage 1: Spec (`/feature` หรือ `/fix`)**:
47
+ - ตรวจสอบ **Single Active Run Guardrail** (บล็อกการเปิดงานซ้อนถ้ามีงานที่ยังไม่เสร็จ)
48
+ - ดึงบริบทจาก `devflow/discoveries/`, `devflow/ideas.md`, หรือคำขอของผู้ใช้
49
+ - จัดสรร Running ID (`xxx-slug`) และสร้าง Branch `feature/{xxx-slug}` หรือ `fix/{xxx-slug}`
50
+ - เขียน **Single Living Spec (`current-feature.md`)** ครอบคลุม:
51
+ - `## 🎯 1. Define & Boundaries` (Problem, In/Out Scope, Risks, Success Criteria)
52
+ - `## 📐 2. Technical Spec & Contracts` (Architecture, Models, Interface Contracts, Non-functional, ACs)
53
+ - `## 📋 3. Execution Plan & TDD Checklist` (Atomic tasks, `[TDD-Red/Green/Refactor]` Triplets)
54
+
55
+ 2. **Stage 2: Implement (`/implement`)**:
56
+ - ดำเนินการ Task-by-task ตาม Checklist อย่างเคร่งครัดด้วย **TDD (Red-Green-Refactor)**
57
+ - ติ๊กเครื่องหมาย `- [x]` และบันทึก `## ⚡ 4. Implementation Log & Evidence` (Diff summary, Checkpoints) ลงใน `current-feature.md`
58
+
59
+ 3. **Stage 3: Check (`/check`)**:
60
+ - Senior QA Multi-Lane Verification (Typecheck, Lint, Test Suites, Manual Proof)
61
+ - บันทึกผลการพิสูจน์เชิงประจักษ์ลงใน `## 🧪 5. Multi-Lane Verification Matrix` ใน `current-feature.md`
62
+
63
+ 4. **Stage 4: Complete (`/complete`)**:
64
+ - สรุปผล `## 📦 6. Release Digest & Retrospective` (Changelog, Lessons Learned, ADRs)
65
+ - ทำการ Archive `current-feature.md` ไปเป็นไฟล์เดี่ยวที่ `devflow/history/{features|fixes|rollbacks}/{xxx-slug}.md`
66
+ - **Mandatory Delivery Gate**: บังคับถามผู้ใช้ก่อนเสมอว่าต้องการ Delivery รูปแบบใด:
67
+ - **Option 1 (Team MR/PR Flow)**: Pull master/main ล่าสุดมารวมกับ Feature/Dev Branch แล้ว push branch ขึ้นไปเพื่อเปิด MR/PR (ไม่ merge เข้า main/master ในเครื่อง และไม่แตะ protected branch)
68
+ - **Option 2 (Direct Squash-Merge)**: ทำการ Squash-merge เข้า main/master ในเครื่องเฉพาะเมื่อผู้ใช้สั่งโดยตรงเท่านั้น
69
+ - รีเซ็ต `current-feature.md` กลับเป็น Idle stub เมื่อปิดรอบงานเรียบร้อย
61
70
 
62
71
  ---
63
72
 
64
- ### 🏗️ Track 2: Deep-Track (Architect Mode 8 Steps)
65
- *Recommended for large architectural epics, database migrations, security audits, and multi-agent coordination.*
73
+ ### 🔮 Pre-Flight Discovery & Architectural Alignment (Companion Tools)
74
+ สำหรับงานที่ต้องการสำรวจไอเดีย, ค้นคว้าทางเทคนิค, หรือการออกแบบสถาปัตยกรรมก่อนเริ่มสร้าง Spec:
75
+ - `/discovery`: Unified Pre-delivery Discovery & Research (บันทึกใน `devflow/discoveries/`)
76
+ - `/idea`: วิเคราะห์และบันทึกไอเดียลงใน `devflow/ideas.md`
77
+ - `/grill` (หรือ `/align`): Socratic Alignment, Domain Modeling & บันทึก ADRs ลงใน `devflow/decisions/`
78
+ - `/brainstorm`: เครื่องมือระดมความคิดทางเลือก 2-3 Options พร้อมเปรียบเทียบ Trade-offs
66
79
 
67
- ```text
68
- 00-explore ➔ 10-define ➔ 20-spec ➔ 30-plan ➔ 40-execute ➔ 50-verify ➔ 60-report ➔ 70-deliver
69
- ```
70
80
 
71
- 1. `00-explore`: Explore request before delivery commitment (`DISC-YYYYMMDD-NNN`).
72
- 2. `10-define`: Turn approved discovery into bounded delivery run in `devflow/context/current-run/10-define.md`.
73
- 3. `20-spec`: Formalize markdown delivery contract & acceptance criteria (`20-spec.md`).
74
- 4. `30-plan`: Breakdown spec into executable tasks with test decisions (`30-plan.md` + checklists).
75
- 5. `40-execute`: Incremental task execution behind review gates (`40-execute.md`).
76
- 6. `50-verify`: Senior QA review & multi-lane verification checks (`50-verify.md`).
77
- 7. `60-report`: Standardized markdown delivery digest (`60-report.md`).
78
- 8. `70-deliver`: Release packaging, git merge, archives `devflow/context/current-run/` `devflow/history/{features|fixes|rollbacks}/{xxx-slug}/`, and closes the run.
81
+ ## 4. Strict TDD & Two-Stage Review Interaction Rules
82
+
83
+ ### 🔴🟢 Strict TDD Execution Discipline
84
+ During implementation in `/implement` and `40-execute`:
85
+ - **Show Red Phase**: First execute tests to demonstrate expected failure *before* adding production code.
86
+ - **Show Green Phase**: Add minimal production code, re-run tests, and report pass rate.
87
+ - **Show Refactor Phase**: Polish and clean up with zero test regression.
88
+ - **Forbidden**: Never present functional code changes without matching test execution evidence.
89
+
90
+ ### 🛡️ Two-Stage Verification Reporting
91
+ During `/check` and `50-verify`:
92
+ - **Stage 1 (Spec Fidelity Gate)**: Report each Acceptance Criterion and "Done When" status.
93
+ - **Stage 2 (Code Quality & Security Gate)**: Report Typecheck, Lint, Test Suites, Security checks, and Findings Ledger (0 blockers).
79
94
 
80
95
  ---
81
96
 
82
- ## 4. Standalone HTML Reporting Policy
97
+ ## 5. Standalone HTML Reporting Policy
83
98
 
84
99
  > [!IMPORTANT]
85
100
  > **No Auto-Generated HTML**: Mainline stages (`/complete` and `60-report`) strictly output Markdown only.
@@ -91,22 +91,33 @@ nexus-devflow/
91
91
 
92
92
  ---
93
93
 
94
- ## 7. Testing & Empirical Proof Standards
94
+ ## 7. Testing & Empirical Proof Standards (Strict TDD & Two-Stage Review)
95
95
 
96
96
  Testing is a core quality gate in Nexus-DevFlow, not an afterthought:
97
97
 
98
98
  - **Unit Test Mandate**: Any new feature, modified logic, parser improvement, or bug fix **MUST ship with automated unit tests** in the same diff.
99
+ - **Strict TDD (Red-Green-Refactor) Protocol**:
100
+ 1. **🔴 RED (Test First)**: Always write automated tests *before* writing or modifying functional logic. Run the test command and verify that it fails for the expected reason.
101
+ 2. **🟢 GREEN (Minimal Code)**: Write only the minimal production code necessary to make the failing test pass. Run the test command and verify 100% green pass.
102
+ 3. **🔵 REFACTOR (Clean & Robust)**: Refactor code for readability, performance, and DRY/YAGNI discipline while ensuring all tests stay green.
103
+ - *Code Deletion / Reversion Rule*: If functional code is created without a prior failing test for behavior changes, it must be reverted or immediately backed by tests before continuing.
99
104
  - **Test Framework**: Use Node.js native test runner executed via `tsx --test test/*.test.ts` under `packages/create-nexus-devflow/`.
100
105
  - **Test Design (AAA Pattern)**:
101
106
  - Structure each test case cleanly: **Arrange** (setup fixtures/mock directories), **Act** (execute function), **Assert** (verify invariants).
102
107
  - Use isolated temporary directories (`fs.mkdtemp` in `os.tmpdir()`) and ensure cleanup in `finally` blocks.
103
108
  - **Empirical Proof Contract**:
104
109
  - Never claim a task is "working", "tested", or "verified" without providing concrete empirical proof (exact command executed, terminal output, pass/fail counts, exit code).
105
- - **Multi-Lane Verification Matrix**:
106
- - **Lane 1 (Type & Syntax Safety)**: `tsc --noEmit` (0 type errors).
107
- - **Lane 2 (Automated Test Suites & Evals)**: `npm test` (Unit tests 100% pass) + `npm run test:routing` (Skill routing accuracy).
108
- - **Lane 3 (Scrutinize & Security Audit)**: Edge cases, null-safety, 0 secrets, safe inputs.
109
- - **Lane 4 (Manual / Scenario Proof)**: Concrete walkthrough steps ("Where to go", "What to run", "What to expect").
110
+ - **Two-Stage Review Pattern (Verification Gate)**:
111
+ - **Stage 1: Spec Fidelity & Acceptance Gate**:
112
+ - Verify 100% conformance against the living spec (`current-feature.md` or `20-spec.md`).
113
+ - Validate all Acceptance Criteria (ACs) and "Done When" observables without missing requirements or scope creep.
114
+ - Test edge cases and boundary conditions defined in the specification.
115
+ - **Stage 2: Code Quality, Security & Architecture Gate**:
116
+ - **Lane 1 (Type & Syntax Safety)**: `tsc --noEmit` (0 type errors).
117
+ - **Lane 2 (Automated Test Suites & Evals)**: `npm test` (Unit tests 100% pass) + `npm run test:routing` (Skill routing accuracy).
118
+ - **Lane 3 (Scrutinize & Security Audit)**: Edge cases, null-safety, 0 secrets, safe inputs.
119
+ - **Lane 4 (Manual / Scenario Proof)**: Concrete walkthrough steps ("Where to go", "What to run", "What to expect").
120
+ - **Findings Ledger State**: 0 blockers (P0/P1) in `devflow/context/findings.md`.
110
121
 
111
122
  ---
112
123
 
@@ -1,13 +1,10 @@
1
- # Findings Ledger
1
+ # Findings
2
2
 
3
- > **Generated Ledger File.** Tracks quality findings, security vulnerabilities, regression risks, and architectural debt raised during review and QA passes.
4
- >
5
- > **Finding Format**:
6
- > `### <ID> [<SEVERITY>] <STATUS> - <Title>`
7
- > - **Severities**: `P0` (Critical Blocker), `P1` (High Blocker), `P2` (Medium), `P3` (Low / Polish)
8
- > - **Statuses**: `unverified`, `open`, `fixed`, `closed`, `accepted`, `invalid`
9
- > - **Release Gate Rule**: Any `P0` or `P1` finding in `open` or `fixed` status unconditionally blocks `/complete` and `70-deliver`.
3
+ > **Generated file.** The findings ledger: review findings raised by `/audit`
4
+ > against the work in progress, each with a durable ID, severity (P0-P3), and
5
+ > status. `/implement` marks repaired findings `fixed`, a later `/audit` pass
6
+ > moves them to `closed`, and `/complete` refuses to merge while any P0 or P1
7
+ > finding is `open` or `fixed`, then archives resolved findings with the work
8
+ > and resets this file.
10
9
 
11
- ---
12
-
13
- _No active findings recorded. QA and audit passes append findings here as they are discovered._
10
+ _No findings recorded. `/audit` appends findings here when it finds them._
@@ -0,0 +1,31 @@
1
+ # Nexus-DevFlow Domain Glossary
2
+
3
+ > พจนานุกรมศัพท์โดเมนและนิยามสถาปัตยกรรมสำหรับ Nexus-DevFlow
4
+
5
+ ---
6
+
7
+ ### Single Living Spec (`current-feature.md`)
8
+ - **Definition**: เอกสาร Markdown กลางเพียงฉบับเดียวที่ใช้ขับเคลื่อนและบันทึกวงจรชีวิตของงานพัฒนาตั้งแต่ต้นจนจบ (Single Source of Truth during active delivery)
9
+ - **Constraints**: มีได้เพียง 1 งานที่ active ในช่วงเวลาหนึ่งตามหลักการ Single Active Run Guardrail
10
+ - **Structure**: ครอบคลุม 6 ส่วนหลัก: (1) Define & Boundaries, (2) Technical Spec & Contracts, (3) Execution Plan & TDD Tasks, (4) Implementation Log & Evidence, (5) Multi-Lane Verification Matrix, (6) Release Digest & Retrospective
11
+ - **Aliases / Related**: `current-feature.md`, Living Spec, Feature Spec
12
+
13
+ ### Unified Fast-Track
14
+ - **Definition**: รูปแบบการพัฒนาหลักแบบ Single-Track ของ Nexus-DevFlow ที่รวมความสามารถเชิงสถาปัตยกรรมระดับลึก (Deep) และความคล่องตัว (Fast) เข้าด้วยกันผ่าน 4 คำสั่งหลัก: `/feature` (หรือ `/fix`), `/implement`, `/check`, และ `/complete`
15
+ - **Constraints**: ขับเคลื่อนผ่านไฟล์ `current-feature.md` และเมื่อเสร็จสิ้นจะถูก Archive เป็นไฟล์ Markdown เดี่ยวใน `devflow/history/`
16
+ - **Aliases / Related**: Fast-Track, Unified Track
17
+
18
+ ### Pre-Flight Discovery
19
+ - **Definition**: กระบวนการสำรวจไอเดีย, ทำการวิจัย (Research), กลั่นกรอง PRD, วิเคราะห์ Trade-offs และจัดทำ ADR ก่อนที่จะเริ่มเปิดรอบพัฒนาจริง
20
+ - **Constraints**: ไม่แก้ไขซอร์สโค้ดโปรเจกต์ และไม่ถือว่าเป็น Active Run จนกว่าจะถูกส่งต่อเข้าสู่ `/feature`
21
+ - **Aliases / Related**: `/discovery`, `/idea`, `/brainstorm`, `/grill`
22
+
23
+ ### Multi-Lane Verification Matrix
24
+ - **Definition**: ตารางตรวจสอบคุณภาพแบบหลายมิติที่ครอบคลุม Typecheck, Linter, Automated Unit/Integration Tests, และ Manual Proof Evidence ในคำสั่ง `/check`
25
+ - **Constraints**: ต้องมีผลลัพธ์ผ่าน (PASS) ครบทุก Lane และไม่มี P0/P1 Finding ที่ยังค้างอยู่ก่อนที่จะส่งต่อไปยัง `/complete`
26
+ - **Aliases / Related**: QA Matrix, Lane Verification
27
+
28
+ ### Release Digest & Retrospective
29
+ - **Definition**: สรุปผลการเปลี่ยนแปลง, บทเรียนที่ได้รับ (Lessons Learned), และการตัดสินใจสำคัญที่บันทึกไว้ในตอนปิดรอบการพัฒนา
30
+ - **Constraints**: บันทึกอัตโนมัติใน Living Spec ก่อนที่จะทำการ Squash Merge และ Archive
31
+ - **Aliases / Related**: Delivery Digest, Retrospective Log
@@ -0,0 +1,65 @@
1
+ # Build Plan
2
+
3
+ > **Document Type**: Build Plan (User-Owned)
4
+ > **Purpose**: รายการฟีเจอร์ตามลำดับการพัฒนาจริง (Ordered Feature Roadmap Checklist)
5
+ > **Workflow**: ใช้เครื่องหมาย Checkbox `- [ ]` เรียงลำดับ 1, 2, 3... เพื่อให้ `/feature` ดึงไปทำทีละงาน
6
+
7
+ ---
8
+
9
+ ## 🚀 Phase 1: Core Foundation & Data Layer
10
+
11
+ - [ ] 1. **Core Schema & Data Models** - สร้าง Data Models, Schemas (Zod) และ Database Migrations เบื้องต้น
12
+ - [ ] 2. **Base Layout & Main UI Shell** - วางโครงสร้างหน้าจอหลัก, Navigation Shell และ Design Tokens
13
+ - [ ] 3. **Primary Feature Flow** - พัฒนาฟังก์ชันการทำงานหลัก พร้อม Input Form และ Validation
14
+
15
+ ---
16
+
17
+ ## ⚡ Phase 2: Interactivity & Core Capabilities
18
+
19
+ - [ ] 4. **Live Preview / Action Pipeline** - เชื่อมต่อ Input เข้าสู่ระบบประมวลผลและการแสดงผลแบบ Real-time
20
+ - [ ] 5. **Export / Output Engine** - พัฒนาระบบส่งออกข้อมูล เช่น Image Generation, PDF Download หรือ API Response
21
+ - [ ] 6. **Local Persistence & Settings** - บันทึกการตั้งค่าและประวัติการใช้งานลงใน Local Storage หรือ Database
22
+ - [ ] 6a. **Settings Panel** - UI สำหรับปรับแต่งค่าและการจัดเก็บ State
23
+ - [ ] 6b. **History & Recall** - แสดงรายการประวัติย้อนหลังและปุ่มเรียกข้อมูลกลับมาใช้
24
+
25
+ ---
26
+
27
+ ## 🚢 Phase 3: Polish, Quality & Production Hardening
28
+
29
+ - [ ] 7. **Edge Cases & Input Polish** - จัดการ Loading States, Error Boundaries และ Responsive Layout
30
+ - [ ] 8. **Deployment Readiness & Production Verification** - ตั้งค่า Environment Config, ตรวจสอบ Production Build และ Health Check
31
+
32
+ ---
33
+
34
+ ## 🛠️ Architecture & Deployment Notes (Optional)
35
+ <!--
36
+ บันทึกการตัดสินใจทางสถาปัตยกรรมที่ตกลงกันไว้ล่วงหน้า เพื่อป้องกันการสับสนระหว่างการ Implement
37
+ -->
38
+
39
+ - **Key Technical Decisions**:
40
+ - [เช่น ใช้ Full Puppeteer พร้อม Bundled Chromium แทน Serverless Chromium เพื่อความเสถียรของ Font]
41
+ - [เช่น จัดเก็บ User Session ผ่าน JWT ใน HttpOnly Cookies]
42
+ - **Environment & Hosting Constraints**:
43
+ - [เช่น ต้องการ Memory ขั้นต่ำ 1GB บน Render หรือ Docker Container]
44
+ - [เช่น กำหนด Concurrency Limits ไม่เกิน 2 worker processes ต่อ instance]
45
+
46
+ ---
47
+
48
+ ## 🔮 Later / Post-MVP Backlog (Not in v1)
49
+ <!--
50
+ ฟีเจอร์ที่วางแผนไว้สำหรับอนาคต (หลังจาก v1 ส่งมอบเรียบร้อยแล้ว)
51
+ -->
52
+
53
+ - [ ] **Cloud Sync & User Accounts** - ระบบสมัครสมาชิกและซิงค์ข้อมูลบน Cloud (Clerk / Supabase)
54
+ - [ ] **Batch Processing** - อัปโหลดไฟล์ CSV และประมวลผลพร้อมกันทีละหลายรายการ
55
+ - [ ] **Paid Subscription & Billing** - เชื่อมต่อ Stripe และจัดการ Tier จำกัดการใช้งาน
56
+
57
+ ---
58
+
59
+ <!--
60
+ 💡 คำแนะนำในการเขียน Build Plan ที่ดี:
61
+ 1. แต่ละข้อต้องเป็น "Feature-Sized Outcome" ที่มองเห็นผลลัพธ์ได้ (ไม่ใช่แค่ task ย่อยๆ เช่น "เขียน function x")
62
+ 2. ห้ามใส่ Scaffolding Chores (เช่น "สร้างโปรเจกต์ Next.js", "ติดตั้ง Tailwind") เพราะทำก่อนหน้าแล้ว
63
+ 3. ฟีเจอร์ที่มีความซับซ้อน สามารถแตกเป็น Sub-items ย่อยได้ เช่น 6a, 6b
64
+ 4. อย่าจัดกลุ่มฟีเจอร์หลายๆ อย่างรวมในข้อเดียว (เช่น "Auth + Database + Dashboard + Deploy")
65
+ -->
@@ -0,0 +1,110 @@
1
+ # [ID-slug] Feature Title
2
+
3
+ > **Template Type**: Single Living Spec (DevFlow 2.5.0)
4
+ > **Active Location**: `devflow/context/current-feature.md`
5
+ > **Archive Location**: `devflow/history/{features|fixes|rollbacks}/{ID-slug}.md`
6
+
7
+ - **Feature ID**: `{xxx-slug}`
8
+ - **Category**: `features` | `fixes` | `rollbacks`
9
+ - **Target Branch**: `feature/{xxx-slug}`
10
+ - **Status**: `Spec Ready` | `In-Progress` | `Verified` | `Completed`
11
+ - **Track**: `Unified Fast-Track`
12
+ - **Discovery Ref**: `devflow/discoveries/DISC-xxx.md` (Optional)
13
+ - **ADR Ref**: `devflow/decisions/ADR-xxx.md` (Optional)
14
+
15
+ ---
16
+
17
+ ## 🎯 1. Define & Boundaries
18
+
19
+ ### Problem Statement & Goal
20
+ - **Problem**: อธิบายปัญหาที่พบ หรือสิ่งที่ต้องการแก้ไข/ปรับปรุง
21
+ - **Goal**: ผลลัพธ์หรือเป้าหมายที่ต้องการให้เกิดขึ้น
22
+
23
+ ### In-Scope & Out-of-Scope
24
+ - **In-Scope**:
25
+ - สิ่งที่ต้องทำในรอบนี้
26
+ - **Out-of-Scope**:
27
+ - สิ่งที่ไม่ทำในรอบนี้ หรือยกยอดไปทำในเฟสถัดไป
28
+
29
+ ### Risk & Mitigation Matrix
30
+ | Risk | Severity | Mitigation |
31
+ | :--- | :--- | :--- |
32
+ | ความเสี่ยงที่อาจเกิดขึ้น | Low/Medium/High | แนวทางป้องกันหรือรับมือ |
33
+
34
+ ### Success Criteria
35
+ 1. เกณฑ์ชี้วัดความสำเร็จข้อที่ 1
36
+ 2. เกณฑ์ชี้วัดความสำเร็จข้อที่ 2
37
+
38
+ ---
39
+
40
+ ## 📐 2. Technical Spec & Contracts
41
+
42
+ ### Architecture & Component Design
43
+ - อธิบายโครงสร้างหรือ Flow การทำงานของ Component/Module
44
+
45
+ ### Data Models & Schemas
46
+ ```typescript
47
+ // Interface หรือ Type Definition
48
+ ```
49
+
50
+ ### API & Interface Contracts
51
+ - **Endpoint / Function**: `methodName(params: Type): ReturnType`
52
+ - **Error Handling**: รายละเอียด Error Codes และวิธีจัดการ
53
+
54
+ ### Non-Functional Constraints
55
+ - **Security**: การตรวจสอบ Input, การจัดการสิทธิ์, Secrets
56
+ - **Performance**: ข้อจำกัดเรื่องความเร็ว หรือ Resource Usage
57
+
58
+ ### Acceptance Criteria (AC)
59
+ - [ ] **AC-1**: เงื่อนไขการยอมรับข้อที่ 1
60
+ - [ ] **AC-2**: เงื่อนไขการยอมรับข้อที่ 2
61
+
62
+ ---
63
+
64
+ ## 📋 3. Execution Plan & TDD Checklist
65
+
66
+ - [ ] **Task 1: Core Foundation & Types**
67
+ - [ ] 1.1 `[TDD-Red]` เขียน Unit Test สำหรับ Logic ส่วนที่ 1
68
+ - [ ] 1.2 `[TDD-Green]` Implement Logic ให้ผ่าน Test
69
+ - [ ] 1.3 `[TDD-Refactor]` Clean up และ Optimize โค้ด
70
+
71
+ - [ ] **Task 2: Feature Implementation**
72
+ - [ ] 2.1 `[TDD-Red]` เขียน Test ครอบคลุม Edge Cases
73
+ - [ ] 2.2 `[TDD-Green]` Implement Feature ตาม Contract
74
+ - [ ] 2.3 `[TDD-Refactor]` ตรวจสอบความถูกต้องและ Architecture
75
+
76
+ - [ ] **Task 3: Integration & QA Verification**
77
+ - [ ] 3.1 `[TDD-Green]` เชื่อมต่อ UI/API และตรวจสอบ End-to-End
78
+
79
+ ---
80
+
81
+ ## ⚡ 4. Implementation Log & Evidence
82
+
83
+ *(จะถูกบันทึกและอัปเดตความคืบหน้าระหว่างรันคำสั่ง `/implement`)*
84
+
85
+ - **Step 1**: ...
86
+ - **Checkpoint Commit**: `feat(scope): ...`
87
+
88
+ ---
89
+
90
+ ## 🧪 5. Multi-Lane Verification Matrix
91
+
92
+ *(จะถูกบันทึกผลการตรวจสอบระหว่างรันคำสั่ง `/check`)*
93
+
94
+ | Lane | Command / Verification Target | Result | Notes / Proof |
95
+ | :--- | :--- | :--- | :--- |
96
+ | **Typecheck** | `npm run typecheck` | ⏳ PENDING | |
97
+ | **Lint** | `npm run lint` | ⏳ PENDING | |
98
+ | **Unit Tests** | `npm test` | ⏳ PENDING | |
99
+ | **Manual Proof** | UI / CLI Behavioral Verification | ⏳ PENDING | |
100
+
101
+ ---
102
+
103
+ ## 📦 6. Release Digest & Retrospective
104
+
105
+ *(จะถูกสรุปและบันทึกอัตโนมัติก่อนทำการ Squash Merge ในคำสั่ง `/complete`)*
106
+
107
+ - **What Changed**: สรุปสิ่งที่เปลี่ยนแปลง
108
+ - **Key Decisions**: การตัดสินใจสำคัญระหว่างพัฒนา
109
+ - **Lessons Learned**: บทเรียนที่ได้รับ
110
+ - **Known Limitations**: ข้อจำกัดที่ทราบและข้อเสนอแนะในอนาคต
@@ -0,0 +1,128 @@
1
+ # Project Plan
2
+
3
+ > **Document Type**: Project Plan (User-Owned)
4
+ > **Purpose**: แหล่งความจริงหลัก (Single Source of Truth) สำหรับวิสัยทัศน์ผลิตภัณฑ์ สถาปัตยกรรมระบบ ขอบเขตการทำงาน และข้อกำหนดทางเทคนิค
5
+ > **Workflow**: กรอกข้อมูลให้ครบถ้วนแล้วรัน `/overview` เพื่อประมวลผลเป็น `project-overview.md`
6
+
7
+ ---
8
+
9
+ ## 1. Problem - What problem are we solving?
10
+ <!--
11
+ อธิบายปัญหาที่ระบบนี้เข้ามาแก้ไข วัตถุประสงค์หลัก และทำไมโปรเจกต์นี้จึงควรมีอยู่ (2-4 ประโยค)
12
+ - ปัญหาในปัจจุบันคืออะไร ทำไมวิธีเดิมถึงไม่ตอบโจทย์
13
+ - ผลลัพธ์ที่ต้องการ (Desired Outcome) หลังระบบนี้สร้างเสร็จ
14
+ -->
15
+
16
+ - **Core Problem**: [ระบุปัญหาหลักที่ผู้ใช้กำลังเผชิญ เช่น การทำงานแบบ Manual ที่เสียเวลาและผิดพลาดง่าย]
17
+ - **Main Purpose**: [ระบุเป้าหมายหลักของระบบ เช่น แปลง Input 3 อย่างเป็นผลลัพธ์พร้อมใช้งานในไม่กี่วินาที]
18
+
19
+ ---
20
+
21
+ ## 2. Users - Who is this for?
22
+ <!--
23
+ กลุ่มผู้ใช้งานเป้าหมายและ Use Cases หลัก
24
+ - Primary Users: ผู้ใช้งานหลักกลุ่มแรก
25
+ - Secondary / Later: กลุ่มผู้ใช้ในอนาคต
26
+ - Access Tiers: สิทธิ์การเข้าถึง เช่น Guest / Registered / Admin
27
+ -->
28
+
29
+ - **Primary Audience**: [เช่น Solo Developers, Content Creators, นักเรียน/นักศึกษา]
30
+ - **Secondary Audience (Later)**: [เช่น ทีมงานองค์กร, ลูกค้าปลายทาง]
31
+ - **User Personas & Access Tiers**:
32
+ - `Anonymous / Guest`: [สิทธิ์การใช้งานทั่วไป เช่น ดูข้อมูลสาธารณะ, ทดลองเล่นแบบจำกัด]
33
+ - `Authenticated User`: [สิทธิ์การใช้งานหลัก เช่น จัดการข้อมูลตนเอง, บันทึกประวัติ]
34
+ - `Admin`: [สิทธิ์การจัดการระบบ เช่น ดูแลผู้ใช้, ตรวจสอบ Log]
35
+
36
+ ---
37
+
38
+ ## 3. Features - What does v1 need?
39
+ <!--
40
+ รายการฟีเจอร์ระดับสูงสำหรับเวอร์ชันแรก (MVP / v1)
41
+ - เขียนสรุปสั้นๆ บรรทัดละ 1 ข้อ ไม่ต้องลงรายละเอียดทางเทคนิคลึก
42
+ - แยกส่วน Out of Scope / Later ให้ชัดเจนเพื่อคุมขอบเขต (Prevent Scope Creep)
43
+ -->
44
+
45
+ ### Core MVP Features (v1):
46
+ - **Feature 1**: [คำอธิบายสั้นๆ เกี่ยวกับสิ่งที่ฟีเจอร์นี้ทำ]
47
+ - **Feature 2**: [คำอธิบายสั้นๆ เกี่ยวกับสิ่งที่ฟีเจอร์นี้ทำ]
48
+ - **Feature 3**: [คำอธิบายสั้นๆ เกี่ยวกับสิ่งที่ฟีเจอร์นี้ทำ]
49
+ - **Feature 4**: [คำอธิบายสั้นๆ เกี่ยวกับสิ่งที่ฟีเจอร์นี้ทำ]
50
+
51
+ ### Later / Post-MVP (Not in v1):
52
+ <!-- สิ่งที่เก็บไว้ทำในอนาคต แต่ยังไม่ทำในรอบแรก -->
53
+ - [เช่น ระบบสมัครสมาชิกและจัดการ Billing ผ่าน Stripe]
54
+ - [เช่น การส่งออกข้อมูลปริมาณมากแบบ Batch/CSV]
55
+ - [เช่น Cloud Sync และการแชร์ข้อมูลข้ามอุปกรณ์]
56
+
57
+ ---
58
+
59
+ ## 4. Data - What are we storing?
60
+ <!--
61
+ โครงสร้างข้อมูลและ Entity หลักที่ระบบต้องจัดเก็บ
62
+ - ข้อมูลที่อยู่ใน Code (Static / Config)
63
+ - ข้อมูลที่เก็บใน Browser (LocalStorage / Session / Cookies)
64
+ - ข้อมูลที่เก็บใน Database (Entities, Fields, Relationships)
65
+ -->
66
+
67
+ - **In-Code / Static**: [เช่น Template Definitions, App Constants, Fixed Options]
68
+ - **Client Storage (LocalStorage/Session)**: [เช่น User Preferences, Form Draft, UI Settings]
69
+ - **Database Entities (If applicable)**:
70
+ - **`User`**: `id` (String/UUID), `email` (String, Unique), `name` (String), `role` (Enum), `createdAt` (DateTime)
71
+ - **`Resource`**: `id` (UUID), `userId` (FK -> User.id), `title` (String), `status` (Enum), `metadata` (JSON), `updatedAt` (DateTime)
72
+ - **Relationships**:
73
+ - `User` 1-to-Many `Resource`
74
+
75
+ ---
76
+
77
+ ## 5. Tech - What stack are we using?
78
+ <!--
79
+ เทคโนโลยี ไลบรารี และเครื่องมือที่เลือกใช้ พร้อมระบุหน้าที่
80
+ -->
81
+
82
+ - **Framework & Runtime**: [เช่น Next.js 15 (App Router), TypeScript, Node.js >=20]
83
+ - **Styling & UI**: [เช่น Tailwind CSS v4, Shadcn UI / Radix Primitives, Lucide Icons]
84
+ - **State & Data Access**: [เช่น Zustand, TanStack Query, Prisma ORM / Drizzle]
85
+ - **Database**: [เช่น PostgreSQL on Neon / Supabase, SQLite on LibSQL]
86
+ - **Authentication**: [เช่น NextAuth.js (Auth.js), Clerk, Supabase Auth, หรือ None in v1]
87
+ - **Validation**: [เช่น Zod for Schema & Input Validation]
88
+ - **Special Engines / Libraries**: [เช่น Puppeteer for Headless PDF/Image Export, Sharp for Image Processing]
89
+
90
+ ---
91
+
92
+ ## 6. Monetize - How will this make money?
93
+ <!--
94
+ โมเดลทางธุรกิจหรือแผนการสร้างรายได้ (หากเป็น Free Tool หรือ Internal App ให้ระบุให้ชัด)
95
+ -->
96
+
97
+ - **Model in v1**: [เช่น Free / Open-Source / Internal Utility (ไม่มีการเก็บเงินใน v1)]
98
+ - **Future Monetization (If applicable)**: [เช่น Freemium, Subscription $10/mo, Usage-based API credits]
99
+
100
+ ---
101
+
102
+ ## 7. UI/UX - How should this look and feel?
103
+ <!--
104
+ ธีม โครงสร้างหน้าจอ สไตล์การออกแบบ และประสบการณ์ผู้ใช้
105
+ -->
106
+
107
+ - **Design Aesthetic**: [เช่น Clean & Modern, Dark-Mode First, Glassmorphism, Minimalist]
108
+ - **Layout Structure**: [เช่น Single-page dashboard with Split View (Form on left, Live Preview on right)]
109
+ - **Key Routes / Screens**:
110
+ - `/`: [หน้า Landing & Main Generator Workflow]
111
+ - `/dashboard`: [หน้าจัดการ Resource และดูประวัติย้อนหลัง]
112
+ - `/settings`: [หน้าตั้งค่า Profile และ Preferences]
113
+
114
+ ---
115
+
116
+ ## 8. Deployment - Where and how will this ship?
117
+ <!--
118
+ เป้าหมายการ Deploy, คำสั่ง Build/Start, และ Environment Variables
119
+ -->
120
+
121
+ - **Target Platform**: [เช่น Vercel, Render, Cloudflare Pages, Fly.io, Self-hosted Docker]
122
+ - **Build Command**: `npm run build`
123
+ - **Start Command / Output**: `npm run start` (หรือ Static Output `out/`)
124
+ - **Required Environment Variables**:
125
+ - `DATABASE_URL`: Connection string สำหรับ Database
126
+ - `NEXTAUTH_SECRET`: Secret key สำหรับ Session signing
127
+ - `API_KEY`: Key สำหรับเชื่อมต่อ Third-party Service
128
+ - **Health Check Endpoint**: `/api/health`
@@ -1,4 +1,4 @@
1
- # DevFlow 2.0 Running ID & 3-Pillars Workspace Contract
1
+ # DevFlow 2.5.0 Running ID & 3-Pillars Workspace Contract
2
2
 
3
3
  ## The 3-Pillars Workspace Architecture
4
4
 
@@ -11,19 +11,20 @@ devflow/
11
11
  ├── ⚡ context/ # [2. Present / Active] Living Source of Truth & Active Work
12
12
  │ ├── project-overview.md # Primary source of truth for project architecture and tech stack
13
13
  │ ├── coding-standards.md # Engineering, code quality, TDD, and testing standards
14
- │ ├── ai-interaction.md # AI agent interaction rules, dual-track flow, and Thai defaults
14
+ │ ├── ai-interaction.md # AI agent interaction rules, unified living spec flow, and Thai defaults
15
15
  │ ├── findings.md # Open and resolved audit findings ledger (P0-P3)
16
+ │ ├── glossary.md # Domain glossary and architecture vocabulary
16
17
  │ ├── current-stage.md # Active state pointer and run tracker
17
- ├── current-feature.md # Fast-Track Single Living Spec (Active work / stub when idle)
18
- │ └── current-run/ # Deep-Track Active Run folder (Temporary during 10-70 execution)
18
+ └── current-feature.md # Single Living Spec (Active work / stub when idle)
19
19
 
20
20
  ├── 📦 history/ # [3. Past / Completed] Permanent Delivery & Release Archives
21
- │ ├── features/ # Completed features, architecture migrations, tooling (xxx-slug.md or xxx-slug/)
21
+ │ ├── features/ # Completed features, architecture migrations, tooling (xxx-slug.md)
22
22
  │ ├── fixes/ # Completed bug fixes, hotfixes, security patches (xxx-slug.md)
23
23
  │ ├── rollbacks/ # Completed feature reversals (YYYY-MM-DD-xxx-slug.md)
24
24
  │ └── HISTORY.md # Master release ledger summary table
25
25
 
26
- └── 🔍 discoveries/ # Pre-delivery discovery records (DISC-YYYYMMDD-NNN-slug/00-explore.md)
26
+ ├── 🔍 discoveries/ # Pre-delivery discovery records (DISC-YYYYMMDD-NNN-slug/discovery.md)
27
+ └── 🏛️ decisions/ # Architecture Decision Records (ADR-xxx-slug.md)
27
28
  ```
28
29
 
29
30
  ---
@@ -31,9 +32,9 @@ devflow/
31
32
  ## Running ID Naming Convention
32
33
 
33
34
  ### 1. Standard Running IDs
34
- - **Format**: `xxx-slug` (e.g. `001-setup-auth`, `021-categorized-history-and-clean-living-spec-architecture`)
35
+ - **Format**: `xxx-slug` (e.g. `001-setup-auth`, `053-unify-deep-and-fast-track-model`)
35
36
  - **Prefix Removal**: The legacy `RUN-` prefix is discontinued in favor of clean 3-digit sequential numbering.
36
- - **Git Branch Standard**: `feature/{xxx-slug}` or `fix/{xxx-slug}`.
37
+ - **Git Branch Standard**: `feature/{xxx-slug}` or `fix/{xxx-slug}` (or specific release branches such as `2.5.0`).
37
38
 
38
39
  ### 2. Sub-Feature Running IDs (`xxx[a-z]-slug`)
39
40
  - **Format**: `xxx[a-z]-slug` (e.g. `038a-backend-schema-and-api`, `038b-frontend-ui-and-state`)
@@ -56,6 +57,6 @@ When detected during `/feature` or `/brief`, the AI triggers the **Interactive S
56
57
 
57
58
  ## Single Active Run Rule (One Thing at a Time)
58
59
 
59
- 1. Only **one active run** is permitted at any given time across both Fast-Track and Deep-Track.
60
- 2. Before opening a new run (`/feature`, `/fix`, or `10-define`), the AI checks `current-stage.md` and `current-feature.md`.
61
- 3. If an active run is in progress, the AI **blocks** starting a new task and requires closing the active run via `/complete` or `70-deliver` (or explicitly cancelling/rolling back).
60
+ 1. Only **one active run** is permitted at any given time in `current-feature.md`.
61
+ 2. Before opening a new run (`/feature` or `/fix`), the AI checks `current-stage.md` and `current-feature.md`.
62
+ 3. If an active run is in progress, the AI **blocks** starting a new task and requires closing the active run via `/complete` (or explicitly cancelling/rolling back).