agent-skills-standard 2.2.3 → 2.2.5

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.js CHANGED
@@ -3555,14 +3555,28 @@ var SkillSyncService = class {
3555
3555
  * - none: Agent has no verified user-invoked command system — skip.
3556
3556
  */
3557
3557
  var WorkflowTransformer = class {
3558
+ static parse(source) {
3559
+ const { description, body } = this.parseSource(source.content);
3560
+ return {
3561
+ key: source.name.replace(/\.md$/, ""),
3562
+ fileName: source.name,
3563
+ description,
3564
+ body,
3565
+ rawContent: source.content
3566
+ };
3567
+ }
3558
3568
  static transform(source, format, workflowSourcePath = ".agents/workflows") {
3569
+ const parsed = this.parse(source);
3570
+ return this.transformParsed(parsed, format, workflowSourcePath);
3571
+ }
3572
+ static transformParsed(parsed, format, workflowSourcePath = ".agents/workflows") {
3559
3573
  if (format === "none") return null;
3560
- const { description, body } = this.parseSource(source.content);
3561
- const baseName = source.name.replace(/\.md$/, "");
3574
+ const { description, body } = parsed;
3575
+ const baseName = parsed.key;
3562
3576
  switch (format) {
3563
3577
  case "native": return {
3564
- name: source.name,
3565
- content: source.content
3578
+ name: parsed.fileName,
3579
+ content: parsed.rawContent
3566
3580
  };
3567
3581
  case "command": return {
3568
3582
  name: `${baseName}.md`,
@@ -3640,7 +3654,7 @@ Follow the exact steps in the workflow file.
3640
3654
  * Agent Skill (SKILL.md) format.
3641
3655
  * Used by Cursor, Trae, and Codex.
3642
3656
  * Lives at <workflowPath>/<name>/SKILL.md
3643
- * User invokes via /<name> in Agent/Skill interface.
3657
+ * Invoked through each platform's skill mechanism.
3644
3658
  */
3645
3659
  static toSkillMarkdown(name, description, body) {
3646
3660
  return `# ${name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ")} Skill
@@ -3740,11 +3754,13 @@ var WorkflowSyncService = class {
3740
3754
  return [];
3741
3755
  }
3742
3756
  /**
3743
- * Writes collected workflows to each active agent's native format.
3744
- * - Antigravity/Kiro: .agents/workflows/*.md (native)
3745
- * - Claude/Gemini: .<agent>/agents/workflow-*.md (agent definition)
3746
- * - Cursor/Windsurf/Trae: .<agent>/rules/workflow-*.mdc (rule)
3747
- * - Copilot: .github/instructions/workflow-*.instructions.md (instruction)
3757
+ * Writes collected workflows from `.agents/workflows/*.md` to each active
3758
+ * agent's native invocation surface.
3759
+ * - Antigravity/Kiro: keep native markdown workflows
3760
+ * - Claude/Roo/OpenCode: markdown command files
3761
+ * - Gemini: TOML command files
3762
+ * - Copilot: prompt files
3763
+ * - Cursor/Trae/Codex: skill folders with SKILL.md
3748
3764
  */
3749
3765
  async writeWorkflows(workflows, config, agents) {
3750
3766
  if (workflows.length === 0) return;
@@ -3755,16 +3771,17 @@ var WorkflowSyncService = class {
3755
3771
  if (!agentDef || agentDef.workflowFormat === "none") continue;
3756
3772
  const workflowDir = path.default.join(process.cwd(), agentDef.workflowPath);
3757
3773
  await fs_extra.default.ensureDir(workflowDir);
3758
- const skillsDir = path.default.join(process.cwd(), agentDef.path);
3759
- const skillsRelative = path.default.relative(workflowDir, skillsDir);
3774
+ const sourceWorkflowDir = path.default.join(process.cwd(), ".agents/workflows");
3775
+ const workflowSourceRelative = path.default.relative(workflowDir, sourceWorkflowDir);
3760
3776
  let written = 0;
3761
3777
  for (const wf of workflows) {
3762
3778
  if (wf.skill !== "workflows") continue;
3763
3779
  for (const fileItem of wf.files) {
3764
- const transformed = WorkflowTransformer.transform({
3780
+ const parsed = WorkflowTransformer.parse({
3765
3781
  name: fileItem.name,
3766
3782
  content: fileItem.content
3767
- }, agentDef.workflowFormat, skillsRelative);
3783
+ });
3784
+ const transformed = WorkflowTransformer.transformParsed(parsed, agentDef.workflowFormat, workflowSourceRelative);
3768
3785
  if (!transformed) continue;
3769
3786
  let targetFilePath;
3770
3787
  if (agentDef.workflowFormat === "skill") {
@@ -4353,7 +4370,7 @@ var SyncCommand = class {
4353
4370
  };
4354
4371
  var package_default = {
4355
4372
  name: "agent-skills-standard",
4356
- version: "2.2.3",
4373
+ version: "2.2.5",
4357
4374
  description: "A CLI to manage and sync AI agent skills standard for Cursor, Claude, Copilot, Windsurf, and more.",
4358
4375
  main: "dist/index.js",
4359
4376
  bin: {
@@ -4429,6 +4446,10 @@ var UpgradeCommand = class {
4429
4446
  console.log(picocolors.default.red("❌ Could not determine latest version."));
4430
4447
  return;
4431
4448
  }
4449
+ if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/.test(latestVersion)) {
4450
+ console.log(picocolors.default.red(`❌ Invalid version received from npm: ${latestVersion}`));
4451
+ return;
4452
+ }
4432
4453
  console.log(picocolors.default.gray(` Current version: ${currentVersion}`));
4433
4454
  console.log(picocolors.default.gray(` Latest version: ${latestVersion}`));
4434
4455
  if (currentVersion === latestVersion) {
@@ -4440,55 +4461,70 @@ var UpgradeCommand = class {
4440
4461
  return;
4441
4462
  }
4442
4463
  const pm = this.detectPackageManager();
4443
- const upgradeCmd = this.getUpgradeCommand(pm);
4464
+ const upgradeCmd = this.getUpgradeCommand(pm, latestVersion);
4444
4465
  console.log(picocolors.default.yellow(`📦 Upgrading to v${latestVersion} using ${pm}...`));
4445
4466
  try {
4446
4467
  console.log(picocolors.default.gray(` Running: ${upgradeCmd}`));
4447
- (0, child_process.execSync)(upgradeCmd, { stdio: "inherit" });
4448
- console.log(picocolors.default.green(`✅ Successfully upgraded to v${latestVersion}!`));
4449
- console.log(picocolors.default.cyan("Please restart your terminal if the version doesn't update immediately."));
4468
+ try {
4469
+ (0, child_process.execSync)(upgradeCmd, { stdio: "inherit" });
4470
+ } catch {
4471
+ console.log(picocolors.default.yellow(`⚠️ Failed to install v${latestVersion}. Retrying with @latest...`));
4472
+ (0, child_process.execSync)(this.getUpgradeCommand(pm, "latest"), { stdio: "inherit" });
4473
+ }
4474
+ try {
4475
+ const lines = (0, child_process.execSync)("ags -V", {
4476
+ encoding: "utf8",
4477
+ stdio: "pipe"
4478
+ }).trim().split("\n");
4479
+ const installedVersion = lines[lines.length - 1].trim();
4480
+ if (installedVersion.includes(latestVersion)) console.log(picocolors.default.green(`✅ Successfully upgraded to v${latestVersion}!`));
4481
+ else {
4482
+ console.log("\n" + picocolors.default.yellow(`⚠️ Installation complete, but 'ags -V' still reports v${installedVersion}.`));
4483
+ console.log(picocolors.default.gray(" This is common if multiple versions are installed or your shell needs a restart."));
4484
+ console.log(picocolors.default.cyan(`👉 Recommendation: Restart your terminal or run: ${picocolors.default.bold(this.getUpgradeCommand(pm, latestVersion) + " --force")}`));
4485
+ }
4486
+ } catch {
4487
+ console.log(picocolors.default.green("\n✅ Upgrade command finished."));
4488
+ console.log(picocolors.default.gray(" (Unable to verify version automatically, please check with 'ags -V')"));
4489
+ }
4490
+ console.log(picocolors.default.cyan("\nNote: You may need to restart your terminal session for changes to take effect."));
4450
4491
  } catch {
4451
4492
  console.log("\n" + picocolors.default.red("❌ Automatic upgrade failed."));
4452
- this.printManualInstructions(pm);
4493
+ this.printManualInstructions(pm, latestVersion);
4453
4494
  }
4454
4495
  }
4455
4496
  detectPackageManager() {
4456
- const userAgent = process.env.npm_config_user_agent || "";
4457
- if (userAgent.includes("pnpm")) return "pnpm";
4458
- if (userAgent.includes("yarn")) return "yarn";
4497
+ const execPath = process.argv[1] || "";
4498
+ if (execPath.includes("pnpm") || (process.env.npm_config_user_agent || "").includes("pnpm")) return "pnpm";
4499
+ if (execPath.includes("yarn") || (process.env.npm_config_user_agent || "").includes("yarn")) return "yarn";
4500
+ if (execPath.includes("nvm") || execPath.includes("npm")) return "npm";
4459
4501
  try {
4460
4502
  (0, child_process.execSync)("pnpm --version", { stdio: "ignore" });
4461
- return "pnpm";
4462
- } catch {
4463
- try {
4464
- (0, child_process.execSync)("yarn --version", { stdio: "ignore" });
4465
- return "yarn";
4466
- } catch {
4467
- return "npm";
4468
- }
4469
- }
4503
+ if (execPath.includes("pnpm")) return "pnpm";
4504
+ } catch {}
4505
+ return "npm";
4470
4506
  }
4471
- getUpgradeCommand(pm) {
4507
+ getUpgradeCommand(pm, version) {
4472
4508
  switch (pm) {
4473
- case "pnpm": return "pnpm add -g agent-skills-standard@latest";
4474
- case "yarn": return "yarn global add agent-skills-standard@latest";
4475
- default: return "npm install -g agent-skills-standard@latest";
4509
+ case "pnpm": return `pnpm add -g agent-skills-standard@${version}`;
4510
+ case "yarn": return `yarn global add agent-skills-standard@${version}`;
4511
+ default: return `npm install -g agent-skills-standard@${version}`;
4476
4512
  }
4477
4513
  }
4478
- printManualInstructions(pm) {
4514
+ printManualInstructions(pm, version) {
4479
4515
  const sudoPrefix = process.platform === "win32" ? "" : "sudo ";
4480
4516
  console.log(picocolors.default.yellow("Possible reasons:"));
4481
4517
  console.log(picocolors.default.gray(" - Permission denied (requires sudo/administrator)"));
4482
4518
  console.log(picocolors.default.gray(" - Network connectivity issues"));
4483
4519
  console.log(picocolors.default.gray(` - ${pm} is not configured for global installs`));
4484
4520
  console.log("\n" + picocolors.default.cyan("👉 Please run the following command manually:"));
4485
- console.log(picocolors.default.white(picocolors.default.bold(` ${sudoPrefix}${this.getUpgradeCommand(pm)}`)));
4521
+ console.log(picocolors.default.white(picocolors.default.bold(` ${sudoPrefix}${this.getUpgradeCommand(pm, version)}`)));
4486
4522
  if (pm !== "npm") {
4487
4523
  console.log(picocolors.default.gray("\nAlternative (npm):"));
4488
- console.log(picocolors.default.gray(` ${sudoPrefix}npm install -g agent-skills-standard@latest`));
4524
+ console.log(picocolors.default.gray(` ${sudoPrefix}npm install -g agent-skills-standard@${version}`));
4489
4525
  }
4490
4526
  console.log(picocolors.default.gray("\nOr run via npx (no install required):"));
4491
- console.log(picocolors.default.gray(` npx agent-skills-standard@latest sync`));
4527
+ console.log(picocolors.default.gray(` npx agent-skills-standard@${version} sync`));
4492
4528
  }
4493
4529
  };
4494
4530
  //#endregion
@@ -4820,7 +4856,7 @@ var ValidateCommand = class {
4820
4856
  //#region src/index.ts
4821
4857
  dotenv.default.config();
4822
4858
  var program = new commander.Command();
4823
- program.name("agent-skills-standard").description("A CLI to manage and sync AI agent skills for Cursor, Claude, Copilot, Windsurf, and more.").version("2.2.3");
4859
+ program.name("agent-skills-standard").description("A CLI to manage and sync AI agent skills for Cursor, Claude, Copilot, Windsurf, and more.").version("2.2.5");
4824
4860
  program.command("init").description("Initialize a .skillsrc configuration file interactively").action(async () => {
4825
4861
  await new InitCommand().run();
4826
4862
  });