kob-cli 1.0.5 → 1.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kob-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.20",
4
4
  "description": "KOB CLI — AI-powered code generation tool. Built by Kob AI, made in Thailand.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,12 +21,11 @@
21
21
  "scripts": {
22
22
  "dev": "bun run src/index.ts",
23
23
  "start": "bun run src/index.ts",
24
- "build": "bun build src/index.ts --compile --outfile kob-cli",
25
- "prepublishOnly": "bun run build",
26
- "publish": "bun run src/scripts/release.ts",
27
- "release:patch": "npm version patch --no-git-tag-version && npm publish",
28
- "release:minor": "npm version minor --no-git-tag-version && npm publish",
29
- "release:major": "npm version major --no-git-tag-version && npm publish"
24
+ "build": "bun run src/scripts/release.ts",
25
+ "build:only": "bun build src/index.ts --compile --outfile kob-cli",
26
+ "release:patch": "bun run src/scripts/release.ts patch",
27
+ "release:minor": "bun run src/scripts/release.ts minor",
28
+ "release:major": "bun run src/scripts/release.ts major"
30
29
  },
31
30
  "engines": {
32
31
  "node": ">=18.0.0"
package/src/index.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
3
  import { Command } from 'commander';
4
- import chalk from 'chalk';
4
+ import { readFileSync } from 'fs';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname, join } from 'path';
5
7
  import { authVerifyCommand, balanceCommand } from './commands/auth.js';
6
8
  import { modelsCommand } from './commands/models.js';
7
9
  import { chatCommand, chatInteractiveCommand } from './commands/chat.js';
@@ -9,13 +11,22 @@ import { streamCommand } from './commands/stream.js';
9
11
  import { askCommand } from './commands/ask.js';
10
12
  import { codeCommand } from './commands/code.js';
11
13
  import { skillsCommand } from './commands/skills.js';
14
+ import { runCodeTui } from './ui/code-tui.js';
15
+
16
+ // Read version from package.json so it stays in sync with releases
17
+ const __filename = fileURLToPath(import.meta.url);
18
+ const __dirname = dirname(__filename);
19
+ const pkg = JSON.parse(
20
+ readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')
21
+ );
22
+ const VERSION: string = pkg.version;
12
23
 
13
24
  const program = new Command();
14
25
 
15
26
  program
16
- .name('kob')
17
- .description('KOB CLI - Command-line interface for Kob AI')
18
- .version('1.0.0');
27
+ .name('kob')
28
+ .description('KOB CLI - Command-line interface for Kob AI')
29
+ .version(VERSION);
19
30
 
20
31
  program.addCommand(authVerifyCommand);
21
32
  program.addCommand(balanceCommand);
@@ -27,58 +38,10 @@ program.addCommand(codeCommand);
27
38
  program.addCommand(skillsCommand);
28
39
  program.addCommand(modelsCommand);
29
40
 
