bokata 2.0.0 → 3.0.0-beta.3

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 (43) hide show
  1. package/{commands/task-parallel/feature-map.md → .agents/skills/bokata-feature-map/SKILL.md} +80 -79
  2. package/.agents/skills/bokata-feature-map/resources/features-template.md +83 -0
  3. package/.agents/skills/bokata-feature-slicer/SKILL.md +171 -182
  4. package/.agents/skills/bokata-feature-slicer/resources/output-template-bites.md +13 -0
  5. package/.agents/skills/bokata-feature-slicer/resources/output-template-increments.md +9 -12
  6. package/.agents/skills/bokata-feature-slicer/resources/output-template-steps.md +6 -22
  7. package/.agents/skills/bokata-feature-slicer/resources/phase-2-increments.md +43 -49
  8. package/.agents/skills/bokata-feature-slicer/resources/phase-3-baby-steps.md +90 -249
  9. package/.agents/skills/bokata-feature-slicer/resources/phase-4-bites.md +138 -0
  10. package/.agents/skills/bokata-plan/SKILL.md +104 -0
  11. package/.agents/skills/bokata-plan/resources/plan-template.md +33 -0
  12. package/.agents/skills/bokata-refactor/SKILL.md +69 -0
  13. package/.agents/skills/bokata-refactor/resources/smells.md +47 -0
  14. package/.agents/skills/bokata-refactor/resources/tidyings.md +31 -0
  15. package/.agents/skills/bokata-render/SKILL.md +144 -0
  16. package/.agents/skills/bokata-render/resources/story-map-template.md +835 -0
  17. package/.agents/skills/bokata-shape/SKILL.md +117 -0
  18. package/.agents/skills/bokata-shape/resources/adr-template.md +24 -0
  19. package/.agents/skills/bokata-shape/resources/breadboarding.md +47 -0
  20. package/.agents/skills/bokata-shape/resources/pitch-template.md +42 -0
  21. package/.agents/skills/bokata-slice/SKILL.md +475 -0
  22. package/.agents/skills/bokata-slice/resources/slice-template.md +117 -0
  23. package/.agents/skills/bokata-status/SKILL.md +65 -0
  24. package/.agents/skills/bokata-tdd/SKILL.md +109 -0
  25. package/.agents/skills/bokata-tdd/resources/evidence-rules.md +27 -0
  26. package/README.md +210 -92
  27. package/agents/bokata-product-designer.md +48 -16
  28. package/agents/bokata-product-engineer.md +48 -15
  29. package/agents/bokata-product-manager.md +48 -16
  30. package/agents/code-executor.md +53 -0
  31. package/agents/design-reviewer.md +40 -0
  32. package/agents/feature-slicer.md +42 -0
  33. package/agents/story-map-renderer.md +19 -0
  34. package/bin/bokata.js +27 -12
  35. package/package.json +20 -7
  36. package/src/agents.js +114 -0
  37. package/src/config.js +75 -0
  38. package/src/install.js +173 -205
  39. package/commands/codex/feature-map.md +0 -263
  40. package/commands/codex/slice-feature.md +0 -291
  41. package/commands/task-parallel/resources/html-template.md +0 -560
  42. package/commands/task-parallel/resources/story-map-template.md +0 -495
  43. package/commands/task-parallel/slice-feature.md +0 -301
