@bcts/dcbor-cli 1.0.0-alpha.13
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 +48 -0
- package/README.md +105 -0
- package/dist/cli.cjs +132 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +133 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.d.cts +202 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +202 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/src-Ce085uR8.mjs +407 -0
- package/dist/src-Ce085uR8.mjs.map +1 -0
- package/dist/src-M5HM-SCU.cjs +490 -0
- package/dist/src-M5HM-SCU.cjs.map +1 -0
- package/package.json +87 -0
- package/src/cli.ts +239 -0
- package/src/cmd/array.ts +41 -0
- package/src/cmd/default.ts +108 -0
- package/src/cmd/index.ts +19 -0
- package/src/cmd/map.ts +41 -0
- package/src/cmd/match.ts +196 -0
- package/src/format.ts +82 -0
- package/src/index.ts +41 -0
- package/src/run.ts +134 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { bytesToHex, cborData, decodeCbor, diagnosticOpt, errorMsg, errorToString, hexOpt, hexToBytes, registerTags } from "@bcts/dcbor";
|
|
2
|
+
import { composeDcborArray, composeDcborMap, composeErrorMessage, fullErrorMessage, parseDcborItem } from "@bcts/dcbor-parse";
|
|
3
|
+
import { FormatPathsOptsBuilder, formatPathsWithCaptures, parse, pathsWithCaptures } from "@bcts/dcbor-pattern";
|
|
4
|
+
|
|
5
|
+
//#region src/format.ts
|
|
6
|
+
/**
|
|
7
|
+
* Format utilities for dcbor-cli
|
|
8
|
+
* Contains InputFormat, OutputFormat enums and formatOutput function
|
|
9
|
+
* Equivalent to the format-related code in Rust's main.rs
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Format CBOR output in the specified format
|
|
13
|
+
* Equivalent to Rust's format_output function
|
|
14
|
+
*/
|
|
15
|
+
function formatOutput(cbor, outFormat, annotate) {
|
|
16
|
+
try {
|
|
17
|
+
switch (outFormat) {
|
|
18
|
+
case "diag": if (annotate) return {
|
|
19
|
+
ok: true,
|
|
20
|
+
value: diagnosticOpt(cbor, {
|
|
21
|
+
annotate: true,
|
|
22
|
+
flat: true
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
else return {
|
|
26
|
+
ok: true,
|
|
27
|
+
value: diagnosticOpt(cbor, { flat: true })
|
|
28
|
+
};
|
|
29
|
+
case "hex": if (annotate) return {
|
|
30
|
+
ok: true,
|
|
31
|
+
value: hexOpt(cbor, { annotate: true })
|
|
32
|
+
};
|
|
33
|
+
else return {
|
|
34
|
+
ok: true,
|
|
35
|
+
value: bytesToHex(cborData(cbor))
|
|
36
|
+
};
|
|
37
|
+
case "bin": return {
|
|
38
|
+
ok: true,
|
|
39
|
+
value: bytesToHex(cborData(cbor))
|
|
40
|
+
};
|
|
41
|
+
case "none": return {
|
|
42
|
+
ok: true,
|
|
43
|
+
value: ""
|
|
44
|
+
};
|
|
45
|
+
default: return {
|
|
46
|
+
ok: false,
|
|
47
|
+
error: errorMsg(`Unknown output format: ${outFormat}`)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
} catch (e) {
|
|
51
|
+
return {
|
|
52
|
+
ok: false,
|
|
53
|
+
error: errorMsg(e instanceof Error ? e.message : String(e))
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Read binary data from a buffer
|
|
59
|
+
*/
|
|
60
|
+
function readData(data) {
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Read string data from a buffer
|
|
65
|
+
*/
|
|
66
|
+
function readString(data) {
|
|
67
|
+
return new TextDecoder().decode(data);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/cmd/array.ts
|
|
72
|
+
/**
|
|
73
|
+
* Compose a dCBOR array from the provided elements
|
|
74
|
+
* Equivalent to Rust's cmd/array.rs
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* Execute array command
|
|
78
|
+
*/
|
|
79
|
+
function execArray(args) {
|
|
80
|
+
const result = composeDcborArray(args.elements);
|
|
81
|
+
if (!result.ok) return {
|
|
82
|
+
ok: false,
|
|
83
|
+
error: errorMsg(composeErrorMessage(result.error))
|
|
84
|
+
};
|
|
85
|
+
return formatOutput(result.value, args.out, args.annotate);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create an Exec implementation for array command
|
|
89
|
+
*/
|
|
90
|
+
function createArrayCommand(args) {
|
|
91
|
+
return { exec: () => execArray(args) };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/cmd/default.ts
|
|
96
|
+
/**
|
|
97
|
+
* Default parsing and validation behavior
|
|
98
|
+
* Equivalent to Rust's cmd/default.rs
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* Execute default command with a reader function for stdin
|
|
102
|
+
*/
|
|
103
|
+
function execDefaultWithReader(args, readString$1, readData$1) {
|
|
104
|
+
let cbor;
|
|
105
|
+
try {
|
|
106
|
+
switch (args.in) {
|
|
107
|
+
case "diag":
|
|
108
|
+
if (args.input !== void 0) {
|
|
109
|
+
const result = parseDcborItem(args.input);
|
|
110
|
+
if (!result.ok) return {
|
|
111
|
+
ok: false,
|
|
112
|
+
error: errorMsg(fullErrorMessage(result.error, args.input))
|
|
113
|
+
};
|
|
114
|
+
cbor = result.value;
|
|
115
|
+
} else {
|
|
116
|
+
const diag = readString$1();
|
|
117
|
+
const result = parseDcborItem(diag);
|
|
118
|
+
if (!result.ok) return {
|
|
119
|
+
ok: false,
|
|
120
|
+
error: errorMsg(fullErrorMessage(result.error, diag))
|
|
121
|
+
};
|
|
122
|
+
cbor = result.value;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case "hex":
|
|
126
|
+
if (args.input !== void 0) cbor = decodeCbor(hexToBytes(args.input));
|
|
127
|
+
else cbor = decodeCbor(hexToBytes(readString$1().trim()));
|
|
128
|
+
break;
|
|
129
|
+
case "bin":
|
|
130
|
+
cbor = decodeCbor(readData$1());
|
|
131
|
+
break;
|
|
132
|
+
default: return {
|
|
133
|
+
ok: false,
|
|
134
|
+
error: errorMsg(`Unknown input format: ${args.in}`)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
} catch (e) {
|
|
138
|
+
return {
|
|
139
|
+
ok: false,
|
|
140
|
+
error: errorMsg(e instanceof Error ? e.message : String(e))
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
return formatOutput(cbor, args.out, args.annotate);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Execute default command (reads from stdin if input not provided)
|
|
147
|
+
*/
|
|
148
|
+
function execDefault(args, stdinContent) {
|
|
149
|
+
return execDefaultWithReader(args, () => stdinContent ?? "", () => {
|
|
150
|
+
if (stdinContent) return new TextEncoder().encode(stdinContent);
|
|
151
|
+
return new Uint8Array(0);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create an Exec implementation for default command
|
|
156
|
+
*/
|
|
157
|
+
function createDefaultCommand(args, stdinContent) {
|
|
158
|
+
return { exec: () => execDefault(args, stdinContent) };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/cmd/map.ts
|
|
163
|
+
/**
|
|
164
|
+
* Compose a dCBOR map from the provided keys and values
|
|
165
|
+
* Equivalent to Rust's cmd/map.rs
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* Execute map command
|
|
169
|
+
*/
|
|
170
|
+
function execMap(args) {
|
|
171
|
+
const result = composeDcborMap(args.kvPairs);
|
|
172
|
+
if (!result.ok) return {
|
|
173
|
+
ok: false,
|
|
174
|
+
error: errorMsg(composeErrorMessage(result.error))
|
|
175
|
+
};
|
|
176
|
+
return formatOutput(result.value, args.out, args.annotate);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create an Exec implementation for map command
|
|
180
|
+
*/
|
|
181
|
+
function createMapCommand(args) {
|
|
182
|
+
return { exec: () => execMap(args) };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/cmd/match.ts
|
|
187
|
+
/**
|
|
188
|
+
* Match dCBOR data against a pattern
|
|
189
|
+
* Equivalent to Rust's cmd/match.rs
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Format a parse error with context
|
|
193
|
+
*/
|
|
194
|
+
function formatPatternError(error, patternStr) {
|
|
195
|
+
switch (error.type) {
|
|
196
|
+
case "UnrecognizedToken": {
|
|
197
|
+
const start = Math.min(error.span.start, patternStr.length);
|
|
198
|
+
const end = Math.min(error.span.end, patternStr.length);
|
|
199
|
+
return `Failed to parse pattern at position ${start}..${end}: unrecognized token '${start < patternStr.length ? patternStr.slice(start, end) : "<end of input>"}'\nPattern: ${patternStr}\n ${" ".repeat(start)}^`;
|
|
200
|
+
}
|
|
201
|
+
case "ExtraData": {
|
|
202
|
+
const start = Math.min(error.span.start, patternStr.length);
|
|
203
|
+
return `Failed to parse pattern: extra data at position ${start}\nPattern: ${patternStr}\n ${" ".repeat(start)}^`;
|
|
204
|
+
}
|
|
205
|
+
case "UnexpectedToken": {
|
|
206
|
+
const start = Math.min(error.span.start, patternStr.length);
|
|
207
|
+
return `Failed to parse pattern at position ${start}: unexpected token\nPattern: ${patternStr}\n ${" ".repeat(start)}^`;
|
|
208
|
+
}
|
|
209
|
+
default: return `Failed to parse pattern: ${error.type}`;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Execute match command
|
|
214
|
+
*/
|
|
215
|
+
function execMatch(args, stdinContent) {
|
|
216
|
+
let inputData;
|
|
217
|
+
if (args.input !== void 0) inputData = new TextEncoder().encode(args.input);
|
|
218
|
+
else if (stdinContent !== void 0) inputData = new TextEncoder().encode(stdinContent);
|
|
219
|
+
else inputData = new Uint8Array(0);
|
|
220
|
+
let cbor;
|
|
221
|
+
try {
|
|
222
|
+
switch (args.in) {
|
|
223
|
+
case "diag": {
|
|
224
|
+
const inputStr = new TextDecoder().decode(inputData).trim();
|
|
225
|
+
const result = parseDcborItem(inputStr);
|
|
226
|
+
if (!result.ok) return {
|
|
227
|
+
ok: false,
|
|
228
|
+
error: errorMsg(fullErrorMessage(result.error, inputStr))
|
|
229
|
+
};
|
|
230
|
+
cbor = result.value;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
case "hex":
|
|
234
|
+
cbor = decodeCbor(hexToBytes(new TextDecoder().decode(inputData).trim()));
|
|
235
|
+
break;
|
|
236
|
+
case "bin":
|
|
237
|
+
cbor = decodeCbor(inputData);
|
|
238
|
+
break;
|
|
239
|
+
default: return {
|
|
240
|
+
ok: false,
|
|
241
|
+
error: errorMsg(`Unknown input format: ${args.in}`)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
} catch (e) {
|
|
245
|
+
return {
|
|
246
|
+
ok: false,
|
|
247
|
+
error: errorMsg(e instanceof Error ? e.message : String(e))
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
const patternResult = parse(args.pattern);
|
|
251
|
+
if (!patternResult.ok) return {
|
|
252
|
+
ok: false,
|
|
253
|
+
error: errorMsg(formatPatternError(patternResult.error, args.pattern))
|
|
254
|
+
};
|
|
255
|
+
const pattern = patternResult.value;
|
|
256
|
+
const { paths, captures } = pathsWithCaptures(pattern, cbor);
|
|
257
|
+
if (paths.length === 0) return {
|
|
258
|
+
ok: false,
|
|
259
|
+
error: errorMsg("No match")
|
|
260
|
+
};
|
|
261
|
+
switch (args.out) {
|
|
262
|
+
case "paths": {
|
|
263
|
+
const formatOptions = FormatPathsOptsBuilder.new().indent(!args.noIndent).lastElementOnly(args.lastOnly).build();
|
|
264
|
+
if (args.captures) return {
|
|
265
|
+
ok: true,
|
|
266
|
+
value: formatPathsWithCaptures(paths, captures, formatOptions)
|
|
267
|
+
};
|
|
268
|
+
else return {
|
|
269
|
+
ok: true,
|
|
270
|
+
value: formatPathsWithCaptures(paths, /* @__PURE__ */ new Map(), formatOptions)
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
case "diag":
|
|
274
|
+
case "hex":
|
|
275
|
+
case "bin": {
|
|
276
|
+
const outputFormat = args.out;
|
|
277
|
+
const elementsToOutput = args.lastOnly ? paths.map((path) => path[path.length - 1]).filter(Boolean) : paths.map((path) => path[0]).filter(Boolean);
|
|
278
|
+
const results = [];
|
|
279
|
+
for (const element of elementsToOutput) {
|
|
280
|
+
const result = formatOutput(element, outputFormat, args.annotate);
|
|
281
|
+
if (!result.ok) return result;
|
|
282
|
+
results.push(result.value);
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
ok: true,
|
|
286
|
+
value: results.join("\n")
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
default: return {
|
|
290
|
+
ok: false,
|
|
291
|
+
error: errorMsg(`Unknown output format: ${args.out}`)
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Create an Exec implementation for match command
|
|
297
|
+
*/
|
|
298
|
+
function createMatchCommand(args, stdinContent) {
|
|
299
|
+
return { exec: () => execMatch(args, stdinContent) };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/run.ts
|
|
304
|
+
/**
|
|
305
|
+
* Main run function for dcbor-cli
|
|
306
|
+
* Equivalent to Rust's run function in main.rs
|
|
307
|
+
*/
|
|
308
|
+
/**
|
|
309
|
+
* Main execution function
|
|
310
|
+
* Equivalent to Rust's run<I, T, R, W> function
|
|
311
|
+
*/
|
|
312
|
+
function run(options) {
|
|
313
|
+
registerTags();
|
|
314
|
+
const { command, stdinContent } = options;
|
|
315
|
+
let output;
|
|
316
|
+
let isBinary = false;
|
|
317
|
+
switch (command.type) {
|
|
318
|
+
case "array": {
|
|
319
|
+
const result = execArray({
|
|
320
|
+
elements: command.elements,
|
|
321
|
+
out: command.out,
|
|
322
|
+
annotate: command.annotate
|
|
323
|
+
});
|
|
324
|
+
if (!result.ok) return {
|
|
325
|
+
ok: false,
|
|
326
|
+
error: new Error(errorToString(result.error))
|
|
327
|
+
};
|
|
328
|
+
output = result.value;
|
|
329
|
+
isBinary = command.out === "bin";
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
case "map": {
|
|
333
|
+
const result = execMap({
|
|
334
|
+
kvPairs: command.kvPairs,
|
|
335
|
+
out: command.out,
|
|
336
|
+
annotate: command.annotate
|
|
337
|
+
});
|
|
338
|
+
if (!result.ok) return {
|
|
339
|
+
ok: false,
|
|
340
|
+
error: new Error(errorToString(result.error))
|
|
341
|
+
};
|
|
342
|
+
output = result.value;
|
|
343
|
+
isBinary = command.out === "bin";
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
case "match": {
|
|
347
|
+
const result = execMatch({
|
|
348
|
+
pattern: command.pattern,
|
|
349
|
+
input: command.input,
|
|
350
|
+
in: command.in,
|
|
351
|
+
out: command.out,
|
|
352
|
+
noIndent: command.noIndent,
|
|
353
|
+
lastOnly: command.lastOnly,
|
|
354
|
+
annotate: command.annotate,
|
|
355
|
+
captures: command.captures
|
|
356
|
+
}, stdinContent);
|
|
357
|
+
if (!result.ok) return {
|
|
358
|
+
ok: false,
|
|
359
|
+
error: new Error(errorToString(result.error))
|
|
360
|
+
};
|
|
361
|
+
output = result.value;
|
|
362
|
+
isBinary = command.out === "bin";
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
case "default": {
|
|
366
|
+
const result = execDefault({
|
|
367
|
+
input: command.input,
|
|
368
|
+
in: command.in,
|
|
369
|
+
out: command.out,
|
|
370
|
+
annotate: command.annotate
|
|
371
|
+
}, stdinContent);
|
|
372
|
+
if (!result.ok) return {
|
|
373
|
+
ok: false,
|
|
374
|
+
error: new Error(errorToString(result.error))
|
|
375
|
+
};
|
|
376
|
+
output = result.value;
|
|
377
|
+
isBinary = command.out === "bin";
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
default: return {
|
|
381
|
+
ok: false,
|
|
382
|
+
error: /* @__PURE__ */ new Error("Unknown command type")
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
ok: true,
|
|
387
|
+
value: {
|
|
388
|
+
output,
|
|
389
|
+
isBinary
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/index.ts
|
|
396
|
+
/**
|
|
397
|
+
* @bcts/dcbor-cli - Command line parser/validator for deterministic CBOR (dCBOR)
|
|
398
|
+
*
|
|
399
|
+
* A command line tool for composing, parsing and validating Gordian dCBOR.
|
|
400
|
+
*
|
|
401
|
+
* @packageDocumentation
|
|
402
|
+
*/
|
|
403
|
+
const VERSION = "1.0.0-alpha.13";
|
|
404
|
+
|
|
405
|
+
//#endregion
|
|
406
|
+
export { createMapCommand as a, execDefault as c, execArray as d, formatOutput as f, execMatch as i, execDefaultWithReader as l, readString as m, run as n, execMap as o, readData as p, createMatchCommand as r, createDefaultCommand as s, VERSION as t, createArrayCommand as u };
|
|
407
|
+
//# sourceMappingURL=src-Ce085uR8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-Ce085uR8.mjs","names":["cbor: Cbor","readString","readData","inputData: Uint8Array","cbor: Cbor","parsePattern","outputFormat: OutputFormat","results: string[]","output: string"],"sources":["../src/format.ts","../src/cmd/array.ts","../src/cmd/default.ts","../src/cmd/map.ts","../src/cmd/match.ts","../src/run.ts","../src/index.ts"],"sourcesContent":["/**\n * Format utilities for dcbor-cli\n * Contains InputFormat, OutputFormat enums and formatOutput function\n * Equivalent to the format-related code in Rust's main.rs\n */\n/* eslint-disable @typescript-eslint/restrict-template-expressions */\n\nimport {\n type Cbor,\n type Result,\n diagnosticOpt,\n hexOpt,\n bytesToHex,\n cborData,\n errorMsg,\n} from \"@bcts/dcbor\";\n\n/**\n * Input format options\n */\nexport type InputFormat = \"diag\" | \"hex\" | \"bin\";\n\n/**\n * Output format options\n */\nexport type OutputFormat = \"diag\" | \"hex\" | \"bin\" | \"none\";\n\n/**\n * Format CBOR output in the specified format\n * Equivalent to Rust's format_output function\n */\nexport function formatOutput(\n cbor: Cbor,\n outFormat: OutputFormat,\n annotate: boolean,\n): Result<string> {\n try {\n switch (outFormat) {\n case \"diag\":\n // Use flat: true for compact single-line output (matching Rust CLI behavior)\n if (annotate) {\n return { ok: true, value: diagnosticOpt(cbor, { annotate: true, flat: true }) };\n } else {\n return { ok: true, value: diagnosticOpt(cbor, { flat: true }) };\n }\n\n case \"hex\":\n if (annotate) {\n return { ok: true, value: hexOpt(cbor, { annotate: true }) };\n } else {\n return { ok: true, value: bytesToHex(cborData(cbor)) };\n }\n\n case \"bin\":\n // For binary output, return hex representation\n // The caller will handle converting to actual binary\n return { ok: true, value: bytesToHex(cborData(cbor)) };\n\n case \"none\":\n return { ok: true, value: \"\" };\n\n default:\n return { ok: false, error: errorMsg(`Unknown output format: ${outFormat}`) };\n }\n } catch (e) {\n return { ok: false, error: errorMsg(e instanceof Error ? e.message : String(e)) };\n }\n}\n\n/**\n * Read binary data from a buffer\n */\nexport function readData(data: Uint8Array): Uint8Array {\n return data;\n}\n\n/**\n * Read string data from a buffer\n */\nexport function readString(data: Uint8Array): string {\n return new TextDecoder().decode(data);\n}\n","/**\n * Compose a dCBOR array from the provided elements\n * Equivalent to Rust's cmd/array.rs\n */\n\nimport { type Result, errorMsg } from \"@bcts/dcbor\";\nimport { composeDcborArray, composeErrorMessage } from \"@bcts/dcbor-parse\";\nimport type { Exec } from \"./index.js\";\nimport { type OutputFormat, formatOutput } from \"../format.js\";\n\n/**\n * Command arguments for array composition\n */\nexport interface ArrayCommandArgs {\n /** Each element is parsed as a dCBOR item in diagnostic notation */\n elements: string[];\n /** The output format (default: hex) */\n out: OutputFormat;\n /** Output with annotations */\n annotate: boolean;\n}\n\n/**\n * Execute array command\n */\nexport function execArray(args: ArrayCommandArgs): Result<string> {\n const result = composeDcborArray(args.elements);\n if (!result.ok) {\n return { ok: false, error: errorMsg(composeErrorMessage(result.error)) };\n }\n return formatOutput(result.value, args.out, args.annotate);\n}\n\n/**\n * Create an Exec implementation for array command\n */\nexport function createArrayCommand(args: ArrayCommandArgs): Exec {\n return {\n exec: () => execArray(args),\n };\n}\n","/**\n * Default parsing and validation behavior\n * Equivalent to Rust's cmd/default.rs\n */\n/* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/strict-boolean-expressions */\n\nimport { type Cbor, type Result, decodeCbor, hexToBytes, errorMsg } from \"@bcts/dcbor\";\nimport { parseDcborItem, fullErrorMessage } from \"@bcts/dcbor-parse\";\nimport type { Exec } from \"./index.js\";\nimport { type InputFormat, type OutputFormat, formatOutput } from \"../format.js\";\n\n/**\n * Command arguments for default parsing behavior\n */\nexport interface DefaultCommandArgs {\n /** Input dCBOR in the format specified by `in`. Optional - reads from stdin if not provided */\n input?: string | undefined;\n /** The input format (default: diag) */\n in: InputFormat;\n /** The output format (default: hex) */\n out: OutputFormat;\n /** Output with annotations */\n annotate: boolean;\n}\n\n/**\n * Execute default command with a reader function for stdin\n */\nexport function execDefaultWithReader(\n args: DefaultCommandArgs,\n readString: () => string,\n readData: () => Uint8Array,\n): Result<string> {\n let cbor: Cbor;\n\n try {\n switch (args.in) {\n case \"diag\": {\n if (args.input !== undefined) {\n const result = parseDcborItem(args.input);\n if (!result.ok) {\n return {\n ok: false,\n error: errorMsg(fullErrorMessage(result.error, args.input)),\n };\n }\n cbor = result.value;\n } else {\n const diag = readString();\n const result = parseDcborItem(diag);\n if (!result.ok) {\n return {\n ok: false,\n error: errorMsg(fullErrorMessage(result.error, diag)),\n };\n }\n cbor = result.value;\n }\n break;\n }\n case \"hex\": {\n if (args.input !== undefined) {\n cbor = decodeCbor(hexToBytes(args.input));\n } else {\n const hexStr = readString().trim();\n cbor = decodeCbor(hexToBytes(hexStr));\n }\n break;\n }\n case \"bin\": {\n const data = readData();\n cbor = decodeCbor(data);\n break;\n }\n default:\n return { ok: false, error: errorMsg(`Unknown input format: ${args.in}`) };\n }\n } catch (e) {\n return { ok: false, error: errorMsg(e instanceof Error ? e.message : String(e)) };\n }\n\n return formatOutput(cbor, args.out, args.annotate);\n}\n\n/**\n * Execute default command (reads from stdin if input not provided)\n */\nexport function execDefault(args: DefaultCommandArgs, stdinContent?: string): Result<string> {\n return execDefaultWithReader(\n args,\n () => stdinContent ?? \"\",\n () => {\n if (stdinContent) {\n return new TextEncoder().encode(stdinContent);\n }\n return new Uint8Array(0);\n },\n );\n}\n\n/**\n * Create an Exec implementation for default command\n */\nexport function createDefaultCommand(args: DefaultCommandArgs, stdinContent?: string): Exec {\n return {\n exec: () => execDefault(args, stdinContent),\n };\n}\n","/**\n * Compose a dCBOR map from the provided keys and values\n * Equivalent to Rust's cmd/map.rs\n */\n\nimport { type Result, errorMsg } from \"@bcts/dcbor\";\nimport { composeDcborMap, composeErrorMessage } from \"@bcts/dcbor-parse\";\nimport type { Exec } from \"./index.js\";\nimport { type OutputFormat, formatOutput } from \"../format.js\";\n\n/**\n * Command arguments for map composition\n */\nexport interface MapCommandArgs {\n /** Alternating keys and values parsed as dCBOR items in diagnostic notation */\n kvPairs: string[];\n /** The output format (default: hex) */\n out: OutputFormat;\n /** Output with annotations */\n annotate: boolean;\n}\n\n/**\n * Execute map command\n */\nexport function execMap(args: MapCommandArgs): Result<string> {\n const result = composeDcborMap(args.kvPairs);\n if (!result.ok) {\n return { ok: false, error: errorMsg(composeErrorMessage(result.error)) };\n }\n return formatOutput(result.value, args.out, args.annotate);\n}\n\n/**\n * Create an Exec implementation for map command\n */\nexport function createMapCommand(args: MapCommandArgs): Exec {\n return {\n exec: () => execMap(args),\n };\n}\n","/**\n * Match dCBOR data against a pattern\n * Equivalent to Rust's cmd/match.rs\n */\n/* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/switch-exhaustiveness-check */\n\nimport { type Cbor, type Result, decodeCbor, hexToBytes, errorMsg } from \"@bcts/dcbor\";\nimport { parseDcborItem, fullErrorMessage } from \"@bcts/dcbor-parse\";\nimport {\n parse as parsePattern,\n pathsWithCaptures,\n formatPathsWithCaptures,\n FormatPathsOptsBuilder,\n type Error as PatternParseError,\n} from \"@bcts/dcbor-pattern\";\nimport type { Exec } from \"./index.js\";\nimport { type OutputFormat, formatOutput } from \"../format.js\";\nimport type { InputFormat } from \"../format.js\";\n\n/**\n * Match output format options\n */\nexport type MatchOutputFormat = \"paths\" | \"diag\" | \"hex\" | \"bin\";\n\n/**\n * Command arguments for match command\n */\nexport interface MatchCommandArgs {\n /** The pattern to match against */\n pattern: string;\n /** dCBOR input (hex, diag, or binary). If not provided, reads from stdin */\n input?: string | undefined;\n /** Input format (default: diag) */\n in: InputFormat;\n /** Output format (default: paths) */\n out: MatchOutputFormat;\n /** Disable indentation of path elements */\n noIndent: boolean;\n /** Show only the last element of each path */\n lastOnly: boolean;\n /** Add annotations to output */\n annotate: boolean;\n /** Include capture information in output */\n captures: boolean;\n}\n\n/**\n * Format a parse error with context\n */\nfunction formatPatternError(error: PatternParseError, patternStr: string): string {\n switch (error.type) {\n case \"UnrecognizedToken\": {\n const start = Math.min(error.span.start, patternStr.length);\n const end = Math.min(error.span.end, patternStr.length);\n const errorText = start < patternStr.length ? patternStr.slice(start, end) : \"<end of input>\";\n return `Failed to parse pattern at position ${start}..${end}: unrecognized token '${errorText}'\\nPattern: ${patternStr}\\n ${\" \".repeat(start)}^`;\n }\n\n case \"ExtraData\": {\n const start = Math.min(error.span.start, patternStr.length);\n return `Failed to parse pattern: extra data at position ${start}\\nPattern: ${patternStr}\\n ${\" \".repeat(start)}^`;\n }\n\n case \"UnexpectedToken\": {\n const start = Math.min(error.span.start, patternStr.length);\n return `Failed to parse pattern at position ${start}: unexpected token\\nPattern: ${patternStr}\\n ${\" \".repeat(start)}^`;\n }\n\n default:\n return `Failed to parse pattern: ${error.type}`;\n }\n}\n\n/**\n * Execute match command\n */\nexport function execMatch(args: MatchCommandArgs, stdinContent?: string): Result<string> {\n // Read input data\n let inputData: Uint8Array;\n if (args.input !== undefined) {\n inputData = new TextEncoder().encode(args.input);\n } else if (stdinContent !== undefined) {\n inputData = new TextEncoder().encode(stdinContent);\n } else {\n inputData = new Uint8Array(0);\n }\n\n // Parse input based on format\n let cbor: Cbor;\n try {\n switch (args.in) {\n case \"diag\": {\n const inputStr = new TextDecoder().decode(inputData).trim();\n const result = parseDcborItem(inputStr);\n if (!result.ok) {\n return {\n ok: false,\n error: errorMsg(fullErrorMessage(result.error, inputStr)),\n };\n }\n cbor = result.value;\n break;\n }\n case \"hex\": {\n const inputStr = new TextDecoder().decode(inputData).trim();\n cbor = decodeCbor(hexToBytes(inputStr));\n break;\n }\n case \"bin\": {\n cbor = decodeCbor(inputData);\n break;\n }\n default:\n return { ok: false, error: errorMsg(`Unknown input format: ${args.in}`) };\n }\n } catch (e) {\n return { ok: false, error: errorMsg(e instanceof Error ? e.message : String(e)) };\n }\n\n // Parse pattern\n const patternResult = parsePattern(args.pattern);\n if (!patternResult.ok) {\n return {\n ok: false,\n error: errorMsg(formatPatternError(patternResult.error, args.pattern)),\n };\n }\n const pattern = patternResult.value;\n\n // Execute pattern matching\n const { paths, captures } = pathsWithCaptures(pattern, cbor);\n\n // Check for matches\n if (paths.length === 0) {\n return { ok: false, error: errorMsg(\"No match\") };\n }\n\n // Format output based on requested format\n switch (args.out) {\n case \"paths\": {\n // Build format options from command line arguments\n const formatOptions = FormatPathsOptsBuilder.new()\n .indent(!args.noIndent)\n .lastElementOnly(args.lastOnly)\n .build();\n\n // Show captures only if explicitly requested\n if (args.captures) {\n return {\n ok: true,\n value: formatPathsWithCaptures(paths, captures, formatOptions),\n };\n } else {\n // Show paths without captures\n return {\n ok: true,\n value: formatPathsWithCaptures(paths, new Map(), formatOptions),\n };\n }\n }\n\n case \"diag\":\n case \"hex\":\n case \"bin\": {\n // For data format outputs, extract the matched elements\n const outputFormat: OutputFormat = args.out;\n\n const elementsToOutput = args.lastOnly\n ? paths.map((path) => path[path.length - 1]).filter(Boolean)\n : paths.map((path) => path[0]).filter(Boolean);\n\n const results: string[] = [];\n for (const element of elementsToOutput) {\n const result = formatOutput(element, outputFormat, args.annotate);\n if (!result.ok) {\n return result;\n }\n results.push(result.value);\n }\n\n return { ok: true, value: results.join(\"\\n\") };\n }\n\n default:\n return { ok: false, error: errorMsg(`Unknown output format: ${args.out}`) };\n }\n}\n\n/**\n * Create an Exec implementation for match command\n */\nexport function createMatchCommand(args: MatchCommandArgs, stdinContent?: string): Exec {\n return {\n exec: () => execMatch(args, stdinContent),\n };\n}\n","/**\n * Main run function for dcbor-cli\n * Equivalent to Rust's run function in main.rs\n */\n\nimport { registerTags, errorToString } from \"@bcts/dcbor\";\nimport type { InputFormat, OutputFormat } from \"./format.js\";\nimport { execArray, execDefault, execMap, execMatch, type MatchOutputFormat } from \"./cmd/index.js\";\n\n/**\n * Command type discriminator\n */\nexport type Command =\n | { type: \"array\"; elements: string[]; out: OutputFormat; annotate: boolean }\n | { type: \"map\"; kvPairs: string[]; out: OutputFormat; annotate: boolean }\n | {\n type: \"match\";\n pattern: string;\n input?: string | undefined;\n in: InputFormat;\n out: MatchOutputFormat;\n noIndent: boolean;\n lastOnly: boolean;\n annotate: boolean;\n captures: boolean;\n }\n | {\n type: \"default\";\n input?: string | undefined;\n in: InputFormat;\n out: OutputFormat;\n annotate: boolean;\n };\n\nexport interface RunOptions {\n command: Command;\n stdinContent?: string | undefined;\n}\n\nexport interface RunResult {\n output: string;\n isBinary: boolean;\n}\n\n/**\n * Main execution function\n * Equivalent to Rust's run<I, T, R, W> function\n */\nexport function run(\n options: RunOptions,\n): { ok: true; value: RunResult } | { ok: false; error: Error } {\n // Register BC components tags\n registerTags();\n\n const { command, stdinContent } = options;\n\n let output: string;\n let isBinary = false;\n\n switch (command.type) {\n case \"array\": {\n const result = execArray({\n elements: command.elements,\n out: command.out,\n annotate: command.annotate,\n });\n if (!result.ok) {\n return { ok: false, error: new Error(errorToString(result.error)) };\n }\n output = result.value;\n isBinary = command.out === \"bin\";\n break;\n }\n\n case \"map\": {\n const result = execMap({\n kvPairs: command.kvPairs,\n out: command.out,\n annotate: command.annotate,\n });\n if (!result.ok) {\n return { ok: false, error: new Error(errorToString(result.error)) };\n }\n output = result.value;\n isBinary = command.out === \"bin\";\n break;\n }\n\n case \"match\": {\n const result = execMatch(\n {\n pattern: command.pattern,\n input: command.input,\n in: command.in,\n out: command.out,\n noIndent: command.noIndent,\n lastOnly: command.lastOnly,\n annotate: command.annotate,\n captures: command.captures,\n },\n stdinContent,\n );\n if (!result.ok) {\n return { ok: false, error: new Error(errorToString(result.error)) };\n }\n output = result.value;\n isBinary = command.out === \"bin\";\n break;\n }\n\n case \"default\": {\n const result = execDefault(\n {\n input: command.input,\n in: command.in,\n out: command.out,\n annotate: command.annotate,\n },\n stdinContent,\n );\n if (!result.ok) {\n return { ok: false, error: new Error(errorToString(result.error)) };\n }\n output = result.value;\n isBinary = command.out === \"bin\";\n break;\n }\n\n default:\n return { ok: false, error: new Error(\"Unknown command type\") };\n }\n\n return { ok: true, value: { output, isBinary } };\n}\n","/**\n * @bcts/dcbor-cli - Command line parser/validator for deterministic CBOR (dCBOR)\n *\n * A command line tool for composing, parsing and validating Gordian dCBOR.\n *\n * @packageDocumentation\n */\n\nexport const VERSION = \"1.0.0-alpha.13\";\n\n// Export format utilities\nexport { formatOutput, readData, readString } from \"./format.js\";\nexport type { InputFormat, OutputFormat } from \"./format.js\";\n\n// Export command modules\nexport {\n // Exec interface\n type Exec,\n // Array command\n type ArrayCommandArgs,\n execArray,\n createArrayCommand,\n // Map command\n type MapCommandArgs,\n execMap,\n createMapCommand,\n // Default command\n type DefaultCommandArgs,\n execDefault,\n execDefaultWithReader,\n createDefaultCommand,\n // Match command\n type MatchOutputFormat,\n type MatchCommandArgs,\n execMatch,\n createMatchCommand,\n} from \"./cmd/index.js\";\n\n// Export the run function for programmatic use\nexport { run } from \"./run.js\";\nexport type { RunOptions, RunResult, Command } from \"./run.js\";\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,aACd,MACA,WACA,UACgB;AAChB,KAAI;AACF,UAAQ,WAAR;GACE,KAAK,OAEH,KAAI,SACF,QAAO;IAAE,IAAI;IAAM,OAAO,cAAc,MAAM;KAAE,UAAU;KAAM,MAAM;KAAM,CAAC;IAAE;OAE/E,QAAO;IAAE,IAAI;IAAM,OAAO,cAAc,MAAM,EAAE,MAAM,MAAM,CAAC;IAAE;GAGnE,KAAK,MACH,KAAI,SACF,QAAO;IAAE,IAAI;IAAM,OAAO,OAAO,MAAM,EAAE,UAAU,MAAM,CAAC;IAAE;OAE5D,QAAO;IAAE,IAAI;IAAM,OAAO,WAAW,SAAS,KAAK,CAAC;IAAE;GAG1D,KAAK,MAGH,QAAO;IAAE,IAAI;IAAM,OAAO,WAAW,SAAS,KAAK,CAAC;IAAE;GAExD,KAAK,OACH,QAAO;IAAE,IAAI;IAAM,OAAO;IAAI;GAEhC,QACE,QAAO;IAAE,IAAI;IAAO,OAAO,SAAS,0BAA0B,YAAY;IAAE;;UAEzE,GAAG;AACV,SAAO;GAAE,IAAI;GAAO,OAAO,SAAS,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE,CAAC;GAAE;;;;;;AAOrF,SAAgB,SAAS,MAA8B;AACrD,QAAO;;;;;AAMT,SAAgB,WAAW,MAA0B;AACnD,QAAO,IAAI,aAAa,CAAC,OAAO,KAAK;;;;;;;;;;;;ACvDvC,SAAgB,UAAU,MAAwC;CAChE,MAAM,SAAS,kBAAkB,KAAK,SAAS;AAC/C,KAAI,CAAC,OAAO,GACV,QAAO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