30
- function showWelcome(): void {
31
- const line = chalk.dim('─'.repeat(58));
32
- const accent = chalk.hex('#a78bfa');
33
- const subtle = chalk.dim;
34
- const label = chalk.hex('#fbbf24');
35
- const green = chalk.hex('#34d399');
36
- const blue = chalk.hex('#38bdf8');
37
- const pink = chalk.hex('#f472b6');
38
-
39
- console.log(`
40
-
41
- ${blue.bold(' ██╗ ██╗ ██████╗ ██████╗ ')}${pink.bold(' ██████╗██╗ ██╗')}
42
- ${green.bold(' ██║ ██╔╝██╔═══██╗██╔══██╗')}${pink.bold(' ██╔════╝██║ ██║')}
43
- ${blue.bold(' █████╔╝ ██║ ██║██████╔╝')}${pink.bold(' ██║ ██║ ██║')}
44
- ${accent.bold(' ██╔═██╗ ██║ ██║██╔══██╗')}${pink.bold(' ██║ ██║ ██║')}
45
- ${pink.bold(' ██║ ██╗╚██████╔╝██████╔╝')}${pink.bold(' ╚██████╗███████╗██║')}
46
- ${subtle(' ╚═╝ ╚═╝ ╚═════╝ ╚═════╝')}${subtle(' ╚═════╝╚══════╝╚═╝')}
47
-
48
- ${subtle('╭' + '─'.repeat(56) + '╮')}
49
- ${subtle('│')} ${chalk.bold('KOB CLI')} ${subtle('·')} ${blue.bold('powered by')} ${green.bold('Kob AI')} ${subtle('·')} ${pink.bold('made in Thailand')} ${chalk.bold('🇹🇭')} ${subtle('│')}
50
- ${subtle('│')} ${subtle.italic('v1.0.0')} ${subtle('·')} ${subtle('www.kob-ai.dev')} ${subtle('·')} ${subtle('AI Command-Line Interface')} ${subtle('│')}
51
- ${subtle('╰' + '─'.repeat(56) + '╯')}
52
-
53
- ${line}
54
- ${label.bold(' 🚀 QUICK START')}
55
- ${line}
56
-
57
- ${accent('kob ask "What is AI?"')} ${subtle('Ask anything to AI')}
58
- ${accent('kob code "REST API"')} ${subtle('Generate code')}
59
- ${accent('kob skills')} ${subtle('List all available skills')}
60
-
61
- ${line}
62
- ${label.bold(' 📋 COMMANDS')}
63
- ${line}
64
-
65
- ${chalk.hex('#f97316')('🔐')} ${accent.bold('auth:verify')} ${accent('balance')} ${subtle('Authentication')}
66
- ${chalk.hex('#22d3ee')('💡')} ${accent.bold('ask')} ${subtle('Ask questions')}
67
- ${chalk.hex('#34d399')('💻')} ${accent.bold('code')} ${accent('--lang python')} ${subtle('Generate code')}
68
- ${chalk.hex('#38bdf8')('💬')} ${accent.bold('chat')} ${accent('chat:interactive')} ${accent('stream')} ${subtle('AI Chat')}
69
- ${chalk.hex('#a78bfa')('🤖')} ${accent.bold('models')} ${accent('--provider DeepSeek')} ${subtle('AI Models')}
70
- ${chalk.hex('#f472b6')('🧠')} ${accent.bold('skills')} ${subtle('All skills')}
71
-
72
- ${line}
73
- ${subtle('💡')} ${subtle.italic('kob <command> --help for detailed options')}
74
- ${chalk.dim('─').repeat(58)}
75
- `);
76
- }
77
-
78
- // Display welcome if no command provided
41
+ // Launch the Code TUI when no subcommand is given — `kob` becomes the entry point
79
42
  if (process.argv.length <= 2) {
80
- showWelcome();
81
- process.exit(0);
43
+ await runCodeTui();
44
+ process.exit(0);
82
45
  }
83
46
 
84
47
  program.parse(process.argv);
@@ -2,15 +2,42 @@ import { readFileSync, writeFileSync } from 'fs';
2
2
  import { execSync } from 'child_process';
3
3
  import { resolve } from 'path';
4
4
 
5
- const pkgPath = resolve(import.meta.dir, '../../package.json');
5
+ const root = resolve(import.meta.dir, '../..');
6
+ const pkgPath = resolve(root, 'package.json');
6
7
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
7
8
 
9
+ const bumpType = (process.argv[2] as 'patch' | 'minor' | 'major') || 'patch';
10
+ const idx = { patch: 2, minor: 1, major: 0 }[bumpType];
8
11
  const parts = pkg.version.split('.').map(Number);
9
- parts[2] += 1;
12
+ parts[idx] += 1;
13
+ if (bumpType === 'major') parts[1] = 0;
14
+ if (bumpType !== 'patch') parts[2] = 0;
10
15
  pkg.version = parts.join('.');
11
16
 
12
17
  writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
13
- console.log(`\n 📦 ${pkg.name}@${pkg.version}\n`);
18
+ console.log(`\n 📦 ${pkg.name}@${pkg.version} (${bumpType})\n`);
14
19
 
15
- execSync('bun run build', { stdio: 'inherit', cwd: resolve(import.meta.dir, '../..') });
16
- execSync('npm publish --ignore-scripts', { stdio: 'inherit', cwd: resolve(import.meta.dir, '../..') });
20
+ try {
21
+ execSync('bun run build:only', { stdio: 'inherit', cwd: root });
22
+ } catch (e) {
23
+ console.error('❌ build failed — skipping publish & push');
24
+ process.exit(1);
25
+ }
26
+
27
+ try {
28
+ execSync('npm publish --ignore-scripts', { stdio: 'inherit', cwd: root });
29
+ } catch (e) {
30
+ console.error('❌ publish failed — version bumped, please check npm');
31
+ process.exit(1);
32
+ }
33
+
34
+ try {
35
+ execSync('git add package.json', { stdio: 'inherit', cwd: root });
36
+ execSync(`git commit -m "release: v${pkg.version}"`, { stdio: 'inherit', cwd: root });
37
+ execSync('git push', { stdio: 'inherit', cwd: root });
38
+ execSync('git tag v' + pkg.version, { stdio: 'inherit', cwd: root });
39
+ execSync('git push --tags', { stdio: 'inherit', cwd: root });
40
+ console.log(`\n ✅ released v${pkg.version}\n`);
41
+ } catch (e) {
42
+ console.error('⚠️ git push failed (published ok) — please push manually');
43
+ }