itismyskillmarket 1.1.7 → 1.2.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/index.js CHANGED
@@ -96,11 +96,23 @@ import https from "https";
96
96
  import { URL } from "url";
97
97
  async function fetchNpmPackage(packageName) {
98
98
  return new Promise((resolve, reject) => {
99
- const encodedName = packageName.replace("@", "");
99
+ const isScoped = packageName.startsWith("@");
100
+ let encodedName;
101
+ if (isScoped) {
102
+ const scopeAndName = packageName.substring(1);
103
+ const slashIndex = scopeAndName.indexOf("/");
104
+ if (slashIndex > 0) {
105
+ const scope = scopeAndName.substring(0, slashIndex);
106
+ const name = scopeAndName.substring(slashIndex + 1);
107
+ encodedName = `@${encodeURIComponent(scope)}%2F${encodeURIComponent(name)}`;
108
+ } else {
109
+ encodedName = packageName;
110
+ }
111
+ } else {
112
+ encodedName = encodeURIComponent(packageName);
113
+ }
100
114
  const url = new URL(`https://registry.npmjs.org/${encodedName}`);
101
- console.error("Fetching URL:", url.toString());
102
115
  const req = https.get(url.toString(), { timeout: 1e4 }, (res) => {
103
- console.error("Response status:", res.statusCode);
104
116
  let data = "";
105
117
  res.on("data", (chunk) => {
106
118
  data += chunk;
@@ -109,24 +121,16 @@ async function fetchNpmPackage(packageName) {
109
121
  try {
110
122
  const parsed = JSON.parse(data);
111
123
  if (parsed.error) {
112
- console.error("NPM error:", parsed.error);
113
124
  resolve(null);
114
125
  return;
115
126
  }
116
- console.error("Parsed keys:", Object.keys(parsed).slice(0, 10));
117
- console.error("Has name:", "name" in parsed);
118
- console.error("Name value:", parsed.name);
119
127
  resolve(parsed);
120
- } catch (e) {
121
- console.error("JSON parse error:", e.message, "Data:", data.slice(0, 200));
128
+ } catch {
122
129
  resolve(null);
123
130
  }
124
131
  });
125
132
  });
126
- req.on("error", (e) => {
127
- console.error("Request error:", e.code, e.message);
128
- reject(e);
129
- });
133
+ req.on("error", reject);
130
134
  req.on("timeout", () => {
131
135
  req.destroy();
132
136
  reject(new Error("Request timeout"));
@@ -194,11 +198,9 @@ async function listSkills(options) {
194
198
  console.log(`Found ${packages.length} skill(s):
195
199
  `);
196
200
  for (const pkgName of packages) {
197
- console.error("Fetching:", pkgName);
198
201
  const info = await fetchNpmPackage(pkgName);
199
- console.error("Got info:", info ? "yes" : "no", info?.name);
200
- if (info && info.name) {
201
- const latestVersion = info["dist-tags"]?.latest;
202
+ if (info && info["dist-tags"]?.latest) {
203
+ const latestVersion = info["dist-tags"].latest;
202
204
  const pkg = info.versions?.[latestVersion];
203
205
  console.log(` ${info.name}@${latestVersion}`);
204
206
  console.log(` ${pkg?.description || "No description"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itismyskillmarket",
3
- "version": "1.1.7",
3
+ "version": "1.2.0",
4
4
  "description": "Cross-platform skill manager for AI coding tools",
5
5
  "type": "module",
6
6
  "files": [
@@ -117,13 +117,10 @@ export async function listSkills(options: LsOptions): Promise<void> {
117
117
 
118
118
  // 遍历每个包,获取详细信息并显示
119
119
  for (const pkgName of packages) {
120
- console.error('Fetching:', pkgName);
121
120
  const info = await fetchNpmPackage(pkgName);
122
- console.error('Got info:', info ? 'yes' : 'no', info?.name);
123
121
 
124
- if (info && info.name) {
125
- // 获取最新版本号
126
- const latestVersion = info['dist-tags']?.latest;
122
+ if (info && info['dist-tags']?.latest) {
123
+ const latestVersion = info['dist-tags'].latest;
127
124
 
128
125
  // 获取该版本的详细信息
129
126
  const pkg = info.versions?.[latestVersion];
@@ -118,20 +118,35 @@ interface SearchPackage {
118
118
  export async function fetchNpmPackage(packageName: string): Promise<NpmRegistryResponse | null> {
119
119
  return new Promise((resolve, reject) => {
120
120
  // 构建 npm registry URL
121
- // 处理 scoped 包(如 @foo/bar -> foo/bar)
122
- const encodedName = packageName.replace('@', '');
123
- const url = new URL(`https://registry.npmjs.org/${encodedName}`);
121
+ // scoped 包(如 @foo/bar)需要特殊处理,保留 @ 符号
122
+ // @foo/bar -> @foo%2Fbar (URL encoded)
123
+ const isScoped = packageName.startsWith('@');
124
+ let encodedName: string;
125
+
126
+ if (isScoped) {
127
+ // 对 scoped 包进行正确编码:@foo/bar -> @foo%2Fbar
128
+ const scopeAndName = packageName.substring(1); // 去掉 @
129
+ const slashIndex = scopeAndName.indexOf('/');
130
+ if (slashIndex > 0) {
131
+ const scope = scopeAndName.substring(0, slashIndex);
132
+ const name = scopeAndName.substring(slashIndex + 1);
133
+ encodedName = `@${encodeURIComponent(scope)}%2F${encodeURIComponent(name)}`;
134
+ } else {
135
+ encodedName = packageName; // fallback
136
+ }
137
+ } else {
138
+ encodedName = encodeURIComponent(packageName);
139
+ }
124
140
 
125
- console.error('Fetching URL:', url.toString());
141
+ const url = new URL(`https://registry.npmjs.org/${encodedName}`);
126
142
 
127
143
  // 发送 HTTPS GET 请求
128
144
  const req = https.get(url.toString(), { timeout: 10000 }, (res) => {
129
- console.error('Response status:', res.statusCode);
130
145
  let data = '';
131
146
 
132
147
  // 收集响应数据
133
148
  res.on('data', chunk => { data += chunk; });
134
-
149
+
135
150
  res.on('end', () => {
136
151
  try {
137
152
  // 解析 JSON 响应
@@ -140,30 +155,21 @@ export async function fetchNpmPackage(packageName: string): Promise<NpmRegistryR
140
155
  // 检查 npm 返回的错误
141
156
  // npm 对于不存在的包也返回 200,但 body 中有 error 字段
142
157
  if (parsed.error) {
143
- console.error('NPM error:', parsed.error);
144
158
  resolve(null);
145
159
  return;
146
160
  }
147
-
148
- console.error('Parsed keys:', Object.keys(parsed).slice(0, 10));
149
- console.error('Has name:', 'name' in parsed);
150
- console.error('Name value:', parsed.name);
151
-
161
+
152
162
  // 成功解析,返回包信息
153
163
  resolve(parsed);
154
- } catch (e) {
164
+ } catch {
155
165
  // JSON 解析失败,返回 null
156
- console.error('JSON parse error:', e.message, 'Data:', data.slice(0, 200));
157
166
  resolve(null);
158
167
  }
159
168
  });
160
169
  });
161
170
 
162
171
  // 处理网络错误
163
- req.on('error', (e) => {
164
- console.error('Request error:', e.code, e.message);
165
- reject(e);
166
- });
172
+ req.on('error', reject);
167
173
 
168
174
  // 处理请求超时(10秒)
169
175
  req.on('timeout', () => {
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 DevTools Assistant Plugin
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.