Skip to content

fix(init): accept all setup-profile presets in CLI flags#6

Open
Atman36 wants to merge 1 commit intobasilisk-labs:mainfrom
Atman36:codex/init-setup-profile-presets
Open

fix(init): accept all setup-profile presets in CLI flags#6
Atman36 wants to merge 1 commit intobasilisk-labs:mainfrom
Atman36:codex/init-setup-profile-presets

Conversation

@Atman36
Copy link

@Atman36 Atman36 commented Feb 14, 2026

Summary

Aligns init --setup-profile CLI validation with the actual preset set used by init flow.

Problem

The init flow supports prod, prod-strict, dev, and dev-safe, but CLI flag validation for --setup-profile allowed only prod|dev.

Changes

  • expand --setup-profile option choices/value hint to include:
    • prod
    • prod-strict
    • dev
    • dev-safe
  • update typing in init command handling
  • add test coverage for strict variants
  • refresh setup docs section with all presets

Validation

  • npx vitest run packages/agentplane/src/cli/run-cli.core.init-upgrade-backend.test.ts
  • repository hooks (pre-commit, pre-push) passed

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduces two new setup profile options: prod-strict and dev-safe, enabling more granular control over initialization configurations alongside existing options.
  • Documentation

    • Updates setup guidance to document all available setup profile options and their respective behaviors.
  • Tests

    • Adds test coverage for new setup profile variants.

@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

A new setup profiles system is introduced, expanding from two fixed profiles ("prod" and "dev") to four configurable presets through a registry-based approach. Changes include documentation updates, new test cases, and core CLI command modifications to support and map these profiles.

Changes

