@fulmenhq/tsfulmen 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/README.md +30 -1
  3. package/config/crucible-ts/taxonomy/metrics.yaml +1 -1
  4. package/dist/appidentity/index.js +9 -2209
  5. package/dist/appidentity/index.js.map +1 -1
  6. package/dist/assets/index.d.ts +179 -0
  7. package/dist/assets/index.js +4 -0
  8. package/dist/assets/index.js.map +1 -0
  9. package/dist/bin/prometheus-cli.js +15 -9139
  10. package/dist/bin/prometheus-cli.js.map +1 -1
  11. package/dist/bin/schema-cli.js +4 -6098
  12. package/dist/bin/schema-cli.js.map +1 -1
  13. package/dist/bin/signals-cli.js +15 -1910
  14. package/dist/bin/signals-cli.js.map +1 -1
  15. package/dist/chunk-3HISR2XI.js +36 -0
  16. package/dist/chunk-3HISR2XI.js.map +1 -0
  17. package/dist/chunk-5HZEJGZ5.js +725 -0
  18. package/dist/chunk-5HZEJGZ5.js.map +1 -0
  19. package/dist/chunk-7SVYOPJ3.js +9412 -0
  20. package/dist/chunk-7SVYOPJ3.js.map +1 -0
  21. package/dist/chunk-BCO3FUUO.js +682 -0
  22. package/dist/chunk-BCO3FUUO.js.map +1 -0
  23. package/dist/chunk-BJDL6JEX.js +208 -0
  24. package/dist/chunk-BJDL6JEX.js.map +1 -0
  25. package/dist/chunk-BTUS6PZZ.js +302 -0
  26. package/dist/chunk-BTUS6PZZ.js.map +1 -0
  27. package/dist/chunk-CW4CSNVF.js +410 -0
  28. package/dist/chunk-CW4CSNVF.js.map +1 -0
  29. package/dist/chunk-HIBZ2AY7.js +194 -0
  30. package/dist/chunk-HIBZ2AY7.js.map +1 -0
  31. package/dist/chunk-HS4F3BRR.js +985 -0
  32. package/dist/chunk-HS4F3BRR.js.map +1 -0
  33. package/dist/chunk-HY6JQOFN.js +32 -0
  34. package/dist/chunk-HY6JQOFN.js.map +1 -0
  35. package/dist/chunk-K2FYT43R.js +837 -0
  36. package/dist/chunk-K2FYT43R.js.map +1 -0
  37. package/dist/chunk-K7BMFGQP.js +43 -0
  38. package/dist/chunk-K7BMFGQP.js.map +1 -0
  39. package/dist/chunk-LWAH2UG7.js +103 -0
  40. package/dist/chunk-LWAH2UG7.js.map +1 -0
  41. package/dist/chunk-OHE2AOH4.js +273 -0
  42. package/dist/chunk-OHE2AOH4.js.map +1 -0
  43. package/dist/chunk-P3DNOZOG.js +1488 -0
  44. package/dist/chunk-P3DNOZOG.js.map +1 -0
  45. package/dist/chunk-PQ6TKPUN.js +27 -0
  46. package/dist/chunk-PQ6TKPUN.js.map +1 -0
  47. package/dist/chunk-QCCN6POA.js +211 -0
  48. package/dist/chunk-QCCN6POA.js.map +1 -0
  49. package/dist/chunk-RSLFR4TO.js +631 -0
  50. package/dist/chunk-RSLFR4TO.js.map +1 -0
  51. package/dist/chunk-UP2VWCW5.js +33 -0
  52. package/dist/chunk-UP2VWCW5.js.map +1 -0
  53. package/dist/chunk-W6TQFTTY.js +130 -0
  54. package/dist/chunk-W6TQFTTY.js.map +1 -0
  55. package/dist/chunk-WSMVLWLB.js +269 -0
  56. package/dist/chunk-WSMVLWLB.js.map +1 -0
  57. package/dist/config/index.js +6 -1220
  58. package/dist/config/index.js.map +1 -1
  59. package/dist/crucible/fulpack/index.js +2 -25
  60. package/dist/crucible/fulpack/index.js.map +1 -1
  61. package/dist/crucible/index.js +13 -1129
  62. package/dist/crucible/index.js.map +1 -1
  63. package/dist/docscribe/index.js +2 -680
  64. package/dist/docscribe/index.js.map +1 -1
  65. package/dist/errors/index.js +5 -1831
  66. package/dist/errors/index.js.map +1 -1
  67. package/dist/errors-D7KXV3QW.js +4 -0
  68. package/dist/errors-D7KXV3QW.js.map +1 -0
  69. package/dist/errors-RBJX6ETJ.js +8 -0
  70. package/dist/errors-RBJX6ETJ.js.map +1 -0
  71. package/dist/export-BWRETGYS.js +6 -0
  72. package/dist/export-BWRETGYS.js.map +1 -0
  73. package/dist/foundry/index.js +340 -3949
  74. package/dist/foundry/index.js.map +1 -1
  75. package/dist/foundry/similarity/index.js +3 -134
  76. package/dist/foundry/similarity/index.js.map +1 -1
  77. package/dist/fulencode/index.js +3 -319
  78. package/dist/fulencode/index.js.map +1 -1
  79. package/dist/fulhash/index.js +3 -611
  80. package/dist/fulhash/index.js.map +1 -1
  81. package/dist/fulpack/index.js +3 -1515
  82. package/dist/fulpack/index.js.map +1 -1
  83. package/dist/hash-YOJYVOWH.js +4 -0
  84. package/dist/hash-YOJYVOWH.js.map +1 -0
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +14 -4395
  87. package/dist/index.js.map +1 -1
  88. package/dist/loader-H5K7HSO5.js +9 -0
  89. package/dist/loader-H5K7HSO5.js.map +1 -0
  90. package/dist/logging/index.js +2 -723
  91. package/dist/logging/index.js.map +1 -1
  92. package/dist/pathfinder/index.js +18 -2341
  93. package/dist/pathfinder/index.js.map +1 -1
  94. package/dist/prom-client-PNEBGD3G.js +4801 -0
  95. package/dist/prom-client-PNEBGD3G.js.map +1 -0
  96. package/dist/reports/license-inventory.csv +1 -1
  97. package/dist/schema/index.d.ts +19 -6
  98. package/dist/schema/index.js +4 -6148
  99. package/dist/schema/index.js.map +1 -1
  100. package/dist/signals/index.js +8 -2767
  101. package/dist/signals/index.js.map +1 -1
  102. package/dist/similarity/index.js +3 -134
  103. package/dist/similarity/index.js.map +1 -1
  104. package/dist/telemetry/http/index.js +9 -930
  105. package/dist/telemetry/http/index.js.map +1 -1
  106. package/dist/telemetry/index.js +4 -1561
  107. package/dist/telemetry/index.js.map +1 -1
  108. package/dist/telemetry/prometheus/index.js +7 -8422
  109. package/dist/telemetry/prometheus/index.js.map +1 -1
  110. package/dist/validator-U4CKD2Y3.js +6 -0
  111. package/dist/validator-U4CKD2Y3.js.map +1 -0
  112. package/package.json +5 -1
  113. package/schemas/crucible-ts/library/module-manifest/v1.0.0/module-manifest.schema.json +1 -1
  114. package/schemas/crucible-ts/observability/logging/v1.0.0/definitions.schema.json +1 -1
  115. package/schemas/crucible-ts/observability/logging/v1.0.0/log-event.schema.json +13 -13
  116. package/schemas/crucible-ts/observability/logging/v1.0.0/logger-config.schema.json +2 -2
  117. package/schemas/crucible-ts/observability/logging/v1.0.0/logging-policy.schema.json +1 -1
  118. package/schemas/crucible-ts/observability/logging/v1.0.0/middleware-config.schema.json +2 -2
  119. package/schemas/crucible-ts/observability/logging/v1.0.0/severity-filter.schema.json +3 -3
  120. package/schemas/crucible-ts/upstream/3leaps/crucible/PROVENANCE.md +3 -3
  121. package/schemas/crucible-ts/upstream/3leaps/crucible/docs/catalog/classifiers/README.md +1 -1
  122. package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/classifiers-framework.md +1 -1
  123. package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/data-sensitivity-classification.md +1 -1
