Skip to content

Commit 8794a88

Browse files
feat(honcho): bundle plugin with bun build, ship dist/ instead of node_modules
Plugins distributed via marketplace can't run npm/pnpm install on the user's machine, so deps must either be vendored as node_modules (4063 files) or bundled. This commit switches to bundling. - plugins/honcho/build.ts: Bun.build over 9 entrypoints (mcp-server, 6 hooks, 2 skill runners) -> ESM bundles in dist/ - hooks/hooks.json, mcp-servers.json, setup/status SKILL.md: paths updated to dist/<...>.js - CI: install bun, run pnpm --filter claude-honcho build after typecheck - Release: build via prepareCmd; dist/**/*.js added to git assets so each release commit ships fresh bundles
1 parent bb364f4 commit 8794a88

18 files changed

Lines changed: 166748 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ jobs:
1616
with:
1717
node-version: 20
1818
cache: pnpm
19+
- uses: oven-sh/setup-bun@v2
20+
with:
21+
bun-version: latest
1922
- run: pnpm install --frozen-lockfile
2023
- run: pnpm -r --if-present typecheck
24+
- run: pnpm --filter claude-honcho build
2125

2226
validate-json:
2327
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
node-version: 20
2424
cache: pnpm
2525
- run: pnpm install --frozen-lockfile
26+
- uses: oven-sh/setup-bun@v2
27+
with:
28+
bun-version: latest
2629
- name: Run semantic-release
2730
env:
2831
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.releaserc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[
99
"@semantic-release/exec",
1010
{
11-
"prepareCmd": "node scripts/bump-versions.mjs ${nextRelease.version}"
11+
"prepareCmd": "node scripts/bump-versions.mjs ${nextRelease.version} && pnpm --filter claude-honcho build"
1212
}
1313
],
1414
[
@@ -21,6 +21,7 @@
2121
".claude-plugin/marketplace.json",
2222
"plugins/honcho/.claude-plugin/plugin.json",
2323
"plugins/honcho/package.json",
24+
"plugins/honcho/dist/**/*.js",
2425
"plugins/honcho-dev/.claude-plugin/plugin.json"
2526
],
2627
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"

plugins/honcho/build.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bun
2+
import { rm, chmod } from "node:fs/promises";
3+
import { join } from "node:path";
4+
5+
const root = import.meta.dir;
6+
const distDir = join(root, "dist");
7+
8+
await rm(distDir, { recursive: true, force: true });
9+
10+
const entrypoints = [
11+
"mcp-server.ts",
12+
"hooks/session-start.ts",
13+
"hooks/session-end.ts",
14+
"hooks/post-tool-use.ts",
15+
"hooks/user-prompt.ts",
16+
"hooks/pre-compact.ts",
17+
"hooks/stop.ts",
18+
"src/skills/setup-runner.ts",
19+
"src/skills/status-runner.ts",
20+
];
21+
22+
const result = await Bun.build({
23+
entrypoints: entrypoints.map((p) => join(root, p)),
24+
outdir: distDir,
25+
root,
26+
target: "bun",
27+
format: "esm",
28+
splitting: false,
29+
sourcemap: "none",
30+
minify: false,
31+
});
32+
33+
if (!result.success) {
34+
for (const log of result.logs) console.error(log);
35+
process.exit(1);
36+
}
37+
38+
for (const out of result.outputs) {
39+
if (out.path.endsWith(".js")) await chmod(out.path, 0o755);
40+
}
41+
42+
console.log(`bundled ${result.outputs.length} files to ${distDir}`);

0 commit comments

Comments
 (0)