@cobol-ts/cobolts 0.0.18 → 0.0.20

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 (127) 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 +103 -30
  5. package/README.oracle.md +110 -0
  6. package/README.periodic-verification.md +84 -83
  7. package/build/gui/assets/index-AxtZbbsk.js +71 -0
  8. package/build/gui/assets/index-DUqGF627.css +1 -0
  9. package/build/gui/index.html +13 -0
  10. package/dist/src/benchmark.aggregate.fixture.spec.js +2 -2
  11. package/dist/src/benchmark.aggregate.fixture.spec.js.map +1 -1
  12. package/dist/src/benchmark.cli.functional.spec.js +15 -5
  13. package/dist/src/benchmark.cli.functional.spec.js.map +1 -1
  14. package/dist/src/benchmark.cli.golden.spec.js +6 -4
  15. package/dist/src/benchmark.cli.golden.spec.js.map +1 -1
  16. package/dist/src/benchmark.composed.execution.spec.js +1 -1
  17. package/dist/src/benchmark.composed.execution.spec.js.map +1 -1
  18. package/dist/src/benchmark.composed.fixture.js +2 -2
  19. package/dist/src/benchmark.composed.fixture.js.map +1 -1
  20. package/dist/src/benchmark.composed.fixture.spec.js +3 -1
  21. package/dist/src/benchmark.composed.fixture.spec.js.map +1 -1
  22. package/dist/src/benchmark.composed.runner.js +14 -4
  23. package/dist/src/benchmark.composed.runner.js.map +1 -1
  24. package/dist/src/benchmark.composed.two.fixture.js +9 -5
  25. package/dist/src/benchmark.composed.two.fixture.js.map +1 -1
  26. package/dist/src/benchmark.composed.two.spec.js +3 -1
  27. package/dist/src/benchmark.composed.two.spec.js.map +1 -1
  28. package/dist/src/benchmark.format.composition.spec.js +16 -11
  29. package/dist/src/benchmark.format.composition.spec.js.map +1 -1
  30. package/dist/src/benchmark.format.fixture.js +2 -2
  31. package/dist/src/benchmark.format.fixture.js.map +1 -1
  32. package/dist/src/benchmark.format.runner.js +2 -2
  33. package/dist/src/benchmark.format.runner.js.map +1 -1
  34. package/dist/src/benchmark.format.spec.js +1 -1
  35. package/dist/src/benchmark.format.spec.js.map +1 -1
  36. package/dist/src/benchmark.periodic.execution.spec.js +6 -6
  37. package/dist/src/benchmark.periodic.execution.spec.js.map +1 -1
  38. package/dist/src/benchmark.runner.d.ts +2 -1
  39. package/dist/src/benchmark.runner.js +10 -2
  40. package/dist/src/benchmark.runner.js.map +1 -1
  41. package/dist/src/benchmark.runner.spec.js +10 -4
  42. package/dist/src/benchmark.runner.spec.js.map +1 -1
  43. package/dist/src/benchmark.strategy.spec.js +3 -1
  44. package/dist/src/benchmark.strategy.spec.js.map +1 -1
  45. package/dist/src/cel.composition.integration.spec.js +15 -12
  46. package/dist/src/cel.composition.integration.spec.js.map +1 -1
  47. package/dist/src/cel.evaluate.integration.spec.js +18 -15
  48. package/dist/src/cel.evaluate.integration.spec.js.map +1 -1
  49. package/dist/src/cel.shared.execution.d.ts +3 -3
  50. package/dist/src/cel.shared.execution.js +4 -4
  51. package/dist/src/cel.shared.execution.js.map +1 -1
  52. package/dist/src/cli.integration.spec.js +5 -5
  53. package/dist/src/cli.integration.spec.js.map +1 -1
  54. package/dist/src/cli.js +7 -0
  55. package/dist/src/cli.js.map +1 -1
  56. package/dist/src/cli.spec.js +18 -0
  57. package/dist/src/cli.spec.js.map +1 -1
  58. package/dist/src/commands/ai.demo.spec.js +30 -6
  59. package/dist/src/commands/ai.demo.spec.js.map +1 -1
  60. package/dist/src/commands/ai.spec.js +16 -5
  61. package/dist/src/commands/ai.spec.js.map +1 -1
  62. package/dist/src/commands/benchmark.js +3 -4
  63. package/dist/src/commands/benchmark.js.map +1 -1
  64. package/dist/src/commands/cel.js +10 -4
  65. package/dist/src/commands/cel.js.map +1 -1
  66. package/dist/src/commands/characteristics.d.ts +1 -0
  67. package/dist/src/commands/characteristics.js +77 -25
  68. package/dist/src/commands/characteristics.js.map +1 -1
  69. package/dist/src/commands/characteristics.spec.js +129 -56
  70. package/dist/src/commands/characteristics.spec.js.map +1 -1
  71. package/dist/src/commands/config.compositions.d.ts +4 -0
  72. package/dist/src/commands/config.compositions.js +15 -0
  73. package/dist/src/commands/config.compositions.js.map +1 -0
  74. package/dist/src/commands/config.validate.js +1 -0
  75. package/dist/src/commands/config.validate.js.map +1 -1
  76. package/dist/src/commands/crypto.d.ts +41 -0
  77. package/dist/src/commands/crypto.js +196 -0
  78. package/dist/src/commands/crypto.js.map +1 -0
  79. package/dist/src/commands/crypto.spec.d.ts +1 -0
  80. package/dist/src/commands/crypto.spec.js +32 -0
  81. package/dist/src/commands/crypto.spec.js.map +1 -0
  82. package/dist/src/commands/extract.d.ts +4 -1
  83. package/dist/src/commands/extract.js +23 -6
  84. package/dist/src/commands/extract.js.map +1 -1
  85. package/dist/src/commands/extract.spec.js +88 -1
  86. package/dist/src/commands/extract.spec.js.map +1 -1
  87. package/dist/src/commands/graph.spec.js +10 -2
  88. package/dist/src/commands/graph.spec.js.map +1 -1
  89. package/dist/src/commands/oracle.d.ts +3 -0
  90. package/dist/src/commands/oracle.js +96 -0
  91. package/dist/src/commands/oracle.js.map +1 -0
  92. package/dist/src/commands/validate.all.js +12 -3
  93. package/dist/src/commands/validate.all.js.map +1 -1
  94. package/dist/src/commands/validate.all.spec.js +22 -0
  95. package/dist/src/commands/validate.all.spec.js.map +1 -1
  96. package/dist/src/composition.data.d.ts +10 -0
  97. package/dist/src/composition.data.js +133 -0
  98. package/dist/src/composition.data.js.map +1 -0
  99. package/dist/src/composition.data.spec.d.ts +1 -0
  100. package/dist/src/composition.data.spec.js +80 -0
  101. package/dist/src/composition.data.spec.js.map +1 -0
  102. package/dist/src/composition.run.d.ts +5 -0
  103. package/dist/src/composition.run.integration.spec.d.ts +1 -0
  104. package/dist/src/composition.run.integration.spec.js +32 -0
  105. package/dist/src/composition.run.integration.spec.js.map +1 -0
  106. package/dist/src/composition.run.js +32 -0
  107. package/dist/src/composition.run.js.map +1 -0
  108. package/dist/src/composition.run.spec.d.ts +1 -0
  109. package/dist/src/composition.run.spec.js +71 -0
  110. package/dist/src/composition.run.spec.js.map +1 -0
  111. package/dist/src/context.d.ts +18 -2
  112. package/dist/src/context.js +96 -12
  113. package/dist/src/context.js.map +1 -1
  114. package/dist/src/gui.assets.d.ts +11 -0
  115. package/dist/src/gui.assets.js +68 -0
  116. package/dist/src/gui.assets.js.map +1 -0
  117. package/dist/src/gui.assets.spec.d.ts +1 -0
  118. package/dist/src/gui.assets.spec.js +94 -0
  119. package/dist/src/gui.assets.spec.js.map +1 -0
  120. package/dist/src/oracle.repository.d.ts +28 -0
  121. package/dist/src/oracle.repository.js +205 -0
  122. package/dist/src/oracle.repository.js.map +1 -0
  123. package/dist/src/oracle.repository.spec.d.ts +1 -0
  124. package/dist/src/oracle.repository.spec.js +118 -0
  125. package/dist/src/oracle.repository.spec.js.map +1 -0
  126. package/index.ts +2 -0
  127. package/package.json +35 -28
