@goodbones/campaigns 0.1.0

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 (102) hide show
  1. package/LICENSE +21 -0
  2. package/build/dts/core/campaign-state.d.ts +38 -0
  3. package/build/dts/core/campaign-state.d.ts.map +1 -0
  4. package/build/dts/core/campaigns.d.ts +196 -0
  5. package/build/dts/core/campaigns.d.ts.map +1 -0
  6. package/build/dts/core/ledger.d.ts +173 -0
  7. package/build/dts/core/ledger.d.ts.map +1 -0
  8. package/build/dts/core/phases.d.ts +26 -0
  9. package/build/dts/core/phases.d.ts.map +1 -0
  10. package/build/dts/core/sectors.d.ts +52 -0
  11. package/build/dts/core/sectors.d.ts.map +1 -0
  12. package/build/dts/domain/config.d.ts +985 -0
  13. package/build/dts/domain/config.d.ts.map +1 -0
  14. package/build/dts/domain/report.d.ts +16 -0
  15. package/build/dts/domain/report.d.ts.map +1 -0
  16. package/build/dts/host/campaigns.d.ts +195 -0
  17. package/build/dts/host/campaigns.d.ts.map +1 -0
  18. package/build/dts/host/diff.d.ts +31 -0
  19. package/build/dts/host/diff.d.ts.map +1 -0
  20. package/build/dts/index.d.ts +17 -0
  21. package/build/dts/index.d.ts.map +1 -0
  22. package/build/dts/infrastructure/campaign-functions.d.ts +7 -0
  23. package/build/dts/infrastructure/campaign-functions.d.ts.map +1 -0
  24. package/build/dts/infrastructure/report-source-fake.d.ts +4 -0
  25. package/build/dts/infrastructure/report-source-fake.d.ts.map +1 -0
  26. package/build/dts/infrastructure/report-source-live.d.ts +3 -0
  27. package/build/dts/infrastructure/report-source-live.d.ts.map +1 -0
  28. package/build/dts/load/decode.d.ts +7 -0
  29. package/build/dts/load/decode.d.ts.map +1 -0
  30. package/build/dts/load/extension.d.ts +25 -0
  31. package/build/dts/load/extension.d.ts.map +1 -0
  32. package/build/dts/manifest/lower.d.ts +14 -0
  33. package/build/dts/manifest/lower.d.ts.map +1 -0
  34. package/build/dts/manifest/spec.d.ts +515 -0
  35. package/build/dts/manifest/spec.d.ts.map +1 -0
  36. package/build/dts/ports/campaign-predicate.d.ts +23 -0
  37. package/build/dts/ports/campaign-predicate.d.ts.map +1 -0
  38. package/build/dts/ports/report-source.d.ts +14 -0
  39. package/build/dts/ports/report-source.d.ts.map +1 -0
  40. package/build/dts/testing.d.ts +2 -0
  41. package/build/dts/testing.d.ts.map +1 -0
  42. package/build/esm/core/campaign-state.js +140 -0
  43. package/build/esm/core/campaign-state.js.map +1 -0
  44. package/build/esm/core/campaigns.js +954 -0
  45. package/build/esm/core/campaigns.js.map +1 -0
  46. package/build/esm/core/ledger.js +519 -0
  47. package/build/esm/core/ledger.js.map +1 -0
  48. package/build/esm/core/phases.js +87 -0
  49. package/build/esm/core/phases.js.map +1 -0
  50. package/build/esm/core/sectors.js +313 -0
  51. package/build/esm/core/sectors.js.map +1 -0
  52. package/build/esm/domain/config.js +245 -0
  53. package/build/esm/domain/config.js.map +1 -0
  54. package/build/esm/domain/report.js +168 -0
  55. package/build/esm/domain/report.js.map +1 -0
  56. package/build/esm/host/campaigns.js +1159 -0
  57. package/build/esm/host/campaigns.js.map +1 -0
  58. package/build/esm/host/diff.js +156 -0
  59. package/build/esm/host/diff.js.map +1 -0
  60. package/build/esm/index.js +27 -0
  61. package/build/esm/index.js.map +1 -0
  62. package/build/esm/infrastructure/campaign-functions.js +67 -0
  63. package/build/esm/infrastructure/campaign-functions.js.map +1 -0
  64. package/build/esm/infrastructure/report-source-fake.js +6 -0
  65. package/build/esm/infrastructure/report-source-fake.js.map +1 -0
  66. package/build/esm/infrastructure/report-source-live.js +165 -0
  67. package/build/esm/infrastructure/report-source-live.js.map +1 -0
  68. package/build/esm/load/decode.js +60 -0
  69. package/build/esm/load/decode.js.map +1 -0
  70. package/build/esm/load/extension.js +326 -0
  71. package/build/esm/load/extension.js.map +1 -0
  72. package/build/esm/manifest/lower.js +488 -0
  73. package/build/esm/manifest/lower.js.map +1 -0
  74. package/build/esm/manifest/spec.js +296 -0
  75. package/build/esm/manifest/spec.js.map +1 -0
  76. package/build/esm/ports/campaign-predicate.js +2 -0
  77. package/build/esm/ports/campaign-predicate.js.map +1 -0
  78. package/build/esm/ports/report-source.js +7 -0
  79. package/build/esm/ports/report-source.js.map +1 -0
  80. package/build/esm/testing.js +5 -0
  81. package/build/esm/testing.js.map +1 -0
  82. package/package.json +65 -0
  83. package/src/core/campaign-state.ts +227 -0
  84. package/src/core/campaigns.ts +1319 -0
  85. package/src/core/ledger.ts +675 -0
  86. package/src/core/phases.ts +138 -0
  87. package/src/core/sectors.ts +399 -0
  88. package/src/domain/config.ts +314 -0
  89. package/src/domain/report.ts +203 -0
  90. package/src/host/campaigns.ts +1664 -0
  91. package/src/host/diff.ts +203 -0
  92. package/src/index.ts +256 -0
  93. package/src/infrastructure/campaign-functions.ts +99 -0
  94. package/src/infrastructure/report-source-fake.ts +10 -0
  95. package/src/infrastructure/report-source-live.ts +193 -0
  96. package/src/load/decode.ts +81 -0
  97. package/src/load/extension.ts +466 -0
  98. package/src/manifest/lower.ts +615 -0
  99. package/src/manifest/spec.ts +364 -0
  100. package/src/ports/campaign-predicate.ts +29 -0
  101. package/src/ports/report-source.ts +35 -0
  102. package/src/testing.ts +4 -0
