@cobol-ts/cobolts 0.0.18 → 0.0.19

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.
Files changed (96) hide show
  1. package/README.benchmark.md +21 -21
  2. package/README.cel.md +19 -11
  3. package/README.crypto.md +105 -0
  4. package/README.md +31 -19
  5. package/README.oracle.md +110 -0
  6. package/README.periodic-verification.md +84 -83
  7. package/dist/src/benchmark.aggregate.fixture.spec.js +2 -2
  8. package/dist/src/benchmark.aggregate.fixture.spec.js.map +1 -1
  9. package/dist/src/benchmark.cli.functional.spec.js +15 -5
  10. package/dist/src/benchmark.cli.functional.spec.js.map +1 -1
  11. package/dist/src/benchmark.cli.golden.spec.js +6 -4
  12. package/dist/src/benchmark.cli.golden.spec.js.map +1 -1
  13. package/dist/src/benchmark.composed.execution.spec.js +1 -1
  14. package/dist/src/benchmark.composed.execution.spec.js.map +1 -1
  15. package/dist/src/benchmark.composed.fixture.js +2 -2
  16. package/dist/src/benchmark.composed.fixture.js.map +1 -1
  17. package/dist/src/benchmark.composed.fixture.spec.js +3 -1
  18. package/dist/src/benchmark.composed.fixture.spec.js.map +1 -1
  19. package/dist/src/benchmark.composed.runner.js +14 -4
  20. package/dist/src/benchmark.composed.runner.js.map +1 -1
  21. package/dist/src/benchmark.composed.two.fixture.js +9 -5
  22. package/dist/src/benchmark.composed.two.fixture.js.map +1 -1
  23. package/dist/src/benchmark.composed.two.spec.js +3 -1
  24. package/dist/src/benchmark.composed.two.spec.js.map +1 -1
  25. package/dist/src/benchmark.format.composition.spec.js +16 -11
  26. package/dist/src/benchmark.format.composition.spec.js.map +1 -1
  27. package/dist/src/benchmark.format.fixture.js +2 -2
  28. package/dist/src/benchmark.format.fixture.js.map +1 -1
  29. package/dist/src/benchmark.format.runner.js +2 -2
  30. package/dist/src/benchmark.format.runner.js.map +1 -1
  31. package/dist/src/benchmark.format.spec.js +1 -1
  32. package/dist/src/benchmark.format.spec.js.map +1 -1
  33. package/dist/src/benchmark.periodic.execution.spec.js +6 -6
  34. package/dist/src/benchmark.periodic.execution.spec.js.map +1 -1
  35. package/dist/src/benchmark.runner.d.ts +2 -1
  36. package/dist/src/benchmark.runner.js +10 -2
  37. package/dist/src/benchmark.runner.js.map +1 -1
  38. package/dist/src/benchmark.runner.spec.js +10 -4
  39. package/dist/src/benchmark.runner.spec.js.map +1 -1
  40. package/dist/src/benchmark.strategy.spec.js +3 -1
  41. package/dist/src/benchmark.strategy.spec.js.map +1 -1
  42. package/dist/src/cel.composition.integration.spec.js +15 -12
  43. package/dist/src/cel.composition.integration.spec.js.map +1 -1
  44. package/dist/src/cel.evaluate.integration.spec.js +18 -15
  45. package/dist/src/cel.evaluate.integration.spec.js.map +1 -1
  46. package/dist/src/cel.shared.execution.d.ts +3 -3
  47. package/dist/src/cel.shared.execution.js +4 -4
  48. package/dist/src/cel.shared.execution.js.map +1 -1
  49. package/dist/src/cli.integration.spec.js +2 -2
  50. package/dist/src/cli.integration.spec.js.map +1 -1
  51. package/dist/src/cli.js +6 -0
  52. package/dist/src/cli.js.map +1 -1
  53. package/dist/src/cli.spec.js +18 -0
  54. package/dist/src/cli.spec.js.map +1 -1
  55. package/dist/src/commands/ai.demo.spec.js +22 -2
  56. package/dist/src/commands/ai.demo.spec.js.map +1 -1
  57. package/dist/src/commands/ai.spec.js +1 -1
  58. package/dist/src/commands/ai.spec.js.map +1 -1
  59. package/dist/src/commands/benchmark.js +3 -4
  60. package/dist/src/commands/benchmark.js.map +1 -1
  61. package/dist/src/commands/cel.js +10 -4
  62. package/dist/src/commands/cel.js.map +1 -1
  63. package/dist/src/commands/characteristics.spec.js +41 -41
  64. package/dist/src/commands/characteristics.spec.js.map +1 -1
  65. package/dist/src/commands/config.compositions.d.ts +4 -0
  66. package/dist/src/commands/config.compositions.js +15 -0
  67. package/dist/src/commands/config.compositions.js.map +1 -0
  68. package/dist/src/commands/config.validate.js +1 -0
  69. package/dist/src/commands/config.validate.js.map +1 -1
  70. package/dist/src/commands/crypto.d.ts +41 -0
  71. package/dist/src/commands/crypto.js +196 -0
  72. package/dist/src/commands/crypto.js.map +1 -0
  73. package/dist/src/commands/crypto.spec.d.ts +1 -0
  74. package/dist/src/commands/crypto.spec.js +32 -0
  75. package/dist/src/commands/crypto.spec.js.map +1 -0
  76. package/dist/src/commands/extract.spec.js +1 -1
  77. package/dist/src/commands/extract.spec.js.map +1 -1
  78. package/dist/src/commands/graph.spec.js +9 -1
  79. package/dist/src/commands/graph.spec.js.map +1 -1
  80. package/dist/src/commands/oracle.d.ts +3 -0
  81. package/dist/src/commands/oracle.js +96 -0
  82. package/dist/src/commands/oracle.js.map +1 -0
  83. package/dist/src/commands/validate.all.js +12 -3
  84. package/dist/src/commands/validate.all.js.map +1 -1
  85. package/dist/src/commands/validate.all.spec.js +22 -0
  86. package/dist/src/commands/validate.all.spec.js.map +1 -1
  87. package/dist/src/context.d.ts +5 -1
  88. package/dist/src/context.js +29 -9
  89. package/dist/src/context.js.map +1 -1
  90. package/dist/src/oracle.repository.d.ts +28 -0
  91. package/dist/src/oracle.repository.js +205 -0
  92. package/dist/src/oracle.repository.js.map +1 -0
  93. package/dist/src/oracle.repository.spec.d.ts +1 -0
  94. package/dist/src/oracle.repository.spec.js +118 -0
  95. package/dist/src/oracle.repository.spec.js.map +1 -0
  96. package/package.json +28 -27
