@cannbot-ai/install-helper 1.1.9-beta.0 → 1.1.9
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/index.js +46 -13
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -170,7 +170,7 @@ var init_embedded_plugins = __esm({
|
|
|
170
170
|
"ascendc-registry",
|
|
171
171
|
"registry"
|
|
172
172
|
],
|
|
173
|
-
skills:
|
|
173
|
+
skills: 30,
|
|
174
174
|
agents: 7,
|
|
175
175
|
description: "\u751F\u4EA7\u7EA7 ACLNN \u6CE8\u518C\u7B97\u5B50\u5168\u6D41\u7A0B\uFF1A\u4EE3\u7801\u2192UT/ST\u2192\u4E0A\u5E93",
|
|
176
176
|
version: "1.2.3",
|
|
@@ -223,6 +223,12 @@ var init_embedded_plugins = __esm({
|
|
|
223
223
|
as: "ops-registry-invoke-workflow"
|
|
224
224
|
}
|
|
225
225
|
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
dir: "plugins-official/ops-registry-invoke/skills",
|
|
229
|
+
skills: [
|
|
230
|
+
"spec-to-design"
|
|
231
|
+
]
|
|
226
232
|
}
|
|
227
233
|
],
|
|
228
234
|
installAgents: [
|
|
@@ -2451,7 +2457,7 @@ init_registry();
|
|
|
2451
2457
|
// src/core/metadata-sync.ts
|
|
2452
2458
|
init_registry();
|
|
2453
2459
|
import { existsSync as existsSync9, readFileSync as readFileSync5, statSync as statSync2, readdirSync as readdirSync3 } from "fs";
|
|
2454
|
-
import { join as join8 } from "path";
|
|
2460
|
+
import { join as join8, sep } from "path";
|
|
2455
2461
|
function readPluginJson(pluginDir) {
|
|
2456
2462
|
const pjPath = join8(pluginDir, ".claude-plugin", "plugin.json");
|
|
2457
2463
|
try {
|
|
@@ -2471,13 +2477,33 @@ function parseIncludedSkills(pluginDir) {
|
|
|
2471
2477
|
return [];
|
|
2472
2478
|
}
|
|
2473
2479
|
}
|
|
2474
|
-
function
|
|
2480
|
+
function parseAllSkills(pluginDir) {
|
|
2481
|
+
const initPath = join8(pluginDir, "init.sh");
|
|
2482
|
+
try {
|
|
2483
|
+
const text = readFileSync5(initPath, "utf-8");
|
|
2484
|
+
const m = text.match(/ALL_SKILLS="([^"]*)"/);
|
|
2485
|
+
if (!m) return [];
|
|
2486
|
+
const val = m[1];
|
|
2487
|
+
if (val.includes("$(") || val.includes("${")) return [];
|
|
2488
|
+
return val.split(/\s+/).filter(Boolean);
|
|
2489
|
+
} catch {
|
|
2490
|
+
return [];
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
function findSkillSourceDir(skillName, repoRoot, scanDirs, pluginDir) {
|
|
2475
2494
|
for (const dir of scanDirs) {
|
|
2476
2495
|
const candidate = join8(repoRoot, dir, skillName);
|
|
2477
2496
|
if (existsSync9(candidate) && statSync2(candidate).isDirectory()) {
|
|
2478
2497
|
return dir;
|
|
2479
2498
|
}
|
|
2480
2499
|
}
|
|
2500
|
+
if (pluginDir) {
|
|
2501
|
+
const localCandidate = join8(pluginDir, "skills", skillName);
|
|
2502
|
+
if (existsSync9(localCandidate) && statSync2(localCandidate).isDirectory()) {
|
|
2503
|
+
const relPluginDir = pluginDir.replace(repoRoot + sep, "").replace(repoRoot + "/", "");
|
|
2504
|
+
return `${relPluginDir}/skills`;
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2481
2507
|
return null;
|
|
2482
2508
|
}
|
|
2483
2509
|
function collectDeclaredSkillNames(installSkills2) {
|
|
@@ -2536,15 +2562,19 @@ function matchAgentsByPattern(agentsDir, pattern) {
|
|
|
2536
2562
|
return [];
|
|
2537
2563
|
}
|
|
2538
2564
|
}
|
|
2539
|
-
function discoverAgents(pluginDir, pj, initShPath) {
|
|
2565
|
+
function discoverAgents(pluginDir, pj, initShPath, fallbackAgents) {
|
|
2540
2566
|
const fromPj = resolveAgentsFromPluginJson(pj);
|
|
2541
2567
|
if (fromPj.length > 0) return fromPj;
|
|
2542
2568
|
if (pj && Array.isArray(pj.agents) && pj.agents.length === 0) return [];
|
|
2543
2569
|
const pattern = parseIncludedAgentPattern(initShPath);
|
|
2544
|
-
if (
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2570
|
+
if (pattern) {
|
|
2571
|
+
const agentsDir = join8(pluginDir, "agents");
|
|
2572
|
+
if (existsSync9(agentsDir)) {
|
|
2573
|
+
const fromPattern = matchAgentsByPattern(agentsDir, pattern);
|
|
2574
|
+
if (fromPattern.length > 0) return fromPattern;
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
return fallbackAgents || [];
|
|
2548
2578
|
}
|
|
2549
2579
|
function countSkills(installSkills2) {
|
|
2550
2580
|
if (!installSkills2) return 0;
|
|
@@ -2555,12 +2585,15 @@ function countSkills(installSkills2) {
|
|
|
2555
2585
|
function mergeInitSkills(existing, pluginDir, repoRoot, scanDirs) {
|
|
2556
2586
|
const base = existing || [];
|
|
2557
2587
|
const seen = collectDeclaredSkillNames(base);
|
|
2558
|
-
|
|
2588
|
+
let initSkills = parseIncludedSkills(pluginDir);
|
|
2589
|
+
if (initSkills.length === 0) {
|
|
2590
|
+
initSkills = parseAllSkills(pluginDir);
|
|
2591
|
+
}
|
|
2559
2592
|
if (initSkills.length === 0) return base;
|
|
2560
2593
|
const merged = base.map((s) => ({ ...s, skills: [...s.skills] }));
|
|
2561
2594
|
for (const skill of initSkills) {
|
|
2562
2595
|
if (seen.has(skill)) continue;
|
|
2563
|
-
const srcDir = findSkillSourceDir(skill, repoRoot, scanDirs);
|
|
2596
|
+
const srcDir = findSkillSourceDir(skill, repoRoot, scanDirs, pluginDir);
|
|
2564
2597
|
if (!srcDir) continue;
|
|
2565
2598
|
let bucket = merged.find((b) => b.dir === srcDir);
|
|
2566
2599
|
if (!bucket) {
|
|
@@ -2588,7 +2621,7 @@ function enrichPluginMetadata(repoPath) {
|
|
|
2588
2621
|
plugin.displayName = pj.name;
|
|
2589
2622
|
}
|
|
2590
2623
|
const initShPath = join8(pluginDir, "init.sh");
|
|
2591
|
-
plugin.installAgents = discoverAgents(pluginDir, pj, initShPath);
|
|
2624
|
+
plugin.installAgents = discoverAgents(pluginDir, pj, initShPath, plugin.installAgents);
|
|
2592
2625
|
const merged = mergeInitSkills(plugin.installSkills, pluginDir, repoPath, scanDirs);
|
|
2593
2626
|
plugin.installSkills = merged;
|
|
2594
2627
|
plugin.skills = countSkills(merged);
|
|
@@ -5024,7 +5057,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
|
|
|
5024
5057
|
// src/commands/uninstall.ts
|
|
5025
5058
|
init_registry();
|
|
5026
5059
|
import { existsSync as existsSync18, unlinkSync as unlinkSync6, rmdirSync, readdirSync as readdirSync8, readFileSync as readFileSync9 } from "fs";
|
|
5027
|
-
import { resolve, basename as basename3, sep, join as join18 } from "path";
|
|
5060
|
+
import { resolve, basename as basename3, sep as sep2, join as join18 } from "path";
|
|
5028
5061
|
import chalk11 from "chalk";
|
|
5029
5062
|
import { select as select5, checkbox as checkbox2, Separator as Separator4, confirm as confirm3 } from "@inquirer/prompts";
|
|
5030
5063
|
init_config();
|
|
@@ -5345,7 +5378,7 @@ async function uninstallPluginById(pluginId, batchMode) {
|
|
|
5345
5378
|
const allowedBases = [resolve(configRoot), resolve(record.installPath)];
|
|
5346
5379
|
const isSafePath = (p) => {
|
|
5347
5380
|
const resolved = resolve(p);
|
|
5348
|
-
return allowedBases.some((base) => resolved === base || resolved.startsWith(base +
|
|
5381
|
+
return allowedBases.some((base) => resolved === base || resolved.startsWith(base + sep2));
|
|
5349
5382
|
};
|
|
5350
5383
|
let removedFiles = 0;
|
|
5351
5384
|
let removedDirs = 0;
|