Skip to content

feat: Add CLI argument parsing for agent selection and initial messages#44

Merged
CSRessel merged 1 commit intomainfrom
add-cli-arguments
Nov 14, 2025
Merged

feat: Add CLI argument parsing for agent selection and initial messages#44
CSRessel merged 1 commit intomainfrom
add-cli-arguments

Conversation

@CSRessel
Copy link
Copy Markdown
Collaborator

Summary

This PR adds command-line argument parsing to nori-cli, allowing users to specify the agent and initial message from the command line.

Changes

  • Add clap dependency: Added clap v4 with derive feature for CLI argument parsing
  • New CLI module: Created src/cli.rs with Cli struct and agent name mapping functions
  • Main function updates: Modified main.rs to parse CLI args, validate agent names, and read from stdin when piped
  • Run app updates: Updated run_app to accept optional agent_index and initial_message parameters
  • Comprehensive tests: Added tests/cli_args_test.rs with tests for all CLI parsing scenarios
  • Documentation updates: Updated docs in both src/docs.md and tests/docs.md

Usage Examples

# Use specific agent
nori-cli --agent claude

# Use specific agent with initial message
nori-cli --agent codex "Hello world"

# Pipe input as initial message
echo "Hello from stdin" | nori-cli

# Short flag for agent
nori-cli -a mock "Test message"

Features

  • Agent selection via --agent or -a flag (claude, codex, claudecode, mock)
  • Initial message as positional argument or via stdin piping
  • Case-insensitive agent name matching
  • Input validation with helpful error messages
  • CLI arguments take precedence over stdin when both provided

- Add clap dependency for command-line argument parsing
- Create cli.rs module with Cli struct and agent name mapping functions
- Modify main.rs to parse CLI args, validate agent names, and read from stdin
- Update run_app to accept optional agent_index and initial_message parameters
- Add comprehensive tests for CLI argument parsing and agent name mapping
- Update documentation to reflect new CLI functionality
@CSRessel CSRessel merged commit 32492b4 into main Nov 14, 2025
3 checks passed
@CSRessel CSRessel deleted the add-cli-arguments branch November 14, 2025 19:56
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