@@ -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
@@ -1,6 +1,10 @@
1
1
  # @cobol-ts/cobolts
2
2
 
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.
3
+ Commander-based CLI for inspecting configured files and input/output characteristic metadata, extracting Excel and input 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
+
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.
4
8
 
5
9
  ## Quick orientation
6
10
 
@@ -56,7 +60,7 @@ extractions:
56
60
 
57
61
  The checked-in
58
62
  [`characteristics.yaml`](../../examples/example/definitions/.cobolts/characteristics.yaml)
59
- then configures **where extracted output and hand-authored input metadata are
63
+ then configures **where extracted output and input metadata are
60
64
  loaded from**:
61
65
 
62
66
  ```yaml
@@ -85,12 +89,13 @@ columns and mapping path before continuing.
85
89
 
86
90
  ```powershell
87
91
  yarn cobolts -d modules/examples/example/definitions extract demo-characteristics --raw --noSources --output modules/examples/example/definitions/.cobolts/demo-characteristics.yaml
92
+ yarn cobolts -d modules/examples/example/definitions extract input-characteristics --output modules/examples/example/definitions/.cobolts/input-characteristics.yaml
88
93
  yarn cobolts -d modules/examples/example/definitions characteristics list
89
94
  yarn cobolts -d modules/examples/example/definitions characteristics show C7200