@@ -20,10 +20,10 @@ yarn cobolts benchmark composition run format-composed-two -n 10000 --runs 5 --a
20
20
 
21
21
  | Command | Workload | Main question |
22
22
  | --- | --- | --- |
23
- | `benchmark run format-indexed-graph-state -n 10000 --runs 5 --modes "read,cel" --accumulator-strategy indexed` | One physical input plus sorted historical accumulator, 1,000 graph nodes in the generated fixture | How fast is indexed graph execution for this single-source workload? |
23
+ | `benchmark run format-indexed-graph-state -n 10000 --runs 5 --composition benchmark --modes "read,cel" --accumulator-strategy indexed` | One physical input plus sorted historical accumulator, 1,000 graph nodes in the generated fixture | How fast is indexed graph execution for this single-source workload? |
24
24
  | `benchmark composition run format-composed-two -n 10000 --runs 5 --accumulator-strategy indexed` | **Two physical files**: a COBOL customer master and a CSV account stream, with direct `manyOptional` matching and historical accumulator | What is the cost of joining two presorted physical streams and evaluating 1,000 graph nodes? |
25
25
  | `benchmark composition run -n 10000 --runs 5 --accumulator-strategy indexed` | Five physical source formats, an explicit CSV relationship map, optional one-to-many records and historical accumulator | What is the total composed customer throughput? |
26
- | `benchmark run graph-1000 -n 10000 --runs 5 --modes "read,cel" --accumulator-strategy indexed` | Legacy COBOL graph fixture, retaining one accumulator across input records | How does the older graph fixture run on the indexed executor? |
26
+ | `benchmark run graph-1000 -n 10000 --runs 5 --composition benchmark --modes "read,cel" --accumulator-strategy indexed` | Legacy COBOL graph fixture, retaining one accumulator across input records | How does the older graph fixture run on the indexed executor? |
27
27
 
28
28
  These **are different workloads**. The legacy `graph-1000` project does not model the same per-customer historical-state join as the generated format or composition projects. Do not interpret throughput differences between them as the cost of one particular data format or accumulator implementation.
29
29
 
@@ -44,8 +44,8 @@ The timed composition pass includes source scanning, the merge, the historical a
44
44
  For a fair object-versus-indexed comparison, run the **same project** twice, changing only `--accumulator-strategy`:
45
45
 
46
46
  ```powershell
47
- yarn cobolts benchmark run format-indexed-graph-state -n 10000 --runs 5 --modes "read,cel" --accumulator-strategy object
48
- yarn cobolts benchmark run format-indexed-graph-state -n 10000 --runs 5 --modes "read,cel" --accumulator-strategy indexed
47
+ yarn cobolts benchmark run format-indexed-graph-state -n 10000 --runs 5 --modes "read,cel" --accumulator-strategy object --composition benchmark
48
+ yarn cobolts benchmark run format-indexed-graph-state -n 10000 --runs 5 --modes "read,cel" --accumulator-strategy indexed --composition benchmark
49
49
  ```
50
50
 
51
51
  Verify the fixtures before drawing conclusions:
@@ -80,36 +80,36 @@ The report shows medians across runs, and may show averages and ranges. Warm-up
80
80
 
81
81
  ```powershell
82
82
  # Projection traversal (separate from read-only and CEL passes)
83
- yarn cobolts benchmark run graph-1000 -n 10000 --runs 5 --modes "read,project,cel"
83
+ yarn cobolts benchmark run graph-1000 -n 10000 --runs 5 --modes "read,project,cel" --composition benchmark
84
84
 
85
85
  # A matching 1,000-node scalar control (no map/reduce):
86
86
  # First generate it, then run it with identical record counts and options.
87
87
  yarn cobolts benchmark init graph-1000-no-map -n 100000
88
- yarn cobolts benchmark run graph-1000-no-map -n 100000 --runs 5 --modes "read,cel" --accumulator-strategy indexed
88
+ yarn cobolts benchmark run graph-1000-no-map -n 100000 --runs 5 --modes "read,cel" --accumulator-strategy indexed --composition benchmark
89
89
 
90
90
  # Three diagnostic benchmarks, each with 1,000 nodes and identical generated records:
91
91
  # A: constant CEL; B: now-chain + arithmetic; C: input/conditional scalar control.
92
92
  yarn cobolts benchmark init graph-1000-constant -n 10000
93
93
  yarn cobolts benchmark init graph-1000-chain -n 10000
94
94
  yarn cobolts benchmark init graph-1000-input -n 10000
95
- yarn cobolts benchmark run graph-1000-constant -n 10000 --runs 5 --gc
96
- yarn cobolts benchmark run graph-1000-chain -n 10000 --runs 5 --gc
97
- yarn cobolts benchmark run graph-1000-input -n 10000 --runs 5 --gc
95
+ yarn cobolts benchmark run graph-1000-constant -n 10000 --runs 5 --gc --composition benchmark
96
+ yarn cobolts benchmark run graph-1000-chain -n 10000 --runs 5 --gc --composition benchmark
97
+ yarn cobolts benchmark run graph-1000-input -n 10000 --runs 5 --gc --composition benchmark
98
98
 
99
99
  # Investigate GC (adds overhead)
100
- yarn cobolts benchmark run graph-1000 -n 10000 --runs 5 --gc
100
+ yarn cobolts benchmark run graph-1000 -n 10000 --runs 5 --gc --composition benchmark
101
101
 
102
102
  # Graph generation timing, sampled every 100 records
103
- yarn cobolts benchmark run graph-1000 -n 10000 --runs 3 --graph-timing --timing-sample-every 100
103
+ yarn cobolts benchmark run graph-1000 -n 10000 --runs 3 --graph-timing --timing-sample-every 100 --composition benchmark
104
104
 
105
105
  # CPU sampling profile; not for comparable throughput numbers
106
- yarn cobolts benchmark run graph-1000 -n 10000 --runs 1 --cpu-profile
106
+ yarn cobolts benchmark run graph-1000 -n 10000 --runs 1 --cpu-profile --composition benchmark
107
107
 
108
108
  # JSON report for reproducible analysis
109
- yarn cobolts benchmark run graph-1000 -n 10000 --runs 5 --json
109
+ yarn cobolts benchmark run graph-1000 -n 10000 --runs 5 --json --composition benchmark
110
110
  ```
