@a5c-ai/babysitter-codex 0.1.7-staging.0825aadb → 0.1.7-staging.33fdc8f6
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 +2 -3
- package/scripts/sync-command-skills.js +95 -22
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/babysitter-codex",
|
|
3
|
-
"version": "0.1.7-staging.
|
|
3
|
+
"version": "0.1.7-staging.33fdc8f6",
|
|
4
4
|
"description": "Babysitter Codex skill bundle and integration package for OpenAI Codex CLI with SDK-managed process-library bootstrapping, 15 orchestration modes, and BOM-safe SKILL installation",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node test/integration.test.js && node test/packaged-install.test.js",
|
|
7
7
|
"test:integration": "node test/integration.test.js",
|
|
8
|
-
"sync:commands": "node scripts/sync-command-skills.js",
|
|
9
8
|
"sync:skills": "node scripts/sync-command-skills.js",
|
|
10
9
|
"team:install": "node scripts/team-install.js",
|
|
11
10
|
"lint": "node -e \"const fs=require('fs'); const path=require('path'); const cp=require('child_process'); const walk=(dir)=>{for(const entry of fs.readdirSync(dir)){const file=path.join(dir, entry); const stat=fs.statSync(file); if(stat.isDirectory()) walk(file); else if(file.endsWith('.js')) cp.execFileSync(process.execPath,['--check',file],{stdio:'inherit'});}}; ['skills','bin','scripts','test'].forEach((dir)=>{if(fs.existsSync(dir)) walk(dir);});\"",
|
|
@@ -45,6 +44,6 @@
|
|
|
45
44
|
},
|
|
46
45
|
"homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-codex#readme",
|
|
47
46
|
"dependencies": {
|
|
48
|
-
"@a5c-ai/babysitter-sdk": "0.0.184-staging.
|
|
47
|
+
"@a5c-ai/babysitter-sdk": "0.0.184-staging.33fdc8f6"
|
|
49
48
|
}
|
|
50
49
|
}
|
|
@@ -2,44 +2,117 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const {
|
|
6
|
-
listDirectories,
|
|
7
|
-
reportCheckResult,
|
|
8
|
-
syncSkillsFromCommands,
|
|
9
|
-
} = require('../../../scripts/plugin-command-sync-lib.cjs');
|
|
10
5
|
|
|
11
6
|
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
12
7
|
const REPO_ROOT = path.resolve(PACKAGE_ROOT, '..', '..');
|
|
13
8
|
const COMMANDS_ROOT = path.join(REPO_ROOT, 'plugins', 'babysitter', 'commands');
|
|
14
9
|
const SKILLS_ROOT = path.join(PACKAGE_ROOT, 'skills');
|
|
15
|
-
|
|
10
|
+
|
|
11
|
+
function parseFrontmatter(markdown) {
|
|
12
|
+
if (!markdown.startsWith('---')) {
|
|
13
|
+
return { data: {}, body: markdown.trimStart() };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const match = markdown.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
17
|
+
if (!match) {
|
|
18
|
+
return { data: {}, body: markdown.trimStart() };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const data = {};
|
|
22
|
+
for (const line of match[1].split(/\r?\n/)) {
|
|
23
|
+
const frontmatterMatch = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
|
|
24
|
+
if (!frontmatterMatch) continue;
|
|
25
|
+
data[frontmatterMatch[1]] = frontmatterMatch[2];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
data,
|
|
30
|
+
body: match[2].trim(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function renderSkill(name, description, body) {
|
|
35
|
+
return [
|
|
36
|
+
'---',
|
|
37
|
+
`name: ${name}`,
|
|
38
|
+
`description: ${description}`,
|
|
39
|
+
'---',
|
|
40
|
+
'',
|
|
41
|
+
`# ${name}`,
|
|
42
|
+
'',
|
|
43
|
+
body.trim(),
|
|
44
|
+
'',
|
|
45
|
+
].join('\n');
|
|
46
|
+
}
|
|
16
47
|
|
|
17
48
|
function getCommandBackedSkillNames() {
|
|
18
|
-
return
|
|
19
|
-
.filter((
|
|
49
|
+
return fs.readdirSync(SKILLS_ROOT, { withFileTypes: true })
|
|
50
|
+
.filter((entry) => entry.isDirectory())
|
|
51
|
+
.map((entry) => entry.name)
|
|
52
|
+
.filter((name) => fs.existsSync(path.join(COMMANDS_ROOT, `${name}.md`)))
|
|
53
|
+
.sort();
|
|
20
54
|
}
|
|
21
55
|
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cwd: PACKAGE_ROOT,
|
|
30
|
-
});
|
|
56
|
+
function buildExpectedSkill(name) {
|
|
57
|
+
const commandPath = path.join(COMMANDS_ROOT, `${name}.md`);
|
|
58
|
+
const commandSource = fs.readFileSync(commandPath, 'utf8').replace(/\r\n/g, '\n');
|
|
59
|
+
const parsed = parseFrontmatter(commandSource);
|
|
60
|
+
const description = parsed.data.description || `Babysitter ${name} mode.`;
|
|
61
|
+
return renderSkill(name, description, parsed.body);
|
|
62
|
+
}
|
|
31
63
|
|
|
32
|
-
|
|
33
|
-
|
|
64
|
+
function checkSkills() {
|
|
65
|
+
const mismatches = [];
|
|
66
|
+
|
|
67
|
+
for (const name of getCommandBackedSkillNames()) {
|
|
68
|
+
const skillPath = path.join(SKILLS_ROOT, name, 'SKILL.md');
|
|
69
|
+
const actual = fs.readFileSync(skillPath, 'utf8').replace(/\r\n/g, '\n');
|
|
70
|
+
const expected = buildExpectedSkill(name);
|
|
71
|
+
if (actual !== expected) {
|
|
72
|
+
mismatches.push(path.relative(PACKAGE_ROOT, skillPath));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (mismatches.length > 0) {
|
|
77
|
+
console.error('[sync-command-skills] stale Codex skills detected:');
|
|
78
|
+
for (const mismatch of mismatches) {
|
|
79
|
+
console.error(` - ${mismatch}`);
|
|
80
|
+
}
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
console.log('[sync-command-skills] Codex command-backed skills are up to date.');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function writeSkills() {
|
|
89
|
+
let updated = 0;
|
|
90
|
+
|
|
91
|
+
for (const name of getCommandBackedSkillNames()) {
|
|
92
|
+
const skillPath = path.join(SKILLS_ROOT, name, 'SKILL.md');
|
|
93
|
+
const expected = buildExpectedSkill(name);
|
|
94
|
+
const current = fs.readFileSync(skillPath, 'utf8').replace(/\r\n/g, '\n');
|
|
95
|
+
if (current === expected) continue;
|
|
96
|
+
fs.writeFileSync(skillPath, expected, 'utf8');
|
|
97
|
+
updated += 1;
|
|
98
|
+
console.log(`[sync-command-skills] updated ${path.relative(PACKAGE_ROOT, skillPath)}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (updated === 0) {
|
|
102
|
+
console.log('[sync-command-skills] no Codex skill changes were needed.');
|
|
34
103
|
return;
|
|
35
104
|
}
|
|
36
105
|
|
|
37
|
-
|
|
38
|
-
|
|
106
|
+
console.log(`[sync-command-skills] updated ${updated} Codex skill file(s).`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function main() {
|
|
110
|
+
if (process.argv.includes('--check')) {
|
|
111
|
+
checkSkills();
|
|
39
112
|
return;
|
|
40
113
|
}
|
|
41
114
|
|
|
42
|
-
|
|
115
|
+
writeSkills();
|
|
43
116
|
}
|
|
44
117
|
|
|
45
118
|
main();
|