wogiflow 1.0.36 → 1.0.38
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.
|
@@ -49,6 +49,17 @@ When compacting, the system automatically:
|
|
|
49
49
|
2. Stores summaries at multiple levels (root → sections → details)
|
|
50
50
|
3. Applies relevance decay to older items
|
|
51
51
|
4. Enables on-demand expansion when details are needed later
|
|
52
|
+
5. **Cleans up completed plan files** from `.claude/plans/`
|
|
53
|
+
|
|
54
|
+
### Plan File Cleanup
|
|
55
|
+
|
|
56
|
+
Compaction automatically cleans up plan files that appear to be complete:
|
|
57
|
+
- Plans with "Complete" in the title
|
|
58
|
+
- Plans containing "can be deleted"
|
|
59
|
+
- Plans with "all completed"
|
|
60
|
+
- Very short/empty plan files
|
|
61
|
+
|
|
62
|
+
This prevents stale plan files from accumulating and being shown after context restoration.
|
|
52
63
|
|
|
53
64
|
## Format for Context Summary
|
|
54
65
|
|
package/package.json
CHANGED
|
@@ -92,6 +92,65 @@ function checkPressure() {
|
|
|
92
92
|
return expander.checkContextPressure();
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Clean up completed plan files from .claude/plans/
|
|
97
|
+
* Plan files that are marked complete or empty are archived or deleted
|
|
98
|
+
* @returns {Object} Cleanup result
|
|
99
|
+
*/
|
|
100
|
+
function cleanupPlanFiles() {
|
|
101
|
+
const fs = require('fs');
|
|
102
|
+
const path = require('path');
|
|
103
|
+
const os = require('os');
|
|
104
|
+
|
|
105
|
+
const result = { cleaned: 0, archived: 0, files: [] };
|
|
106
|
+
|
|
107
|
+
// Get user's home directory and .claude/plans path
|
|
108
|
+
const homeDir = os.homedir();
|
|
109
|
+
const plansDir = path.join(homeDir, '.claude', 'plans');
|
|
110
|
+
|
|
111
|
+
if (!fs.existsSync(plansDir)) {
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
const files = fs.readdirSync(plansDir);
|
|
117
|
+
|
|
118
|
+
for (const file of files) {
|
|
119
|
+
if (!file.endsWith('.md')) continue;
|
|
120
|
+
|
|
121
|
+
const filePath = path.join(plansDir, file);
|
|
122
|
+
let content;
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
content = fs.readFileSync(filePath, 'utf-8');
|
|
126
|
+
} catch (err) {
|
|
127
|
+
continue; // Skip files we can't read
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Check if plan appears to be complete
|
|
131
|
+
const isComplete =
|
|
132
|
+
/^#\s*Plan:\s*Complete/im.test(content) ||
|
|
133
|
+
/can be deleted/i.test(content) ||
|
|
134
|
+
/all.*completed/i.test(content) ||
|
|
135
|
+
content.trim().length < 100; // Very short/empty plans
|
|
136
|
+
|
|
137
|
+
if (isComplete) {
|
|
138
|
+
try {
|
|
139
|
+
fs.unlinkSync(filePath);
|
|
140
|
+
result.cleaned++;
|
|
141
|
+
result.files.push(file);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
// Couldn't delete - that's okay
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} catch (err) {
|
|
148
|
+
// Error reading plans directory - non-critical
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
|
|
95
154
|
/**
|
|
96
155
|
* Compact the context (collapse all expansions, optionally prune tree)
|
|
97
156
|
* @param {Object} options - Compaction options
|
|
@@ -100,6 +159,9 @@ function checkPressure() {
|
|
|
100
159
|
function compact(options = {}) {
|
|
101
160
|
const { pruneOldNodes = false, maxAge = 7 } = options;
|
|
102
161
|
|
|
162
|
+
// Clean up completed plan files
|
|
163
|
+
const planCleanup = cleanupPlanFiles();
|
|
164
|
+
|
|
103
165
|
// Collapse all expansions
|
|
104
166
|
const collapseResult = expander.collapseAll();
|
|
105
167
|
|
|
@@ -140,6 +202,7 @@ function compact(options = {}) {
|
|
|
140
202
|
return {
|
|
141
203
|
collapsed: collapseResult.count,
|
|
142
204
|
pruned: pruneResult.pruned,
|
|
205
|
+
plansCleaned: planCleanup.cleaned,
|
|
143
206
|
pressure: checkPressure()
|
|
144
207
|
};
|
|
145
208
|
}
|
|
@@ -218,6 +281,7 @@ module.exports = {
|
|
|
218
281
|
getStats,
|
|
219
282
|
clearAll,
|
|
220
283
|
getSerializedTree,
|
|
284
|
+
cleanupPlanFiles,
|
|
221
285
|
|
|
222
286
|
// Low-level modules
|
|
223
287
|
summaryTree,
|
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
|
|