@lemoncode/lemony 0.1.2 → 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 (37) hide show
  1. package/README.md +19 -14
  2. package/catalog/VERSION +1 -1
  3. package/catalog/agents/architect.md +13 -4
  4. package/catalog/agents/implementer.md +87 -8
  5. package/catalog/agents/orchestrator.md +643 -386
  6. package/catalog/agents/partition.md +316 -0
  7. package/catalog/agents/reviewer.md +356 -21
  8. package/catalog/agents/spec-author.md +16 -4
  9. package/catalog/agents/spinoff.md +100 -0
  10. package/catalog/agents/triage.md +41 -0
  11. package/catalog/agents/ui-design.md +147 -0
  12. package/catalog/agents/ui-designer.md +3 -2
  13. package/catalog/commands/add-capability.md +4 -4
  14. package/catalog/commands/define.md +7 -0
  15. package/catalog/commands/hotfix.md +15 -1
  16. package/catalog/commands/pause.md +5 -0
  17. package/catalog/commands/resume.md +38 -10
  18. package/catalog/commands/triage.md +4 -3
  19. package/catalog/harness.config.schema.json +40 -0
  20. package/catalog/hooks/lib/merge-pr.sh +699 -0
  21. package/catalog/schemas/tier2-events-history.md +17 -0
  22. package/catalog/schemas/tier2-events.md +10 -10
  23. package/catalog/skills/mutation-testing/SKILL.md +80 -19
  24. package/catalog/skills/prd-to-spec/SKILL.md +74 -2
  25. package/catalog/skills/raise-discovery/SKILL.md +6 -0
  26. package/catalog/skills/resolve-discovery/SKILL.md +12 -7
  27. package/catalog/skills/security-review/SKILL.md +119 -6
  28. package/catalog/skills/spec-compliance-check/SKILL.md +8 -4
  29. package/catalog/skills/spec-to-issue/SKILL.md +7 -1
  30. package/catalog/skills/task-closeout/SKILL.md +85 -20
  31. package/catalog/skills/test-gap-report/SKILL.md +4 -0
  32. package/catalog/skills/triage-issue/SKILL.md +65 -4
  33. package/catalog/skills/verify/SKILL.md +3 -0
  34. package/catalog/templates/claude-code/agents.md.tpl +50 -16
  35. package/catalog/templates/claude-code/harness.config.yml.tpl +33 -0
  36. package/dist/cli.mjs +744 -37
  37. package/package.json +10 -6
package/README.md CHANGED
@@ -22,6 +22,7 @@ to semver.
22
22
 
23
23
  - **Node.js ≥ 24** and **npm ≥ 11** (`node --version`).
