@ontrails/warden 1.0.0-beta.39 → 1.0.0-beta.41

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 (134) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +5 -5
  3. package/package.json +10 -12
  4. package/src/cli.ts +49 -44
  5. package/src/command.ts +2 -2
  6. package/src/drift.ts +4 -3
  7. package/src/index.ts +3 -2
  8. package/src/project-context.ts +3 -3
  9. package/src/resolve.ts +2 -2
  10. package/src/rules/captured-kernel.ts +375 -0
  11. package/src/rules/circular-refs.ts +12 -16
  12. package/src/rules/cli-command-route-coherence.ts +1 -1
  13. package/src/rules/composes-declarations.ts +15 -13
  14. package/src/rules/context-no-surface-types.ts +4 -3
  15. package/src/rules/dead-internal-trail.ts +3 -3
  16. package/src/rules/dead-public-trail.ts +3 -3
  17. package/src/rules/draft-file-marking.ts +4 -9
  18. package/src/rules/draft-visible-debt.ts +3 -8
  19. package/src/rules/duplicate-public-contract.ts +50 -5
  20. package/src/rules/{contour-exists.ts → entity-exists.ts} +67 -64
  21. package/src/rules/entity-ids.ts +15 -0
  22. package/src/rules/error-mapping-completeness.ts +2 -2
  23. package/src/rules/example-valid.ts +84 -84
  24. package/src/rules/fires-declarations.ts +27 -22
  25. package/src/rules/governed-symbol-residue.ts +339 -32
  26. package/src/rules/implementation-returns-result.ts +8 -8
  27. package/src/rules/incomplete-accessor-for-standard-op.ts +15 -15
  28. package/src/rules/incomplete-crud.ts +42 -40
  29. package/src/rules/index.ts +9 -6
  30. package/src/rules/intent-propagation.ts +3 -5
  31. package/src/rules/layer-field-name-drift.ts +2 -2
  32. package/src/rules/library-projection-coherence.ts +2 -2
  33. package/src/rules/metadata.ts +37 -15
  34. package/src/rules/missing-reconcile.ts +3 -4
  35. package/src/rules/missing-visibility.ts +2 -1
  36. package/src/rules/no-destructured-compose.ts +14 -12
  37. package/src/rules/no-direct-implementation-call.ts +12 -7
  38. package/src/rules/no-legacy-cli-alias-export.ts +2 -2
  39. package/src/rules/no-native-error-result.ts +2 -2
  40. package/src/rules/no-redundant-result-error-wrap.ts +10 -10
  41. package/src/rules/no-sync-result-assumption.ts +84 -78
  42. package/src/rules/no-throw-in-detour-recover.ts +2 -2
  43. package/src/rules/no-throw-in-implementation.ts +13 -7
  44. package/src/rules/no-top-level-surface.ts +2 -2
  45. package/src/rules/on-references-exist.ts +3 -3
  46. package/src/rules/orphaned-signal.ts +4 -5
  47. package/src/rules/owner-projection-parity.ts +2 -2
  48. package/src/rules/public-export-example-coverage.ts +10 -4
  49. package/src/rules/public-internal-deep-imports.ts +2 -3
  50. package/src/rules/read-intent-fires.ts +4 -3
  51. package/src/rules/reference-exists.ts +20 -21
  52. package/src/rules/registry-names.ts +6 -4
  53. package/src/rules/resolved-import-boundary.ts +1 -1
  54. package/src/rules/resource-declarations.ts +21 -17
  55. package/src/rules/resource-exists.ts +4 -2
  56. package/src/rules/resource-id-grammar.ts +2 -2
  57. package/src/rules/resource-mock-coverage.ts +2 -2
  58. package/src/rules/retired-vocabulary.ts +242 -5
  59. package/src/rules/source/composition.ts +165 -0
  60. package/src/rules/source/drafts.ts +164 -0
  61. package/src/rules/source/entities.ts +618 -0
  62. package/src/rules/source/pragmas.ts +45 -0
  63. package/src/rules/source/resources.ts +64 -0
  64. package/src/rules/source/signals.ts +397 -0
  65. package/src/rules/source/stores.ts +310 -0
  66. package/src/rules/static-resource-accessor-preference.ts +15 -11
  67. package/src/rules/surface-overlay-coherence.ts +1 -1
  68. package/src/rules/surface-trailhead-coherence.ts +2 -2
  69. package/src/rules/trail-fork-coaching.ts +27 -18
  70. package/src/rules/trail-versioning-source.ts +16 -12
  71. package/src/rules/trail-versioning-topo.ts +2 -2
  72. package/src/rules/trailhead-override-divergence.ts +2 -2
  73. package/src/rules/types.ts +7 -7
  74. package/src/rules/unmaterialized-activation-source.ts +1 -0
  75. package/src/rules/unreachable-detour-shadowing.ts +2 -2
  76. package/src/rules/valid-describe-refs.ts +2 -2
  77. package/src/rules/warden-export-symmetry.ts +3 -3
  78. package/src/rules/warden-rules-use-ast.ts +12 -17
  79. package/src/trails/activation-orphan.trail.ts +5 -5
  80. package/src/trails/captured-kernel.trail.ts +108 -0
  81. package/src/trails/circular-refs.trail.ts +6 -6
  82. package/src/trails/cli-command-route-coherence.trail.ts +2 -2
  83. package/src/trails/composes-declarations.trail.ts +1 -1
  84. package/src/trails/context-no-surface-types.trail.ts +1 -1
  85. package/src/trails/dead-internal-trail.trail.ts +2 -2
  86. package/src/trails/dead-public-trail.trail.ts +1 -1
  87. package/src/trails/deprecation-without-guidance.trail.ts +1 -1
  88. package/src/trails/duplicate-public-contract.trail.ts +3 -3
  89. package/src/trails/entity-exists.trail.ts +21 -0
  90. package/src/trails/example-valid.trail.ts +3 -3
  91. package/src/trails/fires-declarations.trail.ts +1 -1
  92. package/src/trails/{fork-without-preserved-blaze.trail.ts → fork-without-preserved-implementation.trail.ts} +4 -4
  93. package/src/trails/implementation-returns-result.trail.ts +1 -1
  94. package/src/trails/incomplete-accessor-for-standard-op.trail.ts +4 -4
  95. package/src/trails/index.ts +3 -2
  96. package/src/trails/intent-propagation.trail.ts +2 -2
  97. package/src/trails/library-projection-coherence.trail.ts +2 -2
  98. package/src/trails/marker-schema-unsupported.trail.ts +1 -1
  99. package/src/trails/missing-visibility.trail.ts +1 -1
  100. package/src/trails/no-destructured-compose.trail.ts +5 -5
  101. package/src/trails/no-direct-implementation-call.trail.ts +1 -1
  102. package/src/trails/no-redundant-result-error-wrap.trail.ts +2 -2
  103. package/src/trails/no-sync-result-assumption.trail.ts +2 -2
  104. package/src/trails/no-throw-in-detour-recover.trail.ts +1 -1
  105. package/src/trails/no-throw-in-implementation.trail.ts +1 -1
  106. package/src/trails/on-references-exist.trail.ts +1 -1
  107. package/src/trails/pending-force.trail.ts +1 -1
  108. package/src/trails/permit-governance.trail.ts +2 -2
  109. package/src/trails/prefer-schema-inference.trail.ts +1 -1
  110. package/src/trails/public-output-schema.trail.ts +2 -2
  111. package/src/trails/public-union-output-discriminants.trail.ts +1 -1
  112. package/src/trails/read-intent-fires.trail.ts +1 -1
  113. package/src/trails/reference-exists.trail.ts +5 -5
  114. package/src/trails/resource-declarations.trail.ts +1 -1
  115. package/src/trails/resource-exists.trail.ts +1 -1
  116. package/src/trails/run.ts +4 -6
  117. package/src/trails/scheduled-destroy-intent.trail.ts +2 -2
  118. package/src/trails/schema.ts +9 -9
  119. package/src/trails/signal-graph-coaching.trail.ts +2 -2
  120. package/src/trails/static-resource-accessor-preference.trail.ts +1 -1
  121. package/src/trails/surface-overlay-coherence.trail.ts +1 -1
  122. package/src/trails/trail-fork-coaching.trail.ts +1 -1
  123. package/src/trails/unmaterialized-activation-source.trail.ts +5 -5
  124. package/src/trails/valid-detour-contract.trail.ts +1 -1
  125. package/src/trails/version-gap.trail.ts +1 -1
  126. package/src/trails/version-pinned-compose.trail.ts +1 -1
  127. package/src/trails/version-without-examples.trail.ts +1 -1
  128. package/src/trails/warden-rules-use-ast.trail.ts +2 -2
  129. package/src/trails/webhook-route-collision.trail.ts +2 -2
  130. package/src/trails/wrap-rule.ts +17 -17
  131. package/src/ast.ts +0 -137
  132. package/src/rules/ast.ts +0 -4143
  133. package/src/rules/contour-ids.ts +0 -15
  134. package/src/trails/contour-exists.trail.ts +0 -21
