Skip to content

[ef-32] feat: replace flag-soup with policies verb + non-interactive custom install#31

Merged
NiveditJain merged 1 commit into
mainfrom
ef-32
Apr 7, 2026
Merged

[ef-32] feat: replace flag-soup with policies verb + non-interactive custom install#31
NiveditJain merged 1 commit into
mainfrom
ef-32

Conversation

@NiveditJain

@NiveditJain NiveditJain commented Apr 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Replaces --install-policies, --remove-policies, --list-policies flags with a clean policies subcommand verb
  • failproofai policies → list all policies (default)
  • failproofai policies --install / -i → install/enable policies
  • failproofai policies --uninstall / -u → uninstall/disable policies
  • --custom/-c <path> supported on --install; --custom/-c (no value) on --uninstall to clear the custom path
  • failproofai policies --help / -h shows subcommand-specific help (global --help no longer intercepts subcommands)
  • When --custom/-c is given without explicit policy names, skips the interactive TUI — validates the file first, shows enabled policy names on success, exits 1 with error on failure

Test plan

  • failproofai policies lists policies
  • failproofai policies --install opens interactive TUI
  • failproofai policies --install block-sudo installs named policy, no TUI
  • failproofai policies -i -c ./my-hooks.js validates file, skips TUI, prints enabled policies
  • failproofai policies -i -c ./bad-file.js prints error, exits 1, no config written
  • failproofai policies --uninstall block-sudo disables named policy
  • failproofai policies -u --custom clears custom policy path
  • failproofai policies --help shows policies-specific help
  • failproofai --help shows updated top-level help with policies verb

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Policy management commands reorganized under a new policies subcommand, replacing legacy top-level flags with streamlined syntax like policies --install, policies --uninstall, and policies for listing
  • Documentation

    • Updated help text, interactive prompts, and postinstall messages to reflect the new policy command structure

@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: bc1fb39a-ad00-4c9a-a082-96f5ff9d4d3b

📥 Commits

Reviewing files that changed from the base of the PR and between 8d1289b and c63e2a1.

📒 Files selected for processing (5)
  • __tests__/hooks/manager.test.ts
  • bin/failproofai.mjs
  • scripts/postinstall.mjs
  • src/hooks/install-prompt.ts
  • src/hooks/manager.ts
✅ Files skipped from review due to trivial changes (2)
  • src/hooks/install-prompt.ts
  • src/hooks/manager.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/postinstall.mjs
  • tests/hooks/manager.test.ts

📝 Walkthrough

Walkthrough

The changes migrate the CLI from legacy top-level policy flags (--install-policies, --remove-policies, --list-policies) to a new policies subcommand architecture. The main entry point was refactored to parse and route policy operations through the subcommand, and all user-facing guidance strings across CLI, tests, and documentation were updated to reflect the new syntax.

Changes

Cohort / File(s) Summary
CLI Subcommand Refactoring
bin/failproofai.mjs
Replaced legacy policy flags with a policies subcommand. Added conditional --help/-h handling, implemented subcommand routing (policies, policies --install/-i, policies --uninstall/-u), updated flag parsing for --scope, --beta, --custom/-c, positional policy names, and unknown-flag/subcommand detection.
User-Facing Help Text Updates
src/hooks/install-prompt.ts, src/hooks/manager.ts, scripts/postinstall.mjs
Updated interactive prompt tips and CLI guidance messages to reference the new policies subcommand syntax instead of legacy --install-policies, --remove-policies, --list-policies flags.
Test Assertions
__tests__/hooks/manager.test.ts
Updated expected strings in compact output tests from "--install-policies" to "policies --install".

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 The policies now hop through subcommands so neat,
No more -\-install-\-policies in the street!
A policies gate routes them here and there,
With --install and --uninstall care,
The CLI syntax is fresh and fair! 🎉


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

…ve prompt for --custom

- `failproofai policies`            → list policies (was --list-policies)
- `failproofai policies --install`  → install (was --install-policies)
- `failproofai policies --uninstall`→ uninstall (was --remove-policies)
- `-i` / `-u` short forms supported
- `--custom`/`-c <path>` supported on --install; `--custom`/`-c` on --uninstall
- `failproofai policies --help` shows subcommand-specific help
- When --custom/-c is given without explicit policy names, skips the
  interactive TUI and validates the file, then installs silently showing
  the names of enabled policies (or exits 1 on validation failure)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@NiveditJain NiveditJain merged commit 7b4c822 into main Apr 7, 2026
8 checks passed
@NiveditJain NiveditJain deleted the ef-32 branch April 21, 2026 01:31
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