@almyty/skills 1.0.12 → 1.0.15
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/client.js +32 -2
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -148,18 +148,48 @@ export class AlmytyClient {
|
|
|
148
148
|
i++;
|
|
149
149
|
return t.slice(i).join('-');
|
|
150
150
|
};
|
|
151
|
+
// Mirror the server's skill-generator truncation when
|
|
152
|
+
// `${gateway}-${suffix}` exceeds 64 chars: drop kebab
|
|
153
|
+
// segments off the *head* of the suffix until the whole
|
|
154
|
+
// thing fits, falling back to a tail substring if a single
|
|
155
|
+
// segment is itself longer than the remaining budget. Cutting
|
|
156
|
+
// from the head keeps the unique tail of long method names
|
|
157
|
+
// (e.g. ~40 google-translate gRPC methods that all share a
|
|
158
|
+
// long prefix) addressable from the CLI.
|
|
159
|
+
const composeAndTruncate = (gw, suffix) => {
|
|
160
|
+
if (!gw)
|
|
161
|
+
return suffix;
|
|
162
|
+
const combined = `${gw}-${suffix}`;
|
|
163
|
+
if (combined.length <= 64)
|
|
164
|
+
return combined;
|
|
165
|
+
const room = 64 - gw.length - 1;
|
|
166
|
+
if (room <= 0)
|
|
167
|
+
return gw.slice(0, 64);
|
|
168
|
+
const segments = suffix.split('-').filter(Boolean);
|
|
169
|
+
let trimmed = segments.join('-');
|
|
170
|
+
while (trimmed.length > room && segments.length > 1) {
|
|
171
|
+
segments.shift();
|
|
172
|
+
trimmed = segments.join('-');
|
|
173
|
+
}
|
|
174
|
+
if (trimmed.length > room)
|
|
175
|
+
trimmed = trimmed.slice(-room);
|
|
176
|
+
return `${gw}-${trimmed.replace(/^-+|-+$/g, '')}`;
|
|
177
|
+
};
|
|
151
178
|
const match = allTools.find((gt) => {
|
|
152
179
|
const t = gt.tool || gt;
|
|
153
180
|
if (!t)
|
|
154
181
|
return false;
|
|
155
182
|
const rawName = t.name || '';
|
|
156
183
|
const slug = slugify(rawName);
|
|
184
|
+
const dedupedSuffix = dedupeShared(gatewaySlug, slug);
|
|
157
185
|
const composed = gatewaySlug
|
|
158
|
-
? `${gatewaySlug}-${
|
|
186
|
+
? `${gatewaySlug}-${dedupedSuffix}`
|
|
159
187
|
: slug;
|
|
188
|
+
const truncated = composeAndTruncate(gatewaySlug, dedupedSuffix);
|
|
160
189
|
return (rawName === toolId ||
|
|
161
190
|
slug === toolId ||
|
|
162
|
-
composed === toolId
|
|
191
|
+
composed === toolId ||
|
|
192
|
+
truncated === toolId);
|
|
163
193
|
});
|
|
164
194
|
if (!match) {
|
|
165
195
|
throw new Error(`Tool "${toolId}" not found in gateway ${gatewayId}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almyty/skills",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Install API skills into AI coding agents
|
|
3
|
+
"version": "1.0.15",
|
|
4
|
+
"description": "Install API skills into AI coding agents — Claude Code, Cursor, Windsurf, Copilot, Codex",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
"typescript": "^5.3.0",
|
|
42
42
|
"vitest": "^4.1.0"
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|