@vibesdotdev/infra-core 0.0.1 → 0.0.2
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/README.md +12 -68
- package/dist/kinds/git-hosting.kind.js +2 -2
- package/dist/kinds/git-hosting.kind.js.map +1 -1
- package/dist/kinds/package-registry.kind.d.ts +2 -2
- package/dist/kinds/package-registry.kind.js +1 -1
- package/dist/kinds/package-registry.kind.js.map +1 -1
- package/package.json +8 -9
- package/src/kinds/git-hosting.kind.ts +2 -2
- package/src/kinds/package-registry.kind.ts +1 -1
- package/SPEC.md +0 -169
package/README.md
CHANGED
|
@@ -1,78 +1,22 @@
|
|
|
1
1
|
# @vibesdotdev/infra-core
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
kinds, descriptor schemas, and deployment factories shared by adapter packages
|
|
5
|
-
(`infra-cloudflare`, `infra-doks`) and consuming apps.
|
|
3
|
+
Infrastructure manifest schemas and deployment primitives used by Vibes infra adapters.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
This package is part of the public Vibes framework package set. The source repository is private while the public repository split is being prepared, so package documentation is published on the Vibes docs site.
|
|
8
6
|
|
|
9
|
-
##
|
|
7
|
+
## Install
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
`infra/database`, `infra/queue`, `infra/cache`, `infra/object-storage`,
|
|
16
|
-
`infra/sandbox`. Each kind ships a Zod descriptor schema and a pass-through
|
|
17
|
-
default `Implementation` class.
|
|
18
|
-
- `src/deployment.ts` — factory functions that produce validated deployment
|
|
19
|
-
objects from authored input (`createAppDeployment` and friends).
|
|
20
|
-
- `src/infra.plugin.ts` — `infraPlugin` registers all 7 kinds with the
|
|
21
|
-
runtime under `discoveryPattern: "**/*.infra.ts"`.
|
|
22
|
-
|
|
23
|
-
## Common usage
|
|
24
|
-
|
|
25
|
-
Authoring a per-app deployment config (in `apps/<app>-web/deployment.config.ts`):
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { createAppDeployment } from '@vibesdotdev/infra-core/deployment';
|
|
29
|
-
import { createCloudflarePagesDeployment } from '@vibesdotdev/infra-cloudflare/pages';
|
|
30
|
-
|
|
31
|
-
const deployment = createAppDeployment({
|
|
32
|
-
appId: 'my-app',
|
|
33
|
-
appName: 'My App',
|
|
34
|
-
provider: 'cloudflare-workers',
|
|
35
|
-
runtime: 'edge',
|
|
36
|
-
build: { /* ... */ },
|
|
37
|
-
origins: [/* ... */],
|
|
38
|
-
env: [/* ... */]
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export default createCloudflarePagesDeployment({ deployment, /* ... */ });
|
|
9
|
+
```sh
|
|
10
|
+
bun add @vibesdotdev/infra-core
|
|
11
|
+
# or
|
|
12
|
+
npm install @vibesdotdev/infra-core
|
|
42
13
|
```
|
|
43
14
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
import type { WebAppDescriptor } from '@vibesdotdev/infra-core/kinds';
|
|
15
|
+
## Documentation
|
|
48
16
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
kind: 'infra/web-app',
|
|
52
|
-
domain: 'my-app.vibes.dev',
|
|
53
|
-
appDir: 'apps/my-app-web',
|
|
54
|
-
outputDir: 'apps/my-app-web/.svelte-kit/cloudflare',
|
|
55
|
-
adapter: 'cloudflare-pages',
|
|
56
|
-
runtime: 'edge',
|
|
57
|
-
env: []
|
|
58
|
-
} satisfies WebAppDescriptor;
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Real provider behavior comes from adapter packages registering against the
|
|
62
|
-
same kinds. Core never imports adapters.
|
|
63
|
-
|
|
64
|
-
## Verification
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
cd packages/infra-core
|
|
68
|
-
bun test
|
|
69
|
-
bun --bun tsc -p tsconfig.json --noEmit
|
|
70
|
-
```
|
|
17
|
+
- Package guide: https://docs.vibes.dev/packages/infra-core
|
|
18
|
+
- Vibes docs: https://docs.vibes.dev
|
|
71
19
|
|
|
72
|
-
##
|
|
20
|
+
## License
|
|
73
21
|
|
|
74
|
-
|
|
75
|
-
- [PROD-CHECKLIST.md](./PROD-CHECKLIST.md)
|
|
76
|
-
- [`infra-cloudflare`](../infra-cloudflare/SPEC.md)
|
|
77
|
-
- [`infra-doks`](../infra-doks/SPEC.md)
|
|
78
|
-
- [`deploy`](../deploy/SPEC.md)
|
|
22
|
+
MIT
|
|
@@ -21,9 +21,9 @@ export const GitHostingTypeSchema = z.enum(['gitea', 'forgejo']);
|
|
|
21
21
|
export const GitHostingAuthMethodSchema = z.enum(['local', 'oauth', 'token']);
|
|
22
22
|
const GitHostingBaseSchema = RuntimeDescriptorSchema.extend({
|
|
23
23
|
kind: z.literal('infra/git-hosting'),
|
|
24
|
-
/** Primary access URL (e.g. 'https://git.
|
|
24
|
+
/** Primary access URL (e.g. 'https://git.example.com'). */
|
|
25
25
|
url: z.string().url(),
|
|
26
|
-
/** Hostname for DNS resolution (e.g. 'git.
|
|
26
|
+
/** Hostname for DNS resolution (e.g. 'git.example.com'). */
|
|
27
27
|
hostname: z.string().min(1),
|
|
28
28
|
/** Git hosting software type. */
|
|
29
29
|
type: GitHostingTypeSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-hosting.kind.js","sourceRoot":"","sources":["../../src/kinds/git-hosting.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAE/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAA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,CAAC,YAAY,CAAC,EAAE,CAAC;CAC5E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC,MAAM,CAAC;IACrE;;;OAGG;IACH,MAAM,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAIH,MAAM,+BAA+B;IAEnB;IACA;IAFjB,YACiB,UAA6B,EAC7B,OAAgB;QADhB,eAAU,GAAV,UAAU,CAAmB;QAC7B,YAAO,GAAP,OAAO,CAAS;IAC9B,CAAC;IAEJ,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,UAAkC,CAAC;IAChD,CAAC;CACD;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAwD;IACtG,EAAE,EAAE,mBAAmB;IACvB,gBAAgB,EAAE,0BAA0B;IAC5C,qBAAqB,EAAE,+BAA+B;IACtD,gBAAgB,EAAE,uBAAuB;IACzC,WAAW;CACX,CAAC,CAAC"}
|
|
@@ -16,8 +16,8 @@ import * as z from 'zod/v4';
|
|
|
16
16
|
import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
|
|
17
17
|
import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
18
18
|
export declare const PackageRegistryTypeSchema: z.ZodEnum<{
|
|
19
|
-
docker: "docker";
|
|
20
19
|
npm: "npm";
|
|
20
|
+
docker: "docker";
|
|
21
21
|
maven: "maven";
|
|
22
22
|
helm: "helm";
|
|
23
23
|
}>;
|
|
@@ -50,8 +50,8 @@ export declare const PackageRegistryDescriptorSchema: z.ZodObject<{
|
|
|
50
50
|
kind: z.ZodLiteral<"infra/package-registry">;
|
|
51
51
|
url: z.ZodString;
|
|
52
52
|
registryType: z.ZodDefault<z.ZodEnum<{
|
|
53
|
-
docker: "docker";
|
|
54
53
|
npm: "npm";
|
|
54
|
+
docker: "docker";
|
|
55
55
|
maven: "maven";
|
|
56
56
|
helm: "helm";
|
|
57
57
|
}>>;
|
|
@@ -20,7 +20,7 @@ import { deploymentEnvRequirementSchema } from "../schemas.js";
|
|
|
20
20
|
export const PackageRegistryTypeSchema = z.enum(['npm', 'docker', 'maven', 'helm']);
|
|
21
21
|
const PackageRegistryBaseSchema = RuntimeDescriptorSchema.extend({
|
|
22
22
|
kind: z.literal('infra/package-registry'),
|
|
23
|
-
/** Primary access URL (e.g. 'https://packages.
|
|
23
|
+
/** Primary access URL (e.g. 'https://packages.example.com'). */
|
|
24
24
|
url: z.string().url(),
|
|
25
25
|
/** Package type this registry serves. */
|
|
26
26
|
registryType: PackageRegistryTypeSchema.default('npm'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-registry.kind.js","sourceRoot":"","sources":["../../src/kinds/package-registry.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAE/D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAGpF,MAAM,yBAAyB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAChE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC;IAEzC,
|
|
1
|
+
{"version":3,"file":"package-registry.kind.js","sourceRoot":"","sources":["../../src/kinds/package-registry.kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,M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|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -46,14 +46,9 @@
|
|
|
46
46
|
"registry": "https://registry.npmjs.org",
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"repository": {
|
|
50
|
-
"type": "git",
|
|
51
|
-
"url": "git+https://github.com/vibesdotdev/monorepo.git",
|
|
52
|
-
"directory": "packages/infra-core"
|
|
53
|
-
},
|
|
54
49
|
"dependencies": {
|
|
55
|
-
"@vibesdotdev/logging": "0.0.
|
|
56
|
-
"@vibesdotdev/runtime": "0.0.
|
|
50
|
+
"@vibesdotdev/logging": "0.0.2",
|
|
51
|
+
"@vibesdotdev/runtime": "0.0.2",
|
|
57
52
|
"zod": "^4.3.6"
|
|
58
53
|
},
|
|
59
54
|
"scripts": {
|
|
@@ -67,7 +62,6 @@
|
|
|
67
62
|
"src",
|
|
68
63
|
"bin",
|
|
69
64
|
"README.md",
|
|
70
|
-
"SPEC.md",
|
|
71
65
|
"LICENSE",
|
|
72
66
|
"!src/**/__tests__/**",
|
|
73
67
|
"!src/**/__stubs__/**",
|
|
@@ -88,5 +82,10 @@
|
|
|
88
82
|
],
|
|
89
83
|
"vibes": {
|
|
90
84
|
"visibility": "public-framework"
|
|
85
|
+
},
|
|
86
|
+
"description": "Infrastructure manifest schemas and deployment primitives used by Vibes infra adapters.",
|
|
87
|
+
"homepage": "https://docs.vibes.dev/packages/infra-core",
|
|
88
|
+
"bugs": {
|
|
89
|
+
"url": "https://docs.vibes.dev/packages/infra-core#support"
|
|
91
90
|
}
|
|
92
91
|
}
|
|
@@ -29,10 +29,10 @@ export type GitHostingAuthMethod = z.infer<typeof GitHostingAuthMethodSchema>;
|
|
|
29
29
|
const GitHostingBaseSchema = RuntimeDescriptorSchema.extend({
|
|
30
30
|
kind: z.literal('infra/git-hosting'),
|
|
31
31
|
|
|
32
|
-
/** Primary access URL (e.g. 'https://git.
|
|
32
|
+
/** Primary access URL (e.g. 'https://git.example.com'). */
|
|
33
33
|
url: z.string().url(),
|
|
34
34
|
|
|
35
|
-
/** Hostname for DNS resolution (e.g. 'git.
|
|
35
|
+
/** Hostname for DNS resolution (e.g. 'git.example.com'). */
|
|
36
36
|
hostname: z.string().min(1),
|
|
37
37
|
|
|
38
38
|
/** Git hosting software type. */
|
|
@@ -26,7 +26,7 @@ export type PackageRegistryType = z.infer<typeof PackageRegistryTypeSchema>;
|
|
|
26
26
|
const PackageRegistryBaseSchema = RuntimeDescriptorSchema.extend({
|
|
27
27
|
kind: z.literal('infra/package-registry'),
|
|
28
28
|
|
|
29
|
-
/** Primary access URL (e.g. 'https://packages.
|
|
29
|
+
/** Primary access URL (e.g. 'https://packages.example.com'). */
|
|
30
30
|
url: z.string().url(),
|
|
31
31
|
|
|
32
32
|
/** Package type this registry serves. */
|
package/SPEC.md
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
# @vibesdotdev/infra-core
|
|
2
|
-
|
|
3
|
-
Provider-agnostic contract for deployable infrastructure. Defines the runtime
|
|
4
|
-
kinds, descriptor schemas, and deployment factories that adapter packages and
|
|
5
|
-
consuming apps share. Adapter packages
|
|
6
|
-
([`infra-cloudflare`](../infra-cloudflare/SPEC.md),
|
|
7
|
-
[`infra-doks`](../infra-doks/SPEC.md)) implement provider-specific behavior
|
|
8
|
-
against these kinds; consumed by per-app `deployment.config.ts` files, by
|
|
9
|
-
`*.infra.ts` resource declarations under workspace `infra/`, by
|
|
10
|
-
[`secrets`](../secrets/SPEC.md) for env-requirement resolution, and by
|
|
11
|
-
[`deploy`](../deploy/SPEC.md) for orchestration.
|
|
12
|
-
|
|
13
|
-
## Owns
|
|
14
|
-
|
|
15
|
-
- **Runtime kinds:** `infra/web-app`, `infra/worker`, `infra/database`,
|
|
16
|
-
`infra/queue`, `infra/cache`, `infra/object-storage`, `infra/sandbox`,
|
|
17
|
-
`infra/git-hosting`, `infra/package-registry`.
|
|
18
|
-
- **Plugin descriptors registered by the plugin:** `infraPlugin` (id `infra`)
|
|
19
|
-
registers all 9 kinds with `discoveryPattern: "**/*.infra.ts"` and
|
|
20
|
-
pass-through default implementations exposing the validated descriptor as
|
|
21
|
-
`config`.
|
|
22
|
-
- **Schemas** (`./schemas`): atomic Zod schemas — provider enum, runtime enum,
|
|
23
|
-
origin, build, env requirement, dependency, upstream — and the assembled
|
|
24
|
-
`appDeploymentSchema`. Single source of truth for cross-cutting shapes;
|
|
25
|
-
kind descriptor schemas compose from these primitives.
|
|
26
|
-
- **Kind descriptors** (`./kinds`): one file per kind, each defining a Zod
|
|
27
|
-
descriptor schema (composed from `./schemas`) and a pass-through default
|
|
28
|
-
`Implementation` class wired through `createRuntimeKind`.
|
|
29
|
-
- **Deployment factories** (`./deployment`): `createAppDeployment`,
|
|
30
|
-
`createDeploymentOrigin`, `createDeploymentEnvRequirement`,
|
|
31
|
-
`createDeploymentDependency`, `getPrimaryOrigin`, `getUpstreamOriginEnv`.
|
|
32
|
-
These produce the validated objects authored in per-app
|
|
33
|
-
`deployment.config.ts` files.
|
|
34
|
-
|
|
35
|
-
## Does not own
|
|
36
|
-
|
|
37
|
-
- Cloudflare Workers / Workers / Queues / R2 / KV implementations →
|
|
38
|
-
[`infra-cloudflare`](../infra-cloudflare/SPEC.md).
|
|
39
|
-
- DigitalOcean App Platform / DOKS / Spaces / Managed DB / Managed Redis
|
|
40
|
-
implementations → [`infra-doks`](../infra-doks/SPEC.md).
|
|
41
|
-
- Standalone Kubernetes / Docker / DO Droplet implementations — no adapter
|
|
42
|
-
package exists yet (see migration debt).
|
|
43
|
-
- Deployment orchestration, manifest generation, env materialization, and the
|
|
44
|
-
`infra/` workspace tree (`infra/manifest.ts`, `infra/generate.ts`,
|
|
45
|
-
`infra/resources/`) → [`deploy`](../deploy/SPEC.md). Per-app
|
|
46
|
-
`deployment.config.ts` files live in `apps/<app>-web/`.
|
|
47
|
-
- Env-requirement resolution against descriptors →
|
|
48
|
-
[`secrets`](../secrets/SPEC.md).
|
|
49
|
-
- AI inference selection. Inference is an `ai/provider` + `ai/adapter`
|
|
50
|
-
concern — see [`ai`](../ai/SPEC.md) and
|
|
51
|
-
[`ai-providers`](../ai-providers/SPEC.md). No `infra/inference` kind exists
|
|
52
|
-
or should be added.
|
|
53
|
-
|
|
54
|
-
## Hard rules
|
|
55
|
-
|
|
56
|
-
- Core never imports adapter packages. Dependencies are exactly
|
|
57
|
-
`@vibesdotdev/runtime` + `zod`.
|
|
58
|
-
- Shared shapes live in `./schemas`. Kind descriptor schemas compose from
|
|
59
|
-
`./schemas`. Do not redeclare an env-requirement schema or any other
|
|
60
|
-
primitive inside a kind file.
|
|
61
|
-
- New deployable resource types are added as new kinds in `src/kinds/`.
|
|
62
|
-
Provider-specific concepts (Wrangler bindings, Helm values, Spaces CORS,
|
|
63
|
-
CF Sandbox outbound proxy specifics, etc.) belong in adapter packages
|
|
64
|
-
registering implementations against the existing kinds.
|
|
65
|
-
- Inference is not an infra kind. New inference strategies (CF Unified
|
|
66
|
-
Inference, Agents bindings, etc.) are added as `ai/provider` descriptors +
|
|
67
|
-
adapters in [`ai-providers`](../ai-providers/SPEC.md).
|
|
68
|
-
- Default implementations are inert pass-throughs that expose the validated
|
|
69
|
-
descriptor as `config`. Real provider behavior must come from an adapter
|
|
70
|
-
package registering an implementation for the same kind.
|
|
71
|
-
- Kind discovery pattern is `**/*.infra.ts` for every kind. Apps and the
|
|
72
|
-
`infra/` workspace declare concrete resources in `*.infra.ts` files; do
|
|
73
|
-
not change the pattern per kind.
|
|
74
|
-
- Pure TypeScript only. No `$env`, `$server`, `$app`, `@sveltejs/kit`,
|
|
75
|
-
Svelte, Drizzle, or filesystem APIs in this package.
|
|
76
|
-
- `deploymentProviderSchema` enumerates exactly the providers backed by an
|
|
77
|
-
active adapter package. Adding a provider value without a corresponding
|
|
78
|
-
adapter is a contract lie — add the adapter or omit the value.
|
|
79
|
-
- `appDeploymentSchema` cross-validates provider against runtime and origin
|
|
80
|
-
hostnames (e.g. `cloudflare-workers` requires `edge`; `digitalocean-app`
|
|
81
|
-
requires `node` or `worker`). Nonsense combinations fail at parse time,
|
|
82
|
-
not deploy time.
|
|
83
|
-
|
|
84
|
-
## Migration debt (completed)
|
|
85
|
-
|
|
86
|
-
- [x] `envRequirementSchema` is locally redeclared in
|
|
87
|
-
`src/kinds/web-app.kind.ts`, `src/kinds/worker.kind.ts`, and
|
|
88
|
-
`src/kinds/sandbox.kind.ts` instead of imported from `./schemas`.
|
|
89
|
-
**Resolution:** Kinds now import `deploymentEnvRequirementSchema` from `./schemas`.
|
|
90
|
-
All kind files use `import { z } from 'zod/v4'` style for consistency.
|
|
91
|
-
- [x] `package.json#exports` includes `"./kinds/*": "./src/kinds/*.ts"`.
|
|
92
|
-
**Resolution:** Wildcard removed. All 26 consumers updated to use `./kinds`
|
|
93
|
-
aggregate subpath instead of deep imports.
|
|
94
|
-
- [x] `deploymentProviderSchema` declares `digitalocean-droplet`,
|
|
95
|
-
`digitalocean-kubernetes`, `kubernetes`, and `docker`, but only
|
|
96
|
-
`digitalocean-app` (via `infra-doks`) and `cloudflare-workers` (via
|
|
97
|
-
`infra-cloudflare`) have active adapter implementations.
|
|
98
|
-
**Resolution:** Trimmed to only `cloudflare-workers` and `digitalocean-app`.
|
|
99
|
-
- [x] `appDeploymentSchema` does not cross-validate provider against runtime.
|
|
100
|
-
**Resolution:** Added `.refine()` enforcing provider × runtime matrix:
|
|
101
|
-
- `cloudflare-workers`: `edge`, `worker`
|
|
102
|
-
- `digitalocean-app`: `node`, `worker`
|
|
103
|
-
- [x] `discoveryPattern` and `extractStem` are duplicated identically across all
|
|
104
|
-
9 kind files.
|
|
105
|
-
**Resolution:** Extracted shared helper in `src/kinds/discovery.ts` with
|
|
106
|
-
`INFRA_DISCOVERY_PATTERN` constant and `extractStem()` function. All 7
|
|
107
|
-
kind files now import and reuse.
|
|
108
|
-
- [x] `WebAppDescriptor` and `appDeploymentSchema` describe overlapping concepts
|
|
109
|
-
(`appDir`, `outputDir`, `runtime`, `env`).
|
|
110
|
-
**Resolution:** The parallel surfaces are **intentional**:
|
|
111
|
-
- `WebAppDescriptor` (runtime-discovered resource) lives at `infra/web-app`
|
|
112
|
-
kind with `adapter`, `domain`, `env`, etc. Used by runtime discovery.
|
|
113
|
-
- `appDeploymentSchema` (authored deployment config) lives in `./schemas` and
|
|
114
|
-
is used by `deployment.config.ts` files with `provider`, `build`, `origins`,
|
|
115
|
-
etc. Both shapes reference similar fields but serve different consumers.
|
|
116
|
-
No merging; keep parallel with potential future composition via shared
|
|
117
|
-
fragment schemas if divergence becomes problematic.
|
|
118
|
-
|
|
119
|
-
## Migration debt
|
|
120
|
-
|
|
121
|
-
- [x] **`adapter` discriminator → `config` field migration.** All 7 original
|
|
122
|
-
infra kinds declare `adapter: z.string()` as a top-level discriminator field.
|
|
123
|
-
This field is not in `RuntimeDescriptorSchema` and `createRuntimeAsset` could not
|
|
124
|
-
validate it. Every infra kind has moved `adapter` and all adapter-specific
|
|
125
|
-
fields into a `config` object validated against the kind's registered
|
|
126
|
-
`descriptorSchema`. **Affected kinds:** `infra/web-app`, `infra/worker`,
|
|
127
|
-
`infra/database`, `infra/queue`, `infra/cache`, `infra/object-storage`,
|
|
128
|
-
`infra/sandbox`, `infra/git-hosting`, `infra/package-registry`.
|
|
129
|
-
- [x] `infra/web-app`: added `WebAppConfigSchema` union
|
|
130
|
-
(cloudflare-workers, digitalocean-apps)
|
|
131
|
-
- [x] `infra/worker`: added `WorkerConfigSchema` union
|
|
132
|
-
(doks-deployment, cloudflare-workers)
|
|
133
|
-
- [x] `infra/database`: added `DatabaseConfigSchema` union
|
|
134
|
-
(doks-statefulset, do-managed-postgres, turso)
|
|
135
|
-
- [x] `infra/queue`: added `QueueConfigSchema` union
|
|
136
|
-
(doks-statefulset, cloudflare-queues)
|
|
137
|
-
- [x] `infra/cache`: added `CacheConfigSchema` union
|
|
138
|
-
(do-managed-redis, cloudflare-kv, doks-redis)
|
|
139
|
-
- [x] `infra/object-storage`: added `ObjectStorageConfigSchema` union
|
|
140
|
-
(do-spaces, cloudflare-r2)
|
|
141
|
-
- [x] `infra/sandbox`: already had all variants (cloudflare-sandbox, docker,
|
|
142
|
-
digitalocean-droplet)
|
|
143
|
-
- [x] `infra/git-hosting`: added `GitHostingConfigSchema` union (gitea-doks)
|
|
144
|
-
- [x] `infra/package-registry`: added `PackageRegistryConfigSchema` union
|
|
145
|
-
(verdaccio-doks)
|
|
146
|
-
|
|
147
|
-
## Public entrypoints
|
|
148
|
-
|
|
149
|
-
`.`, `./schemas`, `./kinds`, `./deployment`, `./plugin`.
|
|
150
|
-
|
|
151
|
-
Wildcard / migration-era subpaths: `./kinds/*` — do not normalize new code
|
|
152
|
-
against this.
|
|
153
|
-
|
|
154
|
-
## Verification
|
|
155
|
-
|
|
156
|
-
`bun test` from `packages/infra-core`. Covers all 9 schemas (accept-valid +
|
|
157
|
-
reject-invalid), all 9 kind descriptor structures, plugin registration shape
|
|
158
|
-
(id, kinds count, kind IDs, discovery pattern, no dependencies, no lifecycle
|
|
159
|
-
hooks), and all 6 factory functions. `bun --bun tsc -p tsconfig.json
|
|
160
|
-
--noEmit` is the type gate.
|
|
161
|
-
|
|
162
|
-
## Links
|
|
163
|
-
|
|
164
|
-
- [infra-cloudflare/SPEC.md](../infra-cloudflare/SPEC.md)
|
|
165
|
-
- [infra-doks/SPEC.md](../infra-doks/SPEC.md)
|
|
166
|
-
- [deploy/SPEC.md](../deploy/SPEC.md)
|
|
167
|
-
- [secrets/SPEC.md](../secrets/SPEC.md)
|
|
168
|
-
- [runtime/SPEC.md](../runtime/SPEC.md)
|
|
169
|
-
- [ai/SPEC.md](../ai/SPEC.md), [ai-providers/SPEC.md](../ai-providers/SPEC.md)
|