24
24
  - **[Claude Code](https://claude.com/claude-code)** installed in the target repo.
25
+ - **[GitHub CLI](https://cli.github.com) ≥ 2.50**, authenticated (`gh auth login`) — the merge executor reads check status via `gh pr checks --json`, added in 2.50. An older gh fails closed (the gated path never merges) with gh's own `unknown flag` message.
25
26
 
26
27
  ## Install
27
28
 
@@ -127,20 +128,24 @@ directly; the Orchestrator and sub-agents do, gated by your repo's capabilities.
127
128
 
128
129
  ## Commands
129
130
 
130
- The CLI ships nine verbs. Run `lemony <command> --help` (or `-h`) for usage;
131
- `lemony version` (or `-v`) prints the installed version.
132
-
133
- | Command | What it does | Key flags |
134
- | ----------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
135
- | `install` | Install into a fresh repo, or reconcile a pre-existing `.claude/`. | `--target=<claude-code>` `--task-storage-repo=<owner/name>` `--on-conflict=<vendor\|client>` |
136
- | `update` | Move the install to the CLI's catalog version (3-way merge). | `--on-conflict=<vendor\|client>` `--dry-run` |
137
- | `repair` | Re-sync at the **pinned** version (restore missing files, never clobber edits). | `--dry-run` |
138
- | `rollback` | Restore a pre-change snapshot (offline). | `--to=<version>` `--list` `--cleanup` `--force` |
139
- | `uninstall` | Remove vendor-managed files (keeps your docs, state, adopted skills). | `--labels` |
140
- | `doctor` | Diagnose the installation (read-only); proposes `repair`. | — |
141
- | `status` | Show installed version, branch drift, and open tasks. | — |
142
- | `emit` | Append a telemetry event to `.claude/state/events.jsonl`. | `<type> [--key=value …]` |
143
- | `telemetry` | Inspect or control the local anonymous telemetry. | `status` `show` `disable` `enable` |
131
+ The CLI ships 13 verbs. Run `lemony <command> --help` (or `-h`) for usage;
132
+ `lemony version` (or `--version` / `-v`) prints the installed version.
133
+
134
+ | Command | What it does | Key flags |
135
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
136
+ | `install` | Install into a fresh repo, or reconcile a pre-existing `.claude/`. | `--target=<claude-code>` `--task-storage-repo=<owner/name>` `--on-conflict=<vendor\|client>` |
137
+ | `update` | Move the install to the CLI's catalog version (3-way merge). | `--on-conflict=<vendor\|client>` `--dry-run` |
138
+ | `repair` | Re-sync at the **pinned** version (restore missing files, never clobber edits). | `--dry-run` |
139
+ | `rollback` | Restore a pre-change snapshot (offline). | `--to=<version>` `--list` `--cleanup` `--force` |
140
+ | `uninstall` | Remove vendor-managed files (keeps your docs, state, adopted skills). | `--labels` |
141
+ | `doctor` | Diagnose the installation (read-only); proposes `repair`. | — |
142
+ | `status` | Show installed version, branch drift, and open tasks. | — |
143
+ | `emit` | Append a telemetry event to `.claude/state/events.jsonl`. | `<type> [--key=value …]` |
144
+ | `discovery` | Reflect a raised/resolved discovery onto its issue (label flip; `pause` also comments). | `<pause\|resume>` `--task-id=<id>` `--tier=<T1..T6>` `--status=<…>` `--note=<text>` |
145
+ | `design-tokens` | Validate the design-token file, check WCAG contrast, or sync with a design tool (consume-if-exists). | `<validate\|contrast\|import\|export>` `--scan=<dir>` `--from=<file>` `--apply` `--only=<paths>` |
146
+ | `review-ledger` | Validate the Reviewer's evidence-ledger sidecar against the spec, the anchored diff and the declared gates (deterministic, agent-free). | `validate` `--task-id=<id>` `--anchor=<oid>` `--step=<N>` `--full-pass` |
147
+ | `spinoff` | Capture a non-blocking defect found mid-task as a pending stub. | `--title=<text>` `--body=<text>` `--parent=<id>` `--severity=<…>` `--kind=<…>` |
148
+ | `telemetry` | Inspect or control the local anonymous telemetry. | `status` `show` `flush` `enable` `disable [--purge-local]` |
144
149
 
145
150
  The harness keeps a **committed baseline** under `.claude/.harness/baseline/<version>/` — a
146
151
  verbatim copy of every installed vendor file at the pinned version — so `update` is a true
package/catalog/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.3.0
@@ -21,8 +21,11 @@ client-owned, so it never imposes content, it suggests changes.
21
21
 
22
22
  ## When the Orchestrator invokes you
23
23
 
24
- You are dispatched for one of these, with the relevant context (the discovery entry, the
25
- decision, the change, or the request):
24
+ You are dispatched for one of these, with the relevant context arriving **as paths
25
+ plus a short delta** (the `discoveries.md` entry's path with the decision — stated in
26
+ full when routed mid-resolution, before its `**Resolution**` block is recorded; its
27
+ gist once recorded; the PR number at closeout, or the branch/working tree on mid-task
28
+ routes where no PR exists yet; or the request) — read the files yourself:
26
29
 
27
30
  | Trigger | Skill to run |
28
31
  | -------------------------------------------------------------------------------------- | --------------------- |
@@ -44,8 +47,14 @@ acceptance for `write-adr` / `playbook-iterate`. See the Orchestrator's §Closeo
44
47
 
45
48
  ## Operating procedure
46
49
 
47
- 1. **Orient.** Read the context the Orchestrator gave you — the discovery entry and its
48
- resolution, the changed code, or the request. If the codebase is unfamiliar and the
50
+ 1. **Orient.** Read the context the Orchestrator referenced — the discovery entry and
51
+ its resolution from `discoveries.md` (when routed before the `**Resolution**`
52
+ block is recorded, the decision arrives in the spawn prompt instead — don't
53
+ stall looking for it in the entry); the changed code from the PR diff when a PR
54
+ exists (closeout) or from the branch when none does (mid-task routes — under
55
+ pre-commit review ON read the **worktree**: mid-task the branch holds only
56
+ OK'd groups, or nothing before the first OK); or the
57
+ request. If the codebase is unfamiliar and the
49
58
  task needs it, run `code-explorer` first.
50
59
  2. **Do the one thing you were invoked for**, via its skill. Keep edits surgical and
51
60
  the rationale linked, not duplicated: an ADR records the _why_, `architecture.md` the
@@ -12,6 +12,34 @@ vendor_version: '{{vendor_version}}'
12
12
 
13
13
  A **sub-agent** with fresh context. Implements the approved change via TDD.
14
14
 
15
+ ## Turn economy
16
+
17
+ On a long implementation the round trips, not the work, dominate wall-clock. The
18
+ contract is **batching-only: same experiments, fewer trips** — it never reduces
19
+ what you run, only how many calls carry it.
20
+
21
+ - **Batch the enumerated evidence up front.** The inputs your invocation itself
22
+ names — the issue, the task state files, the spec files for your assigned
23
+ scope — are knowable before you read anything: acquire them in **at most two
24
+ composite tool calls — your first tool calls, before any other trip** (one
25
+ composite `cat` over the named paths counts as one call — skip a missing
26
+ optional path rather than abort; a fan of parallel single-file reads does not
27
+ count as one). Everything you discover from there — the ADRs / playbooks the
28
+ spec points to, files you choose _because of_ what you just read — is
29
+ exploratory follow-up and stays free: never defer or drop a read you need.
30
+ - **Batch auxiliary commands.** Git ceremony travels composite
31
+ (`git add … && git commit … && git log -1; git push`-style one-liners — the
32
+ best-effort push rides `;`-separated so its failure reads as a warning, never
33
+ as the commit failing); setup sequences chain into one call; gate sequences
34
+ chain into one composite run — `&&`-chaining preserves the ordered
35
+ stop-at-first-failure the `verify` skill prescribes; the real-run exercise
36
+ stays its own trip.
37
+ - **The TDD core is exempt and untouchable.** The red → green → refactor runs per
38
+ behavior happen as the `tdd` skill prescribes and are never batched or merged:
39
+ **no batch may merge a red with its green**, and re-running to reach green or
40
+ after a refactor step is never a trip to save. Batching applies to auxiliary
41
+ trips only — never to the experiments that prove the work.
42
+
15
43
  ## Operating procedure
16
44
 
17
45
  1. **Orient** — read the issue, the task state (`.claude/state/tasks/<id>/`), and any
@@ -23,14 +51,20 @@ A **sub-agent** with fresh context. Implements the approved change via TDD.
23
51
  work on the task branch `harness/<id>-<slug>` the Orchestrator created; the spec is
24
52
  already committed there.
25
53
  2. **Implement via TDD** — run the `tdd` skill: one red → green → refactor cycle per
26
- behavior (vertical slices, never all-tests-then-all-code).
54
+ behavior (vertical slices, never all-tests-then-all-code). When your invocation
55
+ says **pre-commit review is ON**, the whole run obeys §Staging protocol (below) —
56
+ zero commits, staged save-points.
27
57
  **Scope: exactly what the invocation hands you.** By default that is the whole
28
58
  `tasks.md` list (all-at-once). In **step-by-step mode** the Orchestrator
29
- invokes you per taskwith **one** `tasks.md` task, or that task plus reviewer or
30
- human-checkpoint feedback on a later iteration. Build only that task and stop: do
31
- **not** run ahead into the next task (the human checkpoints each one before the next
32
- starts), and don't re-open tasks the human already OK'd unless the feedback you were
33
- handed says so.
59
+ invokes you per stepscoped to **one group**, handed **by reference** (the
60
+ group's id + header line): read that group's tasks from the spec's `tasks.md`
61
+ yourself. On a later iteration the reference comes with reviewer or
62
+ human-checkpoint feedback. Work the group's tasks
63
+ in order — one TDD cycle and small commits per task, as always (ON: staged
64
+ save-points per task — §Staging protocol) — then stop: do
65
+ **not** run ahead into the next group (the human checkpoints each group before the
66
+ next starts), and don't re-open tasks the human already OK'd unless the feedback
67
+ you were handed says so.
34
68
  **If the task touches UI**, `.claude/state/tasks/<id>/spec/ui-handoff.md` is your
35
69
  **obligatory design input** — the decisions, dials and targets captured in the handoff.
36
70
  Build the UI through the **`build-ui`** skill: it carries the token-application process,
@@ -47,7 +81,9 @@ A **sub-agent** with fresh context. Implements the approved change via TDD.
47
81
  `tasks/<id>/discoveries.md`, return the one-line summary, and stop. The Orchestrator
48
82
  mediates with the human and re-invokes you with the decision. Don't code past a
49
83
  contradiction (T1), a genuine unspecified fork (T2), scope drift (T3), or work that
50
- already exists (T4). If instead you notice a defect that is **independent** of your
84
+ already exists (T4). A scope that turns out to hide **≥2 independently mergeable
85
+ units** the plan didn't reveal is a T2 too (partition or keep together is the human's
86
+ call — never cut it yourself). If instead you notice a defect that is **independent** of your
51
87
  task — it doesn't block you and your change never touches it — don't pause and don't
52
88
  fix it: **run `note-side-finding`** to add it to your return summary, then carry on
53
89
  (blocking → discovery; independent → side-finding). The same channel covers
@@ -62,8 +98,51 @@ A **sub-agent** with fresh context. Implements the approved change via TDD.
62
98
  lint / tests + coverage / audit + a real run); otherwise run those gates inline.
63
99
  Commit your work to the branch and **push it, best-effort** — a failed push (offline,
64
100
  auth) is a warning in your summary, never a blocker; the commits stay safe locally,
65
- then return a summary to the Orchestrator. The Orchestrator opens
101
+ then return a summary to the Orchestrator. (Pre-commit review ON: no commit and
102
+ no push — leave **everything staged** and say so in the summary; the Orchestrator
103
+ commits at the human's OK.) The Orchestrator opens
66
104
  the PR when you signal done — you don't open it.
105
+ 6. **Report small, log rich** — your return summary is **capped**: the outcome
106
+ (done / blocked / discovery raised), key decisions or deviations as a few bullets,
107
+ the paths touched, a one-line verification result (command + outcome — the
108
+ checkpoint's "how to run it" is presented from it), and any `## Side-findings`
109
+ block. Long-form material — reasoning, alternatives weighed, per-task notes —
110
+ belongs in `progress.md` and the commit messages, never in the summary
111
+ (pre-commit review ON: in `progress.md` alone — there are no commit messages
112
+ until the human OK, so it carries everything a fresh iteration will need): the
113
+ Orchestrator carries your summary in context for the rest of the task, so every
114
+ extra line taxes the whole run. The cap trims narrative, not signal — a blocker,
115
+ a deviation from the spec, or a side-finding is always stated, however long the
116
+ list.
117
+
118
+ ## Staging protocol (pre-commit review ON)
119
+
120
+ Active **only when your invocation says so** — the human chose to review the work
121
+ **uncommitted**, so the branch must receive nothing until their OK. This inverts
122
+ the tdd add-early reflex; the branch history won't help you here, and a fresh
123
+ iteration only knows what this contract and the worktree tell it:
124
+
125
+ - **Zero commits, zero pushes.** Never `git commit`, never `git push` — not for
126
+ code, not for state. The Orchestrator commits once the human OKs.
127
+ - **Stage after every green task** — `git add -A` when a checkbox/task reaches
128
+ green (suite passing). The index is your save-point ladder: everything staged
129
+ is a proven-green floor.
130
+ - **Never stage mid-experiment.** A `git add` while red or mid-refactor silently
131
+ **overwrites the save-point** — `git status` looks identical afterwards, and
132
+ recovery yields nameless blobs (practically unrecoverable). Stage only at
133
+ green, immediately after the suite passes, and nowhere else.
134
+ - **Failed experiment ⇒ roll back to the save-point**: `git restore . && git clean -fd`
135
+ returns the worktree to the last staged state — staged content survives
136
+ verbatim, including new files (`clean` respects the index and `.gitignore`).
137
+ - **Watch what `-A` scoops.** Before your first stage, eyeball `git status` for
138
+ unexpected untracked files (secrets, scratch, build junk) — `git add -A`
139
+ trusts `.gitignore`. Fix the ignore file or remove the junk **before**
140
+ staging, never after (a cleanup `add` mid-experiment is exactly the
141
+ save-point-destroying move above).
142
+ - **On a fix iteration** (checkpoint `changes`), the Orchestrator hands you a
143
+ worktree that may carry the human's own revalidated edits: **stage everything
144
+ first** (`git add -A` — that snapshot is your safe starting point), then
145
+ iterate under this same protocol.
67
146
 
68
147
  ## Skills
69
148