package/CHANGELOG.md CHANGED
@@ -14,6 +14,56 @@ _No unreleased changes._
14
14
 
15
15
  ---
16
16
 
17
+ ## [0.4.0] - 2026-06-24
18
+
19
+ > **Minor — compile-safe SSOT asset embedding.** Makes every bundled SSOT asset
20
+ > (schemas, JSON-Schema metaschemas, foundry catalogs, telemetry taxonomy) resolve
21
+ > without the filesystem, so tsfulmen works fully inside a `bun build --compile`
22
+ > single-file binary — including standalone `serve`, schema discovery, and config
23
+ > validation. No public API removals; the new surface is additive. Engine floor
24
+ > unchanged (`>=22.12.0`). Full details in `docs/releases/v0.4.0.md`.
25
+
26
+ ### Added
27
+
28
+ - **`@fulmenhq/tsfulmen/assets` — `AssetResolver` layer.** Central resolution for
29
+ bundled SSOT assets with two backends: `FsAssetResolver` (on-disk) and
30
+ `EmbeddedAssetResolver` (build-embedded generated modules). `resolveAssets()` /
31
+ `getAssetResolver()` select via `TSFULMEN_ASSET_MODE` (`auto` | `fs` | `embedded`;
32
+ default `auto` — filesystem when present, embedded otherwise). Logical paths are
33
+ package-root-relative and validated against path traversal.
34
+ - **Embedded SSOT asset modules** (`src/assets/generated/`, checked in): per-domain
35
+ manifests (metaschema, schemas, foundry catalogs, taxonomy) so loads resolve with
36
+ no filesystem read in a compiled binary. Regenerated via `make embed-assets`;
37
+ drift-guarded by `make verify-embedded-assets` (in `check-all`).
38
+ - **Compile-safety guards** (CI-enforced): `verify-embedded-compile` (in-binary
39
+ read/enumerate **and** standalone `serve` from a temp cwd) and
40
+ `verify-dist-asset-partition` (public entries stay lean; corpus in exactly one
41
+ shared chunk; per-domain presence + size report).
42
+
43
+ ### Changed
44
+
45
+ - **All SSOT asset loads now route through the `AssetResolver`** — schema registry
46
+ discovery, validator metaschemas/vocabulary/`compileSchemaById`/cross-tree `$ref`
47
+ resolution, foundry catalogs + signals catalog, and telemetry taxonomy — replacing
48
+ `import.meta.url`/`__dirname`-relative `readFile`. `SchemaMetadata.path` is now a
49
+ logical (resolver-relative) path. Fixes latent cwd/layout fragility in addition to
50
+ enabling compile-safety.
51
+ - **Build emits shared chunks** (`tsup splitting: true`): the embedded corpus is
52
+ deduped into one shared chunk rather than duplicated per entry, and public entry
53
+ files stay lean. The full `dist/` tree drops to ~3.7 MB vs ~24 MB (~1.1 MB of that
54
+ is JS across all entries plus one shared corpus chunk; the rest is type declarations
55
+ and source maps). Published `dist/` now includes `chunk-*.js` (packed automatically
56
+ via `files: ["dist"]`).
57
+ - **Synced Crucible SSOT `v0.4.14 → v0.4.15`** — fixes cross-schema `$ref`/`$id`
58
+ vs. file-layout inconsistencies (observability/logging `$id` version-as-directory;
59
+ module-manifest relative-ref correction) surfaced by the resolver repoint.
60
+
61
+ ### Fixed
62
+
63
+ - **Standalone `serve`, schema discovery, and config validation work in
64
+ `bun build --compile` single-file binaries** — the foundry signals catalog and the
65
+ rest of the SSOT assets are no longer read from an absent on-disk tree.
66
+
17
67
  ## [0.3.3] - 2026-06-17
