fix(init): accept all setup-profile presets in CLI flags#6
fix(init): accept all setup-profile presets in CLI flags#6Atman36 wants to merge 1 commit intobasilisk-labs:mainfrom
Conversation
📝 WalkthroughWalkthroughA 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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.
| 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); | ||
| }); |
There was a problem hiding this comment.
🧹 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.
| 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.
Summary
Aligns
init --setup-profileCLI validation with the actual preset set used by init flow.Problem
The init flow supports
prod,prod-strict,dev, anddev-safe, but CLI flag validation for--setup-profileallowed onlyprod|dev.Changes
--setup-profileoption choices/value hint to include:prodprod-strictdevdev-safeValidation
npx vitest run packages/agentplane/src/cli/run-cli.core.init-upgrade-backend.test.tspre-commit,pre-push) passedSummary by CodeRabbit
Release Notes
New Features
Documentation
Tests