90
95
  ```
91
96
 
92
- `extract` **overwrites** the output metadata YAML, not the Excel workbook or
93
- input metadata. It reads `.cobolts/extractions.yaml`; `characteristics list/show`
97
+ `extract` **overwrites** the named metadata YAML, not the workbook or the physical
98
+ input files. It reads `.cobolts/extractions.yaml`; `characteristics list/show`
94
99
  read `.cobolts/characteristics.yaml` and the two configured sources. The
95
100
  `--noSources` flag omits worksheet provenance in the generated file; omit it
96
101
  if you want to retain Excel source rows in the characteristic metadata.
@@ -166,7 +171,7 @@ yarn cobolts -d modules/examples/example/definitions graph build experiments.yam
166
171
  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
172
 
168
173
  # 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
174
+ yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel validate --graph generated-graph.yaml --composition productionDaily
170
175
  ```
171
176
 
172
177
  `graph build` accepts a version-1 experiment dossier and optional existing
@@ -200,7 +205,7 @@ window names, and seeds `C7240` with the previous customer lifetime volume. For
200
205
  an eventual evaluation, select the matching seed using the **root-level** option:
201
206
 
202
207
  ```powershell
203
- yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel evaluate 1001 --graph generated-graph.yaml --periodicity monthly
208
+ yarn cobolts -d modules/examples/example/definitions --accumulator accumulator.generated.yaml cel evaluate 1001 --graph generated-graph.yaml --composition productionMonthly
204
209
  ```
205
210
 
206
211
  The customer order-count field is already in the example projection. Do not
@@ -210,7 +215,8 @@ across different output characteristics; graph deduplication comes later.
210
215
 
211
216
  Input `I7000` now describes the existing `input.customers.orderCount` physical
212
217
  projection. Its six monthly seed values are synthetic demonstration history;
