Skip to content

feat: add support for rules to define multiple or single selection - #4

Merged
ndizazzo merged 2 commits into
mainfrom
feature/multi-single-select
Mar 25, 2026
Merged

feat: add support for rules to define multiple or single selection#4
ndizazzo merged 2 commits into
mainfrom
feature/multi-single-select

Conversation

@ndizazzo

@ndizazzo ndizazzo commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

Added a mode configuration option to rules that allows specifying how items can be selected: multi-select (default, allows any combination) or single-select (enforce one-at-a-time selection via radio buttons).

This enables rules with mutually exclusive alternatives like oh-my-opencode.yaml with three provider configs targeting the same file to prevent users from accidentally installing multiple conflicting options. The feature includes TUI radio button indicators, headless enforcement, and applies to all bundled rules (6 multi-select, 1 single-select).

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • Other:

Testing

  • npm test passes (178 tests, 0 failures — includes 5 new mode tests)
  • npm run lint:agents outputs agent-lint: ok
  • New tests added for new behaviour:
    • tests/load-config.test.js: 3 tests for mode normalization (default, explicit, invalid values)
    • tests/install-core.test.js: 2 tests for mode propagation to profiles

Checklist

  • No "use strict" omitted from new .js files
  • No empty catch {} blocks introduced
  • No new runtime dependencies added
  • CHANGELOG.md updated under [Unreleased] (user may want to do this)

Files Changed

Data layer (mode parsing & propagation):

  • scripts/load-config.js — Parse mode from YAML, default to multi-select
  • scripts/install-core.js — Propagate mode to profiles
  • scripts/tui/ui/format.mjs — Propagate mode to tool groups
    TUI (selection enforcement & visual indicators):
  • scripts/tui/App.mjs — Enforce single-select in headless mode, disk scan initialization, and keyboard handlers (depth 0 and 1)
  • scripts/tui/components/SelectionScreen.mjs — Radio button indicators (•) / ( ) for single-select groups
    Rules (explicit mode declarations):
  • rules/claude.yaml, codex.yaml, copilot.yaml, cursor.yaml, gemini.yaml, opencode.yaml — Added mode: multi-select
  • rules/oh-my-opencode.yaml — Added mode: single-select

Documentation:

  • README.md — New "Writing Rules" section covering schema, selection modes, and examples
  • CONTRIBUTING.md — Updated test count, reference to Writing Rules
    Tests:
  • tests/load-config.test.js — 3 new tests for mode normalization
  • tests/install-core.test.js — 2 new tests for mode propagation, updated delta test rule with mode: single-select

@ndizazzo
ndizazzo merged commit 07a1515 into main Mar 25, 2026
3 checks passed
@ndizazzo
ndizazzo deleted the feature/multi-single-select branch March 25, 2026 19:12
ndizazzo added a commit that referenced this pull request Mar 29, 2026
* add support for rules to define multiple or single selection
* update CHANGELOG.md
ndizazzo added a commit that referenced this pull request Mar 29, 2026
… (#5)

* add support for rules to define multiple or single selection
* update CHANGELOG.md
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