feature-loop-harness-cli 0.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 (40) hide show
  1. package/README.md +53 -0
  2. package/bin/flh.js +391 -0
  3. package/package.json +29 -0
  4. package/templates/default/.codex/config.toml +2 -0
  5. package/templates/default/.codex/hooks/user-prompt-submit.sh +5 -0
  6. package/templates/default/.codex/hooks.json +16 -0
  7. package/templates/default/.flh/docs/FEATURE_IMPLEMENTATION_PIPELINE.md +454 -0
  8. package/templates/default/.flh/docs/PROJECT_WORKFLOW.md +270 -0
  9. package/templates/default/.flh/docs/REVIEW_PATCH_PIPELINE.md +166 -0
  10. package/templates/default/.flh/hooks/user_prompt_submit.py +1440 -0
  11. package/templates/default/.flh/runtime/STATE.md +84 -0
  12. package/templates/default/.flh/scripts/pre_commit.py +674 -0
  13. package/templates/default/.flh/workflow/docs-spec.yml +134 -0
  14. package/templates/default/.flh/workflow/flow.yml +82 -0
  15. package/templates/default/.flh/workflow/request-patterns.yml +265 -0
  16. package/templates/default/.flh/workflow/state-actions.yml +117 -0
  17. package/templates/default/.flh/workflow/transition-guards.yml +57 -0
  18. package/templates/default/.husky/pre-commit +3 -0
  19. package/templates/default/AGENTS.md +44 -0
  20. package/templates/default/HARNESS_MANUAL.md +1105 -0
  21. package/templates/default/README.md +251 -0
  22. package/templates/default/docs/API.md +41 -0
  23. package/templates/default/docs/ARCHITECTURE.md +86 -0
  24. package/templates/default/docs/DB_SCHEMA.md +149 -0
  25. package/templates/default/docs/DESIGN.md +52 -0
  26. package/templates/default/docs/MVP.md +47 -0
  27. package/templates/default/docs/QUALITY_SCORE.md +54 -0
  28. package/templates/default/docs/docs-map.md +64 -0
  29. package/templates/default/docs/features/active/.gitkeep +1 -0
  30. package/templates/default/docs/features/backlog/.gitkeep +1 -0
  31. package/templates/default/docs/features/blocked/.gitkeep +1 -0
  32. package/templates/default/docs/features/done/.gitkeep +1 -0
  33. package/templates/default/docs/features/feature-index.md +21 -0
  34. package/templates/default/docs/features/postponed/.gitkeep +1 -0
  35. package/templates/default/docs/features/ready/.gitkeep +1 -0
  36. package/templates/default/docs/features/review/.gitkeep +1 -0
  37. package/templates/default/docs/source-layout.yml +33 -0
  38. package/templates/default/gitignore.template +9 -0
  39. package/templates/default/tests/hooks/test_pre_commit.py +659 -0
  40. package/templates/default/tests/hooks/test_user_prompt_submit.py +750 -0
