|
1 | | -import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync, cpSync } from 'fs'; |
| 1 | +import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, cpSync } from 'fs'; |
2 | 2 | import { dirname, join, isAbsolute } from 'path'; |
3 | 3 | import { buildPlanningCliHelperEntries, renderSkillContent } from './rendering.mjs'; |
4 | 4 | import { buildManifest, readManifest, writeManifest } from './manifest.mjs'; |
@@ -147,7 +147,7 @@ export function createCmdUpdate(ctx) { |
147 | 147 | updated = true; |
148 | 148 | } |
149 | 149 |
|
150 | | - if (platforms.length > 0 || existsSync(ctx.planningDir) || existsSync(join(ctx.cwd, '.agents', 'skills'))) { |
| 150 | + if (platforms.length > 0 || existsSync(ctx.planningDir) || hasGeneratedOpenStandardSkills(ctx.cwd)) { |
151 | 151 | if (isDry) { |
152 | 152 | console.log(' - would update open-standard skills (.agents/skills/gsdd-*)'); |
153 | 153 | } else { |
@@ -199,6 +199,21 @@ export function createCmdUpdate(ctx) { |
199 | 199 | }; |
200 | 200 | } |
201 | 201 |
|
| 202 | +function hasGeneratedOpenStandardSkills(cwd) { |
| 203 | + const skillsDir = join(cwd, '.agents', 'skills'); |
| 204 | + if (!existsSync(skillsDir)) return false; |
| 205 | + |
| 206 | + try { |
| 207 | + return readdirSync(skillsDir, { withFileTypes: true }).some((entry) => |
| 208 | + entry.isDirectory() && |
| 209 | + entry.name.startsWith('gsdd-') && |
| 210 | + existsSync(join(skillsDir, entry.name, 'SKILL.md')) |
| 211 | + ); |
| 212 | + } catch { |
| 213 | + return false; |
| 214 | + } |
| 215 | +} |
| 216 | + |
202 | 217 | function generateOpenStandardSkills(cwd, workflows) { |
203 | 218 | for (const workflow of workflows) { |
204 | 219 | const dir = join(cwd, '.agents', 'skills', workflow.name); |
|
0 commit comments