joyskills-cli 0.3.1 → 0.3.2
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/package.json +1 -1
- package/src/commands/team.js +8 -7
- package/src/commands/update.js +15 -5
package/package.json
CHANGED
package/src/commands/team.js
CHANGED
|
@@ -50,11 +50,12 @@ export function teamCommand(program) {
|
|
|
50
50
|
const registryYamlPath = path.join(registryCachePath, 'registry.yaml');
|
|
51
51
|
const hasRegistryYaml = fs.existsSync(registryYamlPath);
|
|
52
52
|
|
|
53
|
-
// Count
|
|
54
|
-
const
|
|
55
|
-
const
|
|
53
|
+
// Count skills using findSkills (supports nested directories)
|
|
54
|
+
const { findSkills } = await import('./install.js');
|
|
55
|
+
const foundSkills = await findSkills(registryCachePath);
|
|
56
|
+
const skillCount = foundSkills.length;
|
|
56
57
|
|
|
57
|
-
if (!hasRegistryYaml &&
|
|
58
|
+
if (!hasRegistryYaml && skillCount === 0) {
|
|
58
59
|
throw new Error('Invalid registry: no registry.yaml and no skill directories found');
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -66,14 +67,14 @@ export function teamCommand(program) {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
let registryId = name;
|
|
69
|
-
let
|
|
70
|
+
let finalSkillCount = skillCount;
|
|
70
71
|
|
|
71
72
|
if (hasRegistryYaml) {
|
|
72
73
|
const registryManager = new RegistryManager(registryCachePath);
|
|
73
74
|
await registryManager.load();
|
|
74
75
|
const info = registryManager.getRegistryInfo();
|
|
75
76
|
registryId = info.registryId;
|
|
76
|
-
|
|
77
|
+
finalSkillCount = registryManager.getAllSkills().length;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
config.registries[name] = {
|
|
@@ -88,7 +89,7 @@ export function teamCommand(program) {
|
|
|
88
89
|
|
|
89
90
|
console.log(chalk.green(`✅ Successfully added registry: ${name}`));
|
|
90
91
|
console.log(chalk.gray(` Registry ID: ${registryId}`));
|
|
91
|
-
console.log(chalk.gray(` Skills: ${
|
|
92
|
+
console.log(chalk.gray(` Skills: ${finalSkillCount}${hasRegistryYaml ? '' : ' (no registry.yaml, direct scan)'}`));
|
|
92
93
|
|
|
93
94
|
} catch (error) {
|
|
94
95
|
console.error(chalk.red(`❌ Failed to add registry: ${error.message}`));
|
package/src/commands/update.js
CHANGED
|
@@ -276,14 +276,24 @@ async function checkGitSkillUpdate(skill) {
|
|
|
276
276
|
return { hasUpdate: false, error: 'Not a git repository' };
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
// 获取当前 commit
|
|
280
|
+
const currentLog = await git.log({ maxCount: 1 });
|
|
281
|
+
const currentCommit = currentLog.latest?.hash;
|
|
282
|
+
|
|
283
|
+
// Fetch 远程最新
|
|
279
284
|
await git.fetch(['--depth', '1']);
|
|
280
|
-
const log = await git.log({ maxCount: 1 });
|
|
281
|
-
const latestCommit = log.latest;
|
|
282
285
|
|
|
283
|
-
//
|
|
286
|
+
// 获取远程最新 commit
|
|
287
|
+
const remoteLog = await git.log({ maxCount: 1 });
|
|
288
|
+
const remoteCommit = remoteLog.latest?.hash;
|
|
289
|
+
|
|
290
|
+
// 比较 commit
|
|
291
|
+
const hasUpdate = remoteCommit !== currentCommit;
|
|
292
|
+
|
|
284
293
|
return {
|
|
285
|
-
hasUpdate
|
|
286
|
-
latestVersion:
|
|
294
|
+
hasUpdate,
|
|
295
|
+
latestVersion: remoteCommit?.slice(0, 7) || 'latest',
|
|
296
|
+
currentVersion: currentCommit?.slice(0, 7),
|
|
287
297
|
};
|
|
288
298
|
}
|
|
289
299
|
|