@@ -0,0 +1,245 @@
1
+ import { BindingKind, DeclarationKind, ImportProbeTarget, MemberSubject, PatternList, } from "@goodbones/core";
2
+ import * as Schema from "effect/Schema";
3
+ // The lowered vocabulary of the campaigns family — what the manifest's
4
+ // `campaigns` map becomes once its globs are resolved, and what the
5
+ // evaluators in `core/` compile. It reaches into @goodbones/core only for
6
+ // the pattern primitives the other families already speak: an import's
7
+ // probe target, a binding kind, a declaration kind, a member subject.
8
+ // A campaign: one multi-step refactor, tracked as an object in the
9
+ // repository. Where a rule says what may never happen, a campaign names what
10
+ // the code is moving away from — as `objectives`, each a detector with a
11
+ // ledger that only shrinks on its own — over `sectors` the code declares
12
+ // through a `perimeter`, through an ordered sequence of `phases` toward an
13
+ // end. Lowered from the manifest's `campaigns` map with its globs resolved;
14
+ // the detector below is what the evaluator compiles.
15
+ // What one holdout is: a whole file, a named declaration in it, one matched
16
+ // expression, or the sector itself (for a presence objective — the sector is
17
+ // the holdout while nothing in it matches). The first three are the unit a
18
+ // per-file detector answers at; the unit decides what a term from another
19
+ // level means (a file-level term in a declaration objective is a filter; a
20
+ // declaration-level term in a file objective is existential) and what the
21
+ // fingerprint anchors on.
22
+ export const CampaignUnit = Schema.Literals(["file", "declaration", "match"]);
23
+ export const Holdout = Schema.Literals(["file", "declaration", "match", "sector"]);
24
+ // The detector's leaf terms. Every pattern is a regular-expression source,
25
+ // as everywhere else in this config; the manifest writes globs and lowering
26
+ // translates them. Each term answers at one level — `path`, `imports`,
27
+ // `requires`, `content` and a boolean `fn` about the file; `exports` and
28
+ // `members` about a declaration; `syntax` and a listing `fn` about a match.
29
+ const PathTerm = Schema.Struct({
30
+ file: PatternList,
31
+ fileNot: Schema.optionalKey(PatternList),
32
+ // With `convention`: which capture group of `file` holds the name being
33
+ // judged, and the shape it must have for the term to hold.
34
+ subject: Schema.optionalKey(Schema.Finite),
35
+ convention: Schema.optionalKey(Schema.String),
36
+ });
37
+ const ImportsTerm = Schema.Struct({
38
+ // Where an edge of the file must resolve to: a path pattern, a package
39
+ // name, or a builtin. Holds when at least one edge does.
40
+ resolves: ImportProbeTarget,
41
+ // Names that must be pulled across that edge; omit for any binding.
42
+ symbols: Schema.optionalKey(Schema.Array(Schema.String)),
43
+ });
44
+ const ExportsTerm = Schema.Struct({
45
+ name: Schema.optionalKey(PatternList),
46
+ kinds: Schema.optionalKey(Schema.Array(BindingKind)),
47
+ declares: Schema.optionalKey(Schema.Array(DeclarationKind)),
48
+ reexport: Schema.optionalKey(Schema.Boolean),
49
+ });
50
+ const MembersTerm = Schema.Struct({
51
+ subject: MemberSubject,
52
+ name: Schema.optionalKey(PatternList),
53
+ in: Schema.optionalKey(PatternList),
54
+ declares: Schema.optionalKey(Schema.Array(DeclarationKind)),
55
+ });
56
+ const ContentTerm = Schema.Struct({ regex: Schema.String });
57
+ // How a metavariable of a syntax rule is narrowed: by the text it captured,
58
+ // or by what the identifier at its root is bound to — the module it was
59
+ // imported from and the name it was imported as.
60
+ const BindingNarrowing = Schema.Struct({
61
+ resolves: ImportProbeTarget,
62
+ member: Schema.optionalKey(Schema.Array(Schema.String)),
63
+ });
64
+ const CaptureNarrowing = Schema.Struct({
65
+ regex: Schema.optionalKey(Schema.String),
66
+ binding: Schema.optionalKey(BindingNarrowing),
67
+ });
68
+ const SyntaxTerm = Schema.Struct({
69
+ // The engine's rule object, carried opaquely: the matcher validates it.
70
+ rule: Schema.Unknown,
71
+ where: Schema.optionalKey(Schema.Record(Schema.String, CaptureNarrowing)),
72
+ });
73
+ // A pattern no parser of ours sees, reported by another program: a type
74
+ // error, another linter's finding. Exactly one of `command` (run from the
75
+ // repository root, once per process) and `file` (written by an earlier
76
+ // step), each a list — the manifest's one string lowered to a list of one —
77
+ // read as one report. Each diagnostic on a file is a match anchored on the
78
+ // declaration at its position, keyed by its code and a hash of its message.
79
+ export const ReportFormat = Schema.Literals(["tsc", "eslint", "oxlint", "regex"]);
80
+ const ReportTerm = Schema.Struct({
81
+ command: Schema.optionalKey(Schema.Array(Schema.String)),
82
+ file: Schema.optionalKey(Schema.Array(Schema.String)),
83
+ format: ReportFormat,
84
+ // `regex` only: named groups `file`, `line`, and optionally `column`,
85
+ // `code`, `message`.
86
+ pattern: Schema.optionalKey(Schema.String),
87
+ // The codes the term speaks to; omit for every one.
88
+ codes: Schema.optionalKey(Schema.Array(Schema.String)),
89
+ codesNot: Schema.optionalKey(Schema.Array(Schema.String)),
90
+ });
91
+ const DetectorRef = Schema.suspend(() => Detector);
92
+ export const Detector = Schema.Union([
93
+ Schema.Struct({ all: Schema.Array(DetectorRef) }),
94
+ Schema.Struct({ any: Schema.Array(DetectorRef) }),
95
+ Schema.Struct({ not: DetectorRef }),
96
+ Schema.Struct({ path: PathTerm }),
97
+ Schema.Struct({ imports: ImportsTerm }),
98
+ Schema.Struct({ exports: ExportsTerm }),
99
+ Schema.Struct({ members: MembersTerm }),
100
+ Schema.Struct({ requires: Schema.Array(Schema.String) }),
101
+ Schema.Struct({ content: ContentTerm }),
102
+ Schema.Struct({ syntax: SyntaxTerm }),
103
+ Schema.Struct({ report: ReportTerm }),
104
+ Schema.Struct({ fn: Schema.String }),
105
+ ]);
106
+ // A term quantified over the sector's files rather than answered by one.
107
+ // `has` takes an ordinary detector and holds when at least one file (or
108
+ // declaration, or match) in the sector satisfies it — a presence, whose
109
+ // holdout is the sector until something matches. `oneRoot` holds when every
110
+ // file of the sector sits under the root its perimeter was found at, which
111
+ // is what an `endState` needs; `oneHost` when every file matches the host.
112
+ // Each needs the sector's file list and nothing else, so the CLI reports
113
+ // them and the plugin, which sees one file, reads only their effect on the
114
+ // sector's phase through the ledger.
115
+ export const SectorTerm = Schema.Union([
116
+ Schema.Struct({ has: Detector }),
117
+ Schema.Struct({ oneRoot: Schema.Literal(true) }),
118
+ Schema.Struct({ oneHost: PatternList }),
119
+ ]);
120
+ // One diagnostic a probe stands in for, positions one-based as a tool
121
+ // prints them.
122
+ export const ProbeDiagnostic = Schema.Struct({
123
+ line: Schema.Finite,
124
+ column: Schema.optionalKey(Schema.Finite),
125
+ code: Schema.optionalKey(Schema.String),
126
+ message: Schema.optionalKey(Schema.String),
127
+ });
128
+ // A source an objective is proven against: the path it would have, its text
129
+ // when a term needs one, the target of each of its edges (in place of the live
130
+ // resolver), the files beside it (in place of the file system) and the
131
+ // diagnostics reported on it (in place of the report source).
132
+ export const CampaignProbe = Schema.Struct({
133
+ path: Schema.String,
134
+ source: Schema.optionalKey(Schema.String),
135
+ edges: Schema.optionalKey(Schema.Record(Schema.String, ImportProbeTarget)),
136
+ files: Schema.optionalKey(Schema.Array(Schema.String)),
137
+ report: Schema.optionalKey(Schema.Array(ProbeDiagnostic)),
138
+ });
139
+ export const CampaignProbes = Schema.Struct({
140
+ fires: Schema.Array(CampaignProbe),
141
+ ignores: Schema.Array(CampaignProbe),
142
+ });
143
+ // An objective: a detector, a granularity, probes, and a ledger that only
144
+ // shrinks on its own. Owned by one campaign; named by at most one phase (an
145
+ // objective no phase names is in window in every phase). Exactly one of
146
+ // `match` (a per-file detector, evaluated by both hosts) and `sector` (a
147
+ // term over the sector's files, evaluated by the CLI) — or, for the
148
+ // objectives an `endState` expands into, `endState` naming the family.
149
+ export const ObjectiveRule = Schema.Struct({
150
+ // `campaign/<campaign>/<objective>`, the rule name a violation carries.
151
+ name: Schema.String,
152
+ id: Schema.String,
153
+ campaign: Schema.String,
154
+ // The `how`: what a reader at a holdout does about it.
155
+ message: Schema.String,
156
+ why: Schema.optionalKey(Schema.String),
157
+ holdout: Holdout,
158
+ match: Schema.optionalKey(Detector),
159
+ sector: Schema.optionalKey(SectorTerm),
160
+ endState: Schema.optionalKey(Schema.Struct({
161
+ phase: Schema.String,
162
+ family: Schema.Literals(["imports", "exports", "members", "surface", "structure"]),
163
+ })),
164
+ // The phase at which the objective stops counting, exclusive; absent, it
165
+ // counts to the end.
166
+ until: Schema.optionalKey(Schema.String),
167
+ probes: CampaignProbes,
168
+ });
169
+ // How a sector is recognized. The name is the sector's identity. A `marker`
170
+ // is a file that names the sector (and may list the globs it owns); `glob`
171
+ // is one sector per match; `match` one sector per detector match, keyed by
172
+ // its anchor; `file` one sector per file, keyed by the path without its
173
+ // extension; `nx` reads the workspace's projects. A campaign with none has
174
+ // one implicit sector, the scope.
175
+ export const PerimeterRule = Schema.Union([
176
+ Schema.Struct({ kind: Schema.Literal("file") }),
177
+ Schema.Struct({ kind: Schema.Literal("nx") }),
178
+ Schema.Struct({ kind: Schema.Literal("glob"), glob: PatternList }),
179
+ Schema.Struct({
180
+ kind: Schema.Literal("marker"),
181
+ marker: PatternList,
182
+ probes: Schema.optionalKey(Schema.Struct({ fires: PatternList, ignores: PatternList })),
183
+ }),
184
+ Schema.Struct({
185
+ kind: Schema.Literal("match"),
186
+ match: Detector,
187
+ unit: Schema.Literals(["declaration", "match"]),
188
+ probes: CampaignProbes,
189
+ }),
190
+ ]);
191
+ // What a touched sector owes beyond the nudge. A strict ladder: the ledger
192
+ // records growth with a reason under `advise`; `ratchet` refuses it in a
193
+ // touched sector; `paydown` adds that a diff editing a holdout-bearing
194
+ // declaration must leave the sector with fewer holdouts.
195
+ export const OnTouch = Schema.Literals(["advise", "ratchet", "paydown"]);
196
+ // A dated receipt for a change to a defined phase, which authorizes the next
197
+ // `clear` to re-baseline the sectors in that phase's window.
198
+ export const PhaseConcession = Schema.Struct({
199
+ reason: Schema.String,
200
+ at: Schema.String,
201
+ by: Schema.optionalKey(Schema.String),
202
+ });
203
+ // A phase: a named, ordered group of objectives. Defined when it names one
204
+ // (or is attested, or carries an end state); open when it has only an
205
+ // intent, and then it is last. `hash` is the phase's definition — its
206
+ // position, its objectives and their detectors — so a change to a defined
207
+ // phase is visible against the plan the ledger recorded.
208
+ export const PhaseRule = Schema.Struct({
209
+ id: Schema.String,
210
+ intent: Schema.optionalKey(Schema.String),
211
+ objectives: Schema.Array(Schema.String),
212
+ attested: Schema.Boolean,
213
+ onTouch: Schema.optionalKey(OnTouch),
214
+ // The sector-relative node tree, carried as written; expanded per sector
215
+ // by the host that evaluates it.
216
+ endState: Schema.optionalKey(Schema.Unknown),
217
+ concessions: Schema.Array(PhaseConcession),
218
+ hash: Schema.String,
219
+ });
220
+ export const CampaignRule = Schema.Struct({
221
+ // `campaign/<id>`.
222
+ name: Schema.String,
223
+ id: Schema.String,
224
+ title: Schema.optionalKey(Schema.String),
225
+ why: Schema.optionalKey(Schema.String),
226
+ owner: Schema.optionalKey(Schema.String),
227
+ scope: PatternList,
228
+ // Extensions the campaign widens the walk to, beyond the packs' — a
229
+ // JavaScript half a TypeScript pack does not visit.
230
+ extensions: Schema.Array(Schema.String),
231
+ // What the remainder of the scope counts as; absent, everything no sector
232
+ // claims is legacy.
233
+ legacy: Schema.optionalKey(PatternList),
234
+ perimeter: Schema.optionalKey(PerimeterRule),
235
+ onTouch: Schema.optionalKey(OnTouch),
236
+ phases: Schema.Array(PhaseRule),
237
+ objectives: Schema.Array(ObjectiveRule),
238
+ // Milliseconds without progress after which the campaign is stalled;
239
+ // absent, it never is.
240
+ staleAfter: Schema.optionalKey(Schema.Finite),
241
+ // What `check` demands once every count is zero: keep the campaign as a
242
+ // guard against recurrence, or remove it from the manifest.
243
+ onComplete: Schema.Literals(["keep", "remove"]),
244
+ });
245
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/domain/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,uEAAuE;AACvE,oEAAoE;AACpE,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AAEtE,mEAAmE;AACnE,6EAA6E;AAC7E,yEAAyE;AACzE,yEAAyE;AACzE,2EAA2E;AAC3E,4EAA4E;AAC5E,qDAAqD;AAErD,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,0BAA0B;AAC1B,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEnF,2EAA2E;AAC3E,4EAA4E;AAC5E,uEAAuE;AACvE,yEAAyE;AACzE,4EAA4E;AAC5E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,MAAM,CAAC,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AoB;IACpB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;IACvC,qEAAqE;IACrE,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC7C,wEAAwE;IACxE,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAChD,CAAC,CAAC"}
@@ -0,0 +1,168 @@
1
+ // A campaign's `report` term names a pattern no parser of ours sees: a type
2
+ // error, a lint finding from another tool, anything a program prints one
3
+ // line per occurrence. This is the vocabulary such a report is read into —
4
+ // a diagnostic with a file, a position, a code and a message — and the
5
+ // readers for the formats a report comes in. Pure: text in, diagnostics out.
6
+ // Running the command or reading the file is the report source's business.
7
+ const relativeTo = (repoRoot, file) => {
8
+ const slashed = file.replaceAll("\\", "/");
9
+ const root = repoRoot.replaceAll("\\", "/").replace(/\/$/, "");
10
+ const relative = slashed === root
11
+ ? ""
12
+ : slashed.startsWith(`${root}/`)
13
+ ? slashed.slice(root.length + 1)
14
+ : slashed;
15
+ return relative.replace(/^\.\//, "");
16
+ };
17
+ const oneBased = (value, fallback = 1) => {
18
+ const parsed = Number(value);
19
+ return Number.isFinite(parsed) && parsed >= 1 ? parsed - 1 : fallback - 1;
20
+ };
21
+ const firstLine = (message) => message.split(/\r?\n/, 1)[0]?.trim() ?? "";
22
+ // `src/a.ts(12,5): error TS2551: Property 'x' does not exist…`, one per
23
+ // line, with the continuation lines tsc indents beneath a message ignored —
24
+ // the first line is the message.
25
+ const TSC_LINE = /^(.+?)\((\d+),(\d+)\): error (TS\d+): (.*)$/;
26
+ const parseTsc = (text, options) => {
27
+ const found = [];
28
+ for (const line of text.split(/\r?\n/)) {
29
+ const match = TSC_LINE.exec(line);
30
+ if (match === null)
31
+ continue;
32
+ const [, file = "", row, column, code = "", message = ""] = match;
33
+ found.push({
34
+ file: relativeTo(options.repoRoot, file),
35
+ line: oneBased(row),
36
+ column: oneBased(column),
37
+ code,
38
+ message: firstLine(message),
39
+ });
40
+ }
41
+ return found;
42
+ };
43
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
44
+ const asString = (value) => (typeof value === "string" ? value : "");
45
+ const asNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
46
+ const parseJson = (text, format) => {
47
+ try {
48
+ return JSON.parse(text);
49
+ }
50
+ catch (cause) {
51
+ throw new Error(`a ${format} report is JSON, and this one does not parse: ${String(cause)}`);
52
+ }
53
+ };
54
+ // `eslint --format json`: one object per file with its messages. A message
55
+ // with no `ruleId` (a parse error) carries the code `""`.
56
+ const parseEslint = (text, options) => {
57
+ const parsed = parseJson(text, "eslint");
58
+ if (!Array.isArray(parsed))
59
+ throw new Error("an eslint report is a JSON array of files");
60
+ const found = [];
61
+ for (const entry of parsed) {
62
+ if (!isRecord(entry) || !Array.isArray(entry.messages))
63
+ continue;
64
+ const file = relativeTo(options.repoRoot, asString(entry.filePath));
65
+ for (const message of entry.messages) {
66
+ if (!isRecord(message))
67
+ continue;
68
+ found.push({
69
+ file,
70
+ line: (asNumber(message.line) ?? 1) - 1,
71
+ column: (asNumber(message.column) ?? 1) - 1,
72
+ code: asString(message.ruleId),
73
+ message: firstLine(asString(message.message)),
74
+ });
75
+ }
76
+ }
77
+ return found;
78
+ };
79
+ // `oxlint --format json`: `{ diagnostics: [{ filename, code, message,
80
+ // labels: [{ span: { line, column } }] }] }`, positions one-based.
81
+ const parseOxlint = (text, options) => {
82
+ const parsed = parseJson(text, "oxlint");
83
+ if (!isRecord(parsed) || !Array.isArray(parsed.diagnostics)) {
84
+ throw new Error("an oxlint report is a JSON object with a `diagnostics` array");
85
+ }
86
+ const found = [];
87
+ for (const entry of parsed.diagnostics) {
88
+ if (!isRecord(entry))
89
+ continue;
90
+ const labels = Array.isArray(entry.labels) ? entry.labels : [];
91
+ const label = labels[0];
92
+ const span = isRecord(label) && isRecord(label.span) ? label.span : {};
93
+ found.push({
94
+ file: relativeTo(options.repoRoot, asString(entry.filename)),
95
+ line: (asNumber(span.line) ?? 1) - 1,
96
+ column: (asNumber(span.column) ?? 1) - 1,
97
+ code: asString(entry.code),
98
+ message: firstLine(asString(entry.message)),
99
+ });
100
+ }
101
+ return found;
102
+ };
103
+ const parseRegex = (text, options) => {
104
+ if (options.pattern === undefined) {
105
+ throw new Error("a `regex` report needs a `pattern` with named groups `file` and `line`");
106
+ }
107
+ const pattern = new RegExp(options.pattern);
108
+ const found = [];
109
+ for (const line of text.split(/\r?\n/)) {
110
+ const match = pattern.exec(line);
111
+ if (match === null)
112
+ continue;
113
+ const groups = match.groups ?? {};
114
+ if (groups.file === undefined)
115
+ continue;
116
+ found.push({
117
+ file: relativeTo(options.repoRoot, groups.file),
118
+ line: oneBased(groups.line),
119
+ column: oneBased(groups.column),
120
+ code: groups.code ?? "",
121
+ message: firstLine(groups.message ?? ""),
122
+ });
123
+ }
124
+ return found;
125
+ };
126
+ export const parseReport = (format, text, options) => {
127
+ switch (format) {
128
+ case "tsc":
129
+ return parseTsc(text, options);
130
+ case "eslint":
131
+ return parseEslint(text, options);
132
+ case "oxlint":
133
+ return parseOxlint(text, options);
134
+ case "regex":
135
+ return parseRegex(text, options);
136
+ }
137
+ };
138
+ // One report from several outputs. A tool that takes one project at a time
139
+ // is run once per project, and a project's program includes the files of
140
+ // the projects it references, so one diagnostic is printed under several
141
+ // runs; it is one diagnostic. Kept once, at its first appearance, when
142
+ // identical in file, position, code and message.
143
+ export const uniqueDiagnostics = (diagnostics) => {
144
+ const seen = new Set();
145
+ const kept = [];
146
+ for (const one of diagnostics) {
147
+ const key = JSON.stringify([one.file, one.line, one.column, one.code, one.message]);
148
+ if (seen.has(key))
149
+ continue;
150
+ seen.add(key);
151
+ kept.push(one);
152
+ }
153
+ return kept;
154
+ };
155
+ // The diagnostics indexed by file, which is how a per-file evaluator asks
156
+ // for them.
157
+ export const indexByFile = (diagnostics) => {
158
+ const byFile = new Map();
159
+ for (const one of diagnostics) {
160
+ const found = byFile.get(one.file);
161
+ if (found === undefined)
162
+ byFile.set(one.file, [one]);
163
+ else
164
+ found.push(one);
165
+ }
166
+ return byFile;
167
+ };
168
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/domain/report.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAC3E,uEAAuE;AACvE,6EAA6E;AAC7E,2EAA2E;AA0B3E,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAU,EAAE;IAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/D,MAAM,QAAQ,GACZ,OAAO,KAAK,IAAI;QACd,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC;YAC9B,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YAChC,CAAC,CAAC,OAAO,CAAC;IAChB,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,KAAyB,EAAE,QAAQ,GAAG,CAAC,EAAU,EAAE;IACnE,MAAM,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