wogiflow 1.0.22 → 1.0.23
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 +65 -3
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Runs after npm install to:
|
|
7
7
|
* 1. Create minimal directory structure
|
|
8
|
-
* 2.
|
|
9
|
-
* 3.
|
|
8
|
+
* 2. Copy .claude/commands/ (slash commands) - ESSENTIAL for immediate use
|
|
9
|
+
* 3. Create pending-setup.json marker for AI to detect
|
|
10
|
+
* 4. Print instructions to start AI assistant
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
+
* Full setup (config, skills, etc.) is done by the AI via /wogi-init command.
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
const fs = require('fs');
|
|
@@ -17,6 +18,9 @@ const path = require('path');
|
|
|
17
18
|
// Get project root (where npm install was run, not node_modules/wogiflow)
|
|
18
19
|
const PROJECT_ROOT = process.env.INIT_CWD || process.cwd();
|
|
19
20
|
|
|
21
|
+
// Package root (where wogiflow is installed in node_modules)
|
|
22
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
23
|
+
|
|
20
24
|
// Directory structure (relative to project root)
|
|
21
25
|
const WORKFLOW_DIR = path.join(PROJECT_ROOT, '.workflow');
|
|
22
26
|
const STATE_DIR = path.join(WORKFLOW_DIR, 'state');
|
|
@@ -93,6 +97,60 @@ function createPendingSetupMarker() {
|
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Recursively copy a directory
|
|
102
|
+
* @param {string} src - Source directory
|
|
103
|
+
* @param {string} dest - Destination directory
|
|
104
|
+
*/
|
|
105
|
+
function copyDir(src, dest) {
|
|
106
|
+
fs.mkdirSync(dest, { recursive: true, mode: DIR_MODE });
|
|
107
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
108
|
+
|
|
109
|
+
for (const entry of entries) {
|
|
110
|
+
const srcPath = path.join(src, entry.name);
|
|
111
|
+
const destPath = path.join(dest, entry.name);
|
|
112
|
+
|
|
113
|
+
if (entry.isDirectory()) {
|
|
114
|
+
copyDir(srcPath, destPath);
|
|
115
|
+
} else {
|
|
116
|
+
fs.copyFileSync(srcPath, destPath);
|
|
117
|
+
fs.chmodSync(destPath, FILE_MODE);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Copy essential .claude/ resources from package to project
|
|
124
|
+
* This ensures commands are available immediately after npm install
|
|
125
|
+
*/
|
|
126
|
+
function copyClaudeResources() {
|
|
127
|
+
const claudeDir = path.join(PROJECT_ROOT, '.claude');
|
|
128
|
+
fs.mkdirSync(claudeDir, { recursive: true, mode: DIR_MODE });
|
|
129
|
+
|
|
130
|
+
// Copy commands (essential for slash commands to work)
|
|
131
|
+
const packageCommands = path.join(PACKAGE_ROOT, '.claude', 'commands');
|
|
132
|
+
const projectCommands = path.join(claudeDir, 'commands');
|
|
133
|
+
if (fs.existsSync(packageCommands) && !fs.existsSync(projectCommands)) {
|
|
134
|
+
copyDir(packageCommands, projectCommands);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Copy docs (knowledge base)
|
|
138
|
+
const packageDocs = path.join(PACKAGE_ROOT, '.claude', 'docs');
|
|
139
|
+
const projectDocs = path.join(claudeDir, 'docs');
|
|
140
|
+
if (fs.existsSync(packageDocs) && !fs.existsSync(projectDocs)) {
|
|
141
|
+
copyDir(packageDocs, projectDocs);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Copy rules (coding patterns)
|
|
145
|
+
const packageRules = path.join(PACKAGE_ROOT, '.claude', 'rules');
|
|
146
|
+
const projectRules = path.join(claudeDir, 'rules');
|
|
147
|
+
if (fs.existsSync(packageRules) && !fs.existsSync(projectRules)) {
|
|
148
|
+
copyDir(packageRules, projectRules);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Note: skills/ is NOT copied here - /wogi-init will set up project-specific skills
|
|
152
|
+
}
|
|
153
|
+
|
|
96
154
|
/**
|
|
97
155
|
* Check if we should be completely silent (CI only)
|
|
98
156
|
*/
|
|
@@ -116,6 +174,10 @@ function main() {
|
|
|
116
174
|
// Always create minimal structure first
|
|
117
175
|
createMinimalStructure();
|
|
118
176
|
|
|
177
|
+
// Copy essential .claude/ resources (commands, docs, rules)
|
|
178
|
+
// This ensures slash commands are available immediately
|
|
179
|
+
copyClaudeResources();
|
|
180
|
+
|
|
119
181
|
// Create marker for AI to detect (unless already initialized)
|
|
120
182
|
createPendingSetupMarker();
|
|
121
183
|
|