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.
Files changed (292) hide show
  1. package/.agent/skills/agent-kb/HOW_TO_USE.md +428 -0
  2. package/.agent/skills/agent-kb/README.md +46 -0
  3. package/.agent/skills/agent-kb/SKILL.md +128 -0
  4. package/.agent/skills/agent-kb/references/intelligent-analysis-explained.md +333 -0
  5. package/.agent/skills/agent-kb/references/query-optimization.md +225 -0
  6. package/.agent/skills/aireview/SKILL.md +704 -0
  7. package/.agent/skills/analyze/SKILL.md +81 -0
  8. package/.agent/skills/architect-planner/HOW_TO_USE.md +238 -0
  9. package/.agent/skills/architect-planner/README.md +41 -0
  10. package/.agent/skills/architect-planner/SKILL.md +539 -0
  11. package/.agent/skills/auto-mbti/SKILL.md +291 -0
  12. package/.agent/skills/autopilot/SKILL.md +222 -0
  13. package/.agent/skills/backend-patterns/SKILL.md +602 -0
  14. package/.agent/skills/bdd-generator/README.md +78 -0
  15. package/.agent/skills/bdd-generator/SKILL.md +436 -0
  16. package/.agent/skills/brainstorming/HOW_TO_USE.md +289 -0
  17. package/.agent/skills/brainstorming/README.md +41 -0
  18. package/.agent/skills/brainstorming/SKILL.md +165 -0
  19. package/.agent/skills/build-fix/SKILL.md +190 -0
  20. package/.agent/skills/cancel/SKILL.md +658 -0
  21. package/.agent/skills/checkpoint/SKILL.md +94 -0
  22. package/.agent/skills/code-review/SKILL.md +273 -0
  23. package/.agent/skills/coding-standards/SKILL.md +535 -0
  24. package/.agent/skills/conductor/SKILL.md +128 -0
  25. package/.agent/skills/conductor/commands/conductor/implement.toml +358 -0
  26. package/.agent/skills/conductor/commands/conductor/newTrack.toml +142 -0
  27. package/.agent/skills/conductor/commands/conductor/revert.toml +123 -0
  28. package/.agent/skills/conductor/commands/conductor/setup.toml +429 -0
  29. package/.agent/skills/conductor/commands/conductor/status.toml +57 -0
  30. package/.agent/skills/conductor/scripts/install.sh +89 -0
  31. package/.agent/skills/conductor/templates/code_styleguides/csharp.md +115 -0
  32. package/.agent/skills/conductor/templates/code_styleguides/dart.md +238 -0
  33. package/.agent/skills/conductor/templates/code_styleguides/general.md +23 -0
  34. package/.agent/skills/conductor/templates/code_styleguides/go.md +48 -0
  35. package/.agent/skills/conductor/templates/code_styleguides/html-css.md +49 -0
  36. package/.agent/skills/conductor/templates/code_styleguides/javascript.md +51 -0
  37. package/.agent/skills/conductor/templates/code_styleguides/python.md +37 -0
  38. package/.agent/skills/conductor/templates/code_styleguides/typescript.md +43 -0
  39. package/.agent/skills/conductor/templates/rules/README.md +23 -0
  40. package/.agent/skills/conductor/templates/rules/agents.md +49 -0
  41. package/.agent/skills/conductor/templates/rules/coding-style.md +70 -0
  42. package/.agent/skills/conductor/templates/rules/dev.md +20 -0
  43. package/.agent/skills/conductor/templates/rules/git-workflow.md +45 -0
  44. package/.agent/skills/conductor/templates/rules/hooks.md +6 -0
  45. package/.agent/skills/conductor/templates/rules/patterns.md +55 -0
  46. package/.agent/skills/conductor/templates/rules/performance.md +47 -0
  47. package/.agent/skills/conductor/templates/rules/research.md +26 -0
  48. package/.agent/skills/conductor/templates/rules/review.md +22 -0
  49. package/.agent/skills/conductor/templates/rules/security.md +36 -0
  50. package/.agent/skills/conductor/templates/rules/testing.md +30 -0
  51. package/.agent/skills/conductor/templates/workflow.md +333 -0
  52. package/.agent/skills/consensus/HOW_TO_USE.md +191 -0
  53. package/.agent/skills/consensus/README.md +41 -0
  54. package/.agent/skills/consensus/SKILL.md +317 -0
  55. package/.agent/skills/content-research-writer/SKILL.md +537 -0
  56. package/.agent/skills/debug-analysis/SKILL.md +331 -0
  57. package/.agent/skills/deepinit/SKILL.md +347 -0
  58. package/.agent/skills/deepsearch/SKILL.md +56 -0
  59. package/.agent/skills/doctor/SKILL.md +158 -0
  60. package/.agent/skills/drawio/EXAMPLES.md +382 -0
  61. package/.agent/skills/drawio/QUICK_START.md +237 -0
  62. package/.agent/skills/drawio/README.md +315 -0
  63. package/.agent/skills/drawio/SETUP_GUIDE.md +254 -0
  64. package/.agent/skills/drawio/SKILL.md +1176 -0
  65. package/.agent/skills/e2e/SKILL.md +396 -0
  66. package/.agent/skills/ecomode/SKILL.md +160 -0
  67. package/.agent/skills/electron-driver/SKILL.md +144 -0
  68. package/.agent/skills/electron-driver/scripts/driver-template.js +71 -0
  69. package/.agent/skills/eval/SKILL.md +140 -0
  70. package/.agent/skills/eval-harness/SKILL.md +242 -0
  71. package/.agent/skills/evolve/SKILL.md +213 -0
  72. package/.agent/skills/frontend-design/SKILL.md +42 -0
  73. package/.agent/skills/frontend-patterns/SKILL.md +646 -0
  74. package/.agent/skills/frontend-ui-ux/SKILL.md +70 -0
  75. package/.agent/skills/git-master/SKILL.md +75 -0
  76. package/.agent/skills/help/SKILL.md +89 -0
  77. package/.agent/skills/iterative-retrieval/SKILL.md +217 -0
  78. package/.agent/skills/local-skills-setup/SKILL.md +483 -0
  79. package/.agent/skills/log-analyzer/SKILL.md +187 -0
  80. package/.agent/skills/mcp-setup/SKILL.md +226 -0
  81. package/.agent/skills/multi-model-research/HOW_TO_USE.md +614 -0
  82. package/.agent/skills/multi-model-research/README.md +233 -0
  83. package/.agent/skills/multi-model-research/SKILL.md +541 -0
  84. package/.agent/skills/multi-model-research/references/troubleshooting.md +415 -0
  85. package/.agent/skills/note/SKILL.md +80 -0
  86. package/.agent/skills/omc-setup/SKILL.md +219 -0
  87. package/.agent/skills/orchestrate/SKILL.md +620 -0
  88. package/.agent/skills/patent-workflow/IMPLEMENTATION_SUMMARY.md +500 -0
  89. package/.agent/skills/patent-workflow/README.md +455 -0
  90. package/.agent/skills/patent-workflow/SKILL.md +1036 -0
  91. package/.agent/skills/patent-workflow/tools/irr_checker.py +260 -0
  92. package/.agent/skills/patent-workflow/tools/sample_terminology.json +49 -0
  93. package/.agent/skills/patent-workflow/tools/term_checker.py +355 -0
  94. package/.agent/skills/pattern-recognition/SKILL.md +792 -0
  95. package/.agent/skills/pipeline/SKILL.md +448 -0
  96. package/.agent/skills/plan/SKILL.md +309 -0
  97. package/.agent/skills/planning-methodology/SKILL.md +370 -0
  98. package/.agent/skills/planning-with-files/SKILL.md +210 -0
  99. package/.agent/skills/planning-with-files/examples.md +202 -0
  100. package/.agent/skills/planning-with-files/reference.md +218 -0
  101. package/.agent/skills/planning-with-files/scripts/check-complete.ps1 +42 -0
  102. package/.agent/skills/planning-with-files/scripts/check-complete.sh +44 -0
  103. package/.agent/skills/planning-with-files/scripts/init-session.ps1 +120 -0
  104. package/.agent/skills/planning-with-files/scripts/init-session.sh +120 -0
  105. package/.agent/skills/planning-with-files/scripts/session-catchup.py +208 -0
  106. package/.agent/skills/planning-with-files/templates/findings.md +95 -0
  107. package/.agent/skills/planning-with-files/templates/progress.md +114 -0
  108. package/.agent/skills/planning-with-files/templates/task_plan.md +132 -0
  109. package/.agent/skills/project-analyze/CLAUDE.md +18 -0
  110. package/.agent/skills/project-analyze/HOW_TO_USE.md +145 -0
  111. package/.agent/skills/project-analyze/README.md +42 -0
  112. package/.agent/skills/project-analyze/SKILL.md +289 -0
  113. package/.agent/skills/project-analyze/SKILL.md.backup +287 -0
  114. package/.agent/skills/project-analyze/SKILL.md.backup_20260105_093646 +287 -0
  115. package/.agent/skills/project-analyze/assets/analysis-report-template.md +433 -0
  116. package/.agent/skills/project-analyze/references/analysis-patterns.md +422 -0
  117. package/.agent/skills/project-analyze/references/projectmind-explained.md +535 -0
  118. package/.agent/skills/project-session-manager/SKILL.md +428 -0
  119. package/.agent/skills/project-session-manager/lib/config.sh +86 -0
  120. package/.agent/skills/project-session-manager/lib/parse.sh +121 -0
  121. package/.agent/skills/project-session-manager/lib/session.sh +132 -0
  122. package/.agent/skills/project-session-manager/lib/tmux.sh +103 -0
  123. package/.agent/skills/project-session-manager/lib/worktree.sh +171 -0
  124. package/.agent/skills/project-session-manager/psm.sh +629 -0
  125. package/.agent/skills/project-session-manager/templates/feature.md +56 -0
  126. package/.agent/skills/project-session-manager/templates/issue-fix.md +57 -0
  127. package/.agent/skills/project-session-manager/templates/pr-review.md +65 -0
  128. package/.agent/skills/project-session-manager/templates/projects.json +19 -0
  129. package/.agent/skills/quality-check/HOW_TO_USE.md +171 -0
  130. package/.agent/skills/quality-check/README.md +50 -0
  131. package/.agent/skills/quality-check/SKILL.md +240 -0
  132. package/.agent/skills/quality-check/SKILL.md.backup +238 -0
  133. package/.agent/skills/quality-check/SKILL.md.backup_20260105_093646 +238 -0
  134. package/.agent/skills/quality-check/assets/quality-report-template.md +437 -0
  135. package/.agent/skills/quality-check/references/refactoring-patterns.md +550 -0
  136. package/.agent/skills/quality-check/references/scoring-criteria.md +454 -0
  137. package/.agent/skills/quality-validation/SKILL.md +519 -0
  138. package/.agent/skills/quality-validation/SKILL.md.backup +573 -0
  139. package/.agent/skills/quality-validation/SKILL.md.backup_20260105_093646 +573 -0
  140. package/.agent/skills/ralph/SKILL.md +236 -0
  141. package/.agent/skills/ralph-init/SKILL.md +78 -0
  142. package/.agent/skills/ralplan/SKILL.md +58 -0
  143. package/.agent/skills/refactor-clean/SKILL.md +49 -0
  144. package/.agent/skills/release/SKILL.md +84 -0
  145. package/.agent/skills/research/SKILL.md +526 -0
  146. package/.agent/skills/research-methodology/SKILL.md +268 -0
  147. package/.agent/skills/review/SKILL.md +53 -0
  148. package/.agent/skills/security-review/SKILL.md +509 -0
  149. package/.agent/skills/security-review/cloud-infrastructure-security.md +361 -0
  150. package/.agent/skills/setup-pm/SKILL.md +102 -0
  151. package/.agent/skills/skill/SKILL.md +424 -0
  152. package/.agent/skills/skill-create/SKILL.md +209 -0
  153. package/.agent/skills/skill-debugger/HOW_TO_USE.md +244 -0
  154. package/.agent/skills/skill-debugger/README.md +44 -0
  155. package/.agent/skills/skill-debugger/SKILL.md +326 -0
  156. package/.agent/skills/skill-debugger/diagnostic_checklist.md +115 -0
  157. package/.agent/skills/skill-development/SKILL.md +661 -0
  158. package/.agent/skills/skill-development/references/skill-creator-original.md +209 -0
  159. package/.agent/skills/skill-doc-generator/README.md +37 -0
  160. package/.agent/skills/skill-doc-generator/SKILL.md +331 -0
  161. package/.agent/skills/skill-quality-analyzer/HOW_TO_USE.md +243 -0
  162. package/.agent/skills/skill-quality-analyzer/README.md +61 -0
  163. package/.agent/skills/skill-quality-analyzer/SKILL.md +247 -0
  164. package/.agent/skills/skill-quality-analyzer/analyzer.py +209 -0
  165. package/.agent/skills/skill-quality-analyzer/expected_output.json +81 -0
  166. package/.agent/skills/skill-quality-analyzer/sample_input.json +9 -0
  167. package/.agent/skills/skill-tester/README.md +46 -0
  168. package/.agent/skills/skill-tester/SKILL.md +345 -0
  169. package/.agent/skills/start-dev/SKILL.md +701 -0
  170. package/.agent/skills/swarm/SKILL.md +691 -0
  171. package/.agent/skills/task-kb-lookup/SKILL.md +211 -0
  172. package/.agent/skills/task-kb-record/SKILL.md +417 -0
  173. package/.agent/skills/tdd/SKILL.md +446 -0
  174. package/.agent/skills/tdd-generator/DEMO.md +516 -0
  175. package/.agent/skills/tdd-generator/README.md +89 -0
  176. package/.agent/skills/tdd-generator/SKILL.md +278 -0
  177. package/.agent/skills/tdd-workflow/SKILL.md +424 -0
  178. package/.agent/skills/test-coverage/SKILL.md +48 -0
  179. package/.agent/skills/thinkdeep/HOW_TO_USE.md +183 -0
  180. package/.agent/skills/thinkdeep/README.md +41 -0
  181. package/.agent/skills/thinkdeep/SKILL.md +343 -0
  182. package/.agent/skills/ui-ux-pro-max/SKILL.md +228 -0
  183. package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
  184. package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
  185. package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
  186. package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
  187. package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  188. package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  189. package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  190. package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  191. package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  192. package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  193. package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  194. package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  195. package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  196. package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
  197. package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
  198. package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  199. package/.agent/skills/ui-ux-pro-max/scripts/core.py +236 -0
  200. package/.agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
  201. package/.agent/skills/ultrapilot/SKILL.md +647 -0
  202. package/.agent/skills/ultraqa/SKILL.md +152 -0
  203. package/.agent/skills/ultrawork/SKILL.md +123 -0
  204. package/.agent/skills/update-codemaps/SKILL.md +38 -0
  205. package/.agent/skills/update-docs/SKILL.md +52 -0
  206. package/.agent/skills/verification-loop/SKILL.md +140 -0
  207. package/.agent/skills/verify/SKILL.md +80 -0
  208. package/.agent/skills/writer-memory/SKILL.md +459 -0
  209. package/.agent/skills/writer-memory/lib/character-tracker.ts +338 -0
  210. package/.agent/skills/writer-memory/lib/memory-manager.ts +804 -0
  211. package/.agent/skills/writer-memory/lib/relationship-graph.ts +400 -0
  212. package/.agent/skills/writer-memory/lib/scene-organizer.ts +544 -0
  213. package/.agent/skills/writer-memory/lib/synopsis-builder.ts +339 -0
  214. package/.agent/skills/writer-memory/templates/synopsis-template.md +46 -0
  215. package/.governance/skill-lint.allowlist +4 -0
  216. package/.governance/skill-llm.allowlist +4 -0
  217. package/AGENTS.md +59 -0
  218. package/LICENSE +21 -0
  219. package/README.md +169 -0
  220. package/README.zh.md +145 -0
  221. package/bin/omcodex.js +8 -0
  222. package/commands/conductor/implement.toml +358 -0
  223. package/commands/conductor/newTrack.toml +142 -0
  224. package/commands/conductor/revert.toml +123 -0
  225. package/commands/conductor/setup.toml +429 -0
  226. package/commands/conductor/status.toml +57 -0
  227. package/docs/ALIGNMENT.md +40 -0
  228. package/docs/CODEX.md +133 -0
  229. package/docs/NOTIFY.md +81 -0
  230. package/docs/SKILL_GOVERNANCE.md +72 -0
  231. package/docs/SKILL_GOVERNANCE_FRAMEWORK.md +182 -0
  232. package/docs/SKILL_GOVERNANCE_FRAMEWORK.zh.md +170 -0
  233. package/package.json +50 -0
  234. package/prompts/architect.md +105 -0
  235. package/prompts/executor.md +134 -0
  236. package/prompts/planner.md +113 -0
  237. package/scripts/check-skill-governance.sh +84 -0
  238. package/scripts/check-skill-llm-governance.js +302 -0
  239. package/scripts/eval-skills.js +217 -0
  240. package/scripts/generate-catalog-docs.js +95 -0
  241. package/scripts/generate-codex-mcp-config.sh +22 -0
  242. package/scripts/install-codex-force.sh +5 -0
  243. package/scripts/install-codex-incremental.sh +5 -0
  244. package/scripts/install-codex.sh +79 -0
  245. package/scripts/notify-dispatch.js +15 -0
  246. package/scripts/setup-package-manager.js +137 -0
  247. package/src/catalog/generated/public-catalog.json +547 -0
  248. package/src/catalog/manifest.json +542 -0
  249. package/src/catalog/reader.js +43 -0
  250. package/src/catalog/schema.js +79 -0
  251. package/src/cli/doctor.js +62 -0
  252. package/src/cli/index.js +85 -0
  253. package/src/cli/notify.js +127 -0
  254. package/src/cli/route.js +43 -0
  255. package/src/cli/setup.js +155 -0
  256. package/src/cli/team.js +125 -0
  257. package/src/config/generator.js +119 -0
  258. package/src/mcp/memory-server.js +241 -0
  259. package/src/mcp/state-server.js +112 -0
  260. package/src/mcp/trace-server.js +168 -0
  261. package/src/notify/dispatch.js +74 -0
  262. package/src/notify/extensibility/dispatcher.js +113 -0
  263. package/src/notify/extensibility/events.js +15 -0
  264. package/src/notify/extensibility/loader.js +54 -0
  265. package/src/router/skill-router.js +90 -0
  266. package/src/team/auto-advance.js +72 -0
  267. package/src/team/orchestrator.js +82 -0
  268. package/src/team/state-store.js +33 -0
  269. package/src/utils/paths.js +33 -0
  270. package/templates/AGENTS.md +15 -0
  271. package/templates/catalog-manifest.json +542 -0
  272. package/templates/code_styleguides/csharp.md +115 -0
  273. package/templates/code_styleguides/dart.md +238 -0
  274. package/templates/code_styleguides/general.md +23 -0
  275. package/templates/code_styleguides/go.md +48 -0
  276. package/templates/code_styleguides/html-css.md +49 -0
  277. package/templates/code_styleguides/javascript.md +51 -0
  278. package/templates/code_styleguides/python.md +37 -0
  279. package/templates/code_styleguides/typescript.md +43 -0
  280. package/templates/rules/README.md +23 -0
  281. package/templates/rules/agents.md +49 -0
  282. package/templates/rules/coding-style.md +70 -0
  283. package/templates/rules/dev.md +20 -0
  284. package/templates/rules/git-workflow.md +45 -0
  285. package/templates/rules/notify.md +6 -0
  286. package/templates/rules/patterns.md +55 -0
  287. package/templates/rules/performance.md +47 -0
  288. package/templates/rules/research.md +26 -0
  289. package/templates/rules/review.md +22 -0
  290. package/templates/rules/security.md +36 -0
  291. package/templates/rules/testing.md +30 -0
  292. package/templates/workflow.md +333 -0
