@cantemizyurek/skillz 0.1.0 → 0.1.2

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.
@@ -1,17 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
9
+ var __commonJS = (cb, mod) => function __require() {
15
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
11
  };
17
12
  var __export = (target, all) => {
@@ -1061,7 +1056,7 @@ var require_binary = __commonJS({
1061
1056
  "use strict";
1062
1057
  var NodeBuffer;
1063
1058
  try {
1064
- _require = __require;
1059
+ _require = require;
1065
1060
  NodeBuffer = _require("buffer").Buffer;
1066
1061
  } catch (__) {
1067
1062
  }
@@ -1350,7 +1345,7 @@ var require_function = __commonJS({
1350
1345
  "use strict";
1351
1346
  var esprima;
1352
1347
  try {
1353
- _require = __require;
1348
+ _require = require;
1354
1349
  esprima = _require("esprima");
1355
1350
  } catch (_) {
1356
1351
  if (typeof window !== "undefined") esprima = window.esprima;
@@ -3407,7 +3402,7 @@ var require_parse = __commonJS({
3407
3402
  var require_gray_matter = __commonJS({
3408
3403
  "../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
3409
3404
  "use strict";
3410
- var fs5 = __require("fs");
3405
+ var fs5 = require("fs");
3411
3406
  var sections = require_section_matter();
3412
3407
  var defaults = require_defaults();
3413
3408
  var stringify = require_stringify();
@@ -3579,14 +3574,14 @@ var require_pend = __commonJS({
3579
3574
  var require_fd_slicer = __commonJS({
3580
3575
  "../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/fd-slicer.js"(exports2) {
3581
3576
  "use strict";
3582
- var fs5 = __require("fs");
3583
- var util2 = __require("util");
3584
- var stream = __require("stream");
3577
+ var fs5 = require("fs");
3578
+ var util2 = require("util");
3579
+ var stream = require("stream");
3585
3580
  var Readable = stream.Readable;
3586
3581
  var Writable = stream.Writable;
3587
3582
  var PassThrough = stream.PassThrough;
3588
3583
  var Pend = require_pend();
3589
- var EventEmitter = __require("events").EventEmitter;
3584
+ var EventEmitter = require("events").EventEmitter;
3590
3585
  exports2.createFromBuffer = createFromBuffer;
3591
3586
  exports2.createFromFd = createFromFd;
3592
3587
  exports2.BufferSlicer = BufferSlicer;
@@ -3850,7 +3845,7 @@ var require_fd_slicer = __commonJS({
3850
3845
  var require_buffer_crc32 = __commonJS({
3851
3846
  "../../node_modules/.pnpm/buffer-crc32@0.2.13/node_modules/buffer-crc32/index.js"(exports2, module2) {
3852
3847
  "use strict";
3853
- var Buffer2 = __require("buffer").Buffer;
3848
+ var Buffer2 = require("buffer").Buffer;
3854
3849
  var CRC_TABLE = [
3855
3850
  0,
3856
3851
  1996959894,
@@ -4158,15 +4153,15 @@ var require_buffer_crc32 = __commonJS({
4158
4153
  var require_yauzl = __commonJS({
4159
4154
  "../../node_modules/.pnpm/yauzl@3.2.0/node_modules/yauzl/index.js"(exports2) {
4160
4155
  "use strict";
4161
- var fs5 = __require("fs");
4162
- var zlib = __require("zlib");
4156
+ var fs5 = require("fs");
4157
+ var zlib = require("zlib");
4163
4158
  var fd_slicer = require_fd_slicer();
4164
4159
  var crc32 = require_buffer_crc32();
4165
- var util2 = __require("util");
4166
- var EventEmitter = __require("events").EventEmitter;
4167
- var Transform = __require("stream").Transform;
4168
- var PassThrough = __require("stream").PassThrough;
4169
- var Writable = __require("stream").Writable;
4160
+ var util2 = require("util");
4161
+ var EventEmitter = require("events").EventEmitter;
4162
+ var Transform = require("stream").Transform;
4163
+ var PassThrough = require("stream").PassThrough;
4164
+ var Writable = require("stream").Writable;
4170
4165
  exports2.open = open;
4171
4166
  exports2.fromFd = fromFd;
4172
4167
  exports2.fromBuffer = fromBuffer;
@@ -6827,21 +6822,18 @@ var require_semver2 = __commonJS({
6827
6822
  });
6828
6823
 
6829
6824
  // src/index.ts
6830
- import path7 from "path";
6831
- import process2 from "process";
6832
- import {
6833
- input as inputPrompt,
6834
- password as passwordPrompt
6835
- } from "@inquirer/prompts";
6825
+ var import_node_path5 = __toESM(require("path"), 1);
6826
+ var import_node_process = __toESM(require("process"), 1);
6827
+ var import_prompts2 = require("@inquirer/prompts");
6836
6828
 
6837
6829
  // ../shared/dist/index.js
6830
+ var import_promises = __toESM(require("fs/promises"), 1);
6831
+ var import_path = __toESM(require("path"), 1);
6832
+ var import_zlib = require("zlib");
6838
6833
  var import_gray_matter = __toESM(require_gray_matter(), 1);
6834
+ var import_tar_stream = __toESM(require("tar-stream"), 1);
6839
6835
  var import_yauzl = __toESM(require_yauzl(), 1);
6840
- import fs from "fs/promises";
6841
- import path2 from "path";
6842
- import { gunzipSync } from "zlib";
6843
- import tar from "tar-stream";
6844
- import path from "path";
6836
+ var import_path2 = __toESM(require("path"), 1);
6845
6837
  var import_semver = __toESM(require_semver2(), 1);
6846
6838
 
6847
6839
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
@@ -10914,8 +10906,8 @@ function normalizeArchiveEntryPath(rawPath) {
10914
10906
  return segments.join("/");
10915
10907
  }
10916
10908
  function ensureInsideDirectory(baseDir, candidatePath) {
10917
- const relativePath = path.relative(baseDir, candidatePath);
10918
- if (relativePath.startsWith("..") || path.isAbsolute(relativePath)) {
10909
+ const relativePath = import_path2.default.relative(baseDir, candidatePath);
10910
+ if (relativePath.startsWith("..") || import_path2.default.isAbsolute(relativePath)) {
10919
10911
  throw new Error(`Resolved path escapes destination: ${candidatePath}`);
10920
10912
  }
10921
10913
  }
@@ -10941,30 +10933,30 @@ function detectArchiveFormatFromBuffer(archive) {
10941
10933
  async function extractArchiveToDirectory(archive, destinationDir, options2 = {}) {
10942
10934
  const parsed = await readArchiveEntries(archive, options2);
10943
10935
  const metadata = inspectSkillArchive(parsed);
10944
- await fs.rm(destinationDir, { recursive: true, force: true });
10945
- await fs.mkdir(destinationDir, { recursive: true });
10936
+ await import_promises.default.rm(destinationDir, { recursive: true, force: true });
10937
+ await import_promises.default.mkdir(destinationDir, { recursive: true });
10946
10938
  for (const entry of parsed.files) {
10947
- const fileDestination = path2.join(destinationDir, entry.path);
10939
+ const fileDestination = import_path.default.join(destinationDir, entry.path);
10948
10940
  ensureInsideDirectory(destinationDir, fileDestination);
10949
- await fs.mkdir(path2.dirname(fileDestination), { recursive: true });
10950
- await fs.writeFile(fileDestination, entry.content);
10941
+ await import_promises.default.mkdir(import_path.default.dirname(fileDestination), { recursive: true });
10942
+ await import_promises.default.writeFile(fileDestination, entry.content);
10951
10943
  }
10952
10944
  return metadata;
10953
10945
  }
10954
10946
  async function validateSkillDirectory(skillDirectoryPath) {
10955
- const absolutePath = path2.resolve(skillDirectoryPath);
10956
- const stat = await fs.stat(absolutePath);
10947
+ const absolutePath = import_path.default.resolve(skillDirectoryPath);
10948
+ const stat = await import_promises.default.stat(absolutePath);
10957
10949
  if (!stat.isDirectory()) {
10958
10950
  throw new Error("Skill path must be a directory");
10959
10951
  }
10960
- const rootFolder = path2.basename(absolutePath);
10952
+ const rootFolder = import_path.default.basename(absolutePath);
10961
10953
  if (!SKILL_NAME_REGEX.test(rootFolder)) {
10962
10954
  throw new Error(
10963
10955
  `Skill folder name "${rootFolder}" violates naming constraints`
10964
10956
  );
10965
10957
  }
10966
- const skillMdPath = path2.join(absolutePath, "SKILL.md");
10967
- const skillMdRaw = await fs.readFile(skillMdPath, "utf8");
10958
+ const skillMdPath = import_path.default.join(absolutePath, "SKILL.md");
10959
+ const skillMdRaw = await import_promises.default.readFile(skillMdPath, "utf8");
10968
10960
  const frontmatter = parseSkillFrontmatter(skillMdRaw);
10969
10961
  if (frontmatter.name !== rootFolder) {
10970
10962
  throw new Error(
@@ -10972,9 +10964,9 @@ async function validateSkillDirectory(skillDirectoryPath) {
10972
10964
  );
10973
10965
  }
10974
10966
  for (const optionalDir of ["scripts", "references", "assets", "agents"]) {
10975
- const optionalPath = path2.join(absolutePath, optionalDir);
10967
+ const optionalPath = import_path.default.join(absolutePath, optionalDir);
10976
10968
  try {
10977
- const optionalStat = await fs.stat(optionalPath);
10969
+ const optionalStat = await import_promises.default.stat(optionalPath);
10978
10970
  if (!optionalStat.isDirectory()) {
10979
10971
  throw new Error(`Optional path ${optionalDir} must be a directory`);
10980
10972
  }
@@ -11069,9 +11061,9 @@ async function readArchiveEntries(archive, options2) {
11069
11061
  return readZipEntries(archive, maxExtractedBytes);
11070
11062
  }
11071
11063
  async function readTarGzEntries(archive, maxExtractedBytes) {
11072
- const uncompressedTar = gunzipSync(archive);
11064
+ const uncompressedTar = (0, import_zlib.gunzipSync)(archive);
11073
11065
  return new Promise((resolve, reject) => {
11074
- const extract = tar.extract();
11066
+ const extract = import_tar_stream.default.extract();
11075
11067
  const files = [];
11076
11068
  let extractedBytes = 0;
11077
11069
  let done = false;
@@ -11287,7 +11279,7 @@ var agentSchema = external_exports.enum(AGENT_VALUES);
11287
11279
  var scopeSchema = external_exports.enum(SCOPE_VALUES);
11288
11280
 
11289
11281
  // src/index.ts
11290
- import { Command } from "commander";
11282
+ var import_commander = require("commander");
11291
11283
 
11292
11284
  // src/client.ts
11293
11285
  var RegistryClient = class {
@@ -11411,15 +11403,15 @@ async function readErrorMessage(response) {
11411
11403
  }
11412
11404
 
11413
11405
  // src/install.ts
11414
- import fs2 from "fs/promises";
11415
- import os2 from "os";
11416
- import path4 from "path";
11417
- import { select } from "@inquirer/prompts";
11406
+ var import_promises2 = __toESM(require("fs/promises"), 1);
11407
+ var import_node_os2 = __toESM(require("os"), 1);
11408
+ var import_node_path2 = __toESM(require("path"), 1);
11409
+ var import_prompts = require("@inquirer/prompts");
11418
11410
 
11419
11411
  // src/git.ts
11420
- import { execFile } from "child_process";
11421
- import { promisify } from "util";
11422
- var execFileAsync = promisify(execFile);
11412
+ var import_node_child_process = require("child_process");
11413
+ var import_node_util = require("util");
11414
+ var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
11423
11415
  async function detectRepoRoot(cwd) {
11424
11416
  try {
11425
11417
  const { stdout } = await execFileAsync("git", ["rev-parse", "--show-toplevel"], {
@@ -11438,25 +11430,25 @@ async function detectRepoRoot(cwd) {
11438
11430
  }
11439
11431
 
11440
11432
  // src/paths.ts
11441
- import os from "os";
11442
- import path3 from "path";
11433
+ var import_node_os = __toESM(require("os"), 1);
11434
+ var import_node_path = __toESM(require("path"), 1);
11443
11435
  function getInstallBasePath(agent, scope, repoRoot) {
11444
11436
  if (scope === "user") {
11445
11437
  if (agent === "codex") {
11446
- return path3.join(os.homedir(), ".agents", "skills");
11438
+ return import_node_path.default.join(import_node_os.default.homedir(), ".agents", "skills");
11447
11439
  }
11448
11440
  if (agent === "claude") {
11449
- return path3.join(os.homedir(), ".claude", "skills");
11441
+ return import_node_path.default.join(import_node_os.default.homedir(), ".claude", "skills");
11450
11442
  }
11451
- return path3.join(os.homedir(), ".cursor", "skills");
11443
+ return import_node_path.default.join(import_node_os.default.homedir(), ".cursor", "skills");
11452
11444
  }
11453
11445
  if (agent === "codex") {
11454
- return path3.join(repoRoot, ".agents", "skills");
11446
+ return import_node_path.default.join(repoRoot, ".agents", "skills");
11455
11447
  }
11456
11448
  if (agent === "claude") {
11457
- return path3.join(repoRoot, ".claude", "skills");
11449
+ return import_node_path.default.join(repoRoot, ".claude", "skills");
11458
11450
  }
11459
- return path3.join(repoRoot, ".cursor", "skills");
11451
+ return import_node_path.default.join(repoRoot, ".cursor", "skills");
11460
11452
  }
11461
11453
 
11462
11454
  // src/install.ts
@@ -11471,7 +11463,7 @@ async function chooseAgent(input) {
11471
11463
  if (input === "codex" || input === "claude" || input === "cursor") {
11472
11464
  return input;
11473
11465
  }
11474
- return select({
11466
+ return (0, import_prompts.select)({
11475
11467
  message: "Choose an agent target",
11476
11468
  choices: [
11477
11469
  { name: "Codex", value: "codex" },
@@ -11484,7 +11476,7 @@ async function chooseScope(input) {
11484
11476
  if (input === "user" || input === "project") {
11485
11477
  return input;
11486
11478
  }
11487
- return select({
11479
+ return (0, import_prompts.select)({
11488
11480
  message: "Choose install scope",
11489
11481
  choices: [
11490
11482
  { name: "USER", value: "user" },
@@ -11505,7 +11497,7 @@ async function chooseVersion(availableVersions, preferredVersion) {
11505
11497
  return preferredVersion;
11506
11498
  }
11507
11499
  const latest = availableVersions[0];
11508
- return select({
11500
+ return (0, import_prompts.select)({
11509
11501
  message: "Choose version",
11510
11502
  default: latest,
11511
11503
  choices: availableVersions.map((version, index) => ({
@@ -11519,17 +11511,17 @@ async function resolveInstallTarget(input) {
11519
11511
  let usedCwdFallback = false;
11520
11512
  if (input.scope === "project") {
11521
11513
  if (input.dirOverride) {
11522
- repoRoot = path4.resolve(input.dirOverride);
11514
+ repoRoot = import_node_path2.default.resolve(input.dirOverride);
11523
11515
  } else {
11524
11516
  const detected = await detectRepoRoot(input.cwd);
11525
11517
  repoRoot = detected.repoRoot;
11526
11518
  usedCwdFallback = detected.usedCwdFallback;
11527
11519
  }
11528
11520
  } else if (input.dirOverride) {
11529
- repoRoot = path4.resolve(input.dirOverride);
11521
+ repoRoot = import_node_path2.default.resolve(input.dirOverride);
11530
11522
  }
11531
11523
  const basePath = getInstallBasePath(input.agent, input.scope, repoRoot);
11532
- const installPath = path4.join(basePath, input.skillName);
11524
+ const installPath = import_node_path2.default.join(basePath, input.skillName);
11533
11525
  return {
11534
11526
  agent: input.agent,
11535
11527
  scope: input.scope,
@@ -11562,29 +11554,29 @@ async function downloadAndInstallSkill(client, skillRef, version, destinationPat
11562
11554
  };
11563
11555
  }
11564
11556
  async function installArchiveBuffer(archiveBuffer, archiveFormat, destinationPath) {
11565
- const tempRoot = await fs2.mkdtemp(path4.join(os2.tmpdir(), "skillz-install-"));
11557
+ const tempRoot = await import_promises2.default.mkdtemp(import_node_path2.default.join(import_node_os2.default.tmpdir(), "skillz-install-"));
11566
11558
  try {
11567
11559
  const metadata = await extractArchiveToDirectory(archiveBuffer, tempRoot, {
11568
11560
  format: archiveFormat
11569
11561
  });
11570
- const extractedSkillDir = path4.join(tempRoot, metadata.rootFolder);
11571
- await fs2.mkdir(path4.dirname(destinationPath), { recursive: true });
11572
- await fs2.rm(destinationPath, { recursive: true, force: true });
11573
- await fs2.cp(extractedSkillDir, destinationPath, { recursive: true });
11562
+ const extractedSkillDir = import_node_path2.default.join(tempRoot, metadata.rootFolder);
11563
+ await import_promises2.default.mkdir(import_node_path2.default.dirname(destinationPath), { recursive: true });
11564
+ await import_promises2.default.rm(destinationPath, { recursive: true, force: true });
11565
+ await import_promises2.default.cp(extractedSkillDir, destinationPath, { recursive: true });
11574
11566
  } finally {
11575
- await fs2.rm(tempRoot, { recursive: true, force: true });
11567
+ await import_promises2.default.rm(tempRoot, { recursive: true, force: true });
11576
11568
  }
11577
11569
  }
11578
11570
 
11579
11571
  // src/publish.ts
11580
- import fs3 from "fs/promises";
11581
- import os3 from "os";
11582
- import path5 from "path";
11583
- import * as tar2 from "tar";
11584
- import { put as putBlob } from "@vercel/blob/client";
11572
+ var import_promises3 = __toESM(require("fs/promises"), 1);
11573
+ var import_node_os3 = __toESM(require("os"), 1);
11574
+ var import_node_path3 = __toESM(require("path"), 1);
11575
+ var tar2 = __toESM(require("tar"), 1);
11576
+ var import_client = require("@vercel/blob/client");
11585
11577
  async function publishSkillFolder(input) {
11586
11578
  const version = semverSchema.parse(input.version);
11587
- const skillDirectory = path5.resolve(input.skillDirectory);
11579
+ const skillDirectory = import_node_path3.default.resolve(input.skillDirectory);
11588
11580
  const skillMetadata = await validateSkillDirectory(skillDirectory);
11589
11581
  const archiveBuffer = await createTarGzArchive(skillDirectory);
11590
11582
  const uploadStart = await input.client.startUpload(
@@ -11596,7 +11588,7 @@ async function publishSkillFolder(input) {
11596
11588
  sizeBytes: archiveBuffer.byteLength
11597
11589
  }
11598
11590
  );
11599
- const uploadedBlob = await putBlob(uploadStart.blobPath, archiveBuffer, {
11591
+ const uploadedBlob = await (0, import_client.put)(uploadStart.blobPath, archiveBuffer, {
11600
11592
  access: "public",
11601
11593
  contentType: uploadStart.contentType,
11602
11594
  token: uploadStart.clientToken,
@@ -11622,41 +11614,41 @@ async function publishSkillFolder(input) {
11622
11614
  };
11623
11615
  }
11624
11616
  async function createTarGzArchive(skillDirectory) {
11625
- const tempRoot = await fs3.mkdtemp(path5.join(os3.tmpdir(), "skillz-publish-"));
11626
- const archivePath = path5.join(tempRoot, "skill.tar.gz");
11617
+ const tempRoot = await import_promises3.default.mkdtemp(import_node_path3.default.join(import_node_os3.default.tmpdir(), "skillz-publish-"));
11618
+ const archivePath = import_node_path3.default.join(tempRoot, "skill.tar.gz");
11627
11619
  try {
11628
11620
  await tar2.c(
11629
11621
  {
11630
11622
  gzip: true,
11631
11623
  file: archivePath,
11632
- cwd: path5.dirname(skillDirectory),
11624
+ cwd: import_node_path3.default.dirname(skillDirectory),
11633
11625
  portable: true,
11634
11626
  noMtime: true
11635
11627
  },
11636
- [path5.basename(skillDirectory)]
11628
+ [import_node_path3.default.basename(skillDirectory)]
11637
11629
  );
11638
- return await fs3.readFile(archivePath);
11630
+ return await import_promises3.default.readFile(archivePath);
11639
11631
  } finally {
11640
- await fs3.rm(tempRoot, { recursive: true, force: true });
11632
+ await import_promises3.default.rm(tempRoot, { recursive: true, force: true });
11641
11633
  }
11642
11634
  }
11643
11635
 
11644
11636
  // src/storage.ts
11645
- import fs4 from "fs/promises";
11646
- import os4 from "os";
11647
- import path6 from "path";
11648
- var APP_DIR = path6.join(
11649
- process.env.SKILLS_REGISTRY_HOME ?? os4.homedir(),
11637
+ var import_promises4 = __toESM(require("fs/promises"), 1);
11638
+ var import_node_os4 = __toESM(require("os"), 1);
11639
+ var import_node_path4 = __toESM(require("path"), 1);
11640
+ var APP_DIR = import_node_path4.default.join(
11641
+ process.env.SKILLS_REGISTRY_HOME ?? import_node_os4.default.homedir(),
11650
11642
  ".skillz-registry"
11651
11643
  );
11652
- var CONFIG_PATH = path6.join(APP_DIR, "config.json");
11653
- var MANIFEST_PATH = path6.join(APP_DIR, "install-manifest.json");
11644
+ var CONFIG_PATH = import_node_path4.default.join(APP_DIR, "config.json");
11645
+ var MANIFEST_PATH = import_node_path4.default.join(APP_DIR, "install-manifest.json");
11654
11646
  async function ensureAppDir() {
11655
- await fs4.mkdir(APP_DIR, { recursive: true });
11647
+ await import_promises4.default.mkdir(APP_DIR, { recursive: true });
11656
11648
  }
11657
11649
  async function loadConfig() {
11658
11650
  try {
11659
- const raw = await fs4.readFile(CONFIG_PATH, "utf8");
11651
+ const raw = await import_promises4.default.readFile(CONFIG_PATH, "utf8");
11660
11652
  return JSON.parse(raw);
11661
11653
  } catch (error) {
11662
11654
  if (error.code === "ENOENT") {
@@ -11667,12 +11659,12 @@ async function loadConfig() {
11667
11659
  }
11668
11660
  async function saveConfig(config) {
11669
11661
  await ensureAppDir();
11670
- await fs4.writeFile(CONFIG_PATH, `${JSON.stringify(config, null, 2)}
11662
+ await import_promises4.default.writeFile(CONFIG_PATH, `${JSON.stringify(config, null, 2)}
11671
11663
  `, "utf8");
11672
11664
  }
11673
11665
  async function loadManifest() {
11674
11666
  try {
11675
- const raw = await fs4.readFile(MANIFEST_PATH, "utf8");
11667
+ const raw = await import_promises4.default.readFile(MANIFEST_PATH, "utf8");
11676
11668
  const parsed = JSON.parse(raw);
11677
11669
  return {
11678
11670
  version: parsed.version ?? MANIFEST_VERSION,
@@ -11690,7 +11682,7 @@ async function loadManifest() {
11690
11682
  }
11691
11683
  async function saveManifest(manifest) {
11692
11684
  await ensureAppDir();
11693
- await fs4.writeFile(
11685
+ await import_promises4.default.writeFile(
11694
11686
  MANIFEST_PATH,
11695
11687
  `${JSON.stringify(manifest, null, 2)}
11696
11688
  `,
@@ -11711,13 +11703,13 @@ async function upsertManifestEntry(entry) {
11711
11703
  }
11712
11704
 
11713
11705
  // src/index.ts
11714
- var program = new Command();
11706
+ var program = new import_commander.Command();
11715
11707
  program.name("skillz").description("Private Skills Registry CLI").option("--registry <url>", "registry base URL");
11716
11708
  program.command("register").description("Register a user account using an invite code").option("--invite <code>", "invite code").option("--username <username>", "username").option("--password <password>", "password").action(async (options2, command) => {
11717
11709
  const { client } = await makeClient(command, false);
11718
- const inviteCode = options2.invite ?? await inputPrompt({ message: "Invite code" });
11719
- const username = options2.username ?? await inputPrompt({ message: "Username (lowercase + dashes)" });
11720
- const password = options2.password ?? await passwordPrompt({ message: "Password" });
11710
+ const inviteCode = options2.invite ?? await (0, import_prompts2.input)({ message: "Invite code" });
11711
+ const username = options2.username ?? await (0, import_prompts2.input)({ message: "Username (lowercase + dashes)" });
11712
+ const password = options2.password ?? await (0, import_prompts2.password)({ message: "Password" });
11721
11713
  const result = await client.register({ inviteCode, username, password });
11722
11714
  console.log(
11723
11715
  `Registered user ${result.user.username}. Run \`skillz login\` to sign in.`
@@ -11725,8 +11717,8 @@ program.command("register").description("Register a user account using an invite
11725
11717
  });
11726
11718
  program.command("login").description("Sign in with username and password").option("--username <username>", "username").option("--password <password>", "password").action(async (options2, command) => {
11727
11719
  const { client, registryBaseUrl, config } = await makeClient(command, false);
11728
- const username = options2.username ?? await inputPrompt({ message: "Username" });
11729
- const password = options2.password ?? await passwordPrompt({ message: "Password" });
11720
+ const username = options2.username ?? await (0, import_prompts2.input)({ message: "Username" });
11721
+ const password = options2.password ?? await (0, import_prompts2.password)({ message: "Password" });
11730
11722
  const loginResponse = await client.login({ username, password });
11731
11723
  await saveConfig({
11732
11724
  ...config,
@@ -11757,7 +11749,7 @@ program.command("whoami").description("Show current authenticated user").action(
11757
11749
  const me = await client.whoami();
11758
11750
  console.log(`${me.user.username} (${me.user.role})`);
11759
11751
  });
11760
- program.command("search").description("Search skills").argument("<query>", "search query").action(async (query, command) => {
11752
+ program.command("search").description("Search skills").argument("<query>", "search query").action(async (query, _options, command) => {
11761
11753
  const { client } = await makeClient(command, true);
11762
11754
  const result = await client.search(query);
11763
11755
  if (result.skills.length === 0) {
@@ -11770,7 +11762,7 @@ program.command("search").description("Search skills").argument("<query>", "sear
11770
11762
  console.log(` ${skill.description}`);
11771
11763
  }
11772
11764
  });
11773
- program.command("info").description("Show skill metadata and versions").argument("<namespace/skill>", "skill reference").action(async (skillRefInput, command) => {
11765
+ program.command("info").description("Show skill metadata and versions").argument("<namespace/skill>", "skill reference").action(async (skillRefInput, _options, command) => {
11774
11766
  namespaceNameSchema.parse(skillRefInput);
11775
11767
  const skillRef = parseSkillRef(skillRefInput);
11776
11768
  const { client } = await makeClient(command, true);
@@ -11800,12 +11792,12 @@ program.command("install").description("Install a skill").argument("<namespace/s
11800
11792
  agent,
11801
11793
  scope,
11802
11794
  skillName: skillRef.name,
11803
- cwd: process2.cwd(),
11795
+ cwd: import_node_process.default.cwd(),
11804
11796
  dirOverride: options2.dir
11805
11797
  });
11806
11798
  if (resolution.usedCwdFallback) {
11807
11799
  console.log(
11808
- `No git repo detected. Using current directory as repo root: ${process2.cwd()}`
11800
+ `No git repo detected. Using current directory as repo root: ${import_node_process.default.cwd()}`
11809
11801
  );
11810
11802
  }
11811
11803
  await downloadAndInstallSkill(
@@ -11903,7 +11895,7 @@ program.command("publish").description("Publish a skill folder").argument("<path
11903
11895
  const me = await client.whoami();
11904
11896
  const result = await publishSkillFolder({
11905
11897
  client,
11906
- skillDirectory: path7.resolve(skillPath),
11898
+ skillDirectory: import_node_path5.default.resolve(skillPath),
11907
11899
  version: semverSchema.parse(options2.version),
11908
11900
  namespace: me.user.username
11909
11901
  });
@@ -11917,14 +11909,15 @@ invitesCommand.command("create").description("Create a single-use invite code (a
11917
11909
  const invite = await client.createInvite();
11918
11910
  console.log(invite.inviteCode);
11919
11911
  });
11920
- program.parseAsync(process2.argv).catch((error) => {
11912
+ program.parseAsync(import_node_process.default.argv).catch((error) => {
11921
11913
  const message = error instanceof Error ? error.message : String(error);
11922
11914
  console.error(`Error: ${message}`);
11923
- process2.exit(1);
11915
+ import_node_process.default.exit(1);
11924
11916
  });
11925
11917
  async function makeClient(command, requireAuth) {
11918
+ const commandContext = isCommand(command) ? command : program;
11926
11919
  const config = await loadConfig();
11927
- const registryBaseUrl = resolveRegistryBaseUrl(command, config);
11920
+ const registryBaseUrl = resolveRegistryBaseUrl(commandContext, config);
11928
11921
  const token = config.token;
11929
11922
  if (requireAuth && !token) {
11930
11923
  throw new Error("Not logged in. Run skillz login.");
@@ -11937,10 +11930,28 @@ async function makeClient(command, requireAuth) {
11937
11930
  };
11938
11931
  }
11939
11932
  function resolveRegistryBaseUrl(command, config) {
11940
- const options2 = command.optsWithGlobals() ?? {};
11941
- const resolved = options2.registry ?? process2.env.SKILLS_REGISTRY_API_URL ?? config.apiBaseUrl ?? "https://skillz-api.vercel.app";
11933
+ const options2 = resolveGlobalOptions(command);
11934
+ const resolved = options2.registry ?? import_node_process.default.env.SKILLS_REGISTRY_API_URL ?? config.apiBaseUrl ?? "https://skillz-api.vercel.app";
11942
11935
  return resolved.replace(/\/$/, "");
11943
11936
  }
11937
+ function resolveGlobalOptions(command) {
11938
+ const chain = [];
11939
+ let cursor = command;
11940
+ while (cursor) {
11941
+ chain.push(cursor);
11942
+ cursor = cursor.parent;
11943
+ }
11944
+ const merged = {};
11945
+ for (const current of chain.reverse()) {
11946
+ if (typeof current.opts === "function") {
11947
+ Object.assign(merged, current.opts());
11948
+ }
11949
+ }
11950
+ return merged;
11951
+ }
11952
+ function isCommand(value) {
11953
+ return Boolean(value) && typeof value.opts === "function";
11954
+ }
11944
11955
  /*! Bundled license information:
11945
11956
 
11946
11957
  is-extendable/index.js:
@@ -11959,4 +11970,4 @@ strip-bom-string/index.js:
11959
11970
  * Released under the MIT License.
11960
11971
  *)
11961
11972
  */
11962
- //# sourceMappingURL=index.js.map
11973
+ //# sourceMappingURL=index.cjs.map