cc-codeconductor 1.1.0 → 1.2.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.
- package/README.md +4 -2
- package/dist/core/verification/verification-runner.d.ts +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1413 -309
- package/dist/library.js +29 -1
- package/dist/validation/schemas.d.ts +97 -26
- package/package.json +1 -1
- package/presets/agy/AGENTS.md +10 -9
- package/presets/agy/hooks.json +2 -2
- package/presets/agy/scripts/invoke-hook.cjs +115 -0
- package/presets/agy/skills/backlog/SKILL.md +40 -70
- package/presets/agy/skills/cc-spec-mutation/SKILL.md +165 -0
- package/presets/agy/skills/cc-tdd-cycle/SKILL.md +3 -0
- package/presets/agy/skills/evaluation/SKILL.md +61 -2
- package/presets/agy/skills/openspec/SKILL.md +49 -19
- package/presets/agy/skills/testing-tdd/SKILL.md +53 -0
- package/presets/agy/skills/using-cc-skills/SKILL.md +48 -0
- package/presets/agy/workflows/cc-api-contract.md +14 -0
- package/presets/agy/workflows/cc-db-migration.md +14 -0
- package/presets/agy/workflows/cc-feature.md +18 -0
- package/presets/agy/workflows/cc-fix.md +14 -0
- package/presets/agy/workflows/cc-iterative.md +14 -0
- package/presets/agy/workflows/cc-openspec.md +14 -0
- package/presets/agy/workflows/cc-scorecard.md +2 -0
- package/presets/agy/workflows/cc-spec-mutation.md +191 -0
- package/presets/agy/workflows/cc-tdd-cycle.md +14 -0
- package/presets/claude/commands/cc/api-contract.md +14 -0
- package/presets/claude/commands/cc/db-migration.md +14 -0
- package/presets/claude/commands/cc/feature.md +18 -0
- package/presets/claude/commands/cc/fix.md +17 -0
- package/presets/claude/commands/cc/iterative.md +14 -0
- package/presets/claude/commands/cc/openspec.md +14 -0
- package/presets/claude/commands/cc/review.md +3 -0
- package/presets/claude/commands/cc/scorecard.md +2 -0
- package/presets/claude/commands/cc/spec-mutation.md +190 -0
- package/presets/claude/commands/cc/tdd-cycle.md +17 -0
- package/presets/claude/settings.json +13 -11
- package/presets/claude/skills/backlog/SKILL.md +40 -70
- package/presets/claude/skills/evaluation/SKILL.md +47 -24
- package/presets/claude/skills/openspec/SKILL.md +46 -38
- package/presets/claude/skills/testing-tdd/SKILL.md +53 -0
- package/presets/claude/skills/using-cc-skills/SKILL.md +48 -0
- package/presets/codex/AGENTS.md +16 -12
- package/presets/codex/skills/backlog/SKILL.md +61 -0
- package/presets/codex/skills/cc-api-contract/SKILL.md +87 -0
- package/presets/codex/skills/cc-backlog/SKILL.md +108 -0
- package/presets/codex/skills/cc-clarify/SKILL.md +36 -0
- package/presets/codex/skills/cc-council/SKILL.md +92 -0
- package/presets/codex/skills/cc-db-migration/SKILL.md +88 -0
- package/presets/codex/skills/cc-explore/SKILL.md +40 -0
- package/presets/codex/skills/cc-feature/SKILL.md +154 -0
- package/presets/codex/skills/cc-fix/SKILL.md +165 -0
- package/presets/codex/skills/cc-handoff/SKILL.md +45 -0
- package/presets/codex/skills/cc-iterative/SKILL.md +150 -0
- package/presets/codex/skills/cc-openspec/SKILL.md +191 -0
- package/presets/codex/skills/cc-pagespeed/SKILL.md +124 -0
- package/presets/codex/skills/cc-prototype/SKILL.md +42 -0
- package/presets/codex/skills/cc-refactor/SKILL.md +163 -0
- package/presets/codex/skills/cc-review/SKILL.md +152 -0
- package/presets/codex/skills/cc-scorecard/SKILL.md +82 -0
- package/presets/codex/skills/cc-security/SKILL.md +182 -0
- package/presets/codex/skills/cc-spec-mutation/SKILL.md +192 -0
- package/presets/codex/skills/cc-tdd-cycle/SKILL.md +266 -0
- package/presets/codex/skills/cc-test-plan/SKILL.md +153 -0
- package/presets/codex/skills/cc-triage/SKILL.md +38 -0
- package/presets/codex/skills/evaluation/SKILL.md +65 -0
- package/presets/codex/skills/openspec/SKILL.md +66 -0
- package/presets/codex/skills/testing-tdd/SKILL.md +53 -0
- package/presets/codex/skills/using-cc-skills/SKILL.md +48 -0
- package/presets/cursor/commands/cc/api-contract.md +14 -0
- package/presets/cursor/commands/cc/db-migration.md +14 -0
- package/presets/cursor/commands/cc/feature.md +18 -0
- package/presets/cursor/commands/cc/fix.md +17 -0
- package/presets/cursor/commands/cc/iterative.md +14 -0
- package/presets/cursor/commands/cc/openspec.md +14 -0
- package/presets/cursor/commands/cc/scorecard.md +2 -0
- package/presets/cursor/commands/cc/spec-mutation.md +190 -0
- package/presets/cursor/commands/cc/tdd-cycle.md +14 -0
- package/presets/cursor/skills/backlog/SKILL.md +40 -70
- package/presets/cursor/skills/evaluation/SKILL.md +61 -4
- package/presets/cursor/skills/openspec/SKILL.md +46 -36
- package/presets/cursor/skills/testing-tdd/SKILL.md +35 -574
- package/presets/cursor/skills/using-cc-skills/SKILL.md +48 -0
- package/presets/gemini/commands/cc/api-contract.toml +82 -0
- package/presets/gemini/commands/cc/ask.toml +54 -0
- package/presets/gemini/commands/cc/backlog.toml +103 -0
- package/presets/gemini/commands/cc/clarify.toml +31 -0
- package/presets/gemini/commands/cc/council.toml +87 -0
- package/presets/gemini/commands/cc/db-migration.toml +83 -0
- package/presets/gemini/commands/cc/explore.toml +35 -0
- package/presets/gemini/commands/cc/feature.toml +153 -0
- package/presets/gemini/commands/cc/fix.toml +163 -0
- package/presets/gemini/commands/cc/handoff.toml +40 -0
- package/presets/gemini/commands/cc/iterative.toml +145 -0
- package/presets/gemini/commands/cc/openspec.toml +186 -0
- package/presets/gemini/commands/cc/pagespeed.toml +119 -0
- package/presets/gemini/commands/cc/prototype.toml +37 -0
- package/presets/gemini/commands/cc/refactor.toml +158 -0
- package/presets/gemini/commands/cc/review.toml +150 -0
- package/presets/gemini/commands/cc/scorecard.toml +77 -0
- package/presets/gemini/commands/cc/security.toml +177 -0
- package/presets/gemini/commands/cc/spec-mutation.toml +187 -0
- package/presets/gemini/commands/cc/tdd-cycle.toml +264 -0
- package/presets/gemini/commands/cc/test-plan.toml +148 -0
- package/presets/gemini/commands/cc/triage.toml +33 -0
- package/presets/opencode/README.md +24 -21
- package/presets/opencode/agents/architect.md +6 -0
- package/presets/opencode/agents/implementer.md +7 -0
- package/presets/opencode/agents/reviewer.md +6 -0
- package/presets/opencode/agents/tester.md +6 -0
- package/presets/opencode/commands/cc-api-contract.md +14 -0
- package/presets/opencode/commands/cc-db-migration.md +14 -0
- package/presets/opencode/commands/cc-feature.md +18 -0
- package/presets/opencode/commands/cc-fix.md +17 -0
- package/presets/opencode/commands/cc-iterative.md +14 -0
- package/presets/opencode/commands/cc-openspec.md +14 -0
- package/presets/opencode/commands/cc-scorecard.md +2 -0
- package/presets/opencode/commands/cc-spec-mutation.md +190 -0
- package/presets/opencode/commands/cc-tdd-cycle.md +14 -0
- package/presets/opencode/opencode.jsonc +1 -1
- package/presets/opencode/prompts/v1.0.0/architect.md +6 -0
- package/presets/opencode/prompts/v1.0.0/implementer.md +7 -0
- package/presets/opencode/prompts/v1.0.0/reviewer.md +6 -0
- package/presets/opencode/prompts/v1.0.0/tester.md +6 -0
- package/presets/opencode/skills/backlog/SKILL.md +40 -70
- package/presets/opencode/skills/evaluation/SKILL.md +61 -2
- package/presets/opencode/skills/openspec/SKILL.md +46 -34
- package/presets/opencode/skills/testing-tdd/SKILL.md +35 -574
- package/presets/opencode/skills/using-cc-skills/SKILL.md +48 -0
- package/presets/shared/__pycache__/mutation_runner.cpython-314.pyc +0 -0
- package/presets/shared/invoke-hook.cjs +115 -0
- package/presets/shared/mutation_runner.py +273 -0
- package/src/presets/manifests/agy.yml +2 -0
- package/src/presets/manifests/claude.yml +3 -0
- package/src/presets/manifests/gemini.yml +15 -0
- package/src/presets/models/agy.yml +24 -24
- package/src/presets/models/claude.yml +10 -10
- package/src/presets/models/codex.yml +10 -10
- package/src/presets/models/cursor.yml +10 -10
- package/src/presets/models/gemini.yml +10 -10
- package/src/presets/models/opencode.yml +10 -10
- package/presets/agy/scripts/post-tool.sh +0 -25
- package/presets/agy/scripts/pre-tool.sh +0 -56
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
description = "into an immutable Gherkin contract (SHA-256 frozen), implement under the three laws of TDD, pass a judge audit, and merge only if every mutant dies."
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# Spec-Mutation — Hard Spec → TDD → Judge → Mutation Gate
|
|
5
|
+
|
|
6
|
+
Scope: {{args}}
|
|
7
|
+
|
|
8
|
+
Describe what behavior you want to implement. Include:
|
|
9
|
+
|
|
10
|
+
- The function, method, or feature to implement
|
|
11
|
+
- The expected behavior (inputs, outputs, invariants, edge cases)
|
|
12
|
+
- The allowed file scope (production files that may change)
|
|
13
|
+
- The test command for the affected suite (e.g. `pytest tests/test_billing.py`)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 0 — CCEP Bootstrap
|
|
18
|
+
|
|
19
|
+
Command: `spec-mutation` (fixed for this workflow — do not infer from user text)
|
|
20
|
+
|
|
21
|
+
1. Run: `npx cc-codeconductor ccep parse --command spec-mutation "{{args}}" --output json`
|
|
22
|
+
2. Run: `npx cc-codeconductor ccep resolve --command spec-mutation "{{args}}" --output json`
|
|
23
|
+
3. Run: `npx cc-codeconductor ccep profile spec-mutation --output json`
|
|
24
|
+
4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command spec-mutation --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
|
|
25
|
+
5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
|
|
26
|
+
Canonical delivery order is test-before-implement whenever both phases apply.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Step 0b — OpenSpec quality gates
|
|
31
|
+
|
|
32
|
+
If `openspec status` reports an active change folder:
|
|
33
|
+
|
|
34
|
+
1. Run: `npx cc-codeconductor openspec validate --output json`
|
|
35
|
+
2. Run: `npx cc-codeconductor openspec analyze --output json`
|
|
36
|
+
3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
|
|
37
|
+
4. Next command spelling on this runner: `/cc:spec-mutation`
|
|
38
|
+
|
|
39
|
+
Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Contract
|
|
44
|
+
|
|
45
|
+
The Gherkin specification is the **immutable contract** of the system. No code
|
|
46
|
+
merges unless it survives intentional source mutations. The loop is closed:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
[Human + spec_partner] ──> [gherkin_author] ──> [Test Freeze: SHA-256]
|
|
50
|
+
│
|
|
51
|
+
┌──────────────────────────────────────────────────────┘
|
|
52
|
+
▼
|
|
53
|
+
[tdd_craftsman] <───────────────┐ (surviving mutant)
|
|
54
|
+
(Red-Green-Refactor) │
|
|
55
|
+
│ │
|
|
56
|
+
▼ │
|
|
57
|
+
[judge] ───────────> [mutation_testing] ───> [Safe Merge]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Role mapping onto Conductor Agents (AGENTS.md):
|
|
61
|
+
|
|
62
|
+
| Workflow role | Conductor Agent | Deliverable |
|
|
63
|
+
| ------------------ | ----------------- | ------------------------------------------ |
|
|
64
|
+
| `craftsman_lead` | `orchestrator` | Routed Task Cards, per-stage scorecards |
|
|
65
|
+
| `spec_partner` | `task-coach` | Spec draft with invariants and boundaries |
|
|
66
|
+
| `gherkin_author` | `contract-builder`| Strict `.feature` file (Given/When/Then) |
|
|
67
|
+
| `tdd_craftsman` | `tester` → `implementer` | Failing test, then minimal production code |
|
|
68
|
+
| `judge` | `reviewer` | Binary verdict (PASS/REJECT) with scoring |
|
|
69
|
+
| `mutation_testing` | `tester` (runner) | Killed/survived mutant report |
|
|
70
|
+
|
|
71
|
+
## Stage 1 — Interactive refinement (`spec_partner` / task-coach)
|
|
72
|
+
|
|
73
|
+
Do not jump to implementation. Apply Socratic questioning to the initial intent:
|
|
74
|
+
|
|
75
|
+
- Preconditions, postconditions, and edge cases.
|
|
76
|
+
- Invariant matrix: what must always be true.
|
|
77
|
+
- Scope boundaries: explicit `Scope / Files` and `Scope / Out` for the Task Card.
|
|
78
|
+
|
|
79
|
+
Stop gate: human confirms the draft before formalization.
|
|
80
|
+
|
|
81
|
+
## Stage 2 — Hard Spec formalization (`gherkin_author` / contract-builder)
|
|
82
|
+
|
|
83
|
+
Formalize the agreed draft into `specs/<task>.feature` using strict Gherkin:
|
|
84
|
+
|
|
85
|
+
- No vague language ("must respond fast" is forbidden — use measurable Then steps).
|
|
86
|
+
- Every scenario declares preconditions (`Given`), actions (`When`), and
|
|
87
|
+
observable states (`Then`).
|
|
88
|
+
- Once the human approves the `.feature`, freeze it:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
shasum -a 256 specs/<task>.feature tests/ > .codeconductor/tasks/<task_id>.lock
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
From this point `specs/` and `tests/` are **read-only** for implementation
|
|
95
|
+
agents. Before every later gate, recompute the hash; any single-byte difference
|
|
96
|
+
aborts the pipeline with scorecard 0 (Specification Gaming).
|
|
97
|
+
|
|
98
|
+
## Stage 3 — TDD under the three laws (`tdd_craftsman`)
|
|
99
|
+
|
|
100
|
+
Delegates to the `/cc:tdd-cycle` state machine (`tddCycleStateMachine` in
|
|
101
|
+
`domain/loop`). Evidence must be captured with `captureTddSuiteEvidence` — do
|
|
102
|
+
not hand-edit JSON under `.codeconductor/evidence/`.
|
|
103
|
+
|
|
104
|
+
1. **Law 1 (RED):** no production code except to make a failing test pass. A
|
|
105
|
+
compile error from a missing interface counts as a failure.
|
|
106
|
+
2. **Law 2:** write exactly one failing assertion or scenario at a time.
|
|
107
|
+
3. **Law 3 (GREEN):** write only the minimal production code to pass. No
|
|
108
|
+
speculative code, no preventive heuristics, stdlib-first.
|
|
109
|
+
|
|
110
|
+
Hard rule: any write attempt against `specs/` or `tests/` during GREEN/REFACTOR
|
|
111
|
+
is a harness violation — stop execution and report.
|
|
112
|
+
|
|
113
|
+
## Stage 4 — Judge audit (`judge` / reviewer)
|
|
114
|
+
|
|
115
|
+
Deterministic gates before spending compute on mutation:
|
|
116
|
+
|
|
117
|
+
- Clean compile / diagnostics exit code 0.
|
|
118
|
+
- Traceability: every Gherkin step maps to an implemented test step.
|
|
119
|
+
- Scope Gaming audit: `git diff --name-only` must match the Task Card
|
|
120
|
+
`Scope / Files` exactly. Relaxed types, weakened assertions, or out-of-scope
|
|
121
|
+
edits → REJECT with findings.
|
|
122
|
+
|
|
123
|
+
Verdict is binary: PASS continues to the mutation gate; REJECT returns to the
|
|
124
|
+
`implement` phase with the findings attached.
|
|
125
|
+
|
|
126
|
+
## Stage 5 — Mutation gate (`mutation_testing`)
|
|
127
|
+
|
|
128
|
+
Run the deterministic AST mutator shipped with this preset:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
python3 presets/shared/mutation_runner.py \\
|
|
132
|
+
--target <production_file.py> \\
|
|
133
|
+
--test-command "<test command>" \\
|
|
134
|
+
--spec-folder specs
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The runner applies deterministic operator mutations (`>` → `<=`, `==` → `!=`,
|
|
138
|
+
`is` → `is not`, …) one at a time, re-runs the suite per mutant, and restores
|
|
139
|
+
the original source unconditionally (`finally` rollback).
|
|
140
|
+
|
|
141
|
+
- **Mutant killed (tests fail):** the suite detects the corruption. Continue.
|
|
142
|
+
- **Mutant survived (tests pass):** the tests are blind to this branch. The
|
|
143
|
+
runner writes `specs/handover.md` + appends to
|
|
144
|
+
`specs/implementation-summary.md` and exits with code **2**.
|
|
145
|
+
|
|
146
|
+
Non-Python stacks: substitute Stryker (JS/TS), PITest (JVM), or Mutmut
|
|
147
|
+
(Python full-suite) with the same contract — 100% kill rate or hands-off.
|
|
148
|
+
|
|
149
|
+
### Hands-off protocol (exit code 2)
|
|
150
|
+
|
|
151
|
+
1. Do NOT modify production code to "fix" a surviving mutant.
|
|
152
|
+
2. Route back to `tdd_craftsman` with `specs/handover.md` as input: write the
|
|
153
|
+
missing failing test (Law 1 & 2) that asserts the mutated branch.
|
|
154
|
+
3. Re-run stages 3–5.
|
|
155
|
+
|
|
156
|
+
### Circuit breaker (max 3 loops)
|
|
157
|
+
|
|
158
|
+
The orchestrator keeps a persistent counter per Task Card. If the
|
|
159
|
+
`tdd_craftsman ↔ mutation_testing` loop does not reach a 100% kill rate after
|
|
160
|
+
**3 iterations**:
|
|
161
|
+
|
|
162
|
+
- Cancel active subagents (stop token/context spend).
|
|
163
|
+
- `git checkout -- <scope>` rollback to the last clean state.
|
|
164
|
+
- Scorecard: `STATUS = BLOCKED`; escalate to a human operator. The branch stays
|
|
165
|
+
frozen until human arbitration.
|
|
166
|
+
|
|
167
|
+
## Guardrails (harness-enforced, not prompt-enforced)
|
|
168
|
+
|
|
169
|
+
- **Test Freezing:** SHA-256 of `specs/` + `tests/` stored in
|
|
170
|
+
`.codeconductor/tasks/<task_id>.lock`; hash mismatch aborts the pipeline.
|
|
171
|
+
- **Scope Guardian:** `fs_write`/`fs_patch` paths are validated against the Task
|
|
172
|
+
Card `Scope / Files`; path escapes (`../`) and critical files (`**/.env*`,
|
|
173
|
+
`**/credentials*`, infrastructure roots) are denied per `policy.yml`.
|
|
174
|
+
- **RBAC per role:** `gherkin_author` writes only `specs/`; `tdd_craftsman`
|
|
175
|
+
reads specs/tests and writes only scoped `src/`; `judge` and
|
|
176
|
+
`mutation_testing` are read-only except the runner's rolled-back patch.
|
|
177
|
+
- **Worktree isolation:** run the whole flow in a dedicated `git worktree`;
|
|
178
|
+
protected branches (`main`, `master`, `develop`) are never touched.
|
|
179
|
+
|
|
180
|
+
## Completion criteria
|
|
181
|
+
|
|
182
|
+
- [ ] `.feature` approved and frozen (SHA-256 lock file exists and matches).
|
|
183
|
+
- [ ] RED → GREEN → REFACTOR evidence captured per phase.
|
|
184
|
+
- [ ] Judge verdict PASS (compile clean, traceability complete, scope clean).
|
|
185
|
+
- [ ] Mutation runner exits 0 with `total_mutants_killed == total_points`.
|
|
186
|
+
- [ ] Scorecard records the kill rate and iteration count (≤ 3).
|
|
187
|
+
"""
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
description = "test first, implement the minimum code to pass it, then refactor with the suite green."
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# TDD Cycle — Red → Green → Refactor
|
|
5
|
+
|
|
6
|
+
Scope: {{args}}
|
|
7
|
+
|
|
8
|
+
Describe what behavior you want to implement. Include:
|
|
9
|
+
|
|
10
|
+
- The function, method, or feature to implement
|
|
11
|
+
- The expected behavior (inputs and outputs, or acceptance criteria)
|
|
12
|
+
- Any known constraints or edge cases
|
|
13
|
+
- Relevant files or modules (if known)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 0 — CCEP Bootstrap
|
|
18
|
+
|
|
19
|
+
Command: `tdd-cycle` (fixed for this workflow — do not infer from user text)
|
|
20
|
+
|
|
21
|
+
1. Run: `npx cc-codeconductor ccep parse --command tdd-cycle "{{args}}" --output json`
|
|
22
|
+
2. Run: `npx cc-codeconductor ccep resolve --command tdd-cycle "{{args}}" --output json`
|
|
23
|
+
3. Run: `npx cc-codeconductor ccep profile tdd-cycle --output json`
|
|
24
|
+
4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command tdd-cycle --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
|
|
25
|
+
5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
|
|
26
|
+
Canonical delivery order is test-before-implement whenever both phases apply.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Step 0b — OpenSpec quality gates
|
|
31
|
+
|
|
32
|
+
If `openspec status` reports an active change folder:
|
|
33
|
+
|
|
34
|
+
1. Run: `npx cc-codeconductor openspec validate --output json`
|
|
35
|
+
2. Run: `npx cc-codeconductor openspec analyze --output json`
|
|
36
|
+
3. If analyze `stop` is true or any finding is CRITICAL, stop. Do not delegate to implementer.
|
|
37
|
+
4. Next command spelling on this runner: `/cc:tdd-cycle`
|
|
38
|
+
|
|
39
|
+
Local development: `bun run dev <same argv>`. Published package: `npx cc-codeconductor`.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Before you begin — mandatory pre-check
|
|
45
|
+
|
|
46
|
+
This command enforces strict TDD discipline. The three phases are sequential and
|
|
47
|
+
non-negotiable:
|
|
48
|
+
|
|
49
|
+
1. **RED** — a failing test exists before any implementation code is written
|
|
50
|
+
2. **GREEN** — the minimum implementation to make the test pass (no more)
|
|
51
|
+
3. **REFACTOR** — clean up the code while keeping all tests green
|
|
52
|
+
|
|
53
|
+
Do not write implementation code during RED. Do not refactor during GREEN.
|
|
54
|
+
Mixing phases invalidates the cycle.
|
|
55
|
+
|
|
56
|
+
## Verifiable phase gates
|
|
57
|
+
|
|
58
|
+
RED → GREEN and GREEN → REFACTOR are enforced by `tddCycleStateMachine` in
|
|
59
|
+
`domain/loop`. Evidence must be captured with `captureTddSuiteEvidence` (verification
|
|
60
|
+
runner) — do not hand-edit JSON under `.codeconductor/evidence/`.
|
|
61
|
+
|
|
62
|
+
- RED→GREEN requires runner evidence that the suite **failed**.
|
|
63
|
+
- GREEN→REFACTOR requires runner evidence that the suite **passed**.
|
|
64
|
+
|
|
65
|
+
Do not advance phases until that evidence exists.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Phase 1 — RED (Tester role)
|
|
70
|
+
|
|
71
|
+
Invoke the `tester` subagent via the Task tool.
|
|
72
|
+
|
|
73
|
+
### 1a — Scope clarification
|
|
74
|
+
|
|
75
|
+
Before writing any test, confirm:
|
|
76
|
+
|
|
77
|
+
- What is the unit of behavior being tested? (function, method, endpoint, domain
|
|
78
|
+
rule)
|
|
79
|
+
- What are the inputs and expected outputs?
|
|
80
|
+
- What are the failure cases?
|
|
81
|
+
|
|
82
|
+
If the scope is ambiguous, ask one clarifying question and wait for the answer.
|
|
83
|
+
|
|
84
|
+
### 1b — Write the failing test
|
|
85
|
+
|
|
86
|
+
Write a test that:
|
|
87
|
+
|
|
88
|
+
- Targets exactly the behavior described in the scope
|
|
89
|
+
- Fails for the right reason (not a compile error, not a missing dependency —
|
|
90
|
+
the logic does not exist yet)
|
|
91
|
+
- Has a name that describes the behavior: `given_X_when_Y_then_Z` or equivalent
|
|
92
|
+
in the project's test naming convention
|
|
93
|
+
- Covers at minimum: one happy path, one edge case, one failure case
|
|
94
|
+
|
|
95
|
+
Do not write the implementation. Do not make the test pass by any means other
|
|
96
|
+
than the implementation that will follow in Phase 2.
|
|
97
|
+
|
|
98
|
+
### 1c — Run the test suite and confirm RED
|
|
99
|
+
|
|
100
|
+
Run the test suite. The new test must fail. Existing tests must pass.
|
|
101
|
+
|
|
102
|
+
If the new test passes without implementation, the test is wrong. Fix the test
|
|
103
|
+
before continuing.
|
|
104
|
+
|
|
105
|
+
**RED Phase Report:**
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
## RED Phase Report
|
|
109
|
+
|
|
110
|
+
**Test file**: [path/to/test/file]
|
|
111
|
+
**Tests written**:
|
|
112
|
+
- [test name] — [what it verifies]
|
|
113
|
+
|
|
114
|
+
**Suite result**: [X passing, Y failing]
|
|
115
|
+
**New test status**: FAIL ✓
|
|
116
|
+
**Failure reason**: [quoted error or assertion message]
|
|
117
|
+
**Existing tests**: [all passing | N failing — list]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**STOP. Show the RED Phase Report. Do not proceed to GREEN without
|
|
121
|
+
confirmation.**
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Phase 2 — GREEN (Implementer role)
|
|
126
|
+
|
|
127
|
+
Invoke the `implementer` subagent via the Task tool.
|
|
128
|
+
|
|
129
|
+
### 2a — Read the failing test before writing any code
|
|
130
|
+
|
|
131
|
+
Understand exactly what the test asserts. Write only the code that satisfies
|
|
132
|
+
that assertion. Nothing more.
|
|
133
|
+
|
|
134
|
+
### 2b — Implement the minimum
|
|
135
|
+
|
|
136
|
+
Rules for GREEN phase:
|
|
137
|
+
|
|
138
|
+
- Write the smallest amount of code that makes the failing test pass
|
|
139
|
+
- Do not add features not tested
|
|
140
|
+
- Do not clean up or restructure existing code — that is Refactor's job
|
|
141
|
+
- Do not add new tests — that is another RED cycle
|
|
142
|
+
- Hardcoding a return value is acceptable if it makes the test pass (the
|
|
143
|
+
Refactor phase will generalize it)
|
|
144
|
+
|
|
145
|
+
### 2c — Run the test suite and confirm GREEN
|
|
146
|
+
|
|
147
|
+
Run the test suite. The new test must pass. All previously passing tests must
|
|
148
|
+
still pass.
|
|
149
|
+
|
|
150
|
+
If any previously passing test now fails, you introduced a regression. Fix it
|
|
151
|
+
before continuing.
|
|
152
|
+
|
|
153
|
+
**GREEN Phase Report:**
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
## GREEN Phase Report
|
|
157
|
+
|
|
158
|
+
**Files changed**:
|
|
159
|
+
- [path/to/file] — [what was added, one sentence]
|
|
160
|
+
|
|
161
|
+
**Implementation approach**: [one sentence — what the code does]
|
|
162
|
+
**Suite result**: [X passing, Y failing]
|
|
163
|
+
**New test status**: PASS ✓
|
|
164
|
+
**Regressions**: [none | list failing tests]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**STOP. Show the GREEN Phase Report. Do not proceed to REFACTOR without
|
|
168
|
+
confirmation.**
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Phase 3 — REFACTOR (Implementer role, then Reviewer role)
|
|
173
|
+
|
|
174
|
+
Invoke the `implementer` subagent via the Task tool.
|
|
175
|
+
|
|
176
|
+
### 3a — Assess what needs cleaning
|
|
177
|
+
|
|
178
|
+
Before touching any code, identify:
|
|
179
|
+
|
|
180
|
+
- Duplication introduced during GREEN
|
|
181
|
+
- Names that do not clearly express intent
|
|
182
|
+
- Abstractions that belong in a separate function or module
|
|
183
|
+
- Logic that is hardcoded and should be generalized
|
|
184
|
+
|
|
185
|
+
Do not invent improvements. Only address what is directly in the implementation
|
|
186
|
+
written in Phase 2.
|
|
187
|
+
|
|
188
|
+
### 3b — Refactor
|
|
189
|
+
|
|
190
|
+
Rules for REFACTOR phase:
|
|
191
|
+
|
|
192
|
+
- All tests must remain GREEN throughout — run the suite after each change
|
|
193
|
+
- Do not add new behavior
|
|
194
|
+
- Do not add new tests (if you discover untested behavior, note it for a new RED
|
|
195
|
+
cycle)
|
|
196
|
+
- Do not change function signatures unless the original was clearly wrong
|
|
197
|
+
|
|
198
|
+
### 3c — Run the test suite and confirm GREEN after refactor
|
|
199
|
+
|
|
200
|
+
The full suite must pass. If any test fails during refactor, undo the last
|
|
201
|
+
change and investigate.
|
|
202
|
+
|
|
203
|
+
### 3d — Review (Reviewer role)
|
|
204
|
+
|
|
205
|
+
Invoke the `reviewer` subagent via the Task tool.
|
|
206
|
+
|
|
207
|
+
Review only the refactored code against these axes:
|
|
208
|
+
|
|
209
|
+
| Axis | What to check |
|
|
210
|
+
| ------------- | --------------------------------------------------------------- |
|
|
211
|
+
| Scope | Did the refactor change any behavior? |
|
|
212
|
+
| Correctness | Does the logic still satisfy the original test intent? |
|
|
213
|
+
| Architecture | Does the code follow existing project patterns? |
|
|
214
|
+
| Test coverage | Are all written tests still meaningful (not trivially passing)? |
|
|
215
|
+
|
|
216
|
+
Produce a Review Report. CRITICAL findings block completion.
|
|
217
|
+
|
|
218
|
+
**REFACTOR Phase Report:**
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
## REFACTOR Phase Report
|
|
222
|
+
|
|
223
|
+
**Changes made**:
|
|
224
|
+
- [path/to/file] — [what was cleaned up]
|
|
225
|
+
|
|
226
|
+
**Suite result**: [X passing, Y failing]
|
|
227
|
+
**Behavioral changes**: none (refactor only)
|
|
228
|
+
|
|
229
|
+
### Review findings
|
|
230
|
+
**CRITICAL**: (none) | [list]
|
|
231
|
+
**WARNING**: (none) | [list]
|
|
232
|
+
**SUGGESTION**: (none) | [list]
|
|
233
|
+
|
|
234
|
+
**Verdict**: approved | approved with warnings | blocked
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Completion
|
|
240
|
+
|
|
241
|
+
The TDD cycle is complete when:
|
|
242
|
+
|
|
243
|
+
- RED: at least one failing test was written and confirmed failing
|
|
244
|
+
- GREEN: the minimum implementation makes the test pass
|
|
245
|
+
- REFACTOR: the code is clean, all tests pass, no CRITICAL review findings
|
|
246
|
+
|
|
247
|
+
**Final Summary:**
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
## TDD Cycle Summary
|
|
251
|
+
|
|
252
|
+
**Behavior implemented**: [one sentence]
|
|
253
|
+
**Tests written**: [count] — [list test names]
|
|
254
|
+
**Files changed**: [list]
|
|
255
|
+
**Suite result**: [X passing, Y failing]
|
|
256
|
+
**Cycle status**: complete | blocked (reason)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
If the behavior requires additional test cases, start a new `/tdd-cycle` with
|
|
260
|
+
the next scenario. One cycle = one behavior.
|
|
261
|
+
|
|
262
|
+
Skill: `testing-tdd`. Evidence from the verification runner only — handmade TDD
|
|
263
|
+
JSON is rejected. Optional gate: `bun run dev scorecard suite-run --suite workflow-gates`.
|
|
264
|
+
"""
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
description = "unit, integration, contract, and edge cases without writing implementation code."
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# Test Plan Workflow
|
|
5
|
+
|
|
6
|
+
Scope: {{args}}
|
|
7
|
+
|
|
8
|
+
Specify what to plan tests for. Examples:
|
|
9
|
+
|
|
10
|
+
- A feature name: `user authentication`
|
|
11
|
+
- A module or file path: `src/orders/OrderService.kt`
|
|
12
|
+
- A Task Card title: `Add paginated product listing endpoint`
|
|
13
|
+
- A PR or branch: `feature/payment-retry`
|
|
14
|
+
|
|
15
|
+
If {{args}} is empty, describe the scope in your next message before
|
|
16
|
+
proceeding.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 0 — CCEP Bootstrap
|
|
21
|
+
|
|
22
|
+
Command: `test-plan` (fixed for this workflow — do not infer from user text)
|
|
23
|
+
|
|
24
|
+
1. Run: `npx cc-codeconductor ccep parse --command test-plan "{{args}}" --output json`
|
|
25
|
+
2. Run: `npx cc-codeconductor ccep resolve --command test-plan "{{args}}" --output json`
|
|
26
|
+
3. Run: `npx cc-codeconductor ccep profile test-plan --output json`
|
|
27
|
+
4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command test-plan --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
|
|
28
|
+
5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Step 1 — Scope confirmation
|
|
33
|
+
|
|
34
|
+
Before generating the test plan, confirm the scope is well-defined.
|
|
35
|
+
|
|
36
|
+
A valid scope includes:
|
|
37
|
+
|
|
38
|
+
- The behavior or module under test
|
|
39
|
+
- The acceptance criteria or expected behavior (from the Task Card if available)
|
|
40
|
+
- Known edge cases or failure modes
|
|
41
|
+
|
|
42
|
+
If the scope is vague (e.g., "test the whole service"), ask one clarifying
|
|
43
|
+
question and wait for the answer.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 2 — Test plan generation (Tester role, planning mode)
|
|
48
|
+
|
|
49
|
+
Invoke the `tester` subagent via the Task tool.
|
|
50
|
+
|
|
51
|
+
Produce a test plan document — not test code. The plan will be used as input
|
|
52
|
+
when tests are actually written.
|
|
53
|
+
|
|
54
|
+
Cover the following layers:
|
|
55
|
+
|
|
56
|
+
**Unit tests**
|
|
57
|
+
|
|
58
|
+
- Individual functions or methods in isolation
|
|
59
|
+
- One test per behavior, not per method
|
|
60
|
+
- Input/output contracts, null handling, type coercion
|
|
61
|
+
|
|
62
|
+
**Integration tests**
|
|
63
|
+
|
|
64
|
+
- Interactions between two or more components
|
|
65
|
+
- Database read/write cycles (if applicable)
|
|
66
|
+
- External service boundaries (mocked or stubbed)
|
|
67
|
+
|
|
68
|
+
**Contract tests**
|
|
69
|
+
|
|
70
|
+
- API endpoint contracts: request shape, response shape, status codes
|
|
71
|
+
- Event schema contracts (if event-driven components are in scope)
|
|
72
|
+
|
|
73
|
+
**Edge cases**
|
|
74
|
+
|
|
75
|
+
- Empty inputs, boundary values, max/min limits
|
|
76
|
+
- Concurrent access (if shared state is involved)
|
|
77
|
+
- Failure paths: what happens when a dependency is unavailable
|
|
78
|
+
|
|
79
|
+
**Regression cases**
|
|
80
|
+
|
|
81
|
+
- Known past bugs that must not recur (include reference if available)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Step 3 — Test Plan format
|
|
86
|
+
|
|
87
|
+
Produce the plan in this format:
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
## Test Plan — [Scope Name]
|
|
91
|
+
|
|
92
|
+
### Scope
|
|
93
|
+
[What is being tested and why]
|
|
94
|
+
|
|
95
|
+
### Unit Tests
|
|
96
|
+
| Test ID | Target | Scenario | Expected Result |
|
|
97
|
+
| ------- | ------ | -------- | --------------- |
|
|
98
|
+
| U-001 | ... | ... | ... |
|
|
99
|
+
|
|
100
|
+
### Integration Tests
|
|
101
|
+
| Test ID | Components | Scenario | Expected Result |
|
|
102
|
+
| ------- | ---------- | -------- | --------------- |
|
|
103
|
+
| I-001 | ... | ... | ... |
|
|
104
|
+
|
|
105
|
+
### Contract Tests
|
|
106
|
+
| Test ID | Endpoint/Event | Property | Expected Value |
|
|
107
|
+
| ------- | -------------- | -------- | -------------- |
|
|
108
|
+
| C-001 | ... | ... | ... |
|
|
109
|
+
|
|
110
|
+
### Edge Cases
|
|
111
|
+
| Test ID | Input/Condition | Expected Behavior |
|
|
112
|
+
| ------- | --------------- | ----------------- |
|
|
113
|
+
| E-001 | ... | ... |
|
|
114
|
+
|
|
115
|
+
### Regression Cases
|
|
116
|
+
| Test ID | Reference | Scenario | Must Not Happen |
|
|
117
|
+
| ------- | --------- | -------- | --------------- |
|
|
118
|
+
| R-001 | ... | ... | ... |
|
|
119
|
+
|
|
120
|
+
### Coverage Targets
|
|
121
|
+
- Minimum unit coverage: [% or "all acceptance criteria covered"]
|
|
122
|
+
- Integration scenarios: [count]
|
|
123
|
+
- Contract validations: [count]
|
|
124
|
+
|
|
125
|
+
### Out of Scope
|
|
126
|
+
[What this test plan explicitly does not cover and why]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Step 4 — Human review
|
|
132
|
+
|
|
133
|
+
Show the Test Plan before any tests are written. The Test Plan is an artifact
|
|
134
|
+
for review and approval.
|
|
135
|
+
|
|
136
|
+
Writing test code is a separate action — run `/feature` or add a test task to
|
|
137
|
+
implement from this plan.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Completion
|
|
142
|
+
|
|
143
|
+
Deliver the complete Test Plan document. Save it as
|
|
144
|
+
`docs/test-plans/[scope-slug].md` if requested.
|
|
145
|
+
|
|
146
|
+
This command produces a plan, not test files. No production code and no test
|
|
147
|
+
code is written during this command.
|
|
148
|
+
"""
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
description = "CodeConductor triage workflow"
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# Triage Workflow
|
|
5
|
+
|
|
6
|
+
Triage request: {{args}}
|
|
7
|
+
|
|
8
|
+
## Step 0 — CCEP Bootstrap
|
|
9
|
+
|
|
10
|
+
Command: `triage` (fixed for this workflow — do not infer from user text)
|
|
11
|
+
|
|
12
|
+
1. Run: `npx cc-codeconductor ccep parse --command triage "{{args}}" --output json`
|
|
13
|
+
2. Run: `npx cc-codeconductor ccep resolve --command triage "{{args}}" --output json`
|
|
14
|
+
3. Run: `npx cc-codeconductor ccep profile triage --output json`
|
|
15
|
+
4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command triage --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
|
|
16
|
+
5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 1 — Classify (task-coach)
|
|
21
|
+
|
|
22
|
+
Invoke `task-coach`. Produce: title, type (`feature` | `fix` | `refactor` | `review` | `docs` | `test`), risk, named scope, and the destination command (`feature`, `fix`, `refactor`, `review`, `explore`, …).
|
|
23
|
+
|
|
24
|
+
Ask one question per unresolved branch. If the human is unavailable, emit a Markdown questionnaire and stop at ConfirmationGate.
|
|
25
|
+
|
|
26
|
+
**STOP here. Show the classification and wait for confirmation before running the destination workflow.**
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Completion
|
|
31
|
+
|
|
32
|
+
Do not implement. Hand the human a destination slash command and a partial Task Card.
|
|
33
|
+
"""
|