@ze-norm/cli 0.9.0 → 0.10.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.
@@ -1 +1 @@
1
- {"version":3,"file":"install-skills.d.ts","sourceRoot":"","sources":["../../src/commands/install-skills.ts"],"names":[],"mappings":"AA4MA,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCxE"}
1
+ {"version":3,"file":"install-skills.d.ts","sourceRoot":"","sources":["../../src/commands/install-skills.ts"],"names":[],"mappings":"AAqOA,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCxE"}
@@ -93,6 +93,21 @@ function installToTargetDir(targetDir, force) {
93
93
  }
94
94
  log.success(`Installed ${skillNames.length} ZeNorm skill(s): ${targetDir}`);
95
95
  }
96
+ // `skills list` ignores its `--agent` flag and returns every agent's skills, so
97
+ // we scope by the displayName entries in each skill's `agents` array instead.
98
+ // Match on alphanumeric-lowercase normalization: "claude-code" <-> "Claude Code",
99
+ // "github-copilot" <-> "GitHub Copilot", "gemini-cli" <-> "Gemini CLI", etc.
100
+ function normalizeAgentLabel(label) {
101
+ return label.toLowerCase().replace(/[^a-z0-9]/g, "");
102
+ }
103
+ function skillBelongsToAgent(skill, agent) {
104
+ if (agent === "*")
105
+ return true;
106
+ if (!Array.isArray(skill.agents))
107
+ return false;
108
+ const wanted = normalizeAgentLabel(agent);
109
+ return skill.agents.some((label) => typeof label === "string" && normalizeAgentLabel(label) === wanted);
110
+ }
96
111
  function listInstalledSkills(agent, project) {
97
112
  const scopeArgs = project ? [] : ["--global"];
98
113
  const agentArgs = agent === "*" ? [] : ["--agent", agent];
@@ -116,13 +131,19 @@ function assertNoInstalledZeNormSkills(agent, project, force) {
116
131
  if (force)
117
132
  return;
118
133
  const bundledSkillNames = new Set(listSkillDirs(getBundledSkillsRoot()));
119
- const existing = listInstalledSkills(agent, project).filter((skill) => typeof skill.name === "string" && bundledSkillNames.has(skill.name));
134
+ const existing = listInstalledSkills(agent, project).filter((skill) => typeof skill.name === "string" &&
135
+ bundledSkillNames.has(skill.name) &&
136
+ skillBelongsToAgent(skill, agent));
120
137
  if (existing.length === 0)
121
138
  return;
122
- const details = existing
123
- .map((skill) => typeof skill.path === "string" ? `${String(skill.name)} (${skill.path})` : String(skill.name))
124
- .join(", ");
125
- throw new CliError(`Refusing to overwrite existing ZeNorm skills: ${details}. Re-run with --force if this is intentional.`);
139
+ const agentLabel = agent === "*" ? "your agents" : agent;
140
+ const skillLines = existing
141
+ .map((skill) => typeof skill.path === "string"
142
+ ? ` ${String(skill.name)} (${skill.path})`
143
+ : ` • ${String(skill.name)}`)
144
+ .join("\n");
145
+ throw new CliError(`ZeNorm skills are already installed for ${agentLabel}:\n${skillLines}\n\n` +
146
+ `Leaving them as-is. To reinstall the bundled versions, re-run with --force.`);
126
147
  }
127
148
  function runSkillsInstaller(agent, project, force) {
128
149
  assertNoInstalledZeNormSkills(agent, project, force);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ze-norm/cli",
3
3
  "private": false,
4
- "version": "0.9.0",
4
+ "version": "0.10.0",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",
7
7
  "repository": {