agent-cli-kit
v1.0.0
Published
Starter kit for AI agents building CLIs. Includes auth, config, logging, API helpers.
Downloads
111
Maintainers
Readme
agent-cli-kit
A starter kit for AI agents building CLI tools. Handles config, logging, API calls, and auth.
Install
npm install agent-cli-kitQuick Start
const { AgentCLI } = require('agent-cli-kit');
const { program } = require('commander');
// Create your agent
const agent = new AgentCLI('my-agent', '1.0.0');
// Add commands
program
.command('action <target>')
.action((target) => {
agent.log.success(`Action on ${target}`);
});
program.parse(process.argv);Features
✅ Config management (auto-saved to ~/.agent-config/) ✅ Logging helpers (success, error, warn, info) ✅ API call wrapper with timeout ✅ Commander.js pre-integrated ✅ Zero additional setup needed
Built-in Methods
Logging
agent.log.success(msg)— ✅ messagesagent.log.error(msg)— ❌ errorsagent.log.warn(msg)— ⚠️ warningsagent.log.info(msg)— ℹ️ infoagent.log.section(title)— 📍 section headeragent.log.json(obj)— Pretty-print JSON
Config
agent.get(key)— Get config valueagent.set(key, value)— Save config value
API
await agent.api(url, options)— Fetch with timeout + error handling
Example: Weather Agent
const { AgentCLI } = require('agent-cli-kit');
const { program } = require('commander');
const agent = new AgentCLI('weather-agent', '1.0.0');
program
.command('weather <city>')
.action(async (city) => {
try {
const data = await agent.api(`https://api.example.com/weather?city=${city}`);
agent.log.section(`Weather in ${city}`);
agent.log.info(`Temperature: ${data.temp}°C`);
} catch (err) {
agent.log.error(`Could not fetch weather`);
}
});
program.parse(process.argv);License
MIT
