opencode-codeops 2.5.0 → 2.6.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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +39 -0
  3. package/_shared/spec-first-ordering.md +6 -2
  4. package/_shared/test-selection.md +130 -0
  5. package/bin/codeops-test.mjs +855 -0
  6. package/bin/lib/test-branch-policy.d.mts +51 -0
  7. package/bin/lib/test-branch-policy.mjs +185 -0
  8. package/bin/lib/test-map-validate.d.mts +42 -0
  9. package/bin/lib/test-map-validate.mjs +618 -0
  10. package/bin/lib/test-map.d.mts +114 -0
  11. package/bin/lib/test-map.mjs +384 -0
  12. package/bin/lib/test-provenance.d.mts +73 -0
  13. package/bin/lib/test-provenance.mjs +188 -0
  14. package/bin/lib/test-runner.d.mts +72 -0
  15. package/bin/lib/test-runner.mjs +350 -0
  16. package/bin/lib/test-selection-changes.d.mts +76 -0
  17. package/bin/lib/test-selection-changes.mjs +272 -0
  18. package/bin/lib/test-selection-explain.mjs +75 -0
  19. package/bin/lib/test-selection-glob.d.mts +32 -0
  20. package/bin/lib/test-selection-glob.mjs +206 -0
  21. package/bin/lib/test-selection.d.mts +80 -0
  22. package/bin/lib/test-selection.mjs +418 -0
  23. package/package.json +4 -2
  24. package/schemas/test-map.schema.json +164 -0
  25. package/scripts/__pycache__/codeops_plan.cpython-314.pyc +0 -0
  26. package/scripts/__pycache__/install_agents.cpython-314.pyc +0 -0
  27. package/skills/analyze-project/SKILL.md +8 -1
  28. package/skills/exec-plan/SKILL.md +16 -8
  29. package/skills/exec-plan/execution-protocol.md +15 -2
  30. package/skills/git-commit/SKILL.md +1 -1
  31. package/skills/make-plan/SKILL.md +10 -3
  32. package/skills/make-plan/quality-checklist.md +4 -0
  33. package/skills/make-plan/templates.md +19 -1
  34. package/skills/organize-tests/SKILL.md +169 -0
  35. package/skills/organize-tests/references/agents-testing-block.md +80 -0
  36. package/skills/organize-tests/references/analysis-protocol.md +94 -0
  37. package/skills/organize-tests/references/ci-github-actions.md +178 -0
  38. package/skills/organize-tests/references/language-adapters.md +54 -0
  39. package/skills/organize-tests/references/map-health.md +47 -0
  40. package/skills/organize-tests/references/project-wrapper.md +72 -0
  41. package/skills/organize-tests/references/shadow-mode.md +60 -0
  42. package/standards/coding-standards-full.md +28 -0
  43. package/standards/coding-standards.md +29 -0
  44. package/scripts/__pycache__/codeops_plan.cpython-312.pyc +0 -0
  45. package/scripts/__pycache__/install_agents.cpython-312.pyc +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to CodeOps are recorded here.
4
4
 
5
+ ## 2.6.0 — 2026-11-12
6
+
7
+ ### Features
8
+
9
+ - test-selection: document, pilot, and verify the impact gates
10
+ - ci: add the reusable full gate and selection templates
11
+ - organize-tests: add the test-map adoption skill
12
+ - test-selection: add branch policy, CI plans, and provenance
13
+ - test-selection: add the codeops-test CLI and argv-safe runner
14
+ - test-selection: add change detection and the selector core
15
+ - test-map: add map loading, validation, and canonical hashing
16
+ - test-selection: add scoped task verification guidance
17
+
5
18
  ## 2.5.0 — 2026-10-29
6
19
 
7
20
  ### Features
package/README.md CHANGED
@@ -16,6 +16,7 @@ Turn an idea or existing system into ambiguity-free requirements, grounded speci
16
16
  | `exec-plan` | Execute a plan — implement → verify → commit loop with quality reviews |
17
17
  | `roadmap` | Live feature-set roadmap — make, update, review, archive |
18
18
  | `analyze-project` | Analyze repo and create/refresh CodeOps-aware `AGENTS.md` guidance |
19
+ | `organize-tests` | Build or refresh a test-impact map; additive map, AGENTS block, and CI patch |
19
20
  | `analyze-agents` | Run the project-level specialist check on demand — proposals or a recorded None, with check state |
20
21
  | `setup-codeops` | Set up or migrate CodeOps in a git repo |
21
22
  | `setup-routing` | Configure per-role subagent model and policy routing |
@@ -26,6 +27,44 @@ Turn an idea or existing system into ambiguity-free requirements, grounded speci
26
27
  | `git-commit` | Guarded commit — verify, stage deliberately, Conventional Commit message |
27
28
  | `outcome-review` | Review local opt-in outcome metrics (requires `metrics.enabled: true`) |
28
29
 
