@ontrails/trails 1.0.0-beta.30 → 1.0.0-beta.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,158 @@
1
1
  # trails
2
2
 
3
+ ## 1.0.0-beta.39
4
+
5
+ ### Minor Changes
6
+
7
+ - [`9518f5c`](https://github.com/outfitter-dev/trails/commit/9518f5cc892a87273a3bfdaa0d7319f98004ecb8): `trails regrade adjust <transition>` pulls a graduated transition back from consolidated history into an active plan minus the run ledger, preserving the stable transition id so subsequent applies append to the same history spine. Plan re-derivation (`regrade plan`) now carries `transitionId` forward from an existing active plan.
8
+ - [`714939d`](https://github.com/outfitter-dev/trails/commit/714939d6ec143c55a1aba55b65bd11a8a2bfbf1e): Stacked/phased regrades ride the primary tooling: class-mode Regrade plans accept `include` path globs so one transition can be applied in scoped parts that all append to the same consolidated history, and an authored `--name` keys multi-class transitions to a clean transition-name filename instead of concatenated class ids.
9
+ - [`65b362f`](https://github.com/outfitter-dev/trails/commit/65b362f65fa2a75e2121d1a8b31882d52fa0376b): Regrade history consolidates per transition, append-only: `regrade apply` appends a run entry stamped `{ planContentHash, lockHashAtRun }` to `.trails/regrade/history/<transition>.json` instead of overwriting lockhash-named files, identical re-runs are recognized as replays, the artifact carries a stable internal transition `id`, and `regrade check <transition>` verifies each recorded run at its own stamped lock. The report `history.status` union widens to `applied | checked | replay`.
10
+ - [`7c05376`](https://github.com/outfitter-dev/trails/commit/7c05376a4ee2a66ef477d8f165205bf2fbbdc37f): `trails compile` and `trails validate` now collect adapter overlay overlays from the app module's `trailsOverlays` export and embed the validated facts as `overlays.<namespace>` in `trails.lock`, threading the registrations through every derivation site so compiled and freshly derived graphs stay hash-identical.
11
+ - [`adf6419`](https://github.com/outfitter-dev/trails/commit/adf64191ea9e458d7405465ab6fa96ca72ab574c): Add `trails wayfind --overlay <namespace>`: a generic read of namespaced lock overlays (adapter-contributed facts) from saved artifacts, listing available namespaces on a miss — new fact families become inspectable with zero wayfinder edits.
12
+
13
+ ### Patch Changes
14
+
15
+ - [`f42ca6e`](https://github.com/outfitter-dev/trails/commit/f42ca6e40b29155acec446e5bf44e52e014466bd): Hard cutover: the CLI consumes `cli` bindings from the app-authored surfaces overlay. Scalar bindings behave identically to the removed cliAliases (parity-tested) — the binding name splits on `.` into a transparent synonym command path for exactly one trail. List bindings arrive as command groups: each expanded member trail gets a group-prefixed route that dispatches the member trail with its identity preserved, and a singleton list stays a group. Expansion is fail-fast boundary validation: a scalar binding resolving to zero or multiple trails, or a group with an empty member union, is a `ValidationError` naming the binding. `DeriveTopoGraphOptions.cliAliases`, the `cliAliases`/`trailsCliAliases` app-module export convention, and the per-kind compile lift are deleted; `deriveCliCommands`/`createProgram` take `overlays` instead of `aliases`, and both topo-graph derivation pipelines expand the same bindings through one shared helper so runtime CLI routes and lock routes come from one semantic. A leftover legacy export is now a Warden error (`no-legacy-cli-alias-export`) naming the `surfaceOverlay({ cli: { ... } })` rewrite.
16
+
17
+ This is a breaking API removal shipped under the lockstep beta patch convention (pre-1.0 hard-cutover posture, zero external adoption); the removed options have no deprecation window by design.
18
+
19
+ - [`bafde1f`](https://github.com/outfitter-dev/trails/commit/bafde1fc8172abb8d8617f69a3c7a70667626d10): Fresh derivations now collect app-module overlays through the shared channel compile uses. `@ontrails/adapter-kit` exports `resolveTrailsOverlays()`, the one reader of an app module's `trailsOverlays` export; the compile-path fresh app lease and Warden's fresh topo loading both go through it, making per-namespace drift asymmetry structurally impossible. Warden drift checks (`checkDrift` now accepts derive options carrying overlays) and the topo-aware rule context graph derive with the same overlays the committed lock embeds, so rules like `surface-overlay-coherence` fire on standard runs. Stale drift results name the drifted overlay namespaces (`DriftResult.driftedOverlayNamespaces`) and point at `trails compile` as the remediation.
20
+ - [`b077fb7`](https://github.com/outfitter-dev/trails/commit/b077fb7ba6d9724cac6f0e59bc3fec9aec28984c): Add the export-restructure Regrade class family (TRL-1210). `export-restructure:cli-aliases` inverts legacy `cliAliases`/`trailsCliAliases` exports into `surfaceOverlay({ cli })` bindings inside the module's `trailsOverlays` export — adding the `@ontrails/core` import, deleting the legacy export, and routing anything it cannot prove safe (computed keys, spreads, in-module `aliases:` references) to `needs-review` with the exact target shape named. `export-restructure:mcp-trailheads` projects call-site MCP trailhead maps into `surfaceOverlay({ mcp })` group bindings: it rewrites in place when the same module exports `trailsOverlays`, and otherwise emits a classified `needs-review` handoff naming the module-overlay target while the call-site map stays as the richer-metadata override-in-context. Warden's fix-class union grows to `'export-restructure' | 'term-rewrite'`, `no-legacy-cli-alias-export` now advertises the `export-restructure` class, and `loadWardenRegradeClasses` supersedes `loadWardenTermRewriteClasses` (still exported) as the full Warden-routed class loader. Class-mode Regrade also gains the full plan lifecycle: `trails regrade plan --type class --class-ids ...` writes a `.trails/regrade/<slug>.json` plan carrying class ids, scope, and intent, `regrade check` re-runs the dry run and gates on outstanding rewrites or review, and `regrade apply` applies and graduates the plan to `.trails/regrade/history/<slug>-<hash>.json` — the same plan → check → apply → history evidence trail vocabulary regrades already had, now available to structural transforms. The class family ships for downstream apps bridging the pre-1.0 gap, so pre-cutover alias exports and trailhead maps migrate mechanically instead of by hand.
21
+ - [`81373bc`](https://github.com/outfitter-dev/trails/commit/81373bc5e980bb06d56fb06af4f0986f72e318c7): Wave-2 MCP cutover to the app-authored `surfaces` overlay. The overlay's `mcp` bindings are now the authored, lockable default for the MCP surface: a list binding derives one grouped trailhead tool (member selection in `{ trail, input }`, member identity preserved in `{ trail, output }`, deterministic derived description), and a scalar binding derives an additional tool synonym whose MCP-safe name is published verbatim and must expand to exactly one trail. `deriveMcpTools`/`createServer` accept the new `overlays` option; `@ontrails/core` gains `expandMcpSurfaceBindings` and `deriveMcpTrailheadDescription`.
22
+
23
+ The call-site `CreateServerOptions.trailheads` map survives as permanent override-in-context design, not a compatibility bridge: when both channels are present, the call-site map wins at runtime. Warden's new `trailhead-override-divergence` rule (warn) names both sides when a call-site map's binding names or member selectors diverge from the authored overlay default.
24
+
25
+ Topographer now derives `graph.trailheads` from the overlay's `mcp` list bindings in both `deriveTopoGraph` and the store-side graph build, so trailhead facts flow from compiled locks into Wayfinder reads for the first time. The never-wired `DeriveTopoGraphOptions.trailheads` option and the `TopoGraphTrailheadDeclaration`/`TopoGraphTrailheadTrailSelector` types are removed — a beta-window hard cutover of an option no caller could reach; author the equivalent `mcp` list binding in `surfaceOverlay({ mcp })` instead.
26
+
27
+ - [`a0517ef`](https://github.com/outfitter-dev/trails/commit/a0517efa01014754b1dc307169b21ae71a6e3620): Fresh app loading now resolves extensionless relative imports the way Bun does at runtime, so runtime-valid apps stay operator-loadable (`trails compile`, `trails warden`, and every other fresh-load path). When a relative import cannot be resolved at all, the failure is an actionable `ValidationError` naming the importer file and specifier instead of an opaque redacted "Internal server error".
28
+ - [`a89d469`](https://github.com/outfitter-dev/trails/commit/a89d4696aa78f3dda9394c14665ab3ea8c0f313c): Make `trails compile` → `trails validate` round-trip deterministically (TRL-1191). The per-user topo store no longer reuses previously stored JSON Schema bytes by zod definition hash — that hash cannot see `.describe()` metadata or object field order, so a warm store could serve pre-edit schema values into a freshly compiled lock and make `validate` report it stale immediately. Every snapshot now regenerates schema JSON from the live Zod schema, the store's graph hash goes through the same shared `deriveStableHash` path as `deriveTopoGraphHash`, and the committed `trails.lock` omits the wallclock `generatedAt` field so recompiling unchanged sources yields a byte-identical lock. `TopoGraph.generatedAt` is now optional; locks written by earlier versions still parse.
29
+ - [`a89d469`](https://github.com/outfitter-dev/trails/commit/a89d4696aa78f3dda9394c14665ab3ea8c0f313c): Make the per-user topo store an honest cache (TRL-1196). Every snapshot now records a content fingerprint of the app source set (`topo_snapshots.source_fingerprint`, store schema v14), `trails compile` reports it in its output, and Wayfinder artifact loading compares it against a freshly derived fingerprint — a mismatch surfaces as a `topo-store-source-fingerprint-mismatch` stale reason instead of silently serving pre-edit facts. Compile derives everything from live source on every run, so a poisoned or stale store can never reach `trails.lock`, with or without `--force`.
30
+ - [`a89d469`](https://github.com/outfitter-dev/trails/commit/a89d4696aa78f3dda9394c14665ab3ea8c0f313c): Add the lock round-trip invariant gate (TRL-1200): `trails release smoke --check lock-roundtrip` discovers every committed `trails.lock`, recompiles each against a cold per-user store in a temporary state home, and asserts `validate` is green and the recompiled lock is byte-identical to the committed one. Failure output names the diverging section and the `trails compile` command that fixes it — hand-editing a lock is never the remediation. Wired into `bun run check` and the CI Governance job via `bun run lock:roundtrip`.
31
+
32
+ ## 1.0.0-beta.38
33
+
34
+ ## 1.0.0-beta.37
35
+
36
+ ### Patch Changes
37
+
38
+ - [`09f15de`](https://github.com/outfitter-dev/trails/commit/09f15def8fcc8c28b0d604f436e6eeed46da8f37): Stage wide-net Regrade expansion candidates as structured plan review inventory with evidence, status, and pending counts.
39
+
40
+ ## 1.0.0-beta.36
41
+
42
+ ### Patch Changes
43
+
44
+ - [`6e63e48`](https://github.com/outfitter-dev/trails/commit/6e63e483617b84cb6868d0c4d58d5b5a8d3b9ed2): Complete the v1 grouped surface-entry vocabulary cutover from facet to trailhead, including Regrade dogfood support for governed string literal renames and composed AST rewrite application.
45
+ - [`26786a1`](https://github.com/outfitter-dev/trails/commit/26786a14acbe9ed03f69adbdac22968891e33df1): Persist vocabulary Regrade plan artifacts, expose plan/check/preview/apply flows across CLI and MCP, and write applied plan history for reviewed vocabulary migrations.
46
+
47
+ ## 1.0.0-beta.35
48
+
49
+ ## 1.0.0-beta.34
50
+
51
+ ### Patch Changes
52
+
53
+ - [`d67558b`](https://github.com/outfitter-dev/trails/commit/d67558bea3bfa363ed57e0f4091b6eccbf2a7710): Run governed AST symbol renames from the registry-backed `trails regrade` command path, including MCP parity, while preserving derived live API forms.
54
+
55
+ ## 1.0.0-beta.33
56
+
57
+ ### Patch Changes
58
+
59
+ - [`04a6057`](https://github.com/outfitter-dev/trails/commit/04a6057502281fb81d1eb77df140d07181bfdd07): Clean generated release output by suppressing internal dependency cascade noise in package changelogs and rendering generated release PR and GitHub Release notes from the same Highlights, Changes, and Package Versions summary.
60
+ - [`0c40138`](https://github.com/outfitter-dev/trails/commit/0c40138efb962e779710daa172bdfd756d9d992f): Harden vocabulary regrades by deferring Markdown code contexts for review and
61
+ exposing structured preserve rules through the Trails `regrade` command.
62
+ - [`7d65189`](https://github.com/outfitter-dev/trails/commit/7d65189cc33408755fe07a0b5679f1ed01123455): Expose derived live-API preserve inventory in vocabulary Regrade runs and have the Trails operator regrade surface derive current facet API preserves from live topo and MCP surface facts.
63
+ - [`04bb8a4`](https://github.com/outfitter-dev/trails/commit/04bb8a42af4ada51a74b1d8c83697db92035b5e9): Expose vocabulary Regrade occurrence dispositions and disposition summary counts alongside mechanical verdicts.
64
+
65
+ Accept explicit preserve-rule dispositions through the `trails regrade` CLI/MCP contract.
66
+
67
+ ## 1.0.0-beta.32
68
+
69
+ ### Patch Changes
70
+
71
+ - f3c4fef: Export a shared `escapeRegExp` helper from core and migrate first-party callers off local copies.
72
+ - cb0a9d8: Export shared workspace package discovery helpers from core and migrate first-party discovery callers.
73
+ - 8db145e: Move activation report derivation into Topographer and keep the Trails app
74
+ consuming the owner-held activation facts through a compatibility re-export.
75
+ - 8e2603c: Rename read-only topo helper exports from `build*` to `derive*`.
76
+ - 7a3a25f: Rename version lifecycle result paths from `file` to `filePath`.
77
+ - fe72b84: Fold remaining Regrade and Warden scan-target surfaces onto the shared path-scope vocabulary.
78
+ - Updated dependencies [3e5c0fc]
79
+ - Updated dependencies [f3c4fef]
80
+ - Updated dependencies [cb0a9d8]
81
+ - Updated dependencies [8db145e]
82
+ - Updated dependencies [2b819f4]
83
+ - Updated dependencies [21c6dda]
84
+ - Updated dependencies [860ef32]
85
+ - Updated dependencies [fe72b84]
86
+ - @ontrails/adapter-kit@1.0.0-beta.32
87
+ - @ontrails/core@1.0.0-beta.32
88
+ - @ontrails/permits@1.0.0-beta.32
89
+ - @ontrails/warden@1.0.0-beta.32
90
+ - @ontrails/regrade@1.0.0-beta.32
91
+ - @ontrails/topographer@1.0.0-beta.32
92
+ - @ontrails/config@1.0.0-beta.32
93
+ - @ontrails/cli@1.0.0-beta.32
94
+ - @ontrails/commander@1.0.0-beta.32
95
+ - @ontrails/http@1.0.0-beta.32
96
+ - @ontrails/mcp@1.0.0-beta.32
97
+ - @ontrails/observe@1.0.0-beta.32
98
+ - @ontrails/tracing@1.0.0-beta.32
99
+ - @ontrails/wayfinder@1.0.0-beta.32
100
+
101
+ ## 1.0.0-beta.31
102
+
103
+ ### Patch Changes
104
+
105
+ - e2f3d23: Default Regrade reports to actionable entries, add skip counts grouped by
106
+ reason, and expose an `includeEntries` option for full report inventories.
107
+ - 9be2b7e: Load project-local Warden term-rewrite rules from the Regrade root so repo-owned
108
+ migration classes can run through `trails regrade`.
109
+ - 47f782c: Add occurrence-level vocabulary regrade reports with plan, ledger,
110
+ and completion-gate facts. The Trails `regrade` operator command now supports
111
+ positional `<from> <to>` regrade runs and exposes the same capability through
112
+ the curated MCP surface.
113
+ - ee9f3ae: Let Warden fix capabilities declare downstream scan targets and have Regrade
114
+ honor those targets for Warden-backed term-rewrite classes.
115
+
116
+ Dogfood the first safe facet-to-trailhead prose rewrite through project-local
117
+ Warden rules and Regrade.
118
+
119
+ - 982a4d7: Add Regrade path-scope exclusion globs for vocabulary runs and expose them
120
+ through the `trails regrade` CLI/MCP contract.
121
+ - 1540233: Add Regrade scan inventory summaries that group matched files by extension and
122
+ top-level path, with occurrence counts for vocabulary regrade reports.
123
+ - de878bd: Let Trails project config provide default Regrade vocabulary scope settings,
124
+ with explicit CLI or MCP plan inputs overriding those defaults.
125
+ - a0126d9: Add Warden `scope.exclude` globs through project config and the Trails CLI
126
+ wrapper so governance runs can exclude local notes, scratch space, and generated
127
+ state without dropping durable skills or plugin assets from scope.
128
+ - a079073: Rename Regrade path-scope scan controls from `ignore` to `exclude` across CLI, MCP, and project config.
129
+ - 6a26a08: Rename Warden governance scope controls from jurisdiction ignore settings to `scope.exclude` across config, CLI, and Trails surfaces.
130
+ - Updated dependencies [e2f3d23]
131
+ - Updated dependencies [9be2b7e]
132
+ - Updated dependencies [47f782c]
133
+ - Updated dependencies [ee9f3ae]
134
+ - Updated dependencies [982a4d7]
135
+ - Updated dependencies [1540233]
136
+ - Updated dependencies [a0126d9]
137
+ - Updated dependencies [4cd5d4e]
138
+ - Updated dependencies [a079073]
139
+ - Updated dependencies [6a26a08]
140
+ - Updated dependencies [38907cc]
141
+ - @ontrails/regrade@1.0.0-beta.31
142
+ - @ontrails/warden@1.0.0-beta.31
143
+ - @ontrails/mcp@1.0.0-beta.31
144
+ - @ontrails/wayfinder@1.0.0-beta.31
145
+ - @ontrails/core@1.0.0-beta.31
146
+ - @ontrails/commander@1.0.0-beta.31
147
+ - @ontrails/adapter-kit@1.0.0-beta.31
148
+ - @ontrails/cli@1.0.0-beta.31
149
+ - @ontrails/config@1.0.0-beta.31
150
+ - @ontrails/http@1.0.0-beta.31
151
+ - @ontrails/observe@1.0.0-beta.31
152
+ - @ontrails/permits@1.0.0-beta.31
153
+ - @ontrails/topographer@1.0.0-beta.31
154
+ - @ontrails/tracing@1.0.0-beta.31
155
+
3
156
  ## 1.0.0-beta.30
4
157
 
5
158
  ### Patch Changes
package/README.md CHANGED
@@ -16,9 +16,9 @@ Common workflows:
16
16
  - `trails compile` writes root `trails.lock`.
17
17
  - `trails validate` checks root `trails.lock` for drift.
18
18
  - `trails wayfind`, `trails wayfind --trails --intent read`, `trails wayfind <id> --contract`, `trails wayfind <id> --deps`, `trails wayfind <id> --impact`, `trails wayfind pattern "wayfind.*"`, `trails wayfind query "release drift"`, `trails wayfind file <file> --outline`, and `trails wayfind diff ...` read graph artifacts and source outlines through Wayfinder for local navigation.
19
- - `trails schema <command...>` shows accepted CLI routes, aliases, flags, and schemas for an operator command.
20
- - `trails warden` runs Trails governance checks for contract and architecture drift.
21
- - `trails regrade --root-dir <path> --json` dry-runs downstream migration checks; add `--apply` only to write safe rewrites.
19
+ - `trails schema <command...>` shows accepted CLI routes, aliases, flags, and schemas for an operator command or command namespace.
20
+ - `trails warden` runs Trails governance checks for contract and architecture drift. Use `--scope-exclude <glob>` or project `warden.scope.exclude` config when local notes, scratch space, or generated state should not be governed by Warden.
21
+ - `trails regrade plan <from> <to> --root-dir <path> --json` writes an active Regrade plan, `trails regrade plan --expand` stages wide-net review candidates in that plan, `trails regrade preview` reruns it without writing, and `trails regrade apply` consumes the plan and writes history. Use `plan --expand --dry-run` to inspect staged candidates without writing the active plan, and add `--dry-run` to `apply` to prove the apply path without mutating source. Use `trails regrade plans` and `trails regrade check` when a workspace has active plans that need inspection before apply. MCP exposes the same lifecycle as `trails_plan_regrade`, `trails_list_regrades`, `trails_check_regrade`, `trails_preview_regrade`, and `trails_apply_regrade`.
22
22
  - `trails guide` remains available for compatibility; prefer `trails wayfind --source live --module <app-module>` or saved-artifact Wayfinder reads for agent navigation.
23
23
 
24
24
  Trails is contract-first: define trails once with typed input, Result output, examples, and meta; the framework derives CLI, MCP, HTTP, and future surfaces from the same contracts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ontrails/trails",
3
- "version": "1.0.0-beta.30",
3
+ "version": "1.0.0-beta.39",
4
4
  "bin": {
5
5
  "trails": "./bin/trails.ts"
6
6
  },
@@ -27,25 +27,26 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@clack/prompts": "^1.1.0",
30
- "@ontrails/adapter-kit": "^1.0.0-beta.30",
31
- "@ontrails/cli": "^1.0.0-beta.30",
32
- "@ontrails/commander": "^1.0.0-beta.30",
33
- "@ontrails/config": "^1.0.0-beta.30",
34
- "@ontrails/core": "^1.0.0-beta.30",
35
- "@ontrails/http": "^1.0.0-beta.30",
36
- "@ontrails/mcp": "^1.0.0-beta.30",
37
- "@ontrails/observe": "^1.0.0-beta.30",
38
- "@ontrails/permits": "^1.0.0-beta.30",
39
- "@ontrails/regrade": "^1.0.0-beta.30",
40
- "@ontrails/topographer": "^1.0.0-beta.30",
41
- "@ontrails/tracing": "^1.0.0-beta.30",
42
- "@ontrails/warden": "^1.0.0-beta.30",
43
- "@ontrails/wayfinder": "^1.0.0-beta.30",
30
+ "@ontrails/adapter-kit": "^1.0.0-beta.39",
31
+ "@ontrails/cli": "^1.0.0-beta.39",
32
+ "@ontrails/commander": "^1.0.0-beta.39",
33
+ "@ontrails/config": "^1.0.0-beta.39",
34
+ "@ontrails/core": "^1.0.0-beta.39",
35
+ "@ontrails/http": "^1.0.0-beta.39",
36
+ "@ontrails/mcp": "^1.0.0-beta.39",
37
+ "@ontrails/observe": "^1.0.0-beta.39",
38
+ "@ontrails/permits": "^1.0.0-beta.39",
39
+ "@ontrails/regrade": "^1.0.0-beta.39",
40
+ "@ontrails/topographer": "^1.0.0-beta.39",
41
+ "@ontrails/tracing": "^1.0.0-beta.39",
42
+ "@ontrails/warden": "^1.0.0-beta.39",
43
+ "@ontrails/wayfinder": "^1.0.0-beta.39",
44
44
  "commander": "^14.0.3",
45
45
  "typescript": "^5.9.3",
46
46
  "zod": "^4.3.5"
47
47
  },
48
48
  "devDependencies": {
49
- "@ontrails/testing": "^1.0.0-beta.30"
49
+ "@ontrails/cloudflare": "^1.0.0-beta.39",
50
+ "@ontrails/testing": "^1.0.0-beta.39"
50
51
  }
51
52
  }
package/src/app.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { topo } from '@ontrails/core';
1
+ import { surfaceOverlay, topo } from '@ontrails/core';
2
2
  import {
3
3
  wayfindAdaptersTrail,
4
4
  wayfindContoursTrail,
@@ -7,7 +7,8 @@ import {
7
7
  wayfindDiffTrail,
8
8
  wayfindErrorsTrail,
9
9
  wayfindExamplesTrail,
10
- wayfindFacetsTrail,
10
+ wayfindOverlayTrail,
11
+ wayfindTrailheadsTrail,
11
12
  wayfindImpactTrail,
12
13
  wayfindNearbyTrail,
13
14
  wayfindOverviewTrail,
@@ -111,15 +112,16 @@ const cliWayfinderSupportTrails = {
111
112
  wayfindDescribeTrail,
112
113
  wayfindErrorsTrail,
113
114
  wayfindExamplesTrail,
114
- wayfindFacetsTrail,
115
115
  wayfindImpactTrail,
116
116
  wayfindNearbyTrail,
117
117
  wayfindOutlineTrail,
118
+ wayfindOverlayTrail,
118
119
  wayfindOverviewTrail,
119
120
  wayfindResourcesTrail,
120
121
  wayfindSearchTrail,
121
122
  wayfindSignalsTrail,
122
123
  wayfindSurfacesTrail,
124
+ wayfindTrailheadsTrail,
123
125
  wayfindTrailsTrail,
124
126
  wayfindVersionsTrail,
125
127
  };
@@ -138,8 +140,27 @@ export const trailsCliIncludedTrails = [
138
140
  ]),
139
141
  ];
140
142
 
141
- export const trailsCliAliases = {
142
- 'survey.diff': [['diff']],
143
- } as const;
143
+ export const trailsOverlays = [
144
+ surfaceOverlay({
145
+ cli: { diff: 'survey.diff' },
146
+ // Authored, lockable default for the operator MCP `inspect` trailhead.
147
+ // The call-site map in `mcp-options.ts` overrides it at runtime with
148
+ // richer metadata (description, deferred loading) over the same members.
149
+ mcp: {
150
+ inspect: [
151
+ 'survey',
152
+ 'topo',
153
+ 'guide',
154
+ 'survey.brief',
155
+ 'survey.diff',
156
+ 'survey.resource',
157
+ 'survey.signal',
158
+ 'survey.surfaces',
159
+ 'survey.trail',
160
+ 'topo.history',
161
+ ],
162
+ },
163
+ }),
164
+ ];
144
165
 
145
166
  export const app = topo('trails', operatorTrails, cliWayfinderTrails);
package/src/cli.ts CHANGED
@@ -21,7 +21,7 @@ import type { CreateProgramOptions } from '@ontrails/commander';
21
21
  import { resolvePermitFromBearerToken } from '@ontrails/permits';
22
22
  import { deriveTopoGraph } from '@ontrails/topographer';
23
23
 
24
- import { app, trailsCliAliases, trailsCliIncludedTrails } from './app.js';
24
+ import { app, trailsCliIncludedTrails, trailsOverlays } from './app.js';
25
25
  import { resolveInputWithClack } from './clack.js';
26
26
  import { getRetiredTopoCommandDiagnostic } from './retired-topo-command.js';
27
27
  import { attachCompletionsInstallCommand } from './run-completions-install.js';
@@ -247,6 +247,7 @@ const wardenValueFlags = new Set([
247
247
  '--drafts',
248
248
  '--fail-on',
249
249
  '--format',
250
+ '--scope-exclude',
250
251
  '--lock',
251
252
  '--root-dir',
252
253
  ]);
@@ -301,11 +302,11 @@ const runSurfaceOnce = async (): Promise<void> => {
301
302
  const session = maybeInstallTraceSession();
302
303
  try {
303
304
  const surfaceOptions = {
304
- aliases: trailsCliAliases,
305
305
  description: 'Agent-native, contract-first TypeScript framework',
306
306
  include: trailsCliIncludedTrails,
307
307
  name: 'trails',
308
308
  onResult: buildOnResult(session),
309
+ overlays: trailsOverlays,
309
310
  presets: [
310
311
  outputModePreset(),
311
312
  tracePreset(),
package/src/mcp-app.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  wayfindDiffTrail,
7
7
  wayfindErrorsTrail,
8
8
  wayfindExamplesTrail,
9
+ wayfindOverlayTrail,
9
10
  wayfindImpactTrail,
10
11
  wayfindNearbyTrail,
11
12
  wayfindOverviewTrail,
@@ -32,6 +33,7 @@ export const trailsMcpApp = topo('trails', operatorTrails, {
32
33
  wayfindImpactTrail,
33
34
  wayfindNearbyTrail,
34
35
  wayfindOutlineTrail,
36
+ wayfindOverlayTrail,
35
37
  wayfindOverviewTrail,
36
38
  wayfindResourcesTrail,
37
39
  wayfindSearchTrail,
@@ -1,4 +1,9 @@
1
- import type { CreateServerOptions, McpSurfaceFacetMap } from '@ontrails/mcp';
1
+ import type {
2
+ CreateServerOptions,
3
+ McpSurfaceTrailheadMap,
4
+ } from '@ontrails/mcp';
5
+
6
+ import { trailsOverlays } from './app.js';
2
7
 
3
8
  export const trailsMcpIncludedTrails = [
4
9
  'adapter.check',
@@ -14,6 +19,12 @@ export const trailsMcpIncludedTrails = [
14
19
  'doctor',
15
20
  'draft.promote',
16
21
  'guide',
22
+ 'adjust.regrade',
23
+ 'apply.regrade',
24
+ 'check.regrade',
25
+ 'list.regrades',
26
+ 'plan.regrade',
27
+ 'preview.regrade',
17
28
  'release.check',
18
29
  'release.smoke',
19
30
  'revise',
@@ -46,7 +57,7 @@ export const trailsMcpIncludedTrails = [
46
57
  'wayfind.trails',
47
58
  ] as const;
48
59
 
49
- export const trailsMcpFacets = {
60
+ export const trailsMcpTrailheads = {
50
61
  inspect: {
51
62
  description:
52
63
  'Inspect saved topo structure, resources, signals, surfaces, and diffs.',
@@ -64,13 +75,17 @@ export const trailsMcpFacets = {
64
75
  'topo.history',
65
76
  ],
66
77
  },
67
- } satisfies McpSurfaceFacetMap;
78
+ } satisfies McpSurfaceTrailheadMap;
68
79
 
69
80
  export const trailsMcpSurfaceOptions = {
70
81
  description:
71
- 'Trails framework operator surface. Use MCP resources for cold context, direct tools for high-signal work, and the inspect facet for saved topo reads.',
72
- facets: trailsMcpFacets,
82
+ 'Trails framework operator surface. Use MCP resources for cold context, direct tools for high-signal work, and the inspect trailhead for saved topo reads.',
73
83
  include: trailsMcpIncludedTrails,
74
84
  mcpResources: { examples: true, graph: true, surfaceMap: true },
75
85
  name: 'trails',
86
+ // The overlay authors the lockable `inspect` default; the call-site map
87
+ // below is the runtime override-in-context with richer metadata
88
+ // (description, deferred loading) over the same member selectors.
89
+ overlays: trailsOverlays,
90
+ trailheads: trailsMcpTrailheads,
76
91
  } satisfies CreateServerOptions;
@@ -0,0 +1,152 @@
1
+ import { loadTrailsConfigValue } from '@ontrails/config';
2
+ import {
3
+ InternalError,
4
+ Result,
5
+ ValidationError,
6
+ pathScopeSchema,
7
+ } from '@ontrails/core';
8
+ import type { Result as TrailsResult } from '@ontrails/core';
9
+ import { z } from 'zod';
10
+
11
+ export const regradeConfigSchema = z
12
+ .object({
13
+ scope: pathScopeSchema.optional(),
14
+ })
15
+ .default({});
16
+
17
+ export type RegradeConfig = z.output<typeof regradeConfigSchema>;
18
+
19
+ interface RegradeConfigLoadResult {
20
+ readonly config?: RegradeConfig;
21
+ readonly configPath?: string;
22
+ }
23
+
24
+ interface ResolvableConfig {
25
+ readonly resolve: (options?: {
26
+ readonly cwd?: string;
27
+ readonly env?: Record<string, string | undefined>;
28
+ }) => unknown;
29
+ }
30
+
31
+ const isRecord = (value: unknown): value is Record<string, unknown> =>
32
+ typeof value === 'object' && value !== null && !Array.isArray(value);
33
+
34
+ const isResultLike = (
35
+ value: unknown
36
+ ): value is {
37
+ readonly error?: unknown;
38
+ readonly isErr: () => boolean;
39
+ readonly isOk: () => boolean;
40
+ readonly value?: unknown;
41
+ } =>
42
+ isRecord(value) &&
43
+ typeof value['isOk'] === 'function' &&
44
+ typeof value['isErr'] === 'function';
45
+
46
+ const isResolvableConfig = (value: unknown): value is ResolvableConfig =>
47
+ isRecord(value) && typeof value['resolve'] === 'function';
48
+
49
+ const errorMessage = (error: unknown): string =>
50
+ error instanceof Error ? error.message : String(error);
51
+
52
+ const extractRegradeConfig = (
53
+ value: unknown
54
+ ): TrailsResult<RegradeConfig | undefined, ValidationError> => {
55
+ if (!(isRecord(value) && 'regrade' in value)) {
56
+ return Result.ok();
57
+ }
58
+
59
+ const parsed = regradeConfigSchema.safeParse(value['regrade']);
60
+ if (parsed.success) {
61
+ return Result.ok(parsed.data);
62
+ }
63
+
64
+ return Result.err(
65
+ new ValidationError('Invalid regrade config in Trails config file.', {
66
+ context: { issues: parsed.error.issues },
67
+ })
68
+ );
69
+ };
70
+
71
+ export const loadRegradeConfig = async ({
72
+ configPath,
73
+ env = {},
74
+ rootDir,
75
+ }: {
76
+ readonly configPath?: string | undefined;
77
+ readonly env?: Record<string, string | undefined> | undefined;
78
+ readonly rootDir: string;
79
+ }): Promise<
80
+ TrailsResult<RegradeConfigLoadResult, InternalError | ValidationError>
81
+ > => {
82
+ try {
83
+ const loaded = await loadTrailsConfigValue({
84
+ configPath,
85
+ rootDir,
86
+ });
87
+ const exported = loaded.value;
88
+ if (exported === undefined) {
89
+ return Result.ok({});
90
+ }
91
+
92
+ if (isResolvableConfig(exported)) {
93
+ const resolved = await exported.resolve({ cwd: rootDir, env });
94
+ if (isResultLike(resolved)) {
95
+ if (resolved.isErr()) {
96
+ return Result.err(
97
+ new InternalError(
98
+ `Failed to resolve regrade config: ${errorMessage(resolved.error)}`
99
+ )
100
+ );
101
+ }
102
+ const configResult = extractRegradeConfig(resolved.value);
103
+ if (configResult.isErr()) {
104
+ return configResult;
105
+ }
106
+ return Result.ok({
107
+ ...(configResult.value === undefined
108
+ ? {}
109
+ : { config: configResult.value }),
110
+ ...(loaded.configPath === undefined
111
+ ? {}
112
+ : { configPath: loaded.configPath }),
113
+ });
114
+ }
115
+
116
+ const configResult = extractRegradeConfig(resolved);
117
+ if (configResult.isErr()) {
118
+ return configResult;
119
+ }
120
+ return Result.ok({
121
+ ...(configResult.value === undefined
122
+ ? {}
123
+ : { config: configResult.value }),
124
+ ...(loaded.configPath === undefined
125
+ ? {}
126
+ : { configPath: loaded.configPath }),
127
+ });
128
+ }
129
+
130
+ const configResult = extractRegradeConfig(exported);
131
+ if (configResult.isErr()) {
132
+ return configResult;
133
+ }
134
+ return Result.ok({
135
+ ...(configResult.value === undefined
136
+ ? {}
137
+ : { config: configResult.value }),
138
+ ...(loaded.configPath === undefined
139
+ ? {}
140
+ : { configPath: loaded.configPath }),
141
+ });
142
+ } catch (error) {
143
+ return Result.err(
144
+ new InternalError(
145
+ `Failed to load regrade config: ${errorMessage(error)}`,
146
+ {
147
+ cause: error instanceof Error ? error : new Error(String(error)),
148
+ }
149
+ )
150
+ );
151
+ }
152
+ };