Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 38 additions & 34 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,52 @@
#!/usr/bin/env node
import { createRequire } from "node:module";
import dotenv from "dotenv";
import pc from "picocolors";
import { init } from "./init.js";

dotenv.config();

const require = createRequire(import.meta.url);
const { version: VERSION } = require("../../package.json");

const args = process.argv.slice(2);
const command = args[0];

const LOGO = `
${pc.magenta(" █████╗ ██████╗ ██╗ ██╗ ██████╗██╗ █████╗ ██╗ ██╗")}
${pc.magenta(" ██╔══██╗██╔══██╗██║ ██╔╝ ██╔════╝██║ ██╔══██╗██║ ██║")}
${pc.magenta(" ███████║██║ ██║█████╔╝ ██║ ██║ ███████║██║ █╗ ██║")}
${pc.magenta(" ██╔══██║██║ ██║██╔═██╗ ██║ ██║ ██╔══██║██║███╗██║")}
${pc.magenta(" ██║ ██║██████╔╝██║ ██╗ ╚██████╗███████╗██║ ██║╚███╔███╔╝")}
${pc.magenta(" ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝")}`;

function printSplash() {
console.log(LOGO);
console.log();
console.log(
pc.dim(" Personal AI assistant with memory, Telegram & skills."),
);
console.log();
console.log(pc.dim(` v${VERSION}`));
console.log();
console.log(` ${pc.magenta("init")} Create a new ADK Claw project`);
console.log(` ${pc.magenta("start")} Start the AI agent`);
console.log(` ${pc.magenta("skill")} Manage agent skills`);
console.log(` ${pc.magenta("pairing")} Manage Telegram user pairing`);
console.log();
console.log(pc.dim(` Docs: https://github.com/IQAIcom/adk-claw`));
console.log(pc.dim(` GitHub: https://github.com/IQAIcom/adk-claw`));
console.log();
}

async function main() {
switch (command) {
case "init":
case undefined:
await init();
break;
case undefined:
printSplash();
break;
case "start":
await import("./start.js").then((m) => m.start());
break;
Expand All @@ -26,50 +60,20 @@ async function main() {
case "help":
case "--help":
case "-h":
printHelp();
printSplash();
break;
case "version":
case "--version":
case "-v":
printVersion();
console.log(`adk-claw v${VERSION}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Following the suggestion to derive the version from package.json, this line should use the imported version constant (CLI_VERSION) instead of the hardcoded VERSION constant.

console.log(`adk-claw v${CLI_VERSION}`);

break;
default:
console.error(`Unknown command: ${command}`);
printHelp();
printSplash();
process.exit(1);
}
}

function printHelp() {
console.log(`
adk-claw - Personal AI Assistant Setup

Usage:
adk-claw [command]

Commands:
init Initialize ADK Claw (default)
start Start the Telegram bot
skill <cmd> Manage skills (add, list, remove)
pairing <cmd> Manage user pairing (list, approve, deny, users, remove)
help Show this help message
version Show version

Examples:
adk-claw # Run setup wizard
adk-claw init # Same as above
adk-claw start # Launch Telegram bot
adk-claw skill add anthropics/skills --skill frontend-design # Install a skill
adk-claw skill list # List installed skills
adk-claw pairing list telegram # List pending pairing requests
adk-claw pairing approve telegram ABC12DEF # Approve a user
`);
}

function printVersion() {
console.log("adk-claw v0.1.0");
}

main().catch((err) => {
console.error(err);
process.exit(1);
Expand Down
Loading