Add global Codex Bee Army and cross-harness update manager - #4
Conversation
|
Warning Review limit reached
Next review available in: 59 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a global ChangesGlobal Bee Army installer
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant BeeArmy as bee-army CLI
participant Upstream as Upstream checkout
participant Filesystem
participant Manifest as manifest.json
Operator->>BeeArmy: Run install or update --apply
BeeArmy->>Upstream: Fetch and select pinned commit
BeeArmy->>BeeArmy: Generate and validate harness stages
BeeArmy->>Filesystem: Backup and atomically apply managed files
BeeArmy->>Manifest: Persist hashes and backup metadata
Operator->>BeeArmy: Run rollback --apply
BeeArmy->>Filesystem: Restore backup and remove installation
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (1)
scripts/bee-army.mjs (1)
213-226: 🚀 Performance & Scalability | 🔵 TrivialNo backup rotation/pruning.
Every
update --applycreates a new timestamped directory underBACKUPS_ROOTand nothing ever removes old ones. Over many updates this grows unbounded. Consider retaining only the last N backups.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/bee-army.mjs` around lines 213 - 226, The backup creation flow around BACKUPS_ROOT and backupRoot currently retains every backup indefinitely. Add pruning after writing the new backup record to retain only the configured last N timestamped backup directories, sorting them by creation or backup ID order and removing older directories while preserving the newly created backup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 130-137: Clarify the README Rules row and accompanying note to
state that bee-army currently installs rules only for Cursor via .cursor/rules,
and does not generate CLAUDE.md or global Codex instructions. Keep the existing
harness-specific rule locations as reference, but remove wording that implies
Claude/Codex rule translation is performed.
In `@scripts/bee-army.mjs`:
- Around line 269-284: Wrap the `check()` and `preview()` command flows in the
same `withLock` mechanism used by `update`, `validate`, and `rollback`, ensuring
their `fetchUpstream()` calls execute while the shared `SOURCE_ROOT` checkout is
locked. Update the command dispatch so both operations acquire that lock without
changing their existing output or comparison behavior.
- Around line 309-314: Update withLock to provide stale-lock recovery when
LOCK_PATH already exists, using lock metadata such as the owning process
identity and/or age to distinguish an active operation from an abandoned lock;
remove only locks confirmed stale, then retry acquisition while preserving the
existing failure for active locks. Keep cleanup in the finally block for
normally completed operations.
- Around line 211-250: Update applyStage and the recovery path around
restoreBackup so a backup created before file mutations remains discoverable if
the process terminates before MANIFEST_PATH is rewritten. Persist or resolve the
pending backup using the backup directory metadata/name, and make rollback
--apply and update recovery prefer the newest valid backup over the stale
manifest backupId. Preserve existing restoration behavior for completed
manifests and caught errors.
- Around line 27-29: Update run() to provide a finite timeout to execFileSync,
ensuring git operations used by ensureSource, fetchUpstream, and checkoutCommit
cannot hang indefinitely. Preserve any caller-supplied timeout through options
while retaining the existing command execution and output behavior.
- Around line 65-75: Update parseFrontmatter to preserve indented continuation
lines for multiline frontmatter values, especially description, by folding them
into the preceding field before validation and returning fields. Ensure
generated Codex TOML receives the complete value while retaining existing
single-line parsing and required-field checks.
In `@test/bee-army.test.mjs`:
- Line 20: Update the BEE_ARMY_UPSTREAM_BRANCH configuration in the test setup
to avoid assuming the upstream branch is always "main": derive the repository’s
default branch dynamically, or explicitly document and enforce the required
branch when dynamic detection is unavailable.
- Around line 25-48: Update the test around the install invocation to execute
installation from the temporary project directory by using runIn(home, project,
"install", "--apply") instead of run(home, "install", "--apply"). Keep the
existing home-based validation, doctor checks, and project scaffolding
assertions unchanged.
- Around line 12-23: Update the run helper’s child-process environment so
CODEX_HOME, CLAUDE_HOME, CURSOR_HOME, and AGENTS_HOME cannot override
BEE_ARMY_HOME-derived paths; remove these inherited keys or set them to empty
strings while preserving the existing BEE_ARMY_HOME, upstream URL, and branch
values.
---
Nitpick comments:
In `@scripts/bee-army.mjs`:
- Around line 213-226: The backup creation flow around BACKUPS_ROOT and
backupRoot currently retains every backup indefinitely. Add pruning after
writing the new backup record to retain only the configured last N timestamped
backup directories, sorting them by creation or backup ID order and removing
older directories while preserving the newly created backup.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6502a804-f245-43fe-94ed-64121316f85c
📒 Files selected for processing (5)
AGENTS.mdREADME.mdpackage.jsonscripts/bee-army.mjstest/bee-army.test.mjs
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Addressed in e174399:
Fresh verification: |
What changed
bee-armyCLI for global installation and updates.cursorBees into native Codex TOML agentsGlobal-only contract
This implementation never creates
.codex/,.agents/, orAGENTS.mdinside a user project. Codex assets install under the user global homes (~/.codexand~/.agents/skills), with equivalent global destinations for Claude and Cursor.Why
The previous project-adapter approach did not work reliably in real Codex usage. Native global Codex agents plus their paired Stingers reproduce the Bee routing model without requiring per-project scaffolding. The cross-harness manager also prevents Claude, Cursor, and Codex from drifting onto different asset revisions.
Safety and update behavior
Verification
npm testnode --check scripts/bee-army.mjsgit diff --checknpm pack --dry-runSupersedes #3 with a fresh global-only implementation.
Summary by CodeRabbit
New Features
bee-armyCLI for installing and updating AI tooling across Cursor, Claude Code, and Codex.Documentation