Cohort / File(s) Summary
Documentation
docs/user/setup.mdx
Updated user guidance to indicate that --setup-profile can be set to dev or dev-safe in addition to existing options.
Setup Profiles Registry & CLI Implementation
packages/agentplane/src/cli/run-cli/commands/init.ts
Introduced SetupProfilePreset type alias and setupProfilePresets registry mapping four presets (prod, prod-strict, dev, dev-safe) to their respective modes and configurations. Updated CLI spec to expose all four choices in valueHint and choices array. Modified runtime logic to derive mode from the registry lookup instead of direct flag usage.
Test Coverage
packages/agentplane/src/cli/run-cli.core.init-upgrade-backend.test.ts
Added two new test cases validating that the CLI correctly handles --setup-profile prod-strict and --setup-profile dev-safe variants with successful exit codes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Four profiles hop into our CLI warren,
Strict and safe, no need to borrow,
Registry maps each path with care,
Prod and dev dance everywhere! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 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 (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: expanding CLI flag validation to accept all setup-profile presets (prod, prod-strict, dev, dev-safe) that are already supported by the init flow.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/agentplane/src/cli/run-cli.core.init-upgrade-backend.test.ts`:
- Around line 901-911: Add assertions after each successful runCli invocation in
the test "init accepts setup-profile strict variants" to verify that
preset-specific defaults were applied: for the prod-strict run (after runCli
with "--setup-profile", "prod-strict") read the generated configuration (use the
same helper used elsewhere in tests to load repo config or parse the config file
in the repo root created by mkGitRepoRoot) and assert that defaultHooks === true
and defaultStrictUnsafeConfirm === true; for the dev-safe run load that run's
generated config and assert defaultStrictUnsafeConfirm === true (and any other
dev-safe-specific defaults expected). Reference the existing helpers
mkGitRepoRoot, configureGitUser, and runCli to locate where to plug in the
config-load and expect(...) assertions.

Comment on lines +901 to +911
it("init accepts setup-profile strict variants", async () => {
const root1 = await mkGitRepoRoot();
await configureGitUser(root1);
let code = await runCli(["init", "--yes", "--setup-profile", "prod-strict", "--root", root1]);
expect(code).toBe(0);

const root2 = await mkGitRepoRoot();
await configureGitUser(root2);
code = await runCli(["init", "--yes", "--setup-profile", "dev-safe", "--root", root2]);
expect(code).toBe(0);
});
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Test coverage for new presets looks good.

The test correctly validates that prod-strict and dev-safe are accepted by the CLI. Consider adding assertions to verify that preset-specific defaults (e.g., defaultHooks: true for prod-strict, defaultStrictUnsafeConfirm: true for both strict variants) are actually applied in the resulting config.

,

💡 Optional: Verify preset defaults are applied
   it("init accepts setup-profile strict variants", async () => {
     const root1 = await mkGitRepoRoot();
     await configureGitUser(root1);
     let code = await runCli(["init", "--yes", "--setup-profile", "prod-strict", "--root", root1]);
     expect(code).toBe(0);
+    // Verify prod-strict applies defaultStrictUnsafeConfirm: true
+    const config1 = JSON.parse(await readFile(path.join(root1, ".agentplane", "config.json"), "utf8"));
+    expect(config1.execution?.strict_unsafe_confirm).toBe(true);
 
     const root2 = await mkGitRepoRoot();
     await configureGitUser(root2);
     code = await runCli(["init", "--yes", "--setup-profile", "dev-safe", "--root", root2]);
     expect(code).toBe(0);
+    // Verify dev-safe applies defaultStrictUnsafeConfirm: true
+    const config2 = JSON.parse(await readFile(path.join(root2, ".agentplane", "config.json"), "utf8"));
+    expect(config2.execution?.strict_unsafe_confirm).toBe(true);
   });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it("init accepts setup-profile strict variants", async () => {
const root1 = await mkGitRepoRoot();
await configureGitUser(root1);
let code = await runCli(["init", "--yes", "--setup-profile", "prod-strict", "--root", root1]);
expect(code).toBe(0);
const root2 = await mkGitRepoRoot();
await configureGitUser(root2);
code = await runCli(["init", "--yes", "--setup-profile", "dev-safe", "--root", root2]);
expect(code).toBe(0);
});
it("init accepts setup-profile strict variants", async () => {
const root1 = await mkGitRepoRoot();
await configureGitUser(root1);
let code = await runCli(["init", "--yes", "--setup-profile", "prod-strict", "--root", root1]);
expect(code).toBe(0);
// Verify prod-strict applies defaultStrictUnsafeConfirm: true
const config1 = JSON.parse(await readFile(path.join(root1, ".agentplane", "config.json"), "utf8"));
expect(config1.execution?.strict_unsafe_confirm).toBe(true);
const root2 = await mkGitRepoRoot();
await configureGitUser(root2);
code = await runCli(["init", "--yes", "--setup-profile", "dev-safe", "--root", root2]);
expect(code).toBe(0);
// Verify dev-safe applies defaultStrictUnsafeConfirm: true
const config2 = JSON.parse(await readFile(path.join(root2, ".agentplane", "config.json"), "utf8"));
expect(config2.execution?.strict_unsafe_confirm).toBe(true);
});
🤖 Prompt for AI Agents
In `@packages/agentplane/src/cli/run-cli.core.init-upgrade-backend.test.ts` around
lines 901 - 911, Add assertions after each successful runCli invocation in the
test "init accepts setup-profile strict variants" to verify that preset-specific
defaults were applied: for the prod-strict run (after runCli with
"--setup-profile", "prod-strict") read the generated configuration (use the same
helper used elsewhere in tests to load repo config or parse the config file in
the repo root created by mkGitRepoRoot) and assert that defaultHooks === true
and defaultStrictUnsafeConfirm === true; for the dev-safe run load that run's
generated config and assert defaultStrictUnsafeConfirm === true (and any other
dev-safe-specific defaults expected). Reference the existing helpers
mkGitRepoRoot, configureGitUser, and runCli to locate where to plug in the
config-load and expect(...) assertions.

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