213
- advancing `--periodicity monthly` inserts the current record's `orderCount`.
218
+ selecting `--composition productionMonthly` advances the monthly windows and
219
+ inserts the current record's `orderCount`.
214
220
  See the [example `.cobolts` walkthrough](../../examples/example/definitions/.cobolts/README.md)
215
221
  for complete executable commands and the required spreadsheet rows.
216
222
 
@@ -245,7 +251,7 @@ Source filenames are relative to `files.root`; generated filenames are relative
245
251
 
246
252
  ## Commands
247
253
 
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.
254
+ 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
255
 
250
256
  From the repository root (PowerShell):
251
257
 
@@ -255,38 +261,41 @@ yarn cobolts -d benchmarks validate all
255
261
  yarn cobolts -d modules/examples validate all
256
262
 
257
263
  # 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
264
+ yarn cobolts -d benchmarks/graph-10 cel graph --short --composition benchmark
265
+ yarn cobolts -d benchmarks/graph-10 cel canonical --short --composition benchmark
266
+ yarn cobolts -d benchmarks/graph-10 cel sorted --short --composition benchmark
267
+ yarn cobolts -d benchmarks/graph-10 cel planned --short --composition benchmark
262
268
 
263
269
  # 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
270
+ yarn cobolts -d benchmarks/baseline cel validate --composition benchmark
271
+ yarn cobolts -d benchmarks/baseline cel execute --composition benchmark --count 1 --raw
272
+ yarn cobolts -d benchmarks/baseline cel evaluate 1 --composition benchmark --debug
267
273
 
268
274
  # Execute the two-file EBCDIC example
269
- yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --debug
275
+ yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --composition productionDaily --debug
276
+ # Use the same default graph/accumulator with monthly event periodicity:
277
+ yarn cobolts -d modules/examples/example/definitions cel evaluate 1001 --composition productionMonthly --debug
270
278
  ```
271
279
 
272
280
  Commands (`[ ]` marks optional arguments):
273
281
 
274
282
  ```text
275
- cobolts config files|list|names|view|validate
283
+ cobolts config files|list|names|view|validate|compositions
276
284
  cobolts generate all|copybook|projectionDefn|projection [logical-name]
277
285
  cobolts display <logical-name> [--count N | --all] [--skip N] [--raw] [--input file]
278
286
  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]
287
+ cobolts cel graph|canonical|sorted|planned [--graph file] [--composition name] [--short]
288
+ cobolts cel validate [logical-name] [--graph file] [--composition name]
289
+ cobolts cel execute [logical-name] [--graph file] [--composition name] [--count N | --all] [--skip N] [--raw] [--on-error throw|continue]
290
+ cobolts cel evaluate <entity-id> [logical-name] [--graph file] [--composition name] [--debug] [--debug-node name]
283
291
  cobolts validate all
284
292
  cobolts ai prompt|exchange|response <output-id>
285
293
  cobolts ai do <output-id> [--file file]
286
294
  cobolts ai all [--file file]
287
295
  ```
288
296
 
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.
297
+ `display` reads one physical file, with no composition option. For composed CEL
298
+ 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
299
 
291
300
  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
301
 
@@ -342,7 +351,7 @@ Node command or dependency is required:
342
351
 
343
352
  ```powershell
344
353
  # Capture a V8 allocation-sampling profile of the first measured CEL pass.
345
- yarn cobolts benchmark run graph-1000-chain -n 10000 --allocation-profile
354
+ yarn cobolts benchmark run graph-1000-chain -n 10000 --allocation-profile --composition benchmark
346
355
 
347
356
  # Summarise the profile under benchmarks/graph-1000-chain/cel.heapprofile.
348
357
  yarn cobolts benchmark allocations graph-1000-chain --top 30
@@ -363,9 +372,9 @@ unprofiled runs for performance comparisons because sampling affects timings.
363
372
 
364
373
  ## Named characteristic extraction
365
374
 
