skillmds 1.3.0 → 1.3.1
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/dist/cli.js +29 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -685,6 +685,10 @@ async function installClaudePlugin(owner, slug, deps = {}) {
|
|
|
685
685
|
} catch (e) {
|
|
686
686
|
return { ok: false, reason: `could not add the SkillMD marketplace: ${msg(e)}` };
|
|
687
687
|
}
|
|
688
|
+
try {
|
|
689
|
+
await sh("claude", ["plugin", "marketplace", "update", MARKETPLACE_NAME]);
|
|
690
|
+
} catch {
|
|
691
|
+
}
|
|
688
692
|
let out;
|
|
689
693
|
try {
|
|
690
694
|
const r = await sh("claude", ["plugin", "install", qualified]);
|
|
@@ -1169,8 +1173,9 @@ async function tryPluginInstall(arg, flags) {
|
|
|
1169
1173
|
if (flags.agent?.length || flags.skill?.length || flags.list || flags.mode === "copy") return null;
|
|
1170
1174
|
if (!await claudeCliAvailable()) return null;
|
|
1171
1175
|
const res = await installClaudePlugin(spec.owner, spec.slug);
|
|
1172
|
-
if (!res.ok) return
|
|
1176
|
+
if (!res.ok) return { ok: false, reason: res.reason };
|
|
1173
1177
|
return {
|
|
1178
|
+
ok: true,
|
|
1174
1179
|
agent: "claude-code",
|
|
1175
1180
|
name: res.name,
|
|
1176
1181
|
note: `installed ${res.name} as a Claude Code plugin \u2014 manage it with \`claude plugin\` or /plugin`
|
|
@@ -1179,7 +1184,27 @@ async function tryPluginInstall(arg, flags) {
|
|
|
1179
1184
|
async function runAdd(arg, flags, deps) {
|
|
1180
1185
|
const d = deps ?? makeDefaultDeps(flags);
|
|
1181
1186
|
const env = flags.env ?? process.env;
|
|
1182
|
-
const
|
|
1187
|
+
const attempt = await tryPluginInstall(arg, flags);
|
|
1188
|
+
const managed = attempt?.ok ? attempt : null;
|
|
1189
|
+
const managedNotices = !attempt ? [] : attempt.ok ? [infoNotice(attempt.note)] : [warnNotice(`could not install this as a Claude Code plugin (${attempt.reason}) \u2014 installing its skills instead`)];
|
|
1190
|
+
let scopeOnce;
|
|
1191
|
+
const scopeOf = async () => scopeOnce ??= await resolveScope(flags, d);
|
|
1192
|
+
if (managed) {
|
|
1193
|
+
const pre = await scopeOf();
|
|
1194
|
+
if (!pre) return finish2(flags, { kind: "cancel" });
|
|
1195
|
+
const others = detectAgents(pre.scope).filter((id) => id !== managed.agent);
|
|
1196
|
+
if (!others.length) {
|
|
1197
|
+
const paths2 = { home: flags.home ?? homedir4(), cwd: flags.cwd ?? process.cwd() };
|
|
1198
|
+
return finish2(flags, {
|
|
1199
|
+
kind: "install",
|
|
1200
|
+
scope: pre.scope.global ? "global" : "project",
|
|
1201
|
+
records: [],
|
|
1202
|
+
notices: [...pre.note ? [infoNotice(pre.note)] : [], ...managedNotices],
|
|
1203
|
+
paths: paths2,
|
|
1204
|
+
managed: managed.name
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1183
1208
|
let candidates;
|
|
1184
1209
|
try {
|
|
1185
1210
|
candidates = await resolveCandidates(arg, flags, d);
|
|
@@ -1192,16 +1217,12 @@ async function runAdd(arg, flags, deps) {
|
|
|
1192
1217
|
}
|
|
1193
1218
|
const early = gate(flags, d, candidates);
|
|
1194
1219
|
if (early) return early;
|
|
1195
|
-
const resolved = await
|
|
1220
|
+
const resolved = await scopeOf();
|
|
1196
1221
|
if (!resolved) return finish2(flags, { kind: "cancel" });
|
|
1197
1222
|
const scope = resolved.scope;
|
|
1198
1223
|
const notices = resolved.note ? [infoNotice(resolved.note)] : [];
|
|
1199
|
-
|
|
1224
|
+
notices.push(...managedNotices);
|
|
1200
1225
|
const detected = detectAgents(scope).filter((id) => id !== managed?.agent);
|
|
1201
|
-
if (managed && !detected.length) {
|
|
1202
|
-
const paths2 = { home: flags.home ?? homedir4(), cwd: flags.cwd ?? process.cwd() };
|
|
1203
|
-
return finish2(flags, { kind: "install", scope: scope.global ? "global" : "project", records: [], notices, paths: paths2, managed: managed.name });
|
|
1204
|
-
}
|
|
1205
1226
|
const chosen = await chooseTargets(flags, d, scope, detected);
|
|
1206
1227
|
if (!chosen) return finish2(flags, { kind: "cancel" });
|
|
1207
1228
|
notices.push(...chosen.notices);
|
package/package.json
CHANGED