Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Release

on:
'on':
push:
branches:
- main
Expand All @@ -20,6 +20,7 @@ jobs:
terminal-progress--release_created: ${{ steps.release.outputs['packages/terminal-progress--release_created'] }}
homeassistant--release_created: ${{ steps.release.outputs['packages/homeassistant--release_created'] }}
forge-session-title--release_created: ${{ steps.release.outputs['packages/forge-session-title--release_created'] }}
forge-session--release_created: ${{ steps.release.outputs['packages/forge-session--release_created'] }}
atuin-history--release_created: ${{ steps.release.outputs['packages/atuin-history--release_created'] }}
tmux-indicator--release_created: ${{ steps.release.outputs['packages/tmux-indicator--release_created'] }}
steps:
Expand All @@ -42,6 +43,8 @@ jobs:
enabled: ${{ needs.release-please.outputs['homeassistant--release_created'] }}
- package: forge-session-title
enabled: ${{ needs.release-please.outputs['forge-session-title--release_created'] }}
- package: forge-session
enabled: ${{ needs.release-please.outputs['forge-session--release_created'] }}
- package: atuin-history
enabled: ${{ needs.release-please.outputs['atuin-history--release_created'] }}
- package: tmux-indicator
Expand Down
6 changes: 6 additions & 0 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"config": {
"MD013": { "line_length": 100, "tables": false, "code_blocks": false },
},
"ignores": ["**/node_modules/**", "**/CHANGELOG.md"],
}
22 changes: 22 additions & 0 deletions .mise/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import solidTransformPlugin from '@opentui/solid/bun-plugin';

const usage = 'Usage: bun .mise/bundle.ts <package-dir> <outdir> [--sourcemap]';
const [pkg, outdir, ...flags] = Bun.argv.slice(2);
if (!pkg || !outdir) throw new Error(usage);

for (const file of ['index.ts', 'tui.ts', 'tui.tsx']) {
const entry = `${pkg}/src/${file}`;
if (!(await Bun.file(entry).exists())) continue;
const result = await Bun.build({
entrypoints: [entry],
outdir,
target: 'bun',
sourcemap: flags.includes('--sourcemap') ? 'inline' : 'none',
external: ['@opencode/plugin', '@opencode/plugin/*', 'solid-js', 'solid-js/*', '@opentui/*'],
plugins: [solidTransformPlugin],
});
if (!result.success) {
for (const log of result.logs) process.stderr.write(`${log}\n`);
process.exit(1);
}
}
6 changes: 1 addition & 5 deletions .mise/tasks/build
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,5 @@ fi
for pkg in "${pkgs[@]}"; do
pkg=${pkg%/}
echo "Building $(basename "$pkg")..."
for entry in index tui; do
[ -f "$pkg/src/$entry.ts" ] || continue
bun build "$pkg/src/$entry.ts" --outdir "$pkg/dist" --target bun \
--external '@opencode/plugin' --external '@opencode/plugin/*'
done
bun .mise/bundle.ts "$pkg" "$pkg/dist"
done
7 changes: 2 additions & 5 deletions .mise/tasks/dev
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
#MISE description="Build with sourcemaps for development"
#USAGE arg "<package>" help="Package to build (e.g. terminal-progress)"
set -euo pipefail
# shellcheck disable=SC2154 # mise sets usage_* from the #USAGE lines
pkg="packages/${usage_package}"
if [ ! -d "$pkg" ]; then
echo "Package not found: $pkg" >&2
exit 1
fi
for entry in index tui; do
[ -f "$pkg/src/$entry.ts" ] || continue
bun build "$pkg/src/$entry.ts" --outdir "$pkg/dist" --target bun --sourcemap=inline \
--external '@opencode/plugin' --external '@opencode/plugin/*'
done
bun .mise/bundle.ts "$pkg" "$pkg/dist" --sourcemap
7 changes: 2 additions & 5 deletions .mise/tasks/install-local
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
#MISE description="Build a plugin into the local OpenCode plugins directory"
#USAGE arg "<package>" help="Package to install (e.g. terminal-progress)"
set -euo pipefail
# shellcheck disable=SC2154 # mise sets usage_* from the #USAGE lines
pkg="packages/${usage_package}"
if [ ! -d "$pkg" ]; then
echo "Package not found: $pkg" >&2
exit 1
fi
destination="${XDG_CONFIG_HOME:-$HOME/.config}/opencode/plugins/${usage_package}"
mkdir -p "$destination"
for entry in index tui; do
[ -f "$pkg/src/$entry.ts" ] || continue
bun build "$pkg/src/$entry.ts" --outfile "$destination/$entry.js" --target bun \
--external '@opencode/plugin' --external '@opencode/plugin/*'
done
bun .mise/bundle.ts "$pkg" "$destination"
1 change: 1 addition & 0 deletions .mise/tasks/publish
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#USAGE arg "<package>" help="Package to publish (e.g. terminal-progress)"
#USAGE arg "[tag]" help="npm dist-tag" default="latest"
set -euo pipefail
# shellcheck disable=SC2154 # mise sets usage_* from the #USAGE lines
pkg="packages/${usage_package}"
if [ ! -d "$pkg" ]; then
echo "Package not found: $pkg" >&2
Expand Down
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"packages/terminal-progress": "1.0.2",
"packages/homeassistant": "1.0.2",
"packages/forge-session-title": "1.3.0",
"packages/forge-session": "0.0.0",
"packages/atuin-history": "1.0.1",
"packages/tmux-indicator": "1.0.2"
}
18 changes: 13 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ There are no npm scripts. Do not add a `"scripts"` key to any `package.json`.
Plugins target the OpenCode 2 plugin API (`@opencode/plugin`). See
<https://opencode.ai/v2/docs/build/plugins>.

