@ontrails/trails 1.0.0-beta.24 → 1.0.0-beta.29

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 (48) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/README.md +6 -5
  3. package/package.json +16 -14
  4. package/src/app.ts +42 -3
  5. package/src/cli.ts +17 -3
  6. package/src/local-state-io.ts +20 -0
  7. package/src/mcp-app.ts +10 -0
  8. package/src/mcp-options.ts +2 -3
  9. package/src/project-writes.ts +11 -11
  10. package/src/release/check.ts +41 -25
  11. package/src/release/index.ts +40 -0
  12. package/src/release/native-bun-registry.ts +282 -19
  13. package/src/release/pack-coherence.ts +457 -0
  14. package/src/release/policy.ts +1684 -0
  15. package/src/release/semver.ts +104 -0
  16. package/src/release/wayfinder-dogfood-smoke.ts +600 -66
  17. package/src/run-completions-install.ts +2 -2
  18. package/src/run-schema.ts +41 -0
  19. package/src/run-wayfind-outline.ts +166 -0
  20. package/src/trails/adapter-check.ts +1 -1
  21. package/src/trails/add-surface.ts +1 -1
  22. package/src/trails/add-verify.ts +3 -3
  23. package/src/trails/compile.ts +17 -25
  24. package/src/trails/create-scaffold.ts +14 -14
  25. package/src/trails/create.ts +5 -5
  26. package/src/trails/dev-support.ts +44 -24
  27. package/src/trails/doctor.ts +23 -2
  28. package/src/trails/draft-promote.ts +7 -7
  29. package/src/trails/guide.ts +15 -19
  30. package/src/trails/load-app.ts +58 -9
  31. package/src/trails/operator-context.ts +66 -0
  32. package/src/trails/regrade.ts +72 -0
  33. package/src/trails/release-check.ts +1 -0
  34. package/src/trails/run-example.ts +21 -37
  35. package/src/trails/run-examples.ts +16 -32
  36. package/src/trails/run.ts +31 -44
  37. package/src/trails/survey.ts +76 -62
  38. package/src/trails/topo-output-schemas.ts +11 -0
  39. package/src/trails/topo-pin.ts +6 -20
  40. package/src/trails/topo-read-support.ts +91 -41
  41. package/src/trails/topo-reports.ts +4 -2
  42. package/src/trails/topo-store-support.ts +172 -39
  43. package/src/trails/topo-support.ts +1 -2
  44. package/src/trails/topo.ts +5 -19
  45. package/src/trails/validate.ts +9 -20
  46. package/src/trails/version-lifecycle-support.ts +10 -20
  47. package/src/trails/warden.ts +18 -0
  48. package/src/trails/wayfind.ts +1001 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,194 @@
1
1
  # trails
2
2
 
