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,119 @@
|
|
|
1
|
+
/* eslint-disable no-useless-escape */
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function stripManagedBlock(content, startMarker, endMarker) {
|
|
6
|
+
const start = content.indexOf(startMarker);
|
|
7
|
+
if (start < 0) return content;
|
|
8
|
+
const end = content.indexOf(endMarker, start);
|
|
9
|
+
if (end < 0) return content;
|
|
10
|
+
const tailIndex = end + endMarker.length;
|
|
11
|
+
const before = content.slice(0, start).trimEnd();
|
|
12
|
+
const after = content.slice(tailIndex).trimStart();
|
|
13
|
+
return [before, after].filter(Boolean).join('\n\n');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function upsertFeatureFlags(config) {
|
|
17
|
+
const lines = config.split(/\r?\n/);
|
|
18
|
+
const start = lines.findIndex((line) => /^\s*\[features\]\s*$/.test(line));
|
|
19
|
+
|
|
20
|
+
if (start < 0) {
|
|
21
|
+
const append = [
|
|
22
|
+
'[features]',
|
|
23
|
+
'multi_agent = true',
|
|
24
|
+
'child_agents_md = true',
|
|
25
|
+
'collaboration_modes = true',
|
|
26
|
+
'',
|
|
27
|
+
].join('\n');
|
|
28
|
+
return `${config.trimEnd()}\n\n${append}`.trim() + '\n';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let end = lines.length;
|
|
32
|
+
for (let i = start + 1; i < lines.length; i += 1) {
|
|
33
|
+
if (/^\s*\[[^\]]+\]\s*$/.test(lines[i])) {
|
|
34
|
+
end = i;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const featureKeys = new Map([
|
|
40
|
+
['multi_agent', 'multi_agent = true'],
|
|
41
|
+
['child_agents_md', 'child_agents_md = true'],
|
|
42
|
+
['collaboration_modes', 'collaboration_modes = true'],
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
for (const [key, value] of featureKeys.entries()) {
|
|
46
|
+
let found = false;
|
|
47
|
+
for (let i = start + 1; i < end; i += 1) {
|
|
48
|
+
if (new RegExp(`^\\s*${key}\\s*=`).test(lines[i])) {
|
|
49
|
+
lines[i] = value;
|
|
50
|
+
found = true;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (!found) {
|
|
55
|
+
lines.splice(end, 0, value);
|
|
56
|
+
end += 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return `${lines.join('\n').trim()}\n`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function buildManagedBlock(root, options = {}) {
|
|
64
|
+
const notifyScript = path.join(root, 'scripts', 'notify-dispatch.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
65
|
+
const stateServer = path.join(root, 'src', 'mcp', 'state-server.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
66
|
+
const memoryServer = path.join(root, 'src', 'mcp', 'memory-server.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
67
|
+
const traceServer = path.join(root, 'src', 'mcp', 'trace-server.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
68
|
+
const includeContext7 = options.enableContext7 === true;
|
|
69
|
+
|
|
70
|
+
const lines = [
|
|
71
|
+
'# ============================================================',
|
|
72
|
+
'# oh-my-codex managed block',
|
|
73
|
+
'# ============================================================',
|
|
74
|
+
`notify = ["node", "${notifyScript}"]`,
|
|
75
|
+
'model_reasoning_effort = "high"',
|
|
76
|
+
'[mcp_servers.openaiDeveloperDocs]',
|
|
77
|
+
'url = "https://developers.openai.com/mcp"',
|
|
78
|
+
'enabled = true',
|
|
79
|
+
'',
|
|
80
|
+
'[mcp_servers.omcodex_state]',
|
|
81
|
+
'command = "node"',
|
|
82
|
+
`args = ["${stateServer}"]`,
|
|
83
|
+
'enabled = true',
|
|
84
|
+
'',
|
|
85
|
+
'[mcp_servers.omcodex_memory]',
|
|
86
|
+
'command = "node"',
|
|
87
|
+
`args = ["${memoryServer}"]`,
|
|
88
|
+
'enabled = true',
|
|
89
|
+
'',
|
|
90
|
+
'[mcp_servers.omcodex_trace]',
|
|
91
|
+
'command = "node"',
|
|
92
|
+
`args = ["${traceServer}"]`,
|
|
93
|
+
'enabled = true',
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
if (includeContext7) {
|
|
97
|
+
lines.push('', '[mcp_servers.context7]', 'command = "npx"', 'args = ["-y", "@upstash/context7-mcp"]', 'enabled = true');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
lines.push('', '# ============================================================', '# end oh-my-codex managed block', '# ============================================================');
|
|
101
|
+
return lines.join('\n');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function mergeConfig(configFile, root, options = {}) {
|
|
105
|
+
const dir = path.dirname(configFile);
|
|
106
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
107
|
+
|
|
108
|
+
const startMarker = '# oh-my-codex managed block';
|
|
109
|
+
const endMarker = '# end oh-my-codex managed block';
|
|
110
|
+
const existing = fs.existsSync(configFile) ? fs.readFileSync(configFile, 'utf8') : '';
|
|
111
|
+
let next = stripManagedBlock(existing, startMarker, endMarker).trim();
|
|
112
|
+
next = upsertFeatureFlags(next);
|
|
113
|
+
|
|
114
|
+
const managed = buildManagedBlock(root, options);
|
|
115
|
+
const output = `${next.trim()}\n\n${managed}\n`;
|
|
116
|
+
fs.writeFileSync(configFile, output, 'utf8');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
module.exports = { mergeConfig };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { Server } = require('@modelcontextprotocol/sdk/server');
|
|
3
|
+
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
4
|
+
const { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const fsp = require('fs/promises');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
function text(data) {
|
|
10
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function memoryPath(cwd) {
|
|
14
|
+
return path.join(cwd, '.omcodex', 'project-memory.json');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function notepadPath(cwd) {
|
|
18
|
+
return path.join(cwd, '.omcodex', 'notepad.md');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function tokenize(input) {
|
|
22
|
+
return String(input || '')
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replace(/[^\p{L}\p{N}\s]/gu, ' ')
|
|
25
|
+
.split(/\s+/)
|
|
26
|
+
.filter(Boolean);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function flattenJson(value, prefix = '') {
|
|
30
|
+
const docs = [];
|
|
31
|
+
if (value === null || value === undefined) return docs;
|
|
32
|
+
|
|
33
|
+
if (typeof value !== 'object') {
|
|
34
|
+
docs.push({ id: prefix || 'root', text: `${prefix}: ${String(value)}`, source: 'project-memory' });
|
|
35
|
+
return docs;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (Array.isArray(value)) {
|
|
39
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
40
|
+
const nextPrefix = prefix ? `${prefix}[${i}]` : `[${i}]`;
|
|
41
|
+
docs.push(...flattenJson(value[i], nextPrefix));
|
|
42
|
+
}
|
|
43
|
+
return docs;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const [key, child] of Object.entries(value)) {
|
|
47
|
+
const nextPrefix = prefix ? `${prefix}.${key}` : key;
|
|
48
|
+
docs.push(...flattenJson(child, nextPrefix));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return docs;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function scoreDocuments(query, docs, limit = 5) {
|
|
55
|
+
const queryTokens = tokenize(query);
|
|
56
|
+
if (queryTokens.length === 0) return [];
|
|
57
|
+
const querySet = new Set(queryTokens);
|
|
58
|
+
|
|
59
|
+
const df = {};
|
|
60
|
+
const tokenizedDocs = docs.map((doc) => {
|
|
61
|
+
const tokens = tokenize(doc.text);
|
|
62
|
+
const unique = new Set(tokens);
|
|
63
|
+
for (const token of unique) df[token] = (df[token] || 0) + 1;
|
|
64
|
+
return { doc, tokens };
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const idf = {};
|
|
68
|
+
const docCount = Math.max(1, tokenizedDocs.length);
|
|
69
|
+
for (const token of Object.keys(df)) {
|
|
70
|
+
idf[token] = Math.log((docCount + 1) / (df[token] + 1)) + 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const scored = tokenizedDocs.map(({ doc, tokens }) => {
|
|
74
|
+
const tf = {};
|
|
75
|
+
for (const token of tokens) tf[token] = (tf[token] || 0) + 1;
|
|
76
|
+
|
|
77
|
+
let dot = 0;
|
|
78
|
+
let qNorm = 0;
|
|
79
|
+
let dNorm = 0;
|
|
80
|
+
for (const token of querySet) {
|
|
81
|
+
const qWeight = idf[token] || 1;
|
|
82
|
+
const dWeight = (tf[token] || 0) * (idf[token] || 1);
|
|
83
|
+
dot += qWeight * dWeight;
|
|
84
|
+
qNorm += qWeight * qWeight;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
for (const [token, freq] of Object.entries(tf)) {
|
|
88
|
+
const weight = freq * (idf[token] || 1);
|
|
89
|
+
dNorm += weight * weight;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const cosine = qNorm > 0 && dNorm > 0 ? dot / (Math.sqrt(qNorm) * Math.sqrt(dNorm)) : 0;
|
|
93
|
+
const overlap = tokens.filter((token) => querySet.has(token)).length / Math.max(1, querySet.size);
|
|
94
|
+
const score = (cosine * 0.7) + (overlap * 0.3);
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
source: doc.source,
|
|
98
|
+
id: doc.id,
|
|
99
|
+
score: Number(score.toFixed(4)),
|
|
100
|
+
snippet: doc.text.slice(0, 280),
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return scored
|
|
105
|
+
.filter((item) => item.score > 0)
|
|
106
|
+
.sort((a, b) => b.score - a.score)
|
|
107
|
+
.slice(0, Math.max(1, Number(limit) || 5));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function loadSemanticDocuments(wd) {
|
|
111
|
+
const docs = [];
|
|
112
|
+
|
|
113
|
+
const memoryFile = memoryPath(wd);
|
|
114
|
+
if (fs.existsSync(memoryFile)) {
|
|
115
|
+
try {
|
|
116
|
+
const memory = JSON.parse(await fsp.readFile(memoryFile, 'utf8'));
|
|
117
|
+
docs.push(...flattenJson(memory));
|
|
118
|
+
} catch {}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const notesFile = notepadPath(wd);
|
|
122
|
+
if (fs.existsSync(notesFile)) {
|
|
123
|
+
const raw = await fsp.readFile(notesFile, 'utf8');
|
|
124
|
+
const blocks = raw.split(/\n{2,}/).map((item) => item.trim()).filter(Boolean);
|
|
125
|
+
for (let i = 0; i < blocks.length; i += 1) {
|
|
126
|
+
docs.push({
|
|
127
|
+
source: 'notepad',
|
|
128
|
+
id: `note-${i + 1}`,
|
|
129
|
+
text: blocks[i],
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return docs;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const server = new Server({ name: 'omcodex-memory', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
138
|
+
|
|
139
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
140
|
+
tools: [
|
|
141
|
+
{
|
|
142
|
+
name: 'project_memory_read',
|
|
143
|
+
description: 'Read project memory',
|
|
144
|
+
inputSchema: { type: 'object', properties: { workingDirectory: { type: 'string' } } },
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'project_memory_write',
|
|
148
|
+
description: 'Write project memory',
|
|
149
|
+
inputSchema: {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: { memory: { type: 'object' }, workingDirectory: { type: 'string' } },
|
|
152
|
+
required: ['memory'],
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'notepad_read',
|
|
157
|
+
description: 'Read notepad',
|
|
158
|
+
inputSchema: { type: 'object', properties: { workingDirectory: { type: 'string' } } },
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'notepad_write',
|
|
162
|
+
description: 'Append notepad entry',
|
|
163
|
+
inputSchema: {
|
|
164
|
+
type: 'object',
|
|
165
|
+
properties: { content: { type: 'string' }, workingDirectory: { type: 'string' } },
|
|
166
|
+
required: ['content'],
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'memory_search',
|
|
171
|
+
description: 'Semantic search across project memory and notepad',
|
|
172
|
+
inputSchema: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {
|
|
175
|
+
query: { type: 'string' },
|
|
176
|
+
limit: { type: 'number' },
|
|
177
|
+
workingDirectory: { type: 'string' },
|
|
178
|
+
},
|
|
179
|
+
required: ['query'],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
}));
|
|
184
|
+
|
|
185
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
186
|
+
const { name, arguments: args } = request.params;
|
|
187
|
+
const a = args || {};
|
|
188
|
+
const wd = typeof a.workingDirectory === 'string' ? a.workingDirectory : process.cwd();
|
|
189
|
+
|
|
190
|
+
if (name === 'project_memory_read') {
|
|
191
|
+
const file = memoryPath(wd);
|
|
192
|
+
if (!fs.existsSync(file)) return text({ exists: false });
|
|
193
|
+
const content = JSON.parse(await fsp.readFile(file, 'utf8'));
|
|
194
|
+
return text({ exists: true, memory: content });
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (name === 'project_memory_write') {
|
|
198
|
+
const file = memoryPath(wd);
|
|
199
|
+
await fsp.mkdir(path.dirname(file), { recursive: true });
|
|
200
|
+
await fsp.writeFile(file, `${JSON.stringify(a.memory, null, 2)}\n`, 'utf8');
|
|
201
|
+
return text({ success: true });
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (name === 'notepad_read') {
|
|
205
|
+
const file = notepadPath(wd);
|
|
206
|
+
if (!fs.existsSync(file)) return text({ exists: false, content: '' });
|
|
207
|
+
const content = await fsp.readFile(file, 'utf8');
|
|
208
|
+
return text({ exists: true, content });
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (name === 'notepad_write') {
|
|
212
|
+
const file = notepadPath(wd);
|
|
213
|
+
await fsp.mkdir(path.dirname(file), { recursive: true });
|
|
214
|
+
const entry = `\n[${new Date().toISOString()}] ${String(a.content)}\n`;
|
|
215
|
+
await fsp.appendFile(file, entry, 'utf8');
|
|
216
|
+
return text({ success: true });
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (name === 'memory_search') {
|
|
220
|
+
const docs = await loadSemanticDocuments(wd);
|
|
221
|
+
const matches = scoreDocuments(a.query, docs, a.limit);
|
|
222
|
+
return text({
|
|
223
|
+
total_documents: docs.length,
|
|
224
|
+
query: a.query,
|
|
225
|
+
count: matches.length,
|
|
226
|
+
matches,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
async function main() {
|
|
234
|
+
const transport = new StdioServerTransport();
|
|
235
|
+
await server.connect(transport);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
main().catch((error) => {
|
|
239
|
+
console.error(error);
|
|
240
|
+
process.exit(1);
|
|
241
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { Server } = require('@modelcontextprotocol/sdk/server');
|
|
3
|
+
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
4
|
+
const { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const fsp = require('fs/promises');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
const SUPPORTED_MODES = ['autopilot', 'ultrawork', 'ralph', 'ultraqa', 'plan', 'swarm', 'pipeline', 'ecomode'];
|
|
10
|
+
|
|
11
|
+
function statePath(cwd, mode) {
|
|
12
|
+
return path.join(cwd, '.omcodex', 'state', `${mode}-state.json`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function text(data) {
|
|
16
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const server = new Server({ name: 'omcodex-state', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
20
|
+
|
|
21
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
22
|
+
tools: [
|
|
23
|
+
{
|
|
24
|
+
name: 'state_read',
|
|
25
|
+
description: 'Read mode state',
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: { mode: { type: 'string', enum: SUPPORTED_MODES }, workingDirectory: { type: 'string' } },
|
|
29
|
+
required: ['mode'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'state_write',
|
|
34
|
+
description: 'Write mode state',
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
mode: { type: 'string', enum: SUPPORTED_MODES },
|
|
39
|
+
state: { type: 'object' },
|
|
40
|
+
workingDirectory: { type: 'string' },
|
|
41
|
+
},
|
|
42
|
+
required: ['mode', 'state'],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'state_clear',
|
|
47
|
+
description: 'Delete mode state',
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: { mode: { type: 'string', enum: SUPPORTED_MODES }, workingDirectory: { type: 'string' } },
|
|
51
|
+
required: ['mode'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'state_list_active',
|
|
56
|
+
description: 'List active mode states',
|
|
57
|
+
inputSchema: { type: 'object', properties: { workingDirectory: { type: 'string' } } },
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
63
|
+
const { name, arguments: args } = request.params;
|
|
64
|
+
const a = args || {};
|
|
65
|
+
const wd = typeof a.workingDirectory === 'string' ? a.workingDirectory : process.cwd();
|
|
66
|
+
|
|
67
|
+
if (name === 'state_read') {
|
|
68
|
+
const file = statePath(wd, a.mode);
|
|
69
|
+
if (!fs.existsSync(file)) return text({ exists: false });
|
|
70
|
+
const state = JSON.parse(await fsp.readFile(file, 'utf8'));
|
|
71
|
+
return text({ exists: true, state });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (name === 'state_write') {
|
|
75
|
+
const file = statePath(wd, a.mode);
|
|
76
|
+
await fsp.mkdir(path.dirname(file), { recursive: true });
|
|
77
|
+
await fsp.writeFile(file, `${JSON.stringify(a.state, null, 2)}\n`, 'utf8');
|
|
78
|
+
return text({ success: true });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (name === 'state_clear') {
|
|
82
|
+
const file = statePath(wd, a.mode);
|
|
83
|
+
if (fs.existsSync(file)) await fsp.unlink(file);
|
|
84
|
+
return text({ success: true });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (name === 'state_list_active') {
|
|
88
|
+
const stateDir = path.join(wd, '.omcodex', 'state');
|
|
89
|
+
if (!fs.existsSync(stateDir)) return text({ active: [] });
|
|
90
|
+
const files = (await fsp.readdir(stateDir)).filter((file) => file.endsWith('-state.json'));
|
|
91
|
+
const active = [];
|
|
92
|
+
for (const file of files) {
|
|
93
|
+
try {
|
|
94
|
+
const payload = JSON.parse(await fsp.readFile(path.join(stateDir, file), 'utf8'));
|
|
95
|
+
if (payload && payload.active) active.push(file.replace('-state.json', ''));
|
|
96
|
+
} catch {}
|
|
97
|
+
}
|
|
98
|
+
return text({ active });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
async function main() {
|
|
105
|
+
const transport = new StdioServerTransport();
|
|
106
|
+
await server.connect(transport);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
main().catch((error) => {
|
|
110
|
+
console.error(error);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { Server } = require('@modelcontextprotocol/sdk/server');
|
|
3
|
+
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
4
|
+
const { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const fsp = require('fs/promises');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
function text(data) {
|
|
10
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function readJsonl(logDir, last) {
|
|
14
|
+
if (!fs.existsSync(logDir)) return [];
|
|
15
|
+
const files = (await fsp.readdir(logDir)).filter((file) => file.endsWith('.jsonl')).sort();
|
|
16
|
+
const entries = [];
|
|
17
|
+
|
|
18
|
+
for (const file of files) {
|
|
19
|
+
const raw = await fsp.readFile(path.join(logDir, file), 'utf8');
|
|
20
|
+
for (const line of raw.split('\n')) {
|
|
21
|
+
if (!line.trim()) continue;
|
|
22
|
+
try {
|
|
23
|
+
entries.push(JSON.parse(line));
|
|
24
|
+
} catch {}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof last === 'number' && last > 0) return entries.slice(-last);
|
|
29
|
+
return entries;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isErrorEntry(entry) {
|
|
33
|
+
if (!entry || typeof entry !== 'object') return false;
|
|
34
|
+
if (entry.ok === false) return true;
|
|
35
|
+
if (typeof entry.status === 'string' && ['error', 'timeout', 'failed'].includes(entry.status)) return true;
|
|
36
|
+
if (typeof entry.error === 'string' && entry.error.trim() !== '') return true;
|
|
37
|
+
if (typeof entry.reason === 'string' && entry.reason.includes('failed')) return true;
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function summarizeByType(entries) {
|
|
42
|
+
const byType = {};
|
|
43
|
+
for (const item of entries) {
|
|
44
|
+
const type = item.type || 'unknown';
|
|
45
|
+
byType[type] = (byType[type] || 0) + 1;
|
|
46
|
+
}
|
|
47
|
+
return byType;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function buildRecommendations(entries) {
|
|
51
|
+
const recommendations = [];
|
|
52
|
+
const disabledNotify = entries.filter((entry) => entry.type === 'notify_dispatch' && entry.enabled === false).length;
|
|
53
|
+
const pluginErrors = entries.filter((entry) => entry.type === 'notify_plugin_dispatch' && entry.ok === false).length;
|
|
54
|
+
const teamFixTransitions = entries.filter((entry) => entry.type === 'team_auto_advance' && entry.to === 'team-fix').length;
|
|
55
|
+
const totalErrors = entries.filter((entry) => isErrorEntry(entry)).length;
|
|
56
|
+
|
|
57
|
+
if (disabledNotify > 0) {
|
|
58
|
+
recommendations.push({
|
|
59
|
+
skill: 'verify',
|
|
60
|
+
priority: 'high',
|
|
61
|
+
reason: `notify pipeline disabled ${disabledNotify} time(s); enable OMX_NOTIFY_PLUGINS=1 and validate plugins`,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (pluginErrors > 0) {
|
|
66
|
+
recommendations.push({
|
|
67
|
+
skill: 'build-fix',
|
|
68
|
+
priority: 'high',
|
|
69
|
+
reason: `notify plugins failed ${pluginErrors} time(s); run notify validate/test and fix plugin runtime`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (teamFixTransitions > 0) {
|
|
74
|
+
recommendations.push({
|
|
75
|
+
skill: 'ultraqa',
|
|
76
|
+
priority: 'medium',
|
|
77
|
+
reason: `team auto-flow entered fix loop ${teamFixTransitions} time(s); run QA loop before advancing`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (totalErrors > 0) {
|
|
82
|
+
recommendations.push({
|
|
83
|
+
skill: 'debug-analysis',
|
|
84
|
+
priority: 'medium',
|
|
85
|
+
reason: `found ${totalErrors} error-like trace entries; investigate root causes before scaling parallel work`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (recommendations.length === 0) {
|
|
90
|
+
recommendations.push({
|
|
91
|
+
skill: 'autopilot',
|
|
92
|
+
priority: 'low',
|
|
93
|
+
reason: 'no major issues detected in traces; continue feature execution',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return recommendations;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function diagnose(entries) {
|
|
101
|
+
const byType = summarizeByType(entries);
|
|
102
|
+
const allErrors = entries.filter((entry) => isErrorEntry(entry));
|
|
103
|
+
const recentErrors = allErrors.slice(-20);
|
|
104
|
+
return {
|
|
105
|
+
total: entries.length,
|
|
106
|
+
byType,
|
|
107
|
+
error_count: allErrors.length,
|
|
108
|
+
recent_errors: recentErrors,
|
|
109
|
+
recommendations: buildRecommendations(entries),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const server = new Server({ name: 'omcodex-trace', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
114
|
+
|
|
115
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
116
|
+
tools: [
|
|
117
|
+
{
|
|
118
|
+
name: 'trace_timeline',
|
|
119
|
+
description: 'Read recent trace entries',
|
|
120
|
+
inputSchema: { type: 'object', properties: { last: { type: 'number' }, workingDirectory: { type: 'string' } } },
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'trace_summary',
|
|
124
|
+
description: 'Get trace summary counters',
|
|
125
|
+
inputSchema: { type: 'object', properties: { workingDirectory: { type: 'string' } } },
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'trace_diagnose',
|
|
129
|
+
description: 'Diagnose trace patterns and recommend next skills',
|
|
130
|
+
inputSchema: { type: 'object', properties: { last: { type: 'number' }, workingDirectory: { type: 'string' } } },
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
}));
|
|
134
|
+
|
|
135
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
136
|
+
const { name, arguments: args } = request.params;
|
|
137
|
+
const a = args || {};
|
|
138
|
+
const wd = typeof a.workingDirectory === 'string' ? a.workingDirectory : process.cwd();
|
|
139
|
+
const logsDir = path.join(wd, '.omcodex', 'logs');
|
|
140
|
+
|
|
141
|
+
if (name === 'trace_timeline') {
|
|
142
|
+
const entries = await readJsonl(logsDir, a.last);
|
|
143
|
+
return text({ count: entries.length, entries });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (name === 'trace_summary') {
|
|
147
|
+
const entries = await readJsonl(logsDir);
|
|
148
|
+
const byType = summarizeByType(entries);
|
|
149
|
+
return text({ total: entries.length, byType });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (name === 'trace_diagnose') {
|
|
153
|
+
const entries = await readJsonl(logsDir, a.last);
|
|
154
|
+
return text(diagnose(entries));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
async function main() {
|
|
161
|
+
const transport = new StdioServerTransport();
|
|
162
|
+
await server.connect(transport);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
main().catch((error) => {
|
|
166
|
+
console.error(error);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
});
|