@laitszkin/apollo-toolkit 3.13.2 → 3.14.1
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/AGENTS.md +7 -7
- package/CHANGELOG.md +36 -0
- package/CLAUDE.md +8 -8
- package/analyse-app-logs/SKILL.md +3 -3
- package/bin/apollo-toolkit.ts +7 -0
- package/codex/codex-memory-manager/SKILL.md +2 -2
- package/codex/learn-skill-from-conversations/SKILL.md +3 -3
- package/dist/bin/apollo-toolkit.d.ts +2 -0
- package/dist/bin/apollo-toolkit.js +7 -0
- package/dist/lib/cli.d.ts +41 -0
- package/dist/lib/cli.js +655 -0
- package/dist/lib/installer.d.ts +59 -0
- package/dist/lib/installer.js +404 -0
- package/dist/lib/tool-runner.d.ts +19 -0
- package/dist/lib/tool-runner.js +536 -0
- package/dist/lib/tools/architecture.d.ts +2 -0
- package/dist/lib/tools/architecture.js +23 -0
- package/dist/lib/tools/create-specs.d.ts +2 -0
- package/dist/lib/tools/create-specs.js +175 -0
- package/dist/lib/tools/docs-to-voice.d.ts +2 -0
- package/dist/lib/tools/docs-to-voice.js +705 -0
- package/dist/lib/tools/enforce-video-aspect-ratio.d.ts +2 -0
- package/dist/lib/tools/enforce-video-aspect-ratio.js +312 -0
- package/dist/lib/tools/extract-conversations.d.ts +2 -0
- package/dist/lib/tools/extract-conversations.js +105 -0
- package/dist/lib/tools/extract-pdf-text.d.ts +2 -0
- package/dist/lib/tools/extract-pdf-text.js +92 -0
- package/dist/lib/tools/filter-logs.d.ts +2 -0
- package/dist/lib/tools/filter-logs.js +94 -0
- package/dist/lib/tools/find-github-issues.d.ts +2 -0
- package/dist/lib/tools/find-github-issues.js +176 -0
- package/dist/lib/tools/generate-storyboard-images.d.ts +2 -0
- package/dist/lib/tools/generate-storyboard-images.js +419 -0
- package/dist/lib/tools/log-cli-utils.d.ts +35 -0
- package/dist/lib/tools/log-cli-utils.js +233 -0
- package/dist/lib/tools/open-github-issue.d.ts +2 -0
- package/dist/lib/tools/open-github-issue.js +750 -0
- package/dist/lib/tools/read-github-issue.d.ts +2 -0
- package/dist/lib/tools/read-github-issue.js +134 -0
- package/dist/lib/tools/render-error-book.d.ts +2 -0
- package/dist/lib/tools/render-error-book.js +265 -0
- package/dist/lib/tools/render-katex.d.ts +2 -0
- package/dist/lib/tools/render-katex.js +294 -0
- package/dist/lib/tools/review-threads.d.ts +2 -0
- package/dist/lib/tools/review-threads.js +491 -0
- package/dist/lib/tools/search-logs.d.ts +2 -0
- package/dist/lib/tools/search-logs.js +164 -0
- package/dist/lib/tools/sync-memory-index.d.ts +2 -0
- package/dist/lib/tools/sync-memory-index.js +113 -0
- package/dist/lib/tools/validate-openai-agent-config.d.ts +2 -0
- package/dist/lib/tools/validate-openai-agent-config.js +190 -0
- package/dist/lib/tools/validate-skill-frontmatter.d.ts +2 -0
- package/dist/lib/tools/validate-skill-frontmatter.js +118 -0
- package/dist/lib/types.d.ts +82 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/updater.d.ts +34 -0
- package/dist/lib/updater.js +112 -0
- package/dist/lib/utils/format.d.ts +2 -0
- package/dist/lib/utils/format.js +6 -0
- package/dist/lib/utils/terminal.d.ts +12 -0
- package/dist/lib/utils/terminal.js +26 -0
- package/docs-to-voice/SKILL.md +0 -1
- package/generate-spec/SKILL.md +1 -1
- package/katex/SKILL.md +1 -2
- package/lib/cli.ts +780 -0
- package/lib/installer.ts +466 -0
- package/lib/tool-runner.ts +561 -0
- package/lib/tools/architecture.ts +20 -0
- package/lib/tools/create-specs.ts +204 -0
- package/lib/tools/docs-to-voice.ts +799 -0
- package/lib/tools/enforce-video-aspect-ratio.ts +368 -0
- package/lib/tools/extract-conversations.ts +114 -0
- package/lib/tools/extract-pdf-text.ts +99 -0
- package/lib/tools/filter-logs.ts +118 -0
- package/lib/tools/find-github-issues.ts +211 -0
- package/lib/tools/generate-storyboard-images.ts +455 -0
- package/lib/tools/log-cli-utils.ts +262 -0
- package/lib/tools/open-github-issue.ts +930 -0
- package/lib/tools/read-github-issue.ts +179 -0
- package/lib/tools/render-error-book.ts +300 -0
- package/lib/tools/render-katex.ts +325 -0
- package/lib/tools/review-threads.ts +590 -0
- package/lib/tools/search-logs.ts +200 -0
- package/lib/tools/sync-memory-index.ts +114 -0
- package/lib/tools/validate-openai-agent-config.ts +213 -0
- package/lib/tools/validate-skill-frontmatter.ts +124 -0
- package/lib/types.ts +90 -0
- package/lib/updater.ts +165 -0
- package/lib/utils/format.ts +7 -0
- package/lib/utils/terminal.ts +22 -0
- package/open-github-issue/SKILL.md +2 -2
- package/optimise-skill/SKILL.md +1 -1
- package/package.json +13 -4
- package/resources/project-architecture/assets/architecture.css +764 -0
- package/resources/project-architecture/assets/viewer.client.js +144 -0
- package/resources/project-architecture/index.html +42 -0
- package/review-spec-related-changes/SKILL.md +1 -1
- package/solve-issues-found-during-review/SKILL.md +2 -1
- package/tsconfig.json +28 -0
- package/analyse-app-logs/scripts/__pycache__/filter_logs_by_time.cpython-312.pyc +0 -0
- package/analyse-app-logs/scripts/__pycache__/log_cli_utils.cpython-312.pyc +0 -0
- package/analyse-app-logs/scripts/__pycache__/search_logs.cpython-312.pyc +0 -0
- package/analyse-app-logs/scripts/filter_logs_by_time.py +0 -64
- package/analyse-app-logs/scripts/log_cli_utils.py +0 -112
- package/analyse-app-logs/scripts/search_logs.py +0 -137
- package/analyse-app-logs/tests/test_filter_logs_by_time.py +0 -95
- package/analyse-app-logs/tests/test_search_logs.py +0 -100
- package/codex/codex-memory-manager/scripts/extract_recent_conversations.py +0 -369
- package/codex/codex-memory-manager/scripts/sync_memory_index.py +0 -130
- package/codex/codex-memory-manager/tests/test_extract_recent_conversations.py +0 -177
- package/codex/codex-memory-manager/tests/test_memory_template.py +0 -37
- package/codex/codex-memory-manager/tests/test_sync_memory_index.py +0 -84
- package/codex/learn-skill-from-conversations/scripts/extract_recent_conversations.py +0 -369
- package/codex/learn-skill-from-conversations/tests/test_extract_recent_conversations.py +0 -177
- package/docs-to-voice/scripts/__pycache__/docs_to_voice.cpython-312.pyc +0 -0
- package/docs-to-voice/scripts/docs_to_voice.py +0 -1385
- package/docs-to-voice/scripts/docs_to_voice.sh +0 -11
- package/docs-to-voice/tests/test_docs_to_voice_api_max_chars.py +0 -210
- package/docs-to-voice/tests/test_docs_to_voice_sentence_timeline.py +0 -115
- package/docs-to-voice/tests/test_docs_to_voice_settings.py +0 -43
- package/docs-to-voice/tests/test_docs_to_voice_shell_wrapper.py +0 -51
- package/docs-to-voice/tests/test_docs_to_voice_speech_rate.py +0 -57
- package/generate-spec/scripts/__pycache__/create-specscpython-312.pyc +0 -0
- package/generate-spec/scripts/create-specs +0 -215
- package/generate-spec/tests/test_create_specs.py +0 -200
- package/init-project-html/scripts/architecture-bootstrap-render.js +0 -16
- package/init-project-html/scripts/architecture.js +0 -296
- package/katex/scripts/__pycache__/render_katex.cpython-312.pyc +0 -0
- package/katex/scripts/render_katex.py +0 -247
- package/katex/scripts/render_katex.sh +0 -11
- package/katex/tests/test_render_katex.py +0 -174
- package/learning-error-book/scripts/render_error_book_json_to_pdf.py +0 -590
- package/learning-error-book/tests/test_render_error_book_json_to_pdf.py +0 -134
- package/open-github-issue/scripts/__pycache__/open_github_issue.cpython-312.pyc +0 -0
- package/open-github-issue/scripts/open_github_issue.py +0 -705
- package/open-github-issue/tests/test_open_github_issue.py +0 -381
- package/openai-text-to-image-storyboard/scripts/generate_storyboard_images.py +0 -763
- package/openai-text-to-image-storyboard/tests/test_generate_storyboard_images.py +0 -177
- package/read-github-issue/scripts/__pycache__/find_issues.cpython-312.pyc +0 -0
- package/read-github-issue/scripts/__pycache__/read_issue.cpython-312.pyc +0 -0
- package/read-github-issue/scripts/find_issues.py +0 -148
- package/read-github-issue/scripts/read_issue.py +0 -108
- package/read-github-issue/tests/test_find_issues.py +0 -127
- package/read-github-issue/tests/test_read_issue.py +0 -109
- package/resolve-review-comments/scripts/__pycache__/review_threads.cpython-312.pyc +0 -0
- package/resolve-review-comments/scripts/review_threads.py +0 -425
- package/resolve-review-comments/tests/test_review_threads.py +0 -74
- package/scripts/validate_openai_agent_config.py +0 -209
- package/scripts/validate_skill_frontmatter.py +0 -131
- package/text-to-short-video/scripts/__pycache__/enforce_video_aspect_ratio.cpython-312.pyc +0 -0
- package/text-to-short-video/scripts/enforce_video_aspect_ratio.py +0 -350
- package/text-to-short-video/tests/test_enforce_video_aspect_ratio.py +0 -194
- package/weekly-financial-event-report/scripts/extract_pdf_text_pdfkit.swift +0 -99
- package/weekly-financial-event-report/tests/test_extract_pdf_text_pdfkit.py +0 -64
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderKatexHandler = renderKatexHandler;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
function parseArgs(args) {
|
|
11
|
+
const parsed = {
|
|
12
|
+
tex: null,
|
|
13
|
+
inputFile: null,
|
|
14
|
+
outputFormat: 'html-fragment',
|
|
15
|
+
katexFormat: 'htmlAndMathml',
|
|
16
|
+
displayMode: false,
|
|
17
|
+
leqno: false,
|
|
18
|
+
fleqn: false,
|
|
19
|
+
colorIsTextColor: false,
|
|
20
|
+
noThrowOnError: false,
|
|
21
|
+
outputFile: null,
|
|
22
|
+
cssHref: 'https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/katex.min.css',
|
|
23
|
+
title: 'KaTeX Render',
|
|
24
|
+
lang: 'en',
|
|
25
|
+
help: false,
|
|
26
|
+
macro: [],
|
|
27
|
+
macroFile: null,
|
|
28
|
+
errorColor: null,
|
|
29
|
+
strict: null,
|
|
30
|
+
trust: null,
|
|
31
|
+
maxSize: null,
|
|
32
|
+
maxExpand: null,
|
|
33
|
+
minRuleThickness: null,
|
|
34
|
+
};
|
|
35
|
+
for (let i = 0; i < args.length; i++) {
|
|
36
|
+
const arg = args[i];
|
|
37
|
+
if (arg === '--help' || arg === '-h') {
|
|
38
|
+
parsed.help = true;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (arg.startsWith('--')) {
|
|
42
|
+
const eqIndex = arg.indexOf('=');
|
|
43
|
+
let key;
|
|
44
|
+
let value;
|
|
45
|
+
if (eqIndex !== -1) {
|
|
46
|
+
key = arg.slice(2, eqIndex);
|
|
47
|
+
value = arg.slice(eqIndex + 1);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
key = arg.slice(2);
|
|
51
|
+
const next = args[i + 1];
|
|
52
|
+
if (next !== undefined && !next.startsWith('--')) {
|
|
53
|
+
value = next;
|
|
54
|
+
i++;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
value = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
switch (key) {
|
|
61
|
+
case 'tex':
|
|
62
|
+
parsed.tex = String(value);
|
|
63
|
+
break;
|
|
64
|
+
case 'input-file':
|
|
65
|
+
parsed.inputFile = String(value);
|
|
66
|
+
break;
|
|
67
|
+
case 'output-format':
|
|
68
|
+
if (['html-fragment', 'html-page', 'markdown-inline', 'markdown-block', 'json'].includes(String(value))) {
|
|
69
|
+
parsed.outputFormat = String(value);
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case 'katex-format':
|
|
73
|
+
if (['html', 'mathml', 'htmlAndMathml'].includes(String(value))) {
|
|
74
|
+
parsed.katexFormat = String(value);
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case 'display-mode':
|
|
78
|
+
parsed.displayMode = value === true || value === 'true';
|
|
79
|
+
break;
|
|
80
|
+
case 'leqno':
|
|
81
|
+
parsed.leqno = value === true || value === 'true';
|
|
82
|
+
break;
|
|
83
|
+
case 'fleqn':
|
|
84
|
+
parsed.fleqn = value === true || value === 'true';
|
|
85
|
+
break;
|
|
86
|
+
case 'color-is-text-color':
|
|
87
|
+
parsed.colorIsTextColor = value === true || value === 'true';
|
|
88
|
+
break;
|
|
89
|
+
case 'no-throw-on-error':
|
|
90
|
+
parsed.noThrowOnError = value === true || value === 'true';
|
|
91
|
+
break;
|
|
92
|
+
case 'output-file':
|
|
93
|
+
parsed.outputFile = String(value);
|
|
94
|
+
break;
|
|
95
|
+
case 'css-href':
|
|
96
|
+
parsed.cssHref = String(value);
|
|
97
|
+
break;
|
|
98
|
+
case 'title':
|
|
99
|
+
parsed.title = String(value);
|
|
100
|
+
break;
|
|
101
|
+
case 'lang':
|
|
102
|
+
parsed.lang = String(value);
|
|
103
|
+
break;
|
|
104
|
+
case 'macro':
|
|
105
|
+
parsed.macro.push(String(value));
|
|
106
|
+
break;
|
|
107
|
+
case 'macro-file':
|
|
108
|
+
parsed.macroFile = String(value);
|
|
109
|
+
break;
|
|
110
|
+
case 'error-color':
|
|
111
|
+
parsed.errorColor = String(value);
|
|
112
|
+
break;
|
|
113
|
+
case 'strict':
|
|
114
|
+
parsed.strict = String(value);
|
|
115
|
+
break;
|
|
116
|
+
case 'trust':
|
|
117
|
+
parsed.trust = String(value);
|
|
118
|
+
break;
|
|
119
|
+
case 'max-size':
|
|
120
|
+
parsed.maxSize = Number(value);
|
|
121
|
+
break;
|
|
122
|
+
case 'max-expand':
|
|
123
|
+
parsed.maxExpand = Number(value);
|
|
124
|
+
break;
|
|
125
|
+
case 'min-rule-thickness':
|
|
126
|
+
parsed.minRuleThickness = Number(value);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return parsed;
|
|
132
|
+
}
|
|
133
|
+
function loadTex(opts) {
|
|
134
|
+
if (opts.inputFile) {
|
|
135
|
+
const inputPath = node_path_1.default.resolve(opts.inputFile);
|
|
136
|
+
if (!node_fs_1.default.existsSync(inputPath)) {
|
|
137
|
+
throw new Error(`Input file not found: ${inputPath}`);
|
|
138
|
+
}
|
|
139
|
+
return node_fs_1.default.readFileSync(inputPath, 'utf-8').trim();
|
|
140
|
+
}
|
|
141
|
+
return (opts.tex || '').trim();
|
|
142
|
+
}
|
|
143
|
+
function buildHtmlPage(renderedHtml, opts) {
|
|
144
|
+
const cssLink = opts.cssHref
|
|
145
|
+
? ` <link rel="stylesheet" href="${opts.cssHref}">\n`
|
|
146
|
+
: '';
|
|
147
|
+
return ('<!DOCTYPE html>\n' +
|
|
148
|
+
`<html lang="${opts.lang}">\n` +
|
|
149
|
+
'<head>\n' +
|
|
150
|
+
' <meta charset="utf-8">\n' +
|
|
151
|
+
` <title>${opts.title}</title>\n` +
|
|
152
|
+
cssLink +
|
|
153
|
+
'</head>\n' +
|
|
154
|
+
'<body>\n' +
|
|
155
|
+
`${renderedHtml}\n` +
|
|
156
|
+
'</body>\n' +
|
|
157
|
+
'</html>\n');
|
|
158
|
+
}
|
|
159
|
+
function wrapOutput(renderedHtml, tex, opts) {
|
|
160
|
+
switch (opts.outputFormat) {
|
|
161
|
+
case 'html-fragment':
|
|
162
|
+
return `${renderedHtml}\n`;
|
|
163
|
+
case 'html-page':
|
|
164
|
+
return buildHtmlPage(renderedHtml, opts);
|
|
165
|
+
case 'markdown-inline':
|
|
166
|
+
return `${renderedHtml}\n`;
|
|
167
|
+
case 'markdown-block':
|
|
168
|
+
return `\n${renderedHtml}\n`;
|
|
169
|
+
case 'json':
|
|
170
|
+
return JSON.stringify({
|
|
171
|
+
tex,
|
|
172
|
+
displayMode: opts.displayMode,
|
|
173
|
+
katexFormat: opts.katexFormat,
|
|
174
|
+
cssHref: opts.cssHref,
|
|
175
|
+
content: renderedHtml,
|
|
176
|
+
}, null, 2) + '\n';
|
|
177
|
+
default:
|
|
178
|
+
throw new Error(`Unsupported output format: ${opts.outputFormat}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function writeOutput(content, outputFile, stdout) {
|
|
182
|
+
if (!outputFile) {
|
|
183
|
+
stdout.write(content);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const outputPath = node_path_1.default.resolve(outputFile);
|
|
187
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(outputPath), { recursive: true });
|
|
188
|
+
node_fs_1.default.writeFileSync(outputPath, content, 'utf-8');
|
|
189
|
+
stdout.write(`${outputPath}\n`);
|
|
190
|
+
}
|
|
191
|
+
async function renderKatexHandler(args, context) {
|
|
192
|
+
const stdout = context.stdout || process.stdout;
|
|
193
|
+
const stderr = context.stderr || process.stderr;
|
|
194
|
+
try {
|
|
195
|
+
const opts = parseArgs(args);
|
|
196
|
+
if (opts.help) {
|
|
197
|
+
stdout.write(`Usage: apltk render-katex [options]
|
|
198
|
+
|
|
199
|
+
Render TeX with KaTeX and emit insertion-ready output.
|
|
200
|
+
|
|
201
|
+
Options:
|
|
202
|
+
--tex <string> Raw TeX expression without delimiters
|
|
203
|
+
--input-file <path> Path to a text file containing raw TeX
|
|
204
|
+
--output-format <format> html-fragment (default) | html-page | markdown-inline | markdown-block | json
|
|
205
|
+
--katex-format <format> html | mathml | htmlAndMathml (default)
|
|
206
|
+
--display-mode Render in display mode
|
|
207
|
+
--output-file <path> Write output to a file
|
|
208
|
+
--css-href <url> Stylesheet href (default: KaTeX CDN)
|
|
209
|
+
--title <text> Document title for html-page
|
|
210
|
+
--lang <code> HTML lang attribute (default: en)
|
|
211
|
+
`);
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
const tex = loadTex(opts);
|
|
215
|
+
if (!tex) {
|
|
216
|
+
stderr.write('Error: Input TeX is empty.\n');
|
|
217
|
+
return 1;
|
|
218
|
+
}
|
|
219
|
+
// Build npx katex command
|
|
220
|
+
const cmdArgs = [
|
|
221
|
+
'npx',
|
|
222
|
+
'--yes',
|
|
223
|
+
'--package',
|
|
224
|
+
'katex',
|
|
225
|
+
'katex',
|
|
226
|
+
'--format',
|
|
227
|
+
opts.katexFormat,
|
|
228
|
+
];
|
|
229
|
+
if (opts.displayMode)
|
|
230
|
+
cmdArgs.push('--display-mode');
|
|
231
|
+
if (opts.leqno === true)
|
|
232
|
+
cmdArgs.push('--leqno');
|
|
233
|
+
if (opts.fleqn === true)
|
|
234
|
+
cmdArgs.push('--fleqn');
|
|
235
|
+
if (opts.colorIsTextColor === true)
|
|
236
|
+
cmdArgs.push('--color-is-text-color');
|
|
237
|
+
if (opts.noThrowOnError === true)
|
|
238
|
+
cmdArgs.push('--no-throw-on-error');
|
|
239
|
+
if (opts.errorColor)
|
|
240
|
+
cmdArgs.push('--error-color', opts.errorColor);
|
|
241
|
+
if (opts.strict)
|
|
242
|
+
cmdArgs.push('--strict', opts.strict);
|
|
243
|
+
if (opts.trust)
|
|
244
|
+
cmdArgs.push('--trust', opts.trust);
|
|
245
|
+
if (opts.maxSize !== null)
|
|
246
|
+
cmdArgs.push('--max-size', String(opts.maxSize));
|
|
247
|
+
if (opts.maxExpand !== null)
|
|
248
|
+
cmdArgs.push('--max-expand', String(opts.maxExpand));
|
|
249
|
+
if (opts.minRuleThickness !== null)
|
|
250
|
+
cmdArgs.push('--min-rule-thickness', String(opts.minRuleThickness));
|
|
251
|
+
// Handle macro args
|
|
252
|
+
for (const macro of opts.macro) {
|
|
253
|
+
cmdArgs.push('--macro', macro);
|
|
254
|
+
}
|
|
255
|
+
if (opts.macroFile)
|
|
256
|
+
cmdArgs.push('--macro-file', opts.macroFile);
|
|
257
|
+
// Write tex to temp file and pass it to katex
|
|
258
|
+
const tmpFile = node_path_1.default.join(node_fs_1.default.mkdtempSync('katex-'), 'input.tex');
|
|
259
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(tmpFile), { recursive: true });
|
|
260
|
+
node_fs_1.default.writeFileSync(tmpFile, tex + '\n', 'utf-8');
|
|
261
|
+
cmdArgs.push('--input', tmpFile);
|
|
262
|
+
let renderedHtml;
|
|
263
|
+
try {
|
|
264
|
+
const result = (0, node_child_process_1.execSync)(cmdArgs.join(' '), {
|
|
265
|
+
encoding: 'utf-8',
|
|
266
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
267
|
+
timeout: 60000,
|
|
268
|
+
});
|
|
269
|
+
renderedHtml = result.trim();
|
|
270
|
+
}
|
|
271
|
+
catch (err) {
|
|
272
|
+
const message = err instanceof Error ? err.message : 'KaTeX CLI failed.';
|
|
273
|
+
stderr.write(`Error: ${message}\n`);
|
|
274
|
+
return 1;
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
try {
|
|
278
|
+
node_fs_1.default.unlinkSync(tmpFile);
|
|
279
|
+
node_fs_1.default.rmdirSync(node_path_1.default.dirname(tmpFile));
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
// ignore cleanup errors
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const wrapped = wrapOutput(renderedHtml, tex, opts);
|
|
286
|
+
writeOutput(wrapped, opts.outputFile, stdout);
|
|
287
|
+
return 0;
|
|
288
|
+
}
|
|
289
|
+
catch (err) {
|
|
290
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
291
|
+
stderr.write(`Error: ${message}\n`);
|
|
292
|
+
return 1;
|
|
293
|
+
}
|
|
294
|
+
}
|