oh-my-codex-cli 0.1.0
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/.agent/skills/agent-kb/HOW_TO_USE.md +428 -0
- package/.agent/skills/agent-kb/README.md +46 -0
- package/.agent/skills/agent-kb/SKILL.md +128 -0
- package/.agent/skills/agent-kb/references/intelligent-analysis-explained.md +333 -0
- package/.agent/skills/agent-kb/references/query-optimization.md +225 -0
- package/.agent/skills/aireview/SKILL.md +704 -0
- package/.agent/skills/analyze/SKILL.md +81 -0
- package/.agent/skills/architect-planner/HOW_TO_USE.md +238 -0
- package/.agent/skills/architect-planner/README.md +41 -0
- package/.agent/skills/architect-planner/SKILL.md +539 -0
- package/.agent/skills/auto-mbti/SKILL.md +291 -0
- package/.agent/skills/autopilot/SKILL.md +222 -0
- package/.agent/skills/backend-patterns/SKILL.md +602 -0
- package/.agent/skills/bdd-generator/README.md +78 -0
- package/.agent/skills/bdd-generator/SKILL.md +436 -0
- package/.agent/skills/brainstorming/HOW_TO_USE.md +289 -0
- package/.agent/skills/brainstorming/README.md +41 -0
- package/.agent/skills/brainstorming/SKILL.md +165 -0
- package/.agent/skills/build-fix/SKILL.md +190 -0
- package/.agent/skills/cancel/SKILL.md +658 -0
- package/.agent/skills/checkpoint/SKILL.md +94 -0
- package/.agent/skills/code-review/SKILL.md +273 -0
- package/.agent/skills/coding-standards/SKILL.md +535 -0
- package/.agent/skills/conductor/SKILL.md +128 -0
- package/.agent/skills/conductor/commands/conductor/implement.toml +358 -0
- package/.agent/skills/conductor/commands/conductor/newTrack.toml +142 -0
- package/.agent/skills/conductor/commands/conductor/revert.toml +123 -0
- package/.agent/skills/conductor/commands/conductor/setup.toml +429 -0
- package/.agent/skills/conductor/commands/conductor/status.toml +57 -0
- package/.agent/skills/conductor/scripts/install.sh +89 -0
- package/.agent/skills/conductor/templates/code_styleguides/csharp.md +115 -0
- package/.agent/skills/conductor/templates/code_styleguides/dart.md +238 -0
- package/.agent/skills/conductor/templates/code_styleguides/general.md +23 -0
- package/.agent/skills/conductor/templates/code_styleguides/go.md +48 -0
- package/.agent/skills/conductor/templates/code_styleguides/html-css.md +49 -0
- package/.agent/skills/conductor/templates/code_styleguides/javascript.md +51 -0
- package/.agent/skills/conductor/templates/code_styleguides/python.md +37 -0
- package/.agent/skills/conductor/templates/code_styleguides/typescript.md +43 -0
- package/.agent/skills/conductor/templates/rules/README.md +23 -0
- package/.agent/skills/conductor/templates/rules/agents.md +49 -0
- package/.agent/skills/conductor/templates/rules/coding-style.md +70 -0
- package/.agent/skills/conductor/templates/rules/dev.md +20 -0
- package/.agent/skills/conductor/templates/rules/git-workflow.md +45 -0
- package/.agent/skills/conductor/templates/rules/hooks.md +6 -0
- package/.agent/skills/conductor/templates/rules/patterns.md +55 -0
- package/.agent/skills/conductor/templates/rules/performance.md +47 -0
- package/.agent/skills/conductor/templates/rules/research.md +26 -0
- package/.agent/skills/conductor/templates/rules/review.md +22 -0
- package/.agent/skills/conductor/templates/rules/security.md +36 -0
- package/.agent/skills/conductor/templates/rules/testing.md +30 -0
- package/.agent/skills/conductor/templates/workflow.md +333 -0
- package/.agent/skills/consensus/HOW_TO_USE.md +191 -0
- package/.agent/skills/consensus/README.md +41 -0
- package/.agent/skills/consensus/SKILL.md +317 -0
- package/.agent/skills/content-research-writer/SKILL.md +537 -0
- package/.agent/skills/debug-analysis/SKILL.md +331 -0
- package/.agent/skills/deepinit/SKILL.md +347 -0
- package/.agent/skills/deepsearch/SKILL.md +56 -0
- package/.agent/skills/doctor/SKILL.md +158 -0
- package/.agent/skills/drawio/EXAMPLES.md +382 -0
- package/.agent/skills/drawio/QUICK_START.md +237 -0
- package/.agent/skills/drawio/README.md +315 -0
- package/.agent/skills/drawio/SETUP_GUIDE.md +254 -0
- package/.agent/skills/drawio/SKILL.md +1176 -0
- package/.agent/skills/e2e/SKILL.md +396 -0
- package/.agent/skills/ecomode/SKILL.md +160 -0
- package/.agent/skills/electron-driver/SKILL.md +144 -0
- package/.agent/skills/electron-driver/scripts/driver-template.js +71 -0
- package/.agent/skills/eval/SKILL.md +140 -0
- package/.agent/skills/eval-harness/SKILL.md +242 -0
- package/.agent/skills/evolve/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +42 -0
- package/.agent/skills/frontend-patterns/SKILL.md +646 -0
- package/.agent/skills/frontend-ui-ux/SKILL.md +70 -0
- package/.agent/skills/git-master/SKILL.md +75 -0
- package/.agent/skills/help/SKILL.md +89 -0
- package/.agent/skills/iterative-retrieval/SKILL.md +217 -0
- package/.agent/skills/local-skills-setup/SKILL.md +483 -0
- package/.agent/skills/log-analyzer/SKILL.md +187 -0
- package/.agent/skills/mcp-setup/SKILL.md +226 -0
- package/.agent/skills/multi-model-research/HOW_TO_USE.md +614 -0
- package/.agent/skills/multi-model-research/README.md +233 -0
- package/.agent/skills/multi-model-research/SKILL.md +541 -0
- package/.agent/skills/multi-model-research/references/troubleshooting.md +415 -0
- package/.agent/skills/note/SKILL.md +80 -0
- package/.agent/skills/omc-setup/SKILL.md +219 -0
- package/.agent/skills/orchestrate/SKILL.md +620 -0
- package/.agent/skills/patent-workflow/IMPLEMENTATION_SUMMARY.md +500 -0
- package/.agent/skills/patent-workflow/README.md +455 -0
- package/.agent/skills/patent-workflow/SKILL.md +1036 -0
- package/.agent/skills/patent-workflow/tools/irr_checker.py +260 -0
- package/.agent/skills/patent-workflow/tools/sample_terminology.json +49 -0
- package/.agent/skills/patent-workflow/tools/term_checker.py +355 -0
- package/.agent/skills/pattern-recognition/SKILL.md +792 -0
- package/.agent/skills/pipeline/SKILL.md +448 -0
- package/.agent/skills/plan/SKILL.md +309 -0
- package/.agent/skills/planning-methodology/SKILL.md +370 -0
- package/.agent/skills/planning-with-files/SKILL.md +210 -0
- package/.agent/skills/planning-with-files/examples.md +202 -0
- package/.agent/skills/planning-with-files/reference.md +218 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.ps1 +42 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.sh +44 -0
- package/.agent/skills/planning-with-files/scripts/init-session.ps1 +120 -0
- package/.agent/skills/planning-with-files/scripts/init-session.sh +120 -0
- package/.agent/skills/planning-with-files/scripts/session-catchup.py +208 -0
- package/.agent/skills/planning-with-files/templates/findings.md +95 -0
- package/.agent/skills/planning-with-files/templates/progress.md +114 -0
- package/.agent/skills/planning-with-files/templates/task_plan.md +132 -0
- package/.agent/skills/project-analyze/CLAUDE.md +18 -0
- package/.agent/skills/project-analyze/HOW_TO_USE.md +145 -0
- package/.agent/skills/project-analyze/README.md +42 -0
- package/.agent/skills/project-analyze/SKILL.md +289 -0
- package/.agent/skills/project-analyze/SKILL.md.backup +287 -0
- package/.agent/skills/project-analyze/SKILL.md.backup_20260105_093646 +287 -0
- package/.agent/skills/project-analyze/assets/analysis-report-template.md +433 -0
- package/.agent/skills/project-analyze/references/analysis-patterns.md +422 -0
- package/.agent/skills/project-analyze/references/projectmind-explained.md +535 -0
- package/.agent/skills/project-session-manager/SKILL.md +428 -0
- package/.agent/skills/project-session-manager/lib/config.sh +86 -0
- package/.agent/skills/project-session-manager/lib/parse.sh +121 -0
- package/.agent/skills/project-session-manager/lib/session.sh +132 -0
- package/.agent/skills/project-session-manager/lib/tmux.sh +103 -0
- package/.agent/skills/project-session-manager/lib/worktree.sh +171 -0
- package/.agent/skills/project-session-manager/psm.sh +629 -0
- package/.agent/skills/project-session-manager/templates/feature.md +56 -0
- package/.agent/skills/project-session-manager/templates/issue-fix.md +57 -0
- package/.agent/skills/project-session-manager/templates/pr-review.md +65 -0
- package/.agent/skills/project-session-manager/templates/projects.json +19 -0
- package/.agent/skills/quality-check/HOW_TO_USE.md +171 -0
- package/.agent/skills/quality-check/README.md +50 -0
- package/.agent/skills/quality-check/SKILL.md +240 -0
- package/.agent/skills/quality-check/SKILL.md.backup +238 -0
- package/.agent/skills/quality-check/SKILL.md.backup_20260105_093646 +238 -0
- package/.agent/skills/quality-check/assets/quality-report-template.md +437 -0
- package/.agent/skills/quality-check/references/refactoring-patterns.md +550 -0
- package/.agent/skills/quality-check/references/scoring-criteria.md +454 -0
- package/.agent/skills/quality-validation/SKILL.md +519 -0
- package/.agent/skills/quality-validation/SKILL.md.backup +573 -0
- package/.agent/skills/quality-validation/SKILL.md.backup_20260105_093646 +573 -0
- package/.agent/skills/ralph/SKILL.md +236 -0
- package/.agent/skills/ralph-init/SKILL.md +78 -0
- package/.agent/skills/ralplan/SKILL.md +58 -0
- package/.agent/skills/refactor-clean/SKILL.md +49 -0
- package/.agent/skills/release/SKILL.md +84 -0
- package/.agent/skills/research/SKILL.md +526 -0
- package/.agent/skills/research-methodology/SKILL.md +268 -0
- package/.agent/skills/review/SKILL.md +53 -0
- package/.agent/skills/security-review/SKILL.md +509 -0
- package/.agent/skills/security-review/cloud-infrastructure-security.md +361 -0
- package/.agent/skills/setup-pm/SKILL.md +102 -0
- package/.agent/skills/skill/SKILL.md +424 -0
- package/.agent/skills/skill-create/SKILL.md +209 -0
- package/.agent/skills/skill-debugger/HOW_TO_USE.md +244 -0
- package/.agent/skills/skill-debugger/README.md +44 -0
- package/.agent/skills/skill-debugger/SKILL.md +326 -0
- package/.agent/skills/skill-debugger/diagnostic_checklist.md +115 -0
- package/.agent/skills/skill-development/SKILL.md +661 -0
- package/.agent/skills/skill-development/references/skill-creator-original.md +209 -0
- package/.agent/skills/skill-doc-generator/README.md +37 -0
- package/.agent/skills/skill-doc-generator/SKILL.md +331 -0
- package/.agent/skills/skill-quality-analyzer/HOW_TO_USE.md +243 -0
- package/.agent/skills/skill-quality-analyzer/README.md +61 -0
- package/.agent/skills/skill-quality-analyzer/SKILL.md +247 -0
- package/.agent/skills/skill-quality-analyzer/analyzer.py +209 -0
- package/.agent/skills/skill-quality-analyzer/expected_output.json +81 -0
- package/.agent/skills/skill-quality-analyzer/sample_input.json +9 -0
- package/.agent/skills/skill-tester/README.md +46 -0
- package/.agent/skills/skill-tester/SKILL.md +345 -0
- package/.agent/skills/start-dev/SKILL.md +701 -0
- package/.agent/skills/swarm/SKILL.md +691 -0
- package/.agent/skills/task-kb-lookup/SKILL.md +211 -0
- package/.agent/skills/task-kb-record/SKILL.md +417 -0
- package/.agent/skills/tdd/SKILL.md +446 -0
- package/.agent/skills/tdd-generator/DEMO.md +516 -0
- package/.agent/skills/tdd-generator/README.md +89 -0
- package/.agent/skills/tdd-generator/SKILL.md +278 -0
- package/.agent/skills/tdd-workflow/SKILL.md +424 -0
- package/.agent/skills/test-coverage/SKILL.md +48 -0
- package/.agent/skills/thinkdeep/HOW_TO_USE.md +183 -0
- package/.agent/skills/thinkdeep/README.md +41 -0
- package/.agent/skills/thinkdeep/SKILL.md +343 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +236 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
- package/.agent/skills/ultrapilot/SKILL.md +647 -0
- package/.agent/skills/ultraqa/SKILL.md +152 -0
- package/.agent/skills/ultrawork/SKILL.md +123 -0
- package/.agent/skills/update-codemaps/SKILL.md +38 -0
- package/.agent/skills/update-docs/SKILL.md +52 -0
- package/.agent/skills/verification-loop/SKILL.md +140 -0
- package/.agent/skills/verify/SKILL.md +80 -0
- package/.agent/skills/writer-memory/SKILL.md +459 -0
- package/.agent/skills/writer-memory/lib/character-tracker.ts +338 -0
- package/.agent/skills/writer-memory/lib/memory-manager.ts +804 -0
- package/.agent/skills/writer-memory/lib/relationship-graph.ts +400 -0
- package/.agent/skills/writer-memory/lib/scene-organizer.ts +544 -0
- package/.agent/skills/writer-memory/lib/synopsis-builder.ts +339 -0
- package/.agent/skills/writer-memory/templates/synopsis-template.md +46 -0
- package/.governance/skill-lint.allowlist +4 -0
- package/.governance/skill-llm.allowlist +4 -0
- package/AGENTS.md +59 -0
- package/LICENSE +21 -0
- package/README.md +169 -0
- package/README.zh.md +145 -0
- package/bin/omcodex.js +8 -0
- package/commands/conductor/implement.toml +358 -0
- package/commands/conductor/newTrack.toml +142 -0
- package/commands/conductor/revert.toml +123 -0
- package/commands/conductor/setup.toml +429 -0
- package/commands/conductor/status.toml +57 -0
- package/docs/ALIGNMENT.md +40 -0
- package/docs/CODEX.md +133 -0
- package/docs/NOTIFY.md +81 -0
- package/docs/SKILL_GOVERNANCE.md +72 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.md +182 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.zh.md +170 -0
- package/package.json +50 -0
- package/prompts/architect.md +105 -0
- package/prompts/executor.md +134 -0
- package/prompts/planner.md +113 -0
- package/scripts/check-skill-governance.sh +84 -0
- package/scripts/check-skill-llm-governance.js +302 -0
- package/scripts/eval-skills.js +217 -0
- package/scripts/generate-catalog-docs.js +95 -0
- package/scripts/generate-codex-mcp-config.sh +22 -0
- package/scripts/install-codex-force.sh +5 -0
- package/scripts/install-codex-incremental.sh +5 -0
- package/scripts/install-codex.sh +79 -0
- package/scripts/notify-dispatch.js +15 -0
- package/scripts/setup-package-manager.js +137 -0
- package/src/catalog/generated/public-catalog.json +547 -0
- package/src/catalog/manifest.json +542 -0
- package/src/catalog/reader.js +43 -0
- package/src/catalog/schema.js +79 -0
- package/src/cli/doctor.js +62 -0
- package/src/cli/index.js +85 -0
- package/src/cli/notify.js +127 -0
- package/src/cli/route.js +43 -0
- package/src/cli/setup.js +155 -0
- package/src/cli/team.js +125 -0
- package/src/config/generator.js +119 -0
- package/src/mcp/memory-server.js +241 -0
- package/src/mcp/state-server.js +112 -0
- package/src/mcp/trace-server.js +168 -0
- package/src/notify/dispatch.js +74 -0
- package/src/notify/extensibility/dispatcher.js +113 -0
- package/src/notify/extensibility/events.js +15 -0
- package/src/notify/extensibility/loader.js +54 -0
- package/src/router/skill-router.js +90 -0
- package/src/team/auto-advance.js +72 -0
- package/src/team/orchestrator.js +82 -0
- package/src/team/state-store.js +33 -0
- package/src/utils/paths.js +33 -0
- package/templates/AGENTS.md +15 -0
- package/templates/catalog-manifest.json +542 -0
- package/templates/code_styleguides/csharp.md +115 -0
- package/templates/code_styleguides/dart.md +238 -0
- package/templates/code_styleguides/general.md +23 -0
- package/templates/code_styleguides/go.md +48 -0
- package/templates/code_styleguides/html-css.md +49 -0
- package/templates/code_styleguides/javascript.md +51 -0
- package/templates/code_styleguides/python.md +37 -0
- package/templates/code_styleguides/typescript.md +43 -0
- package/templates/rules/README.md +23 -0
- package/templates/rules/agents.md +49 -0
- package/templates/rules/coding-style.md +70 -0
- package/templates/rules/dev.md +20 -0
- package/templates/rules/git-workflow.md +45 -0
- package/templates/rules/notify.md +6 -0
- package/templates/rules/patterns.md +55 -0
- package/templates/rules/performance.md +47 -0
- package/templates/rules/research.md +26 -0
- package/templates/rules/review.md +22 -0
- package/templates/rules/security.md +36 -0
- package/templates/rules/testing.md +30 -0
- package/templates/workflow.md +333 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const fsp = require('fs/promises');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
function parseArgs(argv) {
|
|
8
|
+
const result = {
|
|
9
|
+
mode: 'auto',
|
|
10
|
+
skillsDir: '',
|
|
11
|
+
outDir: '',
|
|
12
|
+
maxFiles: 20,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
16
|
+
const arg = argv[i];
|
|
17
|
+
if (arg === '--mode' && argv[i + 1]) {
|
|
18
|
+
result.mode = argv[i + 1];
|
|
19
|
+
i += 1;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (arg.startsWith('--mode=')) {
|
|
23
|
+
result.mode = arg.slice('--mode='.length);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (arg === '--skills-dir' && argv[i + 1]) {
|
|
27
|
+
result.skillsDir = argv[i + 1];
|
|
28
|
+
i += 1;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (arg.startsWith('--skills-dir=')) {
|
|
32
|
+
result.skillsDir = arg.slice('--skills-dir='.length);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (arg === '--out-dir' && argv[i + 1]) {
|
|
36
|
+
result.outDir = argv[i + 1];
|
|
37
|
+
i += 1;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (arg.startsWith('--out-dir=')) {
|
|
41
|
+
result.outDir = arg.slice('--out-dir='.length);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (arg === '--max-files' && argv[i + 1]) {
|
|
45
|
+
result.maxFiles = Number(argv[i + 1]) || result.maxFiles;
|
|
46
|
+
i += 1;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (arg.startsWith('--max-files=')) {
|
|
50
|
+
result.maxFiles = Number(arg.slice('--max-files='.length)) || result.maxFiles;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function detectSkillsDir(root, explicit) {
|
|
58
|
+
if (explicit) return path.resolve(explicit);
|
|
59
|
+
const candidates = [
|
|
60
|
+
path.join(root, '.agent', 'skills'),
|
|
61
|
+
path.join(root, '.codex', 'skills'),
|
|
62
|
+
];
|
|
63
|
+
return candidates.find((dir) => fs.existsSync(dir)) || candidates[0];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function detectOutDir(root, explicit) {
|
|
67
|
+
return explicit ? path.resolve(explicit) : path.join(root, '.omcodex', 'reports');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function readAllowlist(root) {
|
|
71
|
+
const file = path.join(root, '.governance', 'skill-llm.allowlist');
|
|
72
|
+
if (!fs.existsSync(file)) return new Set();
|
|
73
|
+
const lines = fs.readFileSync(file, 'utf8')
|
|
74
|
+
.split('\n')
|
|
75
|
+
.map((line) => line.trim())
|
|
76
|
+
.filter((line) => line && !line.startsWith('#'));
|
|
77
|
+
return new Set(lines);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function listSkillFiles(skillsDir) {
|
|
81
|
+
if (!fs.existsSync(skillsDir)) return [];
|
|
82
|
+
const entries = await fsp.readdir(skillsDir, { withFileTypes: true });
|
|
83
|
+
const files = [];
|
|
84
|
+
for (const entry of entries) {
|
|
85
|
+
if (!entry.isDirectory()) continue;
|
|
86
|
+
const file = path.join(skillsDir, entry.name, 'SKILL.md');
|
|
87
|
+
if (fs.existsSync(file)) files.push({ name: entry.name, file });
|
|
88
|
+
}
|
|
89
|
+
files.sort((a, b) => a.name.localeCompare(b.name));
|
|
90
|
+
return files;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function heuristicAudit(skillName, content) {
|
|
94
|
+
const issues = [];
|
|
95
|
+
|
|
96
|
+
if (!/^---\n[\s\S]*?\n---\n?/.test(content)) {
|
|
97
|
+
issues.push({ severity: 'high', rule: 'missing_frontmatter', message: 'SKILL.md missing frontmatter block.' });
|
|
98
|
+
}
|
|
99
|
+
if (!/name:\s*[^\n]+/.test(content)) {
|
|
100
|
+
issues.push({ severity: 'high', rule: 'missing_frontmatter_name', message: 'frontmatter.name is missing.' });
|
|
101
|
+
}
|
|
102
|
+
if (!/description:\s*[^\n]+/.test(content)) {
|
|
103
|
+
issues.push({ severity: 'high', rule: 'missing_frontmatter_description', message: 'frontmatter.description is missing.' });
|
|
104
|
+
}
|
|
105
|
+
if (/\bTask\s*\(/.test(content)) {
|
|
106
|
+
issues.push({ severity: 'high', rule: 'legacy_task_api', message: 'Legacy Task(...) syntax is not codex-native.' });
|
|
107
|
+
}
|
|
108
|
+
if (/cc\s+--plugin-dir|\/plugin|HUD/.test(content)) {
|
|
109
|
+
issues.push({ severity: 'high', rule: 'non_codex_runtime', message: 'Contains runtime guidance not supported by Codex.' });
|
|
110
|
+
}
|
|
111
|
+
if (!/\$[\w-]+|[a-z-]+:\s+[^\n]+/i.test(content)) {
|
|
112
|
+
issues.push({ severity: 'medium', rule: 'missing_invocation_example', message: 'No explicit Codex invocation example found.' });
|
|
113
|
+
}
|
|
114
|
+
if (/\betc\.\b|\bmaybe\b|\bif possible\b/i.test(content)) {
|
|
115
|
+
issues.push({ severity: 'low', rule: 'ambiguous_wording', message: 'Contains ambiguous wording that can reduce determinism.' });
|
|
116
|
+
}
|
|
117
|
+
if (!/step|workflow|instructions|usage|how to use|when to use|步骤|用法/i.test(content)) {
|
|
118
|
+
issues.push({ severity: 'medium', rule: 'missing_structure', message: 'Missing clear workflow/instruction sections.' });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
skill: skillName,
|
|
123
|
+
mode: 'heuristic',
|
|
124
|
+
issues,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function extractJson(content) {
|
|
129
|
+
const trimmed = String(content || '').trim();
|
|
130
|
+
try {
|
|
131
|
+
return JSON.parse(trimmed);
|
|
132
|
+
} catch {}
|
|
133
|
+
|
|
134
|
+
const fenced = trimmed.match(/```(?:json)?\n([\s\S]*?)\n```/i);
|
|
135
|
+
if (fenced) {
|
|
136
|
+
try {
|
|
137
|
+
return JSON.parse(fenced[1]);
|
|
138
|
+
} catch {}
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function llmAudit(skillName, content, options) {
|
|
144
|
+
const prompt = [
|
|
145
|
+
'Audit the Codex skill document and return JSON.',
|
|
146
|
+
'Rules:',
|
|
147
|
+
'- Identify execution blockers and ambiguous instructions.',
|
|
148
|
+
'- Focus on Codex compatibility and deterministic execution.',
|
|
149
|
+
'- Keep findings concise.',
|
|
150
|
+
'Output JSON schema:',
|
|
151
|
+
'{"issues":[{"severity":"high|medium|low","rule":"string","message":"string"}]}',
|
|
152
|
+
'',
|
|
153
|
+
`Skill name: ${skillName}`,
|
|
154
|
+
'Document:',
|
|
155
|
+
content.slice(0, 7000),
|
|
156
|
+
].join('\n');
|
|
157
|
+
|
|
158
|
+
const response = await fetch('https://api.openai.com/v1/chat/completions', {
|
|
159
|
+
method: 'POST',
|
|
160
|
+
headers: {
|
|
161
|
+
Authorization: `Bearer ${options.apiKey}`,
|
|
162
|
+
'Content-Type': 'application/json',
|
|
163
|
+
},
|
|
164
|
+
body: JSON.stringify({
|
|
165
|
+
model: options.model,
|
|
166
|
+
temperature: 0,
|
|
167
|
+
response_format: { type: 'json_object' },
|
|
168
|
+
messages: [
|
|
169
|
+
{ role: 'system', content: 'You are a strict governance auditor for Codex skill docs.' },
|
|
170
|
+
{ role: 'user', content: prompt },
|
|
171
|
+
],
|
|
172
|
+
}),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
if (!response.ok) {
|
|
176
|
+
const body = await response.text();
|
|
177
|
+
throw new Error(`llm_http_${response.status}: ${body.slice(0, 240)}`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const data = await response.json();
|
|
181
|
+
const contentText = data && data.choices && data.choices[0] && data.choices[0].message
|
|
182
|
+
? data.choices[0].message.content
|
|
183
|
+
: '';
|
|
184
|
+
const parsed = extractJson(contentText);
|
|
185
|
+
if (!parsed || !Array.isArray(parsed.issues)) {
|
|
186
|
+
throw new Error('llm_invalid_json_output');
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
skill: skillName,
|
|
190
|
+
mode: 'llm',
|
|
191
|
+
issues: parsed.issues
|
|
192
|
+
.filter((issue) => issue && typeof issue === 'object')
|
|
193
|
+
.map((issue) => ({
|
|
194
|
+
severity: ['high', 'medium', 'low'].includes(issue.severity) ? issue.severity : 'medium',
|
|
195
|
+
rule: String(issue.rule || 'llm_rule'),
|
|
196
|
+
message: String(issue.message || '').slice(0, 400),
|
|
197
|
+
})),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function mergeAudits(heuristic, llm) {
|
|
202
|
+
if (!llm) return heuristic;
|
|
203
|
+
return {
|
|
204
|
+
skill: heuristic.skill,
|
|
205
|
+
mode: 'hybrid',
|
|
206
|
+
issues: [...heuristic.issues, ...llm.issues],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function summarize(results) {
|
|
211
|
+
const severity = { high: 0, medium: 0, low: 0 };
|
|
212
|
+
for (const result of results) {
|
|
213
|
+
for (const issue of result.issues) {
|
|
214
|
+
if (severity[issue.severity] !== undefined) severity[issue.severity] += 1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const blockers = results.filter((result) => result.issues.some((issue) => issue.severity === 'high'));
|
|
218
|
+
return {
|
|
219
|
+
totalSkills: results.length,
|
|
220
|
+
severity,
|
|
221
|
+
blockerSkills: blockers.map((item) => item.skill),
|
|
222
|
+
blockerCount: blockers.length,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function main() {
|
|
227
|
+
const root = path.resolve(__dirname, '..');
|
|
228
|
+
const args = parseArgs(process.argv.slice(2));
|
|
229
|
+
const skillsDir = detectSkillsDir(root, args.skillsDir);
|
|
230
|
+
const outDir = detectOutDir(root, args.outDir);
|
|
231
|
+
const allowlist = readAllowlist(root);
|
|
232
|
+
|
|
233
|
+
const files = await listSkillFiles(skillsDir);
|
|
234
|
+
const mode = ['auto', 'heuristic', 'llm'].includes(args.mode) ? args.mode : 'auto';
|
|
235
|
+
const apiKey = process.env.OPENAI_API_KEY;
|
|
236
|
+
const llmEnabled = mode === 'llm' || (mode === 'auto' && !!apiKey);
|
|
237
|
+
const model = process.env.OMX_GOVERNANCE_MODEL || 'gpt-4o-mini';
|
|
238
|
+
|
|
239
|
+
const results = [];
|
|
240
|
+
for (let i = 0; i < files.length; i += 1) {
|
|
241
|
+
const item = files[i];
|
|
242
|
+
const content = await fsp.readFile(item.file, 'utf8');
|
|
243
|
+
const heuristic = heuristicAudit(item.name, content);
|
|
244
|
+
let llm = null;
|
|
245
|
+
|
|
246
|
+
if (llmEnabled && i < Math.max(1, Number(args.maxFiles) || 20)) {
|
|
247
|
+
try {
|
|
248
|
+
llm = await llmAudit(item.name, content, { apiKey, model });
|
|
249
|
+
} catch (error) {
|
|
250
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
251
|
+
heuristic.issues.push({
|
|
252
|
+
severity: 'medium',
|
|
253
|
+
rule: 'llm_fallback',
|
|
254
|
+
message: `LLM audit unavailable, fallback to heuristic: ${message}`,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const merged = mergeAudits(heuristic, llm);
|
|
260
|
+
merged.issues = merged.issues.map((issue) => {
|
|
261
|
+
const key = `${issue.rule}:${merged.skill}`;
|
|
262
|
+
if (allowlist.has(key)) {
|
|
263
|
+
return {
|
|
264
|
+
...issue,
|
|
265
|
+
severity: issue.severity === 'high' ? 'medium' : issue.severity,
|
|
266
|
+
message: `${issue.message} [allowlisted:${key}]`,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
return issue;
|
|
270
|
+
});
|
|
271
|
+
results.push(merged);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const summary = summarize(results);
|
|
275
|
+
const report = {
|
|
276
|
+
generatedAt: new Date().toISOString(),
|
|
277
|
+
mode: llmEnabled ? (mode === 'llm' ? 'llm' : 'auto-llm') : 'heuristic',
|
|
278
|
+
model: llmEnabled ? model : null,
|
|
279
|
+
skillsDir,
|
|
280
|
+
allowlist: Array.from(allowlist).sort(),
|
|
281
|
+
summary,
|
|
282
|
+
results,
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
await fsp.mkdir(outDir, { recursive: true });
|
|
286
|
+
const reportPath = path.join(outDir, 'skill-llm-governance-latest.json');
|
|
287
|
+
await fsp.writeFile(reportPath, `${JSON.stringify(report, null, 2)}\n`, 'utf8');
|
|
288
|
+
|
|
289
|
+
console.log(`Skill governance (LLM gate) completed: ${summary.totalSkills} skills`);
|
|
290
|
+
console.log(`High=${summary.severity.high} Medium=${summary.severity.medium} Low=${summary.severity.low}`);
|
|
291
|
+
console.log(`Report: ${reportPath}`);
|
|
292
|
+
|
|
293
|
+
if (summary.blockerCount > 0) {
|
|
294
|
+
console.error(`Blockers detected in skills: ${summary.blockerSkills.join(', ')}`);
|
|
295
|
+
process.exitCode = 1;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
main().catch((error) => {
|
|
300
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
301
|
+
process.exit(1);
|
|
302
|
+
});
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const fsp = require('fs/promises');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
function parseArgs(argv) {
|
|
8
|
+
const result = {
|
|
9
|
+
skillsDir: '',
|
|
10
|
+
outDir: '',
|
|
11
|
+
minScore: 70,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
15
|
+
const arg = argv[i];
|
|
16
|
+
if (arg === '--skills-dir' && argv[i + 1]) {
|
|
17
|
+
result.skillsDir = argv[i + 1];
|
|
18
|
+
i += 1;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (arg.startsWith('--skills-dir=')) {
|
|
22
|
+
result.skillsDir = arg.slice('--skills-dir='.length);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (arg === '--out-dir' && argv[i + 1]) {
|
|
26
|
+
result.outDir = argv[i + 1];
|
|
27
|
+
i += 1;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (arg.startsWith('--out-dir=')) {
|
|
31
|
+
result.outDir = arg.slice('--out-dir='.length);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (arg === '--min-score' && argv[i + 1]) {
|
|
35
|
+
result.minScore = Number(argv[i + 1]) || result.minScore;
|
|
36
|
+
i += 1;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (arg.startsWith('--min-score=')) {
|
|
40
|
+
result.minScore = Number(arg.slice('--min-score='.length)) || result.minScore;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function detectSkillsDir(root, explicit) {
|
|
48
|
+
if (explicit) return path.resolve(explicit);
|
|
49
|
+
const candidates = [
|
|
50
|
+
path.join(root, '.agent', 'skills'),
|
|
51
|
+
path.join(root, '.codex', 'skills'),
|
|
52
|
+
];
|
|
53
|
+
return candidates.find((dir) => fs.existsSync(dir)) || candidates[0];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function detectOutDir(root, explicit) {
|
|
57
|
+
return explicit ? path.resolve(explicit) : path.join(root, '.omcodex', 'reports');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parseFrontmatter(content) {
|
|
61
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
62
|
+
if (!match) return null;
|
|
63
|
+
const lines = match[1].split('\n');
|
|
64
|
+
const map = {};
|
|
65
|
+
for (const line of lines) {
|
|
66
|
+
const idx = line.indexOf(':');
|
|
67
|
+
if (idx <= 0) continue;
|
|
68
|
+
const key = line.slice(0, idx).trim();
|
|
69
|
+
const value = line.slice(idx + 1).trim().replace(/^["']|["']$/g, '');
|
|
70
|
+
map[key] = value;
|
|
71
|
+
}
|
|
72
|
+
return map;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function hasCodeFence(content) {
|
|
76
|
+
return content.includes('```');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function evaluateSkill(name, content) {
|
|
80
|
+
const findings = [];
|
|
81
|
+
let score = 100;
|
|
82
|
+
const frontmatter = parseFrontmatter(content);
|
|
83
|
+
|
|
84
|
+
if (!frontmatter) {
|
|
85
|
+
score -= 40;
|
|
86
|
+
findings.push('missing frontmatter');
|
|
87
|
+
} else {
|
|
88
|
+
if (!frontmatter.name) {
|
|
89
|
+
score -= 20;
|
|
90
|
+
findings.push('frontmatter.name missing');
|
|
91
|
+
}
|
|
92
|
+
if (!frontmatter.description) {
|
|
93
|
+
score -= 20;
|
|
94
|
+
findings.push('frontmatter.description missing');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!/\$[\w-]+|[a-z-]+:\s+/i.test(content)) {
|
|
99
|
+
score -= 15;
|
|
100
|
+
findings.push('missing codex invocation example');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (!/usage|when to use|instructions|workflow|步骤|用法/i.test(content)) {
|
|
104
|
+
score -= 10;
|
|
105
|
+
findings.push('missing workflow guidance sections');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!hasCodeFence(content)) {
|
|
109
|
+
score -= 8;
|
|
110
|
+
findings.push('missing runnable examples');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (/\bTask\s*\(/.test(content)) {
|
|
114
|
+
score -= 12;
|
|
115
|
+
findings.push('contains legacy Task(...) syntax');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (/cc\s+--plugin-dir|\/plugin|HUD/i.test(content)) {
|
|
119
|
+
score -= 12;
|
|
120
|
+
findings.push('contains non-codex runtime reference');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (/\betc\.\b|\bmaybe\b|\bif possible\b/i.test(content)) {
|
|
124
|
+
score -= 4;
|
|
125
|
+
findings.push('contains ambiguous instruction wording');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
score = Math.max(0, Math.min(100, score));
|
|
129
|
+
return {
|
|
130
|
+
skill: name,
|
|
131
|
+
score,
|
|
132
|
+
findings,
|
|
133
|
+
pass: score >= 70,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function listSkillFiles(skillsDir) {
|
|
138
|
+
if (!fs.existsSync(skillsDir)) return [];
|
|
139
|
+
const entries = await fsp.readdir(skillsDir, { withFileTypes: true });
|
|
140
|
+
const files = [];
|
|
141
|
+
for (const entry of entries) {
|
|
142
|
+
if (!entry.isDirectory()) continue;
|
|
143
|
+
const file = path.join(skillsDir, entry.name, 'SKILL.md');
|
|
144
|
+
if (fs.existsSync(file)) files.push({ name: entry.name, file });
|
|
145
|
+
}
|
|
146
|
+
files.sort((a, b) => a.name.localeCompare(b.name));
|
|
147
|
+
return files;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function renderMarkdownReport(summary) {
|
|
151
|
+
const lines = [];
|
|
152
|
+
lines.push('# Skill Eval Report');
|
|
153
|
+
lines.push('');
|
|
154
|
+
lines.push(`Generated At: ${summary.generatedAt}`);
|
|
155
|
+
lines.push(`Skills Evaluated: ${summary.total}`);
|
|
156
|
+
lines.push(`Average Score: ${summary.averageScore}`);
|
|
157
|
+
lines.push(`Pass: ${summary.passCount}`);
|
|
158
|
+
lines.push(`Fail: ${summary.failCount}`);
|
|
159
|
+
lines.push('');
|
|
160
|
+
lines.push('| Skill | Score | Pass | Findings |');
|
|
161
|
+
lines.push('|---|---:|:---:|---|');
|
|
162
|
+
|
|
163
|
+
for (const row of summary.results) {
|
|
164
|
+
lines.push(`| ${row.skill} | ${row.score} | ${row.pass ? 'Y' : 'N'} | ${row.findings.join('; ') || '-'} |`);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return `${lines.join('\n')}\n`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function main() {
|
|
171
|
+
const root = path.resolve(__dirname, '..');
|
|
172
|
+
const args = parseArgs(process.argv.slice(2));
|
|
173
|
+
const skillsDir = detectSkillsDir(root, args.skillsDir);
|
|
174
|
+
const outDir = detectOutDir(root, args.outDir);
|
|
175
|
+
const minScore = Math.max(1, Number(args.minScore) || 70);
|
|
176
|
+
|
|
177
|
+
const files = await listSkillFiles(skillsDir);
|
|
178
|
+
const results = [];
|
|
179
|
+
for (const item of files) {
|
|
180
|
+
const content = await fsp.readFile(item.file, 'utf8');
|
|
181
|
+
const score = evaluateSkill(item.name, content);
|
|
182
|
+
results.push(score);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const average = results.length === 0
|
|
186
|
+
? 0
|
|
187
|
+
: Number((results.reduce((sum, item) => sum + item.score, 0) / results.length).toFixed(2));
|
|
188
|
+
const passCount = results.filter((item) => item.score >= minScore).length;
|
|
189
|
+
const failCount = results.length - passCount;
|
|
190
|
+
const summary = {
|
|
191
|
+
generatedAt: new Date().toISOString(),
|
|
192
|
+
skillsDir,
|
|
193
|
+
minScore,
|
|
194
|
+
total: results.length,
|
|
195
|
+
averageScore: average,
|
|
196
|
+
passCount,
|
|
197
|
+
failCount,
|
|
198
|
+
results,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
await fsp.mkdir(outDir, { recursive: true });
|
|
202
|
+
const jsonPath = path.join(outDir, 'skill-eval-latest.json');
|
|
203
|
+
const mdPath = path.join(outDir, 'skill-eval-latest.md');
|
|
204
|
+
await fsp.writeFile(jsonPath, `${JSON.stringify(summary, null, 2)}\n`, 'utf8');
|
|
205
|
+
await fsp.writeFile(mdPath, renderMarkdownReport(summary), 'utf8');
|
|
206
|
+
|
|
207
|
+
console.log(`Skill eval completed: ${summary.total} skills, avg=${summary.averageScore}, fail=${summary.failCount}`);
|
|
208
|
+
console.log(`Reports: ${jsonPath}`);
|
|
209
|
+
console.log(`Reports: ${mdPath}`);
|
|
210
|
+
|
|
211
|
+
if (summary.failCount > 0) process.exitCode = 1;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
main().catch((error) => {
|
|
215
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
216
|
+
process.exit(1);
|
|
217
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { validateCatalogManifest, summarizeCatalogCounts } = require('../src/catalog/schema');
|
|
6
|
+
|
|
7
|
+
const root = path.resolve(__dirname, '..');
|
|
8
|
+
const skillsRoot = fs.existsSync(path.join(root, '.agent', 'skills'))
|
|
9
|
+
? path.join(root, '.agent', 'skills')
|
|
10
|
+
: path.join(root, '.codex', 'skills');
|
|
11
|
+
const promptsRoot = path.join(root, 'prompts');
|
|
12
|
+
|
|
13
|
+
const CATEGORY_MAP = new Map([
|
|
14
|
+
['autopilot', 'execution'],
|
|
15
|
+
['ralph', 'execution'],
|
|
16
|
+
['team', 'execution'],
|
|
17
|
+
['ultrawork', 'execution'],
|
|
18
|
+
['ultraqa', 'execution'],
|
|
19
|
+
['swarm', 'execution'],
|
|
20
|
+
['ralplan', 'planning'],
|
|
21
|
+
['plan', 'planning'],
|
|
22
|
+
['code-review', 'shortcut'],
|
|
23
|
+
['security-review', 'shortcut'],
|
|
24
|
+
['tdd', 'shortcut'],
|
|
25
|
+
['build-fix', 'shortcut'],
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const CORE = new Set(['autopilot', 'ralph', 'ultrawork', 'swarm', 'plan']);
|
|
29
|
+
|
|
30
|
+
function detectSkills() {
|
|
31
|
+
if (!fs.existsSync(skillsRoot)) return [];
|
|
32
|
+
return fs.readdirSync(skillsRoot, { withFileTypes: true })
|
|
33
|
+
.filter((entry) => entry.isDirectory())
|
|
34
|
+
.map((entry) => entry.name)
|
|
35
|
+
.sort();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function detectPrompts() {
|
|
39
|
+
if (!fs.existsSync(promptsRoot)) return [];
|
|
40
|
+
return fs.readdirSync(promptsRoot, { withFileTypes: true })
|
|
41
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith('.md'))
|
|
42
|
+
.map((entry) => entry.name.replace(/\.md$/i, ''))
|
|
43
|
+
.sort();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function buildManifest() {
|
|
47
|
+
const skillNames = detectSkills();
|
|
48
|
+
const promptNames = detectPrompts();
|
|
49
|
+
|
|
50
|
+
const skills = skillNames.map((name) => ({
|
|
51
|
+
name,
|
|
52
|
+
category: CATEGORY_MAP.get(name) || 'utility',
|
|
53
|
+
status: 'active',
|
|
54
|
+
core: CORE.has(name),
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
const agents = promptNames.map((name) => ({
|
|
58
|
+
name,
|
|
59
|
+
category: 'role',
|
|
60
|
+
status: 'active',
|
|
61
|
+
core: ['architect', 'planner', 'executor'].includes(name),
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
schemaVersion: 1,
|
|
66
|
+
catalogVersion: new Date().toISOString().slice(0, 10),
|
|
67
|
+
skills,
|
|
68
|
+
agents,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function main() {
|
|
73
|
+
const manifest = validateCatalogManifest(buildManifest());
|
|
74
|
+
const counts = summarizeCatalogCounts(manifest);
|
|
75
|
+
|
|
76
|
+
const templatePath = path.join(root, 'templates', 'catalog-manifest.json');
|
|
77
|
+
const sourcePath = path.join(root, 'src', 'catalog', 'manifest.json');
|
|
78
|
+
const generatedPath = path.join(root, 'src', 'catalog', 'generated', 'public-catalog.json');
|
|
79
|
+
|
|
80
|
+
fs.mkdirSync(path.dirname(templatePath), { recursive: true });
|
|
81
|
+
fs.mkdirSync(path.dirname(sourcePath), { recursive: true });
|
|
82
|
+
fs.mkdirSync(path.dirname(generatedPath), { recursive: true });
|
|
83
|
+
|
|
84
|
+
fs.writeFileSync(templatePath, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
85
|
+
fs.writeFileSync(sourcePath, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
86
|
+
fs.writeFileSync(
|
|
87
|
+
generatedPath,
|
|
88
|
+
`${JSON.stringify({ generatedAt: new Date().toISOString(), counts, skills: manifest.skills, agents: manifest.agents }, null, 2)}\n`,
|
|
89
|
+
'utf8',
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
console.log(`Catalog generated: ${counts.skillCount} skills, ${counts.promptCount} prompts`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
main();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
MODE="user"
|
|
6
|
+
ENABLE_CONTEXT7="false"
|
|
7
|
+
|
|
8
|
+
for arg in "$@"; do
|
|
9
|
+
case "$arg" in
|
|
10
|
+
--project) MODE="project-local" ;;
|
|
11
|
+
--enable-context7) ENABLE_CONTEXT7="true" ;;
|
|
12
|
+
--enable-collab) : ;; # compatibility no-op; collaboration_modes is managed in setup
|
|
13
|
+
esac
|
|
14
|
+
done
|
|
15
|
+
|
|
16
|
+
args=(setup --scope "$MODE" --no-skills --no-prompts --no-rules)
|
|
17
|
+
if [[ "$ENABLE_CONTEXT7" == "true" ]]; then
|
|
18
|
+
args+=(--enable-context7)
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
cd "$ROOT_DIR"
|
|
22
|
+
node ./bin/omcodex.js "${args[@]}"
|