18
68
 
19
69
  > **Patch — compile-safety ergonomics.** Two purely-additive API options that let `bun --compile` single-file binary consumers register a build-embedded identity and load embedded config without per-consumer workarounds — ahead of the larger v0.4.0 SSOT-asset-embedding work. No breaking changes; the existing exported `LoadConfigOptions` shape is unchanged; engine floor unchanged (`>=22.12.0`). Full details in `docs/releases/v0.3.3.md`.
@@ -43,7 +93,7 @@ _No unreleased changes._
43
93
 
44
94
  ### Fixed
45
95
 
46
- - **CLI shadowing under `bun build --compile`** (#15) — the schema/signals/prometheus CLIs self-executed on import via the non-compile-safe guard `import.meta.url === \`file://${process.argv[1]}\``; under `--compile` it fired for non-entry modules, so a compiled consumer importing `@fulmenhq/tsfulmen/schema` ran `tsfulmen-schema` instead of its own program. The library modules no longer parse argv on import; executables moved to dedicated bin entries out of the importable graph.
96
+ - **CLI shadowing under `bun build --compile`** (#15) — the schema/signals/prometheus CLIs self-executed on import via a non-compile-safe main-module guard comparing `import.meta.url` to `process.argv[1]`; under `--compile` it fired for non-entry modules, so a compiled consumer importing `@fulmenhq/tsfulmen/schema` ran `tsfulmen-schema` instead of its own program. The library modules no longer parse argv on import; executables moved to dedicated bin entries out of the importable graph.
47
97
  - **Compiled-binary WASM `ENOENT` crash** (#14) — bump `@3leaps/string-metrics-wasm` 0.3.8 → 0.3.10, fixing the eager top-level WASM load that `--compile` rewrites but does not embed. Consumers no longer need an `overrides` entry.
48
98
 
49
99
  ### Added
package/README.md CHANGED
@@ -5,10 +5,11 @@
5
5
  Every team writes their own HTTP status helpers, exit code enums, and country code lookups. tsfulmen provides production-grade TypeScript implementations derived from a single source of truth—so your TypeScript/Node.js services use the same codes as your Go, Rust, and Python services.
6
6
 
7
7
  - **Zero runtime network calls**: All catalogs embedded at build time
8
+ - **Compile-safe**: Schemas, foundry catalogs, and standalone metrics `serve` resolve with no filesystem, so the full SDK runs inside a `bun build --compile` single-file binary
8
9
  - **Cross-language parity**: Same exit codes, signals, and schemas as gofulmen, rsfulmen, pyfulmen
9
10
  - **Type-safe**: Full TypeScript types with strict mode throughout
10
11
 
11
- **Lifecycle Phase**: `beta` | **Version**: 0.3.0 | **Test Coverage**: 71%
12
+ **Lifecycle Phase**: `beta` | **Version**: 0.4.0 | **Test Coverage**: 71%
12
13
 
13
14
  **Install**: `bun add @fulmenhq/tsfulmen` (or `npm install @fulmenhq/tsfulmen`)
14
15
 
@@ -38,6 +39,7 @@ Every team writes their own HTTP status helpers, exit code enums, and country co
38
39
  - ✅ **DocScribe** - Document processing with frontmatter parsing (50+ tests)
39
40
  - ✅ **Config Path API** - XDG-compliant configuration directory resolution (26 tests)
40
41
  - ✅ **Schema Validation** - JSON Schema 2020-12 validation with AJV and CLI (115 tests)
42
+ - ✅ **Compile-Safe Assets** - SSOT schemas, foundry catalogs, and telemetry taxonomy resolve with no filesystem (`AssetResolver` + `TSFULMEN_ASSET_MODE`), so schema validation and standalone `serve` run inside a `bun --compile` single-file binary
41
43
  - ✅ **Foundry Module** - Pattern catalogs, HTTP statuses, MIME detection, similarity (278 tests)
42
44
  - ✅ **Exit Codes** - Standardized process exit codes with simplified modes and platform detection (34 tests)
43
45
  - ✅ **Signal Handling** - Cross-platform signal handling with graceful shutdown and Windows fallback (180 tests)
@@ -196,6 +198,33 @@ process.chdir(repoRoot);
196
198
 
197
199
  See `docs/guides/crucible-assets.md` for deeper guidance.
198
200
 
201
+ ### Compile-Safe Assets & Single-File Binaries (v0.4.0)
202
+
203
+ tsfulmen resolves its bundled SSOT assets — JSON Schemas, metaschemas, foundry catalogs, and the telemetry taxonomy — through a single `AssetResolver` with filesystem and build-embedded backends. This makes the full SDK (schema validation, foundry catalogs, and standalone metrics `serve`) work inside a `bun build --compile` single-file binary, where no asset tree exists on disk.
204
+
205
+ ```typescript
206
+ import { getAssetResolver } from "@fulmenhq/tsfulmen/assets";
207
+
208
+ const resolver = getAssetResolver(); // auto: filesystem when present, embedded otherwise
209
+ const signals = await resolver.read(
210
+ "config/crucible-ts/library/foundry/signals.yaml",
211
+ );
212
+ const schemas = await resolver.list(["schemas/crucible-ts/**/*.schema.json"]);
213
+ ```
214
+
215
+ If you consume tsfulmen normally (npm / `node dist`), there is nothing to do — the default `auto` mode reads the on-disk asset trees. Building a compiled binary needs no special flags; the embedded modules are bundled automatically:
216
+
217
+ ```bash
218
+ bun build --compile ./your-app.ts --outfile your-app
219
+ ./your-app serve # signals catalog + metrics server resolve from embedded assets
220
+ ```
221
+
222
+ Force a backend with `TSFULMEN_ASSET_MODE` (`auto` | `fs` | `embedded`) when you need to (e.g. testing the embedded path locally).
223
+
224
+ > **Operator note**: the metrics `serve` HTTP server binds `127.0.0.1` (loopback) by default. Keep loopback unless you intentionally bind publicly (`--host 0.0.0.0`), in which case front it with authentication / rate-limiting.
225
+
226
+ See [Compile-safe SSOT assets](docs/development/compile-safe-assets.md) for the full guide.
227
+
199
228
  ### Application Identity
200
229
 
201
230
  Load application identity from `.fulmen/app.yaml` for vendor/app-specific configuration:
@@ -121,7 +121,7 @@ required:
121
121
  - version
122
122
  - metrics
123
123
  additionalProperties: false
124
- version: "0.4.14"
124
+ version: "0.4.15"
125
125
  defaults:
126
126
  histogram_buckets:
127
127
  ms_metrics: