leancraft 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.claude/skills/leancraft/SKILL.md +90 -0
  2. package/.cursor/rules/leancraft.mdc +70 -0
  3. package/.leancraft/README.md +26 -0
  4. package/.leancraft/SKILL.md +90 -0
  5. package/.leancraft/agent/context.md +37 -0
  6. package/.leancraft/agent/proposals/README.md +24 -0
  7. package/.leancraft/agent/status.md +31 -0
  8. package/.leancraft/config.json +357 -0
  9. package/.leancraft/human/definition/features/042-example-feature.md +32 -0
  10. package/.leancraft/human/definition/guardrails.md +37 -0
  11. package/.leancraft/human/definition/intent.md +31 -0
  12. package/.leancraft/human/definition/system.md +48 -0
  13. package/.leancraft/human/discovery/00-index.md +40 -0
  14. package/.leancraft/human/discovery/00-overview.md +31 -0
  15. package/.leancraft/human/discovery/01-vision.md +29 -0
  16. package/.leancraft/human/discovery/02-research.md +104 -0
  17. package/.leancraft/human/discovery/03-competitive.md +28 -0
  18. package/.leancraft/human/discovery/04-personas.md +24 -0
  19. package/.leancraft/human/discovery/05-jtbd.md +27 -0
  20. package/.leancraft/human/discovery/06-prd.md +101 -0
  21. package/.leancraft/human/sprint/map.md +22 -0
  22. package/.leancraft/joint/decisions.log.md +21 -0
  23. package/.leancraft/joint/ledger.jsonl +3 -0
  24. package/.leancraft/joint/test-report.md +20 -0
  25. package/.leancraft/templates/definition/feature.md +32 -0
  26. package/.leancraft/templates/definition/guardrails.md +39 -0
  27. package/.leancraft/templates/definition/intent.md +33 -0
  28. package/.leancraft/templates/definition/system.md +47 -0
  29. package/.leancraft/templates/discovery/00-index.md +40 -0
  30. package/.leancraft/templates/discovery/00-overview.md +31 -0
  31. package/.leancraft/templates/discovery/01-vision.md +28 -0
  32. package/.leancraft/templates/discovery/02-research.md +104 -0
  33. package/.leancraft/templates/discovery/03-competitive.md +27 -0
  34. package/.leancraft/templates/discovery/04-personas.md +26 -0
  35. package/.leancraft/templates/discovery/05-jtbd.md +27 -0
  36. package/.leancraft/templates/discovery/06-prd.md +102 -0
  37. package/.leancraft/templates/sprint/map.md +23 -0
  38. package/.mcp.json +10 -0
  39. package/AGENTS.md +70 -0
  40. package/CLAUDE.md +5 -0
  41. package/LICENSE +21 -0
  42. package/README.md +190 -0
  43. package/bin/leancraft.js +128 -0
  44. package/package.json +55 -0
  45. package/scripts/install-hooks.mjs +27 -0
  46. package/scripts/leancraft-lock.mjs +30 -0
  47. package/scripts/leancraft-sync.mjs +105 -0
  48. package/scripts/leancraft-validate.mjs +159 -0
  49. package/scripts/mcp-server.mjs +122 -0