3
+ ## 1.0.0-beta.29
4
+
5
+ ### Patch Changes
6
+
7
+ - 52425c5: Consolidate registry verdicts behind one shared `packageRegistry` classifier.
8
+
9
+ `apps/trails/src/release` now derives every package's registry state — `complete`, `needs-publish`, `first-time-package`, `needs-tag-repair`, `tag-points-ahead`, `registry-inaccessible` — from a single `classifyPackageRegistryState` function, fed by an exact-version probe (`npm view <name>@<version>`). The release policy engine and the registry preflight both consume it, so their verdicts can no longer drift, and the missing "is the target version actually published" fact is now first-class.
10
+
11
+ The preflight check is phase-aware: `publish:registry-check` (ready) treats an unpublished target or a behind dist-tag as expected pre-publish work rather than a failure, while `publish:registry-check:published` still requires every package to be fully published and tagged. This fixes the confusing failure seen when the repo is several releases ahead of the published `beta` tag. Exact-version probes run with bounded concurrency so release checks stay responsive. No publish or dist-tag mutation is performed.
12
+
13
+ - @ontrails/commander@1.0.0-beta.29
14
+ - @ontrails/adapter-kit@1.0.0-beta.29
15
+ - @ontrails/cli@1.0.0-beta.29
16
+ - @ontrails/config@1.0.0-beta.29
17
+ - @ontrails/core@1.0.0-beta.29
18
+ - @ontrails/http@1.0.0-beta.29
19
+ - @ontrails/mcp@1.0.0-beta.29
20
+ - @ontrails/observe@1.0.0-beta.29
21
+ - @ontrails/permits@1.0.0-beta.29
22
+ - @ontrails/regrade@1.0.0-beta.29
23
+ - @ontrails/topographer@1.0.0-beta.29
24
+ - @ontrails/tracing@1.0.0-beta.29
25
+ - @ontrails/warden@1.0.0-beta.29
26
+ - @ontrails/wayfinder@1.0.0-beta.29
27
+
28
+ ## 1.0.0-beta.28
29
+
30
+ ### Patch Changes
31
+
32
+ - 9d679cf: Make generated release publish policy gather CI proof only for `publish:auto`, reuse generated release PR head proof when it matches the released tree, tolerate duplicate pending checks after a required check has passed, and log registry readiness separately from publish authorization.
33
+ - 32dc2f3: Let generated release PR labeling treat trusted Graphite merge-queue proof with green required CI as source stack evidence for `publish:auto`, alongside explicit `stack:boundary` labels.
34
+ - @ontrails/commander@1.0.0-beta.28
35
+ - @ontrails/adapter-kit@1.0.0-beta.28
36
+ - @ontrails/cli@1.0.0-beta.28
37
+ - @ontrails/config@1.0.0-beta.28
38
+ - @ontrails/core@1.0.0-beta.28
39
+ - @ontrails/http@1.0.0-beta.28
40
+ - @ontrails/mcp@1.0.0-beta.28
41
+ - @ontrails/observe@1.0.0-beta.28
42
+ - @ontrails/permits@1.0.0-beta.28
43
+ - @ontrails/regrade@1.0.0-beta.28
44
+ - @ontrails/topographer@1.0.0-beta.28
45
+ - @ontrails/tracing@1.0.0-beta.28
46
+ - @ontrails/warden@1.0.0-beta.28
47
+ - @ontrails/wayfinder@1.0.0-beta.28
48
+
49
+ ## 1.0.0-beta.27
50
+
51
+ ### Patch Changes
52
+
53
+ - a4727ec: Sync Bun lockfile workspace metadata during package versioning so generated release PRs cannot carry stale first-party package versions.
54
+ - @ontrails/commander@1.0.0-beta.27
55
+ - @ontrails/adapter-kit@1.0.0-beta.27
56
+ - @ontrails/cli@1.0.0-beta.27
57
+ - @ontrails/config@1.0.0-beta.27
58
+ - @ontrails/core@1.0.0-beta.27
59
+ - @ontrails/http@1.0.0-beta.27
60
+ - @ontrails/mcp@1.0.0-beta.27
61
+ - @ontrails/observe@1.0.0-beta.27
62
+ - @ontrails/permits@1.0.0-beta.27
63
+ - @ontrails/regrade@1.0.0-beta.27
64
+ - @ontrails/topographer@1.0.0-beta.27
65
+ - @ontrails/tracing@1.0.0-beta.27
66
+ - @ontrails/warden@1.0.0-beta.27
67
+ - @ontrails/wayfinder@1.0.0-beta.27
68
+
69
+ ## 1.0.0-beta.26
70
+
71
+ ### Patch Changes
72
+
73
+ - 40cd7b4: Add a release-pack coherence guard that runs packed package validation for generated release branches and package release metadata changes.
74
+ - 1307568: Centralize Trails config module path conventions, move local config overrides to root `trails.config.local.*`, scaffold the matching gitignore entries, and load project-local Warden rules from `.trails/rules.ts` or `.trails/rules/`.
75
+ - 0fe873a: Normalize generated project guidance and scaffold ignores around the root `trails.lock` and committed `.trails/` control model.
76
+ - 38cd9d6: Add a shared Trails config file loader that treats `trails.config.ts` as the natural primary while supporting JSON, JSONC, YAML, and TOML peer formats. Release and Warden config loading now consume the same loader and local overrides can be authored as data files.
77
+ - f8403c4: Collapse normal topo compilation onto one root `trails.lock` envelope that embeds the TopoGraph, hash, and summary while keeping legacy `.trails/trails.lock` plus `.trails/topo.lock` readers for migration compatibility.
78
+ - 371d19e: Move the default `trails.db` location to the per-user Trails state store, expose deterministic state-store path helpers, stop scaffolding disposable `.trails/cache` and `.trails/state` directories, and update topo-store documentation for the global-state substrate.
79
+ - Updated dependencies [4e75b85]
80
+ - Updated dependencies [1307568]
81
+ - Updated dependencies [ef09e46]
82
+ - Updated dependencies [38cd9d6]
83
+ - Updated dependencies [f8403c4]
84
+ - Updated dependencies [371d19e]
85
+ - Updated dependencies [ff48e41]
86
+ - @ontrails/regrade@1.0.0-beta.26
87
+ - @ontrails/config@1.0.0-beta.26
88
+ - @ontrails/core@1.0.0-beta.26
89
+ - @ontrails/warden@1.0.0-beta.26
90
+ - @ontrails/topographer@1.0.0-beta.26
91
+ - @ontrails/wayfinder@1.0.0-beta.26
92
+ - @ontrails/tracing@1.0.0-beta.26
93
+ - @ontrails/commander@1.0.0-beta.26
94
+ - @ontrails/adapter-kit@1.0.0-beta.26
95
+ - @ontrails/cli@1.0.0-beta.26
96
+ - @ontrails/http@1.0.0-beta.26
97
+ - @ontrails/mcp@1.0.0-beta.26
98
+ - @ontrails/observe@1.0.0-beta.26
99
+ - @ontrails/permits@1.0.0-beta.26
100
+
101
+ ## 1.0.0-beta.25
102
+
103
+ ### Minor Changes
104
+
105
+ - b9a7d8a: Add generated release PR policy automation with managed publish/channel/release
106
+ labels, stack-boundary source evidence, and inverse active-changeset release
107
+ fact validation.
108
+
109
+ ### Patch Changes
110
+
111
+ - 578731d: `trails doctor` now returns the underlying validation error when the app topo is invalid, instead of crashing with a redacted "Internal server error". The diagnostic command reports the diagnosis: validation failures surface with their category, message, and (with the commander detail rendering) the issue list.
112
+ - c5258ea: Fix the scaffolded AGENTS.md layer guidance to say "cross-cutting trail wrapping" — the cross→compose vocabulary cutover had renamed the standard English collocation, so every generated app shipped the nonsense phrase "compose-cutting".
113
+ - b991263: Retire the package-owned `regrade.downstream.report` trail wrapper so the Trails operator app owns the public Regrade surface while `@ontrails/regrade` exposes the reusable engine APIs and report schema.
114
+ - c75c6cc: Collapse the duplicate `diff` trail into the canonical `survey.diff` contract while keeping `trails diff` available as a CLI route alias.
115
+ - 7b7cd6a: Centralize the Trails operator root-directory and fresh-app lease preamble so topo-reading commands share the same load/release flow.
116
+ - c36aca9: Preserve existing Result error boundaries directly and widen Warden pass-through
117
+ coaching beyond trail blazes.
118
+ - c1bc0d3: Add the `wayfind.outline` source-navigation trail and expose it through the Trails CLI and MCP surfaces.
119
+ - 0d213b1: Enrich compact `wayfind outline --review` text with existing trail intent, schema, and example-count facts when saved graph artifacts are available.
120
+ - dbf4ff4: Emit structured CLI error envelopes for JSON/JSONL command failures and map compile-time Trails DB lock contention to a retryable timeout instead of a generic internal error.
121
+ - 8e1c2ff: Wire adapter and error fact selection into the unified `trails wayfind` command.
122
+ - da39b89: Add the unified `trails wayfind` navigation command over targets, filters, and
123
+ views, and remove the old `wayfind find` search alias during the v1 Wayfinder
124
+ surface cutover.
125
+ - 2059666: Add relational `trails wayfind` flags for downstream, upstream, and nearby graph navigation.
126
+ - 2c08afe: Expose MCP trail graph fact resources and enable them for the Trails operator MCP surface.
127
+ - 4b538d1: Start the `trails wayfind --source live` cutover by routing live overview and ID lookup through the fresh app survey path.
128
+ - dd98701: Update CLI and agent guidance to teach the unified Wayfinder navigation surface and live-source bridge.
129
+ - f1e6efa: Expand the Wayfinder dogfood smoke to exercise the unified navigation command shape.
130
+ - 60fa8f5: Expose the saved graph diff as a distinct `wayfind diff` CLI command and MCP tool.
131
+ - a8e4dc3: Clean up the Wayfinder navigation grammar before RC, including explicit pattern/query/file selectors, target-bound dependency and impact flags, drift-first provenance fields, stricter fires declaration diagnostics, and updated operator dogfood coverage.
132
+ - a528239: Keep Wayfinder artifact drift aligned with rejected and force-annotated topo compiles.
133
+ - de79459: Expand Wayfinder dogfood smoke coverage across demo graph facts, relation views, and artifact provenance failures.
134
+ - f757cd7: Publish Regrade's downstream report and AST rewrite APIs, and expose a dry-run
135
+ by default `trails regrade` operator command with explicit apply mode.
136
+ - 9bcf34e: Add trail-owned CLI command projection metadata and serialize resolved command
137
+ route facts for downstream tools.
138
+ - f7d97fc: Expose resolved CLI command routes through schema helpers, the Trails operator
139
+ schema command, and Wayfinder trail contract output.
140
+ - 59d10da: Dogfood CLI command route aliases through the Trails operator, saved Topographer artifacts, and Wayfinder contract inspection.
141
+ - df13faf: Tighten Wayfinder navigation review findings: carry adapter filters into included adapter facts, keep live-source outline off the operator MCP surface until host-root binding exists, make unknown MCP resources protocol errors, route secondary Wayfinder graph populations through unified flags, and keep undeclared string `ctx.compose()` calls as Warden errors.
142
+ - Updated dependencies [60caabf]
143
+ - Updated dependencies [a9fdbc7]
144
+ - Updated dependencies [f8fd6ca]
145
+ - Updated dependencies [b991263]
146
+ - Updated dependencies [0fcc42b]
147
+ - Updated dependencies [c36aca9]
148
+ - Updated dependencies [c1bc0d3]
149
+ - Updated dependencies [f556559]
150
+ - Updated dependencies [75417bb]
151
+ - Updated dependencies [6250729]
152
+ - Updated dependencies [d73c38e]
153
+ - Updated dependencies [3befcf1]
154
+ - Updated dependencies [dbf4ff4]
155
+ - Updated dependencies [14dc577]
156
+ - Updated dependencies [4f48166]
157
+ - Updated dependencies [2d9e73a]
158
+ - Updated dependencies [da39b89]
159
+ - Updated dependencies [2c08afe]
160
+ - Updated dependencies [f1e6efa]
161
+ - Updated dependencies [f1e6efa]
162
+ - Updated dependencies [f1e6efa]
163
+ - Updated dependencies [a8e4dc3]
164
+ - Updated dependencies [a528239]
165
+ - Updated dependencies [f757cd7]
166
+ - Updated dependencies [a4f9cf6]
167
+ - Updated dependencies [9bcf34e]
168
+ - Updated dependencies [1d3ae74]
169
+ - Updated dependencies [f7d97fc]
170
+ - Updated dependencies [00c0cf8]
171
+ - Updated dependencies [59d10da]
172
+ - Updated dependencies [b313c58]
173
+ - Updated dependencies [f245fa0]
174
+ - Updated dependencies [d9c6e50]
175
+ - Updated dependencies [f1e6efa]
176
+ - Updated dependencies [caff950]
177
+ - Updated dependencies [df13faf]
178
+ - @ontrails/commander@1.0.0-beta.25
179
+ - @ontrails/mcp@1.0.0-beta.25
180
+ - @ontrails/warden@1.0.0-beta.25
181
+ - @ontrails/regrade@1.0.0-beta.25
182
+ - @ontrails/core@1.0.0-beta.25
183
+ - @ontrails/http@1.0.0-beta.25
184
+ - @ontrails/topographer@1.0.0-beta.25
185
+ - @ontrails/wayfinder@1.0.0-beta.25
186
+ - @ontrails/cli@1.0.0-beta.25
187
+ - @ontrails/adapter-kit@1.0.0-beta.25
188
+ - @ontrails/observe@1.0.0-beta.25
189
+ - @ontrails/permits@1.0.0-beta.25
190
+ - @ontrails/tracing@1.0.0-beta.25
191
+
3
192
  ## 1.0.0-beta.24