@@ -0,0 +1,33 @@
1
+ # Plan — <initiative>
2
+
3
+ <!-- One file per initiative: <docs>/<slug>/plan.md. Written by bokata-plan, checked off by the
4
+ executor commit by commit. A section per slice, a subsection per increment. The headings are
5
+ the keys the story map and bokata-status read ("## Slice <nn>" and "### Inc <n>"), so keep them.
6
+ What the owner decides (Gherkin, Unknowns, Parallel-safe, Notes) stays in the slice file.
7
+ Edit only your own increment's section: Incs built in parallel worktrees then touch different lines. -->
8
+
9
+ ## Slice <nn> — <name>
10
+
11
+ <!-- Slice file: slices/<nn>-<name>.md -->
12
+
13
+ ### Inc 1 — <name>
14
+
15
+ Plan:
16
+ - [ ] Acceptance: "<scenario>" in `<test file>`, marked expected failure
17
+ - [ ] <step — one small, tested change that ends in a commit> — proves "<scenario>"
18
+
19
+ Tests:
20
+ - <scenario> → <test file> › <test name>
21
+
22
+ ### Inc 2 — <name>
23
+
24
+ Plan:
25
+ - [ ] <step>
26
+
27
+ Tests:
28
+ - <scenario> → <test file> › <test name>
29
+
30
+ ## Slice <nn> — <name>
31
+
32
+ ### Inc 1 — <name>
33
+ …
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: bokata-refactor
3
+ description: Refactor safely in tiny behaviour-preserving moves — Kent Beck's four rules of simple design as the arbiter, Tidy First? tidyings, Fowler's code smells mapped to the move that fixes each, and coupling and cohesion as the reason to tidy. Use it in the refactor phase of a TDD step, before a step to make the change easy, when reviewing a diff for design, or when the user says refactor, tidy, clean up, code smell or simple design.
4
+ ---
5
+
6
+ # bokata-refactor
7
+
8
+ A refactor changes **structure, never behaviour**. It is made of small moves, each one leaving
9
+ every test green, and it is committed apart from any behaviour change.
10
+
11
+ The project's constitution and coding standards (paths in `.bokata.json` → `memory`; defaults
12
+ `CONSTITUTION.md`, `CODING_STANDARDS.md`) win over everything here.
13
+
14
+ ## The arbiter: four rules of simple design
15
+
16
+ Kent Beck's rules, in priority order. An earlier rule wins over a later one.
17
+
18
+ 1. **Passes the tests.** Every test passes, guard tests included. Tests describe behaviour
19
+ from the scenarios, not the implementation: flag a test that asserts internals, a missing
20
+ edge case the scenario implies, or a test that would still pass if the code were wrong.
21
+ 2. **Reveals intention.** Names come from the project's glossary and the scenarios, so a reader
22
+ understands the code without the plan. Vague names (`data`, `handle`, `util`, `tmp`),
23
+ functions that do two things, booleans that should be named states and magic numbers that
24
+ should be named constants all break it.
25
+ 3. **No duplication.** Each piece of *knowledge* — a rule, a threshold, a shape, a mapping —
26
+ has one place, across every layer. Two lines that look alike but change for different
27
+ reasons are not duplication; leave them.
28
+ 4. **Fewest elements.** Nothing the tests and the first three rules do not need: no unused
29
+ parameter, speculative option, single-use abstraction, wrapper layer, dead branch or file.
30
+
31
+ Stop when the code meets the four rules. Refactoring further is gold-plating.
32
+
33
+ ## When to refactor
34
+
35
+ - **Before a step — make the change easy, then make the easy change.** If the next behaviour
36
+ would land awkwardly (scattered edits, a function that must grow a third branch), tidy
37
+ first, so the change itself is small.
38
+ - **After green** — the refactor phase of every TDD step.
39
+ - **Not otherwise.** Tidy what the current or next change touches. Code nobody is changing is
40
+ left alone (*tidy later* or *never*), however untidy it looks.
41
+
42
+ The reason to tidy is the cost of the next change, and that cost is **coupling**: elements that
43
+ must change together. Tidy toward **cohesion** — what changes together lives together — and
44
+ away from coupling across modules. If a tidying does not make a coming change cheaper or the
45
+ code easier to read now, skip it.
46
+
47
+ ## How to move
48
+
49
+ 1. Name what you see — the rule it breaks, or the smell from
50
+ [resources/smells.md](resources/smells.md) — and the move that fixes it.
51
+ 2. Run the tests: they must be green before you start.
52
+ 3. Make **one** move: a tidying from [resources/tidyings.md](resources/tidyings.md) or the
53
+ move the smell points to.
54
+ 4. Run the tests. Green → next move. Red → **undo the move**; do not fix forward. A red test
55
+ during a refactor means behaviour changed, or the test is coupled to the implementation:
56
+ find out which and say so.
57
+ 5. Commit structure on its own (`refactor(scope): …`), never mixed with `feat` or `fix`. If a
58
+ move needs a new test or widens behaviour, it is not a refactor: stop and treat it as a
59
+ step.
60
+
61
+ Keep moves small enough that undoing one costs nothing. Several moves can share one commit when
62
+ they serve one purpose.
63
+
64
+ ## Principles, as evidence
65
+
66
+ SOLID, KISS, DRY, YAGNI and object calisthenics are not checked as rules on their own. Each one
67
+ shows up in the code as a smell; act on the smell you can point at, with
68
+ [resources/smells.md](resources/smells.md) as the map. A principle with no smell in the diff
69
+ is not a finding.
@@ -0,0 +1,47 @@
1
+ # Smells and the moves that fix them
2
+
3
+ Each smell is a heuristic, never a hard violation: name it ("possible Feature Envy"), point at
4
+ the code, and propose the move. A documented project standard overrides any smell here.
5
+ Moves are Martin Fowler's (*Refactoring*); in functional code read "class" as "module" and
6
+ "method" as "function".
7
+
8
+ | Smell | What you see | Move |
9
+ |---|---|---|
10
+ | **Mysterious Name** | A name that does not say what it does or holds | Rename, using the glossary's word. No honest name comes? The design is murky — split it. |
11
+ | **Long Function** | You need comments or blank lines to follow it | Extract Function per chunk, named by intention |
12
+ | **Long Parameter List** | Many arguments, often passed through untouched | Introduce Parameter Object; or pass the whole value instead of its parts |
13
+ | **Duplicated Code** | The same knowledge in two places | Extract Function and call it from both; or Slide Statements until the shared shape shows |
14
+ | **Divergent Change** | One module edited for unrelated reasons | Split Phase, or Extract Module, so each changes for one reason |
15
+ | **Shotgun Surgery** | One change forces edits in many modules | Move Function / Combine into one module, so what changes together lives together |
16
+ | **Feature Envy** | A function works mostly on another module's data | Move Function next to the data it envies |
17
+ | **Data Clumps** | The same few values always travel together | Introduce Parameter Object or a type for the clump |
18
+ | **Primitive Obsession** | A string or number stands for a domain concept | Replace Primitive with a small type (value object, branded type) that owns its rules |
19
+ | **Repeated Switches** | The same `switch`/`if` chain on the same type in several places | One lookup map shared by both sites, or polymorphism |
20
+ | **Loops** | A loop that filters, maps and accumulates by hand | Replace Loop with Pipeline (`filter`/`map`/`reduce`) when it reads better |
21
+ | **Speculative Generality** | Parameters, hooks or abstractions for needs nobody has | Inline Function / Remove Parameter / Collapse Hierarchy |
22
+ | **Temporary Field** | A field or variable that is only set in some cases | Extract the case that uses it into its own function or type |
23
+ | **Message Chains** | `a.b().c().d()` the caller should not depend on | Hide Delegate: one function on the first object does the walk |
24
+ | **Middle Man** | A module that mostly forwards to another | Remove Middle Man; call the real target |
25
+ | **Mutable Data** | Shared state changed from several places | Encapsulate it, or return new values instead of mutating (copy-on-write) |
26
+ | **Global Data** | Anything can read or write it | Encapsulate it behind a function and narrow who can call it |
27
+ | **Comments** | A comment explains *what* the code does | Extract Function / Rename until the comment is redundant, then delete it. Keep comments that explain *why*. |
28
+ | **Refused Bequest** | An implementer ignores most of what it inherits | Replace inheritance with composition |
29
+
30
+ ## Principles mapped to smells
31
+
32
+ | Principle | Look for |
33
+ |---|---|
34
+ | Single responsibility | Divergent Change, Long Function |
35
+ | Open/closed | Repeated Switches |
36
+ | Liskov | Refused Bequest |
37
+ | Interface segregation | Long Parameter List, a wide interface most callers use a sliver of |
38
+ | Dependency inversion | A dependency created inside instead of passed in at a seam |
39
+ | DRY | Duplicated Code — of *knowledge*, not of look-alike lines |
40
+ | KISS / YAGNI | Speculative Generality, rule 4 (fewest elements) |
41
+ | Coupling | Shotgun Surgery, Feature Envy, Message Chains, Global Data |
42
+ | Cohesion | Divergent Change, Data Clumps |
43
+ | Calisthenics: wrap primitives | Primitive Obsession |
44
+ | Calisthenics: first-class collections | Data Clumps around a collection, Repeated Switches over it |
45
+ | Calisthenics: one level of indentation, no `else` | Long Function → guard clauses, Extract Function |
46
+ | Calisthenics: no getters, tell don't ask | Feature Envy |
47
+ | Calisthenics: small entities | Long Function, Divergent Change |
@@ -0,0 +1,31 @@
1
+ # Tidyings
2
+
3
+ Kent Beck's tidyings (*Tidy First?*): the smallest structure changes, each safe on its own.
4
+ Reach for them first; most refactors are a few of these in a row.
5
+
6
+ | Tidying | Do it when |
7
+ |---|---|
8
+ | **Guard clauses** | Nested conditions hide the main path: return early on the edge cases |
9
+ | **Dead code** | Code nothing calls or no test needs: delete it (version control remembers) |
10
+ | **Normalize symmetries** | The same thing is done in two different ways: pick one and use it everywhere |
11
+ | **New interface, old implementation** | The interface you wish you had is missing: write it and call the old code from it |
12
+ | **Reading order** | A reader meets the parts in the wrong order: reorder them for the reader |
13
+ | **Cohesion order** | Elements that change together sit apart: move them next to each other |
14
+ | **Move declaration and initialization together** | A variable is declared far from where it gets its value |
15
+ | **Explaining variable** | A sub-expression needs a name to be understood |
16
+ | **Explaining constant** | A literal carries meaning (a limit, a threshold): name it |
17
+ | **Explicit parameters** | A function reads what it needs from a big bag or ambient state: pass it in |
18
+ | **Chunk statements** | A block does several things: separate the chunks with a blank line |
19
+ | **Extract helper** | A chunk has one purpose and a name: give it a function |
20
+ | **One pile** | Code is split so finely it can no longer be understood: inline it into one place first, then tidy again |
21
+ | **Explaining comment** | Something is not obvious from the code and cannot be made so: write down why |
22
+ | **Delete redundant comment** | A comment says what the code already says |
23
+
24
+ ## Tidy first, after, later or never
25
+
26
+ - **First** — the tidying makes the next change cheaper and is quick.
27
+ - **After** — you will touch this code again soon, and now you understand it.
28
+ - **Later** — worth doing but not now: note it where the project tracks such work.
29
+ - **Never** — the code will not change again, or the tidying buys nothing.
30
+
31
+ Tidyings go in their own commit, separate from behaviour changes.
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: bokata-render
3
+ description: Render and keep up to date the Patton-style story-map.html dashboard of a bokata initiative — statuses, next step, counters and the vanilla interactivity — from features.md and slices/*.md. Loaded by the story-map-renderer agent, which the bokata skills and code-executor dispatch as a cheap background subagent because rendering is mechanical, deterministic work. Never invoked by the user directly.
4
+ ---
5
+
6
+ # bokata-render
7
+
8
+ You render and maintain **one** artifact: `<docs>/<initiative-slug>/story-map.html`. You are
9
+ mechanical and deterministic: read markdown, write HTML. Never invent product content, never ask
10
+ the user questions, never touch any other file.
11
+
12
+ The markdown is the source of truth. `features.md` holds the backbone; `slices/*.md` hold the
13
+ slicing (`## Slicing`), the increments (`### Inc <n>` with their `**[User Task]**` tags and options),
14
+ the backlog of **bites** (`## Backlog`) and `Status:` (open | done); `plan.md` holds the plan
15
+ checklists, under `## Slice <nn>` → `### Inc <n>`. If the HTML and the markdown
16
+ ever disagree, **the markdown wins** — fix the HTML from it, never the other way round.
17
+
18
+ ## Configuration
19
+
20
+ Read `.bokata.json` at the project root if it exists (`docs` defaults to `docs/initiatives`).
21
+ If `story_map` is `false`, do nothing and report that rendering is disabled.
22
+
23
+ ## Input
24
+
25
+ The caller tells you `<docs>/<initiative-slug>/`, the **operation**, and (for `slice-added`) the
26
+ slice file and the increment (`Inc <n>`). Read only `features.md`, `slices/*.md` and `plan.md` inside that folder.
27
+ Read nothing else and do not load the constitution or the glossary.
28
+
29
+ ## Operations
30
+
31
+ Pick the operation the caller passed. If it is missing, infer it: no `story-map.html` and no
32
+ slices → `create`; no `story-map.html` but slices exist → `rebuild`; the file has no `v3` marker →
33
+ `rebuild`; the file is current and a slice was just added → `slice-added`; otherwise →
34
+ `state-sync`.
35
+
36
+ ### 1. `create` — first render
37
+
38
+ No `story-map.html` exists yet. Build it whole from `features.md` using
39
+ [resources/story-map-template.md](resources/story-map-template.md):
40
+
41
+ - Row 1: one `.feature-header` per Feature, `grid-column: span N` (N = its User Task count), in
42
+ backbone journey order. **A Feature is a header, never a column holding a list of tasks.**
43
+ - Row 2: one `.step-card` per User Task with `data-task-id` and `data-feature-id`, in the order
44
+ listed under its Feature.
45
+ - Row 3: one `.release-cell` ("Not yet sliced") per Step, with `data-task-id`.
46
+ - Counters: 0 done, 0 bites left, totals from the backbone; the next banner stays `hidden`; footer
47
+ with the initiative name, date and counts.
48
+ - Title `"<initiative> — Story Mapping"`, subtitle
49
+ `"Backbone (Features) → Steps (User Tasks) → Releases (Slices)"`.
50
+
51
+ ### 2. `slice-added` — after bokata-slice (new slice or `--next`)
52
+
53
+ An increment was just added to a slice file. Update the existing board **in place**, only the
54
+ columns it touches:
55
+
56
+ 1. Read the slice file; take the `### Inc <n> — …` heading the caller named (if none, every
57
+ `### Inc` heading without a card yet), its `**[User Task Name]**` tags and its `Options:` IDs.
58
+ Map each option ID to its User Task through the `## Slicing` section.
59
+ 2. For each tagged User Task, find `.step-card[data-task-id="<TASK_ID>"]`, resolve its absolute
60
+ `grid-column` (1-indexed over the whole grid, not per Feature).
61
+ 3. `Inc 1` (the Walking Skeleton) replaces that Step's `.release-cell[data-task-id="<TASK_ID>"]`
62
+ with a `.skeleton-item-card` (`grid-row: 3`). A later increment appends an `.increment-card` at
63
+ the next free row of that column (`grid-row: 4, 5, …`), or replaces the placeholder at row 3 if
64
+ the column has no card yet.
65
+ 4. Carry on each card: `data-task-id`, `data-feature-id`, `data-increment-id` (`<nn>-Inc<n>`, the
66
+ same on every card of that increment), `data-slice` (the slice file name without `.md`),
67
+ `data-state` and the card body (title `Inc <n> — <name>`, a description listing the option IDs
68
+ and names of this User Task and, when the Inc has a `Bites:` line, a second line with its bite
69
+ IDs and titles; `.card-details` with one `<li>` per scenario and a link to
70
+ `slices/<nn>-<name>.md`) and, as its last child, the corner badge
71
+ `<span class="scope-badge">S<nn> · Inc <n></span>`.
72
+ 5. Leave every other Step's **increment** cards untouched, including Steps this slice did not tag
73
+ and every card from earlier slices.
74
+ 6. **Redraw the bites of this slice** in every Step column of its Features, tagged or not (a
75
+ `--next` re-prune can change any of them): one `.bite-card` per **untaken** bite of `## Backlog`
76
+ (a bite whose line carries `→ Inc n` is taken and gets no bite card), in the column of its first
77
+ option (resolved through `## Slicing`), below the column's last increment card, ordered
78
+ must-have → nice-to-have → deferred, each with the badge `S<nn> · Backlog`. See the template for the card. A Backlog with no bite lines
79
+ (a slice written before bites) draws none.
80
+ 7. Finish with `state-sync` (operation 4) so statuses, counters and the next banner match the
81
+ new slice immediately.
82
+
83
+ ### 3. `rebuild` — migration or repair
84
+
85
+ The file predates the `v3` template marker, or the auto-check of a previous run failed and could
86
+ not be repaired in place. Render the **whole** board from scratch — `features.md` for the
87
+ backbone, every `slices/*.md` for the cards and their state — following
88
+ [resources/story-map-template.md](resources/story-map-template.md). The result must be identical to
89
+ what a fresh `create` plus every `slice-added` would produce. Use it only as fallback: the normal
90
+ path is in-place editing.
91
+
92
+ ### 4. `state-sync` — after bokata-plan, each executor increment, or a bokata-status catch-up
93
+
94
+ Do not add cards. Re-derive state from `slices/*.md` and update the existing HTML:
95
+
96
+ 1. For every slice file, read `Status:` (open | done); for its plan, read `plan.md`: under
97
+ `## Slice <nn>` and per `### Inc <n>` heading, its checkboxes (`- [ ]` / `- [x]`). An increment
98
+ with no section in `plan.md` has no plan yet.
99
+ 2. Leave every `.bite-card` as it is: bites are redrawn only by `slice-added` and `rebuild`.
100
+ For each card with `data-increment-id="<nn>-Inc<n>"`, compute its state and write it as the
101
+ `state-*` class and `data-state` attribute. If a card matches no heading, leave it untouched
102
+ and report it in the auto-check:
103
+ - every plan checkbox checked (and at least one) → `state-done`
104
+ - at least one checked, not all → `state-building`
105
+ - no checkboxes checked yet (with or without a plan) → `state-planned`
106
+ - no slice file for that increment → remove the `state-*` class (never happens for cards
107
+ written by `slice-added`).
108
+ 3. Update each card's `.steps-badge` `data-done` / `data-total` attributes (steps checked vs
109
+ total in its increment). Render no badge when the increment has no plan.
110
+ 4. Rebuild the **next banner**: the active slice is the first `Status: open` slice with an
111
+ unchecked plan step. The next step is the first `- [ ]` under its `## Slice <nn>` section in `plan.md`. Fill `.next-text` with
112
+ `"<step text> — <nn>-<name>"` and `.next-link` with `plan.md`; hide the banner
113
+ (`hidden`) when there is no next step.
114
+ 5. Update the header counters and footer: increments done / total (`### Inc` headings), steps
115
+ done / total plan steps, slices done / total slice files, bites left (the number of
116
+ `.bite-card`s), `Sliced: <features with ≥1 card>/<features>`, and the generation date.
117
+
118
+ ## Auto-check (mandatory before you finish)
119
+
120
+ Count in the markdown and compare with the HTML you just wrote:
121
+
122
+ - `.step-card` count **equals** the number of User Task IDs in `features.md`.
123
+ - `.feature-header` count **equals** the number of Features; each `span N` equals its User Task
124
+ count.
125
+ - Cards in `state-done` **equal** the cards of increments whose checkboxes are all checked.
126
+ - Every skeleton, increment and bite card has exactly one `.scope-badge`, and it says the card's own
127
+ slice and increment (`S02 · Inc 2`) or `Backlog`.
128
+ - `.bite-card` count **equals** the untaken bite lines (no `→ Inc n`) in every `## Backlog`, and
129
+ each sits in the column of its first option.
130
+ - Header/footer counters **equal** the real counts.
131
+
132
+ If any check fails, fix the HTML from the markdown and run the check again. If it still fails,
133
+ write what is left as a `.system-tasks-note`-style note under the board and report the mismatch —
134
+ never leave counters lying.
135
+
136
+ ## Hard rules
137
+
138
+ - One operation per run, one file written: `story-map.html`. Never edit `features.md`,
139
+ `slices/*.md`, `pitch.md` or anything else.
140
+ - Keep the file self-contained: no external CSS, JS, fonts or images. Vanilla HTML/CSS/JS only.
141
+ - Keep the template marker (`<meta name="bokata-story-map" content="v3">`), the Patton structure
142
+ and the `data-*` attributes — the next run depends on them.
143
+ - Same filename on write: the artifact is updated, not recreated (except `rebuild`).
144
+ - Reply with a single line: `<operation> — story-map.html updated (<increments done>/<total> increments, <steps done>/<total> steps)`.