@@ -0,0 +1,357 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "name": "leancraft",
4
+ "description": "Doc-first verified agency — the registry is the contract. Agent MUST read this first. Lock enforces ownership.",
5
+ "locked": false,
6
+ "ownership": {
7
+ "human": [
8
+ "human/**"
9
+ ],
10
+ "agent": [
11
+ "agent/**"
12
+ ],
13
+ "joint": [
14
+ "joint/**"
15
+ ],
16
+ "denyAgentWrite": [
17
+ "human/**"
18
+ ],
19
+ "allowAgentWrite": [
20
+ "agent/**",
21
+ "joint/**"
22
+ ],
23
+ "humanOwners": "@human-owners"
24
+ },
25
+ "budget": {
26
+ "maxCostUSD": 5,
27
+ "maxToolCalls": 25,
28
+ "maxWallClockMinutes": 30,
29
+ "sandbox": "gvisor",
30
+ "network": "deny-all",
31
+ "allowlist": [
32
+ "registry.npmjs.org",
33
+ "registry.yarnpkg.com",
34
+ "pypi.org"
35
+ ],
36
+ "forbiddenEnv": [
37
+ ".env",
38
+ "DATABASE_URL",
39
+ "AWS_*",
40
+ "GITHUB_TOKEN"
41
+ ],
42
+ "githubTokenScope": "read-only"
43
+ },
44
+ "sprintGates": {
45
+ "prototypeRequires": "human/definition/intent.md",
46
+ "testRequires": "joint/test-report.md",
47
+ "minRealUserNotes": 5
48
+ },
49
+ "docRegistry": {
50
+ "discovery": {
51
+ "00-index.md": {
52
+ "required": true,
53
+ "description": "Reading order, conventions, status legend, how agents should use docs",
54
+ "template": "templates/discovery/00-index.md",
55
+ "sections": [
56
+ "reading-order",
57
+ "conventions",
58
+ "status-legend",
59
+ "agent-usage"
60
+ ]
61
+ },
62
+ "00-overview.md": {
63
+ "required": true,
64
+ "description": "Elevator pitch, parent+brands shape, tech stack, cost ceiling",
65
+ "template": "templates/discovery/00-overview.md",
66
+ "sections": [
67
+ "elevator-pitch",
68
+ "brand-shape",
69
+ "tech-stack",
70
+ "cost-ceiling"
71
+ ]
72
+ },
73
+ "01-vision.md": {
74
+ "required": true,
75
+ "description": "North star, 10x-vs-parity, 3-year vision",
76
+ "template": "templates/discovery/01-vision.md",
77
+ "sections": [
78
+ "north-star",
79
+ "10x-vs-parity",
80
+ "3-year-vision"
81
+ ]
82
+ },
83
+ "02-research.md": {
84
+ "required": true,
85
+ "description": "12 pain themes with real quotes",
86
+ "template": "templates/discovery/02-research.md",
87
+ "sections": [
88
+ "pain-themes",
89
+ "sources"
90
+ ],
91
+ "rules": {
92
+ "minPainThemes": 12,
93
+ "minSources": 12,
94
+ "requireQuoteAndURL": true
95
+ }
96
+ },
97
+ "03-competitive.md": {
98
+ "required": true,
99
+ "description": "Competitor teardown + pricing + wedges",
100
+ "template": "templates/discovery/03-competitive.md",
101
+ "sections": [
102
+ "competitors",
103
+ "pricing-table",
104
+ "wedges"
105
+ ],
106
+ "rules": {
107
+ "minCompetitors": 9,
108
+ "requirePricingWithCurrency": true,
109
+ "minWedges": 5
110
+ }
111
+ },
112
+ "04-personas.md": {
113
+ "required": true,
114
+ "description": "5 personas + affinity map",
115
+ "template": "templates/discovery/04-personas.md",
116
+ "sections": [
117
+ "personas",
118
+ "affinity-map"
119
+ ],
120
+ "rules": {
121
+ "minPersonas": 5,
122
+ "requireFields": [
123
+ "goals",
124
+ "pains",
125
+ "jtbd"
126
+ ]
127
+ }
128
+ },
129
+ "05-jtbd.md": {
130
+ "required": true,
131
+ "description": "JTBD + empathy maps + pain matrix",
132
+ "template": "templates/discovery/05-jtbd.md",
133
+ "sections": [
134
+ "jtbd-statements",
135
+ "empathy-maps",
136
+ "pain-matrix"
137
+ ]
138
+ },
139
+ "06-prd.md": {
140
+ "required": true,
141
+ "description": "Goals, non-goals, flows, FRs, NFRs + lean overview (metrics, assumptions, RACI, PESTEL, 4 Whys, timeline, legal)",
142
+ "template": "templates/discovery/06-prd.md",
143
+ "sections": [
144
+ "goals",
145
+ "non-goals",
146
+ "success-metrics",
147
+ "assumptions",
148
+ "user-flows",
149
+ "functional-reqs",
150
+ "nfrs",
151
+ "stakeholders",
152
+ "raci",
153
+ "pestel",
154
+ "4-whys",
155
+ "timeline",
156
+ "legal",
157
+ "risks"
158
+ ],
159
+ "rules": {
160
+ "minUserFlows": 3,
161
+ "minFunctionalReqs": 10
162
+ }
163
+ }
164
+ },
165
+ "definition": {
166
+ "intent.md": {
167
+ "required": true,
168
+ "description": "Global invariants + oracles (executable spec)",
169
+ "template": "templates/definition/intent.md",
170
+ "sections": [
171
+ "intent",
172
+ "invariants",
173
+ "oracles",
174
+ "non-goals"
175
+ ],
176
+ "rules": {
177
+ "minInvariants": 3,
178
+ "minOracles": 2
179
+ }
180
+ },
181
+ "system.md": {
182
+ "required": true,
183
+ "description": "Architecture, stack, decisions, integrations, deployment",
184
+ "template": "templates/definition/system.md",
185
+ "sections": [
186
+ "stack",
187
+ "architecture",
188
+ "decisions",
189
+ "integrations",
190
+ "deployment",
191
+ "data-model"
192
+ ]
193
+ },
194
+ "guardrails.md": {
195
+ "required": true,
196
+ "description": "Security, perf, a11y, i18n, legal rules",
197
+ "template": "templates/definition/guardrails.md",
198
+ "sections": [
199
+ "security",
200
+ "performance",
201
+ "a11y",
202
+ "i18n",
203
+ "legal"
204
+ ]
205
+ },
206
+ "features/*.md": {
207
+ "required": false,
208
+ "description": "1 per user flow from 06-prd.md, ephemeral",
209
+ "template": "templates/definition/feature.md",
210
+ "sections": [
211
+ "intent",
212
+ "invariants",
213
+ "oracles",
214
+ "acceptance"
215
+ ],
216
+ "naming": "NNN-kebab-case.md (e.g., 042-pdf-export.md)"
217
+ }
218
+ },
219
+ "sprint": {
220
+ "map.md": {
221
+ "required": false,
222
+ "description": "Day 1: HMW, target, map (Design Sprint)",
223
+ "template": "templates/sprint/map.md"
224
+ },
225
+ "sketches.md": {
226
+ "required": false,
227
+ "description": "Day 2: Crazy 8s + decision"
228
+ },
229
+ "test-report.md": {
230
+ "required": false,
231
+ "description": "Day 3: 5 real user notes (joint)",
232
+ "rules": {
233
+ "minRealUserNotes": 5
234
+ }
235
+ }
236
+ },
237
+ "conditional": {
238
+ "07-data.md": {
239
+ "if": "product has persistence",
240
+ "description": "Storage, schema, PII, retention"
241
+ },
242
+ "08-agents.md": {
243
+ "if": "product has agents/bots",
244
+ "description": "Bot definitions, permissions, HITL"
245
+ },
246
+ "09-skills.md": {
247
+ "if": "product has skills/extensions",
248
+ "description": "Skill format, dos/donts"
249
+ },
250
+ "10-ux.md": {
251
+ "if": "product has UI",
252
+ "description": "Wireframes-as-text, IA, a11y"
253
+ },
254
+ "11-design-system.md": {
255
+ "if": "product has UI",
256
+ "description": "Tokens, components, motion"
257
+ }
258
+ }
259
+ },
260
+ "researchMap": {
261
+ "02-research.md": {
262
+ "requires": [
263
+ {
264
+ "type": "web_search",
265
+ "examples": [
266
+ "tavily_search",
267
+ "exa_search",
268
+ "brave_search",
269
+ "WebSearch",
270
+ "web_search"
271
+ ],
272
+ "purpose": "find URLs with real quotes"
273
+ },
274
+ {
275
+ "type": "web_fetch",
276
+ "examples": [
277
+ "firecrawl",
278
+ "exa_fetch",
279
+ "WebFetch",
280
+ "web_fetch",
281
+ "fetch"
282
+ ],
283
+ "purpose": "fetch page as markdown to extract verbatim quote"
284
+ }
285
+ ],
286
+ "queries": [
287
+ "{idea} pain",
288
+ "{idea} reddit",
289
+ "{idea} alternative",
290
+ "{idea} complaint"
291
+ ],
292
+ "requireURLs": true,
293
+ "fallback": "If no tool of type web_search/web_fetch exists, STOP. Do NOT invent. Write to agent/status.md: 'BLOCKED: No web_search available — human must provide 02-research.md or connect a search connector (Tavily/Exa/Brave)' and append to joint/decisions.log.md. Ask human to paste research or enable a connector."
294
+ },
295
+ "03-competitive.md": {
296
+ "requires": [
297
+ {
298
+ "type": "web_search",
299
+ "examples": [
300
+ "tavily_search",
301
+ "exa_search",
302
+ "brave_search",
303
+ "WebSearch"
304
+ ],
305
+ "purpose": "find competitors + pricing pages"
306
+ }
307
+ ],
308
+ "requirePricing": true,
309
+ "fallback": "If no web_search, STOP. Write to agent/status.md and ask human. Do NOT invent pricing."
310
+ },
311
+ "04-personas.md": {
312
+ "derivedFrom": "02-research.md",
313
+ "noNewSearch": true,
314
+ "requires": []
315
+ },
316
+ "05-jtbd.md": {
317
+ "derivedFrom": [
318
+ "02-research.md",
319
+ "03-competitive.md",
320
+ "04-personas.md"
321
+ ],
322
+ "requires": []
323
+ },
324
+ "06-prd.md": {
325
+ "derivedFrom": [
326
+ "02-research.md",
327
+ "04-personas.md",
328
+ "05-jtbd.md"
329
+ ],
330
+ "requires": []
331
+ },
332
+ "intent.md": {
333
+ "derivedFrom": [
334
+ "06-prd.md"
335
+ ],
336
+ "requires": []
337
+ },
338
+ "system.md": {
339
+ "derivedFrom": [
340
+ "06-prd.md",
341
+ "02-research.md"
342
+ ],
343
+ "requires": []
344
+ }
345
+ },
346
+ "validation": {
347
+ "command": "npm run leancraft:validate",
348
+ "blockLockIfFail": true,
349
+ "checks": [
350
+ "required-docs",
351
+ "required-sections",
352
+ "min-counts",
353
+ "requireURLs",
354
+ "no-placeholders"
355
+ ]
356
+ }
357
+ }
@@ -0,0 +1,32 @@
1
+ # Feature — 042-example-feature
2
+
3
+ > Status: DRAFT — 1 per flow from 06-prd.md. Ephemeral, delete when shipped. Copy this template per feature.
4
+
5
+ ## Intent
6
+
7
+ [1 paragraph from 06-prd.md Flow N]
8
+
9
+ ## Invariants (scoped)
10
+
11
+ - **I1:** [feature-specific]
12
+ - **I2:**
13
+
14
+ ## Oracles
15
+
16
+ - **O1:** Property test:
17
+ - **O2:** e2e:
18
+
19
+ ## Acceptance
20
+
21
+ - [ ] Given ... When ... Then ...
22
+ - [ ] Axe passes
23
+ - [ ] Perf <2s
24
+
25
+ ## Source Trace
26
+
27
+ - FR-05, Persona: Solo Sree
28
+
29
+ ## Validation
30
+
31
+ - [ ] Invariants with Check
32
+ - [ ] Source trace
@@ -0,0 +1,37 @@
1
+ # Guardrails — Security, Perf, A11y, i18n
2
+
3
+ > Status: DRAFT — Agent MUST obey. CI enforces.
4
+
5
+ ## Security
6
+
7
+ - CWE-89 SQLi: Never string-concat SQL, use parameterized / scopedQuery()
8
+ - CWE-79 XSS: Never innerHTML
9
+ - Secrets: Never commit .env, use wrangler secret
10
+ - AuthZ: Every query scoped by userId + brandId
11
+ - Checks: semgrep, codeql
12
+
13
+ ## Performance
14
+
15
+ - LCP <2.5s, no N+1, paginate >100
16
+ - Checks: autocannon, lighthouse
17
+
18
+ ## A11y
19
+
20
+ - WCAG AA, axe-core must pass
21
+ - No color-only, ARIA labels required
22
+
23
+ ## i18n
24
+
25
+ - No hardcoded strings, use t() keys
26
+
27
+ ## Legal / Privacy (from 06-prd Legal)
28
+
29
+ - Data / PII: (from 07-data.md if exists)
30
+ - IP / License:
31
+ - Regulatory: (GDPR, etc.)
32
+ - Checks: legal review
33
+
34
+ ## Validation
35
+
36
+ - [ ] 5 sections present
37
+ - [ ] Each has Check command
@@ -0,0 +1,31 @@
1
+ # Intent — Global Executable Spec
2
+
3
+ > Status: DRAFT — Distilled from 06-prd.md. Agent codes ONLY against this.
4
+
5
+ ## Intent
6
+
7
+ [TODO: 1 paragraph, distilled from 06-prd.md]
8
+
9
+ ## Invariants (≥3, machine-checkable)
10
+
11
+ - **I1:** [e.g., totalChargesInScope == SUM(lineItems where scopeId==X)] — Check: `npm run test:invariants`
12
+ - **I2:** [e.g., PDF must be WCAG AA] — Check: `axe-core`
13
+ - **I3:** [e.g., Never string-concat SQL] — Check: `semgrep`
14
+
15
+ ## Oracles (≥2)
16
+
17
+ - **O1:** Property test — `fast-check` 500 random inputs
18
+ - **O2:** Security — CodeQL/Semgrep passes
19
+
20
+ ## Non-Goals
21
+
22
+ - Not:
23
+
24
+ ## Source Trace
25
+
26
+ - FR-01, FR-05; Success Metric: Activation; Assumption: [from 06-prd.md]; Persona P1
27
+
28
+ ## Validation
29
+
30
+ - [ ] ≥3 invariants with Check
31
+ - [ ] ≥2 oracles with tool
@@ -0,0 +1,48 @@
1
+ # System — Architecture & Decisions
2
+
3
+ > Status: DRAFT
4
+
5
+ ## Stack (pinned)
6
+
7
+ - Frontend:
8
+ - Backend:
9
+ - DB:
10
+ - Infra:
11
+
12
+ ## Architecture
13
+
14
+ ```
15
+ [TODO: diagram]
16
+ client → worker → D1
17
+ ```
18
+
19
+ ## Decisions
20
+
21
+ | Decision | Chosen | Rejected | Why |
22
+ |---|---|---|---|
23
+ | | | | |
24
+
25
+ ## Integrations / Dependencies (from 06-prd Stakeholders)
26
+
27
+ | System | API / Host | Why | Allowlist |
28
+ |---|---|---|---|
29
+ | [e.g., Stripe] | api.stripe.com | Payments | → config allowlist |
30
+
31
+ ## Deployment / Infra (light)
32
+
33
+ - Hosting:
34
+ - Env: dev / staging / prod
35
+ - CI: GitHub Actions
36
+
37
+ ## Data Model
38
+
39
+ - Tables:
40
+ - PII handling: (links to discovery/07-data.md if exists)
41
+ - Agents: (links to 08-agents.md if exists)
42
+ - UX: (links to 10-ux.md if exists)
43
+
44
+ ## Validation
45
+
46
+ - [ ] Pinned versions
47
+ - [ ] Diagram + decisions with why
48
+ - [ ] Integrations + Deployment present (overview, 3 lines)
@@ -0,0 +1,40 @@
1
+ # 00 — Index — Reading Order & Conventions
2
+
3
+ > Status: DRAFT — Run `npm run leancraft:validate` before Lock
4
+
5
+ ## Reading Order
6
+
7
+ 1. `00-overview.md` → elevator pitch + stack + cost ceiling
8
+ 2. `01-vision.md` → north star, 10x-vs-parity, 3-year
9
+ 3. `02-research.md` → P1-P12 pain themes (12 real quotes + URLs)
10
+ 4. `03-competitive.md` → 9+ competitors + pricing + wedges
11
+ 5. `04-personas.md` → 5 personas + affinity map
12
+ 6. `05-jtbd.md` → JTBD + empathy maps + pain matrix
13
+ 7. `06-prd.md` → goals, non-goals, flows, FRs, NFRs
14
+ 8. `../definition/intent.md` → invariants + oracles (executable)
15
+ 9. `../definition/system.md` → architecture
16
+ 10. `../definition/guardrails.md` → security/perf/a11y/i18n
17
+ 11. `../definition/features/*.md` → per-flow specs (ephemeral)
18
+
19
+ ## Conventions
20
+
21
+ - `human/discovery/**` — PM-owned, agent READ-ONLY after Lock
22
+ - `human/definition/**` — Tech-owned, agent READ-ONLY after Lock
23
+ - `agent/**` — Agent-owned, auto-generated, human READ-ONLY
24
+ - `joint/**` — Both append (decisions, test reports)
25
+
26
+ ## Status Legend
27
+
28
+ - `DRAFT` — agent drafted, human not yet approved
29
+ - `LOCKED` — human approved, agent must use `agent/proposals/` to suggest changes
30
+ - `AUTO` — regenerated on `leancraft sync`
31
+
32
+ ## Agent Usage
33
+
34
+ Agent MUST read `config.json` → this file → `00-overview.md` → target doc, in order. Never skip.
35
+ Run `npm run leancraft:validate` before asking to Lock.
36
+
37
+ ## Validation
38
+
39
+ - [ ] All 4 sections present
40
+ - [ ] No TODO/TBD
@@ -0,0 +1,31 @@
1
+ # 00 — Overview — Elevator Pitch & Stack
2
+
3
+ > Status: DRAFT — Fill then validate
4
+
5
+ ## Elevator Pitch
6
+
7
+ [TODO: 1 paragraph — what it is, for whom, why now]
8
+
9
+ ## Brand Shape
10
+
11
+ - Parent brand:
12
+ - Sub-brands:
13
+ - Promise:
14
+
15
+ ## Tech Stack (pinned versions)
16
+
17
+ - Frontend:
18
+ - Backend:
19
+ - DB:
20
+ - Infra:
21
+
22
+ ## Cost Ceiling
23
+
24
+ - Target infra cost: $__/mo (must have $)
25
+ - Per-user ceiling:
26
+ - Tracker: `agent/status.md`
27
+
28
+ ## Validation
29
+
30
+ - [ ] Cost ceiling has $ with currency
31
+ - [ ] Stack has pinned versions
@@ -0,0 +1,29 @@
1
+ # 01 — Vision — North Star & 3-Year
2
+
3
+ > Status: DRAFT
4
+
5
+ ## North Star
6
+
7
+ [TODO: 1 sentence — world with product vs without]
8
+
9
+ ## 10x vs Parity Matrix
10
+
11
+ | Capability | Parity (must match) | 10x (our wedge) |
12
+ |---|---|---|
13
+ | | | |
14
+ | | | |
15
+ | | | |
16
+
17
+ ## 3-Year Vision
18
+
19
+ - Year 1:
20
+ - Year 2:
21
+ - Year 3:
22
+
23
+ ## Non-Goals (explicit)
24
+
25
+ - Not building:
26
+
27
+ ## Validation
28
+
29
+ - [ ] ≥3 wedges in 10x column