@comet/cli 9.0.0-beta.3 → 9.0.0-beta.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/lib/comet.js CHANGED
@@ -4,12 +4,12 @@ var commander_1 = require("commander");
4
4
  var download_mitmproxy_1 = require("./commands/download-mitmproxy");
5
5
  var download_oauth2_proxy_1 = require("./commands/download-oauth2-proxy");
6
6
  var generate_block_types_1 = require("./commands/generate-block-types");
7
- var install_agent_skills_1 = require("./commands/install-agent-skills");
7
+ var install_agent_features_1 = require("./commands/install-agent-features");
8
8
  var site_configs_1 = require("./commands/site-configs");
9
9
  var program = new commander_1.Command();
10
10
  program.addCommand(generate_block_types_1.generateBlockTypes);
11
11
  program.addCommand(site_configs_1.injectSiteConfigsCommand);
12
12
  program.addCommand(download_oauth2_proxy_1.downloadOAuth2ProxyCommand);
13
13
  program.addCommand(download_mitmproxy_1.downloadMitmproxyCommand);
14
- program.addCommand(install_agent_skills_1.installAgentSkillsCommand);
14
+ program.addCommand(install_agent_features_1.installAgentFeaturesCommand);
15
15
  program.parse();
@@ -0,0 +1,7 @@
1
+ import { Command } from "commander";
2
+ interface InstallOptions {
3
+ dryRun: boolean;
4
+ }
5
+ export declare function installFeatures(cwd: string, repos: string[], options: InstallOptions): void;
6
+ export declare const installAgentFeaturesCommand: Command;
7
+ export {};
@@ -0,0 +1,339 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __generator = (this && this.__generator) || function (thisArg, body) {
45
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
47
+ function verb(n) { return function (v) { return step([n, v]); }; }
48
+ function step(op) {
49
+ if (f) throw new TypeError("Generator is already executing.");
50
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
51
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
52
+ if (y = 0, t) op = [op[0] & 2, t.value];
53
+ switch (op[0]) {
54
+ case 0: case 1: t = op; break;
55
+ case 4: _.label++; return { value: op[1], done: false };
56
+ case 5: _.label++; y = op[1]; op = [0]; continue;
57
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
58
+ default:
59
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
60
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
61
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
62
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
63
+ if (t[2]) _.ops.pop();
64
+ _.trys.pop(); continue;
65
+ }
66
+ op = body.call(thisArg, _);
67
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
68
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
69
+ }
70
+ };
71
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
72
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
73
+ if (ar || !(i in from)) {
74
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
75
+ ar[i] = from[i];
76
+ }
77
+ }
78
+ return to.concat(ar || Array.prototype.slice.call(from));
79
+ };
80
+ Object.defineProperty(exports, "__esModule", { value: true });
81
+ exports.installAgentFeaturesCommand = void 0;
82
+ exports.installFeatures = installFeatures;
83
+ /* eslint-disable no-console */
84
+ var child_process_1 = require("child_process");
85
+ var commander_1 = require("commander");
86
+ var fs = __importStar(require("fs"));
87
+ var yaml = __importStar(require("js-yaml"));
88
+ var os = __importStar(require("os"));
89
+ var path = __importStar(require("path"));
90
+ var SKILL_SOURCE_PATHS = ["skills", "agentic-plugin/skills"];
91
+ var RULE_SOURCE_PATHS = ["rules"];
92
+ function parseRepoUrl(rawUrl) {
93
+ var hashIndex = rawUrl.lastIndexOf("#");
94
+ if (hashIndex === -1) {
95
+ return { repoUrl: rawUrl, ref: undefined };
96
+ }
97
+ return { repoUrl: rawUrl.slice(0, hashIndex), ref: rawUrl.slice(hashIndex + 1) || undefined };
98
+ }
99
+ function cloneRepo(rawUrl, sparsePatterns) {
100
+ var _a = parseRepoUrl(rawUrl), repoUrl = _a.repoUrl, ref = _a.ref;
101
+ var tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "comet-agent-install-"));
102
+ (0, child_process_1.execFileSync)("git", ["init", tmpDir], { stdio: "pipe" });
103
+ (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "remote", "add", "origin", "--", repoUrl], { stdio: "pipe" });
104
+ (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "config", "core.sparseCheckout", "true"], { stdio: "pipe" });
105
+ fs.writeFileSync(path.join(tmpDir, ".git", "info", "sparse-checkout"), sparsePatterns.map(function (p) { return "".concat(p, "\n"); }).join(""));
106
+ var fetchRef = ref !== null && ref !== void 0 ? ref : "HEAD";
107
+ try {
108
+ console.log("Fetching ".concat(repoUrl, " ref \"").concat(fetchRef, "\" (sparse: ").concat(sparsePatterns.join(", "), ")..."));
109
+ (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "fetch", "--depth", "1", "origin", fetchRef], { stdio: "pipe" });
110
+ (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "checkout", "FETCH_HEAD"], { stdio: "pipe" });
111
+ }
112
+ catch (_b) {
113
+ console.log("Shallow fetch failed for ref \"".concat(fetchRef, "\"; falling back to full fetch..."));
114
+ (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "fetch", "origin", fetchRef], { stdio: "pipe" });
115
+ (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "checkout", "FETCH_HEAD"], { stdio: "pipe" });
116
+ }
117
+ return tmpDir;
118
+ }
119
+ function pathExists(p) {
120
+ try {
121
+ fs.lstatSync(p);
122
+ return true;
123
+ }
124
+ catch (_a) {
125
+ return false;
126
+ }
127
+ }
128
+ function isInternalMarkdown(mdPath) {
129
+ var _a;
130
+ var content;
131
+ try {
132
+ content = fs.readFileSync(mdPath, "utf-8");
133
+ }
134
+ catch (_b) {
135
+ return false;
136
+ }
137
+ var match = content.match(/^---\n([\s\S]*?)\n---/);
138
+ if (!match) {
139
+ return false;
140
+ }
141
+ try {
142
+ var parsed = yaml.load(match[1]);
143
+ return ((_a = parsed === null || parsed === void 0 ? void 0 : parsed.metadata) === null || _a === void 0 ? void 0 : _a.internal) === true;
144
+ }
145
+ catch (_c) {
146
+ return false;
147
+ }
148
+ }
149
+ function listFolders(directory, filterInternal) {
150
+ return fs
151
+ .readdirSync(directory)
152
+ .filter(function (entry) { return fs.statSync(path.join(directory, entry)).isDirectory(); })
153
+ .filter(function (folder) { return !filterInternal || !isInternalMarkdown(path.join(directory, folder, "SKILL.md")); })
154
+ .sort();
155
+ }
156
+ function listMarkdownFiles(directory, filterInternal) {
157
+ var results = [];
158
+ var walk = function (currentDir, relativePath) {
159
+ for (var _i = 0, _a = fs.readdirSync(currentDir); _i < _a.length; _i++) {
160
+ var entry = _a[_i];
161
+ var fullPath = path.join(currentDir, entry);
162
+ var relPath = relativePath ? path.join(relativePath, entry) : entry;
163
+ var stat = fs.statSync(fullPath);
164
+ if (stat.isDirectory()) {
165
+ walk(fullPath, relPath);
166
+ }
167
+ else if (stat.isFile() && entry.endsWith(".md")) {
168
+ if (!filterInternal || !isInternalMarkdown(fullPath)) {
169
+ results.push(relPath);
170
+ }
171
+ }
172
+ }
173
+ };
174
+ walk(directory, "");
175
+ return results.sort();
176
+ }
177
+ function symlinkOrCopy(src, dest, symlink) {
178
+ if (symlink) {
179
+ try {
180
+ fs.symlinkSync(src, dest);
181
+ return "symlinked";
182
+ }
183
+ catch (err) {
184
+ if (err.code !== "EPERM") {
185
+ throw err;
186
+ }
187
+ // Windows without symlink privilege — fall back to copy
188
+ }
189
+ }
190
+ fs.cpSync(src, dest, { recursive: true });
191
+ return "copied";
192
+ }
193
+ function installItems(sources, targetDirs, _a) {
194
+ var dryRun = _a.dryRun;
195
+ var totalInstalled = 0;
196
+ for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) {
197
+ var source = sources_1[_i];
198
+ var label = source.label, directory = source.directory, discover = source.discover, symlink = source.symlink, filterInternal = source.filterInternal, installed = source.installed, itemLabelSingular = source.itemLabelSingular, itemLabelPlural = source.itemLabelPlural;
199
+ if (!fs.existsSync(directory)) {
200
+ console.log("No ".concat(itemLabelPlural, " found in ").concat(label));
201
+ continue;
202
+ }
203
+ var items = discover === "folders" ? listFolders(directory, filterInternal !== null && filterInternal !== void 0 ? filterInternal : false) : listMarkdownFiles(directory, filterInternal !== null && filterInternal !== void 0 ? filterInternal : false);
204
+ if (items.length === 0) {
205
+ console.log("No ".concat(itemLabelPlural, " found in ").concat(label));
206
+ continue;
207
+ }
208
+ console.log("Installing ".concat(items.length, " ").concat(items.length === 1 ? itemLabelSingular : itemLabelPlural, " from ").concat(label, "..."));
209
+ for (var _b = 0, items_1 = items; _b < items_1.length; _b++) {
210
+ var item = items_1[_b];
211
+ if (installed.has(item)) {
212
+ console.warn(" CONFLICT: \"".concat(item, "\" from ").concat(label, " skipped (already installed from a higher-priority source)"));
213
+ continue;
214
+ }
215
+ var srcPath = path.resolve(path.join(directory, item));
216
+ for (var _c = 0, targetDirs_1 = targetDirs; _c < targetDirs_1.length; _c++) {
217
+ var targetDir = targetDirs_1[_c];
218
+ var destPath = path.join(targetDir, item);
219
+ if (dryRun) {
220
+ console.log(" [dry-run] Would ".concat(symlink ? "symlink" : "copy", ": ").concat(srcPath, " -> ").concat(destPath));
221
+ }
222
+ else {
223
+ if (pathExists(destPath)) {
224
+ fs.rmSync(destPath, { recursive: true, force: true });
225
+ }
226
+ fs.mkdirSync(path.dirname(destPath), { recursive: true });
227
+ var action = symlinkOrCopy(srcPath, destPath, symlink);
228
+ console.log(" ".concat(action === "symlinked" ? "Symlinked" : "Copied", ": ").concat(item));
229
+ }
230
+ }
231
+ installed.add(item);
232
+ totalInstalled++;
233
+ }
234
+ }
235
+ return totalInstalled;
236
+ }
237
+ function loadConfig(configPath) {
238
+ var resolved = path.resolve(configPath);
239
+ if (!fs.existsSync(resolved)) {
240
+ throw new Error("Config file not found: ".concat(resolved));
241
+ }
242
+ var raw = fs.readFileSync(resolved, "utf-8");
243
+ return JSON.parse(raw);
244
+ }
245
+ function installFeatures(cwd, repos, options) {
246
+ var skillsTargetDirs = [path.join(cwd, ".agents", "skills"), path.join(cwd, ".claude", "skills")];
247
+ var rulesTargetDirs = [
248
+ path.join(cwd, ".agents", "rules"),
249
+ path.join(cwd, ".claude", "rules"),
250
+ path.join(cwd, ".cursor", "rules"),
251
+ path.join(cwd, ".github", "instructions"),
252
+ ];
253
+ for (var _i = 0, _a = __spreadArray(__spreadArray([], skillsTargetDirs, true), rulesTargetDirs, true); _i < _a.length; _i++) {
254
+ var dir = _a[_i];
255
+ fs.mkdirSync(dir, { recursive: true });
256
+ }
257
+ var installedSkills = new Set();
258
+ var installedRules = new Set();
259
+ var skillSources = SKILL_SOURCE_PATHS.map(function (p) { return ({
260
+ label: "local ".concat(p, "/"),
261
+ directory: path.join(cwd, p),
262
+ discover: "folders",
263
+ symlink: true,
264
+ installed: installedSkills,
265
+ itemLabelSingular: "skill",
266
+ itemLabelPlural: "skills",
267
+ }); });
268
+ var ruleSources = RULE_SOURCE_PATHS.map(function (p) { return ({
269
+ label: "local ".concat(p, "/"),
270
+ directory: path.join(cwd, p),
271
+ discover: "files",
272
+ symlink: true,
273
+ installed: installedRules,
274
+ itemLabelSingular: "rule",
275
+ itemLabelPlural: "rules",
276
+ }); });
277
+ var sparsePatterns = __spreadArray(__spreadArray([], SKILL_SOURCE_PATHS, true), RULE_SOURCE_PATHS, true).map(function (p) { return "".concat(p, "/"); });
278
+ var tempDirs = [];
279
+ try {
280
+ for (var _b = 0, repos_1 = repos; _b < repos_1.length; _b++) {
281
+ var rawUrl = repos_1[_b];
282
+ var cloneDir = cloneRepo(rawUrl, sparsePatterns);
283
+ tempDirs.push(cloneDir);
284
+ for (var _c = 0, SKILL_SOURCE_PATHS_1 = SKILL_SOURCE_PATHS; _c < SKILL_SOURCE_PATHS_1.length; _c++) {
285
+ var p = SKILL_SOURCE_PATHS_1[_c];
286
+ skillSources.push({
287
+ label: "external ".concat(rawUrl, " (").concat(p, "/)"),
288
+ directory: path.join(cloneDir, p),
289
+ discover: "folders",
290
+ symlink: false,
291
+ filterInternal: true,
292
+ installed: installedSkills,
293
+ itemLabelSingular: "skill",
294
+ itemLabelPlural: "skills",
295
+ });
296
+ }
297
+ for (var _d = 0, RULE_SOURCE_PATHS_1 = RULE_SOURCE_PATHS; _d < RULE_SOURCE_PATHS_1.length; _d++) {
298
+ var p = RULE_SOURCE_PATHS_1[_d];
299
+ ruleSources.push({
300
+ label: "external ".concat(rawUrl, " (").concat(p, "/)"),
301
+ directory: path.join(cloneDir, p),
302
+ discover: "files",
303
+ symlink: false,
304
+ filterInternal: true,
305
+ installed: installedRules,
306
+ itemLabelSingular: "rule",
307
+ itemLabelPlural: "rules",
308
+ });
309
+ }
310
+ }
311
+ var skillCount = installItems(skillSources, skillsTargetDirs, options);
312
+ var ruleCount = installItems(ruleSources, rulesTargetDirs, options);
313
+ console.log("\nTotal skills installed: ".concat(skillCount));
314
+ console.log("Total rules installed: ".concat(ruleCount));
315
+ }
316
+ finally {
317
+ for (var _e = 0, tempDirs_1 = tempDirs; _e < tempDirs_1.length; _e++) {
318
+ var tmpDir = tempDirs_1[_e];
319
+ fs.rmSync(tmpDir, { recursive: true, force: true });
320
+ }
321
+ }
322
+ }
323
+ exports.installAgentFeaturesCommand = new commander_1.Command("install-agent-features")
324
+ .description("Install agent features (skills and rules) from local directories and optional external git repos")
325
+ .option("--config <path>", "Path to a JSON config file specifying repos to install features from", "agent-features.json")
326
+ .option("--dry-run", "Show which symlinks/copies would be created without making changes", false)
327
+ .action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
328
+ var configPath, dryRun, resolvedConfig, repos;
329
+ var _a;
330
+ return __generator(this, function (_b) {
331
+ configPath = options.config, dryRun = options.dryRun;
332
+ resolvedConfig = path.resolve(configPath);
333
+ repos = fs.existsSync(resolvedConfig) ? ((_a = loadConfig(configPath).repos) !== null && _a !== void 0 ? _a : []) : [];
334
+ console.log("=== Installing agent features".concat(dryRun ? " (dry run)" : "", " ==="));
335
+ installFeatures(process.cwd(), repos, { dryRun: dryRun });
336
+ console.log("=== Finished ===");
337
+ return [2 /*return*/];
338
+ });
339
+ }); });
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ /* eslint-disable no-console */
37
+ var fs = __importStar(require("fs"));
38
+ var path = __importStar(require("path"));
39
+ var vitest_1 = require("vitest");
40
+ var install_agent_features_1 = require("./install-agent-features");
41
+ vitest_1.vi.mock("fs");
42
+ /**
43
+ * fs mock for installFeatures.
44
+ *
45
+ * - `listings` maps a directory path to the names of its direct entries.
46
+ * - Entries are assumed to be directories unless the entry name ends in `.md`
47
+ * or appears in `fileContents`.
48
+ * - `existingDests` is the set of destination paths that pathExists/lstatSync
49
+ * should return truthy for (used to assert overwrite behavior).
50
+ * - `fileContents` provides content for fs.readFileSync; any path not in the
51
+ * map throws ENOENT.
52
+ */
53
+ function mockFilesystem(_a) {
54
+ var _b = _a === void 0 ? {} : _a, _c = _b.listings, listings = _c === void 0 ? {} : _c, _d = _b.existingDests, existingDests = _d === void 0 ? [] : _d, _e = _b.fileContents, fileContents = _e === void 0 ? {} : _e;
55
+ var isFile = function (p) {
56
+ if (p in fileContents) {
57
+ return true;
58
+ }
59
+ return path.basename(p).endsWith(".md");
60
+ };
61
+ vitest_1.vi.mocked(fs.existsSync).mockImplementation(function (p) { return String(p) in listings; });
62
+ vitest_1.vi.mocked(fs.readdirSync).mockImplementation(function (p) { var _a; return (_a = listings[String(p)]) !== null && _a !== void 0 ? _a : []; });
63
+ vitest_1.vi.mocked(fs.statSync).mockImplementation(function (p) {
64
+ var fileLike = isFile(String(p));
65
+ return { isDirectory: function () { return !fileLike; }, isFile: function () { return fileLike; } };
66
+ });
67
+ vitest_1.vi.mocked(fs.lstatSync).mockImplementation(function (p) {
68
+ if (existingDests.includes(String(p))) {
69
+ return {};
70
+ }
71
+ throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });
72
+ });
73
+ vitest_1.vi.mocked(fs.readFileSync).mockImplementation(function (p) {
74
+ var content = fileContents[String(p)];
75
+ if (content !== undefined) {
76
+ return content;
77
+ }
78
+ throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });
79
+ });
80
+ }
81
+ (0, vitest_1.beforeEach)(function () {
82
+ vitest_1.vi.mocked(fs.mkdirSync).mockImplementation(function () { return undefined; });
83
+ vitest_1.vi.mocked(fs.symlinkSync).mockImplementation(function () { return undefined; });
84
+ vitest_1.vi.mocked(fs.cpSync).mockImplementation(function () { return undefined; });
85
+ vitest_1.vi.mocked(fs.rmSync).mockImplementation(function () { return undefined; });
86
+ vitest_1.vi.spyOn(console, "log").mockImplementation(function () { return undefined; });
87
+ vitest_1.vi.spyOn(console, "warn").mockImplementation(function () { return undefined; });
88
+ });
89
+ (0, vitest_1.afterEach)(function () {
90
+ vitest_1.vi.clearAllMocks();
91
+ vitest_1.vi.restoreAllMocks();
92
+ });
93
+ (0, vitest_1.describe)("installFeatures – local skills", function () {
94
+ (0, vitest_1.it)("symlinks skill folders into .agents/skills and .claude/skills", function () {
95
+ mockFilesystem({ listings: { "/proj/skills": ["my-skill"] } });
96
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
97
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/skills/my-skill"), path.join("/proj", ".agents", "skills", "my-skill"));
98
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/skills/my-skill"), path.join("/proj", ".claude", "skills", "my-skill"));
99
+ });
100
+ (0, vitest_1.it)("also installs from agentic-plugin/skills/", function () {
101
+ mockFilesystem({ listings: { "/proj/agentic-plugin/skills": ["plugin-skill"] } });
102
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
103
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/agentic-plugin/skills/plugin-skill"), path.join("/proj", ".claude", "skills", "plugin-skill"));
104
+ });
105
+ (0, vitest_1.it)("skills/ takes priority over agentic-plugin/skills/ for same name", function () {
106
+ mockFilesystem({
107
+ listings: {
108
+ "/proj/skills": ["shared"],
109
+ "/proj/agentic-plugin/skills": ["shared"],
110
+ },
111
+ });
112
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
113
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/skills/shared"), vitest_1.expect.any(String));
114
+ (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalledWith(path.resolve("/proj/agentic-plugin/skills/shared"), vitest_1.expect.any(String));
115
+ (0, vitest_1.expect)(console.warn).toHaveBeenCalledWith(vitest_1.expect.stringContaining('CONFLICT: "shared"'));
116
+ });
117
+ (0, vitest_1.it)("ignores files in skills/ — only subdirectories are skills", function () {
118
+ mockFilesystem({ listings: { "/proj/skills": ["real-skill", "not-a-skill.md"] } });
119
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
120
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/skills/real-skill"), vitest_1.expect.any(String));
121
+ (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalledWith(path.resolve("/proj/skills/not-a-skill.md"), vitest_1.expect.any(String));
122
+ });
123
+ });
124
+ (0, vitest_1.describe)("installFeatures – local rules", function () {
125
+ (0, vitest_1.it)("symlinks .md files into .agents/rules, .claude/rules, .cursor/rules, and .github/instructions", function () {
126
+ mockFilesystem({ listings: { "/proj/rules": ["my-rule.md"] } });
127
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
128
+ (0, vitest_1.expect)(fs.mkdirSync).toHaveBeenCalledWith(path.join("/proj", ".agents", "rules"), { recursive: true });
129
+ (0, vitest_1.expect)(fs.mkdirSync).toHaveBeenCalledWith(path.join("/proj", ".claude", "rules"), { recursive: true });
130
+ (0, vitest_1.expect)(fs.mkdirSync).toHaveBeenCalledWith(path.join("/proj", ".cursor", "rules"), { recursive: true });
131
+ (0, vitest_1.expect)(fs.mkdirSync).toHaveBeenCalledWith(path.join("/proj", ".github", "instructions"), { recursive: true });
132
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/my-rule.md"), path.join("/proj", ".agents", "rules", "my-rule.md"));
133
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/my-rule.md"), path.join("/proj", ".claude", "rules", "my-rule.md"));
134
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/my-rule.md"), path.join("/proj", ".cursor", "rules", "my-rule.md"));
135
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/my-rule.md"), path.join("/proj", ".github", "instructions", "my-rule.md"));
136
+ });
137
+ (0, vitest_1.it)("walks subdirectories recursively, preserving the layout in each target", function () {
138
+ mockFilesystem({
139
+ listings: {
140
+ "/proj/rules": ["top.md", "backend"],
141
+ "/proj/rules/backend": ["api.md", "deeper"],
142
+ "/proj/rules/backend/deeper": ["nested.md"],
143
+ },
144
+ });
145
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
146
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/backend/api.md"), path.join("/proj", ".claude", "rules", "backend", "api.md"));
147
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/backend/deeper/nested.md"), path.join("/proj", ".claude", "rules", "backend", "deeper", "nested.md"));
148
+ (0, vitest_1.expect)(fs.mkdirSync).toHaveBeenCalledWith(path.join("/proj", ".claude", "rules", "backend"), { recursive: true });
149
+ (0, vitest_1.expect)(fs.mkdirSync).toHaveBeenCalledWith(path.join("/proj", ".claude", "rules", "backend", "deeper"), { recursive: true });
150
+ });
151
+ (0, vitest_1.it)("ignores non-.md entries", function () {
152
+ mockFilesystem({ listings: { "/proj/rules": ["rule.md", "README.txt"] } });
153
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
154
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/rule.md"), vitest_1.expect.any(String));
155
+ (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalledWith(path.resolve("/proj/rules/README.txt"), vitest_1.expect.any(String));
156
+ });
157
+ });
158
+ (0, vitest_1.describe)("installFeatures – cross-namespace", function () {
159
+ (0, vitest_1.it)("a skill and a rule may share a name without conflicting", function () {
160
+ mockFilesystem({
161
+ listings: {
162
+ "/proj/skills": ["shared"],
163
+ "/proj/rules": ["shared.md"],
164
+ },
165
+ });
166
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
167
+ (0, vitest_1.expect)(console.warn).not.toHaveBeenCalled();
168
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/skills/shared"), vitest_1.expect.any(String));
169
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/rules/shared.md"), vitest_1.expect.any(String));
170
+ });
171
+ });
172
+ (0, vitest_1.describe)("installFeatures – dry-run", function () {
173
+ (0, vitest_1.it)("writes nothing", function () {
174
+ mockFilesystem({
175
+ listings: {
176
+ "/proj/skills": ["my-skill"],
177
+ "/proj/rules": ["my-rule.md"],
178
+ },
179
+ });
180
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: true });
181
+ (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalled();
182
+ (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
183
+ (0, vitest_1.expect)(fs.rmSync).not.toHaveBeenCalled();
184
+ });
185
+ (0, vitest_1.it)("logs would-be operations", function () {
186
+ mockFilesystem({ listings: { "/proj/skills": ["my-skill"] } });
187
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: true });
188
+ (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("[dry-run] Would symlink: ".concat(path.resolve("/proj/skills/my-skill"))));
189
+ });
190
+ });
191
+ (0, vitest_1.describe)("installFeatures – overwrites existing destinations", function () {
192
+ (0, vitest_1.it)("removes the existing destination before re-creating it", function () {
193
+ mockFilesystem({
194
+ listings: { "/proj/skills": ["my-skill"] },
195
+ existingDests: [path.join("/proj", ".agents", "skills", "my-skill"), path.join("/proj", ".claude", "skills", "my-skill")],
196
+ });
197
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
198
+ (0, vitest_1.expect)(fs.rmSync).toHaveBeenCalledWith(path.join("/proj", ".agents", "skills", "my-skill"), { recursive: true, force: true });
199
+ (0, vitest_1.expect)(fs.rmSync).toHaveBeenCalledWith(path.join("/proj", ".claude", "skills", "my-skill"), { recursive: true, force: true });
200
+ });
201
+ });
202
+ (0, vitest_1.describe)("installFeatures – internal filtering", function () {
203
+ (0, vitest_1.it)("local sources install internal skills (filterInternal applies only to external repos)", function () {
204
+ mockFilesystem({
205
+ listings: { "/proj/skills": ["public", "internal"] },
206
+ fileContents: { "/proj/skills/internal/SKILL.md": "---\nmetadata:\n internal: true\n---\n# Internal" },
207
+ });
208
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
209
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/skills/public"), vitest_1.expect.any(String));
210
+ (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/proj/skills/internal"), vitest_1.expect.any(String));
211
+ });
212
+ });
213
+ (0, vitest_1.describe)("installFeatures – missing local sources", function () {
214
+ (0, vitest_1.it)("runs cleanly when there are no local skills or rules", function () {
215
+ mockFilesystem({});
216
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
217
+ (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalled();
218
+ (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
219
+ (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("No skills found"));
220
+ (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("No rules found"));
221
+ });
222
+ });
223
+ (0, vitest_1.describe)("installFeatures – EPERM symlink fallback", function () {
224
+ (0, vitest_1.it)("falls back to copy when symlinkSync throws EPERM (e.g. Windows without privileges)", function () {
225
+ mockFilesystem({ listings: { "/proj/skills": ["my-skill"] } });
226
+ vitest_1.vi.mocked(fs.symlinkSync).mockImplementationOnce(function () {
227
+ throw Object.assign(new Error("permission denied"), { code: "EPERM" });
228
+ });
229
+ (0, install_agent_features_1.installFeatures)("/proj", [], { dryRun: false });
230
+ (0, vitest_1.expect)(fs.cpSync).toHaveBeenCalledWith(path.resolve("/proj/skills/my-skill"), path.join("/proj", ".agents", "skills", "my-skill"), {
231
+ recursive: true,
232
+ });
233
+ });
234
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/cli",
3
- "version": "9.0.0-beta.3",
3
+ "version": "9.0.0-beta.4",
4
4
  "description": "A collection of CLI tools for Comet projects",
5
5
  "repository": {
6
6
  "directory": "packages/cli",
@@ -14,6 +14,7 @@
14
14
  "bin": {
15
15
  "comet": "bin/comet.js"
16
16
  },
17
+ "sideEffects": false,
17
18
  "files": [
18
19
  "bin/**/*.js",
19
20
  "lib/*"
@@ -26,13 +27,13 @@
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/js-yaml": "^4.0.9",
29
- "@types/node": "^24.12.2",
30
- "eslint": "^9.39.2",
30
+ "@types/node": "^24.12.4",
31
+ "eslint": "^9.39.4",
31
32
  "npm-run-all2": "^8.0.4",
32
33
  "rimraf": "^6.1.2",
33
34
  "typescript": "^5.9.3",
34
35
  "vitest": "^4.0.16",
35
- "@comet/eslint-config": "9.0.0-beta.3"
36
+ "@comet/eslint-config": "9.0.0-beta.4"
36
37
  },
37
38
  "engines": {
38
39
  "node": ">=22.0.0"
@@ -1,15 +0,0 @@
1
- import { Command } from "commander";
2
- export interface SkillSource {
3
- label: string;
4
- directory: string;
5
- /** If true, create symlinks; if false, copy files (used for tmp clone dirs) */
6
- symlink: boolean;
7
- /** If true, skills with metadata.internal: true in their SKILL.md are excluded */
8
- filterInternal?: boolean;
9
- }
10
- export interface InstallOptions {
11
- dryRun: boolean;
12
- }
13
- export declare function isInternalSkill(skillFolderPath: string): boolean;
14
- export declare function installSkills(sources: SkillSource[], targetDirs: string[], { dryRun }: InstallOptions): void;
15
- export declare const installAgentSkillsCommand: Command;
@@ -1,255 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __generator = (this && this.__generator) || function (thisArg, body) {
45
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
47
- function verb(n) { return function (v) { return step([n, v]); }; }
48
- function step(op) {
49
- if (f) throw new TypeError("Generator is already executing.");
50
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
51
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
52
- if (y = 0, t) op = [op[0] & 2, t.value];
53
- switch (op[0]) {
54
- case 0: case 1: t = op; break;
55
- case 4: _.label++; return { value: op[1], done: false };
56
- case 5: _.label++; y = op[1]; op = [0]; continue;
57
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
58
- default:
59
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
60
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
61
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
62
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
63
- if (t[2]) _.ops.pop();
64
- _.trys.pop(); continue;
65
- }
66
- op = body.call(thisArg, _);
67
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
68
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
69
- }
70
- };
71
- Object.defineProperty(exports, "__esModule", { value: true });
72
- exports.installAgentSkillsCommand = void 0;
73
- exports.isInternalSkill = isInternalSkill;
74
- exports.installSkills = installSkills;
75
- /* eslint-disable no-console */
76
- var child_process_1 = require("child_process");
77
- var commander_1 = require("commander");
78
- var fs = __importStar(require("fs"));
79
- var yaml = __importStar(require("js-yaml"));
80
- var os = __importStar(require("os"));
81
- var path = __importStar(require("path"));
82
- function parseRepoUrl(rawUrl) {
83
- var hashIndex = rawUrl.lastIndexOf("#");
84
- if (hashIndex === -1) {
85
- return { repoUrl: rawUrl, ref: undefined };
86
- }
87
- return { repoUrl: rawUrl.slice(0, hashIndex), ref: rawUrl.slice(hashIndex + 1) || undefined };
88
- }
89
- var SKILL_SOURCE_PATHS = ["skills", "agentic-plugin/skills"];
90
- function cloneRepo(rawUrl) {
91
- var _a = parseRepoUrl(rawUrl), repoUrl = _a.repoUrl, ref = _a.ref;
92
- var tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "comet-agent-skills-"));
93
- // Use sparse checkout to fetch only the skill source folders
94
- (0, child_process_1.execFileSync)("git", ["init", tmpDir], { stdio: "pipe" });
95
- (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "remote", "add", "origin", "--", repoUrl], { stdio: "pipe" });
96
- (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "config", "core.sparseCheckout", "true"], { stdio: "pipe" });
97
- fs.writeFileSync(path.join(tmpDir, ".git", "info", "sparse-checkout"), SKILL_SOURCE_PATHS.map(function (p) { return "".concat(p, "/\n"); }).join(""));
98
- var fetchRef = ref !== null && ref !== void 0 ? ref : "HEAD";
99
- try {
100
- console.log("Fetching ".concat(repoUrl, " ref \"").concat(fetchRef, "\" (sparse, ").concat(SKILL_SOURCE_PATHS.map(function (p) { return "".concat(p, "/"); }).join(", "), " only)..."));
101
- (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "fetch", "--depth", "1", "origin", fetchRef], { stdio: "pipe" });
102
- (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "checkout", "FETCH_HEAD"], { stdio: "pipe" });
103
- }
104
- catch (_b) {
105
- console.log("Shallow fetch failed for ref \"".concat(fetchRef, "\"; falling back to full fetch..."));
106
- (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "fetch", "origin", fetchRef], { stdio: "pipe" });
107
- (0, child_process_1.execFileSync)("git", ["-C", tmpDir, "checkout", "FETCH_HEAD"], { stdio: "pipe" });
108
- }
109
- return tmpDir;
110
- }
111
- function pathExists(p) {
112
- try {
113
- fs.lstatSync(p);
114
- return true;
115
- }
116
- catch (_a) {
117
- return false;
118
- }
119
- }
120
- function isInternalSkill(skillFolderPath) {
121
- var _a;
122
- var skillMdPath = path.join(skillFolderPath, "SKILL.md");
123
- var skillMdContent;
124
- try {
125
- skillMdContent = fs.readFileSync(skillMdPath, "utf-8");
126
- }
127
- catch (_b) {
128
- return false;
129
- }
130
- var frontmatterMatch = skillMdContent.match(/^---\n([\s\S]*?)\n---/);
131
- if (!frontmatterMatch) {
132
- return false;
133
- }
134
- try {
135
- var parsed = yaml.load(frontmatterMatch[1]);
136
- return ((_a = parsed === null || parsed === void 0 ? void 0 : parsed.metadata) === null || _a === void 0 ? void 0 : _a.internal) === true;
137
- }
138
- catch (_c) {
139
- return false;
140
- }
141
- }
142
- function listSkillFolders(directory, filterInternal) {
143
- if (filterInternal === void 0) { filterInternal = false; }
144
- if (!fs.existsSync(directory)) {
145
- return [];
146
- }
147
- return fs
148
- .readdirSync(directory)
149
- .filter(function (f) { return fs.statSync(path.join(directory, f)).isDirectory(); })
150
- .filter(function (folder) { return !filterInternal || !isInternalSkill(path.join(directory, folder)); })
151
- .sort();
152
- }
153
- function installSkills(sources, targetDirs, _a) {
154
- var dryRun = _a.dryRun;
155
- var installed = new Set();
156
- for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) {
157
- var _b = sources_1[_i], label = _b.label, directory = _b.directory, symlink = _b.symlink, filterInternal = _b.filterInternal;
158
- var folders = listSkillFolders(directory, filterInternal);
159
- if (folders.length === 0) {
160
- console.log("No skills found in ".concat(label));
161
- continue;
162
- }
163
- console.log("Installing ".concat(folders.length, " skill(s) from ").concat(label, "..."));
164
- for (var _c = 0, folders_1 = folders; _c < folders_1.length; _c++) {
165
- var folder = folders_1[_c];
166
- if (installed.has(folder)) {
167
- console.warn(" CONFLICT: \"".concat(folder, "\" from ").concat(label, " skipped (already installed from a higher-priority source)"));
168
- continue;
169
- }
170
- var srcPath = path.resolve(path.join(directory, folder));
171
- for (var _d = 0, targetDirs_1 = targetDirs; _d < targetDirs_1.length; _d++) {
172
- var targetDir = targetDirs_1[_d];
173
- var destPath = path.join(targetDir, folder);
174
- var exists = pathExists(destPath);
175
- if (dryRun) {
176
- console.log(" [dry-run] Would ".concat(symlink ? "symlink" : "copy", ": ").concat(srcPath, " -> ").concat(destPath));
177
- }
178
- else {
179
- if (exists) {
180
- fs.rmSync(destPath, { recursive: true, force: true });
181
- }
182
- if (symlink) {
183
- fs.symlinkSync(srcPath, destPath);
184
- }
185
- else {
186
- fs.cpSync(srcPath, destPath, { recursive: true });
187
- }
188
- console.log(" ".concat(symlink ? "Symlinked" : "Copied", ": ").concat(folder));
189
- }
190
- }
191
- installed.add(folder);
192
- }
193
- }
194
- console.log("\nTotal skills installed: ".concat(installed.size));
195
- }
196
- function loadConfig(configPath) {
197
- var resolved = path.resolve(configPath);
198
- if (!fs.existsSync(resolved)) {
199
- throw new Error("Config file not found: ".concat(resolved));
200
- }
201
- var raw = fs.readFileSync(resolved, "utf-8");
202
- return JSON.parse(raw);
203
- }
204
- exports.installAgentSkillsCommand = new commander_1.Command("install-agent-skills")
205
- .description("Install agent skills from local directories and optional external git repos")
206
- .option("--config <path>", "Path to a JSON config file specifying repos to install skills from", "agent-skills.json")
207
- .option("--dry-run", "Show which symlinks/copies would be created without making changes", false)
208
- .action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
209
- var configPath, dryRun, resolvedConfig, repos, cwd, targetDirs, _i, targetDirs_2, dir, sources, tempDirs, _a, repos_1, rawUrl, cloneDir, _b, SKILL_SOURCE_PATHS_1, p, _c, tempDirs_1, tmpDir;
210
- var _d;
211
- return __generator(this, function (_e) {
212
- configPath = options.config, dryRun = options.dryRun;
213
- resolvedConfig = path.resolve(configPath);
214
- repos = fs.existsSync(resolvedConfig) ? ((_d = loadConfig(configPath).repos) !== null && _d !== void 0 ? _d : []) : [];
215
- console.log("=== Installing agent skills".concat(dryRun ? " (dry run)" : "", " ==="));
216
- cwd = process.cwd();
217
- targetDirs = [path.join(cwd, ".agents", "skills"), path.join(cwd, ".claude", "skills")];
218
- // Ensure target directories exist (without clearing existing contents)
219
- for (_i = 0, targetDirs_2 = targetDirs; _i < targetDirs_2.length; _i++) {
220
- dir = targetDirs_2[_i];
221
- fs.mkdirSync(dir, { recursive: true });
222
- }
223
- sources = SKILL_SOURCE_PATHS.map(function (p) { return ({
224
- label: "local ".concat(p, "/"),
225
- directory: path.join(cwd, p),
226
- symlink: true,
227
- }); });
228
- tempDirs = [];
229
- try {
230
- for (_a = 0, repos_1 = repos; _a < repos_1.length; _a++) {
231
- rawUrl = repos_1[_a];
232
- cloneDir = cloneRepo(rawUrl);
233
- tempDirs.push(cloneDir);
234
- for (_b = 0, SKILL_SOURCE_PATHS_1 = SKILL_SOURCE_PATHS; _b < SKILL_SOURCE_PATHS_1.length; _b++) {
235
- p = SKILL_SOURCE_PATHS_1[_b];
236
- sources.push({
237
- label: "external ".concat(rawUrl, " (").concat(p, "/)"),
238
- directory: path.join(cloneDir, p),
239
- symlink: false,
240
- filterInternal: true,
241
- });
242
- }
243
- }
244
- installSkills(sources, targetDirs, { dryRun: dryRun });
245
- }
246
- finally {
247
- for (_c = 0, tempDirs_1 = tempDirs; _c < tempDirs_1.length; _c++) {
248
- tmpDir = tempDirs_1[_c];
249
- fs.rmSync(tmpDir, { recursive: true, force: true });
250
- }
251
- }
252
- console.log("=== Finished ===");
253
- return [2 /*return*/];
254
- });
255
- }); });
@@ -1,280 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- /* eslint-disable no-console */
37
- var fs = __importStar(require("fs"));
38
- var path = __importStar(require("path"));
39
- var vitest_1 = require("vitest");
40
- var install_agent_skills_1 = require("./install-agent-skills");
41
- vitest_1.vi.mock("fs");
42
- var defaultOptions = { dryRun: false };
43
- var targetDirs = [".agents/skills", ".claude/skills"];
44
- /**
45
- * Sets up fs mocks so that each key in skillMap is a readable directory
46
- * containing the listed skill folder names. Destination paths do not exist
47
- * unless listed under a target dir key.
48
- */
49
- function mockFilesystem(skillMap, existingDests, skillMdContents) {
50
- if (existingDests === void 0) { existingDests = []; }
51
- if (skillMdContents === void 0) { skillMdContents = {}; }
52
- vitest_1.vi.mocked(fs.existsSync).mockImplementation(function (p) { return String(p) in skillMap; });
53
- vitest_1.vi.mocked(fs.readdirSync).mockImplementation(function (p) { var _a; return (_a = skillMap[String(p)]) !== null && _a !== void 0 ? _a : []; });
54
- vitest_1.vi.mocked(fs.statSync).mockImplementation(function (p) {
55
- var _a;
56
- var parentDir = path.dirname(String(p));
57
- var name = path.basename(String(p));
58
- var isDir = ((_a = skillMap[parentDir]) !== null && _a !== void 0 ? _a : []).includes(name);
59
- return { isDirectory: function () { return isDir; } };
60
- });
61
- vitest_1.vi.mocked(fs.lstatSync).mockImplementation(function (p) {
62
- if (existingDests.includes(String(p))) {
63
- return {};
64
- }
65
- throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });
66
- });
67
- vitest_1.vi.mocked(fs.readFileSync).mockImplementation(function (p) {
68
- var content = skillMdContents[String(p)];
69
- if (content !== undefined) {
70
- return content;
71
- }
72
- throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });
73
- });
74
- }
75
- (0, vitest_1.beforeEach)(function () {
76
- vitest_1.vi.mocked(fs.symlinkSync).mockImplementation(function () { return undefined; });
77
- vitest_1.vi.mocked(fs.cpSync).mockImplementation(function () { return undefined; });
78
- vitest_1.vi.mocked(fs.rmSync).mockImplementation(function () { return undefined; });
79
- vitest_1.vi.mocked(fs.readFileSync).mockImplementation(function () {
80
- throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });
81
- });
82
- vitest_1.vi.spyOn(console, "log").mockImplementation(function () { return undefined; });
83
- vitest_1.vi.spyOn(console, "warn").mockImplementation(function () { return undefined; });
84
- });
85
- (0, vitest_1.afterEach)(function () {
86
- vitest_1.vi.clearAllMocks();
87
- vitest_1.vi.restoreAllMocks();
88
- });
89
- (0, vitest_1.describe)("installSkills – symlink vs copy", function () {
90
- (0, vitest_1.it)("symlinks skill folders into target folder if symlink: true", function () {
91
- mockFilesystem({ "/local/skills": ["my-skill"] });
92
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
93
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
94
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledTimes(2);
95
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/local/skills/my-skill"), ".agents/skills/my-skill");
96
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/local/skills/my-skill"), ".claude/skills/my-skill");
97
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
98
- });
99
- (0, vitest_1.it)("copies skill folders into target folder if symlink: false", function () {
100
- mockFilesystem({ "/remote/skills": ["remote-skill"] });
101
- var sources = [{ label: "external repo", directory: "/remote/skills", symlink: false }];
102
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
103
- (0, vitest_1.expect)(fs.cpSync).toHaveBeenCalledTimes(2);
104
- (0, vitest_1.expect)(fs.cpSync).toHaveBeenCalledWith(path.resolve("/remote/skills/remote-skill"), ".agents/skills/remote-skill", {
105
- recursive: true,
106
- });
107
- (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalled();
108
- });
109
- (0, vitest_1.it)("ignores files in the source directory, only installs subdirectories", function () {
110
- mockFilesystem({ "/local/skills": ["real-skill"] });
111
- // statSync returns isDirectory: false for "not-a-skill.md" (not in the skillMap)
112
- vitest_1.vi.mocked(fs.readdirSync).mockImplementation(function () { return ["real-skill", "not-a-skill.md"]; });
113
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
114
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
115
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledTimes(2);
116
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/local/skills/real-skill"), vitest_1.expect.any(String));
117
- (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalledWith(path.resolve("/local/skills/not-a-skill.md"), vitest_1.expect.any(String));
118
- });
119
- });
120
- (0, vitest_1.describe)("installSkills – missing source directory", function () {
121
- (0, vitest_1.it)("logs 'No skills found' and does nothing when source directory does not exist", function () {
122
- mockFilesystem({}); // existsSync returns false for all paths
123
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
124
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
125
- (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalled();
126
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
127
- (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("No skills found"));
128
- });
129
- (0, vitest_1.it)("logs 'No skills found' and does nothing when source directory is empty", function () {
130
- mockFilesystem({ "/local/skills": [] }); // dir exists but has no entries
131
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
132
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
133
- (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalled();
134
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
135
- (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("No skills found"));
136
- });
137
- (0, vitest_1.it)("logs 'No skills found' and does nothing when cloned external repo has no skills/ folder", function () {
138
- mockFilesystem({}); // cloned tmp dir exists but contains no skills/ subdirectory
139
- var sources = [
140
- { label: "external git@github.com:org/repo.git (skills/)", directory: "/tmp/cloned-repo/skills", symlink: false },
141
- ];
142
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
143
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
144
- (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("No skills found"));
145
- });
146
- });
147
- (0, vitest_1.describe)("installSkills – dry-run mode", function () {
148
- (0, vitest_1.it)("does not write any files or symlinks", function () {
149
- mockFilesystem({ "/local/skills": ["my-skill"] });
150
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
151
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, { dryRun: true });
152
- (0, vitest_1.expect)(fs.symlinkSync).not.toHaveBeenCalled();
153
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
154
- (0, vitest_1.expect)(fs.rmSync).not.toHaveBeenCalled();
155
- });
156
- (0, vitest_1.it)("logs what would be symlinked", function () {
157
- mockFilesystem({ "/local/skills": ["my-skill"] });
158
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
159
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, { dryRun: true });
160
- (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("[dry-run] Would symlink: ".concat(path.resolve("/local/skills/my-skill"))));
161
- });
162
- (0, vitest_1.it)("logs what would be copied for external sources", function () {
163
- mockFilesystem({ "/remote/skills": ["remote-skill"] });
164
- var sources = [{ label: "external repo", directory: "/remote/skills", symlink: false }];
165
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, { dryRun: true });
166
- (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("[dry-run] Would copy: ".concat(path.resolve("/remote/skills/remote-skill"))));
167
- });
168
- });
169
- (0, vitest_1.describe)("installSkills – overwrites existing destinations", function () {
170
- (0, vitest_1.it)("removes existing destination before writing", function () {
171
- mockFilesystem({ "/local/skills": ["my-skill"] }, [".agents/skills/my-skill", ".claude/skills/my-skill"]);
172
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
173
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
174
- (0, vitest_1.expect)(fs.rmSync).toHaveBeenCalledWith(".agents/skills/my-skill", { recursive: true, force: true });
175
- (0, vitest_1.expect)(fs.rmSync).toHaveBeenCalledWith(".claude/skills/my-skill", { recursive: true, force: true });
176
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledTimes(2);
177
- });
178
- });
179
- (0, vitest_1.describe)("installSkills – conflict: local vs remote", function () {
180
- (0, vitest_1.it)("local skill wins: symlinks local, skips remote with a CONFLICT warning", function () {
181
- mockFilesystem({
182
- "/local/skills": ["shared-skill"],
183
- "/remote/skills": ["shared-skill"],
184
- });
185
- var sources = [
186
- { label: "local skills/", directory: "/local/skills", symlink: true },
187
- { label: "external repo", directory: "/remote/skills", symlink: false },
188
- ];
189
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
190
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalled();
191
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
192
- (0, vitest_1.expect)(console.warn).toHaveBeenCalledWith(vitest_1.expect.stringContaining('CONFLICT: "shared-skill"'));
193
- (0, vitest_1.expect)(console.warn).toHaveBeenCalledWith(vitest_1.expect.stringContaining("external repo"));
194
- });
195
- });
196
- (0, vitest_1.describe)("installSkills – conflict: remote vs remote", function () {
197
- (0, vitest_1.it)("first remote wins: copies remote1 skill, skips remote2 with a CONFLICT warning", function () {
198
- mockFilesystem({
199
- "/remote1/skills": ["shared-skill"],
200
- "/remote2/skills": ["shared-skill"],
201
- });
202
- var sources = [
203
- { label: "external repo1", directory: "/remote1/skills", symlink: false },
204
- { label: "external repo2", directory: "/remote2/skills", symlink: false },
205
- ];
206
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
207
- // Only 2 calls (one per target dir from remote1), not 4
208
- (0, vitest_1.expect)(fs.cpSync).toHaveBeenCalledTimes(2);
209
- (0, vitest_1.expect)(fs.cpSync).toHaveBeenCalledWith(path.resolve("/remote1/skills/shared-skill"), vitest_1.expect.any(String), { recursive: true });
210
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalledWith(path.resolve("/remote2/skills/shared-skill"), vitest_1.expect.any(String), vitest_1.expect.any(Object));
211
- (0, vitest_1.expect)(console.warn).toHaveBeenCalledWith(vitest_1.expect.stringContaining('CONFLICT: "shared-skill"'));
212
- (0, vitest_1.expect)(console.warn).toHaveBeenCalledWith(vitest_1.expect.stringContaining("external repo2"));
213
- });
214
- });
215
- (0, vitest_1.describe)("isInternalSkill", function () {
216
- (0, vitest_1.it)("returns true when metadata.internal is true", function () {
217
- mockFilesystem({}, [], { "/skills/my-skill/SKILL.md": "---\nmetadata:\n internal: true\n---\n# My Skill" });
218
- (0, vitest_1.expect)((0, install_agent_skills_1.isInternalSkill)("/skills/my-skill")).toBe(true);
219
- });
220
- (0, vitest_1.it)("returns false when metadata.internal is false", function () {
221
- mockFilesystem({}, [], { "/skills/my-skill/SKILL.md": "---\nmetadata:\n internal: false\n---\n# My Skill" });
222
- (0, vitest_1.expect)((0, install_agent_skills_1.isInternalSkill)("/skills/my-skill")).toBe(false);
223
- });
224
- (0, vitest_1.it)("returns false when frontmatter has no metadata field", function () {
225
- mockFilesystem({}, [], { "/skills/my-skill/SKILL.md": "---\ntitle: My Skill\n---\n# My Skill" });
226
- (0, vitest_1.expect)((0, install_agent_skills_1.isInternalSkill)("/skills/my-skill")).toBe(false);
227
- });
228
- (0, vitest_1.it)("returns false when SKILL.md has no frontmatter", function () {
229
- mockFilesystem({}, [], { "/skills/my-skill/SKILL.md": "# My Skill\nJust plain markdown, no frontmatter." });
230
- (0, vitest_1.expect)((0, install_agent_skills_1.isInternalSkill)("/skills/my-skill")).toBe(false);
231
- });
232
- (0, vitest_1.it)("returns false when SKILL.md does not exist", function () {
233
- mockFilesystem({}, [], {});
234
- (0, vitest_1.expect)((0, install_agent_skills_1.isInternalSkill)("/skills/my-skill")).toBe(false);
235
- });
236
- (0, vitest_1.it)("returns false when SKILL.md frontmatter contains malformed YAML", function () {
237
- mockFilesystem({}, [], { "/skills/my-skill/SKILL.md": "---\n: invalid: yaml: [\n---\n# My Skill" });
238
- (0, vitest_1.expect)((0, install_agent_skills_1.isInternalSkill)("/skills/my-skill")).toBe(false);
239
- });
240
- });
241
- (0, vitest_1.describe)("installSkills – filterInternal", function () {
242
- (0, vitest_1.it)("excludes internal skills when filterInternal: true, installs only non-internal skills", function () {
243
- mockFilesystem({ "/remote/skills": ["public-skill", "internal-skill"] }, [], {
244
- "/remote/skills/internal-skill/SKILL.md": "---\nmetadata:\n internal: true\n---\n# Internal Skill",
245
- });
246
- var sources = [{ label: "external repo (skills/)", directory: "/remote/skills", symlink: false, filterInternal: true }];
247
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
248
- (0, vitest_1.expect)(fs.cpSync).toHaveBeenCalledTimes(2);
249
- (0, vitest_1.expect)(fs.cpSync).toHaveBeenCalledWith(path.resolve("/remote/skills/public-skill"), vitest_1.expect.any(String), { recursive: true });
250
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalledWith(path.resolve("/remote/skills/internal-skill"), vitest_1.expect.any(String), vitest_1.expect.any(Object));
251
- });
252
- (0, vitest_1.it)("installs all skills including internal ones when filterInternal is omitted", function () {
253
- mockFilesystem({ "/local/skills": ["public-skill", "internal-skill"] }, [], {
254
- "/local/skills/internal-skill/SKILL.md": "---\nmetadata:\n internal: true\n---\n# Internal Skill",
255
- });
256
- var sources = [{ label: "local skills/", directory: "/local/skills", symlink: true }];
257
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
258
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledTimes(4);
259
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/local/skills/public-skill"), vitest_1.expect.any(String));
260
- (0, vitest_1.expect)(fs.symlinkSync).toHaveBeenCalledWith(path.resolve("/local/skills/internal-skill"), vitest_1.expect.any(String));
261
- });
262
- (0, vitest_1.it)("logs 'No skills found' when filterInternal: true and all skills are internal", function () {
263
- mockFilesystem({ "/remote/skills": ["internal-skill"] }, [], {
264
- "/remote/skills/internal-skill/SKILL.md": "---\nmetadata:\n internal: true\n---\n# Internal Skill",
265
- });
266
- var sources = [{ label: "external repo (skills/)", directory: "/remote/skills", symlink: false, filterInternal: true }];
267
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, defaultOptions);
268
- (0, vitest_1.expect)(fs.cpSync).not.toHaveBeenCalled();
269
- (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("No skills found"));
270
- });
271
- (0, vitest_1.it)("excludes internal skills from dry-run output when filterInternal: true", function () {
272
- mockFilesystem({ "/remote/skills": ["public-skill", "internal-skill"] }, [], {
273
- "/remote/skills/internal-skill/SKILL.md": "---\nmetadata:\n internal: true\n---\n# Internal Skill",
274
- });
275
- var sources = [{ label: "external repo (skills/)", directory: "/remote/skills", symlink: false, filterInternal: true }];
276
- (0, install_agent_skills_1.installSkills)(sources, targetDirs, { dryRun: true });
277
- (0, vitest_1.expect)(console.log).toHaveBeenCalledWith(vitest_1.expect.stringContaining("public-skill"));
278
- (0, vitest_1.expect)(console.log).not.toHaveBeenCalledWith(vitest_1.expect.stringContaining("internal-skill"));
279
- });
280
- });