@patronage/factory-ci 1.0.0-alpha.4 → 1.0.0-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +712 -10
  2. package/dist/.build-fingerprint.json +3 -0
  3. package/dist/alchemy/index.d.ts +1174 -0
  4. package/dist/alchemy/index.js +2142 -0
  5. package/dist/bundle-alchemy-entry-CT5hCphA.js +112 -0
  6. package/dist/execute-alchemy-entry-B397GSk5.d.ts +134 -0
  7. package/dist/execute-alchemy-entry-CZ7Knz4q.js +160 -0
  8. package/dist/index.d.ts +1205 -87
  9. package/dist/index.js +2752 -317
  10. package/package.json +28 -10
  11. package/src/actions.ts +13 -0
  12. package/src/alchemy/child-diagnostics.ts +148 -0
  13. package/src/alchemy/credential-preflight.ts +428 -0
  14. package/src/alchemy/destroy-postcondition.ts +103 -0
  15. package/src/alchemy/evaluate-stack.ts +153 -0
  16. package/src/alchemy/first-deploy-authorization.ts +194 -0
  17. package/src/alchemy/index.ts +144 -0
  18. package/src/alchemy/lifecycle-failure.ts +174 -0
  19. package/src/alchemy/lifecycle.ts +1330 -0
  20. package/src/alchemy/local-emulation.ts +89 -0
  21. package/src/alchemy/plan-effects.ts +510 -0
  22. package/src/alchemy/retained-identity.ts +248 -0
  23. package/src/alchemy/secret-name-policy.ts +96 -0
  24. package/src/alchemy/stage-policy.ts +269 -0
  25. package/src/alchemy/state-tree.ts +168 -0
  26. package/src/alchemy/url-implies-auth.ts +264 -0
  27. package/src/alchemy-baseline.ts +75 -0
  28. package/src/bundle-alchemy-entry.ts +5 -0
  29. package/src/candidate-impact-workflow.ts +110 -0
  30. package/src/candidate-lifecycle.ts +29 -0
  31. package/src/cursor-oidc.ts +33 -0
  32. package/src/execute-alchemy-entry.ts +128 -8
  33. package/src/factory-workflow.ts +83 -40
  34. package/src/github-app-token.ts +92 -18
  35. package/src/github-transport.ts +186 -0
  36. package/src/impact-demand-condition.ts +67 -0
  37. package/src/index.ts +174 -0
  38. package/src/lifecycle-contract-lane.ts +113 -0
  39. package/src/merge-freeze-job.ts +253 -0
  40. package/src/pinned-action.ts +30 -0
  41. package/src/pr-status-hud-workflow.ts +96 -0
  42. package/src/preview-cleanup-topology.ts +115 -0
  43. package/src/preview-proof-inventory.ts +1092 -0
  44. package/src/preview-proof-lifecycle.ts +328 -0
  45. package/src/preview-receipt-workflow.ts +83 -0
  46. package/src/production-impact-workflow.ts +181 -0
  47. package/src/proof-reuse-gate.ts +223 -48
  48. package/src/proof-reuse-presentation.ts +131 -0
  49. package/src/push-identity-workflow.ts +463 -0
  50. package/src/runnable-cli.ts +27 -0
  51. package/src/verify-runner-policy.ts +290 -0
  52. package/src/vitest-profile-reader.test.ts +208 -0
  53. package/src/vitest-profile-reader.ts +225 -0
  54. package/src/vitest-profile.ts +631 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The destroy postcondition: a destroyed stage owns nothing.
