@konfig.ts/core 0.0.6 → 0.0.7

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/index.mjs CHANGED
@@ -934,6 +934,7 @@ const KonfigConfig = Schema.Struct({
934
934
  cacheDir: ".konfig/helm-cache",
935
935
  minVersion: "3.16.0"
936
936
  }))),
937
+ cacheInclude: _stringArrayWithKeyDefault([]),
937
938
  diff: Schema.optionalKey(DiffConfig),
938
939
  services: Schema.optionalKey(ServicesConfig),
939
940
  clusters: Schema.optionalKey(Schema.Record(Schema.String, ClusterSpec))
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["make","Dep.App","Dep.Namespace","Compose.makeResidualEntrypoint","Compose.composeLayers","decodeEff","strict"],"sources":["../src/_cast.ts","../src/RenderError.ts","../src/boundary.ts","../src/Compose.ts","../src/deps.ts","../src/Bundle.ts","../src/diff.ts","../src/Manifest.ts","../src/subprocess.ts","../src/Helm.ts","../src/images.ts","../src/konfigConfig.ts","../src/Module.ts","../src/RenderContext.ts","../src/render.ts","../src/renderManifest.ts","../src/yaml/serialize.ts","../src/yaml/index.ts"],"sourcesContent":["/**\n * Nominal-typing primitive — attach a phantom brand to a string value.\n * Used by `Dep.*Ref` constructors and the like. Safe by construction:\n * the brand is a type-only label that the caller stamps on themselves.\n */\n// oxlint-disable-next-line app/no-banned-type-assertions app/no-type-assertion\nexport const brand = <T>(value: string): T => value as unknown as T\n\n/**\n * Unsafe escape hatch — claim a value has type `T` without runtime\n * proof. Every call site MUST pass a one-line `reason` explaining why\n * the cast is sound (e.g. \"variance erasure\", \"runtime narrowed via\n * _tag check\", \"Object.keys is string[]\"). Audit by grepping for\n * `unsafeCoerce(` and reading the reasons.\n *\n * For values crossing a trust boundary (external command output, file\n * contents, network payloads), prefer `boundary` from\n * `@konfig.ts/core/boundary` — it produces a `BoundaryDecodeError`\n * instead of silently accepting the claim.\n *\n * The `reason` parameter is intentionally not used at runtime; it\n * documents intent for readers and audits.\n */\n// oxlint-disable-next-line app/no-type-assertion app/no-multiple-function-params\nexport const unsafeCoerce = <T>(value: unknown, _reason: string): T => value as T\n","import { Data } from \"effect\"\n\nexport class RenderError extends Data.TaggedError(\"RenderError\")<{\n readonly message: string\n readonly cause?: unknown\n}> {}\n\nexport class EmbedYamlReadError extends Data.TaggedError(\"EmbedYamlReadError\")<{\n readonly path: string\n readonly cause: unknown\n}> {}\n\nexport class BoundaryDecodeError extends Data.TaggedError(\"BoundaryDecodeError\")<{\n readonly schema: string\n readonly cause: unknown\n}> {}\n\nexport class HelmVersionTooLow extends Data.TaggedError(\"HelmVersionTooLow\")<{\n readonly required: string\n readonly found: string\n}> {\n get message(): string {\n return `Helm CLI too old: requires >= ${this.required}, found ${this.found}`\n }\n}\n\nexport class HelmRenderError extends Data.TaggedError(\"HelmRenderError\")<{\n readonly chart: string\n readonly version: string\n readonly cause: unknown\n}> {}\n\nexport class HelmDigestMismatch extends Data.TaggedError(\"HelmDigestMismatch\")<{\n readonly chart: string\n readonly version: string\n readonly expected: string\n readonly actual: string\n}> {\n get message(): string {\n return `Helm chart ${this.chart}@${this.version} digest mismatch: expected ${this.expected}, got ${this.actual}`\n }\n}\n\nexport class CrdExtractError extends Data.TaggedError(\"CrdExtractError\")<{\n readonly chart: string\n readonly cause: unknown\n}> {}\n\nexport type AnyRenderError =\n | RenderError\n | EmbedYamlReadError\n | BoundaryDecodeError\n | HelmVersionTooLow\n | HelmRenderError\n | HelmDigestMismatch\n | CrdExtractError\n","import { Effect, Schema } from \"effect\";\nimport { BoundaryDecodeError } from \"./RenderError\";\n\nexport interface BoundaryInput<S extends Schema.Top> {\n\treadonly schema: S;\n\treadonly label?: string;\n}\nexport const boundary =\n\t<S extends Schema.Top>(input: BoundaryInput<S>) =>\n\t(value: unknown): Effect.Effect<S[\"Type\"], BoundaryDecodeError, S[\"DecodingServices\"]> =>\n\t\tSchema.decodeUnknownEffect(input.schema)(value).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew BoundaryDecodeError({\n\t\t\t\t\t\tschema: input.label ?? \"boundary\",\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n","import { type Effect, Layer } from \"effect\";\nimport { unsafeCoerce } from \"./_cast\";\nimport type { Need } from \"./deps\";\nimport type { RenderServices } from \"./Manifest\";\nimport type { AnyRenderError } from \"./RenderError\";\n\n/**\n * The minimal shape `composeLayers` and the residual fold need: anything\n * with a `.layer` field of the standard `(Out, AnyRenderError, In)`\n * triple. Each runtime (argocd `ApplicationHandle`, k8s `BundleHandle`,\n * …) supplies its own wider handle interface — the carried value type\n * is irrelevant to the fold itself.\n */\n// oxlint-disable-next-line app/no-type-assertion\nexport interface ComposeHandle<Out = any, In = any> {\n\treadonly layer: Layer.Layer<Out, AnyRenderError, In>;\n}\n\n// `any` in the AnyHandle upper bound: Effect's Layer is contravariant in\n// its first parameter and `ComposeHandle` is invariant at the inference\n// site. `unknown` rejects concrete subtypes; `any` is bivariant — the\n// canonical \"any handle\" upper bound.\n// oxlint-disable-next-line app/no-type-assertion\ntype AnyHandle = ComposeHandle<any, any>;\n\n// oxlint-disable-next-line app/no-type-assertion\ntype OutOfHandle<H> = H extends ComposeHandle<infer Out, any> ? Out : never;\n// oxlint-disable-next-line app/no-type-assertion\ntype InOfHandle<H> = H extends ComposeHandle<any, infer In> ? In : never;\n\n/**\n * Left-fold over the modules tuple, mirroring the runtime\n * `reduce(Layer.provideMerge)` below. Each module's `In` is filtered\n * against the union of every *prior* module's `Out`; whatever survives\n * is residual. Tuple order matters: a consumer listed before its\n * provider leaves its Need in the residual.\n */\ntype FoldResidualIn<\n\tT extends ReadonlyArray<AnyHandle>,\n\tAccIn,\n\tAccOut,\n> = T extends readonly [infer H, ...infer Rest]\n\t? H extends AnyHandle\n\t\t? Rest extends ReadonlyArray<AnyHandle>\n\t\t\t? FoldResidualIn<\n\t\t\t\t\tRest,\n\t\t\t\t\tAccIn | Exclude<InOfHandle<H>, AccOut>,\n\t\t\t\t\tAccOut | OutOfHandle<H>\n\t\t\t\t>\n\t\t\t: never\n\t\t: never\n\t: AccIn;\n\n/**\n * After folding `Layer.provideMerge` over `Ms` in tuple order, the\n * leftover `RIn` channel — the Needs that no preceding module's Out\n * satisfies. Pair with `makeResidualEntrypoint` to surface a non-empty\n * residual as a compile error at the entrypoint call site.\n */\nexport type ResidualIn<T extends ReadonlyArray<AnyHandle>> = FoldResidualIn<T, never, never>;\n\n/**\n * Runtime layer composition — `reduce(Layer.provideMerge)`. Each\n * successive module receives every prior module's Out as available\n * services. The runtime type collapses to a bottom Layer; the per-module\n * Out/In is tracked statically by `ResidualIn`.\n */\nexport const composeLayers = (\n\tmodules: ReadonlyArray<{ readonly layer: unknown }>,\n): Layer.Layer<never, AnyRenderError, never> => {\n\ttype AnyLayer = Layer.Layer<never, AnyRenderError, never>;\n\treturn modules.reduce<AnyLayer>(\n\t\t(acc, mod) =>\n\t\t\tunsafeCoerce<AnyLayer>(\n\t\t\t\tLayer.provideMerge(\n\t\t\t\t\tunsafeCoerce<AnyLayer>(\n\t\t\t\t\t\tmod.layer,\n\t\t\t\t\t\t\"handle.layer carries its narrow type at the call site; the fold collapses to AnyLayer here\",\n\t\t\t\t\t),\n\t\t\t\t\tacc,\n\t\t\t\t),\n\t\t\t\t\"Layer.provideMerge's return type is per-call; the fold accumulator stays AnyLayer\",\n\t\t\t),\n\t\tunsafeCoerce<AnyLayer>(\n\t\t\tLayer.empty,\n\t\t\t\"Layer.empty has type Layer<never, never, never>; widening to AnyLayer is a no-op at runtime\",\n\t\t),\n\t);\n};\n\n/**\n * Per-Need template-literal hint shown when a residual reaches the\n * entrypoint. `Api` is the calling API's name (\"AppOfApps.fromModules\",\n * \"Bundle.fromModules\", …) so the message points the user at the right\n * call site.\n */\ntype UnsatisfiedHint<R, Api extends string> = R extends Need<infer K, infer V>\n\t? `Missing provider for ${K} \"${V}\". Add a module that provides it to ${Api}({ modules }), or check that providers come before consumers in the list.`\n\t: \"Unsatisfied dep — see the Effect Layer error above.\";\n\n/**\n * Intersects the program type with a phantom `_konfig_unsatisfied`\n * object when the residual `R` carries anything beyond\n * `Manifest.RenderServices`. The program has no such property at runtime,\n * so the call fails to typecheck and the user sees the hint.\n */\ntype ResidualHintCheck<R, Api extends string> =\n\t[Exclude<R, RenderServices>] extends [never]\n\t\t? unknown\n\t\t: {\n\t\t\t\treadonly _konfig_unsatisfied: UnsatisfiedHint<\n\t\t\t\t\tExclude<R, RenderServices>,\n\t\t\t\t\tApi\n\t\t\t\t>;\n\t\t\t};\n\n/**\n * Build an `entrypoint` function bound to a specific API name. The\n * returned function accepts only programs whose `R` channel reduces to\n * `Manifest.RenderServices`; otherwise the call fails at the program\n * argument with a `_konfig_unsatisfied` hint that names the missing\n * provider and the calling API.\n */\nexport const makeResidualEntrypoint =\n\t<const Api extends string>(_api: Api) =>\n\t<A, E, R>(\n\t\tprogram: Effect.Effect<A, E, R> & ResidualHintCheck<R, Api>,\n\t): Effect.Effect<A, E, R & RenderServices> =>\n\t\tunsafeCoerce<Effect.Effect<A, E, R & RenderServices>>(\n\t\t\tprogram,\n\t\t\t\"ResidualHintCheck is a phantom intersection; once the call typechecks, the runtime value is the original Effect\",\n\t\t);\n","import { Context, Layer, type Redacted } from \"effect\";\nimport { brand } from \"./_cast\";\n\n\ndeclare const NeedBrand: unique symbol;\nexport interface Need<K extends string, N extends string> {\n\treadonly [NeedBrand]: { readonly kind: K; readonly name: N };\n}\nexport type Provide<K extends string, N extends string> = Need<K, N>;\n\ndeclare const SecretRefBrand: unique symbol;\ndeclare const ConfigMapRefBrand: unique symbol;\ndeclare const ServiceAccountRefBrand: unique symbol;\ndeclare const PvcRefBrand: unique symbol;\ndeclare const BuiltImageRefBrand: unique symbol;\n\n/**\n * Nominal reference to a named Secret. `N` brands the secret's metadata\n * name; `K` (defaults to `string`) brands the union of declared data\n * keys, so consumers like `secretEnv({ ref, key })` can constrain `key`\n * to keys that actually exist; `Ns` (defaults to `string`) brands the\n * secret's owning namespace, so pod-context consumers (like\n * `secretEnvForPod`) can reject refs from a different namespace at\n * compile time — eliminating the runtime \"secret not found across\n * namespaces\" failure mode.\n */\nexport type SecretRef<\n\tN extends string,\n\tK extends string = string,\n\tNs extends string = string,\n> = string & {\n\treadonly [SecretRefBrand]: {\n\t\treadonly name: N;\n\t\treadonly keys: K;\n\t\treadonly namespace: Ns;\n\t};\n};\n/**\n * Nominal reference to a named ConfigMap. `N` brands the metadata name;\n * `K` (defaults to `string`) brands the union of declared data keys, so\n * `configMapEnv({ ref, key })` can constrain `key` to keys that actually\n * exist on the map. Producers (e.g. `ConfigMap.make`) populate `K` from\n * the literal `data` (or `binaryData`) record keys.\n */\nexport type ConfigMapRef<N extends string, K extends string = string> = string & {\n\treadonly [ConfigMapRefBrand]: { readonly name: N; readonly keys: K };\n};\nexport type ServiceAccountRef<N extends string> = string & {\n\treadonly [ServiceAccountRefBrand]: N;\n};\nexport type PvcRef<N extends string> = string & {\n\treadonly [PvcRefBrand]: N;\n};\n\n/**\n * Nominal reference to a container image built in-tree. Runtime value\n * is the full image ref (`registry/app:tag`) — a string, so K8s YAML\n * serializes it directly. The phantom `App` brand carries the literal\n * app name and ties the ref to the dep graph via `Dep.Image`.\n *\n * Container `image` fields accept either a raw string (escape hatch\n * for vendor images: `ghcr.io/bitnami/postgresql:16.0.0`) or\n * `BuiltImageRef<App>`. The branded path catches a workload whose\n * build module is missing from the composition at `AppOfApps.entrypoint`.\n */\nexport type BuiltImageRef<App extends string> = string & {\n\treadonly [BuiltImageRefBrand]: App;\n};\n\nexport type BuiltImageRefApp<R> = R extends BuiltImageRef<infer App> ? App : never;\n\nexport type SecretRefName<R> = R extends SecretRef<infer N, infer _K, infer _Ns> ? N : never;\nexport type SecretRefKeys<R> = R extends SecretRef<infer _N, infer K, infer _Ns> ? K : never;\nexport type SecretRefNamespace<R> = R extends SecretRef<infer _N, infer _K, infer Ns>\n\t? Ns\n\t: never;\nexport type ConfigMapRefName<R> = R extends ConfigMapRef<infer N, infer _K> ? N : never;\nexport type ConfigMapRefKeys<R> = R extends ConfigMapRef<infer _N, infer K> ? K : never;\nexport type PvcRefName<R> = R extends PvcRef<infer N> ? N : never;\n\nexport const Secret = <\n\tN extends string,\n\tK extends string = string,\n\tNs extends string = string,\n>(\n\tname: N,\n): Context.Service<Need<\"Secret\", N>, SecretRef<N, K, Ns>> =>\n\tContext.Service<Need<\"Secret\", N>, SecretRef<N, K, Ns>>(`Secret:${name}`);\n\nexport type SecretValuesRecord<K extends string> = {\n\treadonly [P in K]: Redacted.Redacted<string>;\n};\n\nexport const SecretValues = <N extends string, K extends string = string>(\n\tname: N,\n): Context.Service<Need<\"SecretValues\", N>, SecretValuesRecord<K>> =>\n\tContext.Service<Need<\"SecretValues\", N>, SecretValuesRecord<K>>(`SecretValues:${name}`);\n\nexport const ConfigMap = <N extends string, K extends string = string>(\n\tname: N,\n): Context.Service<Need<\"ConfigMap\", N>, ConfigMapRef<N, K>> =>\n\tContext.Service<Need<\"ConfigMap\", N>, ConfigMapRef<N, K>>(`ConfigMap:${name}`);\n\nexport const Namespace = <N extends string>(name: N): Context.Service<Need<\"Namespace\", N>, N> =>\n\tContext.Service<Need<\"Namespace\", N>, N>(`Namespace:${name}`);\n\nexport const ServiceAccount = <N extends string>(\n\tname: N,\n): Context.Service<Need<\"ServiceAccount\", N>, ServiceAccountRef<N>> =>\n\tContext.Service<Need<\"ServiceAccount\", N>, ServiceAccountRef<N>>(`ServiceAccount:${name}`);\n\nexport const Application = <N extends string>(\n\tname: N,\n): Context.Service<Need<\"Application\", N>, N> =>\n\tContext.Service<Need<\"Application\", N>, N>(`Application:${name}`);\n\nexport const Pvc = <N extends string>(name: N): Context.Service<Need<\"Pvc\", N>, PvcRef<N>> =>\n\tContext.Service<Need<\"Pvc\", N>, PvcRef<N>>(`Pvc:${name}`);\n\nexport const App = <N extends string, S = unknown>(name: N): Context.Service<Need<\"App\", N>, S> =>\n\tContext.Service<Need<\"App\", N>, S>(`App:${name}`);\n\n/**\n * Context.Service tag for a `BuiltImageRef<App>`. Modules that build an\n * image emit a Layer providing this service; modules that deploy a\n * container yield `Dep.Image(app)` to receive the typed ref. The\n * dep-graph residual at `AppOfApps.entrypoint` catches a missing\n * provider exactly like for `Dep.Secret`.\n */\nexport const Image = <N extends string>(\n\tname: N,\n): Context.Service<Need<\"Image\", N>, BuiltImageRef<N>> =>\n\tContext.Service<Need<\"Image\", N>, BuiltImageRef<N>>(`Image:${name}`);\n\ninterface _ImageRefInput<App extends string> {\n\treadonly app: App;\n\treadonly registry: string;\n\treadonly tag: string;\n}\n\nconst _fullRef = <App extends string>(input: _ImageRefInput<App>): BuiltImageRef<App> =>\n\tbrand<BuiltImageRef<App>>(`${input.registry}/${input.app}:${input.tag}`);\n\n/**\n * `BuiltImageRef` value namespace.\n *\n * const apiImage = BuiltImageRef.of({\n * app: \"api\",\n * registry: \"ghcr.io/example\",\n * tag: \"1.0.0\",\n * });\n *\n * `BuiltImageRef.of` constructs the brand from registry + app + tag.\n * The literal `app` is captured in the brand so a workload's\n * `Dep.Need<\"Image\", App>` matches only the build module that\n * provides this exact app.\n */\nexport const BuiltImageRef = {\n\tof: <const App extends string>(input: _ImageRefInput<App>): BuiltImageRef<App> =>\n\t\t_fullRef(input),\n};\n\n/**\n * Layer providing `Dep.Image(App)` for downstream consumers. Combine\n * with `Application.define` / `Module.fixedNs`'s `provides` slot to\n * have a build module surface its image to sibling workload modules\n * in the composition.\n */\nexport const provideImage = <const App extends string>(\n\tinput: _ImageRefInput<App>,\n): Layer.Layer<Provide<\"Image\", App>> => Layer.succeed(Image(input.app))(_fullRef(input));\n\nexport const provideSecret = <\n\tconst N extends string,\n\tconst K extends string = string,\n\tconst Ns extends string = string,\n>(\n\tname: N,\n): Layer.Layer<Provide<\"Secret\", N>> =>\n\tLayer.succeed(Secret<N, K, Ns>(name))(brand<SecretRef<N, K, Ns>>(name));\n\nexport const provideConfigMap = <const N extends string, const K extends string = string>(\n\tname: N,\n): Layer.Layer<Provide<\"ConfigMap\", N>> =>\n\tLayer.succeed(ConfigMap<N, K>(name))(brand<ConfigMapRef<N, K>>(name));\n\nexport const provideNamespace = <const N extends string>(\n\tname: N,\n): Layer.Layer<Provide<\"Namespace\", N>> => Layer.succeed(Namespace(name))(name);\n\nexport const provideServiceAccount = <const N extends string>(\n\tname: N,\n): Layer.Layer<Provide<\"ServiceAccount\", N>> =>\n\tLayer.succeed(ServiceAccount(name))(brand<ServiceAccountRef<N>>(name));\n\nexport const provideApplication = <const N extends string>(\n\tname: N,\n): Layer.Layer<Provide<\"Application\", N>> => Layer.succeed(Application(name))(name);\n\nexport const providePvc = <const N extends string>(name: N): Layer.Layer<Provide<\"Pvc\", N>> =>\n\tLayer.succeed(Pvc(name))(brand<PvcRef<N>>(name));\n","import { unsafeCoerce } from \"./_cast\";\nimport * as Compose from \"./Compose\";\nimport * as Dep from \"./deps\";\nimport type * as CoreManifest from \"./Manifest\";\nimport type * as Module from \"./Module\";\nimport type { AnyRenderError } from \"./RenderError\";\nimport { type Context, Effect, Layer } from \"effect\";\n\n/**\n * Mutate-attach a `.layer` field to an Effect Context.Tag — same pattern\n * `argocd/Application.ts:_attachLayerToTag` uses. A single unsafe cast\n * in the dep-graph machinery; lives here so the rest of Bundle stays\n * cast-free.\n */\nconst _attachLayerToTag = <Tag extends object, Out, Err, In>(\n\ttag: Tag,\n\tlayer: Layer.Layer<Out, Err, In>,\n): Tag & { readonly layer: Layer.Layer<Out, Err, In> } =>\n\tunsafeCoerce<Tag & { readonly layer: Layer.Layer<Out, Err, In> }>(\n\t\tObject.assign(tag, { layer }),\n\t\t\"Effect Context.Tag is callable + extensible; Object.assign mutates in place and the cast widens the public type\",\n\t);\n\nexport interface Bundle {\n\treadonly name: string;\n\treadonly namespace?: string;\n\treadonly manifests: ReadonlyArray<unknown>;\n}\n\nexport interface BundleMakeOptions {\n\treadonly name: string;\n\treadonly namespace?: string;\n\treadonly manifests: ReadonlyArray<unknown>;\n}\n\nexport const make = (opts: BundleMakeOptions): Bundle => ({\n\tname: opts.name,\n\tmanifests: opts.manifests,\n\t...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),\n});\n\n/**\n * Handle returned by `Bundle.define`. Same yieldable-Context-Tag +\n * `.layer` pattern as argocd's `ApplicationHandle`; only the carried\n * value type differs (a plain `Bundle` with no argo source/syncPolicy).\n * `Dep.Need<\"App\", Name>` keys the dep graph by literal name so\n * sibling modules can `yield* bundleHandle` to consume it.\n */\nexport interface BundleHandle<Name extends string, Out, In>\n\textends Context.Service<Dep.Need<\"App\", Name>, Bundle> {\n\treadonly layer: Layer.Layer<Out, AnyRenderError, In>;\n}\n\n/**\n * Higher-kinded handle constructor that maps `Module`'s\n * `(Name, Ns, R, Extra)` slots onto a `BundleHandle`. Lets\n * `Module.fixedNs({ target: Bundle.target, … })` /\n * `Module.dynamicNs({ target: Bundle.target, … })` return\n * strongly-typed `BundleHandle`s.\n */\nexport interface HandleKind extends Module.HandleKind {\n\treadonly Handle: BundleHandle<\n\t\tthis[\"_Name\"] & string,\n\t\t| Dep.Provide<\"App\", this[\"_Name\"] & string>\n\t\t| Dep.Provide<\"Namespace\", this[\"_Ns\"] & string>\n\t\t| (this[\"_Extra\"] & unknown),\n\t\tExclude<\n\t\t\tthis[\"_R\"] & unknown,\n\t\t\t| Dep.Need<\"Namespace\", this[\"_Ns\"] & string>\n\t\t\t| (this[\"_Extra\"] & unknown)\n\t\t>\n\t>;\n}\n\n/**\n * Re-export of {@link Module.LiteralName} — preserved as\n * `Bundle.LiteralName` so existing wrapper code keeps working.\n * konfig's dep graph keys every `Provide<\"App\", Name>` slot by literal\n * `Name`; a wrapper that lets `Name` widen to `string` collapses every\n * bundle into the same slot.\n */\nexport type LiteralName<T extends string> = Module.LiteralName<T>;\n\nexport interface BundleDefineOptions<\n\tName extends string,\n\tNs extends string,\n\tR,\n\tExtra,\n> {\n\treadonly name: LiteralName<Name>;\n\treadonly namespace?: LiteralName<Ns>;\n\treadonly build:\n\t\t| Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R>\n\t\t| (() => ReadonlyArray<unknown>);\n\treadonly provides?: Layer.Layer<Extra>;\n}\n\ntype _NsProvides<Ns extends string> = [Ns] extends [never]\n\t? never\n\t: Dep.Provide<\"Namespace\", Ns>;\n\ntype _NsExcludes<Ns extends string> = [Ns] extends [never]\n\t? never\n\t: Dep.Need<\"Namespace\", Ns>;\n\n/**\n * Build a typed handle for a manifest bundle — a name + optional\n * namespace + a set of manifests, plus dep-graph wiring. Same\n * compile-time guarantees as argocd's `Application.define` minus\n * `source: ArgoSource` / `syncPolicy` / sync-wave annotations:\n * - the literal `Name` flows into `Dep.Provide<\"App\", Name>`,\n * - the optional literal namespace flows into `Dep.Provide<\"Namespace\", Ns>`,\n * - the build callback's `R` channel becomes the handle's `In` after\n * subtracting what this bundle provides itself.\n *\n * Pair with `Bundle.fromModules` to compose multiple bundles\n * and have the dep-graph residual checked at `Bundle.entrypoint`.\n *\n * For `Module.fixedNs` / `Module.dynamicNs` use, see `Bundle.target`\n * — it adapts this `define` so namespace is required (Module wrappers\n * always thread a namespace through), which lets the dep-graph drop\n * the `Provide<\"Namespace\", never>` cell the optional shape needs.\n */\nexport const define = <\n\tconst Name extends string,\n\tconst Ns extends string = never,\n\tR = never,\n\tExtra = never,\n>(\n\topts: BundleDefineOptions<Name, Ns, R, Extra>,\n): BundleHandle<\n\tName,\n\tDep.Provide<\"App\", Name> | _NsProvides<Ns> | Extra,\n\tExclude<R, _NsExcludes<Ns> | Extra>\n> => {\n\tconst name = unsafeCoerce<Name>(\n\t\topts.name,\n\t\t\"LiteralName<Name> resolves to Name itself once the call typechecks\",\n\t);\n\tconst namespace =\n\t\topts.namespace === undefined\n\t\t\t? undefined\n\t\t\t: unsafeCoerce<Ns>(\n\t\t\t\t\topts.namespace,\n\t\t\t\t\t\"LiteralName<Ns> resolves to Ns itself once the call typechecks\",\n\t\t\t\t);\n\n\tconst tag = Dep.App<Name, Bundle>(name);\n\n\tconst nsLayer =\n\t\tnamespace === undefined\n\t\t\t? Layer.empty\n\t\t\t: Layer.succeed(Dep.Namespace(namespace))(namespace);\n\n\tconst internalLayer =\n\t\topts.provides !== undefined ? Layer.mergeAll(nsLayer, opts.provides) : nsLayer;\n\n\tconst buildEffect: Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R> =\n\t\tEffect.isEffect(opts.build) ? opts.build : Effect.sync(opts.build);\n\n\tconst bundleLayer = Layer.effect(\n\t\ttag,\n\t\tbuildEffect.pipe(\n\t\t\tEffect.map((manifests) =>\n\t\t\t\tmake({\n\t\t\t\t\tname,\n\t\t\t\t\t...(namespace !== undefined ? { namespace } : {}),\n\t\t\t\t\tmanifests,\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t).pipe(Layer.provide(internalLayer));\n\n\tconst layer =\n\t\topts.provides !== undefined\n\t\t\t? Layer.mergeAll(bundleLayer, nsLayer, opts.provides)\n\t\t\t: Layer.mergeAll(bundleLayer, nsLayer);\n\n\treturn unsafeCoerce<\n\t\tBundleHandle<\n\t\t\tName,\n\t\t\tDep.Provide<\"App\", Name> | _NsProvides<Ns> | Extra,\n\t\t\tExclude<R, _NsExcludes<Ns> | Extra>\n\t\t>\n\t>(\n\t\t_attachLayerToTag(tag, layer),\n\t\t\"narrow generic BundleHandle from the attachLayerToTag helper's loose Tag arg\",\n\t);\n};\n\n/**\n * `Module.Target` adapter for `Bundle.define`. `Module.fixedNs` /\n * `Module.dynamicNs` always pass a namespace through, so this adapter\n * requires `namespace` (whereas `Bundle.define` itself accepts it as\n * optional) — pinning `Ns` to a real literal lets the dep-graph emit\n * a concrete `Provide<\"Namespace\", Ns>` cell on the resulting handle.\n *\n * ```ts\n * const defineCache = Module.fixedNs({\n * target: Bundle.target,\n * namespace: \"cache\",\n * build: ({ name, namespace }) => [ ... ],\n * });\n * ```\n */\nexport const target: Module.Target<HandleKind, Record<never, never>, Record<never, never>> = {\n\tdefine: <const Name extends string, const Ns extends string, R = never, Extra = never>(\n\t\targs: Module.DefineBaseArgs<Name, Ns, R, Extra>,\n\t) =>\n\t\tunsafeCoerce<Module.ApplyHandle<HandleKind, Name, Ns, R, Extra>>(\n\t\t\tdefine<Name, Ns, R, Extra>(args),\n\t\t\t\"target requires namespace so Ns is always a string literal; under that constraint Bundle.define's _NsProvides<Ns> reduces to Provide<\\\"Namespace\\\", Ns>, matching HandleKind\",\n\t\t),\n};\n\nexport interface BundleSetResult {\n\treadonly name: string;\n\treadonly bundles: ReadonlyArray<Bundle>;\n}\n\nexport interface BundleSetMakeOptions {\n\treadonly name?: string;\n\treadonly bundles: ReadonlyArray<Bundle>;\n}\n\nexport const makeSet = (opts: BundleSetMakeOptions): BundleSetResult => ({\n\tname: opts.name ?? \"bundles\",\n\tbundles: opts.bundles,\n});\n\n/**\n * Phantom check that rejects a `Bundle.fromModules` program whose `R`\n * channel still carries unmet dep-graph Needs. Bound to the\n * \"Bundle.fromModules\" API label so the `_konfig_unsatisfied` hint\n * guides the user to the right call site.\n */\nexport const entrypoint = Compose.makeResidualEntrypoint(\"Bundle.fromModules\");\n\n// `any` in the AnyHandle upper bound: Effect's Layer is contravariant in\n// its first parameter and `BundleHandle` is invariant at the inference\n// site. `unknown` rejects concrete subtypes; `any` is bivariant — the\n// canonical \"any handle\" upper bound.\n// oxlint-disable-next-line app/no-type-assertion\ntype AnyHandle = BundleHandle<any, any, any>;\n\nexport type ResidualIn<T extends ReadonlyArray<AnyHandle>> = Compose.ResidualIn<T>;\n\nexport interface FromModulesOptions<Ms extends ReadonlyArray<AnyHandle>> {\n\treadonly name?: string;\n\treadonly modules: Ms;\n}\n\n/**\n * One-list composition for a backend-agnostic bundle set. Yields each\n * module's `Bundle` in tuple order, then wires the merged provider layer\n * with `Compose.composeLayers`. The returned Effect's R channel is the\n * residual unmet Needs after the fold (`Compose.ResidualIn<Ms>`),\n * which `entrypoint` rejects unless empty.\n *\n * **Order matters.** List providers before their consumers. A consumer\n * placed before its provider leaves an unmet `Need` in the residual,\n * which surfaces at `entrypoint` as a `_konfig_unsatisfied` hint.\n */\nexport const fromModules = <const Ms extends ReadonlyArray<AnyHandle>>(\n\topts: FromModulesOptions<Ms>,\n): Effect.Effect<\n\tBundleSetResult,\n\tAnyRenderError,\n\tResidualIn<Ms> | CoreManifest.RenderServices\n> => {\n\tconst program = Effect.gen(function* () {\n\t\tconst bundles: Bundle[] = [];\n\t\tfor (const mod of opts.modules) {\n\t\t\tconst b = yield* mod;\n\t\t\tbundles.push(b);\n\t\t}\n\t\treturn makeSet({ name: opts.name, bundles });\n\t});\n\n\tconst wired = Compose.composeLayers(opts.modules);\n\n\treturn unsafeCoerce<\n\t\tEffect.Effect<\n\t\t\tBundleSetResult,\n\t\t\tAnyRenderError,\n\t\t\tResidualIn<Ms> | CoreManifest.RenderServices\n\t\t>\n\t>(\n\t\tEffect.provide(program, wired),\n\t\t\"the runtime Effect is the same; only the static R channel is narrowed to ResidualIn<Ms> by the fold-as-type\",\n\t);\n};\n","import * as YAML from \"yaml\"\nimport { unsafeCoerce } from \"./_cast\"\n\nconst IGNORED_LABEL_KEYS = new Set([\"helm.sh/chart\"])\nconst IGNORED_ANNOTATION_KEYS = new Set([\n \"meta.helm.sh/release-name\",\n \"meta.helm.sh/release-namespace\"\n])\nconst MANAGED_BY_HELM_LABEL = \"app.kubernetes.io/managed-by\"\n\nconst _redactLabelMap = (labels: Record<string, unknown>): Record<string, unknown> => {\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(labels)) {\n if (IGNORED_LABEL_KEYS.has(k)) continue\n if (k === MANAGED_BY_HELM_LABEL && v === \"Helm\") continue\n out[k] = v\n }\n return out\n}\n\nconst _redactAnnotationMap = (annotations: Record<string, unknown>): Record<string, unknown> => {\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(annotations)) {\n if (IGNORED_ANNOTATION_KEYS.has(k)) continue\n out[k] = v\n }\n return out\n}\n\nexport interface RedactOptions {\n /**\n * Normalize numeric strings: `\"1.0\"` compares equal to `1`,\n * `\"true\"` stays a string (only numerics are normalized). Useful for\n * Helm-templated manifests where some fields get stringified.\n */\n readonly normalizeNumerics?: boolean\n}\n\nconst _isNumericString = (s: string): boolean => /^-?\\d+(\\.\\d+)?(e[-+]?\\d+)?$/i.test(s)\n\nexport interface RedactInput {\n readonly value: unknown\n readonly parentKey?: string | null\n readonly options?: RedactOptions\n}\n\n/**\n * Canonicalize a parsed YAML/JSON value for structural comparison,\n * applying two normalizations:\n *\n * 1. **Null/undefined keys are dropped.** Any object key whose value is\n * `null` or `undefined` is omitted from the redacted output. This is\n * deliberate: it makes an *explicit* `field: null` compare equal to\n * an *absent* `field`, which is what we want when diffing manifests\n * where one side spells out a null default the other side simply\n * omits. The trade-off is that a genuine \"field was set to null vs.\n * field removed\" distinction is intentionally invisible to the diff.\n * 2. **Numeric normalization** (opt-in via\n * {@link RedactOptions.normalizeNumerics}) — see that field.\n *\n * Helm metadata redaction (dropping chart-churn labels/annotations) is\n * layered on top when a `labels`/`annotations` map appears under\n * `metadata`.\n */\nexport const redact = (input: RedactInput): unknown => {\n const value = input.value\n const parentKey = input.parentKey ?? null\n const options = input.options ?? {}\n if (Array.isArray(value)) {\n return value.map((v) => redact({ value: v, parentKey: null, options }))\n }\n if (value !== null && typeof value === \"object\") {\n const obj = unsafeCoerce<Record<string, unknown>>(\n value,\n \"typeof === object && !Array.isArray && !== null narrowed above\"\n )\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(obj)) {\n if (v === null || v === undefined) continue\n if (k === \"labels\" && parentKey === \"metadata\" && v !== null && typeof v === \"object\") {\n out[k] = _redactLabelMap(unsafeCoerce(v, \"metadata.labels is Record<string, string>\"))\n continue\n }\n if (k === \"annotations\" && parentKey === \"metadata\" && v !== null && typeof v === \"object\") {\n out[k] = _redactAnnotationMap(unsafeCoerce(v, \"metadata.annotations is Record<string, string>\"))\n continue\n }\n out[k] = redact({ value: v, parentKey: k, options })\n }\n return out\n }\n if (options.normalizeNumerics === true) {\n if (typeof value === \"string\" && _isNumericString(value)) {\n return Number(value)\n }\n if (typeof value === \"number\" && Number.isFinite(value)) {\n // 1.0 and 1 unify when round-tripping through Number().\n return value\n }\n }\n return value\n}\n\nexport interface DeepEqualInput {\n readonly a: unknown\n readonly b: unknown\n}\nexport const deepEqual = (input: DeepEqualInput): boolean => {\n const { a, b } = input\n if (a === b) return true\n if (a === null || b === null) return false\n if (typeof a !== typeof b) return false\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual({ a: a[i], b: b[i] })) return false\n }\n return true\n }\n if (typeof a === \"object\" && typeof b === \"object\") {\n const ka = Object.keys(unsafeCoerce<object>(a, \"typeof === object branch\")).sort()\n const kb = Object.keys(unsafeCoerce<object>(b, \"typeof === object branch\")).sort()\n if (ka.length !== kb.length) return false\n for (let i = 0; i < ka.length; i++) if (ka[i] !== kb[i]) return false\n for (const k of ka) {\n const av = unsafeCoerce<Record<string, unknown>>(a, \"typeof === object branch\")[k]\n const bv = unsafeCoerce<Record<string, unknown>>(b, \"typeof === object branch\")[k]\n if (!deepEqual({ a: av, b: bv })) return false\n }\n return true\n }\n return false\n}\n\nexport const parseYaml = (text: string): unknown => YAML.parse(text)\n\n/**\n * Parse a multi-doc YAML file into an ordered list of documents. Each\n * document's parsed structure is preserved as-is. Empty / whitespace-only\n * segments are dropped, but their position is *not* preserved — only\n * present documents are returned. Use the returned index to identify\n * documents inside one file (alongside the filename) when reporting.\n */\nexport const parseYamlAll = (text: string): ReadonlyArray<unknown> => {\n const docs = YAML.parseAllDocuments(text)\n const out: unknown[] = []\n for (const d of docs) {\n const value = d.toJS()\n if (value === null || value === undefined) continue\n out.push(value)\n }\n return out\n}\n\n/**\n * Identifier for a document inside a multi-doc YAML file. We key by\n * (kind, name, namespace) when those fields are present so a\n * label-only edit on a Service inside a 12-doc file diffs against the\n * same-kind/name Service in the other side, regardless of position\n * shuffle.\n */\nconst _docKey = (value: unknown, fallbackIdx: number): string => {\n if (value === null || typeof value !== \"object\") return `:doc:${fallbackIdx}`\n const v = unsafeCoerce<\n { readonly kind?: unknown; readonly metadata?: { readonly name?: unknown; readonly namespace?: unknown } }\n >(\n value,\n \"typeof === object && !== null branch above narrowed value; every field access below is guarded by a typeof check\"\n )\n const kind = typeof v.kind === \"string\" ? v.kind : \"\"\n const name = typeof v.metadata?.name === \"string\" ? v.metadata.name : \"\"\n const ns = typeof v.metadata?.namespace === \"string\" ? v.metadata.namespace : \"\"\n if (kind || name) return `${kind}|${ns}|${name}`\n return `:doc:${fallbackIdx}`\n}\n\nexport type DocDiff =\n | { readonly _tag: \"Same\"; readonly key: string }\n | { readonly _tag: \"MissingLeft\"; readonly key: string; readonly right: unknown }\n | { readonly _tag: \"MissingRight\"; readonly key: string; readonly left: unknown }\n | {\n readonly _tag: \"Changed\"\n readonly key: string\n readonly left: unknown\n readonly right: unknown\n }\n\nexport type FileDiff =\n | { readonly _tag: \"Same\"; readonly file: string }\n | { readonly _tag: \"MissingLeft\"; readonly file: string }\n | { readonly _tag: \"MissingRight\"; readonly file: string }\n | {\n readonly _tag: \"Changed\"\n readonly file: string\n readonly left: unknown\n readonly right: unknown\n /** Per-document breakdown if the file holds a multi-doc YAML stream. */\n readonly docs?: ReadonlyArray<DocDiff>\n }\n\nexport interface DiffResult {\n readonly entries: ReadonlyArray<FileDiff>\n}\n\nexport interface DiffFilesInput {\n readonly left: Readonly<Record<string, string>>\n readonly right: Readonly<Record<string, string>>\n readonly options?: RedactOptions\n}\n\nconst _diffOne = (\n file: string,\n leftText: string,\n rightText: string,\n options: RedactOptions\n): FileDiff => {\n const lDocs = parseYamlAll(leftText).map((v, i) => [_docKey(v, i), redact({ value: v, options })] as const)\n const rDocs = parseYamlAll(rightText).map((v, i) => [_docKey(v, i), redact({ value: v, options })] as const)\n\n // Fast path: single doc on each side.\n if (lDocs.length <= 1 && rDocs.length <= 1) {\n const l = lDocs[0]?.[1]\n const r = rDocs[0]?.[1]\n if (deepEqual({ a: l, b: r })) return { _tag: \"Same\", file }\n return { _tag: \"Changed\", file, left: l, right: r }\n }\n\n const lByKey = new Map(lDocs)\n const rByKey = new Map(rDocs)\n const keys = Array.from(new Set([...lByKey.keys(), ...rByKey.keys()])).sort()\n\n const docs: DocDiff[] = []\n let anyChange = false\n for (const key of keys) {\n const l = lByKey.get(key)\n const r = rByKey.get(key)\n if (l === undefined) {\n docs.push({ _tag: \"MissingLeft\", key, right: r })\n anyChange = true\n } else if (r === undefined) {\n docs.push({ _tag: \"MissingRight\", key, left: l })\n anyChange = true\n } else if (deepEqual({ a: l, b: r })) {\n docs.push({ _tag: \"Same\", key })\n } else {\n docs.push({ _tag: \"Changed\", key, left: l, right: r })\n anyChange = true\n }\n }\n\n if (!anyChange) return { _tag: \"Same\", file }\n return {\n _tag: \"Changed\",\n file,\n left: lDocs.map((d) => d[1]),\n right: rDocs.map((d) => d[1]),\n docs\n }\n}\n\nexport const diffFiles = (input: DiffFilesInput): DiffResult => {\n const { left, right } = input\n const options = input.options ?? {}\n const files = Array.from(new Set([...Object.keys(left), ...Object.keys(right)])).sort()\n const entries: FileDiff[] = []\n for (const file of files) {\n const hasL = Object.hasOwn(left, file)\n const hasR = Object.hasOwn(right, file)\n if (!hasL) {\n entries.push({ _tag: \"MissingLeft\", file })\n continue\n }\n if (!hasR) {\n entries.push({ _tag: \"MissingRight\", file })\n continue\n }\n entries.push(_diffOne(file, left[file] ?? \"\", right[file] ?? \"\", options))\n }\n return { entries }\n}\n\nexport const hasDifferences = (result: DiffResult): boolean => result.entries.some((e) => e._tag !== \"Same\")\n\nexport type DiffFormat = \"summary\" | \"detail\" | \"json\"\n\nexport interface FormatDiffInput {\n readonly result: DiffResult\n readonly format?: DiffFormat\n}\nexport const formatDiff = (input: FormatDiffInput): string => {\n const { result } = input\n const format = input.format ?? \"summary\"\n if (format === \"json\") {\n return JSON.stringify(result, null, 2)\n }\n const changes = result.entries.filter((e) => e._tag !== \"Same\")\n if (changes.length === 0) return \"\"\n const lines: string[] = []\n for (const e of changes) {\n if (e._tag === \"MissingLeft\") lines.push(`+ ${e.file}`)\n else if (e._tag === \"MissingRight\") lines.push(`- ${e.file}`)\n else lines.push(`~ ${e.file}`)\n if (format === \"detail\" && e._tag === \"Changed\") {\n if (e.docs && e.docs.length > 0) {\n for (const d of e.docs) {\n if (d._tag === \"Same\") continue\n lines.push(` [doc ${d.key}] ${d._tag}`)\n if (d._tag === \"Changed\") {\n lines.push(\" left:\")\n lines.push(\n ...YAML.stringify(d.left, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n lines.push(\" right:\")\n lines.push(\n ...YAML.stringify(d.right, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n }\n }\n } else {\n lines.push(\" left:\")\n lines.push(\n ...YAML.stringify(e.left, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n lines.push(\" right:\")\n lines.push(\n ...YAML.stringify(e.right, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n }\n }\n }\n return lines.join(\"\\n\")\n}\n","\nimport { Effect } from \"effect\";\nimport { FileSystem } from \"effect/FileSystem\";\nimport { unsafeCoerce } from \"./_cast\";\nimport type { Path } from \"effect/Path\";\nimport type * as Scope from \"effect/Scope\";\nimport type { ChildProcessSpawner } from \"./_unstable\";\nimport type { RenderContext } from \"./RenderContext\";\nimport { type AnyRenderError, EmbedYamlReadError } from \"./RenderError\";\n\nexport type RenderServices = FileSystem | Path | ChildProcessSpawner | Scope.Scope;\n\nexport const ManifestTypeId: unique symbol = Symbol.for(\"@konfig.ts/core/Manifest\");\nexport type ManifestTypeId = typeof ManifestTypeId;\n\ninterface Variance<out A> {\n\treadonly _A: (_: never) => A;\n}\n\nexport interface Manifest<out A> {\n\treadonly [ManifestTypeId]: Variance<A>;\n\treadonly render: (ctx: RenderContext) => Effect.Effect<A, AnyRenderError, RenderServices>;\n}\n\nconst variance: Variance<never> = {\n\t_A: (_: never) => _,\n};\n\nexport type MakeRun<A> = (\n\tctx: RenderContext,\n) => A | Effect.Effect<A, AnyRenderError, RenderServices>;\n\nexport const make = <A>(run: MakeRun<A>): Manifest<A> => ({\n\t[ManifestTypeId]: unsafeCoerce<Variance<A>>(variance, \"phantom variance witness — A only appears in covariant position\"),\n\trender: (ctx) => {\n\t\tconst result = run(ctx);\n\t\treturn Effect.isEffect(result)\n\t\t\t? unsafeCoerce<Effect.Effect<A, AnyRenderError, RenderServices>>(\n\t\t\t\t\tresult,\n\t\t\t\t\t\"Effect.isEffect narrowed `result` to an Effect; TS's narrowing doesn't carry the Effect's full type parameters\",\n\t\t\t\t)\n\t\t\t: Effect.succeed(result);\n\t},\n});\n\nexport interface CombineInput<A1, A2> {\n\treadonly a: Manifest<A1>;\n\treadonly b: Manifest<A2>;\n}\nexport const combine = <A1, A2>(input: CombineInput<A1, A2>): Manifest<readonly [A1, A2]> =>\n\tmake((ctx) => Effect.all([input.a.render(ctx), input.b.render(ctx)], { concurrency: \"unbounded\" }));\n\nexport const concat = <A>(...manifests: Manifest<A | A[]>[]): Manifest<A[]> =>\n\tmake((ctx) =>\n\t\tEffect.all(\n\t\t\tmanifests.map((m) => m.render(ctx)),\n\t\t\t{ concurrency: \"unbounded\" },\n\t\t).pipe(\n\t\t\tEffect.map((results) =>\n\t\t\t\tresults.flatMap((r) =>\n\t\t\t\t\tArray.isArray(r)\n\t\t\t\t\t\t? unsafeCoerce<A[]>(r, \"Array.isArray narrowed; element type is A by render contract\")\n\t\t\t\t\t\t: [unsafeCoerce<A>(r, \"non-array branch carries a single A\")],\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t);\n\nexport interface WheneverInput<A> {\n\treadonly cond: boolean;\n\treadonly thunk: () => Manifest<A>;\n}\nexport const whenever = <A>(input: WheneverInput<A>): Manifest<A | undefined> =>\n\tmake((ctx) =>\n\t\tinput.cond\n\t\t\t? input.thunk().render(ctx)\n\t\t\t: unsafeCoerce<Effect.Effect<A | undefined, AnyRenderError, RenderServices>>(\n\t\t\t\t\tEffect.succeed(undefined),\n\t\t\t\t\t\"undefined branch — A is the type seen by the consumer when cond=false\",\n\t\t\t\t),\n\t);\n\nexport type EmbedYamlSource = { readonly path: string } | { readonly literal: string };\n\nexport interface RawYaml {\n\treadonly _tag: \"RawYaml\";\n\treadonly content: string;\n\treadonly origin?: string;\n}\n\nexport const embedYaml = (source: EmbedYamlSource): Manifest<RawYaml> =>\n\tmake<RawYaml>((_ctx) => {\n\t\tif (\"literal\" in source) {\n\t\t\treturn Effect.succeed<RawYaml>({ _tag: \"RawYaml\", content: source.literal });\n\t\t}\n\t\tconst path = source.path;\n\t\treturn Effect.gen(function* () {\n\t\t\tconst fs = yield* FileSystem;\n\t\t\tconst content = yield* fs.readFileString(path);\n\t\t\treturn { _tag: \"RawYaml\" as const, content, origin: path };\n\t\t}).pipe(Effect.mapError((cause) => new EmbedYamlReadError({ path, cause })));\n\t});\n","import { Data, Effect, Stream } from \"effect\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"./_unstable\";\n\n/**\n * Exit code stamped on a `ProcessError` when the process never produced\n * one — i.e. the spawn itself failed (binary not found, EACCES, a stream\n * read error). Distinct from any real OS exit code.\n */\nconst SPAWN_FAILED_EXIT = -1;\n\n/**\n * Upper bound (in UTF-16 code units, a close proxy for bytes here) on the\n * stderr tail retained by `ProcessError` — roughly the last 2KB. Keeps a\n * failing command's diagnostics readable without pinning a runaway log in\n * memory or in the serialized error.\n */\nconst STDERR_TAIL_LIMIT = 2048;\n\nconst _tail = (text: string): string =>\n\ttext.length > STDERR_TAIL_LIMIT ? text.slice(text.length - STDERR_TAIL_LIMIT) : text;\n\nconst _commandLabel = (command: ChildProcess.Command): string =>\n\tChildProcess.isStandardCommand(command)\n\t\t? [command.command, ...command.args].join(\" \")\n\t\t: \"<pipeline>\";\n\n/**\n * Failure of a spawned subprocess: a non-zero exit, a spawn that never\n * started, or (for `runProcessString`) an empty stdout when a payload was\n * required. Carries the exit code and a bounded tail of stderr so callers\n * can surface a diagnostic without re-running the command.\n *\n * `command` is the program plus its already-parsed arguments; it must\n * never be interpolated with secret material by callers.\n */\nexport class ProcessError extends Data.TaggedError(\"ProcessError\")<{\n\treadonly command: string;\n\treadonly exitCode: number;\n\treadonly stderrTail: string;\n}> {\n\tget message(): string {\n\t\tconst tail = this.stderrTail.trim();\n\t\tconst suffix = tail.length > 0 ? `: ${tail}` : \"\";\n\t\treturn `command \\`${this.command}\\` failed (exit ${this.exitCode})${suffix}`;\n\t}\n}\n\ninterface _CollectedProcess {\n\treadonly exitCode: number;\n\treadonly stdout: string;\n\treadonly stderr: string;\n}\n\nconst _collect = (\n\tstream: Stream.Stream<Uint8Array, PlatformError>,\n): Effect.Effect<string, PlatformError> => Stream.mkString(Stream.decodeText(stream));\n\n/**\n * Spawn `command` exactly once and, concurrently, drain stdout and stderr\n * to strings while awaiting the exit code. Draining both pipes alongside\n * `exitCode` avoids the classic pipe-buffer deadlock. A spawn/stream\n * failure (PlatformError) is folded into a `ProcessError` so callers see a\n * single error channel.\n */\nconst _spawnCollect = (\n\tcommand: ChildProcess.Command,\n): Effect.Effect<_CollectedProcess, ProcessError, ChildProcessSpawner> =>\n\tEffect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tconst spawner = yield* ChildProcessSpawner;\n\t\t\tconst handle = yield* spawner.spawn(command);\n\t\t\tconst [exitCode, stdout, stderr] = yield* Effect.all(\n\t\t\t\t[handle.exitCode, _collect(handle.stdout), _collect(handle.stderr)],\n\t\t\t\t{ concurrency: \"unbounded\" },\n\t\t\t);\n\t\t\treturn { exitCode, stdout, stderr };\n\t\t}),\n\t).pipe(\n\t\tEffect.mapError(\n\t\t\t(cause) =>\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: SPAWN_FAILED_EXIT,\n\t\t\t\t\tstderrTail: _tail(String(cause)),\n\t\t\t\t}),\n\t\t),\n\t);\n\n/**\n * Run `command` and return its stdout, checking the exit code — the guard\n * that `spawner.string` omits. Fails with `ProcessError` (carrying the\n * stderr tail) on any non-zero exit. Unless `allowEmptyStdout` is `true`,\n * also fails when the trimmed stdout is empty, so a silently-failing\n * command can never masquerade as an empty-but-successful result.\n */\n// oxlint-disable-next-line app/no-multiple-function-params\nexport const runProcessString = (\n\tcommand: ChildProcess.Command,\n\toptions?: { readonly allowEmptyStdout?: boolean },\n): Effect.Effect<string, ProcessError, ChildProcessSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst result = yield* _spawnCollect(command);\n\t\tif (result.exitCode !== 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\tstderrTail: _tail(result.stderr),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tif (options?.allowEmptyStdout !== true && result.stdout.trim().length === 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\tstderrTail: _tail(result.stderr),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn result.stdout;\n\t});\n\n/**\n * Run `command` for its success/failure only — stdout is drained (to avoid\n * a pipe deadlock) but discarded. Fails with `ProcessError` on any\n * non-zero exit, attaching the stderr tail when present.\n */\nexport const runProcessExit = (\n\tcommand: ChildProcess.Command,\n): Effect.Effect<void, ProcessError, ChildProcessSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst result = yield* _spawnCollect(command);\n\t\tif (result.exitCode !== 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\tstderrTail: _tail(result.stderr),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t});\n","import { Config, Effect } from \"effect\"\nimport { FileSystem } from \"effect/FileSystem\"\nimport { Path } from \"effect/Path\"\nimport * as YAML from \"yaml\"\nimport { unsafeCoerce } from \"./_cast\"\nimport { ChildProcess, ChildProcessSpawner } from \"./_unstable\"\nimport { parseYamlAll } from \"./diff\"\nimport { make, type Manifest, type RawYaml } from \"./Manifest\"\nimport { HelmDigestMismatch, HelmRenderError, HelmVersionTooLow } from \"./RenderError\"\nimport { runProcessExit, runProcessString } from \"./subprocess\"\n\nconst CLUSTER_SCOPED_KINDS: ReadonlySet<string> = new Set([\n \"APIService\",\n \"ClusterRole\",\n \"ClusterRoleBinding\",\n \"ComponentStatus\",\n \"CSIDriver\",\n \"CSINode\",\n \"CustomResourceDefinition\",\n \"FlowSchema\",\n \"IngressClass\",\n \"MutatingWebhookConfiguration\",\n \"Namespace\",\n \"Node\",\n \"PersistentVolume\",\n \"PodSecurityPolicy\",\n \"PriorityClass\",\n \"PriorityLevelConfiguration\",\n \"RuntimeClass\",\n \"StorageClass\",\n \"ValidatingAdmissionPolicy\",\n \"ValidatingAdmissionPolicyBinding\",\n \"ValidatingWebhookConfiguration\",\n \"VolumeAttachment\"\n])\n\nexport interface HelmReleaseOptions {\n readonly repo: string\n readonly chart: string\n readonly releaseName?: string\n readonly version: string\n readonly digest: string\n readonly namespace?: string\n readonly values: Record<string, unknown>\n readonly extraOpts?: readonly string[]\n /**\n * Minimum acceptable `helm` CLI version (semver, e.g. `\"3.16.0\"`).\n * When set, `release` runs a `helm version --short` preflight before\n * pulling/templating and fails with `HelmVersionTooLow` if the\n * installed helm is older (or absent). Omit to skip the check.\n */\n readonly minVersion?: string\n}\n\ninterface _ParseHelmOutputInput {\n readonly output: string\n readonly chart: string\n readonly version: string\n readonly namespace: string | undefined\n}\ninterface _ParsedDocShape {\n readonly kind?: string\n readonly metadata?: { readonly namespace?: string }\n}\n\nconst _asDocShape = (value: unknown): _ParsedDocShape | null =>\n value !== null && typeof value === \"object\"\n ? unsafeCoerce<_ParsedDocShape>(\n value,\n \"parseYamlAll returned a parsed document object; the kind/metadata reads below are each typeof-guarded\"\n )\n : null\n\n/**\n * Turn `helm template` stdout into individual `RawYaml` docs.\n *\n * Document boundaries come from the shared `parseYamlAll`\n * (`YAML.parseAllDocuments`) helper rather than a naive `/^---$/m` split,\n * so a `---` appearing inside a block scalar can't spuriously split one\n * manifest into two. `parseYamlAll` also drops empty / comment-only\n * segments for us.\n *\n * When a `namespace` is supplied, each namespaced-kind document that\n * lacks an explicit namespace is patched to carry it (the re-parse\n * branch behavior). Cluster-scoped kinds and documents that already pin\n * a namespace are left untouched.\n */\nconst _parseHelmOutput = (input: _ParseHelmOutputInput): Effect.Effect<RawYaml[]> =>\n Effect.sync(() => {\n const { output, chart, version, namespace } = input\n const origin = `helm:${chart}@${version}`\n const results: RawYaml[] = []\n for (const parsed of parseYamlAll(output)) {\n let value: unknown = parsed\n if (namespace !== undefined) {\n const shape = _asDocShape(parsed)\n if (\n shape !== null &&\n typeof shape.kind === \"string\" &&\n !CLUSTER_SCOPED_KINDS.has(shape.kind) &&\n (shape.metadata?.namespace === undefined || shape.metadata.namespace === \"\")\n ) {\n value = { ...shape, metadata: { ...shape.metadata, namespace } }\n }\n }\n let content = `---\\n${YAML.stringify(value, { lineWidth: 0 })}`\n if (!content.endsWith(\"\\n\")) content += \"\\n\"\n results.push({ _tag: \"RawYaml\", content, origin })\n }\n return results\n })\n\nconst _HELM_VERSION_RE = /v?(\\d+)\\.(\\d+)\\.(\\d+)/\n\n/** Extract a `major.minor.patch` triple from a version string, or `null`. */\nconst _parseVersionTriple = (text: string): readonly [number, number, number] | null => {\n const m = _HELM_VERSION_RE.exec(text.trim())\n if (m === null) return null\n return [Number(m[1]), Number(m[2]), Number(m[3])]\n}\n\n/** True when `found` is strictly older than `min` (release triple compare). */\nconst _isBelow = (\n found: readonly [number, number, number],\n min: readonly [number, number, number]\n): boolean => {\n for (let i = 0; i < 3; i++) {\n const f = found[i] ?? 0\n const m = min[i] ?? 0\n if (f < m) return true\n if (f > m) return false\n }\n return false\n}\n\n/**\n * One-shot `helm version --short` preflight. Fails `HelmVersionTooLow`\n * when helm is absent/unparseable or older than `minVersion`. Pre-release\n * / build metadata on the installed version is ignored — only the release\n * triple gates the check.\n */\nconst _assertHelmMinVersion = (\n minVersion: string\n): Effect.Effect<void, HelmVersionTooLow, ChildProcessSpawner> =>\n Effect.gen(function*() {\n const cmd = ChildProcess.make(\"helm\", [\"version\", \"--short\"])\n const stdout = yield* runProcessString(cmd, { allowEmptyStdout: false }).pipe(\n Effect.mapError(() => new HelmVersionTooLow({ required: minVersion, found: \"not found\" }))\n )\n const found = _parseVersionTriple(stdout)\n const min = _parseVersionTriple(minVersion)\n if (found === null || (min !== null && _isBelow(found, min))) {\n return yield* Effect.fail(\n new HelmVersionTooLow({ required: minVersion, found: stdout.trim() })\n )\n }\n })\n\nconst _normalizeDigest = (digest: string): string => digest.startsWith(\"sha256:\") ? digest : `sha256:${digest}`\n\nconst _toHex = (buf: ArrayBuffer): string => {\n const view = new Uint8Array(buf)\n let hex = \"\"\n for (let i = 0; i < view.length; i++) {\n hex += (view[i] ?? 0).toString(16).padStart(2, \"0\")\n }\n return hex\n}\n\n// Minimal local typing for `crypto.subtle.digest`. The base tsconfig is\n// `lib: [\"ES2022\"]` (no DOM), so `BufferSource` / `Crypto` are not declared;\n// we define just enough to drive the runtime call without dragging the\n// whole DOM lib in.\ninterface _SubtleCrypto {\n readonly digest: (algorithm: \"SHA-256\", data: ArrayBufferView) => Promise<ArrayBuffer>\n}\ninterface _CryptoGlobal {\n readonly subtle: _SubtleCrypto\n}\n\n/**\n * SHA-256 the file at `filePath` via Web Crypto API (`crypto.subtle.digest`).\n * `crypto.subtle` is a runtime global on Node ≥ 20 and on Bun; no\n * `node:crypto` import is needed, which keeps the file portable across\n * the runtimes Effect targets.\n */\nconst _hashFile = (filePath: string) =>\n Effect.gen(function*() {\n const fs = yield* FileSystem\n const bytes = yield* fs.readFile(filePath)\n const subtle = unsafeCoerce<{ readonly crypto: _CryptoGlobal }>(\n globalThis,\n \"globalThis.crypto is provided by the runtime (Node ≥ 20, Bun) — typed via local _CryptoGlobal interface\"\n ).crypto.subtle\n const digest = yield* Effect.promise(() => subtle.digest(\"SHA-256\", bytes))\n return `sha256:${_toHex(digest)}`\n })\n\ninterface _VerifyDigestInput {\n readonly opts: HelmReleaseOptions\n readonly cachedTgz: string\n}\n\nconst _verifyDigest = (input: _VerifyDigestInput) =>\n Effect.gen(function*() {\n const fs = yield* FileSystem\n const expected = _normalizeDigest(input.opts.digest)\n const actual = yield* _hashFile(input.cachedTgz)\n if (expected !== actual) {\n yield* fs.remove(input.cachedTgz).pipe(Effect.ignore)\n return yield* Effect.fail(\n new HelmDigestMismatch({\n chart: input.opts.chart,\n version: input.opts.version,\n expected,\n actual\n })\n )\n }\n })\n\ninterface _EnsureCachedTarballInput {\n readonly opts: HelmReleaseOptions\n readonly cacheDir: string\n readonly cachedTgz: string\n}\nconst _ensureCachedTarball = (input: _EnsureCachedTarballInput) =>\n Effect.gen(function*() {\n const { opts, cacheDir, cachedTgz } = input\n const fs = yield* FileSystem\n const path = yield* Path\n\n const cacheExists = yield* fs.exists(cachedTgz)\n if (cacheExists) {\n yield* _verifyDigest({ opts, cachedTgz })\n return\n }\n\n const beforeFiles = new Set(\n yield* fs.readDirectory(cacheDir).pipe(Effect.orElseSucceed((): string[] => []))\n )\n\n const pull = ChildProcess.make(\"helm\", [\n \"pull\",\n \"--repo\",\n opts.repo,\n opts.chart,\n \"--version\",\n opts.version,\n \"--destination\",\n cacheDir\n ])\n yield* runProcessExit(pull)\n\n const afterFiles = yield* fs.readDirectory(cacheDir)\n const candidates = afterFiles.filter(\n (f) =>\n f.endsWith(\".tgz\") &&\n f.startsWith(opts.chart) &&\n !beforeFiles.has(f) &&\n path.join(cacheDir, f) !== cachedTgz\n )\n if (candidates.length > 0) {\n yield* fs.rename(path.join(cacheDir, candidates[0] ?? \"\"), cachedTgz)\n }\n yield* _verifyDigest({ opts, cachedTgz })\n })\n\nexport const release = (opts: HelmReleaseOptions): Manifest<RawYaml[]> => {\n const extraOpts = opts.extraOpts ?? []\n\n return make<RawYaml[]>(() =>\n Effect.gen(function*() {\n const fs = yield* FileSystem\n const path = yield* Path\n\n if (opts.minVersion !== undefined) {\n yield* _assertHelmMinVersion(opts.minVersion)\n }\n\n const cacheDir = yield* Config.string(\"KONFIG_HELM_CACHE\").pipe(\n Config.withDefault(path.resolve(\".konfig\", \"helm-cache\"))\n )\n yield* fs.makeDirectory(cacheDir, { recursive: true })\n\n const digestSuffix = opts.digest.replace(/^sha256:/, \"\").slice(0, 12)\n const cachedTgz = path.join(cacheDir, `${opts.chart}-${opts.version}-${digestSuffix}.tgz`)\n yield* _ensureCachedTarball({ opts, cacheDir, cachedTgz })\n\n const tmpDir = yield* fs.makeTempDirectoryScoped({ prefix: \"konfig-helm-\" })\n const valuesFile = path.join(tmpDir, \"values.yaml\")\n yield* fs.writeFileString(valuesFile, YAML.stringify(opts.values, { lineWidth: 0 }))\n\n const releaseName = opts.releaseName ?? opts.chart\n const template = ChildProcess.make(\"helm\", [\n \"template\",\n releaseName,\n cachedTgz,\n \"--values\",\n valuesFile,\n ...(opts.namespace !== undefined ? [\"--namespace\", opts.namespace] : []),\n ...extraOpts\n ])\n const stdout = yield* runProcessString(template, { allowEmptyStdout: false })\n return yield* _parseHelmOutput({\n output: stdout,\n chart: opts.chart,\n version: opts.version,\n namespace: opts.namespace\n })\n }).pipe(\n Effect.scoped,\n Effect.mapError((cause) =>\n // The version preflight already produces a typed HelmVersionTooLow;\n // surface it as-is rather than burying it inside HelmRenderError.\n cause instanceof HelmVersionTooLow\n ? cause\n : new HelmRenderError({ chart: opts.chart, version: opts.version, cause })\n )\n )\n )\n}\n","\nimport { Data, Effect, Schema } from \"effect\";\n\nexport const EnvImages = Schema.Record(Schema.String, Schema.String);\nexport type EnvImages = typeof EnvImages.Type;\n\nexport const ImagesConfig = Schema.Struct({\n\tenvs: Schema.Record(Schema.String, EnvImages),\n});\nexport type ImagesConfig = typeof ImagesConfig.Type;\n\nconst decodeEff = Schema.decodeUnknownEffect(ImagesConfig);\n\nconst strict = { onExcessProperty: \"error\" } as const;\n\nexport const decodeImagesSync = (input: unknown): ImagesConfig =>\n\tEffect.runSync(decodeEff(input, strict));\nexport const decodeImagesEffect = (input: unknown) => decodeEff(input, strict);\n\nexport class ImagesEnvMissing extends Data.TaggedError(\"ImagesEnvMissing\")<{\n\treadonly env: string;\n}> {}\n\nexport interface LookupEnvInput {\n\treadonly cfg: ImagesConfig;\n\treadonly env: string;\n}\nexport const lookupEnv = (input: LookupEnvInput): EnvImages | undefined =>\n\tinput.cfg.envs[input.env];\n\nexport const lookupEnvEffect = (\n\tinput: LookupEnvInput,\n): Effect.Effect<EnvImages, ImagesEnvMissing> => {\n\tconst e = input.cfg.envs[input.env];\n\treturn e === undefined ? Effect.fail(new ImagesEnvMissing({ env: input.env })) : Effect.succeed(e);\n};\n\nexport const imagesFor = (input: LookupEnvInput): EnvImages => {\n\tconst e = input.cfg.envs[input.env];\n\tif (e === undefined) {\n\t\tthrow new ImagesEnvMissing({ env: input.env });\n\t}\n\treturn e;\n};\n\nexport class ImagesAppMissing extends Data.TaggedError(\"ImagesAppMissing\")<{\n\treadonly env: string;\n\treadonly app: string;\n}> {}\n\nexport interface RequireImageInput {\n\treadonly e: EnvImages;\n\treadonly app: string;\n\treadonly envName: string;\n}\nexport const requireImage = (input: RequireImageInput): string => {\n\tconst v = input.e[input.app];\n\tif (v === undefined) {\n\t\tthrow new ImagesAppMissing({ env: input.envName, app: input.app });\n\t}\n\treturn v;\n};\n","\nimport { Effect, Schema } from \"effect\";\n\nconst _stringWithKeyDefault = (def: string) =>\n\tSchema.String.pipe(Schema.optionalKey, Schema.withDecodingDefaultKey(Effect.succeed(def)));\n\nconst _stringArrayWithKeyDefault = (def: ReadonlyArray<string>) =>\n\tSchema.Array(Schema.String).pipe(\n\t\tSchema.optionalKey,\n\t\tSchema.withDecodingDefaultKey(Effect.succeed(def)),\n\t);\n\nexport const EnvEntry = Schema.Struct({\n\tentry: Schema.String,\n});\nexport type EnvEntry = typeof EnvEntry.Type;\n\nexport const OutDir = Schema.Struct({\n\tmanifests: Schema.String,\n});\nexport type OutDir = typeof OutDir.Type;\n\nexport const CrdConfig = Schema.Struct({\n\toutDir: _stringWithKeyDefault(\".generated/crd\"),\n});\nexport type CrdConfig = typeof CrdConfig.Type;\n\nexport const HelmConfig = Schema.Struct({\n\tcacheDir: _stringWithKeyDefault(\".konfig/helm-cache\"),\n\tminVersion: _stringWithKeyDefault(\"3.16.0\"),\n});\nexport type HelmConfig = typeof HelmConfig.Type;\n\nexport const ClusterSpec = Schema.Struct({\n\tregistry: Schema.optionalKey(Schema.String),\n\tingressClass: Schema.optionalKey(Schema.String),\n\tstorageClass: Schema.optionalKey(Schema.String),\n\trepositoryUrl: Schema.optionalKey(Schema.String),\n});\nexport type ClusterSpec = typeof ClusterSpec.Type;\n\nexport const DiffConfig = Schema.Struct({\n\tbaseline: Schema.String,\n});\nexport type DiffConfig = typeof DiffConfig.Type;\n\nexport const ServicesConfig = Schema.Struct({\n\toutFile: Schema.optionalKey(Schema.String),\n\tglobalPaths: _stringArrayWithKeyDefault([]),\n});\nexport type ServicesConfig = typeof ServicesConfig.Type;\n\nexport const KonfigConfig = Schema.Struct({\n\troot: Schema.String,\n\tcluster: _stringWithKeyDefault(\"cluster.ts\"),\n\tmodules: _stringWithKeyDefault(\"modules\"),\n\tcharts: _stringWithKeyDefault(\"charts\"),\n\tenvs: Schema.Record(Schema.String, EnvEntry),\n\toutDir: OutDir,\n\tcrd: Schema.optionalKey(CrdConfig).pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed({ outDir: \".generated/crd\" })),\n\t),\n\thelm: Schema.optionalKey(HelmConfig).pipe(\n\t\tSchema.withDecodingDefaultKey(\n\t\t\tEffect.succeed({ cacheDir: \".konfig/helm-cache\", minVersion: \"3.16.0\" }),\n\t\t),\n\t),\n\tdiff: Schema.optionalKey(DiffConfig),\n\tservices: Schema.optionalKey(ServicesConfig),\n\tclusters: Schema.optionalKey(Schema.Record(Schema.String, ClusterSpec)),\n});\nexport type KonfigConfig = typeof KonfigConfig.Type;\n\nexport interface ResolvedKonfigConfig {\n\treadonly configDir: string;\n\treadonly config: KonfigConfig;\n}\n\nconst strict = { onExcessProperty: \"error\" } as const;\nconst decodeEff = Schema.decodeUnknownEffect(KonfigConfig);\n\nexport const decodeKonfigConfigSync = (input: unknown): KonfigConfig =>\n\tEffect.runSync(decodeEff(input, strict));\nexport const decodeKonfigConfigEffect = (input: unknown) => decodeEff(input, strict);\n","import { Effect, type Layer } from \"effect\";\nimport { unsafeCoerce } from \"./_cast\";\nimport type { AnyRenderError } from \"./RenderError\";\n\n/**\n * Resolves to `T` if it is a string literal (or template-literal\n * pattern), and to a structured error type when `T` widens to the bare\n * `string`. Use as the field type on every name/namespace slot any\n * module wrapper forwards.\n *\n * konfig's dep graph keys each provider by literal name; a wrapper that\n * lets `Name` widen to `string` collapses every module into the same\n * slot and silently masks unmet deps. This brand turns that into a\n * compile error at the call site.\n */\nexport type LiteralName<T extends string> = string extends T\n\t? {\n\t\t\treadonly _konfig_error: \"Module name/namespace must be a string literal. Make the wrapper generic (`<const Name extends string>`) and forward via `Module.LiteralName<Name>`.\";\n\t\t}\n\t: T;\n\n/**\n * Context passed to a module's `build` callback. Carries the\n * per-instance identity (chosen `name` and the module's `namespace`)\n * so the build can stamp them onto manifests without re-receiving\n * them via `opts`.\n */\nexport interface BuildContext<Ns extends string = string> {\n\treadonly name: string;\n\treadonly namespace: Ns;\n}\n\n/**\n * Allowed return shapes from a module `build` callback:\n * - an `Effect` (when the build reads from Layers, files, etc.)\n * - a plain `ReadonlyArray<unknown>` for pure synchronous builds.\n *\n * `Module.fixedNs` / `Module.dynamicNs` lift the array form into an\n * `Effect` internally — wrapper authors don't need to wrap themselves.\n */\nexport type BuildResult<R = never> =\n\t| Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R>\n\t| ReadonlyArray<unknown>;\n\nconst _liftBuild = <R>(\n\tresult: BuildResult<R>,\n): Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R> =>\n\tEffect.isEffect(result) ? result : Effect.succeed(result);\n\n/**\n * Higher-kinded handle constructor: each backend declares a sub-interface\n * that maps the four type parameters (`_Name`, `_Ns`, `_R`, `_Extra`)\n * onto its native handle (`ApplicationHandle` / `BundleHandle` / …).\n *\n * `ApplyHandle` substitutes concrete types into the kind's `this`\n * slots — the standard \"type lambda\" encoding Effect uses for HKTs.\n */\nexport interface HandleKind {\n\treadonly _Name: string;\n\treadonly _Ns: string;\n\treadonly _R: unknown;\n\treadonly _Extra: unknown;\n\treadonly Handle: unknown;\n}\n\nexport type ApplyHandle<\n\tK extends HandleKind,\n\tName extends string,\n\tNs extends string,\n\tR,\n\tExtra,\n> = (K & {\n\treadonly _Name: Name;\n\treadonly _Ns: Ns;\n\treadonly _R: R;\n\treadonly _Extra: Extra;\n})[\"Handle\"];\n\n/**\n * Universal define-args every backend accepts. Each backend layers\n * additional fields on via the `ExtraConfig` (config-time-only) and\n * `ExtraCallArgs` (per-instance) generics on `Target`.\n */\nexport interface DefineBaseArgs<\n\tName extends string,\n\tNs extends string,\n\tR,\n\tExtra,\n> {\n\treadonly name: LiteralName<Name>;\n\treadonly namespace: LiteralName<Ns>;\n\treadonly build:\n\t\t| Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R>\n\t\t| (() => ReadonlyArray<unknown>);\n\treadonly provides?: Layer.Layer<Extra>;\n}\n\n/**\n * Adapter contract a backend implements to plug into `Module.fixedNs` /\n * `Module.dynamicNs`. Both `Application` (argocd) and `Bundle` (k8s)\n * satisfy it via their existing `define` exports — pass the namespace\n * itself as the first argument.\n *\n * - `Kind` — HKT mapping `(Name, Ns, R, Extra)` to the\n * backend's native handle type.\n * - `ExtraConfig` — config-time-only fields the backend accepts\n * (e.g. argocd's `syncPolicy`, `annotations`).\n * - `ExtraCallArgs` — per-instance fields the wrapper requires\n * at the call site (e.g. argocd's `source`).\n */\nexport interface Target<\n\tKind extends HandleKind = HandleKind,\n\tExtraConfig extends object = Record<string, never>,\n\tExtraCallArgs extends object = Record<string, never>,\n> {\n\treadonly define: <\n\t\tconst Name extends string,\n\t\tconst Ns extends string,\n\t\tR = never,\n\t\tExtra = never,\n\t>(\n\t\targs: DefineBaseArgs<Name, Ns, R, Extra> & ExtraConfig & ExtraCallArgs,\n\t) => ApplyHandle<Kind, Name, Ns, R, Extra>;\n}\n\n/** Config accepted by `Module.fixedNs` (namespace baked into the wrapper). */\nexport interface FixedNsConfig<\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tNs extends string,\n\tOpts extends object,\n\tR,\n\tExtra,\n> {\n\treadonly target: Target<Kind, ExtraConfig, ExtraCallArgs>;\n\treadonly namespace: Ns;\n\treadonly provides?: Layer.Layer<Extra>;\n\treadonly build: (ctx: BuildContext<Ns>, opts: Opts) => BuildResult<R>;\n}\n\n/**\n * Build a typed wrapper for a module whose namespace is part of its\n * identity (e.g. `cert-manager` always installs into `cert-manager`).\n *\n * `target` is the backend adapter — typically `Application.target`\n * (argocd) or `Bundle.target` (k8s). The wrapper's call signature\n * merges the backend's per-instance fields (`source` for argocd,\n * none for bundle) with the user-defined `Opts`.\n *\n * ```ts\n * const defineSops = Module.fixedNs({\n * target: Application.target,\n * namespace: \"sops\",\n * annotations: Sync.wave(-1),\n * build: ({ namespace }, _opts: Record<never, never>) => [\n * Namespace.make({ name: namespace }),\n * Helm.release({ ... }),\n * ],\n * });\n *\n * const sops = defineSops({ name: \"sops-operator\", source: src(\"sops\") });\n * ```\n */\nexport const fixedNs = <\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tconst Ns extends string,\n\tOpts extends object = Record<never, never>,\n\tR = never,\n\tExtra = never,\n>(\n\tconfig: FixedNsConfig<Kind, ExtraConfig, ExtraCallArgs, Ns, Opts, R, Extra> & ExtraConfig,\n) => {\n\tconst { target, namespace, provides, build, ...extraConfig } = unsafeCoerce<\n\t\tFixedNsConfig<Kind, ExtraConfig, ExtraCallArgs, Ns, Opts, R, Extra> & ExtraConfig & Record<string, unknown>\n\t>(config, \"Record spread shape mirrors the FixedNsConfig & ExtraConfig intersection\");\n\tconst adapter = unsafeCoerce<Target<Kind, ExtraConfig, ExtraCallArgs>>(\n\t\ttarget,\n\t\t\"target was destructured from config without preserving its typed shape; reattach the constraint\",\n\t);\n\n\treturn <const Name extends string>(\n\t\targs: { readonly name: LiteralName<Name> } & ExtraCallArgs & Opts,\n\t): ApplyHandle<Kind, Name, Ns, R, Extra> => {\n\t\tconst { name, ...rest } = unsafeCoerce<\n\t\t\t{ readonly name: LiteralName<Name> } & Record<string, unknown>\n\t\t>(args, \"destructuring the wrapper args; rest carries ExtraCallArgs & Opts as a flat record\");\n\n\t\tconst ctxName = unsafeCoerce<Name>(\n\t\t\tname,\n\t\t\t\"LiteralName<Name> resolves to Name itself once the wrapper call typechecks\",\n\t\t);\n\n\t\tconst buildResult = build(\n\t\t\t{ name: ctxName, namespace },\n\t\t\tunsafeCoerce<Opts>(rest, \"rest carries Opts fields; ExtraCallArgs flow to target.define below\"),\n\t\t);\n\n\t\treturn adapter.define<Name, Ns, R, Extra>(unsafeCoerce<\n\t\t\tDefineBaseArgs<Name, Ns, R, Extra> & ExtraConfig & ExtraCallArgs\n\t\t>(\n\t\t\t{\n\t\t\t\t...extraConfig,\n\t\t\t\t...rest,\n\t\t\t\tname,\n\t\t\t\tnamespace: unsafeCoerce<LiteralName<Ns>>(\n\t\t\t\t\tnamespace,\n\t\t\t\t\t\"Ns is a const string literal; LiteralName<Ns> resolves to Ns itself\",\n\t\t\t\t),\n\t\t\t\tbuild: _liftBuild(buildResult),\n\t\t\t\t...(provides !== undefined ? { provides } : {}),\n\t\t\t},\n\t\t\t\"the assembled object structurally matches the target's define-args; spread layout matches the intersection\",\n\t\t));\n\t};\n};\n\n/** Config accepted by `Module.dynamicNs` (namespace chosen per instance). */\nexport interface DynamicNsConfig<\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tOpts extends object,\n\tR,\n\tExtra,\n> {\n\treadonly target: Target<Kind, ExtraConfig, ExtraCallArgs>;\n\treadonly provides?: Layer.Layer<Extra>;\n\treadonly build: (ctx: BuildContext, opts: Opts) => BuildResult<R>;\n}\n\n/**\n * Build a typed wrapper for a module whose namespace is chosen per\n * instance (e.g. an `api` module deployed into different namespaces\n * per env).\n *\n * ```ts\n * const defineApi = Module.dynamicNs({\n * target: Application.target,\n * annotations: Sync.wave(1),\n * build: ({ name, namespace }, opts: ApiOpts) => [ ... ],\n * });\n *\n * const api = defineApi({\n * name: \"api\",\n * namespace: \"prod\",\n * source: src(\"api\"),\n * replicas: 2,\n * });\n * ```\n */\nexport const dynamicNs = <\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tOpts extends object = Record<never, never>,\n\tR = never,\n\tExtra = never,\n>(\n\tconfig: DynamicNsConfig<Kind, ExtraConfig, ExtraCallArgs, Opts, R, Extra> & ExtraConfig,\n) => {\n\tconst { target, provides, build, ...extraConfig } = unsafeCoerce<\n\t\tDynamicNsConfig<Kind, ExtraConfig, ExtraCallArgs, Opts, R, Extra> & ExtraConfig & Record<string, unknown>\n\t>(config, \"Record spread shape mirrors the DynamicNsConfig & ExtraConfig intersection\");\n\tconst adapter = unsafeCoerce<Target<Kind, ExtraConfig, ExtraCallArgs>>(\n\t\ttarget,\n\t\t\"target was destructured from config without preserving its typed shape; reattach the constraint\",\n\t);\n\n\treturn <const Name extends string, const Ns extends string>(\n\t\targs: {\n\t\t\treadonly name: LiteralName<Name>;\n\t\t\treadonly namespace: LiteralName<Ns>;\n\t\t} & ExtraCallArgs & Opts,\n\t): ApplyHandle<Kind, Name, Ns, R, Extra> => {\n\t\tconst { name, namespace, ...rest } = unsafeCoerce<\n\t\t\t{ readonly name: LiteralName<Name>; readonly namespace: LiteralName<Ns> } & Record<string, unknown>\n\t\t>(args, \"destructuring the wrapper args; rest carries ExtraCallArgs & Opts as a flat record\");\n\n\t\tconst ctxName = unsafeCoerce<Name>(\n\t\t\tname,\n\t\t\t\"LiteralName<Name> resolves to Name itself once the wrapper call typechecks\",\n\t\t);\n\t\tconst ctxNs = unsafeCoerce<Ns>(\n\t\t\tnamespace,\n\t\t\t\"LiteralName<Ns> resolves to Ns itself once the wrapper call typechecks\",\n\t\t);\n\n\t\tconst buildResult = build(\n\t\t\t{ name: ctxName, namespace: ctxNs },\n\t\t\tunsafeCoerce<Opts>(rest, \"rest carries Opts fields; ExtraCallArgs flow to target.define below\"),\n\t\t);\n\n\t\treturn adapter.define<Name, Ns, R, Extra>(unsafeCoerce<\n\t\t\tDefineBaseArgs<Name, Ns, R, Extra> & ExtraConfig & ExtraCallArgs\n\t\t>(\n\t\t\t{\n\t\t\t\t...extraConfig,\n\t\t\t\t...rest,\n\t\t\t\tname,\n\t\t\t\tnamespace,\n\t\t\t\tbuild: _liftBuild(buildResult),\n\t\t\t\t...(provides !== undefined ? { provides } : {}),\n\t\t\t},\n\t\t\t\"the assembled object structurally matches the target's define-args; spread layout matches the intersection\",\n\t\t));\n\t};\n};\n","/**\n * Context object threaded through every `Manifest.render(...)` call.\n *\n * `env` is the single load-bearing field: it keys both the file-output\n * directory under `outDir.manifests` and the choice of bundle entry in\n * `KonfigConfig.envs`. The optional fields below carry per-cluster\n * context for renders where one logical env spans multiple clusters.\n *\n * **Precedence rules:**\n * - The output directory is keyed on `env` alone when `cluster` is\n * `undefined`; when set, builds write to `<outDir>/<env>/<cluster>/`.\n * Tests that bypass the CLI write into the simpler `<outDir>/<env>/`\n * path by construction.\n * - `cluster` is informational inside `Manifest.make((ctx) => ...)` —\n * no constructor mutates a manifest based on it implicitly; the\n * caller branches.\n * - `k8sVersion` is a hint for renderers that emit\n * apiVersion-conditional resources (e.g. `policy/v1beta1` vs\n * `policy/v1`).\n * - `flags` is the escape hatch for one-off \"render with X\" toggles\n * that don't deserve their own field. Use sparingly.\n */\nexport interface RenderContext {\n\treadonly env: string;\n\treadonly cluster?: string;\n\treadonly k8sVersion?: string;\n\treadonly flags?: ReadonlyMap<string, unknown>;\n}\n\nexport interface RenderContextFullInput {\n\treadonly env: string;\n\treadonly cluster?: string;\n\treadonly k8sVersion?: string;\n\treadonly flags?: ReadonlyMap<string, unknown>;\n}\n\nexport const RenderContext = {\n\tmake: (env: string): RenderContext => ({ env }),\n\tmakeFull: (input: RenderContextFullInput): RenderContext => ({\n\t\tenv: input.env,\n\t\t...(input.cluster !== undefined ? { cluster: input.cluster } : {}),\n\t\t...(input.k8sVersion !== undefined ? { k8sVersion: input.k8sVersion } : {}),\n\t\t...(input.flags !== undefined ? { flags: input.flags } : {}),\n\t}),\n};\n","import { NodeRuntime, NodeServices } from \"@effect/platform-node\"\nimport { Effect, Layer } from \"effect\"\nimport { RenderContext } from \"./RenderContext\"\n\nexport interface RenderOptions<RIn = never> {\n /** Render-context env (default `\"prod\"`). Keys output dirs and bundle entries. */\n readonly env?: string\n /** Extra layer merged with `NodeServices.layer` before running the program. Use for `ConfigProvider` mocks, custom service tags, etc. */\n readonly layers?: Layer.Layer<RIn, never, never>\n}\n\n/** @internal */\nexport const _resolveEnv = (env: string | undefined): string => env ?? \"prod\"\n\n/** @internal */\nexport const _buildLayers = <RIn>(\n extra: Layer.Layer<RIn, never, never> | undefined\n): Layer.Layer<NodeServices.NodeServices | RIn, never, never> =>\n extra === undefined\n // oxlint-disable-next-line app/no-type-assertion\n ? (NodeServices.layer as Layer.Layer<NodeServices.NodeServices | RIn, never, never>)\n : Layer.mergeAll(NodeServices.layer, extra)\n\n/**\n * @internal\n * Compose the ctx + layers wiring `render` hands to `NodeRuntime.runMain`\n * into a single runnable Effect (context fully provided). Extracted so\n * tests can exercise the composition with `Effect.runPromise` instead of\n * `runMain`, which would exit the process.\n */\n// oxlint-disable-next-line app/no-multiple-function-params\nexport const _compose = <E, RIn>(\n program: (ctx: RenderContext) => Effect.Effect<void, E, NodeServices.NodeServices | RIn>,\n options: RenderOptions<RIn> = {}\n): Effect.Effect<void, E> => {\n const ctx = RenderContext.make(_resolveEnv(options.env))\n const layers = _buildLayers(options.layers)\n return program(ctx).pipe(Effect.scoped, Effect.provide(layers))\n}\n\n/**\n * Run a render program against `NodeRuntime`.\n *\n * The callback receives a `RenderContext` keyed on `options.env`\n * (default `\"prod\"`) and returns an Effect whose only required\n * services are `NodeServices` and whatever the caller supplies via\n * `options.layers`. `render` provides both, wraps in `Effect.scoped`,\n * and hands off to `NodeRuntime.runMain`.\n *\n * Replaces the per-file `NodeRuntime.runMain(program.pipe(...))`\n * boilerplate every example used to repeat.\n */\n// oxlint-disable-next-line app/no-multiple-function-params\nexport const render = <E, RIn>(\n program: (ctx: RenderContext) => Effect.Effect<void, E, NodeServices.NodeServices | RIn>,\n options: RenderOptions<RIn> = {}\n): void => {\n NodeRuntime.runMain(_compose(program, options))\n}\n","import type { Effect } from \"effect\";\nimport type { Manifest, RenderServices } from \"./Manifest\";\nimport type { RenderContext } from \"./RenderContext\";\nimport type { AnyRenderError } from \"./RenderError\";\n\nexport interface RenderManifestInput<A> {\n\treadonly manifest: Manifest<A>;\n\treadonly ctx: RenderContext;\n}\nexport const renderManifest = <A>(\n\tinput: RenderManifestInput<A>,\n): Effect.Effect<A, AnyRenderError, RenderServices> => input.manifest.render(input.ctx);\n","import * as YAML from \"yaml\"\nimport { unsafeCoerce } from \"../_cast\"\n\nconst ORDER_ROOT = [\"apiVersion\", \"kind\", \"metadata\", \"spec\", \"status\"]\nconst ORDER_METADATA = [\"name\", \"namespace\", \"labels\", \"annotations\"]\n\ninterface _ReorderInput {\n readonly obj: Record<string, unknown>\n readonly depth: number\n readonly parentKey: string | null\n}\nconst _reorderObject = (input: _ReorderInput): Record<string, unknown> => {\n const { obj, depth, parentKey } = input\n const keys = Object.keys(obj).filter((k) => obj[k] !== null && obj[k] !== undefined)\n const order = depth === 0 ? ORDER_ROOT : depth === 1 && parentKey === \"metadata\" ? ORDER_METADATA : null\n\n let sortedKeys: string[]\n if (order !== null) {\n const known = order.filter((k) => keys.includes(k))\n const rest = keys.filter((k) => !order.includes(k)).sort()\n sortedKeys = [...known, ...rest]\n } else {\n sortedKeys = keys.slice().sort()\n }\n\n const out: Record<string, unknown> = {}\n for (const k of sortedKeys) {\n out[k] = _normalize({ value: obj[k], depth: depth + 1, parentKey: k })\n }\n return out\n}\n\ninterface _NormalizeInput {\n readonly value: unknown\n readonly depth: number\n readonly parentKey: string | null\n}\nconst _normalize = (input: _NormalizeInput): unknown => {\n const { value, depth, parentKey } = input\n if (value === null || value === undefined) return value\n if (Array.isArray(value)) {\n return value.map((v) => _normalize({ value: v, depth: depth + 1, parentKey: null }))\n }\n if (typeof value === \"object\") {\n return _reorderObject({\n obj: unsafeCoerce<Record<string, unknown>>(\n value,\n \"typeof === object branch (value !== null, !Array.isArray above) — treated as a keyed record for reordering\"\n ),\n depth,\n parentKey\n })\n }\n return value\n}\n\nexport interface SerializeInput {\n readonly value: unknown\n readonly trailingNewline?: boolean\n}\nexport const serialize = (input: SerializeInput): string => {\n const normalized = _normalize({ value: input.value, depth: 0, parentKey: null })\n const raw = YAML.stringify(normalized, {\n indent: 2,\n indentSeq: true,\n lineWidth: 0,\n minContentWidth: 0,\n defaultStringType: \"PLAIN\",\n defaultKeyType: \"PLAIN\",\n nullStr: \"null\",\n // Emit YAML safe under 1.1 readers (kubectl/go-yaml). Forces plain strings\n // like \"no\"/\"yes\"/\"on\"/\"off\" to be quoted so they aren't coerced to bools.\n version: \"1.1\"\n })\n const lf = raw.replace(/\\r\\n/g, \"\\n\").replace(/\\s+$/g, \"\")\n return (input.trailingNewline ?? true) ? `${lf}\\n` : lf\n}\n\n/**\n * Derive the on-disk filename (`<Kind>-<name>.yaml`) for a rendered\n * resource.\n *\n * **Precondition (caller invariant):** `resource.kind` and\n * `resource.metadata.name` MUST both be non-empty strings. A rendered\n * Kubernetes object always satisfies this, so callers are expected to\n * validate/decode the object *before* reaching this point (the CLI keys\n * files by kind+name only for objects it has already confirmed carry\n * both fields).\n *\n * Because the precondition is a caller invariant rather than runtime\n * input, a violation is a programming error: this throws synchronously\n * (a defect) instead of returning a typed error. It is deliberately kept\n * out of the `AnyRenderError` channel — do not route untrusted resources\n * through it; narrow them first.\n *\n * @throws {Error} if `kind` or `metadata.name` is missing or empty.\n */\nexport const filenameFor = (resource: {\n readonly kind?: unknown\n readonly metadata?: { readonly name?: unknown }\n}): string => {\n const kind = resource.kind\n const name = resource.metadata?.name\n if (typeof kind !== \"string\" || kind.length === 0) {\n throw new Error(`filenameFor: resource has no string kind`)\n }\n if (typeof name !== \"string\" || name.length === 0) {\n throw new Error(`filenameFor: resource '${kind}' has no metadata.name`)\n }\n return `${kind}-${_sanitizeNameForFilename(name)}.yaml`\n}\n\nconst _sanitizeNameForFilename = (name: string): string => name.replace(/[./]/g, \"-\")\n","export * from \"./serialize\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAa,SAAY,UAAqB;;;;;;;;;;;;;;;;AAkB9C,MAAa,gBAAmB,OAAgB,YAAuB;;;ACtBvE,IAAa,cAAb,cAAiC,KAAK,YAAY,cAAc,CAG7D;AAEH,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAG3E;AAEH,IAAa,sBAAb,cAAyC,KAAK,YAAY,sBAAsB,CAG7E;AAEH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAGzE;CACD,IAAI,UAAkB;EACpB,OAAO,iCAAiC,KAAK,SAAS,UAAU,KAAK;;;AAIzE,IAAa,kBAAb,cAAqC,KAAK,YAAY,kBAAkB,CAIrE;AAEH,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAK3E;CACD,IAAI,UAAkB;EACpB,OAAO,cAAc,KAAK,MAAM,GA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,WAAW;EAAM,CAAC,CAAC;CAEtF,IAAI,OAAO,UAAU,UACnB,OAAO,eAAe;EACpB,KAAK,aACH,OACA,6GACD;EACD;EACA;EACD,CAAC;CAEJ,OAAO;;AAOT,MAAa,aAAa,UAAkC;CAC1D,MAAM,aAAa,WAAW;EAAE,OAAO,MAAM;EAAO,OAAO;EAAG,WAAW;EAAM,CAAC;CAahF,MAAM,KAZM,KAAK,UAAU,YAAY;EACrC,QAAQ;EACR,WAAW;EACX,WAAW;EACX,iBAAiB;EACjB,mBAAmB;EACnB,gBAAgB;EAChB,SAAS;EAGT,SAAS;EACV,CACa,CAAC,QAAQ,SAAS,KAAK,CAAC,QAAQ,SAAS,GAAG;CAC1D,OAAQ,MAAM,mBAAmB,OAAQ,GAAG,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;AAsBvD,MAAa,eAAe,aAGd;CACZ,MAAM,OAAO,SAAS;CACtB,MAAM,OAAO,SAAS,UAAU;CAChC,IAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAC9C,MAAM,IAAI,MAAM,2CAA2C;CAE7D,IAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAC9C,MAAM,IAAI,MAAM,0BAA0B,KAAK,wBAAwB;CAEzE,OAAO,GAAG,KAAK,GAAG,yBAAyB,KAAK,CAAC;;AAGnD,MAAM,4BAA4B,SAAyB,KAAK,QAAQ,SAAS,IAAI"}
1
+ {"version":3,"file":"index.mjs","names":["make","Dep.App","Dep.Namespace","Compose.makeResidualEntrypoint","Compose.composeLayers","decodeEff","strict"],"sources":["../src/_cast.ts","../src/RenderError.ts","../src/boundary.ts","../src/Compose.ts","../src/deps.ts","../src/Bundle.ts","../src/diff.ts","../src/Manifest.ts","../src/subprocess.ts","../src/Helm.ts","../src/images.ts","../src/konfigConfig.ts","../src/Module.ts","../src/RenderContext.ts","../src/render.ts","../src/renderManifest.ts","../src/yaml/serialize.ts","../src/yaml/index.ts"],"sourcesContent":["/**\n * Nominal-typing primitive — attach a phantom brand to a string value.\n * Used by `Dep.*Ref` constructors and the like. Safe by construction:\n * the brand is a type-only label that the caller stamps on themselves.\n */\n// oxlint-disable-next-line app/no-banned-type-assertions app/no-type-assertion\nexport const brand = <T>(value: string): T => value as unknown as T\n\n/**\n * Unsafe escape hatch — claim a value has type `T` without runtime\n * proof. Every call site MUST pass a one-line `reason` explaining why\n * the cast is sound (e.g. \"variance erasure\", \"runtime narrowed via\n * _tag check\", \"Object.keys is string[]\"). Audit by grepping for\n * `unsafeCoerce(` and reading the reasons.\n *\n * For values crossing a trust boundary (external command output, file\n * contents, network payloads), prefer `boundary` from\n * `@konfig.ts/core/boundary` — it produces a `BoundaryDecodeError`\n * instead of silently accepting the claim.\n *\n * The `reason` parameter is intentionally not used at runtime; it\n * documents intent for readers and audits.\n */\n// oxlint-disable-next-line app/no-type-assertion app/no-multiple-function-params\nexport const unsafeCoerce = <T>(value: unknown, _reason: string): T => value as T\n","import { Data } from \"effect\"\n\nexport class RenderError extends Data.TaggedError(\"RenderError\")<{\n readonly message: string\n readonly cause?: unknown\n}> {}\n\nexport class EmbedYamlReadError extends Data.TaggedError(\"EmbedYamlReadError\")<{\n readonly path: string\n readonly cause: unknown\n}> {}\n\nexport class BoundaryDecodeError extends Data.TaggedError(\"BoundaryDecodeError\")<{\n readonly schema: string\n readonly cause: unknown\n}> {}\n\nexport class HelmVersionTooLow extends Data.TaggedError(\"HelmVersionTooLow\")<{\n readonly required: string\n readonly found: string\n}> {\n get message(): string {\n return `Helm CLI too old: requires >= ${this.required}, found ${this.found}`\n }\n}\n\nexport class HelmRenderError extends Data.TaggedError(\"HelmRenderError\")<{\n readonly chart: string\n readonly version: string\n readonly cause: unknown\n}> {}\n\nexport class HelmDigestMismatch extends Data.TaggedError(\"HelmDigestMismatch\")<{\n readonly chart: string\n readonly version: string\n readonly expected: string\n readonly actual: string\n}> {\n get message(): string {\n return `Helm chart ${this.chart}@${this.version} digest mismatch: expected ${this.expected}, got ${this.actual}`\n }\n}\n\nexport class CrdExtractError extends Data.TaggedError(\"CrdExtractError\")<{\n readonly chart: string\n readonly cause: unknown\n}> {}\n\nexport type AnyRenderError =\n | RenderError\n | EmbedYamlReadError\n | BoundaryDecodeError\n | HelmVersionTooLow\n | HelmRenderError\n | HelmDigestMismatch\n | CrdExtractError\n","import { Effect, Schema } from \"effect\";\nimport { BoundaryDecodeError } from \"./RenderError\";\n\nexport interface BoundaryInput<S extends Schema.Top> {\n\treadonly schema: S;\n\treadonly label?: string;\n}\nexport const boundary =\n\t<S extends Schema.Top>(input: BoundaryInput<S>) =>\n\t(value: unknown): Effect.Effect<S[\"Type\"], BoundaryDecodeError, S[\"DecodingServices\"]> =>\n\t\tSchema.decodeUnknownEffect(input.schema)(value).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew BoundaryDecodeError({\n\t\t\t\t\t\tschema: input.label ?? \"boundary\",\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n","import { type Effect, Layer } from \"effect\";\nimport { unsafeCoerce } from \"./_cast\";\nimport type { Need } from \"./deps\";\nimport type { RenderServices } from \"./Manifest\";\nimport type { AnyRenderError } from \"./RenderError\";\n\n/**\n * The minimal shape `composeLayers` and the residual fold need: anything\n * with a `.layer` field of the standard `(Out, AnyRenderError, In)`\n * triple. Each runtime (argocd `ApplicationHandle`, k8s `BundleHandle`,\n * …) supplies its own wider handle interface — the carried value type\n * is irrelevant to the fold itself.\n */\n// oxlint-disable-next-line app/no-type-assertion\nexport interface ComposeHandle<Out = any, In = any> {\n\treadonly layer: Layer.Layer<Out, AnyRenderError, In>;\n}\n\n// `any` in the AnyHandle upper bound: Effect's Layer is contravariant in\n// its first parameter and `ComposeHandle` is invariant at the inference\n// site. `unknown` rejects concrete subtypes; `any` is bivariant — the\n// canonical \"any handle\" upper bound.\n// oxlint-disable-next-line app/no-type-assertion\ntype AnyHandle = ComposeHandle<any, any>;\n\n// oxlint-disable-next-line app/no-type-assertion\ntype OutOfHandle<H> = H extends ComposeHandle<infer Out, any> ? Out : never;\n// oxlint-disable-next-line app/no-type-assertion\ntype InOfHandle<H> = H extends ComposeHandle<any, infer In> ? In : never;\n\n/**\n * Left-fold over the modules tuple, mirroring the runtime\n * `reduce(Layer.provideMerge)` below. Each module's `In` is filtered\n * against the union of every *prior* module's `Out`; whatever survives\n * is residual. Tuple order matters: a consumer listed before its\n * provider leaves its Need in the residual.\n */\ntype FoldResidualIn<\n\tT extends ReadonlyArray<AnyHandle>,\n\tAccIn,\n\tAccOut,\n> = T extends readonly [infer H, ...infer Rest]\n\t? H extends AnyHandle\n\t\t? Rest extends ReadonlyArray<AnyHandle>\n\t\t\t? FoldResidualIn<\n\t\t\t\t\tRest,\n\t\t\t\t\tAccIn | Exclude<InOfHandle<H>, AccOut>,\n\t\t\t\t\tAccOut | OutOfHandle<H>\n\t\t\t\t>\n\t\t\t: never\n\t\t: never\n\t: AccIn;\n\n/**\n * After folding `Layer.provideMerge` over `Ms` in tuple order, the\n * leftover `RIn` channel — the Needs that no preceding module's Out\n * satisfies. Pair with `makeResidualEntrypoint` to surface a non-empty\n * residual as a compile error at the entrypoint call site.\n */\nexport type ResidualIn<T extends ReadonlyArray<AnyHandle>> = FoldResidualIn<T, never, never>;\n\n/**\n * Runtime layer composition — `reduce(Layer.provideMerge)`. Each\n * successive module receives every prior module's Out as available\n * services. The runtime type collapses to a bottom Layer; the per-module\n * Out/In is tracked statically by `ResidualIn`.\n */\nexport const composeLayers = (\n\tmodules: ReadonlyArray<{ readonly layer: unknown }>,\n): Layer.Layer<never, AnyRenderError, never> => {\n\ttype AnyLayer = Layer.Layer<never, AnyRenderError, never>;\n\treturn modules.reduce<AnyLayer>(\n\t\t(acc, mod) =>\n\t\t\tunsafeCoerce<AnyLayer>(\n\t\t\t\tLayer.provideMerge(\n\t\t\t\t\tunsafeCoerce<AnyLayer>(\n\t\t\t\t\t\tmod.layer,\n\t\t\t\t\t\t\"handle.layer carries its narrow type at the call site; the fold collapses to AnyLayer here\",\n\t\t\t\t\t),\n\t\t\t\t\tacc,\n\t\t\t\t),\n\t\t\t\t\"Layer.provideMerge's return type is per-call; the fold accumulator stays AnyLayer\",\n\t\t\t),\n\t\tunsafeCoerce<AnyLayer>(\n\t\t\tLayer.empty,\n\t\t\t\"Layer.empty has type Layer<never, never, never>; widening to AnyLayer is a no-op at runtime\",\n\t\t),\n\t);\n};\n\n/**\n * Per-Need template-literal hint shown when a residual reaches the\n * entrypoint. `Api` is the calling API's name (\"AppOfApps.fromModules\",\n * \"Bundle.fromModules\", …) so the message points the user at the right\n * call site.\n */\ntype UnsatisfiedHint<R, Api extends string> = R extends Need<infer K, infer V>\n\t? `Missing provider for ${K} \"${V}\". Add a module that provides it to ${Api}({ modules }), or check that providers come before consumers in the list.`\n\t: \"Unsatisfied dep — see the Effect Layer error above.\";\n\n/**\n * Intersects the program type with a phantom `_konfig_unsatisfied`\n * object when the residual `R` carries anything beyond\n * `Manifest.RenderServices`. The program has no such property at runtime,\n * so the call fails to typecheck and the user sees the hint.\n */\ntype ResidualHintCheck<R, Api extends string> =\n\t[Exclude<R, RenderServices>] extends [never]\n\t\t? unknown\n\t\t: {\n\t\t\t\treadonly _konfig_unsatisfied: UnsatisfiedHint<\n\t\t\t\t\tExclude<R, RenderServices>,\n\t\t\t\t\tApi\n\t\t\t\t>;\n\t\t\t};\n\n/**\n * Build an `entrypoint` function bound to a specific API name. The\n * returned function accepts only programs whose `R` channel reduces to\n * `Manifest.RenderServices`; otherwise the call fails at the program\n * argument with a `_konfig_unsatisfied` hint that names the missing\n * provider and the calling API.\n */\nexport const makeResidualEntrypoint =\n\t<const Api extends string>(_api: Api) =>\n\t<A, E, R>(\n\t\tprogram: Effect.Effect<A, E, R> & ResidualHintCheck<R, Api>,\n\t): Effect.Effect<A, E, R & RenderServices> =>\n\t\tunsafeCoerce<Effect.Effect<A, E, R & RenderServices>>(\n\t\t\tprogram,\n\t\t\t\"ResidualHintCheck is a phantom intersection; once the call typechecks, the runtime value is the original Effect\",\n\t\t);\n","import { Context, Layer, type Redacted } from \"effect\";\nimport { brand } from \"./_cast\";\n\n\ndeclare const NeedBrand: unique symbol;\nexport interface Need<K extends string, N extends string> {\n\treadonly [NeedBrand]: { readonly kind: K; readonly name: N };\n}\nexport type Provide<K extends string, N extends string> = Need<K, N>;\n\ndeclare const SecretRefBrand: unique symbol;\ndeclare const ConfigMapRefBrand: unique symbol;\ndeclare const ServiceAccountRefBrand: unique symbol;\ndeclare const PvcRefBrand: unique symbol;\ndeclare const BuiltImageRefBrand: unique symbol;\n\n/**\n * Nominal reference to a named Secret. `N` brands the secret's metadata\n * name; `K` (defaults to `string`) brands the union of declared data\n * keys, so consumers like `secretEnv({ ref, key })` can constrain `key`\n * to keys that actually exist; `Ns` (defaults to `string`) brands the\n * secret's owning namespace, so pod-context consumers (like\n * `secretEnvForPod`) can reject refs from a different namespace at\n * compile time — eliminating the runtime \"secret not found across\n * namespaces\" failure mode.\n */\nexport type SecretRef<\n\tN extends string,\n\tK extends string = string,\n\tNs extends string = string,\n> = string & {\n\treadonly [SecretRefBrand]: {\n\t\treadonly name: N;\n\t\treadonly keys: K;\n\t\treadonly namespace: Ns;\n\t};\n};\n/**\n * Nominal reference to a named ConfigMap. `N` brands the metadata name;\n * `K` (defaults to `string`) brands the union of declared data keys, so\n * `configMapEnv({ ref, key })` can constrain `key` to keys that actually\n * exist on the map. Producers (e.g. `ConfigMap.make`) populate `K` from\n * the literal `data` (or `binaryData`) record keys.\n */\nexport type ConfigMapRef<N extends string, K extends string = string> = string & {\n\treadonly [ConfigMapRefBrand]: { readonly name: N; readonly keys: K };\n};\nexport type ServiceAccountRef<N extends string> = string & {\n\treadonly [ServiceAccountRefBrand]: N;\n};\nexport type PvcRef<N extends string> = string & {\n\treadonly [PvcRefBrand]: N;\n};\n\n/**\n * Nominal reference to a container image built in-tree. Runtime value\n * is the full image ref (`registry/app:tag`) — a string, so K8s YAML\n * serializes it directly. The phantom `App` brand carries the literal\n * app name and ties the ref to the dep graph via `Dep.Image`.\n *\n * Container `image` fields accept either a raw string (escape hatch\n * for vendor images: `ghcr.io/bitnami/postgresql:16.0.0`) or\n * `BuiltImageRef<App>`. The branded path catches a workload whose\n * build module is missing from the composition at `AppOfApps.entrypoint`.\n */\nexport type BuiltImageRef<App extends string> = string & {\n\treadonly [BuiltImageRefBrand]: App;\n};\n\nexport type BuiltImageRefApp<R> = R extends BuiltImageRef<infer App> ? App : never;\n\nexport type SecretRefName<R> = R extends SecretRef<infer N, infer _K, infer _Ns> ? N : never;\nexport type SecretRefKeys<R> = R extends SecretRef<infer _N, infer K, infer _Ns> ? K : never;\nexport type SecretRefNamespace<R> = R extends SecretRef<infer _N, infer _K, infer Ns>\n\t? Ns\n\t: never;\nexport type ConfigMapRefName<R> = R extends ConfigMapRef<infer N, infer _K> ? N : never;\nexport type ConfigMapRefKeys<R> = R extends ConfigMapRef<infer _N, infer K> ? K : never;\nexport type PvcRefName<R> = R extends PvcRef<infer N> ? N : never;\n\nexport const Secret = <\n\tN extends string,\n\tK extends string = string,\n\tNs extends string = string,\n>(\n\tname: N,\n): Context.Service<Need<\"Secret\", N>, SecretRef<N, K, Ns>> =>\n\tContext.Service<Need<\"Secret\", N>, SecretRef<N, K, Ns>>(`Secret:${name}`);\n\nexport type SecretValuesRecord<K extends string> = {\n\treadonly [P in K]: Redacted.Redacted<string>;\n};\n\nexport const SecretValues = <N extends string, K extends string = string>(\n\tname: N,\n): Context.Service<Need<\"SecretValues\", N>, SecretValuesRecord<K>> =>\n\tContext.Service<Need<\"SecretValues\", N>, SecretValuesRecord<K>>(`SecretValues:${name}`);\n\nexport const ConfigMap = <N extends string, K extends string = string>(\n\tname: N,\n): Context.Service<Need<\"ConfigMap\", N>, ConfigMapRef<N, K>> =>\n\tContext.Service<Need<\"ConfigMap\", N>, ConfigMapRef<N, K>>(`ConfigMap:${name}`);\n\nexport const Namespace = <N extends string>(name: N): Context.Service<Need<\"Namespace\", N>, N> =>\n\tContext.Service<Need<\"Namespace\", N>, N>(`Namespace:${name}`);\n\nexport const ServiceAccount = <N extends string>(\n\tname: N,\n): Context.Service<Need<\"ServiceAccount\", N>, ServiceAccountRef<N>> =>\n\tContext.Service<Need<\"ServiceAccount\", N>, ServiceAccountRef<N>>(`ServiceAccount:${name}`);\n\nexport const Application = <N extends string>(\n\tname: N,\n): Context.Service<Need<\"Application\", N>, N> =>\n\tContext.Service<Need<\"Application\", N>, N>(`Application:${name}`);\n\nexport const Pvc = <N extends string>(name: N): Context.Service<Need<\"Pvc\", N>, PvcRef<N>> =>\n\tContext.Service<Need<\"Pvc\", N>, PvcRef<N>>(`Pvc:${name}`);\n\nexport const App = <N extends string, S = unknown>(name: N): Context.Service<Need<\"App\", N>, S> =>\n\tContext.Service<Need<\"App\", N>, S>(`App:${name}`);\n\n/**\n * Context.Service tag for a `BuiltImageRef<App>`. Modules that build an\n * image emit a Layer providing this service; modules that deploy a\n * container yield `Dep.Image(app)` to receive the typed ref. The\n * dep-graph residual at `AppOfApps.entrypoint` catches a missing\n * provider exactly like for `Dep.Secret`.\n */\nexport const Image = <N extends string>(\n\tname: N,\n): Context.Service<Need<\"Image\", N>, BuiltImageRef<N>> =>\n\tContext.Service<Need<\"Image\", N>, BuiltImageRef<N>>(`Image:${name}`);\n\ninterface _ImageRefInput<App extends string> {\n\treadonly app: App;\n\treadonly registry: string;\n\treadonly tag: string;\n}\n\nconst _fullRef = <App extends string>(input: _ImageRefInput<App>): BuiltImageRef<App> =>\n\tbrand<BuiltImageRef<App>>(`${input.registry}/${input.app}:${input.tag}`);\n\n/**\n * `BuiltImageRef` value namespace.\n *\n * const apiImage = BuiltImageRef.of({\n * app: \"api\",\n * registry: \"ghcr.io/example\",\n * tag: \"1.0.0\",\n * });\n *\n * `BuiltImageRef.of` constructs the brand from registry + app + tag.\n * The literal `app` is captured in the brand so a workload's\n * `Dep.Need<\"Image\", App>` matches only the build module that\n * provides this exact app.\n */\nexport const BuiltImageRef = {\n\tof: <const App extends string>(input: _ImageRefInput<App>): BuiltImageRef<App> =>\n\t\t_fullRef(input),\n};\n\n/**\n * Layer providing `Dep.Image(App)` for downstream consumers. Combine\n * with `Application.define` / `Module.fixedNs`'s `provides` slot to\n * have a build module surface its image to sibling workload modules\n * in the composition.\n */\nexport const provideImage = <const App extends string>(\n\tinput: _ImageRefInput<App>,\n): Layer.Layer<Provide<\"Image\", App>> => Layer.succeed(Image(input.app))(_fullRef(input));\n\nexport const provideSecret = <\n\tconst N extends string,\n\tconst K extends string = string,\n\tconst Ns extends string = string,\n>(\n\tname: N,\n): Layer.Layer<Provide<\"Secret\", N>> =>\n\tLayer.succeed(Secret<N, K, Ns>(name))(brand<SecretRef<N, K, Ns>>(name));\n\nexport const provideConfigMap = <const N extends string, const K extends string = string>(\n\tname: N,\n): Layer.Layer<Provide<\"ConfigMap\", N>> =>\n\tLayer.succeed(ConfigMap<N, K>(name))(brand<ConfigMapRef<N, K>>(name));\n\nexport const provideNamespace = <const N extends string>(\n\tname: N,\n): Layer.Layer<Provide<\"Namespace\", N>> => Layer.succeed(Namespace(name))(name);\n\nexport const provideServiceAccount = <const N extends string>(\n\tname: N,\n): Layer.Layer<Provide<\"ServiceAccount\", N>> =>\n\tLayer.succeed(ServiceAccount(name))(brand<ServiceAccountRef<N>>(name));\n\nexport const provideApplication = <const N extends string>(\n\tname: N,\n): Layer.Layer<Provide<\"Application\", N>> => Layer.succeed(Application(name))(name);\n\nexport const providePvc = <const N extends string>(name: N): Layer.Layer<Provide<\"Pvc\", N>> =>\n\tLayer.succeed(Pvc(name))(brand<PvcRef<N>>(name));\n","import { unsafeCoerce } from \"./_cast\";\nimport * as Compose from \"./Compose\";\nimport * as Dep from \"./deps\";\nimport type * as CoreManifest from \"./Manifest\";\nimport type * as Module from \"./Module\";\nimport type { AnyRenderError } from \"./RenderError\";\nimport { type Context, Effect, Layer } from \"effect\";\n\n/**\n * Mutate-attach a `.layer` field to an Effect Context.Tag — same pattern\n * `argocd/Application.ts:_attachLayerToTag` uses. A single unsafe cast\n * in the dep-graph machinery; lives here so the rest of Bundle stays\n * cast-free.\n */\nconst _attachLayerToTag = <Tag extends object, Out, Err, In>(\n\ttag: Tag,\n\tlayer: Layer.Layer<Out, Err, In>,\n): Tag & { readonly layer: Layer.Layer<Out, Err, In> } =>\n\tunsafeCoerce<Tag & { readonly layer: Layer.Layer<Out, Err, In> }>(\n\t\tObject.assign(tag, { layer }),\n\t\t\"Effect Context.Tag is callable + extensible; Object.assign mutates in place and the cast widens the public type\",\n\t);\n\nexport interface Bundle {\n\treadonly name: string;\n\treadonly namespace?: string;\n\treadonly manifests: ReadonlyArray<unknown>;\n}\n\nexport interface BundleMakeOptions {\n\treadonly name: string;\n\treadonly namespace?: string;\n\treadonly manifests: ReadonlyArray<unknown>;\n}\n\nexport const make = (opts: BundleMakeOptions): Bundle => ({\n\tname: opts.name,\n\tmanifests: opts.manifests,\n\t...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),\n});\n\n/**\n * Handle returned by `Bundle.define`. Same yieldable-Context-Tag +\n * `.layer` pattern as argocd's `ApplicationHandle`; only the carried\n * value type differs (a plain `Bundle` with no argo source/syncPolicy).\n * `Dep.Need<\"App\", Name>` keys the dep graph by literal name so\n * sibling modules can `yield* bundleHandle` to consume it.\n */\nexport interface BundleHandle<Name extends string, Out, In>\n\textends Context.Service<Dep.Need<\"App\", Name>, Bundle> {\n\treadonly layer: Layer.Layer<Out, AnyRenderError, In>;\n}\n\n/**\n * Higher-kinded handle constructor that maps `Module`'s\n * `(Name, Ns, R, Extra)` slots onto a `BundleHandle`. Lets\n * `Module.fixedNs({ target: Bundle.target, … })` /\n * `Module.dynamicNs({ target: Bundle.target, … })` return\n * strongly-typed `BundleHandle`s.\n */\nexport interface HandleKind extends Module.HandleKind {\n\treadonly Handle: BundleHandle<\n\t\tthis[\"_Name\"] & string,\n\t\t| Dep.Provide<\"App\", this[\"_Name\"] & string>\n\t\t| Dep.Provide<\"Namespace\", this[\"_Ns\"] & string>\n\t\t| (this[\"_Extra\"] & unknown),\n\t\tExclude<\n\t\t\tthis[\"_R\"] & unknown,\n\t\t\t| Dep.Need<\"Namespace\", this[\"_Ns\"] & string>\n\t\t\t| (this[\"_Extra\"] & unknown)\n\t\t>\n\t>;\n}\n\n/**\n * Re-export of {@link Module.LiteralName} — preserved as\n * `Bundle.LiteralName` so existing wrapper code keeps working.\n * konfig's dep graph keys every `Provide<\"App\", Name>` slot by literal\n * `Name`; a wrapper that lets `Name` widen to `string` collapses every\n * bundle into the same slot.\n */\nexport type LiteralName<T extends string> = Module.LiteralName<T>;\n\nexport interface BundleDefineOptions<\n\tName extends string,\n\tNs extends string,\n\tR,\n\tExtra,\n> {\n\treadonly name: LiteralName<Name>;\n\treadonly namespace?: LiteralName<Ns>;\n\treadonly build:\n\t\t| Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R>\n\t\t| (() => ReadonlyArray<unknown>);\n\treadonly provides?: Layer.Layer<Extra>;\n}\n\ntype _NsProvides<Ns extends string> = [Ns] extends [never]\n\t? never\n\t: Dep.Provide<\"Namespace\", Ns>;\n\ntype _NsExcludes<Ns extends string> = [Ns] extends [never]\n\t? never\n\t: Dep.Need<\"Namespace\", Ns>;\n\n/**\n * Build a typed handle for a manifest bundle — a name + optional\n * namespace + a set of manifests, plus dep-graph wiring. Same\n * compile-time guarantees as argocd's `Application.define` minus\n * `source: ArgoSource` / `syncPolicy` / sync-wave annotations:\n * - the literal `Name` flows into `Dep.Provide<\"App\", Name>`,\n * - the optional literal namespace flows into `Dep.Provide<\"Namespace\", Ns>`,\n * - the build callback's `R` channel becomes the handle's `In` after\n * subtracting what this bundle provides itself.\n *\n * Pair with `Bundle.fromModules` to compose multiple bundles\n * and have the dep-graph residual checked at `Bundle.entrypoint`.\n *\n * For `Module.fixedNs` / `Module.dynamicNs` use, see `Bundle.target`\n * — it adapts this `define` so namespace is required (Module wrappers\n * always thread a namespace through), which lets the dep-graph drop\n * the `Provide<\"Namespace\", never>` cell the optional shape needs.\n */\nexport const define = <\n\tconst Name extends string,\n\tconst Ns extends string = never,\n\tR = never,\n\tExtra = never,\n>(\n\topts: BundleDefineOptions<Name, Ns, R, Extra>,\n): BundleHandle<\n\tName,\n\tDep.Provide<\"App\", Name> | _NsProvides<Ns> | Extra,\n\tExclude<R, _NsExcludes<Ns> | Extra>\n> => {\n\tconst name = unsafeCoerce<Name>(\n\t\topts.name,\n\t\t\"LiteralName<Name> resolves to Name itself once the call typechecks\",\n\t);\n\tconst namespace =\n\t\topts.namespace === undefined\n\t\t\t? undefined\n\t\t\t: unsafeCoerce<Ns>(\n\t\t\t\t\topts.namespace,\n\t\t\t\t\t\"LiteralName<Ns> resolves to Ns itself once the call typechecks\",\n\t\t\t\t);\n\n\tconst tag = Dep.App<Name, Bundle>(name);\n\n\tconst nsLayer =\n\t\tnamespace === undefined\n\t\t\t? Layer.empty\n\t\t\t: Layer.succeed(Dep.Namespace(namespace))(namespace);\n\n\tconst internalLayer =\n\t\topts.provides !== undefined ? Layer.mergeAll(nsLayer, opts.provides) : nsLayer;\n\n\tconst buildEffect: Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R> =\n\t\tEffect.isEffect(opts.build) ? opts.build : Effect.sync(opts.build);\n\n\tconst bundleLayer = Layer.effect(\n\t\ttag,\n\t\tbuildEffect.pipe(\n\t\t\tEffect.map((manifests) =>\n\t\t\t\tmake({\n\t\t\t\t\tname,\n\t\t\t\t\t...(namespace !== undefined ? { namespace } : {}),\n\t\t\t\t\tmanifests,\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t).pipe(Layer.provide(internalLayer));\n\n\tconst layer =\n\t\topts.provides !== undefined\n\t\t\t? Layer.mergeAll(bundleLayer, nsLayer, opts.provides)\n\t\t\t: Layer.mergeAll(bundleLayer, nsLayer);\n\n\treturn unsafeCoerce<\n\t\tBundleHandle<\n\t\t\tName,\n\t\t\tDep.Provide<\"App\", Name> | _NsProvides<Ns> | Extra,\n\t\t\tExclude<R, _NsExcludes<Ns> | Extra>\n\t\t>\n\t>(\n\t\t_attachLayerToTag(tag, layer),\n\t\t\"narrow generic BundleHandle from the attachLayerToTag helper's loose Tag arg\",\n\t);\n};\n\n/**\n * `Module.Target` adapter for `Bundle.define`. `Module.fixedNs` /\n * `Module.dynamicNs` always pass a namespace through, so this adapter\n * requires `namespace` (whereas `Bundle.define` itself accepts it as\n * optional) — pinning `Ns` to a real literal lets the dep-graph emit\n * a concrete `Provide<\"Namespace\", Ns>` cell on the resulting handle.\n *\n * ```ts\n * const defineCache = Module.fixedNs({\n * target: Bundle.target,\n * namespace: \"cache\",\n * build: ({ name, namespace }) => [ ... ],\n * });\n * ```\n */\nexport const target: Module.Target<HandleKind, Record<never, never>, Record<never, never>> = {\n\tdefine: <const Name extends string, const Ns extends string, R = never, Extra = never>(\n\t\targs: Module.DefineBaseArgs<Name, Ns, R, Extra>,\n\t) =>\n\t\tunsafeCoerce<Module.ApplyHandle<HandleKind, Name, Ns, R, Extra>>(\n\t\t\tdefine<Name, Ns, R, Extra>(args),\n\t\t\t\"target requires namespace so Ns is always a string literal; under that constraint Bundle.define's _NsProvides<Ns> reduces to Provide<\\\"Namespace\\\", Ns>, matching HandleKind\",\n\t\t),\n};\n\nexport interface BundleSetResult {\n\treadonly name: string;\n\treadonly bundles: ReadonlyArray<Bundle>;\n}\n\nexport interface BundleSetMakeOptions {\n\treadonly name?: string;\n\treadonly bundles: ReadonlyArray<Bundle>;\n}\n\nexport const makeSet = (opts: BundleSetMakeOptions): BundleSetResult => ({\n\tname: opts.name ?? \"bundles\",\n\tbundles: opts.bundles,\n});\n\n/**\n * Phantom check that rejects a `Bundle.fromModules` program whose `R`\n * channel still carries unmet dep-graph Needs. Bound to the\n * \"Bundle.fromModules\" API label so the `_konfig_unsatisfied` hint\n * guides the user to the right call site.\n */\nexport const entrypoint = Compose.makeResidualEntrypoint(\"Bundle.fromModules\");\n\n// `any` in the AnyHandle upper bound: Effect's Layer is contravariant in\n// its first parameter and `BundleHandle` is invariant at the inference\n// site. `unknown` rejects concrete subtypes; `any` is bivariant — the\n// canonical \"any handle\" upper bound.\n// oxlint-disable-next-line app/no-type-assertion\ntype AnyHandle = BundleHandle<any, any, any>;\n\nexport type ResidualIn<T extends ReadonlyArray<AnyHandle>> = Compose.ResidualIn<T>;\n\nexport interface FromModulesOptions<Ms extends ReadonlyArray<AnyHandle>> {\n\treadonly name?: string;\n\treadonly modules: Ms;\n}\n\n/**\n * One-list composition for a backend-agnostic bundle set. Yields each\n * module's `Bundle` in tuple order, then wires the merged provider layer\n * with `Compose.composeLayers`. The returned Effect's R channel is the\n * residual unmet Needs after the fold (`Compose.ResidualIn<Ms>`),\n * which `entrypoint` rejects unless empty.\n *\n * **Order matters.** List providers before their consumers. A consumer\n * placed before its provider leaves an unmet `Need` in the residual,\n * which surfaces at `entrypoint` as a `_konfig_unsatisfied` hint.\n */\nexport const fromModules = <const Ms extends ReadonlyArray<AnyHandle>>(\n\topts: FromModulesOptions<Ms>,\n): Effect.Effect<\n\tBundleSetResult,\n\tAnyRenderError,\n\tResidualIn<Ms> | CoreManifest.RenderServices\n> => {\n\tconst program = Effect.gen(function* () {\n\t\tconst bundles: Bundle[] = [];\n\t\tfor (const mod of opts.modules) {\n\t\t\tconst b = yield* mod;\n\t\t\tbundles.push(b);\n\t\t}\n\t\treturn makeSet({ name: opts.name, bundles });\n\t});\n\n\tconst wired = Compose.composeLayers(opts.modules);\n\n\treturn unsafeCoerce<\n\t\tEffect.Effect<\n\t\t\tBundleSetResult,\n\t\t\tAnyRenderError,\n\t\t\tResidualIn<Ms> | CoreManifest.RenderServices\n\t\t>\n\t>(\n\t\tEffect.provide(program, wired),\n\t\t\"the runtime Effect is the same; only the static R channel is narrowed to ResidualIn<Ms> by the fold-as-type\",\n\t);\n};\n","import * as YAML from \"yaml\"\nimport { unsafeCoerce } from \"./_cast\"\n\nconst IGNORED_LABEL_KEYS = new Set([\"helm.sh/chart\"])\nconst IGNORED_ANNOTATION_KEYS = new Set([\n \"meta.helm.sh/release-name\",\n \"meta.helm.sh/release-namespace\"\n])\nconst MANAGED_BY_HELM_LABEL = \"app.kubernetes.io/managed-by\"\n\nconst _redactLabelMap = (labels: Record<string, unknown>): Record<string, unknown> => {\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(labels)) {\n if (IGNORED_LABEL_KEYS.has(k)) continue\n if (k === MANAGED_BY_HELM_LABEL && v === \"Helm\") continue\n out[k] = v\n }\n return out\n}\n\nconst _redactAnnotationMap = (annotations: Record<string, unknown>): Record<string, unknown> => {\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(annotations)) {\n if (IGNORED_ANNOTATION_KEYS.has(k)) continue\n out[k] = v\n }\n return out\n}\n\nexport interface RedactOptions {\n /**\n * Normalize numeric strings: `\"1.0\"` compares equal to `1`,\n * `\"true\"` stays a string (only numerics are normalized). Useful for\n * Helm-templated manifests where some fields get stringified.\n */\n readonly normalizeNumerics?: boolean\n}\n\nconst _isNumericString = (s: string): boolean => /^-?\\d+(\\.\\d+)?(e[-+]?\\d+)?$/i.test(s)\n\nexport interface RedactInput {\n readonly value: unknown\n readonly parentKey?: string | null\n readonly options?: RedactOptions\n}\n\n/**\n * Canonicalize a parsed YAML/JSON value for structural comparison,\n * applying two normalizations:\n *\n * 1. **Null/undefined keys are dropped.** Any object key whose value is\n * `null` or `undefined` is omitted from the redacted output. This is\n * deliberate: it makes an *explicit* `field: null` compare equal to\n * an *absent* `field`, which is what we want when diffing manifests\n * where one side spells out a null default the other side simply\n * omits. The trade-off is that a genuine \"field was set to null vs.\n * field removed\" distinction is intentionally invisible to the diff.\n * 2. **Numeric normalization** (opt-in via\n * {@link RedactOptions.normalizeNumerics}) — see that field.\n *\n * Helm metadata redaction (dropping chart-churn labels/annotations) is\n * layered on top when a `labels`/`annotations` map appears under\n * `metadata`.\n */\nexport const redact = (input: RedactInput): unknown => {\n const value = input.value\n const parentKey = input.parentKey ?? null\n const options = input.options ?? {}\n if (Array.isArray(value)) {\n return value.map((v) => redact({ value: v, parentKey: null, options }))\n }\n if (value !== null && typeof value === \"object\") {\n const obj = unsafeCoerce<Record<string, unknown>>(\n value,\n \"typeof === object && !Array.isArray && !== null narrowed above\"\n )\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(obj)) {\n if (v === null || v === undefined) continue\n if (k === \"labels\" && parentKey === \"metadata\" && v !== null && typeof v === \"object\") {\n out[k] = _redactLabelMap(unsafeCoerce(v, \"metadata.labels is Record<string, string>\"))\n continue\n }\n if (k === \"annotations\" && parentKey === \"metadata\" && v !== null && typeof v === \"object\") {\n out[k] = _redactAnnotationMap(unsafeCoerce(v, \"metadata.annotations is Record<string, string>\"))\n continue\n }\n out[k] = redact({ value: v, parentKey: k, options })\n }\n return out\n }\n if (options.normalizeNumerics === true) {\n if (typeof value === \"string\" && _isNumericString(value)) {\n return Number(value)\n }\n if (typeof value === \"number\" && Number.isFinite(value)) {\n // 1.0 and 1 unify when round-tripping through Number().\n return value\n }\n }\n return value\n}\n\nexport interface DeepEqualInput {\n readonly a: unknown\n readonly b: unknown\n}\nexport const deepEqual = (input: DeepEqualInput): boolean => {\n const { a, b } = input\n if (a === b) return true\n if (a === null || b === null) return false\n if (typeof a !== typeof b) return false\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual({ a: a[i], b: b[i] })) return false\n }\n return true\n }\n if (typeof a === \"object\" && typeof b === \"object\") {\n const ka = Object.keys(unsafeCoerce<object>(a, \"typeof === object branch\")).sort()\n const kb = Object.keys(unsafeCoerce<object>(b, \"typeof === object branch\")).sort()\n if (ka.length !== kb.length) return false\n for (let i = 0; i < ka.length; i++) if (ka[i] !== kb[i]) return false\n for (const k of ka) {\n const av = unsafeCoerce<Record<string, unknown>>(a, \"typeof === object branch\")[k]\n const bv = unsafeCoerce<Record<string, unknown>>(b, \"typeof === object branch\")[k]\n if (!deepEqual({ a: av, b: bv })) return false\n }\n return true\n }\n return false\n}\n\nexport const parseYaml = (text: string): unknown => YAML.parse(text)\n\n/**\n * Parse a multi-doc YAML file into an ordered list of documents. Each\n * document's parsed structure is preserved as-is. Empty / whitespace-only\n * segments are dropped, but their position is *not* preserved — only\n * present documents are returned. Use the returned index to identify\n * documents inside one file (alongside the filename) when reporting.\n */\nexport const parseYamlAll = (text: string): ReadonlyArray<unknown> => {\n const docs = YAML.parseAllDocuments(text)\n const out: unknown[] = []\n for (const d of docs) {\n const value = d.toJS()\n if (value === null || value === undefined) continue\n out.push(value)\n }\n return out\n}\n\n/**\n * Identifier for a document inside a multi-doc YAML file. We key by\n * (kind, name, namespace) when those fields are present so a\n * label-only edit on a Service inside a 12-doc file diffs against the\n * same-kind/name Service in the other side, regardless of position\n * shuffle.\n */\nconst _docKey = (value: unknown, fallbackIdx: number): string => {\n if (value === null || typeof value !== \"object\") return `:doc:${fallbackIdx}`\n const v = unsafeCoerce<\n { readonly kind?: unknown; readonly metadata?: { readonly name?: unknown; readonly namespace?: unknown } }\n >(\n value,\n \"typeof === object && !== null branch above narrowed value; every field access below is guarded by a typeof check\"\n )\n const kind = typeof v.kind === \"string\" ? v.kind : \"\"\n const name = typeof v.metadata?.name === \"string\" ? v.metadata.name : \"\"\n const ns = typeof v.metadata?.namespace === \"string\" ? v.metadata.namespace : \"\"\n if (kind || name) return `${kind}|${ns}|${name}`\n return `:doc:${fallbackIdx}`\n}\n\nexport type DocDiff =\n | { readonly _tag: \"Same\"; readonly key: string }\n | { readonly _tag: \"MissingLeft\"; readonly key: string; readonly right: unknown }\n | { readonly _tag: \"MissingRight\"; readonly key: string; readonly left: unknown }\n | {\n readonly _tag: \"Changed\"\n readonly key: string\n readonly left: unknown\n readonly right: unknown\n }\n\nexport type FileDiff =\n | { readonly _tag: \"Same\"; readonly file: string }\n | { readonly _tag: \"MissingLeft\"; readonly file: string }\n | { readonly _tag: \"MissingRight\"; readonly file: string }\n | {\n readonly _tag: \"Changed\"\n readonly file: string\n readonly left: unknown\n readonly right: unknown\n /** Per-document breakdown if the file holds a multi-doc YAML stream. */\n readonly docs?: ReadonlyArray<DocDiff>\n }\n\nexport interface DiffResult {\n readonly entries: ReadonlyArray<FileDiff>\n}\n\nexport interface DiffFilesInput {\n readonly left: Readonly<Record<string, string>>\n readonly right: Readonly<Record<string, string>>\n readonly options?: RedactOptions\n}\n\nconst _diffOne = (\n file: string,\n leftText: string,\n rightText: string,\n options: RedactOptions\n): FileDiff => {\n const lDocs = parseYamlAll(leftText).map((v, i) => [_docKey(v, i), redact({ value: v, options })] as const)\n const rDocs = parseYamlAll(rightText).map((v, i) => [_docKey(v, i), redact({ value: v, options })] as const)\n\n // Fast path: single doc on each side.\n if (lDocs.length <= 1 && rDocs.length <= 1) {\n const l = lDocs[0]?.[1]\n const r = rDocs[0]?.[1]\n if (deepEqual({ a: l, b: r })) return { _tag: \"Same\", file }\n return { _tag: \"Changed\", file, left: l, right: r }\n }\n\n const lByKey = new Map(lDocs)\n const rByKey = new Map(rDocs)\n const keys = Array.from(new Set([...lByKey.keys(), ...rByKey.keys()])).sort()\n\n const docs: DocDiff[] = []\n let anyChange = false\n for (const key of keys) {\n const l = lByKey.get(key)\n const r = rByKey.get(key)\n if (l === undefined) {\n docs.push({ _tag: \"MissingLeft\", key, right: r })\n anyChange = true\n } else if (r === undefined) {\n docs.push({ _tag: \"MissingRight\", key, left: l })\n anyChange = true\n } else if (deepEqual({ a: l, b: r })) {\n docs.push({ _tag: \"Same\", key })\n } else {\n docs.push({ _tag: \"Changed\", key, left: l, right: r })\n anyChange = true\n }\n }\n\n if (!anyChange) return { _tag: \"Same\", file }\n return {\n _tag: \"Changed\",\n file,\n left: lDocs.map((d) => d[1]),\n right: rDocs.map((d) => d[1]),\n docs\n }\n}\n\nexport const diffFiles = (input: DiffFilesInput): DiffResult => {\n const { left, right } = input\n const options = input.options ?? {}\n const files = Array.from(new Set([...Object.keys(left), ...Object.keys(right)])).sort()\n const entries: FileDiff[] = []\n for (const file of files) {\n const hasL = Object.hasOwn(left, file)\n const hasR = Object.hasOwn(right, file)\n if (!hasL) {\n entries.push({ _tag: \"MissingLeft\", file })\n continue\n }\n if (!hasR) {\n entries.push({ _tag: \"MissingRight\", file })\n continue\n }\n entries.push(_diffOne(file, left[file] ?? \"\", right[file] ?? \"\", options))\n }\n return { entries }\n}\n\nexport const hasDifferences = (result: DiffResult): boolean => result.entries.some((e) => e._tag !== \"Same\")\n\nexport type DiffFormat = \"summary\" | \"detail\" | \"json\"\n\nexport interface FormatDiffInput {\n readonly result: DiffResult\n readonly format?: DiffFormat\n}\nexport const formatDiff = (input: FormatDiffInput): string => {\n const { result } = input\n const format = input.format ?? \"summary\"\n if (format === \"json\") {\n return JSON.stringify(result, null, 2)\n }\n const changes = result.entries.filter((e) => e._tag !== \"Same\")\n if (changes.length === 0) return \"\"\n const lines: string[] = []\n for (const e of changes) {\n if (e._tag === \"MissingLeft\") lines.push(`+ ${e.file}`)\n else if (e._tag === \"MissingRight\") lines.push(`- ${e.file}`)\n else lines.push(`~ ${e.file}`)\n if (format === \"detail\" && e._tag === \"Changed\") {\n if (e.docs && e.docs.length > 0) {\n for (const d of e.docs) {\n if (d._tag === \"Same\") continue\n lines.push(` [doc ${d.key}] ${d._tag}`)\n if (d._tag === \"Changed\") {\n lines.push(\" left:\")\n lines.push(\n ...YAML.stringify(d.left, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n lines.push(\" right:\")\n lines.push(\n ...YAML.stringify(d.right, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n }\n }\n } else {\n lines.push(\" left:\")\n lines.push(\n ...YAML.stringify(e.left, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n lines.push(\" right:\")\n lines.push(\n ...YAML.stringify(e.right, { lineWidth: 0 })\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n )\n }\n }\n }\n return lines.join(\"\\n\")\n}\n","\nimport { Effect } from \"effect\";\nimport { FileSystem } from \"effect/FileSystem\";\nimport { unsafeCoerce } from \"./_cast\";\nimport type { Path } from \"effect/Path\";\nimport type * as Scope from \"effect/Scope\";\nimport type { ChildProcessSpawner } from \"./_unstable\";\nimport type { RenderContext } from \"./RenderContext\";\nimport { type AnyRenderError, EmbedYamlReadError } from \"./RenderError\";\n\nexport type RenderServices = FileSystem | Path | ChildProcessSpawner | Scope.Scope;\n\nexport const ManifestTypeId: unique symbol = Symbol.for(\"@konfig.ts/core/Manifest\");\nexport type ManifestTypeId = typeof ManifestTypeId;\n\ninterface Variance<out A> {\n\treadonly _A: (_: never) => A;\n}\n\nexport interface Manifest<out A> {\n\treadonly [ManifestTypeId]: Variance<A>;\n\treadonly render: (ctx: RenderContext) => Effect.Effect<A, AnyRenderError, RenderServices>;\n}\n\nconst variance: Variance<never> = {\n\t_A: (_: never) => _,\n};\n\nexport type MakeRun<A> = (\n\tctx: RenderContext,\n) => A | Effect.Effect<A, AnyRenderError, RenderServices>;\n\nexport const make = <A>(run: MakeRun<A>): Manifest<A> => ({\n\t[ManifestTypeId]: unsafeCoerce<Variance<A>>(variance, \"phantom variance witness — A only appears in covariant position\"),\n\trender: (ctx) => {\n\t\tconst result = run(ctx);\n\t\treturn Effect.isEffect(result)\n\t\t\t? unsafeCoerce<Effect.Effect<A, AnyRenderError, RenderServices>>(\n\t\t\t\t\tresult,\n\t\t\t\t\t\"Effect.isEffect narrowed `result` to an Effect; TS's narrowing doesn't carry the Effect's full type parameters\",\n\t\t\t\t)\n\t\t\t: Effect.succeed(result);\n\t},\n});\n\nexport interface CombineInput<A1, A2> {\n\treadonly a: Manifest<A1>;\n\treadonly b: Manifest<A2>;\n}\nexport const combine = <A1, A2>(input: CombineInput<A1, A2>): Manifest<readonly [A1, A2]> =>\n\tmake((ctx) => Effect.all([input.a.render(ctx), input.b.render(ctx)], { concurrency: \"unbounded\" }));\n\nexport const concat = <A>(...manifests: Manifest<A | A[]>[]): Manifest<A[]> =>\n\tmake((ctx) =>\n\t\tEffect.all(\n\t\t\tmanifests.map((m) => m.render(ctx)),\n\t\t\t{ concurrency: \"unbounded\" },\n\t\t).pipe(\n\t\t\tEffect.map((results) =>\n\t\t\t\tresults.flatMap((r) =>\n\t\t\t\t\tArray.isArray(r)\n\t\t\t\t\t\t? unsafeCoerce<A[]>(r, \"Array.isArray narrowed; element type is A by render contract\")\n\t\t\t\t\t\t: [unsafeCoerce<A>(r, \"non-array branch carries a single A\")],\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t);\n\nexport interface WheneverInput<A> {\n\treadonly cond: boolean;\n\treadonly thunk: () => Manifest<A>;\n}\nexport const whenever = <A>(input: WheneverInput<A>): Manifest<A | undefined> =>\n\tmake((ctx) =>\n\t\tinput.cond\n\t\t\t? input.thunk().render(ctx)\n\t\t\t: unsafeCoerce<Effect.Effect<A | undefined, AnyRenderError, RenderServices>>(\n\t\t\t\t\tEffect.succeed(undefined),\n\t\t\t\t\t\"undefined branch — A is the type seen by the consumer when cond=false\",\n\t\t\t\t),\n\t);\n\nexport type EmbedYamlSource = { readonly path: string } | { readonly literal: string };\n\nexport interface RawYaml {\n\treadonly _tag: \"RawYaml\";\n\treadonly content: string;\n\treadonly origin?: string;\n}\n\nexport const embedYaml = (source: EmbedYamlSource): Manifest<RawYaml> =>\n\tmake<RawYaml>((_ctx) => {\n\t\tif (\"literal\" in source) {\n\t\t\treturn Effect.succeed<RawYaml>({ _tag: \"RawYaml\", content: source.literal });\n\t\t}\n\t\tconst path = source.path;\n\t\treturn Effect.gen(function* () {\n\t\t\tconst fs = yield* FileSystem;\n\t\t\tconst content = yield* fs.readFileString(path);\n\t\t\treturn { _tag: \"RawYaml\" as const, content, origin: path };\n\t\t}).pipe(Effect.mapError((cause) => new EmbedYamlReadError({ path, cause })));\n\t});\n","import { Data, Effect, Stream } from \"effect\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"./_unstable\";\n\n/**\n * Exit code stamped on a `ProcessError` when the process never produced\n * one — i.e. the spawn itself failed (binary not found, EACCES, a stream\n * read error). Distinct from any real OS exit code.\n */\nconst SPAWN_FAILED_EXIT = -1;\n\n/**\n * Upper bound (in UTF-16 code units, a close proxy for bytes here) on the\n * stderr tail retained by `ProcessError` — roughly the last 2KB. Keeps a\n * failing command's diagnostics readable without pinning a runaway log in\n * memory or in the serialized error.\n */\nconst STDERR_TAIL_LIMIT = 2048;\n\nconst _tail = (text: string): string =>\n\ttext.length > STDERR_TAIL_LIMIT ? text.slice(text.length - STDERR_TAIL_LIMIT) : text;\n\nconst _commandLabel = (command: ChildProcess.Command): string =>\n\tChildProcess.isStandardCommand(command)\n\t\t? [command.command, ...command.args].join(\" \")\n\t\t: \"<pipeline>\";\n\n/**\n * Failure of a spawned subprocess: a non-zero exit, a spawn that never\n * started, or (for `runProcessString`) an empty stdout when a payload was\n * required. Carries the exit code and a bounded tail of stderr so callers\n * can surface a diagnostic without re-running the command.\n *\n * `command` is the program plus its already-parsed arguments; it must\n * never be interpolated with secret material by callers.\n */\nexport class ProcessError extends Data.TaggedError(\"ProcessError\")<{\n\treadonly command: string;\n\treadonly exitCode: number;\n\treadonly stderrTail: string;\n}> {\n\tget message(): string {\n\t\tconst tail = this.stderrTail.trim();\n\t\tconst suffix = tail.length > 0 ? `: ${tail}` : \"\";\n\t\treturn `command \\`${this.command}\\` failed (exit ${this.exitCode})${suffix}`;\n\t}\n}\n\ninterface _CollectedProcess {\n\treadonly exitCode: number;\n\treadonly stdout: string;\n\treadonly stderr: string;\n}\n\nconst _collect = (\n\tstream: Stream.Stream<Uint8Array, PlatformError>,\n): Effect.Effect<string, PlatformError> => Stream.mkString(Stream.decodeText(stream));\n\n/**\n * Spawn `command` exactly once and, concurrently, drain stdout and stderr\n * to strings while awaiting the exit code. Draining both pipes alongside\n * `exitCode` avoids the classic pipe-buffer deadlock. A spawn/stream\n * failure (PlatformError) is folded into a `ProcessError` so callers see a\n * single error channel.\n */\nconst _spawnCollect = (\n\tcommand: ChildProcess.Command,\n): Effect.Effect<_CollectedProcess, ProcessError, ChildProcessSpawner> =>\n\tEffect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tconst spawner = yield* ChildProcessSpawner;\n\t\t\tconst handle = yield* spawner.spawn(command);\n\t\t\tconst [exitCode, stdout, stderr] = yield* Effect.all(\n\t\t\t\t[handle.exitCode, _collect(handle.stdout), _collect(handle.stderr)],\n\t\t\t\t{ concurrency: \"unbounded\" },\n\t\t\t);\n\t\t\treturn { exitCode, stdout, stderr };\n\t\t}),\n\t).pipe(\n\t\tEffect.mapError(\n\t\t\t(cause) =>\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: SPAWN_FAILED_EXIT,\n\t\t\t\t\tstderrTail: _tail(String(cause)),\n\t\t\t\t}),\n\t\t),\n\t);\n\n/**\n * Run `command` and return its stdout, checking the exit code — the guard\n * that `spawner.string` omits. Fails with `ProcessError` (carrying the\n * stderr tail) on any non-zero exit. Unless `allowEmptyStdout` is `true`,\n * also fails when the trimmed stdout is empty, so a silently-failing\n * command can never masquerade as an empty-but-successful result.\n */\n// oxlint-disable-next-line app/no-multiple-function-params\nexport const runProcessString = (\n\tcommand: ChildProcess.Command,\n\toptions?: { readonly allowEmptyStdout?: boolean },\n): Effect.Effect<string, ProcessError, ChildProcessSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst result = yield* _spawnCollect(command);\n\t\tif (result.exitCode !== 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\tstderrTail: _tail(result.stderr),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tif (options?.allowEmptyStdout !== true && result.stdout.trim().length === 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\tstderrTail: _tail(result.stderr),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn result.stdout;\n\t});\n\n/**\n * Run `command` for its success/failure only — stdout is drained (to avoid\n * a pipe deadlock) but discarded. Fails with `ProcessError` on any\n * non-zero exit, attaching the stderr tail when present.\n */\nexport const runProcessExit = (\n\tcommand: ChildProcess.Command,\n): Effect.Effect<void, ProcessError, ChildProcessSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst result = yield* _spawnCollect(command);\n\t\tif (result.exitCode !== 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ProcessError({\n\t\t\t\t\tcommand: _commandLabel(command),\n\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\tstderrTail: _tail(result.stderr),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t});\n","import { Config, Effect } from \"effect\"\nimport { FileSystem } from \"effect/FileSystem\"\nimport { Path } from \"effect/Path\"\nimport * as YAML from \"yaml\"\nimport { unsafeCoerce } from \"./_cast\"\nimport { ChildProcess, ChildProcessSpawner } from \"./_unstable\"\nimport { parseYamlAll } from \"./diff\"\nimport { make, type Manifest, type RawYaml } from \"./Manifest\"\nimport { HelmDigestMismatch, HelmRenderError, HelmVersionTooLow } from \"./RenderError\"\nimport { runProcessExit, runProcessString } from \"./subprocess\"\n\nconst CLUSTER_SCOPED_KINDS: ReadonlySet<string> = new Set([\n \"APIService\",\n \"ClusterRole\",\n \"ClusterRoleBinding\",\n \"ComponentStatus\",\n \"CSIDriver\",\n \"CSINode\",\n \"CustomResourceDefinition\",\n \"FlowSchema\",\n \"IngressClass\",\n \"MutatingWebhookConfiguration\",\n \"Namespace\",\n \"Node\",\n \"PersistentVolume\",\n \"PodSecurityPolicy\",\n \"PriorityClass\",\n \"PriorityLevelConfiguration\",\n \"RuntimeClass\",\n \"StorageClass\",\n \"ValidatingAdmissionPolicy\",\n \"ValidatingAdmissionPolicyBinding\",\n \"ValidatingWebhookConfiguration\",\n \"VolumeAttachment\"\n])\n\nexport interface HelmReleaseOptions {\n readonly repo: string\n readonly chart: string\n readonly releaseName?: string\n readonly version: string\n readonly digest: string\n readonly namespace?: string\n readonly values: Record<string, unknown>\n readonly extraOpts?: readonly string[]\n /**\n * Minimum acceptable `helm` CLI version (semver, e.g. `\"3.16.0\"`).\n * When set, `release` runs a `helm version --short` preflight before\n * pulling/templating and fails with `HelmVersionTooLow` if the\n * installed helm is older (or absent). Omit to skip the check.\n */\n readonly minVersion?: string\n}\n\ninterface _ParseHelmOutputInput {\n readonly output: string\n readonly chart: string\n readonly version: string\n readonly namespace: string | undefined\n}\ninterface _ParsedDocShape {\n readonly kind?: string\n readonly metadata?: { readonly namespace?: string }\n}\n\nconst _asDocShape = (value: unknown): _ParsedDocShape | null =>\n value !== null && typeof value === \"object\"\n ? unsafeCoerce<_ParsedDocShape>(\n value,\n \"parseYamlAll returned a parsed document object; the kind/metadata reads below are each typeof-guarded\"\n )\n : null\n\n/**\n * Turn `helm template` stdout into individual `RawYaml` docs.\n *\n * Document boundaries come from the shared `parseYamlAll`\n * (`YAML.parseAllDocuments`) helper rather than a naive `/^---$/m` split,\n * so a `---` appearing inside a block scalar can't spuriously split one\n * manifest into two. `parseYamlAll` also drops empty / comment-only\n * segments for us.\n *\n * When a `namespace` is supplied, each namespaced-kind document that\n * lacks an explicit namespace is patched to carry it (the re-parse\n * branch behavior). Cluster-scoped kinds and documents that already pin\n * a namespace are left untouched.\n */\nconst _parseHelmOutput = (input: _ParseHelmOutputInput): Effect.Effect<RawYaml[]> =>\n Effect.sync(() => {\n const { output, chart, version, namespace } = input\n const origin = `helm:${chart}@${version}`\n const results: RawYaml[] = []\n for (const parsed of parseYamlAll(output)) {\n let value: unknown = parsed\n if (namespace !== undefined) {\n const shape = _asDocShape(parsed)\n if (\n shape !== null &&\n typeof shape.kind === \"string\" &&\n !CLUSTER_SCOPED_KINDS.has(shape.kind) &&\n (shape.metadata?.namespace === undefined || shape.metadata.namespace === \"\")\n ) {\n value = { ...shape, metadata: { ...shape.metadata, namespace } }\n }\n }\n let content = `---\\n${YAML.stringify(value, { lineWidth: 0 })}`\n if (!content.endsWith(\"\\n\")) content += \"\\n\"\n results.push({ _tag: \"RawYaml\", content, origin })\n }\n return results\n })\n\nconst _HELM_VERSION_RE = /v?(\\d+)\\.(\\d+)\\.(\\d+)/\n\n/** Extract a `major.minor.patch` triple from a version string, or `null`. */\nconst _parseVersionTriple = (text: string): readonly [number, number, number] | null => {\n const m = _HELM_VERSION_RE.exec(text.trim())\n if (m === null) return null\n return [Number(m[1]), Number(m[2]), Number(m[3])]\n}\n\n/** True when `found` is strictly older than `min` (release triple compare). */\nconst _isBelow = (\n found: readonly [number, number, number],\n min: readonly [number, number, number]\n): boolean => {\n for (let i = 0; i < 3; i++) {\n const f = found[i] ?? 0\n const m = min[i] ?? 0\n if (f < m) return true\n if (f > m) return false\n }\n return false\n}\n\n/**\n * One-shot `helm version --short` preflight. Fails `HelmVersionTooLow`\n * when helm is absent/unparseable or older than `minVersion`. Pre-release\n * / build metadata on the installed version is ignored — only the release\n * triple gates the check.\n */\nconst _assertHelmMinVersion = (\n minVersion: string\n): Effect.Effect<void, HelmVersionTooLow, ChildProcessSpawner> =>\n Effect.gen(function*() {\n const cmd = ChildProcess.make(\"helm\", [\"version\", \"--short\"])\n const stdout = yield* runProcessString(cmd, { allowEmptyStdout: false }).pipe(\n Effect.mapError(() => new HelmVersionTooLow({ required: minVersion, found: \"not found\" }))\n )\n const found = _parseVersionTriple(stdout)\n const min = _parseVersionTriple(minVersion)\n if (found === null || (min !== null && _isBelow(found, min))) {\n return yield* Effect.fail(\n new HelmVersionTooLow({ required: minVersion, found: stdout.trim() })\n )\n }\n })\n\nconst _normalizeDigest = (digest: string): string => digest.startsWith(\"sha256:\") ? digest : `sha256:${digest}`\n\nconst _toHex = (buf: ArrayBuffer): string => {\n const view = new Uint8Array(buf)\n let hex = \"\"\n for (let i = 0; i < view.length; i++) {\n hex += (view[i] ?? 0).toString(16).padStart(2, \"0\")\n }\n return hex\n}\n\n// Minimal local typing for `crypto.subtle.digest`. The base tsconfig is\n// `lib: [\"ES2022\"]` (no DOM), so `BufferSource` / `Crypto` are not declared;\n// we define just enough to drive the runtime call without dragging the\n// whole DOM lib in.\ninterface _SubtleCrypto {\n readonly digest: (algorithm: \"SHA-256\", data: ArrayBufferView) => Promise<ArrayBuffer>\n}\ninterface _CryptoGlobal {\n readonly subtle: _SubtleCrypto\n}\n\n/**\n * SHA-256 the file at `filePath` via Web Crypto API (`crypto.subtle.digest`).\n * `crypto.subtle` is a runtime global on Node ≥ 20 and on Bun; no\n * `node:crypto` import is needed, which keeps the file portable across\n * the runtimes Effect targets.\n */\nconst _hashFile = (filePath: string) =>\n Effect.gen(function*() {\n const fs = yield* FileSystem\n const bytes = yield* fs.readFile(filePath)\n const subtle = unsafeCoerce<{ readonly crypto: _CryptoGlobal }>(\n globalThis,\n \"globalThis.crypto is provided by the runtime (Node ≥ 20, Bun) — typed via local _CryptoGlobal interface\"\n ).crypto.subtle\n const digest = yield* Effect.promise(() => subtle.digest(\"SHA-256\", bytes))\n return `sha256:${_toHex(digest)}`\n })\n\ninterface _VerifyDigestInput {\n readonly opts: HelmReleaseOptions\n readonly cachedTgz: string\n}\n\nconst _verifyDigest = (input: _VerifyDigestInput) =>\n Effect.gen(function*() {\n const fs = yield* FileSystem\n const expected = _normalizeDigest(input.opts.digest)\n const actual = yield* _hashFile(input.cachedTgz)\n if (expected !== actual) {\n yield* fs.remove(input.cachedTgz).pipe(Effect.ignore)\n return yield* Effect.fail(\n new HelmDigestMismatch({\n chart: input.opts.chart,\n version: input.opts.version,\n expected,\n actual\n })\n )\n }\n })\n\ninterface _EnsureCachedTarballInput {\n readonly opts: HelmReleaseOptions\n readonly cacheDir: string\n readonly cachedTgz: string\n}\nconst _ensureCachedTarball = (input: _EnsureCachedTarballInput) =>\n Effect.gen(function*() {\n const { opts, cacheDir, cachedTgz } = input\n const fs = yield* FileSystem\n const path = yield* Path\n\n const cacheExists = yield* fs.exists(cachedTgz)\n if (cacheExists) {\n yield* _verifyDigest({ opts, cachedTgz })\n return\n }\n\n const beforeFiles = new Set(\n yield* fs.readDirectory(cacheDir).pipe(Effect.orElseSucceed((): string[] => []))\n )\n\n const pull = ChildProcess.make(\"helm\", [\n \"pull\",\n \"--repo\",\n opts.repo,\n opts.chart,\n \"--version\",\n opts.version,\n \"--destination\",\n cacheDir\n ])\n yield* runProcessExit(pull)\n\n const afterFiles = yield* fs.readDirectory(cacheDir)\n const candidates = afterFiles.filter(\n (f) =>\n f.endsWith(\".tgz\") &&\n f.startsWith(opts.chart) &&\n !beforeFiles.has(f) &&\n path.join(cacheDir, f) !== cachedTgz\n )\n if (candidates.length > 0) {\n yield* fs.rename(path.join(cacheDir, candidates[0] ?? \"\"), cachedTgz)\n }\n yield* _verifyDigest({ opts, cachedTgz })\n })\n\nexport const release = (opts: HelmReleaseOptions): Manifest<RawYaml[]> => {\n const extraOpts = opts.extraOpts ?? []\n\n return make<RawYaml[]>(() =>\n Effect.gen(function*() {\n const fs = yield* FileSystem\n const path = yield* Path\n\n if (opts.minVersion !== undefined) {\n yield* _assertHelmMinVersion(opts.minVersion)\n }\n\n const cacheDir = yield* Config.string(\"KONFIG_HELM_CACHE\").pipe(\n Config.withDefault(path.resolve(\".konfig\", \"helm-cache\"))\n )\n yield* fs.makeDirectory(cacheDir, { recursive: true })\n\n const digestSuffix = opts.digest.replace(/^sha256:/, \"\").slice(0, 12)\n const cachedTgz = path.join(cacheDir, `${opts.chart}-${opts.version}-${digestSuffix}.tgz`)\n yield* _ensureCachedTarball({ opts, cacheDir, cachedTgz })\n\n const tmpDir = yield* fs.makeTempDirectoryScoped({ prefix: \"konfig-helm-\" })\n const valuesFile = path.join(tmpDir, \"values.yaml\")\n yield* fs.writeFileString(valuesFile, YAML.stringify(opts.values, { lineWidth: 0 }))\n\n const releaseName = opts.releaseName ?? opts.chart\n const template = ChildProcess.make(\"helm\", [\n \"template\",\n releaseName,\n cachedTgz,\n \"--values\",\n valuesFile,\n ...(opts.namespace !== undefined ? [\"--namespace\", opts.namespace] : []),\n ...extraOpts\n ])\n const stdout = yield* runProcessString(template, { allowEmptyStdout: false })\n return yield* _parseHelmOutput({\n output: stdout,\n chart: opts.chart,\n version: opts.version,\n namespace: opts.namespace\n })\n }).pipe(\n Effect.scoped,\n Effect.mapError((cause) =>\n // The version preflight already produces a typed HelmVersionTooLow;\n // surface it as-is rather than burying it inside HelmRenderError.\n cause instanceof HelmVersionTooLow\n ? cause\n : new HelmRenderError({ chart: opts.chart, version: opts.version, cause })\n )\n )\n )\n}\n","\nimport { Data, Effect, Schema } from \"effect\";\n\nexport const EnvImages = Schema.Record(Schema.String, Schema.String);\nexport type EnvImages = typeof EnvImages.Type;\n\nexport const ImagesConfig = Schema.Struct({\n\tenvs: Schema.Record(Schema.String, EnvImages),\n});\nexport type ImagesConfig = typeof ImagesConfig.Type;\n\nconst decodeEff = Schema.decodeUnknownEffect(ImagesConfig);\n\nconst strict = { onExcessProperty: \"error\" } as const;\n\nexport const decodeImagesSync = (input: unknown): ImagesConfig =>\n\tEffect.runSync(decodeEff(input, strict));\nexport const decodeImagesEffect = (input: unknown) => decodeEff(input, strict);\n\nexport class ImagesEnvMissing extends Data.TaggedError(\"ImagesEnvMissing\")<{\n\treadonly env: string;\n}> {}\n\nexport interface LookupEnvInput {\n\treadonly cfg: ImagesConfig;\n\treadonly env: string;\n}\nexport const lookupEnv = (input: LookupEnvInput): EnvImages | undefined =>\n\tinput.cfg.envs[input.env];\n\nexport const lookupEnvEffect = (\n\tinput: LookupEnvInput,\n): Effect.Effect<EnvImages, ImagesEnvMissing> => {\n\tconst e = input.cfg.envs[input.env];\n\treturn e === undefined ? Effect.fail(new ImagesEnvMissing({ env: input.env })) : Effect.succeed(e);\n};\n\nexport const imagesFor = (input: LookupEnvInput): EnvImages => {\n\tconst e = input.cfg.envs[input.env];\n\tif (e === undefined) {\n\t\tthrow new ImagesEnvMissing({ env: input.env });\n\t}\n\treturn e;\n};\n\nexport class ImagesAppMissing extends Data.TaggedError(\"ImagesAppMissing\")<{\n\treadonly env: string;\n\treadonly app: string;\n}> {}\n\nexport interface RequireImageInput {\n\treadonly e: EnvImages;\n\treadonly app: string;\n\treadonly envName: string;\n}\nexport const requireImage = (input: RequireImageInput): string => {\n\tconst v = input.e[input.app];\n\tif (v === undefined) {\n\t\tthrow new ImagesAppMissing({ env: input.envName, app: input.app });\n\t}\n\treturn v;\n};\n","\nimport { Effect, Schema } from \"effect\";\n\nconst _stringWithKeyDefault = (def: string) =>\n\tSchema.String.pipe(Schema.optionalKey, Schema.withDecodingDefaultKey(Effect.succeed(def)));\n\nconst _stringArrayWithKeyDefault = (def: ReadonlyArray<string>) =>\n\tSchema.Array(Schema.String).pipe(\n\t\tSchema.optionalKey,\n\t\tSchema.withDecodingDefaultKey(Effect.succeed(def)),\n\t);\n\nexport const EnvEntry = Schema.Struct({\n\tentry: Schema.String,\n});\nexport type EnvEntry = typeof EnvEntry.Type;\n\nexport const OutDir = Schema.Struct({\n\tmanifests: Schema.String,\n});\nexport type OutDir = typeof OutDir.Type;\n\nexport const CrdConfig = Schema.Struct({\n\toutDir: _stringWithKeyDefault(\".generated/crd\"),\n});\nexport type CrdConfig = typeof CrdConfig.Type;\n\nexport const HelmConfig = Schema.Struct({\n\tcacheDir: _stringWithKeyDefault(\".konfig/helm-cache\"),\n\tminVersion: _stringWithKeyDefault(\"3.16.0\"),\n});\nexport type HelmConfig = typeof HelmConfig.Type;\n\nexport const ClusterSpec = Schema.Struct({\n\tregistry: Schema.optionalKey(Schema.String),\n\tingressClass: Schema.optionalKey(Schema.String),\n\tstorageClass: Schema.optionalKey(Schema.String),\n\trepositoryUrl: Schema.optionalKey(Schema.String),\n});\nexport type ClusterSpec = typeof ClusterSpec.Type;\n\nexport const DiffConfig = Schema.Struct({\n\tbaseline: Schema.String,\n});\nexport type DiffConfig = typeof DiffConfig.Type;\n\nexport const ServicesConfig = Schema.Struct({\n\toutFile: Schema.optionalKey(Schema.String),\n\tglobalPaths: _stringArrayWithKeyDefault([]),\n});\nexport type ServicesConfig = typeof ServicesConfig.Type;\n\nexport const KonfigConfig = Schema.Struct({\n\troot: Schema.String,\n\tcluster: _stringWithKeyDefault(\"cluster.ts\"),\n\tmodules: _stringWithKeyDefault(\"modules\"),\n\tcharts: _stringWithKeyDefault(\"charts\"),\n\tenvs: Schema.Record(Schema.String, EnvEntry),\n\toutDir: OutDir,\n\tcrd: Schema.optionalKey(CrdConfig).pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed({ outDir: \".generated/crd\" })),\n\t),\n\thelm: Schema.optionalKey(HelmConfig).pipe(\n\t\tSchema.withDecodingDefaultKey(\n\t\t\tEffect.succeed({ cacheDir: \".konfig/helm-cache\", minVersion: \"3.16.0\" }),\n\t\t),\n\t),\n\t// Extra files/directories/glob patterns (relative to konfig.json)\n\t// hashed into the build cache input on top of everything under\n\t// `root` — for inputs that feed a render but live outside the\n\t// konfig root. Globs use Node glob syntax (requires node >= 22).\n\tcacheInclude: _stringArrayWithKeyDefault([]),\n\tdiff: Schema.optionalKey(DiffConfig),\n\tservices: Schema.optionalKey(ServicesConfig),\n\tclusters: Schema.optionalKey(Schema.Record(Schema.String, ClusterSpec)),\n});\nexport type KonfigConfig = typeof KonfigConfig.Type;\n\nexport interface ResolvedKonfigConfig {\n\treadonly configDir: string;\n\treadonly config: KonfigConfig;\n}\n\nconst strict = { onExcessProperty: \"error\" } as const;\nconst decodeEff = Schema.decodeUnknownEffect(KonfigConfig);\n\nexport const decodeKonfigConfigSync = (input: unknown): KonfigConfig =>\n\tEffect.runSync(decodeEff(input, strict));\nexport const decodeKonfigConfigEffect = (input: unknown) => decodeEff(input, strict);\n","import { Effect, type Layer } from \"effect\";\nimport { unsafeCoerce } from \"./_cast\";\nimport type { AnyRenderError } from \"./RenderError\";\n\n/**\n * Resolves to `T` if it is a string literal (or template-literal\n * pattern), and to a structured error type when `T` widens to the bare\n * `string`. Use as the field type on every name/namespace slot any\n * module wrapper forwards.\n *\n * konfig's dep graph keys each provider by literal name; a wrapper that\n * lets `Name` widen to `string` collapses every module into the same\n * slot and silently masks unmet deps. This brand turns that into a\n * compile error at the call site.\n */\nexport type LiteralName<T extends string> = string extends T\n\t? {\n\t\t\treadonly _konfig_error: \"Module name/namespace must be a string literal. Make the wrapper generic (`<const Name extends string>`) and forward via `Module.LiteralName<Name>`.\";\n\t\t}\n\t: T;\n\n/**\n * Context passed to a module's `build` callback. Carries the\n * per-instance identity (chosen `name` and the module's `namespace`)\n * so the build can stamp them onto manifests without re-receiving\n * them via `opts`.\n */\nexport interface BuildContext<Ns extends string = string> {\n\treadonly name: string;\n\treadonly namespace: Ns;\n}\n\n/**\n * Allowed return shapes from a module `build` callback:\n * - an `Effect` (when the build reads from Layers, files, etc.)\n * - a plain `ReadonlyArray<unknown>` for pure synchronous builds.\n *\n * `Module.fixedNs` / `Module.dynamicNs` lift the array form into an\n * `Effect` internally — wrapper authors don't need to wrap themselves.\n */\nexport type BuildResult<R = never> =\n\t| Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R>\n\t| ReadonlyArray<unknown>;\n\nconst _liftBuild = <R>(\n\tresult: BuildResult<R>,\n): Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R> =>\n\tEffect.isEffect(result) ? result : Effect.succeed(result);\n\n/**\n * Higher-kinded handle constructor: each backend declares a sub-interface\n * that maps the four type parameters (`_Name`, `_Ns`, `_R`, `_Extra`)\n * onto its native handle (`ApplicationHandle` / `BundleHandle` / …).\n *\n * `ApplyHandle` substitutes concrete types into the kind's `this`\n * slots — the standard \"type lambda\" encoding Effect uses for HKTs.\n */\nexport interface HandleKind {\n\treadonly _Name: string;\n\treadonly _Ns: string;\n\treadonly _R: unknown;\n\treadonly _Extra: unknown;\n\treadonly Handle: unknown;\n}\n\nexport type ApplyHandle<\n\tK extends HandleKind,\n\tName extends string,\n\tNs extends string,\n\tR,\n\tExtra,\n> = (K & {\n\treadonly _Name: Name;\n\treadonly _Ns: Ns;\n\treadonly _R: R;\n\treadonly _Extra: Extra;\n})[\"Handle\"];\n\n/**\n * Universal define-args every backend accepts. Each backend layers\n * additional fields on via the `ExtraConfig` (config-time-only) and\n * `ExtraCallArgs` (per-instance) generics on `Target`.\n */\nexport interface DefineBaseArgs<\n\tName extends string,\n\tNs extends string,\n\tR,\n\tExtra,\n> {\n\treadonly name: LiteralName<Name>;\n\treadonly namespace: LiteralName<Ns>;\n\treadonly build:\n\t\t| Effect.Effect<ReadonlyArray<unknown>, AnyRenderError, R>\n\t\t| (() => ReadonlyArray<unknown>);\n\treadonly provides?: Layer.Layer<Extra>;\n}\n\n/**\n * Adapter contract a backend implements to plug into `Module.fixedNs` /\n * `Module.dynamicNs`. Both `Application` (argocd) and `Bundle` (k8s)\n * satisfy it via their existing `define` exports — pass the namespace\n * itself as the first argument.\n *\n * - `Kind` — HKT mapping `(Name, Ns, R, Extra)` to the\n * backend's native handle type.\n * - `ExtraConfig` — config-time-only fields the backend accepts\n * (e.g. argocd's `syncPolicy`, `annotations`).\n * - `ExtraCallArgs` — per-instance fields the wrapper requires\n * at the call site (e.g. argocd's `source`).\n */\nexport interface Target<\n\tKind extends HandleKind = HandleKind,\n\tExtraConfig extends object = Record<string, never>,\n\tExtraCallArgs extends object = Record<string, never>,\n> {\n\treadonly define: <\n\t\tconst Name extends string,\n\t\tconst Ns extends string,\n\t\tR = never,\n\t\tExtra = never,\n\t>(\n\t\targs: DefineBaseArgs<Name, Ns, R, Extra> & ExtraConfig & ExtraCallArgs,\n\t) => ApplyHandle<Kind, Name, Ns, R, Extra>;\n}\n\n/** Config accepted by `Module.fixedNs` (namespace baked into the wrapper). */\nexport interface FixedNsConfig<\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tNs extends string,\n\tOpts extends object,\n\tR,\n\tExtra,\n> {\n\treadonly target: Target<Kind, ExtraConfig, ExtraCallArgs>;\n\treadonly namespace: Ns;\n\treadonly provides?: Layer.Layer<Extra>;\n\treadonly build: (ctx: BuildContext<Ns>, opts: Opts) => BuildResult<R>;\n}\n\n/**\n * Build a typed wrapper for a module whose namespace is part of its\n * identity (e.g. `cert-manager` always installs into `cert-manager`).\n *\n * `target` is the backend adapter — typically `Application.target`\n * (argocd) or `Bundle.target` (k8s). The wrapper's call signature\n * merges the backend's per-instance fields (`source` for argocd,\n * none for bundle) with the user-defined `Opts`.\n *\n * ```ts\n * const defineSops = Module.fixedNs({\n * target: Application.target,\n * namespace: \"sops\",\n * annotations: Sync.wave(-1),\n * build: ({ namespace }, _opts: Record<never, never>) => [\n * Namespace.make({ name: namespace }),\n * Helm.release({ ... }),\n * ],\n * });\n *\n * const sops = defineSops({ name: \"sops-operator\", source: src(\"sops\") });\n * ```\n */\nexport const fixedNs = <\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tconst Ns extends string,\n\tOpts extends object = Record<never, never>,\n\tR = never,\n\tExtra = never,\n>(\n\tconfig: FixedNsConfig<Kind, ExtraConfig, ExtraCallArgs, Ns, Opts, R, Extra> & ExtraConfig,\n) => {\n\tconst { target, namespace, provides, build, ...extraConfig } = unsafeCoerce<\n\t\tFixedNsConfig<Kind, ExtraConfig, ExtraCallArgs, Ns, Opts, R, Extra> & ExtraConfig & Record<string, unknown>\n\t>(config, \"Record spread shape mirrors the FixedNsConfig & ExtraConfig intersection\");\n\tconst adapter = unsafeCoerce<Target<Kind, ExtraConfig, ExtraCallArgs>>(\n\t\ttarget,\n\t\t\"target was destructured from config without preserving its typed shape; reattach the constraint\",\n\t);\n\n\treturn <const Name extends string>(\n\t\targs: { readonly name: LiteralName<Name> } & ExtraCallArgs & Opts,\n\t): ApplyHandle<Kind, Name, Ns, R, Extra> => {\n\t\tconst { name, ...rest } = unsafeCoerce<\n\t\t\t{ readonly name: LiteralName<Name> } & Record<string, unknown>\n\t\t>(args, \"destructuring the wrapper args; rest carries ExtraCallArgs & Opts as a flat record\");\n\n\t\tconst ctxName = unsafeCoerce<Name>(\n\t\t\tname,\n\t\t\t\"LiteralName<Name> resolves to Name itself once the wrapper call typechecks\",\n\t\t);\n\n\t\tconst buildResult = build(\n\t\t\t{ name: ctxName, namespace },\n\t\t\tunsafeCoerce<Opts>(rest, \"rest carries Opts fields; ExtraCallArgs flow to target.define below\"),\n\t\t);\n\n\t\treturn adapter.define<Name, Ns, R, Extra>(unsafeCoerce<\n\t\t\tDefineBaseArgs<Name, Ns, R, Extra> & ExtraConfig & ExtraCallArgs\n\t\t>(\n\t\t\t{\n\t\t\t\t...extraConfig,\n\t\t\t\t...rest,\n\t\t\t\tname,\n\t\t\t\tnamespace: unsafeCoerce<LiteralName<Ns>>(\n\t\t\t\t\tnamespace,\n\t\t\t\t\t\"Ns is a const string literal; LiteralName<Ns> resolves to Ns itself\",\n\t\t\t\t),\n\t\t\t\tbuild: _liftBuild(buildResult),\n\t\t\t\t...(provides !== undefined ? { provides } : {}),\n\t\t\t},\n\t\t\t\"the assembled object structurally matches the target's define-args; spread layout matches the intersection\",\n\t\t));\n\t};\n};\n\n/** Config accepted by `Module.dynamicNs` (namespace chosen per instance). */\nexport interface DynamicNsConfig<\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tOpts extends object,\n\tR,\n\tExtra,\n> {\n\treadonly target: Target<Kind, ExtraConfig, ExtraCallArgs>;\n\treadonly provides?: Layer.Layer<Extra>;\n\treadonly build: (ctx: BuildContext, opts: Opts) => BuildResult<R>;\n}\n\n/**\n * Build a typed wrapper for a module whose namespace is chosen per\n * instance (e.g. an `api` module deployed into different namespaces\n * per env).\n *\n * ```ts\n * const defineApi = Module.dynamicNs({\n * target: Application.target,\n * annotations: Sync.wave(1),\n * build: ({ name, namespace }, opts: ApiOpts) => [ ... ],\n * });\n *\n * const api = defineApi({\n * name: \"api\",\n * namespace: \"prod\",\n * source: src(\"api\"),\n * replicas: 2,\n * });\n * ```\n */\nexport const dynamicNs = <\n\tKind extends HandleKind,\n\tExtraConfig extends object,\n\tExtraCallArgs extends object,\n\tOpts extends object = Record<never, never>,\n\tR = never,\n\tExtra = never,\n>(\n\tconfig: DynamicNsConfig<Kind, ExtraConfig, ExtraCallArgs, Opts, R, Extra> & ExtraConfig,\n) => {\n\tconst { target, provides, build, ...extraConfig } = unsafeCoerce<\n\t\tDynamicNsConfig<Kind, ExtraConfig, ExtraCallArgs, Opts, R, Extra> & ExtraConfig & Record<string, unknown>\n\t>(config, \"Record spread shape mirrors the DynamicNsConfig & ExtraConfig intersection\");\n\tconst adapter = unsafeCoerce<Target<Kind, ExtraConfig, ExtraCallArgs>>(\n\t\ttarget,\n\t\t\"target was destructured from config without preserving its typed shape; reattach the constraint\",\n\t);\n\n\treturn <const Name extends string, const Ns extends string>(\n\t\targs: {\n\t\t\treadonly name: LiteralName<Name>;\n\t\t\treadonly namespace: LiteralName<Ns>;\n\t\t} & ExtraCallArgs & Opts,\n\t): ApplyHandle<Kind, Name, Ns, R, Extra> => {\n\t\tconst { name, namespace, ...rest } = unsafeCoerce<\n\t\t\t{ readonly name: LiteralName<Name>; readonly namespace: LiteralName<Ns> } & Record<string, unknown>\n\t\t>(args, \"destructuring the wrapper args; rest carries ExtraCallArgs & Opts as a flat record\");\n\n\t\tconst ctxName = unsafeCoerce<Name>(\n\t\t\tname,\n\t\t\t\"LiteralName<Name> resolves to Name itself once the wrapper call typechecks\",\n\t\t);\n\t\tconst ctxNs = unsafeCoerce<Ns>(\n\t\t\tnamespace,\n\t\t\t\"LiteralName<Ns> resolves to Ns itself once the wrapper call typechecks\",\n\t\t);\n\n\t\tconst buildResult = build(\n\t\t\t{ name: ctxName, namespace: ctxNs },\n\t\t\tunsafeCoerce<Opts>(rest, \"rest carries Opts fields; ExtraCallArgs flow to target.define below\"),\n\t\t);\n\n\t\treturn adapter.define<Name, Ns, R, Extra>(unsafeCoerce<\n\t\t\tDefineBaseArgs<Name, Ns, R, Extra> & ExtraConfig & ExtraCallArgs\n\t\t>(\n\t\t\t{\n\t\t\t\t...extraConfig,\n\t\t\t\t...rest,\n\t\t\t\tname,\n\t\t\t\tnamespace,\n\t\t\t\tbuild: _liftBuild(buildResult),\n\t\t\t\t...(provides !== undefined ? { provides } : {}),\n\t\t\t},\n\t\t\t\"the assembled object structurally matches the target's define-args; spread layout matches the intersection\",\n\t\t));\n\t};\n};\n","/**\n * Context object threaded through every `Manifest.render(...)` call.\n *\n * `env` is the single load-bearing field: it keys both the file-output\n * directory under `outDir.manifests` and the choice of bundle entry in\n * `KonfigConfig.envs`. The optional fields below carry per-cluster\n * context for renders where one logical env spans multiple clusters.\n *\n * **Precedence rules:**\n * - The output directory is keyed on `env` alone when `cluster` is\n * `undefined`; when set, builds write to `<outDir>/<env>/<cluster>/`.\n * Tests that bypass the CLI write into the simpler `<outDir>/<env>/`\n * path by construction.\n * - `cluster` is informational inside `Manifest.make((ctx) => ...)` —\n * no constructor mutates a manifest based on it implicitly; the\n * caller branches.\n * - `k8sVersion` is a hint for renderers that emit\n * apiVersion-conditional resources (e.g. `policy/v1beta1` vs\n * `policy/v1`).\n * - `flags` is the escape hatch for one-off \"render with X\" toggles\n * that don't deserve their own field. Use sparingly.\n */\nexport interface RenderContext {\n\treadonly env: string;\n\treadonly cluster?: string;\n\treadonly k8sVersion?: string;\n\treadonly flags?: ReadonlyMap<string, unknown>;\n}\n\nexport interface RenderContextFullInput {\n\treadonly env: string;\n\treadonly cluster?: string;\n\treadonly k8sVersion?: string;\n\treadonly flags?: ReadonlyMap<string, unknown>;\n}\n\nexport const RenderContext = {\n\tmake: (env: string): RenderContext => ({ env }),\n\tmakeFull: (input: RenderContextFullInput): RenderContext => ({\n\t\tenv: input.env,\n\t\t...(input.cluster !== undefined ? { cluster: input.cluster } : {}),\n\t\t...(input.k8sVersion !== undefined ? { k8sVersion: input.k8sVersion } : {}),\n\t\t...(input.flags !== undefined ? { flags: input.flags } : {}),\n\t}),\n};\n","import { NodeRuntime, NodeServices } from \"@effect/platform-node\"\nimport { Effect, Layer } from \"effect\"\nimport { RenderContext } from \"./RenderContext\"\n\nexport interface RenderOptions<RIn = never> {\n /** Render-context env (default `\"prod\"`). Keys output dirs and bundle entries. */\n readonly env?: string\n /** Extra layer merged with `NodeServices.layer` before running the program. Use for `ConfigProvider` mocks, custom service tags, etc. */\n readonly layers?: Layer.Layer<RIn, never, never>\n}\n\n/** @internal */\nexport const _resolveEnv = (env: string | undefined): string => env ?? \"prod\"\n\n/** @internal */\nexport const _buildLayers = <RIn>(\n extra: Layer.Layer<RIn, never, never> | undefined\n): Layer.Layer<NodeServices.NodeServices | RIn, never, never> =>\n extra === undefined\n // oxlint-disable-next-line app/no-type-assertion\n ? (NodeServices.layer as Layer.Layer<NodeServices.NodeServices | RIn, never, never>)\n : Layer.mergeAll(NodeServices.layer, extra)\n\n/**\n * @internal\n * Compose the ctx + layers wiring `render` hands to `NodeRuntime.runMain`\n * into a single runnable Effect (context fully provided). Extracted so\n * tests can exercise the composition with `Effect.runPromise` instead of\n * `runMain`, which would exit the process.\n */\n// oxlint-disable-next-line app/no-multiple-function-params\nexport const _compose = <E, RIn>(\n program: (ctx: RenderContext) => Effect.Effect<void, E, NodeServices.NodeServices | RIn>,\n options: RenderOptions<RIn> = {}\n): Effect.Effect<void, E> => {\n const ctx = RenderContext.make(_resolveEnv(options.env))\n const layers = _buildLayers(options.layers)\n return program(ctx).pipe(Effect.scoped, Effect.provide(layers))\n}\n\n/**\n * Run a render program against `NodeRuntime`.\n *\n * The callback receives a `RenderContext` keyed on `options.env`\n * (default `\"prod\"`) and returns an Effect whose only required\n * services are `NodeServices` and whatever the caller supplies via\n * `options.layers`. `render` provides both, wraps in `Effect.scoped`,\n * and hands off to `NodeRuntime.runMain`.\n *\n * Replaces the per-file `NodeRuntime.runMain(program.pipe(...))`\n * boilerplate every example used to repeat.\n */\n// oxlint-disable-next-line app/no-multiple-function-params\nexport const render = <E, RIn>(\n program: (ctx: RenderContext) => Effect.Effect<void, E, NodeServices.NodeServices | RIn>,\n options: RenderOptions<RIn> = {}\n): void => {\n NodeRuntime.runMain(_compose(program, options))\n}\n","import type { Effect } from \"effect\";\nimport type { Manifest, RenderServices } from \"./Manifest\";\nimport type { RenderContext } from \"./RenderContext\";\nimport type { AnyRenderError } from \"./RenderError\";\n\nexport interface RenderManifestInput<A> {\n\treadonly manifest: Manifest<A>;\n\treadonly ctx: RenderContext;\n}\nexport const renderManifest = <A>(\n\tinput: RenderManifestInput<A>,\n): Effect.Effect<A, AnyRenderError, RenderServices> => input.manifest.render(input.ctx);\n","import * as YAML from \"yaml\"\nimport { unsafeCoerce } from \"../_cast\"\n\nconst ORDER_ROOT = [\"apiVersion\", \"kind\", \"metadata\", \"spec\", \"status\"]\nconst ORDER_METADATA = [\"name\", \"namespace\", \"labels\", \"annotations\"]\n\ninterface _ReorderInput {\n readonly obj: Record<string, unknown>\n readonly depth: number\n readonly parentKey: string | null\n}\nconst _reorderObject = (input: _ReorderInput): Record<string, unknown> => {\n const { obj, depth, parentKey } = input\n const keys = Object.keys(obj).filter((k) => obj[k] !== null && obj[k] !== undefined)\n const order = depth === 0 ? ORDER_ROOT : depth === 1 && parentKey === \"metadata\" ? ORDER_METADATA : null\n\n let sortedKeys: string[]\n if (order !== null) {\n const known = order.filter((k) => keys.includes(k))\n const rest = keys.filter((k) => !order.includes(k)).sort()\n sortedKeys = [...known, ...rest]\n } else {\n sortedKeys = keys.slice().sort()\n }\n\n const out: Record<string, unknown> = {}\n for (const k of sortedKeys) {\n out[k] = _normalize({ value: obj[k], depth: depth + 1, parentKey: k })\n }\n return out\n}\n\ninterface _NormalizeInput {\n readonly value: unknown\n readonly depth: number\n readonly parentKey: string | null\n}\nconst _normalize = (input: _NormalizeInput): unknown => {\n const { value, depth, parentKey } = input\n if (value === null || value === undefined) return value\n if (Array.isArray(value)) {\n return value.map((v) => _normalize({ value: v, depth: depth + 1, parentKey: null }))\n }\n if (typeof value === \"object\") {\n return _reorderObject({\n obj: unsafeCoerce<Record<string, unknown>>(\n value,\n \"typeof === object branch (value !== null, !Array.isArray above) — treated as a keyed record for reordering\"\n ),\n depth,\n parentKey\n })\n }\n return value\n}\n\nexport interface SerializeInput {\n readonly value: unknown\n readonly trailingNewline?: boolean\n}\nexport const serialize = (input: SerializeInput): string => {\n const normalized = _normalize({ value: input.value, depth: 0, parentKey: null })\n const raw = YAML.stringify(normalized, {\n indent: 2,\n indentSeq: true,\n lineWidth: 0,\n minContentWidth: 0,\n defaultStringType: \"PLAIN\",\n defaultKeyType: \"PLAIN\",\n nullStr: \"null\",\n // Emit YAML safe under 1.1 readers (kubectl/go-yaml). Forces plain strings\n // like \"no\"/\"yes\"/\"on\"/\"off\" to be quoted so they aren't coerced to bools.\n version: \"1.1\"\n })\n const lf = raw.replace(/\\r\\n/g, \"\\n\").replace(/\\s+$/g, \"\")\n return (input.trailingNewline ?? true) ? `${lf}\\n` : lf\n}\n\n/**\n * Derive the on-disk filename (`<Kind>-<name>.yaml`) for a rendered\n * resource.\n *\n * **Precondition (caller invariant):** `resource.kind` and\n * `resource.metadata.name` MUST both be non-empty strings. A rendered\n * Kubernetes object always satisfies this, so callers are expected to\n * validate/decode the object *before* reaching this point (the CLI keys\n * files by kind+name only for objects it has already confirmed carry\n * both fields).\n *\n * Because the precondition is a caller invariant rather than runtime\n * input, a violation is a programming error: this throws synchronously\n * (a defect) instead of returning a typed error. It is deliberately kept\n * out of the `AnyRenderError` channel — do not route untrusted resources\n * through it; narrow them first.\n *\n * @throws {Error} if `kind` or `metadata.name` is missing or empty.\n */\nexport const filenameFor = (resource: {\n readonly kind?: unknown\n readonly metadata?: { readonly name?: unknown }\n}): string => {\n const kind = resource.kind\n const name = resource.metadata?.name\n if (typeof kind !== \"string\" || kind.length === 0) {\n throw new Error(`filenameFor: resource has no string kind`)\n }\n if (typeof name !== \"string\" || name.length === 0) {\n throw new Error(`filenameFor: resource '${kind}' has no metadata.name`)\n }\n return `${kind}-${_sanitizeNameForFilename(name)}.yaml`\n}\n\nconst _sanitizeNameForFilename = (name: string): string => name.replace(/[./]/g, \"-\")\n","export * from \"./serialize\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAa,SAAY,UAAqB;;;;;;;;;;;;;;;;AAkB9C,MAAa,gBAAmB,OAAgB,YAAuB;;;ACtBvE,IAAa,cAAb,cAAiC,KAAK,YAAY,cAAc,CAG7D;AAEH,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAG3E;AAEH,IAAa,sBAAb,cAAyC,KAAK,YAAY,sBAAsB,CAG7E;AAEH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAGzE;CACD,IAAI,UAAkB;EACpB,OAAO,iCAAiC,KAAK,SAAS,UAAU,KAAK;;;AAIzE,IAAa,kBAAb,cAAqC,KAAK,YAAY,kBAAkB,CAIrE;AAEH,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAK3E;CACD,IAAI,UAAkB;EACpB,OAAO,cAAc,KAAK,MAAM,GAAG,KAAK,QAAQ,6BAA6B,KAAK,SAAS,QAAQ,KAAK;;;AAI5G,IAAa,kBAAb,cAAqC,KAAK,YAAY,kBAAkB,CAGrE;;;ACvCH,MAAa,YACW,WACtB,UACA,OAAO,oBAAoB,MAAM,OAAO,CAAC,MAAM,CAAC,KAC/C,OAAO,UACL,UACA,IAAI,oBAAoB;CACvB,QAAQ,MAAM,SAAS;CACvB;CACA,CAAC,CACH,CACD;;;;;;;;;;;;;ACiDH,MAAa,iBACZ,YAC+C;CAE/C,OAAO,QAAQ,QACb,KAAK,QACL,aACC,MAAM,aACL,aACC,IAAI,OACJ,6FACA,EACD,IACA,EACD,oFACA,EACF,aACC,MAAM,OACN,8FACA,CACD;;;;;;;;;AAoCF,MAAa,0BACe,UAE1B,YAEA,aACC,SACA,kHACA;;;;;;;;;;;;;;;;;;;;;;ACnDH,MAAa,UAKZ,SAEA,QAAQ,QAAgD,UAAU,OAAO;AAM1E,MAAa,gBACZ,SAE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,MAAM,OAAO,SAAS,UAAU;CAChC,IAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAC9C,MAAM,IAAI,MAAM,2CAA2C;CAE7D,IAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAC9C,MAAM,IAAI,MAAM,0BAA0B,KAAK,wBAAwB;CAEzE,OAAO,GAAG,KAAK,GAAG,yBAAyB,KAAK,CAAC;;AAGnD,MAAM,4BAA4B,SAAyB,KAAK,QAAQ,SAAS,IAAI"}
@@ -50,6 +50,7 @@ export declare const KonfigConfig: Schema.Struct<{
50
50
  readonly cacheDir: Schema.withDecodingDefaultKey<Schema.optionalKey<Schema.String>, never>;
51
51
  readonly minVersion: Schema.withDecodingDefaultKey<Schema.optionalKey<Schema.String>, never>;
52
52
  }>>, never>;
53
+ readonly cacheInclude: Schema.withDecodingDefaultKey<Schema.optionalKey<Schema.$Array<Schema.String>>, never>;
53
54
  readonly diff: Schema.optionalKey<Schema.Struct<{
54
55
  readonly baseline: Schema.String;
55
56
  }>>;
@@ -90,6 +91,7 @@ export declare const decodeKonfigConfigEffect: (input: unknown) => Effect.Effect
90
91
  readonly cacheDir?: string | undefined;
91
92
  readonly minVersion?: string | undefined;
92
93
  } | undefined;
94
+ readonly cacheInclude?: readonly string[] | undefined;
93
95
  readonly diff?: {
94
96
  readonly baseline: string;
95
97
  } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfig.ts/core",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Core abstractions (Manifest, RenderContext, Helm, deps) for konfig.ts — typesafe Kubernetes + ArgoCD config in TypeScript.",
5
5
  "license": "MIT",
6
6
  "author": "David Stahl-Gruber",
@@ -35,13 +35,13 @@
35
35
  "LICENSE"
36
36
  ],
37
37
  "engines": {
38
- "node": ">=20"
38
+ "node": ">=22"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
43
  "scripts": {
44
- "build": "tsdown ./src/index.ts --format=esm --target=node20 --sourcemap --clean --no-dts && tsc -p tsconfig.build.json",
44
+ "build": "tsdown ./src/index.ts --format=esm --target=node22 --sourcemap --clean --no-dts && tsc -p tsconfig.build.json",
45
45
  "check": "tsc -p tsconfig.check.json --noEmit",
46
46
  "test": "vitest run",
47
47
  "lint": "oxlint",