4
193
 
5
194
  ### Patch Changes
package/README.md CHANGED
@@ -13,12 +13,13 @@ Common workflows:
13
13
  - `trails create` starts a new Trails project with generated trail, topo, surface, and verification files.
14
14
  - `trails add surface` adds another surface entrypoint to an existing project.
15
15
  - `trails topo` inspects topo state and manages pins/history.
16
- - `trails compile` writes committed topo artifacts.
17
- - `trails validate` checks committed topo artifacts for drift.
18
- - `trails wayfind overview` and adjacent `trails wayfind ...` commands read
19
- saved topo artifacts through Wayfinder for local graph navigation.
16
+ - `trails compile` writes root `trails.lock`.
17
+ - `trails validate` checks root `trails.lock` for drift.
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
20
  - `trails warden` runs Trails governance checks for contract and architecture drift.
21
- - `trails guide` shows available trails and examples from a project.
21
+ - `trails regrade --root-dir <path> --json` dry-runs downstream migration checks; add `--apply` only to write safe rewrites.
22
+ - `trails guide` remains available for compatibility; prefer `trails wayfind --source live --module <app-module>` or saved-artifact Wayfinder reads for agent navigation.
22
23
 
23
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.
24
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ontrails/trails",
3
- "version": "1.0.0-beta.24",
3
+ "version": "1.0.0-beta.29",
4
4
  "bin": {
5
5
  "trails": "./bin/trails.ts"
6
6
  },
