shizai-agent-mcp 0.2.8 → 0.2.9

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/README.md CHANGED
@@ -24,7 +24,7 @@ npx -y shizai-agent-mcp path
24
24
  npx -y shizai-agent-mcp uninstall
25
25
  ```
26
26
 
27
- 当前 npm launcher 版本为 `0.2.8`,默认下载最新的 `v0.6.7` Windows x64 资产:
27
+ 当前 npm launcher 版本为 `0.2.9`,默认下载最新的 `v0.6.7` Windows x64 资产:
28
28
  `shizai-agent-v0.6.7-windows-x64.zip`。npm 包不附带浏览器自动化依赖,也不要求用户安装额外扩展。
29
29
 
30
30
  `install` 覆盖文件后会自动注册 Codex MCP;需要跳过配置写入时使用
@@ -199,12 +199,22 @@ function install(version, options = {}) {
199
199
  if (fs.existsSync(backup) && fs.existsSync(destination)) removeDirectoryWithRetries(backup);
200
200
  }
201
201
  }
202
- function replaceTomlSection(content, section, replacement) {
203
- const escaped = section.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
204
- const pattern = new RegExp(`^\\[${escaped}\\]\\r?\\n[\\s\\S]*?(?=^\\[|$)`, 'm');
205
- const next = content.replace(pattern, '').trimEnd();
206
- return `${next}${next ? '\r\n\r\n' : ''}${replacement.trim()}\r\n`;
207
- }
202
+ function replaceTomlSection(content, section, replacement) {
203
+ const header = `[${section}]`;
204
+ const lines = String(content || '').split(/\r?\n/);
205
+ const kept = [];
206
+ let skipping = false;
207
+ for (const line of lines) {
208
+ if (line.trim() === header) {
209
+ skipping = true;
210
+ continue;
211
+ }
212
+ if (skipping && /^\s*\[.*\]\s*$/.test(line)) skipping = false;
213
+ if (!skipping) kept.push(line);
214
+ }
215
+ const next = kept.join('\n').trimEnd();
216
+ return `${next}${next ? '\r\n\r\n' : ''}${replacement.trim()}\r\n`;
217
+ }
208
218
  function tomlString(value) { return JSON.stringify(String(value)); }
209
219
  function registerCodex(silent = false) {
210
220
  const config = process.env.SHIZAI_CODEX_CONFIG || path.join(os.homedir(), '.codex', 'config.toml');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shizai-agent-mcp",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Installer and launcher for the Shizai Agent local MCP server",
5
5
  "bin": {
6
6
  "shizai-agent-mcp": "bin/shizai-agent-mcp.js"