@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
package/LICENSE
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Copyright © 2023 Blockchain Commons, LLC
|
|
2
|
+
Copyright © 2025 Leonardo Amoroso Custodio
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
Subject to the terms and conditions of this license, each copyright holder and
|
|
15
|
+
contributor hereby grants to those receiving rights under this license a
|
|
16
|
+
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
17
|
+
(except for failure to satisfy the conditions of this license) patent license to
|
|
18
|
+
make, have made, use, offer to sell, sell, import, and otherwise transfer this
|
|
19
|
+
software, where such license applies only to those patent claims, already
|
|
20
|
+
acquired or hereafter acquired, licensable by such copyright holder or
|
|
21
|
+
contributor that are necessarily infringed by:
|
|
22
|
+
|
|
23
|
+
(a) their Contribution(s) (the licensed copyrights of copyright holders and
|
|
24
|
+
non-copyrightable additions of contributors, in source or binary form)
|
|
25
|
+
alone; or
|
|
26
|
+
|
|
27
|
+
(b) combination of their Contribution(s) with the work of authorship to
|
|
28
|
+
which such Contribution(s) was added by such copyright holder or
|
|
29
|
+
contributor, if, at the time the Contribution is added, such addition causes
|
|
30
|
+
such combination to be necessarily infringed. The patent license shall not
|
|
31
|
+
apply to any other combinations which include the Contribution.
|
|
32
|
+
|
|
33
|
+
Except as expressly stated above, no rights or licenses from any copyright
|
|
34
|
+
holder or contributor is granted under this license, whether expressly, by
|
|
35
|
+
implication, estoppel or otherwise.
|
|
36
|
+
|
|
37
|
+
DISCLAIMER
|
|
38
|
+
|
|
39
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
40
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
41
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
42
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
|
|
43
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
44
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
45
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
46
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
47
|
+
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
48
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Blockchain Commons dCBOR CLI (TypeScript)
|
|
2
|
+
|
|
3
|
+
> Disclaimer: This package is under active development and APIs may change.
|
|
4
|
+
|
|
5
|
+
## Introduction
|
|
6
|
+
|
|
7
|
+
`@bcts/dcbor-cli` is a command line tool for parsing, validating, and converting [dCBOR](https://datatracker.ietf.org/doc/draft-mcnally-deterministic-cbor/) (Deterministic CBOR) data.
|
|
8
|
+
|
|
9
|
+
Features:
|
|
10
|
+
- Validates dCBOR inputs
|
|
11
|
+
- Receives inputs in hex, binary, or diagnostic notation format
|
|
12
|
+
- Outputs in multiple formats: diagnostic notation (compact or annotated), hexadecimal (compact or annotated), or binary
|
|
13
|
+
- Compose dCBOR arrays and maps from individual elements
|
|
14
|
+
|
|
15
|
+
## Rust Reference Implementation
|
|
16
|
+
|
|
17
|
+
This TypeScript implementation is based on [bc-dcbor-cli](https://github.com/BlockchainCommons/bc-dcbor-cli) **v0.16.0** ([commit](https://github.com/BlockchainCommons/bc-dcbor-cli/tree/1977ba6e2934f58d49b0dbf10d171988d9cb31d3)).
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Install globally
|
|
23
|
+
bun add -g @bcts/dcbor-cli
|
|
24
|
+
|
|
25
|
+
# Or run directly with bunx
|
|
26
|
+
bunx @bcts/dcbor-cli --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Basic Conversion
|
|
32
|
+
|
|
33
|
+
Convert CBOR diagnostic notation to hexadecimal (default):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
dcbor '42'
|
|
37
|
+
# Output: 182a
|
|
38
|
+
|
|
39
|
+
dcbor '3.14'
|
|
40
|
+
# Output: fb40091eb851eb851f
|
|
41
|
+
|
|
42
|
+
dcbor '"Hello"'
|
|
43
|
+
# Output: 6548656c6c6f
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Input/Output Formats
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Convert hex to diagnostic notation
|
|
50
|
+
dcbor --in hex --out diag 6548656c6c6f
|
|
51
|
+
# Output: "Hello"
|
|
52
|
+
|
|
53
|
+
# Convert with annotations
|
|
54
|
+
dcbor --in hex --out diag --annotate 6548656c6c6f
|
|
55
|
+
# Output: "Hello" / text(5) /
|
|
56
|
+
|
|
57
|
+
# Convert to binary
|
|
58
|
+
dcbor --in hex --out bin 6548656c6c6f > output.bin
|
|
59
|
+
|
|
60
|
+
# Read binary input
|
|
61
|
+
dcbor --in bin < input.bin
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Compose Arrays and Maps
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Compose an array
|
|
68
|
+
dcbor array 1 2 3
|
|
69
|
+
# Output: hex for [1, 2, 3]
|
|
70
|
+
|
|
71
|
+
# Compose a map
|
|
72
|
+
dcbor map '"key1"' 1 '"key2"' 2
|
|
73
|
+
# Output: hex for {"key1": 1, "key2": 2}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Command Line Reference
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Usage: dcbor [options] [input] [command]
|
|
80
|
+
|
|
81
|
+
Commands:
|
|
82
|
+
array Compose a dCBOR array from the provided elements
|
|
83
|
+
map Compose a dCBOR map from the provided keys and values
|
|
84
|
+
|
|
85
|
+
Arguments:
|
|
86
|
+
input Input dCBOR (format specified by --in)
|
|
87
|
+
|
|
88
|
+
Options:
|
|
89
|
+
-i, --in <format> Input format: diag, hex, bin (default: diag)
|
|
90
|
+
-o, --out <format> Output format: diag, hex, bin, none (default: hex)
|
|
91
|
+
-a, --annotate Add annotations to output
|
|
92
|
+
-h, --help Display help
|
|
93
|
+
-V, --version Display version
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Dependencies
|
|
97
|
+
|
|
98
|
+
- `@bcts/dcbor` - dCBOR encoding/decoding
|
|
99
|
+
- `@bcts/dcbor-parse` - Diagnostic notation parser
|
|
100
|
+
- `@bcts/dcbor-pattern` - Pattern matching
|
|
101
|
+
- `@bcts/components` - Shared components
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
BSD-2-Clause-Patent
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_src = require('./src-M5HM-SCU.cjs');
|
|
3
|
+
let commander = require("commander");
|
|
4
|
+
|
|
5
|
+
//#region src/cli.ts
|
|
6
|
+
/**
|
|
7
|
+
* dcbor CLI - Command line parser/validator for deterministic CBOR (dCBOR)
|
|
8
|
+
*
|
|
9
|
+
* A command line tool for composing, parsing and validating Gordian dCBOR.
|
|
10
|
+
* See the main repo README: https://github.com/leonardocustodio/bcts
|
|
11
|
+
*/
|
|
12
|
+
const program = new commander.Command();
|
|
13
|
+
program.name("dcbor").description("Command line parser/validator for deterministic CBOR (dCBOR)").version(require_src.VERSION);
|
|
14
|
+
program.argument("[input]", "Input dCBOR in the format specified by --in").addOption(new commander.Option("-i, --in <format>", "The input format").choices([
|
|
15
|
+
"diag",
|
|
16
|
+
"hex",
|
|
17
|
+
"bin"
|
|
18
|
+
]).default("diag")).addOption(new commander.Option("-o, --out <format>", "The output format").choices([
|
|
19
|
+
"diag",
|
|
20
|
+
"hex",
|
|
21
|
+
"bin",
|
|
22
|
+
"none"
|
|
23
|
+
]).default("hex")).option("-a, --annotate", "Output diagnostic notation or hexadecimal with annotations").action(async (input, options) => {
|
|
24
|
+
let stdinContent;
|
|
25
|
+
if (input === void 0 && options.in !== "bin") stdinContent = await readStdin();
|
|
26
|
+
else if (options.in === "bin") stdinContent = await readStdin();
|
|
27
|
+
const result = require_src.run({
|
|
28
|
+
command: {
|
|
29
|
+
type: "default",
|
|
30
|
+
input,
|
|
31
|
+
in: options.in,
|
|
32
|
+
out: options.out,
|
|
33
|
+
annotate: options.annotate ?? false
|
|
34
|
+
},
|
|
35
|
+
stdinContent
|
|
36
|
+
});
|
|
37
|
+
if (!result.ok) {
|
|
38
|
+
console.error(`Error: ${result.error.message}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
42
|
+
});
|
|
43
|
+
program.command("array").description("Compose a dCBOR array from the provided elements").argument("<elements...>", "Each element is parsed as a dCBOR item in diagnostic notation").addOption(new commander.Option("-o, --out <format>", "The output format").choices([
|
|
44
|
+
"diag",
|
|
45
|
+
"hex",
|
|
46
|
+
"bin",
|
|
47
|
+
"none"
|
|
48
|
+
]).default("hex")).option("-a, --annotate", "Output diagnostic notation or hexadecimal with annotations").action((elements, options) => {
|
|
49
|
+
const result = require_src.run({ command: {
|
|
50
|
+
type: "array",
|
|
51
|
+
elements,
|
|
52
|
+
out: options.out,
|
|
53
|
+
annotate: options.annotate ?? false
|
|
54
|
+
} });
|
|
55
|
+
if (!result.ok) {
|
|
56
|
+
console.error(`Error: ${result.error.message}`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
60
|
+
});
|
|
61
|
+
program.command("map").description("Compose a dCBOR map from the provided keys and values").argument("<pairs...>", "Each alternating key and value is parsed as a dCBOR item in diagnostic notation").addOption(new commander.Option("-o, --out <format>", "The output format").choices([
|
|
62
|
+
"diag",
|
|
63
|
+
"hex",
|
|
64
|
+
"bin",
|
|
65
|
+
"none"
|
|
66
|
+
]).default("hex")).option("-a, --annotate", "Output diagnostic notation or hexadecimal with annotations").action((pairs, options) => {
|
|
67
|
+
const result = require_src.run({ command: {
|
|
68
|
+
type: "map",
|
|
69
|
+
kvPairs: pairs,
|
|
70
|
+
out: options.out,
|
|
71
|
+
annotate: options.annotate ?? false
|
|
72
|
+
} });
|
|
73
|
+
if (!result.ok) {
|
|
74
|
+
console.error(`Error: ${result.error.message}`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
78
|
+
});
|
|
79
|
+
program.command("match").description("Match dCBOR data against a pattern").argument("<pattern>", "The pattern to match against").argument("[input]", "dCBOR input (hex, diag, or binary). If not provided, reads from stdin").addOption(new commander.Option("-i, --in <format>", "Input format").choices([
|
|
80
|
+
"diag",
|
|
81
|
+
"hex",
|
|
82
|
+
"bin"
|
|
83
|
+
]).default("diag")).addOption(new commander.Option("-o, --out <format>", "Output format").choices([
|
|
84
|
+
"paths",
|
|
85
|
+
"diag",
|
|
86
|
+
"hex",
|
|
87
|
+
"bin"
|
|
88
|
+
]).default("paths")).option("--no-indent", "Disable indentation of path elements").option("--last-only", "Show only the last element of each path").option("--annotate", "Add annotations to output").option("--captures", "Include capture information in output").action(async (pattern, input, options) => {
|
|
89
|
+
let stdinContent;
|
|
90
|
+
if (input === void 0) stdinContent = await readStdin();
|
|
91
|
+
const result = require_src.run({
|
|
92
|
+
command: {
|
|
93
|
+
type: "match",
|
|
94
|
+
pattern,
|
|
95
|
+
input,
|
|
96
|
+
in: options.in,
|
|
97
|
+
out: options.out,
|
|
98
|
+
noIndent: !options.indent,
|
|
99
|
+
lastOnly: options.lastOnly ?? false,
|
|
100
|
+
annotate: options.annotate ?? false,
|
|
101
|
+
captures: options.captures ?? false
|
|
102
|
+
},
|
|
103
|
+
stdinContent
|
|
104
|
+
});
|
|
105
|
+
if (!result.ok) {
|
|
106
|
+
console.error(`Error: ${result.error.message}`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* Read from stdin
|
|
113
|
+
*/
|
|
114
|
+
async function readStdin() {
|
|
115
|
+
if (process.stdin.isTTY) return "";
|
|
116
|
+
const chunks = [];
|
|
117
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
118
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Write output to stdout
|
|
122
|
+
*/
|
|
123
|
+
function writeOutput(output, isBinary) {
|
|
124
|
+
if (isBinary) {
|
|
125
|
+
const bytes = Buffer.from(output, "hex");
|
|
126
|
+
process.stdout.write(bytes);
|
|
127
|
+
} else if (output.length > 0) console.log(output);
|
|
128
|
+
}
|
|
129
|
+
program.parse();
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
//# sourceMappingURL=cli.cjs.map
|
package/dist/cli.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["Command","VERSION","Option","stdinContent: string | undefined","run","chunks: Buffer[]"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/* eslint-disable no-console, no-undef, no-restricted-globals, @typescript-eslint/no-unsafe-argument */\n/**\n * dcbor CLI - Command line parser/validator for deterministic CBOR (dCBOR)\n *\n * A command line tool for composing, parsing and validating Gordian dCBOR.\n * See the main repo README: https://github.com/leonardocustodio/bcts\n */\n\nimport { Command, Option } from \"commander\";\nimport { VERSION } from \"./index.js\";\nimport { run, type Command as CmdType } from \"./run.js\";\nimport type { InputFormat, OutputFormat } from \"./format.js\";\nimport type { MatchOutputFormat } from \"./cmd/match.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"dcbor\")\n .description(\"Command line parser/validator for deterministic CBOR (dCBOR)\")\n .version(VERSION);\n\n// Default command arguments (when no subcommand is provided)\nprogram\n .argument(\"[input]\", \"Input dCBOR in the format specified by --in\")\n .addOption(\n new Option(\"-i, --in <format>\", \"The input format\")\n .choices([\"diag\", \"hex\", \"bin\"])\n .default(\"diag\"),\n )\n .addOption(\n new Option(\"-o, --out <format>\", \"The output format\")\n .choices([\"diag\", \"hex\", \"bin\", \"none\"])\n .default(\"hex\"),\n )\n .option(\"-a, --annotate\", \"Output diagnostic notation or hexadecimal with annotations\")\n .action(\n async (\n input: string | undefined,\n options: {\n in: InputFormat;\n out: OutputFormat;\n annotate?: boolean;\n },\n ) => {\n // Read stdin if needed\n let stdinContent: string | undefined;\n if (input === undefined && options.in !== \"bin\") {\n stdinContent = await readStdin();\n } else if (options.in === \"bin\") {\n stdinContent = await readStdin();\n }\n\n const command: CmdType = {\n type: \"default\",\n input,\n in: options.in,\n out: options.out,\n annotate: options.annotate ?? false,\n };\n\n const result = run({ command, stdinContent });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n// Array subcommand\nprogram\n .command(\"array\")\n .description(\"Compose a dCBOR array from the provided elements\")\n .argument(\"<elements...>\", \"Each element is parsed as a dCBOR item in diagnostic notation\")\n .addOption(\n new Option(\"-o, --out <format>\", \"The output format\")\n .choices([\"diag\", \"hex\", \"bin\", \"none\"])\n .default(\"hex\"),\n )\n .option(\"-a, --annotate\", \"Output diagnostic notation or hexadecimal with annotations\")\n .action(\n (\n elements: string[],\n options: {\n out: OutputFormat;\n annotate?: boolean;\n },\n ) => {\n const command: CmdType = {\n type: \"array\",\n elements,\n out: options.out,\n annotate: options.annotate ?? false,\n };\n\n const result = run({ command });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n// Map subcommand\nprogram\n .command(\"map\")\n .description(\"Compose a dCBOR map from the provided keys and values\")\n .argument(\n \"<pairs...>\",\n \"Each alternating key and value is parsed as a dCBOR item in diagnostic notation\",\n )\n .addOption(\n new Option(\"-o, --out <format>\", \"The output format\")\n .choices([\"diag\", \"hex\", \"bin\", \"none\"])\n .default(\"hex\"),\n )\n .option(\"-a, --annotate\", \"Output diagnostic notation or hexadecimal with annotations\")\n .action(\n (\n pairs: string[],\n options: {\n out: OutputFormat;\n annotate?: boolean;\n },\n ) => {\n const command: CmdType = {\n type: \"map\",\n kvPairs: pairs,\n out: options.out,\n annotate: options.annotate ?? false,\n };\n\n const result = run({ command });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n// Match subcommand\nprogram\n .command(\"match\")\n .description(\"Match dCBOR data against a pattern\")\n .argument(\"<pattern>\", \"The pattern to match against\")\n .argument(\"[input]\", \"dCBOR input (hex, diag, or binary). If not provided, reads from stdin\")\n .addOption(\n new Option(\"-i, --in <format>\", \"Input format\").choices([\"diag\", \"hex\", \"bin\"]).default(\"diag\"),\n )\n .addOption(\n new Option(\"-o, --out <format>\", \"Output format\")\n .choices([\"paths\", \"diag\", \"hex\", \"bin\"])\n .default(\"paths\"),\n )\n .option(\"--no-indent\", \"Disable indentation of path elements\")\n .option(\"--last-only\", \"Show only the last element of each path\")\n .option(\"--annotate\", \"Add annotations to output\")\n .option(\"--captures\", \"Include capture information in output\")\n .action(\n async (\n pattern: string,\n input: string | undefined,\n options: {\n in: InputFormat;\n out: MatchOutputFormat;\n indent: boolean;\n lastOnly?: boolean;\n annotate?: boolean;\n captures?: boolean;\n },\n ) => {\n // Read stdin if needed\n let stdinContent: string | undefined;\n if (input === undefined) {\n stdinContent = await readStdin();\n }\n\n const command: CmdType = {\n type: \"match\",\n pattern,\n input,\n in: options.in,\n out: options.out,\n noIndent: !options.indent,\n lastOnly: options.lastOnly ?? false,\n annotate: options.annotate ?? false,\n captures: options.captures ?? false,\n };\n\n const result = run({ command, stdinContent });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n/**\n * Read from stdin\n */\nasync function readStdin(): Promise<string> {\n // Check if stdin is a TTY (interactive terminal)\n if (process.stdin.isTTY) {\n return \"\";\n }\n\n const chunks: Buffer[] = [];\n for await (const chunk of process.stdin) {\n chunks.push(chunk);\n }\n return Buffer.concat(chunks).toString(\"utf8\");\n}\n\n/**\n * Write output to stdout\n */\nfunction writeOutput(output: string, isBinary: boolean): void {\n if (isBinary) {\n // For binary output, decode hex back to bytes\n const bytes = Buffer.from(output, \"hex\");\n process.stdout.write(bytes);\n } else if (output.length > 0) {\n console.log(output);\n }\n}\n\nprogram.parse();\n"],"mappings":";;;;;;;;;;;AAeA,MAAM,UAAU,IAAIA,mBAAS;AAE7B,QACG,KAAK,QAAQ,CACb,YAAY,+DAA+D,CAC3E,QAAQC,oBAAQ;AAGnB,QACG,SAAS,WAAW,8CAA8C,CAClE,UACC,IAAIC,iBAAO,qBAAqB,mBAAmB,CAChD,QAAQ;CAAC;CAAQ;CAAO;CAAM,CAAC,CAC/B,QAAQ,OAAO,CACnB,CACA,UACC,IAAIA,iBAAO,sBAAsB,oBAAoB,CAClD,QAAQ;CAAC;CAAQ;CAAO;CAAO;CAAO,CAAC,CACvC,QAAQ,MAAM,CAClB,CACA,OAAO,kBAAkB,6DAA6D,CACtF,OACC,OACE,OACA,YAKG;CAEH,IAAIC;AACJ,KAAI,UAAU,UAAa,QAAQ,OAAO,MACxC,gBAAe,MAAM,WAAW;UACvB,QAAQ,OAAO,MACxB,gBAAe,MAAM,WAAW;CAWlC,MAAM,SAASC,gBAAI;EAAE,SARI;GACvB,MAAM;GACN;GACA,IAAI,QAAQ;GACZ,KAAK,QAAQ;GACb,UAAU,QAAQ,YAAY;GAC/B;EAE6B;EAAc,CAAC;AAE7C,KAAI,CAAC,OAAO,IAAI;AACd,UAAQ,MAAM,UAAU,OAAO,MAAM,UAAU;AAC/C,UAAQ,KAAK,EAAE;;AAGjB,aAAY,OAAO,MA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@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { n as run, t as VERSION } from "./src-Ce085uR8.mjs";
|
|
3
|
+
import { Command, Option } from "commander";
|
|
4
|
+
|
|
5
|
+
//#region src/cli.ts
|
|
6
|
+
/**
|
|
7
|
+
* dcbor CLI - Command line parser/validator for deterministic CBOR (dCBOR)
|
|
8
|
+
*
|
|
9
|
+
* A command line tool for composing, parsing and validating Gordian dCBOR.
|
|
10
|
+
* See the main repo README: https://github.com/leonardocustodio/bcts
|
|
11
|
+
*/
|
|
12
|
+
const program = new Command();
|
|
13
|
+
program.name("dcbor").description("Command line parser/validator for deterministic CBOR (dCBOR)").version(VERSION);
|
|
14
|
+
program.argument("[input]", "Input dCBOR in the format specified by --in").addOption(new Option("-i, --in <format>", "The input format").choices([
|
|
15
|
+
"diag",
|
|
16
|
+
"hex",
|
|
17
|
+
"bin"
|
|
18
|
+
]).default("diag")).addOption(new Option("-o, --out <format>", "The output format").choices([
|
|
19
|
+
"diag",
|
|
20
|
+
"hex",
|
|
21
|
+
"bin",
|
|
22
|
+
"none"
|
|
23
|
+
]).default("hex")).option("-a, --annotate", "Output diagnostic notation or hexadecimal with annotations").action(async (input, options) => {
|
|
24
|
+
let stdinContent;
|
|
25
|
+
if (input === void 0 && options.in !== "bin") stdinContent = await readStdin();
|
|
26
|
+
else if (options.in === "bin") stdinContent = await readStdin();
|
|
27
|
+
const result = run({
|
|
28
|
+
command: {
|
|
29
|
+
type: "default",
|
|
30
|
+
input,
|
|
31
|
+
in: options.in,
|
|
32
|
+
out: options.out,
|
|
33
|
+
annotate: options.annotate ?? false
|
|
34
|
+
},
|
|
35
|
+
stdinContent
|
|
36
|
+
});
|
|
37
|
+
if (!result.ok) {
|
|
38
|
+
console.error(`Error: ${result.error.message}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
42
|
+
});
|
|
43
|
+
program.command("array").description("Compose a dCBOR array from the provided elements").argument("<elements...>", "Each element is parsed as a dCBOR item in diagnostic notation").addOption(new Option("-o, --out <format>", "The output format").choices([
|
|
44
|
+
"diag",
|
|
45
|
+
"hex",
|
|
46
|
+
"bin",
|
|
47
|
+
"none"
|
|
48
|
+
]).default("hex")).option("-a, --annotate", "Output diagnostic notation or hexadecimal with annotations").action((elements, options) => {
|
|
49
|
+
const result = run({ command: {
|
|
50
|
+
type: "array",
|
|
51
|
+
elements,
|
|
52
|
+
out: options.out,
|
|
53
|
+
annotate: options.annotate ?? false
|
|
54
|
+
} });
|
|
55
|
+
if (!result.ok) {
|
|
56
|
+
console.error(`Error: ${result.error.message}`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
60
|
+
});
|
|
61
|
+
program.command("map").description("Compose a dCBOR map from the provided keys and values").argument("<pairs...>", "Each alternating key and value is parsed as a dCBOR item in diagnostic notation").addOption(new Option("-o, --out <format>", "The output format").choices([
|
|
62
|
+
"diag",
|
|
63
|
+
"hex",
|
|
64
|
+
"bin",
|
|
65
|
+
"none"
|
|
66
|
+
]).default("hex")).option("-a, --annotate", "Output diagnostic notation or hexadecimal with annotations").action((pairs, options) => {
|
|
67
|
+
const result = run({ command: {
|
|
68
|
+
type: "map",
|
|
69
|
+
kvPairs: pairs,
|
|
70
|
+
out: options.out,
|
|
71
|
+
annotate: options.annotate ?? false
|
|
72
|
+
} });
|
|
73
|
+
if (!result.ok) {
|
|
74
|
+
console.error(`Error: ${result.error.message}`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
78
|
+
});
|
|
79
|
+
program.command("match").description("Match dCBOR data against a pattern").argument("<pattern>", "The pattern to match against").argument("[input]", "dCBOR input (hex, diag, or binary). If not provided, reads from stdin").addOption(new Option("-i, --in <format>", "Input format").choices([
|
|
80
|
+
"diag",
|
|
81
|
+
"hex",
|
|
82
|
+
"bin"
|
|
83
|
+
]).default("diag")).addOption(new Option("-o, --out <format>", "Output format").choices([
|
|
84
|
+
"paths",
|
|
85
|
+
"diag",
|
|
86
|
+
"hex",
|
|
87
|
+
"bin"
|
|
88
|
+
]).default("paths")).option("--no-indent", "Disable indentation of path elements").option("--last-only", "Show only the last element of each path").option("--annotate", "Add annotations to output").option("--captures", "Include capture information in output").action(async (pattern, input, options) => {
|
|
89
|
+
let stdinContent;
|
|
90
|
+
if (input === void 0) stdinContent = await readStdin();
|
|
91
|
+
const result = run({
|
|
92
|
+
command: {
|
|
93
|
+
type: "match",
|
|
94
|
+
pattern,
|
|
95
|
+
input,
|
|
96
|
+
in: options.in,
|
|
97
|
+
out: options.out,
|
|
98
|
+
noIndent: !options.indent,
|
|
99
|
+
lastOnly: options.lastOnly ?? false,
|
|
100
|
+
annotate: options.annotate ?? false,
|
|
101
|
+
captures: options.captures ?? false
|
|
102
|
+
},
|
|
103
|
+
stdinContent
|
|
104
|
+
});
|
|
105
|
+
if (!result.ok) {
|
|
106
|
+
console.error(`Error: ${result.error.message}`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
writeOutput(result.value.output, result.value.isBinary);
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* Read from stdin
|
|
113
|
+
*/
|
|
114
|
+
async function readStdin() {
|
|
115
|
+
if (process.stdin.isTTY) return "";
|
|
116
|
+
const chunks = [];
|
|
117
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
118
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Write output to stdout
|
|
122
|
+
*/
|
|
123
|
+
function writeOutput(output, isBinary) {
|
|
124
|
+
if (isBinary) {
|
|
125
|
+
const bytes = Buffer.from(output, "hex");
|
|
126
|
+
process.stdout.write(bytes);
|
|
127
|
+
} else if (output.length > 0) console.log(output);
|
|
128
|
+
}
|
|
129
|
+
program.parse();
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
export { };
|
|
133
|
+
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["stdinContent: string | undefined","chunks: Buffer[]"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/* eslint-disable no-console, no-undef, no-restricted-globals, @typescript-eslint/no-unsafe-argument */\n/**\n * dcbor CLI - Command line parser/validator for deterministic CBOR (dCBOR)\n *\n * A command line tool for composing, parsing and validating Gordian dCBOR.\n * See the main repo README: https://github.com/leonardocustodio/bcts\n */\n\nimport { Command, Option } from \"commander\";\nimport { VERSION } from \"./index.js\";\nimport { run, type Command as CmdType } from \"./run.js\";\nimport type { InputFormat, OutputFormat } from \"./format.js\";\nimport type { MatchOutputFormat } from \"./cmd/match.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"dcbor\")\n .description(\"Command line parser/validator for deterministic CBOR (dCBOR)\")\n .version(VERSION);\n\n// Default command arguments (when no subcommand is provided)\nprogram\n .argument(\"[input]\", \"Input dCBOR in the format specified by --in\")\n .addOption(\n new Option(\"-i, --in <format>\", \"The input format\")\n .choices([\"diag\", \"hex\", \"bin\"])\n .default(\"diag\"),\n )\n .addOption(\n new Option(\"-o, --out <format>\", \"The output format\")\n .choices([\"diag\", \"hex\", \"bin\", \"none\"])\n .default(\"hex\"),\n )\n .option(\"-a, --annotate\", \"Output diagnostic notation or hexadecimal with annotations\")\n .action(\n async (\n input: string | undefined,\n options: {\n in: InputFormat;\n out: OutputFormat;\n annotate?: boolean;\n },\n ) => {\n // Read stdin if needed\n let stdinContent: string | undefined;\n if (input === undefined && options.in !== \"bin\") {\n stdinContent = await readStdin();\n } else if (options.in === \"bin\") {\n stdinContent = await readStdin();\n }\n\n const command: CmdType = {\n type: \"default\",\n input,\n in: options.in,\n out: options.out,\n annotate: options.annotate ?? false,\n };\n\n const result = run({ command, stdinContent });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n// Array subcommand\nprogram\n .command(\"array\")\n .description(\"Compose a dCBOR array from the provided elements\")\n .argument(\"<elements...>\", \"Each element is parsed as a dCBOR item in diagnostic notation\")\n .addOption(\n new Option(\"-o, --out <format>\", \"The output format\")\n .choices([\"diag\", \"hex\", \"bin\", \"none\"])\n .default(\"hex\"),\n )\n .option(\"-a, --annotate\", \"Output diagnostic notation or hexadecimal with annotations\")\n .action(\n (\n elements: string[],\n options: {\n out: OutputFormat;\n annotate?: boolean;\n },\n ) => {\n const command: CmdType = {\n type: \"array\",\n elements,\n out: options.out,\n annotate: options.annotate ?? false,\n };\n\n const result = run({ command });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n// Map subcommand\nprogram\n .command(\"map\")\n .description(\"Compose a dCBOR map from the provided keys and values\")\n .argument(\n \"<pairs...>\",\n \"Each alternating key and value is parsed as a dCBOR item in diagnostic notation\",\n )\n .addOption(\n new Option(\"-o, --out <format>\", \"The output format\")\n .choices([\"diag\", \"hex\", \"bin\", \"none\"])\n .default(\"hex\"),\n )\n .option(\"-a, --annotate\", \"Output diagnostic notation or hexadecimal with annotations\")\n .action(\n (\n pairs: string[],\n options: {\n out: OutputFormat;\n annotate?: boolean;\n },\n ) => {\n const command: CmdType = {\n type: \"map\",\n kvPairs: pairs,\n out: options.out,\n annotate: options.annotate ?? false,\n };\n\n const result = run({ command });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n// Match subcommand\nprogram\n .command(\"match\")\n .description(\"Match dCBOR data against a pattern\")\n .argument(\"<pattern>\", \"The pattern to match against\")\n .argument(\"[input]\", \"dCBOR input (hex, diag, or binary). If not provided, reads from stdin\")\n .addOption(\n new Option(\"-i, --in <format>\", \"Input format\").choices([\"diag\", \"hex\", \"bin\"]).default(\"diag\"),\n )\n .addOption(\n new Option(\"-o, --out <format>\", \"Output format\")\n .choices([\"paths\", \"diag\", \"hex\", \"bin\"])\n .default(\"paths\"),\n )\n .option(\"--no-indent\", \"Disable indentation of path elements\")\n .option(\"--last-only\", \"Show only the last element of each path\")\n .option(\"--annotate\", \"Add annotations to output\")\n .option(\"--captures\", \"Include capture information in output\")\n .action(\n async (\n pattern: string,\n input: string | undefined,\n options: {\n in: InputFormat;\n out: MatchOutputFormat;\n indent: boolean;\n lastOnly?: boolean;\n annotate?: boolean;\n captures?: boolean;\n },\n ) => {\n // Read stdin if needed\n let stdinContent: string | undefined;\n if (input === undefined) {\n stdinContent = await readStdin();\n }\n\n const command: CmdType = {\n type: \"match\",\n pattern,\n input,\n in: options.in,\n out: options.out,\n noIndent: !options.indent,\n lastOnly: options.lastOnly ?? false,\n annotate: options.annotate ?? false,\n captures: options.captures ?? false,\n };\n\n const result = run({ command, stdinContent });\n\n if (!result.ok) {\n console.error(`Error: ${result.error.message}`);\n process.exit(1);\n }\n\n writeOutput(result.value.output, result.value.isBinary);\n },\n );\n\n/**\n * Read from stdin\n */\nasync function readStdin(): Promise<string> {\n // Check if stdin is a TTY (interactive terminal)\n if (process.stdin.isTTY) {\n return \"\";\n }\n\n const chunks: Buffer[] = [];\n for await (const chunk of process.stdin) {\n chunks.push(chunk);\n }\n return Buffer.concat(chunks).toString(\"utf8\");\n}\n\n/**\n * Write output to stdout\n */\nfunction writeOutput(output: string, isBinary: boolean): void {\n if (isBinary) {\n // For binary output, decode hex back to bytes\n const bytes = Buffer.from(output, \"hex\");\n process.stdout.write(bytes);\n } else if (output.length > 0) {\n console.log(output);\n }\n}\n\nprogram.parse();\n"],"mappings":";;;;;;;;;;;AAeA,MAAM,UAAU,IAAI,SAAS;AA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B,UAAU,QAAQ,YAAY;GAC9B,UAAU,QAAQ,YAAY;GAC9B,UAAU,QAAQ,YAAY;GAC/B;EAE6B;EAAc,CAAC;AAE7C,KAAI,CAAC,OAAO,IAAI;AACd,UAAQ,MAAM,UAAU,OAAO,MAAM,UAAU;AAC/C,UAAQ,KAAK,EAAE;;AAGjB,aAAY,OAAO,MAAM,QAAQ,OAAO,MAAM,SAAS;EAE1D;;;;AAKH,eAAe,YAA6B;AAE1C,KAAI,QAAQ,MAAM,MAChB,QAAO;CAGT,MAAMC,SAAmB,EAAE;AAC3B,YAAW,MAAM,SAAS,QAAQ,MAChC,QAAO,KAAK,MAAM;AAEpB,QAAO,OAAO,OAAO,OAAO,CAAC,SAAS,OAAO;;;;;AAM/C,SAAS,YAAY,QAAgB,UAAyB;AAC5D,KAAI,UAAU;EAEZ,MAAM,QAAQ,OAAO,KAAK,QAAQ,MAAM;AACxC,UAAQ,OAAO,MAAM,MAAM;YAClB,OAAO,SAAS,EACzB,SAAQ,IAAI,OAAO;;AAIvB,QAAQ,OAAO"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_src = require('./src-M5HM-SCU.cjs');
|
|
2
|
+
|
|
3
|
+
exports.VERSION = require_src.VERSION;
|
|
4
|
+
exports.createArrayCommand = require_src.createArrayCommand;
|
|
5
|
+
exports.createDefaultCommand = require_src.createDefaultCommand;
|
|
6
|
+
exports.createMapCommand = require_src.createMapCommand;
|
|
7
|
+
exports.createMatchCommand = require_src.createMatchCommand;
|
|
8
|
+
exports.execArray = require_src.execArray;
|
|
9
|
+
exports.execDefault = require_src.execDefault;
|
|
10
|
+
exports.execDefaultWithReader = require_src.execDefaultWithReader;
|
|
11
|
+
exports.execMap = require_src.execMap;
|
|
12
|
+
exports.execMatch = require_src.execMatch;
|
|
13
|
+
exports.formatOutput = require_src.formatOutput;
|
|
14
|
+
exports.readData = require_src.readData;
|
|
15
|
+
exports.readString = require_src.readString;
|
|
16
|
+
exports.run = require_src.run;
|