@@ -27,23 +27,25 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@clack/prompts": "^1.1.0",
30
- "@ontrails/adapter-kit": "^1.0.0-beta.24",
31
- "@ontrails/cli": "^1.0.0-beta.24",
32
- "@ontrails/commander": "^1.0.0-beta.24",
33
- "@ontrails/core": "^1.0.0-beta.24",
34
- "@ontrails/http": "^1.0.0-beta.24",
35
- "@ontrails/mcp": "^1.0.0-beta.24",
36
- "@ontrails/observe": "^1.0.0-beta.24",
37
- "@ontrails/permits": "^1.0.0-beta.24",
38
- "@ontrails/topographer": "^1.0.0-beta.24",
39
- "@ontrails/tracing": "^1.0.0-beta.24",
40
- "@ontrails/warden": "^1.0.0-beta.24",
41
- "@ontrails/wayfinder": "^1.0.0-beta.24",
30
+ "@ontrails/adapter-kit": "^1.0.0-beta.29",
31
+ "@ontrails/cli": "^1.0.0-beta.29",
32
+ "@ontrails/commander": "^1.0.0-beta.29",
33
+ "@ontrails/config": "^1.0.0-beta.29",
34
+ "@ontrails/core": "^1.0.0-beta.29",
35
+ "@ontrails/http": "^1.0.0-beta.29",
36
+ "@ontrails/mcp": "^1.0.0-beta.29",
37
+ "@ontrails/observe": "^1.0.0-beta.29",
38
+ "@ontrails/permits": "^1.0.0-beta.29",
39
+ "@ontrails/regrade": "^1.0.0-beta.29",
40
+ "@ontrails/topographer": "^1.0.0-beta.29",
41
+ "@ontrails/tracing": "^1.0.0-beta.29",
42
+ "@ontrails/warden": "^1.0.0-beta.29",
43
+ "@ontrails/wayfinder": "^1.0.0-beta.29",
42
44
  "commander": "^14.0.3",
