@intentius/chant 0.52.2 → 0.53.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/cdk/advise.d.ts +29 -0
- package/dist/cdk/advise.d.ts.map +1 -0
- package/dist/cdk/assembly.d.ts +38 -0
- package/dist/cdk/assembly.d.ts.map +1 -0
- package/dist/cdk/graph.d.ts +68 -0
- package/dist/cdk/graph.d.ts.map +1 -0
- package/dist/cdk/tier-map.d.ts +44 -0
- package/dist/cdk/tier-map.d.ts.map +1 -0
- package/dist/cdk/types.d.ts +114 -0
- package/dist/cdk/types.d.ts.map +1 -0
- package/dist/cli/commands/carve-apply.d.ts.map +1 -1
- package/dist/cli/commands/carve-bridge.d.ts.map +1 -1
- package/dist/cli/commands/carve-emit.d.ts.map +1 -1
- package/dist/cli/commands/carve.d.ts +48 -6
- package/dist/cli/commands/carve.d.ts.map +1 -1
- package/dist/cli/handlers/carve-emit.d.ts.map +1 -1
- package/dist/cli/handlers/carve.d.ts +5 -4
- package/dist/cli/handlers/carve.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.d.ts +10 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/identity.d.ts +196 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lexicon.d.ts +41 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/terraform/adopt-state.d.ts +17 -66
- package/dist/terraform/adopt-state.d.ts.map +1 -1
- package/dist/terraform/aws-resources.d.ts +1 -1
- package/dist/terraform/carve-provider.d.ts +142 -0
- package/dist/terraform/carve-provider.d.ts.map +1 -0
- package/dist/terraform/carve.d.ts +36 -3
- package/dist/terraform/carve.d.ts.map +1 -1
- package/dist/terraform/emit-source.d.ts +25 -0
- package/dist/terraform/emit-source.d.ts.map +1 -0
- package/dist/terraform/graduate.d.ts +11 -1
- package/dist/terraform/graduate.d.ts.map +1 -1
- package/dist/terraform/providers/aws.d.ts +19 -0
- package/dist/terraform/providers/aws.d.ts.map +1 -0
- package/dist/terraform/providers/gcp.d.ts +41 -0
- package/dist/terraform/providers/gcp.d.ts.map +1 -0
- package/dist/terraform/providers/index.d.ts +15 -0
- package/dist/terraform/providers/index.d.ts.map +1 -0
- package/dist/terraform/providers/kubernetes.d.ts +29 -0
- package/dist/terraform/providers/kubernetes.d.ts.map +1 -0
- package/dist/terraform/score.d.ts +70 -4
- package/dist/terraform/score.d.ts.map +1 -1
- package/dist/terraform/tier-map.d.ts +30 -35
- package/dist/terraform/tier-map.d.ts.map +1 -1
- package/dist/terraform/types.d.ts +6 -0
- package/dist/terraform/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cdk/__fixtures__/cdk.out/AppStack.template.json +171 -0
- package/src/cdk/__fixtures__/cdk.out/DataStack.template.json +90 -0
- package/src/cdk/__fixtures__/cdk.out/cdk.out +1 -0
- package/src/cdk/__fixtures__/cdk.out/manifest.json +30 -0
- package/src/cdk/__fixtures__/cdk.out/tree.json +201 -0
- package/src/cdk/__fixtures__/cdk.out-dummy/LookupStack.template.json +29 -0
- package/src/cdk/__fixtures__/cdk.out-dummy/manifest.json +26 -0
- package/src/cdk/advise.test.ts +208 -0
- package/src/cdk/advise.ts +44 -0
- package/src/cdk/assembly.ts +133 -0
- package/src/cdk/graph.test.ts +206 -0
- package/src/cdk/graph.ts +525 -0
- package/src/cdk/tier-map.ts +71 -0
- package/src/cdk/types.ts +115 -0
- package/src/cli/commands/carve-apply.ts +20 -4
- package/src/cli/commands/carve-bridge.ts +9 -5
- package/src/cli/commands/carve-emit-k8s.test.ts +262 -0
- package/src/cli/commands/carve-emit-provider.test.ts +207 -0
- package/src/cli/commands/carve-emit.ts +28 -24
- package/src/cli/commands/carve.ts +139 -36
- package/src/cli/handlers/carve-emit.ts +8 -3
- package/src/cli/handlers/carve.ts +8 -7
- package/src/cli/handlers/lifecycle.test.ts +187 -1
- package/src/cli/handlers/lifecycle.ts +125 -1
- package/src/cli/main.ts +12 -5
- package/src/identity.test.ts +199 -0
- package/src/identity.ts +346 -0
- package/src/index.ts +1 -0
- package/src/lexicon.ts +53 -0
- package/src/terraform/__fixtures__/gcp-estate/main.tf +60 -0
- package/src/terraform/adopt-state.test.ts +131 -0
- package/src/terraform/adopt-state.ts +19 -167
- package/src/terraform/aws-resources.test.ts +38 -22
- package/src/terraform/aws-resources.ts +1 -1
- package/src/terraform/carve-provider.test.ts +155 -0
- package/src/terraform/carve-provider.ts +237 -0
- package/src/terraform/carve.test.ts +55 -1
- package/src/terraform/carve.ts +0 -0
- package/src/terraform/emit-source.ts +39 -0
- package/src/terraform/graduate.test.ts +37 -0
- package/src/terraform/graduate.ts +55 -7
- package/src/terraform/graph.ts +3 -3
- package/src/terraform/providers/aws.ts +169 -0
- package/src/terraform/providers/gcp.test.ts +228 -0
- package/src/terraform/providers/gcp.ts +329 -0
- package/src/terraform/providers/index.ts +21 -0
- package/src/terraform/providers/kubernetes.ts +224 -0
- package/src/terraform/score.ts +111 -25
- package/src/terraform/tier-map.ts +45 -107
- package/src/terraform/types.ts +6 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CDK half of `chant carve advise` (#1056): read a cloud assembly, rank its
|
|
3
|
+
* constructs with the same model the Terraform advisor uses.
|
|
4
|
+
*
|
|
5
|
+
* Read-only, like the Terraform path — it emits nothing, patches nothing, and
|
|
6
|
+
* touches no live resource. `carve emit`, `carve bridge` and `carve apply` are
|
|
7
|
+
* deliberately Terraform-only: bridging a CDK carve means rewriting the
|
|
8
|
+
* surviving app's source, which does not generalize across jsii languages.
|
|
9
|
+
*/
|
|
10
|
+
import type { CarveDialect } from "../terraform/carve.js";
|
|
11
|
+
import type { Peelability, ScoreOptions } from "../terraform/score.js";
|
|
12
|
+
import type { TfGraph } from "../terraform/types.js";
|
|
13
|
+
export interface CdkAdvice {
|
|
14
|
+
graph: TfGraph;
|
|
15
|
+
results: Peelability[];
|
|
16
|
+
/** The hooks that produced `results`, so the boundary pass agrees with it. */
|
|
17
|
+
scoreOptions: ScoreOptions;
|
|
18
|
+
diagnostics: string[];
|
|
19
|
+
}
|
|
20
|
+
/** The bridge vocabulary a CDK report's boundary edges are named in. */
|
|
21
|
+
export declare const CDK_DIALECT: CarveDialect;
|
|
22
|
+
/**
|
|
23
|
+
* Rank a cloud assembly. The scoring model, the bands and the report shape are
|
|
24
|
+
* the Terraform path's, verbatim; what changes is the tier lookup (already in
|
|
25
|
+
* CloudFormation type space, so no translation) and the signals only a CDK
|
|
26
|
+
* reader can see — assets, nested stacks, L3 subtrees, a dummy-value assembly.
|
|
27
|
+
*/
|
|
28
|
+
export declare function adviseCloudAssembly(dir: string): CdkAdvice;
|
|
29
|
+
//# sourceMappingURL=advise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advise.d.ts","sourceRoot":"","sources":["../../src/cdk/advise.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,8EAA8E;IAC9E,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wEAAwE;AACxE,eAAO,MAAM,WAAW,EAAE,YAAoB,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAQ1D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a CDK cloud assembly off disk (#1056).
|
|
3
|
+
*
|
|
4
|
+
* The only filesystem layer the CDK advisor needs. Detection is by content, not
|
|
5
|
+
* a flag: a directory holding `manifest.json` plus at least one
|
|
6
|
+
* `*.template.json` is a cloud assembly, so `chant carve advise --from ./cdk.out`
|
|
7
|
+
* routes itself.
|
|
8
|
+
*
|
|
9
|
+
* A malformed or truncated assembly degrades rather than throws — a stack whose
|
|
10
|
+
* template will not parse is dropped with a diagnostic, and the rest is still
|
|
11
|
+
* ranked. The advisor is read-only, so a partial read costs nothing but a
|
|
12
|
+
* shorter report.
|
|
13
|
+
*/
|
|
14
|
+
import type { CdkTreeNode, CloudAssembly } from "./types.js";
|
|
15
|
+
/**
|
|
16
|
+
* Is `dir` a CDK cloud assembly? `manifest.json` plus at least one synthesized
|
|
17
|
+
* template. Both are required: `manifest.json` alone is far too common a
|
|
18
|
+
* filename to claim on sight.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isCloudAssembly(dir: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Why a Terraform-only carve phase refuses a cloud assembly (#1056).
|
|
23
|
+
*
|
|
24
|
+
* Advise is the only phase that reads CDK. Bridging a carve means rewriting the
|
|
25
|
+
* surviving app's source so it reimports what was taken, and CDK source is
|
|
26
|
+
* TypeScript, Python, Java or C# depending on who wrote it — nothing that
|
|
27
|
+
* generalizes the way patching HCL does. Better to say so than to parse the
|
|
28
|
+
* assembly's `.tf` files, find none, and report an empty estate.
|
|
29
|
+
*/
|
|
30
|
+
export declare function cdkNotSupported(dir: string, phase: "emit" | "bridge" | "apply"): string;
|
|
31
|
+
/** Index `tree.json` by construct path, so a resource's path resolves in one lookup. */
|
|
32
|
+
export declare function indexTree(root: CdkTreeNode | undefined): Map<string, CdkTreeNode>;
|
|
33
|
+
/**
|
|
34
|
+
* Read the assembly at `dir`. Throws only when the directory is not an assembly
|
|
35
|
+
* at all — everything past that point is a diagnostic.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readCloudAssembly(dir: string): CloudAssembly;
|
|
38
|
+
//# sourceMappingURL=assembly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../src/cdk/assembly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAsC,WAAW,EAAe,aAAa,EAAE,MAAM,SAAS,CAAC;AAS3G;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAKvF;AAmBD,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAQjF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CA4C5D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a CDK cloud assembly into the same dependency graph the Terraform
|
|
3
|
+
* advisor scores (#1056).
|
|
4
|
+
*
|
|
5
|
+
* Two jobs, both exact rather than heuristic:
|
|
6
|
+
*
|
|
7
|
+
* **Grouping.** CloudFormation resources are the wrong unit to rank. One L2
|
|
8
|
+
* construct emits several of them — a `Function` emits a role, a policy and the
|
|
9
|
+
* function — and they carve together or not at all. Every resource carries its
|
|
10
|
+
* emitting construct in `Metadata["aws:cdk:path"]`, and `tree.json` says which
|
|
11
|
+
* ancestor of that path is the construct a person actually wrote. So resources
|
|
12
|
+
* fold up to the shallowest L2 (or L3) ancestor and that construct ranks once.
|
|
13
|
+
* This is the CDK analogue of Terraform sub-resources folding into their parent.
|
|
14
|
+
*
|
|
15
|
+
* **Edges.** `Ref`, `Fn::GetAtt` and `Fn::Sub` are intra-stack; `Fn::ImportValue`
|
|
16
|
+
* resolves through the exporting stack's `Outputs` to the construct that
|
|
17
|
+
* actually produces the value, so a cross-stack dependency lands as a real edge
|
|
18
|
+
* between two constructs in both directions rather than a dangling name. There
|
|
19
|
+
* is no expression AST to consult and no regex over HCL: the template is JSON,
|
|
20
|
+
* and an intrinsic is a JSON object with a known key.
|
|
21
|
+
*
|
|
22
|
+
* Pure — no filesystem, no CDK CLI. `assembly.ts` does the reading.
|
|
23
|
+
*/
|
|
24
|
+
import type { CloudAssembly } from "./types.js";
|
|
25
|
+
import type { ScoreSignals } from "../terraform/score.js";
|
|
26
|
+
import type { TfGraph } from "../terraform/types.js";
|
|
27
|
+
/**
|
|
28
|
+
* What a construct is, from its jsii class name.
|
|
29
|
+
*
|
|
30
|
+
* - `l1` — a `Cfn*` class: one construct, one CloudFormation resource.
|
|
31
|
+
* - `l2` — a curated service construct (`aws-cdk-lib.aws_s3.Bucket`).
|
|
32
|
+
* - `l3` — a pattern or a hand-written grouping construct. A Composite
|
|
33
|
+
* candidate (#1000), ranked whole instead of leaf by leaf.
|
|
34
|
+
* - `nested` — a `NestedStack`: a template of its own.
|
|
35
|
+
* - `container` — App/Stage/Stack. Never a scoring unit; the ranking lives
|
|
36
|
+
* inside it.
|
|
37
|
+
* - `unknown` — no tree metadata to go on.
|
|
38
|
+
*
|
|
39
|
+
* A user's own construct class is not jsii-compiled, so tree metadata reports
|
|
40
|
+
* its nearest jsii ancestor: `constructs.Construct` for a grouping construct,
|
|
41
|
+
* `aws-cdk-lib.Stack` for a stack subclass. That is why stacks are recognized
|
|
42
|
+
* by their manifest artifact rather than by fqn — the fqn alone cannot tell a
|
|
43
|
+
* user's stack from a user's L3.
|
|
44
|
+
*/
|
|
45
|
+
export type ConstructLevel = "l1" | "l2" | "l3" | "nested" | "container" | "unknown";
|
|
46
|
+
export declare function constructLevel(fqn: string | undefined): ConstructLevel;
|
|
47
|
+
/** The assembly's dependency graph, plus the signals only a CDK reader can see. */
|
|
48
|
+
export interface CdkCarveGraph {
|
|
49
|
+
graph: TfGraph;
|
|
50
|
+
/** Per-node scoring signals, keyed by construct path. */
|
|
51
|
+
signals: Map<string, ScoreSignals>;
|
|
52
|
+
diagnostics: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Is the assembly a faithful picture of an account, or a guess? Either the
|
|
56
|
+
* manifest admits an unresolved context query, or a template still carries the
|
|
57
|
+
* placeholder that query would have replaced.
|
|
58
|
+
*/
|
|
59
|
+
export declare function dummyAssemblyReason(assembly: CloudAssembly): string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Build the graph and the per-construct signals from a read assembly.
|
|
62
|
+
*
|
|
63
|
+
* Every resource folds into a construct, every construct becomes one node, and
|
|
64
|
+
* every intrinsic becomes an edge between two nodes. Nothing is inferred: a
|
|
65
|
+
* reference with no resolvable target is dropped rather than drawn.
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildCdkGraph(assembly: CloudAssembly): CdkCarveGraph;
|
|
68
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/cdk/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,EAAsC,aAAa,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,oBAAoB,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAiBrF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAQtE;AAuLD,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,yDAAyD;IACzD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAQD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAqB/E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CA2NpE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CloudFormation-type → native-spec tier for the CDK carve advisor (#1056).
|
|
3
|
+
*
|
|
4
|
+
* The Terraform path's hardest layer — translating `aws_s3_bucket` into
|
|
5
|
+
* `AWS::S3::Bucket` and a tier — does not exist here: a synthesized template is
|
|
6
|
+
* already in CloudFormation type space, which is the space
|
|
7
|
+
* `AWS_CARVE_TYPES.nativeType` is written in. So this is the same table read
|
|
8
|
+
* from the other end, not a second table to keep in step. Adding an AWS type to
|
|
9
|
+
* the carve-out table lights it up for both advisors at once.
|
|
10
|
+
*
|
|
11
|
+
* `mapsTo` is the CloudFormation type itself, because that identity is the
|
|
12
|
+
* point: chant's AWS lexicon constructors take CloudFormation PascalCase props,
|
|
13
|
+
* so a CDK resource needs no translation to become one.
|
|
14
|
+
*/
|
|
15
|
+
import type { TierInfo } from "../terraform/tier-map.js";
|
|
16
|
+
/**
|
|
17
|
+
* CloudFormation type → tier. Two Terraform types can name one CloudFormation
|
|
18
|
+
* type (`aws_lb` and `aws_alb` are the same load balancer); the first entry
|
|
19
|
+
* wins, and since aliases share a tier by construction there is nothing to
|
|
20
|
+
* reconcile.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CFN_TIER_MAP: Record<string, TierInfo>;
|
|
23
|
+
/** The chant AWS lexicon constructor a CloudFormation type would carve into. */
|
|
24
|
+
export declare const CFN_CTOR: Record<string, string>;
|
|
25
|
+
export declare function resolveCfnTier(cfnType: string): TierInfo | null;
|
|
26
|
+
/**
|
|
27
|
+
* A nested stack is an assembly of its own: its resources live in a separate
|
|
28
|
+
* template that this advisor does not descend into, so carving the
|
|
29
|
+
* `AWS::CloudFormation::Stack` resource means carving everything under it.
|
|
30
|
+
*/
|
|
31
|
+
export declare const NESTED_STACK_TYPE = "AWS::CloudFormation::Stack";
|
|
32
|
+
/**
|
|
33
|
+
* CloudFormation resources CDK synthesizes for its own bookkeeping. They
|
|
34
|
+
* describe the synthesis, not the infrastructure, so they never appear in the
|
|
35
|
+
* ranking.
|
|
36
|
+
*/
|
|
37
|
+
export declare const SCAFFOLDING_TYPES: Set<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Template parameters CDK adds for bootstrap and asset plumbing. A reference to
|
|
40
|
+
* one is not a sign the resource is parameterized by its author — it is the
|
|
41
|
+
* synthesizer talking to itself — so these do not mark a construct dynamic.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isScaffoldingParameter(name: string): boolean;
|
|
44
|
+
//# sourceMappingURL=tier-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tier-map.d.ts","sourceRoot":"","sources":["../../src/cdk/tier-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAO9C,CAAC;AAEL,gFAAgF;AAChF,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIxC,CAAC;AAEL,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAE/D;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,+BAA+B,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,aAAkC,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO5D"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts of a CDK cloud assembly the carve advisor reads (#1056).
|
|
3
|
+
*
|
|
4
|
+
* A cloud assembly is already JSON, so there is no parser to install and no
|
|
5
|
+
* expression AST to resolve — the Terraform path's two hardest layers do not
|
|
6
|
+
* exist here. Three files carry everything the advisor needs:
|
|
7
|
+
*
|
|
8
|
+
* - `manifest.json` — which artifacts are stacks, which template file each
|
|
9
|
+
* one synthesized to, and (crucially) whether any context lookup went
|
|
10
|
+
* unresolved.
|
|
11
|
+
* - `tree.json` — the construct tree, so CloudFormation resources can be
|
|
12
|
+
* grouped back under the construct that emitted them. Optional: CDK can be
|
|
13
|
+
* told not to write it, and the advisor degrades to a coarser grouping.
|
|
14
|
+
* - `*.template.json` — the CloudFormation templates themselves, already in
|
|
15
|
+
* `AWS::*` type space, which is exactly what the AWS tier map keys on.
|
|
16
|
+
*
|
|
17
|
+
* Everything here is post-jsii, so a Python or Java CDK app reads through the
|
|
18
|
+
* same code path as a TypeScript one. Nothing in this module reads CDK source.
|
|
19
|
+
*
|
|
20
|
+
* The declarations are deliberately loose — every field optional, unknown keys
|
|
21
|
+
* tolerated — because the assembly schema is not chant's to own and gains
|
|
22
|
+
* fields between CDK releases.
|
|
23
|
+
*/
|
|
24
|
+
/** A CloudFormation resource as it appears in a synthesized template. */
|
|
25
|
+
export interface CfnResource {
|
|
26
|
+
Type?: string;
|
|
27
|
+
Properties?: Record<string, unknown>;
|
|
28
|
+
/** `aws:cdk:path` names the emitting construct; `aws:asset:*` marks an asset. */
|
|
29
|
+
Metadata?: Record<string, unknown>;
|
|
30
|
+
DependsOn?: string | string[];
|
|
31
|
+
/** Names a template `Condition` — the CloudFormation analogue of `count`. */
|
|
32
|
+
Condition?: string;
|
|
33
|
+
[k: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
/** A CloudFormation `Outputs` entry. */
|
|
36
|
+
export interface CfnOutput {
|
|
37
|
+
Value?: unknown;
|
|
38
|
+
Export?: {
|
|
39
|
+
Name?: unknown;
|
|
40
|
+
};
|
|
41
|
+
[k: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
export interface CfnTemplate {
|
|
44
|
+
Parameters?: Record<string, Record<string, unknown>>;
|
|
45
|
+
Conditions?: Record<string, unknown>;
|
|
46
|
+
Resources?: Record<string, CfnResource>;
|
|
47
|
+
Outputs?: Record<string, CfnOutput>;
|
|
48
|
+
[k: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
/** One artifact in `manifest.json`. */
|
|
51
|
+
export interface CdkArtifact {
|
|
52
|
+
type?: string;
|
|
53
|
+
properties?: {
|
|
54
|
+
templateFile?: string;
|
|
55
|
+
[k: string]: unknown;
|
|
56
|
+
};
|
|
57
|
+
displayName?: string;
|
|
58
|
+
dependencies?: string[];
|
|
59
|
+
environment?: string;
|
|
60
|
+
[k: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
/** One unresolved context lookup, as `cdk synth` records it. */
|
|
63
|
+
export interface CdkMissingContext {
|
|
64
|
+
key?: string;
|
|
65
|
+
provider?: string;
|
|
66
|
+
props?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
export interface CdkManifest {
|
|
69
|
+
version?: string;
|
|
70
|
+
artifacts?: Record<string, CdkArtifact>;
|
|
71
|
+
/**
|
|
72
|
+
* Context queries synthesis could not answer. Non-empty means the templates
|
|
73
|
+
* hold placeholder values rather than the real account's, so nothing
|
|
74
|
+
* synthesized from them describes real infrastructure.
|
|
75
|
+
*/
|
|
76
|
+
missing?: CdkMissingContext[];
|
|
77
|
+
[k: string]: unknown;
|
|
78
|
+
}
|
|
79
|
+
/** A node of `tree.json`. Children are keyed by construct id. */
|
|
80
|
+
export interface CdkTreeNode {
|
|
81
|
+
id?: string;
|
|
82
|
+
path?: string;
|
|
83
|
+
children?: Record<string, CdkTreeNode>;
|
|
84
|
+
/** `fqn` is the construct class — the L1/L2/L3 signal. */
|
|
85
|
+
constructInfo?: {
|
|
86
|
+
fqn?: string;
|
|
87
|
+
version?: string;
|
|
88
|
+
};
|
|
89
|
+
attributes?: Record<string, unknown>;
|
|
90
|
+
}
|
|
91
|
+
export interface CdkTreeFile {
|
|
92
|
+
version?: string;
|
|
93
|
+
tree?: CdkTreeNode;
|
|
94
|
+
}
|
|
95
|
+
/** One CloudFormation stack artifact, with its template read. */
|
|
96
|
+
export interface CdkStack {
|
|
97
|
+
/** Artifact id in `manifest.json`, e.g. `Stage-AppStack`. */
|
|
98
|
+
id: string;
|
|
99
|
+
/** Construct path of the stack, e.g. `Stage/AppStack`. */
|
|
100
|
+
path: string;
|
|
101
|
+
templateFile: string;
|
|
102
|
+
template: CfnTemplate;
|
|
103
|
+
}
|
|
104
|
+
/** A read cloud assembly: the manifest, the construct tree, the stacks. */
|
|
105
|
+
export interface CloudAssembly {
|
|
106
|
+
dir: string;
|
|
107
|
+
manifest: CdkManifest;
|
|
108
|
+
/** Absent when the app was synthesized without tree metadata. */
|
|
109
|
+
tree?: CdkTreeNode;
|
|
110
|
+
stacks: CdkStack[];
|
|
111
|
+
/** Everything that went wrong or is worth saying about the read itself. */
|
|
112
|
+
diagnostics: string[];
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cdk/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MA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-apply.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"carve-apply.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,EAA4C,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAIzG,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA6EnF;AAqBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA2BjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve-bridge.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"carve-bridge.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,EAAkB,KAAK,UAAU,EAAuB,MAAM,wBAAwB,CAAC;AAK9F,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,mDAAmD;IACnD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AASD,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAoItF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAqCnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-emit.ts"],"names":[],"mappings":"AAA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AiF;IACjF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,sFAAsF;IACtF,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC9B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAwIrG;AAiJD,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAwD/D"}
|
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `chant carve advise` — the read-only
|
|
2
|
+
* `chant carve advise` — the read-only peelability advisor (#214, #1056).
|
|
3
3
|
*
|
|
4
|
-
* Points at
|
|
5
|
-
*
|
|
4
|
+
* Points at foreign infrastructure and reports which pieces are cheap to carve
|
|
5
|
+
* into native chant later and which should stay where they are. It emits
|
|
6
6
|
* nothing, patches nothing, and touches no live resource — pure analysis. The
|
|
7
|
-
* emit/boundary/apply phases
|
|
7
|
+
* emit/boundary/apply phases (`carve emit|bridge|apply`, #197) read Terraform
|
|
8
|
+
* only, and refuse a cloud assembly by name.
|
|
9
|
+
*
|
|
10
|
+
* Two sources, one report. A Terraform estate is parsed from `.tf`; a CDK cloud
|
|
11
|
+
* assembly is read from `cdk.out` (#1056). Which one is in `--from` is decided
|
|
12
|
+
* by looking, not by a second flag: a directory holding `manifest.json` plus a
|
|
13
|
+
* synthesized `*.template.json` is an assembly. Both produce the same bands,
|
|
14
|
+
* the same score arithmetic, and the same JSON shape.
|
|
8
15
|
*/
|
|
9
|
-
import { type Peelability } from "../../terraform/score.js";
|
|
16
|
+
import { type Peelability, type ScoreOptions } from "../../terraform/score.js";
|
|
10
17
|
import { type BoundaryEdge } from "../../terraform/carve.js";
|
|
11
18
|
import type { TfGraph } from "../../terraform/types.js";
|
|
12
19
|
export interface CarveAdviseOptions {
|
|
13
|
-
/** Terraform estate directory (from `--from`). */
|
|
20
|
+
/** Terraform estate directory or CDK cloud assembly (from `--from`). */
|
|
14
21
|
from?: string;
|
|
15
22
|
/** Opt-in `.tfstate` path (from `--state`): accurate fan-out instance counts. */
|
|
16
23
|
statePath?: string;
|
|
17
24
|
/** Write the full JSON report to this path (from `--report <path>`). */
|
|
18
25
|
reportFile?: string;
|
|
19
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Which source the ranking came from. Terraform addresses and CDK construct
|
|
29
|
+
* paths are different namespaces, and the bridge patches have different names,
|
|
30
|
+
* so a report says which it is rather than leaving a reader to guess from the
|
|
31
|
+
* shape of an address.
|
|
32
|
+
*/
|
|
33
|
+
export type CarveSource = "terraform" | "cdk";
|
|
20
34
|
export interface CarveAdviseResult {
|
|
21
35
|
ok: boolean;
|
|
22
36
|
error?: string;
|
|
23
37
|
from?: string;
|
|
38
|
+
source?: CarveSource;
|
|
24
39
|
results?: Peelability[];
|
|
25
40
|
/**
|
|
26
41
|
* The parsed dependency graph the scores came from. Kept so the JSON report
|
|
@@ -28,6 +43,10 @@ export interface CarveAdviseResult {
|
|
|
28
43
|
* Not part of the JSON payload — `carveJson` derives from it.
|
|
29
44
|
*/
|
|
30
45
|
graph?: TfGraph;
|
|
46
|
+
/** The hooks the scores were produced with, so the boundary pass agrees. */
|
|
47
|
+
scoreOptions?: ScoreOptions;
|
|
48
|
+
/** Anything about the read itself worth saying out loud. */
|
|
49
|
+
diagnostics?: string[];
|
|
31
50
|
}
|
|
32
51
|
export declare function carveAdvise(opts: CarveAdviseOptions): Promise<CarveAdviseResult>;
|
|
33
52
|
/**
|
|
@@ -45,6 +64,16 @@ export declare function carveAdvise(opts: CarveAdviseOptions): Promise<CarveAdvi
|
|
|
45
64
|
* not).
|
|
46
65
|
* - A reader that does not know the version it is handed should refuse the
|
|
47
66
|
* report rather than half-read it.
|
|
67
|
+
*
|
|
68
|
+
* The CDK source (#1056) stays inside that promise and does not bump the
|
|
69
|
+
* version. Every field an existing reader keys on keeps its type and meaning:
|
|
70
|
+
* `address` is still an opaque string identifier (a construct path instead of a
|
|
71
|
+
* Terraform address), `kind` is still `"resource"` or `"module"` (an L3
|
|
72
|
+
* construct subtree is a Composite candidate, which is what `module` already
|
|
73
|
+
* means), `score`/`band`/`breakdown` are the same arithmetic. What is new is
|
|
74
|
+
* additive and ignorable: the top-level `source` discriminator, per-resource
|
|
75
|
+
* `notes` and `members`, and two more `bridge` values in a list that was
|
|
76
|
+
* already declared open-ended.
|
|
48
77
|
*/
|
|
49
78
|
export declare const CARVE_REPORT_VERSION = 1;
|
|
50
79
|
/** One ranked resource in the JSON report: its score, plus the boundary its carve would cut. */
|
|
@@ -78,10 +107,23 @@ export interface CarveJsonResource extends Peelability {
|
|
|
78
107
|
export interface CarveJsonReport {
|
|
79
108
|
version: number;
|
|
80
109
|
from?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Which source was read (#1056). `terraform` — addresses are Terraform
|
|
112
|
+
* addresses, bridges are `data` sources. `cdk` — addresses are construct
|
|
113
|
+
* paths and bridges are reimports. Absent on a chant that predates the CDK
|
|
114
|
+
* advisor, which a reader should take as `terraform`.
|
|
115
|
+
*/
|
|
116
|
+
source: CarveSource;
|
|
81
117
|
advisory: string;
|
|
82
118
|
count: number;
|
|
83
119
|
/** Band name -> how many resources landed in it. */
|
|
84
120
|
bands: Record<string, number>;
|
|
121
|
+
/**
|
|
122
|
+
* Anything about the read the scores alone do not say — a missing `tree.json`,
|
|
123
|
+
* an assembly synthesized from unresolved context lookups. Present only when
|
|
124
|
+
* there is something to report.
|
|
125
|
+
*/
|
|
126
|
+
diagnostics?: string[];
|
|
85
127
|
resources: CarveJsonResource[];
|
|
86
128
|
}
|
|
87
129
|
/** Build the `--json` / `--report` payload. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAe,KAAK,WAAW,EAAwB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAkB,KAAK,YAAY,EAAqB,MAAM,uBAAuB,CAAC;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAID,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAatF;AA4CD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAC;QAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAClE;AAED,yGAAyG;AACzG,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAiBpE;AAeD,6CAA6C;AAC7C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAqCnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/carve-emit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/carve-emit.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0CvE"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { CommandContext } from "../registry.js";
|
|
2
2
|
/**
|
|
3
|
-
* `chant carve advise --from <terraform-dir> [--json] [--report <path>]`
|
|
3
|
+
* `chant carve advise --from <terraform-dir | cdk.out> [--json] [--report <path>]`
|
|
4
4
|
*
|
|
5
|
-
* Read-only. Reuses `--from` (shared with migrate/import) for the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Read-only. Reuses `--from` (shared with migrate/import) for the source dir,
|
|
6
|
+
* and works out which source it is by looking at the directory (#1056) rather
|
|
7
|
+
* than adding a second flag. Loads no chant project and no lexicon plugins —
|
|
8
|
+
* pure analysis of a foreign tree.
|
|
8
9
|
*/
|
|
9
10
|
export declare function runCarveAdvise(ctx: CommandContext): Promise<number>;
|
|
10
11
|
/** Fallback for `chant carve` with no/unknown subcommand. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/carve.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD
|
|
1
|
+
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/carve.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBzE;AAED,6DAA6D;AAC7D,wBAAsB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3E"}
|
|
@@ -58,6 +58,16 @@ export declare function runLifecycleTeardown(ctx: CommandContext): Promise<numbe
|
|
|
58
58
|
* chant lifecycle log [environment]
|
|
59
59
|
*/
|
|
60
60
|
export declare function runLifecycleLog(ctx: CommandContext): Promise<number>;
|
|
61
|
+
/**
|
|
62
|
+
* chant lifecycle whoami <environment> [lexicon] [--json] [--strict]
|
|
63
|
+
*
|
|
64
|
+
* Read-only pre-flight (#1982): who chant would act as in each configured
|
|
65
|
+
* lexicon, and what that principal is scoped to, before it acts. Never
|
|
66
|
+
* mutates, never gates — `--strict` is the only way this exits non-zero on an
|
|
67
|
+
* unresolved row, and a lexicon that answers for nothing is reported as such
|
|
68
|
+
* rather than as an empty identity.
|
|
69
|
+
*/
|
|
70
|
+
export declare function runLifecycleWhoami(ctx: CommandContext): Promise<number>;
|
|
61
71
|
/**
|
|
62
72
|
* Fallback for unknown state subcommands.
|
|
63
73
|
*/
|
|
@@ -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":"AA4CA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAE9E;AAmCD;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAyH/E;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C3E;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B/E;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAmL3E;AAslBD;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAgP3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA2L/E;AAsBD;;GAEG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB1E;AAgBD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAmE7E;AAiCD;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAM9E;AAkBD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA+C/E"}
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAsF9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAmUpD;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAsF9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAmUpD;AAwnBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
|