This project contains a Java conversion of the TypeScript Claude Code CLI, integrated into a Spring Boot application with advanced agent capabilities, MCP integration, and autonomous task execution.
The CLI provides comprehensive functionality:
- Authentication: Login/logout with Claude AI API
- AI Assistance: Ask questions to Claude AI with multi-provider support
- Code Analysis: Explain code files using Claude AI
- Agent System: Autonomous task execution with different operational modes
- MCP Integration: Model Context Protocol support with multi-server capabilities
- Planning System: ReAct-based planning for complex task decomposition
- Help System: Built-in help and command documentation
Document | Purpose | Key Features |
---|---|---|
README.md | Main project documentation | Installation, usage, architecture overview |
CLAUDE.md | Development guidance for Claude Code | Build commands, architecture, configuration |
CLI-README.md | Basic CLI documentation | Command usage, authentication, examples |
Document | Feature Area | Description |
---|---|---|
AGENT_MODE_README.md | Agent System | Autonomous operation, task types, architecture |
PLANNING_SYSTEM_README.md | Planning & ReAct | Task decomposition, ReAct cycles, memory management |
Document | Status | Description |
---|---|---|
PORTING_DOCUMENTATION.md | ✅ Complete | TypeScript to Java migration documentation |
AGENT_IMPLEMENTATION_COMPLETE.md | ✅ Complete | Agent system implementation completion |
MCP_CONFIG_MIGRATION_COMPLETED.md | ✅ Complete | MCP configuration migration |
MCP_MULTI_SERVER_COMPLETION.md | ✅ Complete | Multi-server MCP support |
PARAMETER_VALIDATION_ENHANCEMENT_COMPLETE.md | ✅ Complete | Parameter validation enhancements |
PROJECT_STRUCTURE_UPDATED.md | ✅ Complete | Project structure updates |
Document | Type | Purpose |
---|---|---|
MARKDOWN_FILES_INVENTORY.md | Inventory | Complete listing of all markdown files |
package.md | Configuration | Package configuration details |
package-lock.md | Dependencies | Dependency lock information |
- Command Line Parsing: Converts TypeScript argument parsing to Java
- Command Registry: Maintains a registry of available commands with categories
- Help System: Generates formatted help output for commands
- Error Handling: User-friendly error messages and proper exit codes
- Authentication: Token-based authentication with local storage
- AI Integration: Uses Spring AI Anthropic integration for Claude API calls
- Java 17 or higher
- Maven 3.6 or higher
- Claude API key from Anthropic
# Build the project
.\mvnw.cmd clean package -DskipTests
# Or use the provided script
.\claude-code.ps1 --version
Set your Claude API key either:
-
Environment Variable (Recommended):
$env:ANTHROPIC_API_KEY = "sk-ant-api03-..."
-
CLI Login (Alternative):
java -jar target\misoto-0.0.1-SNAPSHOT.jar login
# Using Java directly
java -jar target\misoto-0.0.1-SNAPSHOT.jar <command> [arguments]
# Using PowerShell script (auto-builds if needed)
.\claude-code.ps1 <command> [arguments]
# Using Batch script
.\claude-code.bat <command> [arguments]
# Login with API token
java -jar target\misoto-0.0.1-SNAPSHOT.jar login --token sk-ant-api03-...
# Login interactively
java -jar target\misoto-0.0.1-SNAPSHOT.jar login
# Logout
java -jar target\misoto-0.0.1-SNAPSHOT.jar logout
# Ask a question
java -jar target\misoto-0.0.1-SNAPSHOT.jar ask "How do I implement a binary search tree in Java?"
# Explain a code file
java -jar target\misoto-0.0.1-SNAPSHOT.jar explain src\main\java\MyClass.java
# Explain with focus
java -jar target\misoto-0.0.1-SNAPSHOT.jar explain MyClass.java --focus=algorithm
# Show all commands
java -jar target\misoto-0.0.1-SNAPSHOT.jar help
# Show help for specific command
java -jar target\misoto-0.0.1-SNAPSHOT.jar help ask
# Show version
java -jar target\misoto-0.0.1-SNAPSHOT.jar version
- Spring Boot Integration: Uses Spring Boot's dependency injection and configuration
- Spring AI: Leverages Spring AI for Anthropic Claude integration
- Java Type System: Strongly typed interfaces and classes instead of TypeScript types
- Maven Dependencies: Uses Maven for dependency management instead of npm
- JAR Packaging: Distributed as a self-contained JAR instead of npm package
-
Create a new command class implementing the
Command
interface:@Component public class MyCommand implements Command { // Implement required methods }
-
Register the command in
CommandRegistrationService
:@Autowired private MyCommand myCommand; // Add to registerAllCommands() method commands.add(myCommand);
Configure the application through application.properties
:
# Claude AI Configuration
spring.ai.anthropic.api-key=${ANTHROPIC_API_KEY}
spring.ai.anthropic.chat.model=claude-3-sonnet-20240229
spring.ai.anthropic.chat.temperature=0.7
spring.ai.anthropic.chat.max-tokens=4000
# Logging
logging.level.sg.edu.nus.iss.misoto.cli=INFO
- No API Key: Set the
ANTHROPIC_API_KEY
environment variable or use the login command - Java Version: Ensure you're using Java 17 or higher
- Build Issues: Run
.\mvnw.cmd clean compile
to rebuild
The CLI stores authentication tokens in ~/.claude-code/auth.token
on your system. Use the logout
command to clear stored credentials.
This project maintains the same license as the original TypeScript implementation.