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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joyskills-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "JoySkills CLI v2.0 - Multi-agent skill management with JoyCode native support",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -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 skill directories (dirs with SKILL.md)
54
- const entries = fs.readdirSync(registryCachePath, { withFileTypes: true });
55
- const skillDirs = entries.filter(e => e.isDirectory() && fs.existsSync(path.join(registryCachePath, e.name, 'SKILL.md')));
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 && skillDirs.length === 0) {
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 skillCount = skillDirs.length;
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
- skillCount = registryManager.getAllSkills().length;
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: ${skillCount}${hasRegistryYaml ? '' : ' (no registry.yaml, direct scan)'}`));
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}`));
@@ -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
- // 简化:如果有 fetch 成功,认为可能有更新
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: true,
286
- latestVersion: latestCommit?.hash?.slice(0, 7) || 'latest',
294
+ hasUpdate,
295
+ latestVersion: remoteCommit?.slice(0, 7) || 'latest',
296
+ currentVersion: currentCommit?.slice(0, 7),
287
297
  };
288
298
  }
289
299