@ontrails/regrade 1.0.0-beta.29 → 1.0.0-beta.32
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 +52 -0
- package/package.json +5 -5
- package/src/downstream/collect.ts +29 -3
- package/src/downstream/report.ts +291 -35
- package/src/downstream/scan-summary.ts +193 -0
- package/src/downstream/vocabulary.ts +965 -0
- package/src/index.ts +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @ontrails/regrade
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f3c4fef: Export a shared `escapeRegExp` helper from core and migrate first-party callers off local copies.
|
|
8
|
+
- fe72b84: Fold remaining Regrade and Warden scan-target surfaces onto the shared path-scope vocabulary.
|
|
9
|
+
- Updated dependencies [3e5c0fc]
|
|
10
|
+
- Updated dependencies [f3c4fef]
|
|
11
|
+
- Updated dependencies [cb0a9d8]
|
|
12
|
+
- Updated dependencies [21c6dda]
|
|
13
|
+
- Updated dependencies [fe72b84]
|
|
14
|
+
- @ontrails/core@1.0.0-beta.32
|
|
15
|
+
- @ontrails/warden@1.0.0-beta.32
|
|
16
|
+
|
|
17
|
+
## 1.0.0-beta.31
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- e2f3d23: Default Regrade reports to actionable entries, add skip counts grouped by
|
|
22
|
+
reason, and expose an `includeEntries` option for full report inventories.
|
|
23
|
+
- 9be2b7e: Load project-local Warden term-rewrite rules from the Regrade root so repo-owned
|
|
24
|
+
migration classes can run through `trails regrade`.
|
|
25
|
+
- 47f782c: Add occurrence-level vocabulary regrade reports with plan, ledger,
|
|
26
|
+
and completion-gate facts. The Trails `regrade` operator command now supports
|
|
27
|
+
positional `<from> <to>` regrade runs and exposes the same capability through
|
|
28
|
+
the curated MCP surface.
|
|
29
|
+
- ee9f3ae: Let Warden fix capabilities declare downstream scan targets and have Regrade
|
|
30
|
+
honor those targets for Warden-backed term-rewrite classes.
|
|
31
|
+
|
|
32
|
+
Dogfood the first safe facet-to-trailhead prose rewrite through project-local
|
|
33
|
+
Warden rules and Regrade.
|
|
34
|
+
|
|
35
|
+
- 982a4d7: Add Regrade path-scope exclusion globs for vocabulary runs and expose them
|
|
36
|
+
through the `trails regrade` CLI/MCP contract.
|
|
37
|
+
- 1540233: Add Regrade scan inventory summaries that group matched files by extension and
|
|
38
|
+
top-level path, with occurrence counts for vocabulary regrade reports.
|
|
39
|
+
- a079073: Rename Regrade path-scope scan controls from `ignore` to `exclude` across CLI, MCP, and project config.
|
|
40
|
+
- Updated dependencies [ee9f3ae]
|
|
41
|
+
- Updated dependencies [a0126d9]
|
|
42
|
+
- Updated dependencies [4cd5d4e]
|
|
43
|
+
- Updated dependencies [6a26a08]
|
|
44
|
+
- Updated dependencies [38907cc]
|
|
45
|
+
- @ontrails/warden@1.0.0-beta.31
|
|
46
|
+
- @ontrails/core@1.0.0-beta.31
|
|
47
|
+
|
|
48
|
+
## 1.0.0-beta.30
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- @ontrails/core@1.0.0-beta.30
|
|
53
|
+
- @ontrails/warden@1.0.0-beta.30
|
|
54
|
+
|
|
3
55
|
## 1.0.0-beta.29
|
|
4
56
|
|
|
5
57
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontrails/regrade",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.32",
|
|
4
4
|
"description": "Downstream migration reporting and safe rewrite helpers for Trails.",
|
|
5
5
|
"files": [
|
|
6
6
|
"src/**/*.ts",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ontrails/core": "^1.0.0-beta.
|
|
26
|
-
"@ontrails/warden": "^1.0.0-beta.
|
|
25
|
+
"@ontrails/core": "^1.0.0-beta.32",
|
|
26
|
+
"@ontrails/warden": "^1.0.0-beta.32",
|
|
27
27
|
"zod": "^4.3.5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@ontrails/testing": "^1.0.0-beta.
|
|
31
|
-
"@ontrails/topographer": "^1.0.0-beta.
|
|
30
|
+
"@ontrails/testing": "^1.0.0-beta.32",
|
|
31
|
+
"@ontrails/topographer": "^1.0.0-beta.32"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
NotFoundError,
|
|
3
|
+
Result,
|
|
4
|
+
matchesAnyPathGlob,
|
|
5
|
+
trail,
|
|
6
|
+
} from '@ontrails/core';
|
|
2
7
|
import { readdirSync } from 'node:fs';
|
|
3
8
|
import { join, posix, relative, resolve, sep } from 'node:path';
|
|
4
9
|
import { z } from 'zod';
|
|
@@ -66,6 +71,8 @@ export interface DownstreamCollectionOptions {
|
|
|
66
71
|
readonly ignoredDirectories?: readonly string[];
|
|
67
72
|
/** Source extensions to collect. Defaults to {@link DEFAULT_SOURCE_EXTENSIONS}. */
|
|
68
73
|
readonly extensions?: readonly string[];
|
|
74
|
+
/** Root-relative path globs to skip before collection. */
|
|
75
|
+
readonly exclude?: readonly string[];
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
/** Outcome of classifying a single directory entry. */
|
|
@@ -79,6 +86,16 @@ const extensionOf = (name: string): string => {
|
|
|
79
86
|
return dot <= 0 ? '' : name.slice(dot);
|
|
80
87
|
};
|
|
81
88
|
|
|
89
|
+
const normalizeExtension = (extension: string): string =>
|
|
90
|
+
extension === '' || extension.startsWith('.') ? extension : `.${extension}`;
|
|
91
|
+
|
|
92
|
+
const collectionExtensions = (
|
|
93
|
+
extensions: readonly string[] | undefined
|
|
94
|
+
): readonly string[] =>
|
|
95
|
+
extensions === undefined
|
|
96
|
+
? DEFAULT_SOURCE_EXTENSIONS
|
|
97
|
+
: extensions.map(normalizeExtension);
|
|
98
|
+
|
|
82
99
|
/**
|
|
83
100
|
* Decide what to do with a single directory entry. Pure: no filesystem access,
|
|
84
101
|
* so collection policy can be tested directly with synthetic entries.
|
|
@@ -90,7 +107,7 @@ export const classifyDownstreamEntry = (
|
|
|
90
107
|
): DownstreamEntryClassification => {
|
|
91
108
|
const ignoredDirectories =
|
|
92
109
|
options.ignoredDirectories ?? DEFAULT_IGNORED_DIRECTORIES;
|
|
93
|
-
const extensions = options.extensions
|
|
110
|
+
const extensions = collectionExtensions(options.extensions);
|
|
94
111
|
|
|
95
112
|
if (kind === 'directory') {
|
|
96
113
|
return ignoredDirectories.includes(name)
|
|
@@ -100,7 +117,7 @@ export const classifyDownstreamEntry = (
|
|
|
100
117
|
if (kind === 'other') {
|
|
101
118
|
return { action: 'skip', reason: 'unsupported-entry' };
|
|
102
119
|
}
|
|
103
|
-
return extensions.includes(extensionOf(name))
|
|
120
|
+
return extensions.length === 0 || extensions.includes(extensionOf(name))
|
|
104
121
|
? { action: 'collect' }
|
|
105
122
|
: { action: 'skip', reason: 'unsupported-extension' };
|
|
106
123
|
};
|
|
@@ -177,6 +194,10 @@ export const collectDownstreamSources = (
|
|
|
177
194
|
for (const entry of read.entries) {
|
|
178
195
|
const absolutePath = join(current, entry.name);
|
|
179
196
|
const path = toPosixRelative(absoluteRoot, absolutePath);
|
|
197
|
+
if (matchesAnyPathGlob(path, options.exclude)) {
|
|
198
|
+
skipped.push({ path, reason: 'ignored-glob' });
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
180
201
|
const classification = classifyDownstreamEntry(
|
|
181
202
|
entry.name,
|
|
182
203
|
entry.kind,
|
|
@@ -198,6 +219,10 @@ export const collectDownstreamSources = (
|
|
|
198
219
|
};
|
|
199
220
|
|
|
200
221
|
export const collectDownstreamSourcesInput = z.object({
|
|
222
|
+
exclude: z
|
|
223
|
+
.array(z.string())
|
|
224
|
+
.optional()
|
|
225
|
+
.describe('Root-relative path globs to skip before collection'),
|
|
201
226
|
extensions: z
|
|
202
227
|
.array(z.string())
|
|
203
228
|
.optional()
|
|
@@ -247,6 +272,7 @@ export const collectDownstreamSourcesTrail = trail(
|
|
|
247
272
|
...(input.extensions === undefined
|
|
248
273
|
? {}
|
|
249
274
|
: { extensions: input.extensions }),
|
|
275
|
+
...(input.exclude === undefined ? {} : { exclude: input.exclude }),
|
|
250
276
|
...(input.ignoredDirectories === undefined
|
|
251
277
|
? {}
|
|
252
278
|
: { ignoredDirectories: input.ignoredDirectories }),
|