111
111
 
112
- Options on `benchmark run` include `-n/--records`, `-r/--runs`, `--modes`, `--accumulator-strategy`, `--json`, `--gc`, `--graph-timing`, `--timing-sample-every`, `--cpu-profile`, `--allocation-profile` and `--profile-mode`. `benchmark composition run` is a separate command and has its own narrower options.
112
+ Options on `benchmark run` include `-n/--records`, `-r/--runs`, `--modes`, `--accumulator-strategy`, `--composition`, `--json`, `--gc`, `--graph-timing`, `--timing-sample-every`, `--cpu-profile`, `--allocation-profile` and `--profile-mode`. `benchmark composition run` is a separate command and has its own narrower options.
113
113
 
114
114
  ## Correctness and limitations
115
115
 
@@ -127,9 +127,9 @@ composition in each project's `.cobolts/files.yaml` and validate it:
127
127
  ```powershell
128
128
  yarn cobolts -d benchmarks validate all
129
129
  yarn cobolts -d benchmarks/baseline config files
130
- yarn cobolts -d benchmarks/baseline cel validate
131
- yarn cobolts -d benchmarks/baseline cel execute --count 1 --raw
132
- yarn cobolts -d benchmarks/baseline cel evaluate 1 --debug
130
+ yarn cobolts -d benchmarks/baseline cel validate --composition benchmark
131
+ yarn cobolts -d benchmarks/baseline cel execute --composition benchmark --count 1 --raw
132
+ yarn cobolts -d benchmarks/baseline cel evaluate 1 --composition benchmark --debug
133
133
  ```
134
134
 
135
135
  The `benchmark.cli.golden.spec.ts` functional suite exercises all four graph
@@ -157,8 +157,8 @@ This selects safe-integer numeric IDs for the indexed merge.
157
157
 
158
158
  ```powershell
159
159
  yarn cobolts benchmark init graph-1000-periodic -n 10000
160
- yarn cobolts benchmark run graph-1000-periodic -n 10000 --runs 5 --periodicity daily --accumulator-strategy indexed
161
- yarn cobolts benchmark run graph-1000-periodic -n 10000 --runs 5 --periodicity monthly --accumulator-strategy indexed
160
+ yarn cobolts benchmark run graph-1000-periodic -n 10000 --runs 5 --composition benchmark --accumulator-strategy indexed
161
+ yarn cobolts benchmark run graph-1000-periodic -n 10000 --runs 5 --composition monthly --accumulator-strategy indexed
162
162
  ```
163
163
 
