@house365/comate 0.9.6 → 0.9.7

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.
Files changed (2) hide show
  1. package/bin/init.mjs +32 -11
  2. package/package.json +1 -1
package/bin/init.mjs CHANGED
@@ -256,9 +256,9 @@ function pruneDeprecatedSkills(
256
256
  return removed;
257
257
  }
258
258
 
259
- // True only when the pinned `skills` dependency resolves locally. A postinstall
260
- // must never reach the network, so this gates syncComateSkills: if resolution
261
- // fails we skip rather than let skillsInvocation fall back to `npx skills@latest`.
259
+ // True only when the pinned `skills` dependency resolves locally. This keeps a
260
+ // postinstall from downloading an arbitrary CLI through the npx fallback. The
261
+ // CLI may still fetch declared skill sources such as obra/superpowers.
262
262
  function skillsResolvesLocally(pkgRoot) {
263
263
  try {
264
264
  createRequire(join(pkgRoot, 'package.json')).resolve('skills/package.json');
@@ -268,19 +268,40 @@ function skillsResolvesLocally(pkgRoot) {
268
268
  }
269
269
  }
270
270
 
271
- // Copy comate's own skills into ~/.agents/skills via the bundled skills CLI —
272
- // the exact command `comate init` runs, so the layout is identical. Local-only:
273
- // skips (never goes to network) when the skills dep can't be resolved, leaving
274
- // `comate init` as the fallback. Returns { ok, skipped }.
275
- function syncComateSkills(pkgRoot, { home = process.env.HOME ?? process.env.USERPROFILE ?? '', runner = run } = {}) {
271
+ // Install the user-level skills needed by comate via the bundled skills CLI.
272
+ // Superpowers is fetched only when its marker is absent; comate's bundled skills
273
+ // are always refreshed on npm upgrades. `comate init` remains the diagnostic
274
+ // fallback when this best-effort postinstall sync cannot complete.
275
+ function syncComateSkills(
276
+ pkgRoot,
277
+ {
278
+ home = process.env.HOME ?? process.env.USERPROFILE ?? '',
279
+ runner = run,
280
+ exists = existsSync,
281
+ } = {},
282
+ ) {
276
283
  if (!skillsResolvesLocally(pkgRoot)) return { ok: false, skipped: 'no-local-cli' };
277
- const r = runner(
284
+
285
+ const superpowersMarker = join(home, '.agents', 'skills', 'using-superpowers', 'SKILL.md');
286
+ let superpowers = { ok: true };
287
+ if (!exists(superpowersMarker)) {
288
+ superpowers = runner(
289
+ skillsInvocation(pkgRoot, ['add', 'obra/superpowers', '-g', '-y']),
290
+ SKILLS_TIMEOUT_MS,
291
+ { quiet: true },
292
+ );
293
+ }
294
+
295
+ const comate = runner(
278
296
  skillsInvocation(pkgRoot, ['add', pkgRoot, '--skill', '*', '-g', '-y']),
279
297
  SKILLS_TIMEOUT_MS,
280
298
  { quiet: true },
281
299
  );
282
- const landed = existsSync(join(home, '.agents', 'skills', 'comate', 'SKILL.md'));
283
- return { ok: r.ok && landed, skipped: null };
300
+ const comateMarker = join(home, '.agents', 'skills', 'comate', 'SKILL.md');
301
+ return {
302
+ ok: superpowers.ok && exists(superpowersMarker) && comate.ok && exists(comateMarker),
303
+ skipped: null,
304
+ };
284
305
  }
285
306
 
286
307
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@house365/comate",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "comate —— SDD (规约驱动开发) 的 AI 开发编排器(Agent Skills)",
5
5
  "type": "module",
6
6
  "license": "MIT",