UNPKG

hataraku

Version:

An autonomous coding agent for building AI-powered development tools. The name "Hataraku" (働く) means "to work" in Japanese.

77 lines (76 loc) 5.03 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.runCLI = exports.main = exports.program = void 0; const commander_1 = require("commander"); const chalk_1 = __importDefault(require("chalk")); const package_json_1 = require("../../package.json"); const first_run_manager_1 = require("../config/first-run-manager"); // Import command registration const commands_1 = require("./commands"); // Import execution functions const execution_1 = require("./execution"); Object.defineProperty(exports, "main", { enumerable: true, get: function () { return execution_1.main; } }); Object.defineProperty(exports, "runCLI", { enumerable: true, get: function () { return execution_1.runCLI; } }); // Create the main program and register all commands const program = new commander_1.Command(); exports.program = program; (0, commands_1.registerAllCommands)(program); // Configure the main program program .name('hataraku') .description('Hataraku is a CLI tool for creating and managing tasks') .option('--update', 'Update Hataraku to the latest version') .option('-p, --provider <provider>', 'API provider to use (openrouter, bedrock, knowledge-base)') .option('-m, --model <model>', 'Model ID for the provider (e.g., anthropic/claude-3.5-sonnet)') .option('-k, --api-key <key>', 'API key for the provider (can also use PROVIDER_API_KEY env var)') .option('-i, --interactive', 'Run in interactive mode, prompting for tasks') .option('--no-sound', 'Disable sound effects') .option('--no-stream', 'Disable streaming responses') .option('-v, --verbose', 'Enable verbose output with intermediate task information') .option('--region <region>', 'AWS region for Bedrock/Knowledge Base (defaults to AWS_REGION env var)') .option('--profile <profile>', 'Use specific AWS profile') .option('--agent <agent>', 'Use specific agent') .option('--kb-id <id>', 'Knowledge Base ID when using knowledge-base provider (REQUIRED, can also use KB_ID env var)') .arguments('[task...]') .version(package_json_1.version) .addHelpText('after', ` Examples: $ hataraku "create a hello world html file" # Uses default model (claude-3.5-sonnet) $ hataraku --model deepseek/deepseek-chat "explain this code" # Uses different model $ hataraku --provider anthropic --model claude-3 "write a test" # Uses different provider $ hataraku --provider bedrock --model us.anthropic.claude-3-7-sonnet-20250219-v1:0 "analyze this code" # Uses AWS Bedrock $ hataraku --provider knowledge-base --kb-id my-kb-id "what is x?" # Uses AWS Knowledge Base with specific ID $ hataraku --provider knowledge-base --model anthropic/claude-3-5-sonnet "what is x?" # Uses Knowledge Base with specific model $ KB_ID=my-kb-id KB_MODEL_ARN=arn:aws:... hataraku --provider knowledge-base "what is x?" # Uses env vars $ OPENROUTER_API_KEY=<key> hataraku "write a test file" # Provides API key via env var $ hataraku -i # Run in interactive mode $ hataraku -i "initial task" # Interactive mode with initial task $ hataraku --no-sound "create a test file" # Run without sound effects $ hataraku --no-stream "explain this code" # Run without streaming responses $ hataraku --verbose "debug this issue" # Run with verbose output $ hataraku --profile coding "refactor this code" # Use a specific AWS profile $ hataraku --agent code-reviewer "review my code" # Use a specific agent $ hataraku profile list # List all profiles $ hataraku task run code-review # Run a saved task $ hataraku init # Initialize configuration Environment Variables: OPENROUTER_API_KEY - API key for OpenRouter ANTHROPIC_API_KEY - API key for Anthropic OPENAI_API_KEY - API key for OpenAI AWS_ACCESS_KEY_ID - AWS access key ID for Bedrock AWS_SECRET_ACCESS_KEY - AWS secret access key for Bedrock AWS_REGION - AWS region for Bedrock (defaults to us-east-1)`) .action(async (task) => { // Check if this is the first run const firstRunManager = new first_run_manager_1.FirstRunManager(); const isFirstRun = await firstRunManager.isFirstRun(); if (isFirstRun) { console.log(chalk_1.default.yellow('\nFirst run detected. Initializing default configuration...')); await firstRunManager.initializeDefaults(); } // The task will be handled by main() after parsing }); //# sourceMappingURL=index.js.map