@cantemizyurek/skillz 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3402,7 +3402,7 @@ var require_parse = __commonJS({
3402
3402
  var require_gray_matter = __commonJS({
3403
3403
  "../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
3404
3404
  "use strict";
3405
- var fs5 = require("fs");
3405
+ var fs6 = require("fs");
3406
3406
  var sections = require_section_matter();
3407
3407
  var defaults = require_defaults();
3408
3408
  var stringify = require_stringify();
@@ -3486,7 +3486,7 @@ var require_gray_matter = __commonJS({
3486
3486
  return stringify(file, data, options2);
3487
3487
  };
3488
3488
  matter2.read = function(filepath, options2) {
3489
- const str2 = fs5.readFileSync(filepath, "utf8");
3489
+ const str2 = fs6.readFileSync(filepath, "utf8");
3490
3490
  const file = matter2(str2, options2);
3491
3491
  file.path = filepath;
3492
3492
  return file;
@@ -3574,7 +3574,7 @@ var require_pend = __commonJS({
3574
3574
  var require_fd_slicer = __commonJS({
3575
3575
  "../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/fd-slicer.js"(exports2) {
3576
3576
  "use strict";
3577
- var fs5 = require("fs");
3577
+ var fs6 = require("fs");
3578
3578
  var util2 = require("util");
3579
3579
  var stream = require("stream");
3580
3580
  var Readable = stream.Readable;
@@ -3599,7 +3599,7 @@ var require_fd_slicer = __commonJS({
3599
3599
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
3600
3600
  var self = this;
3601
3601
  self.pend.go(function(cb) {
3602
- fs5.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
3602
+ fs6.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
3603
3603
  cb();
3604
3604
  callback(err, bytesRead, buffer2);
3605
3605
  });
@@ -3608,7 +3608,7 @@ var require_fd_slicer = __commonJS({
3608
3608
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
3609
3609
  var self = this;
3610
3610
  self.pend.go(function(cb) {
3611
- fs5.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
3611
+ fs6.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
3612
3612
  cb();
3613
3613
  callback(err, written, buffer2);
3614
3614
  });
@@ -3629,7 +3629,7 @@ var require_fd_slicer = __commonJS({
3629
3629
  if (self.refCount > 0) return;
3630
3630
  if (self.refCount < 0) throw new Error("invalid unref");
3631
3631
  if (self.autoClose) {
3632
- fs5.close(self.fd, onCloseDone);
3632
+ fs6.close(self.fd, onCloseDone);
3633
3633
  }
3634
3634
  function onCloseDone(err) {
3635
3635
  if (err) {
@@ -3666,7 +3666,7 @@ var require_fd_slicer = __commonJS({
3666
3666
  self.context.pend.go(function(cb) {
3667
3667
  if (self.destroyed) return cb();
3668
3668
  var buffer = Buffer.allocUnsafe(toRead);
3669
- fs5.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
3669
+ fs6.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
3670
3670
  if (err) {
3671
3671
  self.destroy(err);
3672
3672
  } else if (bytesRead === 0) {
@@ -3713,7 +3713,7 @@ var require_fd_slicer = __commonJS({
3713
3713
  }
3714
3714
  self.context.pend.go(function(cb) {
3715
3715
  if (self.destroyed) return cb();
3716
- fs5.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
3716
+ fs6.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
3717
3717
  if (err2) {
3718
3718
  self.destroy();
3719
3719
  cb();
@@ -4153,7 +4153,7 @@ var require_buffer_crc32 = __commonJS({
4153
4153
  var require_yauzl = __commonJS({
4154
4154
  "../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/index.js"(exports2) {
4155
4155
  "use strict";
4156
- var fs5 = require("fs");
4156
+ var fs6 = require("fs");
4157
4157
  var zlib = require("zlib");
4158
4158
  var fd_slicer = require_fd_slicer();
4159
4159
  var crc32 = require_buffer_crc32();
@@ -4174,7 +4174,7 @@ var require_yauzl = __commonJS({
4174
4174
  exports2.Entry = Entry;
4175
4175
  exports2.LocalFileHeader = LocalFileHeader;
4176
4176
  exports2.RandomAccessReader = RandomAccessReader;
4177
- function open(path8, options2, callback) {
4177
+ function open(path9, options2, callback) {
4178
4178
  if (typeof options2 === "function") {
4179
4179
  callback = options2;
4180
4180
  options2 = null;
@@ -4186,10 +4186,10 @@ var require_yauzl = __commonJS({
4186
4186
  if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
4187
4187
  if (options2.strictFileNames == null) options2.strictFileNames = false;
4188
4188
  if (callback == null) callback = defaultCallback;
4189
- fs5.open(path8, "r", function(err, fd) {
4189
+ fs6.open(path9, "r", function(err, fd) {
4190
4190
  if (err) return callback(err);
4191
4191
  fromFd(fd, options2, function(err2, zipfile) {
4192
- if (err2) fs5.close(fd, defaultCallback);
4192
+ if (err2) fs6.close(fd, defaultCallback);
4193
4193
  callback(err2, zipfile);
4194
4194
  });
4195
4195
  });
@@ -4206,7 +4206,7 @@ var require_yauzl = __commonJS({
4206
4206
  if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
4207
4207
  if (options2.strictFileNames == null) options2.strictFileNames = false;
4208
4208
  if (callback == null) callback = defaultCallback;
4209
- fs5.fstat(fd, function(err, stats) {
4209
+ fs6.fstat(fd, function(err, stats) {
4210
4210
  if (err) return callback(err);
4211
4211
  var reader = fd_slicer.createFromFd(fd, { autoClose: true });
4212
4212
  fromRandomAccessReader(reader, stats.size, options2, callback);
@@ -6822,7 +6822,7 @@ var require_semver2 = __commonJS({
6822
6822
  });
6823
6823
 
6824
6824
  // src/index.ts
6825
- var import_node_path5 = __toESM(require("path"), 1);
6825
+ var import_node_path6 = __toESM(require("path"), 1);
6826
6826
  var import_node_process2 = __toESM(require("process"), 1);
6827
6827
  var import_prompts2 = require("@inquirer/prompts");
6828
6828
 
@@ -7314,8 +7314,8 @@ function getErrorMap() {
7314
7314
 
7315
7315
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
7316
7316
  var makeIssue = (params) => {
7317
- const { data, path: path8, errorMaps, issueData } = params;
7318
- const fullPath = [...path8, ...issueData.path || []];
7317
+ const { data, path: path9, errorMaps, issueData } = params;
7318
+ const fullPath = [...path9, ...issueData.path || []];
7319
7319
  const fullIssue = {
7320
7320
  ...issueData,
7321
7321
  path: fullPath
@@ -7431,11 +7431,11 @@ var errorUtil;
7431
7431
 
7432
7432
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
7433
7433
  var ParseInputLazyPath = class {
7434
- constructor(parent, value, path8, key) {
7434
+ constructor(parent, value, path9, key) {
7435
7435
  this._cachedPath = [];
7436
7436
  this.parent = parent;
7437
7437
  this.data = value;
7438
- this._path = path8;
7438
+ this._path = path9;
7439
7439
  this._key = key;
7440
7440
  }
7441
7441
  get path() {
@@ -11285,7 +11285,7 @@ var import_commander = require("commander");
11285
11285
  // package.json
11286
11286
  var package_default = {
11287
11287
  name: "@cantemizyurek/skillz",
11288
- version: "0.1.9",
11288
+ version: "0.1.11",
11289
11289
  publishConfig: {
11290
11290
  access: "public"
11291
11291
  },
@@ -12019,6 +12019,83 @@ async function upsertManifestEntry(entry) {
12019
12019
  await saveManifest(manifest);
12020
12020
  }
12021
12021
 
12022
+ // src/uninstall.ts
12023
+ var import_promises5 = __toESM(require("fs/promises"), 1);
12024
+ var import_node_path5 = __toESM(require("path"), 1);
12025
+ async function uninstallInstalledSkills(input) {
12026
+ const candidateIds = new Set(input.entries.map((entry) => entryKey(entry)));
12027
+ const removedEntries = input.manifest.installs.filter(
12028
+ (entry) => candidateIds.has(entryKey(entry))
12029
+ );
12030
+ const retainedEntries = input.manifest.installs.filter(
12031
+ (entry) => !candidateIds.has(entryKey(entry))
12032
+ );
12033
+ if (removedEntries.length === 0) {
12034
+ return {
12035
+ removedCount: 0,
12036
+ removedEntries: [],
12037
+ retainedEntries: input.manifest.installs,
12038
+ removedPaths: []
12039
+ };
12040
+ }
12041
+ const candidatePaths = collectReferencedPaths(removedEntries);
12042
+ const removedPaths = [];
12043
+ for (const candidatePath of candidatePaths) {
12044
+ if (retainedEntries.some((entry) => entryReferencesPath(entry, candidatePath))) {
12045
+ continue;
12046
+ }
12047
+ const pathEntries = removedEntries.filter(
12048
+ (entry) => entryReferencesPath(entry, candidatePath)
12049
+ );
12050
+ assertSafeSkillPath(candidatePath, pathEntries);
12051
+ await import_promises5.default.rm(candidatePath, { recursive: true, force: true });
12052
+ removedPaths.push(candidatePath);
12053
+ }
12054
+ return {
12055
+ removedCount: removedEntries.length,
12056
+ removedEntries,
12057
+ retainedEntries,
12058
+ removedPaths
12059
+ };
12060
+ }
12061
+ function collectReferencedPaths(entries) {
12062
+ const paths = /* @__PURE__ */ new Set();
12063
+ for (const entry of entries) {
12064
+ paths.add(entry.installPath);
12065
+ paths.add(resolveSourceInstallPath(entry));
12066
+ }
12067
+ return Array.from(paths);
12068
+ }
12069
+ function resolveSourceInstallPath(entry) {
12070
+ return entry.sourceInstallPath ?? entry.installPath;
12071
+ }
12072
+ function entryReferencesPath(entry, installPath) {
12073
+ return entry.installPath === installPath || resolveSourceInstallPath(entry) === installPath;
12074
+ }
12075
+ function assertSafeSkillPath(installPath, entries) {
12076
+ const baseName = import_node_path5.default.basename(import_node_path5.default.resolve(installPath));
12077
+ for (const entry of entries) {
12078
+ if (baseName !== entry.name) {
12079
+ throw new Error(
12080
+ `Refusing to remove path "${installPath}" because it does not match expected skill name "${entry.name}".`
12081
+ );
12082
+ }
12083
+ }
12084
+ }
12085
+ function entryKey(entry) {
12086
+ return [
12087
+ entry.namespace,
12088
+ entry.name,
12089
+ entry.version,
12090
+ entry.agent,
12091
+ entry.scope,
12092
+ entry.installPath,
12093
+ entry.sourceInstallPath ?? "",
12094
+ entry.registryBaseUrl,
12095
+ entry.installedAt
12096
+ ].join("\0");
12097
+ }
12098
+
12022
12099
  // src/update.ts
12023
12100
  async function updateInstalledSkills(input) {
12024
12101
  if (!input.config.token) {
@@ -12419,12 +12496,47 @@ program.command("update").description("Update installed skills").argument("[name
12419
12496
  }
12420
12497
  console.log(`Updated ${updatedCount} skill(s).`);
12421
12498
  });
12499
+ program.command("uninstall").alias("remove").description("Uninstall an installed skill").argument("<namespace/skill>", "skill reference").option("--agent <agents>", "codex | claude | cursor (comma-separated)").option("--scope <scope>", "user | project").action(async (skillRefInput, options2) => {
12500
+ namespaceNameSchema.parse(skillRefInput);
12501
+ const skillRef = parseSkillRef(skillRefInput);
12502
+ const manifest = await loadManifest();
12503
+ const scopedAgents = options2.agent ? parseAgentTargetsOption(options2.agent) : void 0;
12504
+ const scopedScope = options2.scope ? scopeSchema.parse(options2.scope) : void 0;
12505
+ const candidates = manifest.installs.filter((entry) => {
12506
+ if (entry.namespace !== skillRef.namespace || entry.name !== skillRef.name) {
12507
+ return false;
12508
+ }
12509
+ if (scopedAgents && !scopedAgents.includes(entry.agent)) {
12510
+ return false;
12511
+ }
12512
+ if (scopedScope && entry.scope !== scopedScope) {
12513
+ return false;
12514
+ }
12515
+ return true;
12516
+ });
12517
+ if (candidates.length === 0) {
12518
+ console.log("No matching installed skills to uninstall.");
12519
+ return;
12520
+ }
12521
+ const result = await uninstallInstalledSkills({
12522
+ manifest,
12523
+ entries: candidates
12524
+ });
12525
+ manifest.installs = result.retainedEntries;
12526
+ await saveManifest(manifest);
12527
+ console.log(
12528
+ `Uninstalled ${result.removedCount} install(s) for ${skillRef.namespace}/${skillRef.name}.`
12529
+ );
12530
+ for (const removedPath of result.removedPaths) {
12531
+ console.log(`Removed: ${removedPath}`);
12532
+ }
12533
+ });
12422
12534
  program.command("publish").description("Publish a skill folder").argument("<path-to-skill-folder>", "path to the skill folder").requiredOption("--version <x.y.z>", "version to publish").action(async (skillPath, options2, command) => {
12423
12535
  const { client } = await makeClient(command, true);
12424
12536
  const me = await client.whoami();
12425
12537
  const result = await publishSkillFolder({
12426
12538
  client,
12427
- skillDirectory: import_node_path5.default.resolve(skillPath),
12539
+ skillDirectory: import_node_path6.default.resolve(skillPath),
12428
12540
  version: semverSchema.parse(options2.version),
12429
12541
  namespace: me.user.username
12430
12542
  });