@garygentry/feature-forge 0.2.14 → 0.3.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 (227) hide show
  1. package/README.md +6 -3
  2. package/adapters/GENERATION-REPORT.md +20 -0
  3. package/adapters/claude/.feature-forge-bundle.json +1 -1
  4. package/adapters/claude/references/forge-config-schema.json +2 -2
  5. package/adapters/claude/scripts/forge-root.sh +47 -3
  6. package/adapters/claude/scripts/forge-session.py +30 -8
  7. package/adapters/claude/skills/forge-4-backlog/references/forge-config-schema.json +2 -2
  8. package/adapters/claude/skills/forge-5-loop/references/forge-config-schema.json +2 -2
  9. package/adapters/claude/skills/forge-guide/references/forge-config-schema.json +2 -2
  10. package/adapters/codex/.feature-forge-bundle.json +1 -1
  11. package/adapters/codex/references/forge-config-schema.json +2 -2
  12. package/adapters/codex/scripts/forge-root.sh +47 -3
  13. package/adapters/codex/scripts/forge-session.py +30 -8
  14. package/adapters/codex/skills/forge-4-backlog/references/forge-config-schema.json +2 -2
  15. package/adapters/codex/skills/forge-5-loop/references/forge-config-schema.json +2 -2
  16. package/adapters/codex/skills/forge-guide/references/forge-config-schema.json +2 -2
  17. package/adapters/copilot/.feature-forge-bundle.json +1 -1
  18. package/adapters/copilot/references/forge-config-schema.json +2 -2
  19. package/adapters/copilot/scripts/forge-root.sh +47 -3
  20. package/adapters/copilot/scripts/forge-session.py +30 -8
  21. package/adapters/copilot/skills/forge-4-backlog/references/forge-config-schema.json +2 -2
  22. package/adapters/copilot/skills/forge-5-loop/references/forge-config-schema.json +2 -2
  23. package/adapters/copilot/skills/forge-guide/references/forge-config-schema.json +2 -2
  24. package/adapters/cursor/.feature-forge-bundle.json +1 -1
  25. package/adapters/cursor/references/forge-config-schema.json +2 -2
  26. package/adapters/cursor/scripts/forge-root.sh +47 -3
  27. package/adapters/cursor/scripts/forge-session.py +30 -8
  28. package/adapters/cursor/skills/forge-4-backlog/references/forge-config-schema.json +2 -2
  29. package/adapters/cursor/skills/forge-5-loop/references/forge-config-schema.json +2 -2
  30. package/adapters/cursor/skills/forge-guide/references/forge-config-schema.json +2 -2
  31. package/adapters/gemini/.feature-forge-bundle.json +1 -1
  32. package/adapters/gemini/gemini-extension.json +1 -1
  33. package/adapters/gemini/references/forge-config-schema.json +2 -2
  34. package/adapters/gemini/scripts/forge-root.sh +47 -3
  35. package/adapters/gemini/scripts/forge-session.py +30 -8
  36. package/adapters/gemini/skills/forge-4-backlog/references/forge-config-schema.json +2 -2
  37. package/adapters/gemini/skills/forge-5-loop/references/forge-config-schema.json +2 -2
  38. package/adapters/gemini/skills/forge-guide/references/forge-config-schema.json +2 -2
  39. package/adapters/pi/.feature-forge-bundle.json +6 -0
  40. package/adapters/pi/agents/forge-researcher.md +139 -0
  41. package/adapters/pi/agents/forge-spec-writer.md +116 -0
  42. package/adapters/pi/agents/forge-verifier.md +126 -0
  43. package/adapters/pi/extensions/ask-user-question/LICENSE +21 -0
  44. package/adapters/pi/extensions/ask-user-question/README.md +91 -0
  45. package/adapters/pi/extensions/ask-user-question/ask-user-question.ts +298 -0
  46. package/adapters/pi/extensions/ask-user-question/config.ts +78 -0
  47. package/adapters/pi/extensions/ask-user-question/events.ts +57 -0
  48. package/adapters/pi/extensions/ask-user-question/index.ts +61 -0
  49. package/adapters/pi/extensions/ask-user-question/locales/de.json +27 -0
  50. package/adapters/pi/extensions/ask-user-question/locales/en.json +27 -0
  51. package/adapters/pi/extensions/ask-user-question/locales/es.json +27 -0
  52. package/adapters/pi/extensions/ask-user-question/locales/fr.json +27 -0
  53. package/adapters/pi/extensions/ask-user-question/locales/pt-BR.json +27 -0
  54. package/adapters/pi/extensions/ask-user-question/locales/pt.json +27 -0
  55. package/adapters/pi/extensions/ask-user-question/locales/ru.json +27 -0
  56. package/adapters/pi/extensions/ask-user-question/locales/uk.json +27 -0
  57. package/adapters/pi/extensions/ask-user-question/locales/zh.json +29 -0
  58. package/adapters/pi/extensions/ask-user-question/reconcile.ts +49 -0
  59. package/adapters/pi/extensions/ask-user-question/rpc-fallback.ts +168 -0
  60. package/adapters/pi/extensions/ask-user-question/state/build-questionnaire.ts +302 -0
  61. package/adapters/pi/extensions/ask-user-question/state/i18n-bridge.ts +53 -0
  62. package/adapters/pi/extensions/ask-user-question/state/key-router.ts +277 -0
  63. package/adapters/pi/extensions/ask-user-question/state/questionnaire-session.ts +234 -0
  64. package/adapters/pi/extensions/ask-user-question/state/row-intent.ts +145 -0
  65. package/adapters/pi/extensions/ask-user-question/state/selectors/contract.ts +26 -0
  66. package/adapters/pi/extensions/ask-user-question/state/selectors/derivations.ts +42 -0
  67. package/adapters/pi/extensions/ask-user-question/state/selectors/focus.ts +19 -0
  68. package/adapters/pi/extensions/ask-user-question/state/selectors/projections.ts +101 -0
  69. package/adapters/pi/extensions/ask-user-question/state/state-reducer.ts +292 -0
  70. package/adapters/pi/extensions/ask-user-question/state/state.ts +55 -0
  71. package/adapters/pi/extensions/ask-user-question/tool/format-answer.ts +31 -0
  72. package/adapters/pi/extensions/ask-user-question/tool/response-envelope.ts +49 -0
  73. package/adapters/pi/extensions/ask-user-question/tool/types.ts +147 -0
  74. package/adapters/pi/extensions/ask-user-question/tool/validate-questionnaire.ts +58 -0
  75. package/adapters/pi/extensions/ask-user-question/vendor-config-shim.ts +65 -0
  76. package/adapters/pi/extensions/ask-user-question/view/component-binding.ts +47 -0
  77. package/adapters/pi/extensions/ask-user-question/view/components/inline-input.ts +98 -0
  78. package/adapters/pi/extensions/ask-user-question/view/components/multi-select-view.ts +193 -0
  79. package/adapters/pi/extensions/ask-user-question/view/components/option-list-view.ts +70 -0
  80. package/adapters/pi/extensions/ask-user-question/view/components/preview/markdown-content-cache.ts +79 -0
  81. package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-block-renderer.ts +111 -0
  82. package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-box-renderer.ts +88 -0
  83. package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-layout-decider.ts +202 -0
  84. package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-pane.ts +228 -0
  85. package/adapters/pi/extensions/ask-user-question/view/components/submit-picker.ts +67 -0
  86. package/adapters/pi/extensions/ask-user-question/view/components/tab-bar.ts +59 -0
  87. package/adapters/pi/extensions/ask-user-question/view/components/wrapping-select.ts +293 -0
  88. package/adapters/pi/extensions/ask-user-question/view/dialog-builder.ts +224 -0
  89. package/adapters/pi/extensions/ask-user-question/view/props-adapter.ts +125 -0
  90. package/adapters/pi/extensions/ask-user-question/view/stateful-view.ts +26 -0
  91. package/adapters/pi/extensions/ask-user-question/view/tab-components.ts +18 -0
  92. package/adapters/pi/extensions/ask-user-question/view/tab-content-strategy.ts +252 -0
  93. package/adapters/pi/package.json +26 -0
  94. package/adapters/pi/references/epic-manifest-schema.json +125 -0
  95. package/adapters/pi/references/forge-config-schema.json +236 -0
  96. package/adapters/pi/references/pipeline-state-schema.json +191 -0
  97. package/adapters/pi/references/portable-root.md +71 -0
  98. package/adapters/pi/references/process-overview.md +143 -0
  99. package/adapters/pi/references/ralph-loop-contract.md +221 -0
  100. package/adapters/pi/references/shared-conventions.md +295 -0
  101. package/adapters/pi/references/skill-frontmatter.schema.json +17 -0
  102. package/adapters/pi/references/stack-resolution.md +54 -0
  103. package/adapters/pi/references/stacks/_generic.md +111 -0
  104. package/adapters/pi/references/stacks/go.md +157 -0
  105. package/adapters/pi/references/stacks/python.md +184 -0
  106. package/adapters/pi/references/stacks/rust.md +170 -0
  107. package/adapters/pi/references/stacks/typescript.md +134 -0
  108. package/adapters/pi/references/stage-exit-protocol.md +258 -0
  109. package/adapters/pi/references/templates/specs-hygiene/AGENTS.md +32 -0
  110. package/adapters/pi/references/templates/specs-hygiene/CLAUDE.md +31 -0
  111. package/adapters/pi/references/vendor-construct-inventory.md +50 -0
  112. package/adapters/pi/scripts/epic-manifest.py +1694 -0
  113. package/adapters/pi/scripts/forge-bootstrap.py +1070 -0
  114. package/adapters/pi/scripts/forge-init.sh +58 -0
  115. package/adapters/pi/scripts/forge-root.sh +179 -0
  116. package/adapters/pi/scripts/forge-session.py +1888 -0
  117. package/adapters/pi/scripts/validate-traceability.py +150 -0
  118. package/adapters/pi/skills/forge/SKILL.md +243 -0
  119. package/adapters/pi/skills/forge/references/pipeline-state-schema.json +191 -0
  120. package/adapters/pi/skills/forge/references/process-overview.md +143 -0
  121. package/adapters/pi/skills/forge/references/shared-conventions.md +295 -0
  122. package/adapters/pi/skills/forge/references/stage-exit-protocol.md +258 -0
  123. package/adapters/pi/skills/forge-0-epic/SKILL.md +308 -0
  124. package/adapters/pi/skills/forge-0-epic/references/edit-mode.md +266 -0
  125. package/adapters/pi/skills/forge-0-epic/references/epic-manifest-subcommands.md +75 -0
  126. package/adapters/pi/skills/forge-0-epic/references/pipeline-state-schema.json +191 -0
  127. package/adapters/pi/skills/forge-0-epic/references/portable-root.md +71 -0
  128. package/adapters/pi/skills/forge-0-epic/references/shared-conventions.md +295 -0
  129. package/adapters/pi/skills/forge-0-epic/references/stage-exit-protocol.md +258 -0
  130. package/adapters/pi/skills/forge-1-prd/SKILL.md +164 -0
  131. package/adapters/pi/skills/forge-1-prd/references/pipeline-state-schema.json +191 -0
  132. package/adapters/pi/skills/forge-1-prd/references/prd-template.md +106 -0
  133. package/adapters/pi/skills/forge-1-prd/references/shared-conventions.md +295 -0
  134. package/adapters/pi/skills/forge-1-prd/references/stage-exit-protocol.md +258 -0
  135. package/adapters/pi/skills/forge-2-tech/SKILL.md +225 -0
  136. package/adapters/pi/skills/forge-2-tech/references/pipeline-state-schema.json +191 -0
  137. package/adapters/pi/skills/forge-2-tech/references/shared-conventions.md +295 -0
  138. package/adapters/pi/skills/forge-2-tech/references/stack-discovery-checklist.md +95 -0
  139. package/adapters/pi/skills/forge-2-tech/references/stack-resolution.md +54 -0
  140. package/adapters/pi/skills/forge-2-tech/references/stacks/_generic.md +111 -0
  141. package/adapters/pi/skills/forge-2-tech/references/stacks/go.md +157 -0
  142. package/adapters/pi/skills/forge-2-tech/references/stacks/python.md +184 -0
  143. package/adapters/pi/skills/forge-2-tech/references/stacks/rust.md +170 -0
  144. package/adapters/pi/skills/forge-2-tech/references/stacks/typescript.md +134 -0
  145. package/adapters/pi/skills/forge-2-tech/references/stage-exit-protocol.md +258 -0
  146. package/adapters/pi/skills/forge-3-specs/SKILL.md +178 -0
  147. package/adapters/pi/skills/forge-3-specs/references/pipeline-state-schema.json +191 -0
  148. package/adapters/pi/skills/forge-3-specs/references/shared-conventions.md +295 -0
  149. package/adapters/pi/skills/forge-3-specs/references/spec-archetypes.md +106 -0
  150. package/adapters/pi/skills/forge-3-specs/references/spec-examples.md +71 -0
  151. package/adapters/pi/skills/forge-3-specs/references/stacks/_generic.md +111 -0
  152. package/adapters/pi/skills/forge-3-specs/references/stacks/go.md +157 -0
  153. package/adapters/pi/skills/forge-3-specs/references/stacks/python.md +184 -0
  154. package/adapters/pi/skills/forge-3-specs/references/stacks/rust.md +170 -0
  155. package/adapters/pi/skills/forge-3-specs/references/stacks/typescript.md +134 -0
  156. package/adapters/pi/skills/forge-3-specs/references/stage-exit-protocol.md +258 -0
  157. package/adapters/pi/skills/forge-4-backlog/SKILL.md +175 -0
  158. package/adapters/pi/skills/forge-4-backlog/references/forge-config-schema.json +236 -0
  159. package/adapters/pi/skills/forge-4-backlog/references/pipeline-state-schema.json +191 -0
  160. package/adapters/pi/skills/forge-4-backlog/references/shared-conventions.md +295 -0
  161. package/adapters/pi/skills/forge-4-backlog/references/stage-exit-protocol.md +258 -0
  162. package/adapters/pi/skills/forge-5-loop/SKILL.md +314 -0
  163. package/adapters/pi/skills/forge-5-loop/references/forge-config-schema.json +236 -0
  164. package/adapters/pi/skills/forge-5-loop/references/ralph-loop-contract.md +221 -0
  165. package/adapters/pi/skills/forge-5-loop/references/result-reporting.md +85 -0
  166. package/adapters/pi/skills/forge-5-loop/references/runner-contract.md +341 -0
  167. package/adapters/pi/skills/forge-5-loop/references/shared-conventions.md +295 -0
  168. package/adapters/pi/skills/forge-5-loop/references/stage-exit-protocol.md +258 -0
  169. package/adapters/pi/skills/forge-6-docs/SKILL.md +202 -0
  170. package/adapters/pi/skills/forge-6-docs/references/doc-conventions.md +126 -0
  171. package/adapters/pi/skills/forge-6-docs/references/pipeline-state-schema.json +191 -0
  172. package/adapters/pi/skills/forge-6-docs/references/shared-conventions.md +295 -0
  173. package/adapters/pi/skills/forge-bootstrap/SKILL.md +250 -0
  174. package/adapters/pi/skills/forge-bootstrap/references/templates/ci/github-actions.yml +12 -0
  175. package/adapters/pi/skills/forge-bootstrap/references/templates/generic/run.sh +3 -0
  176. package/adapters/pi/skills/forge-bootstrap/references/templates/generic/test.sh +13 -0
  177. package/adapters/pi/skills/forge-bootstrap/references/templates/go/go.mod +3 -0
  178. package/adapters/pi/skills/forge-bootstrap/references/templates/go/main.go +12 -0
  179. package/adapters/pi/skills/forge-bootstrap/references/templates/go/main_test.go +11 -0
  180. package/adapters/pi/skills/forge-bootstrap/references/templates/hygiene/AGENTS.md +35 -0
  181. package/adapters/pi/skills/forge-bootstrap/references/templates/hygiene/CLAUDE.md +36 -0
  182. package/adapters/pi/skills/forge-bootstrap/references/templates/hygiene/README.md +11 -0
  183. package/adapters/pi/skills/forge-bootstrap/references/templates/licenses/Apache-2.0/LICENSE +198 -0
  184. package/adapters/pi/skills/forge-bootstrap/references/templates/licenses/MIT/LICENSE +21 -0
  185. package/adapters/pi/skills/forge-bootstrap/references/templates/python/pyproject.toml +24 -0
  186. package/adapters/pi/skills/forge-bootstrap/references/templates/python/src/{{PKG}}/__init__.py +5 -0
  187. package/adapters/pi/skills/forge-bootstrap/references/templates/python/src/{{PKG}}/main.py +13 -0
  188. package/adapters/pi/skills/forge-bootstrap/references/templates/python/tests/test_smoke.py +8 -0
  189. package/adapters/pi/skills/forge-bootstrap/references/templates/rust/Cargo.toml +15 -0
  190. package/adapters/pi/skills/forge-bootstrap/references/templates/rust/src/lib.rs +7 -0
  191. package/adapters/pi/skills/forge-bootstrap/references/templates/rust/src/main.rs +5 -0
  192. package/adapters/pi/skills/forge-bootstrap/references/templates/rust/tests/smoke.rs +6 -0
  193. package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/package.json +15 -0
  194. package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/src/index.ts +4 -0
  195. package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/test/smoke.test.ts +6 -0
  196. package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/tsconfig.json +14 -0
  197. package/adapters/pi/skills/forge-fix/SKILL.md +98 -0
  198. package/adapters/pi/skills/forge-fix/references/shared-conventions.md +295 -0
  199. package/adapters/pi/skills/forge-fix/references/stage-exit-protocol.md +258 -0
  200. package/adapters/pi/skills/forge-guide/SKILL.md +192 -0
  201. package/adapters/pi/skills/forge-guide/references/forge-config-schema.json +236 -0
  202. package/adapters/pi/skills/forge-guide/references/process-overview.md +143 -0
  203. package/adapters/pi/skills/forge-guide/references/ralph-loop-contract.md +221 -0
  204. package/adapters/pi/skills/forge-guide/references/shared-conventions.md +295 -0
  205. package/adapters/pi/skills/forge-guide/references/stack-resolution.md +54 -0
  206. package/adapters/pi/skills/forge-guide/references/stacks/_generic.md +111 -0
  207. package/adapters/pi/skills/forge-guide/references/stacks/go.md +157 -0
  208. package/adapters/pi/skills/forge-guide/references/stacks/python.md +184 -0
  209. package/adapters/pi/skills/forge-guide/references/stacks/rust.md +170 -0
  210. package/adapters/pi/skills/forge-guide/references/stacks/typescript.md +134 -0
  211. package/adapters/pi/skills/forge-init/SKILL.md +72 -0
  212. package/adapters/pi/skills/forge-verify/SKILL.md +273 -0
  213. package/adapters/pi/skills/forge-verify/references/pipeline-state-schema.json +191 -0
  214. package/adapters/pi/skills/forge-verify/references/shared-conventions.md +295 -0
  215. package/adapters/pi/skills/forge-verify/references/verification-checklists.md +477 -0
  216. package/dist/agent-targets.d.ts +1 -1
  217. package/dist/agent-targets.js +23 -3
  218. package/dist/detect.d.ts +1 -1
  219. package/dist/detect.js +2 -1
  220. package/dist/manifest.d.ts +1 -1
  221. package/dist/manifest.js +2 -2
  222. package/dist/placements.js +5 -1
  223. package/dist/rauf.d.ts +4 -4
  224. package/dist/rauf.js +3 -3
  225. package/dist/types.d.ts +31 -6
  226. package/dist/types.js +6 -3
  227. package/package.json +14 -3