3
+ *
4
+ * Alchemy's `destroy` can exit zero while the state store still lists
5
+ * resources for the stage — a partial destroy, a resource whose delete failed
6
+ * quietly, or a state row that was never removed. Paitronage checks the state
7
+ * store after the child exits rather than trusting the exit code
8
+ * (`runAlchemyLifecycle`, the `"Alchemy destroy left target-stage state
9
+ * registered."` branch). Firedup carries no equivalent, which is exactly the
10
+ * gap this closes.
11
+ *
12
+ * Reading the state store is the project's job: only the project knows which
13
+ * store it configured and how to address a stage in it. This function owns the
14
+ * postcondition, and it refuses to pass on a reader that reported nothing
15
+ * usable — a check that cannot fail is not a check.
16
+ */
17
+
18
+ export interface StageStateTarget {
19
+ readonly stack: string;
20
+ readonly stage: string;
21
+ }
22
+
23
+ /**
24
+ * Lists the resource identifiers the state store still holds for one stage.
25
+ * Returns an empty array for a stage the store does not know. It must not
26
+ * return an empty array for a stage it could not read; it throws instead.
27
+ */
28
+ export type StageStateReader = (
29
+ target: StageStateTarget
30
+ ) => readonly string[] | Promise<readonly string[]>;
31
+
32
+ export interface AssertDestroyLeftNothingOptions extends StageStateTarget {
33
+ readonly stateReader: StageStateReader;
34
+ }
35
+
36
+ /**
37
+ * Read the state store through the project's reader.
38
+ *
39
+ * A reader addresses a state store with a credential, and its failure can
40
+ * quote the URL, the header, or the token it was reading with. Nothing from
41
+ * the original error survives: no message, no `cause`, no copied property.
42
+ * This is the policy `credentialPreflight` applies to `resolveCredential`, for
43
+ * the same reason.
44
+ */
45
+ const readState = async (
46
+ stateReader: StageStateReader,
47
+ target: StageStateTarget
48
+ ): Promise<readonly string[]> => {
49
+ try {
50
+ return await stateReader(target);
51
+ } catch {
52
+ throw new Error(
53
+ `The destroy postcondition for ${target.stack} into ${target.stage} could not read the state store.`
54
+ );
55
+ }
56
+ };
57
+
58
+ /**
59
+ * Proves a destroy left no resource registered for the stage.
60
+ *
61
+ * Throws when the store still lists resources, naming them in sorted order,
62
+ * and throws when the reader returns anything other than a list of resource
63
+ * identifiers. A reader that throws fails the postcondition too, under a fixed
64
+ * message that carries nothing the reader's own error said. Resource
65
+ * identifiers are names, never values.
66
+ */
67
+ export const assertDestroyLeftNothing = async ({
68
+ stack,
69
+ stage,
70
+ stateReader,
71
+ }: AssertDestroyLeftNothingOptions): Promise<void> => {
72
+ if (!(stack.trim() && stage.trim())) {
73
+ throw new Error("The destroy postcondition requires a stack and a stage.");
74
+ }
75
+ if (stack !== stack.trim() || stage !== stage.trim()) {
76
+ // A stage read from the environment carries a trailing newline often
77
+ // enough to matter. Padded, it addresses a stage the store does not know,
78
+ // the reader answers with an empty list, and the postcondition passes over
79
+ // a stage that was never emptied.
80
+ throw new Error(
81
+ "The destroy postcondition requires a stack and a stage with no surrounding whitespace."
82
+ );
83
+ }
84
+ const listed = await readState(stateReader, { stack, stage });
85
+ if (
86
+ !Array.isArray(listed) ||
87
+ listed.some((resource) => typeof resource !== "string" || !resource.trim())
88
+ ) {
89
+ // Without this the check passes on `undefined`, which is the reading a
90
+ // broken reader produces most often, and the assertion becomes vacuous.
91
+ // A blank entry is the same failure: it is not a resource identifier, so
92
+ // it is a reader that did not answer, not a stage that is empty.
93
+ throw new Error(
94
+ `The destroy postcondition for ${stack} into ${stage} could not read a resource list from the state store.`
95
+ );
96
+ }
97
+ const remaining = [...listed].toSorted();
98
+ if (remaining.length > 0) {
99
+ throw new Error(
100
+ `Alchemy destroy left ${remaining.length} resource registered for ${stack} in ${stage}: ${remaining.join(", ")}`
101
+ );
102
+ }
103
+ };
@@ -0,0 +1,153 @@
1
+ import * as Alchemy from "alchemy";
2
+ import * as Output from "alchemy/Output";
3
+ import { tryFindProviderByType } from "alchemy/Provider";
4
+ import type { ProviderService } from "alchemy/Provider";
5
+ import type { ProviderServices } from "alchemy/Stack";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Layer from "effect/Layer";
8
+ import * as Option from "effect/Option";
9
+
10
+ export interface EvaluatedResource {
11
+ id: string;
12
+ type: string;
13
+ props: Record<string, unknown>;
14
+ /**
15
+ * Cross-resource references, kept per top-level prop: each key is a prop
16
+ * this resource declares, and the value names the logical ids that prop's
17
+ * value references. A prop that holds an unresolved Alchemy output names its
18
+ * producer here, which is the only way to read a cross-resource reference
19
+ * out of raw props: an output is a function, so the prop says nothing on its
20
+ * own.
21
+ *
22
+ * A prop that references nothing carries no key, so the map holds only the
23
+ * props that reference something. The references are kept per prop and never
24
+ * pooled, because a caller asking "which Workers does this application's
25
+ * `destinations` name" must not be answered with an id some other prop
26
+ * happened to mention.
27
+ */
28
+ upstreamByProp: Record<string, string[]>;
29
+ }
30
+
31
+ export interface EvaluatedBinding {
32
+ worker: string;
33
+ name: string;
34
+ type: string;
35
+ target?: string;
36
+ }
37
+
38
+ export interface EvaluatedGraph {
39
+ resources: EvaluatedResource[];
40
+ bindings: EvaluatedBinding[];
41
+ }
42
+
43
+ export interface EvaluateStackInput {
44
+ /** The stack name and program: the first and last arguments the consumer gives `Alchemy.Stack`. */
45
+ name: string;
46
+ program: Effect.Effect<
47
+ unknown,
48
+ unknown,
49
+ Alchemy.Stack | Alchemy.Stage | ProviderServices
50
+ >;
51
+ stage: string;
52
+ /** A provider layer to wrap. Each provider it registers keeps its identity but never probes. */
53
+ providers?: Layer.Layer<never>;
54
+ }
55
+
56
+ class EvaluationProviders extends Alchemy.ProviderCollection<EvaluationProviders>()(
57
+ "factory-ci/evaluate-stack"
58
+ ) {}
59
+
60
+ /** The lifecycle every provider evaluates with: read and list answer "absent"; a plan never applies. */
61
+ const absentProvider = (type: string): ProviderService => ({
62
+ delete: () => Effect.die(`evaluateStack never deletes ${type}`),
63
+ list: () => Effect.succeed([]),
64
+ // oxlint-disable-next-line unicorn/no-useless-undefined -- `read` returns `Attributes | undefined`.
65
+ read: () => Effect.succeed(undefined),
66
+ reconcile: () => Effect.die(`evaluateStack never reconciles ${type}`),
67
+ });
68
+
69
+ /** Wrap the consumer's providers: Alchemy's own lookup finds each one, then its probes are stubbed. */
70
+ const evaluationProviders = (providers: Layer.Layer<never> | undefined) =>
71
+ Layer.effect(
72
+ EvaluationProviders,
73
+ Effect.map(Effect.context<never>(), (context) => ({
74
+ get: (type: string) => {
75
+ const found = Effect.provide(tryFindProviderByType(type), context);
76
+ const provider = Option.getOrUndefined(Effect.runSync(found));
77
+ return {
78
+ ...provider,
79
+ ...absentProvider(type),
80
+ modes: undefined,
81
+ } as never;
82
+ },
83
+ kind: "ProviderCollection" as const,
84
+ providers: {},
85
+ }))
86
+ ).pipe(Layer.provide(providers ?? Layer.empty));
87
+
88
+ /** The logical ids one prop's value references, or nothing when it references none. */
89
+ const upstreamOfProps = (
90
+ props: Record<string, unknown>
91
+ ): Record<string, string[]> => {
92
+ const byProp: Record<string, string[]> = {};
93
+ for (const [key, value] of Object.entries(props)) {
94
+ const ids = Object.values(Output.upstreamAny(value)).map(
95
+ (node) => node.LogicalId
96
+ );
97
+ if (ids.length > 0) {
98
+ byProp[key] = ids;
99
+ }
100
+ }
101
+ return byProp;
102
+ };
103
+
104
+ /** Map plan nodes to the graph. A binding row carries Alchemy's Worker shape, `{ bindings: [{ name, type }] }`. */
105
+ const toGraph = (plan: Alchemy.Plan.Plan): EvaluatedGraph => ({
106
+ bindings: Object.values(plan.resources).flatMap(({ bindings, resource }) =>
107
+ bindings.flatMap((row) => {
108
+ const target = Object.values(Output.upstreamAny(row.data))[0]?.LogicalId;
109
+ const entries: Partial<EvaluatedBinding>[] = row.data?.bindings ?? [];
110
+ return entries.map((entry) => ({
111
+ name: entry.name ?? row.sid,
112
+ target,
113
+ type: entry.type ?? "unknown",
114
+ worker: resource.LogicalId,
115
+ }));
116
+ })
117
+ ),
118
+ resources: Object.values(plan.resources).map(({ resource }) => ({
119
+ id: resource.LogicalId,
120
+ props: resource.Props ?? {},
121
+ type: resource.Type,
122
+ upstreamByProp: upstreamOfProps(resource.Props ?? {}),
123
+ })),
124
+ });
125
+
126
+ /**
127
+ * Run a stack program at `stage` and build the graph Alchemy would plan, with no state and no network:
128
+ * `Plan.make` runs under `inMemoryState()` and every provider read and list answers "absent".
129
+ */
130
+ export const evaluateStack = ({
131
+ name,
132
+ program,
133
+ providers,
134
+ stage,
135
+ }: EvaluateStackInput) => {
136
+ const stack = { actions: {}, bindings: {}, name, resources: {}, stage };
137
+ // The program's declared provider tags (`Cloudflare.Providers` and the like) resolve at runtime
138
+ // through collection lookup, which Alchemy does by shape, so the cast drops only those tags.
139
+ const evaluation = program.pipe(
140
+ Effect.flatMap((output) => Alchemy.Plan.make({ ...stack, output })),
141
+ Effect.map(toGraph),
142
+ Effect.provide(
143
+ Layer.mergeAll(
144
+ Layer.succeed(Alchemy.Stack, stack),
145
+ Layer.succeed(Alchemy.Stage, stage),
146
+ Alchemy.inMemoryState(),
147
+ evaluationProviders(providers)
148
+ )
149
+ ),
150
+ Effect.scoped
151
+ ) as Effect.Effect<EvaluatedGraph, unknown>;
152
+ return Effect.runPromise(evaluation);
153
+ };
@@ -0,0 +1,194 @@
1
+ import { createHash } from "node:crypto";
2
+
3
+ import { canonicalPlan } from "./plan-effects.ts";
4
+
5
+ /**
6
+ * First-deploy authorization by plan hash.
7
+ *
8
+ * The first deploy of a stack into a stage is the one deploy no earlier state
9
+ * can constrain: there is nothing to diff against, so the plan is the only
10
+ * description of what is about to be created. Paitronage binds that plan to an
11
+ * operator decision by hashing it and comparing the hash against a reviewed
12
+ * value (`firstDeployPlanSha256` and `assertFirstDeployEntry` in
13
+ * `tools/alchemy/src/internal/lifecycle.ts`).
14
+ *
15
+ * The generic form keeps the binding and drops the project's stage policy.
16
+ * Which stages are eligible, and where the authorized hashes are kept, stay
17
+ * with the project. This function answers one question: does this exact plan
18
+ * appear on the list the project authorized?
19
+ *
20
+ * It fails closed. An empty list, a malformed list entry, an empty plan, plan
21
+ * output the plan adapter cannot read, and an unlisted hash are all refusals.
22
+ *
23
+ * What the hash binds is the plan, not the run that printed it: the summary
24
+ * line and every row's tag and action, with the target and the reviewed
25
+ * source. Alchemy's renderer logs each line through Effect's pretty console
26
+ * logger and prints its own elapsed duration, so the verbatim output carries
27
+ * a timestamp per line, a fiber id, `Plan ready (2.9s)`, and colour when the
28
+ * child inherits `FORCE_COLOR` — all facts about one process, none about the
29
+ * plan. Hashing them meant a reviewed plan could never be redeployed at its
30
+ * reviewed hash (#1232), so `canonicalPlan` is hashed instead.
31
+ */
32
+
33
+ const sha256 = (value: string) =>
34
+ createHash("sha256").update(value).digest("hex");
35
+
36
+ /**
37
+ * Which plan representation the payload hashes. It is part of the payload so
38
+ * a hash can never be read as one of a different shape.
39
+ */
40
+ const PLAN_HASH_FORMAT = "canonical-plan-v1";
41
+
42
+ const HASH_PATTERN = /^[0-9a-f]{64}$/u;
43
+ const SOURCE_SHA_PATTERN = /^[0-9a-f]{40}$/u;
44
+
45
+ export interface FirstDeployPlanHashOptions {
46
+ /**
47
+ * The Alchemy CLI's plan output, verbatim. It is canonicalised and hashed
48
+ * here; it is never stored and never logged.
49
+ */
50
+ readonly planText: string;
51
+ /**
52
+ * The reviewed source commit this plan was produced from, as a full
53
+ * lowercase 40-character SHA, or `null` when the project binds the plan to
54
+ * no commit. The field is required so that choice is written down: an
55
+ * omitted field and a deliberate `null` are not the same decision, and only
56
+ * the second one is allowed.
57
+ */
58
+ readonly sourceSha: string | null;
59
+ readonly stack: string;
60
+ readonly stage: string;
61
+ }
62
+
63
+ export type FirstDeployAuthorizationOptions = FirstDeployPlanHashOptions & {
64
+ /**
65
+ * The plan hashes an operator authorized for a first deploy. The project
66
+ * owns the list; this package neither stores nor edits it.
67
+ */
68
+ readonly authorizedHashes: readonly string[];
69
+ };
70
+
71
+ export interface FirstDeployAuthorization {
72
+ /** The hash that matched. An operator adds this value to authorize. */
73
+ readonly planHash: string;
74
+ }
75
+
76
+ /**
77
+ * The hash a first deploy is authorized by: the plan, the target, and the
78
+ * reviewed source, in one payload.
79
+ *
80
+ * The plan enters the payload as the sha256 of `canonicalPlan`, so the value
81
+ * that is compared never embeds plan output, and two runs of one plan agree.
82
+ * Bound: the summary line, every row's tag and action (resource, binding and
83
+ * task rows alike, `noop` included), which of those rows are resources and
84
+ * which are bindings, the stack, the stage, and the source SHA. Not bound:
85
+ * logger timestamps and fiber ids, the run's elapsed durations, ANSI colour,
86
+ * progress lines, and the order the rows were printed in.
87
+ *
88
+ * Row order is not bound but the reading of the rows is, because they are
89
+ * not the same fact. Order alone used to carry which rows are a resource's
90
+ * bindings and which are resources inside its namespace; the canonical form
91
+ * states that outright, so two plans creating different resources can never
92
+ * agree merely by printing one multiset of rows two ways.
93
+ *
94
+ * `planFormat` names that shape. A hash issued by an earlier version of this
95
+ * function, which hashed the verbatim output, can never equal one issued
96
+ * now — those hashes were not reproducible in the first place, so they
97
+ * authorized nothing that could be deployed.
98
+ *
99
+ * Throws a `PlanEffectsError` when the plan adapter cannot account for the
100
+ * output: an unreadable plan is refused, never hashed.
101
+ */
102
+ export const firstDeployPlanHash = ({
103
+ planText,
104
+ sourceSha,
105
+ stack,
106
+ stage,
107
+ }: FirstDeployPlanHashOptions): string => {
108
+ if (!(stack.trim() && stage.trim())) {
109
+ throw new Error("First-deploy authorization requires a stack and a stage.");
110
+ }
111
+ if (
112
+ stack !== stack.trim() ||
113
+ stage !== stage.trim() ||
114
+ (sourceSha !== null && sourceSha !== sourceSha.trim())
115
+ ) {
116
+ // Padding would mint a second hash for one target, so an authorized plan
117
+ // would read as unauthorized on the next run that spells the stage with a
118
+ // trailing newline. One target has one hash.
119
+ throw new Error(
120
+ "First-deploy authorization requires a stack, a stage, and a source SHA with no surrounding whitespace."
121
+ );
122
+ }
123
+ if (sourceSha !== null && !SOURCE_SHA_PATTERN.test(sourceSha)) {
124
+ // An empty string, a short SHA, and an upper-case SHA each hash to a
125
+ // different value than the full lowercase commit they stand for.
126
+ throw new Error(
127
+ "First-deploy authorization requires a full lowercase 40-character source SHA, or null."
128
+ );
129
+ }
130
+ if (!planText.trim()) {
131
+ throw new Error(
132
+ "First-deploy authorization requires plan output; an empty plan describes nothing."
133
+ );
134
+ }
135
+ if (!planText.isWellFormed()) {
136
+ // A lone surrogate is replaced when the string is encoded as UTF-8, so
137
+ // two plans that differ only there would hash to one value.
138
+ throw new Error(
139
+ "First-deploy authorization requires well-formed plan output."
140
+ );
141
+ }
142
+ return sha256(
143
+ JSON.stringify({
144
+ operation: "deploy",
145
+ planFormat: PLAN_HASH_FORMAT,
146
+ planSha256: sha256(canonicalPlan(planText)),
147
+ sourceSha,
148
+ stack,
149
+ stage,
150
+ })
151
+ );
152
+ };
153
+
154
+ /**
155
+ * Admits a first deploy only when its plan hash is one the project
156
+ * authorized.
157
+ *
158
+ * The thrown message carries the computed hash, which is what an operator
159
+ * adds to the authorization list after reading the plan. It never carries the
160
+ * plan text.
161
+ */
162
+ export const firstDeployAuthorization = ({
163
+ authorizedHashes,
164
+ planText,
165
+ sourceSha,
166
+ stack,
167
+ stage,
168
+ }: FirstDeployAuthorizationOptions): FirstDeployAuthorization => {
169
+ const planHash = firstDeployPlanHash({ planText, sourceSha, stack, stage });
170
+ const malformed = authorizedHashes.filter(
171
+ (hash) => !HASH_PATTERN.test(hash.trim().toLowerCase())
172
+ );
173
+ if (malformed.length > 0) {
174
+ // A malformed entry can never match, so it would fail as a mismatch and
175
+ // read as an unreviewed plan. It is a broken list, and it says so.
176
+ throw new Error(
177
+ `First-deploy authorization list holds ${malformed.length} entry that is not a sha256 hash.`
178
+ );
179
+ }
180
+ const authorized = new Set(
181
+ authorizedHashes.map((hash) => hash.trim().toLowerCase())
182
+ );
183
+ if (authorized.size === 0) {
184
+ throw new Error(
185
+ `First deploy of ${stack} into ${stage} is not authorized: the authorization list is empty. Reviewed plan hash: ${planHash}`
186
+ );
187
+ }
188
+ if (!authorized.has(planHash)) {
189
+ throw new Error(
190
+ `First deploy of ${stack} into ${stage} is not authorized. Reviewed plan hash: ${planHash}`
191
+ );
192
+ }
193
+ return { planHash };
194
+ };
@@ -0,0 +1,144 @@
1
+ /**
2
+ * The `@patronage/factory-ci/alchemy` subpath: the only place in this package
3
+ * where `alchemy` or `effect` may be imported (ADR 0031).
4
+ *
5
+ * Both are **optional** peer dependencies, so a consumer that never imports
6
+ * this subpath installs the package with neither. Anything exported from here
7
+ * may assume the consumer's own copy of each is resolvable; the package root
8
+ * may never assume that, and a test proves the root import graph names
9
+ * neither.
10
+ *
11
+ * Stage policy, retained-identity asserts, the lifecycle guards, the graph
12
+ * invariants, and stack evaluation live here. The guards import neither
13
+ * package: they are the
14
+ * checks that surround an Alchemy run, not the run. `evaluateStack` imports
15
+ * both.
16
+ */
17
+
18
+ /** The specifier a consumer imports this surface by. */
19
+ export const ALCHEMY_SUBPATH = "@patronage/factory-ci/alchemy";
20
+
21
+ export {
22
+ type EvaluatedBinding,
23
+ type EvaluatedGraph,
24
+ type EvaluatedResource,
25
+ type EvaluateStackInput,
26
+ evaluateStack,
27
+ } from "./evaluate-stack.ts";
28
+ export {
29
+ assertRetainedIdentities,
30
+ type AssertRetainedIdentitiesOptions,
31
+ parseStateSnapshot,
32
+ RetainedIdentityError,
33
+ type RetainedIdentityMarker,
34
+ type RetainedIdentitySection,
35
+ type RetainedIdentityViolation,
36
+ type RetainedIdentityViolationReason,
37
+ type StateSnapshot,
38
+ type StateSnapshotResource,
39
+ type StateSnapshotScope,
40
+ } from "./retained-identity.ts";
41
+ export { localEmulationEnvironment } from "./local-emulation.ts";
42
+ export {
43
+ anyStage,
44
+ isLocalEmulationStage,
45
+ LOCAL_PREVIEW_STAGES,
46
+ type StackStageOwnership,
47
+ type StageMatcher,
48
+ stagePolicy,
49
+ type StagePolicy,
50
+ StagePolicyError,
51
+ type StagePolicyErrorCode,
52
+ type StagePolicyTable,
53
+ } from "./stage-policy.ts";
54
+ export {
55
+ CloudflareCredentialUnavailableError,
56
+ credentialPreflight,
57
+ HOSTED_CLOUDFLARE_CREDENTIAL_NAMES,
58
+ } from "./credential-preflight.ts";
59
+ export type {
60
+ CloudflareCredential,
61
+ CloudflareTokenKind,
62
+ CredentialPreflightOptions,
63
+ CredentialPreflightResult,
64
+ CredentialSource,
65
+ } from "./credential-preflight.ts";
66
+ export { assertDestroyLeftNothing } from "./destroy-postcondition.ts";
67
+ export type {
68
+ AssertDestroyLeftNothingOptions,
69
+ StageStateReader,
70
+ StageStateTarget,
71
+ } from "./destroy-postcondition.ts";
72
+ export {
73
+ firstDeployAuthorization,
74
+ firstDeployPlanHash,
75
+ } from "./first-deploy-authorization.ts";
76
+ export type {
77
+ FirstDeployAuthorization,
78
+ FirstDeployAuthorizationOptions,
79
+ FirstDeployPlanHashOptions,
80
+ } from "./first-deploy-authorization.ts";
81
+ export {
82
+ assertUrlImpliesAuth,
83
+ UrlImpliesAuthError,
84
+ } from "./url-implies-auth.ts";
85
+ export type {
86
+ AssertUrlImpliesAuthOptions,
87
+ AuthBindingNameMatcher,
88
+ UrlImpliesAuthAllowance,
89
+ UrlImpliesAuthViolation,
90
+ UrlImpliesAuthViolationReason,
91
+ } from "./url-implies-auth.ts";
92
+ export {
93
+ MINIMUM_REDACTABLE_SECRET_LENGTH,
94
+ SECRET_REDACTION_PLACEHOLDER,
95
+ secretNamePolicy,
96
+ } from "./secret-name-policy.ts";
97
+ export type { SecretNamePolicyOptions } from "./secret-name-policy.ts";
98
+ export {
99
+ AlchemyLifecycleError,
100
+ isAlchemyLifecycleError,
101
+ LIFECYCLE_FAILURE_MESSAGES,
102
+ } from "./lifecycle-failure.ts";
103
+ export type {
104
+ AlchemyLifecycleFailureCode,
105
+ AlchemyLifecycleFailureFields,
106
+ AlchemyLifecycleOperation,
107
+ AlchemyLifecyclePhase,
108
+ MutationCertainty,
109
+ } from "./lifecycle-failure.ts";
110
+ export {
111
+ PLAN_ACTIONS,
112
+ PLAN_OUTPUT_ALCHEMY_VERSION,
113
+ parsePlanEffects,
114
+ PlanEffectsError,
115
+ } from "./plan-effects.ts";
116
+ export type {
117
+ PlanAction,
118
+ PlanEffects,
119
+ PlanEffectsRejection,
120
+ PlanResourceEffect,
121
+ PlanTaskAction,
122
+ PlanTaskEffect,
123
+ } from "./plan-effects.ts";
124
+ export {
125
+ deleteStageRows,
126
+ inventoryStages,
127
+ readStageSnapshot,
128
+ } from "./state-tree.ts";
129
+ export type { ChildDiagnostics } from "./child-diagnostics.ts";
130
+ export { runAlchemyLifecycle } from "./lifecycle.ts";
131
+ export type {
132
+ AlchemyLifecycleEntry,
133
+ AlchemyLifecyclePolicy,
134
+ AlchemyLifecycleRequest,
135
+ AlchemyLifecycleResult,
136
+ FirstDeployPolicy,
137
+ RunAlchemyLifecycleOptions,
138
+ StackOutputOccupancy,
139
+ StageCleanupOutcome,
140
+ StageLease,
141
+ StageSnapshotView,
142
+ StageStateStore,
143
+ StageTarget,
144
+ } from "./lifecycle.ts";