30
+ ## Test-impact selection (opt-in)
31
+
32
+ Large suites do not have to run in full for every small change. CodeOps can use
33
+ a committed test map to run the affected feature-slice groups during task, phase,
34
+ and pull-request work while the **full verify** stays the release, acceptance,
35
+ and CI gate.
36
+
37
+ The feature is opt-in:
38
+
39
+ - No `codeops/test-map.json` and no `codeops/test-map/` directory: behavior is
40
+ exactly today's full verify.
41
+ - With a map: `codeops-test select|run|check|plan|shadow|provenance` selects and
42
+ runs only the affected groups. The release and acceptance gates still run the
43
+ full suite.
44
+ - Set `CODEOPS_FULL_TESTS=1` to force the full suite at any gate.
45
+ - To roll back, **delete the map** (or remove the testing block). The project
46
+ returns to the full verify with no other change.
47
+
48
+ ```bash
49
+ # Inspect the selection for a change
50
+ node bin/codeops-test.mjs select --gate task --baseline <tree> --explain
51
+
52
+ # Run the selected groups
53
+ node bin/codeops-test.mjs run --gate task --baseline <tree>
54
+
55
+ # Validate the map and its test ownership
56
+ node bin/codeops-test.mjs check --strict
57
+
58
+ # CI plan for a pull request
59
+ node bin/codeops-test.mjs plan --gate pr --json
60
+ ```
61
+
62
+ Adoption is additive and reversible. The `organize-tests` skill inventories the
63
+ suite, proposes feature slices, previews the map/AGENTS/CI changes, proves the
64
+ selection in shadow mode with zero missed failures, and never edits tests or
65
+ weakens the full gate. This repository ships its own pilot map under
66
+ `codeops/test-map/`; the full verify remains the gate for releases.
67
+
29
68
  ## Installation
30
69
 
31
70
  One command installs everything CodeOps owns: the skills, the subagents, and the OpenCode plugin
@@ -72,8 +72,12 @@ Step N.1: [Feature Name]
72
72
  N.1.3 Implement feature
73
73
  N.1.4 Verify spec tests pass (green phase)
74
74
  N.1.5 Write implementation tests
