agentinit 1.16.2 → 1.17.0

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/cli.js CHANGED
@@ -16945,6 +16945,13 @@ var init_marketplaceRegistry = __esm(() => {
16945
16945
  CUSTOM_MARKETPLACE_CACHE_TTL_MS = 3600000;
16946
16946
  });
16947
16947
 
16948
+ // dist/types/skills.js
16949
+ var SHARED_SKILLS_TARGET_ID, SHARED_SKILLS_TARGET_NAME;
16950
+ var init_skills = __esm(() => {
16951
+ SHARED_SKILLS_TARGET_ID = "agents";
16952
+ SHARED_SKILLS_TARGET_NAME = "AGENTS.md ecosystem";
16953
+ });
16954
+
16948
16955
  // dist/core/mcpFilter.js
16949
16956
  class MCPFilter {
16950
16957
  static filterForAgent(agent, servers) {
@@ -18526,6 +18533,7 @@ import {promisify} from "util";
18526
18533
 
18527
18534
  class SkillsManager {
18528
18535
  agentManager;
18536
+ preparedSourceContexts = new Map;
18529
18537
  constructor(agentManager3) {
18530
18538
  this.agentManager = agentManager3 || new AgentManager;
18531
18539
  }
@@ -18668,7 +18676,7 @@ class SkillsManager {
18668
18676
  }
18669
18677
  }
18670
18678
  async discoverSkills(repoPath) {
18671
- const skills = [];
18679
+ const skills2 = [];
18672
18680
  const seen = new Set;
18673
18681
  for (const searchDir of SKILL_SEARCH_DIRS) {
18674
18682
  const fullDir = resolve8(repoPath, searchDir);
@@ -18679,7 +18687,7 @@ class SkillsManager {
18679
18687
  const parsed = await this.parseSkillMd(directSkillMd);
18680
18688
  if (parsed && !seen.has(parsed.name)) {
18681
18689
  seen.add(parsed.name);
18682
- skills.push({ ...parsed, path: resolve8(fullDir) });
18690
+ skills2.push({ ...parsed, path: resolve8(fullDir) });
18683
18691
  }
18684
18692
  }
18685
18693
  const directSkillMdLower = join5(fullDir, "skill.md");
@@ -18687,7 +18695,7 @@ class SkillsManager {
18687
18695
  const parsed = await this.parseSkillMd(directSkillMdLower);
18688
18696
  if (parsed && !seen.has(parsed.name)) {
18689
18697
  seen.add(parsed.name);
18690
- skills.push({ ...parsed, path: resolve8(fullDir) });
18698
+ skills2.push({ ...parsed, path: resolve8(fullDir) });
18691
18699
  }
18692
18700
  }
18693
18701
  if (!await isDirectory(fullDir))
@@ -18705,11 +18713,11 @@ class SkillsManager {
18705
18713
  const parsed = await this.parseSkillMd(skillFile);
18706
18714
  if (parsed && !seen.has(parsed.name)) {
18707
18715
  seen.add(parsed.name);
18708
- skills.push({ ...parsed, path: entryPath });
18716
+ skills2.push({ ...parsed, path: entryPath });
18709
18717
  }
18710
18718
  }
18711
18719
  }
18712
- return skills;
18720
+ return skills2;
18713
18721
  }
18714
18722
  async cloneRepo(url) {
18715
18723
  const tempDir = await fs24.mkdtemp(join5(tmpdir(), "agentinit-skills-"));
@@ -18836,24 +18844,24 @@ class SkillsManager {
18836
18844
  }
18837
18845
  }
18838
18846
  const discoveryRoot = await this.resolveDiscoveryRoot(repoPath, resolved, source);
18839
- let skills = await this.discoverSkills(discoveryRoot);
18847
+ let skills2 = await this.discoverSkills(discoveryRoot);
18840
18848
  let pluginWarnings = [];
18841
- if (skills.length === 0) {
18849
+ if (skills2.length === 0) {
18842
18850
  const pluginBackedSkills = await this.discoverPortablePluginSkills(discoveryRoot, source, resolved, projectPath);
18843
18851
  if (pluginBackedSkills) {
18844
- skills = pluginBackedSkills.skills;
18852
+ skills2 = pluginBackedSkills.skills;
18845
18853
  pluginWarnings = pluginBackedSkills.warnings;
18846
18854
  }
18847
18855
  }
18848
18856
  if (request.implicitSkills.length > 0) {
18849
18857
  const names = new Set(request.implicitSkills.map((skill) => skill.toLowerCase()));
18850
- skills = skills.filter((skill) => names.has(skill.name.toLowerCase()));
18858
+ skills2 = skills2.filter((skill) => names.has(skill.name.toLowerCase()));
18851
18859
  }
18852
18860
  const warnings = [
18853
18861
  ...pluginWarnings,
18854
18862
  ...request.implicitSkills.length > 0 ? [`Resolved "${source}" from the default skills catalog ${DEFAULT_SKILLS_CATALOG.owner}/${DEFAULT_SKILLS_CATALOG.repo}. Use "./${source}" for a local path.`] : []
18855
18863
  ];
18856
- return { skills, warnings, cleanup };
18864
+ return { skills: skills2, warnings, cleanup };
18857
18865
  } catch (error) {
18858
18866
  await cleanup();
18859
18867
  throw error;
@@ -18870,6 +18878,37 @@ class SkillsManager {
18870
18878
  await context.cleanup();
18871
18879
  }
18872
18880
  }
18881
+ getPreparedSourceKey(source, projectPath, from) {
18882
+ return `${projectPath}\n${from || ""}\n${source}`;
18883
+ }
18884
+ async storePreparedSourceContext(source, projectPath, from, context) {
18885
+ const key = this.getPreparedSourceKey(source, projectPath, from);
18886
+ const existing = this.preparedSourceContexts.get(key);
18887
+ this.preparedSourceContexts.set(key, context);
18888
+ if (existing && existing !== context) {
18889
+ await existing.cleanup();
18890
+ }
18891
+ }
18892
+ takePreparedSourceContext(source, projectPath, from) {
18893
+ const key = this.getPreparedSourceKey(source, projectPath, from);
18894
+ const existing = this.preparedSourceContexts.get(key) || null;
18895
+ if (existing) {
18896
+ this.preparedSourceContexts.delete(key);
18897
+ }
18898
+ return existing;
18899
+ }
18900
+ async prepareSource(source, projectPath, options2 = {}) {
18901
+ const context = await this.loadDiscoveredSkillsContext(source, projectPath, options2);
18902
+ await this.storePreparedSourceContext(source, projectPath, options2.from, context);
18903
+ return {
18904
+ skills: context.skills,
18905
+ warnings: context.warnings
18906
+ };
18907
+ }
18908
+ async discardPreparedSource(source, projectPath, options2 = {}) {
18909
+ const context = this.takePreparedSourceContext(source, projectPath, options2.from);
18910
+ await context?.cleanup();
18911
+ }
18873
18912
  async getTargetAgents(projectPath, options2) {
18874
18913
  if (options2.agents && options2.agents.length > 0) {
18875
18914
  const agents = [];
@@ -18997,6 +19036,27 @@ class SkillsManager {
18997
19036
  }
18998
19037
  return plan;
18999
19038
  }
19039
+ async installSkillToCanonicalStore(skillPath, skillName, projectPath, options2 = {}) {
19040
+ const plan = this.getCanonicalInstallPlan(skillName, projectPath, options2);
19041
+ await this.cleanAndCreateDirectory(plan.path);
19042
+ await this.copyDir(skillPath, plan.path);
19043
+ return plan;
19044
+ }
19045
+ async installSkillFromContentToCanonicalStore(skillName, skillContent, projectPath, options2 = {}) {
19046
+ const plan = this.getCanonicalInstallPlan(skillName, projectPath, options2);
19047
+ await this.cleanAndCreateDirectory(plan.path);
19048
+ await fs24.writeFile(join5(plan.path, "SKILL.md"), skillContent, "utf8");
19049
+ return plan;
19050
+ }
19051
+ getCanonicalInstallPlan(skillName, projectPath, options2 = {}) {
19052
+ const normalizedSkillName = this.normalizeSkillName(skillName);
19053
+ const canonicalPath = this.resolveInstallPath(this.getCanonicalSkillsDir(projectPath, options2.global ?? false), normalizedSkillName);
19054
+ return {
19055
+ path: canonicalPath,
19056
+ canonicalPath,
19057
+ mode: "symlink"
19058
+ };
19059
+ }
19000
19060
  normalizeSkillName(skillName) {
19001
19061
  const normalized = skillName.trim();
19002
19062
  if (!normalized) {
@@ -19032,45 +19092,59 @@ class SkillsManager {
19032
19092
  await fs24.cp(src, dest, { recursive: true, dereference: true });
19033
19093
  }
19034
19094
  async addFromSource(source, projectPath, options2 = {}) {
19035
- const context = await this.loadDiscoveredSkillsContext(source, projectPath, {
19095
+ const context = this.takePreparedSourceContext(source, projectPath, options2.from) || await this.loadDiscoveredSkillsContext(source, projectPath, {
19036
19096
  ...options2.from !== undefined ? { from: options2.from } : {}
19037
19097
  });
19038
19098
  try {
19039
- let skills = context.skills;
19040
- if (skills.length === 0) {
19099
+ let skills2 = context.skills;
19100
+ if (skills2.length === 0) {
19041
19101
  return { installed: [], skipped: [], warnings: context.warnings };
19042
19102
  }
19043
19103
  if (options2.skills && options2.skills.length > 0) {
19044
19104
  const names = new Set(options2.skills.map((skill) => skill.toLowerCase()));
19045
- skills = skills.filter((skill) => names.has(skill.name.toLowerCase()));
19105
+ skills2 = skills2.filter((skill) => names.has(skill.name.toLowerCase()));
19046
19106
  }
19107
+ const installToSharedStore = options2.agents?.includes(SHARED_SKILLS_TARGET_ID) ?? false;
19047
19108
  const agents = await this.getTargetAgents(projectPath, options2);
19048
- if (agents.length === 0) {
19109
+ if (agents.length === 0 && !installToSharedStore) {
19049
19110
  return {
19050
19111
  installed: [],
19051
- skipped: skills.map((skill) => ({ skill, reason: "No target agents found" })),
19112
+ skipped: skills2.map((skill) => ({ skill, reason: "No target agents found" })),
19052
19113
  warnings: context.warnings
19053
19114
  };
19054
19115
  }
19055
19116
  const result = { installed: [], skipped: [], warnings: context.warnings };
19056
19117
  const installableAgents = [];
19118
+ if (installToSharedStore) {
19119
+ for (const skill of skills2) {
19120
+ try {
19121
+ const installOptions = {
19122
+ ...options2.global !== undefined ? { global: options2.global } : {}
19123
+ };
19124
+ const installed = skill.generatedContent ? await this.installSkillFromContentToCanonicalStore(skill.name, skill.generatedContent, projectPath, installOptions) : await this.installSkillToCanonicalStore(skill.path, skill.name, projectPath, installOptions);
19125
+ result.installed.push({ skill, agent: SHARED_SKILLS_TARGET_ID, ...installed });
19126
+ } catch (error) {
19127
+ result.skipped.push({ skill, reason: error.message });
19128
+ }
19129
+ }
19130
+ }
19057
19131
  for (const agent of agents) {
19058
19132
  if (!agent.supportsSkills()) {
19059
- for (const skill of skills) {
19133
+ for (const skill of skills2) {
19060
19134
  result.skipped.push({ skill, reason: `${agent.name} does not support skills` });
19061
19135
  }
19062
19136
  continue;
19063
19137
  }
19064
19138
  const skillsDir = agent.getSkillsDir(projectPath, options2.global);
19065
19139
  if (!skillsDir) {
19066
- for (const skill of skills) {
19140
+ for (const skill of skills2) {
19067
19141
  result.skipped.push({ skill, reason: `No skills directory for ${agent.name}` });
19068
19142
  }
19069
19143
  continue;
19070
19144
  }
19071
19145
  installableAgents.push(agent);
19072
19146
  }
19073
- for (const skill of skills) {
19147
+ for (const skill of skills2) {
19074
19148
  for (const agent of installableAgents) {
19075
19149
  try {
19076
19150
  const installOptions = {
@@ -19149,6 +19223,43 @@ class SkillsManager {
19149
19223
  }
19150
19224
  }
19151
19225
  }
19226
+ const includeSharedTarget = !options2.agents || options2.agents.includes(SHARED_SKILLS_TARGET_ID);
19227
+ if (includeSharedTarget) {
19228
+ const scopes = options2.global ? ["global"] : ["project", "global"];
19229
+ const referencedCanonicalPaths = new Set(installed.map((entry) => entry.canonicalPath).filter((value) => !!value).map((value) => resolve8(value)));
19230
+ for (const scope of scopes) {
19231
+ const canonicalDir = this.getCanonicalSkillsDir(projectPath, scope === "global");
19232
+ if (!await fileExists(canonicalDir))
19233
+ continue;
19234
+ const entries = await listFiles(canonicalDir);
19235
+ for (const entry of entries) {
19236
+ const entryPath = join5(canonicalDir, entry);
19237
+ if (!await isDirectory(entryPath))
19238
+ continue;
19239
+ const resolvedEntryPath = resolve8(entryPath);
19240
+ if (referencedCanonicalPaths.has(resolvedEntryPath))
19241
+ continue;
19242
+ const skillMdPath = join5(entryPath, "SKILL.md");
19243
+ const skillMdPathLower = join5(entryPath, "skill.md");
19244
+ const skillFile = await fileExists(skillMdPath) ? skillMdPath : await fileExists(skillMdPathLower) ? skillMdPathLower : null;
19245
+ if (!skillFile)
19246
+ continue;
19247
+ const parsed = await this.parseSkillMd(skillFile);
19248
+ if (!parsed)
19249
+ continue;
19250
+ installed.push({
19251
+ name: parsed.name,
19252
+ description: parsed.description,
19253
+ path: entryPath,
19254
+ canonicalPath: resolvedEntryPath,
19255
+ agent: SHARED_SKILLS_TARGET_ID,
19256
+ scope,
19257
+ isSymlink: false,
19258
+ mode: "symlink"
19259
+ });
19260
+ }
19261
+ }
19262
+ }
19152
19263
  return installed;
19153
19264
  }
19154
19265
  async remove(skillNames, projectPath, options2 = {}) {
@@ -19159,11 +19270,19 @@ class SkillsManager {
19159
19270
  const skipped = [];
19160
19271
  const namesLower = new Set(skillNames.map((n) => n.toLowerCase()));
19161
19272
  const targetAgentIds = new Set(agents.map((agent) => agent.id));
19273
+ if (options2.agents?.includes(SHARED_SKILLS_TARGET_ID) || options2.agents === undefined) {
19274
+ targetAgentIds.add(SHARED_SKILLS_TARGET_ID);
19275
+ }
19162
19276
  const installed = await this.listInstalledForAgents(projectPath, allAgents, options2);
19163
- const scopedInstalled = installed.filter((entry) => options2.global ? entry.scope === "global" : entry.scope === "project");
19277
+ const sharedTargetInstalled = options2.agents?.includes(SHARED_SKILLS_TARGET_ID) ? await this.listInstalledForAgents(projectPath, [], options2) : [];
19278
+ const installedEntries = Array.from(new Map([...installed, ...sharedTargetInstalled].map((entry) => [
19279
+ `${entry.agent}:${entry.scope}:${entry.path}:${entry.name}`,
19280
+ entry
19281
+ ])).values());
19282
+ const scopedInstalled = installedEntries.filter((entry) => options2.global ? entry.scope === "global" : entry.scope === "project");
19164
19283
  const targetedEntries = scopedInstalled.filter((entry) => targetAgentIds.has(entry.agent) && namesLower.has(entry.name.toLowerCase()));
19165
19284
  const targetedKeys = new Set(targetedEntries.map((entry) => `${entry.agent}:${entry.scope}:${entry.path}:${entry.name}`));
19166
- const remainingEntries = installed.filter((entry) => !targetedKeys.has(`${entry.agent}:${entry.scope}:${entry.path}:${entry.name}`));
19285
+ const remainingEntries = installedEntries.filter((entry) => !targetedKeys.has(`${entry.agent}:${entry.scope}:${entry.path}:${entry.name}`));
19167
19286
  const removedPaths = new Set;
19168
19287
  const removedCanonicalPaths = new Set;
19169
19288
  for (const entry of targetedEntries) {
@@ -19223,6 +19342,7 @@ var init_skillsManager = __esm(() => {
19223
19342
  init_fs();
19224
19343
  init_agentManager();
19225
19344
  init_marketplaceRegistry();
19345
+ init_skills();
19226
19346
  execFileAsync = promisify(execFile);
19227
19347
  DEFAULT_SKILLS_CATALOG = {
19228
19348
  owner: "vercel-labs",
@@ -39992,7 +40112,7 @@ init_fs();
39992
40112
  import {dirname as dirname8, join as join9} from "path";
39993
40113
  async function discoverProjectSkills(projectPath, skillsManager4) {
39994
40114
  const sources = [];
39995
- const skills = new Map;
40115
+ const skills2 = new Map;
39996
40116
  for (const sourceDir of PROJECT_SKILL_SOURCE_DIRS) {
39997
40117
  const absoluteSourceDir = join9(projectPath, sourceDir);
39998
40118
  if (!await fileExists(absoluteSourceDir)) {
@@ -40002,23 +40122,23 @@ async function discoverProjectSkills(projectPath, skillsManager4) {
40002
40122
  const discovered = await skillsManager4.discoverSkills(absoluteSourceDir);
40003
40123
  for (const skill of discovered) {
40004
40124
  const key = skill.name.toLowerCase();
40005
- if (!skills.has(key)) {
40006
- skills.set(key, skill);
40125
+ if (!skills2.has(key)) {
40126
+ skills2.set(key, skill);
40007
40127
  }
40008
40128
  }
40009
40129
  }
40010
40130
  return {
40011
40131
  sources,
40012
- skills: [...skills.values()]
40132
+ skills: [...skills2.values()]
40013
40133
  };
40014
40134
  }
40015
40135
  async function applyProjectSkills(projectPath, targetAgentIds, managedState2, options2 = {}) {
40016
40136
  const agentManager6 = new AgentManager;
40017
40137
  const skillsManager4 = new SkillsManager(agentManager6);
40018
- const { sources, skills } = await discoverProjectSkills(projectPath, skillsManager4);
40138
+ const { sources, skills: skills2 } = await discoverProjectSkills(projectPath, skillsManager4);
40019
40139
  const installed = [];
40020
40140
  const skipped = [];
40021
- if (skills.length === 0) {
40141
+ if (skills2.length === 0) {
40022
40142
  return {
40023
40143
  discovered: 0,
40024
40144
  sources,
@@ -40029,22 +40149,22 @@ async function applyProjectSkills(projectPath, targetAgentIds, managedState2, op
40029
40149
  const targetAgents = targetAgentIds.map((id) => agentManager6.getAgentById(id)).filter((agent) => !!agent);
40030
40150
  if (targetAgents.length === 0) {
40031
40151
  return {
40032
- discovered: skills.length,
40152
+ discovered: skills2.length,
40033
40153
  sources,
40034
40154
  installed,
40035
- skipped: skills.map((skill) => ({ skill, reason: "No target agents found" }))
40155
+ skipped: skills2.map((skill) => ({ skill, reason: "No target agents found" }))
40036
40156
  };
40037
40157
  }
40038
40158
  for (const agent of targetAgents) {
40039
40159
  if (!agent.supportsSkills()) {
40040
- for (const skill of skills) {
40160
+ for (const skill of skills2) {
40041
40161
  skipped.push({ skill, reason: `${agent.name} does not support skills` });
40042
40162
  }
40043
40163
  continue;
40044
40164
  }
40045
40165
  const skillsDir = agent.getSkillsDir(projectPath, false);
40046
40166
  if (!skillsDir) {
40047
- for (const skill of skills) {
40167
+ for (const skill of skills2) {
40048
40168
  skipped.push({ skill, reason: `No skills directory for ${agent.name}` });
40049
40169
  }
40050
40170
  continue;
@@ -40055,7 +40175,7 @@ async function applyProjectSkills(projectPath, targetAgentIds, managedState2, op
40055
40175
  continue;
40056
40176
  if (!agent.getSkillsDir(projectPath, false))
40057
40177
  continue;
40058
- for (const skill of skills) {
40178
+ for (const skill of skills2) {
40059
40179
  try {
40060
40180
  const installOptions = {
40061
40181
  ...options2.copy !== undefined ? { copy: options2.copy } : {}
@@ -40079,7 +40199,7 @@ async function applyProjectSkills(projectPath, targetAgentIds, managedState2, op
40079
40199
  }
40080
40200
  }
40081
40201
  return {
40082
- discovered: skills.length,
40202
+ discovered: skills2.length,
40083
40203
  sources,
40084
40204
  installed,
40085
40205
  skipped
@@ -41081,10 +41201,11 @@ import {relative as relative7, resolve as resolve12} from "path";
41081
41201
  init_skillsManager();
41082
41202
  init_marketplaceRegistry();
41083
41203
  init_agentManager();
41204
+ init_skills();
41084
41205
  function registerSkillsCommand(program2) {
41085
41206
  const marketplaceHelp = getMarketplaceIds().join(", ");
41086
- const skills = program2.command("skills").description("Manage agent skills");
41087
- skills.command("add <source>").description("Add skills from a marketplace, GitHub repo, or local path").option("--from <marketplace>", `Marketplace source override (available: ${marketplaceHelp})`).option("-g, --global", "Install skills globally").option("-a, --agent <agents...>", "Target specific agent(s)").option("-s, --skill <names...>", "Install only specific skills by name").option("-l, --list", "List available skills from the source without installing").option("--copy", "Copy skill files instead of symlinking").option("-y, --yes", "Skip prompts and auto-detect project-configured agents only").action(async (source, options2) => {
41207
+ const skills3 = program2.command("skills").description("Manage agent skills");
41208
+ skills3.command("add <source>").description("Add skills from a marketplace, GitHub repo, or local path").option("--from <marketplace>", `Marketplace source override (available: ${marketplaceHelp})`).option("-g, --global", "Install skills globally").option("-a, --agent <agents...>", "Target specific agent(s)").option("-s, --skill <names...>", "Install only specific skills by name").option("-l, --list", "List available skills from the source without installing").option("--copy", "Copy skill files instead of symlinking").option("-y, --yes", "Skip prompts and auto-detect project-configured agents only").action(async (source, options2) => {
41088
41209
  logger.titleBox("AgentInit Skills");
41089
41210
  const agentManager9 = new AgentManager;
41090
41211
  const skillsManager5 = new SkillsManager(agentManager9);
@@ -41102,6 +41223,17 @@ function registerSkillsCommand(program2) {
41102
41223
  }
41103
41224
  return;
41104
41225
  }
41226
+ const verifySpinner = ora("Verifying skill source...").start();
41227
+ try {
41228
+ await skillsManager5.prepareSource(source, process.cwd(), {
41229
+ from: options2.from
41230
+ });
41231
+ verifySpinner.stop();
41232
+ } catch (error) {
41233
+ verifySpinner.fail("Failed to verify skill source");
41234
+ logger.error(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
41235
+ return;
41236
+ }
41105
41237
  let targetAgents = options2.agent;
41106
41238
  let targetGlobal = options2.global;
41107
41239
  if (!targetAgents && !options2.yes) {
@@ -41110,6 +41242,9 @@ function registerSkillsCommand(program2) {
41110
41242
  global: options2.global
41111
41243
  });
41112
41244
  if (selection?.aborted) {
41245
+ await skillsManager5.discardPreparedSource(source, process.cwd(), {
41246
+ from: options2.from
41247
+ });
41113
41248
  return;
41114
41249
  }
41115
41250
  if (selection?.agents && selection.agents.length > 0) {
@@ -41134,7 +41269,7 @@ function registerSkillsCommand(program2) {
41134
41269
  logger.error(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
41135
41270
  }
41136
41271
  });
41137
- skills.command("list").alias("ls").description("List installed skills").option("-g, --global", "List only global skills").option("-a, --agent <agents...>", "Filter by specific agent(s)").action(async (options2) => {
41272
+ skills3.command("list").alias("ls").description("List installed skills").option("-g, --global", "List only global skills").option("-a, --agent <agents...>", "Filter by specific agent(s)").action(async (options2) => {
41138
41273
  logger.titleBox("AgentInit Skills");
41139
41274
  const agentManager9 = new AgentManager;
41140
41275
  const skillsManager5 = new SkillsManager(agentManager9);
@@ -41163,7 +41298,7 @@ function registerSkillsCommand(program2) {
41163
41298
  if (skill.mode === "symlink") {
41164
41299
  existing.mode = "symlink";
41165
41300
  }
41166
- existing.agents.add(agentManager9.getAgentById(skill.agent)?.name || skill.agent);
41301
+ existing.agents.add(formatSkillTargetName(agentManager9, skill.agent));
41167
41302
  bySkill.set(key, existing);
41168
41303
  }
41169
41304
  for (const skill of bySkill.values()) {
@@ -41174,7 +41309,7 @@ function registerSkillsCommand(program2) {
41174
41309
  logger.info(` Agents: ${[...skill.agents].join(", ")}`);
41175
41310
  }
41176
41311
  });
41177
- skills.command("remove [names...]").alias("rm").description("Remove installed skills by name").option("-g, --global", "Remove from global scope").option("-a, --agent <agents...>", "Target specific agent(s)").option("-y, --yes", "Skip confirmation prompts").action(async (names, options2) => {
41312
+ skills3.command("remove [names...]").alias("rm").description("Remove installed skills by name").option("-g, --global", "Remove from global scope").option("-a, --agent <agents...>", "Target specific agent(s)").option("-y, --yes", "Skip confirmation prompts").action(async (names, options2) => {
41178
41313
  logger.titleBox("AgentInit Skills");
41179
41314
  if (!names || names.length === 0) {
41180
41315
  if (!options2.yes) {
@@ -41258,9 +41393,9 @@ async function resolveInteractiveSkillTargets(skillsManager5, agentManager9, sou
41258
41393
  instructions: false,
41259
41394
  min: 1,
41260
41395
  choices: availableGroups.map((group) => ({
41261
- title: `${group.displayDir} -> ${group.agentNames.join(", ")}${formatCompatibleAgents(group)}`,
41396
+ title: formatSkillGroupTitle(group),
41262
41397
  ...group.description ? { description: group.description } : {},
41263
- value: group.agents.map((agent) => agent.id),
41398
+ value: group.kind === "canonical-shared" ? [SHARED_SKILLS_TARGET_ID] : group.agents.map((agent) => agent.id),
41264
41399
  selected: shouldPreselectSkillGroup(group, installGlobal, detectedGroups.length > 0, recommendedAgentId)
41265
41400
  }))
41266
41401
  });
@@ -41309,15 +41444,23 @@ var buildSkillGroups = function(agents, projectPath, global3) {
41309
41444
  existing.push(agent);
41310
41445
  dirToAgents.set(skillsDir, existing);
41311
41446
  }
41312
- return Array.from(dirToAgents.entries()).map(([dir, groupedAgents]) => ({
41313
- dir,
41314
- displayDir: formatSkillsDir(projectPath, dir),
41315
- agents: groupedAgents,
41316
- agentNames: groupedAgents.map((agent) => agent.name),
41317
- compatibleAgents: [],
41318
- compatibleAgentNames: [],
41319
- kind: "native"
41320
- }));
41447
+ return Array.from(dirToAgents.entries()).map(([dir, groupedAgents]) => {
41448
+ const canonicalShared = resolve12(dir) === getCanonicalSkillsDirForScope(projectPath, !!global3) && groupedAgents.every((agent) => agent.getProjectSkillsStandard() === "agents");
41449
+ return {
41450
+ dir,
41451
+ displayDir: formatSkillsDir(projectPath, dir),
41452
+ agents: groupedAgents,
41453
+ agentNames: groupedAgents.map((agent) => agent.name),
41454
+ compatibleAgents: [],
41455
+ compatibleAgentNames: [],
41456
+ ...canonicalShared ? {
41457
+ description: `Install only into the shared AGENTS.md store. Compatible tools: ${groupedAgents.map((agent) => agent.name).join(", ")}.`,
41458
+ kind: "canonical-shared"
41459
+ } : {
41460
+ kind: "native"
41461
+ }
41462
+ };
41463
+ });
41321
41464
  };
41322
41465
  var prependCanonicalGlobalGroup = function(agentManager9, projectPath, groups) {
41323
41466
  const canonicalDir = getCanonicalGlobalSkillsDir();
@@ -41332,7 +41475,7 @@ var prependCanonicalGlobalGroup = function(agentManager9, projectPath, groups) {
41332
41475
  return [
41333
41476
  {
41334
41477
  ...existingCanonical,
41335
- description: existingCanonical.description || "Canonical shared skills store for the open AGENTS.md ecosystem.",
41478
+ description: existingCanonical.description || `Install only into the shared AGENTS.md store. Compatible tools: ${existingCanonical.agentNames.join(", ")}.`,
41336
41479
  kind: "canonical-shared"
41337
41480
  },
41338
41481
  ...remaining
@@ -41346,7 +41489,7 @@ var prependCanonicalGlobalGroup = function(agentManager9, projectPath, groups) {
41346
41489
  agentNames: sharedAgents.map((agent) => agent.name),
41347
41490
  compatibleAgents: [],
41348
41491
  compatibleAgentNames: [],
41349
- description: "Canonical shared skills store for the open AGENTS.md ecosystem.",
41492
+ description: `Install only into the shared AGENTS.md store. Compatible tools: ${sharedAgents.map((agent) => agent.name).join(", ")}.`,
41350
41493
  kind: "canonical-shared"
41351
41494
  },
41352
41495
  ...groups.map((group) => {
@@ -41384,12 +41527,15 @@ var formatPromptPath = function(path) {
41384
41527
  var getCanonicalGlobalSkillsDir = function() {
41385
41528
  return resolve12(homedir6(), ".agents/skills");
41386
41529
  };
41530
+ var getCanonicalSkillsDirForScope = function(projectPath, global3) {
41531
+ return global3 ? getCanonicalGlobalSkillsDir() : resolve12(projectPath, ".agents/skills");
41532
+ };
41387
41533
  var getCanonicalGlobalSkillsDisplayPath = function() {
41388
41534
  return formatPromptPath(getCanonicalGlobalSkillsDir());
41389
41535
  };
41390
41536
  var describeGlobalSkillGroup = function(group) {
41391
41537
  if (group.kind === "canonical-shared") {
41392
- return group.description;
41538
+ return group.description || `Install only into the shared AGENTS.md store. Compatible tools: ${group.agentNames.join(", ")}.`;
41393
41539
  }
41394
41540
  if (group.agents.every((agent) => agent.getProjectSkillsStandard() === "agents")) {
41395
41541
  return `Native agent directory linked to ${getCanonicalGlobalSkillsDisplayPath()} when symlinks are used.`;
@@ -41399,6 +41545,18 @@ var describeGlobalSkillGroup = function(group) {
41399
41545
  }
41400
41546
  return;
41401
41547
  };
41548
+ var formatSkillGroupTitle = function(group) {
41549
+ if (group.kind === "canonical-shared") {
41550
+ return `${group.displayDir} -> ${SHARED_SKILLS_TARGET_NAME}`;
41551
+ }
41552
+ return `${group.displayDir} -> ${group.agentNames.join(", ")}${formatCompatibleAgents(group)}`;
41553
+ };
41554
+ var formatSkillTargetName = function(agentManager9, agentId) {
41555
+ if (agentId === SHARED_SKILLS_TARGET_ID) {
41556
+ return SHARED_SKILLS_TARGET_NAME;
41557
+ }
41558
+ return agentManager9.getAgentById(agentId)?.name || agentId;
41559
+ };
41402
41560
  var shouldPreselectSkillGroup = function(group, installGlobal, hasDetectedGroups, recommendedAgentId) {
41403
41561
  const includesRecommendedAgent = !!recommendedAgentId && group.agents.some((agent) => agent.id === recommendedAgentId);
41404
41562
  if (!installGlobal) {
@@ -41451,18 +41609,18 @@ var buildSkillsAddCommand = function(source, from, extraArgs) {
41451
41609
  args.push(...extraArgs);
41452
41610
  return args.join(" ");
41453
41611
  };
41454
- var displayDiscoveredSkills = function(skills, warnings) {
41455
- if (skills.length === 0) {
41612
+ var displayDiscoveredSkills = function(skills3, warnings) {
41613
+ if (skills3.length === 0) {
41456
41614
  logger.info("No skills found in the source.");
41457
41615
  for (const warning of warnings) {
41458
41616
  logger.warn(warning);
41459
41617
  }
41460
41618
  return;
41461
41619
  }
41462
- logger.info(`Found ${green(String(skills.length))} skill(s):\n`);
41620
+ logger.info(`Found ${green(String(skills3.length))} skill(s):\n`);
41463
41621
  logger.info(" Name Description");
41464
41622
  logger.info(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
41465
- for (const skill of skills) {
41623
+ for (const skill of skills3) {
41466
41624
  const name = skill.name.padEnd(18);
41467
41625
  logger.info(` ${green(name)} ${skill.description}`);
41468
41626
  }
@@ -41503,7 +41661,7 @@ var displayInstallResult = function(result, spinner, agentManager9, skillsManage
41503
41661
  agents: new Set,
41504
41662
  skills: new Set
41505
41663
  };
41506
- existing.agents.add(agentManager9.getAgentById(item.agent)?.name || item.agent);
41664
+ existing.agents.add(formatSkillTargetName(agentManager9, item.agent));
41507
41665
  existing.skills.add(item.skill.name);
41508
41666
  byPath.set(path, existing);
41509
41667
  }
@@ -1 +1 @@
1
- {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoM5D"}
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmN5D"}