366
- `cobolts extract <name>` reads one extraction from `.cobolts/extractions.yaml`. Source worksheet provenance is included by default; `--noSources` suppresses that field in either YAML or JSON output without affecting the join.
375
+ `cobolts extract <name>` reads one extraction from `.cobolts/extractions.yaml`. Source provenance is included by default; `--noSources` suppresses that field in either YAML or JSON output without affecting the join.
367
376
  The `extractions` mapping can contain several named, type-tagged definitions. Currently
368
- `type: excel` is implemented; other types (including Word) can be added later.
377
+ `type: excel` and `type: input` are implemented; other types (including Word) can be added later.
369
378
 
370
379
  For the `Demo characteristics` spreadsheet, save the exported `.xlsx` in
371
380
  `source/demo-characteristics.xlsx`, and configure:
@@ -412,6 +421,31 @@ working directory. Diagnostics go to stderr unless `--raw` suppresses the traili
412
421
  The output includes the source file,
413
422
  sheet and row for each matched record. Extraction does not mutate experiment dossiers.
414
423
 
424
+ ## Input characteristic extraction
425
+
426
+ `type: input` extracts all scalar fields and terminal arrays from each configured logical
427
+ projection. It does not require a physical data file. Configure entity keys independently
428
+ of the cursor composition key, and optionally map projected fields to legacy IDs:
429
+
430
+ ```yaml
431
+ extractions:
432
+ input-characteristics:
433
+ type: input
434
+ files:
435
+ accounts:
436
+ keys:
437
+ customer: customerId
438
+ account: accountId
439
+ fields:
440
+ balance:
441
+ id: I0010
442
+ ```
443
+
444
+ The API and AI consume `metadata.path` (e.g. `input.accounts.balance`) and `metadata.keys`
445
+ (e.g. `customer: input.accounts.customerId`). The input catalogue validates these fields
446
+ when it loads; the output catalogue remains unconstrained. The graph executor and
447
+ benchmarks do not require extraction or characteristic metadata configuration.
448
+
415
449
  ## Characteristic metadata repository
416
450
 
417
451
  `.cobolts/characteristics.yaml` declares a global `files` directory prefix and independent `input` and `output` sets of named `type: yaml` metadata sources. Each source selects a dotted `path` to a map of characteristic IDs or the list emitted by `cobolts extract`. Sources within each kind join by characteristic ID. An ID may appear in both kinds with different metadata.
@@ -453,18 +487,48 @@ cobolts -d modules/examples/example/definitions extract demo-characteristics \
453
487
 
454
488
  Use `--format json` for JSON. Without `--kind`, `list` produces separate `input` and `output` arrays; `show` produces both records with an explicit `null` for a kind where the ID is absent. `list --ids` prefixes each ID with its kind (`input:C0010`, `output:C0010`) so repeated identifiers remain unambiguous. `--kind input` or `--kind output` limits output to that catalogue and preserves the single-catalogue response shape. Both inspection commands accept `--config`. The internal metadata query port remains `list()`/`get(id)` for each kind.
455
489
 
490
+ ## Serve Graph Explorer
491
+
492
+ After compiling the workspace packages, launch directly (the GUI builds automatically when needed):
493
+
494
+ ```powershell
495
+ yarn cobolts -d modules/examples/example/definitions serve
496
+ ```
497
+
498
+ Open http://127.0.0.1:3000/. `serve` and `serve all` host the API and built
499
+ GUI on the same Express server. `serve api` needs no GUI assets. `serve gui`
500
+ needs no project configuration and proxies `/api` to a separately hosted API:
501
+
502
+ ```powershell
503
+ yarn cobolts -d modules/examples/example/definitions serve api --port 3000
504
+ yarn cobolts serve gui --port 5173 --api-url http://127.0.0.1:3000
505
+ ```
506
+
507
+ Run those two commands in separate terminals if you want separate servers.
508
+ The default GUI-only port is 5173; the default API/all port is 3000.
509
+ `characteristics serve` accepts the same modes. `--host` defaults to localhost
510
+ (127.0.0.1). These servers have no authentication; keep them on trusted hosts.
511
+ The Vite build writes to the CLI package's `build/gui` directory, included in
512
+ its package files. No Vite dev server, hot reload or CORS configuration is
513
+ needed at runtime. When running the TypeScript CLI from a source checkout,
514
+ the CLI builds the GUI on every launch using linked TypeScript package entry
515
+ points; no dist directories are needed.
516
+ API-only mode never builds the GUI. Installed CLI packages use their prebuilt
517
+ assets without Vite. The optional `build:gui` command and `prepack` remain
518
+ available for explicit builds and distribution.
519
+
456
520
  ## Characteristic metadata HTTP API
