Interactive CLI for the AI agent with flexible arguments and multiple execution modes.
- TypeScript 68.5%
- JavaScript 31.5%
Import and pass CLI_PERMISSIONS preset from severin. Switch from new Agent() to Agent.create() to properly await plugin initialization before prompt(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| src | ||
| .gitignore | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Agent CLI
Interactive command line interface for the AI agent with flexible command-line arguments and multiple execution modes.
Getting Started
-
Build the project:
npm run build -
Run the CLI:
node dist/index.js [options]
Command-Line Arguments
Message Options (Multiple Aliases)
Send a message to the agent using any of these equivalent options:
-m, --message <text>- Send a message to the agent--ask <text>- Send a message to the agent--query <text>- Send a message to the agent
System Options
--system- Display the agent's system prompt (shows available tools and instructions)
Execution Mode Options
--once- Run once and exit (non-interactive mode)--exit- Run once and exit (non-interactive mode)
Usage Examples
Interactive Mode (Default)
# Start normal interactive session
node dist/index.js
# Start with an initial message
node dist/index.js --message "Hello, what's the current time?"
node dist/index.js --ask "What tools do you have available?"
node dist/index.js -m "Search for recent AI news"
# Show system prompt, then continue interactively
node dist/index.js --system
# Show system prompt and send initial message, then continue interactively
node dist/index.js --system --ask "What can you help me with?"
Non-Interactive Mode
# Execute single command and exit
node dist/index.js --message "What time is it?" --exit
node dist/index.js --ask "Search for Node.js tutorials" --once
# Display system prompt and exit
node dist/index.js --system --exit
# Display system prompt, execute command, then exit
node dist/index.js --system --query "Help me with JavaScript" --once
Interactive Session Example
🤖 Welcome to Agent CLI! Type your prompts below (Ctrl+C to exit):
👤 You: Hello, what tools do you have available?
🤖 Agent: I have access to several tools:
- DateTime tool for current date/time information
- Web search tool for finding current information
- Web fetch tool for extracting content from specific URLs
- Internal test tool for error handling testing
👤 You: What's the current time?
🔧 Using dateTimeTool...
🤖 Agent: The current time is 2:30 PM EST on January 25, 2025.
👤 You: exit
🛑 Shutting down, goodbye!
Available Tools
The agent-cli comes pre-configured with these tools:
- DateTime Tool - Get current date and time information
- Web Search Tool - Search the web using DuckDuckGo
- Web Fetch Tool - Fetch and extract content from web pages
- Internal Test Tool - For testing error handling
Testing and Development
This CLI is perfect for:
- General agent testing - Use
--message,--system, and--exitarguments for quick testing - Tool testing - If the agent-cli has a specific tool installed, you can test its functionality
- Development workflow - Use non-interactive mode for scripting and automation
- Debugging - Use
--systemto inspect the agent's available tools and instructions
Error Handling
- Invalid option combinations will show helpful error messages
- Use
--helpto see all available options - Press
Ctrl+Cfor immediate exit in interactive mode - Type
exitorquitin interactive mode for graceful shutdown