kataster 0.0.0-stage → 0.2.1

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 (162) hide show
  1. package/.claude/agents/acceptance-tester.md +53 -0
  2. package/.claude/agents/code-reviewer.md +56 -0
  3. package/.claude/agents/domain-architect.md +40 -0
  4. package/.claude/agents/lead-dev.md +50 -0
  5. package/.claude/agents/product-owner.md +39 -0
  6. package/.claude/agents/repo-analyst.md +78 -0
  7. package/.claude/agents/requirements-engineer.md +44 -0
  8. package/.claude/agents/ux-designer.md +64 -0
  9. package/.claude/hooks/bash-guard.ts +92 -0
  10. package/.claude/hooks/code-check.ts +37 -0
  11. package/.claude/hooks/path-guard.ts +34 -0
  12. package/.claude/hooks/path-rules.ts +66 -0
  13. package/.claude/hooks/project-check.ts +108 -0
  14. package/.claude/hooks/protect-files.ts +55 -0
  15. package/.claude/hooks/session-start.ts +213 -0
  16. package/.claude/hooks/stop-gate.ts +56 -0
  17. package/.claude/hooks/validate-docs.ts +58 -0
  18. package/.claude/lib/architecture.ts +736 -0
  19. package/.claude/lib/backlog-github.ts +454 -0
  20. package/.claude/lib/backlog-jira.ts +347 -0
  21. package/.claude/lib/backlog-sync.ts +42 -0
  22. package/.claude/lib/backlog.ts +396 -0
  23. package/.claude/lib/bazel.ts +212 -0
  24. package/.claude/lib/config.ts +122 -0
  25. package/.claude/lib/discovery.ts +821 -0
  26. package/.claude/lib/engineering.ts +406 -0
  27. package/.claude/lib/nx.ts +129 -0
  28. package/.claude/lib/repo.ts +1194 -0
  29. package/.claude/lib/toolgraph.ts +74 -0
  30. package/.claude/lib/turbo.ts +166 -0
  31. package/.claude/package-lock.json +427 -0
  32. package/.claude/package.json +21 -0
  33. package/.claude/settings.json +82 -0
  34. package/.claude/skills/adopt/SKILL.md +283 -0
  35. package/.claude/skills/adopt/scripts/boundary-check.ts +156 -0
  36. package/.claude/skills/adopt/scripts/package-doc.ts +71 -0
  37. package/.claude/skills/adopt/scripts/repo-map.ts +123 -0
  38. package/.claude/skills/adopt/scripts/rule-doc.ts +80 -0
  39. package/.claude/skills/architect/ADR-FORMAT.md +97 -0
  40. package/.claude/skills/architect/SKILL.md +64 -0
  41. package/.claude/skills/architect/TECH-STACK.md +21 -0
  42. package/.claude/skills/backlog/SKILL.md +198 -0
  43. package/.claude/skills/backlog/scripts/backlog-pull.ts +45 -0
  44. package/.claude/skills/backlog/scripts/backlog-push.ts +38 -0
  45. package/.claude/skills/backlog/scripts/backlog-status.ts +32 -0
  46. package/.claude/skills/backlog/scripts/jira-import.ts +40 -0
  47. package/.claude/skills/backlog/scripts/jira-plan.ts +26 -0
  48. package/.claude/skills/backlog/scripts/jira-record.ts +41 -0
  49. package/.claude/skills/bootstrap/SKILL.md +119 -0
  50. package/.claude/skills/codebase-design/DEEPENING.md +37 -0
  51. package/.claude/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  52. package/.claude/skills/codebase-design/SKILL.md +114 -0
  53. package/.claude/skills/domain-model/CONTEXT-FORMAT.md +47 -0
  54. package/.claude/skills/domain-model/SKILL.md +64 -0
  55. package/.claude/skills/domain-model/templates/data-model.md +29 -0
  56. package/.claude/skills/engineering-conventions/SKILL.md +31 -0
  57. package/.claude/skills/event-storming/SKILL.md +44 -0
  58. package/.claude/skills/event-storming/schema/events.schema.json +124 -0
  59. package/.claude/skills/event-storming/scripts/render-event-storming.ts +11 -0
  60. package/.claude/skills/event-storming/scripts/validate-events.ts +11 -0
  61. package/.claude/skills/event-storming/templates/events.example.yaml +91 -0
  62. package/.claude/skills/feature/SKILL.md +86 -0
  63. package/.claude/skills/feature/scripts/intake.ts +356 -0
  64. package/.claude/skills/grill-me/SKILL.md +7 -0
  65. package/.claude/skills/grill-with-docs/SKILL.md +7 -0
  66. package/.claude/skills/grilling/SKILL.md +30 -0
  67. package/.claude/skills/groom-backlog/SKILL.md +93 -0
  68. package/.claude/skills/groom-backlog/scripts/backlog-health.ts +238 -0
  69. package/.claude/skills/implement/SKILL.md +129 -0
  70. package/.claude/skills/implement/scripts/affected.ts +245 -0
  71. package/.claude/skills/implement/scripts/check-commands.ts +37 -0
  72. package/.claude/skills/implement/scripts/check-language.ts +15 -0
  73. package/.claude/skills/implement/scripts/check-scenarios.ts +59 -0
  74. package/.claude/skills/implement/scripts/next-story.ts +23 -0
  75. package/.claude/skills/implement/scripts/story-context.ts +135 -0
  76. package/.claude/skills/implement/scripts/story-status.ts +47 -0
  77. package/.claude/skills/implement/scripts/verify.ts +92 -0
  78. package/.claude/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
  79. package/.claude/skills/improve-codebase-architecture/SKILL.md +71 -0
  80. package/.claude/skills/retro/SKILL.md +53 -0
  81. package/.claude/skills/review-stories/SKILL.md +31 -0
  82. package/.claude/skills/shape/SKILL.md +193 -0
  83. package/.claude/skills/tdd/SKILL.md +38 -0
  84. package/.claude/skills/tdd/mocking.md +59 -0
  85. package/.claude/skills/tdd/tests.md +77 -0
  86. package/.claude/skills/user-stories/SKILL.md +138 -0
  87. package/.claude/skills/user-stories/schema/story.schema.json +39 -0
  88. package/.claude/skills/user-stories/scripts/render-backlog.ts +4 -0
  89. package/.claude/skills/user-stories/scripts/validate-stories.ts +13 -0
  90. package/.claude/skills/user-stories/templates/story-template.md +38 -0
  91. package/.claude/skills/ux-design/SKILL.md +107 -0
  92. package/.claude/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
  93. package/.claude/skills/writing-for-agents/SKILL.md +81 -0
  94. package/.claude/tsconfig.json +15 -0
  95. package/.opencode/agents/acceptance-tester.md +64 -0
  96. package/.opencode/agents/code-reviewer.md +69 -0
  97. package/.opencode/agents/domain-architect.md +59 -0
  98. package/.opencode/agents/lead-dev.md +67 -0
  99. package/.opencode/agents/product-owner.md +59 -0
  100. package/.opencode/agents/repo-analyst.md +86 -0
  101. package/.opencode/agents/requirements-engineer.md +58 -0
  102. package/.opencode/agents/ux-designer.md +83 -0
  103. package/.opencode/commands/adopt.md +7 -0
  104. package/.opencode/commands/backlog-sync.md +7 -0
  105. package/.opencode/commands/bootstrap.md +7 -0
  106. package/.opencode/commands/event-storming.md +7 -0
  107. package/.opencode/commands/feature.md +7 -0
  108. package/.opencode/commands/grill-me.md +7 -0
  109. package/.opencode/commands/grill-with-docs.md +7 -0
  110. package/.opencode/commands/groom-backlog.md +7 -0
  111. package/.opencode/commands/implement.md +7 -0
  112. package/.opencode/commands/improve-codebase-architecture.md +7 -0
  113. package/.opencode/commands/retro.md +7 -0
  114. package/.opencode/commands/review-stories.md +7 -0
  115. package/.opencode/commands/shape.md +7 -0
  116. package/.opencode/opencode.jsonc +15 -0
  117. package/.opencode/plugins/kataster/index.ts +283 -0
  118. package/AGENTS.md +21 -0
  119. package/CHANGELOG.md +91 -0
  120. package/LICENSE +21 -0
  121. package/README.md +331 -2
  122. package/bin/kataster.mjs +7 -0
  123. package/extras/skills/shadcn/SKILL.md +277 -0
  124. package/extras/skills/shadcn/agents/openai.yml +5 -0
  125. package/extras/skills/shadcn/assets/shadcn-small.png +0 -0
  126. package/extras/skills/shadcn/assets/shadcn.png +0 -0
  127. package/extras/skills/shadcn/cli.md +290 -0
  128. package/extras/skills/shadcn/customization.md +209 -0
  129. package/extras/skills/shadcn/evals/evals.json +77 -0
  130. package/extras/skills/shadcn/mcp.md +105 -0
  131. package/extras/skills/shadcn/registry.md +277 -0
  132. package/extras/skills/shadcn/rules/base-vs-radix.md +306 -0
  133. package/extras/skills/shadcn/rules/chat.md +250 -0
  134. package/extras/skills/shadcn/rules/composition.md +213 -0
  135. package/extras/skills/shadcn/rules/forms.md +192 -0
  136. package/extras/skills/shadcn/rules/icons.md +101 -0
  137. package/extras/skills/shadcn/rules/styling.md +185 -0
  138. package/guide/README.md +9 -0
  139. package/guide/brownfield.md +242 -0
  140. package/guide/concepts.md +109 -0
  141. package/guide/greenfield.md +84 -0
  142. package/guide/install.md +144 -0
  143. package/guide/release.md +92 -0
  144. package/package.json +56 -4
  145. package/src/cli.mjs +302 -0
  146. package/src/detect.mjs +237 -0
  147. package/src/install.mjs +427 -0
  148. package/src/repo.mjs +129 -0
  149. package/src/util.mjs +110 -0
  150. package/templates/CONTEXT.md +21 -0
  151. package/templates/conventions.md +63 -0
  152. package/templates/docs/adr/README.md +7 -0
  153. package/templates/docs/architecture/data-model.md +31 -0
  154. package/templates/docs/domain/context-map.md +21 -0
  155. package/templates/docs/domain/events.yaml +23 -0
  156. package/templates/docs/product/initiatives/README.md +41 -0
  157. package/templates/docs/product/ux-guidelines.md +27 -0
  158. package/templates/docs/product/vision.md +36 -0
  159. package/templates/docs/reviews/.gitkeep +0 -0
  160. package/templates/docs/stories/OPEN_QUESTIONS.md +8 -0
  161. package/templates/docs/stories/README.md +26 -0
  162. package/templates/docs/workflow.md +135 -0
