@ontrails/warden 1.0.0-beta.42 → 1.0.0-beta.45

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 (36) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/package.json +15 -10
  3. package/src/adapter-check.ts +1 -1
  4. package/src/cli.ts +81 -5
  5. package/src/index.ts +17 -4
  6. package/src/regrade-history.ts +599 -0
  7. package/src/rules/cli-command-route-coherence.ts +6 -6
  8. package/src/rules/draft-visible-debt.ts +1 -1
  9. package/src/rules/duplicate-exported-symbol.ts +4 -43
  10. package/src/rules/governed-symbol-residue.ts +146 -53
  11. package/src/rules/governed-vocabulary-permutation-watch.ts +76 -0
  12. package/src/rules/implementation-returns-result.ts +99 -9
  13. package/src/rules/index.ts +17 -6
  14. package/src/rules/layer-field-name-drift.ts +2 -2
  15. package/src/rules/{library-projection-coherence.ts → library-render-coherence.ts} +11 -14
  16. package/src/rules/metadata.ts +51 -14
  17. package/src/rules/no-redundant-result-error-wrap.ts +15 -17
  18. package/src/rules/no-retired-cross-vocabulary.ts +0 -1
  19. package/src/rules/{owner-projection-parity.ts → owner-render-parity.ts} +18 -18
  20. package/src/rules/public-internal-deep-imports.ts +1 -3
  21. package/src/rules/public-output-schema.ts +1 -1
  22. package/src/rules/registry-names.ts +6 -4
  23. package/src/rules/retired-vocabulary.ts +775 -41
  24. package/src/rules/surface-overlay-coherence.ts +1 -1
  25. package/src/rules/trail-versioning-source.ts +1 -1
  26. package/src/rules/trailhead-override-divergence.ts +4 -4
  27. package/src/rules/types.ts +51 -5
  28. package/src/trails/governed-vocabulary-permutation-watch.trail.ts +16 -0
  29. package/src/trails/index.ts +3 -2
  30. package/src/trails/layer-field-name-drift.trail.ts +1 -1
  31. package/src/trails/{library-projection-coherence.trail.ts → library-render-coherence.trail.ts} +6 -6
  32. package/src/trails/{owner-projection-parity.trail.ts → owner-render-parity.trail.ts} +4 -4
  33. package/src/trails/public-output-schema.trail.ts +1 -1
  34. package/src/trails/run.ts +44 -2
  35. package/src/trails/schema.ts +41 -0
  36. package/src/trails/wrap-rule.ts +44 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,74 @@
1
1
  # @ontrails/warden
2
2
 
