@liangjie559567/ultrapower 5.4.4 → 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.4",
11
+ "version": "5.4.6",
12
12
  "source": {
13
13
  "source": "npm",
14
14
  "package": "@liangjie559567/ultrapower",
15
- "version": "5.4.4"
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.4",
4
+ "version": "5.4.6",
5
5
  "author": {
6
6
  "name": "liangjie559567"
7
7
  },
@@ -16,7 +16,5 @@
16
16
  "orchestration",
17
17
  "workflows",
18
18
  "ultrapower"
19
- ],
20
- "hooks": "./hooks/hooks.json",
21
- "agents": "./agents/"
19
+ ]
22
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liangjie559567/ultrapower",
3
- "version": "5.4.4",
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
@@ -235,10 +292,13 @@ function fixMissingPluginJson() {
235
292
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
236
293
  const version = pkg.version || '0.0.0';
237
294
 
238
- // Include metadata fields + explicit component path declarations.
239
- // Per official docs, paths must start with './' — auto-discovery constructs paths without
240
- // this prefix, causing Zod validation errors: "hooks: Invalid input, agents: Invalid input".
241
- // Declaring explicit paths prevents auto-discovery from taking over.
295
+ // Metadata-only plugin manifest. Per the Claude Code plugin schema:
296
+ // - hooks/hooks.json is auto-discovered from the hooks/ directory
297
+ // - agents/ directory is auto-discovered automatically
298
+ // - The 'hooks' field is only for ADDITIONAL hooks files (must end with .json)
299
+ // - The 'agents' field is only for ADDITIONAL individual agent .md files (must end with .md)
300
+ // Declaring hooks/agents directory paths here causes Zod validation failures because
301
+ // the schema expects .md files for agents and .json files for hooks, NOT directory paths.
242
302
  const pluginJson = {
243
303
  name: 'ultrapower',
244
304
  description: pkg.description || '',
@@ -248,22 +308,20 @@ function fixMissingPluginJson() {
248
308
  repository: pkg.repository?.url || pkg.repository || '',
249
309
  license: pkg.license || 'MIT',
250
310
  keywords: pkg.keywords || [],
251
- hooks: './hooks/hooks.json',
252
- agents: './agents/',
253
311
  };
254
312
  const pluginJsonStr = JSON.stringify(pluginJson, null, 2);
255
313
 
256
314
  // Detect cache entries that need repair:
257
- // - Missing hooks or agents fields (old clean format from v5.4.3)
258
- // - hooks/agents not declared as relative string paths starting with './'
259
- // - Old invalid inline object/array formats from v5.3.x
315
+ // - Old invalid inline object/array formats from v5.3.x (hooks as object, agents as array)
316
+ // - Old invalid path formats from v5.4.1-v5.4.4 (agents as directory path like './agents/')
317
+ // NOTE: Missing hooks/agents fields is NOT a problem — auto-discovery handles them.
260
318
  function needsRepair(jsonPath) {
261
319
  try {
262
320
  const content = JSON.parse(readFileSync(jsonPath, 'utf-8'));
263
- // hooks must be a string path starting with './'
264
- if (!content.hooks || typeof content.hooks !== 'string' || !content.hooks.startsWith('./')) return true;
265
- // agents must be a string path starting with './'
266
- if (!content.agents || typeof content.agents !== 'string' || !content.agents.startsWith('./')) return true;
321
+ // agents must NOT be a directory path (./agents/ fails r48() which requires .md files)
322
+ if (content.agents && (typeof content.agents !== 'string' || !content.agents.endsWith('.md'))) return true;
323
+ // hooks must NOT be an object/array (inline format is invalid; string path or absent is OK)
324
+ if (content.hooks && typeof content.hooks === 'object') return true;
267
325
  return false;
268
326
  } catch { return false; }
269
327
  }
@@ -272,11 +330,12 @@ function fixMissingPluginJson() {
272
330
  // Also overwrite if existing file has missing or incorrectly formatted component paths.
273
331
  const localPluginJsonDir = join(pluginRoot, '.claude-plugin');
274
332
  const localPluginJsonPath = join(localPluginJsonDir, 'plugin.json');
275
- if (!existsSync(localPluginJsonPath) || needsRepair(localPluginJsonPath)) {
276
- mkdirSync(localPluginJsonDir, { recursive: true });
277
- writeFileSync(localPluginJsonPath, pluginJsonStr);
278
- console.log('[OMC] Wrote .claude-plugin/plugin.json with correct component paths in install dir');
279
- }
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');
280
339
 
281
340
  // 2. Write directly to plugin cache (marketplace: omc, plugin: ultrapower)
282
341
  // Claude Code copies from npm-cache but skips hidden dirs, so we patch the cache directly.