thachvd-kit 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/bin/cli.js +56 -9
  2. package/package.json +11 -9
package/bin/cli.js CHANGED
@@ -4,6 +4,7 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const prompts = require('prompts');
6
6
  const pc = require('picocolors');
7
+ const packageJson = require('../package.json');
7
8
 
8
9
  const sourceDir = path.resolve(__dirname, '..');
9
10
  const targetDir = process.cwd();
@@ -90,6 +91,33 @@ const PACKAGE_MANAGER_CHOICES = ['npm', 'pnpm', 'yarn', 'bun', 'pip', 'uv', 'go
90
91
  const TEST_FRAMEWORK_CHOICES = ['jest', 'vitest', 'pytest', 'go test', 'phpunit', 'pest', 'rspec', 'junit', 'auto-detect'];
91
92
  const CLOUD_CHOICES = ['aws', 'gcp', 'azure', 'vercel', 'fly', 'railway', 'none'];
92
93
 
94
+ function printHelp() {
95
+ console.log(`
96
+ ${pc.bold('Usage:')}
97
+ thachvd-kit init [--scan] [--yes]
98
+ thachvd-kit --version
99
+ thachvd-kit --help
100
+
101
+ ${pc.bold('Commands:')}
102
+ init Run the project init wizard
103
+
104
+ ${pc.bold('Options:')}
105
+ --scan Scan the current project to prefill PROJECT_CONTEXT.md
106
+ --yes Use detected/default values without prompting
107
+ --version Show the installed CLI version
108
+ --help Show this help message
109
+ `);
110
+ }
111
+
112
+ async function askQuestions(questions) {
113
+ return prompts(questions, {
114
+ onCancel: () => {
115
+ console.log(pc.yellow('\nCancelled.'));
116
+ process.exit(130);
117
+ }
118
+ });
119
+ }
120
+
93
121
  function fileExists(...parts) {
94
122
  return fs.existsSync(path.join(targetDir, ...parts));
95
123
  }
@@ -403,7 +431,26 @@ See PROJECT_CONTEXT.md for full agent routing table.
403
431
  // --- Main CLI ---
404
432
 
405
433
  async function main() {
406
- const args = process.argv.slice(2);
434
+ const rawArgs = process.argv.slice(2);
435
+ const command = rawArgs[0] && !rawArgs[0].startsWith('-') ? rawArgs[0] : 'init';
436
+ const args = command === 'init' ? rawArgs.slice(rawArgs[0] === 'init' ? 1 : 0) : rawArgs.slice(1);
437
+
438
+ if (rawArgs.includes('--version') || rawArgs.includes('-v')) {
439
+ console.log(packageJson.version);
440
+ return;
441
+ }
442
+
443
+ if (rawArgs.includes('--help') || rawArgs.includes('-h')) {
444
+ printHelp();
445
+ return;
446
+ }
447
+
448
+ if (command !== 'init') {
449
+ console.error(pc.red(`Unknown command: ${command}`));
450
+ printHelp();
451
+ process.exit(1);
452
+ }
453
+
407
454
  let useScan = args.includes('--scan');
408
455
  const assumeYes = args.includes('--yes') || args.includes('-y');
409
456
 
@@ -414,7 +461,7 @@ async function main() {
414
461
 
415
462
  let projectSetup = 'new';
416
463
  if (!useScan && !assumeYes) {
417
- const modeAnswer = await prompts([
464
+ const modeAnswer = await askQuestions([
418
465
  {
419
466
  type: 'select',
420
467
  name: 'project_setup',
@@ -446,10 +493,10 @@ async function main() {
446
493
  }
447
494
 
448
495
  if (fs.existsSync(path.join(targetDir, 'PROJECT_CONTEXT.md')) && !assumeYes) {
449
- const res = await prompts({
496
+ const res = await askQuestions({
450
497
  type: 'confirm',
451
498
  name: 'overwrite',
452
- message: 'PROJECT_CONTEXT.md already exists in this folder. Overwrite?',
499
+ message: 'PROJECT_CONTEXT.md already exists in this folder. Overwrite?',
453
500
  initial: false
454
501
  });
455
502
  if (!res.overwrite) {
@@ -465,7 +512,7 @@ async function main() {
465
512
  console.log(` ${pc.bold('Detected infra:')} ${scanned.infrastructure.join(', ') || 'none'}\n`);
466
513
  }
467
514
 
468
- const { project_name, description, project_type } = await prompts([
515
+ const { project_name, description, project_type } = await askQuestions([
469
516
  { type: assumeYes ? null : 'text', name: 'project_name', message: 'Project name:', initial: scanned?.project_name || path.basename(targetDir) },
470
517
  { type: assumeYes ? null : 'text', name: 'description', message: 'Short description:', initial: scanned?.description || 'A software project' },
471
518
  {
@@ -475,7 +522,7 @@ async function main() {
475
522
  }
476
523
  ]);
477
524
 
478
- const { primary_language } = await prompts({
525
+ const { primary_language } = await askQuestions({
479
526
  type: assumeYes ? null : 'select',
480
527
  name: 'primary_language',
481
528
  message: 'Primary language:',
@@ -483,7 +530,7 @@ async function main() {
483
530
  initial: Math.max(LANGUAGE_CHOICES.indexOf(scanned?.primary_language || 'typescript'), 0)
484
531
  });
485
532
 
486
- const { frameworks } = await prompts({
533
+ const { frameworks } = await askQuestions({
487
534
  type: assumeYes ? null : 'multiselect',
488
535
  name: 'frameworks',
489
536
  message: 'Frameworks (Space to select, Enter to confirm):',
@@ -491,7 +538,7 @@ async function main() {
491
538
  min: 0
492
539
  });
493
540
 
494
- const dbAndInfra = await prompts([
541
+ const dbAndInfra = await askQuestions([
495
542
  {
496
543
  type: assumeYes ? null : 'select', name: 'database', message: 'Database / ORM:',
497
544
  choices: DATABASE_CHOICES.map(d => ({ title: d, value: d })),
@@ -505,7 +552,7 @@ async function main() {
505
552
  }
506
553
  ]);
507
554
 
508
- const { package_manager, test_framework, max_file_lines } = await prompts([
555
+ const { package_manager, test_framework, max_file_lines } = await askQuestions([
509
556
  {
510
557
  type: assumeYes ? null : 'select', name: 'package_manager', message: 'Package Manager:',
511
558
  choices: PACKAGE_MANAGER_CHOICES.map(p => ({ title: p, value: p })),
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "thachvd-kit",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Universal Agent Kit for Antigravity, Claude Code, and OpenCode",
5
- "main": "index.js",
6
5
  "bin": {
7
6
  "thachvd-kit": "./bin/cli.js"
8
7
  },
@@ -23,14 +22,17 @@
23
22
  "node": ">=16.7"
24
23
  },
25
24
  "scripts": {
26
- "test": "echo \"Error: no test specified\" && exit 1"
25
+ "test": "echo \"Error: no test specified\" && exit 1",
26
+ "release:patch": "npm version patch",
27
+ "release:dry-run": "npm pack --dry-run",
28
+ "release:publish": "npm publish"
27
29
  },
28
- "keywords": [
29
- "ai",
30
- "agent",
31
- "claude",
32
- "antigravity",
33
- "codex"
30
+ "keywords": [
31
+ "ai",
32
+ "agent",
33
+ "claude",
34
+ "antigravity",
35
+ "codex"
34
36
  ],
35
37
  "author": "thachvd",
36
38
  "license": "MIT",