@intentius/chant 0.108.1 → 0.109.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/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/composite.d.ts +5 -0
- package/dist/composite.d.ts.map +1 -1
- package/dist/discovery/collect.d.ts.map +1 -1
- package/dist/discovery/fold-import.d.ts +15 -0
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/param-deps.d.ts +30 -3
- package/dist/discovery/param-deps.d.ts.map +1 -1
- package/dist/fold/subset.d.ts +10 -2
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/fold-provenance.d.ts +35 -2
- package/dist/fold-provenance.d.ts.map +1 -1
- package/dist/provenance.d.ts +38 -0
- package/dist/provenance.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/handlers/lifecycle.test.ts +106 -1
- package/src/cli/handlers/lifecycle.ts +26 -5
- package/src/composite.ts +37 -0
- package/src/discovery/collect.ts +13 -3
- package/src/discovery/fold-import.ts +251 -9
- package/src/discovery/fold-package-composite.test.ts +14 -1
- package/src/discovery/fold-project-provenance.test.ts +532 -0
- package/src/discovery/param-deps.test.ts +120 -1
- package/src/discovery/param-deps.ts +73 -3
- package/src/fold/subset-public-export.test.ts +38 -0
- package/src/fold/subset.ts +10 -2
- package/src/fold-provenance.test.ts +179 -16
- package/src/fold-provenance.ts +136 -11
- package/src/provenance.ts +46 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/lifecycle.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,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 export declare class CompositeRegistry {
|
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
78
|
export declare function Composite<P, M extends CompositeFactoryMembers = CompositeMembers>(factory: (props: P) => M, name?: string): CompositeDefinition<P, M>;
|
|
79
|
+
/**
|
|
80
|
+
* chant#3608 — the composite whose call built `entity`, or `undefined` for an
|
|
81
|
+
* entity no chant composite built.
|
|
82
|
+
*/
|
|
83
|
+
export declare function compositeOfMember(entity: object): string | undefined;
|
|
79
84
|
/**
|
|
80
85
|
* Expands a CompositeInstance into a flat Map of prefixed entity names to Declarables.
|
|
81
86
|
* Handles nested composites recursively.
|
package/dist/composite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../src/composite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAgC,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uBAAuB,GAE/B,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAO/D,iBAAiB,CAAC,GAAG,CAAC,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,uBAAuB,GAAG,gBAAgB;IACrF,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAEpB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,EAAE,CAAC,SAAS,uBAAuB,GAAG,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eAAuC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,cAAc,eAA0C,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,gBAAgB,EAClD,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAM1B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,EAC9C,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,EAC/D,KAAK,EAAE,CAAC,EACR,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,CAAC,CAEH;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,IAAI,EAAE,CAAC,EACP,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,GAC9B,CAAC,CAqBH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/discovery/collect.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/discovery/collect.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAmI9D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,EAClE,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAiEzB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import { type Declarable } from "../declarable.js";
|
|
3
3
|
import { type CompositeInstance } from "../composite.js";
|
|
4
|
+
import { type FoldProvenance } from "../fold-provenance.js";
|
|
4
5
|
import { type IntrinsicDef } from "../lexicon.js";
|
|
5
6
|
import type { BuildParamValue } from "../build-params.js";
|
|
6
7
|
/**
|
|
@@ -622,6 +623,20 @@ export interface FoldProjectVerdict {
|
|
|
622
623
|
};
|
|
623
624
|
/** The file's complete export namespace, present only when `verdict` is "fold". */
|
|
624
625
|
readonly exports?: ReadonlyMap<string, unknown>;
|
|
626
|
+
/**
|
|
627
|
+
* chant#3598 — fold provenance for the entities this file contributes,
|
|
628
|
+
* keyed by entity name, in the shape `build()` reports as
|
|
629
|
+
* `BuildResult.foldProvenance`. Present only when `verdict` is "fold" and
|
|
630
|
+
* the folded files' entities could be collected (a duplicate entity name
|
|
631
|
+
* fails collection for the whole set, as it fails a build, and then no
|
|
632
|
+
* verdict carries it). A file that folds and declares nothing with
|
|
633
|
+
* properties carries `{}`.
|
|
634
|
+
*
|
|
635
|
+
* A "run" file has no entry: foldProject never executes one, so it has no
|
|
636
|
+
* entities to attribute. That holds under `sandbox` too, where nothing
|
|
637
|
+
* crosses the child-process wire because no child is started.
|
|
638
|
+
*/
|
|
639
|
+
readonly foldProvenance?: FoldProvenance;
|
|
625
640
|
}
|
|
626
641
|
/**
|
|
627
642
|
* Fold a whole set of project files and report every file's verdict
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,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,aAAa,CAAA;KAAE,CAAC;IAC3D,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAkE1C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
|
-
import type { PathOrigin } from "../provenance.js";
|
|
2
|
+
import type { ArgumentLocation, PathOrigin, SourceLocation } from "../provenance.js";
|
|
3
3
|
/**
|
|
4
4
|
* Path → build-parameter origin for one resource's props object literal.
|
|
5
5
|
*
|
|
@@ -29,6 +29,30 @@ export interface CompositeParamScope {
|
|
|
29
29
|
/** Local name → the parameter path it was destructured from (`({ name }) => …`). */
|
|
30
30
|
destructured: ReadonlyMap<string, string>;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* The composite call an interpreted factory body was reached from (chant
|
|
34
|
+
* #3597): the `WebApp({ replicas: 3 })` expression in the author's source and
|
|
35
|
+
* the absolute path of the file it is written in. The node must come from a
|
|
36
|
+
* source file parsed with parent pointers, which is how `fold-import.ts`
|
|
37
|
+
* parses every file it interprets.
|
|
38
|
+
*/
|
|
39
|
+
export interface CompositeCallSite {
|
|
40
|
+
file: string;
|
|
41
|
+
node: ts.CallExpression;
|
|
42
|
+
}
|
|
43
|
+
/** A node's start as a 1-based {@link SourceLocation}. */
|
|
44
|
+
export declare function sourceLocationOf(file: string, node: ts.Node): SourceLocation;
|
|
45
|
+
/**
|
|
46
|
+
* Where `parameter` was written at `call`: the property at that path in the
|
|
47
|
+
* call's object-literal argument, descending nested object literals segment by
|
|
48
|
+
* segment, or the call itself when there is no such property.
|
|
49
|
+
*
|
|
50
|
+
* The fallback covers a parameter the call leaves out, one that arrives through
|
|
51
|
+
* a spread, and an argument that is not an object literal. In each of those the
|
|
52
|
+
* call is the nearest place that governs the value, and no `text` is given,
|
|
53
|
+
* because no property at the call says what it is.
|
|
54
|
+
*/
|
|
55
|
+
export declare function argumentLocation(call: CompositeCallSite, parameter: string): ArgumentLocation;
|
|
32
56
|
/**
|
|
33
57
|
* Path → composite origin for one `new Type({...})` inside an interpreted
|
|
34
58
|
* composite factory body (chant #2161).
|
|
@@ -45,8 +69,11 @@ export interface CompositeParamScope {
|
|
|
45
69
|
* something under here", while `composite-literal` would be a claim that every
|
|
46
70
|
* key it brings is fixed. That claim is left unmade, and those paths come back
|
|
47
71
|
* `unknown` from ../fold-provenance.ts instead.
|
|
72
|
+
*
|
|
73
|
+
* `call` (chant #3597), when the fold saw the composite call, adds where each
|
|
74
|
+
* parameter's argument was written there, in the same pass.
|
|
48
75
|
*/
|
|
49
|
-
export declare function collectCompositeOrigins(props: ts.ObjectLiteralExpression, consts: ReadonlyMap<string, ts.Expression>, scope: CompositeParamScope, composite: string): Record<string, PathOrigin>;
|
|
76
|
+
export declare function collectCompositeOrigins(props: ts.ObjectLiteralExpression, consts: ReadonlyMap<string, ts.Expression>, scope: CompositeParamScope, composite: string, call?: CompositeCallSite): Record<string, PathOrigin>;
|
|
50
77
|
/**
|
|
51
78
|
* Path → composite origin for an entity a registered tag built inside an
|
|
52
79
|
* interpreted composite factory body (chant #3212).
|
|
@@ -62,5 +89,5 @@ export declare function collectCompositeOrigins(props: ts.ObjectLiteralExpressio
|
|
|
62
89
|
* recorded `composite-literal` at the key, which a parameter recorded deeper
|
|
63
90
|
* still outranks by longest prefix.
|
|
64
91
|
*/
|
|
65
|
-
export declare function collectTagOrigins(interpolations: readonly ts.Expression[], fields: ReadonlyArray<readonly string[]>, props: unknown, consts: ReadonlyMap<string, ts.Expression>, scope: CompositeParamScope, composite: string): Record<string, PathOrigin>;
|
|
92
|
+
export declare function collectTagOrigins(interpolations: readonly ts.Expression[], fields: ReadonlyArray<readonly string[]>, props: unknown, consts: ReadonlyMap<string, ts.Expression>, scope: CompositeParamScope, composite: string, call?: CompositeCallSite): Record<string, PathOrigin>;
|
|
66
93
|
//# sourceMappingURL=param-deps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"param-deps.d.ts","sourceRoot":"","sources":["../../src/discovery/param-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"param-deps.d.ts","sourceRoot":"","sources":["../../src/discovery/param-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAsHlF;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,EAAE,CAAC,uBAAuB,EACjC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAC1C,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAC/B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAwC5B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,oFAAoF;IACpF,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAkGD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC;CACzB;AAED,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,cAAc,CAI5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAmB7F;AAOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,EAAE,CAAC,uBAAuB,EACjC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAC1C,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,iBAAiB,GACvB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAkD5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,EACxC,MAAM,EAAE,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,EACxC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAC1C,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,iBAAiB,GACvB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAqB5B"}
|
package/dist/fold/subset.d.ts
CHANGED
|
@@ -176,7 +176,7 @@ import { type IntrinsicDef } from "../lexicon.js";
|
|
|
176
176
|
* `spec/VERSION` in the specification repository carries the same string, and
|
|
177
177
|
* the conformance adapter reads this one to fill its `specVersion` field.
|
|
178
178
|
*
|
|
179
|
-
* ## Why
|
|
179
|
+
* ## Why 2.2, and what each version since 1.0 asked for (chant#2445)
|
|
180
180
|
*
|
|
181
181
|
* Raising this is the last step of adopting a rule set, so each version was
|
|
182
182
|
* checked against what chant does rather than against whether the suite is
|
|
@@ -217,6 +217,14 @@ import { type IntrinsicDef } from "../lexicon.js";
|
|
|
217
217
|
* - **1.8** added `ι = executing`, and chant carries it as of `0.72.3`
|
|
218
218
|
* (#2455) — `FoldProjectOptions.executing`, mutually exclusive with
|
|
219
219
|
* `sandbox`. `open` stays the default and stays strict (#2453).
|
|
220
|
+
* - **2.2** added obligations to `F-Obs-Provenance` for an implementation that
|
|
221
|
+
* claims provenance: one origin per emitted path of four kinds, the
|
|
222
|
+
* innermost writer wins, and an origin that cannot be determined is reported
|
|
223
|
+
* as unknown, never as direct. chant claims provenance, so this is the
|
|
224
|
+
* version whose obligations it takes on. 2.2 also widens two rules to what
|
|
225
|
+
* chant already did: a call-bound local exported by name (`export { x }`)
|
|
226
|
+
* resolves by F-Call as the single declarator does, and a same-file call's
|
|
227
|
+
* result read inside an F-Call argument resolves once per file (#3329).
|
|
220
228
|
*
|
|
221
229
|
* `scripts/check-docs-citations.ts` refuses to run when this constant and the
|
|
222
230
|
* rules it loads disagree, so this and the `@intentius/tsad-conformance`
|
|
@@ -228,7 +236,7 @@ import { type IntrinsicDef } from "../lexicon.js";
|
|
|
228
236
|
* Until chant#2470 the rules came from a commit `docs-check.yml` checked out;
|
|
229
237
|
* now they come from the published package, so bumping it is what moves this.
|
|
230
238
|
*/
|
|
231
|
-
export declare const SPEC_VERSION = "2.
|
|
239
|
+
export declare const SPEC_VERSION = "2.2";
|
|
232
240
|
/** The two EVL rule ids a shape violation can be attributed to. */
|
|
233
241
|
export type SubsetRuleId = "EVL001" | "EVL003";
|
|
234
242
|
/** A located, shape-level rejection: the offending node, the EVL rule id it maps to, and a message. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subset.d.ts","sourceRoot":"","sources":["../../src/fold/subset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9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S,YAAY,EAAE,GACnC,eAAe,GAAG,SAAS,CAkO7B"}
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
* call and the parameter path, and performs no edit.
|
|
70
70
|
*/
|
|
71
71
|
import { type Declarable } from "./declarable.js";
|
|
72
|
-
import { type EntityProvenance, type PathOrigin } from "./provenance.js";
|
|
72
|
+
import { type ArgumentLocation, type EntityProvenance, type PathOrigin, type SourceLocation } from "./provenance.js";
|
|
73
73
|
import type { DeepEntityDrift } from "./lifecycle/deep-diff.js";
|
|
74
74
|
/** Why a field's origin could not be determined. Both are facts about the BUILD, not about the field. */
|
|
75
75
|
export type UnknownOriginReason =
|
|
@@ -98,10 +98,15 @@ export type FoldFieldOrigin = {
|
|
|
98
98
|
composite: string;
|
|
99
99
|
instance?: string;
|
|
100
100
|
parameters: string[];
|
|
101
|
+
/** Where the composite call was written (chant #3597), when the build saw it. */
|
|
102
|
+
call?: SourceLocation;
|
|
103
|
+
/** Where each parameter's argument was written at that call, in `parameters` order. */
|
|
104
|
+
arguments?: ArgumentLocation[];
|
|
101
105
|
} | {
|
|
102
106
|
kind: "composite-literal";
|
|
103
107
|
composite: string;
|
|
104
108
|
instance?: string;
|
|
109
|
+
call?: SourceLocation;
|
|
105
110
|
} | {
|
|
106
111
|
kind: "direct";
|
|
107
112
|
} | {
|
|
@@ -116,6 +121,11 @@ export interface EntityFoldProvenance {
|
|
|
116
121
|
composite?: string;
|
|
117
122
|
/** The composite call (export name) it belongs to, when one expanded it. */
|
|
118
123
|
instance?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Where that composite call was written (chant #3597), when the fold
|
|
126
|
+
* interpreted the factory at a call it saw as written.
|
|
127
|
+
*/
|
|
128
|
+
compositeCall?: SourceLocation;
|
|
119
129
|
/**
|
|
120
130
|
* Emitted property path to origin, in sorted key order. Every path the entity
|
|
121
131
|
* emits is present: a path with no attribution carries an `unknown` origin
|
|
@@ -165,6 +175,15 @@ export declare function foldProvenanceOfEntities(entities: ReadonlyMap<string, D
|
|
|
165
175
|
export declare function describeFoldFieldOrigin(origin: FoldFieldOrigin): string;
|
|
166
176
|
/** Why an origin could not be determined, in words a report can print. */
|
|
167
177
|
export declare function unknownOriginText(reason: UnknownOriginReason): string;
|
|
178
|
+
/** `src/app.ts:12`, relative to `root` when it is inside it. */
|
|
179
|
+
export declare function formatSourceLocation(location: SourceLocation, root?: string): string;
|
|
180
|
+
/**
|
|
181
|
+
* The composite call as the author wrote the arguments that govern a field:
|
|
182
|
+
* `WebApp({ replicas: 3 })`, or `WebApp({ iam: { path: "/service/" } })` for a
|
|
183
|
+
* nested parameter. Only arguments actually written at the call appear; when
|
|
184
|
+
* none is, the call is shown as `WebApp(...)`.
|
|
185
|
+
*/
|
|
186
|
+
export declare function describeCompositeArguments(composite: string, locations: readonly ArgumentLocation[]): string;
|
|
168
187
|
/**
|
|
169
188
|
* What the return leg may do about one drifted field.
|
|
170
189
|
*
|
|
@@ -203,6 +222,12 @@ export interface FieldReconcile {
|
|
|
203
222
|
declared?: unknown;
|
|
204
223
|
live?: unknown;
|
|
205
224
|
origin: FoldFieldOrigin;
|
|
225
|
+
/**
|
|
226
|
+
* One line naming where the field came from (chant #3597):
|
|
227
|
+
* `spec.replicas on Deployment webDeployment comes from WebApp({ replicas: 3 }) at src/app.ts:12`.
|
|
228
|
+
* An `unknown` origin says so and why; it never reads as a direct declaration.
|
|
229
|
+
*/
|
|
230
|
+
summary: string;
|
|
206
231
|
resolution: DriftResolution;
|
|
207
232
|
}
|
|
208
233
|
/**
|
|
@@ -212,14 +237,20 @@ export interface FieldReconcile {
|
|
|
212
237
|
* source declared, whose live value moved. Undeclared fields are held
|
|
213
238
|
* elsewhere and never reach here, so the only question left is which of the
|
|
214
239
|
* four origins produced the field.
|
|
240
|
+
*
|
|
241
|
+
* `entityType` names the resource in the summary line, and `root` (the
|
|
242
|
+
* project directory) makes the file names in it relative. Both are optional;
|
|
243
|
+
* without them the summary uses the entity name alone and absolute files.
|
|
215
244
|
*/
|
|
216
245
|
export declare function resolveDriftedField(input: {
|
|
217
246
|
entity: string;
|
|
247
|
+
entityType?: string;
|
|
218
248
|
path: string;
|
|
219
249
|
declared?: unknown;
|
|
220
250
|
live?: unknown;
|
|
221
251
|
origin?: PathOrigin;
|
|
222
252
|
provenance?: EntityProvenance;
|
|
253
|
+
root?: string;
|
|
223
254
|
}): FieldReconcile;
|
|
224
255
|
/**
|
|
225
256
|
* Every drifted field in a deep diff, classified.
|
|
@@ -232,5 +263,7 @@ export declare function resolveDriftedField(input: {
|
|
|
232
263
|
* cloud does not have it. That is still drift on a declared path, and the same
|
|
233
264
|
* four origins decide what may be proposed about it.
|
|
234
265
|
*/
|
|
235
|
-
export declare function resolveDeepDrift(drifted: readonly DeepEntityDrift[], provenanceOf: (entity: string) => EntityProvenance | undefined
|
|
266
|
+
export declare function resolveDeepDrift(drifted: readonly DeepEntityDrift[], provenanceOf: (entity: string) => EntityProvenance | undefined, options?: {
|
|
267
|
+
root?: string;
|
|
268
|
+
}): FieldReconcile[];
|
|
236
269
|
//# sourceMappingURL=fold-provenance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-provenance.d.ts","sourceRoot":"","sources":["../src/fold-provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,OAAO,EAAwB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"fold-provenance.d.ts","sourceRoot":"","sources":["../src/fold-provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,OAAO,EAAwB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,U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AA;CAAO,GAC9B,cAAc,EAAE,CAoBlB"}
|
package/dist/provenance.d.ts
CHANGED
|
@@ -29,6 +29,13 @@ export interface EntityProvenance {
|
|
|
29
29
|
* collapse a composite to a single node at coarse diagram detail levels (#494).
|
|
30
30
|
*/
|
|
31
31
|
compositeInstance?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Where the composite call that expanded this entity was written (chant
|
|
34
|
+
* #3597): the `WebApp({...})` expression, not the factory body. Recorded
|
|
35
|
+
* only when the fold interpreted the factory at a call it could see; the
|
|
36
|
+
* run path and a nested call made from already-folded values leave it unset.
|
|
37
|
+
*/
|
|
38
|
+
compositeCall?: SourceLocation;
|
|
32
39
|
/**
|
|
33
40
|
* Per-path origins within the entity's `props` (chant #1443). Read with
|
|
34
41
|
* {@link originOfPath}, which does the prefix resolution these keys are
|
|
@@ -95,10 +102,41 @@ export type PathOrigin = {
|
|
|
95
102
|
kind: "composite-parameter";
|
|
96
103
|
composite: string;
|
|
97
104
|
parameters: string[];
|
|
105
|
+
/**
|
|
106
|
+
* Where each parameter's argument was written at the composite call
|
|
107
|
+
* (chant #3597), in `parameters` order. Absent when the build did not
|
|
108
|
+
* see the call; see {@link ArgumentLocation} for the fallback.
|
|
109
|
+
*/
|
|
110
|
+
arguments?: ArgumentLocation[];
|
|
98
111
|
} | {
|
|
99
112
|
kind: "composite-literal";
|
|
100
113
|
composite: string;
|
|
101
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* A place in a source file. `file` is absolute, as
|
|
117
|
+
* {@link EntityProvenance.sourceFile} is; `line` and `column` are 1-based, the
|
|
118
|
+
* way an editor and `file:line:column` print them.
|
|
119
|
+
*/
|
|
120
|
+
export interface SourceLocation {
|
|
121
|
+
file: string;
|
|
122
|
+
line: number;
|
|
123
|
+
column: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Where one composite parameter's argument was written at the call (chant
|
|
127
|
+
* #3597). When the call's argument object has a property at the parameter's
|
|
128
|
+
* path, the location is that property and `text` is the property as written
|
|
129
|
+
* (`replicas: 3`). When it does not (the parameter was left out, or arrived
|
|
130
|
+
* through a spread or a non-literal argument), the location is the call's own
|
|
131
|
+
* and `text` is absent: the call is the nearest place that governs it, and
|
|
132
|
+
* nothing claims a property that is not there.
|
|
133
|
+
*/
|
|
134
|
+
export interface ArgumentLocation extends SourceLocation {
|
|
135
|
+
/** The factory parameter path, as in `parameters` (`replicas`, `iam.path`). */
|
|
136
|
+
parameter: string;
|
|
137
|
+
/** The innermost property as written at the call, when one is. */
|
|
138
|
+
text?: string;
|
|
139
|
+
}
|
|
102
140
|
/**
|
|
103
141
|
* Merge provenance onto an entity. Non-enumerable so it is invisible to
|
|
104
142
|
* serializers and spreads. Existing fields win (`??=`), so the first/most
|
package/dist/provenance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACzC;
|
|
1
|
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G,KAAK,GAAG,SAAS,CAAC;CACnD"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { describe, test, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import { sep } from "node:path";
|
|
2
|
+
import { join, sep } from "node:path";
|
|
3
3
|
import { createMockPlugin, staticDescribeResources, staticObservation, staticDeepObservation, staticListArtifacts } from "@intentius/chant-test-utils";
|
|
4
4
|
import type { LexiconPlugin, ResourceMetadata } from "../../lexicon";
|
|
5
5
|
import { deepObservation } from "../../deep-observation";
|
|
6
6
|
import { heldElsewhere } from "../../held-elsewhere";
|
|
7
|
+
import { setProvenance } from "../../provenance";
|
|
7
8
|
import type { BuildResult } from "../../build";
|
|
8
9
|
import type { ParsedArgs } from "../registry";
|
|
9
10
|
|
|
@@ -739,6 +740,110 @@ describe("runLifecycleDiff --live", () => {
|
|
|
739
740
|
});
|
|
740
741
|
});
|
|
741
742
|
|
|
743
|
+
// #3597 — a drifted field names where it came from: the composite argument
|
|
744
|
+
// and its line, the composite that fixes it, or an unknown origin and why.
|
|
745
|
+
describe("drift names its origin in source (#3597)", () => {
|
|
746
|
+
const app = join(process.cwd(), "src", "app.ts");
|
|
747
|
+
const call = { file: app, line: 10, column: 20 };
|
|
748
|
+
const names = ["webDeployment", "webService", "worker", "legacy"];
|
|
749
|
+
|
|
750
|
+
const runOriginDiff = async (args: Partial<ParsedArgs> = {}) => {
|
|
751
|
+
const build = makeBuildResult({ k8s: names });
|
|
752
|
+
const declare = (name: string, provenance?: Parameters<typeof setProvenance>[1]) => {
|
|
753
|
+
const entity = { lexicon: "k8s", entityType: "Deployment", props: { spec: { replicas: 3 } } };
|
|
754
|
+
if (provenance) setProvenance(entity, provenance);
|
|
755
|
+
build.entities.set(name, entity as never);
|
|
756
|
+
};
|
|
757
|
+
declare("webDeployment", {
|
|
758
|
+
sourceFile: app,
|
|
759
|
+
composite: "WebApp",
|
|
760
|
+
compositeInstance: "web",
|
|
761
|
+
compositeCall: call,
|
|
762
|
+
paths: {
|
|
763
|
+
"spec.replicas": {
|
|
764
|
+
kind: "composite-parameter",
|
|
765
|
+
composite: "WebApp",
|
|
766
|
+
parameters: ["replicas"],
|
|
767
|
+
arguments: [{ parameter: "replicas", file: app, line: 12, column: 3, text: "replicas: 3" }],
|
|
768
|
+
},
|
|
769
|
+
},
|
|
770
|
+
});
|
|
771
|
+
declare("webService", {
|
|
772
|
+
sourceFile: app,
|
|
773
|
+
composite: "WebApp",
|
|
774
|
+
compositeInstance: "web",
|
|
775
|
+
compositeCall: call,
|
|
776
|
+
paths: { "spec.replicas": { kind: "composite-literal", composite: "WebApp" } },
|
|
777
|
+
});
|
|
778
|
+
declare("worker", { sourceFile: app });
|
|
779
|
+
declare("legacy", { sourceFile: app, composite: "LegacyApp", compositeInstance: "legacy" });
|
|
780
|
+
buildMock.mockResolvedValue(build);
|
|
781
|
+
fetchLifecycleMock.mockResolvedValue(undefined);
|
|
782
|
+
readSnapshotMock.mockResolvedValue(null);
|
|
783
|
+
const live = Object.fromEntries(names.map((n) => [n, { type: "Deployment", properties: { spec: { replicas: 5 } } }]));
|
|
784
|
+
const plugins: LexiconPlugin[] = [
|
|
785
|
+
createMockPlugin({
|
|
786
|
+
name: "k8s",
|
|
787
|
+
describeResources: staticObservation(Object.fromEntries(names.map((n) => [n, meta({ type: "Deployment" })]))),
|
|
788
|
+
observeResourcesDeep: staticDeepObservation(live),
|
|
789
|
+
}),
|
|
790
|
+
];
|
|
791
|
+
return runLifecycleDiff({
|
|
792
|
+
args: makeArgs({ command: "state", path: "diff", extraPositional: "prod", live: true, ...args }),
|
|
793
|
+
plugins,
|
|
794
|
+
serializers: plugins.map((p) => p.serializer),
|
|
795
|
+
} as never);
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
test("the human report names the argument and line, the fixing composite, and an unknown origin", async () => {
|
|
799
|
+
await runOriginDiff();
|
|
800
|
+
const output = stdoutBuf.join("\n");
|
|
801
|
+
expect(output).toContain(
|
|
802
|
+
"spec.replicas on Deployment webDeployment comes from WebApp({ replicas: 3 }) at src/app.ts:12",
|
|
803
|
+
);
|
|
804
|
+
expect(output).toContain("change parameter `replicas` of the `web` call of composite WebApp at src/app.ts:12");
|
|
805
|
+
expect(output).toContain(
|
|
806
|
+
"spec.replicas on Deployment webService is fixed inside composite WebApp; no argument to the call at src/app.ts:10 moves it",
|
|
807
|
+
);
|
|
808
|
+
expect(output).toContain(
|
|
809
|
+
"spec.replicas on Deployment legacy has an unknown origin: expanded by a composite whose factory this build did not interpret",
|
|
810
|
+
);
|
|
811
|
+
// Direct keeps today's output: the row, and nothing under it.
|
|
812
|
+
expect(output).not.toContain("on Deployment worker");
|
|
813
|
+
const workerRow = output.split("\n").findIndex((l) => l.includes("- worker (Deployment)"));
|
|
814
|
+
expect(output.split("\n")[workerRow + 1]).toMatch(/^ {6}spec\.replicas: 3 → 5/);
|
|
815
|
+
expect(output.split("\n")[workerRow + 2] ?? "").not.toMatch(/^ {8}\S/);
|
|
816
|
+
// An unknown origin is never shown as a direct declaration.
|
|
817
|
+
expect(output).not.toMatch(/legacy.*declared directly/);
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
test("--json carries the origin object for every drifted field", async () => {
|
|
821
|
+
await runOriginDiff({ json: true });
|
|
822
|
+
const payload = JSON.parse(stdoutBuf.join("\n")) as {
|
|
823
|
+
lexicons: { k8s: { reconcile: Array<{ entity: string; origin: Record<string, unknown>; summary: string }> } };
|
|
824
|
+
};
|
|
825
|
+
const byEntity = Object.fromEntries(payload.lexicons.k8s.reconcile.map((r) => [r.entity, r]));
|
|
826
|
+
expect(byEntity.webDeployment.origin).toEqual({
|
|
827
|
+
kind: "composite-parameter",
|
|
828
|
+
composite: "WebApp",
|
|
829
|
+
instance: "web",
|
|
830
|
+
parameters: ["replicas"],
|
|
831
|
+
call,
|
|
832
|
+
arguments: [{ parameter: "replicas", file: app, line: 12, column: 3, text: "replicas: 3" }],
|
|
833
|
+
});
|
|
834
|
+
expect(byEntity.webService.origin).toEqual({ kind: "composite-literal", composite: "WebApp", instance: "web", call });
|
|
835
|
+
expect(byEntity.worker.origin).toEqual({ kind: "direct" });
|
|
836
|
+
expect(byEntity.legacy.origin).toEqual({ kind: "unknown", reason: "composite-not-interpreted" });
|
|
837
|
+
expect(byEntity.webDeployment.summary).toContain("at src/app.ts:12");
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
test("the diff builds the way `chant build` does, folding by default", async () => {
|
|
841
|
+
await runOriginDiff();
|
|
842
|
+
const options = buildMock.mock.calls[0][3] as { fold?: boolean };
|
|
843
|
+
expect(options.fold).toBe(true);
|
|
844
|
+
});
|
|
845
|
+
});
|
|
846
|
+
|
|
742
847
|
// #2162 — a `heldElsewhere()` marker reports as held, not drift, and a
|
|
743
848
|
// held property nothing ever writes is flagged suspicious on stderr.
|
|
744
849
|
describe("heldElsewhere() markers (#2162)", () => {
|
|
@@ -41,6 +41,7 @@ import { loadChantConfig, environmentNames, matchesDeclaredEnvironment, resolveO
|
|
|
41
41
|
import { unknownEnvError, isProdLikeEnvironment } from "../../env";
|
|
42
42
|
import { planTeardown, executeTeardown, type TeardownPlan, type TeardownReport } from "../../lifecycle/teardown";
|
|
43
43
|
import { collectBuildRootContributors } from "../plugins";
|
|
44
|
+
import { resolveBuildModes, resolveProjectBuildOptions } from "../build-options";
|
|
44
45
|
import { applyLiveEndpoint } from "../../live-endpoint";
|
|
45
46
|
import { isObservableDeclarable } from "../../declarable";
|
|
46
47
|
import { formatError, formatWarning, formatSuccess, formatBold } from "../format";
|
|
@@ -378,11 +379,22 @@ export async function runLifecycleDiff(ctx: CommandContext): Promise<number> {
|
|
|
378
379
|
const endpointResult = applyLiveEndpoint(config.environments, environment, liveLexicons);
|
|
379
380
|
if (endpointResult.notice) console.error(formatWarning({ message: endpointResult.notice }));
|
|
380
381
|
|
|
381
|
-
|
|
382
|
+
// The build `chant build` would produce for this project (#2002's one
|
|
383
|
+
// place), so the diff folds by default as `chant build` does. A run build
|
|
384
|
+
// cannot say which composite argument produced a field, so without this
|
|
385
|
+
// every composite field in the live diff read as unknown (#3597).
|
|
386
|
+
const projectRoot = resolve(".");
|
|
387
|
+
const diffBuildOptions = resolveProjectBuildOptions({
|
|
388
|
+
config,
|
|
389
|
+
configDir: projectRoot,
|
|
390
|
+
plugins,
|
|
391
|
+
modes: resolveBuildModes(config, { fold: args.fold, sandbox: args.sandbox }),
|
|
392
|
+
buildParams: declaredParams,
|
|
393
|
+
});
|
|
382
394
|
|
|
383
395
|
try {
|
|
384
396
|
for (const target of targets) {
|
|
385
|
-
const buildResult = await build(target.root, targetSerializers, undefined,
|
|
397
|
+
const buildResult = await build(target.root, targetSerializers, undefined, diffBuildOptions);
|
|
386
398
|
if (buildResult.errors.length > 0) {
|
|
387
399
|
const label = target.stack ? `stack "${target.stack}"` : "project";
|
|
388
400
|
console.error(formatError({ message: `Build failed for ${label} — fix errors before diffing` }));
|
|
@@ -434,6 +446,7 @@ export async function runLifecycleDiff(ctx: CommandContext): Promise<number> {
|
|
|
434
446
|
baseline,
|
|
435
447
|
updateBaseline: args.updateBaseline,
|
|
436
448
|
...(args.namespace ? { namespace: args.namespace } : {}),
|
|
449
|
+
projectRoot,
|
|
437
450
|
});
|
|
438
451
|
totalDrift += r.totalDrift;
|
|
439
452
|
totalUnobserved += r.totalUnobserved;
|
|
@@ -687,6 +700,8 @@ interface LiveDiffArgs {
|
|
|
687
700
|
/** `--namespace <ns>` (#1629): where to read entities that declare no
|
|
688
701
|
* namespace of their own. */
|
|
689
702
|
namespace?: string;
|
|
703
|
+
/** Directory source locations in the report are printed relative to (#3597). */
|
|
704
|
+
projectRoot?: string;
|
|
690
705
|
}
|
|
691
706
|
|
|
692
707
|
interface LiveDiffOutcome {
|
|
@@ -902,8 +917,8 @@ async function runLifecycleDiffLive(args: LiveDiffArgs): Promise<LiveDiffOutcome
|
|
|
902
917
|
if (args.json) {
|
|
903
918
|
const entry = (byLexicon[lexiconName] ??= {});
|
|
904
919
|
entry.deep = deep;
|
|
905
|
-
entry.reconcile = resolveDeepDrift(deep.drifted, provenanceOf);
|
|
906
|
-
} else renderDeepDiff(lexiconName, deep, provenanceOf);
|
|
920
|
+
entry.reconcile = resolveDeepDrift(deep.drifted, provenanceOf, { root: args.projectRoot });
|
|
921
|
+
} else renderDeepDiff(lexiconName, deep, provenanceOf, args.projectRoot);
|
|
907
922
|
// Printed on stderr regardless of `--json` (#2162), same reason the
|
|
908
923
|
// unobserved/disruption notices are: a shape with no column for
|
|
909
924
|
// "suspicious" must not read as clean.
|
|
@@ -971,6 +986,7 @@ function renderDeepDiff(
|
|
|
971
986
|
lexiconName: string,
|
|
972
987
|
deep: DeepDiffResult,
|
|
973
988
|
provenanceOf: (entity: string) => EntityProvenance | undefined = () => undefined,
|
|
989
|
+
projectRoot?: string,
|
|
974
990
|
): void {
|
|
975
991
|
const drift = countPropertyDrift(deep);
|
|
976
992
|
const unclaimedCount = countUnclaimed(deep);
|
|
@@ -1018,15 +1034,20 @@ function renderDeepDiff(
|
|
|
1018
1034
|
// something today's behaviour would get wrong. A field the author
|
|
1019
1035
|
// declared directly is left unremarked: editing it IS today's
|
|
1020
1036
|
// behaviour, and saying so on every row would bury the two that matter.
|
|
1021
|
-
|
|
1037
|
+
// #3597 — the line before the proposal names the composite call and
|
|
1038
|
+
// the argument behind the field, with the file and line it was written on.
|
|
1039
|
+
const { resolution, summary } = resolveDriftedField({
|
|
1022
1040
|
entity: entity.name,
|
|
1041
|
+
entityType: entity.type,
|
|
1023
1042
|
path: change.path,
|
|
1024
1043
|
...("declared" in change ? { declared: change.declared } : {}),
|
|
1025
1044
|
...("live" in change ? { live: change.live } : {}),
|
|
1026
1045
|
...(change.origin ? { origin: change.origin } : {}),
|
|
1027
1046
|
...(provenance ? { provenance } : {}),
|
|
1047
|
+
...(projectRoot ? { root: projectRoot } : {}),
|
|
1028
1048
|
});
|
|
1029
1049
|
if (resolution.kind !== "edit-declaration") {
|
|
1050
|
+
console.log(` ${summary}`);
|
|
1030
1051
|
console.log(` ${resolution.description}`);
|
|
1031
1052
|
}
|
|
1032
1053
|
}
|