@bcts/provenance-mark-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.
@@ -0,0 +1,332 @@
1
+ import { Cbor } from "@bcts/dcbor";
2
+ import { ProvenanceSeed } from "@bcts/provenance-mark";
3
+
4
+ //#region src/exec.d.ts
5
+
6
+ /**
7
+ * Exec interface - 1:1 port of exec.rs
8
+ *
9
+ * All CLI commands implement this interface.
10
+ */
11
+ /**
12
+ * Result type for command execution.
13
+ * Commands return either a string output or throw an error.
14
+ */
15
+ type ExecResult = string;
16
+ /**
17
+ * Interface that all CLI commands implement.
18
+ * Each command's exec() method returns a string output.
19
+ */
20
+ interface Exec {
21
+ /**
22
+ * Execute the command and return the output string.
23
+ * @throws Error if the command fails
24
+ */
25
+ exec(): ExecResult;
26
+ }
27
+ //#endregion
28
+ //#region src/utils.d.ts
29
+ /**
30
+ * Utilities module - 1:1 port of utils.rs
31
+ *
32
+ * Helper functions for CLI operations.
33
+ */
34
+ /**
35
+ * Read a new path, supporting globbing, and resolving relative paths.
36
+ *
37
+ * Corresponds to Rust `read_new_path()`
38
+ */
39
+ declare function readNewPath(pathStr: string): string;
40
+ /**
41
+ * Read an existing directory path, supporting globbing, and resolving relative paths.
42
+ *
43
+ * Corresponds to Rust `read_existing_directory_path()`
44
+ */
45
+ declare function readExistingDirectoryPath(pathStr: string): string;
46
+ /**
47
+ * Read an argument from command line or stdin.
48
+ *
49
+ * Corresponds to Rust `read_argument()`
50
+ */
51
+ declare function readArgument(argument?: string): string;
52
+ /**
53
+ * Read all stdin synchronously.
54
+ */
55
+ declare function readStdinSync(): string;
56
+ /**
57
+ * Convert bytes to hex string.
58
+ */
59
+ declare function bytesToHex(bytes: Uint8Array): string;
60
+ /**
61
+ * Convert hex string to bytes.
62
+ */
63
+ declare function hexToBytes(hex: string): Uint8Array;
64
+ /**
65
+ * Convert bytes to base64 string.
66
+ */
67
+ declare function toBase64(bytes: Uint8Array): string;
68
+ /**
69
+ * Convert base64 string to bytes.
70
+ */
71
+ declare function fromBase64(base64: string): Uint8Array;
72
+ //#endregion
73
+ //#region src/cmd/info.d.ts
74
+ /**
75
+ * Arguments for info payload.
76
+ *
77
+ * Corresponds to Rust `InfoArgs`
78
+ */
79
+ interface InfoArgs {
80
+ /** Hex-encoded dCBOR or UR payload to embed in the mark's `info` field. */
81
+ info?: string | undefined;
82
+ /** CBOR tag value to associate with an unknown UR type. */
83
+ infoTag?: number | undefined;
84
+ }
85
+ /**
86
+ * Parse info args to CBOR.
87
+ *
88
+ * Corresponds to Rust `InfoArgs::to_cbor()`
89
+ */
90
+ declare function parseInfoArgs(args: InfoArgs): Cbor | undefined;
91
+ //#endregion
92
+ //#region src/cmd/seed.d.ts
93
+ /**
94
+ * Parse a seed from a string.
95
+ *
96
+ * Supports the following formats:
97
+ * - `ur:seed/...` - UR-encoded seed
98
+ * - `0x...` or hex string - Hex-encoded seed
99
+ * - Base64 string - Base64-encoded seed
100
+ *
101
+ * Corresponds to Rust `parse_seed()`
102
+ */
103
+ declare function parseSeed(input: string): ProvenanceSeed;
104
+ //#endregion
105
+ //#region src/cmd/new.d.ts
106
+ /**
107
+ * Output format for the creation summary.
108
+ *
109
+ * Corresponds to Rust `OutputFormat`
110
+ */
111
+ declare enum OutputFormat {
112
+ Markdown = "markdown",
113
+ Ur = "ur",
114
+ Json = "json",
115
+ }
116
+ /**
117
+ * Resolution level for the provenance mark chain.
118
+ *
119
+ * Corresponds to Rust `Resolution`
120
+ */
121
+ declare enum Resolution {
122
+ /** Good for physical works of art and applications requiring minimal mark size. */
123
+ Low = "low",
124
+ /** Good for digital works of art. */
125
+ Medium = "medium",
126
+ /** Good for general use. */
127
+ Quartile = "quartile",
128
+ /** Industrial strength, largest mark. */
129
+ High = "high",
130
+ }
131
+ /**
132
+ * Parse a resolution string.
133
+ */
134
+ declare function parseResolution(value: string): Resolution;
135
+ /**
136
+ * Parse an output format string.
137
+ */
138
+ declare function parseOutputFormat(value: string): OutputFormat;
139
+ /**
140
+ * Arguments for the new command.
141
+ *
142
+ * Corresponds to Rust `CommandArgs`
143
+ */
144
+ interface NewCommandArgs {
145
+ /** Path to directory to be created. Must not already exist. */
146
+ path: string;
147
+ /** A seed to use for the provenance mark chain, encoded as base64. */
148
+ seed?: ProvenanceSeed;
149
+ /** The resolution of the provenance mark chain. */
150
+ resolution: Resolution;
151
+ /** A comment to be included for the genesis mark. */
152
+ comment: string;
153
+ /** The date of the genesis mark. If not supplied, the current date is used. */
154
+ date?: Date;
155
+ /** Suppress informational status output on stderr/stdout. */
156
+ quiet: boolean;
157
+ /** Output format for the creation summary. */
158
+ format: OutputFormat;
159
+ /** Info args for the mark. */
160
+ info: InfoArgs;
161
+ }
162
+ /**
163
+ * Create default args for the new command.
164
+ */
165
+ declare function defaultNewCommandArgs(): NewCommandArgs;
166
+ /**
167
+ * New command implementation.
168
+ *
169
+ * Corresponds to Rust `impl Exec for CommandArgs`
170
+ */
171
+ declare class NewCommand implements Exec {
172
+ private readonly args;
173
+ constructor(args: NewCommandArgs);
174
+ exec(): string;
175
+ private createDir;
176
+ }
177
+ //#endregion
178
+ //#region src/cmd/next.d.ts
179
+ /**
180
+ * Arguments for the next command.
181
+ *
182
+ * Corresponds to Rust `CommandArgs`
183
+ */
184
+ interface NextCommandArgs {
185
+ /** Path to the chain's directory. Must already exist. */
186
+ path: string;
187
+ /** A comment to be included for the mark. */
188
+ comment: string;
189
+ /** The date of the next mark. If not supplied, the current date is used. */
190
+ date?: Date;
191
+ /** Suppress informational status output on stderr/stdout. */
192
+ quiet: boolean;
193
+ /** Output format for the mark. */
194
+ format: OutputFormat;
195
+ /** Info args for the mark. */
196
+ info: InfoArgs;
197
+ }
198
+ /**
199
+ * Create default args for the next command.
200
+ */
201
+ declare function defaultNextCommandArgs(): NextCommandArgs;
202
+ /**
203
+ * Next command implementation.
204
+ *
205
+ * Corresponds to Rust `impl Exec for CommandArgs`
206
+ */
207
+ declare class NextCommand implements Exec {
208
+ private readonly args;
209
+ constructor(args: NextCommandArgs);
210
+ exec(): string;
211
+ }
212
+ //#endregion
213
+ //#region src/cmd/print.d.ts
214
+ /**
215
+ * Arguments for the print command.
216
+ *
217
+ * Corresponds to Rust `CommandArgs`
218
+ */
219
+ interface PrintCommandArgs {
220
+ /** Path to the chain's directory. Must already exist. */
221
+ path: string;
222
+ /** The sequence number of the first mark to print. */
223
+ start: number;
224
+ /** The sequence number of the last mark to print. */
225
+ end?: number;
226
+ /** Output format for the rendered marks. */
227
+ format: OutputFormat;
228
+ }
229
+ /**
230
+ * Create default args for the print command.
231
+ */
232
+ declare function defaultPrintCommandArgs(): PrintCommandArgs;
233
+ /**
234
+ * Print command implementation.
235
+ *
236
+ * Corresponds to Rust `impl Exec for CommandArgs`
237
+ */
238
+ declare class PrintCommand implements Exec {
239
+ private readonly args;
240
+ constructor(args: PrintCommandArgs);
241
+ exec(): string;
242
+ }
243
+ //#endregion
244
+ //#region src/cmd/validate.d.ts
245
+ /**
246
+ * Output format for the validation report.
247
+ *
248
+ * Corresponds to Rust `Format`
249
+ */
250
+ declare enum ValidateFormat {
251
+ Text = "text",
252
+ JsonCompact = "json-compact",
253
+ JsonPretty = "json-pretty",
254
+ }
255
+ /**
256
+ * Parse a format string.
257
+ */
258
+ declare function parseValidateFormat(value: string): ValidateFormat;
259
+ /**
260
+ * Arguments for the validate command.
261
+ *
262
+ * Corresponds to Rust `CommandArgs`
263
+ */
264
+ interface ValidateCommandArgs {
265
+ /** One or more provenance mark URs to validate. */
266
+ marks: string[];
267
+ /** Path to a chain directory containing marks to validate. */
268
+ dir?: string;
269
+ /** Report issues as warnings without failing. */
270
+ warn: boolean;
271
+ /** Output format for the validation report. */
272
+ format: ValidateFormat;
273
+ }
274
+ /**
275
+ * Create default args for the validate command.
276
+ */
277
+ declare function defaultValidateCommandArgs(): ValidateCommandArgs;
278
+ /**
279
+ * Validate command implementation.
280
+ *
281
+ * Corresponds to Rust `impl Exec for CommandArgs`
282
+ */
283
+ declare class ValidateCommand implements Exec {
284
+ private readonly args;
285
+ constructor(args: ValidateCommandArgs);
286
+ exec(): string;
287
+ /**
288
+ * Parse marks from UR strings.
289
+ *
290
+ * Corresponds to Rust `parse_marks_from_urs()`
291
+ */
292
+ private parseMarksFromUrs;
293
+ /**
294
+ * Extract a ProvenanceMark from a UR string.
295
+ *
296
+ * Supports three types of URs:
297
+ * 1. `ur:provenance` - Direct provenance mark
298
+ * 2. `ur:envelope` - Envelope with a 'provenance' assertion
299
+ * 3. Any other UR type - Attempts to decode CBOR as an envelope
300
+ *
301
+ * Corresponds to Rust `extract_provenance_mark()`
302
+ */
303
+ private extractProvenanceMark;
304
+ /**
305
+ * Extract a ProvenanceMark from an Envelope.
306
+ *
307
+ * The envelope must contain exactly one 'provenance' assertion,
308
+ * and the object subject of that assertion must be a ProvenanceMark.
309
+ *
310
+ * Corresponds to Rust `extract_provenance_mark_from_envelope()`
311
+ */
312
+ private extractProvenanceMarkFromEnvelope;
313
+ /**
314
+ * Load marks from a directory.
315
+ *
316
+ * Corresponds to Rust `load_marks_from_dir()`
317
+ */
318
+ private loadMarksFromDir;
319
+ }
320
+ //#endregion
321
+ //#region src/index.d.ts
322
+ /**
323
+ * @bcts/provenance-mark-cli - Command line tool for creating and managing Provenance Marks
324
+ *
325
+ * This is a 1:1 TypeScript port of provenance-mark-cli-rust.
326
+ *
327
+ * @packageDocumentation
328
+ */
329
+ declare const VERSION = "1.0.0-alpha.13";
330
+ //#endregion
331
+ export { type Exec, type ExecResult, type InfoArgs, NewCommand, type NewCommandArgs, NextCommand, type NextCommandArgs, OutputFormat, PrintCommand, type PrintCommandArgs, Resolution, VERSION, ValidateCommand, type ValidateCommandArgs, ValidateFormat, bytesToHex, defaultNewCommandArgs, defaultNextCommandArgs, defaultPrintCommandArgs, defaultValidateCommandArgs, fromBase64, hexToBytes, parseInfoArgs, parseOutputFormat, parseResolution, parseSeed, parseValidateFormat, readArgument, readExistingDirectoryPath, readNewPath, readStdinSync, toBase64 };
332
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/exec.ts","../src/utils.ts","../src/cmd/info.ts","../src/cmd/seed.ts","../src/cmd/new.ts","../src/cmd/next.ts","../src/cmd/print.ts","../src/cmd/validate.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAUA;AAMA;;;;ACAgB,KDNJ,UAAA,GCMe,MAAA;AAoB3B;AAmBA;AAgBA;AA4BA;AASgB,UD5FC,IAAA,CC4FS;EAYV;AAOhB;;;UD1GU;AENV;;;;;;;AFLA;AAMA;;;;ACAA;AAoBgB,iBApBA,WAAA,CAoByB,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAmBzC;AAgBA;AA4BA;AASA;AAYA;AAOgB,iBA3FA,yBAAA,CA2FsC,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;AChHtD;AAYA;iBD4BgB,YAAA;;;AElChB;iBFkDgB,aAAA,CAAA;;;AG7ChB;AAWY,iBH8DI,UAAA,CG9DM,KAAA,EH8DY,UG9DZ,CAAA,EAAA,MAAA;AA8BtB;AAkBA;AAkBA;AAIS,iBHCO,UAAA,CGDP,GAAA,EAAA,MAAA,CAAA,EHCgC,UGDhC;;;;AAYD,iBHCQ,QAAA,CGDR,KAAA,EHCwB,UGDxB,CAAA,EAAA,MAAA;;AAMR;AAgBA;iBHdgB,UAAA,kBAA4B;;;;;;AA/G5C;AAoBA;AAmBgB,UCxCC,QAAA,CDwCW;EAgBZ;EA4BA,IAAA,CAAA,EAAA,MAAU,GAAA,SAAQ;EASlB;EAYA,OAAA,CAAA,EAAA,MAAQ,GAAA,SAAQ;AAOhC;;;;AChHA;AAYA;iBAAgB,aAAA,OAAoB,WAAW;;;;;;ADX/C;AAoBA;AAmBA;AAgBA;AA4BA;AASA;AAYA;AAOgB,iBE1GA,SAAA,CF0G4B,KAAA,EAAU,MAAA,CAAA,EE1GZ,cF0G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KAAA,EAAA,MAAU;;;;EChHT,MAAA,EIYP,YJZe;AAYzB;;;;ACNgB,iBGYA,uBAAA,CAAA,CHZwC,EGYb,gBHZa;;;;ACKxD;AAWA;AA8BgB,cErBH,YAAA,YAAwB,IFqBqB,CAAA;EAkB1C,iBAAA,IAAiB;EAkBhB,WAAA,CAAA,IAAA,EEtDG,gBFsDW;EAItB,IAAA,CAAA,CAAA,EAAA,MAAA;;;;;;;AH3FT;AAoBA;AAmBgB,aM3BJ,cAAA;EN2CI,IAAA,GAAA,MAAA;EA4BA,WAAA,GAAU,cAAQ;EASlB,UAAA,GAAU,aAAe;AAYzC;AAOA;;;iBM5EgB,mBAAA,iBAAoC;ALpCpD;AAYA;;;;ACNgB,UIgDC,mBAAA,CJhDyB;;;;ECK9B,GAAA,CAAA,EAAA,MAAA;EAWA;EA8BI,IAAA,EAAA,OAAA;EAkBA;EAkBC,MAAA,EG1BP,cH0BqB;;;;;AAgBvB,iBGpCQ,0BAAA,CAAA,CHoCR,EGpCsC,mBHoCtC;;AAMR;AAgBA;;;cG7Ca,eAAA,YAA2B;EF1EvB,iBAAA,IAAe;EAMvB,WAAA,CAAA,IAAA,EEuEW,mBFvEX;EAIC,IAAA,CAAA,CAAA,EAAA,MAAA;EAEF;;AAMR;AAeA;;;;ACpCA;AAcA;AAaA;;;;AClBA;AAuBA;AAkBA;EAcgB,QAAA,qBAA0B;EAa7B;;;;ACxFb;;;;;;;;;;;;;;;;;;AREA;AAMA;;cQRa,OAAA"}
@@ -0,0 +1,332 @@
1
+ import { Cbor } from "@bcts/dcbor";
2
+ import { ProvenanceSeed } from "@bcts/provenance-mark";
3
+
4
+ //#region src/exec.d.ts
5
+
6
+ /**
7
+ * Exec interface - 1:1 port of exec.rs
8
+ *
9
+ * All CLI commands implement this interface.
10
+ */
11
+ /**
12
+ * Result type for command execution.
13
+ * Commands return either a string output or throw an error.
14
+ */
15
+ type ExecResult = string;
16
+ /**
17
+ * Interface that all CLI commands implement.
18
+ * Each command's exec() method returns a string output.
19
+ */
20
+ interface Exec {
21
+ /**
22
+ * Execute the command and return the output string.
23
+ * @throws Error if the command fails
24
+ */
25
+ exec(): ExecResult;
26
+ }
27
+ //#endregion
28
+ //#region src/utils.d.ts
29
+ /**
30
+ * Utilities module - 1:1 port of utils.rs
31
+ *
32
+ * Helper functions for CLI operations.
33
+ */
34
+ /**
35
+ * Read a new path, supporting globbing, and resolving relative paths.
36
+ *
37
+ * Corresponds to Rust `read_new_path()`
38
+ */
39
+ declare function readNewPath(pathStr: string): string;
40
+ /**
41
+ * Read an existing directory path, supporting globbing, and resolving relative paths.
42
+ *
43
+ * Corresponds to Rust `read_existing_directory_path()`
44
+ */
45
+ declare function readExistingDirectoryPath(pathStr: string): string;
46
+ /**
47
+ * Read an argument from command line or stdin.
48
+ *
49
+ * Corresponds to Rust `read_argument()`
50
+ */
51
+ declare function readArgument(argument?: string): string;
52
+ /**
53
+ * Read all stdin synchronously.
54
+ */
55
+ declare function readStdinSync(): string;
56
+ /**
57
+ * Convert bytes to hex string.
58
+ */
59
+ declare function bytesToHex(bytes: Uint8Array): string;
60
+ /**
61
+ * Convert hex string to bytes.
62
+ */
63
+ declare function hexToBytes(hex: string): Uint8Array;
64
+ /**
65
+ * Convert bytes to base64 string.
66
+ */
67
+ declare function toBase64(bytes: Uint8Array): string;
68
+ /**
69
+ * Convert base64 string to bytes.
70
+ */
71
+ declare function fromBase64(base64: string): Uint8Array;
72
+ //#endregion
73
+ //#region src/cmd/info.d.ts
74
+ /**
75
+ * Arguments for info payload.
76
+ *
77
+ * Corresponds to Rust `InfoArgs`
78
+ */
79
+ interface InfoArgs {
80
+ /** Hex-encoded dCBOR or UR payload to embed in the mark's `info` field. */
81
+ info?: string | undefined;
82
+ /** CBOR tag value to associate with an unknown UR type. */
83
+ infoTag?: number | undefined;
84
+ }
85
+ /**
86
+ * Parse info args to CBOR.
87
+ *
88
+ * Corresponds to Rust `InfoArgs::to_cbor()`
89
+ */
90
+ declare function parseInfoArgs(args: InfoArgs): Cbor | undefined;
91
+ //#endregion
92
+ //#region src/cmd/seed.d.ts
93
+ /**
94
+ * Parse a seed from a string.
95
+ *
96
+ * Supports the following formats:
97
+ * - `ur:seed/...` - UR-encoded seed
98
+ * - `0x...` or hex string - Hex-encoded seed
99
+ * - Base64 string - Base64-encoded seed
100
+ *
101
+ * Corresponds to Rust `parse_seed()`
102
+ */
103
+ declare function parseSeed(input: string): ProvenanceSeed;
104
+ //#endregion
105
+ //#region src/cmd/new.d.ts
106
+ /**
107
+ * Output format for the creation summary.
108
+ *
109
+ * Corresponds to Rust `OutputFormat`
110
+ */
111
+ declare enum OutputFormat {
112
+ Markdown = "markdown",
113
+ Ur = "ur",
114
+ Json = "json",
115
+ }
116
+ /**
117
+ * Resolution level for the provenance mark chain.
118
+ *
119
+ * Corresponds to Rust `Resolution`
120
+ */
121
+ declare enum Resolution {
122
+ /** Good for physical works of art and applications requiring minimal mark size. */
123
+ Low = "low",
124
+ /** Good for digital works of art. */
125
+ Medium = "medium",
126
+ /** Good for general use. */
127
+ Quartile = "quartile",
128
+ /** Industrial strength, largest mark. */
129
+ High = "high",
130
+ }
131
+ /**
132
+ * Parse a resolution string.
133
+ */
134
+ declare function parseResolution(value: string): Resolution;
135
+ /**
136
+ * Parse an output format string.
137
+ */
138
+ declare function parseOutputFormat(value: string): OutputFormat;
139
+ /**
140
+ * Arguments for the new command.
141
+ *
142
+ * Corresponds to Rust `CommandArgs`
143
+ */
144
+ interface NewCommandArgs {
145
+ /** Path to directory to be created. Must not already exist. */
146
+ path: string;
147
+ /** A seed to use for the provenance mark chain, encoded as base64. */
148
+ seed?: ProvenanceSeed;
149
+ /** The resolution of the provenance mark chain. */
150
+ resolution: Resolution;
151
+ /** A comment to be included for the genesis mark. */
152
+ comment: string;
153
+ /** The date of the genesis mark. If not supplied, the current date is used. */
154
+ date?: Date;
155
+ /** Suppress informational status output on stderr/stdout. */
156
+ quiet: boolean;
157
+ /** Output format for the creation summary. */
158
+ format: OutputFormat;
159
+ /** Info args for the mark. */
160
+ info: InfoArgs;
161
+ }
162
+ /**
163
+ * Create default args for the new command.
164
+ */
165
+ declare function defaultNewCommandArgs(): NewCommandArgs;
166
+ /**
167
+ * New command implementation.
168
+ *
169
+ * Corresponds to Rust `impl Exec for CommandArgs`
170
+ */
171
+ declare class NewCommand implements Exec {
172
+ private readonly args;
173
+ constructor(args: NewCommandArgs);
174
+ exec(): string;
175
+ private createDir;
176
+ }
177
+ //#endregion
178
+ //#region src/cmd/next.d.ts
179
+ /**
180
+ * Arguments for the next command.
181
+ *
182
+ * Corresponds to Rust `CommandArgs`
183
+ */
184
+ interface NextCommandArgs {
185
+ /** Path to the chain's directory. Must already exist. */
186
+ path: string;
187
+ /** A comment to be included for the mark. */
188
+ comment: string;
189
+ /** The date of the next mark. If not supplied, the current date is used. */
190
+ date?: Date;
191
+ /** Suppress informational status output on stderr/stdout. */
192
+ quiet: boolean;
193
+ /** Output format for the mark. */
194
+ format: OutputFormat;
195
+ /** Info args for the mark. */
196
+ info: InfoArgs;
197
+ }
198
+ /**
199
+ * Create default args for the next command.
200
+ */
201
+ declare function defaultNextCommandArgs(): NextCommandArgs;
202
+ /**
203
+ * Next command implementation.
204
+ *
205
+ * Corresponds to Rust `impl Exec for CommandArgs`
206
+ */
207
+ declare class NextCommand implements Exec {
208
+ private readonly args;
209
+ constructor(args: NextCommandArgs);
210
+ exec(): string;
211
+ }
212
+ //#endregion
213
+ //#region src/cmd/print.d.ts
214
+ /**
215
+ * Arguments for the print command.
216
+ *
217
+ * Corresponds to Rust `CommandArgs`
218
+ */
219
+ interface PrintCommandArgs {
220
+ /** Path to the chain's directory. Must already exist. */
221
+ path: string;
222
+ /** The sequence number of the first mark to print. */
223
+ start: number;
224
+ /** The sequence number of the last mark to print. */
225
+ end?: number;
226
+ /** Output format for the rendered marks. */
227
+ format: OutputFormat;
228
+ }
229
+ /**
230
+ * Create default args for the print command.
231
+ */
232
+ declare function defaultPrintCommandArgs(): PrintCommandArgs;
233
+ /**
234
+ * Print command implementation.
235
+ *
236
+ * Corresponds to Rust `impl Exec for CommandArgs`
237
+ */
238
+ declare class PrintCommand implements Exec {
239
+ private readonly args;
240
+ constructor(args: PrintCommandArgs);
241
+ exec(): string;
242
+ }
243
+ //#endregion
244
+ //#region src/cmd/validate.d.ts
245
+ /**
246
+ * Output format for the validation report.
247
+ *
248
+ * Corresponds to Rust `Format`
249
+ */
250
+ declare enum ValidateFormat {
251
+ Text = "text",
252
+ JsonCompact = "json-compact",
253
+ JsonPretty = "json-pretty",
254
+ }
255
+ /**
256
+ * Parse a format string.
257
+ */
258
+ declare function parseValidateFormat(value: string): ValidateFormat;
259
+ /**
260
+ * Arguments for the validate command.
261
+ *
262
+ * Corresponds to Rust `CommandArgs`
263
+ */
264
+ interface ValidateCommandArgs {
265
+ /** One or more provenance mark URs to validate. */
266
+ marks: string[];
267
+ /** Path to a chain directory containing marks to validate. */
268
+ dir?: string;
269
+ /** Report issues as warnings without failing. */
270
+ warn: boolean;
271
+ /** Output format for the validation report. */
272
+ format: ValidateFormat;
273
+ }
274
+ /**
275
+ * Create default args for the validate command.
276
+ */
277
+ declare function defaultValidateCommandArgs(): ValidateCommandArgs;
278
+ /**
279
+ * Validate command implementation.
280
+ *
281
+ * Corresponds to Rust `impl Exec for CommandArgs`
282
+ */
283
+ declare class ValidateCommand implements Exec {
284
+ private readonly args;
285
+ constructor(args: ValidateCommandArgs);
286
+ exec(): string;
287
+ /**
288
+ * Parse marks from UR strings.
289
+ *
290
+ * Corresponds to Rust `parse_marks_from_urs()`
291
+ */
292
+ private parseMarksFromUrs;
293
+ /**
294
+ * Extract a ProvenanceMark from a UR string.
295
+ *
296
+ * Supports three types of URs:
297
+ * 1. `ur:provenance` - Direct provenance mark
298
+ * 2. `ur:envelope` - Envelope with a 'provenance' assertion
299
+ * 3. Any other UR type - Attempts to decode CBOR as an envelope
300
+ *
301
+ * Corresponds to Rust `extract_provenance_mark()`
302
+ */
303
+ private extractProvenanceMark;
304
+ /**
305
+ * Extract a ProvenanceMark from an Envelope.
306
+ *
307
+ * The envelope must contain exactly one 'provenance' assertion,
308
+ * and the object subject of that assertion must be a ProvenanceMark.
309
+ *
310
+ * Corresponds to Rust `extract_provenance_mark_from_envelope()`
311
+ */
312
+ private extractProvenanceMarkFromEnvelope;
313
+ /**
314
+ * Load marks from a directory.
315
+ *
316
+ * Corresponds to Rust `load_marks_from_dir()`
317
+ */
318
+ private loadMarksFromDir;
319
+ }
320
+ //#endregion
321
+ //#region src/index.d.ts
322
+ /**
323
+ * @bcts/provenance-mark-cli - Command line tool for creating and managing Provenance Marks
324
+ *
325
+ * This is a 1:1 TypeScript port of provenance-mark-cli-rust.
326
+ *
327
+ * @packageDocumentation
328
+ */
329
+ declare const VERSION = "1.0.0-alpha.13";
330
+ //#endregion
331
+ export { type Exec, type ExecResult, type InfoArgs, NewCommand, type NewCommandArgs, NextCommand, type NextCommandArgs, OutputFormat, PrintCommand, type PrintCommandArgs, Resolution, VERSION, ValidateCommand, type ValidateCommandArgs, ValidateFormat, bytesToHex, defaultNewCommandArgs, defaultNextCommandArgs, defaultPrintCommandArgs, defaultValidateCommandArgs, fromBase64, hexToBytes, parseInfoArgs, parseOutputFormat, parseResolution, parseSeed, parseValidateFormat, readArgument, readExistingDirectoryPath, readNewPath, readStdinSync, toBase64 };
332
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/exec.ts","../src/utils.ts","../src/cmd/info.ts","../src/cmd/seed.ts","../src/cmd/new.ts","../src/cmd/next.ts","../src/cmd/print.ts","../src/cmd/validate.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAUA;AAMA;;;;ACAgB,KDNJ,UAAA,GCMe,MAAA;AAoB3B;AAmBA;AAgBA;AA4BA;AASgB,UD5FC,IAAA,CC4FS;EAYV;AAOhB;;;UD1GU;AENV;;;;;;;AFLA;AAMA;;;;ACAA;AAoBgB,iBAp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AAoC;ALpCpD;AAYA;;;;ACNgB,UIgDC,mBAAA,CJhDyB;;;;ECK9B,GAAA,CAAA,EAAA,MAAA;EAWA;EA8BI,IAAA,EAAA,OAAA;EAkBA;EAkBC,MAAA,EG1BP,cH0BqB;;;;;AAgBvB,iBGpCQ,0BAAA,CAAA,CHoCR,EGpCsC,mBHoCtC;;AAMR;AAgBA;;;cG7Ca,eAAA,YAA2B;EF1EvB,iBAAA,IAAe;EAMvB,WAAA,CAAA,IAAA,EEuEW,mBFvEX;EAIC,IAAA,CAAA,CAAA,EAAA,MAAA;EAEF;;AAMR;AAeA;;;;ACpCA;AAcA;AAaA;;;;AClBA;AAuBA;AAkBA;EAcgB,QAAA,qBAA0B;EAa7B;;;;ACxFb;;;;;;;;;;;;;;;;;;AREA;AAMA;;cQRa,OAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { C as readNewPath, S as readExistingDirectoryPath, T as toBase64, _ as parseInfoArgs, a as parseValidateFormat, b as hexToBytes, c as NextCommand, d as OutputFormat, f as Resolution, g as parseSeed, h as parseResolution, i as defaultValidateCommandArgs, l as defaultNextCommandArgs, m as parseOutputFormat, n as ValidateCommand, o as PrintCommand, p as defaultNewCommandArgs, r as ValidateFormat, s as defaultPrintCommandArgs, t as VERSION, u as NewCommand, v as bytesToHex, w as readStdinSync, x as readArgument, y as fromBase64 } from "./src-Bu1tG89l.mjs";
2
+
3
+ export { NewCommand, NextCommand, OutputFormat, PrintCommand, Resolution, VERSION, ValidateCommand, ValidateFormat, bytesToHex, defaultNewCommandArgs, defaultNextCommandArgs, defaultPrintCommandArgs, defaultValidateCommandArgs, fromBase64, hexToBytes, parseInfoArgs, parseOutputFormat, parseResolution, parseSeed, parseValidateFormat, readArgument, readExistingDirectoryPath, readNewPath, readStdinSync, toBase64 };