diff --git a/README.md b/README.md index c64ff224..befda40f 100644 --- a/README.md +++ b/README.md @@ -278,3 +278,18 @@ at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + +## Development + +To make the global `plannotator` command run from this checkout: + +```bash +bun install +bun link +``` + +After linking, commands like `plannotator review` use `apps/hook/server/index.ts` from your local repo. Rebuild the bundled HTML when changing UI code: + +```bash +bun run --cwd apps/review build && bun run build:hook +``` diff --git a/bin/plannotator.js b/bin/plannotator.js new file mode 100755 index 00000000..29e42ccc --- /dev/null +++ b/bin/plannotator.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node +const childProcess = require("node:child_process"); +const fs = require("node:fs"); +const path = require("node:path"); + +const repoRoot = path.resolve(path.dirname(__filename), ".."); +const sourceEntry = path.join(repoRoot, "apps", "hook", "server", "index.ts"); + +if (!fs.existsSync(sourceEntry)) { + console.error(`Could not find Plannotator source entry at ${sourceEntry}`); + process.exit(1); +} + +const result = childProcess.spawnSync("bun", [sourceEntry, ...process.argv.slice(2)], { + cwd: process.cwd(), + stdio: "inherit", +}); + +if (result.error) { + console.error(result.error.message); + process.exit(1); +} + +process.exit(typeof result.status === "number" ? result.status : 0); diff --git a/package.json b/package.json index e27c061f..b32cbc92 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "description": "Interactive Plan Review for Claude Code - annotate plans visually, share with team, automatically send feedback", "author": "backnotprop", "license": "MIT OR Apache-2.0", + "bin": { + "plannotator": "bin/plannotator.js" + }, "repository": { "type": "git", "url": "git+https://github.com/backnotprop/plannotator.git"