164
164
  The graph contains exactly **1,000 nodes**: 100 daily scalar counters (`prev` + 1,
@@ -189,8 +189,8 @@ measured run exercises incremental transitions rather than first-use bootstrap.
189
189
 
190
190
  ```sh
191
191
  yarn cobolts benchmark init graph-1000-aggregates -n 10000
192
- yarn cobolts benchmark run graph-1000-aggregates -n 10000 --runs 5 --periodicity daily --accumulator-strategy indexed
193
- yarn cobolts benchmark run graph-1000-aggregates -n 10000 --runs 5 --periodicity monthly --accumulator-strategy indexed
192
+ yarn cobolts benchmark run graph-1000-aggregates -n 10000 --runs 5 --composition benchmark --accumulator-strategy indexed
193
+ yarn cobolts benchmark run graph-1000-aggregates -n 10000 --runs 5 --composition monthly --accumulator-strategy indexed
194
194
  ```
195
195
 
196
196
  Every pass reloads the same committed fixture; daily and monthly numbers should
package/README.cel.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # CEL dependency graph commands
2
2
 
3
- The normal CLI execution path uses a composition in `.cobolts/files.yaml`.
3
+ The normal CLI execution path explicitly selects a named **relational**
4
+ composition in `.cobolts/files.yaml` with `--composition <name>`. There is no
5
+ default composition; `validationDataSet` is not executable by this relational
6
+ CEL command. `display <logical-name>` inspects a physical file and does **not**
7
+ accept `--composition`.
4
8
  A composition may contain just one physical file. Every source declares its
5
9
  entity key with `key` and `keyPath`; the master determines the entity selected
6
10
  by `cel evaluate`. Encoding and framing are properties of each COBOL source.
@@ -9,13 +13,16 @@ Neither `generation.yaml` nor generated TypeScript is required for CEL execution
9
13
  From the monorepo root:
10
14
 
11
15
  ```powershell
12
- yarn cobolts -d modules/examples/example/definitions cel graph --short
13
- yarn cobolts -d modules/examples/example/definitions cel canonical --short
14
- yarn cobolts -d modules/examples/example/definitions cel sorted --short
15
- yarn cobolts -d modules/examples/example/definitions cel planned --short
16
- yarn cobolts -d modules/examples/example/definitions cel validate
17
- yarn cobolts -d modules/examples/example/definitions cel execute --count 1 --raw
18
- yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --debug
16
+ yarn cobolts -d modules/examples/example/definitions config compositions
17
+ yarn cobolts -d modules/examples/example/definitions cel graph --short --composition productionDaily
18
+ yarn cobolts -d modules/examples/example/definitions cel canonical --short --composition productionDaily
19
+ yarn cobolts -d modules/examples/example/definitions cel sorted --short --composition productionDaily
20
+ yarn cobolts -d modules/examples/example/definitions cel planned --short --composition productionDaily
21
+ yarn cobolts -d modules/examples/example/definitions cel validate --composition productionDaily
22
+ yarn cobolts -d modules/examples/example/definitions cel execute --count 1 --raw --composition productionDaily
23
+ yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --composition productionDaily --debug
24
+ # Select the monthly production composition to advance monthly windows.
25
+ yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --composition productionMonthly --debug
19
26
  ```
20
27
 
21
28
  Each of the four graph inspection stages accepts `--graph <filename>` and
@@ -26,8 +33,9 @@ shows each node and its dependencies (the planned form shows numeric downstream
26
33
  references). Inspection does not scan data records.
27
34
 
28
35
  `cel validate` checks graph structure and the configured compiled accessors.
29
- For a composed project, it uses all source projections; for a legacy single-file
30
- project, `cel validate [logical-name]` selects one input. `cel execute` writes
36
+ For a composed project, `cel validate --composition <name>` uses that
37
+ composition's projections. The optional `cel validate [logical-name]` is the
38
+ separate single-physical-file mode. `cel execute` writes
31
39
  one accumulator JSON object per processed entity. `--count N`, `--all`,
32
40
  `--skip N`, `--raw` and `--graph` are available; `--input` selects a physical
33
41
  file only in the single-file mode. `cel evaluate <entity-id> [logical-name]`
@@ -74,7 +82,7 @@ Authored YAML → canonical dependencies and mustBeBefore constraints
74
82
 
75
83
  An error in a composed file should report the logical/physical file, record,
76
84
  field, and decoder problem. The default execution error policy is `throw`.
77
- `--on-error continue` is supported only in the legacy single-file mode;
85
+ `--on-error continue` is supported only in single-file mode;
78
86
  composed execution rejects it until accumulator rollback is available.
79
87
 
80
88
  ## Accumulator configuration
@@ -0,0 +1,105 @@
1
+ # COBOL-TS crypto CLI
2
+
3
+ This is a **standalone local encryption/decryption utility**, independent of the production oracle importer and the validation compactor. It works on an individual file, a directory or a `.zip` delivery, encrypting every original file under its own content key. No `files.yaml` or composition selection is required.
4
+
5
+ ## Initial configuration
6
+
7
+ From the repository root, use the checked-in example file at:
8
+
9
+ `modules/examples/example/definitions/.cobolts/crypto.yaml`
10
+
11
+ ```yaml
12
+ version: 1
13
+ storage:
14
+ type: filesystem
15
+ root: ../encrypted
16
+ security:
17
+ fileKeys:
18
+ strategy: local-sealed-box
19
+ recipientKeyId: local-dev-recipient
20
+ publicKeyFile: ../dev-keys/recipient.pub
21
+ privateKeyFile: ../dev-keys/recipient.key
22
+ signer:
23
+ strategy: local-ed25519
24
+ keyId: local-dev-publisher
25
+ privateKeyFile: ../dev-keys/publisher.key
26
+ trustedPublicKeyFile: ../dev-keys/publisher.pub
27
+ ```
28
+
29
+ All paths in this file resolve relative to the **discovered `.cobolts` directory**. Filesystem storage, local X25519 recipient-key wrapping and Ed25519 signing are the supported initial adapters. The generated `dev-keys` and `encrypted` directories are gitignored. Install the declared `@cobol-ts/crypto-packager` dependencies (`libsodium-wrappers-sumo`, `yauzl`, `yazl`) before running.
30
+
31
+ ## Commands
32
+
33
+ ```powershell
34
+ # One-time local key generation (refuses to overwrite keys)
35
+ yarn cobolts -d modules/examples/example/definitions crypto keys generate
36
+
37
+ # Inspect both public keys and their SHA-256 fingerprints
38
+ yarn cobolts -d modules/examples/example/definitions crypto keys show --kind recipient
39
+ yarn cobolts -d modules/examples/example/definitions crypto keys show --kind signer
40
+
41
+ # Standalone file, .zip or directory input is detected automatically
42
+ yarn cobolts -d modules/examples/example/definitions crypto pack --source source.csv --package one-file
43
+ yarn cobolts -d modules/examples/example/definitions crypto pack --source modules/examples/example/definitions/data --package example-data
44
+ yarn cobolts -d modules/examples/example/definitions crypto pack --source incoming/daily.zip --package example-zip
45
+
46
+ # Signed package inventory and cryptographic metadata
47
+ yarn cobolts -d modules/examples/example/definitions crypto list --package example-data
48
+ yarn cobolts -d modules/examples/example/definitions crypto inspect --package example-data
49
+ yarn cobolts -d modules/examples/example/definitions crypto inspect --package example-data --file customers.fb --show-key
50
+
51
+ # Show only the specific file's 256-bit content key as 64 hex characters
52
+ yarn cobolts -d modules/examples/example/definitions crypto key --package example-data --file customers.fb
53
+
54
+ # Byte-exact decryption: stdout defaults to raw bytes (CSV is readable, COBOL may not be)
55
+ yarn cobolts -d modules/examples/example/definitions crypto view --package example-data --file customers.fb --output recovered.fb
56
+
57
+ # Explicit content-key override; --key-file avoids exposing it in process arguments
58
+ yarn cobolts -d modules/examples/example/definitions crypto view --package example-data --file customers.fb --key-file content-key.hex --output recovered-with-key.fb
59
+
60
+ # Authenticate every file, then restore every original file
61
+ yarn cobolts -d modules/examples/example/definitions crypto verify --package example-data
62
+ yarn cobolts -d modules/examples/example/definitions crypto unpack --package example-data --output recovered-directory
63
+ ```
64
+
65
+ The package root comes from `crypto.yaml`, so a package named `example-data` is stored under that root. `crypto` also accepts `--config some-crypto.yaml` to select another configuration relative to `.cobolts`.
66
+
67
+ `inspect` displays the signed metadata plus configured recipient public key, recipient fingerprint and signing public key. It does **not** mean that all ciphertexts have been decrypted; use `verify` to authenticate and validate all the streams. `inspect --show-key` and `key` explicitly recover a **content** key and do not disclose a recipient private key or HSM master key. `--key-hex` accepts exactly 64 hexadecimal characters, and `--key-file` reads that same format. Explicit keys override key recovery, **not** signature verification or authenticated decryption. Public-key metadata is read from trusted local configuration, not trusted because a manifest claims it.
68
+
69
+ `view` writes raw file bytes to stdout when `--output` is absent; there are no progress messages on stdout. With `--output`, the file is staged and only appears after successful verification. Existing target paths are not overwritten. `unpack` similarly requires a new output directory. A package ID is published only after its detached manifest signature exists; repeat packaging under a published ID is rejected.
70
+
71
+ ## Smoke test using the checked-in example (Windows PowerShell)
72
+
73
+ Run these commands **from the repository root**, after installing/building the newly added `@cobol-ts/crypto-packager` workspace package and its `libsodium-wrappers-sumo`, `yauzl` and `yazl` dependencies. `$demo/data` contains two real fixed-length EBCDIC COBOL files. Generate keys **once**; skip key generation if the four configured key files already exist.
74
+
75
+ ```powershell
76
+ $demo = 'modules/examples/example/definitions'
77
+ yarn cobolts -d $demo crypto keys generate
78
+ yarn cobolts -d $demo crypto keys show --kind recipient
79
+ yarn cobolts -d $demo crypto keys show --kind signer
80
+
81
+ yarn cobolts -d $demo crypto pack --source "$demo/data" --package smoke-crypto-01
82
+ yarn cobolts -d $demo crypto list --package smoke-crypto-01
83
+ yarn cobolts -d $demo crypto inspect --package smoke-crypto-01 --file customers.fb --show-key
84
+ yarn cobolts -d $demo crypto verify --package smoke-crypto-01
85
+ yarn cobolts -d $demo crypto view --package smoke-crypto-01 --file customers.fb --output recovered-crypto.fb
86
+ fc.exe /b "$demo/data/customers.fb" recovered-crypto.fb
87
+ ```
88
+
89
+ The last command must report **no differences**. The package will be under `modules/examples/example/definitions/encrypted/smoke-crypto-01`, because `crypto.yaml` resolves `../encrypted` relative to `.cobolts`. A second run must use a new package ID and a new output filename, or remove your disposable smoke-test artefacts first. A `crypto view` without `--output` emits binary EBCDIC for `.fb` files; use `--output` for those.
90
+
91
+ To exercise **single-file** packaging and readable text independently, create a small CSV and package it:
92
+
93
+ ```powershell
94
+ @('customerId,value', '1001,42') | Set-Content -Encoding ascii smoke.csv
95
+ yarn cobolts -d $demo crypto pack --source smoke.csv --package smoke-csv-01
96
+ yarn cobolts -d $demo crypto view --package smoke-csv-01 --file smoke.csv
97
+ ```
98
+
99
+ Expected stdout for the last command is the two CSV rows, without a CLI header. This command does not use a named composition. To test repository placement and relational-file requirements, follow [README.oracle.md](README.oracle.md).
100
+
101
+ ## Automated tests
102
+
103
+ The crypto-packager tests exercise round-trip binary and multiline CSV files, per-file keys, content-key override, signature-last publication and corrupted ciphertext failure. The library's identity tests lock down canonical AAD and HSM context encoding. A clean monorepo dependency installation is required to run the full Jest suite.
104
+
105
+ For repository-aware imports by composition and actual execution date, see [README.oracle.md](README.oracle.md). The `crypto` commands do not know about logical source relationships. A failed package write removes its incomplete objects; a published package is not overwritten by a second `crypto pack`.
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Commander-based CLI for inspecting configured files and input/output characteristic metadata, extracting Excel characteristics, serving read-only characteristic APIs, generating TypeScript contracts, displaying physical data, and compiling or executing CEL dependency graphs, and generating AI-assisted graph experiments. Code generation uses `@cobol-ts/codegen`; neither `display` nor `cel execute` requires or executes generated TypeScript.
4
4
 
5
+ ## Local cryptographic packaging
6
+
7
+ The standalone `cobolts crypto` commands package ZIP or directory inputs, inspect public keys and signed metadata, reveal an individual file content key, verify/decrypt streams, and restore exact original bytes. See [README.crypto.md](README.crypto.md) for configuration, commands and security boundaries. This does not require a named composition.
8
+
5
9
  ## Quick orientation
6
10
 
7
11
  **In this README:** [Layout](#layout) · [Excel → AI experiment → graph walkthrough](#excel--ai-experiment--graph-walkthrough) · [Commands](#commands) · [Characteristic metadata repository](#characteristic-metadata-repository) · [Characteristic metadata HTTP API](#characteristic-metadata-http-api) · [Display data (no generated TypeScript)](#display-data-no-generated-typescript) · [CEL dependency graphs](#cel-dependency-graphs) · [Benchmark allocation diagnostics](#benchmark-allocation-diagnostics)
@@ -166,7 +170,7 @@ yarn cobolts -d modules/examples/example/definitions graph build experiments.yam
166
170
  yarn cobolts -d modules/examples/example/definitions graph build experiments.yaml --with modules/examples/example/definitions/.cobolts/graph.yaml --file modules/examples/example/definitions/.cobolts/combined-graph.yaml
167
171
 
168
172
  # Check the assembled authoring graph before execution
169
- yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel validate --graph generated-graph.yaml
173
+ yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel validate --graph generated-graph.yaml --composition productionDaily
170
174
  ```
171
175
 
172
176
  `graph build` accepts a version-1 experiment dossier and optional existing
@@ -200,7 +204,7 @@ window names, and seeds `C7240` with the previous customer lifetime volume. For
200
204
  an eventual evaluation, select the matching seed using the **root-level** option:
201
205
 
202
206
  ```powershell
203
- yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel evaluate 1001 --graph generated-graph.yaml --periodicity monthly
207
+ yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel evaluate 1001 --graph generated-graph.yaml --composition productionMonthly
204
208
  ```
205
209
 
206
210
  The customer order-count field is already in the example projection. Do not
@@ -210,7 +214,8 @@ across different output characteristics; graph deduplication comes later.
210
214
 
211
215
  Input `I7000` now describes the existing `input.customers.orderCount` physical
212
216
  projection. Its six monthly seed values are synthetic demonstration history;
213
- advancing `--periodicity monthly` inserts the current record's `orderCount`.
217
+ selecting `--composition productionMonthly` advances the monthly windows and
218
+ inserts the current record's `orderCount`.
214
219
  See the [example `.cobolts` walkthrough](../../examples/example/definitions/.cobolts/README.md)
215
220
  for complete executable commands and the required spreadsheet rows.
216
221
 
@@ -245,7 +250,7 @@ Source filenames are relative to `files.root`; generated filenames are relative
245
250
 
246
251
  ## Commands
247
252
 
248
- The normal execution model is a composition declared in `.cobolts/files.yaml`. A composition may contain only one physical source. Entity keys are declared with `key` and `keyPath` on its source; do not assume a `customerId` field exists in arbitrary input files. `generation.yaml` is needed for code generation, not CEL execution or workspace validation.
253
+ The normal execution model is an explicitly selected named composition declared under `compositions` in `.cobolts/files.yaml`. Singular `composition:` declarations are invalid in files.yaml. All benchmark generators and test fixtures use named `compositions:`. A composition may contain only one physical source. Entity keys are declared with `key` and `keyPath` on its source; do not assume a `customerId` field exists in arbitrary input files. `generation.yaml` is needed for code generation, not CEL execution or workspace validation.
249
254
 
250
255
  From the repository root (PowerShell):
251
256
 
@@ -255,38 +260,41 @@ yarn cobolts -d benchmarks validate all
255
260
  yarn cobolts -d modules/examples validate all
256
261
 
257
262
  # Inspect the authoring-to-planned pipeline
258
- yarn cobolts -d benchmarks/graph-10 cel graph --short
259
- yarn cobolts -d benchmarks/graph-10 cel canonical --short
260
- yarn cobolts -d benchmarks/graph-10 cel sorted --short
261
- yarn cobolts -d benchmarks/graph-10 cel planned --short
263
+ yarn cobolts -d benchmarks/graph-10 cel graph --short --composition benchmark
264
+ yarn cobolts -d benchmarks/graph-10 cel canonical --short --composition benchmark
265
+ yarn cobolts -d benchmarks/graph-10 cel sorted --short --composition benchmark
266
+ yarn cobolts -d benchmarks/graph-10 cel planned --short --composition benchmark
262
267
 
263
268
  # Validate and execute a composed project
264
- yarn cobolts -d benchmarks/baseline cel validate
265
- yarn cobolts -d benchmarks/baseline cel execute --count 1 --raw
266
- yarn cobolts -d benchmarks/baseline cel evaluate 1 --debug
269
+ yarn cobolts -d benchmarks/baseline cel validate --composition benchmark
270
+ yarn cobolts -d benchmarks/baseline cel execute --composition benchmark --count 1 --raw
271
+ yarn cobolts -d benchmarks/baseline cel evaluate 1 --composition benchmark --debug
267
272
 
268
273
  # Execute the two-file EBCDIC example
269
- yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --debug
274
+ yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --composition productionDaily --debug
275
+ # Use the same default graph/accumulator with monthly event periodicity:
276
+ yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --composition productionMonthly --debug
270
277
  ```
271
278
 
272
279
  Commands (`[ ]` marks optional arguments):
273
280
 
274
281
  ```text
275
- cobolts config files|list|names|view|validate
282
+ cobolts config files|list|names|view|validate|compositions
276
283
  cobolts generate all|copybook|projectionDefn|projection [logical-name]
277
284
  cobolts display <logical-name> [--count N | --all] [--skip N] [--raw] [--input file]
278
285
  cobolts graph build <experiments.yaml> [--with existing-graph.yaml] [--file graph.yaml] [--report] [--detailed]
279
- cobolts cel graph|canonical|sorted|planned [--graph file] [--short]
280
- cobolts cel validate [logical-name] [--graph file]
281
- cobolts cel execute [logical-name] [--count N | --all] [--skip N] [--raw] [--on-error throw|continue]
282
- cobolts cel evaluate <entity-id> [logical-name] [--debug] [--debug-node name]
286
+ cobolts cel graph|canonical|sorted|planned [--graph file] [--composition name] [--short]
287
+ cobolts cel validate [logical-name] [--graph file] [--composition name]
288
+ cobolts cel execute [logical-name] [--graph file] [--composition name] [--count N | --all] [--skip N] [--raw] [--on-error throw|continue]
289
+ cobolts cel evaluate <entity-id> [logical-name] [--graph file] [--composition name] [--debug] [--debug-node name]
283
290
  cobolts validate all
284
291
  cobolts ai prompt|exchange|response <output-id>
285
292
  cobolts ai do <output-id> [--file file]
286
293
  cobolts ai all [--file file]
287
294
  ```
288
295
 
289
- For composed projects, omit `[logical-name]` and the CLI uses `files.yaml` composition. The optional logical-name form supports the legacy single-file route. `--on-error continue` is **not supported for composed execution** until rollback semantics are implemented; `throw` remains the default. `cel evaluate` selects the configured entity key, whereas `cel execute --count 1` executes the first available record.
296
+ `display` reads one physical file, with no composition option. For composed CEL
297
+ projects, supply `--composition <name>` and omit `[logical-name]`; the CLI resolves that named entry from `files.yaml`. A `validationDataSet` entry requires the encrypted manifest loader and cannot be executed by the relational CEL command. The optional logical-name form supports the legacy single-file route. `--on-error continue` is **not supported for composed execution** until rollback semantics are implemented; `throw` remains the default. `cel evaluate` selects the configured entity key, whereas `cel execute --count 1` executes the first available record.
290
298
 
291
299
  Benchmark projects use `yarn cobolts benchmark list` to enumerate all 21 registered fixtures, and `yarn cobolts benchmark init all --force` to regenerate them, including `graph-1000-periodic`. Generated accumulator files explicitly select safe-integer numeric customer IDs; see [README.benchmark.md](README.benchmark.md).
292
300
 
@@ -342,7 +350,7 @@ Node command or dependency is required:
342
350
 
343
351
  ```powershell
344
352
  # Capture a V8 allocation-sampling profile of the first measured CEL pass.
345
- yarn cobolts benchmark run graph-1000-chain -n 10000 --allocation-profile
353
+ yarn cobolts benchmark run graph-1000-chain -n 10000 --allocation-profile --composition benchmark
346
354
 
347
355
  # Summarise the profile under benchmarks/graph-1000-chain/cel.heapprofile.
348
356
  yarn cobolts benchmark allocations graph-1000-chain --top 30
@@ -517,3 +525,7 @@ cobolts -d modules/examples/example/definitions characteristics serve --port 300
517
525
  `GET http://127.0.0.1:3000/api/characteristics/C0010` returns one characteristic, or a JSON 404 when absent.
518
526
 
519
527
  The CLI `characteristics list` and `characteristics show` use the same internal `CharacteristicQueries` port. The server deliberately binds only to `127.0.0.1` and has no authentication; do not expose it to other machines. Restart it to load edited source YAML files.
528
+
529
+ ## Encrypted production oracle repository
530
+
531
+ Use `cobolts oracle import --composition productionDaily --date YYYY-MM-DD --source <file-or-directory-or-zip>` to validate and archive an observed production execution, then `oracle list`, `verify`, `inspect`, `view`, `key` or `unpack` to recover it. Configuration is in `.cobolts/oracle.yaml`, which refers to `crypto.yaml`. See [README.oracle.md](README.oracle.md) for a **working smoke test using checked-in COBOL files**, required filename mapping, and exact commands.
@@ -0,0 +1,110 @@
1
+ # Production oracle repository CLI
2
+
3
+ `oracle` is a repository-aware adapter over `@cobol-ts/crypto-packager`. It imports one observed production execution, identified by **explicit named relational composition** and **actual execution date**, into its canonical `{composition}/{date}` directory. The single `validationDataSet` composition is not an import target. It does not compact the original files or calculate characteristics.
4
+
5
+ ## Configuration
6
+
7
+ `.cobolts/oracle.yaml`:
8
+
9
+ ```yaml
10
+ version: 1
11
+ cryptoConfig: crypto.yaml
12
+ repository:
13
+ type: filesystem
14
+ root: ../oracle
15
+ ```
16
+
17
+ The root and `cryptoConfig` paths resolve against the discovered `.cobolts` directory. `oracle.yaml` controls only the repository destination; `crypto.yaml` supplies the local sealed-box recipient, Ed25519 signing keys and shared authenticated streaming format. It does not duplicate `files.yaml` readers or relations. A Google storage/key provider can replace local adapters in a later phase without changing import logic.
18
+
19
+ The `productionDaily` and `productionMonthly` definitions in `files.yaml` identify required input files, their copybooks/projections and key ordering. The loader demands those original files with names made from the logical name plus physical extension (`customers.fb`, `customerPreferences.fb`, etc.). Extra CSV/JSONL reference-result files such as `oracleDaily.jsonl` are accepted as raw original files and do not need redundant catalogue entries; their precise required naming/completeness policy is not yet configurable. All source files are archived byte-exact and individually encrypted. Nested paths in production deliveries are rejected.
20
+
21
+ ## Commands
22
+
23
+ From the monorepo root:
24
+
25
+ ```powershell
26
+ # Create local dev keys if not already created for crypto.yaml
27
+ # yarn cobolts -d modules/examples/example/definitions crypto keys generate
28
+
29
+ # Import a directory or ZIP containing the required files for that composition
30
+ # (the ZIP basename is not used to infer composition or execution date)
31
+ yarn cobolts -d modules/examples/example/definitions oracle import --composition productionDaily --date 2026-05-31 --source ../incoming/daily.zip
32
+
33
+ # Replace an already published run (the old signature is invalidated first)
34
+ yarn cobolts -d modules/examples/example/definitions oracle import --composition productionDaily --date 2026-05-31 --source ../incoming/corrected.zip --force
35
+
36
+ # Discover complete, signed production runs
37
+ yarn cobolts -d modules/examples/example/definitions oracle list
38
+
39
+ # Check every encrypted source and detached signature
40
+ yarn cobolts -d modules/examples/example/definitions oracle verify --composition productionDaily --date 2026-05-31
41
+
42
+ # Inspect public metadata and the signed inventory
43
+ yarn cobolts -d modules/examples/example/definitions oracle inspect --composition productionDaily --date 2026-05-31
44
+
45
+ # Explicitly show one 256-bit content key (NEVER a parent/private key)
46
+ yarn cobolts -d modules/examples/example/definitions oracle key --composition productionDaily --date 2026-05-31 --file customers.fb
47
+
48
+ # Restore one file, optionally selecting the content key from --key-file or --key-hex
49
+ yarn cobolts -d modules/examples/example/definitions oracle view --composition productionDaily --date 2026-05-31 --file customers.fb --output recovered.fb
50
+
51
+ # Omit --output to emit the exact original bytes to stdout, without log messages
52
+ yarn cobolts -d modules/examples/example/definitions oracle view --composition productionDaily --date 2026-05-31 --file oracleDaily.jsonl
53
+
54
+ # Recover the entire run into a previously nonexistent directory
55
+ yarn cobolts -d modules/examples/example/definitions oracle unpack --composition productionDaily --date 2026-05-31 --output recovered-daily
56
+ ```
57
+
58
+ ## Executable smoke tests with the checked-in files (Windows PowerShell)
59
+
60
+ The `../incoming/daily.zip` examples above are **illustrative**; that ZIP is not checked in. The demo *does* contain `customers.fb` and `customer-preferences.fb` in `modules/examples/example/definitions/data`. The importer derives the required filename from the logical name in `files.yaml`, so it requires **`customerPreferences.fb`**, not the existing `customer-preferences.fb` name used by `data.yaml`. Stage a separate delivery and rename that file in the copy; do not rename the original example data, because `data.yaml` still references it.
61
+
62
+ First check the **single-file monthly** path, requiring only `customers.fb`. Generate the crypto keys once using `crypto keys generate` if they do not already exist (see [README.crypto.md](README.crypto.md)). Run all commands from the repository root:
63
+
64
+ ```powershell
65
+ $demo = 'modules/examples/example/definitions'
66
+ yarn cobolts -d $demo oracle import --composition productionMonthly --date 2026-05-31 --source "$demo/data/customers.fb"
67
+ yarn cobolts -d $demo oracle list
68
+ yarn cobolts -d $demo oracle verify --composition productionMonthly --date 2026-05-31
69
+ yarn cobolts -d $demo oracle inspect --composition productionMonthly --date 2026-05-31 --file customers.fb --show-key
70
+ yarn cobolts -d $demo oracle view --composition productionMonthly --date 2026-05-31 --file customers.fb --output recovered-monthly.fb
71
+ fc.exe /b "$demo/data/customers.fb" recovered-monthly.fb
72
+ ```
73
+
74
+ The list should contain `productionMonthly/2026-05-31`, and `fc.exe` should report **no differences**. The repository package is stored at `modules/examples/example/definitions/oracle/productionMonthly/2026-05-31`.
75
+
76
+ Then check the **directory-based daily** path, including an optional published CSV/JSONL result stream:
77
+
78
+ ```powershell
79
+ New-Item -ItemType Directory -Force -Path smoke-daily | Out-Null
80
+ Copy-Item "$demo/data/customers.fb" smoke-daily/customers.fb
81
+ Copy-Item "$demo/data/customer-preferences.fb" smoke-daily/customerPreferences.fb
82
+ @('{"customerId":"00001001","result":42}') | Set-Content -Encoding ascii smoke-daily/oracleDaily.jsonl
83
+
84
+ yarn cobolts -d $demo oracle import --composition productionDaily --date 2026-06-01 --source smoke-daily
85
+ yarn cobolts -d $demo oracle list
86
+ yarn cobolts -d $demo oracle verify --composition productionDaily --date 2026-06-01
87
+ yarn cobolts -d $demo oracle view --composition productionDaily --date 2026-06-01 --file oracleDaily.jsonl --output recovered-oracle.jsonl
88
+ Get-Content recovered-oracle.jsonl
89
+ fc.exe /b smoke-daily/oracleDaily.jsonl recovered-oracle.jsonl
90
+ ```
91
+
92
+ The resulting package is under `modules/examples/example/definitions/oracle/productionDaily/2026-06-01`. This demonstrates **original bytes preserved**, including the optional result stream. To check the **ZIP import** path, compress the *contents* of `smoke-daily` (not its parent folder), and import under another execution date:
93
+
94
+ ```powershell
95
+ Compress-Archive -Path smoke-daily/* -DestinationPath smoke-daily.zip
96
+ yarn cobolts -d $demo oracle import --composition productionDaily --date 2026-06-02 --source smoke-daily.zip
97
+ yarn cobolts -d $demo oracle verify --composition productionDaily --date 2026-06-02
98
+ ```
99
+
100
+ Importing the same composition/date again must fail unless `--force` is specified. **`--force` deletes and replaces that complete run**, so use it only on disposable test runs. `oracle list` displays published signed packages; it is not a substitute for `oracle verify`, which decrypts and validates all files. Each `view --output` requires a previously nonexistent output filename.
101
+
102
+ ## Publication and verification
103
+
104
+ 1. Resolve the named relational composition, validate the execution date, read its required physical sources and validate their framing and nondecreasing original customer key using the existing typed COBOL/CSV/JSONL readers.
105
+ 2. Reject missing required inputs and unknown binary files. Accept additional CSV/JSONL reference-result files without a secondary catalogue. For ordinary directories and individual files, validation reads the original paths and packaging streams them again without copying them to scratch. ZIP deliveries are extracted into a private temporary directory to permit validation and re-reading without buffering the entire archive in memory.
106
+ 3. Invoke `CryptoPackager.publish(id, files, 'production')`. Each file receives a separate 256-bit content key, compressed single-entry ZIP and authenticated secretstream. The signed package includes the correct production identity, stream header, key-recovery metadata, SHA-256 and detached Ed25519 signature.
107
+ 4. Readers require independently trusted signing keys. An interrupted write cleans up the incomplete package; the final signature is the usability marker. `--force` validates the incoming delivery first, invalidates the existing signature and fully replaces the package.
108
+ 5. `view`/`unpack` stage results and publish only after authenticated decryption, final marker, ciphertext hash, ZIP member/framing and CRC checks. `verify` checks every file. An explicit content key bypasses key recovery, not decryption authentication or signature validation.
109
+
110
+ **Current deployment boundary:** Local filesystem and libsodium are supported. As in the crypto layer, ZIP decryption and input validation use private local scratch space. Do not assume local scratch and replacement concurrency controls satisfy a production bank policy. The exact required inventory of undeclared reference-result files and Google KMS/GCS adapters remain future work. No CLI here asserts that the validation dataset loader/compactor exists.