Skip to content

πŸ—οΈ chore: adopt bun workspaces at plugin root (closes #42)#43

Closed
ZaxShen wants to merge 2 commits into
devfrom
chore/42-bun-workspaces
Closed

πŸ—οΈ chore: adopt bun workspaces at plugin root (closes #42)#43
ZaxShen wants to merge 2 commits into
devfrom
chore/42-bun-workspaces

Conversation

@ZaxShen
Copy link
Copy Markdown
Contributor

@ZaxShen ZaxShen commented Apr 24, 2026

Summary

  • Add root package.json declaring mcp/trajectory-server and monitors as a bun workspace β€” a single bun install at plugin root now installs both subpackages and produces one consolidated bun.lock.
  • Simplify docs/local-testing.md and .github/workflows/test.yml to use the root-level commands (bun install, bun run build, bash tests/run-all.sh).
  • Add docs/trustmybot/ to .gitignore so dogfood-from-inside-repo runs (which write architecture snapshots + task artifacts under that path) never pollute commits.

Why

User hit Bun could not find a package.json file to install from when following docs/local-testing.md at the plugin root. Industry standard for multi-package repos with bun is workspaces β€” one install, one lockfile, contributors don't juggle subdirectories. The .gitignore line covers the other concern from the same report: local testing inside this repo must not generate files that end up tracked by git.

Test plan

  • bun install --frozen-lockfile at plugin root resolves both subpackages (260 packages, single bun.lock).
  • bun run build at plugin root compiles the MCP server successfully.
  • bash tests/run-all.sh: 235 MCP + 16 hook + 4 agent-budget lint, all green.
  • CI workflow updated to match (single install at root, no per-package working-directory).
  • Confirmed docs/trustmybot/ ignored β€” no pollution if dogfood writes there.

Closes #42

ZaxShen and others added 2 commits April 23, 2026 23:42
closes #42)

Two coupled fixes surfaced during a dogfood attempt that ran bun install
at the plugin repo root and failed β€” there was no root package.json.

Workspaces
- New plugin/package.json declares `workspaces: ["mcp/trajectory-server",
  "monitors"]`. One `bun install` at plugin root installs every
  subpackage; dedups `better-sqlite3` that both subpackages share.
- Root `scripts.build` runs `bun --filter='*' run build` β€” every
  workspace with a build script rebuilds. Root `scripts.test` runs
  `bash tests/run-all.sh`.
- Subpackage `bun.lock` files deleted (mcp/trajectory-server + monitors);
  replaced by a single root `bun.lock` (26 KB).

Gitignore dogfood-generated paths
- Add `docs/trustmybot/` to .gitignore. The plugin's own contributor
  docs live at `docs/architecture/`, not `docs/trustmybot/`. If a
  contributor dogfoods inside this repo (instead of a scratch project),
  architect/SWE would create `docs/trustmybot/snapshots/`,
  `docs/trustmybot/architecture/auto/`, etc. as if this were a user
  project β€” those artifacts should never land in commits.
- The plugin-root .gitignore's existing `.claude/` rule already covers
  the runtime DB + worktrees path.

Docs updated
- docs/local-testing.md Prereqs section: one-command `bun install` +
  `bun run build` at the plugin repo root. Two other places that said
  `cd plugin/mcp/trajectory-server && bun run build` trimmed the same
  way.

CI simplified
- .github/workflows/test.yml: three install/build/test steps that each
  set `working-directory: mcp/trajectory-server` collapsed into a
  single root-level `bun install --frozen-lockfile`, `bun run build`,
  and `bash tests/run-all.sh` (picks up MCP + hook + lint suites).

Verified
- `bun install` at plugin root installs 260 packages, produces one
  consolidated lockfile.
- `bun run build` at plugin root compiles MCP server successfully
  (monitors has no build; `bun --filter` skips it cleanly).
- `bash tests/run-all.sh`: 235 MCP + 16 hook + 4 agent-budget lint, all
  green.

Closes #42

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Users were copy-pasting `/absolute/path/to/trustmybot-plugin` literally and
launching Claude Code with a bogus `--plugin-dir`, so no plugin loaded and
`@gatekeeper` had nothing to bind to.

Replace the placeholder with `$(pwd)` captured from the plugin repo root,
with a sanity-check echo and a fallback note for users who run from elsewhere.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ZaxShen
Copy link
Copy Markdown
Contributor Author

ZaxShen commented Apr 24, 2026

Folding into #41 β€” both changes are dogfood-enablement (test plan + the infra that makes the plan runnable). One combined PR is easier to review than two interleaved ones.

@ZaxShen ZaxShen closed this Apr 24, 2026
@ZaxShen ZaxShen deleted the chore/42-bun-workspaces branch April 25, 2026 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant