oh-my-codex-cli 0.1.0 → 0.2.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/package.json
CHANGED
package/src/config/generator.js
CHANGED
|
@@ -61,22 +61,16 @@ function upsertFeatureFlags(config) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function buildManagedBlock(root, options = {}) {
|
|
64
|
-
const notifyScript = path.join(root, 'scripts', 'notify-dispatch.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
65
64
|
const stateServer = path.join(root, 'src', 'mcp', 'state-server.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
66
65
|
const memoryServer = path.join(root, 'src', 'mcp', 'memory-server.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
67
66
|
const traceServer = path.join(root, 'src', 'mcp', 'trace-server.js').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
68
67
|
const includeContext7 = options.enableContext7 === true;
|
|
68
|
+
const includeOpenaiDocs = options.includeOpenaiDocs !== false;
|
|
69
69
|
|
|
70
70
|
const lines = [
|
|
71
71
|
'# ============================================================',
|
|
72
72
|
'# oh-my-codex managed block',
|
|
73
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
74
|
'[mcp_servers.omcodex_state]',
|
|
81
75
|
'command = "node"',
|
|
82
76
|
`args = ["${stateServer}"]`,
|
|
@@ -93,7 +87,11 @@ function buildManagedBlock(root, options = {}) {
|
|
|
93
87
|
'enabled = true',
|
|
94
88
|
];
|
|
95
89
|
|
|
96
|
-
if (
|
|
90
|
+
if (includeOpenaiDocs) {
|
|
91
|
+
lines.push('', '[mcp_servers.openaiDeveloperDocs]', 'url = "https://developers.openai.com/mcp"', 'enabled = true');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (includeContext7 && options.includeContext7Server !== false) {
|
|
97
95
|
lines.push('', '[mcp_servers.context7]', 'command = "npx"', 'args = ["-y", "@upstash/context7-mcp"]', 'enabled = true');
|
|
98
96
|
}
|
|
99
97
|
|
|
@@ -101,6 +99,12 @@ function buildManagedBlock(root, options = {}) {
|
|
|
101
99
|
return lines.join('\n');
|
|
102
100
|
}
|
|
103
101
|
|
|
102
|
+
function hasSection(config, sectionName) {
|
|
103
|
+
const escaped = sectionName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
104
|
+
const pattern = new RegExp(`^\\s*\\[${escaped}\\]\\s*$`, 'm');
|
|
105
|
+
return pattern.test(config);
|
|
106
|
+
}
|
|
107
|
+
|
|
104
108
|
function mergeConfig(configFile, root, options = {}) {
|
|
105
109
|
const dir = path.dirname(configFile);
|
|
106
110
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -111,7 +115,11 @@ function mergeConfig(configFile, root, options = {}) {
|
|
|
111
115
|
let next = stripManagedBlock(existing, startMarker, endMarker).trim();
|
|
112
116
|
next = upsertFeatureFlags(next);
|
|
113
117
|
|
|
114
|
-
const managed = buildManagedBlock(root,
|
|
118
|
+
const managed = buildManagedBlock(root, {
|
|
119
|
+
...options,
|
|
120
|
+
includeOpenaiDocs: !hasSection(next, 'mcp_servers.openaiDeveloperDocs'),
|
|
121
|
+
includeContext7Server: !hasSection(next, 'mcp_servers.context7'),
|
|
122
|
+
});
|
|
115
123
|
const output = `${next.trim()}\n\n${managed}\n`;
|
|
116
124
|
fs.writeFileSync(configFile, output, 'utf8');
|
|
117
125
|
}
|