dsh-agent-plugins-market 0.14.4 → 0.14.5

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.
@@ -159,6 +159,22 @@ export function sanitizeId(raw) {
159
159
  .replace(/-{2,}/g, '-');
160
160
  return cleaned === '' ? 'unnamed' : cleaned;
161
161
  }
162
+ /**
163
+ * Drop every trailing slash in one pass.
164
+ *
165
+ * The anchored regex this replaces scanned the run once from each starting
166
+ * position, which is quadratic on a URL that ends in many slashes; a source URL
167
+ * comes from marketplace data, so the count is not bounded by us.
168
+ *
169
+ * @param value - the URL or path to trim.
170
+ * @returns the same string without trailing `/` characters.
171
+ */
172
+ function trimTrailingSlashes(value) {
173
+ let end = value.length;
174
+ while (end > 0 && value.charCodeAt(end - 1) === 0x2f)
175
+ end -= 1;
176
+ return end === value.length ? value : value.slice(0, end);
177
+ }
162
178
  /** Strip a trailing `.git` or archive suffix (`plugin-0.1.zip` → `plugin-0-1`). */
163
179
  function stripSourceSuffix(base) {
164
180
  const withoutGit = base.endsWith('.git') ? base.slice(0, -4) : base;
@@ -175,7 +191,7 @@ function stripSourceSuffix(base) {
175
191
  * @returns the owner and repository, or undefined for a local path.
176
192
  */
177
193
  export function parseRemoteRepository(url) {
178
- const trimmed = url.trim().replace(/\/+$/, '');
194
+ const trimmed = trimTrailingSlashes(url.trim());
179
195
  const isRemote = /^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed) || /^[\w.-]+@[\w.-]+:/.test(trimmed);
180
196
  if (!isRemote)
181
197
  return undefined;
@@ -198,7 +214,7 @@ export function parseRemoteRepository(url) {
198
214
  * of numeric suffixes. Local paths yield the basename only.
199
215
  */
200
216
  export function deriveSourceIdCandidates(url) {
201
- const trimmed = url.trim().replace(/\/+$/, '');
217
+ const trimmed = trimTrailingSlashes(url.trim());
202
218
  const base = stripSourceSuffix(trimmed.split(/[/\\]/).at(-1) ?? '');
203
219
  const primary = sanitizeId(base);
204
220
  const candidates = [primary];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-agent-plugins-market",
3
3
  "icon": "./assets/dsh-agent-plugins.png",
4
4
  "description": "One-stop skills, subagent, MCP and LSP manager inside DeepSeek Harness (DSH), compatible with Claude Code, Codex, Cursor, Kimi and other agent plugin layouts.",
5
- "version": "0.14.4",
5
+ "version": "0.14.5",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
8
8
  "types": "lib/types/index.d.ts",