@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":"
|
|
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" &&
|
|
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
|
|
123
|
-
|
|
124
|
-
.
|
|
125
|
-
|
|
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);
|