@uvrn/cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +340 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +297 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/docs/CLI_GUIDE.md +618 -0
- package/jest.config.js +12 -0
- package/package.json +42 -0
- package/src/cli.ts +294 -0
- package/src/index.ts +6 -0
- package/test-bundle.json +25 -0
- package/test-receipt.json +1 -0
- package/tests/cli.test.ts +393 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
# Loosechain Delta Engine CLI - Comprehensive Guide
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
1. [Introduction](#introduction)
|
|
6
|
+
2. [Installation](#installation)
|
|
7
|
+
3. [Core Concepts](#core-concepts)
|
|
8
|
+
4. [Command Reference](#command-reference)
|
|
9
|
+
5. [Input/Output Formats](#inputoutput-formats)
|
|
10
|
+
6. [Workflows & Examples](#workflows--examples)
|
|
11
|
+
7. [Integration Patterns](#integration-patterns)
|
|
12
|
+
8. [Advanced Usage](#advanced-usage)
|
|
13
|
+
9. [Troubleshooting](#troubleshooting)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Introduction
|
|
18
|
+
|
|
19
|
+
The Loosechain Delta Engine CLI provides command-line access to Layer-1 protocol functionality. It transforms data bundles into cryptographically verifiable receipts without requiring any adapter code or external data sources.
|
|
20
|
+
|
|
21
|
+
### What Does It Do?
|
|
22
|
+
|
|
23
|
+
The CLI performs three core operations:
|
|
24
|
+
|
|
25
|
+
1. **Validation** - Verify bundle structure conforms to protocol schema
|
|
26
|
+
2. **Execution** - Run the delta engine and produce a receipt
|
|
27
|
+
3. **Verification** - Replay receipt hash computation to ensure integrity
|
|
28
|
+
|
|
29
|
+
### Protocol Guarantees
|
|
30
|
+
|
|
31
|
+
- **Determinism**: Same bundle → same receipt → same hash
|
|
32
|
+
- **No External Calls**: Pure computation, no network/file I/O during execution
|
|
33
|
+
- **Layer-1 Only**: No adapter logic, no data collection, no enrichment
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### Global Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g @uvrn/cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Verify installation:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
delta-engine --version
|
|
49
|
+
# Output: 1.0.0
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Local/Project Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install @uvrn/cli --save-dev
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Use with npx:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx delta-engine --version
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### From Source
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/uvrn/lc_delta-core.git
|
|
68
|
+
cd lc_delta-core
|
|
69
|
+
git checkout phase-a/cli-v1
|
|
70
|
+
npm install
|
|
71
|
+
npm run build --workspace=@uvrn/cli
|
|
72
|
+
node packages/uvrn-cli/dist/cli.js --version
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Core Concepts
|
|
78
|
+
|
|
79
|
+
### Bundles
|
|
80
|
+
|
|
81
|
+
A **DeltaBundle** is the input to the engine. It contains:
|
|
82
|
+
|
|
83
|
+
- Multiple data sources (DataSpec[])
|
|
84
|
+
- A claim being verified
|
|
85
|
+
- A variance threshold
|
|
86
|
+
|
|
87
|
+
### Receipts
|
|
88
|
+
|
|
89
|
+
A **DeltaReceipt** is the output. It contains:
|
|
90
|
+
|
|
91
|
+
- Computed deltas (variances)
|
|
92
|
+
- Round-by-round analysis
|
|
93
|
+
- Consensus outcome
|
|
94
|
+
- Cryptographic hash
|
|
95
|
+
|
|
96
|
+
### The Delta Engine
|
|
97
|
+
|
|
98
|
+
The engine compares metrics across sources and computes variances. If variance stays within the threshold, the bundle achieves **consensus**. Otherwise, it's **indeterminate**.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Command Reference
|
|
103
|
+
|
|
104
|
+
### `delta-engine run`
|
|
105
|
+
|
|
106
|
+
**Purpose**: Execute the delta engine on a bundle.
|
|
107
|
+
|
|
108
|
+
**Syntax**:
|
|
109
|
+
```bash
|
|
110
|
+
delta-engine run [bundle] [options]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Arguments**:
|
|
114
|
+
- `[bundle]` - Path to bundle file, URL, or omit for stdin
|
|
115
|
+
|
|
116
|
+
**Options**:
|
|
117
|
+
- `-o, --output <file>` - Write receipt to file
|
|
118
|
+
- `-q, --quiet` - Suppress console messages
|
|
119
|
+
- `-p, --pretty` - Pretty-print JSON
|
|
120
|
+
|
|
121
|
+
**Examples**:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# File input
|
|
125
|
+
delta-engine run bundle.json
|
|
126
|
+
|
|
127
|
+
# Pretty output to file
|
|
128
|
+
delta-engine run bundle.json --output receipt.json --pretty
|
|
129
|
+
|
|
130
|
+
# Stdin input
|
|
131
|
+
cat bundle.json | delta-engine run
|
|
132
|
+
|
|
133
|
+
# URL input
|
|
134
|
+
delta-engine run https://example.com/data/bundle.json
|
|
135
|
+
|
|
136
|
+
# Quiet mode (only JSON output)
|
|
137
|
+
delta-engine run bundle.json --quiet
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Exit Codes**:
|
|
141
|
+
- `0` - Success (consensus achieved)
|
|
142
|
+
- `1` - Invalid bundle structure
|
|
143
|
+
- `2` - Engine error
|
|
144
|
+
- `3` - I/O error
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### `delta-engine validate`
|
|
149
|
+
|
|
150
|
+
**Purpose**: Validate bundle structure without running engine.
|
|
151
|
+
|
|
152
|
+
**Syntax**:
|
|
153
|
+
```bash
|
|
154
|
+
delta-engine validate [bundle] [options]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Arguments**:
|
|
158
|
+
- `[bundle]` - Path to bundle file, URL, or omit for stdin
|
|
159
|
+
|
|
160
|
+
**Options**:
|
|
161
|
+
- `-o, --output <file>` - Write result to file
|
|
162
|
+
- `-q, --quiet` - Suppress console messages
|
|
163
|
+
- `-p, --pretty` - Pretty-print JSON
|
|
164
|
+
|
|
165
|
+
**Examples**:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Basic validation
|
|
169
|
+
delta-engine validate bundle.json
|
|
170
|
+
|
|
171
|
+
# With detailed output
|
|
172
|
+
delta-engine validate bundle.json --pretty
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Output Format**:
|
|
176
|
+
|
|
177
|
+
Valid bundle:
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"valid": true
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Invalid bundle:
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"valid": false,
|
|
188
|
+
"error": "thresholdPct must be > 0 and <= 1"
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Exit Codes**:
|
|
193
|
+
- `0` - Bundle is valid
|
|
194
|
+
- `1` - Bundle is invalid
|
|
195
|
+
- `3` - I/O error
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### `delta-engine verify`
|
|
200
|
+
|
|
201
|
+
**Purpose**: Verify receipt integrity by recomputing hash.
|
|
202
|
+
|
|
203
|
+
**Syntax**:
|
|
204
|
+
```bash
|
|
205
|
+
delta-engine verify [receipt] [options]
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Arguments**:
|
|
209
|
+
- `[receipt]` - Path to receipt file, URL, or omit for stdin
|
|
210
|
+
|
|
211
|
+
**Options**:
|
|
212
|
+
- `-o, --output <file>` - Write result to file
|
|
213
|
+
- `-q, --quiet` - Suppress console messages
|
|
214
|
+
- `-p, --pretty` - Pretty-print JSON
|
|
215
|
+
|
|
216
|
+
**Examples**:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Verify receipt
|
|
220
|
+
delta-engine verify receipt.json
|
|
221
|
+
|
|
222
|
+
# Pretty output
|
|
223
|
+
delta-engine verify receipt.json --pretty
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Output Format**:
|
|
227
|
+
|
|
228
|
+
Valid receipt:
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"verified": true,
|
|
232
|
+
"hash": "36247244c63f58e0b2908d2fad115f60677f29b59b67665579b9b6e8db727791"
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Invalid receipt:
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"verified": false,
|
|
240
|
+
"error": "Hash mismatch. Provided: abc..., Computed: def...",
|
|
241
|
+
"providedHash": "abc123...",
|
|
242
|
+
"recomputedHash": "def456..."
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Exit Codes**:
|
|
247
|
+
- `0` - Receipt is valid
|
|
248
|
+
- `2` - Receipt verification failed
|
|
249
|
+
- `3` - I/O error
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Input/Output Formats
|
|
254
|
+
|
|
255
|
+
### Reading Input
|
|
256
|
+
|
|
257
|
+
The CLI supports three input methods:
|
|
258
|
+
|
|
259
|
+
#### 1. File Path
|
|
260
|
+
```bash
|
|
261
|
+
delta-engine run /path/to/bundle.json
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Both relative and absolute paths work:
|
|
265
|
+
```bash
|
|
266
|
+
delta-engine run ./data/bundle.json
|
|
267
|
+
delta-engine run ~/bundles/bundle.json
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### 2. Stdin
|
|
271
|
+
```bash
|
|
272
|
+
cat bundle.json | delta-engine run
|
|
273
|
+
echo '{"bundleId":"test",...}' | delta-engine run
|
|
274
|
+
curl https://api.example.com/bundle | delta-engine run
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Use `-` explicitly:
|
|
278
|
+
```bash
|
|
279
|
+
delta-engine run - < bundle.json
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
#### 3. URL
|
|
283
|
+
```bash
|
|
284
|
+
delta-engine run https://example.com/bundle.json
|
|
285
|
+
delta-engine run http://localhost:3000/api/bundle
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Supports both HTTP and HTTPS.
|
|
289
|
+
|
|
290
|
+
### Writing Output
|
|
291
|
+
|
|
292
|
+
#### 1. Stdout (Default)
|
|
293
|
+
```bash
|
|
294
|
+
delta-engine run bundle.json
|
|
295
|
+
# Prints JSON to console
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### 2. File
|
|
299
|
+
```bash
|
|
300
|
+
delta-engine run bundle.json --output receipt.json
|
|
301
|
+
# Writes to receipt.json
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### 3. Pretty Print
|
|
305
|
+
```bash
|
|
306
|
+
delta-engine run bundle.json --pretty
|
|
307
|
+
# Formatted JSON with indentation
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
#### 4. Quiet Mode
|
|
311
|
+
```bash
|
|
312
|
+
delta-engine run bundle.json --quiet
|
|
313
|
+
# No status messages, only JSON
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Workflows & Examples
|
|
319
|
+
|
|
320
|
+
### Basic Verification Workflow
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Step 1: Validate bundle structure
|
|
324
|
+
delta-engine validate bundle.json
|
|
325
|
+
# ✓ Bundle is valid
|
|
326
|
+
|
|
327
|
+
# Step 2: Run engine
|
|
328
|
+
delta-engine run bundle.json --output receipt.json
|
|
329
|
+
# Generates receipt
|
|
330
|
+
|
|
331
|
+
# Step 3: Verify receipt
|
|
332
|
+
delta-engine verify receipt.json
|
|
333
|
+
# ✓ Receipt is valid
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### CI/CD Integration
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
#!/bin/bash
|
|
340
|
+
# verify-security-scan.sh
|
|
341
|
+
|
|
342
|
+
BUNDLE="security-scan-bundle.json"
|
|
343
|
+
RECEIPT="security-scan-receipt.json"
|
|
344
|
+
|
|
345
|
+
# Validate bundle
|
|
346
|
+
if ! delta-engine validate "$BUNDLE" --quiet; then
|
|
347
|
+
echo "ERROR: Invalid bundle structure"
|
|
348
|
+
exit 1
|
|
349
|
+
fi
|
|
350
|
+
|
|
351
|
+
# Run engine
|
|
352
|
+
if delta-engine run "$BUNDLE" --output "$RECEIPT" --quiet; then
|
|
353
|
+
echo "✓ Security scan achieved consensus"
|
|
354
|
+
|
|
355
|
+
# Verify receipt integrity
|
|
356
|
+
delta-engine verify "$RECEIPT" --quiet
|
|
357
|
+
|
|
358
|
+
# Archive receipt with timestamp
|
|
359
|
+
cp "$RECEIPT" "archive/receipt-$(date +%Y%m%d-%H%M%S).json"
|
|
360
|
+
else
|
|
361
|
+
echo "✗ Security scan failed to reach consensus"
|
|
362
|
+
echo "Review variance in receipt details"
|
|
363
|
+
exit 1
|
|
364
|
+
fi
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Batch Processing
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
#!/bin/bash
|
|
371
|
+
# Process multiple bundles
|
|
372
|
+
|
|
373
|
+
for bundle in bundles/*.json; do
|
|
374
|
+
name=$(basename "$bundle" .json)
|
|
375
|
+
receipt="receipts/${name}-receipt.json"
|
|
376
|
+
|
|
377
|
+
echo "Processing $name..."
|
|
378
|
+
|
|
379
|
+
if delta-engine run "$bundle" --output "$receipt" --quiet; then
|
|
380
|
+
echo " ✓ Generated $receipt"
|
|
381
|
+
else
|
|
382
|
+
echo " ✗ Failed to process $bundle"
|
|
383
|
+
fi
|
|
384
|
+
done
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Data Pipeline Integration
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Fetch data → Build bundle → Run engine → Store receipt
|
|
391
|
+
|
|
392
|
+
curl -X POST https://api.example.com/collect \
|
|
393
|
+
-H "Content-Type: application/json" \
|
|
394
|
+
-d '{"sources": ["github", "npm", "security-db"]}' | \
|
|
395
|
+
delta-engine run --output receipt.json --pretty
|
|
396
|
+
|
|
397
|
+
# Then push receipt to storage
|
|
398
|
+
aws s3 cp receipt.json s3://receipts/$(date +%Y-%m-%d)/receipt.json
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Integration Patterns
|
|
404
|
+
|
|
405
|
+
### Node.js Scripts
|
|
406
|
+
|
|
407
|
+
```javascript
|
|
408
|
+
const { execSync } = require('child_process');
|
|
409
|
+
const fs = require('fs');
|
|
410
|
+
|
|
411
|
+
// Build bundle
|
|
412
|
+
const bundle = {
|
|
413
|
+
bundleId: 'script-001',
|
|
414
|
+
claim: 'Verify metrics',
|
|
415
|
+
thresholdPct: 0.05,
|
|
416
|
+
dataSpecs: [/* ... */]
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
fs.writeFileSync('bundle.json', JSON.stringify(bundle));
|
|
420
|
+
|
|
421
|
+
// Run CLI
|
|
422
|
+
try {
|
|
423
|
+
const receipt = execSync('delta-engine run bundle.json --quiet', {
|
|
424
|
+
encoding: 'utf-8'
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
const receiptObj = JSON.parse(receipt);
|
|
428
|
+
console.log('Outcome:', receiptObj.outcome);
|
|
429
|
+
console.log('Hash:', receiptObj.hash);
|
|
430
|
+
} catch (error) {
|
|
431
|
+
console.error('Engine failed:', error.message);
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Python Integration
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
import subprocess
|
|
439
|
+
import json
|
|
440
|
+
|
|
441
|
+
# Load bundle
|
|
442
|
+
with open('bundle.json', 'r') as f:
|
|
443
|
+
bundle = json.load(f)
|
|
444
|
+
|
|
445
|
+
# Run CLI
|
|
446
|
+
result = subprocess.run(
|
|
447
|
+
['delta-engine', 'run', 'bundle.json', '--quiet'],
|
|
448
|
+
capture_output=True,
|
|
449
|
+
text=True
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
if result.returncode == 0:
|
|
453
|
+
receipt = json.loads(result.stdout)
|
|
454
|
+
print(f"Outcome: {receipt['outcome']}")
|
|
455
|
+
print(f"Hash: {receipt['hash']}")
|
|
456
|
+
else:
|
|
457
|
+
print(f"Error: {result.stderr}")
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Shell Functions
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Add to .bashrc or .zshrc
|
|
464
|
+
|
|
465
|
+
# Shorthand for validate + run + verify
|
|
466
|
+
verify-bundle() {
|
|
467
|
+
local bundle="$1"
|
|
468
|
+
local receipt="${2:-receipt.json}"
|
|
469
|
+
|
|
470
|
+
delta-engine validate "$bundle" && \
|
|
471
|
+
delta-engine run "$bundle" --output "$receipt" && \
|
|
472
|
+
delta-engine verify "$receipt"
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
# Usage:
|
|
476
|
+
# verify-bundle bundle.json output-receipt.json
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## Advanced Usage
|
|
482
|
+
|
|
483
|
+
### Combining with jq
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
# Extract specific fields
|
|
487
|
+
delta-engine run bundle.json | jq '.outcome'
|
|
488
|
+
# "consensus"
|
|
489
|
+
|
|
490
|
+
delta-engine run bundle.json | jq '.deltaFinal'
|
|
491
|
+
# 0.01980198
|
|
492
|
+
|
|
493
|
+
# Filter rounds
|
|
494
|
+
delta-engine run bundle.json | jq '.rounds[] | select(.withinThreshold == false)'
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### Environment Variables
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
# Set default output directory
|
|
501
|
+
export DELTA_ENGINE_OUTPUT_DIR="./receipts"
|
|
502
|
+
|
|
503
|
+
# Wrapper script
|
|
504
|
+
delta-engine run bundle.json --output "$DELTA_ENGINE_OUTPUT_DIR/receipt.json"
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Parallel Execution
|
|
508
|
+
|
|
509
|
+
```bash
|
|
510
|
+
# Process multiple bundles in parallel (GNU parallel)
|
|
511
|
+
ls bundles/*.json | parallel -j 4 \
|
|
512
|
+
'delta-engine run {} --output receipts/{/.}-receipt.json'
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### Streaming JSON
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
# Process newline-delimited JSON
|
|
519
|
+
while IFS= read -r bundle; do
|
|
520
|
+
echo "$bundle" | delta-engine run --quiet
|
|
521
|
+
done < bundles.ndjson > receipts.ndjson
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## Troubleshooting
|
|
527
|
+
|
|
528
|
+
### Common Issues
|
|
529
|
+
|
|
530
|
+
#### Issue: "Cannot find module '@uvrn/core'"
|
|
531
|
+
|
|
532
|
+
**Solution**: Rebuild the workspace:
|
|
533
|
+
```bash
|
|
534
|
+
cd /path/to/monorepo
|
|
535
|
+
npm run build
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
#### Issue: "Invalid JSON for bundle"
|
|
539
|
+
|
|
540
|
+
**Solution**: Validate JSON syntax:
|
|
541
|
+
```bash
|
|
542
|
+
cat bundle.json | jq .
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
#### Issue: "thresholdPct must be > 0 and <= 1"
|
|
546
|
+
|
|
547
|
+
**Solution**: Check your threshold value:
|
|
548
|
+
```json
|
|
549
|
+
{
|
|
550
|
+
"thresholdPct": 0.05 // Valid: 5%
|
|
551
|
+
}
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
Not:
|
|
555
|
+
```json
|
|
556
|
+
{
|
|
557
|
+
"thresholdPct": 5 // Invalid: Must be 0.0 to 1.0
|
|
558
|
+
}
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
#### Issue: "dataSpecs must be an array with at least 2 items"
|
|
562
|
+
|
|
563
|
+
**Solution**: Ensure at least 2 data sources:
|
|
564
|
+
```json
|
|
565
|
+
{
|
|
566
|
+
"dataSpecs": [
|
|
567
|
+
{ "id": "source-1", /* ... */ },
|
|
568
|
+
{ "id": "source-2", /* ... */ }
|
|
569
|
+
]
|
|
570
|
+
}
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### Debug Mode
|
|
574
|
+
|
|
575
|
+
Enable verbose logging:
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
# Node.js debug
|
|
579
|
+
NODE_DEBUG=* delta-engine run bundle.json
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Checking Exit Codes
|
|
583
|
+
|
|
584
|
+
```bash
|
|
585
|
+
delta-engine run bundle.json
|
|
586
|
+
case $? in
|
|
587
|
+
0) echo "Success" ;;
|
|
588
|
+
1) echo "Invalid bundle" ;;
|
|
589
|
+
2) echo "Engine error" ;;
|
|
590
|
+
3) echo "I/O error" ;;
|
|
591
|
+
esac
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
|
|
596
|
+
## Best Practices
|
|
597
|
+
|
|
598
|
+
1. **Always validate before running**: Use `validate` to catch structural issues early
|
|
599
|
+
2. **Use --quiet in scripts**: Suppress console output for cleaner automation
|
|
600
|
+
3. **Store receipts with timestamps**: Archive receipts for audit trails
|
|
601
|
+
4. **Verify receipts after generation**: Ensure hash integrity immediately
|
|
602
|
+
5. **Use semantic bundle IDs**: Make bundleId descriptive (e.g., `security-scan-2024-01-14`)
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Next Steps
|
|
607
|
+
|
|
608
|
+
- Explore the [API Server](../../uvrn-api/README.md) for HTTP access
|
|
609
|
+
- Learn about [MCP Integration](../../uvrn-mcp/README.md) for AI agents
|
|
610
|
+
- Read the [Protocol Specification](../../../admin/docs/compass/PROTOCOL.md)
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
## Support
|
|
615
|
+
|
|
616
|
+
- Repository: https://github.com/uvrn/lc_delta-core
|
|
617
|
+
- Issues: https://github.com/uvrn/lc_delta-core/issues
|
|
618
|
+
- Protocol Docs: See `/admin/docs/compass/` in repository
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
preset: 'ts-jest',
|
|
3
|
+
testEnvironment: 'node',
|
|
4
|
+
roots: ['<rootDir>/tests'],
|
|
5
|
+
testMatch: ['**/*.test.ts'],
|
|
6
|
+
collectCoverageFrom: [
|
|
7
|
+
'src/**/*.ts',
|
|
8
|
+
'!src/**/*.d.ts'
|
|
9
|
+
],
|
|
10
|
+
coverageDirectory: 'coverage',
|
|
11
|
+
coverageReporters: ['text', 'lcov', 'html']
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uvrn/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "UVRN CLI — bundle to receipt",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"uvrn": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"uvrn",
|
|
12
|
+
"cli",
|
|
13
|
+
"verification",
|
|
14
|
+
"receipt"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"commander": "^11.1.0",
|
|
19
|
+
"@uvrn/core": "1.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/jest": "^29.5.0",
|
|
23
|
+
"@types/node": "^20.0.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
25
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
26
|
+
"eslint": "^8.0.0",
|
|
27
|
+
"jest": "^29.5.0",
|
|
28
|
+
"ts-jest": "^29.1.0",
|
|
29
|
+
"typescript": "^5.3.0"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"test:watch": "jest --watch",
|
|
38
|
+
"test:coverage": "jest --coverage",
|
|
39
|
+
"lint": "eslint src/**/*.ts",
|
|
40
|
+
"clean": "rm -rf dist"
|
|
41
|
+
}
|
|
42
|
+
}
|