@o/cli 0.16.20 → 0.16.21
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 +4 -4
- package/src/tko/commands/skills.ts +24 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.21",
|
|
4
4
|
"description": "Typed command and subprocess helpers for Orez consumers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@clack/prompts": "^0.8.2",
|
|
55
55
|
"@lydell/node-pty": "^1.2.0-beta.3",
|
|
56
56
|
"picocolors": "^1.1.1",
|
|
57
|
-
"@o/run": "0.16.
|
|
58
|
-
"@o/scripts": "0.16.
|
|
57
|
+
"@o/run": "0.16.21",
|
|
58
|
+
"@o/scripts": "0.16.21",
|
|
59
59
|
"citty": "^0.1.6"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"optional": true
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"releaseSourceCommit": "
|
|
78
|
+
"releaseSourceCommit": "692d233ff502256274f2ff23036a5d17c0936b5a"
|
|
79
79
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* skills command group - manage repository agent skills
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { randomUUID } from 'node:crypto'
|
|
5
6
|
import {
|
|
6
7
|
existsSync,
|
|
7
8
|
lstatSync,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
readdirSync,
|
|
10
11
|
readFileSync,
|
|
11
12
|
readlinkSync,
|
|
13
|
+
renameSync,
|
|
12
14
|
rmSync,
|
|
13
15
|
rmdirSync,
|
|
14
16
|
symlinkSync,
|
|
@@ -20,6 +22,18 @@ import { join, relative, resolve } from 'node:path'
|
|
|
20
22
|
import { defineCommand } from 'citty'
|
|
21
23
|
import pc from 'picocolors'
|
|
22
24
|
|
|
25
|
+
function publishSkillFile(path: string, content: string, linkTarget?: string) {
|
|
26
|
+
const temporary = `${path}.${randomUUID()}.tmp`
|
|
27
|
+
try {
|
|
28
|
+
if (linkTarget === undefined) writeFileSync(temporary, content, 'utf-8')
|
|
29
|
+
else symlinkSync(linkTarget, temporary)
|
|
30
|
+
// another generator can publish between our read and write.
|
|
31
|
+
renameSync(temporary, path)
|
|
32
|
+
} finally {
|
|
33
|
+
rmSync(temporary, { force: true })
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
// --- doc skills generation ---
|
|
24
38
|
|
|
25
39
|
const SKILL_PREFIX = 'takeout-'
|
|
@@ -201,24 +215,28 @@ async function generateDocSkills(
|
|
|
201
215
|
shouldCreate = false
|
|
202
216
|
}
|
|
203
217
|
}
|
|
204
|
-
|
|
205
|
-
|
|
218
|
+
} catch (error) {
|
|
219
|
+
if (
|
|
220
|
+
!error ||
|
|
221
|
+
typeof error !== 'object' ||
|
|
222
|
+
!('code' in error) ||
|
|
223
|
+
error.code !== 'ENOENT'
|
|
224
|
+
) {
|
|
225
|
+
throw error
|
|
206
226
|
}
|
|
207
|
-
} catch {
|
|
208
|
-
// nothing exists
|
|
209
227
|
}
|
|
210
228
|
|
|
211
229
|
if (!shouldCreate) continue
|
|
212
230
|
|
|
213
231
|
if (isSymlinkTarget) {
|
|
214
|
-
|
|
232
|
+
publishSkillFile(skillFile, content, relativePath)
|
|
215
233
|
symlinked++
|
|
216
234
|
|
|
217
235
|
console.info(
|
|
218
236
|
` ${pc.green('⟷')} ${skillName} ${pc.dim(`(${relative(cwd, skillsDir)})`)}`
|
|
219
237
|
)
|
|
220
238
|
} else {
|
|
221
|
-
|
|
239
|
+
publishSkillFile(skillFile, targetContent)
|
|
222
240
|
generated++
|
|
223
241
|
|
|
224
242
|
console.info(
|