@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.
- package/LICENSE +21 -0
- package/build/dts/core/campaign-state.d.ts +38 -0
- package/build/dts/core/campaign-state.d.ts.map +1 -0
- package/build/dts/core/campaigns.d.ts +196 -0
- package/build/dts/core/campaigns.d.ts.map +1 -0
- package/build/dts/core/ledger.d.ts +173 -0
- package/build/dts/core/ledger.d.ts.map +1 -0
- package/build/dts/core/phases.d.ts +26 -0
- package/build/dts/core/phases.d.ts.map +1 -0
- package/build/dts/core/sectors.d.ts +52 -0
- package/build/dts/core/sectors.d.ts.map +1 -0
- package/build/dts/domain/config.d.ts +985 -0
- package/build/dts/domain/config.d.ts.map +1 -0
- package/build/dts/domain/report.d.ts +16 -0
- package/build/dts/domain/report.d.ts.map +1 -0
- package/build/dts/host/campaigns.d.ts +195 -0
- package/build/dts/host/campaigns.d.ts.map +1 -0
- package/build/dts/host/diff.d.ts +31 -0
- package/build/dts/host/diff.d.ts.map +1 -0
- package/build/dts/index.d.ts +17 -0
- package/build/dts/index.d.ts.map +1 -0
- package/build/dts/infrastructure/campaign-functions.d.ts +7 -0
- package/build/dts/infrastructure/campaign-functions.d.ts.map +1 -0
- package/build/dts/infrastructure/report-source-fake.d.ts +4 -0
- package/build/dts/infrastructure/report-source-fake.d.ts.map +1 -0
- package/build/dts/infrastructure/report-source-live.d.ts +3 -0
- package/build/dts/infrastructure/report-source-live.d.ts.map +1 -0
- package/build/dts/load/decode.d.ts +7 -0
- package/build/dts/load/decode.d.ts.map +1 -0
- package/build/dts/load/extension.d.ts +25 -0
- package/build/dts/load/extension.d.ts.map +1 -0
- package/build/dts/manifest/lower.d.ts +14 -0
- package/build/dts/manifest/lower.d.ts.map +1 -0
- package/build/dts/manifest/spec.d.ts +515 -0
- package/build/dts/manifest/spec.d.ts.map +1 -0
- package/build/dts/ports/campaign-predicate.d.ts +23 -0
- package/build/dts/ports/campaign-predicate.d.ts.map +1 -0
- package/build/dts/ports/report-source.d.ts +14 -0
- package/build/dts/ports/report-source.d.ts.map +1 -0
- package/build/dts/testing.d.ts +2 -0
- package/build/dts/testing.d.ts.map +1 -0
- package/build/esm/core/campaign-state.js +140 -0
- package/build/esm/core/campaign-state.js.map +1 -0
- package/build/esm/core/campaigns.js +954 -0
- package/build/esm/core/campaigns.js.map +1 -0
- package/build/esm/core/ledger.js +519 -0
- package/build/esm/core/ledger.js.map +1 -0
- package/build/esm/core/phases.js +87 -0
- package/build/esm/core/phases.js.map +1 -0
- package/build/esm/core/sectors.js +313 -0
- package/build/esm/core/sectors.js.map +1 -0
- package/build/esm/domain/config.js +245 -0
- package/build/esm/domain/config.js.map +1 -0
- package/build/esm/domain/report.js +168 -0
- package/build/esm/domain/report.js.map +1 -0
- package/build/esm/host/campaigns.js +1159 -0
- package/build/esm/host/campaigns.js.map +1 -0
- package/build/esm/host/diff.js +156 -0
- package/build/esm/host/diff.js.map +1 -0
- package/build/esm/index.js +27 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/infrastructure/campaign-functions.js +67 -0
- package/build/esm/infrastructure/campaign-functions.js.map +1 -0
- package/build/esm/infrastructure/report-source-fake.js +6 -0
- package/build/esm/infrastructure/report-source-fake.js.map +1 -0
- package/build/esm/infrastructure/report-source-live.js +165 -0
- package/build/esm/infrastructure/report-source-live.js.map +1 -0
- package/build/esm/load/decode.js +60 -0
- package/build/esm/load/decode.js.map +1 -0
- package/build/esm/load/extension.js +326 -0
- package/build/esm/load/extension.js.map +1 -0
- package/build/esm/manifest/lower.js +488 -0
- package/build/esm/manifest/lower.js.map +1 -0
- package/build/esm/manifest/spec.js +296 -0
- package/build/esm/manifest/spec.js.map +1 -0
- package/build/esm/ports/campaign-predicate.js +2 -0
- package/build/esm/ports/campaign-predicate.js.map +1 -0
- package/build/esm/ports/report-source.js +7 -0
- package/build/esm/ports/report-source.js.map +1 -0
- package/build/esm/testing.js +5 -0
- package/build/esm/testing.js.map +1 -0
- package/package.json +65 -0
- package/src/core/campaign-state.ts +227 -0
- package/src/core/campaigns.ts +1319 -0
- package/src/core/ledger.ts +675 -0
- package/src/core/phases.ts +138 -0
- package/src/core/sectors.ts +399 -0
- package/src/domain/config.ts +314 -0
- package/src/domain/report.ts +203 -0
- package/src/host/campaigns.ts +1664 -0
- package/src/host/diff.ts +203 -0
- package/src/index.ts +256 -0
- package/src/infrastructure/campaign-functions.ts +99 -0
- package/src/infrastructure/report-source-fake.ts +10 -0
- package/src/infrastructure/report-source-live.ts +193 -0
- package/src/load/decode.ts +81 -0
- package/src/load/extension.ts +466 -0
- package/src/manifest/lower.ts +615 -0
- package/src/manifest/spec.ts +364 -0
- package/src/ports/campaign-predicate.ts +29 -0
- package/src/ports/report-source.ts +35 -0
- package/src/testing.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Data Quail
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Violation } from "@goodbones/core";
|
|
2
|
+
import type { PhaseRule } from "../domain/config.js";
|
|
3
|
+
import { type CampaignHit, type CampaignInput, type CompiledCampaign, type CompiledObjective } from "./campaigns.js";
|
|
4
|
+
import type { SectorRecord } from "./ledger.js";
|
|
5
|
+
import { type Residue, type SectorPosition } from "./phases.js";
|
|
6
|
+
import { type Sector, type SectorDiscovery, type SectorIndex } from "./sectors.js";
|
|
7
|
+
export type ObjectiveHit = CampaignHit & {
|
|
8
|
+
readonly sector: string;
|
|
9
|
+
readonly entry: string;
|
|
10
|
+
};
|
|
11
|
+
export type SectorState = {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly sector: Sector;
|
|
14
|
+
readonly phase: number;
|
|
15
|
+
readonly position: SectorPosition;
|
|
16
|
+
readonly inWindow: ReadonlyArray<CompiledObjective>;
|
|
17
|
+
readonly counts: Residue;
|
|
18
|
+
readonly residue: Residue;
|
|
19
|
+
};
|
|
20
|
+
export type CampaignEvaluation = {
|
|
21
|
+
readonly rule: CompiledCampaign;
|
|
22
|
+
readonly index: SectorIndex;
|
|
23
|
+
readonly hits: ReadonlyArray<ObjectiveHit>;
|
|
24
|
+
readonly sectors: ReadonlyMap<string, SectorState>;
|
|
25
|
+
};
|
|
26
|
+
export type CampaignEvaluationInput = {
|
|
27
|
+
readonly files: ReadonlyArray<string>;
|
|
28
|
+
readonly inputOf: (file: string) => CampaignInput;
|
|
29
|
+
readonly readText: (file: string) => string | null;
|
|
30
|
+
readonly globToRegExp: SectorDiscovery["globToRegExp"];
|
|
31
|
+
readonly projects?: SectorDiscovery["projects"];
|
|
32
|
+
readonly recordOf: (sector: string) => SectorRecord | undefined;
|
|
33
|
+
readonly endStateOf?: ((sector: Sector, phase: PhaseRule, family: string) => ReadonlyArray<Violation>) | undefined;
|
|
34
|
+
};
|
|
35
|
+
export declare const evaluateCampaign: (rule: CompiledCampaign, input: CampaignEvaluationInput) => CampaignEvaluation;
|
|
36
|
+
export declare const hitsInWindow: (evaluation: CampaignEvaluation) => ReadonlyArray<ObjectiveHit>;
|
|
37
|
+
export declare const towardNextOf: (rule: CompiledCampaign, state: SectorState) => Residue;
|
|
38
|
+
//# sourceMappingURL=campaign-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaign-state.d.ts","sourceRoot":"","sources":["../../../src/core/campaign-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAElB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAGvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,MAAM,EAEX,KAAK,eAAe,EACpB,KAAK,WAAW,EAEjB,MAAM,cAAc,CAAC;AAQtB,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CA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BAAkB,KAAG,aAAa,CAAC,YAAY,CAIrF,CAAC;AAIJ,eAAO,MAAM,YAAY,SAAU,gBAAgB,SAAS,WAAW,KAAG,OASzE,CAAC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { type BindingKind, type DeclarationKind, type FactExtractor, type FileSystem, type MemberSubject, type ModuleResolver, PatternInvalid, type SourceFacts, type SyntaxMatcher, type SyntaxTree, type Violation } from "@goodbones/core";
|
|
2
|
+
import * as Result from "effect/Result";
|
|
3
|
+
import type { CampaignProbe, CampaignRule, CampaignUnit, Holdout, ObjectiveRule, OnTouch, PhaseRule, ReportFormat } from "../domain/config.js";
|
|
4
|
+
import type { CampaignPredicate, Range } from "../ports/campaign-predicate.js";
|
|
5
|
+
import type { ReportSource, ReportSpec } from "../ports/report-source.js";
|
|
6
|
+
export type { CampaignPredicate, CampaignPredicateInput, CampaignSubject, Range, } from "../ports/campaign-predicate.js";
|
|
7
|
+
type Target = {
|
|
8
|
+
readonly kind: "path";
|
|
9
|
+
readonly pattern: RegExp;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: "external";
|
|
12
|
+
readonly name: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: "builtin";
|
|
15
|
+
readonly name: string;
|
|
16
|
+
};
|
|
17
|
+
type CompiledNarrowing = {
|
|
18
|
+
readonly capture: string;
|
|
19
|
+
readonly regex: RegExp | null;
|
|
20
|
+
readonly binding: {
|
|
21
|
+
readonly resolves: Target;
|
|
22
|
+
readonly member: ReadonlyArray<string> | null;
|
|
23
|
+
} | null;
|
|
24
|
+
};
|
|
25
|
+
export type CompiledDetector = {
|
|
26
|
+
readonly kind: "all";
|
|
27
|
+
readonly terms: ReadonlyArray<CompiledDetector>;
|
|
28
|
+
} | {
|
|
29
|
+
readonly kind: "any";
|
|
30
|
+
readonly terms: ReadonlyArray<CompiledDetector>;
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: "not";
|
|
33
|
+
readonly term: CompiledDetector;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: "path";
|
|
36
|
+
readonly file: ReadonlyArray<RegExp>;
|
|
37
|
+
readonly fileNot: ReadonlyArray<RegExp>;
|
|
38
|
+
readonly subject: number | null;
|
|
39
|
+
readonly convention: RegExp | null;
|
|
40
|
+
} | {
|
|
41
|
+
readonly kind: "imports";
|
|
42
|
+
readonly resolves: Target;
|
|
43
|
+
readonly symbols: ReadonlyArray<string> | null;
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: "exports";
|
|
46
|
+
readonly name: ReadonlyArray<RegExp>;
|
|
47
|
+
readonly kinds: ReadonlyArray<BindingKind> | null;
|
|
48
|
+
readonly declares: ReadonlyArray<DeclarationKind> | null;
|
|
49
|
+
readonly reexport: boolean | null;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "members";
|
|
52
|
+
readonly subject: MemberSubject;
|
|
53
|
+
readonly name: ReadonlyArray<RegExp>;
|
|
54
|
+
readonly in: ReadonlyArray<RegExp>;
|
|
55
|
+
readonly declares: ReadonlyArray<DeclarationKind> | null;
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: "requires";
|
|
58
|
+
readonly templates: ReadonlyArray<string>;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: "content";
|
|
61
|
+
readonly regex: RegExp;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: "syntax";
|
|
64
|
+
readonly rule: unknown;
|
|
65
|
+
readonly where: ReadonlyArray<CompiledNarrowing>;
|
|
66
|
+
} | {
|
|
67
|
+
readonly kind: "report";
|
|
68
|
+
readonly command: ReadonlyArray<string> | null;
|
|
69
|
+
readonly file: ReadonlyArray<string> | null;
|
|
70
|
+
readonly format: ReportFormat;
|
|
71
|
+
readonly pattern: string | null;
|
|
72
|
+
readonly codes: ReadonlySet<string> | null;
|
|
73
|
+
readonly codesNot: ReadonlySet<string>;
|
|
74
|
+
} | {
|
|
75
|
+
readonly kind: "fn";
|
|
76
|
+
readonly name: string;
|
|
77
|
+
};
|
|
78
|
+
export type CompiledSectorTerm = {
|
|
79
|
+
readonly kind: "has";
|
|
80
|
+
readonly detect: CompiledDetector;
|
|
81
|
+
} | {
|
|
82
|
+
readonly kind: "oneRoot";
|
|
83
|
+
} | {
|
|
84
|
+
readonly kind: "oneHost";
|
|
85
|
+
readonly hosts: ReadonlyArray<RegExp>;
|
|
86
|
+
};
|
|
87
|
+
export type CompiledObjective = {
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly campaign: string;
|
|
91
|
+
readonly message: string;
|
|
92
|
+
readonly why: string | null;
|
|
93
|
+
readonly holdout: Holdout;
|
|
94
|
+
readonly unit: CampaignUnit;
|
|
95
|
+
readonly detect: CompiledDetector | null;
|
|
96
|
+
readonly sector: CompiledSectorTerm | null;
|
|
97
|
+
readonly endState: {
|
|
98
|
+
readonly phase: string;
|
|
99
|
+
readonly family: string;
|
|
100
|
+
} | null;
|
|
101
|
+
readonly until: string | null;
|
|
102
|
+
readonly probes: {
|
|
103
|
+
readonly fires: ReadonlyArray<CampaignProbe>;
|
|
104
|
+
readonly ignores: ReadonlyArray<CampaignProbe>;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export type CompiledPerimeter = {
|
|
108
|
+
readonly kind: "file";
|
|
109
|
+
} | {
|
|
110
|
+
readonly kind: "nx";
|
|
111
|
+
} | {
|
|
112
|
+
readonly kind: "glob";
|
|
113
|
+
readonly glob: ReadonlyArray<RegExp>;
|
|
114
|
+
} | {
|
|
115
|
+
readonly kind: "marker";
|
|
116
|
+
readonly marker: ReadonlyArray<RegExp>;
|
|
117
|
+
readonly probes: {
|
|
118
|
+
readonly fires: ReadonlyArray<string>;
|
|
119
|
+
readonly ignores: ReadonlyArray<string>;
|
|
120
|
+
} | null;
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: "match";
|
|
123
|
+
readonly detect: CompiledDetector;
|
|
124
|
+
readonly unit: "declaration" | "match";
|
|
125
|
+
readonly probes: {
|
|
126
|
+
readonly fires: ReadonlyArray<CampaignProbe>;
|
|
127
|
+
readonly ignores: ReadonlyArray<CampaignProbe>;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export type CompiledCampaign = {
|
|
131
|
+
readonly name: string;
|
|
132
|
+
readonly id: string;
|
|
133
|
+
readonly title: string | null;
|
|
134
|
+
readonly why: string | null;
|
|
135
|
+
readonly owner: string | null;
|
|
136
|
+
readonly scope: ReadonlyArray<RegExp>;
|
|
137
|
+
readonly extensions: ReadonlyArray<string>;
|
|
138
|
+
readonly legacy: ReadonlyArray<RegExp> | null;
|
|
139
|
+
readonly perimeter: CompiledPerimeter | null;
|
|
140
|
+
readonly onTouch: OnTouch | null;
|
|
141
|
+
readonly phases: ReadonlyArray<PhaseRule>;
|
|
142
|
+
readonly objectives: ReadonlyArray<CompiledObjective>;
|
|
143
|
+
readonly staleAfter: number | null;
|
|
144
|
+
readonly onComplete: "keep" | "remove";
|
|
145
|
+
};
|
|
146
|
+
export declare const compileObjective: (rule: ObjectiveRule) => Result.Result<CompiledObjective, PatternInvalid>;
|
|
147
|
+
export declare const compileCampaignRule: (rule: CampaignRule) => Result.Result<CompiledCampaign, PatternInvalid>;
|
|
148
|
+
export declare const compileCampaignRules: (rules: ReadonlyArray<CampaignRule>) => Result.Result<ReadonlyArray<CompiledCampaign>, PatternInvalid>;
|
|
149
|
+
export declare const campaignsSelecting: (rules: ReadonlyArray<CompiledCampaign>, file: string) => ReadonlyArray<CompiledCampaign>;
|
|
150
|
+
export declare const perFileObjectivesOf: (rule: CompiledCampaign) => ReadonlyArray<CompiledObjective>;
|
|
151
|
+
export declare const needsSyntax: (detectors: ReadonlyArray<CompiledDetector>) => boolean;
|
|
152
|
+
declare const LEAF_ORDER: readonly ["path", "imports", "exports", "members", "requires", "content", "syntax", "report", "fn"];
|
|
153
|
+
type LeafKind = (typeof LEAF_ORDER)[number];
|
|
154
|
+
export declare const leafTermsOf: (detector: CompiledDetector) => ReadonlyArray<LeafKind>;
|
|
155
|
+
export type CampaignInput = {
|
|
156
|
+
readonly file: string;
|
|
157
|
+
readonly text: string;
|
|
158
|
+
readonly facts: SourceFacts;
|
|
159
|
+
readonly resolver: ModuleResolver;
|
|
160
|
+
readonly fileSystem: FileSystem;
|
|
161
|
+
readonly syntax: SyntaxTree | null;
|
|
162
|
+
readonly functions: ReadonlyMap<string, CampaignPredicate>;
|
|
163
|
+
readonly reports: ReportSource;
|
|
164
|
+
};
|
|
165
|
+
export type CampaignHit = {
|
|
166
|
+
readonly violation: Violation;
|
|
167
|
+
readonly campaign: string;
|
|
168
|
+
readonly objective: string;
|
|
169
|
+
readonly range?: Range;
|
|
170
|
+
};
|
|
171
|
+
export declare const matchKeyOf: (anchor: string | null, text: string) => string;
|
|
172
|
+
export declare const candidatesOf: (detect: CompiledDetector, unit: CampaignUnit, input: CampaignInput) => ReadonlyArray<{
|
|
173
|
+
readonly key: string;
|
|
174
|
+
readonly range: Range | null;
|
|
175
|
+
}>;
|
|
176
|
+
export declare const evaluateObjective: (rule: CompiledObjective, input: CampaignInput) => ReadonlyArray<CampaignHit>;
|
|
177
|
+
export declare const reportSpecsOf: (rules: ReadonlyArray<CompiledCampaign>) => ReadonlyArray<ReportSpec>;
|
|
178
|
+
export declare const evaluateObjectives: (selected: ReadonlyArray<CompiledObjective>, input: CampaignInput) => ReadonlyArray<CampaignHit>;
|
|
179
|
+
export type TermAnswer = {
|
|
180
|
+
readonly term: string;
|
|
181
|
+
readonly answer: boolean;
|
|
182
|
+
readonly count?: number;
|
|
183
|
+
};
|
|
184
|
+
export declare const detectorOf: (rule: CompiledObjective) => CompiledDetector | null;
|
|
185
|
+
export declare const explainObjective: (rule: CompiledObjective, input: CampaignInput) => ReadonlyArray<TermAnswer>;
|
|
186
|
+
export declare const explainDetector: (detect: CompiledDetector | null, input: CampaignInput) => ReadonlyArray<TermAnswer>;
|
|
187
|
+
export declare const probeInputOf: (probe: CampaignProbe, extractor: FactExtractor, matcher: SyntaxMatcher | null, functions: ReadonlyMap<string, CampaignPredicate>) => CampaignInput;
|
|
188
|
+
export type FailedProbe = {
|
|
189
|
+
readonly name: string;
|
|
190
|
+
readonly probe: CampaignProbe;
|
|
191
|
+
readonly expected: "fires" | "ignores" | "end-shape";
|
|
192
|
+
readonly admittedBy?: string;
|
|
193
|
+
readonly outOfScope?: boolean;
|
|
194
|
+
};
|
|
195
|
+
export declare const campaignsFailingTheirProbe: (rules: ReadonlyArray<CompiledCampaign>, extractor: FactExtractor, matcherFor: (file: string) => SyntaxMatcher | null, functions: ReadonlyMap<string, CampaignPredicate>) => ReadonlyArray<FailedProbe>;
|
|
196
|
+
//# sourceMappingURL=campaigns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../../src/core/campaigns.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,UAAU,EAIf,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,cAAc,EAId,KAAK,WAAW,EAEhB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EAEZ,OAAO,EACP,aAAa,EACb,OAAO,EAEP,SAAS,EACT,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA8B1E,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,KAAK,GACN,MAAM,gCAAgC,CAAC;AAExC,KAAK,MAAM,GACP;IAAE,QAAQ,CAAC,IAAI,EAAE,M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Q,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAErD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAUF,eAAO,MAAM,0BAA0B,UAC9B,aAAa,CAAC,gBAAgB,CAAC,aAC3B,aAAa,cACZ,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,GAAG,IAAI,aACvC,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAChD,aAAa,CAAC,WAAW,CA8D3B,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as Result from "effect/Result";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import type { CampaignUnit } from "../domain/config.js";
|
|
4
|
+
import type { CompiledCampaign } from "./campaigns.js";
|
|
5
|
+
import { type SectorPosition } from "./phases.js";
|
|
6
|
+
export declare const SectorLedger: Schema.Struct<{
|
|
7
|
+
readonly entered: Schema.String;
|
|
8
|
+
readonly initial: Schema.Finite;
|
|
9
|
+
readonly cleared: Schema.Finite;
|
|
10
|
+
readonly closed: Schema.Finite;
|
|
11
|
+
readonly lastCleared: Schema.String;
|
|
12
|
+
readonly holdouts: Schema.$Array<Schema.String>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const Concession: Schema.Union<readonly [Schema.Struct<{
|
|
15
|
+
readonly sector: Schema.String;
|
|
16
|
+
readonly at: Schema.String;
|
|
17
|
+
readonly by: Schema.String;
|
|
18
|
+
readonly delta: Schema.Finite;
|
|
19
|
+
readonly reason: Schema.String;
|
|
20
|
+
readonly holdouts: Schema.$Array<Schema.String>;
|
|
21
|
+
}>, Schema.Struct<{
|
|
22
|
+
readonly sector: Schema.String;
|
|
23
|
+
readonly at: Schema.String;
|
|
24
|
+
readonly by: Schema.String;
|
|
25
|
+
readonly from: Schema.Finite;
|
|
26
|
+
readonly to: Schema.Finite;
|
|
27
|
+
readonly reason: Schema.String;
|
|
28
|
+
}>]>;
|
|
29
|
+
export declare const Ledger: Schema.Struct<{
|
|
30
|
+
readonly version: Schema.Literal<2>;
|
|
31
|
+
readonly campaign: Schema.String;
|
|
32
|
+
readonly objective: Schema.String;
|
|
33
|
+
readonly created: Schema.String;
|
|
34
|
+
readonly sectors: Schema.$Record<Schema.String, Schema.Struct<{
|
|
35
|
+
readonly entered: Schema.String;
|
|
36
|
+
readonly initial: Schema.Finite;
|
|
37
|
+
readonly cleared: Schema.Finite;
|
|
38
|
+
readonly closed: Schema.Finite;
|
|
39
|
+
readonly lastCleared: Schema.String;
|
|
40
|
+
readonly holdouts: Schema.$Array<Schema.String>;
|
|
41
|
+
}>>;
|
|
42
|
+
readonly concessions: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
43
|
+
readonly sector: Schema.String;
|
|
44
|
+
readonly at: Schema.String;
|
|
45
|
+
readonly by: Schema.String;
|
|
46
|
+
readonly delta: Schema.Finite;
|
|
47
|
+
readonly reason: Schema.String;
|
|
48
|
+
readonly holdouts: Schema.$Array<Schema.String>;
|
|
49
|
+
}>, Schema.Struct<{
|
|
50
|
+
readonly sector: Schema.String;
|
|
51
|
+
readonly at: Schema.String;
|
|
52
|
+
readonly by: Schema.String;
|
|
53
|
+
readonly from: Schema.Finite;
|
|
54
|
+
readonly to: Schema.Finite;
|
|
55
|
+
readonly reason: Schema.String;
|
|
56
|
+
}>]>>;
|
|
57
|
+
}>;
|
|
58
|
+
export type Ledger = typeof Ledger.Type;
|
|
59
|
+
export type SectorLedger = typeof SectorLedger.Type;
|
|
60
|
+
export type Concession = typeof Concession.Type;
|
|
61
|
+
export declare const EMPTY_LEDGER: (campaign: string, objective: string, now: number) => Ledger;
|
|
62
|
+
export declare const isLegacyLedger: (raw: unknown) => boolean;
|
|
63
|
+
export declare const decodeLedger: (raw: unknown) => Result.Result<Ledger, string>;
|
|
64
|
+
export declare const serializeLedger: (ledger: Ledger) => string;
|
|
65
|
+
export declare const deltaOf: (concession: Concession) => number;
|
|
66
|
+
export declare const sectorArithmeticHolds: (ledger: Ledger, sector: string) => boolean;
|
|
67
|
+
export declare const ledgerArithmeticHolds: (ledger: Ledger) => boolean;
|
|
68
|
+
export type Reconciliation = {
|
|
69
|
+
readonly ledgered: ReadonlyArray<string>;
|
|
70
|
+
readonly unrecorded: ReadonlyArray<string>;
|
|
71
|
+
readonly stale: ReadonlyArray<string>;
|
|
72
|
+
readonly drifted: ReadonlyArray<{
|
|
73
|
+
readonly from: string;
|
|
74
|
+
readonly to: string;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
export declare const reconcileSector: (ledger: Ledger, sector: string, entries: Iterable<string>, unit: CampaignUnit) => Reconciliation;
|
|
78
|
+
export declare const clearedSector: (ledger: Ledger, sector: string, entries: Iterable<string>, unit: CampaignUnit, now: number, window: "inside" | "outside") => Ledger;
|
|
79
|
+
export type ConcessionRecord = {
|
|
80
|
+
readonly at: number;
|
|
81
|
+
readonly by: string;
|
|
82
|
+
readonly reason: string;
|
|
83
|
+
};
|
|
84
|
+
export declare const concededSector: (ledger: Ledger, sector: string, entries: Iterable<string>, record: ConcessionRecord) => Ledger;
|
|
85
|
+
export declare const rebaselinedSector: (ledger: Ledger, sector: string, entries: Iterable<string>, record: ConcessionRecord) => Ledger;
|
|
86
|
+
export declare const holdoutsOf: (ledger: Ledger) => number;
|
|
87
|
+
export declare const initialOf: (ledger: Ledger) => number;
|
|
88
|
+
export declare const clearedOf: (ledger: Ledger) => number;
|
|
89
|
+
export declare const closedOf: (ledger: Ledger) => number;
|
|
90
|
+
export declare const allowedOf: (ledger: Ledger) => number;
|
|
91
|
+
export declare const progressOf: (ledger: Ledger) => number;
|
|
92
|
+
export declare const isComplete: (ledger: Ledger) => boolean;
|
|
93
|
+
export declare const lastClearedOf: (ledger: Ledger) => string | null;
|
|
94
|
+
export declare const isStalled: (rule: {
|
|
95
|
+
readonly staleAfter: number | null;
|
|
96
|
+
}, ledger: Ledger, now: number, sectorClock?: string | null) => boolean;
|
|
97
|
+
declare const Attestation: Schema.Struct<{
|
|
98
|
+
readonly phase: Schema.String;
|
|
99
|
+
readonly reason: Schema.String;
|
|
100
|
+
readonly evidence: Schema.optionalKey<Schema.String>;
|
|
101
|
+
readonly at: Schema.String;
|
|
102
|
+
readonly by: Schema.String;
|
|
103
|
+
}>;
|
|
104
|
+
declare const Note: Schema.Struct<{
|
|
105
|
+
readonly at: Schema.String;
|
|
106
|
+
readonly by: Schema.String;
|
|
107
|
+
readonly phase: Schema.NullOr<Schema.String>;
|
|
108
|
+
readonly text: Schema.String;
|
|
109
|
+
}>;
|
|
110
|
+
export declare const SectorRecord: Schema.Struct<{
|
|
111
|
+
readonly version: Schema.Literal<1>;
|
|
112
|
+
readonly campaign: Schema.String;
|
|
113
|
+
readonly sector: Schema.String;
|
|
114
|
+
readonly reached: Schema.NullOr<Schema.String>;
|
|
115
|
+
readonly since: Schema.String;
|
|
116
|
+
readonly attested: Schema.$Array<Schema.Struct<{
|
|
117
|
+
readonly phase: Schema.String;
|
|
118
|
+
readonly reason: Schema.String;
|
|
119
|
+
readonly evidence: Schema.optionalKey<Schema.String>;
|
|
120
|
+
readonly at: Schema.String;
|
|
121
|
+
readonly by: Schema.String;
|
|
122
|
+
}>>;
|
|
123
|
+
readonly notes: Schema.$Array<Schema.Struct<{
|
|
124
|
+
readonly at: Schema.String;
|
|
125
|
+
readonly by: Schema.String;
|
|
126
|
+
readonly phase: Schema.NullOr<Schema.String>;
|
|
127
|
+
readonly text: Schema.String;
|
|
128
|
+
}>>;
|
|
129
|
+
}>;
|
|
130
|
+
export type SectorRecord = typeof SectorRecord.Type;
|
|
131
|
+
export type Attestation = typeof Attestation.Type;
|
|
132
|
+
export type Note = typeof Note.Type;
|
|
133
|
+
export declare const decodeSectorRecord: (raw: unknown) => Result.Result<SectorRecord, string>;
|
|
134
|
+
export declare const serializeSectorRecord: (record: SectorRecord) => string;
|
|
135
|
+
export declare const EMPTY_SECTOR_RECORD: (campaign: string, sector: string, now: number) => SectorRecord;
|
|
136
|
+
export declare const positionOf: (rule: CompiledCampaign, record: SectorRecord | undefined) => SectorPosition;
|
|
137
|
+
export declare const reachedRecord: (record: SectorRecord, rule: CompiledCampaign, phase: number, now: number) => SectorRecord;
|
|
138
|
+
export declare const attestedRecord: (record: SectorRecord, entry: Omit<Attestation, "at"> & {
|
|
139
|
+
readonly at: number;
|
|
140
|
+
}) => SectorRecord;
|
|
141
|
+
export declare const NOTE_CAP = 20;
|
|
142
|
+
export declare const NOTE_LENGTH = 500;
|
|
143
|
+
export declare const notedRecord: (record: SectorRecord, note: Omit<Note, "at"> & {
|
|
144
|
+
readonly at: number;
|
|
145
|
+
}) => SectorRecord;
|
|
146
|
+
export declare const sectorClockOf: (record: SectorRecord) => string;
|
|
147
|
+
export declare const PlanRecord: Schema.Struct<{
|
|
148
|
+
readonly version: Schema.Literal<1>;
|
|
149
|
+
readonly campaign: Schema.String;
|
|
150
|
+
readonly phases: Schema.$Array<Schema.Struct<{
|
|
151
|
+
readonly id: Schema.String;
|
|
152
|
+
readonly hash: Schema.String;
|
|
153
|
+
readonly defined: Schema.Boolean;
|
|
154
|
+
readonly concessions: Schema.Finite;
|
|
155
|
+
}>>;
|
|
156
|
+
}>;
|
|
157
|
+
export type PlanRecord = typeof PlanRecord.Type;
|
|
158
|
+
export declare const decodePlanRecord: (raw: unknown) => Result.Result<PlanRecord, string>;
|
|
159
|
+
export declare const serializePlanRecord: (record: PlanRecord) => string;
|
|
160
|
+
export declare const planOf: (rule: CompiledCampaign) => PlanRecord;
|
|
161
|
+
export type PlanDiff = {
|
|
162
|
+
readonly refined: ReadonlyArray<string>;
|
|
163
|
+
readonly changed: ReadonlyArray<string>;
|
|
164
|
+
readonly unreceipted: ReadonlyArray<string>;
|
|
165
|
+
};
|
|
166
|
+
export declare const planDiffOf: (rule: CompiledCampaign, recorded: PlanRecord | undefined) => PlanDiff;
|
|
167
|
+
export declare const ledgerPathOf: (dir: string, campaign: string, objective: string) => string;
|
|
168
|
+
export declare const legacyLedgerPathOf: (dir: string, campaign: string) => string;
|
|
169
|
+
export declare const encodeSectorName: (sector: string) => string;
|
|
170
|
+
export declare const sectorRecordPathOf: (dir: string, campaign: string, sector: string) => string;
|
|
171
|
+
export declare const planPathOf: (dir: string, campaign: string) => string;
|
|
172
|
+
export {};
|
|
173
|
+
//# sourceMappingURL=ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../src/core/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAyBlE,eAAO,MAAM,YAAY;;;;;;;EAcvB,CAAC;AAuBH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;IAAqC,CAAC;AAE7D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AA8BhD,eAAO,MAAM,YAAY,aAAc,MAAM,aAAa,MAAM,OAAO,MAAM,KAAG,MAO9E,CAAC;AAEH,eAAO,MAAM,cAAc,QAAS,OAAO,KAAG,OACoD,CAAC;AAMnG,eAAO,MAAM,YAAY,QAAS,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAA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rF,CAAC;AAKF,eAAO,MAAM,YAAY,QAAS,MAAM,YAAY,MAAM,aAAa,MAAM,KAAG,MACxC,CAAC;AAGzC,eAAO,MAAM,kBAAkB,QAAS,MAAM,YAAY,MAAM,KAAG,MACxC,CAAC;AAE5B,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,MAAoC,CAAC;AAEvF,eAAO,MAAM,kBAAkB,QAAS,MAAM,YAAY,MAAM,UAAU,MAAM,KAAG,MACpB,CAAC;AAEhE,eAAO,MAAM,UAAU,QAAS,MAAM,YAAY,MAAM,KAAG,MAAwC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OnTouch, PhaseRule } from "../domain/config.js";
|
|
2
|
+
import type { CompiledCampaign, CompiledObjective } from "./campaigns.js";
|
|
3
|
+
export declare const donePhaseOf: (rule: CompiledCampaign) => number;
|
|
4
|
+
export declare const LEGACY_PHASE = 0;
|
|
5
|
+
export declare const isOpenPhase: (phase: PhaseRule) => boolean;
|
|
6
|
+
export declare const isDefinedPhase: (phase: PhaseRule) => boolean;
|
|
7
|
+
export type SectorPosition = {
|
|
8
|
+
readonly reached: number;
|
|
9
|
+
readonly attested: ReadonlySet<string>;
|
|
10
|
+
};
|
|
11
|
+
export declare const UNPLACED: SectorPosition;
|
|
12
|
+
export type Window = {
|
|
13
|
+
readonly from: number;
|
|
14
|
+
readonly until: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const windowOf: (rule: CompiledCampaign, objective: CompiledObjective) => Window;
|
|
17
|
+
export declare const isShut: (rule: CompiledCampaign, objective: CompiledObjective, position: SectorPosition) => boolean;
|
|
18
|
+
export declare const inWindow: (rule: CompiledCampaign, objective: CompiledObjective, phase: number, position: SectorPosition) => boolean;
|
|
19
|
+
export declare const objectivesInWindow: (rule: CompiledCampaign, phase: number, position: SectorPosition) => ReadonlyArray<CompiledObjective>;
|
|
20
|
+
export declare const derivePhase: (rule: CompiledCampaign, counts: (objectiveId: string) => number, position: SectorPosition) => number;
|
|
21
|
+
export declare const onTouchOf: (rule: CompiledCampaign, phase: number) => OnTouch;
|
|
22
|
+
export type Residue = Readonly<Record<string, number>>;
|
|
23
|
+
export type Direction = "forward" | "back" | "mixed" | "neutral";
|
|
24
|
+
export declare const compareResidue: (before: Residue, after: Residue) => Direction;
|
|
25
|
+
export declare const worsened: (before: Residue, after: Residue) => ReadonlyArray<string>;
|
|
26
|
+
//# sourceMappingURL=phases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../../../src/core/phases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAU1E,eAAO,MAAM,WAAW,SAAU,gBAAgB,KAAG,MAA4B,CAAC;AAIlF,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,eAAO,MAAM,WAAW,UAAW,SAAS,KAAG,OACG,CAAC;AAEnD,eAAO,MAAM,cAAc,UAAW,SAAS,KAAG,OAA8B,CAAC;AAIjF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,cAAqD,CAAC;AAE7E,MAAM,MAAM,MAAM,GAAG;IAGnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,gBAAgB,aAAa,iBAAiB,KAAG,MAO/E,CAAC;AAKF,eAAO,MAAM,MAAM,SACX,gBAAgB,aACX,iBAAiB,YAClB,cAAc,KACvB,OAGF,CAAC;AAEF,eAAO,MAAM,QAAQ,SACb,gBAAgB,aACX,iBAAiB,SACrB,MAAM,YACH,cAAc,KACvB,OAIF,CAAC;AAEF,eAAO,MAAM,kBAAkB,SACvB,gBAAgB,SACf,MAAM,YACH,cAAc,KACvB,aAAa,CAAC,iBAAiB,CACiD,CAAC;AAMpF,eAAO,MAAM,WAAW,SAChB,gBAAgB,UACd,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,YAC7B,cAAc,KACvB,MAaF,CAAC;AAIF,eAAO,MAAM,SAAS,SAAU,gBAAgB,SAAS,MAAM,KAAG,OAKjE,CAAC;AAGF,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAKjE,eAAO,MAAM,cAAc,WAAY,OAAO,SAAS,OAAO,KAAG,SAahE,CAAC;AAGF,eAAO,MAAM,QAAQ,WAAY,OAAO,SAAS,OAAO,KAAG,aAAa,CAAC,MAAM,CAGpE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Violation } from "@goodbones/core";
|
|
2
|
+
import type { CompiledCampaign } from "./campaigns.js";
|
|
3
|
+
export declare const IMPLICIT_SECTOR = "scope";
|
|
4
|
+
export declare const LEGACY_SECTOR = "legacy";
|
|
5
|
+
export type Sector = {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly roots: ReadonlyArray<string>;
|
|
8
|
+
readonly files: ReadonlyArray<string>;
|
|
9
|
+
readonly marker: string | null;
|
|
10
|
+
readonly declaration: {
|
|
11
|
+
readonly file: string;
|
|
12
|
+
readonly anchor: string;
|
|
13
|
+
} | null;
|
|
14
|
+
};
|
|
15
|
+
export type SectorIndex = {
|
|
16
|
+
readonly sectors: ReadonlyMap<string, Sector>;
|
|
17
|
+
readonly legacy: ReadonlyArray<string>;
|
|
18
|
+
readonly sectorOf: (file: string) => string | null;
|
|
19
|
+
readonly sectorOfHit: (file: string, subject: string | null) => string | null;
|
|
20
|
+
readonly drift: ReadonlyArray<{
|
|
21
|
+
readonly file: string;
|
|
22
|
+
readonly sectors: ReadonlyArray<string>;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export type SectorMarker = {
|
|
26
|
+
readonly name?: string | undefined;
|
|
27
|
+
readonly owns?: ReadonlyArray<string> | undefined;
|
|
28
|
+
};
|
|
29
|
+
export declare const parseSectorMarker: (text: string) => SectorMarker | null;
|
|
30
|
+
export declare const withoutExtension: (file: string) => string;
|
|
31
|
+
export declare const fixedPrefixOf: (glob: string) => string;
|
|
32
|
+
export type SectorDiscovery = {
|
|
33
|
+
readonly files: ReadonlyArray<string>;
|
|
34
|
+
readonly readText: (file: string) => string | null;
|
|
35
|
+
readonly globToRegExp: (glob: string) => RegExp;
|
|
36
|
+
readonly perimeterMatches?: ((file: string) => ReadonlyArray<string>) | undefined;
|
|
37
|
+
readonly projects?: ReadonlyArray<{
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly root: string;
|
|
40
|
+
}> | undefined;
|
|
41
|
+
};
|
|
42
|
+
export declare const discoverSectors: (rule: CompiledCampaign, input: SectorDiscovery) => SectorIndex;
|
|
43
|
+
export declare const rootOf: (sector: Sector, file: string) => string;
|
|
44
|
+
export declare const SECTOR_HOLDOUT = "~";
|
|
45
|
+
export declare const entryOf: (violation: Violation, root: string) => string;
|
|
46
|
+
export declare const sectorNamed: (index: SectorIndex, name: string) => Sector | null;
|
|
47
|
+
export type Placement = {
|
|
48
|
+
readonly sector: string;
|
|
49
|
+
readonly root: string;
|
|
50
|
+
};
|
|
51
|
+
export declare const membershipOf: (rule: CompiledCampaign, file: string, index: SectorIndex | null, anchors: ReadonlyArray<string>) => ((subject: string | null) => Placement | null);
|
|
52
|
+
//# sourceMappingURL=sectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sectors.d.ts","source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