@chiendt/ack-cli 1.3.0-dev.3 → 1.3.0-dev.4
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/cli-manifest.json +2 -2
- package/dist/index.js +119 -95
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -51018,8 +51018,16 @@ import { existsSync as existsSync18 } from "node:fs";
|
|
|
51018
51018
|
import { readFile as readFile14, readdir as readdir10, stat as stat6 } from "node:fs/promises";
|
|
51019
51019
|
import { homedir as homedir18 } from "node:os";
|
|
51020
51020
|
import { join as join33 } from "node:path";
|
|
51021
|
-
|
|
51022
|
-
|
|
51021
|
+
function resolveSkillsDir(projectPath) {
|
|
51022
|
+
return projectPath ? join33(projectPath, ".claude", "skills") : globalSkillsDir;
|
|
51023
|
+
}
|
|
51024
|
+
function resolveMetadataPath(scope, projectPath) {
|
|
51025
|
+
if (scope === "global")
|
|
51026
|
+
return join33(homedir18(), ".claude", "metadata.json");
|
|
51027
|
+
return join33(projectPath ?? process.cwd(), ".claude", "metadata.json");
|
|
51028
|
+
}
|
|
51029
|
+
async function getCkSkillMetadata(scope, projectPath) {
|
|
51030
|
+
const metaPath = resolveMetadataPath(scope, projectPath);
|
|
51023
51031
|
if (!existsSync18(metaPath))
|
|
51024
51032
|
return null;
|
|
51025
51033
|
const result = new Map;
|
|
@@ -51087,15 +51095,13 @@ function inferCategory(name, metadata) {
|
|
|
51087
51095
|
return "ai-ml";
|
|
51088
51096
|
return "other";
|
|
51089
51097
|
}
|
|
51090
|
-
async function scanSkills() {
|
|
51098
|
+
async function scanSkills(projectPath) {
|
|
51099
|
+
const skillsDir = resolveSkillsDir(projectPath);
|
|
51091
51100
|
if (!existsSync18(skillsDir))
|
|
51092
51101
|
return [];
|
|
51093
51102
|
try {
|
|
51094
51103
|
const entries = await readdir10(skillsDir);
|
|
51095
|
-
const [globalMeta, projectMeta] = await Promise.all([
|
|
51096
|
-
getCkSkillMetadata("global"),
|
|
51097
|
-
getCkSkillMetadata("project")
|
|
51098
|
-
]);
|
|
51104
|
+
const [globalMeta, projectMeta] = projectPath ? [null, await getCkSkillMetadata("project", projectPath)] : await Promise.all([getCkSkillMetadata("global"), getCkSkillMetadata("project")]);
|
|
51099
51105
|
const ckMeta = globalMeta ?? projectMeta;
|
|
51100
51106
|
const skills = [];
|
|
51101
51107
|
for (const entry of entries) {
|
|
@@ -51146,10 +51152,10 @@ async function scanSkills() {
|
|
|
51146
51152
|
return [];
|
|
51147
51153
|
}
|
|
51148
51154
|
}
|
|
51149
|
-
var import_gray_matter4,
|
|
51155
|
+
var import_gray_matter4, globalSkillsDir, SKIP_DIRS2;
|
|
51150
51156
|
var init_skill_scanner = __esm(() => {
|
|
51151
51157
|
import_gray_matter4 = __toESM(require_gray_matter(), 1);
|
|
51152
|
-
|
|
51158
|
+
globalSkillsDir = join33(homedir18(), ".claude", "skills");
|
|
51153
51159
|
SKIP_DIRS2 = [".venv", "scripts", "__pycache__", "node_modules", ".git", "common"];
|
|
51154
51160
|
});
|
|
51155
51161
|
|
|
@@ -51158,11 +51164,13 @@ import { existsSync as existsSync19 } from "node:fs";
|
|
|
51158
51164
|
import { copyFile as copyFile2, mkdir as mkdir9, readFile as readFile15, rename as rename5, rm as rm4, writeFile as writeFile9 } from "node:fs/promises";
|
|
51159
51165
|
import { homedir as homedir19 } from "node:os";
|
|
51160
51166
|
import { join as join34 } from "node:path";
|
|
51161
|
-
function getSettingsPath() {
|
|
51167
|
+
function getSettingsPath(projectPath) {
|
|
51168
|
+
if (projectPath)
|
|
51169
|
+
return join34(projectPath, ".claude", settingsFilename);
|
|
51162
51170
|
return join34(claudeDir, settingsFilename);
|
|
51163
51171
|
}
|
|
51164
|
-
async function readSettings() {
|
|
51165
|
-
const settingsPath = getSettingsPath();
|
|
51172
|
+
async function readSettings(projectPath) {
|
|
51173
|
+
const settingsPath = getSettingsPath(projectPath);
|
|
51166
51174
|
try {
|
|
51167
51175
|
if (!existsSync19(settingsPath))
|
|
51168
51176
|
return null;
|
|
@@ -51634,14 +51642,14 @@ async function countMdFilesRecursive(dir, depth = 0) {
|
|
|
51634
51642
|
}
|
|
51635
51643
|
}
|
|
51636
51644
|
async function countSkills2() {
|
|
51637
|
-
const
|
|
51638
|
-
if (!existsSync20(
|
|
51645
|
+
const skillsDir = join38(claudeDir2, "skills");
|
|
51646
|
+
if (!existsSync20(skillsDir))
|
|
51639
51647
|
return 0;
|
|
51640
51648
|
try {
|
|
51641
|
-
const entries = await readdir11(
|
|
51649
|
+
const entries = await readdir11(skillsDir);
|
|
51642
51650
|
let count = 0;
|
|
51643
51651
|
for (const entry of entries) {
|
|
51644
|
-
if (existsSync20(join38(
|
|
51652
|
+
if (existsSync20(join38(skillsDir, entry, "SKILL.md")))
|
|
51645
51653
|
count++;
|
|
51646
51654
|
}
|
|
51647
51655
|
return count;
|
|
@@ -61065,6 +61073,19 @@ import { existsSync as existsSync37 } from "node:fs";
|
|
|
61065
61073
|
import { readFile as readFile27 } from "node:fs/promises";
|
|
61066
61074
|
import { homedir as homedir32 } from "node:os";
|
|
61067
61075
|
import { basename as basename21, join as join55, resolve as resolve28 } from "node:path";
|
|
61076
|
+
async function countProjectMcpJsonServers(projectPath) {
|
|
61077
|
+
const filePath = join55(projectPath, ".mcp.json");
|
|
61078
|
+
if (!existsSync37(filePath))
|
|
61079
|
+
return 0;
|
|
61080
|
+
try {
|
|
61081
|
+
const content = await readFile27(filePath, "utf-8");
|
|
61082
|
+
const parsed = JSON.parse(content);
|
|
61083
|
+
const servers = parsed.mcpServers && typeof parsed.mcpServers === "object" && !Array.isArray(parsed.mcpServers) ? parsed.mcpServers : parsed;
|
|
61084
|
+
return Object.keys(servers).filter((k2) => k2 !== "mcpServers").length;
|
|
61085
|
+
} catch {
|
|
61086
|
+
return 0;
|
|
61087
|
+
}
|
|
61088
|
+
}
|
|
61068
61089
|
function resolveKitInfo(metadata) {
|
|
61069
61090
|
const kitsMap = metadata.kits ?? null;
|
|
61070
61091
|
if (kitsMap && typeof kitsMap === "object") {
|
|
@@ -61325,13 +61346,14 @@ async function buildProjectInfoFromRegistry(registered, cachedSettings, cachedSk
|
|
|
61325
61346
|
}
|
|
61326
61347
|
} catch {}
|
|
61327
61348
|
const hasLocalConfig = hasClaudeDir && CkConfigManager.projectConfigExists(registered.path, false);
|
|
61328
|
-
const settings =
|
|
61329
|
-
const skills =
|
|
61349
|
+
const settings = hasClaudeDir ? await readSettings(registered.path) : null;
|
|
61350
|
+
const skills = hasClaudeDir ? await scanSkills(registered.path) : [];
|
|
61330
61351
|
const settingsPath = join55(homedir32(), ".claude", "settings.json");
|
|
61331
61352
|
const health = existsSync37(settingsPath) ? "healthy" : "warning";
|
|
61332
61353
|
const model = getCurrentModel() || settings?.model || "claude-sonnet-4";
|
|
61333
61354
|
const planData = includePlanData ? await buildProjectPlanData(registered.path, "project") : null;
|
|
61334
61355
|
const kitInfo = resolveKitInfo(metadata);
|
|
61356
|
+
const projectMcpJsonCount = await countProjectMcpJsonServers(registered.path);
|
|
61335
61357
|
return {
|
|
61336
61358
|
id: registered.id,
|
|
61337
61359
|
name: registered.alias,
|
|
@@ -61343,7 +61365,7 @@ async function buildProjectInfoFromRegistry(registered, cachedSettings, cachedSk
|
|
|
61343
61365
|
health,
|
|
61344
61366
|
model,
|
|
61345
61367
|
activeHooks: settings ? countHooks(settings) : 0,
|
|
61346
|
-
mcpServers: settings ? countMcpServers(settings) : 0,
|
|
61368
|
+
mcpServers: (settings ? countMcpServers(settings) : 0) + projectMcpJsonCount,
|
|
61347
61369
|
skills: skills.map((s) => s.id),
|
|
61348
61370
|
pinned: registered.pinned,
|
|
61349
61371
|
tags: registered.tags,
|
|
@@ -61369,12 +61391,14 @@ async function detectAndBuildProjectInfo(path5, id, cachedSettings, cachedSkills
|
|
|
61369
61391
|
}
|
|
61370
61392
|
} catch {}
|
|
61371
61393
|
const hasLocalConfig = CkConfigManager.projectConfigExists(path5, id === "global");
|
|
61372
|
-
const
|
|
61373
|
-
const
|
|
61394
|
+
const isGlobal = id === "global";
|
|
61395
|
+
const settings = isGlobal ? await readSettings() : await readSettings(path5);
|
|
61396
|
+
const skills = isGlobal ? await scanSkills() : await scanSkills(path5);
|
|
61374
61397
|
const settingsPath = join55(homedir32(), ".claude", "settings.json");
|
|
61375
61398
|
const health = existsSync37(settingsPath) ? "healthy" : "warning";
|
|
61376
61399
|
const model = getCurrentModel() || settings?.model || "claude-sonnet-4";
|
|
61377
61400
|
const scope = id === "global" ? "global" : "project";
|
|
61401
|
+
const projectMcpJsonCount = isGlobal ? 0 : await countProjectMcpJsonServers(path5);
|
|
61378
61402
|
const planData = includePlanData ? await buildProjectPlanData(id === "global" ? null : path5, scope) : null;
|
|
61379
61403
|
const kitInfo = resolveKitInfo(metadata);
|
|
61380
61404
|
return {
|
|
@@ -61388,7 +61412,7 @@ async function detectAndBuildProjectInfo(path5, id, cachedSettings, cachedSkills
|
|
|
61388
61412
|
health,
|
|
61389
61413
|
model,
|
|
61390
61414
|
activeHooks: settings ? countHooks(settings) : 0,
|
|
61391
|
-
mcpServers: settings ? countMcpServers(settings) : 0,
|
|
61415
|
+
mcpServers: (settings ? countMcpServers(settings) : 0) + projectMcpJsonCount,
|
|
61392
61416
|
skills: skills.map((s) => s.id),
|
|
61393
61417
|
planSettings: planData?.planSettings,
|
|
61394
61418
|
activePlans: planData?.activePlans
|
|
@@ -62212,16 +62236,16 @@ async function detectSource(skillDir) {
|
|
|
62212
62236
|
return "local";
|
|
62213
62237
|
}
|
|
62214
62238
|
async function listSkills() {
|
|
62215
|
-
const
|
|
62239
|
+
const skillsDir = getSkillsDir();
|
|
62216
62240
|
let entries;
|
|
62217
62241
|
try {
|
|
62218
|
-
const dirEntries = await fs6.readdir(
|
|
62242
|
+
const dirEntries = await fs6.readdir(skillsDir, { withFileTypes: true });
|
|
62219
62243
|
entries = dirEntries.filter((e2) => e2.isDirectory()).map((e2) => e2.name);
|
|
62220
62244
|
} catch {
|
|
62221
62245
|
return [];
|
|
62222
62246
|
}
|
|
62223
62247
|
const skills = await Promise.all(entries.map(async (name) => {
|
|
62224
|
-
const skillDir = path5.join(
|
|
62248
|
+
const skillDir = path5.join(skillsDir, name);
|
|
62225
62249
|
const skillMdPath = path5.join(skillDir, "SKILL.md");
|
|
62226
62250
|
try {
|
|
62227
62251
|
await fs6.access(skillMdPath);
|
|
@@ -62270,8 +62294,8 @@ function registerSkillBrowserRoutes(app) {
|
|
|
62270
62294
|
const query = rawQuery.slice(0, 500);
|
|
62271
62295
|
const limit = Math.min(100, Math.max(1, Number.parseInt(rawLimit, 10) || 10));
|
|
62272
62296
|
try {
|
|
62273
|
-
const
|
|
62274
|
-
const catalog = await skillCatalogGenerator.readOrRegenerate(
|
|
62297
|
+
const skillsDir = getSkillsDir();
|
|
62298
|
+
const catalog = await skillCatalogGenerator.readOrRegenerate(skillsDir);
|
|
62275
62299
|
const results = searchSkills(catalog.skills, query, limit, catalog.generated);
|
|
62276
62300
|
res.json({ results });
|
|
62277
62301
|
} catch {
|
|
@@ -62292,11 +62316,11 @@ function registerSkillBrowserRoutes(app) {
|
|
|
62292
62316
|
res.status(400).json({ error: "Invalid skill name" });
|
|
62293
62317
|
return;
|
|
62294
62318
|
}
|
|
62295
|
-
const
|
|
62296
|
-
const skillDir = path5.join(
|
|
62319
|
+
const skillsDir = getSkillsDir();
|
|
62320
|
+
const skillDir = path5.join(skillsDir, name);
|
|
62297
62321
|
const skillMdPath = path5.join(skillDir, "SKILL.md");
|
|
62298
62322
|
const resolvedPath = path5.resolve(skillMdPath);
|
|
62299
|
-
const resolvedSkillsDir = path5.resolve(
|
|
62323
|
+
const resolvedSkillsDir = path5.resolve(skillsDir);
|
|
62300
62324
|
if (!resolvedPath.startsWith(resolvedSkillsDir + path5.sep)) {
|
|
62301
62325
|
res.status(403).json({ error: "Access denied" });
|
|
62302
62326
|
return;
|
|
@@ -63727,7 +63751,7 @@ var package_default;
|
|
|
63727
63751
|
var init_package = __esm(() => {
|
|
63728
63752
|
package_default = {
|
|
63729
63753
|
name: "@chiendt/ack-cli",
|
|
63730
|
-
version: "1.3.0-dev.
|
|
63754
|
+
version: "1.3.0-dev.4",
|
|
63731
63755
|
description: "ACK CLI - tool for bootstrapping and updating ACK kits (Claude Code agent kits)",
|
|
63732
63756
|
type: "module",
|
|
63733
63757
|
repository: {
|
|
@@ -73611,8 +73635,8 @@ function validatePackageName(packageName) {
|
|
|
73611
73635
|
throw new Error("Invalid package name");
|
|
73612
73636
|
}
|
|
73613
73637
|
}
|
|
73614
|
-
function validateScriptPath(
|
|
73615
|
-
const skillsDirResolved = resolve37(
|
|
73638
|
+
function validateScriptPath(skillsDir, scriptPath) {
|
|
73639
|
+
const skillsDirResolved = resolve37(skillsDir);
|
|
73616
73640
|
const scriptPathResolved = resolve37(scriptPath);
|
|
73617
73641
|
const skillsDirNormalized = isWindows() ? skillsDirResolved.toLowerCase() : skillsDirResolved;
|
|
73618
73642
|
const scriptPathNormalized = isWindows() ? scriptPathResolved.toLowerCase() : scriptPathResolved;
|
|
@@ -73937,8 +73961,8 @@ function getSystemPackageCommands(summary, systemFailures) {
|
|
|
73937
73961
|
}
|
|
73938
73962
|
return summary.remediation.sudo_packages ? [summary.remediation.sudo_packages] : [];
|
|
73939
73963
|
}
|
|
73940
|
-
function displayInstallErrors(
|
|
73941
|
-
const summaryPath = join99(
|
|
73964
|
+
function displayInstallErrors(skillsDir) {
|
|
73965
|
+
const summaryPath = join99(skillsDir, ".install-error-summary.json");
|
|
73942
73966
|
if (!existsSync66(summaryPath)) {
|
|
73943
73967
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
73944
73968
|
return;
|
|
@@ -74036,8 +74060,8 @@ async function checkNeedsSudoPackages() {
|
|
|
74036
74060
|
return true;
|
|
74037
74061
|
}
|
|
74038
74062
|
}
|
|
74039
|
-
function hasInstallState(
|
|
74040
|
-
const stateFilePath = join99(
|
|
74063
|
+
function hasInstallState(skillsDir) {
|
|
74064
|
+
const stateFilePath = join99(skillsDir, ".install-state.json");
|
|
74041
74065
|
return existsSync66(stateFilePath);
|
|
74042
74066
|
}
|
|
74043
74067
|
var WHICH_COMMAND_TIMEOUT_MS = 5000, WINDOWS_SYSTEM_PACKAGES, SYSTEM_TOOL_KEYS, WINDOWS_RSVG_COMMANDS;
|
|
@@ -74056,7 +74080,7 @@ var init_install_error_handler = __esm(() => {
|
|
|
74056
74080
|
|
|
74057
74081
|
// src/services/package-installer/skills-installer.ts
|
|
74058
74082
|
import { join as join100 } from "node:path";
|
|
74059
|
-
async function installSkillsDependencies(
|
|
74083
|
+
async function installSkillsDependencies(skillsDir, options2 = {}) {
|
|
74060
74084
|
const { skipConfirm = false, withSudo = false } = options2;
|
|
74061
74085
|
const displayName = "Skills Dependencies";
|
|
74062
74086
|
if (isCIEnvironment()) {
|
|
@@ -74081,9 +74105,9 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74081
74105
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
74082
74106
|
const platform9 = process.platform;
|
|
74083
74107
|
const scriptName = platform9 === "win32" ? "install.ps1" : "install.sh";
|
|
74084
|
-
const scriptPath = join100(
|
|
74108
|
+
const scriptPath = join100(skillsDir, scriptName);
|
|
74085
74109
|
try {
|
|
74086
|
-
validateScriptPath(
|
|
74110
|
+
validateScriptPath(skillsDir, scriptPath);
|
|
74087
74111
|
} catch (error) {
|
|
74088
74112
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
74089
74113
|
logger.error(`Invalid script path: ${errorMessage}`);
|
|
@@ -74097,7 +74121,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74097
74121
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
74098
74122
|
logger.info("");
|
|
74099
74123
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
74100
|
-
logger.info(` See: ${join100(
|
|
74124
|
+
logger.info(` See: ${join100(skillsDir, "INSTALLATION.md")}`);
|
|
74101
74125
|
logger.info("");
|
|
74102
74126
|
logger.info("Quick start:");
|
|
74103
74127
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -74144,7 +74168,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74144
74168
|
logger.info(` ${platform9 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
74145
74169
|
logger.info("");
|
|
74146
74170
|
logger.info("Or see complete guide:");
|
|
74147
|
-
logger.info(` ${join100(
|
|
74171
|
+
logger.info(` ${join100(skillsDir, "INSTALLATION.md")}`);
|
|
74148
74172
|
return {
|
|
74149
74173
|
success: false,
|
|
74150
74174
|
package: displayName,
|
|
@@ -74154,7 +74178,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74154
74178
|
logger.info(`Installing ${displayName}...`);
|
|
74155
74179
|
logger.info(`Running: ${scriptPath}`);
|
|
74156
74180
|
const scriptArgs = ["--yes"];
|
|
74157
|
-
if (hasInstallState(
|
|
74181
|
+
if (hasInstallState(skillsDir)) {
|
|
74158
74182
|
if (skipConfirm || isNonInteractive()) {
|
|
74159
74183
|
logger.info("Resuming previous installation...");
|
|
74160
74184
|
scriptArgs.push("--resume");
|
|
@@ -74221,13 +74245,13 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74221
74245
|
if (platform9 === "win32") {
|
|
74222
74246
|
await executeInteractiveScript("powershell.exe", ["-NoLogo", "-ExecutionPolicy", "Bypass", "-File", scriptPath, "-Y"], {
|
|
74223
74247
|
timeout: 600000,
|
|
74224
|
-
cwd:
|
|
74248
|
+
cwd: skillsDir,
|
|
74225
74249
|
env: scriptEnv
|
|
74226
74250
|
});
|
|
74227
74251
|
} else {
|
|
74228
74252
|
await executeInteractiveScript("bash", [scriptPath, ...scriptArgs], {
|
|
74229
74253
|
timeout: 600000,
|
|
74230
|
-
cwd:
|
|
74254
|
+
cwd: skillsDir,
|
|
74231
74255
|
env: scriptEnv
|
|
74232
74256
|
});
|
|
74233
74257
|
}
|
|
@@ -74241,7 +74265,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74241
74265
|
const exitCodeMatch = errorMessage.match(/exited with code (\d+)/);
|
|
74242
74266
|
const exitCode = exitCodeMatch ? Number.parseInt(exitCodeMatch[1], 10) : 1;
|
|
74243
74267
|
if (exitCode === EXIT_CODE_PARTIAL_SUCCESS) {
|
|
74244
|
-
displayInstallErrors(
|
|
74268
|
+
displayInstallErrors(skillsDir);
|
|
74245
74269
|
logger.info("");
|
|
74246
74270
|
logger.success("Core functionality is available despite some package failures.");
|
|
74247
74271
|
return {
|
|
@@ -74251,7 +74275,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74251
74275
|
};
|
|
74252
74276
|
}
|
|
74253
74277
|
if (exitCode === EXIT_CODE_CRITICAL_FAILURE) {
|
|
74254
|
-
displayInstallErrors(
|
|
74278
|
+
displayInstallErrors(skillsDir);
|
|
74255
74279
|
logger.error("");
|
|
74256
74280
|
logger.error("Skills installation failed. See above for details.");
|
|
74257
74281
|
return {
|
|
@@ -74265,7 +74289,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74265
74289
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
74266
74290
|
logger.info("");
|
|
74267
74291
|
logger.info("See complete guide:");
|
|
74268
|
-
logger.info(` cat ${join100(
|
|
74292
|
+
logger.info(` cat ${join100(skillsDir, "INSTALLATION.md")}`);
|
|
74269
74293
|
logger.info("");
|
|
74270
74294
|
logger.info("Quick start:");
|
|
74271
74295
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -74282,9 +74306,9 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74282
74306
|
};
|
|
74283
74307
|
}
|
|
74284
74308
|
}
|
|
74285
|
-
async function handleSkillsInstallation(
|
|
74309
|
+
async function handleSkillsInstallation(skillsDir, options2 = {}) {
|
|
74286
74310
|
try {
|
|
74287
|
-
const skillsResult = await installSkillsDependencies(
|
|
74311
|
+
const skillsResult = await installSkillsDependencies(skillsDir, options2);
|
|
74288
74312
|
if (skillsResult.success) {
|
|
74289
74313
|
if (skillsResult.version === PARTIAL_INSTALL_VERSION) {
|
|
74290
74314
|
logger.success("Skills core dependencies installed (some optional packages skipped)");
|
|
@@ -87843,10 +87867,10 @@ import { existsSync as existsSync53 } from "node:fs";
|
|
|
87843
87867
|
import { readFile as readFile40, readdir as readdir19 } from "node:fs/promises";
|
|
87844
87868
|
import { basename as basename24, join as join76, relative as relative16 } from "node:path";
|
|
87845
87869
|
var SKIP_DIRS5 = new Set([".git", ".venv", "__pycache__", "node_modules", "scripts", "common"]);
|
|
87846
|
-
async function scanSkills2(
|
|
87847
|
-
if (!existsSync53(
|
|
87870
|
+
async function scanSkills2(skillsDir) {
|
|
87871
|
+
if (!existsSync53(skillsDir))
|
|
87848
87872
|
return [];
|
|
87849
|
-
const skillDirs = await findSkillDirs(
|
|
87873
|
+
const skillDirs = await findSkillDirs(skillsDir);
|
|
87850
87874
|
const skills = [];
|
|
87851
87875
|
for (const dir of skillDirs) {
|
|
87852
87876
|
const file = join76(dir, "SKILL.md");
|
|
@@ -87854,7 +87878,7 @@ async function scanSkills2(skillsDir2) {
|
|
|
87854
87878
|
const content = await readFile40(file, "utf8");
|
|
87855
87879
|
const { data } = import_gray_matter11.default(content, { engines: { javascript: { parse: () => ({}) } } });
|
|
87856
87880
|
const rawName = typeof data.name === "string" ? data.name : "";
|
|
87857
|
-
const fallbackId = relative16(
|
|
87881
|
+
const fallbackId = relative16(skillsDir, dir).replace(/\\/g, "/") || basename24(dir);
|
|
87858
87882
|
skills.push({
|
|
87859
87883
|
id: normalizeSkillId(rawName, fallbackId),
|
|
87860
87884
|
description: typeof data.description === "string" ? data.description : "",
|
|
@@ -103490,13 +103514,13 @@ import { join as join129, relative as relative27 } from "node:path";
|
|
|
103490
103514
|
class SkillsManifestManager {
|
|
103491
103515
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
103492
103516
|
static MANIFEST_VERSION = "1.0.0";
|
|
103493
|
-
static async generateManifest(
|
|
103494
|
-
logger.debug(`Generating manifest for: ${
|
|
103495
|
-
if (!await import_fs_extra24.pathExists(
|
|
103496
|
-
throw new SkillsMigrationError(`Skills directory does not exist: ${
|
|
103517
|
+
static async generateManifest(skillsDir) {
|
|
103518
|
+
logger.debug(`Generating manifest for: ${skillsDir}`);
|
|
103519
|
+
if (!await import_fs_extra24.pathExists(skillsDir)) {
|
|
103520
|
+
throw new SkillsMigrationError(`Skills directory does not exist: ${skillsDir}`);
|
|
103497
103521
|
}
|
|
103498
|
-
const structure = await SkillsManifestManager.detectStructure(
|
|
103499
|
-
const skills = await SkillsManifestManager.scanSkills(
|
|
103522
|
+
const structure = await SkillsManifestManager.detectStructure(skillsDir);
|
|
103523
|
+
const skills = await SkillsManifestManager.scanSkills(skillsDir, structure);
|
|
103500
103524
|
const manifest = {
|
|
103501
103525
|
version: SkillsManifestManager.MANIFEST_VERSION,
|
|
103502
103526
|
structure,
|
|
@@ -103506,13 +103530,13 @@ class SkillsManifestManager {
|
|
|
103506
103530
|
logger.debug(`Generated manifest with ${skills.length} skills (${structure} structure)`);
|
|
103507
103531
|
return manifest;
|
|
103508
103532
|
}
|
|
103509
|
-
static async writeManifest(
|
|
103510
|
-
const manifestPath = join129(
|
|
103533
|
+
static async writeManifest(skillsDir, manifest) {
|
|
103534
|
+
const manifestPath = join129(skillsDir, SkillsManifestManager.MANIFEST_FILENAME);
|
|
103511
103535
|
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
103512
103536
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
103513
103537
|
}
|
|
103514
|
-
static async readManifest(
|
|
103515
|
-
const manifestPath = join129(
|
|
103538
|
+
static async readManifest(skillsDir) {
|
|
103539
|
+
const manifestPath = join129(skillsDir, SkillsManifestManager.MANIFEST_FILENAME);
|
|
103516
103540
|
if (!await import_fs_extra24.pathExists(manifestPath)) {
|
|
103517
103541
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
103518
103542
|
return null;
|
|
@@ -103528,14 +103552,14 @@ class SkillsManifestManager {
|
|
|
103528
103552
|
return null;
|
|
103529
103553
|
}
|
|
103530
103554
|
}
|
|
103531
|
-
static async detectStructure(
|
|
103532
|
-
const entries = await readdir34(
|
|
103555
|
+
static async detectStructure(skillsDir) {
|
|
103556
|
+
const entries = await readdir34(skillsDir, { withFileTypes: true });
|
|
103533
103557
|
const dirs = entries.filter((entry) => entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith("."));
|
|
103534
103558
|
if (dirs.length === 0) {
|
|
103535
103559
|
return "flat";
|
|
103536
103560
|
}
|
|
103537
103561
|
for (const dir of dirs.slice(0, 3)) {
|
|
103538
|
-
const dirPath = join129(
|
|
103562
|
+
const dirPath = join129(skillsDir, dir.name);
|
|
103539
103563
|
const subEntries = await readdir34(dirPath, { withFileTypes: true });
|
|
103540
103564
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
103541
103565
|
if (hasSubdirs) {
|
|
@@ -103548,13 +103572,13 @@ class SkillsManifestManager {
|
|
|
103548
103572
|
}
|
|
103549
103573
|
return "flat";
|
|
103550
103574
|
}
|
|
103551
|
-
static async scanSkills(
|
|
103575
|
+
static async scanSkills(skillsDir, structure) {
|
|
103552
103576
|
const skills = [];
|
|
103553
103577
|
if (structure === "flat") {
|
|
103554
|
-
const entries = await readdir34(
|
|
103578
|
+
const entries = await readdir34(skillsDir, { withFileTypes: true });
|
|
103555
103579
|
for (const entry of entries) {
|
|
103556
103580
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
103557
|
-
const skillPath = join129(
|
|
103581
|
+
const skillPath = join129(skillsDir, entry.name);
|
|
103558
103582
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
103559
103583
|
skills.push({
|
|
103560
103584
|
name: entry.name,
|
|
@@ -103563,10 +103587,10 @@ class SkillsManifestManager {
|
|
|
103563
103587
|
}
|
|
103564
103588
|
}
|
|
103565
103589
|
} else {
|
|
103566
|
-
const categories = await readdir34(
|
|
103590
|
+
const categories = await readdir34(skillsDir, { withFileTypes: true });
|
|
103567
103591
|
for (const category of categories) {
|
|
103568
103592
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
103569
|
-
const categoryPath = join129(
|
|
103593
|
+
const categoryPath = join129(skillsDir, category.name);
|
|
103570
103594
|
const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
|
|
103571
103595
|
for (const skillEntry of skillEntries) {
|
|
103572
103596
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
@@ -103723,11 +103747,11 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
103723
103747
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
103724
103748
|
import { readdir as readdir35 } from "node:fs/promises";
|
|
103725
103749
|
import { join as join130 } from "node:path";
|
|
103726
|
-
async function scanDirectory(
|
|
103727
|
-
if (!await import_fs_extra25.pathExists(
|
|
103750
|
+
async function scanDirectory(skillsDir) {
|
|
103751
|
+
if (!await import_fs_extra25.pathExists(skillsDir)) {
|
|
103728
103752
|
return ["flat", []];
|
|
103729
103753
|
}
|
|
103730
|
-
const entries = await readdir35(
|
|
103754
|
+
const entries = await readdir35(skillsDir, { withFileTypes: true });
|
|
103731
103755
|
const dirs = entries.filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith("."));
|
|
103732
103756
|
if (dirs.length === 0) {
|
|
103733
103757
|
return ["flat", []];
|
|
@@ -103735,7 +103759,7 @@ async function scanDirectory(skillsDir2) {
|
|
|
103735
103759
|
let totalSkillLikeCount = 0;
|
|
103736
103760
|
const allSkills = [];
|
|
103737
103761
|
for (const dir of dirs) {
|
|
103738
|
-
const dirPath = join130(
|
|
103762
|
+
const dirPath = join130(skillsDir, dir.name);
|
|
103739
103763
|
const subEntries = await readdir35(dirPath, { withFileTypes: true });
|
|
103740
103764
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
103741
103765
|
if (subdirs.length > 0) {
|
|
@@ -104188,22 +104212,22 @@ function validatePath2(path10, paramName) {
|
|
|
104188
104212
|
|
|
104189
104213
|
class SkillsBackupManager {
|
|
104190
104214
|
static BACKUP_PREFIX = ".skills-backup-";
|
|
104191
|
-
static async createBackup(
|
|
104192
|
-
validatePath2(
|
|
104215
|
+
static async createBackup(skillsDir, parentDir) {
|
|
104216
|
+
validatePath2(skillsDir, "skillsDir");
|
|
104193
104217
|
if (parentDir) {
|
|
104194
104218
|
validatePath2(parentDir, "parentDir");
|
|
104195
104219
|
}
|
|
104196
|
-
if (!await import_fs_extra28.pathExists(
|
|
104197
|
-
throw new SkillsMigrationError(`Cannot create backup: Skills directory does not exist: ${
|
|
104220
|
+
if (!await import_fs_extra28.pathExists(skillsDir)) {
|
|
104221
|
+
throw new SkillsMigrationError(`Cannot create backup: Skills directory does not exist: ${skillsDir}`);
|
|
104198
104222
|
}
|
|
104199
104223
|
const timestamp = Date.now();
|
|
104200
104224
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
104201
104225
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
104202
|
-
const backupDir = parentDir ? join132(parentDir, backupDirName) : join132(
|
|
104226
|
+
const backupDir = parentDir ? join132(parentDir, backupDirName) : join132(skillsDir, "..", backupDirName);
|
|
104203
104227
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
104204
104228
|
try {
|
|
104205
104229
|
await mkdir34(backupDir, { recursive: true });
|
|
104206
|
-
await SkillsBackupManager.copyDirectory(
|
|
104230
|
+
await SkillsBackupManager.copyDirectory(skillsDir, backupDir);
|
|
104207
104231
|
logger.success("Backup created successfully");
|
|
104208
104232
|
return backupDir;
|
|
104209
104233
|
} catch (error) {
|
|
@@ -104475,16 +104499,16 @@ function validatePath3(path10, paramName) {
|
|
|
104475
104499
|
}
|
|
104476
104500
|
}
|
|
104477
104501
|
}
|
|
104478
|
-
async function scanSkillsDirectory(
|
|
104479
|
-
if (!await import_fs_extra30.pathExists(
|
|
104502
|
+
async function scanSkillsDirectory(skillsDir) {
|
|
104503
|
+
if (!await import_fs_extra30.pathExists(skillsDir)) {
|
|
104480
104504
|
return ["flat", []];
|
|
104481
104505
|
}
|
|
104482
|
-
const entries = await readdir39(
|
|
104506
|
+
const entries = await readdir39(skillsDir, { withFileTypes: true });
|
|
104483
104507
|
const dirs = entries.filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith("."));
|
|
104484
104508
|
if (dirs.length === 0) {
|
|
104485
104509
|
return ["flat", []];
|
|
104486
104510
|
}
|
|
104487
|
-
const firstDirPath = join134(
|
|
104511
|
+
const firstDirPath = join134(skillsDir, dirs[0].name);
|
|
104488
104512
|
const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
|
|
104489
104513
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
104490
104514
|
if (subdirs.length > 0) {
|
|
@@ -104500,7 +104524,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
104500
104524
|
if (skillLikeCount > 0) {
|
|
104501
104525
|
const skills = [];
|
|
104502
104526
|
for (const dir of dirs) {
|
|
104503
|
-
const categoryPath = join134(
|
|
104527
|
+
const categoryPath = join134(skillsDir, dir.name);
|
|
104504
104528
|
const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
|
|
104505
104529
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
104506
104530
|
}
|
|
@@ -104509,17 +104533,17 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
104509
104533
|
}
|
|
104510
104534
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
104511
104535
|
}
|
|
104512
|
-
async function findSkillPath(
|
|
104513
|
-
const flatPath = join134(
|
|
104536
|
+
async function findSkillPath(skillsDir, skillName) {
|
|
104537
|
+
const flatPath = join134(skillsDir, skillName);
|
|
104514
104538
|
if (await import_fs_extra30.pathExists(flatPath)) {
|
|
104515
104539
|
return { path: flatPath, category: undefined };
|
|
104516
104540
|
}
|
|
104517
|
-
const entries = await readdir39(
|
|
104541
|
+
const entries = await readdir39(skillsDir, { withFileTypes: true });
|
|
104518
104542
|
for (const entry of entries) {
|
|
104519
104543
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
104520
104544
|
continue;
|
|
104521
104545
|
}
|
|
104522
|
-
const categoryPath = join134(
|
|
104546
|
+
const categoryPath = join134(skillsDir, entry.name);
|
|
104523
104547
|
const skillPath = join134(categoryPath, skillName);
|
|
104524
104548
|
if (await import_fs_extra30.pathExists(skillPath)) {
|
|
104525
104549
|
return { path: skillPath, category: entry.name };
|
|
@@ -104948,8 +104972,8 @@ async function handlePostInstall(ctx) {
|
|
|
104948
104972
|
}
|
|
104949
104973
|
if (installSkills) {
|
|
104950
104974
|
const { handleSkillsInstallation: handleSkillsInstallation2 } = await Promise.resolve().then(() => (init_package_installer(), exports_package_installer));
|
|
104951
|
-
const
|
|
104952
|
-
await handleSkillsInstallation2(
|
|
104975
|
+
const skillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
104976
|
+
await handleSkillsInstallation2(skillsDir, {
|
|
104953
104977
|
skipConfirm: ctx.isNonInteractive,
|
|
104954
104978
|
withSudo: ctx.options.withSudo
|
|
104955
104979
|
});
|
|
@@ -109791,8 +109815,8 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
109791
109815
|
}
|
|
109792
109816
|
if (installSkills) {
|
|
109793
109817
|
const { handleSkillsInstallation: handleSkillsInstallation2 } = await Promise.resolve().then(() => (init_package_installer(), exports_package_installer));
|
|
109794
|
-
const
|
|
109795
|
-
await handleSkillsInstallation2(
|
|
109818
|
+
const skillsDir = PathResolver.buildSkillsPath(resolvedDir, false);
|
|
109819
|
+
await handleSkillsInstallation2(skillsDir, {
|
|
109796
109820
|
skipConfirm: isNonInteractive2,
|
|
109797
109821
|
withSudo: validOptions.withSudo
|
|
109798
109822
|
});
|