43
45
  "typescript": "^5.9.3",
44
46
  "zod": "^4.3.5"
45
47
  },
46
48
  "devDependencies": {
47
- "@ontrails/testing": "^1.0.0-beta.24"
49
+ "@ontrails/testing": "^1.0.0-beta.29"
48
50
  }
49
51
  }
package/src/app.ts CHANGED
@@ -1,15 +1,23 @@
1
1
  import { topo } from '@ontrails/core';
2
2
  import {
3
3
  wayfindAdaptersTrail,
4
+ wayfindContoursTrail,
4
5
  wayfindContractTrail,
5
6
  wayfindDescribeTrail,
7
+ wayfindDiffTrail,
6
8
  wayfindErrorsTrail,
7
9
  wayfindExamplesTrail,
10
+ wayfindFacetsTrail,
8
11
  wayfindImpactTrail,
9
12
  wayfindNearbyTrail,
10
13
  wayfindOverviewTrail,
14
+ wayfindOutlineTrail,
15
+ wayfindResourcesTrail,
11
16
  wayfindSearchTrail,
17
+ wayfindSignalsTrail,
18
+ wayfindSurfacesTrail,
12
19
  wayfindTrailsTrail,
20
+ wayfindVersionsTrail,
13
21
  } from '@ontrails/wayfinder';
14
22
 
15
23
  import * as addSurface from './trails/add-surface.js';
@@ -30,6 +38,7 @@ import * as devStats from './trails/dev-stats.js';
30
38
  import * as doctor from './trails/doctor.js';
31
39
  import * as draftPromote from './trails/draft-promote.js';
32
40
  import * as guide from './trails/guide.js';
41
+ import * as regrade from './trails/regrade.js';
33
42
  import * as releaseCheck from './trails/release-check.js';
34
43
  import * as releaseSmoke from './trails/release-smoke.js';
35
44
  import * as revise from './trails/revise.js';
@@ -44,6 +53,7 @@ import * as topoUnpin from './trails/topo-unpin.js';
44
53
  import * as validate from './trails/validate.js';
45
54
  import * as warden from './trails/warden.js';
46
55
  import * as wardenGuide from './trails/warden-guide.js';
