@torus-engineering/tas-kit 1.13.0 → 2.1.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 (100) hide show
  1. package/.tas/_platform/claude-code/settings.json +58 -46
  2. package/.tas/_platform/hooks/code-quality.js +127 -127
  3. package/.tas/_platform/hooks/session-end.js +111 -111
  4. package/.tas/agents/architect.md +53 -53
  5. package/.tas/agents/aws-reviewer.md +71 -71
  6. package/.tas/agents/build-resolver.md +89 -59
  7. package/.tas/agents/code-explorer.md +63 -63
  8. package/.tas/agents/csharp-reviewer.md +62 -62
  9. package/.tas/agents/database-reviewer.md +73 -73
  10. package/.tas/agents/doc-updater.md +68 -66
  11. package/.tas/agents/python-reviewer.md +67 -67
  12. package/.tas/agents/security-reviewer.md +79 -79
  13. package/.tas/agents/software-engineer.md +53 -0
  14. package/.tas/agents/typescript-reviewer.md +65 -65
  15. package/.tas/commands/ado-create.md +33 -28
  16. package/.tas/commands/ado-delete.md +26 -22
  17. package/.tas/commands/ado-get.md +24 -20
  18. package/.tas/commands/ado-status.md +22 -18
  19. package/.tas/commands/ado-update.md +31 -27
  20. package/.tas/commands/tas-adr.md +37 -33
  21. package/.tas/commands/tas-apitest-plan.md +177 -173
  22. package/.tas/commands/tas-apitest.md +147 -143
  23. package/.tas/commands/tas-brainstorm.md +23 -19
  24. package/.tas/commands/tas-brd.md +50 -0
  25. package/.tas/commands/tas-bug.md +127 -113
  26. package/.tas/commands/tas-checklist.md +180 -0
  27. package/.tas/commands/tas-debug.md +103 -0
  28. package/.tas/commands/tas-design.md +41 -37
  29. package/.tas/commands/tas-dev.md +225 -125
  30. package/.tas/commands/tas-e2e-mobile.md +146 -155
  31. package/.tas/commands/tas-e2e-web.md +150 -163
  32. package/.tas/commands/tas-e2e.md +289 -102
  33. package/.tas/commands/tas-feature.md +181 -47
  34. package/.tas/commands/tas-fix.md +72 -51
  35. package/.tas/commands/tas-functest-mobile.md +138 -144
  36. package/.tas/commands/tas-functest-web.md +176 -192
  37. package/.tas/commands/tas-functest.md +225 -76
  38. package/.tas/commands/tas-init.md +22 -17
  39. package/.tas/commands/tas-master-plan.md +300 -0
  40. package/.tas/commands/tas-orchestrate.md +159 -0
  41. package/.tas/commands/tas-plan.md +152 -117
  42. package/.tas/commands/tas-prd.md +57 -37
  43. package/.tas/commands/tas-review-pr.md +174 -0
  44. package/.tas/commands/tas-review.md +115 -113
  45. package/.tas/commands/tas-sad.md +47 -43
  46. package/.tas/commands/tas-security.md +91 -87
  47. package/.tas/commands/tas-spec.md +54 -50
  48. package/.tas/commands/tas-status.md +25 -16
  49. package/.tas/project-status-example.yaml +3 -1
  50. package/.tas/rules/ado-integration.md +67 -65
  51. package/.tas/rules/common/api-design.md +517 -517
  52. package/.tas/rules/common/build-debug-loop.md +233 -0
  53. package/.tas/rules/common/code-review.md +4 -0
  54. package/.tas/rules/common/feature-done.md +42 -0
  55. package/.tas/rules/common/post-implementation-review.md +4 -0
  56. package/.tas/rules/common/project-status.md +33 -16
  57. package/.tas/rules/common/sad-impact.md +81 -0
  58. package/.tas/rules/common/tdd.md +104 -89
  59. package/.tas/rules/csharp/api-testing.md +2 -2
  60. package/.tas/rules/csharp/torus-core-framework.md +128 -0
  61. package/.tas/tas-example.yaml +9 -32
  62. package/.tas/templates/AGENTS.md +13 -0
  63. package/.tas/templates/API-Test-Spec.md +5 -4
  64. package/.tas/templates/BRD.md +133 -0
  65. package/.tas/templates/Bug.md +15 -0
  66. package/.tas/templates/E2E-Execution-Report.md +8 -8
  67. package/.tas/templates/E2E-Mobile-Spec.md +6 -8
  68. package/.tas/templates/E2E-Report.md +2 -2
  69. package/.tas/templates/E2E-Scenario.md +22 -22
  70. package/.tas/templates/E2E-Test-Spec.md +274 -0
  71. package/.tas/templates/E2E-Web-Spec.md +4 -4
  72. package/.tas/templates/Feature-Technical-Part.md +69 -0
  73. package/.tas/templates/Feature-Technical-Stack.md +74 -0
  74. package/.tas/templates/Feature-Technical.md +329 -0
  75. package/.tas/templates/Feature.md +50 -26
  76. package/.tas/templates/Func-Test-Script.md +29 -56
  77. package/.tas/templates/Func-Test-Spec.md +144 -142
  78. package/.tas/templates/PRD.md +173 -142
  79. package/.tas/templates/TestChecklist.md +96 -0
  80. package/.tas/templates/torus-dotnet-bootstrap.md +223 -0
  81. package/.tas/tools/tas-ado-readme.md +24 -27
  82. package/.tas/tools/tas-ado.py +328 -25
  83. package/.tas/tools/tas-github.py +339 -0
  84. package/README.md +142 -57
  85. package/bin/cli.js +90 -90
  86. package/lib/adapters/antigravity.js +131 -131
  87. package/lib/adapters/claude-code.js +71 -35
  88. package/lib/adapters/codex.js +157 -157
  89. package/lib/adapters/cursor.js +80 -80
  90. package/lib/adapters/index.js +20 -20
  91. package/lib/adapters/utils.js +81 -81
  92. package/lib/deleted-files.json +7 -0
  93. package/lib/install.js +546 -543
  94. package/package.json +2 -2
  95. package/.tas/README.md +0 -334
  96. package/.tas/commands/tas-epic.md +0 -35
  97. package/.tas/commands/tas-story.md +0 -91
  98. package/.tas/rules/common/story-done.md +0 -30
  99. package/.tas/templates/Epic.md +0 -46
  100. package/.tas/templates/Story.md +0 -90
