@konfig.ts/argocd
@konfig.ts/argocd turns each of your modules into an Argo CD Application and composes those applications into a single app-of-apps. The point of the package is the check that happens while you compose: every module declares what it provides and what it needs, and AppOfApps.fromModules only compiles when every need is met by some listed module (or a group-level provides: layer). A missing provider is therefore a TypeScript error in the env file, not a failed sync in the cluster. The env file’s default export is what konfig build <env> renders.
Install
bun add @konfig.ts/argocdUsage
Below is the prod env of the full-stack example. Each define* call is a module built with Module.fixedNs and adapted into an Application through Application.target. The small src(name) helper builds the Argo CD source (repo URL, target revision, path) for each app.
export default AppOfApps.fromModules({
target: { repoURL: cluster.repositoryUrl, branch, rootPath },
defaults: { destination: { server: "https://kubernetes.default.svc" } },
modules: [
sopsOperator,
imagePulls,
featureFlags,
postgres,
apiBuild,
workerBuild,
redisCache,
api,
worker
]
})The check in practice: if the api module needs the ghcr-pull secret (it yields Dep.Secret("ghcr-pull")) and none of the listed modules provides it, fromModules refuses to compile with Missing provider for Secret "ghcr-pull". See Dependency graph.
Surface
| Export | Purpose |
|---|---|
Application.define | Build an ApplicationHandle<Name, Out, In>: a Context tag that also carries a Layer<Out, _, In> |
Application.make | Plain Application value constructor, no dependency graph |
Application.target | Adapter passed as target to Module.fixedNs / Module.dynamicNs |
Application.LiteralName<T>, Application.ApplicationHandle, Application.HandleKind | Types: reject a string-widened name at the call site; the handle and kind produced by define |
AppOfApps.fromModules | Compose handles into a sealed, directly renderable app-of-apps; the compile-time check fires here. provides?: Layer satisfies group-level needs |
AppOfApps.entrypoint | Deprecated no-op wrapper, kept for one release; export fromModules directly instead |
AppOfApps.make | Plain AppOfAppsResult from already-built Applications |
Sync.wave(n), Sync.hook(phase), Sync.options([...]) | argocd.argoproj.io/* annotation helpers to spread into annotations |
buildCR, serializeApplicationCR, applicationCRFilename, emitApplicationCR | Emit an Application CR as an object, YAML string, filename, or Manifest<string> |
ArgoSource, SyncPolicy, HookPhase, AppOfAppsTarget, AppOfAppsDefaults, AppOfAppsResult | Option and result types |
Errors
This package exports no tagged error classes. Its failures happen at compile time: an unsatisfied need, or two modules providing the same thing (rejected by Compose.NoDuplicateProvides). Anything that fails at render time comes from @konfig.ts/core as AnyRenderError.
Requirements
effect@^4.0.0-rc.111as a peer dependency (Effect 4, release-candidate line).- Depends on
@konfig.ts/core. - Runtime: Bun recommended; Node >= 23.6 works; Node 22.6 to 23.5 with
--experimental-strip-types;tsxworks.
Source and README: packages/argocd.