vibe-validate 0.15.0-rc.1 → 0.15.0-rc.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.
- package/bin/vibe-validate +156 -0
- package/bin/vv +156 -0
- package/package.json +9 -2
- package/dist/.gitkeep +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
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.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { existsSync } from 'fs';
|
|
15
|
+
import { dirname, join } from 'path';
|
|
16
|
+
import { spawnSync } from 'child_process';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = dirname(__filename);
|
|
21
|
+
|
|
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
|
+
}
|
|
154
|
+
|
|
155
|
+
// Run main function
|
|
156
|
+
main();
|
package/bin/vv
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
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.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { existsSync } from 'fs';
|
|
15
|
+
import { dirname, join } from 'path';
|
|
16
|
+
import { spawnSync } from 'child_process';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = dirname(__filename);
|
|
21
|
+
|
|
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
|
+
}
|
|
154
|
+
|
|
155
|
+
// Run main function
|
|
156
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibe-validate",
|
|
3
|
-
"version": "0.15.0-rc.
|
|
3
|
+
"version": "0.15.0-rc.3",
|
|
4
4
|
"description": "Git-aware validation orchestration for vibe coding (LLM-assisted development) - umbrella package",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vibe-validate": "./bin/vibe-validate",
|
|
8
|
+
"vv": "./bin/vv"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin"
|
|
12
|
+
],
|
|
6
13
|
"keywords": [
|
|
7
14
|
"validation",
|
|
8
15
|
"testing",
|
|
@@ -41,6 +48,6 @@
|
|
|
41
48
|
"access": "public"
|
|
42
49
|
},
|
|
43
50
|
"dependencies": {
|
|
44
|
-
"@vibe-validate/cli": "0.15.0-rc.
|
|
51
|
+
"@vibe-validate/cli": "0.15.0-rc.2"
|
|
45
52
|
}
|
|
46
53
|
}
|
package/dist/.gitkeep
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Meta-package - no build artifacts
|