vibe-validate 0.17.0-rc4 → 0.17.1-rc.2

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/bin/vibe-validate CHANGED
@@ -1,156 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Smart vibe-validate wrapper with context-aware execution
4
- *
5
- * Automatically detects execution context and delegates to appropriate binary:
6
- * - Developer mode: Inside vibe-validate repo → packages/cli/dist/bin.js (unpackaged dev build)
7
- * - Local install: Project has vibe-validate → node_modules version (packaged)
8
- * - Global install: Fallback → globally installed version (packaged)
9
- *
10
- * Works in both git and non-git directories. Non-git directories don't get
11
- * caching but still get error extraction.
3
+ * Thin wrapper that delegates to @vibe-validate/cli
4
+ * This ensures single source of truth for all wrapper logic.
12
5
  */
13
-
14
- import { existsSync } from 'fs';
15
- import { dirname, join } from 'path';
16
- import { spawnSync } from 'child_process';
17
6
  import { fileURLToPath } from 'url';
7
+ import { dirname, join } from 'path';
18
8
 
19
9
  const __filename = fileURLToPath(import.meta.url);
20
10
  const __dirname = dirname(__filename);
21
11
 
22
- /**
23
- * Find project root by walking up to .git directory
24
- * Falls back to startDir if no git repo found
25
- */
26
- function findProjectRoot(startDir) {
27
- let current = startDir;
28
-
29
- while (true) {
30
- const gitDir = join(current, '.git');
31
- if (existsSync(gitDir)) {
32
- return current; // Found git repo
33
- }
34
-
35
- const parent = dirname(current);
36
- if (parent === current) {
37
- // Reached filesystem root, no git found
38
- return startDir;
39
- }
40
- current = parent;
41
- }
42
- }
43
-
44
- /**
45
- * Check if we're in vibe-validate repo (developer mode)
46
- * Simple detection: both dist/vibe-validate and dist/bin.js must exist
47
- */
48
- function getDevModeBinary(projectRoot) {
49
- const wrapperPath = join(projectRoot, 'packages/cli/dist/vibe-validate');
50
- const binPath = join(projectRoot, 'packages/cli/dist/bin.js');
51
-
52
- // Both files must exist to confirm we're in vibe-validate repo
53
- if (existsSync(wrapperPath) && existsSync(binPath)) {
54
- return binPath;
55
- }
56
-
57
- return null;
58
- }
59
-
60
- /**
61
- * Find local vibe-validate installation in node_modules
62
- * Walks up directory tree from project root
63
- */
64
- function findLocalInstall(projectRoot) {
65
- let current = projectRoot;
66
-
67
- while (true) {
68
- const localBin = join(current, 'node_modules/@vibe-validate/cli/dist/bin.js');
69
- if (existsSync(localBin)) {
70
- return localBin;
71
- }
72
-
73
- const parent = dirname(current);
74
- if (parent === current) {
75
- // Reached filesystem root
76
- break;
77
- }
78
- current = parent;
79
- }
80
-
81
- return null;
82
- }
83
-
84
- /**
85
- * Find CLI package relative to umbrella package installation
86
- * Used when umbrella package is installed (locally or globally)
87
- */
88
- function findCliInUmbrellaPackage() {
89
- // When this wrapper is in umbrella package, CLI is in node_modules
90
- // __dirname is .../vibe-validate/bin
91
- const umbrellaRoot = dirname(__dirname);
92
- const cliBin = join(umbrellaRoot, 'node_modules/@vibe-validate/cli/dist/bin.js');
93
-
94
- if (existsSync(cliBin)) {
95
- return cliBin;
96
- }
97
-
98
- return null;
99
- }
100
-
101
- /**
102
- * Main entry point - detects context and executes appropriate binary
103
- */
104
- function main() {
105
- const cwd = process.cwd();
106
- const args = process.argv.slice(2);
107
-
108
- // Find project root (where .git is, or cwd if no git)
109
- const projectRoot = findProjectRoot(cwd);
110
-
111
- let binPath;
112
- let context;
113
-
114
- // Priority 1: Check for developer mode (inside vibe-validate repo)
115
- const devBin = getDevModeBinary(projectRoot);
116
- if (devBin) {
117
- binPath = devBin;
118
- context = 'dev';
119
- }
120
- // Priority 2: Check for local install (node_modules)
121
- else {
122
- const localBin = findLocalInstall(projectRoot);
123
- if (localBin) {
124
- binPath = localBin;
125
- context = 'local';
126
- }
127
- // Priority 3: Check if CLI is in umbrella package (global or local umbrella install)
128
- else {
129
- const umbrellaCliBin = findCliInUmbrellaPackage();
130
- if (umbrellaCliBin) {
131
- binPath = umbrellaCliBin;
132
- context = 'umbrella';
133
- }
134
- // Priority 4: Try relative path (CLI package structure)
135
- else {
136
- binPath = join(__dirname, '../dist/bin.js');
137
- context = 'direct';
138
- }
139
- }
140
- }
141
-
142
- // Execute the binary with all arguments
143
- const result = spawnSync(process.execPath, [binPath, ...args], {
144
- stdio: 'inherit',
145
- env: {
146
- ...process.env,
147
- VV_CONTEXT: context, // Pass context for debugging (optional)
148
- }
149
- });
150
-
151
- // Exit with same code as child process
152
- process.exit(result.status ?? 1);
153
- }
12
+ // Resolve the CLI package's wrapper script
13
+ // Go from: vibe-validate/bin/vibe-validate
14
+ // To: @vibe-validate/cli/dist/bin/vibe-validate.js
15
+ const cliWrapperPath = join(__dirname, '../node_modules/@vibe-validate/cli/dist/bin/vibe-validate.js');
154
16
 
