mdast-control 0.1.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/README.md +359 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +534 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lsp/requests.d.ts +215 -0
- package/dist/lsp/requests.js +613 -0
- package/dist/lsp/requests.js.map +1 -0
- package/dist/lsp/server.d.ts +1 -0
- package/dist/lsp/server.js +110 -0
- package/dist/lsp/server.js.map +1 -0
- package/dist/lsp-methods.d.ts +25 -0
- package/dist/lsp-methods.js +26 -0
- package/dist/lsp-methods.js.map +1 -0
- package/dist/markdown.d.ts +17 -0
- package/dist/markdown.js +140 -0
- package/dist/markdown.js.map +1 -0
- package/dist/plugins.d.ts +144 -0
- package/dist/plugins.js +833 -0
- package/dist/plugins.js.map +1 -0
- package/dist/query.d.ts +8 -0
- package/dist/query.js +518 -0
- package/dist/query.js.map +1 -0
- package/dist/table-interchange.d.ts +22 -0
- package/dist/table-interchange.js +191 -0
- package/dist/table-interchange.js.map +1 -0
- package/dist/table-model.d.ts +15 -0
- package/dist/table-model.js +105 -0
- package/dist/table-model.js.map +1 -0
- package/dist/table-structural.d.ts +9 -0
- package/dist/table-structural.js +190 -0
- package/dist/table-structural.js.map +1 -0
- package/dist/table.d.ts +49 -0
- package/dist/table.js +131 -0
- package/dist/table.js.map +1 -0
- package/dist/transport.d.ts +6 -0
- package/dist/transport.js +7 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +60 -0
- package/scripts/verify-package.mjs +252 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { astToJson, copyMarkdown, deleteMarkdown, isInsertPosition, isMoveTargetPolicy, insertMarkdown, moveMarkdown, parseMarkdown, replaceMarkdown, restoreMarkdownFromAstJson, stringifyAst, unwrapMarkdown, wrapMarkdown, } from './markdown.js';
|
|
4
|
+
import { getCapabilities, getElementCapabilities, getOperationDescriptor, getPluginCapabilities, listPlugins, runPluginOperation, } from './plugins.js';
|
|
5
|
+
import { queryAst } from './query.js';
|
|
6
|
+
import { addTableColumn, deleteTableColumn, deleteTableRow, delimitedToMarkdownTable, extractTableModel, insertDelimitedAsTable, insertTableRow, replaceTableWithDelimited, sortTable, tableToDelimited, updateTableCell, } from './table.js';
|
|
7
|
+
import { toTransportMatches } from './transport.js';
|
|
8
|
+
const program = new Command();
|
|
9
|
+
program
|
|
10
|
+
.name('mdastctl')
|
|
11
|
+
.description('Markdown AST control CLI');
|
|
12
|
+
program
|
|
13
|
+
.command('parse')
|
|
14
|
+
.description('Read markdown from stdin and emit AST JSON')
|
|
15
|
+
.action(async () => {
|
|
16
|
+
const input = await readStdin();
|
|
17
|
+
process.stdout.write(`${astToJson(parseMarkdown(input))}\n`);
|
|
18
|
+
});
|
|
19
|
+
program
|
|
20
|
+
.command('print')
|
|
21
|
+
.description('Read AST JSON from stdin and emit markdown')
|
|
22
|
+
.action(async () => {
|
|
23
|
+
const input = await readStdin();
|
|
24
|
+
process.stdout.write(restoreMarkdownFromAstJson(input));
|
|
25
|
+
});
|
|
26
|
+
program
|
|
27
|
+
.command('query')
|
|
28
|
+
.description('Read markdown from stdin and emit matching nodes as JSON')
|
|
29
|
+
.requiredOption('--select <query>', 'Query string')
|
|
30
|
+
.action(async (options) => {
|
|
31
|
+
const input = await readStdin();
|
|
32
|
+
const matches = toTransportMatches(queryAst(parseMarkdown(input), options.select));
|
|
33
|
+
process.stdout.write(`${JSON.stringify(matches, null, 2)}\n`);
|
|
34
|
+
});
|
|
35
|
+
program
|
|
36
|
+
.command('insert')
|
|
37
|
+
.description('Insert markdown snippet around query matches')
|
|
38
|
+
.requiredOption('--select <query>', 'Query string')
|
|
39
|
+
.requiredOption('--position <position>', 'before|after|prepend|append')
|
|
40
|
+
.requiredOption('--markdown <snippet>', 'Markdown snippet to insert')
|
|
41
|
+
.action(async (options) => {
|
|
42
|
+
const input = await readStdin();
|
|
43
|
+
if (!isInsertPosition(options.position)) {
|
|
44
|
+
throw new Error(`Unsupported insert position "${options.position}"`);
|
|
45
|
+
}
|
|
46
|
+
const result = insertMarkdown(input, options.select, options.position, options.markdown);
|
|
47
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
48
|
+
});
|
|
49
|
+
program
|
|
50
|
+
.command('delete')
|
|
51
|
+
.description('Delete nodes matched by query')
|
|
52
|
+
.requiredOption('--select <query>', 'Query string')
|
|
53
|
+
.action(async (options) => {
|
|
54
|
+
const input = await readStdin();
|
|
55
|
+
const result = deleteMarkdown(input, options.select);
|
|
56
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
57
|
+
});
|
|
58
|
+
program
|
|
59
|
+
.command('replace')
|
|
60
|
+
.description('Replace matched nodes with markdown snippet')
|
|
61
|
+
.requiredOption('--select <query>', 'Query string')
|
|
62
|
+
.requiredOption('--markdown <snippet>', 'Markdown snippet to replace with')
|
|
63
|
+
.action(async (options) => {
|
|
64
|
+
const input = await readStdin();
|
|
65
|
+
const result = replaceMarkdown(input, options.select, options.markdown);
|
|
66
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
67
|
+
});
|
|
68
|
+
program
|
|
69
|
+
.command('wrap')
|
|
70
|
+
.description('Wrap matched nodes with a container snippet')
|
|
71
|
+
.requiredOption('--select <query>', 'Query string')
|
|
72
|
+
.requiredOption('--markdown <wrapper>', 'Wrapper markdown snippet')
|
|
73
|
+
.action(async (options) => {
|
|
74
|
+
const input = await readStdin();
|
|
75
|
+
const result = wrapMarkdown(input, options.select, options.markdown);
|
|
76
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
77
|
+
});
|
|
78
|
+
program
|
|
79
|
+
.command('unwrap')
|
|
80
|
+
.description('Remove one container layer from matched nodes')
|
|
81
|
+
.requiredOption('--select <query>', 'Query string')
|
|
82
|
+
.action(async (options) => {
|
|
83
|
+
const input = await readStdin();
|
|
84
|
+
const result = unwrapMarkdown(input, options.select);
|
|
85
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
86
|
+
});
|
|
87
|
+
program
|
|
88
|
+
.command('move')
|
|
89
|
+
.description('Move matched nodes to a target match')
|
|
90
|
+
.requiredOption('--select <query>', 'Source query string')
|
|
91
|
+
.requiredOption('--to <query>', 'Target query string')
|
|
92
|
+
.requiredOption('--position <position>', 'before|after|prepend|append')
|
|
93
|
+
.option('--target-policy <policy>', 'exactly-one|first|last', 'exactly-one')
|
|
94
|
+
.action(async (options) => {
|
|
95
|
+
const input = await readStdin();
|
|
96
|
+
if (!isInsertPosition(options.position)) {
|
|
97
|
+
throw new Error(`Unsupported insert position "${options.position}"`);
|
|
98
|
+
}
|
|
99
|
+
const targetPolicy = parseMoveTargetPolicy(options.targetPolicy);
|
|
100
|
+
const result = moveMarkdown(input, options.select, options.to, options.position, targetPolicy);
|
|
101
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
102
|
+
});
|
|
103
|
+
program
|
|
104
|
+
.command('copy')
|
|
105
|
+
.description('Copy matched nodes to a target match without deleting the originals')
|
|
106
|
+
.requiredOption('--select <query>', 'Source query string')
|
|
107
|
+
.requiredOption('--to <query>', 'Target query string')
|
|
108
|
+
.requiredOption('--position <position>', 'before|after|prepend|append')
|
|
109
|
+
.option('--target-policy <policy>', 'exactly-one|first|last', 'exactly-one')
|
|
110
|
+
.action(async (options) => {
|
|
111
|
+
const input = await readStdin();
|
|
112
|
+
if (!isInsertPosition(options.position)) {
|
|
113
|
+
throw new Error(`Unsupported insert position "${options.position}"`);
|
|
114
|
+
}
|
|
115
|
+
const targetPolicy = parseMoveTargetPolicy(options.targetPolicy);
|
|
116
|
+
const result = copyMarkdown(input, options.select, options.to, options.position, targetPolicy);
|
|
117
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
118
|
+
});
|
|
119
|
+
program
|
|
120
|
+
.command('capabilities')
|
|
121
|
+
.description('Show core and plugin capabilities')
|
|
122
|
+
.option('--format <format>', 'text|json', 'text')
|
|
123
|
+
.action((options) => {
|
|
124
|
+
emitOutput(getCapabilities(), options.format, renderCapabilities);
|
|
125
|
+
});
|
|
126
|
+
const tableProgram = program
|
|
127
|
+
.command('table')
|
|
128
|
+
.description('Query and convert Markdown tables');
|
|
129
|
+
tableProgram
|
|
130
|
+
.command('query')
|
|
131
|
+
.description('Read Markdown from stdin and emit one normalized table')
|
|
132
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
133
|
+
.option('--format <format>', 'json|csv|tsv', 'json')
|
|
134
|
+
.option('--no-header', 'Exclude the header from CSV/TSV output')
|
|
135
|
+
.option('--line-terminator <style>', 'lf|crlf', 'lf')
|
|
136
|
+
.option('--quote-mode <mode>', 'minimal|always', 'minimal')
|
|
137
|
+
.action(async (options) => {
|
|
138
|
+
const input = await readStdin();
|
|
139
|
+
if (options.format === 'json') {
|
|
140
|
+
process.stdout.write(`${JSON.stringify(extractTableModel(input, options.select), null, 2)}\n`);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const format = parseDelimitedFormat(options.format);
|
|
144
|
+
const exportOptions = parseDelimitedExportOptions(options);
|
|
145
|
+
emitDelimitedText(tableToDelimited(input, options.select, format, exportOptions), exportOptions.lineTerminator ?? '\n');
|
|
146
|
+
});
|
|
147
|
+
tableProgram
|
|
148
|
+
.command('export')
|
|
149
|
+
.description('Read Markdown from stdin and export one table as CSV or TSV')
|
|
150
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
151
|
+
.requiredOption('--format <format>', 'csv|tsv')
|
|
152
|
+
.option('--no-header', 'Exclude the header row')
|
|
153
|
+
.option('--line-terminator <style>', 'lf|crlf', 'lf')
|
|
154
|
+
.option('--quote-mode <mode>', 'minimal|always', 'minimal')
|
|
155
|
+
.action(async (options) => {
|
|
156
|
+
const input = await readStdin();
|
|
157
|
+
const exportOptions = parseDelimitedExportOptions(options);
|
|
158
|
+
const output = tableToDelimited(input, options.select, parseDelimitedFormat(options.format), exportOptions);
|
|
159
|
+
emitDelimitedText(output, exportOptions.lineTerminator ?? '\n');
|
|
160
|
+
});
|
|
161
|
+
tableProgram
|
|
162
|
+
.command('import')
|
|
163
|
+
.description('Import CSV/TSV from stdin, or mutate Markdown stdin using --data')
|
|
164
|
+
.requiredOption('--format <format>', 'csv|tsv')
|
|
165
|
+
.option('--replace <query>', 'Replace exactly one selected table')
|
|
166
|
+
.option('--insert <query>', 'Insert at exactly one selected target')
|
|
167
|
+
.option('--position <position>', 'before|after|prepend|append')
|
|
168
|
+
.option('--data <text>', 'Delimited data for --replace or --insert')
|
|
169
|
+
.option('--no-header', 'Treat every imported row as a body row')
|
|
170
|
+
.option('--strict-width', 'Reject rows with different source widths')
|
|
171
|
+
.option('--trim-cells', 'Trim leading and trailing whitespace in cells')
|
|
172
|
+
.option('--align <json>', 'JSON alignment array')
|
|
173
|
+
.action(async (options) => {
|
|
174
|
+
const input = await readStdin();
|
|
175
|
+
const format = parseDelimitedFormat(options.format);
|
|
176
|
+
const importOptions = parseDelimitedImportOptions(options);
|
|
177
|
+
const mutationCount = Number(options.replace !== undefined) + Number(options.insert !== undefined);
|
|
178
|
+
if (mutationCount === 0) {
|
|
179
|
+
if (options.data !== undefined || options.position !== undefined) {
|
|
180
|
+
throw new Error('--data and --position require --replace or --insert');
|
|
181
|
+
}
|
|
182
|
+
process.stdout.write(delimitedToMarkdownTable(input, format, importOptions));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (mutationCount !== 1) {
|
|
186
|
+
throw new Error('Provide exactly one of --replace or --insert');
|
|
187
|
+
}
|
|
188
|
+
if (options.data === undefined) {
|
|
189
|
+
throw new Error('--data is required when importing into Markdown from stdin');
|
|
190
|
+
}
|
|
191
|
+
if (options.replace !== undefined) {
|
|
192
|
+
if (options.position !== undefined) {
|
|
193
|
+
throw new Error('--position is only valid with --insert');
|
|
194
|
+
}
|
|
195
|
+
const result = replaceTableWithDelimited(input, options.replace, format, options.data, importOptions);
|
|
196
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (options.position === undefined || !isInsertPosition(options.position)) {
|
|
200
|
+
throw new Error('--insert requires --position before|after|prepend|append');
|
|
201
|
+
}
|
|
202
|
+
const result = insertDelimitedAsTable(input, options.insert ?? '', options.position, format, options.data, importOptions);
|
|
203
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
204
|
+
});
|
|
205
|
+
const tableCellProgram = tableProgram
|
|
206
|
+
.command('cell')
|
|
207
|
+
.description('Edit cells in exactly one selected table');
|
|
208
|
+
tableCellProgram
|
|
209
|
+
.command('set')
|
|
210
|
+
.description('Set one body cell to plain text')
|
|
211
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
212
|
+
.requiredOption('--row <index>', 'Zero-based body row index')
|
|
213
|
+
.requiredOption('--column <column>', 'Zero-based column index or exact header text')
|
|
214
|
+
.requiredOption('--value <text>', 'Replacement plain text')
|
|
215
|
+
.action(async (options) => {
|
|
216
|
+
const input = await readStdin();
|
|
217
|
+
const result = updateTableCell(input, options.select, parseIntegerOption(options.row, '--row'), parseTableColumnAddress(options.column), options.value);
|
|
218
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
219
|
+
});
|
|
220
|
+
const tableRowProgram = tableProgram
|
|
221
|
+
.command('row')
|
|
222
|
+
.description('Insert or delete body rows in exactly one selected table');
|
|
223
|
+
tableRowProgram
|
|
224
|
+
.command('insert')
|
|
225
|
+
.description('Insert one body row, padding omitted trailing cells')
|
|
226
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
227
|
+
.requiredOption('--index <index>', 'Zero-based body row insertion index')
|
|
228
|
+
.requiredOption('--values <json>', 'JSON array of string cell values')
|
|
229
|
+
.action(async (options) => {
|
|
230
|
+
const input = await readStdin();
|
|
231
|
+
const result = insertTableRow(input, options.select, parseIntegerOption(options.index, '--index'), parseStringArrayOption(options.values, '--values'));
|
|
232
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
233
|
+
});
|
|
234
|
+
tableRowProgram
|
|
235
|
+
.command('delete')
|
|
236
|
+
.description('Delete one body row')
|
|
237
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
238
|
+
.requiredOption('--row <index>', 'Zero-based body row index')
|
|
239
|
+
.action(async (options) => {
|
|
240
|
+
const input = await readStdin();
|
|
241
|
+
const result = deleteTableRow(input, options.select, parseIntegerOption(options.row, '--row'));
|
|
242
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
243
|
+
});
|
|
244
|
+
const tableColumnProgram = tableProgram
|
|
245
|
+
.command('column')
|
|
246
|
+
.description('Add or delete columns in exactly one selected table');
|
|
247
|
+
tableColumnProgram
|
|
248
|
+
.command('add')
|
|
249
|
+
.description('Add one column, padding omitted body values')
|
|
250
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
251
|
+
.requiredOption('--index <index>', 'Zero-based column insertion index')
|
|
252
|
+
.requiredOption('--header <text>', 'Header text')
|
|
253
|
+
.option('--values <json>', 'JSON array of string body values', '[]')
|
|
254
|
+
.action(async (options) => {
|
|
255
|
+
const input = await readStdin();
|
|
256
|
+
const result = addTableColumn(input, options.select, parseIntegerOption(options.index, '--index'), options.header, parseStringArrayOption(options.values, '--values'));
|
|
257
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
258
|
+
});
|
|
259
|
+
tableColumnProgram
|
|
260
|
+
.command('delete')
|
|
261
|
+
.description('Delete one column by index or exact header text')
|
|
262
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
263
|
+
.requiredOption('--column <column>', 'Zero-based column index or exact header text')
|
|
264
|
+
.action(async (options) => {
|
|
265
|
+
const input = await readStdin();
|
|
266
|
+
const result = deleteTableColumn(input, options.select, parseTableColumnAddress(options.column));
|
|
267
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
268
|
+
});
|
|
269
|
+
tableProgram
|
|
270
|
+
.command('sort')
|
|
271
|
+
.description('Stably sort body rows by one column')
|
|
272
|
+
.requiredOption('--select <query>', 'Query selecting exactly one table')
|
|
273
|
+
.requiredOption('--column <column>', 'Zero-based column index or exact header text')
|
|
274
|
+
.requiredOption('--direction <direction>', 'asc|desc')
|
|
275
|
+
.action(async (options) => {
|
|
276
|
+
const input = await readStdin();
|
|
277
|
+
const result = sortTable(input, options.select, parseTableColumnAddress(options.column), parseTableSortDirection(options.direction));
|
|
278
|
+
process.stdout.write(stringifyAst(result.tree));
|
|
279
|
+
});
|
|
280
|
+
const pluginProgram = program
|
|
281
|
+
.command('plugin')
|
|
282
|
+
.description('Inspect registered AST element plugins');
|
|
283
|
+
pluginProgram
|
|
284
|
+
.command('list')
|
|
285
|
+
.description('List available plugins')
|
|
286
|
+
.option('--format <format>', 'text|json', 'text')
|
|
287
|
+
.action((options) => {
|
|
288
|
+
emitOutput(listPlugins(), options.format, renderPluginList);
|
|
289
|
+
});
|
|
290
|
+
pluginProgram
|
|
291
|
+
.command('show')
|
|
292
|
+
.description('Show one plugin or all plugins for an element kind')
|
|
293
|
+
.option('--plugin <id>', 'Plugin identifier')
|
|
294
|
+
.option('--element <kind>', 'Element kind')
|
|
295
|
+
.option('--format <format>', 'text|json', 'text')
|
|
296
|
+
.action((options) => {
|
|
297
|
+
if ((options.plugin && options.element) || (!options.plugin && !options.element)) {
|
|
298
|
+
throw new Error('Provide exactly one of --plugin or --element');
|
|
299
|
+
}
|
|
300
|
+
if (options.plugin) {
|
|
301
|
+
const plugin = getPluginCapabilities(options.plugin);
|
|
302
|
+
if (!plugin) {
|
|
303
|
+
throw new Error(`Unknown plugin "${options.plugin}"`);
|
|
304
|
+
}
|
|
305
|
+
emitOutput(plugin, options.format, renderPlugin);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
emitOutput(getElementCapabilities(options.element ?? ''), options.format, renderElementCapabilities);
|
|
309
|
+
});
|
|
310
|
+
pluginProgram
|
|
311
|
+
.command('operation')
|
|
312
|
+
.description('Show one plugin operation descriptor')
|
|
313
|
+
.requiredOption('--plugin <id>', 'Plugin identifier')
|
|
314
|
+
.requiredOption('--name <operation>', 'Operation name')
|
|
315
|
+
.option('--format <format>', 'text|json', 'text')
|
|
316
|
+
.action((options) => {
|
|
317
|
+
const descriptor = getOperationDescriptor(options.plugin, options.name);
|
|
318
|
+
if (!descriptor) {
|
|
319
|
+
throw new Error(`Unknown operation "${options.name}" for plugin "${options.plugin}"`);
|
|
320
|
+
}
|
|
321
|
+
emitOutput(descriptor, options.format, renderOperation);
|
|
322
|
+
});
|
|
323
|
+
pluginProgram
|
|
324
|
+
.command('run')
|
|
325
|
+
.description('Run one plugin operation against markdown from stdin')
|
|
326
|
+
.requiredOption('--plugin <id>', 'Plugin identifier')
|
|
327
|
+
.requiredOption('--name <operation>', 'Operation name')
|
|
328
|
+
.requiredOption('--select <query>', 'Query string')
|
|
329
|
+
.option('--args <json>', 'JSON object for operation args', '{}')
|
|
330
|
+
.option('--format <format>', 'text|json', 'text')
|
|
331
|
+
.action(async (options) => {
|
|
332
|
+
const input = await readStdin();
|
|
333
|
+
const result = runPluginOperation({
|
|
334
|
+
plugin: options.plugin,
|
|
335
|
+
operation: options.name,
|
|
336
|
+
markdown: input,
|
|
337
|
+
query: options.select,
|
|
338
|
+
args: parseJsonObjectOption(options.args, '--args'),
|
|
339
|
+
});
|
|
340
|
+
emitPluginRunResult(result, options.format);
|
|
341
|
+
});
|
|
342
|
+
program.parse(process.argv);
|
|
343
|
+
async function readStdin() {
|
|
344
|
+
const chunks = [];
|
|
345
|
+
for await (const chunk of process.stdin) {
|
|
346
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
347
|
+
}
|
|
348
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
349
|
+
}
|
|
350
|
+
function emitOutput(value, format, renderText) {
|
|
351
|
+
if (format === 'json') {
|
|
352
|
+
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (format !== 'text') {
|
|
356
|
+
throw new Error(`Unsupported output format "${format}"`);
|
|
357
|
+
}
|
|
358
|
+
process.stdout.write(`${renderText(value)}\n`);
|
|
359
|
+
}
|
|
360
|
+
function renderCapabilities(capabilities) {
|
|
361
|
+
const lines = [
|
|
362
|
+
`core query operators: ${capabilities.core.queryOperators.join(', ')}`,
|
|
363
|
+
`core generic operations: ${capabilities.core.genericOperations.join(', ')}`,
|
|
364
|
+
`core custom requests: ${capabilities.core.customRequests.join(', ')}`,
|
|
365
|
+
'plugins:',
|
|
366
|
+
];
|
|
367
|
+
for (const plugin of capabilities.plugins) {
|
|
368
|
+
lines.push(`- ${plugin.id} (${plugin.availability}) :: ${plugin.elementKinds.join(', ')}`);
|
|
369
|
+
}
|
|
370
|
+
return lines.join('\n');
|
|
371
|
+
}
|
|
372
|
+
function renderPluginList(plugins) {
|
|
373
|
+
return plugins.map((plugin) => `${plugin.id}\t${plugin.availability}\t${plugin.elementKinds.join(',')}`).join('\n');
|
|
374
|
+
}
|
|
375
|
+
function renderPlugin(plugin) {
|
|
376
|
+
const lines = [
|
|
377
|
+
`plugin: ${plugin.id}`,
|
|
378
|
+
`title: ${plugin.title}`,
|
|
379
|
+
`availability: ${plugin.availability}`,
|
|
380
|
+
`elements: ${plugin.elementKinds.join(', ')}`,
|
|
381
|
+
'operations:',
|
|
382
|
+
];
|
|
383
|
+
for (const operation of plugin.operations) {
|
|
384
|
+
lines.push(`- ${operation.name} (${operation.availability}, ${operation.stability})`);
|
|
385
|
+
}
|
|
386
|
+
if (plugin.queryExtensions?.length) {
|
|
387
|
+
lines.push('query extensions:');
|
|
388
|
+
for (const extension of plugin.queryExtensions) {
|
|
389
|
+
lines.push(`- ${extension.name} (${extension.availability})`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return lines.join('\n');
|
|
393
|
+
}
|
|
394
|
+
function renderElementCapabilities(capabilities) {
|
|
395
|
+
const lines = [`element: ${capabilities.elementKind}`, 'plugins:'];
|
|
396
|
+
for (const plugin of capabilities.plugins) {
|
|
397
|
+
lines.push(`- ${plugin.id} (${plugin.availability})`);
|
|
398
|
+
}
|
|
399
|
+
return lines.join('\n');
|
|
400
|
+
}
|
|
401
|
+
function renderOperation(operation) {
|
|
402
|
+
const lines = [
|
|
403
|
+
`operation: ${operation.name}`,
|
|
404
|
+
`category: ${operation.category}`,
|
|
405
|
+
`availability: ${operation.availability}`,
|
|
406
|
+
`targets: ${operation.targetKinds.join(', ')}`,
|
|
407
|
+
`target cardinality: ${operation.targetCardinality}`,
|
|
408
|
+
];
|
|
409
|
+
if (operation.params.length) {
|
|
410
|
+
lines.push('params:');
|
|
411
|
+
for (const param of operation.params) {
|
|
412
|
+
lines.push(`- ${param.name}: ${param.type}${param.required ? ' required' : ''}`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return lines.join('\n');
|
|
416
|
+
}
|
|
417
|
+
function emitPluginRunResult(result, format) {
|
|
418
|
+
if (format === 'json') {
|
|
419
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (format !== 'text') {
|
|
423
|
+
throw new Error(`Unsupported output format "${format}"`);
|
|
424
|
+
}
|
|
425
|
+
if (result.kind === 'mutation') {
|
|
426
|
+
process.stdout.write(result.markdown);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
if (result.kind === 'json') {
|
|
430
|
+
process.stdout.write(`${JSON.stringify(result.value, null, 2)}\n`);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
process.stdout.write(result.text.endsWith('\n') ? result.text : `${result.text}\n`);
|
|
434
|
+
}
|
|
435
|
+
function parseJsonObjectOption(input, optionName) {
|
|
436
|
+
let parsed;
|
|
437
|
+
try {
|
|
438
|
+
parsed = JSON.parse(input);
|
|
439
|
+
}
|
|
440
|
+
catch {
|
|
441
|
+
throw new Error(`${optionName} must be valid JSON`);
|
|
442
|
+
}
|
|
443
|
+
if (parsed === null || Array.isArray(parsed) || typeof parsed !== 'object') {
|
|
444
|
+
throw new Error(`${optionName} must be a JSON object`);
|
|
445
|
+
}
|
|
446
|
+
return parsed;
|
|
447
|
+
}
|
|
448
|
+
function parseDelimitedFormat(value) {
|
|
449
|
+
if (value === 'csv' || value === 'tsv') {
|
|
450
|
+
return value;
|
|
451
|
+
}
|
|
452
|
+
throw new Error(`Unsupported delimited format "${value}"`);
|
|
453
|
+
}
|
|
454
|
+
function parseDelimitedExportOptions(options) {
|
|
455
|
+
if (options.lineTerminator !== 'lf' && options.lineTerminator !== 'crlf') {
|
|
456
|
+
throw new Error(`Unsupported line terminator "${options.lineTerminator}"`);
|
|
457
|
+
}
|
|
458
|
+
if (options.quoteMode !== 'minimal' && options.quoteMode !== 'always') {
|
|
459
|
+
throw new Error(`Unsupported quote mode "${options.quoteMode}"`);
|
|
460
|
+
}
|
|
461
|
+
return {
|
|
462
|
+
includeHeader: options.header,
|
|
463
|
+
lineTerminator: options.lineTerminator === 'crlf' ? '\r\n' : '\n',
|
|
464
|
+
quoteMode: options.quoteMode,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
function parseDelimitedImportOptions(options) {
|
|
468
|
+
return {
|
|
469
|
+
hasHeader: options.header,
|
|
470
|
+
strictWidth: options.strictWidth ?? false,
|
|
471
|
+
trimCells: options.trimCells ?? false,
|
|
472
|
+
...(options.align === undefined ? {} : { align: parseAlignmentOption(options.align) }),
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function parseAlignmentOption(input) {
|
|
476
|
+
let parsed;
|
|
477
|
+
try {
|
|
478
|
+
parsed = JSON.parse(input);
|
|
479
|
+
}
|
|
480
|
+
catch {
|
|
481
|
+
throw new Error('--align must be valid JSON');
|
|
482
|
+
}
|
|
483
|
+
if (!Array.isArray(parsed)) {
|
|
484
|
+
throw new Error('--align must be a JSON array');
|
|
485
|
+
}
|
|
486
|
+
return parsed.map((value, index) => {
|
|
487
|
+
if (value !== null && value !== 'left' && value !== 'right' && value !== 'center') {
|
|
488
|
+
throw new Error(`--align has an invalid value at index ${String(index)}`);
|
|
489
|
+
}
|
|
490
|
+
return value;
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
function parseIntegerOption(input, optionName) {
|
|
494
|
+
if (!/^-?\d+$/.test(input)) {
|
|
495
|
+
throw new Error(`${optionName} must be an integer`);
|
|
496
|
+
}
|
|
497
|
+
const value = Number(input);
|
|
498
|
+
if (!Number.isSafeInteger(value)) {
|
|
499
|
+
throw new Error(`${optionName} must be a safe integer`);
|
|
500
|
+
}
|
|
501
|
+
return value;
|
|
502
|
+
}
|
|
503
|
+
function parseTableColumnAddress(input) {
|
|
504
|
+
return /^-?\d+$/.test(input) ? parseIntegerOption(input, '--column') : input;
|
|
505
|
+
}
|
|
506
|
+
function parseStringArrayOption(input, optionName) {
|
|
507
|
+
let parsed;
|
|
508
|
+
try {
|
|
509
|
+
parsed = JSON.parse(input);
|
|
510
|
+
}
|
|
511
|
+
catch {
|
|
512
|
+
throw new Error(`${optionName} must be valid JSON`);
|
|
513
|
+
}
|
|
514
|
+
if (!Array.isArray(parsed) || !parsed.every((value) => typeof value === 'string')) {
|
|
515
|
+
throw new Error(`${optionName} must be a JSON array of strings`);
|
|
516
|
+
}
|
|
517
|
+
return parsed;
|
|
518
|
+
}
|
|
519
|
+
function parseTableSortDirection(input) {
|
|
520
|
+
if (input !== 'asc' && input !== 'desc') {
|
|
521
|
+
throw new Error(`Unsupported table sort direction "${input}"`);
|
|
522
|
+
}
|
|
523
|
+
return input;
|
|
524
|
+
}
|
|
525
|
+
function parseMoveTargetPolicy(input) {
|
|
526
|
+
if (!isMoveTargetPolicy(input)) {
|
|
527
|
+
throw new Error(`Unsupported move target policy "${input}"`);
|
|
528
|
+
}
|
|
529
|
+
return input;
|
|
530
|
+
}
|
|
531
|
+
function emitDelimitedText(value, lineTerminator) {
|
|
532
|
+
process.stdout.write(value.endsWith(lineTerminator) ? value : `${value}${lineTerminator}`);
|
|
533
|
+
}
|
|
534
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,EACf,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EACX,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,yBAAyB,EACzB,SAAS,EACT,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,UAAU,CAAC;KAChB,WAAW,CAAC,0BAA0B,CAAC,CAAC;AAE3C,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,4CAA4C,CAAC;KACzD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,KAAK,GAAG,MAAM,SAAS,EAAE,CAAC;IAChC,OAAO,CAAC,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c,EAAE,CAAC,CAAC;AAC7F,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { astToJson, convertMarkdownToAstJson, copyMarkdown, deleteMarkdown, insertMarkdown, jsonToAst, moveMarkdown, parseMarkdown, replaceMarkdown, restoreMarkdownFromAstJson, stringifyAst, unwrapMarkdown, validateQuery, wrapMarkdown, } from './markdown.js';
|
|
2
|
+
export { PluginRegistry, PluginOperationError, defaultPluginRegistry, getCapabilities, getElementCapabilities, getOperationDescriptor, getPluginCapabilities, listPlugins, listPluginsForElementKind, listQueryExtensions, runPluginOperation, } from './plugins.js';
|
|
3
|
+
export { queryAst } from './query.js';
|
|
4
|
+
export { extractTableModel, extractTableModels, csvToMarkdownTable, csvToTableAst, delimitedToMarkdownTable, delimitedToTableModel, delimiterForFormat, addTableColumn, addTableColumnNode, deleteTableColumn, deleteTableColumnNode, deleteTableRow, deleteTableRowNode, flattenTableCellText, getTableCell, insertCsvAsTable, insertDelimitedAsTable, insertTsvAsTable, insertTableRow, insertTableRowNode, parseDelimited, replaceTableWithCsv, replaceTableWithDelimited, replaceTableWithTsv, resolveSingleTableColumnIndex, resolveTableColumnIndexes, tableModelToAst, tableModelToDelimited, tableNodeToModel, tableToCsv, tableToDelimited, tableToTsv, sortTable, sortTableNode, tsvToMarkdownTable, tsvToTableAst, updateTableCell, updateTableCellNode, } from './table.js';
|
|
5
|
+
export type { InsertPosition, InsertResult, MdastNode, MoveTargetPolicy, MutationResult, QueryMatch, QueryOperator, QueryPredicate, QueryStep, } from './types.js';
|
|
6
|
+
export type { DelimitedDelimiter, DelimitedExportOptions, DelimitedFormat, DelimitedImportOptions, TableAlignment, TableColumnAddress, TableModel, TableSortDirection, } from './table.js';
|
|
7
|
+
export type { AstElementPlugin, CapabilitiesSnapshot, CapabilityAvailability, ConverterDescriptor, CoreCapabilities, ElementCapabilities, PluginOperationArgs, PluginOperationErrorCode, PluginOperationErrorShape, OperationDescriptor, OperationParamDescriptor, PluginRunRequest, PluginRunResult, OperationResultDescriptor, PluginCapabilities, QueryExtensionDescriptor, } from './plugins.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { astToJson, convertMarkdownToAstJson, copyMarkdown, deleteMarkdown, insertMarkdown, jsonToAst, moveMarkdown, parseMarkdown, replaceMarkdown, restoreMarkdownFromAstJson, stringifyAst, unwrapMarkdown, validateQuery, wrapMarkdown, } from './markdown.js';
|
|
2
|
+
export { PluginRegistry, PluginOperationError, defaultPluginRegistry, getCapabilities, getElementCapabilities, getOperationDescriptor, getPluginCapabilities, listPlugins, listPluginsForElementKind, listQueryExtensions, runPluginOperation, } from './plugins.js';
|
|
3
|
+
export { queryAst } from './query.js';
|
|
4
|
+
export { extractTableModel, extractTableModels, csvToMarkdownTable, csvToTableAst, delimitedToMarkdownTable, delimitedToTableModel, delimiterForFormat, addTableColumn, addTableColumnNode, deleteTableColumn, deleteTableColumnNode, deleteTableRow, deleteTableRowNode, flattenTableCellText, getTableCell, insertCsvAsTable, insertDelimitedAsTable, insertTsvAsTable, insertTableRow, insertTableRowNode, parseDelimited, replaceTableWithCsv, replaceTableWithDelimited, replaceTableWithTsv, resolveSingleTableColumnIndex, resolveTableColumnIndexes, tableModelToAst, tableModelToDelimited, tableNodeToModel, tableToCsv, tableToDelimited, tableToTsv, sortTable, sortTableNode, tsvToMarkdownTable, tsvToTableAst, updateTableCell, updateTableCellNode, } from './table.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,SAAS,EACT,YAAY,EACZ,aAAa,EACb,eAAe,EACf,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,mBAAmB,GACnB,MAAM,YAAY,CAAC"}
|