@liangjie559567/ultrapower 5.4.5 → 5.4.6

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.
@@ -8,11 +8,11 @@
8
8
  {
9
9
  "name": "ultrapower",
10
10
  "description": "Disciplined multi-agent orchestration: workflow enforcement + parallel execution",
11
- "version": "5.4.5",
11
+ "version": "5.4.6",
12
12
  "source": {
13
13
  "source": "npm",
14
14
  "package": "@liangjie559567/ultrapower",
15
- "version": "5.4.5"
15
+ "version": "5.4.6"
16
16
  },
17
17
  "author": {
18
18
  "name": "liangjie559567"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ultrapower",
3
3
  "description": "Disciplined multi-agent orchestration: workflow enforcement + parallel execution. Combines superpowers' TDD/debugging discipline with OMC's multi-agent execution capabilities.",
4
- "version": "5.4.5",
4
+ "version": "5.4.6",
5
5
  "author": {
6
6
  "name": "liangjie559567"
7
7
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liangjie559567/ultrapower",
3
- "version": "5.4.5",
3
+ "version": "5.4.6",
4
4
  "description": "Disciplined multi-agent orchestration: workflow enforcement + parallel execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -223,6 +223,63 @@ function copyTemplatesToCache() {
223
223
 
224
224
  copyTemplatesToCache();
225
225
 
226
+ // Fix: Claude Code's _8Y() function uses a VERSION-AGNOSTIC npm-cache path:
227
+ // ~/.claude/plugins/cache/npm-cache/node_modules/@liangjie559567/ultrapower/
228
+ // If this dir was populated by an old bad install (v5.3.x with hooks/agents in plugin.json),
229
+ // ALL subsequent installs for ANY version reuse the stale cache without running npm install
230
+ // or postinstall — causing "hooks: Invalid input, agents: Invalid input" validation errors.
231
+ // This function proactively repairs the npm-cache plugin.json so the next install works.
232
+ function fixNpmCache() {
233
+ try {
234
+ const npmCacheDir = join(CLAUDE_DIR, 'plugins', 'cache', 'npm-cache', 'node_modules', '@liangjie559567', 'ultrapower');
235
+ if (!existsSync(npmCacheDir)) return;
236
+
237
+ const npmPluginJsonDir = join(npmCacheDir, '.claude-plugin');
238
+ const npmPluginJsonPath = join(npmPluginJsonDir, 'plugin.json');
239
+
240
+ // Read version from npm-cache's own package.json
241
+ let cacheVersion = '0.0.0';
242
+ try {
243
+ const cachePkg = JSON.parse(readFileSync(join(npmCacheDir, 'package.json'), 'utf-8'));
244
+ cacheVersion = cachePkg.version || cacheVersion;
245
+ } catch { /* use default */ }
246
+
247
+ // Detect if repair is needed: hooks as object/array OR agents as non-.md path
248
+ function cacheNeedsRepair() {
249
+ try {
250
+ const content = JSON.parse(readFileSync(npmPluginJsonPath, 'utf-8'));
251
+ if (content.agents && (typeof content.agents !== 'string' || !content.agents.endsWith('.md'))) return true;
252
+ if (content.hooks && typeof content.hooks === 'object') return true;
253
+ return false;
254
+ } catch (e) {
255
+ if (e.code === 'ENOENT') return false; // file absent is OK
256
+ return false;
257
+ }
258
+ }
259
+
260
+ if (!cacheNeedsRepair()) return;
261
+
262
+ // Build clean metadata-only plugin.json using the npm-cache's own version.
263
+ // Do NOT include hooks or agents fields — they cause Zod validation failures.
264
+ const cleanPluginJson = {
265
+ name: 'ultrapower',
266
+ description: 'Disciplined multi-agent orchestration: workflow enforcement + parallel execution',
267
+ version: cacheVersion,
268
+ homepage: 'https://github.com/liangjie559567/ultrapower#readme',
269
+ repository: 'git+https://github.com/liangjie559567/ultrapower.git',
270
+ license: 'MIT',
271
+ keywords: ['claude', 'claude-code', 'ai', 'agent', 'multi-agent', 'orchestration', 'omc'],
272
+ };
273
+ mkdirSync(npmPluginJsonDir, { recursive: true });
274
+ writeFileSync(npmPluginJsonPath, JSON.stringify(cleanPluginJson, null, 2));
275
+ console.log(`[OMC] Repaired stale npm-cache plugin.json (v${cacheVersion}) — old install had invalid hooks/agents fields`);
276
+ } catch (e) {
277
+ console.log('[OMC] Warning: Could not repair npm-cache plugin.json:', e.message);
278
+ }
279
+ }
280
+
281
+ fixNpmCache();
282
+
226
283
  // Fix: npm install strips hidden directories (starting with '.'), so .claude-plugin/plugin.json
227
284
  // is never extracted to the plugin cache. We recreate it directly in the plugin cache.
228
285
  // The postinstall script runs from the npm-cache node_modules dir, so we must target the
@@ -273,11 +330,12 @@ function fixMissingPluginJson() {
273
330
  // Also overwrite if existing file has missing or incorrectly formatted component paths.
274
331
  const localPluginJsonDir = join(pluginRoot, '.claude-plugin');
275
332
  const localPluginJsonPath = join(localPluginJsonDir, 'plugin.json');
276
- if (!existsSync(localPluginJsonPath) || needsRepair(localPluginJsonPath)) {
277
- mkdirSync(localPluginJsonDir, { recursive: true });
278
- writeFileSync(localPluginJsonPath, pluginJsonStr);
279
- console.log('[OMC] Wrote .claude-plugin/plugin.json with correct component paths in install dir');
280
- }
333
+ // Always write clean plugin.json to the install dir (npm-cache node_modules) unconditionally.
334
+ // This ensures the npm-cache always has a valid manifest after postinstall runs,
335
+ // so future installs that reuse the cache get correct data.
336
+ mkdirSync(localPluginJsonDir, { recursive: true });
337
+ writeFileSync(localPluginJsonPath, pluginJsonStr);
338
+ console.log('[OMC] Wrote .claude-plugin/plugin.json in install dir');
281
339
 
282
340
  // 2. Write directly to plugin cache (marketplace: omc, plugin: ultrapower)
283
341
  // Claude Code copies from npm-cache but skips hidden dirs, so we patch the cache directly.