vibe-validate 0.17.0-rc.12 → 0.17.0-rc.13

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 (3) hide show
  1. package/bin/vibe-validate +9 -147
  2. package/bin/vv +9 -147
  3. package/package.json +11 -2
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-rc.12",
3
+ "version": "0.17.0-rc.13",
4
4
  "description": "Git-aware validation orchestration for vibe coding (LLM-assisted development) - umbrella package",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,6 +48,15 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@vibe-validate/cli": "0.17.0-rc.12"
51
+ "@vibe-validate/cli": "0.17.0-rc.13"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^20.14.8",
55
+ "typescript": "^5.5.2",
56
+ "vitest": "^2.0.5"
57
+ },
58
+ "scripts": {
59
+ "test": "vitest run",
60
+ "lint": "echo 'No linting needed for delegation wrappers'"
52
61
  }
53
62
  }