@kibibot/cli 1.0.8 → 1.0.10
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.
- package/README.md +2 -0
- package/dist/commands/about.d.ts +5 -0
- package/dist/commands/about.js +51 -0
- package/dist/commands/login.js +44 -10
- package/dist/index.js +2 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { join, dirname } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
function getVersion() {
|
|
6
|
+
try {
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', '..', 'package.json'), 'utf-8'));
|
|
9
|
+
return pkg.version || 'unknown';
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return 'unknown';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function registerAbout(program) {
|
|
16
|
+
program
|
|
17
|
+
.command('about')
|
|
18
|
+
.description('About KibiBot CLI')
|
|
19
|
+
.action(() => {
|
|
20
|
+
const version = getVersion();
|
|
21
|
+
const W = 43; // inner width between ║ borders
|
|
22
|
+
function pad(text, displayWidth) {
|
|
23
|
+
// displayWidth accounts for emojis/wide chars taking 2 columns
|
|
24
|
+
const dw = displayWidth ?? text.length;
|
|
25
|
+
const padding = W - dw;
|
|
26
|
+
return text + ' '.repeat(Math.max(0, padding));
|
|
27
|
+
}
|
|
28
|
+
const lines = [
|
|
29
|
+
'',
|
|
30
|
+
' K I B I B O T',
|
|
31
|
+
'',
|
|
32
|
+
' Deploy tokens. Earn fees.',
|
|
33
|
+
' Power your AI agent.',
|
|
34
|
+
'',
|
|
35
|
+
` Version ${version}`,
|
|
36
|
+
' Website kibi.bot',
|
|
37
|
+
' Docs kibi.bot/docs/agent',
|
|
38
|
+
' GitHub github.com/KibiAgent',
|
|
39
|
+
'',
|
|
40
|
+
' Base · BSC · Solana',
|
|
41
|
+
'',
|
|
42
|
+
];
|
|
43
|
+
console.log();
|
|
44
|
+
console.log(chalk.cyan(` ╔${'═'.repeat(W)}╗`));
|
|
45
|
+
for (const line of lines) {
|
|
46
|
+
console.log(chalk.cyan(' ║') + pad(line) + chalk.cyan('║'));
|
|
47
|
+
}
|
|
48
|
+
console.log(chalk.cyan(` ╚${'═'.repeat(W)}╝`));
|
|
49
|
+
console.log();
|
|
50
|
+
});
|
|
51
|
+
}
|
package/dist/commands/login.js
CHANGED
|
@@ -27,17 +27,51 @@ export function registerLogin(program) {
|
|
|
27
27
|
}
|
|
28
28
|
let apiKey = opts.apiKey;
|
|
29
29
|
if (!apiKey) {
|
|
30
|
-
// Interactive prompt
|
|
31
|
-
|
|
32
|
-
const rl = readline.createInterface({
|
|
33
|
-
input: process.stdin,
|
|
34
|
-
output: process.stdout,
|
|
35
|
-
});
|
|
30
|
+
// Interactive prompt with masked input
|
|
31
|
+
process.stdout.write('Enter your API key: ');
|
|
36
32
|
apiKey = await new Promise((resolve) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
let input = '';
|
|
34
|
+
const stdin = process.stdin;
|
|
35
|
+
const wasRaw = stdin.isRaw;
|
|
36
|
+
if (stdin.isTTY) {
|
|
37
|
+
stdin.setRawMode(true);
|
|
38
|
+
}
|
|
39
|
+
stdin.resume();
|
|
40
|
+
stdin.setEncoding('utf8');
|
|
41
|
+
const onData = (ch) => {
|
|
42
|
+
const c = ch.toString();
|
|
43
|
+
if (c === '\n' || c === '\r') {
|
|
44
|
+
// Enter
|
|
45
|
+
stdin.removeListener('data', onData);
|
|
46
|
+
if (stdin.isTTY)
|
|
47
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
48
|
+
stdin.pause();
|
|
49
|
+
process.stdout.write('\n');
|
|
50
|
+
resolve(input.trim());
|
|
51
|
+
}
|
|
52
|
+
else if (c === '\u0003') {
|
|
53
|
+
// Ctrl+C
|
|
54
|
+
process.stdout.write('\n');
|
|
55
|
+
process.exit(0);
|
|
56
|
+
}
|
|
57
|
+
else if (c === '\u007f' || c === '\b') {
|
|
58
|
+
// Backspace
|
|
59
|
+
if (input.length > 0) {
|
|
60
|
+
input = input.slice(0, -1);
|
|
61
|
+
process.stdout.write('\b \b');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (c.length === 1 && c >= ' ') {
|
|
65
|
+
input += c;
|
|
66
|
+
process.stdout.write('*');
|
|
67
|
+
}
|
|
68
|
+
else if (c.length > 1) {
|
|
69
|
+
// Pasted text
|
|
70
|
+
input += c;
|
|
71
|
+
process.stdout.write('*'.repeat(c.length));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
stdin.on('data', onData);
|
|
41
75
|
});
|
|
42
76
|
}
|
|
43
77
|
if (!apiKey || !apiKey.startsWith('kb_')) {
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { registerQuota } from './commands/quota.js';
|
|
|
19
19
|
import { registerSkills } from './commands/skills.js';
|
|
20
20
|
import { registerLlm } from './commands/llm.js';
|
|
21
21
|
import { registerConfig } from './commands/config.js';
|
|
22
|
+
import { registerAbout } from './commands/about.js';
|
|
22
23
|
// Read version from package.json
|
|
23
24
|
const __filename = fileURLToPath(import.meta.url);
|
|
24
25
|
const __dirname = dirname(__filename);
|
|
@@ -47,4 +48,5 @@ registerQuota(program);
|
|
|
47
48
|
registerSkills(program);
|
|
48
49
|
registerLlm(program);
|
|
49
50
|
registerConfig(program);
|
|
51
|
+
registerAbout(program);
|
|
50
52
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kibibot/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "KibiBot CLI — deploy tokens, check balances, and manage your AI agent from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"dev": "tsc --watch",
|
|
18
|
-
"prepublishOnly": "npm run build"
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"postinstall": "node dist/index.js about 2>/dev/null || true"
|
|
19
20
|
},
|
|
20
21
|
"engines": {
|
|
21
22
|
"node": ">=18.0.0"
|