56
+ import * as wayfind from './trails/wayfind.js';
47
57
 
48
58
  export const operatorApp = topo(
49
59
  'trails',
@@ -64,6 +74,7 @@ export const operatorApp = topo(
64
74
  devClean,
65
75
  devReset,
66
76
  guide,
77
+ regrade,
67
78
  releaseCheck,
68
79
  releaseSmoke,
69
80
  draftPromote,
@@ -85,22 +96,50 @@ const operatorTrails = Object.fromEntries(
85
96
  operatorApp.list().map((trailItem) => [trailItem.id, trailItem])
86
97
  );
87
98
 
88
- const cliWayfinderTrails = {
99
+ const cliWayfinderCommandTrails = {
100
+ wayfindDiffTrail,
101
+ wayfindFileTrail: wayfind.wayfindFileTrail,
102
+ wayfindPatternTrail: wayfind.wayfindPatternTrail,
103
+ wayfindQueryTrail: wayfind.wayfindQueryTrail,
104
+ wayfindTrail: wayfind.wayfindTrail,
105
+ };
106
+
107
+ const cliWayfinderSupportTrails = {
89
108
  wayfindAdaptersTrail,
109
+ wayfindContoursTrail,
90
110
  wayfindContractTrail,
91
111
  wayfindDescribeTrail,
92
112
  wayfindErrorsTrail,
93
113
  wayfindExamplesTrail,
114
+ wayfindFacetsTrail,
94
115
  wayfindImpactTrail,
95
116
  wayfindNearbyTrail,
117
+ wayfindOutlineTrail,
96
118
  wayfindOverviewTrail,
119
+ wayfindResourcesTrail,
97
120
  wayfindSearchTrail,
121
+ wayfindSignalsTrail,
122
+ wayfindSurfacesTrail,
98
123
  wayfindTrailsTrail,
124
+ wayfindVersionsTrail,
125
+ };
126
+
127
+ const cliWayfinderTrails = {
128
+ ...cliWayfinderCommandTrails,
129
+ ...cliWayfinderSupportTrails,
99
130
  };
100
131
 
101
132
  export const trailsCliIncludedTrails = [
102
- ...operatorApp.list().map((trailItem) => trailItem.id),
103
- ...Object.values(cliWayfinderTrails).map((trailItem) => trailItem.id),
133
+ ...new Set([
134
+ ...operatorApp.list().map((trailItem) => trailItem.id),
135
+ ...Object.values(cliWayfinderCommandTrails).map(
136
+ (trailItem) => trailItem.id
137
+ ),
138
+ ]),
104
139
  ];
105
140
 
141
+ export const trailsCliAliases = {
142
+ 'survey.diff': [['diff']],
143
+ } as const;
144
+
106
145
  export const app = topo('trails', operatorTrails, cliWayfinderTrails);
package/src/cli.ts CHANGED
@@ -5,6 +5,7 @@ import { isAbsolute, join, resolve } from 'node:path';
5
5
  import {
6
6
  defaultOnResult,
7
7
  devPermitPreset,
8
+ deriveCliCommands,
8
9
  outputModePreset,
9
10
  permitPreset,
10
11
  tokenPreset,
@@ -16,13 +17,15 @@ import type {
16
17
  ResolveCliPermitFromToken,
17
18
  } from '@ontrails/cli';
18
19
  import { createProgram } from '@ontrails/commander';
20
+ import type { CreateProgramOptions } from '@ontrails/commander';
19
21
  import { resolvePermitFromBearerToken } from '@ontrails/permits';
20
22
  import { deriveTopoGraph } from '@ontrails/topographer';
21
23
 
22
- import { app, trailsCliIncludedTrails } from './app.js';
24
+ import { app, trailsCliAliases, trailsCliIncludedTrails } from './app.js';
23
25
  import { resolveInputWithClack } from './clack.js';
24
26
  import { getRetiredTopoCommandDiagnostic } from './retired-topo-command.js';
25
27
  import { attachCompletionsInstallCommand } from './run-completions-install.js';
28
+ import { attachSchemaCommand } from './run-schema.js';
26
29
  import {
27
30
  applyAdapterCheckExitCode,
28
31
  tryAdapterCheckOutput,
@@ -49,6 +52,7 @@ import {
49
52
  runWatchLoop,
50
53
  } from './run-watch.js';
51
54
  import { tryWardenOutput } from './run-warden.js';
55
+ import { tryWayfindOutlineOutput } from './run-wayfind-outline.js';
52
56
  import { tryLoadFreshAppLease } from './trails/load-app.js';
53
57
  import { resolveRunModulePath } from './trails/run.js';
54
58
  import { resolveTrailRootDir } from './trails/root-dir.js';
@@ -97,6 +101,9 @@ const buildOnResult =
97
101
  if (tryReleaseCheckOutput(resolvedCtx)) {
98
102
  return;
99
103
  }
104
+ if (tryWayfindOutlineOutput(resolvedCtx)) {
105
+ return;
106
+ }
100
107
  await defaultOnResult(resolvedCtx);
101
108
  };
102
109
 
@@ -293,7 +300,8 @@ const runSurfaceOnce = async (): Promise<void> => {
293
300
 
294
301
  const session = maybeInstallTraceSession();
295
302
  try {
296
- const program = createProgram(app, {
303
+ const surfaceOptions = {
304
+ aliases: trailsCliAliases,
297
305
  description: 'Agent-native, contract-first TypeScript framework',
298
306
  include: trailsCliIncludedTrails,
299
307
  name: 'trails',
@@ -309,7 +317,13 @@ const runSurfaceOnce = async (): Promise<void> => {
309
317
  resolveInput: resolveInputWithClack,
310
318
  resolvePermitFromToken: resolveCliPermitFromToken,
311
319
  version: trailsPackageVersion,
312
- });
320
+ } satisfies CreateProgramOptions;
321
+ const program = createProgram(app, surfaceOptions);
322
+ const schemaCommands = deriveCliCommands(app, surfaceOptions);
323
+ if (schemaCommands.isErr()) {
324
+ throw schemaCommands.error;
325
+ }
326
+ attachSchemaCommand(program, schemaCommands.value);
313
327
  attachCompletionsInstallCommand(program);
314
328
  await program.parseAsync(normalizeWardenArgv(process.argv));
315
329
  } finally {
@@ -151,3 +151,23 @@ export const removeRootRelativeFileIfPresent = (
151
151
  );
152
152
  }
153
153
  };
154
+
155
+ export const removeFileIfPresent = (
156
+ path: string
157
+ ): TrailsResult<boolean, Error> => {
158
+ if (!existsSync(path)) {
159
+ return Result.ok(false);
160
+ }
161
+
162
+ try {
163
+ rmSync(path, { force: true });
164
+ return Result.ok(true);
165
+ } catch (error) {
166
+ return Result.err(
167
+ new InternalError(`Failed to remove local state file "${path}"`, {
168
+ cause: asError(error),
169
+ context: { path },
170
+ })
171
+ );
172
+ }
173
+ };
package/src/mcp-app.ts CHANGED
@@ -2,12 +2,17 @@ import { topo } from '@ontrails/core';
2
2
  import {
3
3
  wayfindAdaptersTrail,
4
4
  wayfindContractTrail,
5
+ wayfindDescribeTrail,
6
+ wayfindDiffTrail,
5
7
  wayfindErrorsTrail,
6
8
  wayfindExamplesTrail,
7
9
  wayfindImpactTrail,
8
10
  wayfindNearbyTrail,
9
11
  wayfindOverviewTrail,
12
+ wayfindOutlineTrail,
13
+ wayfindResourcesTrail,
10
14
  wayfindSearchTrail,
15
+ wayfindSurfacesTrail,
11
16
  wayfindTrailsTrail,
12
17
  } from '@ontrails/wayfinder';
13
18
 
@@ -20,11 +25,16 @@ const operatorTrails = Object.fromEntries(
20
25
  export const trailsMcpApp = topo('trails', operatorTrails, {
21
26
  wayfindAdaptersTrail,
22
27
  wayfindContractTrail,
28
+ wayfindDescribeTrail,
29
+ wayfindDiffTrail,
23
30
  wayfindErrorsTrail,
24
31
  wayfindExamplesTrail,
25
32
  wayfindImpactTrail,
26
33
  wayfindNearbyTrail,
34
+ wayfindOutlineTrail,
27
35
  wayfindOverviewTrail,
36
+ wayfindResourcesTrail,
28
37
  wayfindSearchTrail,
38
+ wayfindSurfacesTrail,
29
39
  wayfindTrailsTrail,
30
40
  });
@@ -11,7 +11,6 @@ export const trailsMcpIncludedTrails = [
11
11
  'dev.clean',
12
12
  'dev.reset',
13
13
  'dev.stats',
14
- 'diff',
15
14
  'doctor',
16
15
  'draft.promote',
17
16
  'guide',
@@ -37,6 +36,7 @@ export const trailsMcpIncludedTrails = [
37
36
  'warden.guide',
38
37
  'wayfind.adapters',
39
38
  'wayfind.contract',
39
+ 'wayfind.diff',
40
40
  'wayfind.errors',
41
41
  'wayfind.examples',
42
42
  'wayfind.impact',
@@ -53,7 +53,6 @@ export const trailsMcpFacets = {
53
53
  mcp: { loading: 'deferred' },
54
54
  trails: [
55
55
  'survey',
56
- 'diff',
57
56
  'topo',
58
57
  'guide',
59
58
  'survey.brief',
@@ -72,6 +71,6 @@ export const trailsMcpSurfaceOptions = {
72
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.',
73
72
  facets: trailsMcpFacets,
74
73
  include: trailsMcpIncludedTrails,
75
- mcpResources: { examples: true, surfaceMap: true },
74
+ mcpResources: { examples: true, graph: true, surfaceMap: true },
76
75
  name: 'trails',
77
76
  } satisfies CreateServerOptions;
@@ -151,12 +151,12 @@ export const renameContainedProjectPath = (
151
151
  ): TrailsResult<void, Error> => {
152
152
  const from = resolveProjectPath(projectDir, fromPath);
153
153
  if (from.isErr()) {
154
- return Result.err(from.error);
154
+ return from;
155
155
  }
156
156
 
157
157
  const to = resolveProjectPath(projectDir, toPath);
158
158
  if (to.isErr()) {
159
- return Result.err(to.error);
159
+ return to;
160
160
  }
161
161
 
162
162
  try {
@@ -238,7 +238,7 @@ const shouldApplyProjectOperation = (
238
238
  const { path } = operation;
239
239
  const target = resolveProjectPath(projectDir, path);
240
240
  if (target.isErr()) {
241
- return Result.err(target.error);
241
+ return target;
242
242
  }
243
243
 
244
244
  return Result.ok(!existsSync(target.value));
@@ -257,7 +257,7 @@ const selectProjectOperations = (
257
257
  options
258
258
  );
259
259
  if (shouldApply.isErr()) {
260
- return Result.err(shouldApply.error);
260
+ return shouldApply;
261
261
  }
262
262
  if (shouldApply.value) {
263
263
  selected.push(operation);
@@ -274,14 +274,14 @@ export const planProjectOperations = (
274
274
  ): TrailsResult<PlannedProjectOperation[], Error> => {
275
275
  const selected = selectProjectOperations(projectDir, operations, options);
276
276
  if (selected.isErr()) {
277
- return Result.err(selected.error);
277
+ return selected;
278
278
  }
279
279
 
280
280
  const planned: PlannedProjectOperation[] = [];
281
281
  for (const operation of selected.value) {
282
282
  const result = planProjectOperation(projectDir, operation);
283
283
  if (result.isErr()) {
284
- return Result.err(result.error);
284
+ return result;
285
285
  }
286
286
  planned.push(result.value);
287
287
  }
@@ -296,7 +296,7 @@ const applyProjectOperation = async (
296
296
  case 'mkdir': {
297
297
  const target = resolveProjectPath(projectDir, operation.path);
298
298
  if (target.isErr()) {
299
- return Result.err(target.error);
299
+ return target;
300
300
  }
301
301
  try {
302
302
  mkdirSync(target.value, { recursive: true });
@@ -323,7 +323,7 @@ const applyProjectOperation = async (
323
323
  case 'write': {
324
324
  const target = resolveProjectPath(projectDir, operation.path);
325
325
  if (target.isErr()) {
326
- return Result.err(target.error);
326
+ return target;
327
327
  }
328
328
  try {
329
329
  mkdirSync(dirname(target.value), { recursive: true });
@@ -358,18 +358,18 @@ export const applyProjectOperations = async (
358
358
  ): Promise<TrailsResult<PlannedProjectOperation[], Error>> => {
359
359
  const selected = selectProjectOperations(projectDir, operations, options);
360
360
  if (selected.isErr()) {
361
- return Result.err(selected.error);
361
+ return selected;
362
362
  }
363
363
 
364
364
  const planned = planProjectOperations(projectDir, selected.value);
365
365
  if (planned.isErr()) {
366
- return Result.err(planned.error);
366
+ return planned;
367
367
  }
368
368
 
369
369
  for (const operation of selected.value) {
370
370
  const applied = await applyProjectOperation(projectDir, operation);
371
371
  if (applied.isErr()) {
372
- return Result.err(applied.error);
372
+ return applied;
373
373
  }
374
374
  }
375
375