itismyskillmarket 1.2.5 → 1.2.6
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 +15 -8
- package/package.json +1 -1
- package/src/cli.ts +10 -1
package/dist/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
+
import { readFileSync } from "fs";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { dirname, resolve } from "path";
|
|
5
8
|
|
|
6
9
|
// src/commands/registry.ts
|
|
7
10
|
import fs2 from "fs-extra";
|
|
@@ -97,7 +100,7 @@ async function isSkillInstalled(skillId) {
|
|
|
97
100
|
import https from "https";
|
|
98
101
|
import { URL } from "url";
|
|
99
102
|
async function fetchNpmPackage(packageName) {
|
|
100
|
-
return new Promise((
|
|
103
|
+
return new Promise((resolve2, reject) => {
|
|
101
104
|
const isScoped = packageName.startsWith("@");
|
|
102
105
|
let encodedName;
|
|
103
106
|
if (isScoped) {
|
|
@@ -123,12 +126,12 @@ async function fetchNpmPackage(packageName) {
|
|
|
123
126
|
try {
|
|
124
127
|
const parsed = JSON.parse(data);
|
|
125
128
|
if (parsed.error) {
|
|
126
|
-
|
|
129
|
+
resolve2(null);
|
|
127
130
|
return;
|
|
128
131
|
}
|
|
129
|
-
|
|
132
|
+
resolve2(parsed);
|
|
130
133
|
} catch {
|
|
131
|
-
|
|
134
|
+
resolve2(null);
|
|
132
135
|
}
|
|
133
136
|
});
|
|
134
137
|
});
|
|
@@ -174,7 +177,7 @@ async function searchSkillmarketPackages(options = {}) {
|
|
|
174
177
|
const { from = 0, size = 100 } = options;
|
|
175
178
|
const packages = [];
|
|
176
179
|
let total = 0;
|
|
177
|
-
return new Promise((
|
|
180
|
+
return new Promise((resolve2, reject) => {
|
|
178
181
|
const url = new URL("https://registry.npmjs.org/-/v1/search");
|
|
179
182
|
url.searchParams.set("text", "keywords:skillmarket");
|
|
180
183
|
url.searchParams.set("size", String(size));
|
|
@@ -195,9 +198,9 @@ async function searchSkillmarketPackages(options = {}) {
|
|
|
195
198
|
}
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
|
-
|
|
201
|
+
resolve2({ packages, total });
|
|
199
202
|
} catch {
|
|
200
|
-
|
|
203
|
+
resolve2({ packages: [], total: 0 });
|
|
201
204
|
}
|
|
202
205
|
});
|
|
203
206
|
});
|
|
@@ -752,8 +755,12 @@ Uninstalling from ${validAdapters.length} platform(s)...
|
|
|
752
755
|
}
|
|
753
756
|
|
|
754
757
|
// src/cli.ts
|
|
758
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
759
|
+
var __dirname = dirname(__filename);
|
|
760
|
+
var packageJson = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf-8"));
|
|
761
|
+
var VERSION = packageJson.version;
|
|
755
762
|
var program = new Command();
|
|
756
|
-
program.name("skm").description("SkillMarket - Cross-platform skill manager for AI coding tools").version(
|
|
763
|
+
program.name("skm").description("SkillMarket - Cross-platform skill manager for AI coding tools").version(VERSION);
|
|
757
764
|
program.hook("preAction", (thisCommand) => {
|
|
758
765
|
if (thisCommand.opts().help) {
|
|
759
766
|
console.log(`
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -29,6 +29,15 @@
|
|
|
29
29
|
|
|
30
30
|
// Commander.js - 轻量级的命令行界面框架
|
|
31
31
|
import { Command } from 'commander';
|
|
32
|
+
import { readFileSync } from 'fs';
|
|
33
|
+
import { fileURLToPath } from 'url';
|
|
34
|
+
import { dirname, resolve } from 'path';
|
|
35
|
+
|
|
36
|
+
// 获取 package.json 中的版本号
|
|
37
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
38
|
+
const __dirname = dirname(__filename);
|
|
39
|
+
const packageJson = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), 'utf-8'));
|
|
40
|
+
const VERSION = packageJson.version;
|
|
32
41
|
|
|
33
42
|
// 内部模块导入
|
|
34
43
|
import { PLATFORMS } from './constants.js'; // 平台常量
|
|
@@ -65,7 +74,7 @@ const program = new Command();
|
|
|
65
74
|
program
|
|
66
75
|
.name('skm')
|
|
67
76
|
.description('SkillMarket - Cross-platform skill manager for AI coding tools')
|
|
68
|
-
.version(
|
|
77
|
+
.version(VERSION);
|
|
69
78
|
|
|
70
79
|
// -----------------------------------------------------------------------------
|
|
71
80
|
// 帮助命令 (-h, --help)
|