75
- N.1.6 Full verification
75
+ N.1.6 Phase/plan gate verification
76
76
  ```
77
77
 
78
78
  The order `spec tests → red phase → implement → green phase → impl tests → verify` is NEVER
79
- negotiable, regardless of feature size.
79
+ negotiable, regardless of feature size. The red phase runs only the declared spec file(s). The
80
+ final verification is the phase/plan gate: the full project verify, or the map's release gate.
81
+ Per-task verification may use the selected task groups or a validated `**Task verify**` command;
82
+ the gate rules, fallback behavior, and evidence contract live in
83
+ [test-selection.md](test-selection.md).
@@ -0,0 +1,130 @@
1
+ # Test Selection and the Verification Gate Ladder
2
+
3
+ > **CodeOps Artifact Schema**: 1
4
+
5
+ This is the canonical verification protocol. The standards carry the six prime directives; every
6
+ skill links here instead of restating the rules. The selector is opt-in: a project with no
7
+ `codeops/test-map.json` and no `codeops/test-map/` behaves exactly as before.
8
+
9
+ ## Gate ladder
10
+
11
+ | Gate | What runs | When |
12
+ | --- | --- | --- |
13
+ | `task` | The map's selected `task`-tier groups plus always-run groups, or the plan's validated `**Task verify**` command | After each implemented task |
14
+ | `phase` | `task` + `phase` groups, or the plan's task command plus the changed phase surface | Plan phase exit |
15
+ | `pr` | `task` + `phase` groups, always-run groups, and `policy.prSmoke` groups | Pull request / merge queue |
16
+ | `release` | Every group, plus the full verify command | Release branch, hotfix, release tag, package |
17
+ | `acceptance` | Every group, plus acceptance groups and acceptance evidence | Acceptance branch or environment |
18
+ | `nightly` | Every group, but only when a relevant path changed since the last successful full run | Scheduled |
19
+ | `full` | The full verify command; no partial selection | CI fallback, explicit force, release gate |
20
+
21
+ The full gate is always authoritative. A green task or PR slice is never a release signal.
22
+
23
+ ## No-map contract
24
+
25
+ With no map:
26
+
27
+ - selection returns `mode: "full"`, `fullCommand: null`, and a visible `no-map` reason;
28
+ - `run` requires an explicit `--full-command` and refuses to invent one;
29
+ - CI uses the project's existing full job.
30
+
31
+ Deleting the map, or setting `CODEOPS_FULL_TESTS=1`, restores full behavior at every gate.
32
+
33
+ ## Map overview
34
+
35
+ A map is either one file, `codeops/test-map.json`, or a directory containing `policy.json`,
36
+ `shared.json`, and domain fragments. A group declares:
37
+
38
+ - `id`, `slice`, `tier` (`task`, `phase`, `release`, `acceptance`);
39
+ - `sources` and optional `tests` globs (target-based runners may omit `tests`);
40
+ - `run.command` as an argv array; `{tests}` expands to the group's full resolved test set;
41
+ - `dependsOn`, `alwaysRun`, `durationSec`, `parallelSafe`, `requires`;
42
+ - an optional per-slice `acceptance` record.
43
+
44
+ `policy.json` owns `full` (argv), budgets, branches, ignore/full-on paths, acceptance mode,
45
+ `prSmoke`, `requirements` probes, `caseSensitive`, and `fullThreshold`. The JSON Schema is
46
+ `schemas/test-map.schema.json`.
47
+
48
+ ## Baseline and change detection
49
+
50
+ Selection accepts, in priority order:
51
+
52
+ 1. `--baseline <tree|ref>` — exec-plan passes the phase baseline tree here;
53
+ 2. `CODEOPS_TEST_BASE`;
54
+ 3. `--last-full-sha <sha>` or `CODEOPS_LAST_FULL_SHA` — the last successful full-run marker;
55
+ 4. a branch-aware base;
56
+ 5. `HEAD` only for an explicit local uncommitted-only selection.
57
+
58
+ On an integration branch, a missing, unreadable, or non-ancestor last-full marker selects full.
59
+ The selector never guesses a base.
60
+
61
+ ## Selection rules
62
+
63
+ 1. Collect committed, staged, unstaged, and untracked changes; normalize paths; include both
64
+ sides of renames and deletions.
65
+ 2. Apply `fullOnPaths` first; an ignored path that is also full-on still selects full.
66
+ 3. Apply `ignorePaths`; if every changed path is ignored, return `mode: "none"`.
67
+ 4. Select groups whose `sources` or `tests` match a changed path.
68
+ 5. Add downstream dependents through `dependsOn`; never add upstream providers.
69
+ 6. Add `alwaysRun` groups and, at the `pr` gate, `policy.prSmoke` groups.
70
+ 7. Filter by gate tier and record deferred groups.
71
+ 8. At partial gates, an over-threshold selection falls back to full.
72
+ 9. Estimate the task budget (120 s target, 180 s acceptable); never drop a group.
73
+ 10. Any unknown path, invalid map, unresolved base, or selector error selects full with a visible
74
+ reason. `select` and `plan` return that result with exit 0; `check` reports the map defect.
75
+
76
+ Globs are case-sensitive on every platform unless policy explicitly opts out. Test paths are
77
+ expanded from the group's full test set, independent of the change set, so a source-only change
78
+ still runs the whole group.
79
+
80
+ ## Spec tests and `--include`
81
+
82
+ A feature's specification test file always runs. Exec-plan passes the plan's declared spec
83
+ file(s) with `--include`; the selector adds the owning group, and an unowned spec file selects
84
+ full with `unknown-path`. A failing spec test means the implementation is wrong, never the test.
85
+
86
+ ## Evidence
87
+
88
+ Every verification records:
89
+
90
+ - the gate and baseline (tree/ref);
91
+ - selected groups and their reasons (`direct-source`, `direct-test`, `dependent`, `always-run`,
92
+ `smoke`);
93
+ - deferred groups;
94
+ - the budget status;
95
+ - any fallback reason and the map hash.
96
+
97
+ CI evidence is authoritative. The content-free metrics surface, when enabled, emits only gate,
98
+ selected/total, budget status, fallback reason, and map hash.
99
+
100
+ ## Lightweight fallback: `**Task verify**`
101
+
102
+ A plan may record two commands:
103
+
104
+ ```markdown
105
+ **Task verify**: `npm run test -- --run web/billing/invoice-dialog`
106
+ **Verify (gate)**: `npm run verify`
107
+ ```
108
+
109
+ `make-plan` runs the task command once and records the observed test count. A command that runs
110
+ zero tests is invalid. `exec-plan` uses the task command per task and the gate command at phase
111
+ exit, plan completion, before push, and in CI. A plan with only one `**Verify**` line uses that
112
+ line as the gate command; a map may derive the task command, otherwise the gate command serves
113
+ both. This is the supported path for projects that never adopt a map.
114
+
115
+ A changed path outside the phase's expected modification set, or a shared/config/test-infrastructure
116
+ change, forces the full gate and a scope note.
117
+
118
+ ## AGENTS.md testing block
119
+
120
+ `organize-tests` is the sole writer of the `CODEOPS-TESTING` block inside the
121
+ `CODEOPS-PROJECT` managed block. `analyze-project` preserves that block byte-for-byte and warns
122
+ when it is missing or stale; it never renders it. With no map, the block reads
123
+ `Testing: full suite only (no test map)`.
124
+
125
+ ## References
126
+
127
+ - Selector CLI: `bin/codeops-test.mjs`
128
+ - Map schema: `schemas/test-map.schema.json`
129
+ - Adoption skill: `skills/organize-tests/SKILL.md`
130
+ - Specification-first ordering: `_shared/spec-first-ordering.md`