thachvd-kit 1.0.2 → 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 +25 -8
  2. package/package.json +5 -2
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();
@@ -94,6 +95,7 @@ function printHelp() {
94
95
  console.log(`
95
96
  ${pc.bold('Usage:')}
96
97
  thachvd-kit init [--scan] [--yes]
98
+ thachvd-kit --version
97
99
  thachvd-kit --help
98
100
 
99
101
  ${pc.bold('Commands:')}
@@ -102,10 +104,20 @@ ${pc.bold('Commands:')}
102
104
  ${pc.bold('Options:')}
103
105
  --scan Scan the current project to prefill PROJECT_CONTEXT.md
104
106
  --yes Use detected/default values without prompting
107
+ --version Show the installed CLI version
105
108
  --help Show this help message
106
109
  `);
107
110
  }
108
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
+
109
121
  function fileExists(...parts) {
110
122
  return fs.existsSync(path.join(targetDir, ...parts));
111
123
  }
@@ -423,6 +435,11 @@ async function main() {
423
435
  const command = rawArgs[0] && !rawArgs[0].startsWith('-') ? rawArgs[0] : 'init';
424
436
  const args = command === 'init' ? rawArgs.slice(rawArgs[0] === 'init' ? 1 : 0) : rawArgs.slice(1);
425
437
 
438
+ if (rawArgs.includes('--version') || rawArgs.includes('-v')) {
439
+ console.log(packageJson.version);
440
+ return;
441
+ }
442
+
426
443
  if (rawArgs.includes('--help') || rawArgs.includes('-h')) {
427
444
  printHelp();
428
445
  return;
@@ -444,7 +461,7 @@ async function main() {
444
461
 
445
462
  let projectSetup = 'new';
446
463
  if (!useScan && !assumeYes) {
447
- const modeAnswer = await prompts([
464
+ const modeAnswer = await askQuestions([
448
465
  {
449
466
  type: 'select',
450
467
  name: 'project_setup',
@@ -476,10 +493,10 @@ async function main() {
476
493
  }
477
494
 
478
495
  if (fs.existsSync(path.join(targetDir, 'PROJECT_CONTEXT.md')) && !assumeYes) {
479
- const res = await prompts({
496
+ const res = await askQuestions({
480
497
  type: 'confirm',
481
498
  name: 'overwrite',
482
- message: 'PROJECT_CONTEXT.md already exists in this folder. Overwrite?',
499
+ message: 'PROJECT_CONTEXT.md already exists in this folder. Overwrite?',
483
500
  initial: false
484
501
  });
485
502
  if (!res.overwrite) {
@@ -495,7 +512,7 @@ async function main() {
495
512
  console.log(` ${pc.bold('Detected infra:')} ${scanned.infrastructure.join(', ') || 'none'}\n`);
496
513
  }
497
514
 
498
- const { project_name, description, project_type } = await prompts([
515
+ const { project_name, description, project_type } = await askQuestions([
499
516
  { type: assumeYes ? null : 'text', name: 'project_name', message: 'Project name:', initial: scanned?.project_name || path.basename(targetDir) },
500
517
  { type: assumeYes ? null : 'text', name: 'description', message: 'Short description:', initial: scanned?.description || 'A software project' },
501
518
  {
@@ -505,7 +522,7 @@ async function main() {
505
522
  }
506
523
  ]);
507
524
 
508
- const { primary_language } = await prompts({
525
+ const { primary_language } = await askQuestions({
509
526
  type: assumeYes ? null : 'select',
510
527
  name: 'primary_language',
511
528
  message: 'Primary language:',
@@ -513,7 +530,7 @@ async function main() {
513
530
  initial: Math.max(LANGUAGE_CHOICES.indexOf(scanned?.primary_language || 'typescript'), 0)
514
531
  });
515
532
 
516
- const { frameworks } = await prompts({
533
+ const { frameworks } = await askQuestions({
517
534
  type: assumeYes ? null : 'multiselect',
518
535
  name: 'frameworks',
519
536
  message: 'Frameworks (Space to select, Enter to confirm):',
@@ -521,7 +538,7 @@ async function main() {
521
538
  min: 0
522
539
  });
523
540
 
524
- const dbAndInfra = await prompts([
541
+ const dbAndInfra = await askQuestions([
525
542
  {
526
543
  type: assumeYes ? null : 'select', name: 'database', message: 'Database / ORM:',
527
544
  choices: DATABASE_CHOICES.map(d => ({ title: d, value: d })),
@@ -535,7 +552,7 @@ async function main() {
535
552
  }
536
553
  ]);
537
554
 
538
- const { package_manager, test_framework, max_file_lines } = await prompts([
555
+ const { package_manager, test_framework, max_file_lines } = await askQuestions([
539
556
  {
540
557
  type: assumeYes ? null : 'select', name: 'package_manager', message: 'Package Manager:',
541
558
  choices: PACKAGE_MANAGER_CHOICES.map(p => ({ title: p, value: p })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thachvd-kit",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Universal Agent Kit for Antigravity, Claude Code, and OpenCode",
5
5
  "bin": {
6
6
  "thachvd-kit": "./bin/cli.js"
@@ -22,7 +22,10 @@
22
22
  "node": ">=16.7"
23
23
  },
24
24
  "scripts": {
25
- "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"
26
29
  },
27
30
  "keywords": [
28
31
  "ai",