agent-skills-standard 2.2.2 → 2.2.4

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
@@ -675,7 +675,10 @@ var DEFAULT_WORKFLOWS = [
675
675
  "codebase-review",
676
676
  "plan-feature",
677
677
  "skill-benchmark",
678
- "pentest"
678
+ "pentest",
679
+ "dev-fix",
680
+ "implement-feature",
681
+ "verify-bug"
679
682
  ];
680
683
  var getAgentDefinition = (id) => {
681
684
  switch (id) {
@@ -3552,14 +3555,28 @@ var SkillSyncService = class {
3552
3555
  * - none: Agent has no verified user-invoked command system — skip.
3553
3556
  */
3554
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
+ }
3555
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") {
3556
3573
  if (format === "none") return null;
3557
- const { description, body } = this.parseSource(source.content);
3558
- const baseName = source.name.replace(/\.md$/, "");
3574
+ const { description, body } = parsed;
3575
+ const baseName = parsed.key;
3559
3576
  switch (format) {
3560
3577
  case "native": return {
3561
- name: source.name,
3562
- content: source.content
3578
+ name: parsed.fileName,
3579
+ content: parsed.rawContent
3563
3580
  };
3564
3581
  case "command": return {
3565
3582
  name: `${baseName}.md`,
@@ -3637,7 +3654,7 @@ Follow the exact steps in the workflow file.
3637
3654
  * Agent Skill (SKILL.md) format.
3638
3655
  * Used by Cursor, Trae, and Codex.
3639
3656
  * Lives at <workflowPath>/<name>/SKILL.md
3640
- * User invokes via /<name> in Agent/Skill interface.
3657
+ * Invoked through each platform's skill mechanism.
3641
3658
  */
3642
3659
  static toSkillMarkdown(name, description, body) {
3643
3660
  return `# ${name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ")} Skill
@@ -3684,11 +3701,14 @@ var WorkflowSyncService = class {
3684
3701
  console.log(picocolors.default.yellow(`✨ Workflows Discovered: Adding [${newWorkflows.join(", ")}] to .skillsrc.`));
3685
3702
  changed = true;
3686
3703
  }
3687
- } else if (config.workflows === void 0 || config.workflows === true) {
3704
+ } else if (config.workflows === void 0) {
3688
3705
  const defaultWorkflows = availableWorkflows.filter((wf) => DEFAULT_WORKFLOWS.includes(wf));
3689
3706
  config.workflows = defaultWorkflows;
3690
3707
  console.log(picocolors.default.yellow(`✨ Workflows Initialized: Adding [${defaultWorkflows.join(", ")}] to .skillsrc.`));
3691
3708
  changed = true;
3709
+ } else if (config.workflows === true) {
3710
+ const newWorkflows = availableWorkflows.filter((wf) => !DEFAULT_WORKFLOWS.includes(wf));
3711
+ if (newWorkflows.length > 0) console.log(picocolors.default.cyan(`ℹ️ Registry has ${availableWorkflows.length} workflows (including ${newWorkflows.length} non-default). Syncing all because 'workflows: true' is set.`));
3692
3712
  }
3693
3713
  return changed;
3694
3714
  }
@@ -3729,15 +3749,18 @@ var WorkflowSyncService = class {
3729
3749
  content: f.content
3730
3750
  }))
3731
3751
  }];
3732
- }
3752
+ } else if (workflowFiles.length > 0) console.log(picocolors.default.red(` ❌ Failed to download ${workflowFiles.length} matched workflows.`));
3753
+ else console.log(picocolors.default.gray(` ℹ️ No matching workflows found in registry.`));
3733
3754
  return [];
3734
3755
  }
3735
3756
  /**
3736
- * Writes collected workflows to each active agent's native format.
3737
- * - Antigravity/Kiro: .agents/workflows/*.md (native)
3738
- * - Claude/Gemini: .<agent>/agents/workflow-*.md (agent definition)
3739
- * - Cursor/Windsurf/Trae: .<agent>/rules/workflow-*.mdc (rule)
3740
- * - 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
3741
3764
  */
3742
3765
  async writeWorkflows(workflows, config, agents) {
3743
3766
  if (workflows.length === 0) return;
@@ -3748,16 +3771,17 @@ var WorkflowSyncService = class {
3748
3771
  if (!agentDef || agentDef.workflowFormat === "none") continue;
3749
3772
  const workflowDir = path.default.join(process.cwd(), agentDef.workflowPath);
3750
3773
  await fs_extra.default.ensureDir(workflowDir);
3751
- const skillsDir = path.default.join(process.cwd(), agentDef.path);
3752
- 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);
3753
3776
  let written = 0;
3754
3777
  for (const wf of workflows) {
3755
3778
  if (wf.skill !== "workflows") continue;
3756
3779
  for (const fileItem of wf.files) {
3757
- const transformed = WorkflowTransformer.transform({
3780
+ const parsed = WorkflowTransformer.parse({
3758
3781
  name: fileItem.name,
3759
3782
  content: fileItem.content
3760
- }, agentDef.workflowFormat, skillsRelative);
3783
+ });
3784
+ const transformed = WorkflowTransformer.transformParsed(parsed, agentDef.workflowFormat, workflowSourceRelative);
3761
3785
  if (!transformed) continue;
3762
3786
  let targetFilePath;
3763
3787
  if (agentDef.workflowFormat === "skill") {
@@ -3887,6 +3911,97 @@ var SpecialistSyncService = class {
3887
3911
  }
3888
3912
  };
3889
3913
  //#endregion
3914
+ //#region src/services/GitService.ts
3915
+ /**
3916
+ * Service for handling Git operations within the project.
3917
+ * Provides a clean interface for querying changed and untracked files.
3918
+ */
3919
+ var GitService = class {
3920
+ /**
3921
+ * Finds the root of the project by looking for .git or pnpm-workspace.yaml.
3922
+ */
3923
+ findProjectRoot(startDir = process.cwd()) {
3924
+ let currentDir = startDir;
3925
+ while (currentDir !== path.default.parse(currentDir).root) {
3926
+ if (fs_extra.default.existsSync(path.default.join(currentDir, "pnpm-workspace.yaml")) || fs_extra.default.existsSync(path.default.join(currentDir, ".git"))) return currentDir;
3927
+ currentDir = path.default.dirname(currentDir);
3928
+ }
3929
+ return startDir;
3930
+ }
3931
+ /**
3932
+ * Retrieves a list of files that have changed compared to the base branch or HEAD.
3933
+ * Handles both CI (GitHub Actions) and local development environments.
3934
+ * @param rootDir The root directory of the repository
3935
+ * @returns Array of relative file paths
3936
+ */
3937
+ getChangedFiles(rootDir) {
3938
+ try {
3939
+ if (process.env.GITHUB_BASE_REF) {
3940
+ const baseRef = process.env.GITHUB_BASE_REF;
3941
+ if (!/^[\w./:-]+$/.test(baseRef)) {
3942
+ if (process.env.DEBUG) console.warn("GITHUB_BASE_REF contains unsafe characters; skipping CI diff.");
3943
+ return [];
3944
+ }
3945
+ try {
3946
+ (0, child_process.execFileSync)("git", [
3947
+ "fetch",
3948
+ "origin",
3949
+ baseRef,
3950
+ "--depth=1"
3951
+ ], {
3952
+ cwd: rootDir,
3953
+ stdio: "ignore"
3954
+ });
3955
+ } catch {}
3956
+ return (0, child_process.execFileSync)("git", [
3957
+ "diff",
3958
+ "--name-only",
3959
+ `origin/${baseRef}...HEAD`
3960
+ ], {
3961
+ cwd: rootDir,
3962
+ encoding: "utf8"
3963
+ }).split("\n").map((f) => f.trim()).filter((f) => f !== "" && fs_extra.default.existsSync(path.default.join(rootDir, f)));
3964
+ } else return (0, child_process.execSync)("git diff --name-only HEAD", {
3965
+ cwd: rootDir,
3966
+ encoding: "utf8"
3967
+ }).split("\n").map((f) => f.trim()).filter((f) => f !== "" && fs_extra.default.existsSync(path.default.join(rootDir, f)));
3968
+ } catch (error) {
3969
+ if (process.env.DEBUG) console.warn("Git failure while getting changed files:", error);
3970
+ return [];
3971
+ }
3972
+ }
3973
+ /**
3974
+ * Retrieves a list of untracked files in the repository.
3975
+ * @param rootDir The root directory of the repository
3976
+ * @returns Array of relative file paths
3977
+ */
3978
+ getUntrackedFiles(rootDir) {
3979
+ try {
3980
+ return (0, child_process.execSync)("git ls-files --others --exclude-standard", {
3981
+ cwd: rootDir,
3982
+ encoding: "utf8"
3983
+ }).split("\n").map((f) => f.trim()).filter((f) => f !== "" && fs_extra.default.existsSync(path.default.join(rootDir, f)));
3984
+ } catch (error) {
3985
+ if (process.env.DEBUG) console.warn("Git failure while getting untracked files:", error);
3986
+ return [];
3987
+ }
3988
+ }
3989
+ /**
3990
+ * Retrieves the URL of the 'origin' remote.
3991
+ * @param rootDir The root directory of the repository
3992
+ */
3993
+ getRemoteUrl(rootDir) {
3994
+ try {
3995
+ return (0, child_process.execSync)("git remote get-url origin", {
3996
+ cwd: rootDir,
3997
+ encoding: "utf8"
3998
+ }).trim();
3999
+ } catch {
4000
+ return null;
4001
+ }
4002
+ }
4003
+ };
4004
+ //#endregion
3890
4005
  //#region src/services/utils/MarkdownUtils.ts
3891
4006
  /**
3892
4007
  * Utility functions for manipulating markdown content
@@ -3933,6 +4048,7 @@ var SyncService = class {
3933
4048
  skillSyncService = new SkillSyncService(this.githubService);
3934
4049
  workflowSyncService = new WorkflowSyncService(this.githubService);
3935
4050
  specialistSyncService = new SpecialistSyncService();
4051
+ gitService = new GitService();
3936
4052
  async reconcileConfig(config, projectDeps) {
3937
4053
  const reenabled = this.configService.reconcileDependencies(config, projectDeps);
3938
4054
  if (reenabled.length > 0) {
@@ -3946,8 +4062,19 @@ var SyncService = class {
3946
4062
  return this.workflowSyncService.reconcileWorkflows(config);
3947
4063
  }
3948
4064
  async assembleSkills(categories, config) {
4065
+ await this.warnIfSyncingFromSameRepo(config);
3949
4066
  return this.skillSyncService.assembleSkills(categories, config);
3950
4067
  }
4068
+ async warnIfSyncingFromSameRepo(config) {
4069
+ const remoteUrl = this.gitService.getRemoteUrl(process.cwd());
4070
+ if (!remoteUrl) return;
4071
+ const remoteMatch = GithubService.parseGitHubUrl(remoteUrl);
4072
+ const registryMatch = GithubService.parseGitHubUrl(config.registry);
4073
+ if (remoteMatch && registryMatch && remoteMatch.owner === registryMatch.owner && remoteMatch.repo === registryMatch.repo) {
4074
+ console.log(picocolors.default.yellow(`\n⚠️ Note: You are syncing from the registry repository itself (${remoteMatch.owner}/${remoteMatch.repo}).`));
4075
+ console.log(picocolors.default.gray(` 'ags sync' pulls from GitHub. If you have unpushed local changes, they will be overwritten by the remote versions.`));
4076
+ }
4077
+ }
3951
4078
  async writeSkills(skills, config) {
3952
4079
  await this.cleanupOldFolders();
3953
4080
  const agents = await this.resolveTargetAgents(config);
@@ -4243,7 +4370,7 @@ var SyncCommand = class {
4243
4370
  };
4244
4371
  var package_default = {
4245
4372
  name: "agent-skills-standard",
4246
- version: "2.2.2",
4373
+ version: "2.2.4",
4247
4374
  description: "A CLI to manage and sync AI agent skills standard for Cursor, Claude, Copilot, Windsurf, and more.",
4248
4375
  main: "dist/index.js",
4249
4376
  bin: {
@@ -4319,6 +4446,10 @@ var UpgradeCommand = class {
4319
4446
  console.log(picocolors.default.red("❌ Could not determine latest version."));
4320
4447
  return;
4321
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
+ }
4322
4453
  console.log(picocolors.default.gray(` Current version: ${currentVersion}`));
4323
4454
  console.log(picocolors.default.gray(` Latest version: ${latestVersion}`));
4324
4455
  if (currentVersion === latestVersion) {
@@ -4330,16 +4461,27 @@ var UpgradeCommand = class {
4330
4461
  return;
4331
4462
  }
4332
4463
  const pm = this.detectPackageManager();
4333
- const upgradeCmd = this.getUpgradeCommand(pm);
4464
+ const upgradeCmd = this.getUpgradeCommand(pm, latestVersion);
4334
4465
  console.log(picocolors.default.yellow(`📦 Upgrading to v${latestVersion} using ${pm}...`));
4335
4466
  try {
4336
4467
  console.log(picocolors.default.gray(` Running: ${upgradeCmd}`));
4337
4468
  (0, child_process.execSync)(upgradeCmd, { stdio: "inherit" });
4338
- console.log(picocolors.default.green(`✅ Successfully upgraded to v${latestVersion}!`));
4469
+ try {
4470
+ const lines = (0, child_process.execSync)("ags -V", { encoding: "utf8" }).trim().split("\n");
4471
+ const installedVersion = lines[lines.length - 1].trim();
4472
+ if (installedVersion === latestVersion) console.log(picocolors.default.green(`✅ Successfully upgraded to v${latestVersion}!`));
4473
+ else {
4474
+ console.log("\n" + picocolors.default.yellow(`⚠️ Install finished, but 'ags -V' still reports v${installedVersion}.`));
4475
+ console.log(picocolors.default.gray(" This is likely due to package manager caching or a PATH conflict."));
4476
+ console.log(picocolors.default.cyan(`👉 Recommendation: Run '${picocolors.default.bold(upgradeCmd + " --force")}' manually.`));
4477
+ }
4478
+ } catch {
4479
+ console.log(picocolors.default.green(`✅ Install command completed.`));
4480
+ }
4339
4481
  console.log(picocolors.default.cyan("Please restart your terminal if the version doesn't update immediately."));
4340
4482
  } catch {
4341
4483
  console.log("\n" + picocolors.default.red("❌ Automatic upgrade failed."));
4342
- this.printManualInstructions(pm);
4484
+ this.printManualInstructions(pm, latestVersion);
4343
4485
  }
4344
4486
  }
4345
4487
  detectPackageManager() {
@@ -4358,104 +4500,27 @@ var UpgradeCommand = class {
4358
4500
  }
4359
4501
  }
4360
4502
  }
4361
- getUpgradeCommand(pm) {
4503
+ getUpgradeCommand(pm, version) {
4362
4504
  switch (pm) {
4363
- case "pnpm": return "pnpm add -g agent-skills-standard@latest";
4364
- case "yarn": return "yarn global add agent-skills-standard@latest";
4365
- default: return "npm install -g agent-skills-standard@latest";
4505
+ case "pnpm": return `pnpm add -g agent-skills-standard@${version}`;
4506
+ case "yarn": return `yarn global add agent-skills-standard@${version}`;
4507
+ default: return `npm install -g agent-skills-standard@${version}`;
4366
4508
  }
4367
4509
  }
4368
- printManualInstructions(pm) {
4510
+ printManualInstructions(pm, version) {
4369
4511
  const sudoPrefix = process.platform === "win32" ? "" : "sudo ";
4370
4512
  console.log(picocolors.default.yellow("Possible reasons:"));
4371
4513
  console.log(picocolors.default.gray(" - Permission denied (requires sudo/administrator)"));
4372
4514
  console.log(picocolors.default.gray(" - Network connectivity issues"));
4373
4515
  console.log(picocolors.default.gray(` - ${pm} is not configured for global installs`));
4374
4516
  console.log("\n" + picocolors.default.cyan("👉 Please run the following command manually:"));
4375
- console.log(picocolors.default.white(picocolors.default.bold(` ${sudoPrefix}${this.getUpgradeCommand(pm)}`)));
4517
+ console.log(picocolors.default.white(picocolors.default.bold(` ${sudoPrefix}${this.getUpgradeCommand(pm, version)}`)));
4376
4518
  if (pm !== "npm") {
4377
4519
  console.log(picocolors.default.gray("\nAlternative (npm):"));
4378
- console.log(picocolors.default.gray(` ${sudoPrefix}npm install -g agent-skills-standard@latest`));
4520
+ console.log(picocolors.default.gray(` ${sudoPrefix}npm install -g agent-skills-standard@${version}`));
4379
4521
  }
4380
4522
  console.log(picocolors.default.gray("\nOr run via npx (no install required):"));
4381
- console.log(picocolors.default.gray(` npx agent-skills-standard@latest sync`));
4382
- }
4383
- };
4384
- //#endregion
4385
- //#region src/services/GitService.ts
4386
- /**
4387
- * Service for handling Git operations within the project.
4388
- * Provides a clean interface for querying changed and untracked files.
4389
- */
4390
- var GitService = class {
4391
- /**
4392
- * Finds the root of the project by looking for .git or pnpm-workspace.yaml.
4393
- */
4394
- findProjectRoot(startDir = process.cwd()) {
4395
- let currentDir = startDir;
4396
- while (currentDir !== path.default.parse(currentDir).root) {
4397
- if (fs_extra.default.existsSync(path.default.join(currentDir, "pnpm-workspace.yaml")) || fs_extra.default.existsSync(path.default.join(currentDir, ".git"))) return currentDir;
4398
- currentDir = path.default.dirname(currentDir);
4399
- }
4400
- return startDir;
4401
- }
4402
- /**
4403
- * Retrieves a list of files that have changed compared to the base branch or HEAD.
4404
- * Handles both CI (GitHub Actions) and local development environments.
4405
- * @param rootDir The root directory of the repository
4406
- * @returns Array of relative file paths
4407
- */
4408
- getChangedFiles(rootDir) {
4409
- try {
4410
- if (process.env.GITHUB_BASE_REF) {
4411
- const baseRef = process.env.GITHUB_BASE_REF;
4412
- if (!/^[\w./:-]+$/.test(baseRef)) {
4413
- if (process.env.DEBUG) console.warn("GITHUB_BASE_REF contains unsafe characters; skipping CI diff.");
4414
- return [];
4415
- }
4416
- try {
4417
- (0, child_process.execFileSync)("git", [
4418
- "fetch",
4419
- "origin",
4420
- baseRef,
4421
- "--depth=1"
4422
- ], {
4423
- cwd: rootDir,
4424
- stdio: "ignore"
4425
- });
4426
- } catch {}
4427
- return (0, child_process.execFileSync)("git", [
4428
- "diff",
4429
- "--name-only",
4430
- `origin/${baseRef}...HEAD`
4431
- ], {
4432
- cwd: rootDir,
4433
- encoding: "utf8"
4434
- }).split("\n").map((f) => f.trim()).filter((f) => f !== "" && fs_extra.default.existsSync(path.default.join(rootDir, f)));
4435
- } else return (0, child_process.execSync)("git diff --name-only HEAD", {
4436
- cwd: rootDir,
4437
- encoding: "utf8"
4438
- }).split("\n").map((f) => f.trim()).filter((f) => f !== "" && fs_extra.default.existsSync(path.default.join(rootDir, f)));
4439
- } catch (error) {
4440
- if (process.env.DEBUG) console.warn("Git failure while getting changed files:", error);
4441
- return [];
4442
- }
4443
- }
4444
- /**
4445
- * Retrieves a list of untracked files in the repository.
4446
- * @param rootDir The root directory of the repository
4447
- * @returns Array of relative file paths
4448
- */
4449
- getUntrackedFiles(rootDir) {
4450
- try {
4451
- return (0, child_process.execSync)("git ls-files --others --exclude-standard", {
4452
- cwd: rootDir,
4453
- encoding: "utf8"
4454
- }).split("\n").map((f) => f.trim()).filter((f) => f !== "" && fs_extra.default.existsSync(path.default.join(rootDir, f)));
4455
- } catch (error) {
4456
- if (process.env.DEBUG) console.warn("Git failure while getting untracked files:", error);
4457
- return [];
4458
- }
4523
+ console.log(picocolors.default.gray(` npx agent-skills-standard@${version} sync`));
4459
4524
  }
4460
4525
  };
4461
4526
  //#endregion
@@ -4787,7 +4852,7 @@ var ValidateCommand = class {
4787
4852
  //#region src/index.ts
4788
4853
  dotenv.default.config();
4789
4854
  var program = new commander.Command();
4790
- 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.2");
4855
+ 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.4");
4791
4856
  program.command("init").description("Initialize a .skillsrc configuration file interactively").action(async () => {
4792
4857
  await new InitCommand().run();
4793
4858
  });