457
521
 
458
522
  Read-only metadata is available over localhost without an MCP server:
459
523
 
460
524
  ```powershell
461
- cobolts -d modules/examples/example/definitions characteristics serve --port 3000
462
- cobolts -d modules/examples/example/definitions characteristics serve --port 3000 --quiet
525
+ cobolts -d modules/examples/example/definitions serve api --port 3000
526
+ cobolts -d modules/examples/example/definitions serve api --port 3000 --quiet
463
527
  ```
464
528
 
465
529
  By default the server prints its base URL and the API endpoints to stderr. `--quiet` suppresses only this startup information; errors remain visible.
466
530
 
467
- `GET /api` links to `/api/characteristics`, whose sitemap links to the input and output collections. Those collections each provide self-links for every characteristic, with detail endpoints under `/api/characteristics/input/:id` and `/api/characteristics/output/:id`. All links are root-relative and characteristic IDs are URL-encoded. There is no authentication: do not expose the server outside the trusted developer machine. Restart it to load edits to the source YAML files.
531
+ `GET /api` links to `/api/characteristics` and, when serving, `/api/graph`, `/api/canonical`, `/api/sorted`, and `/api/planned`. The characteristics sitemap links to the input and output collections. Those collections each provide self-links for every characteristic, with detail endpoints under `/api/characteristics/input/:id` and `/api/characteristics/output/:id`. All links are root-relative and characteristic IDs are URL-encoded. There is no authentication: do not expose the server outside the trusted developer machine. Restart it to load edits to the characteristic source YAML files. The four graph endpoints invoke the existing `celInspect` pipeline and return precisely the JSON from `cobolts cel graph|canonical|sorted|planned`. Use `--graph <filename>` to select another graph at server startup.
468
532
 
469
533
  ## AI characteristic experiment loop (mock provider)
470
534
 
@@ -510,10 +574,19 @@ Read-only metadata is available over localhost without introducing an MCP server
510
574
 
511
575
  ```powershell
512
576
  # Load .cobolts/characteristics.yaml once and serve a snapshot
513
- cobolts -d modules/examples/example/definitions characteristics serve --port 3000
577
+ cobolts -d modules/examples/example/definitions serve api --port 3000
514
578
  ```
515
579
 
516
580
  `GET http://127.0.0.1:3000/api/characteristics` returns `{ "characteristics": [...] }`.
517
581
  `GET http://127.0.0.1:3000/api/characteristics/C0010` returns one characteristic, or a JSON 404 when absent.
518
582
 
519
- 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.
583
+ The CLI `characteristics list` and `characteristics show` use the same internal `CharacteristicQueries` port. The server defaults to `127.0.0.1` and has no authentication; do not expose it to other machines. Restart it to load edited source YAML files.
584
+
585
+ ## Encrypted production oracle repository
586
+
587
+ 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.
588
+
589
+ The `serve api` API also exposes `/api/graph/display`,
590
+ `/api/canonical/display`, `/api/sorted/display` and `/api/planned/display`.
591
+ These are display-only views enriched with input-field nodes using
592
+ `@cobol-ts/graph_utils`; raw graph endpoints and production execution are unchanged.