opencode-ship 0.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/CHANGELOG.md +57 -0
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/assets/agents/delivery-reviewer.md +80 -0
- package/assets/agents/delivery-verifier.md +61 -0
- package/assets/skills/delivery-workflow/SKILL.md +62 -0
- package/assets/skills/planning-research-checkpoint/SKILL.md +37 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2484 -0
- package/dist/core.d.ts +1 -0
- package/dist/core.js +1851 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.js +15060 -0
- package/docs/adr/0001-opencode-ship-redesign.md +168 -0
- package/package.json +62 -0
- package/schema/project-adapter.example.json +50 -0
- package/schema/project-adapter.schema.json +132 -0
- package/schema/project-opencode-shim.json +42 -0
- package/schema/ship-config.schema.json +136 -0
- package/schema/ship-lock.schema.json +112 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `opencode-ship` are recorded here.
|
|
4
|
+
|
|
5
|
+
## 0.2.0 — npm-distributed installer release
|
|
6
|
+
|
|
7
|
+
`opencode-ship@0.2.0` replaces the v0.1.x copy-the-shim workflow. The package is now an npm-distributed CLI plus a self-contained OpenCode plugin. Run `pnpm dlx opencode-ship@latest init` from any consumer repo to materialise everything needed for the delivery workflow.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **Package name and public API.** The package is now `opencode-ship` (was `opencode-delivery`). The package root exports the bundled OpenCode plugin; the previous library surface is still reachable through `opencode-ship/core`.
|
|
12
|
+
- **`pnpm dlx opencode-ship@latest <command>`.** Five idempotent subcommands: `init`, `diff`, `update`, `doctor`, `uninstall`. Manual copying is no longer required.
|
|
13
|
+
- **Self-contained plugin.** `dist/plugin.js` is a single ESM bundle that inlines `@opencode-ai/plugin`. The nine `delivery_*` tools are registered against the bundled tool helper, no consumer-side wrapper is needed.
|
|
14
|
+
- **User-owned config + managed lock.** `.opencode/ship.config.json` is user-owned and preserved across updates; `.opencode/ship.lock.json` records installed version, schema version, managed paths, SHA-256 hashes, and an integrity digest.
|
|
15
|
+
- **Hash-based reconciliation.** Every managed file's previous lock hash, current disk hash, and desired hash determine the action. Modified managed files are refused with a precise conflict report, never silently overwritten.
|
|
16
|
+
- **Recoverable multi-file transactions.** Staged writes, sibling temporary files, journaled backups, and atomic rename per file. Pre-commit failures roll back in reverse order. The lock is promoted last as the commit marker.
|
|
17
|
+
- **Build permissions only.** `init` merges only Build-agent delivery permissions into the root `opencode.json` (or `.jsonc`); everything else is preserved untouched.
|
|
18
|
+
- **`init` auto-runs `doctor`.** After a successful commit, `init` runs the doctor checks and embeds the result in the JSON envelope (`doctor`, `doctorChecks`). Pass `--strict-doctor` to fail init when the doctor reports unhealthy checks.
|
|
19
|
+
- **Post-merge cleanup is immediate.** Successful merge triggers `delivery_cleanup` automatically. Failures persist `cleanupPending` in the lock; the next delivery task or plugin startup retries the queue.
|
|
20
|
+
- **Verifier permission isolation.** The verifier's frontmatter now explicitly allows only `delivery_verify` and denies every other `delivery_*` tool, mirroring the reviewer.
|
|
21
|
+
- **Models.** Agents inherit the consumer's default model; no hardcoded provider/model pin.
|
|
22
|
+
- **Schema files published.** `project-adapter.schema.json`, `ship-config.schema.json`, and `ship-lock.schema.json` are accessible through `opencode-ship/schema/*` exports.
|
|
23
|
+
- **Reviewer change-of-SHA guard.** Reviewer must capture the PR head SHA before recording; mismatch returns `head-mismatch` and `missing-head-sha`.
|
|
24
|
+
- **`gh pr view` no longer requests the unsupported `merged` field.** `merged` is now derived from `state === "MERGED"` (falling back to a non-null `mergedAt`), so the merge path is portable across `gh` 2.x versions where the field may be missing.
|
|
25
|
+
- **Verification pipeline.** `npm run verify` runs `format:check`, `lint`, `typecheck`, `build`, and the auto-discovered test suite against all `tests/**/*.test.mjs`.
|
|
26
|
+
- **Packed-artifact smoke test.** `tests/package/packed-artifact.test.mjs` runs `npm pack`, inspects the file list, extracts the tarball, copies the bundled plugin into an isolated consumer with no `node_modules`, and asserts that the plugin loads with exactly nine tool definitions.
|
|
27
|
+
- **Fail-closed `prepack`.** `scripts/prepack.mjs` requires `esbuild` and `tsc`, builds the project, and verifies every required build artifact before publishing.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **Install manifests and commands.** `init`, `diff`, `update`, `doctor`, `uninstall` CLI commands; exit codes 0–5.
|
|
32
|
+
- **JSON-pointer ownership** for the Build-agent permission block; the installer's edits are reversible from the lock.
|
|
33
|
+
- **`--force-root-config`** flag that synthesises a minimal `opencode.json` with installer-owned permissions when the consumer has none.
|
|
34
|
+
- **`--strict-doctor`** flag that turns doctor issues into a hard init failure.
|
|
35
|
+
- **`ship.config.json`** with a nested shape (`project`, `delivery`) and a flat legacy-adapter compatibility layer in `src/installer/ship-adapter.js`.
|
|
36
|
+
- **Migration** from legacy v0.1.x consumers (`.opencode/delivery.json`, `.opencode/delivery.lock.json`, generic `delivery.ts` shim). Migration does not delete legacy artifacts and refuses destructive changes when customised.
|
|
37
|
+
- **Agent and skill discovery** tests (`tests/agents/delivery-reviewer-contract.test.mjs`, `tests/agents/delivery-verifier-contract.test.mjs`, `tests/agents/reviewer-permission-boundary.test.mjs`, `tests/agents/skill-discovery.test.mjs`).
|
|
38
|
+
- **Installer plugin-load smoke test** (`tests/plugin/plugin-load.test.mjs`) that imports the bundled artifact and asserts exactly nine tool definitions.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- **`gh pr view merged blocker.** The GitHub driver no longer requests the unsupported `merged` field on `gh pr view --json`. `merged` is derived from `state` / `mergedAt` instead.
|
|
43
|
+
- **Cleanup-after-merged-PR race.** Cleanup preconditions are validated atomically; the agent-owned worktree and local branch are removed only after the manifest is sealed.
|
|
44
|
+
- **Deterministic cleanup recovery.** A `merged` manifest that has no PR is recovered when the worktree is clean and the recorded head SHA matches the local head.
|
|
45
|
+
- **Stale lockfile / missing adapter schema.** The lockfile is regenerated during `npm install`; the previously missing `schema/project-adapter.schema.json` is published.
|
|
46
|
+
- **Locked JSON parse drift.** Config files generated with extra fields the schema rejected (`inferredFrom`) no longer fail validation; detection now produces schema-compliant output.
|
|
47
|
+
- **Hash-corruption in root-config writes.** The order-preserving JSONC walker now merges new keys with the original source order, so existing pointers are not lost on rewrite.
|
|
48
|
+
|
|
49
|
+
### Compatibility
|
|
50
|
+
|
|
51
|
+
- Requires Node `>=22.6.0` (matches `engines` and doctor).
|
|
52
|
+
- Requires `@opencode-ai/plugin >= 1.15.5 < 2` as a peer dependency (it is provided by OpenCode at runtime).
|
|
53
|
+
- The plugin auto-discovers from `.opencode/plugin/opencode-ship.js`; consumers do NOT add a `plugin` entry to `opencode.json` for the bundled plugin (avoid double registration).
|
|
54
|
+
|
|
55
|
+
### Removed
|
|
56
|
+
|
|
57
|
+
- The previous source-pinned package layout that required copying `delivery.json`, the project plugin shim, the agents, and the skills by hand.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vktr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# opencode-ship
|
|
2
|
+
|
|
3
|
+
> npm-distributed OpenCode installer and delivery plugin: a single command materialises the lifecycle plugin, reviewer/verifier agents, and skills into any consumer repository, with a recoverable lock and never silently overwrites managed files.
|
|
4
|
+
>
|
|
5
|
+
> **Status:** v0.2.0. The installer is now a `pnpm dlx opencode-ship@latest <cmd>` workflow. Five idempotent CLI commands manage a managed-file lock, a transactional promoter, and a compiled ESM plugin that registers the canonical nine `delivery_*` tools. Post-merge cleanup is immediate and recoverable. All 150 tests and the packed-artifact smoke check pass under `npm run verify`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What this package is
|
|
10
|
+
|
|
11
|
+
`opencode-ship` is the npm-distributed successor to `opencode-delivery`. It bundles:
|
|
12
|
+
|
|
13
|
+
- a **nine-tool OpenCode plugin** that auto-loads from `.opencode/plugin/opencode-ship.js`;
|
|
14
|
+
- a **lifecycle state machine** for one issue → one worktree → one PR → one merge → one cleanup;
|
|
15
|
+
- a **Git worktree driver** (no rebase-after-push, no force-push, no `--force-with-lease`);
|
|
16
|
+
- a **GitHub CLI driver** that talks only to typed `gh pr/issue` verbs (never `gh api`);
|
|
17
|
+
- a **project adapter** (`.opencode/ship.config.json`) so any project can declare its own verify/bootstrap/CI commands;
|
|
18
|
+
- **reviewer** and **verifier** subagents, both with strictly bounded `delivery_*` permissions;
|
|
19
|
+
- a **delivery-workflow** skill that drives the canonical lifecycle;
|
|
20
|
+
- a **planning-research-checkpoint** skill that offers a single, optional Deep Research gate per non-trivial plan;
|
|
21
|
+
- a **delivery doctor** that validates the adapter, package pin, and OpenCode compatibility;
|
|
22
|
+
- an **install/doctor/diff/update/uninstall** CLI with stable exit codes and `--json` envelopes;
|
|
23
|
+
- a **.opencode/ship.lock.json** lock that records managed paths, hashes, and the installer-owned JSON pointers;
|
|
24
|
+
- **recovery** for interrupted cleanup, half-written state files, and stale worktrees.
|
|
25
|
+
|
|
26
|
+
The package **does not** own:
|
|
27
|
+
|
|
28
|
+
- package managers, test commands, linters, docs layout, or CI templates;
|
|
29
|
+
- issue-label catalogues, release scripts, or deploy hooks;
|
|
30
|
+
- framework- or language-specific expertise.
|
|
31
|
+
|
|
32
|
+
## Distribution
|
|
33
|
+
|
|
34
|
+
Once `opencode-ship` is published, consumers install with `pnpm dlx` (or `npx`) and never edit the file by hand:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
pnpm dlx opencode-ship@latest init # install managed files
|
|
38
|
+
pnpm dlx opencode-ship@latest update # apply a packaged upgrade
|
|
39
|
+
pnpm dlx opencode-ship@latest diff # preview what would change
|
|
40
|
+
pnpm dlx opencode-ship@latest doctor # environment and lock audit
|
|
41
|
+
pnpm dlx opencode-ship@latest uninstall # remove only the files still matching the lock
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If you want to try a pre-release tarball locally without publishing to npm:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pnpm dlx --package=/absolute/path/opencode-ship-0.2.0.tgz opencode-ship init
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The plugin auto-discovers from `.opencode/plugin/opencode-ship.js`; the consumer does not add a plugin entry to `opencode.json`. The installer merges only Build-agent permissions into the root `opencode.json` (or `.jsonc`); all other root-config fields remain owned by the user. Use `--force-root-config` on `init` to create a minimal `opencode.json` if the consumer has none.
|
|
51
|
+
|
|
52
|
+
### Managed file layout
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
.opencode/plugin/opencode-ship.js
|
|
56
|
+
.opencode/agents/delivery-reviewer.md
|
|
57
|
+
.opencode/agents/delivery-verifier.md
|
|
58
|
+
.opencode/skills/delivery-workflow/SKILL.md
|
|
59
|
+
.opencode/skills/planning-research-checkpoint/SKILL.md
|
|
60
|
+
.opencode/ship.config.json # user-owned; written by `init` only if absent
|
|
61
|
+
.opencode/ship.lock.json # installer-managed; drives update + uninstall
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Schema files
|
|
65
|
+
|
|
66
|
+
These JSON Schemas are published and discoverable through the `exports` map:
|
|
67
|
+
|
|
68
|
+
- `opencode-ship/schema/project-adapter.schema.json`
|
|
69
|
+
- `opencode-ship/schema/ship-config.schema.json`
|
|
70
|
+
- `opencode-ship/schema/ship-lock.schema.json`
|
|
71
|
+
|
|
72
|
+
### Legacy migration
|
|
73
|
+
|
|
74
|
+
Existing consumers of `opencode-delivery@0.1.x` (commit-pinned shim) can run `pnpm dlx opencode-ship@latest init` from the same checkout. Migration recognises `.opencode/delivery.json`, `.opencode/delivery.lock.json`, the two canonical agents, and the generic plugin `.opencode/plugin/delivery.ts`, and adopts them when their bytes match. Legacy artifacts are preserved on disk so a downgrade remains possible; the installer does NOT modify Leo or any other consumer.
|
|
75
|
+
|
|
76
|
+
## Lifecycle
|
|
77
|
+
|
|
78
|
+
1. Begin a Build task: the delivery plugin immediately runs any queued post-merge cleanups. Failed cleanups are recorded in `ship.lock.json#cleanupPending` and retried at the next delivery task or plugin startup.
|
|
79
|
+
2. Optional Deep Research checkpoint for non-trivial plans.
|
|
80
|
+
3. Find or create exactly one issue per PR.
|
|
81
|
+
4. Discover the default branch and fetch it.
|
|
82
|
+
5. Create a dedicated worktree and branch.
|
|
83
|
+
6. Run the project adapter's bootstrap command.
|
|
84
|
+
7. Implement and commit.
|
|
85
|
+
8. Push and open a draft PR linked to the issue (`Closes #N`).
|
|
86
|
+
9. Continue commits/pushes on the same branch.
|
|
87
|
+
10. Merge latest default branch into the feature branch before final review.
|
|
88
|
+
11. Run independent reviewer on the final HEAD.
|
|
89
|
+
12. Run canonical local verification.
|
|
90
|
+
13. Push and wait for required remote CI checks.
|
|
91
|
+
14. Mark the PR Ready and stop.
|
|
92
|
+
15. Explicit "merge it" re-runs the freshness checks and performs the squash merge.
|
|
93
|
+
16. The plugin immediately invokes `delivery_cleanup`; failures leave `cleanupPending` for the next session.
|
|
94
|
+
|
|
95
|
+
## Exit codes
|
|
96
|
+
|
|
97
|
+
| Code | Meaning |
|
|
98
|
+
|---:|---|
|
|
99
|
+
| `0` | success / no-op |
|
|
100
|
+
| `1` | expected negative result (`diff` saw changes; `doctor` unhealthy) |
|
|
101
|
+
| `2` | invalid input, unsupported project, ambiguous detection |
|
|
102
|
+
| `3` | ownership / hash / structural conflict |
|
|
103
|
+
| `4` | filesystem, staging, rollback, or transaction failure |
|
|
104
|
+
| `5` | unsupported lock/config schema |
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
`npm run verify` runs `format:check`, `lint`, `typecheck`, `build`, and the auto-discovered test suite. 150 tests cover lifecycle, drivers, recovery, doctor, agents, the installer CLI, plugin registration, the isolated packed-artifact smoke check, and the order-preserving root-config merge.
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
npm ci
|
|
112
|
+
npm run build
|
|
113
|
+
npm run verify
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The shipped artifact is built by esbuild (`scripts/build.mjs`); self-contained `dist/*.d.ts` are emitted by `tsc` from the in-package `src/plugin.ts`, `src/cli.ts`, and `src/core.ts` entry points. The `prepack` script fails closed if `esbuild` or `tsc` is missing or any required build artifact is absent.
|
|
117
|
+
|
|
118
|
+
## Status and licensing
|
|
119
|
+
|
|
120
|
+
- **License:** MIT. See `LICENSE`.
|
|
121
|
+
- **Versioning:** SemVer. v0.2.0 is the first npm-distributed release. Subsequent releases follow standard `<major>.<minor>.<patch>` rules.
|
|
122
|
+
- **Compatibility:** the bundled plugin targets `@opencode-ai/plugin >= 1.15.5 < 2` and OpenCode `>= 1.15.5`.
|
|
123
|
+
|
|
124
|
+
## FAQ
|
|
125
|
+
|
|
126
|
+
**Is the package on npm?**
|
|
127
|
+
|
|
128
|
+
Not yet. The repository is a draft PR. Once the release workflow lands, the first published tag will produce a GitHub Release tarball and (optionally) an npm release. Until then, install from a local tarball with `pnpm dlx --package=…`.
|
|
129
|
+
|
|
130
|
+
**Where is the `@opencode-ai/plugin` dependency?**
|
|
131
|
+
|
|
132
|
+
The plugin is bundled (`scripts/build.mjs` does not externalize it). Consumers do not need to install `@opencode-ai/plugin` themselves; the runtime is self-contained. The package still declares a peer dependency so consumers who also use the opencode runtime are not given duplicate copies.
|
|
133
|
+
|
|
134
|
+
**What does `init` actually write?**
|
|
135
|
+
|
|
136
|
+
It writes (or refreshes) the seven managed files in `.opencode/`, the user-owned `ship.config.json`, and the integrity-hashed `ship.lock.json`. It also merges eleven JSON-pointer values into the root `opencode.json` (or `.jsonc`) without overwriting unrelated keys. By default it does not create `opencode.json` — pass `--force-root-config` to do so.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Read-only delivery reviewer. Returns the canonical six-section envelope. Use before marking a delivery PR Ready.
|
|
3
|
+
mode: subagent
|
|
4
|
+
temperature: 0.2
|
|
5
|
+
steps: 8
|
|
6
|
+
permission:
|
|
7
|
+
edit: deny
|
|
8
|
+
external_directory: deny
|
|
9
|
+
webfetch: deny
|
|
10
|
+
websearch: deny
|
|
11
|
+
bash:
|
|
12
|
+
"*": deny
|
|
13
|
+
"git diff *": allow
|
|
14
|
+
"git log *": allow
|
|
15
|
+
"git show *": allow
|
|
16
|
+
"git status *": allow
|
|
17
|
+
"git rev-parse *": allow
|
|
18
|
+
"ls *": allow
|
|
19
|
+
"cat *": allow
|
|
20
|
+
"head *": allow
|
|
21
|
+
"tail *": allow
|
|
22
|
+
delivery_review: allow
|
|
23
|
+
delivery_inspect: deny
|
|
24
|
+
delivery_issue: deny
|
|
25
|
+
delivery_worktree: deny
|
|
26
|
+
delivery_verify: deny
|
|
27
|
+
delivery_pr: deny
|
|
28
|
+
delivery_ready: deny
|
|
29
|
+
delivery_merge: deny
|
|
30
|
+
delivery_cleanup: deny
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
You are the delivery reviewer. You receive a diff scope and return the canonical six-section envelope. You never edit.
|
|
34
|
+
|
|
35
|
+
## Reviewer recording contract
|
|
36
|
+
|
|
37
|
+
When `Status: pass`, you MUST also invoke the `delivery_review` typed tool so the lifecycle records your verdict against the PR head SHA. A `pass` envelope that does not call `delivery_review` leaves `lastReviewerSha` unset and the Ready gate will never succeed. Conversely, a `delivery_review` call without a real review is a contract violation — never record a SHA you did not actually review.
|
|
38
|
+
|
|
39
|
+
The head SHA must match the PR's current head exactly. The tool refuses any other SHA; a missing `headSha` argument is treated as a refused call (returns `missing-head-sha`) and a mismatching SHA returns `head-mismatch`.
|
|
40
|
+
|
|
41
|
+
- Capture the PR head SHA from the worktree (`git rev-parse origin/<branch>` or the value reported by the parent agent) BEFORE you call `delivery_review`.
|
|
42
|
+
- Call `delivery_review({ taskId, status: "pass", headSha: <exactSha> })` ONLY when your envelope status is `pass`. `delivery_review` is the only mutation you are allowed to perform.
|
|
43
|
+
- For any verdict other than `pass` (fail / blocked / partial), DO NOT call `delivery_review`. The tool would refuse to record and the parent would see `review-not-pass`. Surface the reason in the `## Risks` section of your envelope instead.
|
|
44
|
+
- If the head SHA you observe drifts from the value you intended to review (a new commit landed mid-review), DO NOT silently record the new SHA. Refuse with `Status: blocked` and surface the drift under `## Risks` in the envelope you return. The parent agent will re-dispatch you against the new SHA.
|
|
45
|
+
- You must not invoke any other `delivery_*` tool. The permission block above denies them all; if you find yourself wanting to call one, surface that as a `Risks` finding instead.
|
|
46
|
+
|
|
47
|
+
Return Markdown or raw JSON. Every required section must appear. No prose before or after.
|
|
48
|
+
|
|
49
|
+
Envelope:
|
|
50
|
+
|
|
51
|
+
## Status
|
|
52
|
+
|
|
53
|
+
pass | fail | blocked | partial
|
|
54
|
+
|
|
55
|
+
## Summary
|
|
56
|
+
|
|
57
|
+
- <= 3 short bullets
|
|
58
|
+
|
|
59
|
+
## Findings
|
|
60
|
+
|
|
61
|
+
- path/to/file:line — issue — fix
|
|
62
|
+
|
|
63
|
+
## Evidence
|
|
64
|
+
|
|
65
|
+
files read, commands run, key observations
|
|
66
|
+
|
|
67
|
+
## Verification
|
|
68
|
+
|
|
69
|
+
how the diff was read and cross-checked
|
|
70
|
+
|
|
71
|
+
## Risks
|
|
72
|
+
|
|
73
|
+
- unresolved concern
|
|
74
|
+
|
|
75
|
+
Rules:
|
|
76
|
+
- Empty diff or unclear scope -> Status: blocked, explain in Risks.
|
|
77
|
+
- Findings must include file:line + concrete issue + suggested fix.
|
|
78
|
+
- Stay strictly read-only. Never write or edit.
|
|
79
|
+
- Reject any finding that requires running the consumer's verification command; that gate belongs to the verifier subagent, not you.
|
|
80
|
+
- You are a single-shot subagent per dispatch. After you return the envelope, the parent agent owns the next move.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Read-only delivery verifier. Calls the project adapter's canonical verification command through the typed `delivery_verify` tool. Returns the canonical six-section envelope.
|
|
3
|
+
mode: subagent
|
|
4
|
+
temperature: 0.1
|
|
5
|
+
steps: 8
|
|
6
|
+
permission:
|
|
7
|
+
edit: deny
|
|
8
|
+
bash: deny
|
|
9
|
+
external_directory: deny
|
|
10
|
+
webfetch: deny
|
|
11
|
+
websearch: deny
|
|
12
|
+
delivery_verify: allow
|
|
13
|
+
delivery_inspect: deny
|
|
14
|
+
delivery_issue: deny
|
|
15
|
+
delivery_worktree: deny
|
|
16
|
+
delivery_review: deny
|
|
17
|
+
delivery_pr: deny
|
|
18
|
+
delivery_ready: deny
|
|
19
|
+
delivery_merge: deny
|
|
20
|
+
delivery_cleanup: deny
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
You are the delivery verifier. You invoke only the `delivery_verify` tool. You never edit, never invoke shell, never run the project command directly.
|
|
24
|
+
|
|
25
|
+
The verifier record includes `status`, `commandId`, `stdoutTail`, `stderrTail`, and `headSha`. `status=0` means every gate of the project adapter's verification command passed.
|
|
26
|
+
|
|
27
|
+
Return Markdown or raw JSON. Every required section must appear. No prose before or after.
|
|
28
|
+
|
|
29
|
+
Envelope:
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
|
|
33
|
+
pass | fail | blocked | partial
|
|
34
|
+
|
|
35
|
+
## Summary
|
|
36
|
+
|
|
37
|
+
- <= 3 short bullets
|
|
38
|
+
|
|
39
|
+
## Checks
|
|
40
|
+
|
|
41
|
+
| Command | Exit | Result |
|
|
42
|
+
| ---------- | ---: | ------ |
|
|
43
|
+
| delivery_verify | <int> | <short> |
|
|
44
|
+
|
|
45
|
+
## Evidence
|
|
46
|
+
|
|
47
|
+
tool payload verbatim (status, commandId, stdoutTail tail, stderrTail tail, headSha)
|
|
48
|
+
|
|
49
|
+
## Verification
|
|
50
|
+
|
|
51
|
+
which commandId was used, what the adapter declared, what the recorded HEAD SHA is
|
|
52
|
+
|
|
53
|
+
## Risks
|
|
54
|
+
|
|
55
|
+
- unresolved concern
|
|
56
|
+
|
|
57
|
+
Rules:
|
|
58
|
+
- Call only the `delivery_verify` tool.
|
|
59
|
+
- Never run the project verification command through bash.
|
|
60
|
+
- Never edit code or config.
|
|
61
|
+
- If the manifest is missing or no verification command is declared, Status: blocked with Risks explaining.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: delivery-workflow
|
|
3
|
+
description: Orchestrates the canonical delivery lifecycle from issue creation through Ready PR. Use when the user asks for "implement issue N", "work on ready issues", "delivery", "autonomous delivery", or after a plan-mode session confirms the work scope.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# delivery-workflow
|
|
7
|
+
|
|
8
|
+
You drive the opencode-ship package from a one-line user request to a green, conflict-free, ready-to-merge pull request.
|
|
9
|
+
|
|
10
|
+
## When you trigger
|
|
11
|
+
|
|
12
|
+
- "Implement issue N", "work on issue N", "deliver issue N"
|
|
13
|
+
- "Pick the next ready issue and implement it"
|
|
14
|
+
- "Open a PR for #N"
|
|
15
|
+
- "Mark PR #N ready"
|
|
16
|
+
- "Merge PR #N" — only valid if you already created the PR through this workflow
|
|
17
|
+
- "Clean up my worktree" / "Tidy old worktrees" — entry point for next-task cleanup
|
|
18
|
+
|
|
19
|
+
Do **not** trigger on:
|
|
20
|
+
- Read-only questions ("explain issue N")
|
|
21
|
+
- Plain chat about the project's domain model
|
|
22
|
+
- Typo / doc one-liners that do not deserve a PR
|
|
23
|
+
|
|
24
|
+
## Lifecycle contract
|
|
25
|
+
|
|
26
|
+
| Step | Tool | Notes |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| 1. Cleanup old worktrees | `delivery_inspect` for each manifest, recovery scan, `delivery_cleanup` for provably-merged ones | Runs immediately after a successful merge; retries on next Build task if interrupted |
|
|
29
|
+
| 2. Offer research checkpoint | (this skill) | Single-shot per session; offer only if the plan is non-trivial |
|
|
30
|
+
| 3. Find or create the issue | `delivery_issue` | Always idempotent; never create a duplicate |
|
|
31
|
+
| 4. Create a worktree | `delivery_worktree` | Refuse overwrites; refuse dirty tree |
|
|
32
|
+
| 5. Implement | (consumer-owned) | Stay inside the worktree |
|
|
33
|
+
| 6. Commit + push | (consumer-owned `git`) | Use Conventional Commits |
|
|
34
|
+
| 7. Open draft PR | `delivery_pr` | `Closes #N` is added automatically |
|
|
35
|
+
| 8. Sync with default branch | (consumer-owned `git`) | Merge `origin/main` into the feature branch; never rebase a published branch |
|
|
36
|
+
| 9. Review | `task reviewer:delivery-reviewer` | Re-run if HEAD changed |
|
|
37
|
+
| 10. Verify | `task verifier:delivery-verifier` | Same final HEAD required |
|
|
38
|
+
| 11. Mark Ready | `delivery_ready` | Refreshes checks; refuses if any gate is stale |
|
|
39
|
+
| 12. Stop at Ready | (this skill) | Do not merge without an explicit user request |
|
|
40
|
+
| 13. Merge (only on explicit request) | `delivery_merge` | Re-checks base, head, and mergeability |
|
|
41
|
+
| 14. Immediate cleanup | `delivery_cleanup` | Runs automatically right after a successful merge |
|
|
42
|
+
|
|
43
|
+
## Hard rules
|
|
44
|
+
|
|
45
|
+
1. Every PR carries a `Closes #N` reference. If the issue does not exist, create it first.
|
|
46
|
+
2. The lifecycle stops at Ready by default. An explicit "merge it" is the only thing that triggers `delivery_merge`.
|
|
47
|
+
3. Force-push, hard-reset, stash, and `git worktree remove` are denied to you. Use `delivery_worktree` and `delivery_cleanup` instead.
|
|
48
|
+
4. You never edit `main` directly. You never bypass the reviewer/verifier gates.
|
|
49
|
+
5. The typed `delivery_*` tools are the only sanctioned way to mutate GitHub state. Do not invoke `gh pr merge`, `gh api`, or raw Git plumbing directly.
|
|
50
|
+
6. When a gate fails, fix the cause and re-run only the failed gate; never skip.
|
|
51
|
+
7. If `delivery_merge` returns a `MergeError`, surface it verbatim. Do not invent a workaround.
|
|
52
|
+
|
|
53
|
+
## Single-shot research checkpoint
|
|
54
|
+
|
|
55
|
+
If you decide the task is non-trivial, pause once and offer a Deep Research prompt to the user. If they approve, gather the research, summarize the relevant findings inline (do not write to `docs/research/` unless the findings materially shape an ADR; ADR storage is the project's call, not yours). Continue only after the user confirms or declines.
|
|
56
|
+
|
|
57
|
+
## Stop conditions
|
|
58
|
+
|
|
59
|
+
- Ready reached: stop. Surface the PR URL, the worktree path, the recorded verifier SHA, and the explicit-merge instruction.
|
|
60
|
+
- `merge it` requested and gates are fresh: perform the squash merge. Surface the merge SHA. The plugin will queue immediate cleanup; if cleanup fails it is recorded as `cleanupPending` and retried on the next Build task.
|
|
61
|
+
- Any gate fails after one re-run: stop. Surface the failing tool, the failing input, and the recorded evidence.
|
|
62
|
+
- Unexpected lifecycle error (missing-manifest, head-changed, ci-failing): stop. Surface the error envelope.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: planning-research-checkpoint
|
|
3
|
+
description: Offers a single, optional Deep Research gate before non-trivial plans proceed to implementation. Use when the parent agent has finished the plan-mode brief and the work touches architecture, lifecycle design, or an unfamiliar domain.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# planning-research-checkpoint
|
|
7
|
+
|
|
8
|
+
You trigger exactly once per non-trivial planning session. Trivial sessions (typo fixes, docstring changes, single-file edits, follow-up PRs on already-decided work) skip this gate silently.
|
|
9
|
+
|
|
10
|
+
## When you trigger
|
|
11
|
+
|
|
12
|
+
- The plan touches architecture, lifecycle, API surface, or test strategy
|
|
13
|
+
- The plan consumes external standards (OpenCode, GitHub, Git, package manager, CI)
|
|
14
|
+
- The plan mentions an unfamiliar package, language, or framework
|
|
15
|
+
- The user explicitly asks for a research pass
|
|
16
|
+
|
|
17
|
+
Do **not** trigger on:
|
|
18
|
+
- Single-file edits and doc fixes
|
|
19
|
+
- Implementations of a previously-accepted plan
|
|
20
|
+
- PRs that only rename or reformat
|
|
21
|
+
|
|
22
|
+
## Procedure
|
|
23
|
+
|
|
24
|
+
1. Read the current session's plan from the parent context. Do **not** ask the user to re-state it.
|
|
25
|
+
2. Output a single Markdown block titled "Research checkpoint" containing:
|
|
26
|
+
- The plan summary in <= 3 bullets
|
|
27
|
+
- A **one-line** decision the research is meant to inform
|
|
28
|
+
- A draft Deep Research prompt in a copyable ```text fenced block
|
|
29
|
+
3. Ask the user one question: "Run the research, or proceed without?"
|
|
30
|
+
4. If they run the research, wait for the result and continue. Persist a concise dated summary into the consumer project's `docs/research/` only if the research materially shapes an ADR or other architectural decision; otherwise treat the result as session-local.
|
|
31
|
+
5. If they decline, proceed with the plan as written. Do not mention the offer again this session.
|
|
32
|
+
|
|
33
|
+
## Constraints
|
|
34
|
+
|
|
35
|
+
- Never ask the user to formulate the prompt themselves. The draft is yours to write.
|
|
36
|
+
- Never loop. One offer, one outcome, continue.
|
|
37
|
+
- Never persist the full research output. The summary you write must be yours, dated, and bounded.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|