package/CHANGELOG.md CHANGED
@@ -1,5 +1,130 @@
1
1
  # @ontrails/warden
2
2
 
3
+ ## 1.0.0-beta.41
4
+
5
+ ## 1.0.0-beta.40
6
+
7
+ ### Minor Changes
8
+
9
+ - [`5adb995`](https://github.com/outfitter-dev/trails/commit/5adb99551c2dda6190d46cce7f60bb08d63c99aa): Complete the v1 hard cutover from the authored `blaze` field to
10
+ `implementation` across trail contracts, surface projections, tests, examples,
11
+ and public source-analysis helpers. Existing applications must rename authored
12
+ trail behavior fields and direct trail-object access before upgrading.
13
+ - [`6712075`](https://github.com/outfitter-dev/trails/commit/67120754df3f614c7f4dd98be1fa0ba9d69b7765): Complete the v1 hard cutover from the `contour` domain-object declaration
14
+ vocabulary to `entity` across contracts, topo facts, store helpers, Warden,
15
+ Wayfinder, operator surfaces, examples, and generated locks. Existing
16
+ applications must rename contour APIs, run `trails dev reset --yes` to discard
17
+ pre-cutover local Topographer snapshots, and then recompile committed
18
+ `trails.lock` artifacts before upgrading. Those derived snapshots are
19
+ intentionally not read through a compatibility layer.
20
+ The entity-shaped wire contract advances `TopoGraph` and split lock manifests
21
+ from schema version 3 to 4; old split artifacts fail with regeneration guidance,
22
+ while the canonical root `trails.lock` remains schema version 5.
23
+ Wayfinder reports those stale rows as topo-store drift while keeping current
24
+ committed lock facts available for inspection.
25
+ - [`aedb87b`](https://github.com/outfitter-dev/trails/commit/aedb87b3b536c5849636c7a5951c51e1e7f0d1cc): Add governed identifier-segment renames for AST-backed migrations. Regrade can
26
+ now migrate camelCase, PascalCase, leading-underscore, and SCREAMING_SNAKE
27
+ identifier segments, including single-segment forms such as `BLAZE` and
28
+ `_BLAZE`, while preserving exact-mode behavior and rejecting lowercase
29
+ substring, concatenated acronym, or inflection matches.
30
+
31
+ ### Patch Changes
32
+
33
+ - [`9874e0b`](https://github.com/outfitter-dev/trails/commit/9874e0bb034c0f98edeb19833d9d3519c2a07a4c): Add `@ontrails/cloudflare/d1`, an env-bound Cloudflare D1 store resource for `@ontrails/store` definitions. The new subpath exports `cloudflareD1` and `connectD1`, supports the backend-agnostic store accessor contract (`get`, `list`, `upsert`, `remove`), versioned-table optimistic concurrency, fixture/mock seeding, store-derived write signals, Miniflare-backed conformance tests, and Worker env-bridge integration.
34
+
35
+ `@ontrails/core` and `@ontrails/store` no longer require the Bun global for signal fire ids or late-bound store signal tokens, so store definitions and store-derived signal emission work inside Worker modules. `@ontrails/warden` now treats `cloudflareD1` as a required Cloudflare public export with `@example` coverage.
36
+
37
+ - [`1e64ee7`](https://github.com/outfitter-dev/trails/commit/1e64ee7bc270901486c5bb51ac38bf045c924adc): Add first-class queue activation sources with `queue()` in `@ontrails/core`.
38
+ Queue sources validate their runtime queue name and parse contract, project the
39
+ queue name into durable topo facts, participate in activation input
40
+ compatibility, and block established outputs when malformed.
41
+
42
+ Add `@ontrails/cloudflare/queues` with `cloudflareQueue`, `createMemoryQueue`,
43
+ and `createQueueHandler`. Cloudflare Workers now expose both `fetch` and
44
+ `queue` entrypoints from `createWorkersHandler`, resolve env-bound resources for
45
+ queue-activated trails, acknowledge successful/skipped/cancelled messages, and
46
+ acknowledge traced non-retryable Trails errors so permanently invalid messages
47
+ do not churn through the queue. Failures explicitly marked retryable enter
48
+ Cloudflare's retry and DLQ flow, with rate-limit delays preserved.
49
+
50
+ `@ontrails/warden` now treats queue activation sources as materialized and
51
+ requires `cloudflareQueue` public export example coverage.
52
+
53
+ - [`4086b5b`](https://github.com/outfitter-dev/trails/commit/4086b5b2f01b24660924fd8b667523f38caaed29): Add `@ontrails/cloudflare/r2`, an env-bound Cloudflare R2 bucket resource with
54
+ `cloudflareR2`, `createMemoryR2`, and `r2ObjectToBlobRef`. The resource
55
+ materializes Worker `r2_buckets` bindings through the shared env bridge, records
56
+ Cloudflare lock overlay facts, carries an in-memory object mock for
57
+ configuration-free tests, and documents the supported object operations plus
58
+ streaming/metadata boundaries.
59
+
60
+ `@ontrails/warden` now treats `cloudflareR2` as a required Cloudflare public
61
+ export with `@example` coverage.
62
+
63
+ - [`01b9204`](https://github.com/outfitter-dev/trails/commit/01b92046db52c71f22a871e58a308d7a94483cab): Harden governed v1 vocabulary transitions with property-key-only blaze literal
64
+ rewrites, structured review for ambiguous literal positions, explicit
65
+ scratch/history boundaries, and scan-only preservation for migration plans and
66
+ historical decision evidence.
67
+ - [`ce86e06`](https://github.com/outfitter-dev/trails/commit/ce86e06ea1624cb426f50f7333ae9b01c592868e): Treat same-scope inverse operation pairs such as enable/disable, pause/resume,
68
+ star/unstar, and archive/restore as intentional distinct public contracts in
69
+ the `duplicate-public-contract` rule.
70
+ - [`3531b58`](https://github.com/outfitter-dev/trails/commit/3531b58ba5320753d6d2594257ef71bc950d28a1): Add the advisory captured-kernel Warden rule for ownership review when a public
71
+ subpath re-exports package internals and multiple production workspaces consume
72
+ that subpath, including import-then-export barrels that preserve the internal
73
+ binding through a local alias or default export.
74
+
75
+ Expose typed import-kind inspection from `@ontrails/source` so project rules
76
+ can keep erased type bindings separate from runtime exports.
77
+
78
+ - [`35cbe28`](https://github.com/outfitter-dev/trails/commit/35cbe289db46539b3689dbf6cf8ab0e5d9a1b09c): Found `@ontrails/source` as the shared source-code AST kernel for parsing,
79
+ walking, locations, edits, literals, and generic Trails syntax recognition.
80
+ Warden, Regrade, Wayfinder, and the Trails operator now import those shared
81
+ mechanics from `@ontrails/source`; the legacy Warden AST route is removed by the
82
+ stacked hard cutover.
83
+ - [`35e5fed`](https://github.com/outfitter-dev/trails/commit/35e5fedd228e498783f479f0dd502e2f3ec772b8): Fold the Wayfinder graph-read catalog into `@ontrails/topography`. Wayfind
84
+ remains the product, trail-id, CLI, and MCP brand, but there is no longer an
85
+ `@ontrails/wayfinder` package to install or import. Programmatic consumers
86
+ should move imports such as `wayfinderTopo`, `wayfindOverviewTrail`,
87
+ `loadWayfinderArtifacts`, and the Wayfinder filter/provenance types to
88
+ `@ontrails/topography`.
89
+
90
+ Expose that package move as a governed Regrade transition so exact
91
+ `@ontrails/wayfinder` imports can move safely while product vocabulary and near
92
+ routes remain unchanged for review. Regrade routes package manifests through
93
+ structured review instead of rewriting dependency keys as plain text.
94
+
95
+ The Trails operator now reads all `wayfind.*` query trails and artifact helpers
96
+ from `@ontrails/topography` while preserving the existing CLI/MCP schemas,
97
+ route IDs, output shapes, and internal trail visibility.
98
+
99
+ - [`3a65ae3`](https://github.com/outfitter-dev/trails/commit/3a65ae363e05b7589f4a9876da4346886353b48c): Rename the durable graph substrate package from `@ontrails/topographer` to
100
+ `@ontrails/topography` after folding Wayfind graph queries into that owner.
101
+
102
+ Update imports to `@ontrails/topography` or
103
+ `@ontrails/topography/backend-support`. The pre-1.0 cutover does not ship a
104
+ compatibility package. TopoGraph, lock, topo-store, semantic diff, and Wayfind
105
+ APIs keep their existing contracts, and the `trails wayfind` CLI and MCP names
106
+ remain unchanged.
107
+
108
+ The governed package-route transition moves legacy `@ontrails/wayfinder`
109
+ imports directly to `@ontrails/topography`; it does not emit the retired
110
+ intermediate `@ontrails/topographer` route.
111
+
112
+ - [`2b7da24`](https://github.com/outfitter-dev/trails/commit/2b7da245b7d689e056bfd642e3651244c95e7ff4): Split Warden's source-analysis implementation into focused shared mechanics and
113
+ Warden-owned policy modules while preserving the public AST helper contract.
114
+ - [`76a9e1d`](https://github.com/outfitter-dev/trails/commit/76a9e1da974de24259f7384947e198e1f6380e44): Remove the legacy Warden AST compatibility export now that shared source-analysis helpers are published from `@ontrails/source`.
115
+ - [`a45cead`](https://github.com/outfitter-dev/trails/commit/a45cead6e3ddf6ce606bf5e663b74c0d3b5664b8): Make the planned contour-to-entity Regrade transition code-fact complete for
116
+ apply readiness while leaving the repository cutover status planned.
117
+ Identifiers that already contain the target segment now stay in the review
118
+ inventory instead of producing duplicated target names.
119
+ - [`8a1ac00`](https://github.com/outfitter-dev/trails/commit/8a1ac00b5d789be41ca6e464358c96b01e442bf4): Govern the exact `@ontrails/warden/ast` to `@ontrails/source` package route
120
+ transition for Regrade string-literal and module-specifier rewrites exposed
121
+ through the Trails CLI and MCP tools. Safe rewrites now require the owning
122
+ manifest to already declare the target package; otherwise Regrade preserves the
123
+ occurrence with dependency repair guidance. Invalid manifests remain unchanged
124
+ and produce structured repair guidance that names the owning manifest. Explicit
125
+ preserve rules remain no-ops before dependency validation, and dotted or
126
+ subpath-like near routes remain deferred instead of becoming invented imports.
127
+
3
128
  ## 1.0.0-beta.39
4
129
 
5
130
  ### Patch Changes
package/README.md CHANGED
@@ -29,7 +29,7 @@ Built-in rules are registered in `wardenRules` and `wardenTopoRules`; use those
29
29
 
30
30
  Rules cover several families:
31
31
 
32
- - blaze and `Result` contract checks
32
+ - implementation and `Result` contract checks
33
33
  - compose, fire, resource, and detour declaration drift
34
34
  - draft-state containment
35
35
  - source-static guardrails such as surface-type leakage
@@ -94,7 +94,7 @@ export const rule = {
94
94
 
95
95
  ## Drift detection
96
96
 
97
- Warden integrates with `@ontrails/topographer` to detect when the topo has changed without updating the lock file:
97
+ Warden integrates with `@ontrails/topography` to detect when the topo has changed without updating the lock file:
98
98
 
99
99
  ```typescript
100
100
  import { checkDrift } from '@ontrails/warden';
@@ -127,10 +127,10 @@ import {
127
127
  } from '@ontrails/warden';
128
128
  ```
129
129
 
130
- Parser helpers for rule authoring and repo-local tooling live on the dedicated AST entrypoint:
130
+ Reusable source-code parser helpers now live in `@ontrails/source`:
131
131
 
132
132
  ```typescript
133
- import { findStringLiterals, parse, walk } from '@ontrails/warden/ast';
133
+ import { findStringLiterals, parse, walk } from '@ontrails/source';
134
134
  ```
135
135
 
136
136
  ## Trail-based API
@@ -185,7 +185,7 @@ This is the same factory used internally to build all built-in rule trails.
185
185
  | `formatSummary(report)` | Compact summary line |
186
186
  | `wrapRule(rule)` | Wrap a custom rule as a trail (same factory used for all built-in rule trails) |
187
187
 
188
- AST parser helpers are exported from `@ontrails/warden/ast`, not the root runtime barrel. The stable authoring surface includes `parse`, `walk`, `walkScope`, `walkWithParents`, `walkWithScopeContext`, `offsetToLine`, `offsetToLineColumn`, source-edit helpers, `findTrailDefinitions`, `findBlazeBodies`, `findContourDefinitions`, `isBlazeCall`, and string-literal helpers.
188
+ Source-code parser helpers are owned by `@ontrails/source`, not the Warden root runtime barrel.
189
189
 
190
190
  `runWarden({ tier })` can narrow a run to `source-static`, `project-static`, `topo-aware`, `drift`, or `advisory`. Omit `tier` for the default full run.
191
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ontrails/warden",
3
- "version": "1.0.0-beta.39",
3
+ "version": "1.0.0-beta.41",
4
4
  "bin": {
5
5
  "warden": "./bin/warden.ts"
6
6
  },
@@ -16,7 +16,6 @@
16
16
  "type": "module",
17
17
  "exports": {
18
18
  ".": "./src/index.ts",
19
- "./ast": "./src/ast.ts",
20
19
  "./resolve": "./src/resolve.ts",
21
20
  "./package.json": "./package.json"
22
21
  },
@@ -28,21 +27,20 @@
28
27
  "clean": "rm -rf dist *.tsbuildinfo"
29
28
  },
30
29
  "dependencies": {
31
- "@ontrails/adapter-kit": "^1.0.0-beta.39",
32
- "@ontrails/cli": "^1.0.0-beta.39",
33
- "@ontrails/config": "^1.0.0-beta.39",
34
- "@ontrails/permits": "^1.0.0-beta.39",
35
- "@ontrails/store": "^1.0.0-beta.39",
36
- "oxc-parser": "^0.121.0",
30
+ "@ontrails/adapter-kit": "^1.0.0-beta.41",
31
+ "@ontrails/cli": "^1.0.0-beta.41",
32
+ "@ontrails/config": "^1.0.0-beta.41",
33
+ "@ontrails/permits": "^1.0.0-beta.41",
34
+ "@ontrails/source": "^1.0.0-beta.41",
35
+ "@ontrails/store": "^1.0.0-beta.41",
37
36
  "oxc-resolver": "11.19.1",
38
- "oxc-walker": "^1.0.0",
39
37
  "zod": "^4.3.5"
40
38
  },
41
39
  "devDependencies": {
42
- "@ontrails/testing": "^1.0.0-beta.39"
40
+ "@ontrails/testing": "^1.0.0-beta.41"
43
41
  },
44
42
  "peerDependencies": {
45
- "@ontrails/core": "^1.0.0-beta.39",
46
- "@ontrails/topographer": "^1.0.0-beta.39"
43
+ "@ontrails/core": "^1.0.0-beta.41",
44
+ "@ontrails/topography": "^1.0.0-beta.41"
47
45
  }
48
46
  }
package/src/cli.ts CHANGED
@@ -9,17 +9,17 @@ import { isAbsolute, relative, resolve } from 'node:path';
9
9
 
10
10
  import { resolveTrailsProjectRoot } from '@ontrails/config';
11
11
  import {
12
- getContourReferences,
12
+ getEntityReferences,
13
13
  matchesAnyPathGlob,
14
14
  resolveSurfaceOverlayBindings,
15
15
  surfaceBindingsFromLockOverlays,
16
16
  } from '@ontrails/core';
17
17
  import type { SurfaceBindings, Topo } from '@ontrails/core';
18
- import { deriveTopoGraph } from '@ontrails/topographer';
18
+ import { deriveTopoGraph } from '@ontrails/topography';
19
19
  import type {
20
20
  TopoGraph,
21
21
  TopoGraphOverlayRegistration,
22
- } from '@ontrails/topographer';
22
+ } from '@ontrails/topography';
23
23
 
24
24
  import type {
25
25
  EffectiveWardenConfig,
@@ -47,17 +47,22 @@ import {
47
47
  } from './project-context.js';
48
48
  import {
49
49
  collectComposeTargetTrailIds,
50
- collectContourDefinitionIds,
51
- collectContourReferenceTargetsByName,
52
- collectCrudTableIds as collectCrudTableIdsFromAst,
50
+ collectTrailIntentsById,
51
+ } from './rules/source/composition.js';
52
+ import {
53
+ collectEntityDefinitionIds,
54
+ collectEntityReferenceTargetsByName,
55
+ } from './rules/source/entities.js';
56
+ import { collectResourceDefinitionIds } from './rules/source/resources.js';
57
+ import {
53
58
  collectOnTargetSignalIds as collectOnTargetSignalIdsFromAst,
54
- collectReconcileTableIds as collectReconcileTableIdsFromAst,
55
- collectResourceDefinitionIds,
56
59
  collectSignalDefinitionIds,
57
- collectTrailIntentsById,
58
- findTrailDefinitions,
59
- parse,
60
- } from './rules/ast.js';
60
+ } from './rules/source/signals.js';
61
+ import {
62
+ collectCrudTableIds as collectCrudTableIdsFromAst,
63
+ collectReconcileTableIds as collectReconcileTableIdsFromAst,
64
+ } from './rules/source/stores.js';
65
+ import { findTrailDefinitions, parse } from '@ontrails/source';
61
66
  import { collectFileCrudCoverage } from './rules/incomplete-crud.js';
62
67
  import { wardenRules, wardenTopoRules } from './rules/index.js';
63
68
  import { getWardenRuleMetadata } from './rules/metadata.js';
@@ -374,11 +379,11 @@ interface MutableProjectContext {
374
379
  authoredMcpSurfaceBindingSets:
375
380
  | readonly AuthoredMcpSurfaceBindingSet[]
376
381
  | undefined;
377
- contourReferencesByName: Map<string, Set<string>>;
382
+ entityReferencesByName: Map<string, Set<string>>;
378
383
  crudTableIds: Set<string>;
379
384
  composeTargetTrailIds: Set<string>;
380
385
  crudCoverageByEntity: Map<string, Set<string>>;
381
- knownContourIds: Set<string>;
386
+ knownEntityIds: Set<string>;
382
387
  knownResourceIds: Set<string>;
383
388
  knownSignalIds: Set<string>;
384
389
  knownTrailIds: Set<string>;
@@ -401,16 +406,16 @@ interface MutableProjectContext {
401
406
  const createMutableProjectContext = (): MutableProjectContext => ({
402
407
  authoredMcpSurfaceBindingSets: undefined,
403
408
  composeTargetTrailIds: new Set<string>(),
404
- contourReferencesByName: new Map<string, Set<string>>(),
405
409
  crudCoverageByEntity: new Map<string, Set<string>>(),
406
410
  crudTableIds: new Set<string>(),
407
411
  documentedImportResolutionsByFile: new Map<
408
412
  string,
409
413
  readonly WardenImportResolution[]
410
414
  >(),
415
+ entityReferencesByName: new Map<string, Set<string>>(),
411
416
  exportedSymbolDefinitionsByName: new Map(),
412
417
  importResolutionsByFile: new Map<string, readonly WardenImportResolution[]>(),
413
- knownContourIds: new Set<string>(),
418
+ knownEntityIds: new Set<string>(),
414
419
  knownResourceIds: new Set<string>(),
415
420
  knownSignalIds: new Set<string>(),
416
421
  knownTrailIds: new Set<string>(),
@@ -421,12 +426,12 @@ const createMutableProjectContext = (): MutableProjectContext => ({
421
426
  trailIntentsById: new Map<string, 'destroy' | 'read' | 'write'>(),
422
427
  });
423
428
 
424
- const addContourReferenceTargets = (
429
+ const addEntityReferenceTargets = (
425
430
  context: MutableProjectContext,
426
- contourName: string,
431
+ entityName: string,
427
432
  targets: readonly string[]
428
433
  ): void => {
429
- const existing = context.contourReferencesByName.get(contourName);
434
+ const existing = context.entityReferencesByName.get(entityName);
430
435
  if (existing) {
431
436
  for (const target of targets) {
432
437
  existing.add(target);
@@ -434,17 +439,17 @@ const addContourReferenceTargets = (
434
439
  return;
435
440
  }
436
441
 
437
- context.contourReferencesByName.set(contourName, new Set(targets));
442
+ context.entityReferencesByName.set(entityName, new Set(targets));
438
443
  };
439
444
 
440
445
  const toProjectContext = (context: MutableProjectContext): ProjectContext => ({
441
446
  ...(context.authoredMcpSurfaceBindingSets === undefined
442
447
  ? {}
443
448
  : { authoredMcpSurfaceBindingSets: context.authoredMcpSurfaceBindingSets }),
444
- ...(context.contourReferencesByName.size > 0
449
+ ...(context.entityReferencesByName.size > 0
445
450
  ? {
446
- contourReferencesByName: new Map(
447
- [...context.contourReferencesByName.entries()].map(
451
+ entityReferencesByName: new Map(
452
+ [...context.entityReferencesByName.entries()].map(
448
453
  ([name, targets]) => [name, [...targets]]
449
454
  )
450
455
  ),
@@ -466,7 +471,7 @@ const toProjectContext = (context: MutableProjectContext): ProjectContext => ({
466
471
  }
467
472
  : {}),
468
473
  composeTargetTrailIds: context.composeTargetTrailIds,
469
- knownContourIds: context.knownContourIds,
474
+ knownEntityIds: context.knownEntityIds,
470
475
  knownResourceIds: context.knownResourceIds,
471
476
  knownSignalIds: context.knownSignalIds,
472
477
  knownTrailIds: context.knownTrailIds,
@@ -500,17 +505,17 @@ const toProjectContext = (context: MutableProjectContext): ProjectContext => ({
500
505
  trailIntentsById: context.trailIntentsById,
501
506
  });
502
507
 
503
- const collectKnownContourIds = (
508
+ const collectKnownEntityIds = (
504
509
  sourceCode: string,
505
510
  filePath: string,
506
- knownContourIds: Set<string>
511
+ knownEntityIds: Set<string>
507
512
  ): void => {
508
513
  const ast = parse(filePath, sourceCode);
509
514
  if (!ast) {
510
515
  return;
511
516
  }
512
- for (const id of collectContourDefinitionIds(ast)) {
513
- knownContourIds.add(id);
517
+ for (const id of collectEntityDefinitionIds(ast)) {
518
+ knownEntityIds.add(id);
514
519
  }
515
520
  };
516
521
 
@@ -707,8 +712,8 @@ const collectTopoKnownIds = (
707
712
  appTopo: Topo,
708
713
  context: MutableProjectContext
709
714
  ): void => {
710
- for (const name of appTopo.contours.keys()) {
711
- context.knownContourIds.add(name);
715
+ for (const name of appTopo.entities.keys()) {
716
+ context.knownEntityIds.add(name);
712
717
  }
713
718
 
714
719
  for (const id of appTopo.trails.keys()) {
@@ -737,15 +742,15 @@ const collectTopoComposesAndIntents = (
737
742
  }
738
743
  };
739
744
 
740
- const collectTopoContourReferences = (
745
+ const collectTopoEntityReferences = (
741
746
  appTopo: Topo,
742
747
  context: MutableProjectContext
743
748
  ): void => {
744
- for (const contour of appTopo.listContours()) {
745
- addContourReferenceTargets(
749
+ for (const entity of appTopo.listEntities()) {
750
+ addEntityReferenceTargets(
746
751
  context,
747
- contour.name,
748
- getContourReferences(contour).map((reference) => reference.contour)
752
+ entity.name,
753
+ getEntityReferences(entity).map((reference) => reference.entity)
749
754
  );
750
755
  }
751
756
  };
@@ -756,17 +761,17 @@ const collectTopoTrailContext = (
756
761
  ): void => {
757
762
  collectTopoKnownIds(appTopo, context);
758
763
  collectTopoComposesAndIntents(appTopo, context);
759
- collectTopoContourReferences(appTopo, context);
764
+ collectTopoEntityReferences(appTopo, context);
760
765
  };
761
766
 
762
767
  const collectFileKnownIds = (
763
768
  sourceFile: SourceFile,
764
769
  context: MutableProjectContext
765
770
  ): void => {
766
- collectKnownContourIds(
771
+ collectKnownEntityIds(
767
772
  sourceFile.sourceCode,
768
773
  sourceFile.filePath,
769
- context.knownContourIds
774
+ context.knownEntityIds
770
775
  );
771
776
  collectKnownTrailIds(
772
777
  sourceFile.sourceCode,
@@ -836,7 +841,7 @@ const collectFileProjectContext = (
836
841
  collectFileSupplementalProjectContext(sourceFile, context);
837
842
  };
838
843
 
839
- const collectFileContourReferences = (
844
+ const collectFileEntityReferences = (
840
845
  sourceFile: SourceFile,
841
846
  context: MutableProjectContext
842
847
  ): void => {
@@ -845,12 +850,12 @@ const collectFileContourReferences = (
845
850
  return;
846
851
  }
847
852
 
848
- const referencesByName = collectContourReferenceTargetsByName(
853
+ const referencesByName = collectEntityReferenceTargetsByName(
849
854
  ast,
850
- context.knownContourIds
855
+ context.knownEntityIds
851
856
  );
852
- for (const [contourName, targets] of referencesByName) {
853
- addContourReferenceTargets(context, contourName, targets);
857
+ for (const [entityName, targets] of referencesByName) {
858
+ addEntityReferenceTargets(context, entityName, targets);
854
859
  }
855
860
  };
856
861
 
@@ -971,7 +976,7 @@ const buildProjectContext = (
971
976
  }
972
977
 
973
978
  for (const sourceFile of typeScriptSourceFiles) {
974
- collectFileContourReferences(sourceFile, context);
979
+ collectFileEntityReferences(sourceFile, context);
975
980
  }
976
981
  collectFileImportResolutions(rootDir, typeScriptSourceFiles, context);
977
982
  collectFileDocumentedImportResolutions(
package/src/command.ts CHANGED
@@ -15,7 +15,7 @@ import type {
15
15
  import { resolveTrailsOverlays } from '@ontrails/adapter-kit';
16
16
  import type { Topo } from '@ontrails/core';
17
17
  import { AmbiguousError, NotFoundError } from '@ontrails/core';
18
- import type { TopoGraphOverlayRegistration } from '@ontrails/topographer';
18
+ import type { TopoGraphOverlayRegistration } from '@ontrails/topography';
19
19
  import {
20
20
  loadTrailsConfigValue,
21
21
  resolveTrailsProjectRoot,
@@ -621,7 +621,7 @@ const isTopo = (value: unknown): value is Topo => {
621
621
  value['trails'] instanceof Map &&
622
622
  value['signals'] instanceof Map &&
623
623
  value['resources'] instanceof Map &&
624
- value['contours'] instanceof Map &&
624
+ value['entities'] instanceof Map &&
625
625
  typeof value['get'] === 'function' &&
626
626
  typeof value['list'] === 'function' &&
627
627
  typeof value['name'] === 'string'
package/src/drift.ts CHANGED
@@ -20,15 +20,16 @@ import {
20
20
  deriveTopoGraph,
21
21
  deriveTopoGraphHash,
22
22
  isTopoArtifactRegenerationError,
23
+ LOCK_MANIFEST_SCHEMA_VERSION,
23
24
  readLockManifest,
24
25
  readTopoGraph,
25
26
  readTrailsLock,
26
- } from '@ontrails/topographer';
27
+ } from '@ontrails/topography';
27
28
  import type {
28
29
  DeriveTopoGraphOptions,
29
30
  LockManifest,
30
31
  TopoGraphOverlays,
31
- } from '@ontrails/topographer';
32
+ } from '@ontrails/topography';
32
33
 
33
34
  /**
34
35
  * Derive options `checkDrift` accepts so the fresh comparison graph carries
@@ -99,7 +100,7 @@ const readCommittedLockManifest = async (
99
100
  ],
100
101
  scope: rootLock.scope,
101
102
  summary: rootLock.summary,
102
- version: 3,
103
+ version: LOCK_MANIFEST_SCHEMA_VERSION,
103
104
  };
104
105
  }
105
106
  return await readLockManifest({ dir: deriveTrailsDir({ rootDir }) });
package/src/index.ts CHANGED
@@ -190,9 +190,10 @@ export { wardenTopo } from './trails/topo.js';
190
190
  export { runTopoAwareWardenTrails, runWardenTrails } from './trails/run.js';
191
191
  export {
192
192
  activationOrphanTrail,
193
+ capturedKernelTrail,
193
194
  cliCommandRouteCoherenceTrail,
194
195
  circularRefsTrail,
195
- contourExistsTrail,
196
+ entityExistsTrail,
196
197
  contextNoSurfaceTypesTrail,
197
198
  composesDeclarationsTrail,
198
199
  deadInternalTrailTrail,
@@ -206,7 +207,7 @@ export {
206
207
  errorMappingCompletenessTrail,
207
208
  exampleValidTrail,
208
209
  firesDeclarationsTrail,
209
- forkWithoutPreservedBlazeTrail,
210
+ forkWithoutPreservedImplementationTrail,
210
211
  governedSymbolResidueTrail,
211
212
  implementationReturnsResultTrail,
212
213
  incompleteAccessorForStandardOpTrail,
@@ -19,8 +19,8 @@ import {
19
19
  getNodeBodyStatements,
20
20
  getNodeDeclaration,
21
21
  getNodeDeclarations,
22
- getNodeExportKind,
23
22
  getNodeExported,
23
+ getNodeExportKind,
24
24
  getNodeId,
25
25
  getNodeLocal,
26
26
  getNodeName,
@@ -32,8 +32,8 @@ import {
32
32
  isVariableDeclaration,
33
33
  offsetToLine,
34
34
  parse,
35
- } from './rules/ast.js';
36
- import type { AstNode } from './rules/ast.js';
35
+ } from '@ontrails/source';
36
+ import type { AstNode } from '@ontrails/source';
37
37
  import type { WardenExportedSymbolDefinition } from './rules/types.js';
38
38
  import { collectPublicWorkspaces } from './workspaces.js';
39
39
  import type { WardenPublicWorkspace } from './workspaces.js';
package/src/resolve.ts CHANGED
@@ -21,8 +21,8 @@ import {
21
21
  offsetToLine,
22
22
  parse,
23
23
  walk,
24
- } from './rules/ast.js';
25
- import type { AstNode } from './rules/ast.js';
24
+ } from '@ontrails/source';
25
+ import type { AstNode } from '@ontrails/source';
26
26
 
27
27
  export const wardenImportResolutionErrorKinds = [
28
28
  'builtin',