@agent-nexus/csreg 0.1.9 → 0.1.10

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,7 +19,7 @@ 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";
@@ -266,7 +266,7 @@ var releaseCommand = new Command6("release").description("Bump the version in SK
266
266
  writeFileSync2(skillPath, updated, "utf-8");
267
267
  info(`Updated version to ${newVersion}`);
268
268
  }
269
- const { pushCommand: pushCommand2 } = await import("./push-NOK3Z7EW.js");
269
+ const { pushCommand: pushCommand2 } = await import("./push-X5G76LYV.js");
270
270
  await pushCommand2.parseAsync([dir], { from: "user" });
271
271
  } catch (err) {
272
272
  handleError(err);
@@ -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.10",
4
4
  "description": "CLI for Claude Skills Registry",
5
5
  "license": "MIT",
6
6
  "type": "module",