Interactive CLI for the AI agent with flexible arguments and multiple execution modes.
  • TypeScript 68.5%
  • JavaScript 31.5%
Find a file
James Peret 1de128ffe2
feat: use CLI_PERMISSIONS preset and switch to Agent.create()
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>
2026-04-13 23:37:27 -03:00
src feat: use CLI_PERMISSIONS preset and switch to Agent.create() 2026-04-13 23:37:27 -03:00
.gitignore Initial commit 2025-08-23 00:47:11 -03:00
package-lock.json feat: add browser-tool dependency for agent-cli 2026-03-30 06:43:28 -03:00
package.json feat: add browser-tool dependency for agent-cli 2026-03-30 06:43:28 -03:00
README.md Update README with comprehensive command-line argument documentation 2025-08-25 16:48:26 -03:00
tsconfig.json Initial commit 2025-08-23 00:47:11 -03:00

Agent CLI

Interactive command line interface for the AI agent with flexible command-line arguments and multiple execution modes.

Getting Started

  1. Build the project:

    npm run build
    
  2. 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 --exit arguments 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 --system to inspect the agent's available tools and instructions

Error Handling

  • Invalid option combinations will show helpful error messages
  • Use --help to see all available options
  • Press Ctrl+C for immediate exit in interactive mode
  • Type exit or quit in interactive mode for graceful shutdown