Skip to content

Fix factory CLI top-level commands#17

Merged
khaliqgant merged 1 commit into
mainfrom
fix/direct-factory-cli
Jun 22, 2026
Merged

Fix factory CLI top-level commands#17
khaliqgant merged 1 commit into
mainfrom
fix/direct-factory-cli

Conversation

@miyaontherelay

Copy link
Copy Markdown
Contributor

Summary

  • expose factory actions directly from the factory binary (run-once, start, status, etc.)
  • move shared fleet operations under the fleet namespace while preserving the local bin/fleet.mjs UX
  • update README and scheduled canary script to use the direct command form

Closes #15.

Validation

  • npm run build
  • npm test
  • node bin/factory.mjs run-once --dry-run --config test/fixtures/factory.config.json
  • node bin/factory.mjs factory run-once --dry-run --config test/fixtures/factory.config.json exits 1 with Unknown factory command: factory

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@miyaontherelay, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 55 minutes and 21 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 29901a8e-f4f1-4885-8864-0232e36c9850

📥 Commits

Reviewing files that changed from the base of the PR and between 2e33354 and 965b116.

📒 Files selected for processing (5)
  • README.md
  • bin/fleet.mjs
  • scripts/factory-canary.sh
  • src/cli/fleet.test.ts
  • src/cli/fleet.ts
📝 Walkthrough

Walkthrough

Factory actions (run-once, start, status, loop, etc.) are promoted to top-level CLI verbs, eliminating the redundant factory factory … double-prefix. parseFleetCommand now uses a new isFactoryAction predicate to route directly, bin/fleet.mjs prepends 'fleet' for fleet-specific routing, the canary script drops the prefix, and tests and README are updated throughout.

Changes

Flatten factory command namespace

Layer / File(s) Summary
Core routing: isFactoryAction and parseFleetCommand
src/cli/fleet.ts
Adds isFactoryAction(value) enumerating all factory verbs. Refactors parseFleetCommand to route via that predicate, updates error-message prefixes in parseFleetSubcommand, parseFactoryCommand, and parseFactoryStartFlags, and rewrites usage() to list the new top-level verbs.
Entrypoint and script wiring
bin/fleet.mjs, scripts/factory-canary.sh
bin/fleet.mjs prepends 'fleet' to args passed to mod.main. factory-canary.sh drops the factory prefix, invoking canary directly as a top-level verb.
Test and README updates
src/cli/fleet.test.ts, README.md
All runFleetCli/parseFleetCommand calls drop the factory prefix. New status command test added. Parsing test asserts old nested factory form now throws. README Install and Quick start sections updated to factory run-once / factory start --mode live.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • AgentWorkforce/factory#11: Previously added factory canary tooling and its shell script invocation, which is directly updated in this PR when factory-canary.sh drops the nested factory prefix.

Poem

🐇 No more factory factory, what a silly double hop,
The rabbit said "just factory run-once—one word, then stop!"
The verbs now live up top, where every shell command shines,
No nested tunnels left to dig through duplicated lines.
✨ One hop is all you need, the burrow's now direct!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix factory CLI top-level commands' clearly and specifically describes the main change in the PR: restructuring the CLI to expose factory actions as direct top-level commands instead of nested under a namespace.
Description check ✅ Passed The PR description is well-related to the changeset, detailing the exposure of factory actions as direct commands, the reorganization under fleet namespace, and updates to documentation and scripts.
Linked Issues check ✅ Passed All acceptance criteria from issue #15 are met: direct command forms work (run-once, start, status), nested factory factory pattern is rejected with error, README examples are updated to use direct form, and fleet commands are namespaced.
Out of Scope Changes check ✅ Passed All changes directly support the PR objective to fix the CLI structure and eliminate the double factory pattern; updates to bin/fleet.mjs, scripts, tests, and documentation are all aligned with issue #15 requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/direct-factory-cli

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request flattens the CLI command structure by removing the nested factory subcommand namespace. Factory actions (such as run-once, start, and status) are promoted to top-level commands under the factory CLI, while fleet-related commands are nested under a new fleet subcommand (e.g., factory fleet spawn). The documentation, tests, and helper scripts have been updated accordingly. There are no review comments, so I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@miyaontherelay miyaontherelay force-pushed the fix/direct-factory-cli branch from 2e33354 to 965b116 Compare June 22, 2026 10:45

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/cli/fleet.ts (1)

646-659: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Centralize factory action names to prevent routing/help drift.

isFactoryAction() and usage() both hardcode the action list; future additions can easily update one but miss the other, making valid actions unreachable or undocumented.

♻️ Proposed refactor
+const FACTORY_ACTIONS = [
+  'start',
+  'run-once',
+  'loop',
+  'status',
+  'loop-status',
+  'kill-loop',
+  'reap-orphans',
+  'canary',
+  'triage',
+  'dispatch',
+  'close-probe',
+] as const
+
 function isFactoryAction(value: string): boolean {
-  return value === 'start' ||
-    value === 'run-once' ||
-    value === 'loop' ||
-    value === 'status' ||
-    value === 'loop-status' ||
-    value === 'kill-loop' ||
-    value === 'reap-orphans' ||
-    value === 'canary' ||
-    value === 'triage' ||
-    value === 'dispatch' ||
-    value === 'close-probe'
+  return (FACTORY_ACTIONS as readonly string[]).includes(value)
 }
 
 function usage(): string {
-  return 'usage: factory <run-once|start|status|loop|loop-status|kill-loop|reap-orphans|canary|triage|dispatch|close-probe|fleet> [options]'
+  return `usage: factory <${[...FACTORY_ACTIONS, 'fleet'].join('|')}> [options]`
 }

Also applies to: 715-715

🤖 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 `@src/cli/fleet.ts` around lines 646 - 659, The isFactoryAction() function and
usage() function both hardcode the same list of factory actions, creating
maintenance drift where adding a new action to one place can easily be forgotten
in the other. Create a centralized constant array containing all valid factory
action names at the module level, then refactor isFactoryAction() to check if
the input value is included in this constant, and update the usage() function to
reference the same constant when displaying available actions. This ensures any
future action additions only need to be made in one place.
🤖 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.

Nitpick comments:
In `@src/cli/fleet.ts`:
- Around line 646-659: The isFactoryAction() function and usage() function both
hardcode the same list of factory actions, creating maintenance drift where
adding a new action to one place can easily be forgotten in the other. Create a
centralized constant array containing all valid factory action names at the
module level, then refactor isFactoryAction() to check if the input value is
included in this constant, and update the usage() function to reference the same
constant when displaying available actions. This ensures any future action
additions only need to be made in one place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1bbcb122-6000-4d3e-b2b2-fdbfa0b5285e

📥 Commits

Reviewing files that changed from the base of the PR and between 88e3776 and 2e33354.

📒 Files selected for processing (5)
  • README.md
  • bin/fleet.mjs
  • scripts/factory-canary.sh
  • src/cli/fleet.test.ts
  • src/cli/fleet.ts

@khaliqgant khaliqgant merged commit 462cc5e into main Jun 22, 2026
2 checks passed
@khaliqgant khaliqgant deleted the fix/direct-factory-cli branch June 22, 2026 10: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.

Avoid double factory factory command invocation

2 participants