3
+ ## 1.0.0-beta.45
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f1bd093`](https://github.com/outfitter-dev/trails/commit/f1bd09395fcf81db0bcb8657030288877c2e26e6): Recognize conditional, aliased, and parenthesized Result provenance while invalidating provenance after reassignment across the implementation-return and redundant-error-wrap rules.
8
+
9
+ ## 1.0.0-beta.44
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b1fbe57`](https://github.com/outfitter-dev/trails/commit/b1fbe574e6f44d1fecb5e3a000270955c0a77b7b): Publish Bun-validated package tarballs through an npm trusted-publishing adapter
14
+ binding, add exact repository metadata for each public workspace package, and
15
+ correct the native Bun release descriptor to its pack-only runtime boundary.
16
+
17
+ ## 1.0.0-beta.43
18
+
19
+ ### Minor Changes
20
+
21
+ - [`4fb20a6`](https://github.com/outfitter-dev/trails/commit/4fb20a68e1ed98972d99fed8b2df96bfa6804bd3): Derive deterministic, provenance-bearing vocabulary plan proposals from a minimal `from`/`to` seed, including morphology, public and compound identifier review, filename and reference-closure candidates, namespace census, and validated live-topo API preserves. Classified governed transitions retain their registry identity while routing every governed form to review instead of inventing a single safe successor.
22
+ - [`8fde0a6`](https://github.com/outfitter-dev/trails/commit/8fde0a6c66a7f64f0c27909df7db2731fa4b10f4): Add an advisory project-static rule that reports unknown governed vocabulary permutations from the latest committed Regrade history until they are classified.
23
+ - [`d3215b0`](https://github.com/outfitter-dev/trails/commit/d3215b0966f13af2a72ece9adbcc2c68c70f81b6): Add governed file renames to vocabulary Regrade plans, with move-first derived reference closure and persisted policy-aware evidence across CLI and MCP.
24
+ - [`5a7d22a`](https://github.com/outfitter-dev/trails/commit/5a7d22ab9d674f86b28758f23c3e94a17efb5be1): Add three-tier vocabulary migration scope. Protected historical paths remain
25
+ scanned and counted as `historical-by-policy` without being rewritten, while
26
+ reports expose scope-tier totals and census-expected teaching-surface coverage
27
+ through equivalent CLI and MCP plan schemas. Applied vocabulary occurrences
28
+ remain auditable in history with an `applied` verdict, while policy-only
29
+ evidence does not make an active plan stale merely by being recorded.
30
+ - [`88a6a62`](https://github.com/outfitter-dev/trails/commit/88a6a62a9e9e230ca6d368fa78dc3ece6c816204): Complete the v1 classification-first cutover from projection/project vocabulary
31
+ to derive/derived for contract-owned fact production and render/rendered for
32
+ surface presentation. Public type, helper, rule, relation, and report names move
33
+ without compatibility aliases; ordinary repository/project nouns remain
34
+ explicit preserves or structured review inventory.
35
+ - [`bd1bd96`](https://github.com/outfitter-dev/trails/commit/bd1bd96b90cd8b55f73061e4078a14cd75bed745): Require committed Regrade provenance for governed vocabulary transitions.
36
+
37
+ Applied governed plans now expose deterministic transition, plan, source,
38
+ safe-apply, and review-follow-up evidence through history results. Warden loads
39
+ committed history into project context, cites it for reintroduced symbols, and
40
+ rejects invalid or missing provenance for transitions that require Regrade in
41
+ the workspace that owns the governed registry, without making downstream apps
42
+ prove the framework's own migrations.
43
+ Portable validation accepts the authoritative numeric file-rename counters
44
+ persisted by Regrade history.
45
+
46
+ ### Patch Changes
47
+
48
+ - [`53014a4`](https://github.com/outfitter-dev/trails/commit/53014a4593170edd5adfbaa2c94c895c67a320d1): Exclude immutable Regrade history artifacts from downstream migration source scans while preserving active plan and other policy-classified evidence. Warden continues to validate committed history through its dedicated provenance loader.
49
+ - [`9f0842e`](https://github.com/outfitter-dev/trails/commit/9f0842ee9d7c7155d86a4fd023760ac0a5636f5d): Retire the temporary root vocabulary-cutover toolchain now that Regrade owns
50
+ structured migration plans, safe rewrites, classification, census, CLI/MCP
51
+ reports, and immutable history. Remove the obsolete source exemptions so
52
+ Oxlint and Warden enforce the durable transition contract directly, and add a
53
+ history-driven Regrade audit surface for current-tree regression checks.
54
+ - [`9f0842e`](https://github.com/outfitter-dev/trails/commit/9f0842ee9d7c7155d86a4fd023760ac0a5636f5d): Allow source rules to opt into documentation and text-file scanning so durable repository vocabulary guards cover every declared source kind.
55
+ - [`113aed6`](https://github.com/outfitter-dev/trails/commit/113aed62d20041e35b0cf9d6c1b1a18df4b88f57): Rename the dependency-light observability owner from `@ontrails/observe` to
56
+ `@ontrails/observability` as a pre-v1 hard cut. Update dependent packages,
57
+ documentation, package discovery, and the governed Regrade route; no
58
+ compatibility package or old import route is retained.
59
+ - [`0938e7b`](https://github.com/outfitter-dev/trails/commit/0938e7badc0c5470d194139d642b673658d099e0): Fold the removed `@ontrails/tracing` package into the truthful existing
60
+ owners: intrinsic trace contracts remain in core, developer-state tooling now
61
+ lives at `@ontrails/observability/dev`, and the dependency-light OTel adapter
62
+ lives at `@ontrails/observability/otel`. There is intentionally no root-package
63
+ compatibility redirect because the former root had more than one owner.
64
+ - [`50e2779`](https://github.com/outfitter-dev/trails/commit/50e27796d074851bccd57d7df009db749757b457): Extract the real `@ontrails/logtape` and `@ontrails/pino` adapters from the
65
+ temporary observability subpaths. The new packages own their namesake foreign
66
+ dependencies and preserve Trails record metadata, levels, redaction boundaries,
67
+ and lifecycle behavior; the old subpaths are removed in the pre-v1 hard cut.
68
+
69
+ Add governed Regrade transitions for both exact import replacements and expose
70
+ the observability adapter target through the shared adapter readiness check.
71
+
3
72
  ## 1.0.0-beta.42
4
73
 
5
74
  ## 1.0.0-beta.41
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@ontrails/warden",
3
- "version": "1.0.0-beta.42",
3
+ "version": "1.0.0-beta.45",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/outfitter-dev/trails.git",
7
+ "directory": "packages/warden"
8
+ },
4
9
  "bin": {
5
10
  "warden": "./bin/warden.ts"
6
11
  },
@@ -27,20 +32,20 @@
27
32
  "clean": "rm -rf dist *.tsbuildinfo"
28
33
  },
29
34
  "dependencies": {
30
- "@ontrails/adapter-kit": "^1.0.0-beta.42",
31
- "@ontrails/cli": "^1.0.0-beta.42",
32
- "@ontrails/config": "^1.0.0-beta.42",
33
- "@ontrails/permits": "^1.0.0-beta.42",
34
- "@ontrails/source": "^1.0.0-beta.42",
35
- "@ontrails/store": "^1.0.0-beta.42",
35
+ "@ontrails/adapter-kit": "^1.0.0-beta.45",
36
+ "@ontrails/cli": "^1.0.0-beta.45",
37
+ "@ontrails/config": "^1.0.0-beta.45",
38
+ "@ontrails/permits": "^1.0.0-beta.45",
39
+ "@ontrails/source": "^1.0.0-beta.45",
40
+ "@ontrails/store": "^1.0.0-beta.45",
36
41
  "oxc-resolver": "11.19.1",
37
42
  "zod": "^4.3.5"
38
43
  },
39
44
  "devDependencies": {
40
- "@ontrails/testing": "^1.0.0-beta.42"
45
+ "@ontrails/testing": "^1.0.0-beta.45"
41
46
  },
42
47
  "peerDependencies": {
43
- "@ontrails/core": "^1.0.0-beta.42",
44
- "@ontrails/topography": "^1.0.0-beta.42"
48
+ "@ontrails/core": "^1.0.0-beta.45",
49
+ "@ontrails/topography": "^1.0.0-beta.45"
45
50
  }
46
51
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Warden projection for shared adapter readiness checks.
2
+ * Warden rendering for shared adapter readiness checks.
3
3
  *
4
4
  * Adapter facts stay in @ontrails/adapter-kit. Warden only maps those facts
5
5
  * into governance diagnostics and severity.
package/src/cli.ts CHANGED
@@ -39,6 +39,7 @@ import type { DriftResult } from './drift.js';
39
39
  import { checkDrift, staleDriftMessage } from './drift.js';
40
40
  import { loadProjectWardenRules } from './project-rules.js';
41
41
  import type { ProjectWardenRules } from './project-rules.js';
42
+ import { loadGovernedVocabularyHistory } from './regrade-history.js';
42
43
  import {
43
44
  collectProjectDocumentationImportResolutions,
44
45
  collectProjectExportedSymbolDefinitions,
@@ -332,21 +333,36 @@ const collectTextScanFiles = (dir: string): readonly string[] => [
332
333
  ...collectFilesMatching(dir, '**/*.zsh', true),
333
334
  ...collectFilesMatching(dir, '**/*.yml', true),
334
335
  ...collectFilesMatching(dir, '**/*.yaml', true),
336
+ ...collectFilesMatching(dir, 'plugin/**/*.json', true),
337
+ ...collectFilesMatching(dir, 'plugin/**/*.jsonc', true),
338
+ ...collectFilesMatching(dir, 'plugin/**/*.toml', true),
339
+ ...collectFilesMatching(dir, 'plugin/**/*.cjs', true),
340
+ ...collectFilesMatching(dir, 'plugin/**/*.mjs', true),
341
+ ...collectFilesMatching(dir, 'scripts/**/*.json', true),
342
+ ...collectFilesMatching(dir, 'scripts/**/*.jsonc', true),
343
+ ...collectFilesMatching(dir, 'scripts/**/*.toml', true),
344
+ ...collectFilesMatching(dir, 'scripts/**/*.cjs', true),
345
+ ...collectFilesMatching(dir, 'scripts/**/*.mjs', true),
335
346
  ...collectFilesMatching(dir, '**/package.json', true),
336
347
  ];
337
348
 
338
349
  const isDocumentationScanTarget = (match: string): boolean => {
339
- if (match === 'README.md') {
350
+ if (
351
+ match === 'AGENTS.md' ||
352
+ match === 'README.md' ||
353
+ /^(?:packages|adapters|apps)(?:\/[^/]+)*\/AGENTS\.md$/.test(match)
354
+ ) {
340
355
  return true;
341
356
  }
342
357
  if (/^(?:packages|adapters|apps)\/[^/]+\/README\.md$/.test(match)) {
343
358
  return true;
344
359
  }
345
360
  return (
346
- match.startsWith('docs/') &&
347
- !match.startsWith('docs/adr/') &&
348
- !match.startsWith('docs/migration/') &&
349
- !match.startsWith('docs/releases/') &&
361
+ (match.startsWith('plugin/') ||
362
+ (match.startsWith('docs/') &&
363
+ !match.startsWith('docs/adr/') &&
364
+ !match.startsWith('docs/migration/') &&
365
+ !match.startsWith('docs/releases/'))) &&
350
366
  match.endsWith('.md')
351
367
  );
352
368
  };
@@ -393,6 +409,9 @@ interface MutableProjectContext {
393
409
  string,
394
410
  readonly WardenExportedSymbolDefinition[]
395
411
  >;
412
+ governedVocabularyHistoryByTransitionId: ProjectContext['governedVocabularyHistoryByTransitionId'];
413
+ governedVocabularyHistoryIssues: ProjectContext['governedVocabularyHistoryIssues'];
414
+ governedVocabularyHistoryRequired: ProjectContext['governedVocabularyHistoryRequired'];
396
415
  documentedImportResolutionsByFile: Map<
397
416
  string,
398
417
  readonly WardenImportResolution[]
@@ -414,6 +433,9 @@ const createMutableProjectContext = (): MutableProjectContext => ({
414
433
  >(),
415
434
  entityReferencesByName: new Map<string, Set<string>>(),
416
435
  exportedSymbolDefinitionsByName: new Map(),
436
+ governedVocabularyHistoryByTransitionId: undefined,
437
+ governedVocabularyHistoryIssues: undefined,
438
+ governedVocabularyHistoryRequired: undefined,
417
439
  importResolutionsByFile: new Map<string, readonly WardenImportResolution[]>(),
418
440
  knownEntityIds: new Set<string>(),
419
441
  knownResourceIds: new Set<string>(),
@@ -471,6 +493,24 @@ const toProjectContext = (context: MutableProjectContext): ProjectContext => ({
471
493
  }
472
494
  : {}),
473
495
  composeTargetTrailIds: context.composeTargetTrailIds,
496
+ ...(context.governedVocabularyHistoryByTransitionId === undefined
497
+ ? {}
498
+ : {
499
+ governedVocabularyHistoryByTransitionId:
500
+ context.governedVocabularyHistoryByTransitionId,
501
+ }),
502
+ ...(context.governedVocabularyHistoryIssues === undefined
503
+ ? {}
504
+ : {
505
+ governedVocabularyHistoryIssues:
506
+ context.governedVocabularyHistoryIssues,
507
+ }),
508
+ ...(context.governedVocabularyHistoryRequired === undefined
509
+ ? {}
510
+ : {
511
+ governedVocabularyHistoryRequired:
512
+ context.governedVocabularyHistoryRequired,
513
+ }),
474
514
  knownEntityIds: context.knownEntityIds,
475
515
  knownResourceIds: context.knownResourceIds,
476
516
  knownSignalIds: context.knownSignalIds,
@@ -951,6 +991,10 @@ const buildProjectContext = (
951
991
  | undefined = undefined
952
992
  ): ProjectContext => {
953
993
  const context = createMutableProjectContext();
994
+ const governedHistory = loadGovernedVocabularyHistory(rootDir);
995
+ context.governedVocabularyHistoryByTransitionId =
996
+ governedHistory.byTransitionId;
997
+ context.governedVocabularyHistoryIssues = governedHistory.issues;
954
998
  context.authoredMcpSurfaceBindingSets = authoredMcpSurfaceBindingSets;
955
999
  const typeScriptSourceFiles = sourceFiles.filter(
956
1000
  (sourceFile) => sourceFile.kind === 'typescript'
@@ -961,6 +1005,8 @@ const buildProjectContext = (
961
1005
  context.publicWorkspaces = collectPublicWorkspaces(rootDir, {
962
1006
  exclude: scope.exclude,
963
1007
  });
1008
+ context.governedVocabularyHistoryRequired =
1009
+ context.publicWorkspaces.has('@ontrails/warden');
964
1010
 
965
1011
  if (appTopos.length > 0) {
966
1012
  for (const appTopo of appTopos) {
@@ -1095,6 +1141,25 @@ const isSelectedRule = (
1095
1141
  : ruleMatchesDepth(metadata, selector.depth);
1096
1142
  };
1097
1143
 
1144
+ const selectorIncludesProjectChecks = (
1145
+ selector: WardenRuleSelector
1146
+ ): boolean => {
1147
+ if (selector.tier !== undefined) {
1148
+ return selector.tier !== 'source-static';
1149
+ }
1150
+ return (
1151
+ selector.depth === undefined ||
1152
+ depthIncludesTier(selector.depth, 'project-static')
1153
+ );
1154
+ };
1155
+
1156
+ const isSelectedProjectRule = (
1157
+ rule: WardenRule,
1158
+ selector: WardenRuleSelector
1159
+ ): boolean =>
1160
+ selectorIncludesProjectChecks(selector) &&
1161
+ (selector.tier === 'project-static' || isSelectedRule(rule, selector));
1162
+
1098
1163
  const isSelectedTopoRule = (
1099
1164
  rule: TopoAwareWardenRule,
1100
1165
  selector: WardenRuleSelector
@@ -1182,10 +1247,20 @@ const lintSourceFiles = (
1182
1247
  ): readonly WardenDiagnostic[] => {
1183
1248
  const diagnostics: WardenDiagnostic[] = [];
1184
1249
  const rules = [...wardenRules.values(), ...extraSourceRules];
1250
+ for (const rule of rules) {
1251
+ if (
1252
+ isSelectedProjectRule(rule, selector) &&
1253
+ isProjectAwareRule(rule) &&
1254
+ rule.checkProject !== undefined
1255
+ ) {
1256
+ diagnostics.push(...rule.checkProject(context));
1257
+ }
1258
+ }
1185
1259
  for (const sourceFile of sourceFiles) {
1186
1260
  for (const rule of rules) {
1187
1261
  if (
1188
1262
  sourceFile.kind === 'text' &&
1263
+ !rule.sourceKinds?.includes('text') &&
1189
1264
  rule.name !== 'no-dev-permit-in-source' &&
1190
1265
  rule.name !== 'public-internal-deep-imports'
1191
1266
  ) {
@@ -1194,6 +1269,7 @@ const lintSourceFiles = (
1194
1269
 
1195
1270
  if (
1196
1271
  sourceFile.kind === 'documentation' &&
1272
+ !rule.sourceKinds?.includes('documentation') &&
1197
1273
  rule.name !== 'public-internal-deep-imports'
1198
1274
  ) {
1199
1275
  continue;
package/src/index.ts CHANGED
@@ -10,6 +10,9 @@
10
10
  // Rule types
11
11
  export type {
12
12
  BuiltinWardenRuleName,
13
+ GovernedVocabularyHistoryEvidence,
14
+ GovernedVocabularyHistoryFormObservation,
15
+ GovernedVocabularyHistoryIssue,
13
16
  ProjectAwareWardenRule,
14
17
  ProjectContext,
15
18
  TopoAwareWardenRule,
@@ -39,7 +42,10 @@ export {
39
42
  formatGovernedVocabularyTransitionGuide,
40
43
  getGovernedVocabularyTransition,
41
44
  governedVocabularyLiteralRenameSchema,
45
+ governedVocabularyFileRenameSchema,
46
+ governedVocabularyHistoryProvenanceSchema,
42
47
  governedVocabularyPreserveRuleSchema,
48
+ governedVocabularyProvenancePolicySchema,
43
49
  governedVocabularyRegistrySchema,
44
50
  governedVocabularyScopeSchema,
45
51
  governedVocabularySymbolRenameSchema,
@@ -62,7 +68,9 @@ export {
62
68
  } from './rules/index.js';
63
69
  export type {
64
70
  GovernedVocabularyLiteralRename,
71
+ GovernedVocabularyHistoryProvenance,
65
72
  GovernedVocabularyPreserveRule,
73
+ GovernedVocabularyProvenancePolicy,
66
74
  GovernedVocabularyScope,
67
75
  GovernedVocabularySymbolRename,
68
76
  GovernedVocabularyTarget,
@@ -148,7 +156,7 @@ export { checkDrift } from './drift.js';
148
156
  export type { ProjectWardenRules } from './project-rules.js';
149
157
  export { loadProjectWardenRules } from './project-rules.js';
150
158
 
151
- // Guide projection
159
+ // Guide rendering
152
160
  export type {
153
161
  WardenGuideFormat,
154
162
  WardenGuideManifest,
@@ -187,7 +195,11 @@ export {
187
195
 
188
196
  // Trail layer
189
197
  export { wardenTopo } from './trails/topo.js';
190
- export { runTopoAwareWardenTrails, runWardenTrails } from './trails/run.js';
198
+ export {
199
+ runProjectWardenRules,
200
+ runTopoAwareWardenTrails,
201
+ runWardenTrails,
202
+ } from './trails/run.js';
191
203
  export {
192
204
  activationOrphanTrail,
193
205
  capturedKernelTrail,
@@ -209,12 +221,13 @@ export {
209
221
  firesDeclarationsTrail,
210
222
  forkWithoutPreservedImplementationTrail,
211
223
  governedSymbolResidueTrail,
224
+ governedVocabularyPermutationWatchTrail,
212
225
  implementationReturnsResultTrail,
213
226
  incompleteAccessorForStandardOpTrail,
214
227
  incompleteCrudTrail,
215
228
  intentPropagationTrail,
216
229
  layerFieldNameDriftTrail,
217
- libraryProjectionCoherenceTrail,
230
+ libraryRenderCoherenceTrail,
218
231
  markerSchemaUnsupportedTrail,
219
232
  missingVisibilityTrail,
220
233
  missingReconcileTrail,
@@ -232,7 +245,7 @@ export {
232
245
  noTopLevelSurfaceTrail,
233
246
  onReferencesExistTrail,
234
247
  orphanedSignalTrail,
235
- ownerProjectionParityTrail,
248
+ ownerRenderParityTrail,
236
249
  pendingForceTrail,
237
250
  permitGovernanceTrail,
238
251
  preferSchemaInferenceTrail,