kern-lang 1.0.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/LICENSE +661 -0
- package/README.md +304 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +244 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +46 -0
- package/dist/config.js +54 -0
- package/dist/config.js.map +1 -0
- package/dist/context-export.d.ts +11 -0
- package/dist/context-export.js +121 -0
- package/dist/context-export.js.map +1 -0
- package/dist/decompiler.d.ts +2 -0
- package/dist/decompiler.js +44 -0
- package/dist/decompiler.js.map +1 -0
- package/dist/draft-protocol.d.ts +27 -0
- package/dist/draft-protocol.js +135 -0
- package/dist/draft-protocol.js.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +40 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics.d.ts +30 -0
- package/dist/metrics.js +182 -0
- package/dist/metrics.js.map +1 -0
- package/dist/parser.d.ts +4 -0
- package/dist/parser.js +361 -0
- package/dist/parser.js.map +1 -0
- package/dist/spec.d.ts +17 -0
- package/dist/spec.js +86 -0
- package/dist/spec.js.map +1 -0
- package/dist/styles-react.d.ts +3 -0
- package/dist/styles-react.js +20 -0
- package/dist/styles-react.js.map +1 -0
- package/dist/styles-tailwind.d.ts +8 -0
- package/dist/styles-tailwind.js +197 -0
- package/dist/styles-tailwind.js.map +1 -0
- package/dist/transpiler-cli.d.ts +3 -0
- package/dist/transpiler-cli.js +279 -0
- package/dist/transpiler-cli.js.map +1 -0
- package/dist/transpiler-express.d.ts +3 -0
- package/dist/transpiler-express.js +612 -0
- package/dist/transpiler-express.js.map +1 -0
- package/dist/transpiler-nextjs.d.ts +21 -0
- package/dist/transpiler-nextjs.js +400 -0
- package/dist/transpiler-nextjs.js.map +1 -0
- package/dist/transpiler-tailwind.d.ts +3 -0
- package/dist/transpiler-tailwind.js +594 -0
- package/dist/transpiler-tailwind.js.map +1 -0
- package/dist/transpiler-terminal.d.ts +3 -0
- package/dist/transpiler-terminal.js +522 -0
- package/dist/transpiler-terminal.js.map +1 -0
- package/dist/transpiler-web.d.ts +3 -0
- package/dist/transpiler-web.js +218 -0
- package/dist/transpiler-web.js.map +1 -0
- package/dist/transpiler.d.ts +3 -0
- package/dist/transpiler.js +218 -0
- package/dist/transpiler.js.map +1 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +36 -0
- package/dist/utils.js.map +1 -0
- package/kern.config.ts +61 -0
- package/package.json +64 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import { countTokens, serializeIR } from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Terminal Transpiler — generates ANSI-based CLI rendering code
|
|
4
|
+
*
|
|
5
|
+
* Pure Node.js output, no dependencies. Writes escape codes to process.stdout.
|
|
6
|
+
* Handles: text with styles, separator, table, scoreboard, spinner, progress,
|
|
7
|
+
* box, gradient, state blocks, REPL, and parallel dispatch.
|
|
8
|
+
*/
|
|
9
|
+
// ── ANSI code helpers (generated into output) ────────────────────────────
|
|
10
|
+
const ANSI_HELPERS = `
|
|
11
|
+
// ── ANSI helpers ──────────────────────────────────────────────────────
|
|
12
|
+
const ESC = '\\x1b[';
|
|
13
|
+
const RESET = ESC + '0m';
|
|
14
|
+
let _activeSpinner = null;
|
|
15
|
+
|
|
16
|
+
function hexTo256(hex) {
|
|
17
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
18
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
19
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
20
|
+
return 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function ansiColor(c) {
|
|
24
|
+
if (typeof c === 'number') return ESC + '38;5;' + c + 'm';
|
|
25
|
+
if (typeof c === 'string' && c.startsWith('#')) return ESC + '38;5;' + hexTo256(c) + 'm';
|
|
26
|
+
const named = {
|
|
27
|
+
red: '31', green: '32', yellow: '33', blue: '34',
|
|
28
|
+
cyan: '36', magenta: '35', white: '37', dim: '2', bold: '1', italic: '3',
|
|
29
|
+
};
|
|
30
|
+
return ESC + (named[c] || '37') + 'm';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function ansiBg(c) {
|
|
34
|
+
if (typeof c === 'number') return ESC + '48;5;' + c + 'm';
|
|
35
|
+
if (typeof c === 'string' && c.startsWith('#')) return ESC + '48;5;' + hexTo256(c) + 'm';
|
|
36
|
+
const named = {
|
|
37
|
+
red: '41', green: '42', yellow: '43', blue: '44',
|
|
38
|
+
cyan: '46', magenta: '45', white: '47',
|
|
39
|
+
};
|
|
40
|
+
return ESC + (named[c] || '47') + 'm';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function style(text, opts) {
|
|
44
|
+
let prefix = '';
|
|
45
|
+
if (opts.bold) prefix += ESC + '1m';
|
|
46
|
+
if (opts.dim) prefix += ESC + '2m';
|
|
47
|
+
if (opts.italic) prefix += ESC + '3m';
|
|
48
|
+
if (opts.color !== undefined) prefix += ansiColor(opts.color);
|
|
49
|
+
if (opts.bg !== undefined) prefix += ansiBg(opts.bg);
|
|
50
|
+
return prefix + text + RESET;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function separator(width) {
|
|
54
|
+
return style('─'.repeat(width || 48), { dim: true });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function table(headers, rows, colWidths) {
|
|
58
|
+
const widths = colWidths || headers.map((h, i) => Math.max(h.length, ...rows.map(r => (r[i] || '').length)) + 2);
|
|
59
|
+
const pad = (s, w) => s + ' '.repeat(Math.max(0, w - s.length));
|
|
60
|
+
const lines = [];
|
|
61
|
+
lines.push(headers.map((h, i) => style(pad(h, widths[i]), { bold: true })).join(''));
|
|
62
|
+
lines.push(style('─'.repeat(widths.reduce((a, b) => a + b, 0)), { dim: true }));
|
|
63
|
+
for (const row of rows) {
|
|
64
|
+
lines.push(row.map((c, i) => pad(c, widths[i])).join(''));
|
|
65
|
+
}
|
|
66
|
+
return lines.join('\\n');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function box(content, color, width) {
|
|
70
|
+
color = color || 'white';
|
|
71
|
+
width = width || 50;
|
|
72
|
+
const lines = content.split('\\n');
|
|
73
|
+
const inner = width - 4;
|
|
74
|
+
const top = style('┌' + '─'.repeat(inner + 2) + '┐', { color });
|
|
75
|
+
const bot = style('└' + '─'.repeat(inner + 2) + '┘', { color });
|
|
76
|
+
const mid = lines.map(l => {
|
|
77
|
+
const padded = l + ' '.repeat(Math.max(0, inner - l.length));
|
|
78
|
+
return style('│ ', { color }) + padded + style(' │', { color });
|
|
79
|
+
});
|
|
80
|
+
return [top, ...mid, bot].join('\\n');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function gradient(text, colors) {
|
|
84
|
+
if (!colors || colors.length === 0) return text;
|
|
85
|
+
return text.split('').map((ch, i) => {
|
|
86
|
+
const colorIdx = Math.floor((i / text.length) * colors.length);
|
|
87
|
+
return ansiColor(colors[Math.min(colorIdx, colors.length - 1)]) + ch;
|
|
88
|
+
}).join('') + RESET;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function spinner(message, color) {
|
|
92
|
+
color = color || 'white';
|
|
93
|
+
const frames = ['⠋','⠙','⠹','⠸','⠼','⠴','⠦','⠧','⠇','⠏'];
|
|
94
|
+
let i = 0;
|
|
95
|
+
let interval;
|
|
96
|
+
const s = {
|
|
97
|
+
start() {
|
|
98
|
+
_activeSpinner = s;
|
|
99
|
+
interval = setInterval(() => {
|
|
100
|
+
process.stdout.write('\\r' + ansiColor(color) + frames[i % frames.length] + RESET + ' ' + message);
|
|
101
|
+
i++;
|
|
102
|
+
}, 80);
|
|
103
|
+
},
|
|
104
|
+
stop(finalMsg) {
|
|
105
|
+
clearInterval(interval);
|
|
106
|
+
_activeSpinner = null;
|
|
107
|
+
process.stdout.write('\\r' + ' '.repeat(message.length + 4) + '\\r');
|
|
108
|
+
if (finalMsg) console.log(finalMsg);
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
return s;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function progressBar(value, max, width, color) {
|
|
115
|
+
width = width || 20;
|
|
116
|
+
color = color || 'green';
|
|
117
|
+
const pct = Math.min(1, Math.max(0, value / max));
|
|
118
|
+
const filled = Math.round(pct * width);
|
|
119
|
+
const empty = width - filled;
|
|
120
|
+
return ansiColor(color) + '▓'.repeat(filled) + RESET + '░'.repeat(empty) + \` \${Math.round(pct * 100)}%\`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
process.on('SIGINT', () => { if (_activeSpinner) _activeSpinner.stop(); process.exit(0); });
|
|
124
|
+
`.trim();
|
|
125
|
+
// ── Types ────────────────────────────────────────────────────────────────
|
|
126
|
+
function getProps(node) {
|
|
127
|
+
return node.props || {};
|
|
128
|
+
}
|
|
129
|
+
function getChildren(node, type) {
|
|
130
|
+
return (node.children || []).filter(c => c.type === type);
|
|
131
|
+
}
|
|
132
|
+
function getFirstChild(node, type) {
|
|
133
|
+
return (node.children || []).find(c => c.type === type);
|
|
134
|
+
}
|
|
135
|
+
// ── State block generator ────────────────────────────────────────────────
|
|
136
|
+
function generateStateBlock(stateNode) {
|
|
137
|
+
const lines = [];
|
|
138
|
+
const props = getProps(stateNode);
|
|
139
|
+
// State node from parser: state name=varName initial=value
|
|
140
|
+
const name = props.name;
|
|
141
|
+
const initial = props.initial;
|
|
142
|
+
if (name && initial !== undefined) {
|
|
143
|
+
const initVal = initial === 'null' ? 'null' : initial === 'true' ? 'true' : initial === 'false' ? 'false' : isNaN(Number(initial)) ? `'${initial}'` : String(initial);
|
|
144
|
+
lines.push(`let ${name} = ${initVal};`);
|
|
145
|
+
}
|
|
146
|
+
else if (props.styles) {
|
|
147
|
+
// State block with styles syntax: state {key:value}
|
|
148
|
+
const styles = props.styles;
|
|
149
|
+
for (const [key, val] of Object.entries(styles)) {
|
|
150
|
+
const initVal = val === 'null' ? 'null' : val === 'true' ? 'true' : val === 'false' ? 'false' : isNaN(Number(val)) ? `'${val}'` : String(val);
|
|
151
|
+
lines.push(`let ${key} = ${initVal};`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return lines;
|
|
155
|
+
}
|
|
156
|
+
// ── Node renderer ────────────────────────────────────────────────────────
|
|
157
|
+
function renderTerminalNode(node, indent) {
|
|
158
|
+
const p = getProps(node);
|
|
159
|
+
const lines = [];
|
|
160
|
+
switch (node.type) {
|
|
161
|
+
case 'text': {
|
|
162
|
+
const value = p.value || '';
|
|
163
|
+
const styles = p.styles || {};
|
|
164
|
+
const styleObj = [];
|
|
165
|
+
if (styles.c || styles.color)
|
|
166
|
+
styleObj.push(`color: ${JSON.stringify(styles.c || styles.color)}`);
|
|
167
|
+
if (styles.bg)
|
|
168
|
+
styleObj.push(`bg: ${JSON.stringify(styles.bg)}`);
|
|
169
|
+
if (styles.fw === 'bold' || styles.bold)
|
|
170
|
+
styleObj.push('bold: true');
|
|
171
|
+
if (styles.dim)
|
|
172
|
+
styleObj.push('dim: true');
|
|
173
|
+
if (styles.italic)
|
|
174
|
+
styleObj.push('italic: true');
|
|
175
|
+
if (styleObj.length > 0) {
|
|
176
|
+
lines.push(`${indent}console.log(style(${JSON.stringify(value)}, { ${styleObj.join(', ')} }));`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
lines.push(`${indent}console.log(${JSON.stringify(value)});`);
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case 'separator': {
|
|
184
|
+
const width = Number(p.width) || 48;
|
|
185
|
+
lines.push(`${indent}console.log(separator(${width}));`);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
case 'table': {
|
|
189
|
+
const headers = p.headers || '[]';
|
|
190
|
+
lines.push(`${indent}const _tableHeaders = ${headers};`);
|
|
191
|
+
lines.push(`${indent}const _tableRows: string[][] = [];`);
|
|
192
|
+
for (const row of getChildren(node, 'row')) {
|
|
193
|
+
const rowData = getProps(row).data || '[]';
|
|
194
|
+
lines.push(`${indent}_tableRows.push(${rowData});`);
|
|
195
|
+
}
|
|
196
|
+
lines.push(`${indent}console.log(table(_tableHeaders, _tableRows));`);
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case 'scoreboard': {
|
|
200
|
+
const title = p.title || 'Results';
|
|
201
|
+
const winner = p.winner || '';
|
|
202
|
+
lines.push(`${indent}console.log(style(${JSON.stringify(title)}, { bold: true }));`);
|
|
203
|
+
if (winner) {
|
|
204
|
+
lines.push(`${indent}console.log(style('Winner: ${winner}', { color: 'green', bold: true }));`);
|
|
205
|
+
}
|
|
206
|
+
for (const metric of getChildren(node, 'metric')) {
|
|
207
|
+
const mp = getProps(metric);
|
|
208
|
+
const name = mp.name || '';
|
|
209
|
+
const values = mp.values || '[]';
|
|
210
|
+
lines.push(`${indent}console.log(' ' + style('${name}:', { dim: true }) + ' ' + ${values}.join(' | '));`);
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case 'spinner': {
|
|
215
|
+
const message = p.message || 'Loading...';
|
|
216
|
+
const color = p.color || 'white';
|
|
217
|
+
lines.push(`${indent}const _spinner = spinner(${JSON.stringify(message)}, ${JSON.stringify(color)});`);
|
|
218
|
+
lines.push(`${indent}_spinner.start();`);
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case 'progress': {
|
|
222
|
+
const value = Number(p.value) || 0;
|
|
223
|
+
const max = Number(p.max) || 100;
|
|
224
|
+
const color = p.color || 'green';
|
|
225
|
+
lines.push(`${indent}console.log(progressBar(${value}, ${max}, 20, ${JSON.stringify(color)}));`);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
case 'box': {
|
|
229
|
+
const color = p.color || 'white';
|
|
230
|
+
const width = Number(p.width) || 50;
|
|
231
|
+
// Box content from all children (recursive)
|
|
232
|
+
const boxContent = [];
|
|
233
|
+
for (const child of node.children || []) {
|
|
234
|
+
const cp = getProps(child);
|
|
235
|
+
if (child.type === 'text') {
|
|
236
|
+
boxContent.push(cp.value || '');
|
|
237
|
+
}
|
|
238
|
+
else if (child.type === 'separator') {
|
|
239
|
+
boxContent.push('─'.repeat(Math.min(Number(cp.width) || 40, width - 4)));
|
|
240
|
+
}
|
|
241
|
+
else if (child.type === 'progress') {
|
|
242
|
+
boxContent.push(`[progress: ${cp.value || 0}/${cp.max || 100}]`);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
boxContent.push(`[${child.type}]`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
lines.push(`${indent}console.log(box(${JSON.stringify(boxContent.join('\\n'))}, ${JSON.stringify(color)}, ${width}));`);
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
case 'gradient': {
|
|
252
|
+
const text = p.text || '';
|
|
253
|
+
const colors = p.colors || '[]';
|
|
254
|
+
lines.push(`${indent}console.log(gradient(${JSON.stringify(text)}, ${colors}));`);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case 'handler': {
|
|
258
|
+
const code = p.code || '';
|
|
259
|
+
for (const line of code.split('\n')) {
|
|
260
|
+
lines.push(`${indent}${line.trim()}`);
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
case 'state':
|
|
265
|
+
// Handled at top level
|
|
266
|
+
break;
|
|
267
|
+
case 'repl':
|
|
268
|
+
// Handled at top level
|
|
269
|
+
break;
|
|
270
|
+
case 'parallel':
|
|
271
|
+
lines.push(...generateParallelCode(node, indent));
|
|
272
|
+
break;
|
|
273
|
+
default:
|
|
274
|
+
// Recurse into children for unknown nodes
|
|
275
|
+
if (node.children) {
|
|
276
|
+
for (const child of node.children) {
|
|
277
|
+
lines.push(...renderTerminalNode(child, indent));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return lines;
|
|
282
|
+
}
|
|
283
|
+
// ── Parallel code generator ───────────────────────────────────────────────
|
|
284
|
+
function generateParallelCode(node, indent) {
|
|
285
|
+
const p = getProps(node);
|
|
286
|
+
const timeoutSec = Number(p.timeout) || 60;
|
|
287
|
+
const lines = [];
|
|
288
|
+
// Find each/dispatch children and then block
|
|
289
|
+
const eachNode = (node.children || []).find(c => c.type === 'each');
|
|
290
|
+
const dispatchNodes = getChildren(node, 'dispatch');
|
|
291
|
+
const thenNode = (node.children || []).find(c => c.type === 'then');
|
|
292
|
+
lines.push(`${indent}// ── Parallel dispatch ──────────────────────────`);
|
|
293
|
+
lines.push(`${indent}await (async () => {`);
|
|
294
|
+
lines.push(`${indent} const _ac = new AbortController();`);
|
|
295
|
+
lines.push(`${indent} const _timeout = setTimeout(() => _ac.abort(), ${timeoutSec * 1000});`);
|
|
296
|
+
lines.push('');
|
|
297
|
+
if (eachNode) {
|
|
298
|
+
// Pattern: each engine in collection → dispatch
|
|
299
|
+
const ep = getProps(eachNode);
|
|
300
|
+
// "each engine in state.engines" → varName=engine, collection=state.engines
|
|
301
|
+
// Parse from props: name=engine, in=state.engines (or similar)
|
|
302
|
+
const varName = ep.name || 'item';
|
|
303
|
+
const collection = ep.in || '[]';
|
|
304
|
+
const innerDispatch = getFirstChild(eachNode, 'dispatch');
|
|
305
|
+
if (innerDispatch) {
|
|
306
|
+
const dp = getProps(innerDispatch);
|
|
307
|
+
const prompt = dp.prompt || 'prompt';
|
|
308
|
+
const resultVar = dp.result || 'result';
|
|
309
|
+
// Check for on start/done events (Pattern B)
|
|
310
|
+
const onStartNode = (innerDispatch.children || []).find(c => c.type === 'on' && (getProps(c).name === 'start' || getProps(c).event === 'start'));
|
|
311
|
+
const onDoneNode = (innerDispatch.children || []).find(c => c.type === 'on' && (getProps(c).name === 'done' || getProps(c).event === 'done'));
|
|
312
|
+
lines.push(`${indent} const _tasks = (${collection} || []).map(async (${varName}) => {`);
|
|
313
|
+
if (onStartNode) {
|
|
314
|
+
const startHandler = getFirstChild(onStartNode, 'handler');
|
|
315
|
+
const startCode = startHandler ? String(getProps(startHandler).code || '') : '';
|
|
316
|
+
if (startCode) {
|
|
317
|
+
for (const l of startCode.split('\n'))
|
|
318
|
+
lines.push(`${indent} ${l.trim()}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
lines.push(`${indent} const ${resultVar} = await dispatch(${varName}, ${prompt}, { signal: _ac.signal });`);
|
|
322
|
+
if (onDoneNode) {
|
|
323
|
+
const doneHandler = getFirstChild(onDoneNode, 'handler');
|
|
324
|
+
const doneCode = doneHandler ? String(getProps(doneHandler).code || '') : '';
|
|
325
|
+
if (doneCode) {
|
|
326
|
+
for (const l of doneCode.split('\n'))
|
|
327
|
+
lines.push(`${indent} ${l.trim()}`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
lines.push(`${indent} return { ${varName}, ${resultVar} };`);
|
|
331
|
+
lines.push(`${indent} });`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else if (dispatchNodes.length > 0) {
|
|
335
|
+
// Named dispatch nodes: dispatch engine="claude" → claudeResult
|
|
336
|
+
lines.push(`${indent} const _tasks = [`);
|
|
337
|
+
for (const dn of dispatchNodes) {
|
|
338
|
+
const dp = getProps(dn);
|
|
339
|
+
const engine = dp.engine || 'engine';
|
|
340
|
+
const prompt = dp.prompt || 'prompt';
|
|
341
|
+
const resultVar = dp.result || `${engine}Result`;
|
|
342
|
+
// Check for on start/done events
|
|
343
|
+
const onStartNode = (dn.children || []).find(c => c.type === 'on' && (getProps(c).name === 'start' || getProps(c).event === 'start'));
|
|
344
|
+
const onDoneNode = (dn.children || []).find(c => c.type === 'on' && (getProps(c).name === 'done' || getProps(c).event === 'done'));
|
|
345
|
+
lines.push(`${indent} (async () => {`);
|
|
346
|
+
if (onStartNode) {
|
|
347
|
+
const startHandler = getFirstChild(onStartNode, 'handler');
|
|
348
|
+
const startCode = startHandler ? String(getProps(startHandler).code || '') : '';
|
|
349
|
+
if (startCode) {
|
|
350
|
+
for (const l of startCode.split('\n'))
|
|
351
|
+
lines.push(`${indent} ${l.trim()}`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
lines.push(`${indent} const ${resultVar} = await dispatch(${JSON.stringify(engine)}, ${prompt}, { signal: _ac.signal });`);
|
|
355
|
+
if (onDoneNode) {
|
|
356
|
+
const doneHandler = getFirstChild(onDoneNode, 'handler');
|
|
357
|
+
const doneCode = doneHandler ? String(getProps(doneHandler).code || '') : '';
|
|
358
|
+
if (doneCode) {
|
|
359
|
+
for (const l of doneCode.split('\n'))
|
|
360
|
+
lines.push(`${indent} ${l.trim()}`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
lines.push(`${indent} return { engine: ${JSON.stringify(engine)}, result: ${resultVar} };`);
|
|
364
|
+
lines.push(`${indent} })(),`);
|
|
365
|
+
}
|
|
366
|
+
lines.push(`${indent} ];`);
|
|
367
|
+
}
|
|
368
|
+
lines.push('');
|
|
369
|
+
lines.push(`${indent} // Race tasks against timeout — collect whatever finished`);
|
|
370
|
+
lines.push(`${indent} const _timeoutPromise = new Promise((resolve) => {`);
|
|
371
|
+
lines.push(`${indent} _ac.signal.addEventListener('abort', () => resolve('timeout'));`);
|
|
372
|
+
lines.push(`${indent} });`);
|
|
373
|
+
lines.push(`${indent} const _raceResult = await Promise.race([`);
|
|
374
|
+
lines.push(`${indent} Promise.allSettled(_tasks).then(r => ({ settled: r })),`);
|
|
375
|
+
lines.push(`${indent} _timeoutPromise.then(() => ({ settled: null })),`);
|
|
376
|
+
lines.push(`${indent} ]);`);
|
|
377
|
+
lines.push(`${indent} clearTimeout(_timeout);`);
|
|
378
|
+
lines.push(`${indent} // On timeout, collect partial results (resolved so far)`);
|
|
379
|
+
lines.push(`${indent} const _settled = (_raceResult as any).settled || [];`);
|
|
380
|
+
lines.push(`${indent} const results = _settled`);
|
|
381
|
+
lines.push(`${indent} .filter((r) => r.status === 'fulfilled')`);
|
|
382
|
+
lines.push(`${indent} .map((r) => r.value);`);
|
|
383
|
+
// Then block
|
|
384
|
+
if (thenNode) {
|
|
385
|
+
lines.push('');
|
|
386
|
+
// Render then children
|
|
387
|
+
for (const child of thenNode.children || []) {
|
|
388
|
+
lines.push(...renderTerminalNode(child, `${indent} `));
|
|
389
|
+
}
|
|
390
|
+
// Handler inside then
|
|
391
|
+
const thenHandler = getFirstChild(thenNode, 'handler');
|
|
392
|
+
if (thenHandler) {
|
|
393
|
+
const code = String(getProps(thenHandler).code || '');
|
|
394
|
+
for (const l of code.split('\n')) {
|
|
395
|
+
lines.push(`${indent} ${l.trim()}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
lines.push(`${indent}})();`);
|
|
400
|
+
return lines;
|
|
401
|
+
}
|
|
402
|
+
// ── Main export ──────────────────────────────────────────────────────────
|
|
403
|
+
export function transpileTerminal(root, _config) {
|
|
404
|
+
const sourceMap = [];
|
|
405
|
+
const lines = [];
|
|
406
|
+
// ANSI helpers
|
|
407
|
+
lines.push(ANSI_HELPERS);
|
|
408
|
+
lines.push('');
|
|
409
|
+
// State blocks
|
|
410
|
+
const stateNodes = getChildren(root, 'state');
|
|
411
|
+
if (stateNodes.length > 0) {
|
|
412
|
+
lines.push('// ── State ──────────────────────────────────────────────');
|
|
413
|
+
for (const stateNode of stateNodes) {
|
|
414
|
+
lines.push(...generateStateBlock(stateNode));
|
|
415
|
+
}
|
|
416
|
+
lines.push('');
|
|
417
|
+
}
|
|
418
|
+
// REPL node detection — generate readline setup
|
|
419
|
+
const replNode = (root.children || []).find(c => c.type === 'repl');
|
|
420
|
+
// Render static nodes (text, separator, box, parallel, etc.) before REPL
|
|
421
|
+
const staticChildren = (root.children || []).filter(c => c.type !== 'state' && c.type !== 'repl');
|
|
422
|
+
const hasAsync = staticChildren.some(c => c.type === 'parallel');
|
|
423
|
+
if (staticChildren.length > 0) {
|
|
424
|
+
lines.push('// ── Output ─────────────────────────────────────────────');
|
|
425
|
+
if (hasAsync)
|
|
426
|
+
lines.push('(async () => {');
|
|
427
|
+
const indent = hasAsync ? ' ' : '';
|
|
428
|
+
for (const child of staticChildren) {
|
|
429
|
+
lines.push(...renderTerminalNode(child, indent));
|
|
430
|
+
}
|
|
431
|
+
if (hasAsync)
|
|
432
|
+
lines.push('})();');
|
|
433
|
+
lines.push('');
|
|
434
|
+
}
|
|
435
|
+
if (replNode) {
|
|
436
|
+
lines.push(...generateReplCode(replNode));
|
|
437
|
+
}
|
|
438
|
+
sourceMap.push({
|
|
439
|
+
irLine: root.loc?.line || 0,
|
|
440
|
+
irCol: root.loc?.col || 1,
|
|
441
|
+
outLine: 1,
|
|
442
|
+
outCol: 1,
|
|
443
|
+
});
|
|
444
|
+
const code = lines.join('\n');
|
|
445
|
+
const irText = serializeIR(root);
|
|
446
|
+
const irTokenCount = countTokens(irText);
|
|
447
|
+
const tsTokenCount = countTokens(code);
|
|
448
|
+
const tokenReduction = Math.round((1 - irTokenCount / tsTokenCount) * 100);
|
|
449
|
+
return {
|
|
450
|
+
code,
|
|
451
|
+
sourceMap,
|
|
452
|
+
irTokenCount,
|
|
453
|
+
tsTokenCount,
|
|
454
|
+
tokenReduction,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
// ── REPL generator ───────────────────────────────────────────────────────
|
|
458
|
+
function generateReplCode(replNode) {
|
|
459
|
+
const p = getProps(replNode);
|
|
460
|
+
const prompt = p.prompt || '> ';
|
|
461
|
+
const lines = [];
|
|
462
|
+
lines.push(`import { createInterface } from 'node:readline';`);
|
|
463
|
+
lines.push('');
|
|
464
|
+
lines.push('// ── REPL ───────────────────────────────────────────────');
|
|
465
|
+
lines.push(`const rl = createInterface({`);
|
|
466
|
+
lines.push(` input: process.stdin,`);
|
|
467
|
+
lines.push(` output: process.stdout,`);
|
|
468
|
+
lines.push(` prompt: ${JSON.stringify(prompt + ' ')},`);
|
|
469
|
+
lines.push(`});`);
|
|
470
|
+
lines.push('');
|
|
471
|
+
// on line handler
|
|
472
|
+
const onLineNode = (replNode.children || []).find(c => c.type === 'on' && ((getProps(c).name || getProps(c).event) === 'line' || (getProps(c).name || getProps(c).event) === 'input'));
|
|
473
|
+
if (onLineNode) {
|
|
474
|
+
const handlerNode = getFirstChild(onLineNode, 'handler');
|
|
475
|
+
const handlerCode = handlerNode ? String(getProps(handlerNode).code || '') : '';
|
|
476
|
+
lines.push(`rl.on('line', async (input: string) => {`);
|
|
477
|
+
lines.push(` const trimmed = input.trim();`);
|
|
478
|
+
lines.push(` if (!trimmed) { rl.prompt(); return; }`);
|
|
479
|
+
// Guard node — busy check
|
|
480
|
+
const guardNode = (replNode.children || []).find(c => c.type === 'guard');
|
|
481
|
+
if (guardNode) {
|
|
482
|
+
const guardProp = getProps(guardNode);
|
|
483
|
+
const condition = Object.entries(guardProp).find(([k]) => k !== 'styles' && k !== 'pseudoStyles' && k !== 'themeRefs');
|
|
484
|
+
if (condition) {
|
|
485
|
+
lines.push(` if (${condition[0]}) {`);
|
|
486
|
+
// Guard children (text output)
|
|
487
|
+
for (const gc of guardNode.children || []) {
|
|
488
|
+
lines.push(...renderTerminalNode(gc, ' '));
|
|
489
|
+
}
|
|
490
|
+
lines.push(` rl.prompt(); return;`);
|
|
491
|
+
lines.push(` }`);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
if (handlerCode) {
|
|
495
|
+
for (const line of handlerCode.split('\n')) {
|
|
496
|
+
lines.push(` ${line.trim()}`);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
lines.push(` rl.prompt();`);
|
|
500
|
+
lines.push(`});`);
|
|
501
|
+
}
|
|
502
|
+
// on interrupt handler
|
|
503
|
+
const onInterruptNode = (replNode.children || []).find(c => c.type === 'on' && ((getProps(c).name || getProps(c).event) === 'interrupt' || (getProps(c).name || getProps(c).event) === 'SIGINT'));
|
|
504
|
+
if (onInterruptNode) {
|
|
505
|
+
lines.push('');
|
|
506
|
+
lines.push(`rl.on('SIGINT', () => {`);
|
|
507
|
+
for (const child of onInterruptNode.children || []) {
|
|
508
|
+
lines.push(...renderTerminalNode(child, ' '));
|
|
509
|
+
}
|
|
510
|
+
lines.push(` rl.close();`);
|
|
511
|
+
lines.push(` process.exit(0);`);
|
|
512
|
+
lines.push(`});`);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
lines.push('');
|
|
516
|
+
lines.push(`rl.on('SIGINT', () => { rl.close(); process.exit(0); });`);
|
|
517
|
+
}
|
|
518
|
+
lines.push('');
|
|
519
|
+
lines.push(`rl.prompt();`);
|
|
520
|
+
return lines;
|
|
521
|
+
}
|
|
522
|
+
//# sourceMappingURL=transpiler-terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transpiler-terminal.js","sourceRoot":"","sources":["../src/transpiler-terminal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;GAMG;AAEH,4EAA4E;AAE5E,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHpB,CAAC,IAAI,EAAE,CAAC;AAET,4EAA4E;AAE5E,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY;IAC7C,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC5D,CAAC;AAED,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