@agent-nexus/csreg 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.
@@ -1,7 +1,8 @@
1
1
  // src/commands/push.ts
2
2
  import { Command as Command2 } from "commander";
3
3
  import { resolve as resolve3, join as join6, basename as basename3 } from "path";
4
- import { existsSync as existsSync5, readFileSync as readFileSync3, statSync as statSync3, readdirSync as readdirSync3, lstatSync as lstatSync2 } from "fs";
4
+ import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync2, statSync as statSync3, readdirSync as readdirSync3, lstatSync as lstatSync2 } from "fs";
5
+ import { input } from "@inquirer/prompts";
5
6
  import { createHash as createHash2 } from "crypto";
6
7
 
7
8
  // src/commands/validate.ts
@@ -519,6 +520,16 @@ function collectFileTree(dir, prefix = "") {
519
520
  }
520
521
  return files;
521
522
  }
523
+ function addFrontmatterField(dir, field, value) {
524
+ const skillPath = join6(dir, "SKILL.md");
525
+ const raw = readFileSync3(skillPath, "utf-8");
526
+ const updated = raw.replace(
527
+ /^(---\s*\n[\s\S]*?\n)(---\s*\n?)/,
528
+ `$1${field}: "${value}"
529
+ $2`
530
+ );
531
+ writeFileSync2(skillPath, updated, "utf-8");
532
+ }
522
533
  async function pushSingle(resolved) {
523
534
  const spin = spinner("Validating skill...");
524
535
  const validation = runValidation(resolved);
@@ -532,14 +543,31 @@ async function pushSingle(resolved) {
532
543
  spin.succeed("Validation passed.");
533
544
  const manifest = parseManifest(resolved);
534
545
  if (!manifest.version) {
535
- throw new CliError('Missing "version" in SKILL.md frontmatter.', [
536
- 'Add a version field: version: "1.0.0"'
537
- ]);
546
+ const version = await input({
547
+ message: "Version (semver):",
548
+ default: "1.0.0",
549
+ validate: (value) => {
550
+ const semver = /^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/;
551
+ if (!semver.test(value.trim())) return "Must be valid semver (e.g., 1.0.0).";
552
+ return true;
553
+ }
554
+ });
555
+ manifest.version = version.trim();
556
+ addFrontmatterField(resolved, "version", manifest.version);
538
557
  }
539
558
  if (!manifest.scope) {
540
- throw new CliError('Missing "scope" in SKILL.md frontmatter.', [
541
- "Add a scope field: scope: my-team"
542
- ]);
559
+ const scope = await input({
560
+ message: "Scope (team or username):",
561
+ validate: (value) => {
562
+ if (!value.trim()) return "Scope is required.";
563
+ if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(value.trim())) {
564
+ return "Must be lowercase alphanumeric with hyphens (e.g., my-team).";
565
+ }
566
+ return true;
567
+ }
568
+ });
569
+ manifest.scope = scope.trim();
570
+ addFrontmatterField(resolved, "scope", manifest.scope);
543
571
  }
544
572
  spin.start("Packing skill...");
545
573
  const archive = await pack(resolved);
package/dist/index.js CHANGED
@@ -19,10 +19,13 @@ import {
19
19
  success,
20
20
  validateCommand,
21
21
  warn
22
- } from "./chunk-Z27YSJYQ.js";
22
+ } from "./chunk-YPG2FR7G.js";
23
23
 
24
24
  // src/index.ts
25
25
  import { Command as Command11 } from "commander";
26
+ import { readFileSync as readFileSync3 } from "fs";
27
+ import { fileURLToPath } from "url";
28
+ import { dirname as dirname2, join as join4 } from "path";
26
29
 
27
30
  // src/commands/login.ts
28
31
  import { Command } from "commander";
@@ -266,7 +269,7 @@ var releaseCommand = new Command6("release").description("Bump the version in SK
266
269
  writeFileSync2(skillPath, updated, "utf-8");
267
270
  info(`Updated version to ${newVersion}`);
268
271
  }
269
- const { pushCommand: pushCommand2 } = await import("./push-NOK3Z7EW.js");
272
+ const { pushCommand: pushCommand2 } = await import("./push-X5G76LYV.js");
270
273
  await pushCommand2.parseAsync([dir], { from: "user" });
271
274
  } catch (err) {
272
275
  handleError(err);
@@ -648,8 +651,10 @@ var searchCommand = new Command10("search").description("Search for skills in th
648
651
  });
649
652
 
650
653
  // src/index.ts
654
+ var __dirname = dirname2(fileURLToPath(import.meta.url));
655
+ var pkg = JSON.parse(readFileSync3(join4(__dirname, "..", "package.json"), "utf-8"));
651
656
  var program = new Command11();
652
- program.name("csreg").description("Claude Skills Registry CLI").version("0.1.0");
657
+ program.name("csreg").description("Claude Skills Registry CLI").version(pkg.version);
653
658
  program.addCommand(loginCommand);
654
659
  program.addCommand(logoutCommand);
655
660
  program.addCommand(whoamiCommand);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pushCommand
3
- } from "./chunk-Z27YSJYQ.js";
3
+ } from "./chunk-YPG2FR7G.js";
4
4
  export {
5
5
  pushCommand
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-nexus/csreg",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "CLI for Claude Skills Registry",
5
5
  "license": "MIT",
6
6
  "type": "module",