@@ -0,0 +1,134 @@
1
+ version: 1
2
+
3
+ defaults:
4
+ required_status: completed
5
+ forbidden_tokens:
6
+ - "{{TODO"
7
+ - "TODO"
8
+ - "TBD"
9
+ - "PLACEHOLDER"
10
+ min_section_chars: 40
11
+
12
+ documents:
13
+ mvp:
14
+ path: docs/MVP.md
15
+ purpose: "Template completed by the actual project to define MVP scope."
16
+ required_sections:
17
+ - "MVP Goal"
18
+ - "Target Users"
19
+ - "Core Problem"
20
+ - "In Scope"
21
+ - "Out of Scope"
22
+ - "Success Criteria"
23
+
24
+ architecture:
25
+ path: docs/ARCHITECTURE.md
26
+ purpose: "Template completed by the actual project to define system architecture."
27
+ required_sections:
28
+ - "System Overview"
29
+ - "Tech Stack"
30
+ - "Source Layout"
31
+ - "Package Layout"
32
+ - "Testing Strategy"
33
+ - "Modules"
34
+ - "Data Flow"
35
+ - "External Dependencies"
36
+ - "Runtime Environment"
37
+ - "Scaffold Policy"
38
+ - "Constraints"
39
+
40
+ source_layout:
41
+ path: docs/source-layout.yml
42
+ format: yaml
43
+ purpose: "Machine-readable source layout manifest generated during architecture design."
44
+ required_status: completed
45
+ required_yaml_fields:
46
+ - project.type
47
+ - project.package_manager
48
+ - project.workspace
49
+ - project.runtime
50
+ - project.persistence.database_required
51
+ - project.persistence.database_provider
52
+ - source_roots
53
+ required_yaml_mapping: source_roots
54
+ required_yaml_mapping_item_fields:
55
+ - path
56
+ - role
57
+ - package
58
+ - stack
59
+ - framework
60
+ - runtime
61
+ - language
62
+ - module
63
+ - testing
64
+ - tooling
65
+ - scaffold
66
+ - description
67
+
68
+ feature_index:
69
+ path: docs/features/feature-index.md
70
+ purpose: "Template completed by the actual project to list feature candidates and priorities."
71
+ required_sections:
72
+ - "Feature Index"
73
+ - "Feature List"
74
+ required_item_fields:
75
+ - "Feature ID"
76
+ - "Name"
77
+ - "Summary"
78
+ - "Priority"
79
+ - "Core Requirements"
80
+
81
+ db_schema:
82
+ path: docs/DB_SCHEMA.md
83
+ purpose: "Template completed by the actual project to define a Prisma-ready data model baseline."
84
+ required_sections:
85
+ - "Core Entities"
86
+ - "Entity Specifications"
87
+ - "Relation Specifications"
88
+ - "Indexes and Constraints"
89
+ - "Enums"
90
+ - "Ownership and Permissions"
91
+ - "ID Strategy"
92
+ - "Lifecycle Policy"
93
+ - "Common Field Policy"
94
+ - "Prisma Mapping Notes"
95
+ - "Migration Notes"
96
+
97
+ api:
98
+ path: docs/API.md
99
+ purpose: "Template completed by the actual project to define API boundaries."
100
+ required_sections:
101
+ - "API Areas"
102
+ - "Endpoint Draft"
103
+ - "Authentication and Authorization"
104
+ - "Request and Response Rules"
105
+ - "Error Response Rules"
106
+
107
+ design:
108
+ path: docs/DESIGN.md
109
+ purpose: "Design guideline file for the actual project. It may be authored in this workflow or imported from an external source and approved in STATE.md."
110
+ required_sections:
111
+ - "Layout Principles"
112
+ - "Component Principles"
113
+ - "State Loading and Error"
114
+ - "Form Rules"
115
+ - "Responsive Rules"
116
+ - "Accessibility"
117
+
118
+ feature_implementation_pipeline:
119
+ path: .flh/docs/FEATURE_IMPLEMENTATION_PIPELINE.md
120
+ purpose: "Harness operation document for feature-level implementation."
121
+ required_status: completed
122
+ required_sections:
123
+ - "Overview"
124
+ - "Feature State Directories"
125
+ - "0. Preparation"
126
+ - "1. Design"
127
+ - "1.5. Source Package Scaffold Baseline"
128
+ - "1.6. Baseline DB Deployment"
129
+ - "2. Branch and Worktree"
130
+ - "3. Implementation and Tests"
131
+ - "4. Verification"
132
+ - "Quality Scoring"
133
+ - "5. Feedback Loop"
134
+ - "6. Commit Merge and Cleanup"
@@ -0,0 +1,82 @@
1
+ version: 1
2
+
3
+ initial_state: MVP_DEFINITION
4
+
5
+ states:
6
+ MVP_DEFINITION:
7
+ description: "Define the actual project's MVP using docs/MVP.md."
8
+ allowed_request_types:
9
+ - MVP_DESIGN_REQUEST
10
+ - STATE_STATUS_REQUEST
11
+ - STATE_TRANSITION_REQUEST
12
+ - UNKNOWN
13
+ next_states:
14
+ - ARCHITECTURE_DESIGN
15
+
16
+ ARCHITECTURE_DESIGN:
17
+ description: "Define the actual project's system architecture and source layout using docs/ARCHITECTURE.md and docs/source-layout.yml."
18
+ allowed_request_types:
19
+ - ARCHITECTURE_DESIGN_REQUEST
20
+ - STATE_STATUS_REQUEST
21
+ - STATE_TRANSITION_REQUEST
22
+ - UNKNOWN
23
+ next_states:
24
+ - FEATURE_INDEX_DEFINITION
25
+
26
+ FEATURE_INDEX_DEFINITION:
27
+ description: "Define the actual project's feature index using docs/features/feature-index.md."
28
+ allowed_request_types:
29
+ - FEATURE_INDEX_REQUEST
30
+ - STATE_STATUS_REQUEST
31
+ - STATE_TRANSITION_REQUEST
32
+ - UNKNOWN
33
+ next_states:
34
+ - DATA_MODEL_DEFINITION
35
+
36
+ DATA_MODEL_DEFINITION:
37
+ description: "Define the actual project's Prisma-ready data model baseline in docs/DB_SCHEMA.md without creating Prisma files."
38
+ allowed_request_types:
39
+ - DATA_MODEL_DESIGN_REQUEST
40
+ - PRISMA_BASELINE_CREATE_REQUEST
41
+ - STATE_STATUS_REQUEST
42
+ - STATE_TRANSITION_REQUEST
43
+ - UNKNOWN
44
+ next_states:
45
+ - API_DESIGN
46
+
47
+ API_DESIGN:
48
+ description: "Define the actual project's API boundaries using docs/API.md."
49
+ allowed_request_types:
50
+ - API_DESIGN_REQUEST
51
+ - STATE_STATUS_REQUEST
52
+ - STATE_TRANSITION_REQUEST
53
+ - UNKNOWN
54
+ next_states:
55
+ - FRONTEND_DESIGN
56
+
57
+ FRONTEND_DESIGN:
58
+ description: "Confirm the actual project's design guide using docs/DESIGN.md or STATE approvals.design."
59
+ allowed_request_types:
60
+ - FRONTEND_DESIGN_REQUEST
61
+ - STATE_STATUS_REQUEST
62
+ - STATE_TRANSITION_REQUEST
63
+ - UNKNOWN
64
+ next_states:
65
+ - FEATURE_IMPLEMENTATION
66
+
67
+ FEATURE_IMPLEMENTATION:
68
+ description: "Run feature-level implementation using .flh/docs/FEATURE_IMPLEMENTATION_PIPELINE.md."
69
+ allowed_request_types:
70
+ - FEATURE_PREPARE_REQUEST
71
+ - FEATURE_DESIGN_REQUEST
72
+ - IMPLEMENTATION_REQUEST
73
+ - TEST_REQUEST
74
+ - COMMIT_REQUEST
75
+ - STATE_STATUS_REQUEST
76
+ - UNKNOWN
77
+ next_states: []
78
+
79
+ unknown_request_policy:
80
+ allow_without_state_transition: true
81
+ allowed_behavior: "Answer explanation, analysis, status, and documentation requests. File changes are limited by AGENTS.md."
82
+ forbidden_behavior: "Do not modify app/src/apps code, create tests, run implementation pipeline, commit, or update STATE.md."
@@ -0,0 +1,265 @@
1
+ version: 1
2
+
3
+ # Hook-level bypass patterns.
4
+ # These are evaluated before workflow request patterns.
5
+ # Pure question/confirmation prompts are treated as non-mutating requests.
6
+ # If a prompt also contains another workflow intent, the hook treats it as low confidence.
7
+ question_or_confirmation_patterns:
8
+ - \?
9
+ - 맞아\??$
10
+ - 맞나\??$
11
+ - 되나\??$
12
+ - 되는거지\??$
13
+ - 하면 되는거지\??$
14
+ - 해야 하나\??$
15
+ - 해도 돼\??$
16
+ - 괜찮아\??$
17
+ - "어떻게 생각"
18
+ - "어때"
19
+ - "맞을까"
20
+ - "좋을까"
21
+ - 수정하면 되는거지\??$
22
+ - 바꾸면 되는거지\??$
23
+ - 진행하면 되는거지\??$
24
+
25
+ patterns:
26
+ PRISMA_BASELINE_CREATE_REQUEST:
27
+ strong:
28
+ - prisma.*baseline
29
+ - baseline.*prisma
30
+ - schema\.prisma
31
+ - 프리즈마.*베이스라인
32
+ - 프리즈마.*생성
33
+ - prisma.*생성
34
+ aliases:
35
+ - Prisma.*baseline.*만들
36
+ - schema\.prisma.*생성
37
+ - Prisma.*초기.*스키마
38
+ - Prisma.*모델.*생성
39
+ - DB.*baseline.*생성
40
+ - 초기.*migration
41
+ - baseline.*migration
42
+ - Prisma.*migration.*준비
43
+
44
+ IMPLEMENTATION_REQUEST:
45
+ strong:
46
+ - 구현해
47
+ - 코드.*작성
48
+ - 컴포넌트.*만들
49
+ - api.*구현
50
+ - 파일.*수정
51
+ - 앱.*수정
52
+ - 작업.*진행
53
+ aliases:
54
+ - 이.*기능.*구현
55
+ - 개발.*시작
56
+ - 코드.*반영
57
+ - 실제.*코드.*작성
58
+ - 앱.*반영
59
+ - 기능.*붙
60
+ - 화면.*만들
61
+ - API.*만들
62
+ - 컴포넌트.*만들
63
+ - 로직.*작성
64
+ - 수정.*반영
65
+
66
+ TEST_REQUEST:
67
+ strong:
68
+ - 테스트.*작성
69
+ - 테스트.*실행
70
+ - e2e
71
+ - unit test
72
+ - 유닛
73
+ aliases:
74
+ - 테스트.*만들
75
+ - 테스트.*추가
76
+ - 검증해
77
+ - 테스트.*돌
78
+ - E2E.*만들
79
+ - 유닛.*테스트.*만들
80
+ - 통합.*테스트.*작성
81
+ - 테스트.*케이스.*코드
82
+
83
+ COMMIT_REQUEST:
84
+ strong:
85
+ - 커밋
86
+ - commit
87
+ - push
88
+ - 푸쉬
89
+ - merge
90
+ - 머지
91
+ aliases:
92
+ - PR.*만들
93
+ - 브랜치.*정리
94
+ - 작업.*마무리
95
+ - 후처리.*진행
96
+ - 변경사항.*올
97
+
98
+ FEATURE_PREPARE_REQUEST:
99
+ strong:
100
+ - 기능.*준비
101
+ - feature.*prepare
102
+ - backlog
103
+ - 기능.*디렉토리.*생성
104
+ aliases:
105
+ - 이.*기능.*준비
106
+ - 기능.*작업.*준비
107
+ - 기능.*문서.*공간
108
+ - feature.*workspace
109
+ - 작업.*대상.*올
110
+ - 기능.*ready
111
+ - feature-index.*추가.*준비
112
+
113
+ FEATURE_DESIGN_REQUEST:
114
+ strong:
115
+ - 기능.*설계
116
+ - SPEC\.md
117
+ - CHECKLIST\.md
118
+ - TEST_CASES\.md
119
+ - 기능.*스펙
120
+ aliases:
121
+ - 이.*기능.*설계
122
+ - 기능.*스펙.*작성
123
+ - SPEC.*작성
124
+ - 체크리스트.*만들
125
+ - 테스트.*케이스.*정리
126
+ - 구현.*전.*기능.*문서
127
+ - 기능.*요구사항.*정리
128
+ - 기능.*범위.*정리
129
+ - 기능.*완료.*기준
130
+
131
+ MVP_DESIGN_REQUEST:
132
+ strong:
133
+ - \bmvp\b
134
+ - MVP
135
+ - 엠브이피
136
+ - 최소.*제품
137
+ - 최소.*범위
138
+ aliases:
139
+ - 초기.*범위.*정리
140
+ - 1차.*출시.*범위
141
+ - 핵심.*범위
142
+ - 어디까지.*만들
143
+ - 가장.*먼저.*만들
144
+ - 필수.*기능.*추
145
+ - 첫.*버전.*범위
146
+ - 프로젝트.*목표.*정리
147
+ - 타겟.*사용자.*정리
148
+ - 해결.*문제.*정리
149
+
150
+ ARCHITECTURE_DESIGN_REQUEST:
151
+ strong:
152
+ - 아키텍처
153
+ - 아키텍쳐
154
+ - architecture
155
+ - 시스템.*구조
156
+ aliases:
157
+ - 전체.*구조
158
+ - 기술.*구조
159
+ - 프로젝트.*구조
160
+ - 폴더.*구조
161
+ - 소스.*구조
162
+ - 소스.*레이아웃
163
+ - source.*layout
164
+ - 패키지.*구조
165
+ - 모듈.*구조
166
+ - 레이어.*구조
167
+ - 서비스.*구성
168
+ - 백엔드.*프론트.*연결
169
+
170
+ FEATURE_INDEX_REQUEST:
171
+ strong:
172
+ - feature-index
173
+ - 기능.*목록
174
+ - 기능.*리스트
175
+ - Feature Index
176
+ aliases:
177
+ - 필요한.*기능.*정리
178
+ - 구현할.*기능.*뽑
179
+ - 기능.*리스트업
180
+ - 기능.*우선순위
181
+ - 기능.*인덱스
182
+ - MVP.*기능.*나
183
+ - 기능.*단위.*쪼
184
+ - 작업할.*기능.*정리
185
+
186
+ DATA_MODEL_DESIGN_REQUEST:
187
+ strong:
188
+ - 데이터.*모델
189
+ - DB_SCHEMA
190
+ - ERD
191
+ - E-R
192
+ - 엔티티
193
+ - schema
194
+ aliases:
195
+ - 데이터.*구조
196
+ - 테이블.*구조
197
+ - DB.*구조
198
+ - ER.*구조
199
+ - 관계.*정의
200
+ - 스키마.*초안
201
+ - 도메인.*모델
202
+ - 저장.*데이터
203
+ - Prisma.*모델.*방향
204
+
205
+ API_DESIGN_REQUEST:
206
+ strong:
207
+ - \bAPI\b
208
+ - api
209
+ - 엔드포인트
210
+ - endpoint
211
+ aliases:
212
+ - API.*목록
213
+ - 엔드포인트.*목록
214
+ - API.*스펙
215
+ - 요청.*응답.*구조
216
+ - 라우트.*구조
217
+ - 서버.*API.*설계
218
+ - 백엔드.*API.*설계
219
+ - API.*계약
220
+
221
+ FRONTEND_DESIGN_REQUEST:
222
+ strong:
223
+ - 프론트
224
+ - frontend
225
+ - FRONTEND
226
+ - 디자인.*지침
227
+ - UI.*지침
228
+ aliases:
229
+ - 화면.*설계
230
+ - UI.*방향
231
+ - 프론트.*구조
232
+ - 화면.*흐름
233
+ - 페이지.*구성
234
+ - 사용자.*플로우
235
+ - 디자인.*가이드
236
+ - 컴포넌트.*방향
237
+ - 레이아웃.*방향
238
+
239
+ STATE_STATUS_REQUEST:
240
+ strong:
241
+ - 현재.*상태
242
+ - 진행.*상황
243
+ - 다음.*할
244
+ - 남은.*작업
245
+ - 요약
246
+ - 상태.*알려
247
+ aliases:
248
+ - 어디까지.*됐
249
+ - 현재.*단계
250
+ - 뭐.*해야
251
+ - 뭐부터.*하면
252
+ - 다음.*작업.*추천
253
+
254
+ STATE_TRANSITION_REQUEST:
255
+ strong:
256
+ - 다음.*단계
257
+ - 전이
258
+ - 상태.*변경
259
+ aliases:
260
+ - 다음.*단계.*넘어
261
+ - 단계.*변경
262
+ - 단계.*완료.*처리
263
+ - workflow.*이동
264
+ - 이.*단계.*끝
265
+ - 다음.*상태.*바
@@ -0,0 +1,117 @@
1
+ version: 1
2
+
3
+ usage:
4
+ rule: "Read only the entry for the current state."
5
+ purpose: "Short execution checklist for the active project workflow state."
6
+
7
+ states:
8
+ MVP_DEFINITION:
9
+ required_outputs:
10
+ - docs/MVP.md
11
+ actions:
12
+ - Clarify MVP goal, target users, core problem, scope, non-goals, and success criteria.
13
+ - Update docs/MVP.md.
14
+ - Mark docs/MVP.md as completed only when the MVP scope is clear.
15
+ allowed_extra_writes: []
16
+ ask_user_when:
17
+ - MVP scope is broad, conflicting, or unclear.
18
+
19
+ ARCHITECTURE_DESIGN:
20
+ required_outputs:
21
+ - docs/ARCHITECTURE.md
22
+ - docs/source-layout.yml
23
+ - source directories listed in docs/source-layout.yml
24
+ actions:
25
+ - Decide project type, package manager, runtime stack, persistence need, database provider, testing tools, and source layout.
26
+ - Use docs/source-layout.yml as the required architecture decision checklist.
27
+ - Ask the user for any missing docs/source-layout.yml fields before marking architecture completed.
28
+ - Write docs/source-layout.yml.
29
+ - Record project-level persistence.database_required and persistence.database_provider decisions in docs/source-layout.yml.
30
+ - Record package-level framework, runtime, language, module, testing, and tooling decisions in docs/source-layout.yml.
31
+ - Record project.scaffold_extra_root_files in docs/source-layout.yml only when scaffold baseline needs root files outside the default scaffold categories.
32
+ - Create only the directories listed in docs/source-layout.yml.
33
+ - Add .gitkeep to empty source directories.
34
+ - Update docs/ARCHITECTURE.md.
35
+ - Do not scaffold framework code in this state.
36
+ allowed_extra_writes:
37
+ - docs/source-layout.yml
38
+ - app/**/.gitkeep
39
+ - apps/**/.gitkeep
40
+ - packages/**/.gitkeep
41
+ ask_user_when:
42
+ - Project type, workspace policy, package manager, runtime, language, module, persistence need, database provider, or source layout is unclear.
43
+ - Unit, integration, E2E, or component testing tools are unclear.
44
+ - Lint or format tooling is unclear.
45
+ - Multiple frontend/backend/package layouts are plausible.
46
+
47
+ FEATURE_INDEX_DEFINITION:
48
+ required_outputs:
49
+ - docs/features/feature-index.md
50
+ actions:
51
+ - Derive feature candidates from MVP and architecture.
52
+ - Assign feature ID, name, summary, priority, core requirements, dependencies, and reference.
53
+ - Keep implementation status out of feature-index.md.
54
+ - Do not create feature SPEC/CHECKLIST/TEST_CASES yet.
55
+ allowed_extra_writes: []
56
+ ask_user_when:
57
+ - Feature priority or MVP fit is unclear.
58
+
59
+ DATA_MODEL_DEFINITION:
60
+ required_outputs:
61
+ - docs/DB_SCHEMA.md
62
+ actions:
63
+ - Define the project-wide data model baseline in docs/DB_SCHEMA.md.
64
+ - Make docs/DB_SCHEMA.md detailed enough to convert directly into schema.prisma during Feature Implementation 1.6.
65
+ - Define entity fields, Prisma types, DB types, nullability, defaults, uniqueness, indexes, relations, enums, constraints, ownership, ID strategy, lifecycle, common fields, Prisma mapping notes, and migration notes.
66
+ - Do not create or modify schema.prisma, Prisma migrations, package.json, or backend package files in this state.
67
+ - Do not deploy to a real DB server in this state.
68
+ allowed_extra_writes:
69
+ - docs/DB_SCHEMA.md
70
+ ask_user_when:
71
+ - Database provider, persistence need, entity ownership, relation cardinality, field nullability, index strategy, enum values, or lifecycle policy is unclear.
72
+
73
+ API_DESIGN:
74
+ required_outputs:
75
+ - docs/API.md
76
+ actions:
77
+ - Define API areas and endpoint draft.
78
+ - Define authentication, authorization, request/response, and error response rules.
79
+ - Align API design with feature-index and DB schema when they exist.
80
+ - Do not implement API routes in this state.
81
+ allowed_extra_writes: []
82
+ ask_user_when:
83
+ - API boundary, auth model, or backend responsibility is unclear.
84
+
85
+ FRONTEND_DESIGN:
86
+ required_outputs:
87
+ - docs/DESIGN.md
88
+ - or .flh/runtime/STATE.md approvals.design.approved for external design guide
89
+ actions:
90
+ - Ask whether to import an external DESIGN.md or author docs/DESIGN.md.
91
+ - If authoring, complete docs/DESIGN.md.
92
+ - If importing, confirm user approval and record non-secret design approval metadata.
93
+ - Do not implement UI in this state.
94
+ allowed_extra_writes:
95
+ - .flh/runtime/STATE.md
96
+ ask_user_when:
97
+ - Design source is unclear.
98
+ - Existing DESIGN.md does not clearly represent the project design guide.
99
+
100
+ FEATURE_IMPLEMENTATION:
101
+ required_outputs:
102
+ - feature directory under docs/features/*
103
+ actions:
104
+ - Use .flh/docs/FEATURE_IMPLEMENTATION_PIPELINE.md for the first full implementation loop.
105
+ - Do not start a new feature when docs/features/active or docs/features/review contains a feature directory.
106
+ - Verify source package scaffold baseline before creating the first feature branch/worktree.
107
+ - If source scaffold approval is missing, run Source Package Scaffold Baseline before DB deployment and feature work.
108
+ - Use AGENTS.md review rules for docs/features/review patch requests.
109
+ - Verify database baseline status after scaffold baseline and before moving the first feature to active.
110
+ allowed_extra_writes:
111
+ - controlled by AGENTS.md and FEATURE_IMPLEMENTATION_PIPELINE.md
112
+ ask_user_when:
113
+ - No feature is selected.
114
+ - active or review already contains a feature.
115
+ - source scaffold approval is missing.
116
+ - source scaffold needs more information than docs/source-layout.yml provides.
117
+ - database baseline approval is missing for a DB-backed project, or no-database skip approval is missing for a project that does not require a DB.
@@ -0,0 +1,57 @@
1
+ version: 1
2
+
3
+ transitions:
4
+ MVP_DEFINITION_TO_ARCHITECTURE_DESIGN:
5
+ from: MVP_DEFINITION
6
+ to: ARCHITECTURE_DESIGN
7
+ required_docs:
8
+ - mvp
9
+
10
+ ARCHITECTURE_DESIGN_TO_FEATURE_INDEX_DEFINITION:
11
+ from: ARCHITECTURE_DESIGN
12
+ to: FEATURE_INDEX_DEFINITION
13
+ required_docs:
14
+ - architecture
15
+ required_source_layout_directories:
16
+ - source_layout
17
+
18
+ FEATURE_INDEX_DEFINITION_TO_DATA_MODEL_DEFINITION:
19
+ from: FEATURE_INDEX_DEFINITION
20
+ to: DATA_MODEL_DEFINITION
21
+ required_docs:
22
+ - feature_index
23
+
24
+ DATA_MODEL_DEFINITION_TO_API_DESIGN:
25
+ from: DATA_MODEL_DEFINITION
26
+ to: API_DESIGN
27
+ required_docs:
28
+ - db_schema
29
+
30
+ API_DESIGN_TO_FRONTEND_DESIGN:
31
+ from: API_DESIGN
32
+ to: FRONTEND_DESIGN
33
+ required_docs:
34
+ - api
35
+
36
+ FRONTEND_DESIGN_TO_FEATURE_IMPLEMENTATION:
37
+ from: FRONTEND_DESIGN
38
+ to: FEATURE_IMPLEMENTATION
39
+ required_docs:
40
+ - feature_implementation_pipeline
41
+ required_docs_any:
42
+ - design
43
+ required_approvals_any:
44
+ - design
45
+ required_directories:
46
+ - docs/features/backlog
47
+ - docs/features/ready
48
+ - docs/features/active
49
+ - docs/features/blocked
50
+ - docs/features/review
51
+ - docs/features/done
52
+ - docs/features/postponed
53
+
54
+ guard_policy:
55
+ check_all_intermediate_transitions: true
56
+ file_existence_only_is_insufficient: true
57
+ document_completion_uses: .flh/workflow/docs-spec.yml
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env sh
2
+
3
+ python3 .flh/scripts/pre_commit.py
@@ -0,0 +1,44 @@
1
+ # AGENTS.md
2
+
3
+ ## Core Routing
4
+
5
+ - Always read `.flh/runtime/STATE.md` before choosing a workflow.
6
+ - For project workflow work, read only the current state's entry from `.flh/workflow/state-actions.yml`.
7
+ - Follow the current state's `actions`, `allowed_extra_writes`, and `ask_user_when`.
8
+ - Do not perform implementation work unless `current_state` is `FEATURE_IMPLEMENTATION`.
9
+
10
+ ## Runtime State
11
+
12
+ - Treat `.flh/runtime/STATE.md` frontmatter as the only machine-readable runtime workflow state.
13
+ - When updating `.flh/runtime/STATE.md`, preserve the Markdown body unless the user explicitly asks to change the state guide.
14
+ - When recording `approvals`, follow the approval recording guide in the Markdown body of `.flh/runtime/STATE.md`.
15
+ - Do not record secrets, API keys, tokens, passwords, or connection strings in `.flh/runtime/STATE.md`.
16
+
17
+ ## Prefix Modes
18
+
19
+ - `/q`: question mode. Answer only. Do not create, modify, delete, commit, push, merge, update state, or run workflow pipelines.
20
+ - `/d`: documentation and harness-control mode.
21
+ - `/d` may modify only documentation and harness-maintenance targets: `docs/`, `.flh/`, `AGENTS.md`, `README.md`, `.codex/`, `tests/hooks/`, `.husky/`, `package.json`, `package-lock.json`.
22
+ - When editing package scripts, test config, or lint-staged config for the harness, target source extensions only; do not include design/harness document extensions such as `md`, `yml`, or `yaml` unless explicitly requested.
23
+ - `/d` may commit or push only when the user explicitly requests it and every changed file is within the allowed documentation/harness targets.
24
+ - `/d` must not merge.
25
+ - `/d` may perform explicit workflow state skip/transition requests.
26
+ - Do not skip `MVP_DEFINITION`, `ARCHITECTURE_DESIGN`, or `FEATURE_INDEX_DEFINITION`.
27
+
28
+ ## Feature Implementation
29
+
30
+ - Run `.flh/docs/FEATURE_IMPLEMENTATION_PIPELINE.md` only when `current_state` is `FEATURE_IMPLEMENTATION` and the user explicitly asks for feature implementation.
31
+ - If the user has not explicitly requested implementation, do not run the implementation pipeline; ask whether they want to start or continue feature implementation.
32
+ - Before running the full implementation pipeline, inspect `docs/features/active/` and `docs/features/review/`.
33
+ - If `docs/features/active/` contains a feature directory, tell the user there is already an active feature and ask whether to continue it, block it, or finish it before starting another feature.
34
+ - If `docs/features/review/` contains a feature directory, do not run the full implementation pipeline; use the review patch rules.
35
+ - Do not start a new feature when either `docs/features/active/` or `docs/features/review/` contains a feature directory.
36
+ - For status, progress, or next-work questions, answer only; do not run the implementation pipeline.
37
+
38
+ ## Review Patch
39
+
40
+ - If `docs/features/review/` contains a feature directory, user edit requests target that feature by default.
41
+ - Use one `fix/*` review branch/worktree per review feature until the user explicitly approves completion.
42
+ - Follow `.flh/docs/REVIEW_PATCH_PIPELINE.md` for review feature edits.
43
+ - Do not run `.flh/docs/FEATURE_IMPLEMENTATION_PIPELINE.md` for review feature edits.
44
+ - Move a feature from `docs/features/review/` to `docs/features/done/` only when the user explicitly approves completion.