@intentius/chant 0.18.37 → 0.19.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/commands/carve-apply.d.ts +30 -0
- package/dist/cli/commands/carve-apply.d.ts.map +1 -0
- package/dist/cli/commands/carve-bridge.d.ts +32 -0
- package/dist/cli/commands/carve-bridge.d.ts.map +1 -0
- package/dist/cli/commands/carve-emit.d.ts +58 -0
- package/dist/cli/commands/carve-emit.d.ts.map +1 -0
- package/dist/cli/commands/carve.d.ts +29 -0
- package/dist/cli/commands/carve.d.ts.map +1 -0
- package/dist/cli/handlers/carve-apply.d.ts +9 -0
- package/dist/cli/handlers/carve-apply.d.ts.map +1 -0
- package/dist/cli/handlers/carve-bridge.d.ts +10 -0
- package/dist/cli/handlers/carve-bridge.d.ts.map +1 -0
- package/dist/cli/handlers/carve-emit.d.ts +11 -0
- package/dist/cli/handlers/carve-emit.d.ts.map +1 -0
- package/dist/cli/handlers/carve.d.ts +12 -0
- package/dist/cli/handlers/carve.d.ts.map +1 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +12 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/terraform/adopt-state.d.ts +32 -0
- package/dist/terraform/adopt-state.d.ts.map +1 -0
- package/dist/terraform/aws-resources.d.ts +49 -0
- package/dist/terraform/aws-resources.d.ts.map +1 -0
- package/dist/terraform/bridge.d.ts +65 -0
- package/dist/terraform/bridge.d.ts.map +1 -0
- package/dist/terraform/carve.d.ts +66 -0
- package/dist/terraform/carve.d.ts.map +1 -0
- package/dist/terraform/graduate.d.ts +43 -0
- package/dist/terraform/graduate.d.ts.map +1 -0
- package/dist/terraform/graph.d.ts +24 -0
- package/dist/terraform/graph.d.ts.map +1 -0
- package/dist/terraform/parse.d.ts +33 -0
- package/dist/terraform/parse.d.ts.map +1 -0
- package/dist/terraform/score.d.ts +50 -0
- package/dist/terraform/score.d.ts.map +1 -0
- package/dist/terraform/state.d.ts +42 -0
- package/dist/terraform/state.d.ts.map +1 -0
- package/dist/terraform/tier-map.d.ts +38 -0
- package/dist/terraform/tier-map.d.ts.map +1 -0
- package/dist/terraform/types.d.ts +66 -0
- package/dist/terraform/types.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/cli/commands/carve-apply.test.ts +82 -0
- package/src/cli/commands/carve-apply.ts +106 -0
- package/src/cli/commands/carve-bridge.test.ts +97 -0
- package/src/cli/commands/carve-bridge.ts +134 -0
- package/src/cli/commands/carve-emit-state.test.ts +114 -0
- package/src/cli/commands/carve-emit.test.ts +158 -0
- package/src/cli/commands/carve-emit.ts +181 -0
- package/src/cli/commands/carve.test.ts +104 -0
- package/src/cli/commands/carve.ts +123 -0
- package/src/cli/handlers/carve-apply.ts +34 -0
- package/src/cli/handlers/carve-bridge.ts +33 -0
- package/src/cli/handlers/carve-emit.ts +51 -0
- package/src/cli/handlers/carve.ts +44 -0
- package/src/cli/main.ts +48 -0
- package/src/cli/registry.ts +12 -0
- package/src/terraform/__fixtures__/advise.test.ts +51 -0
- package/src/terraform/__fixtures__/carve-arc.test.ts +77 -0
- package/src/terraform/__fixtures__/sample-estate/main.tf +58 -0
- package/src/terraform/adopt-state.test.ts +64 -0
- package/src/terraform/adopt-state.ts +79 -0
- package/src/terraform/aws-resources.test.ts +74 -0
- package/src/terraform/aws-resources.ts +154 -0
- package/src/terraform/bridge.test.ts +118 -0
- package/src/terraform/bridge.ts +164 -0
- package/src/terraform/carve.test.ts +97 -0
- package/src/terraform/carve.ts +0 -0
- package/src/terraform/graduate.test.ts +49 -0
- package/src/terraform/graduate.ts +78 -0
- package/src/terraform/graph.test.ts +137 -0
- package/src/terraform/graph.ts +176 -0
- package/src/terraform/parse.test.ts +56 -0
- package/src/terraform/parse.ts +87 -0
- package/src/terraform/score.test.ts +140 -0
- package/src/terraform/score.ts +148 -0
- package/src/terraform/state.test.ts +76 -0
- package/src/terraform/state.ts +87 -0
- package/src/terraform/tier-map.ts +60 -0
- package/src/terraform/types.ts +69 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant carve apply` — apply graduation for the strangler-fig carve (#197).
|
|
3
|
+
*
|
|
4
|
+
* The dial-turn from observe to apply: resolve the ownership marker that makes
|
|
5
|
+
* the carved resource chant-owned and finalize the ordered apply runbook.
|
|
6
|
+
*
|
|
7
|
+
* BYOL-honest: it does not call the cloud. It computes the marker + graduation
|
|
8
|
+
* plan and (with `--write`) emits a graduation doc. The apply is whatever
|
|
9
|
+
* lifecycle you brought.
|
|
10
|
+
*/
|
|
11
|
+
import { type GraduationPlan } from "../../terraform/graduate.js";
|
|
12
|
+
export interface CarveApplyOptions {
|
|
13
|
+
from?: string;
|
|
14
|
+
select?: string;
|
|
15
|
+
env?: string;
|
|
16
|
+
stack?: string;
|
|
17
|
+
statePath?: string;
|
|
18
|
+
output?: string;
|
|
19
|
+
/** Write the graduation doc to the output dir. */
|
|
20
|
+
write?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface CarveApplyResult {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
error?: string;
|
|
25
|
+
plan?: GraduationPlan;
|
|
26
|
+
written?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function carveApply(opts: CarveApplyOptions): Promise<CarveApplyResult>;
|
|
29
|
+
export declare function formatCarveApply(result: CarveApplyResult): string;
|
|
30
|
+
//# sourceMappingURL=carve-apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-apply.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,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;CACjB;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;CAClB;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4BnF;AAqBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBjE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant carve bridge` — the boundary-bridging step of the strangler-fig carve
|
|
3
|
+
* (#197). Generates the edits to the surviving Terraform (data sources +
|
|
4
|
+
* rewired references), records the deferred deploy-time inputs, and writes a
|
|
5
|
+
* reversible handoff runbook.
|
|
6
|
+
*
|
|
7
|
+
* Safe by default: writes proposed files to an output directory for review.
|
|
8
|
+
* `--apply-rewrites` writes the rewritten survivor `.tf` back in place — an
|
|
9
|
+
* opt-in mutation of your Terraform, never the default.
|
|
10
|
+
*/
|
|
11
|
+
import { type BridgePlan } from "../../terraform/bridge.js";
|
|
12
|
+
export interface CarveBridgeOptions {
|
|
13
|
+
from?: string;
|
|
14
|
+
select?: string;
|
|
15
|
+
statePath?: string;
|
|
16
|
+
/** Output directory for proposed files (default `<from>/carveout`). */
|
|
17
|
+
output?: string;
|
|
18
|
+
/** Write rewritten survivor `.tf` back in place instead of to the output dir. */
|
|
19
|
+
applyRewrites?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface CarveBridgeResult {
|
|
22
|
+
ok: boolean;
|
|
23
|
+
error?: string;
|
|
24
|
+
plan?: BridgePlan;
|
|
25
|
+
/** Absolute paths written. */
|
|
26
|
+
written?: string[];
|
|
27
|
+
/** True if survivor files were edited in place. */
|
|
28
|
+
appliedInPlace?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function carveBridge(opts: CarveBridgeOptions): Promise<CarveBridgeResult>;
|
|
31
|
+
export declare function formatCarveBridge(result: CarveBridgeResult): string;
|
|
32
|
+
//# sourceMappingURL=carve-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-bridge.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,EAAkB,KAAK,UAAU,EAAuB,MAAM,wBAAwB,CAAC;AAG9F,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,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;CAC1B;AASD,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA2DtF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA2BnE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant carve emit` — the first strangler-fig emit step (#197).
|
|
3
|
+
*
|
|
4
|
+
* Given a resource selected from a Terraform estate, it:
|
|
5
|
+
* 1. classifies the boundary (which edges the carve cuts),
|
|
6
|
+
* 2. adopts the live resource into typed chant source via live import
|
|
7
|
+
* (`chant import --from <env>` machinery — cloud→code, read-only export),
|
|
8
|
+
* 3. writes a boundary report.
|
|
9
|
+
*
|
|
10
|
+
* It does not patch the surviving Terraform or apply anything — that is the
|
|
11
|
+
* boundary-bridging and apply-graduation work (later PRs). This lands the
|
|
12
|
+
* resource at the observe position: emitted, reversible, nothing mutated.
|
|
13
|
+
*/
|
|
14
|
+
import { type CarveReport } from "../../terraform/carve.js";
|
|
15
|
+
import type { LexiconPlugin, ResourceSelector } from "../../lexicon.js";
|
|
16
|
+
import type { ImportResult, LiveImportOptions } from "./import.js";
|
|
17
|
+
export interface CarveEmitOptions {
|
|
18
|
+
/** Terraform estate directory (`--from`). */
|
|
19
|
+
from?: string;
|
|
20
|
+
/** Terraform address to carve, e.g. `aws_s3_bucket.assets` (`--select`). */
|
|
21
|
+
select?: string;
|
|
22
|
+
/** Live environment to adopt from (`--env`). */
|
|
23
|
+
env?: string;
|
|
24
|
+
/**
|
|
25
|
+
* CloudFormation logical ID to adopt on the live path (`--live-name`). The
|
|
26
|
+
* live import filters a stack's template by logical ID, which is not the
|
|
27
|
+
* Terraform physical name — so the live selector is by native type by
|
|
28
|
+
* default, and this narrows it when a stack has several of that type.
|
|
29
|
+
*/
|
|
30
|
+
liveName?: string;
|
|
31
|
+
/** Opt-in `.tfstate` for instance counts (`--state`). */
|
|
32
|
+
statePath?: string;
|
|
33
|
+
/** Output directory for the emitted source (`--output`). */
|
|
34
|
+
output?: string;
|
|
35
|
+
/** Write the boundary report JSON here (`--report`). */
|
|
36
|
+
reportFile?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Injected so tests exercise emit without cloud calls. */
|
|
39
|
+
export interface CarveEmitDeps {
|
|
40
|
+
plugins: LexiconPlugin[];
|
|
41
|
+
liveImport: (plugins: LexiconPlugin[], options: LiveImportOptions) => Promise<ImportResult>;
|
|
42
|
+
}
|
|
43
|
+
export interface CarveEmitResult {
|
|
44
|
+
ok: boolean;
|
|
45
|
+
error?: string;
|
|
46
|
+
report?: CarveReport;
|
|
47
|
+
emit?: ImportResult;
|
|
48
|
+
/** The selector used for the live adoption, for transparency (cloud path). */
|
|
49
|
+
selector?: ResourceSelector;
|
|
50
|
+
/** How the resource was adopted. */
|
|
51
|
+
source?: "tfstate" | "live";
|
|
52
|
+
/** Emitted file path(s). */
|
|
53
|
+
emittedFiles?: string[];
|
|
54
|
+
}
|
|
55
|
+
export declare function carveEmit(opts: CarveEmitOptions, deps: CarveEmitDeps): Promise<CarveEmitResult>;
|
|
56
|
+
/** Human-readable emit summary: what was adopted and what boundary work remains. */
|
|
57
|
+
export declare function formatCarveEmit(result: CarveEmitResult): string;
|
|
58
|
+
//# sourceMappingURL=carve-emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CAC7F;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,oCAAoC;IACpC,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,4BAA4B;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CA8ErG;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAkC/D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant carve advise` — the read-only Terraform peelability advisor (#214).
|
|
3
|
+
*
|
|
4
|
+
* Points at a Terraform estate and reports which resources/modules are cheap to
|
|
5
|
+
* carve into native chant later and which should stay in Terraform. It emits
|
|
6
|
+
* nothing, patches nothing, and touches no live resource — pure analysis. The
|
|
7
|
+
* emit/boundary/apply phases stay in #197, gated on demand.
|
|
8
|
+
*/
|
|
9
|
+
import { type Peelability } from "../../terraform/score.js";
|
|
10
|
+
export interface CarveAdviseOptions {
|
|
11
|
+
/** Terraform estate directory (from `--from`). */
|
|
12
|
+
from?: string;
|
|
13
|
+
/** Opt-in `.tfstate` path (from `--state`): accurate fan-out instance counts. */
|
|
14
|
+
statePath?: string;
|
|
15
|
+
/** Write the full JSON report to this path (from `--report <path>`). */
|
|
16
|
+
reportFile?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CarveAdviseResult {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
from?: string;
|
|
22
|
+
results?: Peelability[];
|
|
23
|
+
}
|
|
24
|
+
export declare function carveAdvise(opts: CarveAdviseOptions): Promise<CarveAdviseResult>;
|
|
25
|
+
/** The `--json` / `--report` payload. */
|
|
26
|
+
export declare function carveJson(result: CarveAdviseResult): unknown;
|
|
27
|
+
/** Human-readable banded, ranked summary. */
|
|
28
|
+
export declare function formatCarveReport(result: CarveAdviseResult): string;
|
|
29
|
+
//# sourceMappingURL=carve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAe,KAAK,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AAE5F,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACzB;AAID,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAwBtF;AAED,yCAAyC;AACzC,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAY5D;AAED,6CAA6C;AAC7C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAyBnE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommandContext } from "../registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* `chant carve apply --from <tf-dir> --select <address> --env <env> [--stack <name>] [--write]`
|
|
4
|
+
*
|
|
5
|
+
* Resolves the ownership marker + graduation runbook. BYOL-honest: no cloud
|
|
6
|
+
* calls. `--write` saves the graduation doc. No lexicon plugins needed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runCarveApply(ctx: CommandContext): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=carve-apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-apply.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/carve-apply.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBxE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandContext } from "../registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* `chant carve bridge --from <tf-dir> --select <address> [--output <dir>] [--apply-rewrites]`
|
|
4
|
+
*
|
|
5
|
+
* Read-only by default: writes proposed survivor patches + a runbook to an
|
|
6
|
+
* output dir. `--apply-rewrites` edits the surviving `.tf` in place. Loads no
|
|
7
|
+
* lexicon plugins — pure Terraform-side analysis.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runCarveBridge(ctx: CommandContext): Promise<number>;
|
|
10
|
+
//# sourceMappingURL=carve-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-bridge.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/carve-bridge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBzE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandContext } from "../registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* `chant carve emit --from <tf-dir> --select <address> (--state <tfstate> | --env <env>)`
|
|
4
|
+
*
|
|
5
|
+
* Adopts the selected Terraform resource into typed chant source. `--state`
|
|
6
|
+
* adopts offline from the tfstate (no plugins); `--env` adopts via the live
|
|
7
|
+
* cloud import path, for which the target lexicon is loaded lazily here — so a
|
|
8
|
+
* state-only carve never pays the plugin-load cost.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runCarveEmit(ctx: CommandContext): Promise<number>;
|
|
11
|
+
//# sourceMappingURL=carve-emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve-emit.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/carve-emit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoCvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CommandContext } from "../registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* `chant carve advise --from <terraform-dir> [--json] [--report <path>]`
|
|
4
|
+
*
|
|
5
|
+
* Read-only. Reuses `--from` (shared with migrate/import) for the estate dir.
|
|
6
|
+
* Loads no chant project and no lexicon plugins — pure analysis of a foreign
|
|
7
|
+
* Terraform tree.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runCarveAdvise(ctx: CommandContext): Promise<number>;
|
|
10
|
+
/** Fallback for `chant carve` with no/unknown subcommand. */
|
|
11
|
+
export declare function runCarveUnknown(_ctx: CommandContext): Promise<number>;
|
|
12
|
+
//# sourceMappingURL=carve.d.ts.map
|
|
@@ -0,0 +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;;;;;;GAMG;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"}
|
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;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAsB9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAyMpD;AA2XD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
|
package/dist/cli/registry.d.ts
CHANGED
|
@@ -30,6 +30,18 @@ export interface ParsedArgs {
|
|
|
30
30
|
live: boolean;
|
|
31
31
|
/** `chant migrate --from <name>` (default "github") */
|
|
32
32
|
migrateFrom?: string;
|
|
33
|
+
/** `chant carve advise --state <path>` — opt-in .tfstate for accurate instance counts */
|
|
34
|
+
statePath?: string;
|
|
35
|
+
/** `chant carve emit --select <tf-address>` — the Terraform resource to carve */
|
|
36
|
+
selectAddress?: string;
|
|
37
|
+
/** `chant carve emit --live-name <logicalId>` — CFN logical ID for live adoption */
|
|
38
|
+
liveName?: string;
|
|
39
|
+
/** `chant carve bridge --apply-rewrites` — write rewritten survivor .tf in place */
|
|
40
|
+
applyRewrites?: boolean;
|
|
41
|
+
/** `chant carve apply --stack <name>` — ownership-marker stack for graduation */
|
|
42
|
+
carveStack?: string;
|
|
43
|
+
/** `chant carve apply --write` — save the graduation doc */
|
|
44
|
+
write?: boolean;
|
|
33
45
|
/** `chant migrate --to <name>` (default "gitlab") */
|
|
34
46
|
migrateTo?: string;
|
|
35
47
|
/** `chant migrate --emit yaml|ts` */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/cli/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,IAA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iB/F"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adopt a Terraform-managed resource into chant source from its `.tfstate`
|
|
3
|
+
* (#1009). This is the correct adoption source for carving OUT of Terraform:
|
|
4
|
+
* a TF resource is created through the provider API, not CloudFormation, so it
|
|
5
|
+
* is not in any CFN stack — but its resolved attributes ARE in the state file.
|
|
6
|
+
*
|
|
7
|
+
* chant AWS constructors take CloudFormation PascalCase properties (e.g.
|
|
8
|
+
* `new Bucket({ BucketName })`), while Terraform state uses the provider's
|
|
9
|
+
* snake_case attributes (`bucket`, `tags`). The mapping is driven by the single
|
|
10
|
+
* AWS carve-out table (`aws-resources.ts`) — the same table the advisor's tier
|
|
11
|
+
* map derives from, so every AWS type advise ranks can be emitted. Attributes
|
|
12
|
+
* without a mapping are preserved in a reference comment, never dropped.
|
|
13
|
+
*/
|
|
14
|
+
import type { StateResource } from "./state.js";
|
|
15
|
+
export interface AdoptedSource {
|
|
16
|
+
fileName: string;
|
|
17
|
+
content: string;
|
|
18
|
+
/** True when at least one attribute was mapped to a native prop. */
|
|
19
|
+
mapped: boolean;
|
|
20
|
+
nativeType: string;
|
|
21
|
+
}
|
|
22
|
+
/** Is this Terraform type adoptable from state (has a native constructor)? */
|
|
23
|
+
export declare function canAdoptFromState(tfType: string): boolean;
|
|
24
|
+
/** Terraform types that can currently be adopted from state, for user-facing hints. */
|
|
25
|
+
export declare function supportedStateAdoptionTypes(): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Render chant source for a state-adopted resource. Emits the native
|
|
28
|
+
* constructor with mapped properties, plus a reference comment listing the
|
|
29
|
+
* Terraform attributes that were not mapped so nothing is silently dropped.
|
|
30
|
+
*/
|
|
31
|
+
export declare function adoptFromState(resource: StateResource): AdoptedSource | null;
|
|
32
|
+
//# sourceMappingURL=adopt-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adopt-state.d.ts","sourceRoot":"","sources":["../../src/terraform/adopt-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,uFAAuF;AACvF,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI,CA6B5E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AWS carve-out resource table — the single source of truth for which AWS
|
|
3
|
+
* Terraform types chant can carve, and how.
|
|
4
|
+
*
|
|
5
|
+
* Both the advisor (tier map / scoring) and `carve emit --state` derive from
|
|
6
|
+
* this one list, so advise and emit cover exactly the same AWS types: advise
|
|
7
|
+
* never ranks a resource emit cannot produce, and emit never claims a type
|
|
8
|
+
* advise did not score. Adding a type here lights it up for both at once.
|
|
9
|
+
*
|
|
10
|
+
* Each entry maps the common, high-confidence Terraform attributes to their
|
|
11
|
+
* CloudFormation property names (chant AWS constructors take CFN PascalCase
|
|
12
|
+
* props). Attributes without a mapping here are preserved in a reference
|
|
13
|
+
* comment on emit, never dropped — a curated seed, not a full TF↔CFN transform.
|
|
14
|
+
*/
|
|
15
|
+
/** A Terraform attribute → CloudFormation property mapping. */
|
|
16
|
+
type FieldSpec = string | {
|
|
17
|
+
prop: string;
|
|
18
|
+
transform: (v: unknown) => unknown;
|
|
19
|
+
};
|
|
20
|
+
export interface AwsCarveType {
|
|
21
|
+
/** Terraform resource type, e.g. `aws_s3_bucket`. */
|
|
22
|
+
tfType: string;
|
|
23
|
+
/** Native-spec map tier: 1 clean 1:1, 2 some reshaping, 3 heavy composite. */
|
|
24
|
+
tier: 1 | 2 | 3;
|
|
25
|
+
/** CloudFormation type, e.g. `AWS::S3::Bucket`. */
|
|
26
|
+
nativeType: string;
|
|
27
|
+
/** chant AWS lexicon constructor, e.g. `Bucket` (verified against generated exports). */
|
|
28
|
+
ctor: string;
|
|
29
|
+
/** The HCL attribute carrying the physical name (for the live-import hint / graph identity). */
|
|
30
|
+
identityAttr?: string;
|
|
31
|
+
/** Terraform attribute → CFN property mappings. */
|
|
32
|
+
fields: Record<string, FieldSpec>;
|
|
33
|
+
/** Map the Terraform `tags` map to CloudFormation `Tags` list. */
|
|
34
|
+
tags?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const AWS_LEXICON_IMPORT = "@intentius/chant-lexicon-aws";
|
|
37
|
+
export declare const AWS_CARVE_TYPES: AwsCarveType[];
|
|
38
|
+
export declare function awsCarveType(tfType: string): AwsCarveType | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Apply an entry's field mappings to a resource's Terraform attributes, yielding
|
|
41
|
+
* CloudFormation properties and the set of attribute keys that were consumed
|
|
42
|
+
* (so the caller can report the rest as unmapped).
|
|
43
|
+
*/
|
|
44
|
+
export declare function applyAwsMapper(entry: AwsCarveType, attrs: Record<string, unknown>): {
|
|
45
|
+
props: Record<string, unknown>;
|
|
46
|
+
mappedKeys: string[];
|
|
47
|
+
};
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=aws-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-resources.d.ts","sourceRoot":"","sources":["../../src/terraform/aws-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,+DAA+D;AAC/D,KAAK,SAAS,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAA;CAAE,CAAC;AAE/E,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC,kEAAkE;IAClE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AAajE,eAAO,MAAM,eAAe,EAAE,YAAY,EA8DzC,CAAC;AAIF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAErE;AASD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAoB1D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boundary bridging for the strangler-fig carve (#197) — the centerpiece.
|
|
3
|
+
*
|
|
4
|
+
* Carving a resource cuts edges. This generates the edits to the Terraform you
|
|
5
|
+
* LEAVE BEHIND so its plan stays valid once the resource is chant-owned:
|
|
6
|
+
*
|
|
7
|
+
* - inbound edge → the survivor loses its reference to the carved resource.
|
|
8
|
+
* Bridge: add a `data` source for the (now chant-managed) resource and
|
|
9
|
+
* rewrite the survivor's `type.name.attr` references to `data.type.name.attr`.
|
|
10
|
+
* Required immediately, or `terraform plan` errors on the dangling ref.
|
|
11
|
+
*
|
|
12
|
+
* - outbound edge → the carved resource read a value from a survivor. That
|
|
13
|
+
* value must enter chant from outside synthesis, as a deploy-time input.
|
|
14
|
+
* Deferred until apply; here we only record the provenance.
|
|
15
|
+
*
|
|
16
|
+
* Pure text transform over the original `.tf` content — no wasm, no shell, no
|
|
17
|
+
* mutation. The command layer writes the results and (optionally) diffs them
|
|
18
|
+
* into a git-applyable patch. A carve never destroys or recreates; the runbook
|
|
19
|
+
* is reversible via `terraform import`.
|
|
20
|
+
*/
|
|
21
|
+
import type { CarveReport } from "./carve.js";
|
|
22
|
+
export interface CarvedIdentity {
|
|
23
|
+
/** The HCL identity attribute, e.g. `bucket` or `name`. */
|
|
24
|
+
attr?: string;
|
|
25
|
+
/** Its literal value, e.g. `myapp-assets-prod`. */
|
|
26
|
+
value?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DataSourceBlock {
|
|
29
|
+
/** Carved resource address the data source stands in for. */
|
|
30
|
+
address: string;
|
|
31
|
+
type: string;
|
|
32
|
+
name: string;
|
|
33
|
+
hcl: string;
|
|
34
|
+
}
|
|
35
|
+
export interface FileRewrite {
|
|
36
|
+
path: string;
|
|
37
|
+
original: string;
|
|
38
|
+
rewritten: string;
|
|
39
|
+
changed: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface DeferredInput {
|
|
42
|
+
survivor: string;
|
|
43
|
+
carved: string;
|
|
44
|
+
attrs: string[];
|
|
45
|
+
note: string;
|
|
46
|
+
}
|
|
47
|
+
export interface BridgePlan {
|
|
48
|
+
target: string;
|
|
49
|
+
dataSources: DataSourceBlock[];
|
|
50
|
+
rewrites: FileRewrite[];
|
|
51
|
+
deferredInputs: DeferredInput[];
|
|
52
|
+
runbook: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build the bridge plan for a carve.
|
|
56
|
+
*
|
|
57
|
+
* @param report the boundary report (from `boundaryReport`)
|
|
58
|
+
* @param files every `.tf` file in the estate, as { path, content }
|
|
59
|
+
* @param identities physical identity per carved address, for the data sources
|
|
60
|
+
*/
|
|
61
|
+
export declare function generateBridge(report: CarveReport, files: Array<{
|
|
62
|
+
path: string;
|
|
63
|
+
content: string;
|
|
64
|
+
}>, identities: Map<string, CarvedIdentity>): BridgePlan;
|
|
65
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/terraform/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAiBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAC/C,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GACtC,UAAU,CAsCZ"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Carve-out boundary analysis for the strangler-fig emit path (#197).
|
|
3
|
+
*
|
|
4
|
+
* The advisor (#214) ranks *what* is cheap to carve. This is the next step:
|
|
5
|
+
* given a chosen resource, work out the boundary — every dependency edge the
|
|
6
|
+
* carve would cut — so the surviving Terraform can be patched and the resource
|
|
7
|
+
* handed off without destroying it.
|
|
8
|
+
*
|
|
9
|
+
* Pure analysis over the graph, like the scorer. Emitting the chant source
|
|
10
|
+
* (via live import) and generating the TF patches live in the command/bridge
|
|
11
|
+
* layers; this module just classifies the boundary.
|
|
12
|
+
*/
|
|
13
|
+
import type { TfGraph } from "./types.js";
|
|
14
|
+
/** One resource in the carve set (the selected node plus its folded sub-resources). */
|
|
15
|
+
export interface CarveMember {
|
|
16
|
+
address: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
/** Set when this member is a sub-resource inlined into the selected parent. */
|
|
19
|
+
foldedInto?: string;
|
|
20
|
+
}
|
|
21
|
+
export type BoundaryDirection = "inbound" | "outbound";
|
|
22
|
+
/**
|
|
23
|
+
* A dependency edge the carve cuts.
|
|
24
|
+
* - inbound → a survivor depends on the carve set. Bridge: rewrite that
|
|
25
|
+
* reference to a Terraform `data` source. Required immediately, or the
|
|
26
|
+
* surviving plan breaks.
|
|
27
|
+
* - outbound → the carve set depends on a survivor. Bridge: the value enters
|
|
28
|
+
* chant as a deploy-time input. Deferred until apply; only provenance is
|
|
29
|
+
* recorded at the observe position.
|
|
30
|
+
*/
|
|
31
|
+
export interface BoundaryEdge {
|
|
32
|
+
direction: BoundaryDirection;
|
|
33
|
+
/** The survivor side of the edge. */
|
|
34
|
+
survivor: string;
|
|
35
|
+
/** The carve-set side of the edge. */
|
|
36
|
+
carved: string;
|
|
37
|
+
attrs: string[];
|
|
38
|
+
bridge: "tf-data-source" | "deferred-input";
|
|
39
|
+
required: "immediately" | "at-apply";
|
|
40
|
+
}
|
|
41
|
+
export interface CarveReport {
|
|
42
|
+
/** The selected resource address. */
|
|
43
|
+
target: string;
|
|
44
|
+
carveSet: CarveMember[];
|
|
45
|
+
/** Peelability of the selected resource (from the #214 scorer). */
|
|
46
|
+
peelability: number;
|
|
47
|
+
inbound: BoundaryEdge[];
|
|
48
|
+
outbound: BoundaryEdge[];
|
|
49
|
+
/** A carve never destroys/recreates; it is reversible via `terraform import`. */
|
|
50
|
+
reversible: true;
|
|
51
|
+
diagnostics: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The carve set for a selected address: the node itself plus any sub-resources
|
|
55
|
+
* that fold into it (same name, a `FOLDS_INTO` child type whose parent is the
|
|
56
|
+
* selection). Those are carried along and inlined, not left behind.
|
|
57
|
+
*/
|
|
58
|
+
export declare function resolveCarveSet(graph: TfGraph, target: string): CarveMember[];
|
|
59
|
+
/**
|
|
60
|
+
* Classify the boundary of carving `target`: the inbound edges that need an
|
|
61
|
+
* immediate data-source patch, and the outbound edges that become deferred
|
|
62
|
+
* deploy-time inputs. Edges internal to the carve set (e.g. a folded
|
|
63
|
+
* sub-resource pointing at its parent) are not boundary work.
|
|
64
|
+
*/
|
|
65
|
+
export declare function boundaryReport(graph: TfGraph, target: string): CarveReport | null;
|
|
66
|
+
//# sourceMappingURL=carve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../src/terraform/carve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IAC5C,QAAQ,EAAE,aAAa,GAAG,UAAU,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iFAAiF;IACjF,UAAU,EAAE,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAgB7E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAgDjF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply graduation for the strangler-fig carve (#197) — the last step.
|
|
3
|
+
*
|
|
4
|
+
* After a resource is emitted (`carve emit`) and the survivors are bridged
|
|
5
|
+
* (`carve bridge`), it sits at the observe position: chant has the source, but
|
|
6
|
+
* the live resource is an orphan carrying no chant ownership. Graduation is the
|
|
7
|
+
* dial-turn to apply: mark the resource chant-owned so `chant carve` / status
|
|
8
|
+
* recognize it, and finalize the ordered apply runbook.
|
|
9
|
+
*
|
|
10
|
+
* This is BYOL-honest: it does NOT call the cloud. It resolves the ownership
|
|
11
|
+
* marker (reusing core's `ownershipEntries`) and produces the graduation
|
|
12
|
+
* artifacts + runbook. The apply itself is whatever lifecycle you brought —
|
|
13
|
+
* the native CLI, a CI pipeline, an ApplyOp — and it stamps the marker the
|
|
14
|
+
* emitted source now carries.
|
|
15
|
+
*/
|
|
16
|
+
import { type ChannelKeys, type OwnershipMarker } from "../ownership.js";
|
|
17
|
+
import type { CarveReport } from "./carve.js";
|
|
18
|
+
/**
|
|
19
|
+
* Default tag channel, mirroring the AWS lexicon's `AWS_TAG_OWNERSHIP_KEYS`
|
|
20
|
+
* (`lexicons/aws/src/ownership.ts`). Core cannot import a lexicon, so the
|
|
21
|
+
* convention is duplicated here; the values match so the graduation plan shows
|
|
22
|
+
* the tags the AWS apply path will actually stamp.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_TAG_OWNERSHIP_KEYS: ChannelKeys;
|
|
25
|
+
export interface GraduationPlan {
|
|
26
|
+
target: string;
|
|
27
|
+
marker: OwnershipMarker;
|
|
28
|
+
/** The ownership tags the emitted resource must carry to be chant-owned. */
|
|
29
|
+
ownershipTags: Record<string, string>;
|
|
30
|
+
/** The finalized, ordered apply runbook. */
|
|
31
|
+
steps: string[];
|
|
32
|
+
warnings: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface GraduationOptions {
|
|
35
|
+
/** Chant stack name for the ownership marker (defaults to the resource name). */
|
|
36
|
+
stack?: string;
|
|
37
|
+
/** Environment identity for the marker. */
|
|
38
|
+
env?: string;
|
|
39
|
+
/** Override the tag channel (e.g. for a non-AWS lexicon). */
|
|
40
|
+
channel?: ChannelKeys;
|
|
41
|
+
}
|
|
42
|
+
export declare function graduationPlan(report: CarveReport, opts?: GraduationOptions): GraduationPlan;
|
|
43
|
+
//# sourceMappingURL=graduate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graduate.d.ts","sourceRoot":"","sources":["../../src/terraform/graduate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAoB,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAIxC,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,eAAe,CAAC;IACxB,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,GAAE,iBAAsB,GAAG,cAAc,CA2BhG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure Terraform dependency-graph builder for the carve-out advisor (#214 T1).
|
|
3
|
+
*
|
|
4
|
+
* Input is the JSON tree `@cdktf/hcl2json` produces (`Hcl2JsonTree`). No wasm,
|
|
5
|
+
* no filesystem — so the graph and its edge classification are unit-testable
|
|
6
|
+
* on hand-written fixtures. `parse.ts` is the thin glue that loads the wasm
|
|
7
|
+
* parser and feeds this.
|
|
8
|
+
*/
|
|
9
|
+
import type { Hcl2JsonTree, TfEdge, TfGraph } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Build the dependency graph from a merged hcl2json tree.
|
|
12
|
+
*
|
|
13
|
+
* `resource` and `module` blocks become nodes. `data` sources are NOT nodes
|
|
14
|
+
* (they are not carvable infrastructure), but a reference *to* a data source
|
|
15
|
+
* marks the referring node dynamic. An edge is recorded only when its target
|
|
16
|
+
* resolves to a known resource/module node — references to `var`/`local`/data
|
|
17
|
+
* are dropped.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildGraph(tree: Hcl2JsonTree): TfGraph;
|
|
20
|
+
/** Edges where other nodes depend on `address` (each → a surviving-TF data-source patch). */
|
|
21
|
+
export declare function inboundEdges(graph: TfGraph, address: string): TfEdge[];
|
|
22
|
+
/** Edges where `address` depends on other nodes (each → a deferred deploy-time input). */
|
|
23
|
+
export declare function outboundEdges(graph: TfGraph, address: string): TfEdge[];
|
|
24
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/terraform/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAU,MAAM,SAAS,CAAC;AA4ErE;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAsEtD;AAED,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtE;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wasm glue for the carve-out advisor (#214 T1): read a Terraform estate's
|
|
3
|
+
* `.tf` files, run them through `@cdktf/hcl2json`, merge into one tree, and hand
|
|
4
|
+
* off to the pure `buildGraph`.
|
|
5
|
+
*
|
|
6
|
+
* `@cdktf/hcl2json` is NOT a chant dependency — it carries a ~1.8 MB wasm blob
|
|
7
|
+
* and only carve-out users need it. It is lazy-loaded here and, if absent, the
|
|
8
|
+
* advisor fails with a one-line install hint.
|
|
9
|
+
*/
|
|
10
|
+
import type { Hcl2JsonTree, TfGraph } from "./types.js";
|
|
11
|
+
/** Minimal shape of the parser export we depend on. */
|
|
12
|
+
type Hcl2JsonParse = (filename: string, hcl: string) => Promise<Hcl2JsonTree>;
|
|
13
|
+
export declare class Hcl2JsonNotInstalled extends Error {
|
|
14
|
+
constructor(cause: unknown);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Lazy-load the optional HCL parser. Throws `Hcl2JsonNotInstalled` with an
|
|
18
|
+
* install hint when the package is missing, rather than a raw MODULE_NOT_FOUND.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadHcl2json(): Promise<Hcl2JsonParse>;
|
|
21
|
+
export interface ParseTerraformOptions {
|
|
22
|
+
/** Opt-in `.tfstate` path (#214 T2): overlays state-expanded instance counts. */
|
|
23
|
+
statePath?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parse a Terraform directory into a dependency graph. Reads only `.tf` unless
|
|
27
|
+
* `statePath` is given. Pure `.tf` estates parse fully; `count`/`for_each`
|
|
28
|
+
* blocks report a single instance and are flagged `hasDynamic`. With state, the
|
|
29
|
+
* instance counts become accurate (see `state.ts`).
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseTerraformDir(dir: string, opts?: ParseTerraformOptions): Promise<TfGraph>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/terraform/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAErD,uDAAuD;AACvD,KAAK,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE9E,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,KAAK,EAAE,OAAO;CAQ3B;AAED;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC,CAO3D;AAuBD,MAAM,WAAW,qBAAqB;IACpC,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,qBAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,CAWvG"}
|