@@ -0,0 +1,242 @@
1
+ # Brownfield: adopting an existing repository
2
+
3
+ The repository already works. The goal is not a rewrite and not a documentation exercise – it is to recover the
4
+ domain the code encodes, in the user's language, and then decide what to build next.
5
+
6
+ ```bash
7
+ npx kataster init --brownfield
8
+ # in the harness
9
+ /adopt # map the repository, then choose a slice
10
+ /adopt apps/billing # adopt one package
11
+ /adopt libs/shared-kernel # adopt a shared library
12
+ ```
13
+
14
+ ## Adopt in slices, not in one pass
15
+
16
+ A monorepo with eighty packages cannot be understood in one session. `/adopt` therefore works in two levels:
17
+
18
+ 1. **Repository map** – deterministic, no questions: which build tool drives the repository, where the packages
19
+ are, how they depend on each other, which ones change most.
20
+ 2. **One slice** – one domain plus at most one shared library. Deep evidence, grilling, package docs, checks.
21
+ Then the next slice in a later session.
22
+
23
+ The map is generated from manifests and git history:
24
+
25
+ - `docs/architecture/repo-map.json` – packages, paths, kinds, internal dependencies, consumers, adoption ranking
26
+ - `docs/architecture/repo-map.md` – the same as a readable map, plus dependency edges and a suggested first slice
27
+ - the **repository block in `AGENTS.md`** – tooling, layout, commands, adopted slices
28
+ - `.claude/project.json` → `repo.tooling` – Nx, Turborepo, Bazel, pnpm/npm/yarn workspaces, Go, Cargo, Gradle, Maven
29
+
30
+ The map is facts, not domain. It says where code lives, never what a word means.
31
+
32
+ ## What `/adopt` does
33
+
34
+ ### 1. Chooses the slice with you
35
+
36
+ The ranking weighs recent churn, fan-in and kind – not size. The suggested slice is usually one domain plus the
37
+ shared library it uses most. You can pick another; the rule stays: **one domain, at most one shared library**.
38
+
39
+ A simple repository without monorepo tooling is one slice – then the whole repository is in scope.
40
+
41
+ ### 2. Reads before it analyses
42
+
43
+ `CONTEXT.md`, `docs/`, `README*`, `AGENTS.md`/`CLAUDE.md`, existing ADRs. Existing documentation is **primary
44
+ evidence** and outranks inference from code. Contradictions between docs and code are findings.
45
+
46
+ ### 3. Dispatches read-only analysts for the slice
47
+
48
+ A monorepo gets three lenses:
49
+
50
+ | Lens | Typical evidence |
51
+ |---|---|
52
+ | Structure, data and entry points | manifests, entry points, schema, migrations, enums, external services, jobs, the slice's dependencies and consumers |
53
+ | Language, behaviour and tests | types, routes, UI texts, errors, validations, permissions, tests as executable specifications |
54
+ | Architecture, dependencies and history | layering and import direction from the repo map, build tooling, config that encodes a decision, `git log` hotspots |
55
+
56
+ A small repository without monorepo tooling gets the five classic lenses: structure and stack, domain language,
57
+ data and integrations, behaviour and tests, history and decisions.
58
+
59
+ Each analyst returns facts with `path:line`, candidate vocabulary, candidate events/commands/read models,
60
+ contradictions, and questions with a recommended answer. Confidence is `high`, `medium` or `low`.
61
+
62
+ ### 4. Drafts the slice
63
+
64
+ - `CONTEXT.md` – the slice's terms, competing spellings under `_Avoid_`
65
+ - `docs/domain/events.yaml` – 10–25 candidate events, commands, actors, read models, flows, hotspots
66
+ - `docs/domain/context-map.md`, `docs/architecture/data-model.md` (as-is)
67
+ - `docs/engineering/conventions.md` – how the code actually works today, including the monorepo tooling
68
+ - `docs/adr/` – de-facto decisions worth recording (`status: proposed`)
69
+ - **package docs** – `<package>/AGENTS.md` plus `<package>/CLAUDE.md`, written by
70
+ `node .claude/skills/adopt/scripts/package-doc.ts <path>`
71
+
72
+ Everything uncertain is marked. The draft is a proposal, not a verdict.
73
+
74
+ ### 5. Grills you against the draft
75
+
76
+ This is the core. Rounds of numbered questions on the frontier, each with a recommended answer:
77
+
78
+ > **Q1 – One concept, three names.** You call it `Order`, `Purchase` and `Checkout` in three places
79
+ > (`src/orders/*`, `src/api/checkout.ts`, `messages/en.json`). Is it one concept, and which is the domain word?
80
+ >
81
+ > ➡️ One concept, "Order"; `Checkout` is the UI action, `Purchase` should be avoided.
82
+
83
+ Answers update `CONTEXT.md`, `events.yaml` and the package's `AGENTS.md` immediately. Resolved hotspots get a
84
+ resolution; new uncertainty becomes a new hotspot.
85
+
86
+ ### 6. Builds the safety net
87
+
88
+ For every confirmed hard rule, choose the cheapest deterministic enforcement: type system, lint/boundary check,
89
+ architecture or characterization test, hook, or documentation only. Brownfield checks start **report-only** with a
90
+ baseline of existing violations; only new violations fail. A hook that is red on day one gets switched off.
91
+
92
+ `/adopt` may add characterization tests and tooling. It never changes production code, and it never writes a test
93
+ that fails on existing behaviour – that would be a story.
94
+
95
+ ### 7. Records the gap – stories only on request
96
+
97
+ | Class | Default |
98
+ |---|---|
99
+ | Exists and is intended | Documentation (data model, context map) – no action |
100
+ | Exists but contradicts the model | Candidate in the gap register |
101
+ | Missing | Candidate in the gap register |
102
+ | Dead | Candidate: removal or an explicit "leave it" |
103
+
104
+ **The first adoption pass creates no stories.** It records the gap in `docs/domain/adoption-report.md` (and open
105
+ questions in `OPEN_QUESTIONS.md`), so the model can be reviewed before anyone commits to work. Only
106
+ `/adopt <scope> --stories` (or an explicit "turn these into stories") delegates the selected gaps to
107
+ `requirements-engineer`.
108
+
109
+ **Behaviour that already works does not become a story.** That turns the backlog into a description of the past.
110
+
111
+ ### 8. Writes the report and marks the slice adopted
112
+
113
+ `docs/domain/adoption-report.md`: scope, map and slice, facts, confirmed model, package docs, contradictions, rules
114
+ and checks, gaps, what was deliberately left alone, open hotspots, next slice.
115
+
116
+ ```bash
117
+ node .claude/skills/adopt/scripts/repo-map.ts --adopt apps/billing
118
+ ```
119
+
120
+ The next session sees the progress in `AGENTS.md` and the map, and starts the next slice with
121
+ `/adopt <path>`.
122
+
123
+ ## What lives where
124
+
125
+ | File | Loaded | Contains |
126
+ |---|---|---|
127
+ | `AGENTS.md` (root) | every session | repository structure, commands, hard conventions, links – **no domain** |
128
+ | `<package>/AGENTS.md` | when working in that package | purpose, key entities or public API, interfaces, pitfalls, boundaries |
129
+ | `<package>/CLAUDE.md` | same, for Claude Code | one line: `@AGENTS.md` |
130
+ | `<group>/AGENTS.md` | when working under that group | rules for a whole group, e.g. `libs/**` – plus `<group>/CLAUDE.md` |
131
+ | `.claude/rules/*.md` | when a matching file is touched (both harnesses) | path-scoped rules for patterns a directory cannot express |
132
+ | `docs/architecture/boundaries.yaml` | on demand / on check | allowed and forbidden dependency edges (first match wins) |
133
+ | `docs/architecture/boundaries.baseline.json` | on check | existing violations, so only new ones fail |
134
+ | `docs/engineering/checks.yaml` | on check | what runs at edit time and at Stop/CI |
135
+ | `docs/architecture/repo-map.md` | on demand | generated map: packages, edges, consumers, ranking |
136
+ | `CONTEXT.md` | every session | the domain language |
137
+
138
+ Nested `AGENTS.md` is loaded on demand by OpenCode; Claude Code loads the nested `CLAUDE.md` when it reads or
139
+ edits a file there. That is why every package gets both files.
140
+
141
+ ## Monorepos and shared libraries
142
+
143
+ The detected tool is used, not re-implemented:
144
+
145
+ | Tool | One package | Affected only |
146
+ |---|---|---|
147
+ | Nx | `nx run <project>:test` | `nx affected -t test` |
148
+ | Turborepo | `turbo run test --filter=<package>` | `turbo run test --filter='...[HEAD^1]'` |
149
+ | Bazel | `bazel test //<package>/...` | – (query at work time) |
150
+ | pnpm | `pnpm --filter <package> test` | `pnpm -r --filter '...[HEAD^1]' test` |
151
+ | npm/yarn workspaces | `npm run test --workspace <package>` / `yarn workspace <package> test` | – |
152
+ | Go / Cargo / Gradle / Maven | language-specific, in the package doc | – |
153
+
154
+ When a shared library changes, its consumers from the map are the first thing to check; run their tests or the
155
+ affected set. The library's `AGENTS.md` records its public API, consumers and compatibility rules.
156
+
157
+ The map asks the build tool for its own graph and stores it as an optional `toolGraph` next to the manifest
158
+ graph – Turborepo via `turbo run <task> --dry=json`, Nx via `nx graph --file=<temp>`, Bazel from the `deps`
159
+ attributes in `BUILD`/`BUILD.bazel`. The fast loop then uses it:
160
+
161
+ ```bash
162
+ # which packages are affected by these files, including shared-library dependents?
163
+ node .claude/skills/implement/scripts/affected.ts --changed libs/shared-kernel/src/index.ts
164
+
165
+ # or against a base ref; the tool's native affected filter is emitted
166
+ node .claude/skills/implement/scripts/affected.ts --base origin/main
167
+
168
+ # execute the printed command
169
+ node .claude/skills/implement/scripts/affected.ts --changed apps/billing/src/index.ts --run
170
+ ```
171
+
172
+ The output is a native command: Turborepo gets `turbo run test --filter=…`, Nx `nx run-many -p …` or
173
+ `nx affected`, Bazel `bazel test //pkg/...`, and so on. Nx project names are resolved from the graph, so
174
+ `billing` and `@acme/billing` do not have to match. If the tool is not installed (or does not answer), the
175
+ manifest graph is used instead – the workflow never depends on the tool being present.
176
+
177
+ ## Rules, boundaries and checks
178
+
179
+ Confirmed architecture rules become deterministic, not prose:
180
+
181
+ ```bash
182
+ node .claude/skills/adopt/scripts/boundary-check.ts --init
183
+ # edit docs/architecture/boundaries.yaml with the rules the user confirmed
184
+ node .claude/skills/adopt/scripts/boundary-check.ts --update-baseline
185
+ node .claude/skills/adopt/scripts/boundary-check.ts
186
+ ```
187
+
188
+ `boundaries.yaml` holds edges, not stories:
189
+
190
+ ```yaml
191
+ version: 1
192
+ engine: auto # scan JS/TS imports, or command for your own tool
193
+ command: ""
194
+ rules:
195
+ - id: shared-libs-are-leaves
196
+ from: "libs/**"
197
+ to: ["apps/**", "services/**"]
198
+ effect: deny
199
+ reason: "Shared libraries never import applications or services."
200
+ ```
201
+
202
+ Rules are evaluated in order; the first matching `from` → `to` pair decides, no match means allow. The `scan`
203
+ engine reads JS/TS imports; `command` runs dependency-cruiser, Nx module boundaries, Bazel, ArchUnit,
204
+ import-linter or your own script and ratchets its failure output.
205
+
206
+ **Baseline/ratchet:** `--update-baseline` freezes what already exists. After that only new violations fail, so a
207
+ brownfield repository is green on day one and the baseline shrinks over time. The checks are wired once through
208
+ `project-check.ts`; `docs/engineering/checks.yaml` decides which check runs at edit time (changed file only) and
209
+ which at Stop/CI.
210
+
211
+ Path-scoped rules that a directory cannot express get a file with `paths:`:
212
+
213
+ ```bash
214
+ node .claude/skills/adopt/scripts/rule-doc.ts libs-shared --paths "libs/**" --title "Shared libraries"
215
+ ```
216
+
217
+ A rule for a whole directory belongs in `<dir>/AGENTS.md` (plus its one-line `CLAUDE.md`) – that is the mechanism
218
+ both harnesses load on demand. Path-scoped rules are read natively by Claude Code; in OpenCode the plugin attaches
219
+ the matching rule as session context as soon as a file under its globs is read or written.
220
+
221
+ ## Rules that make adoption work
222
+
223
+ - **Adopt in slices.** One bounded context completely beats the whole repository shallowly.
224
+ - **Code names are evidence, not language.** `OrderService.place()` suggests "Order placed"; the user decides.
225
+ - **Never change production code.** The output is language, model, decisions, docs and checks.
226
+ - **An 80% confirmed model with 20% hotspots beats a 100% invented one.**
227
+ - **The user owns the language.** Propose a better word; don't rename the domain alone.
228
+ - **The root `AGENTS.md` stays free of domain.** Structure and commands only.
229
+
230
+ ## After adoption
231
+
232
+ ```bash
233
+ git diff # only CONTEXT.md, docs/, package docs and tooling changed
234
+ /adopt <next> # next slice
235
+ /adopt <scope> --stories # turn the selected gaps into stories, when you want a backlog
236
+ /feature <idea | ticket> # next work, now that the domain has a language
237
+ /shape <large idea> # new service/context/migration: placement, impact, slices, cost range
238
+ /implement # once a story is ready
239
+ ```
240
+
241
+ With a tracker (`backlog.provider` = `github` or `jira`), pull before adopting or reviewing and push the derived
242
+ stories afterwards. The tracker is the source of truth; `docs/stories/` is the mirror.
@@ -0,0 +1,109 @@
1
+ # Concepts
2
+
3
+ The vocabulary the workflow uses, and why each piece exists.
4
+
5
+ ## Grilling
6
+
7
+ An interview in **rounds**. The **frontier** is every decision whose prerequisites are settled – the questions that
8
+ can be asked now without guessing at answers you haven't heard. Each question is numbered and carries a recommended
9
+ answer, worded so that "yes" accepts it. Answers reshape the tree and push the frontier outward.
10
+
11
+ Two rules make it work:
12
+
13
+ - **Facts are the agent's job, decisions are the user's.** Files, code, docs, history – look it up. Never ask the
14
+ user something you could find yourself.
15
+ - **Do not act until the frontier is empty** and the user confirms a shared understanding.
16
+
17
+ `/grill-me` is the pure form. `/grill-with-docs` adds the glossary and ADRs. Every discovery command embeds it.
18
+
19
+ ## The artifacts
20
+
21
+ | Artifact | What it is | Who owns it |
22
+ |---|---|---|
23
+ | `CONTEXT.md` | Glossary – the ubiquitous language. One canonical word per concept, alternatives under `_Avoid_` | user, maintained by the agent |
24
+ | `docs/domain/events.yaml` | Event storming model: actors, contexts, aggregates, events, commands, policies, read models, hotspots, flows | user, written by the agent |
25
+ | `docs/domain/context-map.md` | Bounded contexts and their relationships (DDD patterns) | domain-architect |
26
+ | `docs/architecture/data-model.md` | Logical, stack-neutral model per aggregate; lifecycle and ER diagrams | domain-architect |
27
+ | `docs/engineering/conventions.md` | How code is built here, including the seam catalog | user |
28
+ | `docs/adr/` | Architecture decisions. `proposed` until the user accepts; accepted ones are superseded, never edited | user |
29
+ | `docs/stories/` | The backlog. One Markdown file per story; `BACKLOG.md` is generated. With a tracker, this is the local mirror | requirements-engineer, PO, lead-dev; `/backlog-sync` with a tracker |
30
+ | `docs/product/vision.md` | Problem, user groups, goals, non-goals, success criteria | user |
31
+ | `docs/product/ux-guidelines.md` | The interface yardstick, as numbered rules with date and reason | ux-designer, approved by user |
32
+
33
+ ## Events, commands, aggregates
34
+
35
+ - An **event** is a business fact in the past tense: "Order placed". Not a button click, not "Record saved".
36
+ - A **command** is an intent that produces events: "Place order". It has an actor (or a policy) and rules.
37
+ - A **policy** is "whenever <event>, then <command>" – including time-triggered ones.
38
+ - A **read model** is what an actor needs to decide to send a command.
39
+ - An **aggregate** protects the invariants that must be consistent *immediately*. Everything else is eventually
40
+ consistent via events and policies.
41
+ - An **invariant** is stated once, on the aggregate. A command's rules list only what it adds beyond them.
42
+
43
+ IDs are prefixed and stable: `ACT-`, `EXT-`, `BC-`, `AGG-`, `EVT-`, `CMD-`, `POL-`, `RM-`, `HS-`, `FLOW-`, `ST-`.
44
+ The code carries the same IDs, which is what makes traceability checkable.
45
+
46
+ ## Stories
47
+
48
+ A story is a vertical slice of observable behaviour: `draft → review → ready → in-progress → done` (plus
49
+ `superseded`).
50
+
51
+ - **Discovery ends at `ready`.** Engineering moves `ready → in-progress → done`.
52
+ - **A story that turns out wrong goes back to `review`** with an `[OPEN]` and a row in `OPEN_QUESTIONS.md` – never
53
+ guessed into shape during implementation.
54
+ - **`done` is final.** A change to finished behaviour is a new story.
55
+ - **At most 10 scenarios.** Each is one red → green cycle. More means split.
56
+ - **A scenario title becomes a test title**: `ST-NNN: <scenario title>`. `verify.ts` checks the link.
57
+
58
+ ### Stories from tickets
59
+
60
+ `/feature` can start from an `ST-NNN`, a GitHub issue (`#123` or URL), a Jira key or a pasted ticket. The ticket is
61
+ **evidence, not a specification**: its acceptance criteria are grilled like any other claim, contradictions with the
62
+ model are findings, and the source is recorded in the story (`Source: …`). A bug gets one regression story with the
63
+ label `bug`; if the documented rule itself is wrong, it is a feature, because the rule changes. The intake is
64
+ read-only – it never writes stories, `external` links or sync state.
65
+
66
+ ## Initiatives
67
+
68
+ An **initiative** is a proposal for an idea larger than one feature: a new service, a new bounded context, a
69
+ migration, a cross-context capability. `/shape` writes it to `docs/product/initiatives/<slug>.md` after the user
70
+ confirms the summary. It answers four questions: should we, where does it belong, what changes vs. what is new, and
71
+ what does it roughly cost. It ends with one recommendation: go, go with slice 1, spike first, needs discovery, park
72
+ or no-go.
73
+
74
+ An initiative is **not** a work item: no `ready`/`done`, no stories, no second backlog. The cost is always a range
75
+ with a basis and a confidence – an analogue service is evidence, not a template. Each accepted slice then goes
76
+ through `/feature`, which creates the stories and runs the review.
77
+
78
+ ## The seam catalog
79
+
80
+ A **seam** is where a test attaches. Testing everything everywhere is not affordable, so the project agrees up front
81
+ which kind of code is tested at which seam – pure rule, command, read model, page. That catalog lives in
82
+ `docs/engineering/conventions.md`. `/implement` only stops for the user when a story needs a seam that is not in it.
83
+
84
+ ## Review lanes
85
+
86
+ Review effort follows the risk of the diff, not a fixed checklist:
87
+
88
+ - **Light lane** – small, no domain events, no command, no migration, no input handling, no new dependency:
89
+ acceptance tester only.
90
+ - **Normal lane** – code reviewer and acceptance tester in parallel, plus a bug-focused or security-focused pass when
91
+ the diff touches shared platform code or input/auth/uploads.
92
+
93
+ ## The acceptance verdict
94
+
95
+ The **acceptance tester decides** whether a story is done, not the user. The user reviews the pull request and
96
+ merges. That keeps one checkpoint with the user (merge) instead of two.
97
+
98
+ ## Why a local mirror
99
+
100
+ One Markdown file per story, versioned with the code, validated by a hook, rendered into `BACKLOG.md`. The agent can
101
+ read and write it deterministically, and the domain model and the stories can be checked against each other.
102
+
103
+ That is the whole answer for `backlog.provider: "local"`. Teams that already work in a tracker get the same properties
104
+ with `"github"` or `"jira"`: the tracker is the source of truth, `docs/stories/` is a synchronized mirror, and the
105
+ mirror is what validation, test traceability and offline work run on. The story keeps its `ST-NNN` id; the tracker key
106
+ lives in `external`. Only the backlog core syncs – reviews and open questions stay local. The tracker wins a conflict;
107
+ the local file is backed up before it is overwritten.
108
+
109
+ GitHub syncs through `gh`; Jira through `mcp-atlassian`, because MCP is reachable only from the agent.
@@ -0,0 +1,84 @@
1
+ # Greenfield: starting a new project
2
+
3
+ ```bash
4
+ npx kataster init --greenfield
5
+ # in the harness
6
+ /bootstrap
7
+ ```
8
+
9
+ The order is fixed: **vision → domain → architecture → UX → stories**. Technology comes after the domain, never
10
+ before it.
11
+
12
+ For an idea that is larger than one project – several services, a new product line – `/shape` can frame it first.
13
+ Without a domain model it will stop at `unknown` placement and send you back here; that is the correct answer, not
14
+ a failure.
15
+
16
+ ## Phase 1 – Vision
17
+
18
+ The frontier is every `[OPEN]` in `docs/product/vision.md`: problem, user groups, goals, non-goals, success criteria,
19
+ constraints, the domain in one paragraph. Grilled in rounds, each question with a recommended answer.
20
+
21
+ Two rules that do the most work:
22
+
23
+ - **No technology in this phase.** If the user starts with a framework, park it: that is an ADR after the domain,
24
+ and the domain may change the answer.
25
+ - **Force a non-goal.** A vision without a "we will not do this" is a wish list.
26
+
27
+ ## Phase 2 – Event storming
28
+
29
+ Big-picture storming, phases 1–6 of the `event-storming` skill:
30
+
31
+ 1. 8–15 suspected events, in the user's words, past tense
32
+ 2. Timeline into flows, pivotal events marked
33
+ 3. Hotspots, grilled where the user can decide now
34
+ 4. Commands and actors
35
+ 5. Policies, including time-triggered ones
36
+ 6. Read models
37
+
38
+ `docs/domain/events.yaml` is written after every phase and validated by a hook.
39
+
40
+ ## Phase 3 – Domain model and architecture
41
+
42
+ `domain-architect` proposes bounded contexts, the context map, aggregates with testable invariants, and the
43
+ logical data model. Then, in this order:
44
+
45
+ 1. **Shape** – the simplest architecture that meets the documented requirements. A monolith is the default;
46
+ anything distributed cites a requirement.
47
+ 2. **Tech stack** – one ADR, `status: proposed`, driving requirements cited. Only the user sets `accepted`.
48
+ 3. **Other decisions** – only the ones that pass the architect's three criteria.
49
+
50
+ ## Phase 4 – UX yardstick
51
+
52
+ Devices and design size, UI language(s), the states every screen needs (empty, full, rejected, no permission), and
53
+ the recurring patterns worth a guideline number. Written as rules into `docs/product/ux-guidelines.md`, with date
54
+ and reason.
55
+
56
+ ## Phase 5 – Foundation stories and the first slice
57
+
58
+ Two kinds of work, kept apart:
59
+
60
+ - **Foundation tech tasks** – repository skeleton, one quality command (`verify`), CI, test harness, auth/roles if
61
+ the vision needs them, deployment. Minimal, with `depends_on`, just in time.
62
+ - **The first vertical slice** – the smallest set of stories that delivers one real end-to-end path from the
63
+ vision, each with Gherkin scenarios.
64
+
65
+ At most 10 scenarios per story; no implementation plan inside a domain story; every story links its `events`.
66
+
67
+ ## Phase 6 – Review
68
+
69
+ `/review-stories` – one lead-dev pass over value, buildability and UX. The user approves every `ready`. With a tracker,
70
+ pull before the review and push the approved stories afterwards (`/backlog-sync`).
71
+
72
+ ## Phase 7 – Build
73
+
74
+ ```bash
75
+ node .claude/skills/implement/scripts/verify.ts # should be green
76
+ /implement # first foundation story
77
+ ```
78
+
79
+ Then `/feature <idea | ticket>` for everything after that, `/groom-backlog` once the first bounded context is complete.
80
+
81
+ ## Checkpoints
82
+
83
+ After vision, after storming, after the model, after the stories – summarize in 3–5 lines and ask whether to
84
+ continue. A bootstrap that runs to the end without a checkpoint produces a beautiful model nobody agreed to.
@@ -0,0 +1,144 @@
1
+ # Install, upgrade, troubleshoot
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ npx kataster init [dir]
7
+ ```
8
+
9
+ | Option | Effect |
10
+ |---|---|
11
+ | `--brownfield` / `--greenfield` | Sets the starting path (default: detected from the code) |
12
+ | `--name <name>` | Project name (default: `package.json` name, else directory name) |
13
+ | `--ui-language <lang>` | Language of the user interface (default `en`) |
14
+ | `--artifacts <lang>` | Language of docs, stories, code comments (default `en`) |
15
+ | `--backlog <provider>` | Where stories live: `local` (default), `github`, `jira` |
16
+ | `--jira-project <key>` | Jira project key (with `--backlog jira`) |
17
+ | `--github-repo <repo>` | `owner/name` for a GitHub backlog (default: the current repository) |
18
+ | `--with <list>` | Optional extras, comma-separated (`shadcn`) |
19
+ | `--yes`, `-y` | Non-interactive: accept the detected defaults |
20
+ | `--no-install` | Skip `npm install --prefix .claude` |
21
+ | `--dry-run` | Show what would happen, write nothing |
22
+
23
+ The installer:
24
+
25
+ - copies `.claude/`, `.opencode/`, `AGENTS.md` and the `docs/` skeleton,
26
+ - **merges** into an existing `AGENTS.md` (marker block), `.claude/settings.json` (hooks and permissions) and
27
+ `.opencode/opencode.jsonc` (watcher ignore list),
28
+ - detects stack, package manager, code roots and commands into `.claude/project.json`,
29
+ - records the backlog backend in `.claude/project.json` (`local`, `github` or `jira`),
30
+ - adds `.claude/node_modules/`, `.claude/state/` and `.kataster/` to `.gitignore`,
31
+ - installs the tooling dependency (`yaml`) into `.claude/`,
32
+ - records every managed file with a hash in `.claude/install.json`.
33
+
34
+ Existing `CONTEXT.md` and `docs/` are never overwritten.
35
+
36
+ ## Verify the installation
37
+
38
+ ```bash
39
+ npx kataster doctor
40
+ ```
41
+
42
+ Checks Node version, workflow files, manifest, profile, tooling dependencies, the docs skeleton, whether
43
+ `docs/domain/events.yaml` validates, and the backlog backend (Jira project/MCP server or GitHub CLI/auth).
44
+
45
+ ## Upgrade
46
+
47
+ ```bash
48
+ npx kataster upgrade
49
+ ```
50
+
51
+ - Workflow files that you did not change are replaced.
52
+ - Workflow files you **did** change are kept and listed as conflicts; `--force` overwrites them and writes a backup
53
+ to `.kataster/backup/<timestamp>/`.
54
+ - Project content (`CONTEXT.md`, `docs/`, `.claude/project.json`) is never touched.
55
+ - An installation made under the old name (La Guardia) is migrated in place: `.laguardia/` becomes `.kataster/`, the
56
+ OpenCode adapter moves to `.opencode/plugins/kataster/`, and the marker blocks in `AGENTS.md`/`CLAUDE.md` are
57
+ rewritten. `backlog.labelPrefix` in `project.json` is kept, so labels already in GitHub or Jira stay valid.
58
+ - An existing `project.json` keeps its content. If it predates the backlog backend, add the `backlog` section by hand
59
+ (see the README) – without it the provider stays `local`.
60
+ - `--with` can add extras on upgrade.
61
+
62
+ ## Harness setup
63
+
64
+ ### OpenCode
65
+
66
+ Nothing to configure. `.opencode/commands/` provides the slash commands, `.opencode/agents/` the subagents, and
67
+ `.opencode/plugins/kataster/index.ts` wires the `.claude/hooks/*.ts` scripts into OpenCode's hook events.
68
+ `.opencode/opencode.jsonc` only holds watcher ignores.
69
+
70
+ ### Claude Code
71
+
72
+ `.claude/settings.json` wires the same hooks (`SessionStart`, `PreToolUse`, `PostToolUse`, `Stop`). Skills in
73
+ `.claude/skills/` and agents in `.claude/agents/` are discovered automatically. Approve the project hooks once when
74
+ Claude Code asks.
75
+
76
+ ### Both
77
+
78
+ Both harnesses read `AGENTS.md`. Claude Code reads `CLAUDE.md` first; the installer creates one containing
79
+ `@AGENTS.md`, or adds that import block to an existing `CLAUDE.md` without touching your house rules. The workflow
80
+ lives in `.claude/`; `.opencode/` is an adapter. An existing `.claude/` is merged: skills, rules and settings that
81
+ do not collide with a workflow file are left alone.
82
+
83
+ **Models.** OpenCode agents inherit the session's model; set `model:` in `.opencode/agents/*.md` if you want a
84
+ specific one per role (the review agents are the ones where a stronger model pays off). Claude Code agents use the
85
+ aliases `sonnet`/`opus` in `.claude/agents/*.md`; adjust them to the models you have.
86
+
87
+ ### Backlog backends
88
+
89
+ `local` needs nothing. `github` needs the `gh` CLI, authenticated with the `repo` scope; set
90
+ `backlog.github.repo` if it is not the current repository. `jira` needs the `mcp-atlassian` server in your harness and
91
+ a real `backlog.jira.project`; the status and priority maps must match the project's workflow.
92
+
93
+ - Claude Code: add the server to `.mcp.json` and approve it once.
94
+ - OpenCode: add it to the `mcp` block in `opencode.jsonc`.
95
+
96
+ ```jsonc
97
+ {
98
+ "mcp": {
99
+ "mcp-atlassian": {
100
+ "type": "local",
101
+ "command": ["uvx", "mcp-atlassian"],
102
+ "enabled": true,
103
+ "environment": { "JIRA_URL": "https://…", "JIRA_USERNAME": "…", "JIRA_API_TOKEN": "…" }
104
+ }
105
+ }
106
+ }
107
+ ```
108
+
109
+ Then `/backlog-sync pull|push` (or the `backlog` skill) keeps `docs/stories/` in step with the tracker. The tracker is
110
+ the source of truth; the local directory is the mirror that validation and test traceability run on. Reviews and open
111
+ questions stay local.
112
+
113
+ ## Troubleshooting
114
+
115
+ **"Tooling dependencies are missing"** – run `npm install --prefix .claude`. The validators and hooks need `yaml`.
116
+
117
+ **Hooks don't run in OpenCode** – the plugin spawns the project's `node`. If Node is not on `PATH`, set
118
+ `KATASTER_NODE` to the binary.
119
+
120
+ **`verify` skips project checks** – `commands` in `.claude/project.json` are empty. Fill in `lint`, `typecheck`,
121
+ `test` (and `e2e`) with the commands this repository actually uses.
122
+
123
+ **The stack detection is wrong** – it is a starting point. Edit `.claude/project.json`; nothing else reads the
124
+ detection.
125
+
126
+ **The backlog sync fails** – `npx kataster doctor` checks the provider. GitHub: `gh auth status`. Jira: the
127
+ `mcp-atlassian` server must be configured in the harness and `backlog.jira.project` must be set.
128
+ `node .claude/skills/backlog/scripts/backlog-status.ts` shows what is linked and what drifted.
129
+
130
+ **An accepted ADR can't be edited** – by design. Write a new ADR and set the old one's status to
131
+ `superseded by ADR-NNNN`. The hook allows exactly that.
132
+
133
+ **Upgrade reports conflicts** – those are files you changed. Review the diff, then either keep your version or run
134
+ `upgrade --force` (a backup is written to `.kataster/backup/`).
135
+ `upgrade --force` (backup is written).
136
+
137
+ ## Uninstall
138
+
139
+ ```bash
140
+ rm -rf .claude .opencode .kataster
141
+ # keep CONTEXT.md and docs/ – they are your project's domain
142
+ ```
143
+
144
+ Remove the Kataster block from `AGENTS.md` and the `.gitignore` entries if you want a clean slate.
@@ -0,0 +1,92 @@
1
+ # Release
2
+
3
+ ## 1. Prepare
4
+
5
+ 1. Bump `version` in `package.json`. The package is `0.x`: a breaking change – a renamed command, a removed flag, a
6
+ moved directory – bumps the minor number, everything else the patch number.
7
+ 2. Move the `Unreleased` section of `CHANGELOG.md` under the new version.
8
+ 3. Check the tree:
9
+
10
+ ```bash
11
+ npm install --prefix .claude --no-audit --no-fund
12
+ npm run typecheck --prefix .claude
13
+ npm test
14
+ npm pack --dry-run # 162 files, 256 kB – no examples/, no node_modules, no state/
15
+ ```
16
+
17
+ 4. Install the tarball once and start a throwaway project with it – a tarball that installs is not the same as a
18
+ tarball that works:
19
+
20
+ ```bash
21
+ npm pack
22
+ npm install -g --prefix "$(mktemp -d)" ./kataster-*.tgz
23
+ kataster init /tmp/smoke --yes
24
+ kataster doctor /tmp/smoke
25
+ ```
26
+
27
+ ## 2. Publish
28
+
29
+ ### Through CI (the normal case)
30
+
31
+ The tag publishes. `v0.2.0` starts `.github/workflows/release.yml`, which checks that the tag matches
32
+ `package.json`, runs the type check and the suite, then publishes over OIDC – no npm token in the repository, no
33
+ one-time password, and provenance attestations are written automatically.
34
+
35
+ ```bash
36
+ git push origin main
37
+ git tag -a v0.2.0 -m "Kataster 0.2.0"
38
+ git push origin v0.2.0
39
+ gh run watch
40
+ ```
41
+
42
+ If the tag and `package.json` disagree, the workflow fails before it publishes – bump the version first, then tag.
43
+
44
+ ### The first time only: trusted publisher
45
+
46
+ npm has to know which workflow may publish. On npmjs.com → `kataster` → Settings → **Trusted publishing** →
47
+ GitHub Actions:
48
+
49
+ | Field | Value |
50
+ |---|---|
51
+ | Organization or user | `hemi1986` |
52
+ | Repository | `kataster` |
53
+ | Workflow filename | `release.yml` |
54
+ | Environment name | – (leave empty) |
55
+ | Allowed actions | **Allow npm publish** (the default `npm stage publish` alone is not enough) |
56
+
57
+ The first publish has to succeed within **two days**, otherwise the configuration expires and has to be created
58
+ again. Once it works, lock the old path down: Settings → **Publishing access** → "Require two-factor authentication
59
+ and disallow tokens". Trusted publishers keep working; tokens and OTP stop working.
60
+
61
+ ### By hand (fallback)
62
+
63
+ If CI is unavailable or a version has to go out without a tag:
64
+
65
+ ```bash
66
+ npm login # once per machine
67
+ npm publish --access public
68
+ ```
69
+
70
+ `prepublishOnly` runs the test suite, so a red suite cannot be published.
71
+
72
+ ## 3. Verify
73
+
74
+ ```bash
75
+ npm view kataster version
76
+ npx kataster@latest --version
77
+ ```
78
+
79
+ The package page shows a provenance badge (`built and signed on GitHub Actions`) and the workflow run is linked to
80
+ the tag. A missing badge means the publish did not go through trusted publishing.
81
+
82
+ ## What ships
83
+
84
+ `package.json` → `files` decides:
85
+
86
+ - `bin/`, `src/` – the CLI and installer
87
+ - `.claude/`, `.opencode/` – the payload the installer copies
88
+ - `templates/`, `extras/` – docs skeleton and optional skills
89
+ - `guide/`, `README.md`, `AGENTS.md`, `CHANGELOG.md`, `LICENSE`
90
+
91
+ Not shipped: `test/`, `examples/`, `.github/`. `examples/` contains project-specific facts and is reference material
92
+ for the repository only.