155
- // Run main function
156
- main();
17
+ // Import and execute the CLI wrapper
18
+ await import(cliWrapperPath);
package/bin/vv CHANGED
@@ -1,156 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Smart vibe-validate wrapper with context-aware execution
4
- *
5
- * Automatically detects execution context and delegates to appropriate binary:
6
- * - Developer mode: Inside vibe-validate repo → packages/cli/dist/bin.js (unpackaged dev build)
7
- * - Local install: Project has vibe-validate → node_modules version (packaged)
8
- * - Global install: Fallback → globally installed version (packaged)
9
- *
10
- * Works in both git and non-git directories. Non-git directories don't get
11
- * caching but still get error extraction.
3
+ * Thin wrapper that delegates to @vibe-validate/cli
4
+ * This ensures single source of truth for all wrapper logic.
12
5
  */
13
-
14
- import { existsSync } from 'fs';
15
- import { dirname, join } from 'path';
16
- import { spawnSync } from 'child_process';
17
6
  import { fileURLToPath } from 'url';
7
+ import { dirname, join } from 'path';
18
8
 
19
9
  const __filename = fileURLToPath(import.meta.url);
20
10
  const __dirname = dirname(__filename);
21
11
 
22
- /**
23
- * Find project root by walking up to .git directory
24
- * Falls back to startDir if no git repo found
25
- */
26
- function findProjectRoot(startDir) {
27
- let current = startDir;
28
-
29
- while (true) {
30
- const gitDir = join(current, '.git');
31
- if (existsSync(gitDir)) {
32
- return current; // Found git repo
33
- }
34
-
35
- const parent = dirname(current);
36
- if (parent === current) {
37
- // Reached filesystem root, no git found
38
- return startDir;
39
- }
40
- current = parent;
41
- }
42
- }
43
-
44
- /**
45
- * Check if we're in vibe-validate repo (developer mode)
46
- * Simple detection: both dist/vibe-validate and dist/bin.js must exist
47
- */
48
- function getDevModeBinary(projectRoot) {
49
- const wrapperPath = join(projectRoot, 'packages/cli/dist/vibe-validate');
50
- const binPath = join(projectRoot, 'packages/cli/dist/bin.js');
51
-
52
- // Both files must exist to confirm we're in vibe-validate repo
53
- if (existsSync(wrapperPath) && existsSync(binPath)) {
54
- return binPath;
55
- }
56
-
57
- return null;
58
- }
59
-
60
- /**
61
- * Find local vibe-validate installation in node_modules
62
- * Walks up directory tree from project root
63
- */
64
- function findLocalInstall(projectRoot) {
65
- let current = projectRoot;
66
-
67
- while (true) {
68
- const localBin = join(current, 'node_modules/@vibe-validate/cli/dist/bin.js');
69
- if (existsSync(localBin)) {
70
- return localBin;
71
- }
72
-
73
- const parent = dirname(current);
74
- if (parent === current) {
75
- // Reached filesystem root
76
- break;
77
- }
78
- current = parent;
79
- }
80
-
81
- return null;
82
- }
83
-
84
- /**
85
- * Find CLI package relative to umbrella package installation
86
- * Used when umbrella package is installed (locally or globally)
87
- */
88
- function findCliInUmbrellaPackage() {
89
- // When this wrapper is in umbrella package, CLI is in node_modules
90
- // __dirname is .../vibe-validate/bin
91
- const umbrellaRoot = dirname(__dirname);
92
- const cliBin = join(umbrellaRoot, 'node_modules/@vibe-validate/cli/dist/bin.js');
93
-
94
- if (existsSync(cliBin)) {
95
- return cliBin;
96
- }
97
-
98
- return null;
99
- }
100
-
101
- /**
102
- * Main entry point - detects context and executes appropriate binary
103
- */
104
- function main() {
105
- const cwd = process.cwd();
106
- const args = process.argv.slice(2);
107
-
108
- // Find project root (where .git is, or cwd if no git)
109
- const projectRoot = findProjectRoot(cwd);
110
-
111
- let binPath;
112
- let context;
113
-
114
- // Priority 1: Check for developer mode (inside vibe-validate repo)
115
- const devBin = getDevModeBinary(projectRoot);
116
- if (devBin) {
117
- binPath = devBin;
118
- context = 'dev';
119
- }
120
- // Priority 2: Check for local install (node_modules)
121
- else {
122
- const localBin = findLocalInstall(projectRoot);
123
- if (localBin) {
124
- binPath = localBin;
125
- context = 'local';
126
- }
127
- // Priority 3: Check if CLI is in umbrella package (global or local umbrella install)
128
- else {
129
- const umbrellaCliBin = findCliInUmbrellaPackage();
130
- if (umbrellaCliBin) {
131
- binPath = umbrellaCliBin;
132
- context = 'umbrella';
133
- }
134
- // Priority 4: Try relative path (CLI package structure)
135
- else {
136
- binPath = join(__dirname, '../dist/bin.js');
137
- context = 'direct';
138
- }
139
- }
140
- }
141
-
142
- // Execute the binary with all arguments
143
- const result = spawnSync(process.execPath, [binPath, ...args], {
144
- stdio: 'inherit',
145
- env: {
146
- ...process.env,
147
- VV_CONTEXT: context, // Pass context for debugging (optional)
148
- }
149
- });
150
-
151
- // Exit with same code as child process
152
- process.exit(result.status ?? 1);
153
- }
12
+ // Resolve the CLI package's wrapper script
13
+ // Go from: vibe-validate/bin/vv
14
+ // To: @vibe-validate/cli/dist/bin/vv (which is really vibe-validate.js)
15
+ const cliWrapperPath = join(__dirname, '../node_modules/@vibe-validate/cli/dist/bin/vibe-validate.js');
154
16
 
