wogiflow 1.0.36 → 1.0.37
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 +1 -1
- package/scripts/postinstall.js +42 -2
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* Runs after npm install to:
|
|
7
7
|
* 1. Create minimal directory structure
|
|
8
8
|
* 2. Copy .claude/commands/ (slash commands) - ESSENTIAL for immediate use
|
|
9
|
-
* 3.
|
|
10
|
-
* 4.
|
|
9
|
+
* 3. Copy scripts/ (workflow scripts) - ensures scripts are updated on npm update
|
|
10
|
+
* 4. Create pending-setup.json marker for AI to detect
|
|
11
|
+
* 5. Print instructions to start AI assistant
|
|
11
12
|
*
|
|
12
13
|
* Full setup (config, skills, etc.) is done by the AI via /wogi-init command.
|
|
13
14
|
*/
|
|
@@ -192,6 +193,41 @@ function copyClaudeResources() {
|
|
|
192
193
|
// Note: skills/ is NOT copied here - /wogi-init will set up project-specific skills
|
|
193
194
|
}
|
|
194
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Copy scripts from package to project (for npm update scenario)
|
|
198
|
+
* This ensures scripts are updated on npm install/update
|
|
199
|
+
*
|
|
200
|
+
* Uses merge mode: new scripts are added, existing ones are NOT overwritten
|
|
201
|
+
* This preserves user customizations while ensuring new scripts are available
|
|
202
|
+
*/
|
|
203
|
+
function copyScriptsFromPackage() {
|
|
204
|
+
const packageScripts = path.join(PACKAGE_ROOT, 'scripts');
|
|
205
|
+
const projectScripts = path.join(PROJECT_ROOT, 'scripts');
|
|
206
|
+
|
|
207
|
+
if (!fs.existsSync(packageScripts)) {
|
|
208
|
+
if (process.env.DEBUG) {
|
|
209
|
+
console.error('[postinstall] Package scripts not found');
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Use merge mode to add new scripts without overwriting customizations
|
|
215
|
+
const alreadyExists = fs.existsSync(projectScripts);
|
|
216
|
+
copyDir(packageScripts, projectScripts, alreadyExists);
|
|
217
|
+
|
|
218
|
+
// Make flow script executable
|
|
219
|
+
const flowScript = path.join(projectScripts, 'flow');
|
|
220
|
+
if (fs.existsSync(flowScript)) {
|
|
221
|
+
try {
|
|
222
|
+
fs.chmodSync(flowScript, 0o755);
|
|
223
|
+
} catch (err) {
|
|
224
|
+
if (process.env.DEBUG) {
|
|
225
|
+
console.error(`[postinstall] chmod flow script failed: ${err.message}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
195
231
|
/**
|
|
196
232
|
* Check if we should be completely silent (CI only)
|
|
197
233
|
*/
|
|
@@ -219,6 +255,10 @@ function main() {
|
|
|
219
255
|
// This ensures slash commands are available immediately
|
|
220
256
|
copyClaudeResources();
|
|
221
257
|
|
|
258
|
+
// Copy scripts (for npm update scenario)
|
|
259
|
+
// This ensures scripts are updated when running npm install/update
|
|
260
|
+
copyScriptsFromPackage();
|
|
261
|
+
|
|
222
262
|
// Create marker for AI to detect (unless already initialized)
|
|
223
263
|
createPendingSetupMarker();
|
|
224
264
|
|