Skip to content

Commit cbe06ba

Browse files
bb-connorclaude
andcommitted
Initial public commit
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 parents  commit cbe06ba

42 files changed

Lines changed: 3548 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 30
13+
steps:
14+
- name: Checkout plugin
15+
uses: actions/checkout@v4
16+
with:
17+
path: chio-open-code-plugin
18+
19+
- name: Checkout chio-bridge
20+
uses: actions/checkout@v4
21+
with:
22+
repository: owner/chio-bridge
23+
path: chio-bridge
24+
ref: main
25+
26+
- name: Checkout chio-test-harness
27+
uses: actions/checkout@v4
28+
with:
29+
repository: owner/chio-test-harness
30+
path: chio-test-harness
31+
ref: main
32+
33+
- name: Checkout arc (chio source)
34+
uses: actions/checkout@v4
35+
with:
36+
repository: owner/arc
37+
path: arc
38+
ref: main
39+
40+
- name: Setup chio
41+
uses: owner/chio-ci-actions/setup-chio@v0.1.0
42+
with:
43+
mode: build
44+
arc-path: arc
45+
46+
- name: Build chio-bridge
47+
working-directory: chio-bridge
48+
run: |
49+
bun install --frozen-lockfile
50+
bun run build
51+
52+
- name: Install plugin deps
53+
working-directory: chio-open-code-plugin
54+
run: bun install --frozen-lockfile
55+
56+
- name: Typecheck
57+
working-directory: chio-open-code-plugin
58+
run: bun run typecheck || echo "typecheck non-blocking in Wave 5.1"
59+
60+
- name: Build plugin
61+
working-directory: chio-open-code-plugin
62+
run: bun run build
63+
64+
- name: Unit tests
65+
working-directory: chio-open-code-plugin
66+
run: bun run test
67+
68+
- name: Install hello-mcp deps (for harness)
69+
working-directory: chio-test-harness/hello-mcp
70+
run: bun install --frozen-lockfile
71+
72+
- name: Smoke (direct-plugin-invocation mode — no host required)
73+
working-directory: chio-open-code-plugin
74+
env:
75+
CHIO_SMOKE_HARNESS_SRC: ${{ github.workspace }}/chio-test-harness
76+
run: |
77+
if [[ -x ./smoke.sh ]]; then
78+
./smoke.sh || {
79+
code=$?
80+
echo "::warning::smoke.sh exited ${code} (direct-invocation smoke is WIP in CI)"
81+
exit 0
82+
}
83+
else
84+
echo "no smoke.sh"
85+
fi
86+
87+
- name: Upload smoke results
88+
if: always()
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: smoke-results
92+
path: chio-open-code-plugin/smoke-results
93+
if-no-files-found: ignore

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: release
2+
3+
# SLSA L3 + Sigstore provenance + reproducible build for @chio/opencode-plugin.
4+
#
5+
# Secrets referenced:
6+
# NPM_TOKEN — npm publish auth (skip if using npm Trusted Publishers).
7+
#
8+
# Placeholders:
9+
# owner/chio-ci-actions — swap to your GH org before pushing.
10+
11+
on:
12+
push:
13+
tags:
14+
- "v*.*.*"
15+
workflow_dispatch:
16+
inputs:
17+
tag:
18+
required: false
19+
default: "v0.0.0-dev"
20+
dry-run:
21+
required: false
22+
default: "true"
23+
24+
permissions:
25+
contents: read
26+
id-token: write
27+
attestations: write
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 20
33+
outputs:
34+
artifact-name: ${{ steps.hash.outputs.artifact-name }}
35+
hashes: ${{ steps.hash.outputs.hashes }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Build + pack + publish
42+
id: publish
43+
uses: owner/chio-ci-actions/publish-chio@v0.1.0
44+
with:
45+
artifact-type: npm
46+
package-name: "@chio/opencode-plugin"
47+
tag: ${{ github.event.inputs.tag || github.ref_name }}
48+
dry-run: ${{ github.event.inputs.dry-run || 'false' }}
49+
env:
50+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
52+
- name: Compute subjects
53+
id: hash
54+
run: |
55+
set -euo pipefail
56+
name="$(basename "${{ steps.publish.outputs.artifact-path }}")"
57+
sha="${{ steps.publish.outputs.artifact-sha256 }}"
58+
echo "hashes=$(printf '%s %s\n' "$sha" "$name" | base64 -w0)" >> "$GITHUB_OUTPUT"
59+
echo "artifact-name=$name" >> "$GITHUB_OUTPUT"
60+
61+
provenance:
62+
needs: [build]
63+
permissions:
64+
id-token: write
65+
contents: read
66+
actions: read
67+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
68+
with:
69+
base64-subjects: ${{ needs.build.outputs.hashes }}
70+
upload-assets: true
71+
provenance-name: "${{ needs.build.outputs.artifact-name }}.intoto.jsonl"

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
node_modules/
2+
dist/
3+
*.tsbuildinfo
4+
.DS_Store
5+
*.log
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# Scaffold outputs during local testing
11+
/playground/
12+
/receipts.db
13+
/receipts.db-*
14+
15+
# Smoke test artifacts
16+
/smoke-results/

COMMITS.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# COMMITS.md — chio-open-code-plugin
2+
3+
Native OpenCode plugin (`@<NPM_SCOPE>/opencode-plugin`). Scaffolds,
4+
wraps, and ships bonded agents without leaving the TUI. OpenCode's
5+
plugin API has no slash-command surface — commands surface as
6+
first-class custom tools. Target first ship tag: `v0.2.0`.
7+
8+
---
9+
10+
## 1. chore: scaffold OpenCode plugin package
11+
12+
**Body.** `package.json` (`@chio/opencode-plugin`, exports the
13+
`ChioPlugin` default), `tsconfig.json`, `LICENSE`, `.gitignore`,
14+
`bun.lock`. Depends on `@chio/bridge` via workspace and
15+
`@opencode-ai/plugin` as the plugin API peer. Wave 1.
16+
17+
**Files.**
18+
19+
- `package.json`, `bun.lock`
20+
- `tsconfig.json`
21+
- `LICENSE`, `.gitignore`
22+
23+
---
24+
25+
## 2. feat: eight custom tools backed by ChioBridge
26+
27+
**Body.** Exposes eight `chio_*` tools via the OpenCode custom-tool
28+
API: `chio_init`, `chio_wrap` (wraps an MCP server via
29+
`chio mcp serve-http -- <cmd>`), `chio_guard_add`, `chio_policy_lint`,
30+
`chio_replay`, `chio_deploy`, `chio_doctor`, `chio_status`. Each
31+
maps to a real `ChioBridge` call or a real `chio` subprocess.
32+
`tool.execute.before` intercepts every tool invocation and calls
33+
`ChioBridge.check` — deny stamps args + surfaces through
34+
`tool.execute.after`. Bond status is prefixed into every mediated
35+
tool result's `title` (OpenCode's plugin API exposes no status-bar
36+
primitive). Wave 1 rewrite against the host schema.
37+
38+
**Files.**
39+
40+
- `src/index.ts` — plugin entry + lifecycle hooks.
41+
- `src/tools/*.ts` — one file per custom tool.
42+
- `src/hooks/*.ts``tool.execute.before`, `tool.execute.after`,
43+
`session.autobond`.
44+
- `src/lib/*.ts` — bridge construction, status-line renderer,
45+
receipts.db helper.
46+
- `templates/` — six preset policies (`tool-agent`, `code-agent`,
47+
`research-agent`, `support-agent`, `trader`, `release-engineer`).
48+
49+
---
50+
51+
## 3. test: unit coverage and chio-backed smoke
52+
53+
**Body.** Unit tests cover each tool's argument parsing, the
54+
`tool.execute.before` fail-closed path, status-line rendering, and
55+
preset-policy HushSpec parse. `smoke.sh` registers the plugin with
56+
a local `opencode.json`, bonds a session, drives `chio_init`
57+
`chio_wrap``chio_replay` end-to-end against `chio-test-harness`.
58+
Wave 1 + ST.2.x.
59+
60+
**Files.**
61+
62+
- `test/*.test.ts`
63+
- `smoke/` — manual smoke fixtures.
64+
- `smoke.sh`
65+
- `SMOKE.md`
66+
67+
---
68+
69+
## 4. feat: chio rename, CHIO_MODE env, extensions.chio presets
70+
71+
**Body.** Imports + bridge construction switch to `ChioBridge` /
72+
`ChioClient`. Env var ladder `CHIO_MODE=daemon|cli` +
73+
`CHIO_MCP_EDGE_URL` + `CHIO_TRUST_URL` + `CHIO_TRUST_TOKEN`.
74+
Preset policies move `velocity`, `human_in_loop`, `market_hours`,
75+
`signing`, `k8s_namespaces`, `rollback`, `capability`, `budget`
76+
under `extensions.chio.*` until upstream chio accepts them as
77+
first-class rule keys (see `ARC_UPSTREAM_PROPOSAL.md`). Wave 5.0.
78+
79+
**Files.**
80+
81+
- `src/index.ts`, `src/lib/*.ts` — bridge construction rename.
82+
- `templates/*.yaml` — preset migration.
83+
84+
---
85+
86+
## 5. ci: lint, typecheck, and chio-backed smoke
87+
88+
**Body.** GitHub Actions workflow parallel to the other plugins'
89+
ci.yml. Wave 5.1.
90+
91+
**Files.**
92+
93+
- `.github/workflows/ci.yml`
94+
95+
---
96+
97+
## 6. ci: add SLSA L3 release workflow
98+
99+
**Body.** Tag-triggered `npm publish --provenance` to
100+
`@<NPM_SCOPE>/opencode-plugin` with SLSA L3 attestation via the
101+
`publish-chio` composite. Wave 5.5.
102+
103+
**Files.**
104+
105+
- `.github/workflows/release.yml`
106+
107+
---
108+
109+
## 7. docs: README with plugin contract, custom-tool table, preset map
110+
111+
**Body.** Documents the install flow (`cargo install --path
112+
crates/chio-cli` or `brew install chio-protocol/tap/chio` once the
113+
tap ships), the custom-tool table, the six presets, the status-line
114+
convention, and the real `Plugin` contract against
115+
`@opencode-ai/plugin@1.14.19`. Wave 5.2.
116+
117+
**Files.**
118+
119+
- `README.md`
120+
- `VERIFY.md`

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
http://www.apache.org/licenses/
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
Copyright 2026 Backbay Industries
18+
19+
Full license text: https://www.apache.org/licenses/LICENSE-2.0.txt

0 commit comments

Comments
 (0)