Skip to content

feat: add OptionResolver utility and --silent option#60

Open
MaxwellCalkin wants to merge 1 commit intosensay-io:mainfrom
MaxwellCalkin:feat/option-resolver-silent
Open

feat: add OptionResolver utility and --silent option#60
MaxwellCalkin wants to merge 1 commit intosensay-io:mainfrom
MaxwellCalkin:feat/option-resolver-silent

Conversation

@MaxwellCalkin
Copy link
Copy Markdown

Summary

  • Creates reusable OptionResolver utility class (src/utils/option-resolver.ts) that handles the standard configuration priority chain (CLI → ENV → Interactive → Project → User) as specified in CLAUDE.md
  • Adds global --silent / -s option that skips interactive prompts and uses config defaults (errors if a required value is missing)
  • Refactors chat and simple-organization-setup commands to use OptionResolver, eliminating duplicated config resolution logic (net -18 lines)

Details

The OptionResolver class:

  • Lazily loads project and user config on first resolve() call
  • Supports custom validators per option
  • Supports environment variable resolution
  • Handles both interactive (prompt with defaults) and silent (use defaults or error) modes

Closes #2

Test plan

  • Run sensay chat interactively — verify replica name prompt appears with config default
  • Run sensay chat -s -r "MyReplica" -m "hello" — verify silent mode works
  • Run sensay chat -s without config — verify error for missing required option
  • Run sensay simple-organization-setup interactively — verify userName/userEmail prompts
  • Run sensay simple-organization-setup -s with config file — verify silent mode uses defaults
  • Verify sensay --help shows the new -s, --silent option

🤖 Generated with Claude Code

Creates a reusable OptionResolver class that handles the standard
configuration priority chain (CLI → ENV → Interactive → Project → User)
as specified in CLAUDE.md. Adds global --silent/-s option that skips
interactive prompts and uses config defaults.

Refactors chat and simple-organization-setup commands to use
OptionResolver, eliminating duplicated config resolution logic.

Closes sensay-io#2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Missing silent option and OptionResolver utility class

1 participant