bobs-workshop 3.1.6 → 3.1.7
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/package.json +2 -1
- package/postinstall.js +91 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bobs-workshop",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.7",
|
|
4
4
|
"description": "MANUAL-driven development with background agents for OpenCode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugins/bobs-workshop.js",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@opencode-ai/plugin": "^1.1.36",
|
|
31
|
+
"bobs-workshop": "^3.1.6",
|
|
31
32
|
"jsonc-parser": "^3.2.1",
|
|
32
33
|
"skills": "^1.3.1"
|
|
33
34
|
},
|
package/postinstall.js
CHANGED
|
@@ -16,19 +16,50 @@ const PACKAGE_NAME = 'bobs-workshop';
|
|
|
16
16
|
* Skip when: global npm update, or running from within bobs-workshop repo itself.
|
|
17
17
|
*/
|
|
18
18
|
function isInstalledAsDependencyInThisRepo() {
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
// Try multiple methods to detect if we're in a dependent project
|
|
20
|
+
|
|
21
|
+
// Method 1: INIT_CWD (set by npm during install)
|
|
22
|
+
const cwdCandidates = [
|
|
23
|
+
process.env.INIT_CWD,
|
|
24
|
+
process.env.npm_config_local_prefix,
|
|
25
|
+
].filter(Boolean);
|
|
26
|
+
|
|
27
|
+
for (const projectRoot of cwdCandidates) {
|
|
28
|
+
const pkgPath = join(projectRoot, 'package.json');
|
|
29
|
+
if (existsSync(pkgPath)) {
|
|
30
|
+
try {
|
|
31
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
32
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
33
|
+
if (typeof deps[PACKAGE_NAME] === 'string') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
|
|
42
|
+
// Method 2: Check parent directories for node_modules/bobs-workshop
|
|
43
|
+
let currentDir = dirname(__dirname);
|
|
44
|
+
for (let i = 0; i < 5; i++) { // Check up to 5 levels up
|
|
45
|
+
const pkgPath = join(currentDir, 'package.json');
|
|
46
|
+
if (existsSync(pkgPath)) {
|
|
47
|
+
try {
|
|
48
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
49
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
50
|
+
if (typeof deps[PACKAGE_NAME] === 'string') {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
// Continue to parent
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const parentDir = dirname(currentDir);
|
|
58
|
+
if (parentDir === currentDir) break;
|
|
59
|
+
currentDir = parentDir;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return false;
|
|
32
63
|
}
|
|
33
64
|
|
|
34
65
|
function checkConflicts(opencodeDir) {
|
|
@@ -65,13 +96,56 @@ function checkConflicts(opencodeDir) {
|
|
|
65
96
|
return conflicts;
|
|
66
97
|
}
|
|
67
98
|
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
99
|
+
function findProjectRoot() {
|
|
100
|
+
// Try INIT_CWD first
|
|
101
|
+
if (process.env.INIT_CWD) {
|
|
102
|
+
const pkgPath = join(process.env.INIT_CWD, 'package.json');
|
|
103
|
+
if (existsSync(pkgPath)) {
|
|
104
|
+
try {
|
|
105
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
106
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
107
|
+
if (typeof deps[PACKAGE_NAME] === 'string') {
|
|
108
|
+
return process.env.INIT_CWD;
|
|
109
|
+
}
|
|
110
|
+
} catch {}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Try npm_config_local_prefix
|
|
115
|
+
if (process.env.npm_config_local_prefix) {
|
|
116
|
+
return process.env.npm_config_local_prefix;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Fallback: walk up from current location
|
|
120
|
+
let currentDir = dirname(__dirname);
|
|
121
|
+
for (let i = 0; i < 5; i++) {
|
|
122
|
+
const pkgPath = join(currentDir, 'package.json');
|
|
123
|
+
if (existsSync(pkgPath)) {
|
|
124
|
+
try {
|
|
125
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
126
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
127
|
+
if (typeof deps[PACKAGE_NAME] === 'string') {
|
|
128
|
+
return currentDir;
|
|
129
|
+
}
|
|
130
|
+
} catch {}
|
|
131
|
+
}
|
|
132
|
+
const parentDir = dirname(currentDir);
|
|
133
|
+
if (parentDir === currentDir) break;
|
|
134
|
+
currentDir = parentDir;
|
|
71
135
|
}
|
|
136
|
+
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
72
139
|
|
|
73
|
-
|
|
74
|
-
const projectRoot =
|
|
140
|
+
function postinstall() {
|
|
141
|
+
const projectRoot = findProjectRoot();
|
|
142
|
+
|
|
143
|
+
if (!projectRoot) {
|
|
144
|
+
console.log('⚠️ bobs-workshop: Could not detect project root. Skipping installation.');
|
|
145
|
+
console.log(' This is normal if installing globally or in a monorepo.');
|
|
146
|
+
console.log(' To manually install, run: npx bobs-workshop install');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
75
149
|
const opencodeDir = join(projectRoot, '.opencode');
|
|
76
150
|
|
|
77
151
|
console.log('🔧 Installing bobs-workshop...');
|