@kibibot/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Terminal display helpers — tables, cards, formatting.
3
+ */
4
+ import chalk from 'chalk';
5
+ /**
6
+ * Print a key-value card.
7
+ */
8
+ export function printCard(title, fields) {
9
+ console.log();
10
+ console.log(chalk.bold.cyan(title));
11
+ console.log(chalk.dim('─'.repeat(40)));
12
+ for (const [key, value] of fields) {
13
+ if (value !== undefined && value !== null && value !== '') {
14
+ console.log(` ${chalk.dim(key + ':')} ${value}`);
15
+ }
16
+ }
17
+ console.log();
18
+ }
19
+ /**
20
+ * Print a simple table with headers.
21
+ */
22
+ export function printTable(headers, rows) {
23
+ // Calculate column widths
24
+ const widths = headers.map((h, i) => {
25
+ const maxRow = rows.reduce((max, row) => Math.max(max, (row[i] || '').length), 0);
26
+ return Math.max(h.length, maxRow);
27
+ });
28
+ // Header
29
+ const headerLine = headers.map((h, i) => h.padEnd(widths[i])).join(' ');
30
+ console.log();
31
+ console.log(chalk.bold(headerLine));
32
+ console.log(chalk.dim(widths.map(w => '─'.repeat(w)).join(' ')));
33
+ // Rows
34
+ for (const row of rows) {
35
+ const line = row.map((cell, i) => (cell || '').padEnd(widths[i])).join(' ');
36
+ console.log(line);
37
+ }
38
+ console.log();
39
+ }
40
+ /**
41
+ * Truncate an address for display.
42
+ */
43
+ export function shortAddr(addr, chars = 6) {
44
+ if (!addr)
45
+ return chalk.dim('—');
46
+ if (addr.length <= chars * 2 + 2)
47
+ return addr;
48
+ return `${addr.slice(0, chars + 2)}...${addr.slice(-chars)}`;
49
+ }
50
+ /**
51
+ * Format a balance value.
52
+ */
53
+ export function fmtBalance(value, symbol) {
54
+ if (!value || value === '0' || value === '0.0')
55
+ return chalk.dim(`0 ${symbol}`);
56
+ // Trim trailing zeros after decimal
57
+ const num = parseFloat(value);
58
+ if (isNaN(num))
59
+ return chalk.dim(`0 ${symbol}`);
60
+ if (num === 0)
61
+ return chalk.dim(`0 ${symbol}`);
62
+ const formatted = num < 0.0001 ? num.toExponential(2) : num.toFixed(6).replace(/0+$/, '').replace(/\.$/, '');
63
+ return `${formatted} ${symbol}`;
64
+ }
65
+ /**
66
+ * Format a USD value.
67
+ */
68
+ export function fmtUsd(value) {
69
+ if (!value)
70
+ return chalk.dim('$0.00');
71
+ const num = parseFloat(value);
72
+ if (isNaN(num))
73
+ return chalk.dim('$0.00');
74
+ return `$${num.toFixed(2)}`;
75
+ }
76
+ /**
77
+ * Format a date string.
78
+ */
79
+ export function fmtDate(dateStr) {
80
+ if (!dateStr)
81
+ return chalk.dim('—');
82
+ try {
83
+ const d = new Date(dateStr);
84
+ return d.toLocaleDateString('en-US', {
85
+ year: 'numeric',
86
+ month: 'short',
87
+ day: 'numeric',
88
+ hour: '2-digit',
89
+ minute: '2-digit',
90
+ });
91
+ }
92
+ catch {
93
+ return dateStr;
94
+ }
95
+ }
96
+ /**
97
+ * Print a success message.
98
+ */
99
+ export function success(msg) {
100
+ console.log(chalk.green('✓') + ' ' + msg);
101
+ }
102
+ /**
103
+ * Print an error message to stderr.
104
+ */
105
+ export function error(msg) {
106
+ console.error(chalk.red('Error:') + ' ' + msg);
107
+ }
108
+ /**
109
+ * Print a warning message.
110
+ */
111
+ export function warn(msg) {
112
+ console.log(chalk.yellow('⚠') + ' ' + msg);
113
+ }
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Shared TypeScript types for the KibiBot CLI.
3
+ * Mirrors the Agent API + LLM Gateway response shapes.
4
+ */
5
+ export interface KibiConfig {
6
+ apiKey?: string;
7
+ apiUrl?: string;
8
+ llmUrl?: string;
9
+ }
10
+ export interface MeResponse {
11
+ twitter_user_id: string;
12
+ twitter_username?: string;
13
+ profile_image_url?: string;
14
+ followers_count?: number;
15
+ joined_at?: string;
16
+ }
17
+ export interface CreatedTokenItem {
18
+ token_address: string;
19
+ name: string;
20
+ symbol: string;
21
+ chain: string;
22
+ platform?: string;
23
+ created_at?: string;
24
+ }
25
+ export interface CreatedTokensResponse {
26
+ tokens: CreatedTokenItem[];
27
+ total: number;
28
+ page: number;
29
+ page_size: number;
30
+ has_more: boolean;
31
+ }
32
+ export interface TokenCreateRequest {
33
+ name: string;
34
+ symbol: string;
35
+ chain: string;
36
+ description?: string;
37
+ image_url?: string;
38
+ platform?: string;
39
+ }
40
+ export interface QuotaInfo {
41
+ chain: string;
42
+ free_used_today: number;
43
+ free_limit: number;
44
+ sponsored_remaining: number;
45
+ }
46
+ export interface TokenCreateResponse {
47
+ job_id: number;
48
+ status: string;
49
+ chain: string;
50
+ quota: QuotaInfo;
51
+ }
52
+ export interface TokenInfoResponse {
53
+ token_address: string;
54
+ name: string;
55
+ symbol: string;
56
+ chain: string;
57
+ platform?: string;
58
+ creator_twitter_username?: string;
59
+ price_usd?: string;
60
+ market_cap_usd?: string;
61
+ volume_24h_usd?: string;
62
+ creator_reward_usd?: string;
63
+ created_at?: string;
64
+ }
65
+ export interface JobStatusResponse {
66
+ job_id: number;
67
+ status: string;
68
+ chain?: string;
69
+ token_address?: string;
70
+ error?: string;
71
+ created_at?: string;
72
+ completed_at?: string;
73
+ }
74
+ export interface WalletSlot {
75
+ address?: string;
76
+ balance_eth?: string;
77
+ balance_bnb?: string;
78
+ balance_sol?: string;
79
+ balance_usdc_base?: string;
80
+ balance_usdt_bsc?: string;
81
+ balance_usdc_solana?: string;
82
+ eth_error?: string;
83
+ bnb_error?: string;
84
+ sol_error?: string;
85
+ usdc_base_error?: string;
86
+ usdt_bsc_error?: string;
87
+ usdc_solana_error?: string;
88
+ }
89
+ export interface WalletBalanceResponse {
90
+ evm_main: WalletSlot;
91
+ evm_trading: WalletSlot;
92
+ solana_main: WalletSlot;
93
+ solana_trading: WalletSlot;
94
+ }
95
+ export interface AgentReloadConfig {
96
+ enabled: boolean;
97
+ amount_usd: number;
98
+ daily_limit_usd: number;
99
+ chains: string[];
100
+ }
101
+ export interface AgentReloadResponse {
102
+ success: boolean;
103
+ amount_usd: string;
104
+ tx_hash?: string;
105
+ new_balance_usd?: string;
106
+ daily_used_usd: string;
107
+ daily_remaining_usd: string;
108
+ }
109
+ export interface KibiCreditBalanceResponse {
110
+ balance_usd: string;
111
+ balance_usd_cents: number;
112
+ agent_reload?: AgentReloadConfig;
113
+ }
114
+ export interface ChainQuota {
115
+ chain: string;
116
+ free_used_today: number;
117
+ free_limit: number;
118
+ sponsored_remaining: number;
119
+ can_create_paid: boolean;
120
+ trading_wallet_balance?: string;
121
+ trading_wallet_address?: string;
122
+ }
123
+ export interface QuotaResponse {
124
+ chains: ChainQuota[];
125
+ }
126
+ export interface SkillItem {
127
+ name: string;
128
+ description: string;
129
+ example?: string;
130
+ }
131
+ export interface SkillsResponse {
132
+ skills: SkillItem[];
133
+ total: number;
134
+ }
135
+ export interface LlmModelsResponse {
136
+ models: string[];
137
+ }
138
+ export interface ApiErrorResponse {
139
+ detail?: string;
140
+ message?: string;
141
+ }
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shared TypeScript types for the KibiBot CLI.
3
+ * Mirrors the Agent API + LLM Gateway response shapes.
4
+ */
5
+ export {};
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@kibibot/cli",
3
+ "version": "1.0.0",
4
+ "description": "KibiBot CLI — deploy tokens, check balances, and manage your AI agent from the terminal",
5
+ "type": "module",
6
+ "bin": {
7
+ "kibi": "./bin/kibi.js"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "files": [
12
+ "dist",
13
+ "bin"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "tsc --watch",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "engines": {
21
+ "node": ">=18.0.0"
22
+ },
23
+ "keywords": [
24
+ "kibibot",
25
+ "kibi",
26
+ "token",
27
+ "meme",
28
+ "agent",
29
+ "cli",
30
+ "base",
31
+ "bsc",
32
+ "solana"
33
+ ],
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "license": "MIT",
38
+ "dependencies": {
39
+ "chalk": "^5.3.0",
40
+ "commander": "^12.1.0",
41
+ "ora": "^8.1.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^22.0.0",
45
+ "typescript": "^5.6.0"
46
+ }
47
+ }