@@ -0,0 +1,157 @@
1
+ # Go Stack Profile
2
+
3
+ Stack-specific guidance for Go projects (1.21+).
4
+
5
+ ## Stack Identity
6
+
7
+ - **Language**: Go 1.21+ (required for `slog` stdlib logging, `slices`/`maps` packages, improved generics)
8
+ - **Build system**: `go build`, `go install` (no external build tool required)
9
+ - **Module system**: Go modules (`go.mod` / `go.sum`)
10
+ - **Philosophy**: Simplicity-first — prefer the standard library, add dependencies only when justified
11
+
12
+ ## Discovery Checklist
13
+
14
+ When examining a Go project, check for:
15
+
16
+ - **Module definition**: `go.mod` (module path, Go version, dependencies)
17
+ - **Dependency lock**: `go.sum` (checksums for reproducible builds)
18
+ - **Entry points**: `cmd/` directory (for CLIs, services, or multiple binaries)
19
+ - **Private packages**: `internal/` directory (compiler-enforced encapsulation)
20
+ - **Public packages**: `pkg/` directory (if used — not all projects follow this convention)
21
+ - **Build automation**: `Makefile`, `Taskfile.yml`, `mage` targets
22
+ - **Configuration**: `.golangci.yml` or `.golangci.yaml` (linter config)
23
+ - **Code generation**: `go generate` directives, `//go:generate` comments, `tools.go` for tool dependencies
24
+ - **Framework**: Check imports for chi, gin, echo, fiber (routers), or stdlib `net/http`
25
+ - **Database**: Check for sqlx, pgx, ent, gorm, or `database/sql`
26
+
27
+ ## Archetype Conventions
28
+
29
+ ### 00-core-definitions.md (Go)
30
+
31
+ - **Structs**: Use `struct` types with json/db tags (e.g., `` `json:"name" db:"name"` ``). Document every exported field with a comment.
32
+ - **Interfaces**: Keep small and behavior-focused (1–3 methods). Define at the consumer site, not the implementation site. Name with `-er` suffix where natural (e.g., `Reader`, `Validator`).
33
+ - **Error types**: Custom types implementing the `error` interface. Use `errors.New` for sentinel errors, `fmt.Errorf` with `%w` for wrapping. Group domain errors in a dedicated `errors.go` file.
34
+ - **Constants**: Use `iota` for sequential constants, typed constants for domain values, `const` blocks for related groups
35
+ - **Type aliases and generics**: Use sparingly. Generic types when the abstraction genuinely applies across multiple concrete types.
36
+ - **No barrel exports**: Go uses package-level visibility (`Exported` vs `unexported`); there is no index file pattern.
37
+
38
+ ### 01-architecture-layout.md (Go)
39
+
40
+ - **Standard project layout**:
41
+ - `cmd/<binary-name>/main.go` — entry points (one per binary)
42
+ - `internal/` — private application code (compiler-enforced)
43
+ - `pkg/` — public library code (optional, some projects skip this)
44
+ - `api/` — OpenAPI specs, protobuf definitions, API contracts
45
+ - `configs/` — configuration file templates
46
+ - `scripts/` — build, install, analysis scripts
47
+ - **go.mod**: Module path matching the repo URL (e.g., `github.com/user/repo`), minimum Go version, direct and indirect dependencies
48
+ - **Package design**: One package per directory, package name matches directory name, package-level `doc.go` for documentation
49
+ - **Build considerations**: Cross-compilation with `GOOS`/`GOARCH`, build tags for platform-specific code, `ldflags` for version injection
50
+
51
+ ### NN-testing-strategy.md (Go)
52
+
53
+ - **Framework**: `testing` package from stdlib (no external framework required)
54
+ - **Test file location**: `*_test.go` files in the same package (white-box) or `_test` package suffix (black-box)
55
+ - **Table-driven tests**: Standard pattern using slice of test structs with `t.Run()` subtests
56
+ - **Test helpers**: Functions accepting `testing.TB` with `t.Helper()` call at top
57
+ - **Mocking**: Interfaces + manual mocks, or testify/mock, gomock, mockgen if project uses them
58
+ - **Assertions**: stdlib `if got != want` pattern, or testify `assert`/`require` if project uses it
59
+ - **Integration tests**: Build tags (`//go:build integration`) to separate from unit tests
60
+ - **Benchmarks**: `func BenchmarkXxx(b *testing.B)` with `b.N` loop
61
+ - **Test fixtures**: `testdata/` directory (ignored by Go tooling), `TestMain` for setup/teardown
62
+
63
+ ## Spec Quality Rules
64
+
65
+ - All Go code must be valid syntax with complete type information — not pseudocode
66
+ - Follow Go idioms:
67
+ - Return `error` as the last return value — never panic for expected failures
68
+ - Accept interfaces, return structs (depend on behavior, produce concrete types)
69
+ - Design meaningful zero values (a zero-valued struct should be usable or clearly invalid)
70
+ - No getters — use the field name directly (e.g., `user.Name` not `user.GetName()`)
71
+ - Use embedding for composition, not inheritance
72
+ - `context.Context` as the first parameter for any function that may block or be cancelled
73
+ - `error` as the last return value for any function that can fail
74
+ - Include complete function signatures with named return values where they improve clarity
75
+ - Document every exported type, function, and method with a comment starting with the identifier name
76
+ - Use `//nolint` directives only with a justification comment
77
+
78
+ ## Verification Specifics
79
+
80
+ - **Static analysis**: `go vet ./...` (catches common mistakes)
81
+ - **Linting**: `golangci-lint run` (if `.golangci.yml` exists or CI uses it)
82
+ - **Testing**: `go test ./...` (all packages)
83
+ - **Building**: `go build ./...` (ensures all packages compile)
84
+ - **Formatting**: `gofmt -l .` or `goimports -l .` (should produce no output)
85
+ - **Module tidiness**: `go mod tidy` (ensures `go.mod` and `go.sum` are consistent)
86
+
87
+ ### Runtime Entrypoints & Bootstrap-Wiring Sites
88
+
89
+ Used by `CHECK-I22` (a runtime-required bootstrap needs a **non-test** caller on one of these) and
90
+ `CHECK-I23` (a heavy init wired into a **universal** bootstrap entry should move to a lazier site).
91
+
92
+ - **Runtime entrypoints (a legitimate non-test call site):** `func main()` in a `package main` under
93
+ `cmd/…` or the module root, an HTTP handler registered on a `*http.ServeMux` / router, a gRPC service
94
+ registration, or a worker/consumer goroutine started from `main` — not a `*_test.go` file.
95
+ - **Universal bootstrap entries (run on every startup — the `CHECK-I23` risk site):** a package-level
96
+ `func init()` that constructs heavy clients, package-level `var` initializers that dial/connect at
97
+ import time, or a single `bootstrap`/`wire` module `main` calls before serving. `init()` and
98
+ package-var side effects run on **every** binary start, before `main` gets control.
99
+ - **Heavy server-only import markers (what makes an init "heavy" for `CHECK-I23`):** DB drivers/pools
100
+ (`database/sql` + a driver, `pgx`, `gorm`, `mongo-driver`), message/queue clients (`sarama`/Kafka,
101
+ `amqp`, `go-redis`), telemetry SDKs (`go.opentelemetry.io/*`, `sentry-go`), or a broad internal
102
+ service package. An `init()` or package-var that dials any of these is the CHECK-I23 pattern —
103
+ recommend a `sync.Once` lazy constructor invoked from the first handler that needs it, not an
104
+ eager package-level connect.
105
+
106
+ ## Testing
107
+
108
+ - **Framework**: `testing` stdlib package
109
+ - **Test command**: `go test ./...` for all, `go test -v -run TestName ./pkg/...` for specific
110
+ - **Table-driven tests**: Idiomatic pattern — slice of anonymous structs with `name`, input, and expected fields
111
+ - **Subtests**: `t.Run("case name", func(t *testing.T) { ... })` for grouped assertions
112
+ - **Assertions**: testify `assert`/`require` (if project uses it), otherwise manual `if` checks with `t.Errorf`
113
+ - **Coverage**: `go test -coverprofile=coverage.out ./...` then `go tool cover -html=coverage.out`
114
+ - **Race detection**: `go test -race ./...` for concurrency safety
115
+ - **Fuzzing**: `func FuzzXxx(f *testing.F)` (Go 1.18+)
116
+
117
+ ## Common Frameworks
118
+
119
+ | Category | Options |
120
+ |----------|---------|
121
+ | HTTP router | net/http (stdlib), chi, gin, echo, fiber |
122
+ | Database | database/sql (stdlib), sqlx, pgx, ent, gorm |
123
+ | Migrations | golang-migrate, goose, atlas |
124
+ | CLI | cobra, urfave/cli, kong |
125
+ | Logging | log/slog (stdlib), zerolog, zap |
126
+ | Configuration | viper, envconfig, koanf |
127
+ | Dependency injection | wire, fx, dig |
128
+ | gRPC | google.golang.org/grpc, connect-go |
129
+ | Testing | testify, gomock, go-cmp |
130
+
131
+ ## Example: Project-Level Override
132
+
133
+ Create `.feature-forge/stack-decisions.md` (legacy alias: `.claude/references/stack-decisions.md`) in your project root:
134
+
135
+ ```markdown
136
+ # Stack Decisions
137
+
138
+ ## Runtime & Build
139
+ - Go 1.22 with standard go toolchain
140
+ - Makefile for build automation
141
+
142
+ ## Backend
143
+ - chi for HTTP routing
144
+ - sqlx with PostgreSQL
145
+ - log/slog for structured logging
146
+
147
+ ## Testing
148
+ - testify for assertions and mocking
149
+ - Table-driven tests with t.Run() subtests
150
+ - Build tag `integration` for integration tests
151
+
152
+ ## Conventions
153
+ - Standard project layout (cmd/, internal/, pkg/)
154
+ - golangci-lint with project .golangci.yml
155
+ - Context as first parameter, error as last return
156
+ - Interfaces defined at consumer site
157
+ ```
@@ -0,0 +1,184 @@
1
+ # Python Stack Profile
2
+
3
+ Stack-specific guidance for Python projects (3.10+).
4
+
5
+ ## Stack Identity
6
+
7
+ - **Language**: Python 3.10+ (required for modern type hint syntax: `X | Y` unions, `match` statements)
8
+ - **Package management**: pip, uv, poetry, pdm, or pipenv (check for respective lock/config files)
9
+ - **Type checking**: mypy, pyright, or pytype
10
+ - **Linting**: ruff, flake8, pylint
11
+
12
+ ## Discovery Checklist
13
+
14
+ When examining a Python project, check for:
15
+
16
+ - **Project manifest**: `pyproject.toml` (modern), `setup.py`/`setup.cfg` (legacy), `requirements.txt` (minimal)
17
+ - **Package manager**: `uv.lock` (uv), `poetry.lock` (poetry), `pdm.lock` (pdm), `Pipfile.lock` (pipenv)
18
+ - **Monorepo**: `pants.toml` (Pants), `BUILD` files (Bazel), `nx.json` with Python plugins, or plain workspace structure
19
+ - **Framework**: FastAPI, Django, Flask, Starlette, Litestar
20
+ - **Database**: SQLAlchemy, Django ORM, Tortoise ORM, SQLModel
21
+ - **Validation**: Pydantic, attrs, marshmallow
22
+ - **Testing**: pytest (dominant), unittest
23
+ - **Type checking**: `mypy.ini`, `pyrightconfig.json`, or `[tool.mypy]` / `[tool.pyright]` in `pyproject.toml`
24
+
25
+ ## Archetype Conventions
26
+
27
+ ### 00-core-definitions.md (Python)
28
+
29
+ - **Data structures**: Use `dataclasses` for simple data containers, Pydantic `BaseModel` for validated/serializable models. Use `TypedDict` for dict-shaped data.
30
+ - **Type aliases**: Use `type` statements (3.12+) or `TypeAlias` annotation
31
+ - **Union types**: Use `X | Y` syntax (3.10+)
32
+ - **Protocols**: Use `typing.Protocol` for structural subtyping (Python's equivalent of interfaces)
33
+ - **Error/exception hierarchy**: Base exception class inheriting from `Exception` (or a more specific built-in); domain-specific subclasses with typed attributes
34
+ - **Constants and enumerations**: Use `enum.Enum`, `enum.StrEnum`, or module-level constants with `Final` annotation
35
+ - **Module exports**: Define `__all__` in `__init__.py` for explicit public API
36
+
37
+ ### 01-architecture-layout.md (Python)
38
+
39
+ - **Project layout**: `src/` layout (recommended) or flat layout
40
+ - **pyproject.toml**: `[project]` table with `name`, `dependencies`, `optional-dependencies`, `[project.scripts]` for CLI entry points
41
+ - **Tool configuration**: `[tool.pytest.ini_options]`, `[tool.mypy]`, `[tool.ruff]` sections in `pyproject.toml`
42
+ - **Module entry points**: `__init__.py` files with explicit `__all__` lists for re-exports
43
+ - **Namespace packages**: When applicable, `py.typed` marker for PEP 561 compliance
44
+
45
+ ### Monorepo conventions (if applicable)
46
+
47
+ - **Workspace structure**: `packages/` or `libs/` directories with individual `pyproject.toml` per package
48
+ - **Internal dependencies**: Path dependencies in `pyproject.toml` or editable installs
49
+ - **Build coordination**: Pants, Bazel, or Makefile-based orchestration
50
+
51
+ ## Spec Quality Rules
52
+
53
+ - All Python code must be valid syntax with complete type annotations — not pseudocode
54
+ - Use Google-style or NumPy-style docstrings consistently (match project convention)
55
+ - Include `Args`, `Returns`, `Raises` sections in docstrings for every public function
56
+ - Use `Protocol` classes to define interfaces/contracts
57
+ - Include explicit import statements in all code examples
58
+ - Use `async def` for asynchronous operations where applicable
59
+
60
+ ### Example: Well-Specified Function
61
+
62
+ ```python
63
+ class SessionExpiredError(AuthError):
64
+ """Raised when a session token has expired.
65
+
66
+ Attributes:
67
+ expired_at: When the session expired.
68
+ """
69
+
70
+ def __init__(self, expired_at: datetime) -> None:
71
+ self.expired_at = expired_at
72
+ super().__init__(
73
+ code="SESSION_EXPIRED",
74
+ message=f"Session expired at {expired_at.isoformat()}",
75
+ )
76
+
77
+
78
+ async def refresh_session_token(
79
+ current_token: str,
80
+ *,
81
+ max_age: timedelta = SESSION_DURATION,
82
+ refresh_threshold: timedelta = REFRESH_THRESHOLD,
83
+ signing_key: bytes,
84
+ ) -> str | None:
85
+ """Refresh a session token if it's within the refresh threshold.
86
+
87
+ Returns a new token with an extended expiry, or None if the session
88
+ is not eligible for refresh (valid but outside threshold).
89
+
90
+ Args:
91
+ current_token: The JWT string from the session cookie.
92
+ max_age: Maximum age of a token eligible for refresh.
93
+ refresh_threshold: How close to expiry before refresh is allowed.
94
+ signing_key: Secret key for signing the new token.
95
+
96
+ Returns:
97
+ New session token string, or None if refresh is not possible.
98
+
99
+ Raises:
100
+ SessionExpiredError: If the token has already expired.
101
+ TokenValidationError: If the token signature is invalid.
102
+ """
103
+ ...
104
+ ```
105
+
106
+ ## Verification Specifics
107
+
108
+ - **Type checking**: `mypy .`, `mypy src/`, `pyright`, or `pyright src/`
109
+ - **Linting**: `ruff check .` or `flake8`
110
+ - **Formatting**: `ruff format --check .` or `black --check .`
111
+ - **Import validation**: `mypy` with `--strict` or `--disallow-untyped-defs` catches missing type annotations
112
+ - **Module export validation**: `__all__` lists in `__init__.py` match spec's public API
113
+
114
+ ### Runtime Entrypoints & Bootstrap-Wiring Sites
115
+
116
+ Used by `CHECK-I22` (a runtime-required bootstrap needs a **non-test** caller on one of these) and
117
+ `CHECK-I23` (a heavy init wired into a **universal** bootstrap entry should move to a lazier site).
118
+
119
+ - **Runtime entrypoints (a legitimate non-test call site):** a `if __name__ == "__main__":` block, a
120
+ `[project.scripts]` console-script target in `pyproject.toml`, an ASGI/WSGI app object
121
+ (`app = FastAPI()` / Django `wsgi.py` / `asgi.py`), a route/view/handler, a Celery/RQ task module, or
122
+ a management command — not a `test_*.py` / `conftest.py`.
123
+ - **Universal bootstrap entries (run on every startup — the `CHECK-I23` risk site):** a package
124
+ `__init__.py` that eagerly instantiates heavy clients at import time, a framework startup hook
125
+ (FastAPI `lifespan` / `@app.on_event("startup")`, Django `AppConfig.ready()`, a Gunicorn/uvicorn
126
+ `--preload` module), or a `conftest.py` that bootstraps production graphs. Import-time side effects
127
+ here run on every process start.
128
+ - **Heavy server-only import markers (what makes an init "heavy" for `CHECK-I23`):** DB/ORM engines
129
+ (`sqlalchemy.create_engine`, `psycopg`, Django ORM, `pymongo`, `redis`), task queues (`celery`,
130
+ `rq`, `kafka`), telemetry SDKs (`opentelemetry`, `sentry_sdk`), or a whole-service-layer package
131
+ import. An init pulling any of these at a universal entry is the CHECK-I23 pattern — recommend lazy
132
+ init (module-level `@lru_cache` factory, `Depends()` provider, or first-use lazy import) at the
133
+ handler that needs it.
134
+
135
+ ## Testing
136
+
137
+ - **Framework**: pytest (with `conftest.py` for fixtures)
138
+ - **Fixtures**: Define in `conftest.py` at appropriate scope (session, module, function)
139
+ - **Mocking**: `unittest.mock.patch`, `monkeypatch` fixture, or `pytest-mock`
140
+ - **Coverage**: `pytest-cov` with `--cov=src/` flag
141
+ - **Test file location**: `tests/` directory mirroring `src/` structure, or co-located `test_*.py` files
142
+ - **Async testing**: `pytest-asyncio` for async function tests
143
+ - **Type testing**: Runtime checks with `isinstance()`, static checks with `reveal_type()`
144
+
145
+ ## Common Frameworks
146
+
147
+ | Category | Options |
148
+ |----------|---------|
149
+ | Web (async) | FastAPI, Starlette, Litestar |
150
+ | Web (sync) | Django, Flask |
151
+ | Database ORM | SQLAlchemy, Django ORM, SQLModel, Tortoise ORM |
152
+ | Migrations | Alembic (SQLAlchemy), Django migrations |
153
+ | Validation | Pydantic, attrs, marshmallow |
154
+ | Task queues | Celery, Dramatiq, Huey, ARQ |
155
+ | CLI | Click, Typer, argparse |
156
+ | HTTP client | httpx, aiohttp, requests |
157
+
158
+ ## Example: Project-Level Override
159
+
160
+ Create `.feature-forge/stack-decisions.md` (legacy alias: `.claude/references/stack-decisions.md`) in your project root:
161
+
162
+ ```markdown
163
+ # Stack Decisions
164
+
165
+ ## Runtime & Build
166
+ - Python 3.12 with uv for package management
167
+ - src/ layout with pyproject.toml
168
+
169
+ ## Backend
170
+ - FastAPI for HTTP framework
171
+ - SQLAlchemy 2.0 with PostgreSQL (async)
172
+ - Pydantic v2 for validation and serialization
173
+
174
+ ## Testing
175
+ - pytest with pytest-asyncio
176
+ - Factory Boy for test fixtures
177
+ - Coverage target: 90%
178
+
179
+ ## Conventions
180
+ - Google-style docstrings
181
+ - ruff for linting and formatting
182
+ - mypy with --strict for type checking
183
+ - __all__ exports in every __init__.py
184
+ ```
@@ -0,0 +1,170 @@
1
+ # Rust Stack Profile
2
+
3
+ Stack-specific guidance for Rust projects (stable channel).
4
+
5
+ ## Stack Identity
6
+
7
+ - **Language**: Rust (stable channel, edition 2021 or later)
8
+ - **Build system**: Cargo (`cargo build`, `cargo test`, `cargo run`)
9
+ - **Package registry**: crates.io (dependencies declared in `Cargo.toml`)
10
+ - **Philosophy**: Zero-cost abstractions, ownership model for memory safety, fearless concurrency
11
+
12
+ ## Discovery Checklist
13
+
14
+ When examining a Rust project, check for:
15
+
16
+ - **Project manifest**: `Cargo.toml` (package metadata, dependencies, features, workspace config)
17
+ - **Dependency lock**: `Cargo.lock` (exact dependency versions for reproducible builds)
18
+ - **Library entry**: `src/lib.rs` (library crate root)
19
+ - **Binary entry**: `src/main.rs` (binary crate root), or `src/bin/` for multiple binaries
20
+ - **Build script**: `build.rs` (compile-time code generation, native library linking)
21
+ - **Cargo config**: `.cargo/config.toml` (target-specific settings, linker config, aliases)
22
+ - **Workspace**: `[workspace]` table in root `Cargo.toml` with `members` list
23
+ - **Framework**: Check `Cargo.toml` dependencies for actix-web, axum, rocket (web), clap (CLI), tokio (async)
24
+ - **Async runtime**: tokio, async-std, smol
25
+ - **Serialization**: serde, serde_json, serde_yaml
26
+
27
+ ## Archetype Conventions
28
+
29
+ ### 00-core-definitions.md (Rust)
30
+
31
+ - **Structs**: Use `struct` types with derive macros (`#[derive(Debug, Clone, Serialize, Deserialize)]`). Document every public field with `///` doc comments.
32
+ - **Enums**: Use for sum types / discriminated unions. Each variant documents its purpose. Exhaustive `match` for control flow.
33
+ - **Traits**: Define shared behavior contracts. Keep focused (single responsibility). Use associated types for output types, generics for input types.
34
+ - **Error types**: `thiserror::Error` for library errors (typed, specific), `anyhow::Error` for application errors (erased, convenient). Define `type Result<T> = std::result::Result<T, MyError>` aliases per module.
35
+ - **Type aliases**: Use `type` for complex generic instantiations (e.g., `type DbPool = Pool<Postgres>`)
36
+ - **Newtypes**: Single-field tuple structs for type safety (e.g., `struct UserId(Uuid)`)
37
+ - **Constants**: `const` for compile-time values, `static` for global state (rarely needed), `lazy_static!` or `std::sync::LazyLock` for runtime-initialized globals
38
+
39
+ ### 01-architecture-layout.md (Rust)
40
+
41
+ - **Single crate structure**:
42
+ - `src/lib.rs` — library root, declares modules with `mod` statements
43
+ - `src/main.rs` — binary entry point, imports from library crate
44
+ - `src/<module>.rs` or `src/<module>/mod.rs` — submodules
45
+ - `tests/` — integration tests (each file is a separate crate)
46
+ - `examples/` — runnable examples (`cargo run --example name`)
47
+ - `benches/` — benchmarks (`cargo bench`)
48
+ - **Cargo workspace** (multi-crate):
49
+ - Root `Cargo.toml` with `[workspace]` and `members = ["crates/*"]`
50
+ - Shared dependencies via `[workspace.dependencies]` with `{ workspace = true }` in member crates
51
+ - Internal crate references as path dependencies
52
+ - **Cargo.toml**: `[package]` (name, version, edition), `[dependencies]`, `[dev-dependencies]`, `[build-dependencies]`, `[features]` for conditional compilation
53
+ - **Module visibility**: `pub`, `pub(crate)`, `pub(super)` for fine-grained access control. Re-exports via `pub use` in parent modules.
54
+
55
+ ### NN-testing-strategy.md (Rust)
56
+
57
+ - **Framework**: Built-in `#[test]` attribute (no external framework required)
58
+ - **Unit tests**: `#[cfg(test)] mod tests { ... }` at bottom of each source file (white-box, access to private items)
59
+ - **Integration tests**: `tests/` directory, each `.rs` file is a separate test crate (black-box, only public API)
60
+ - **Test assertions**: `assert!`, `assert_eq!`, `assert_ne!` macros; custom messages as format string arguments
61
+ - **Doc tests**: Code blocks in `///` doc comments run as tests with `cargo test`
62
+ - **Examples**: `examples/` directory, verified to compile with `cargo test`, runnable with `cargo run --example`
63
+ - **Test fixtures**: Builder pattern structs, helper functions in `tests/common/mod.rs`
64
+ - **Async tests**: `#[tokio::test]` attribute for async test functions
65
+ - **Property testing**: `proptest` or `quickcheck` crates for generative testing
66
+ - **Snapshot testing**: `insta` crate for snapshot/approval testing
67
+
68
+ ## Spec Quality Rules
69
+
70
+ - All Rust code must be valid syntax with complete type annotations — not pseudocode
71
+ - Follow Rust idioms:
72
+ - `Result<T, E>` for fallible operations — never panic for expected failures
73
+ - `Option<T>` for nullable/optional values — never use sentinel values
74
+ - Ownership and borrowing: specify whether a function takes ownership (`T`), borrows (`&T`), or mutably borrows (`&mut T`). Note when `Clone` is required.
75
+ - Lifetime annotations when the compiler cannot infer them — document why a lifetime relationship exists
76
+ - Derive macros for common traits (`Debug`, `Clone`, `PartialEq`, `Eq`, `Hash`, `Serialize`, `Deserialize`)
77
+ - `impl` blocks for methods — group inherent methods and trait implementations separately
78
+ - Pattern matching with `match` for control flow over enums and `Result`/`Option`
79
+ - `?` operator for error propagation — avoid manual `match` on `Result` when `?` suffices
80
+ - Document every public item with `///` doc comments including `# Examples` sections for non-trivial APIs
81
+ - Use `#[must_use]` on functions whose return values should not be ignored
82
+ - Include complete `use` statements in all code examples
83
+
84
+ ## Verification Specifics
85
+
86
+ - **Type checking**: `cargo check` (fast compile without codegen — catches all type errors)
87
+ - **Linting**: `cargo clippy` (idiomatic Rust lints, catches common mistakes)
88
+ - **Testing**: `cargo test` (unit tests, integration tests, doc tests, examples)
89
+ - **Documentation**: `cargo doc --no-deps` (ensures documentation compiles, catches broken links)
90
+ - **Formatting**: `cargo fmt --check` (ensures code matches `rustfmt` style)
91
+ - **Unsafe audit**: `cargo geiger` (if security-sensitive — counts unsafe blocks)
92
+
93
+ ### Runtime Entrypoints & Bootstrap-Wiring Sites
94
+
95
+ Used by `CHECK-I22` (a runtime-required bootstrap needs a **non-test** caller on one of these) and
96
+ `CHECK-I23` (a heavy init wired into a **universal** bootstrap entry should move to a lazier site).
97
+
98
+ - **Runtime entrypoints (a legitimate non-test call site):** `fn main()` in `main.rs` or a `[[bin]]`
99
+ target, an async runtime entry (`#[tokio::main]`), an HTTP handler registered on an axum/actix/warp
100
+ router, or a worker task spawned from `main` — not a `#[cfg(test)]` module or a `tests/` integration
101
+ file.
102
+ - **Universal bootstrap entries (run on every startup — the `CHECK-I23` risk site):** a `lazy_static!`
103
+ / `once_cell::sync::Lazy` static that eagerly constructs heavy clients, a single `bootstrap`/`setup`
104
+ fn `main` calls before serving, or a `#[ctor]`-style pre-`main` initializer. A `Lazy` static is only
105
+ a risk when it is *forced* at startup rather than on first use.
106
+ - **Heavy server-only import markers (what makes an init "heavy" for `CHECK-I23`):** DB pools
107
+ (`sqlx::Pool`, `diesel`, `deadpool`, `mongodb`), message/queue clients (`rdkafka`, `lapin`,
108
+ `redis`), telemetry SDKs (`opentelemetry`, `sentry`), or a broad internal service crate. Constructing
109
+ any of these eagerly at a universal entry is the CHECK-I23 pattern — recommend a `OnceCell`/`Lazy`
110
+ forced on **first use** by the handler that needs it, not at process start.
111
+
112
+ ## Testing
113
+
114
+ - **Framework**: Built-in test harness (`#[test]`, `#[cfg(test)]`)
115
+ - **Test command**: `cargo test` for all, `cargo test test_name` for specific, `cargo test --lib` for unit only
116
+ - **Unit tests**: `#[cfg(test)] mod tests` at bottom of source files
117
+ - **Integration tests**: `tests/` directory, each file is a separate crate
118
+ - **Doc tests**: Code in `///` comments, verified by `cargo test --doc`
119
+ - **Assertions**: `assert!`, `assert_eq!`, `assert_ne!` with optional format messages
120
+ - **Async tests**: `#[tokio::test]` macro for async test functions
121
+ - **Snapshot testing**: `insta` crate with `assert_snapshot!` / `assert_debug_snapshot!`
122
+ - **Coverage**: `cargo llvm-cov` or `cargo tarpaulin`
123
+ - **Benchmarks**: `criterion` crate or built-in `#[bench]` (nightly)
124
+
125
+ ## Common Frameworks
126
+
127
+ | Category | Options |
128
+ |----------|---------|
129
+ | Web (async) | axum, actix-web, rocket, warp |
130
+ | Serialization | serde, serde_json, serde_yaml, toml |
131
+ | Async runtime | tokio, async-std, smol |
132
+ | Database | sqlx, diesel, sea-orm |
133
+ | Migrations | sqlx-cli, diesel-cli, refinery |
134
+ | CLI | clap, argh, structopt (legacy) |
135
+ | Observability | tracing, tracing-subscriber, metrics |
136
+ | HTTP client | reqwest, hyper, ureq (blocking) |
137
+ | Middleware | tower, tower-http, actix middleware |
138
+ | Error handling | thiserror (library), anyhow (application), eyre |
139
+
140
+ ## Example: Project-Level Override
141
+
142
+ Create `.feature-forge/stack-decisions.md` (legacy alias: `.claude/references/stack-decisions.md`) in your project root:
143
+
144
+ ```markdown
145
+ # Stack Decisions
146
+
147
+ ## Runtime & Build
148
+ - Rust stable (edition 2021)
149
+ - Cargo workspace with crates/ directory
150
+
151
+ ## Backend
152
+ - axum for HTTP framework
153
+ - sqlx with PostgreSQL (compile-time query checking)
154
+ - tokio as async runtime
155
+
156
+ ## Serialization & Validation
157
+ - serde for serialization/deserialization
158
+ - Custom validation via trait implementations
159
+
160
+ ## Testing
161
+ - Built-in #[test] with assert macros
162
+ - Integration tests in tests/ directory
163
+ - insta for snapshot testing
164
+
165
+ ## Conventions
166
+ - thiserror for library error types, anyhow in binary
167
+ - tracing for structured logging
168
+ - cargo clippy must pass with no warnings
169
+ - All public APIs documented with /// and examples
170
+ ```
@@ -0,0 +1,134 @@
1
+ # TypeScript Stack Profile
2
+
3
+ Stack-specific guidance for TypeScript projects (Node.js/Bun, monorepo or single-package).
4
+
5
+ ## Stack Identity
6
+
7
+ - **Language**: TypeScript
8
+ - **Runtime**: Node.js or Bun (check `package.json` `engines` field and lock files)
9
+ - **Package management**: npm, pnpm, yarn, or bun (check for respective lock files)
10
+ - **Common monorepo tools**: Turborepo (`turbo.json`), Nx (`nx.json`), Lerna (`lerna.json`)
11
+
12
+ ## Discovery Checklist
13
+
14
+ When examining a TypeScript project, check for:
15
+
16
+ - **Runtime**: Bun or Node.js (check `package.json` for which)
17
+ - **Package management**: Check for `bun.lockb`, `pnpm-lock.yaml`, `package-lock.json`, or `yarn.lock`
18
+ - **Monorepo**: Check for `turbo.json` (Turborepo), `nx.json` (Nx), or `lerna.json` (Lerna)
19
+ - **Framework**: Check existing packages for Hono, Express, Fastify, etc.
20
+ - **Frontend**: Check for React, Vue, Svelte, etc.
21
+ - **Routing**: Check for TanStack Router, React Router, Next.js, etc.
22
+ - **Database**: Check for Drizzle, Prisma, TypeORM, etc.
23
+ - **Validation**: Check for Zod, Yup, io-ts, etc.
24
+ - **UI Components**: Check for shadcn/ui, Radix, MUI, etc.
25
+ - **Styling**: Check for Tailwind (v3 or v4), CSS Modules, styled-components, etc.
26
+
27
+ ## Archetype Conventions
28
+
29
+ ### 00-core-definitions.md (TypeScript)
30
+
31
+ - **Type aliases and union types**: Use `type` declarations for unions, intersections, utility types
32
+ - **Core interfaces**: Define with `interface` keyword, JSDoc on every field
33
+ - **Error class hierarchy**: Base error class extending `Error` with `code: string` property; domain-specific subclasses with typed properties
34
+ - **Constants and enums**: Use `const` declarations and `as const` assertions; prefer string union types over `enum`
35
+ - **Utility types**: Generic helpers like `Result<T, E>`, `Optional<T>`, etc.
36
+ - **Barrel exports**: Export everything from `src/index.ts`
37
+
38
+ ### 01-architecture-layout.md (TypeScript)
39
+
40
+ - **Package.json**: `name`, `exports` map (subpath exports like `.`, `./server`, `./client`, `./react`), `dependencies`, `devDependencies`, `scripts`
41
+ - **tsconfig.json**: Key compiler options, extends root config
42
+ - **Barrel export structure**: What each `index.ts` re-exports
43
+ - **Build considerations**: Bundle vs unbundled, ESM vs CJS
44
+
45
+ ### Monorepo conventions
46
+
47
+ - **Package naming**: `@repo/{name}` for shared packages, `@starter/{name}` for app-specific (adapt to project convention)
48
+ - **Internal dependencies**: Reference as `@repo/{package}` in `package.json`
49
+ - **Workspace protocol**: `"@repo/config": "workspace:*"` in pnpm, `"@repo/config": "*"` in bun
50
+
51
+ ## Spec Quality Rules
52
+
53
+ - All TypeScript must be valid syntax — not pseudocode
54
+ - Include complete interfaces with generics where applicable
55
+ - Use discriminated unions for result types (e.g., `{ success: true; data: T } | { success: false; error: E }`)
56
+ - Every interface field must have JSDoc explaining its purpose
57
+ - Include explicit import paths in all code examples
58
+ - Use `async/await` for asynchronous operations (not raw Promises)
59
+
60
+ ## Verification Specifics
61
+
62
+ - **Type checking**: `bun run typecheck`, `tsc --noEmit`, or `npx tsc --noEmit`
63
+ - **Barrel export validation**: Every `index.ts` re-exports what the spec says
64
+ - **Cross-package type checks**: `bun run typecheck` (or equivalent) passes for both the feature package AND packages that depend on it
65
+ - **Import path validation**: All import paths resolve correctly per the `exports` map in `package.json`
66
+
67
+ ### Runtime Entrypoints & Bootstrap-Wiring Sites
68
+
69
+ Used by `CHECK-I22` (a runtime-required bootstrap needs a **non-test** caller on one of these) and
70
+ `CHECK-I23` (a heavy init wired into a **universal** bootstrap entry should move to a lazier site).
71
+
72
+ - **Runtime entrypoints (a legitimate non-test call site):** a `package.json` `bin` / CLI `main`; a
73
+ server entry that actually starts listening (`src/server.ts`, `src/index.ts` invoking `listen`); a
74
+ worker/consumer file; and for Next.js — `middleware.ts`, `app/**/route.ts` route handlers,
75
+ `app/**/{page,layout,template}.tsx`, server actions, and `instrumentation.ts`. Express/Hono/Fastify:
76
+ the file that constructs the app and calls `.listen()`.
77
+ - **Universal bootstrap entries (run on every startup — the `CHECK-I23` risk site):** Next.js
78
+ `instrumentation.ts` / `instrumentation.js` (its `register()` runs once per server process before
79
+ any request), an app-server preload/`register`/`--import` hook, a root `app/layout.tsx` that
80
+ eagerly imports server singletons, and global test setup (`vitest.setup.ts`, `jest.setup.ts`) if it
81
+ bootstraps production graphs. Wiring a heavy init here loads it on **every** cold start (and, under
82
+ the dev server, on every module re-evaluation).
83
+ - **Heavy server-only import markers (what makes an init "heavy" for `CHECK-I23`):** DB/ORM clients
84
+ (`drizzle-orm`, `@prisma/client`, `pg`, `mongoose`, `kysely`), queue/worker libs (`bullmq`, `bull`,
85
+ `kafkajs`, `ioredis`), telemetry/observability SDKs (`@opentelemetry/*`, `@sentry/node`), and a
86
+ whole-service-layer barrel (`import * as services from "@repo/services"`). An init that pulls any of
87
+ these into a universal bootstrap entry is the CHECK-I23 pattern — recommend lazy init at the first
88
+ route/handler/worker that needs it.
89
+
90
+ ## Testing
91
+
92
+ - **Framework**: Vitest (most common in modern TS), Jest, or testing-library
93
+ - **Test file location**: Co-located (`*.test.ts` next to source) or in `__tests__/` directories
94
+ - **Fixture patterns**: Factory functions, test builders
95
+ - **Type testing**: `expectTypeOf` from vitest for type-level assertions
96
+
97
+ ## Common Frameworks
98
+
99
+ | Category | Options |
100
+ |----------|---------|
101
+ | Backend | Hono, Express, Fastify, Koa |
102
+ | Frontend | React, Vue, Svelte, Solid |
103
+ | Routing | TanStack Router, React Router, Next.js App Router |
104
+ | Database | Drizzle, Prisma, TypeORM, Kysely |
105
+ | Validation | Zod, Valibot, Yup, io-ts |
106
+ | UI Components | shadcn/ui, Radix, MUI, Mantine |
107
+ | Styling | Tailwind CSS, CSS Modules, styled-components, vanilla-extract |
108
+
109
+ ## Example: Project-Level Override
110
+
111
+ Create `.feature-forge/stack-decisions.md` (legacy alias: `.claude/references/stack-decisions.md`) in your project root:
112
+
113
+ ```markdown
114
+ # Stack Decisions
115
+
116
+ ## Runtime & Build
117
+ - Bun 1.x for runtime and package management
118
+ - Turborepo for monorepo orchestration
119
+
120
+ ## Backend
121
+ - Hono for HTTP framework
122
+ - Drizzle ORM with PostgreSQL
123
+ - Zod for runtime validation
124
+
125
+ ## Frontend
126
+ - React 19 with TanStack Router (SPA-first)
127
+ - shadcn/ui component library
128
+ - Tailwind CSS v4 with oklch color theming
129
+
130
+ ## Conventions
131
+ - Barrel exports from index.ts in every package
132
+ - Package naming: @repo/{name} for shared, @starter/{name} for app-specific
133
+ - Vitest for testing
134
+ ```