@@ -1,76 +1,225 @@
1
- # /tas-functest $ARGUMENTS
2
-
3
- Role: SE / QA
4
- Generate Functional Test Specification from a User Story, linking test cases to Acceptance Criteria (AC).
5
-
6
- ## IMPORTANT - Layer 2: Functional Testing
7
- - Functional tests (FT) sit between Unit tests (Layer 1) and E2E tests (Layer 3)
8
- - FT tests individual function/story in isolation, DOESN'T test linked flows between multiple features
9
- - Each FT case MUST reference AC-ID for traceability
10
-
11
- ## Actions
12
-
13
- ### Step 1: Identify Story
14
- 1. $ARGUMENTS is Story ID or file path
15
- 2. If no $ARGUMENTS: scan `docs/epics/**/Story-*.md` for stories with status In Progress or Committed
16
- 3. Read Story file to get:
17
- - All Acceptance Criteria (AC-1, AC-2, ...)
18
- - Epic/Feature/Story numbers (from frontmatter or file path)
19
- - Platform context (mobile/web/backend)
20
- 4. Read `root/tas.yaml` to get project code (e.g., "AL")
21
-
22
- ### Step 2: Auto-detect Platform
23
- From Story context, determine platform:
24
- - **Mobile**: Keywords "screen", "navigation", "React Native", "Detox"; paths `apps/mobile/src/features/*`
25
- - **Web**: Keywords "browser", "page", "Playwright", "React"; paths `apps/web/*`
26
- - **Backend**: Keywords "API endpoint", "service", "controller"; paths `src/Torus.*`, `tests/`
27
- - If cannot determine: ask user
28
-
29
- ### Step 3: Generate FT Test Cases
30
- Read template from `.tas/templates/Func-Test-Spec.md`
31
-
32
- Naming format:
33
- ```
34
- {PROJECT}_E{EPIC}_F{FEATURE}_S{STORY}_FT_{NNN}_{MODIFIER}
35
- ```
36
-
37
- For each AC, generate:
38
- - **REQUIRED**: 1 Happy path test (H)
39
- - **SHOULD HAVE**: 1 Negative test (N) if error scenarios exist
40
- - **OPTIONAL**: 1 Edge case test (E) if boundary conditions exist
41
-
42
- Each test case MUST have AC-ID column in mapping table.
43
-
44
- ### Step 4: Generate Test Data Requirements
45
- - Identify data needed for each test case
46
- - Hardcoded data: write directly in scenario
47
- - Credentials: only reference `process.env.TEST_USER_PASSWORD`, DO NOT hardcode
48
- - Environment-specific data: reference `test-data.{env}.json`
49
-
50
- ### Step 5: Output File
51
- Save file at:
52
- ```
53
- docs/epics/{epic-dir}/{feature-dir}/Func-Test-{story-slug}.md
54
- ```
55
-
56
- ### Step 6: Prompting
57
- After generating, ask user:
58
- - "Any edge cases to add?"
59
- - "Any negative test scenarios missed?"
60
- - "Any test cases to mark as P0 Critical?"
61
- - "What additional test data and fixtures needed?"
62
-
63
- ## Traceability Feature
64
- - Each FT case links AC-ID in mapping column
65
- - When AC changes: grep AC-ID in Func-Test-*.md to know which FTs need update
66
- - In test script, each describe block has comment `// AC Reference: AC-{N}`
67
-
68
- ## Status Flow
69
- Draft Ready Implemented → Verified
70
-
71
- ## Principles
72
- - DO NOT create test code, only create specification (markdown)
73
- - Test code created by `/tas-functest-mobile` or `/tas-functest-web`
74
- - Func-Test-Spec is input for Layer 2 script generation
75
- - Each AC must have at least 1 FT case
76
- - FT uses type code `FT`, NOT `E2E` or `UT`
1
+ # /tas-functest $FEATURE_FILE $CHECKLIST_FILE
2
+
3
+ You are a Senior QA Engineer creating a comprehensive Functional Test Specification based on a Feature document and Test Checklist.
4
+
5
+ ## Purpose
6
+
7
+ Generate a detailed Functional Test Specification document that maps Acceptance Criteria to executable test cases, with proper traceability, test data management, and automation readiness flags.
8
+
9
+ ## When to Use
10
+
11
+ - Run after Test Checklist is approved
12
+ - Run before writing automation scripts
13
+ - Run when Feature requirements change (update test spec)
14
+
15
+ ## Prerequisites
16
+
17
+ 1. Feature document exists (pattern: `*-Feature-*.md`)
18
+ 2. Test Checklist exists (pattern: `*-TestChecklist.md`) - optional but recommended
19
+ 3. Template exists at `.tas/templates/Func-Test-Spec.md`
20
+ 4. `tas.yaml` exists at project root
21
+
22
+ ## Step-by-Step Actions
23
+
24
+ ### Step 1: Locate and Read Input Documents
25
+
26
+ 1. **Feature Document:**
27
+ - If `$FEATURE_FILE` provided, use that
28
+ - Otherwise, search for `*-Feature-*.md` in current directory
29
+ - Extract: Feature Code, Feature Name, Epic ID, Story ID, Acceptance Criteria
30
+
31
+ 2. **Test Checklist:**
32
+ - If `$CHECKLIST_FILE` provided, use that
33
+ - Otherwise, search for `*-TestChecklist.md` in current directory
34
+ - Extract all test points from checklist matrix by category
35
+ - Map checklist points to test cases
36
+
37
+ 3. **Read Template:**
38
+ - Read `.tas/templates/Func-Test-Spec.md`
39
+
40
+ ### Step 2: Parse and Structure Requirements
41
+
42
+ From Feature document, extract:
43
+
44
+ **A. Acceptance Criteria (AC):**
45
+ - Each AC with Given/When/Then format
46
+ - Assign AC ID: `{FeatureCode}-AC{N}`
47
+ - Assign Priority: P0 (Must), P1 (Should), P2 (Nice)
48
+
49
+ **B. Story Context:**
50
+ - Story Summary: As a [user], I want [action] so that [benefit]
51
+ - Scope: What's being tested
52
+ - Out of Scope: What's NOT tested
53
+ - Dependencies: APIs, mocks, upstream features
54
+ - Test Strategy: Manual → Automation
55
+
56
+ ### Step 3: Map Checklist to Test Cases
57
+
58
+ For each test point in checklist, create corresponding test case:
59
+
60
+ **From Checklist Category Test Type Mapping:**
61
+ - GUI & UX UI/UX test cases
62
+ - Validation → Happy Path + Negative test cases
63
+ - Business Logic → Happy Path + Edge Case test cases
64
+ - Exception Handling Negative test cases
65
+ - Security Security test cases
66
+ - Performance Performance test cases
67
+ - Integration → Happy Path + Edge Case test cases
68
+
69
+ **For each test point, determine:**
70
+ - **Autoable:**
71
+ - `Yes` - if validation, logic, API call (automatable)
72
+ - `None` - if visual, exploratory, subjective (human-only)
73
+ - **Priority:**
74
+ - P0 - Core business logic, security, critical validations
75
+ - P1 - Important business rules, error handling
76
+ - P2 - UI/UX, minor validations
77
+ - **Test Data:**
78
+ - If Autoable=Yes: `data_test_S{STORY_ID}.json#case_{NNN}`
79
+ - If Autoable=None: Describe inline data
80
+
81
+ ### Step 4: Generate Test Case Sections
82
+
83
+ Create test cases organized by type:
84
+
85
+ #### 4.1 Happy Path Test Cases
86
+ - At least 1 per AC (P0 requirement)
87
+ - Focus on successful user flows
88
+ - Main business scenarios
89
+
90
+ #### 4.2 Negative / Error Test Cases
91
+ - Invalid inputs, error scenarios
92
+ - Missing required fields
93
+ - Boundary violations
94
+
95
+ #### 4.3 Edge Case / Boundary Test Cases
96
+ - Max/min values
97
+ - Empty/null conditions
98
+ - Concurrent operations
99
+
100
+ #### 4.4 Permission / Role-Based Test Cases
101
+ - Different user roles
102
+ - Access control
103
+ - Authorization checks
104
+
105
+ #### 4.5 UI / UX & Responsive Test Cases
106
+ - Visual verification
107
+ - Responsive layout
108
+ - Accessibility checks
109
+
110
+ **TC ID Format:** `{Epic_ID}-{Feature_ID}-{Story_ID}-{AC_ID}-{sequence}`
111
+
112
+ **For each TC, provide:**
113
+ - Pre-Condition (system state before test)
114
+ - Logical Steps (Given/When/Then format)
115
+ - Test Data (JSON reference or inline)
116
+ - Expected Result (specific, verifiable)
117
+ - Autoable flag
118
+ - Traceability to AC
119
+
120
+ ### Step 5: Fill Frontmatter and Metadata
121
+
122
+ ```yaml
123
+ created_date: {YYYY-MM-DD}
124
+ updated_date: {YYYY-MM-DD}
125
+ executor: {Current user or placeholder}
126
+ reviewer: {Placeholder}
127
+ status: Draft
128
+ story_id: {Extracted from Feature}
129
+ feature_id: {Extracted from Feature}
130
+ epic_id: {Extracted from Feature}
131
+ platform: {web | mobile | backend}
132
+ tags: [functional, {feature_name}]
133
+ locator_ref: /docs/NAMING_CONVENTION.md
134
+ ver: 1.0
135
+ ```
136
+
137
+ ### Step 6: Generate Coverage Matrix
138
+
139
+ **Requirement Coverage Matrix:**
140
+ - Map each AC to covering TC IDs
141
+ - Calculate coverage % (ACs with at least 1 TC)
142
+ - Target: 100% AC coverage
143
+
144
+ **Test Run Summary:**
145
+ - Total TCs by priority
146
+ - Pass/Fail/Blocked counts (initially all "— Not Run")
147
+
148
+ ### Step 7: Generate Risk & Assumption Log
149
+
150
+ Identify 3-5 key risks:
151
+ - API stability
152
+ - Test data availability
153
+ - Environment configuration
154
+ - Feature flags
155
+ - Third-party dependencies
156
+
157
+ ### Step 8: Write Output File
158
+
159
+ Create file: `{FeatureCode}-FuncTest-Spec.md`
160
+
161
+ Fill template with:
162
+ - Frontmatter
163
+ - Story Context
164
+ - Environment Matrix (keep default, customize if needed)
165
+ - AC Summary
166
+ - Test Cases (all sections)
167
+ - Coverage Matrix
168
+ - Risk Log
169
+ - Change Log
170
+
171
+ ### Step 9: Output Summary
172
+
173
+ Report to user:
174
+ ```
175
+ ✓ Functional Test Spec created: {filename}
176
+
177
+ Summary:
178
+ ├─ Total ACs: {count}
179
+ ├─ Total Test Cases: {count}
180
+ │ ├─ Happy Path: {count}
181
+ │ ├─ Negative: {count}
182
+ │ ├─ Edge Case: {count}
183
+ │ ├─ Permission: {count}
184
+ │ └─ UI/UX: {count}
185
+ ├─ Automatable: {count} ({percent}%)
186
+ └─ Manual Only: {count} ({percent}%)
187
+
188
+ Priority Breakdown:
189
+ ├─ P0 (Critical): {count}
190
+ ├─ P1 (High): {count}
191
+ └─ P2 (Medium): {count}
192
+
193
+ AC Coverage: {percent}%
194
+ Target: 100%
195
+
196
+ Next Steps:
197
+ 1. Review test cases with team
198
+ 2. Create test data JSON files
199
+ 3. Implement automation for Autoable=Yes cases
200
+ 4. Update Execution Locators using QC Agent UI Mapping
201
+ ```
202
+
203
+ ## Important Notes
204
+
205
+ 1. **One AC → Multiple TCs:** Each AC should have happy path + negative cases
206
+ 2. **Traceability:** Every TC must link to an AC ID
207
+ 3. **Automation Ready:** Mark Autoable=Yes for all non-visual tests
208
+ 4. **Test Data External:** Don't inline test data for automatable tests
209
+ 5. **Human-Only Tests:** Visual/UX checks should have Autoable=None
210
+ 6. **Specific Expected Results:** Must be verifiable, not subjective
211
+
212
+ ## Error Handling
213
+
214
+ - No Feature found: "No Feature document found. Run in feature directory or specify: /tas-functest <feature-file>"
215
+ - No Checklist found: "Warning: No Test Checklist found. Will generate based on Feature document only."
216
+ - Template missing: "Error: Func-Test-Spec.md template not found in .tas/templates/"
217
+ - No ACs in Feature: "Error: Feature document has no Acceptance Criteria. Cannot generate test spec."
218
+
219
+ ## Best Practices
220
+
221
+ 1. **Follow 5W1H:** Each test case should answer What, When, Why, How
222
+ 2. **Independent Tests:** Each TC should be executable independently
223
+ 3. **Cleanup:** Include cleanup steps if TC modifies system state
224
+ 4. **Data Isolation:** Each TC should use unique test data
225
+ 5. **Reproducible:** Steps should be detailed enough for any QC to execute
@@ -1,17 +1,22 @@
1
- # /tas-init
2
-
3
- Initialize TAS kit for the current project.
4
-
5
- ## Actions
6
- 1. Need context from root/tas.yaml. If not exists, copy from .tas/tas-example.yaml to root and ask user to fill required information.
7
- 2. Create directory structure: .tas/templates/, docs/, docs/adr/, docs/epics/, docs/bugs/, docs/ref/
8
- 3. Create root/project-status.yaml file with initial state (artifacts, epics, adrs all empty).
9
- 4. Copy default templates to .tas/templates/ if not exist.
10
- 5. If project type is brownfield and codebase_scan_on_init = true:
11
- - Scan existing codebase
12
- - Create docs/codebase-overview.md summarizing current architecture
13
- 6. Display status: project type, team roles, enabled workflow phases.
14
-
15
- ## Notes
16
- - DO NOT recreate files if already exist
17
- - Ask for confirmation before executing
1
+ ---
2
+ model: sonnet
3
+ ---
4
+
5
+ # /tas-init
6
+
7
+ Initialize TAS kit for the current project.
8
+
9
+ ## Actions
10
+ 1. Need context from root/`tas.yaml`. If absent, copy from `.tas/tas-example.yaml` to root, ask user to fill required info.
11
+ 2. Create directory structure: `.tas/templates/`, `docs/`, `docs/adr/`, `docs/features/`, `docs/bugs/`, `docs/ref/`
12
+ 3. Create root/`project-status.yaml` from `.tas/project-status-example.yaml` (flat `features` map; no `epics`/`stories` nesting).
13
+ 4. Copy default templates to `.tas/templates/` if missing.
14
+ 5. If project type is `brownfield` and `codebase_scan_on_init = true`:
15
+ - Scan existing codebase
16
+ - Create `docs/codebase-overview.md` summarizing current architecture
17
+ 6. Display status: project type, team roles, enabled workflow phases.
18
+
19
+ ## Notes
20
+ - DO NOT recreate files if they already exist
21
+ - Ask for confirmation before executing
22
+ - Migrating from a previous kit version that had `docs/epics/`? See migration note in repo CHANGELOG — flatten manually (move `docs/epics/*/Feature-*/Feature-*.md` → `docs/features/{CODE}-Feature-{NNN}-{slug}/`).
@@ -0,0 +1,300 @@
1
+ ---
2
+ model: opus
3
+ ---
4
+
5
+ # /tas-master-plan $ARGUMENTS
6
+
7
+ Role: Tech Lead — Master Plan Architect
8
+ Generate full project execution plan from PRD FRs: propose scaffold Features, order all Features into dependency tracks, write machine-readable plan. Orchestration Agent reads this plan to auto-execute via `/tas-dev`.
9
+
10
+ **Scope:** Planning only — reads PRD FRs, proposes scaffolds, writes plan file.
11
+ **Out of scope:** Writing business Feature content (that's `/tas-feature`), coding, testing.
12
+
13
+ ## Always / Ask / Never
14
+
15
+ | | Action |
16
+ |---|---|
17
+ | **Always** | Read PRD FR list as source of truth — not `docs/features/` |
18
+ | **Always** | Propose one scaffold Feature per stack before business Features |
19
+ | **Always** | Order tracks by SAD dependency: `service` → `integration` → `web` → `app` |
20
+ | **Always** | Write YAML plan block in `docs/master-plan.md` for Orchestration Agent |
21
+ | **Always** | Sync plan to root/`project-status.yaml` under `master_plan` key |
22
+ | **Always** | On resume: read root/`project-status.yaml` to skip `done` Features — never re-run completed work |
23
+ | **Never** | Plan Features not in PRD without PE approval |
24
+ | **Never** | Skip scaffold phase |
25
+ | **Never** | Assign Feature IDs without scanning `docs/features/` for existing max NNN |
26
+
27
+ ## Prerequisites
28
+ - `tas.yaml` at project root
29
+ - `docs/prd.md` with FR list
30
+ - SAD file (path from `tas.yaml` or `docs/sad.md`) — for stack/dependency info
31
+
32
+ ## Steps
33
+
34
+ ### CREATE mode (no existing master plan)
35
+
36
+ **Step 1 — Read context**
37
+ - Read `project.code` from `tas.yaml`
38
+ - Read `docs/prd.md` — extract full FR list: ID, title, brief description
39
+ - Read SAD — extract stacks present + dependency order between stacks
40
+ - Read root/`project-status.yaml` — check for existing `master_plan` key
41
+
42
+ If `master_plan` key exists with `status: in_progress` → announce resume mode and go to **RESUME mode** below.
43
+
44
+ **Step 2 — Scaffold proposal**
45
+
46
+ For each stack found in SAD (`service` → `integration` → `web` → `app`, only stacks present), propose one scaffold Feature.
47
+
48
+ Show in-conversation:
49
+ ```
50
+ Scaffold Features (Phase 1 — blocking — must complete before business Features in each track):
51
+
52
+ [ ] scaffold-service Service foundation: DI, DB setup, error handling, logging, auth middleware base
53
+ [ ] scaffold-web Web foundation: routing, DI, error handling, API client base, logging
54
+ [ ] scaffold-app App foundation: navigation, DI, error handling, theme, logging
55
+
56
+ Approve all scaffolds? (yes / customize / skip)
57
+ ```
58
+ - Approved → Step 3
59
+ - Customize → adjust list, then Step 3
60
+ - Skip → warn: "⚠️ Scaffold features skipped. Foundation setup must be handled manually before coding." → Step 4
61
+
62
+ **Step 3 — Create scaffold Feature docs (inline)**
63
+
64
+ For each approved scaffold:
65
+ - Scan `docs/features/` for max existing NNN → assign next sequential IDs (scaffold Features first)
66
+ - Create `docs/features/{CODE}-Feature-{NNN}-scaffold-{stack}/`
67
+ - Create Feature file using `.tas/templates/Feature.md`
68
+ - Fill content using **Scaffold Content Guide** (section below)
69
+ - Add each scaffold Feature to `project-status.yaml` per `.tas/rules/common/project-status.md`
70
+
71
+ **Step 4 — Map FRs to Feature IDs and stacks**
72
+
73
+ For each FR in PRD:
74
+ - Infer which stacks it touches (cross-reference SAD layer responsibilities)
75
+ - Assign tentative Feature ID (continuing from scaffold max NNN + 1)
76
+ - Note inter-FR dependencies (e.g., auth FR must precede profile FR)
77
+ - Primary stack = the stack owning the core logic of this FR
78
+
79
+ Result: ordered list of `{Feature-ID, FR-title, primary-stack, touches-stacks[], depends-on[]}`
80
+
81
+ **Step 5 — Build execution tracks**
82
+
83
+ Group Features by primary stack → one track per stack. Within each track, assign stages (each stage = one execution wave — all Features in a stage can start simultaneously):
84
+
85
+ - **Stage 1 — blocking**: scaffold Feature only. No other Feature in track starts until scaffold is `done`.
86
+ - **Stage N — sequential**: single Feature with dependency on previous stage outcome. One Feature per stage.
87
+ - **Stage N — parallel**: multiple Features with no dependencies on each other, but all depend on previous stage. Orchestration Agent batches by `max_parallel`.
88
+
89
+ Rule: if Feature A and Feature B both depend only on Stage N-1, they belong in the same stage. If Feature B depends on Feature A, they belong in separate sequential stages.
90
+
91
+ Cross-track dependencies (e.g., web Feature depends on service auth Feature): mark as `depends_on: [Feature-NNN]` — Orchestration Agent enforces before spawning.
92
+
93
+ **Step 6 — Write `docs/master-plan.md`**
94
+
95
+ ```markdown
96
+ # Master Plan — {CODE}
97
+
98
+ _Generated: {date} | Status: ready_
99
+
100
+ ## Overview
101
+ {N} FRs → {N} Features across {N} tracks: service, web, app
102
+
103
+ ## Tracks
104
+
105
+ ### Track: service
106
+ **Stage 1 [blocking]:** Feature-001 scaffold-service
107
+ **Stage 2 [sequential]:** Feature-003 auth
108
+ **Stage 3 [sequential]:** Feature-005 user-management
109
+ **Stage 4 [parallel]:** Feature-007 notifications | Feature-008 audit-log
110
+
111
+ ### Track: web
112
+ ...
113
+
114
+ ## Execution Plan
115
+
116
+ ```yaml
117
+ tracks:
118
+ service:
119
+ stages:
120
+ - stage: 1
121
+ type: blocking
122
+ features:
123
+ - id: Feature-001
124
+ slug: scaffold-service
125
+ depends_on: []
126
+ status: pending
127
+ - stage: 2
128
+ type: sequential
129
+ features:
130
+ - id: Feature-003
131
+ slug: auth
132
+ depends_on: [Feature-001]
133
+ status: pending
134
+ - stage: 3
135
+ type: sequential
136
+ features:
137
+ - id: Feature-005
138
+ slug: user-management
139
+ depends_on: [Feature-003]
140
+ status: pending
141
+ - stage: 4
142
+ type: parallel
143
+ features:
144
+ - id: Feature-007
145
+ slug: notifications
146
+ depends_on: [Feature-003]
147
+ status: pending
148
+ - id: Feature-008
149
+ slug: audit-log
150
+ depends_on: [Feature-003]
151
+ status: pending
152
+ web:
153
+ stages:
154
+ - stage: 1
155
+ type: blocking
156
+ features:
157
+ - id: Feature-002
158
+ slug: scaffold-web
159
+ depends_on: []
160
+ status: pending
161
+ - stage: 2
162
+ type: parallel
163
+ features:
164
+ - id: Feature-004
165
+ slug: login-ui
166
+ depends_on: [Feature-002, Feature-003]
167
+ status: pending
168
+ ```
169
+
170
+ **Step 7 — Update `project-status.yaml`**
171
+
172
+ Add `master_plan` key:
173
+ ```yaml
174
+ master_plan:
175
+ file: docs/master-plan.md
176
+ status: ready # ready | in_progress | completed
177
+ last_updated: YYYY-MM-DD
178
+ tracks:
179
+ service:
180
+ current_stage: 1
181
+ stages:
182
+ 1:
183
+ type: blocking
184
+ status: pending # pending | in_progress | done
185
+ features:
186
+ Feature-001: pending # pending | in_progress | done | blocked | error
187
+ 2:
188
+ type: sequential
189
+ status: pending
190
+ features:
191
+ Feature-003: pending
192
+ 3:
193
+ type: sequential
194
+ status: pending
195
+ features:
196
+ Feature-005: pending
197
+ 4:
198
+ type: parallel
199
+ status: pending
200
+ features:
201
+ Feature-007: pending
202
+ Feature-008: pending
203
+ web:
204
+ current_stage: 1
205
+ stages:
206
+ 1:
207
+ type: blocking
208
+ status: pending
209
+ features:
210
+ Feature-002: pending
211
+ ```
212
+
213
+ **Step 8 — Notify**
214
+ > "Master plan ready at `docs/master-plan.md`.
215
+ > - Execute automatically: run Orchestration Agent (`/orchestrate` or start agent `orchestrator`)
216
+ > - Execute manually: follow track order in master plan, run `/tas-plan {Feature-ID}` then `/tas-dev {Feature-ID}` per Feature"
217
+
218
+ ---
219
+
220
+ ### RESUME mode (existing master plan with `status: in_progress`)
221
+
222
+ 1. Read `docs/master-plan.md` YAML block — load tracks and stages
223
+ 2. Read `project-status.yaml` `master_plan.tracks` — load current Feature statuses
224
+ 3. Show resume summary:
225
+ ```
226
+ Resuming master plan.
227
+ ✅ Done: Feature-001, Feature-003
228
+ ⏳ In progress: Feature-005
229
+ ⏸ Pending: Feature-007, Feature-008, Feature-002, Feature-004
230
+ ```
231
+ 4. Update `project-status.yaml`: `master_plan.status: in_progress`
232
+ 5. Notify:
233
+ > "Resume from current state — run Orchestration Agent to continue auto-execution, or proceed manually."
234
+
235
+ ---
236
+
237
+ ### AMEND mode (invoked after ad-hoc Feature creation)
238
+
239
+ Triggered when called with `AMEND` argument, or invoked inline by `/tas-feature`.
240
+
241
+ **Step 1 — Read current plan state**
242
+ - Read `docs/master-plan.md` YAML block — load existing tracks, stages, Feature IDs, stacks, and depends_on
243
+ - Read `project-status.yaml` — get `master_plan.status` and all Feature statuses in `master_plan.tracks`
244
+ - Read SAD — confirm stack dependency order
245
+
246
+ **Step 2 — Collect unplanned Features**
247
+ - Scan `docs/features/` directory names → extract Feature IDs from folder names
248
+ - Compare against Feature IDs already in `master-plan.md` YAML block
249
+ - Collect IDs not yet in plan → these are new unplanned Features
250
+ - Read **only those new Feature files** — extract primary stack and AC for dependency inference
251
+ - Do NOT re-read all Feature files — `master-plan.md` already has full context for planned Features
252
+
253
+ **Step 3 — Determine case and re-plan**
254
+
255
+ **Case A — Plan not started** (`master_plan.status: pending` or `ready`):
256
+ - Collect ALL Features: existing pending + new unplanned
257
+ - Re-sort by SAD dependency + inter-feature dependencies (same ordering logic as CREATE Step 5)
258
+ - Rewrite full `docs/master-plan.md` YAML block
259
+ - Rebuild `project-status.yaml` `master_plan.tracks` from re-sorted plan
260
+
261
+ **Case B — Plan in progress** (`master_plan.status: in_progress`):
262
+ - Lock `done` and `in_progress` Features in place — do not move them
263
+ - Collect all `pending` Features + new unplanned Features
264
+ - Re-sort pending group by SAD dependency + inter-feature dependencies
265
+ - Determine insertion point per stack track based on primary stack of each new Feature
266
+ - Append new stage(s) or merge into existing pending stages where dependency allows
267
+ - Update `docs/master-plan.md` — replace pending stages sections only
268
+ - Update `project-status.yaml` `master_plan.tracks` for affected tracks only
269
+
270
+ **Step 4 — Report result**
271
+ ```
272
+ Master plan updated (AMEND):
273
+ + Added: Feature-{NNN} → Track: {stack}, Stage: {N} (depends_on: Feature-{X})
274
+ Pending re-sorted: {N} features across {N} tracks
275
+ ```
276
+ Return to caller — do not end turn.
277
+
278
+ ---
279
+
280
+ ## Scaffold Content Guide
281
+
282
+ When filling scaffold Feature docs in Step 3:
283
+
284
+ **Description**: "[Stack] layer foundation — base project structure and cross-cutting concerns"
285
+ **User Story**: "As a developer, I want a stable [stack] foundation, so that all business features share consistent structure and patterns"
286
+ **Actor**: Development team
287
+ **Foundation Concerns** (replaces Business Flow) — ask PE via `AskUserQuestion` multiSelect:
288
+ > "Which foundation concerns for [stack]?"
289
+ Options: `DI container setup` / `Error handling pattern` / `Logging framework` / `Auth middleware base` / `Base configs (env, secrets)` / `Folder/module structure` / `Database connection` / `API client base`
290
+
291
+ **Foundation Rules** (replaces Business Rules): patterns all business Features in [stack] must follow — naming, error shape, log format, auth contract
292
+ **UI/UX Rules**: skip for `service`/`integration`; ask for `web`/`app`
293
+ **NFR**: performance baselines, security baseline applicable across all Features in stack
294
+ **AC** (Given/When/Then): one AC per selected Foundation Concern. Examples:
295
+ - "Given app starts, When any unhandled exception occurs, Then error handler returns `{error, message, traceId}` shape"
296
+ - "Given any request, When response is 401, Then auth middleware redirects to login"
297
+
298
+ ## Final Step — Token Log
299
+
300
+ Follow `.tas/rules/common/token-logging.md`: write AI Usage Log to `docs/master-plan.md`.