@@ -0,0 +1,62 @@
1
+ /* eslint-disable no-console */
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { spawnSync } = require('child_process');
5
+ const { tryReadCatalogManifest } = require('../catalog/reader');
6
+
7
+ function checkCodexCli() {
8
+ const result = spawnSync('codex', ['--version'], { encoding: 'utf8' });
9
+ return !result.error && result.status === 0;
10
+ }
11
+
12
+ async function doctor() {
13
+ const root = path.resolve(__dirname, '..', '..');
14
+ const checks = [];
15
+ const codexCliInstalled = checkCodexCli();
16
+
17
+ checks.push({ name: 'Codex CLI', pass: codexCliInstalled, msg: codexCliInstalled ? 'installed' : 'not found' });
18
+
19
+ const skillsRoot = fs.existsSync(path.join(root, '.agent', 'skills'))
20
+ ? path.join(root, '.agent', 'skills')
21
+ : path.join(root, '.codex', 'skills');
22
+ checks.push({
23
+ name: 'Skills source',
24
+ pass: fs.existsSync(skillsRoot),
25
+ msg: skillsRoot,
26
+ });
27
+
28
+ const promptsRoot = path.join(root, 'prompts');
29
+ checks.push({
30
+ name: 'Prompts source',
31
+ pass: fs.existsSync(promptsRoot),
32
+ msg: fs.existsSync(promptsRoot) ? promptsRoot : 'missing (optional)',
33
+ });
34
+
35
+ const manifest = tryReadCatalogManifest(root);
36
+ checks.push({
37
+ name: 'Catalog manifest',
38
+ pass: !!manifest,
39
+ msg: manifest ? `ok (${manifest.skills.length} skills)` : 'missing or invalid',
40
+ });
41
+
42
+ const teamStatePath = path.join(process.cwd(), '.omcodex', 'state', 'team-state.json');
43
+ checks.push({
44
+ name: 'Team state file',
45
+ pass: true,
46
+ msg: fs.existsSync(teamStatePath) ? teamStatePath : 'not initialized yet',
47
+ });
48
+
49
+ let passCount = 0;
50
+ for (const check of checks) {
51
+ const icon = check.pass ? '[OK]' : '[XX]';
52
+ if (check.pass) passCount += 1;
53
+ console.log(`${icon} ${check.name}: ${check.msg}`);
54
+ }
55
+
56
+ console.log(`\nResult: ${passCount}/${checks.length} checks passed.`);
57
+ if (passCount !== checks.length) {
58
+ process.exitCode = 1;
59
+ }
60
+ }
61
+
62
+ module.exports = { doctor };
@@ -0,0 +1,85 @@
1
+ /* eslint-disable no-console */
2
+ const { setup } = require('./setup');
3
+ const { doctor } = require('./doctor');
4
+ const { team } = require('./team');
5
+ const { notify } = require('./notify');
6
+ const { route } = require('./route');
7
+
8
+ const HELP = `oh-my-codex CLI (omcodex)
9
+
10
+ Usage:
11
+ omcodex setup [--scope user|project-local|project] [--force] [--dry-run] [--verbose] [--no-prompts]
12
+ omcodex doctor
13
+ omcodex team start \"<task>\"
14
+ omcodex team status
15
+ omcodex team advance <phase> [reason]
16
+ omcodex team cancel
17
+ omcodex team clear
18
+ omcodex route "<task>" [--limit 5] [--json]
19
+ omcodex notify init|status|validate|test [event]
20
+ omcodex help
21
+ `;
22
+
23
+ function parseScope(args) {
24
+ for (let i = 0; i < args.length; i += 1) {
25
+ const arg = args[i];
26
+ if (arg === '--scope') {
27
+ const next = args[i + 1];
28
+ if (!next) throw new Error('Missing value for --scope');
29
+ return next;
30
+ }
31
+ if (arg.startsWith('--scope=')) {
32
+ return arg.slice('--scope='.length);
33
+ }
34
+ }
35
+ return undefined;
36
+ }
37
+
38
+ async function main(args) {
39
+ const command = args[0] || 'help';
40
+ const flags = new Set(args);
41
+
42
+ if (command === 'help' || command === '--help' || command === '-h') {
43
+ console.log(HELP);
44
+ return;
45
+ }
46
+
47
+ if (command === 'setup') {
48
+ await setup({
49
+ scope: parseScope(args.slice(1)),
50
+ force: flags.has('--force'),
51
+ dryRun: flags.has('--dry-run'),
52
+ verbose: flags.has('--verbose'),
53
+ enableContext7: flags.has('--enable-context7'),
54
+ installSkills: !flags.has('--no-skills'),
55
+ installPrompts: !flags.has('--no-prompts'),
56
+ installRules: !flags.has('--no-rules'),
57
+ installConfig: !flags.has('--no-config'),
58
+ });
59
+ return;
60
+ }
61
+
62
+ if (command === 'doctor') {
63
+ await doctor();
64
+ return;
65
+ }
66
+
67
+ if (command === 'team') {
68
+ await team(args.slice(1));
69
+ return;
70
+ }
71
+
72
+ if (command === 'notify') {
73
+ await notify(args.slice(1));
74
+ return;
75
+ }
76
+
77
+ if (command === 'route') {
78
+ await route(args.slice(1));
79
+ return;
80
+ }
81
+
82
+ throw new Error(`Unknown command: ${command}`);
83
+ }
84
+
85
+ module.exports = { main };
@@ -0,0 +1,127 @@
1
+ /* eslint-disable no-console */
2
+ const fs = require('fs');
3
+ const fsp = require('fs/promises');
4
+ const path = require('path');
5
+ const { pathToFileURL } = require('url');
6
+ const { buildNotifyEvent } = require('../notify/extensibility/events');
7
+ const { dispatchNotifyEvent } = require('../notify/extensibility/dispatcher');
8
+ const {
9
+ discoverNotifyPlugins,
10
+ notifyPluginsDir,
11
+ legacyNotifyPluginsDir,
12
+ } = require('../notify/extensibility/loader');
13
+
14
+ const SUPPORTED_TEST_EVENTS = new Set([
15
+ 'turn-complete',
16
+ 'session-start',
17
+ 'session-end',
18
+ 'session-idle',
19
+ 'needs-input',
20
+ 'pre-tool-use',
21
+ 'post-tool-use',
22
+ ]);
23
+
24
+ const SAMPLE_PLUGIN = `export async function onNotifyEvent(event, sdk) {
25
+ if (event.event !== 'turn-complete') return;
26
+ const current = Number((await sdk.state.read('seen-count')) || 0);
27
+ const next = current + 1;
28
+ await sdk.state.write('seen-count', next);
29
+ await sdk.log.info('sample notify plugin observed turn-complete', { seen: next, turn_id: event.turn_id });
30
+ }
31
+ `;
32
+
33
+ async function validatePlugin(filePath) {
34
+ try {
35
+ const mod = await import(`${pathToFileURL(filePath).href}?t=${Date.now()}`);
36
+ if (typeof mod.onNotifyEvent !== 'function') {
37
+ return { valid: false, reason: 'missing export onNotifyEvent(event, sdk)' };
38
+ }
39
+ return { valid: true };
40
+ } catch (error) {
41
+ return { valid: false, reason: error instanceof Error ? error.message : String(error) };
42
+ }
43
+ }
44
+
45
+ async function notify(args) {
46
+ const sub = args[0] || 'status';
47
+ const cwd = process.cwd();
48
+
49
+ if (sub === 'init') {
50
+ const dir = notifyPluginsDir(cwd);
51
+ const file = path.join(dir, 'sample-notify-plugin.mjs');
52
+ await fsp.mkdir(dir, { recursive: true });
53
+ if (fs.existsSync(file)) {
54
+ console.log(`already exists: ${file}`);
55
+ return;
56
+ }
57
+ await fsp.writeFile(file, SAMPLE_PLUGIN, 'utf8');
58
+ console.log(`created ${file}`);
59
+ console.log('Enable notify plugins with OMX_NOTIFY_PLUGINS=1');
60
+ return;
61
+ }
62
+
63
+ if (sub === 'status') {
64
+ const plugins = discoverNotifyPlugins(cwd);
65
+ console.log(`notify plugins dir: ${notifyPluginsDir(cwd)}`);
66
+ console.log(`legacy notify dir: ${legacyNotifyPluginsDir(cwd)}`);
67
+ console.log(`plugins discovered: ${plugins.length}`);
68
+ for (const plugin of plugins) {
69
+ const legacy = plugin.legacy ? ' (legacy)' : '';
70
+ console.log(`- ${plugin.fileName}${legacy}`);
71
+ }
72
+ return;
73
+ }
74
+
75
+ if (sub === 'validate') {
76
+ const plugins = discoverNotifyPlugins(cwd);
77
+ if (plugins.length === 0) {
78
+ console.log('No notify plugins found.');
79
+ return;
80
+ }
81
+
82
+ let failed = 0;
83
+ for (const plugin of plugins) {
84
+ const result = await validatePlugin(plugin.filePath);
85
+ if (result.valid) {
86
+ console.log(`OK ${plugin.fileName}`);
87
+ } else {
88
+ failed += 1;
89
+ console.log(`XX ${plugin.fileName}: ${result.reason}`);
90
+ }
91
+ }
92
+
93
+ if (failed > 0) throw new Error(`notify validation failed (${failed})`);
94
+ return;
95
+ }
96
+
97
+ if (sub === 'test') {
98
+ const eventName = args[1] || 'turn-complete';
99
+ if (!SUPPORTED_TEST_EVENTS.has(eventName)) {
100
+ throw new Error(`unsupported notify test event: ${eventName}`);
101
+ }
102
+
103
+ const event = buildNotifyEvent(eventName, {
104
+ source: 'native',
105
+ session_id: 'notify-test',
106
+ thread_id: `thread-${Date.now()}`,
107
+ turn_id: `turn-${Date.now()}`,
108
+ context: { reason: 'notify-test' },
109
+ });
110
+
111
+ const result = await dispatchNotifyEvent(event, {
112
+ cwd,
113
+ env: { ...process.env, OMX_NOTIFY_PLUGINS: '1' },
114
+ });
115
+
116
+ console.log(`plugins enabled: ${result.enabled ? 'yes' : 'no'}`);
117
+ console.log(`plugins: ${result.plugin_count}`);
118
+ for (const item of result.results) {
119
+ console.log(`${item.plugin}: ${item.status}`);
120
+ }
121
+ return;
122
+ }
123
+
124
+ console.log('Usage: omcodex notify init|status|validate|test [event]');
125
+ }
126
+
127
+ module.exports = { notify };
@@ -0,0 +1,43 @@
1
+ /* eslint-disable no-console */
2
+ const path = require('path');
3
+ const { routeTaskToSkills } = require('../router/skill-router');
4
+
5
+ function parseLimit(args) {
6
+ for (const arg of args) {
7
+ if (arg.startsWith('--limit=')) return Number(arg.slice('--limit='.length));
8
+ }
9
+ const index = args.indexOf('--limit');
10
+ if (index >= 0 && args[index + 1]) return Number(args[index + 1]);
11
+ return 5;
12
+ }
13
+
14
+ function parseTask(args) {
15
+ return args.filter((arg) => !arg.startsWith('--limit') && arg !== '--json').join(' ').trim();
16
+ }
17
+
18
+ async function route(args) {
19
+ const json = args.includes('--json');
20
+ const limit = parseLimit(args);
21
+ const task = parseTask(args);
22
+ if (!task) {
23
+ throw new Error('Usage: omcodex route "<task description>" [--limit 5] [--json]');
24
+ }
25
+
26
+ const result = routeTaskToSkills(task, {
27
+ limit,
28
+ root: path.resolve(__dirname, '..', '..'),
29
+ });
30
+
31
+ if (json) {
32
+ console.log(JSON.stringify(result, null, 2));
33
+ return;
34
+ }
35
+
36
+ console.log(`task: ${result.task}`);
37
+ console.log(`confidence: ${(result.confidence * 100).toFixed(0)}%`);
38
+ for (const item of result.recommendations) {
39
+ console.log(`- ${item.skill} (score=${item.score}, ${item.rationale})`);
40
+ }
41
+ }
42
+
43
+ module.exports = { route };
@@ -0,0 +1,155 @@
1
+ /* eslint-disable no-console */
2
+ const fs = require('fs');
3
+ const fsp = require('fs/promises');
4
+ const path = require('path');
5
+ const os = require('os');
6
+ const {
7
+ codexHome,
8
+ codexConfigPath,
9
+ codexPromptsPath,
10
+ skillsSource,
11
+ promptsSource,
12
+ } = require('../utils/paths');
13
+ const { mergeConfig } = require('../config/generator');
14
+ const { getCatalogHeadlineCounts } = require('../catalog/reader');
15
+
16
+ const SETUP_SCOPES = new Set(['user', 'project-local', 'project']);
17
+
18
+ function readPersistedScope(cwd) {
19
+ const scopeFile = path.join(cwd, '.omcodex', 'setup-scope.json');
20
+ if (!fs.existsSync(scopeFile)) return null;
21
+ try {
22
+ const parsed = JSON.parse(fs.readFileSync(scopeFile, 'utf8'));
23
+ if (SETUP_SCOPES.has(parsed.scope)) return parsed.scope;
24
+ } catch {}
25
+ return null;
26
+ }
27
+
28
+ async function persistScope(cwd, scope, dryRun) {
29
+ const scopeFile = path.join(cwd, '.omcodex', 'setup-scope.json');
30
+ if (dryRun) return;
31
+ await fsp.mkdir(path.dirname(scopeFile), { recursive: true });
32
+ await fsp.writeFile(scopeFile, `${JSON.stringify({ scope }, null, 2)}\n`, 'utf8');
33
+ }
34
+
35
+ async function copyDirectory(src, dest, options) {
36
+ if (!fs.existsSync(src)) return 0;
37
+ if (!options.dryRun) {
38
+ await fsp.mkdir(dest, { recursive: true });
39
+ }
40
+ const entries = await fsp.readdir(src, { withFileTypes: true });
41
+ let count = 0;
42
+
43
+ for (const entry of entries) {
44
+ const from = path.join(src, entry.name);
45
+ const to = path.join(dest, entry.name);
46
+
47
+ if (entry.isDirectory()) {
48
+ count += await copyDirectory(from, to, options);
49
+ continue;
50
+ }
51
+
52
+ if (!entry.isFile()) continue;
53
+
54
+ if (!options.force && fs.existsSync(to)) continue;
55
+ if (!options.dryRun) {
56
+ await fsp.mkdir(path.dirname(to), { recursive: true });
57
+ await fsp.copyFile(from, to);
58
+ }
59
+ count += 1;
60
+ }
61
+
62
+ return count;
63
+ }
64
+
65
+ async function setup(options = {}) {
66
+ const cwd = process.cwd();
67
+ const root = path.resolve(__dirname, '..', '..');
68
+ const scope = options.scope || readPersistedScope(cwd) || 'user';
69
+
70
+ if (!SETUP_SCOPES.has(scope)) {
71
+ throw new Error(`Invalid scope: ${scope}. Expected one of user, project-local, project.`);
72
+ }
73
+
74
+ console.log('oh-my-codex setup');
75
+ console.log('=================');
76
+ console.log(`Scope: ${scope}`);
77
+
78
+ const baseCodexHome = codexHome(scope, cwd);
79
+ const configPath = codexConfigPath(scope, cwd);
80
+ const rulesSource = path.join(root, 'templates', 'rules');
81
+ const rulesDest = scope === 'user'
82
+ ? path.join(os.homedir(), '.codex', 'rules')
83
+ : path.join(cwd, '.codex', 'rules');
84
+ const promptsSrc = promptsSource(root);
85
+ const promptsDest = codexPromptsPath(scope, cwd);
86
+
87
+ const skillSrc = (() => {
88
+ const src = skillsSource(root);
89
+ if (fs.existsSync(src.agentSkills)) return src.agentSkills;
90
+ if (fs.existsSync(src.codexSkills)) return src.codexSkills;
91
+ throw new Error('No skills source found (.agent/skills or .codex/skills)');
92
+ })();
93
+
94
+ const skillsDest = scope === 'user'
95
+ ? path.join(os.homedir(), '.codex', 'skills')
96
+ : path.join(cwd, '.codex', 'skills');
97
+
98
+ await persistScope(cwd, scope, options.dryRun);
99
+
100
+ console.log('[1/5] Installing skills...');
101
+ const shouldInstallSkills = options.installSkills !== false && scope !== 'project';
102
+ const skillCount = shouldInstallSkills
103
+ ? await copyDirectory(skillSrc, skillsDest, options)
104
+ : 0;
105
+ if (shouldInstallSkills) {
106
+ const label = options.dryRun ? 'Would install/update' : 'Installed/updated';
107
+ console.log(` ${label} ${skillCount} files -> ${skillsDest}`);
108
+ } else {
109
+ console.log(' Skipped for project scope');
110
+ }
111
+
112
+ console.log('[2/5] Installing prompts...');
113
+ const shouldInstallPrompts = options.installPrompts !== false && scope !== 'project';
114
+ if (!shouldInstallPrompts) {
115
+ console.log(' Skipped (--no-prompts or project scope)');
116
+ } else if (!fs.existsSync(promptsSrc)) {
117
+ console.log(` Skipped (missing prompts source: ${promptsSrc})`);
118
+ } else {
119
+ const promptCount = await copyDirectory(promptsSrc, promptsDest, options);
120
+ const label = options.dryRun ? 'Would install/update' : 'Installed/updated';
121
+ console.log(` ${label} ${promptCount} files -> ${promptsDest}`);
122
+ }
123
+
124
+ console.log('[3/5] Installing rules...');
125
+ if (options.installRules !== false) {
126
+ const ruleCount = await copyDirectory(rulesSource, rulesDest, options);
127
+ const label = options.dryRun ? 'Would install/update' : 'Installed/updated';
128
+ console.log(` ${label} ${ruleCount} files -> ${rulesDest}`);
129
+ } else {
130
+ console.log(' Skipped (--no-rules)');
131
+ }
132
+
133
+ console.log('[4/5] Merging config.toml...');
134
+ if (options.installConfig !== false && !options.dryRun) {
135
+ mergeConfig(configPath, root, { enableContext7: options.enableContext7 });
136
+ }
137
+ if (options.installConfig !== false) {
138
+ const label = options.dryRun ? 'Would update' : 'Updated';
139
+ console.log(` ${label} ${configPath}`);
140
+ } else {
141
+ console.log(' Skipped (--no-config)');
142
+ }
143
+
144
+ console.log('[5/5] Catalog check...');
145
+ const headline = getCatalogHeadlineCounts(root);
146
+ if (headline) {
147
+ console.log(` Catalog baseline: ${headline.skills} skills, ${headline.prompts} prompts`);
148
+ } else {
149
+ console.log(' Catalog manifest missing (run npm run catalog:generate)');
150
+ }
151
+
152
+ console.log('\nDone.');
153
+ }
154
+
155
+ module.exports = { setup };
@@ -0,0 +1,125 @@
1
+ /* eslint-disable no-console */
2
+ const path = require('path');
3
+ const { createTeamState, transitionPhase } = require('../team/orchestrator');
4
+ const { readTeamState, writeTeamState, clearTeamState } = require('../team/state-store');
5
+ const { routeTaskToSkills } = require('../router/skill-router');
6
+
7
+ function usage() {
8
+ console.log('Usage: omcodex team start "<task>" [--auto] [--max-fix=N] | status | advance <phase> [reason] | cancel | clear');
9
+ }
10
+
11
+ function parseStartArgs(args) {
12
+ const taskParts = [];
13
+ let autoAdvance = false;
14
+ let maxFixAttempts = 3;
15
+
16
+ for (let i = 1; i < args.length; i += 1) {
17
+ const arg = args[i];
18
+ if (arg === '--auto') {
19
+ autoAdvance = true;
20
+ continue;
21
+ }
22
+ if (arg === '--max-fix' && args[i + 1]) {
23
+ maxFixAttempts = Math.max(1, Number(args[i + 1]) || 3);
24
+ i += 1;
25
+ continue;
26
+ }
27
+ if (arg.startsWith('--max-fix=')) {
28
+ maxFixAttempts = Math.max(1, Number(arg.slice('--max-fix='.length)) || 3);
29
+ continue;
30
+ }
31
+ taskParts.push(arg);
32
+ }
33
+
34
+ return {
35
+ autoAdvance,
36
+ maxFixAttempts,
37
+ task: taskParts.join(' ').trim(),
38
+ };
39
+ }
40
+
41
+ async function team(args) {
42
+ const sub = args[0];
43
+ const cwd = process.cwd();
44
+
45
+ if (!sub || sub === 'help') {
46
+ usage();
47
+ return;
48
+ }
49
+
50
+ if (sub === 'start') {
51
+ const { autoAdvance, maxFixAttempts, task } = parseStartArgs(args);
52
+ if (!task) throw new Error('Usage: omcodex team start "<task>"');
53
+ const state = createTeamState(task, maxFixAttempts, { autoAdvance });
54
+ const routed = routeTaskToSkills(task, { limit: 3, root: path.resolve(__dirname, '..', '..') });
55
+ state.recommended_skills = routed.recommendations.map((item) => item.skill);
56
+ writeTeamState(cwd, state);
57
+ console.log(`team started: phase=${state.phase} auto_advance=${state.auto_advance ? 'on' : 'off'}`);
58
+ console.log(`recommended_skills=${state.recommended_skills.join(',')}`);
59
+ return;
60
+ }
61
+
62
+ if (sub === 'status') {
63
+ const state = readTeamState(cwd);
64
+ if (!state) {
65
+ console.log('No team state found.');
66
+ return;
67
+ }
68
+ console.log(`phase=${state.phase} active=${state.active}`);
69
+ console.log(`fix_attempt=${state.current_fix_attempt}/${state.max_fix_attempts}`);
70
+ console.log(`auto_advance=${state.auto_advance === true ? 'on' : 'off'}`);
71
+ if (Array.isArray(state.recommended_skills) && state.recommended_skills.length > 0) {
72
+ console.log(`recommended_skills=${state.recommended_skills.join(',')}`);
73
+ }
74
+ console.log(`task=${state.task_description}`);
75
+ return;
76
+ }
77
+
78
+ if (sub === 'advance') {
79
+ const nextPhase = args[1];
80
+ const reason = args.slice(2).join(' ').trim() || undefined;
81
+ if (!nextPhase) throw new Error('Usage: omcodex team advance <phase> [reason]');
82
+
83
+ const state = readTeamState(cwd);
84
+ if (!state) throw new Error('No team state found. Start first with `omcodex team start`');
85
+ const next = transitionPhase(state, nextPhase, reason);
86
+ writeTeamState(cwd, next);
87
+ console.log(`phase advanced: ${state.phase} -> ${next.phase}`);
88
+ return;
89
+ }
90
+
91
+ if (sub === 'cancel') {
92
+ const state = readTeamState(cwd);
93
+ if (!state) {
94
+ console.log('No team state found.');
95
+ return;
96
+ }
97
+ const next = {
98
+ ...state,
99
+ active: false,
100
+ phase: 'cancelled',
101
+ phase_transitions: [
102
+ ...state.phase_transitions,
103
+ {
104
+ from: state.phase,
105
+ to: 'cancelled',
106
+ at: new Date().toISOString(),
107
+ reason: 'manual_cancel',
108
+ },
109
+ ],
110
+ };
111
+ writeTeamState(cwd, next);
112
+ console.log('team cancelled');
113
+ return;
114
+ }
115
+
116
+ if (sub === 'clear') {
117
+ clearTeamState(cwd);
118
+ console.log('team state cleared');
119
+ return;
120
+ }
121
+
122
+ usage();
123
+ }
124
+
125
+ module.exports = { team };