- Server plugins live in `src/index.ts`; CLI (TUI) plugins live in `src/tui.ts`. The build compiles
whichever exist, and packages export them as `.` and `./tui`.
- Server plugins live in `src/index.ts`; CLI (TUI) plugins live in `src/tui.ts`, or `src/tui.tsx`
when they render JSX. `.mise/bundle.ts` compiles whichever exist, and packages export them as `.`
and `./tui`.
- JSX goes through OpenTUI's Solid transform. The bundle keeps `solid-js` and `@opentui/*` external,
because OpenCode provides them at runtime. A package that renders JSX lists `@opentui/core`,
`@opentui/solid`, and `solid-js` as peer dependencies, and sets `"jsx": "preserve"` and
`"jsxImportSource": "@opentui/solid"` in its `tsconfig.json`.
- Import `@opencode/plugin` and `@opencode/plugin/tui` with `import type` only, and default-export
`{ id, setup } satisfies Plugin.Plugin` (or `Plugin.Definition` for TUI). `Plugin.define` is an
identity function, so no runtime dependency is needed. The build marks the package as external as
Expand All @@ -46,7 +51,8 @@ Plugins target the OpenCode 2 plugin API (`@opencode/plugin`). See
- Each package has its own `package.json` with name, version, description, and a peerDependency on
`@opencode/plugin`
- Each package extends `../../tsconfig.base.json` via its own `tsconfig.json`
- Internal shared code lives in `packages/_shared/` without a `package.json`; it is bundled into each plugin
- Internal shared code lives in `packages/_shared/` without a `package.json`; it is bundled into
each plugin

## Adding a new plugin

Expand All @@ -60,9 +66,11 @@ Verify by running `mise run test`, `mise run build`, and `mise run typecheck` su

## Releasing

Releases are fully automated via [release-please](https://github.com/googleapis/release-please) and GitHub Actions. **Do NOT manually bump versions.**
Releases are fully automated via [release-please](https://github.com/googleapis/release-please)
and GitHub Actions. **Do NOT manually bump versions.**

1. Push commits to `main` using [Conventional Commits](https://www.conventionalcommits.org/) (e.g. `fix:`, `feat:`, `chore:`).
1. Push commits to `main` using [Conventional Commits](https://www.conventionalcommits.org/)
(e.g. `fix:`, `feat:`, `chore:`).
2. Release-please creates separate release PRs per package.
3. Merge the release PR — this creates a GitHub Release and triggers npm publish.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The plugins target OpenCode 2. The last OpenCode 1 versions live on the
| [terminal-progress](packages/terminal-progress/) | Shows agent progress in terminal tabs (Ghostty, iTerm2, WezTerm, Windows Terminal) | [![npm](https://img.shields.io/npm/v/opencode-terminal-progress)](https://www.npmjs.com/package/opencode-terminal-progress) |
| [homeassistant](packages/homeassistant/) | Sends agent status to Home Assistant via webhooks | [![npm](https://img.shields.io/npm/v/opencode-homeassistant)](https://www.npmjs.com/package/opencode-homeassistant) |
| [forge-session-title](packages/forge-session-title/) | Prefixes session titles with forge issue/PR/MR references | [![npm](https://img.shields.io/npm/v/opencode-forge-session-title)](https://www.npmjs.com/package/opencode-forge-session-title) |
| [forge-session](packages/forge-session/) | Tracks each session's issues and PRs/MRs: title prefixes, a PR/MR status footer, and review notifications | [![npm](https://img.shields.io/npm/v/opencode-forge-session)](https://www.npmjs.com/package/opencode-forge-session) |
| [atuin-history](packages/atuin-history/) | Records agent shell commands in Atuin shell history | [![npm](https://img.shields.io/npm/v/opencode-atuin-history)](https://www.npmjs.com/package/opencode-atuin-history) |
| [tmux-indicator](packages/tmux-indicator/) | Sets a tmux window option when the agent is waiting for input | [![npm](https://img.shields.io/npm/v/opencode-tmux-indicator)](https://www.npmjs.com/package/opencode-tmux-indicator) |

Expand Down
Loading
Loading