mirror of
https://github.com/Done-0/fuck-u-code.git
synced 2026-05-22 20:40:36 +08:00
- Add comprehensive JSON schema field descriptions with i18n support (en, zh, ru) - Fix shell script parsing by adding graceful fallback to regex parser when tree-sitter fails - Change MCP server default output format from markdown to JSON for better AI integration - Improve parser error handling with automatic fallback mechanism - Add detailed field explanations in $schema for better AI comprehension - Bump version to 2.2.0 Breaking changes: - MCP server now returns JSON format by default instead of markdown
51 lines
1.1 KiB
JavaScript
Executable File
51 lines
1.1 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { spawn } from 'child_process';
|
|
import { fileURLToPath } from 'url';
|
|
import { dirname, join } from 'path';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
const hasMemoryFlag = process.execArgv.some(arg => arg.startsWith('--max-old-space-size'));
|
|
|
|
if (!hasMemoryFlag) {
|
|
const args = [
|
|
'--max-old-space-size=8192',
|
|
join(__dirname, '..', 'dist', 'index.js'),
|
|
...process.argv.slice(2)
|
|
];
|
|
|
|
const child = spawn(process.execPath, args, {
|
|
stdio: ['inherit', 'inherit', 'pipe'],
|
|
env: process.env
|
|
});
|
|
|
|
let inFatalError = false;
|
|
|
|
child.stderr.on('data', (data) => {
|
|
const text = data.toString();
|
|
|
|
if (text.includes('Fatal process out of memory') || text.includes('Native stack trace')) {
|
|
inFatalError = true;
|
|
return;
|
|
}
|
|
|
|
if (inFatalError) {
|
|
return;
|
|
}
|
|
|
|
process.stderr.write(data);
|
|
});
|
|
|
|
child.on('exit', (code) => {
|
|
if (code === 133 && inFatalError) {
|
|
process.exit(0);
|
|
} else {
|
|
process.exit(code || 0);
|
|
}
|
|
});
|
|
} else {
|
|
import('../dist/index.js');
|
|
}
|