@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.
- package/bin/init.mjs +32 -11
- 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.
|
|
260
|
-
//
|
|
261
|
-
//
|
|
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
|
-
//
|
|
272
|
-
//
|
|
273
|
-
//
|
|
274
|
-
//
|
|
275
|
-
function syncComateSkills(
|
|
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
|
-
|
|
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
|
|
283
|
-
return {
|
|
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 {
|