155
- // Run main function
156
- main();
17
+ // Import and execute the CLI wrapper
18
+ await import(cliWrapperPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-validate",
3
- "version": "0.17.0-rc4",
3
+ "version": "0.17.1-rc.2",
4
4
  "description": "Git-aware validation orchestration for vibe coding (LLM-assisted development) - umbrella package",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,9 @@
8
8
  "vv": "./bin/vv"
9
9
  },
10
10
  "files": [
11
- "bin"
11
+ "bin",
12
+ "scripts",
13
+ "skill"
12
14
  ],
13
15
  "keywords": [
14
16
  "validation",
@@ -48,6 +50,16 @@
48
50
  "access": "public"
49
51
  },
50
52
  "dependencies": {
51
- "@vibe-validate/cli": "0.17.0-rc4"
53
+ "@vibe-validate/cli": "0.17.1-rc.2"
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": "^20.14.8",
57
+ "typescript": "^5.5.2",
58
+ "vitest": "^2.0.5"
59
+ },
60
+ "scripts": {
61
+ "test": "vitest run",
62
+ "lint": "echo 'No linting needed for delegation wrappers'",
63
+ "postinstall": "node scripts/install-skill.js"
52
64
  }
53
65
  }
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Install vibe-validate skill to ~/.claude/skills/vibe-validate
4
+ *
5
+ * This script runs after `npm install -g vibe-validate` to make the skill
6
+ * available to Claude Code globally.
7
+ */
8
+
9
+ import { copyFileSync, mkdirSync, existsSync, readdirSync, statSync, rmSync } from 'node:fs';
10
+ import { join, dirname } from 'node:path';
11
+ import { homedir } from 'node:os';
12
+ import { fileURLToPath } from 'node:url';
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = dirname(__filename);
16
+
17
+ // Determine skill source location
18
+ const PACKAGE_ROOT = join(__dirname, '..');
19
+ const SKILL_SOURCE = join(PACKAGE_ROOT, 'skill');
20
+
21
+ // Target location
22
+ const CLAUDE_SKILLS_DIR = join(homedir(), '.claude', 'skills', 'vibe-validate');
23
+
24
+ /**
25
+ * Recursively copy directory
26
+ */
27
+ function copyDirectory(src, dest) {
28
+ if (!existsSync(dest)) {
29
+ mkdirSync(dest, { recursive: true });
30
+ }
31
+
32
+ const entries = readdirSync(src);
33
+
34
+ for (const entry of entries) {
35
+ const srcPath = join(src, entry);
36
+ const destPath = join(dest, entry);
37
+
38
+ if (statSync(srcPath).isDirectory()) {
39
+ copyDirectory(srcPath, destPath);
40
+ } else {
41
+ copyFileSync(srcPath, destPath);
42
+ }
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Install skill
48
+ */
49
+ function installSkill() {
50
+ // Only install if skill source exists
51
+ if (!existsSync(SKILL_SOURCE)) {
52
+ console.log('⚠️ Skill source not found, skipping installation');
53
+ return;
54
+ }
55
+
56
+ // Only install for global installations
57
+ // Check if we're in node_modules (global or local)
58
+ const isGlobalInstall = __dirname.includes('/lib/node_modules/');
59
+
60
+ if (!isGlobalInstall) {
61
+ // Local project installation - skip skill install
62
+ return;
63
+ }
64
+
65
+ try {
66
+ console.log('📦 Installing vibe-validate skill to Claude Code...');
67
+
68
+ // Create ~/.claude/skills directory if needed
69
+ mkdirSync(dirname(CLAUDE_SKILLS_DIR), { recursive: true });
70
+
71
+ // Remove old installation if it exists (clean install)
72
+ if (existsSync(CLAUDE_SKILLS_DIR)) {
73
+ rmSync(CLAUDE_SKILLS_DIR, { recursive: true, force: true });
74
+ }
75
+
76
+ // Copy skill files
77
+ copyDirectory(SKILL_SOURCE, CLAUDE_SKILLS_DIR);
78
+
79
+ console.log(`✅ Skill installed to ${CLAUDE_SKILLS_DIR}`);
80
+ console.log(' Claude Code will automatically discover it on next launch');
81
+ } catch (error) {
82
+ console.error('⚠️ Failed to install skill:', error.message);
83
+ console.error(' You can manually copy docs/skill/ to ~/.claude/skills/vibe-validate');
84
+ }
85
+ }
86
+
87
+ // Run installation
88
+ installSkill();