@vibesdotdev/config 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 -75
- package/package.json +7 -8
- package/SPEC.md +0 -71
package/README.md
CHANGED
|
@@ -1,85 +1,22 @@
|
|
|
1
1
|
# @vibesdotdev/config
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
runtime resolves storage, environment overlays, and surface forms.
|
|
3
|
+
Configuration manifests, environment resolution, and validation utilities for Vibes applications.
|
|
5
4
|
|
|
6
|
-
|
|
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.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Install
|
|
9
8
|
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export const appConfig = createConfigManifest({
|
|
16
|
-
id: 'app-config',
|
|
17
|
-
name: 'Application Settings',
|
|
18
|
-
tier: 'user',
|
|
19
|
-
schema: z.object({
|
|
20
|
-
apiEndpoint: z.string().url().default('http://localhost:3000'),
|
|
21
|
-
timeout: z.number().default(30000),
|
|
22
|
-
features: z.object({
|
|
23
|
-
experimental: z.boolean().default(false),
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
26
|
-
fields: {
|
|
27
|
-
apiEndpoint: configField('API Endpoint').description('Base URL for API requests'),
|
|
28
|
-
timeout: configField('Timeout').description('Request timeout in milliseconds'),
|
|
29
|
-
'features.experimental': configField('Experimental Features').component('toggle'),
|
|
30
|
-
},
|
|
31
|
-
storage: { namespace: 'app', adapter: 'localdb' },
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Load / get / set
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
import { ConfigManifest } from '@vibesdotdev/config';
|
|
39
|
-
|
|
40
|
-
const config = new ConfigManifest('app-config');
|
|
41
|
-
const values = await config.load();
|
|
42
|
-
const timeout = await config.get('timeout', 30000);
|
|
43
|
-
await config.set('features.experimental', true);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Render a form (Svelte)
|
|
47
|
-
|
|
48
|
-
```svelte
|
|
49
|
-
<script>
|
|
50
|
-
import ManifestForm from '@vibesdotdev/config/adapters/web/components/ManifestForm.svelte';
|
|
51
|
-
import { appConfig } from './app-config';
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<ManifestForm manifest={appConfig} onSubmit={(v) => saveConfig(v)} />
|
|
9
|
+
```sh
|
|
10
|
+
bun add @vibesdotdev/config
|
|
11
|
+
# or
|
|
12
|
+
npm install @vibesdotdev/config
|
|
55
13
|
```
|
|
56
14
|
|
|
57
|
-
|
|
15
|
+
## Documentation
|
|
58
16
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const values = await runManifestPrompts(appConfig);
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Diagnose
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
import { diagnoseConfig } from '@vibesdotdev/config/doctor';
|
|
69
|
-
|
|
70
|
-
const result = diagnoseConfig(manifest, values);
|
|
71
|
-
for (const issue of result.issues) {
|
|
72
|
-
console.log(`[${issue.severity}] ${issue.path}: ${issue.message}`);
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Test
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
bun --bun vitest run
|
|
80
|
-
```
|
|
17
|
+
- Package guide: https://docs.vibes.dev/packages/config
|
|
18
|
+
- Vibes docs: https://docs.vibes.dev
|
|
81
19
|
|
|
82
|
-
##
|
|
20
|
+
## License
|
|
83
21
|
|
|
84
|
-
|
|
85
|
-
- [runtime](../runtime/SPEC.md), [storage](../storage/SPEC.md), [tui](../tui/SPEC.md), [cli](../cli/SPEC.md)
|
|
22
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -364,13 +364,8 @@
|
|
|
364
364
|
"registry": "https://registry.npmjs.org",
|
|
365
365
|
"access": "public"
|
|
366
366
|
},
|
|
367
|
-
"repository": {
|
|
368
|
-
"type": "git",
|
|
369
|
-
"url": "git+https://github.com/vibesdotdev/monorepo.git",
|
|
370
|
-
"directory": "packages/config"
|
|
371
|
-
},
|
|
372
367
|
"peerDependencies": {
|
|
373
|
-
"@vibesdotdev/runtime": "0.0.
|
|
368
|
+
"@vibesdotdev/runtime": "0.0.2"
|
|
374
369
|
},
|
|
375
370
|
"dependencies": {
|
|
376
371
|
"js-yaml": "^4.1.1",
|
|
@@ -392,7 +387,6 @@
|
|
|
392
387
|
"src",
|
|
393
388
|
"bin",
|
|
394
389
|
"README.md",
|
|
395
|
-
"SPEC.md",
|
|
396
390
|
"LICENSE",
|
|
397
391
|
"!src/**/__tests__/**",
|
|
398
392
|
"!src/**/__stubs__/**",
|
|
@@ -413,5 +407,10 @@
|
|
|
413
407
|
],
|
|
414
408
|
"vibes": {
|
|
415
409
|
"visibility": "public-framework"
|
|
410
|
+
},
|
|
411
|
+
"description": "Configuration manifests, environment resolution, and validation utilities for Vibes applications.",
|
|
412
|
+
"homepage": "https://docs.vibes.dev/packages/config",
|
|
413
|
+
"bugs": {
|
|
414
|
+
"url": "https://docs.vibes.dev/packages/config#support"
|
|
416
415
|
}
|
|
417
416
|
}
|
package/SPEC.md
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# @vibesdotdev/config
|
|
2
|
-
|
|
3
|
-
Schema-driven configuration. Zod schemas define config types; the runtime resolves storage, environment overlays, and surface forms.
|
|
4
|
-
|
|
5
|
-
## Owns
|
|
6
|
-
|
|
7
|
-
- **Runtime kinds:** `config/manifest`, `config/collection`, `config/environment`, `settings/section`
|
|
8
|
-
- **`ConfigManifest<T>`** (`./manifest`): load, get, set, validate against a Zod schema; resolves storage adapter through the runtime
|
|
9
|
-
- **`ConfigCollection`** (`./collection`): grouped/related manifests
|
|
10
|
-
- **`SettingsSectionDescriptor`** (`./settings`): pure-data contribution kind. Each owning module registers one or more `settings/section` descriptors naming the `config/manifest` IDs in its section. `assembleSettingsSections(runtime)` concatenates every registered section sorted by `order`. Config never enumerates which sections exist.
|
|
11
|
-
- **Environment system** (`./environment`): `local`, `staging`, `production` descriptors + `environment.plugin`; current-environment detection; per-env value overlays
|
|
12
|
-
- **Form core** (`./form/core`): field resolution, Zod validation, visibility rules, groups
|
|
13
|
-
- **Generic env helpers** (`./env`, `./env.runtime`): `getEnv` / `getEnvNumber` / `getEnvBoolean` / `validateRequiredEnv` / `readRuntimeEnv`. Isomorphic (Node + browser). **No monorepo-wide `env` aggregate** — domain env lives with the domain.
|
|
14
|
-
- **Surface adapters:**
|
|
15
|
-
- `./adapters/cli` — Inquirer-based prompts
|
|
16
|
-
- `./adapters/web` — `ManifestForm.svelte` and Svelte form components
|
|
17
|
-
- `./tui` — OpenTUI/React `config-settings` and `config-registry` descriptors + impls
|
|
18
|
-
- **Loader** (`./loader`): file-loader, discovery, merge, validation, server/client entrypoints
|
|
19
|
-
- **Schema utilities** (`./schema`, `./schemas`)
|
|
20
|
-
- **Routing** (`./routing`): config route registry + merge
|
|
21
|
-
- **CRUD primitives** (`./crud`): base types, schemas, shared helpers
|
|
22
|
-
- **Extensions** (`./extensions`): pluggable extension registry
|
|
23
|
-
- **Services** (`./services`): config accessor, manifest utils, encryption (AES-256-GCM + PBKDF2)
|
|
24
|
-
- **Doctor** (`./doctor`): generic `diagnoseConfig(manifest, values, options)`
|
|
25
|
-
- **Plugins:** `./config.plugin` (core), `./environment/environment.plugin`
|
|
26
|
-
- **Context:** `config.context.descriptor` (DI handle for resolved config)
|
|
27
|
-
|
|
28
|
-
## Does not own
|
|
29
|
-
|
|
30
|
-
- Storage implementations / adapters → [`storage`](../storage/SPEC.md). Config consumes `storage/adapter` through the runtime.
|
|
31
|
-
- Secrets backends (keychain, OS credential store) → [`secrets`](../secrets/SPEC.md). Encryption hands off to storage's encrypted adapters.
|
|
32
|
-
- TUI substrate (gateway, dispatcher, kinds) → [`tui`](../tui/SPEC.md). Config registers TUI assets against tui-owned kinds.
|
|
33
|
-
- CLI runtime / command dispatcher → [`cli`](../cli/SPEC.md).
|
|
34
|
-
- Domain-specific config manifests (AI providers, chat modes, knowledge sources, etc.). Each owning module defines its own `config/manifest` descriptors.
|
|
35
|
-
- AI-specific diagnostics (`diagnoseAIConfig`), AI source maps, chat-mode normalizers — **migrated to `packages/ai/src/config/` on 2026-05-09.** See [`packages/ai/SPEC.md`](../ai/SPEC.md) and `@vibesdotdev/ai/config/*` exports.
|
|
36
|
-
- **Domain env values.** AI provider URLs/keys, OAuth callback URLs, Linear team/status IDs, SMTP/Proton, scheduler crons, rate limits, etc. — owned by the consuming module (`packages/ai`, `packages/auth`, `packages/workers`, `apps/auth-web`, etc.). Config supplies `getEnv` / `getEnvBoolean` / `getEnvNumber`; the domain builds its own typed env from them. **Removed 2026-05-11** along with `./system`, `./schemas/env`, `./schemas/system`, `./settings`, `./form/navigation`.
|
|
37
|
-
- **Hard-coded global settings layout.** The old `./settings/manifest.ts` enumerated domain manifest IDs (`ai.providers`, `chat.modes`, `knowledge.bases`, …) in a single hard-coded list — that violated the no-domain-manifests rule. The current `./settings` exposes the `settings/section` contribution kind instead: each owning module's plugin registers its section via `descriptors: [...]` and `assembleSettingsSections(runtime)` concatenates them. Config never enumerates which sections exist.
|
|
38
|
-
- **`DEFAULT_PAGES` navigation table.** Same pattern — the deleted `./form/navigation` bundled an `ai`/`knowledge`/`session` page list. If page-tree navigation comes back, the page list is supplied by callers, not baked into config.
|
|
39
|
-
|
|
40
|
-
## Hard rules
|
|
41
|
-
|
|
42
|
-
- **All config access goes through `ConfigManifest` or storage manifest.** No raw `fs.readFileSync` / `node:fs/promises` in config code. All persistence is runtime-resolved through storage adapters.
|
|
43
|
-
- **Resolution order is canonical:** env var → env-specific config file → base config file → schema default. Don't invent alternative orders.
|
|
44
|
-
- **Sensitive values use storage-adapter encryption, not Zod markers.** No `.encrypted()` extension on schemas. Encryption is a property of the storage adapter the manifest binds to.
|
|
45
|
-
- **Storage adapter selection is runtime-resolved.** Manifests declare what storage they want; the runtime picks the implementation. No `if (isCloud)` branches in config code.
|
|
46
|
-
- **Bootstrap order:** `storage` plugin → `config.plugin` → `environment.plugin` → consumers. Do not reorder.
|
|
47
|
-
- **`./ai/*` subpath removed (2026-05-09).** AI config utilities now live at `@vibesdotdev/ai/config/*`. Do not recreate.
|
|
48
|
-
- **No `config.ai` state here.** The stable `config.ai` TUI state id is registered by `@vibesdotdev/ai`; consumers resolve it through `runtime.query('tui/state')`.
|
|
49
|
-
- **No domain manifests in this package.** If a manifest is "AI providers" or "chat modes" or "tools agents," it lives in the owning module, not here.
|
|
50
|
-
- **No monorepo-wide `env` aggregate.** `@vibesdotdev/config/env` exports only the generic helpers (`getEnv`, `getEnvNumber`, `getEnvBoolean`, `validateRequiredEnv`). Do not reintroduce a `services.{ollama,…}` / `ai.{openai,…}` / `oauth.{github,…}` / `email.{…}` god-object. Domain env lives with the domain.
|
|
51
|
-
- **Domain env must be Zod-validated at its owning module's boundary.** Each owning module's `src/config/env.schema.ts` defines a Zod schema; `env.ts` parses `process.env` once through that schema and exports a typed value. No untyped `process.env.X` access in feature code.
|
|
52
|
-
- **Global settings layout is contributed, not enumerated.** Surfaces call `assembleSettingsSections(runtime)`; modules contribute `settings/section` descriptors via their plugin's `descriptors: [...]`. The owning module decides which of its `config/manifest` IDs participate in its section.
|
|
53
|
-
|
|
54
|
-
## Public entrypoints
|
|
55
|
-
|
|
56
|
-
`package.json#exports` is canonical. Grouped: `.`, `./manifest/*`, `./form` + `./form/core/*`, `./loader/*`, `./schema/*`, `./schemas/*`, `./routing/*`, `./crud/*`, `./collection/*`, `./extensions/*`, `./services/*`, `./settings` + `./settings/*`, `./adapters/cli/*`, `./adapters/web/*`, `./browser`, `./server`, `./common`, `./cli/*`, `./tui/*`, `./environment/*`, `./client/*`, `./env`, `./env.runtime`, `./system-constants`, `./doctor`, `./plugin` (= `./config.plugin`).
|
|
57
|
-
|
|
58
|
-
Removed entries (do not reintroduce without restoring the domain-ownership review): `./system`, `./form/navigation`, `./form/navigation/*`, `./schemas/env`, `./schemas/system`.
|
|
59
|
-
|
|
60
|
-
Note: `./settings` is reintroduced as the runtime-first contribution surface (descriptor schema + assembly helper). It does **not** export a hard-coded manifest list — see Hard rules.
|
|
61
|
-
|
|
62
|
-
## Verification
|
|
63
|
-
|
|
64
|
-
`bun --bun vitest run` from package root. Covers manifest CRUD, form core (field resolution, validation, visibility), encryption roundtrip, environment detection, doctor diagnostics, loader/merge.
|
|
65
|
-
|
|
66
|
-
## Links
|
|
67
|
-
|
|
68
|
-
- [runtime/SPEC.md](../runtime/SPEC.md)
|
|
69
|
-
- [storage/SPEC.md](../storage/SPEC.md)
|
|
70
|
-
- [tui/SPEC.md](../tui/SPEC.md)
|
|
71
|
-
- [cli/SPEC.md](../cli/SPEC.md)
|