everything-dev 1.35.3 → 1.35.5

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.
@@ -2,7 +2,7 @@
2
2
  name: dev-workflow
3
3
  description: Development workflow for everything-dev projects using bos dev, bos start, and the Module Federation runtime. Use when starting dev servers, debugging hot reload, or understanding the service-descriptor architecture.
4
4
  metadata:
5
- sources: "src/service-descriptor.ts,src/orchestrator.ts,src/dev-logs.ts,src/host.ts"
5
+ sources: "packages/everything-dev/src/service-descriptor.ts,packages/everything-dev/src/orchestrator.ts,packages/everything-dev/src/dev-logs.ts,packages/everything-dev/src/dev-session.ts"
6
6
  ---
7
7
 
8
8
  # everything-dev Development Workflow
@@ -28,7 +28,7 @@ bos dev # Full local (rarely needed)
28
28
  | auth | 3002 | http://localhost:3002 |
29
29
  | ui | 3003 | http://localhost:3003 |
30
30
  | ui-ssr | 3004 | http://localhost:3004 |
31
- | plugins | 3010+ | http://localhost:3010+ |
31
+ | plugins | 3010+ | http://localhost:3010+ (incremental — one per plugin in config order) |
32
32
 
33
33
  ## Service-Descriptor Architecture
34
34
 
@@ -49,6 +49,8 @@ The orchestrator:
49
49
 
50
50
  - **UI changes**: Rsbuild HMR — instant at :3003, no rebuild
51
51
  - **API changes**: Rspack HMR — instant at :3001, no rebuild
52
+ - **Auth / Plugin changes**: No HMR — require full restart (`bos kill && bos dev`)
53
+ - **SSR (ui-ssr)**: No HMR — restart required after UI changes
52
54
  - **Config changes**: Require host restart (`bos kill && bos dev`)
53
55
 
54
56
  ## Contract Sync & Type Generation
@@ -79,6 +81,8 @@ bos types gen # Regenerate ui/src/lib/api-types.gen.ts and api/src/lib/plugins
79
81
 
80
82
  The host reads `BOS_RUNTIME_CONFIG` at startup (resolved from `bos.config.json` by the CLI). `ConfigService` is an immutable Effect Layer — every service is built from that one snapshot.
81
83
 
84
+ **Override for testing**: Set `BOS_RUNTIME_CONFIG` env var to a JSON string or file path to bypass config loading from disk. Useful for testing with different configs without modifying `bos.config.json`.
85
+
82
86
  On page refresh:
83
87
  1. Browser re-fetches HTML shell from host
84
88
  2. Host injects current config into `window.__RUNTIME_CONFIG__`
@@ -99,21 +103,45 @@ Build configs (rsbuild/rspack) read from `.bos/bos.resolved-config.json` first,
99
103
  ```bash
100
104
  bos ps # List running processes + ports
101
105
  bos status # Check remote health
106
+ bos info # Show current configuration
102
107
  ls .bos/logs/ # Available log files
103
108
  cat .bos/logs/api.log # API process logs
104
109
  ```
105
110
 
106
- API not responding:
111
+ ### Port Conflicts
112
+
113
+ If a port is already in use, the local service fails to start. Check what's on the port:
114
+
115
+ ```bash
116
+ lsof -i :3003 # Check what is using port 3003
117
+ ```
118
+
119
+ Kill the conflicting process and retry, or stop the existing `bos dev` session first.
120
+
121
+ ### Stale PID file
122
+
123
+ If `bos kill` doesn't run cleanly (e.g., terminal was closed), stale PIDs in `.bos/pids.json` can block restart:
124
+
125
+ ```bash
126
+ rm .bos/pids.json # Clear stale PID tracking
127
+ bos dev # Start fresh
128
+ ```
129
+
130
+ ### API not responding
131
+
107
132
  1. `bos ps` — is API running?
108
133
  2. `.bos/logs/api.log` — startup errors?
109
134
  3. `curl http://localhost:3001/remoteEntry.js` — is the entry accessible?
110
135
 
111
- UI not loading:
136
+ ### UI not loading
137
+
112
138
  1. Check browser console for Module Federation errors
113
139
  2. `bos.config.json` — is `app.ui.development` correct?
114
- 3. Clear browser cache and hard reload
140
+ 3. Clear browser cache and hard reload (Cmd+Shift+R)
141
+ 4. Verify UI SSR restart if using SSR
142
+
143
+ ### Module Federation errors
115
144
 
116
- Module Federation errors:
117
145
  - Verify shared dependency versions match across package.json files
118
146
  - Clear browser cache (Cmd+Shift+R)
119
147
  - Check `bos.config.json` URLs are accessible
@@ -2,7 +2,7 @@
2
2
  name: extends-config
3
3
  description: How bos.config.json extends chains work, deep merge semantics, resolved config lifecycle, env-specific extends, and canonical field ordering. Use when debugging extends inheritance, configuring per-environment parents, understanding what dev writes vs publish writes, or reasoning about config merging.
4
4
  metadata:
5
- sources: "src/merge.ts,src/config.ts,src/shared-deps.ts,src/types.ts"
5
+ sources: "packages/everything-dev/src/merge.ts,packages/everything-dev/src/config.ts,packages/everything-dev/src/shared-deps.ts,packages/everything-dev/src/types.ts"
6
6
  ---
7
7
 
8
8
  # extends & Config Merging
@@ -151,6 +151,16 @@ The `_resolved` metadata is stripped before use.
151
151
 
152
152
  When host is remote, `syncResolvedSharedDeps()` reads versions from `bos.config.json` and writes them into `package.json` catalog. No resolved config is written — the remote host reads `bos.config.json` directly.
153
153
 
154
+ ### `_resolved.resolvedAt`
155
+
156
+ The `resolvedAt` timestamp in `.bos/bos.resolved-config.json` is metadata for debugging only. It is not used for staleness detection — the CLI always re-resolves on `bos dev` / `bos build`.
157
+
158
+ ## Circular Extends Detection
159
+
160
+ If the extends chain contains a cycle (e.g., A→B→A), the resolver detects it during config loading and throws an error listing the cycle path. This prevents infinite recursion during merge.
161
+
162
+ Detection occurs in `resolveExtendsRef()` → `mergeBosConfigWithExtends()`. The extends chain is tracked as a set of visited BOS refs; a duplicate visit triggers the error.
163
+
154
164
  ## Canonical Field Ordering
155
165
 
156
166
  `BOS_CONFIG_ORDER` enforces consistent key order:
@@ -158,24 +168,26 @@ When host is remote, `syncResolvedSharedDeps()` reads versions from `bos.config.
158
168
  1. `extends` — always first
159
169
  2. `account`
160
170
  3. `domain`
161
- 4. `testnet`
162
- 5. `staging`
163
- 6. `repository`
164
- 7. `app`
165
- 8. `plugins`
166
- 9. `shared`
171
+ 4. `title`
172
+ 5. `description`
173
+ 6. `testnet`
174
+ 7. `staging`
175
+ 8. `repository`
176
+ 9. `ci`
177
+ 10. `app`
178
+ 11. `plugins`
167
179
 
168
180
  Unknown keys go after known keys. `rebuildOrderedConfig()` is applied before every write.
169
181
 
170
182
  ## API
171
183
 
172
- From `src/config.ts`:
184
+ From `packages/everything-dev/src/config.ts`:
173
185
  - `writeResolvedConfig(configDir, config, env, extendsChain?)` — writes `.bos/bos.resolved-config.json`
174
186
  - `loadResolvedConfig(configDir)` — reads resolved config, returns `BosConfig | null`
175
187
  - `resolveBosConfigPath(configDir)` — returns resolved config path if exists, else `bos.config.json`
176
188
  - `readBosConfigForBuild(configDir)` — reads resolved config stripping `_resolved`, falls back to `bos.config.json`
177
189
 
178
- From `src/merge.ts`:
190
+ From `packages/everything-dev/src/merge.ts`:
179
191
  - `mergeBosConfigWithExtends(parent, child)` — deep merge for extends chain
180
192
  - `mergeBosConfigWithTemplate(local, template)` — merge for sync (local wins)
181
193
  - `resolveExtendsRef(extendsField, env)` — resolve string|object extends for a given env
@@ -2,7 +2,7 @@
2
2
  name: init-upgrade
3
3
  description: bos init, bos sync, and bos upgrade workflows — template download, snapshot-based conflict detection, package version bumps, and how init/sync select and own files. Use when scaffolding new projects, syncing upstream changes, or upgrading framework packages.
4
4
  metadata:
5
- sources: "src/cli/init.ts,src/cli/sync.ts,src/cli/upgrade.ts,src/cli/snapshot.ts"
5
+ sources: "packages/everything-dev/src/cli/init.ts,packages/everything-dev/src/cli/sync.ts,packages/everything-dev/src/cli/upgrade.ts,packages/everything-dev/src/cli/snapshot.ts,packages/everything-dev/src/merge.ts"
6
6
  ---
7
7
 
8
8
  # bos init, sync, upgrade
@@ -23,8 +23,8 @@ bos init --overrides ui,api,host # Include host locally
23
23
  3. Build the file list with `buildInitPatterns(overrides, plugins)`
24
24
  4. Filter plugins: only included plugins + their routes are copied
25
25
  5. `personalizeConfig()` — sets `extends`, `account`, `domain`, removes production URLs
26
- 6. `resolveWorkspaceRefs()` — normalizes package manifests, sets catalog refs
27
- 7. Write initial snapshot (`.bos/sync-snapshot.json`)
26
+ 6. `resolveWorkspaceRefs()` — normalizes each workspace `package.json`: rewrites `file:`/`workspace:*` refs to `catalog:`, ensures all workspace packages are listed in root `workspaces.catalog`, pins framework versions (`everything-dev`, `every-plugin`)
27
+ 7. Write initial snapshot (`.bos/sync-snapshot.json`) — records file path → content hash for all template-origin files, used later by `bos sync` for conflict detection
28
28
  8. `bun install` + `bos types gen`
29
29
 
30
30
  ## Shared Host + Custom Child App
@@ -188,22 +188,18 @@ Workspace packages use `catalog:` refs so a single version bump in root catalog
188
188
 
189
189
  ## bos publish
190
190
 
191
+ See `everything-dev#publish-sync` for the full publish workflow. A quick reference:
192
+
191
193
  ```bash
192
194
  bos publish # Publish config to FastKV
193
195
  bos publish --deploy # Build, deploy to CDN, then publish
194
196
  ```
195
197
 
196
- On `--deploy`:
197
- 1. Build all workspace targets
198
- 2. Deploy to Zephyr CDN → auto-updates `bos.config.json` with production URLs + integrity
199
- 3. Re-read config to pick up deploy updates
200
- 4. Publish full config to FastKV registry
201
-
202
- **This is the only time `bos dev`-style writes touch `bos.config.json`** — it's the snapshot moment.
198
+ `bos publish --deploy` builds, deploys to Zephyr, auto-updates `bos.config.json` with production URLs + integrity hashes, then publishes the config to FastKV.
203
199
 
204
200
  ## Canonical Ordering
205
201
 
206
202
  All writes to `bos.config.json` enforce `BOS_CONFIG_ORDER`:
207
- `extends` → `account` → `domain` → `testnet` → `staging` → `repository` → `app` → `plugins`
203
+ `extends` → `account` → `domain` → `title` → `description` → `testnet` → `staging` → `repository` → `ci` → `app` → `plugins`
208
204
 
209
- Unknown keys go after known keys.
205
+ Unknown keys go after known keys. See `everything-dev#extends-config` for full ordering details.
@@ -2,7 +2,7 @@
2
2
  name: publish-sync
3
3
  description: Publish bos.config.json to the FastKV registry, sync from upstream, and upgrade workspace packages. Use when deploying, syncing, or managing runtime configuration across projects.
4
4
  metadata:
5
- sources: "src/plugin.ts,src/cli/sync.ts,src/cli/upgrade.ts,src/fastkv.ts,src/integrity.ts"
5
+ sources: "packages/everything-dev/src/plugin.ts,packages/everything-dev/src/cli/sync.ts,packages/everything-dev/src/cli/upgrade.ts,packages/everything-dev/src/fastkv.ts,packages/everything-dev/src/integrity.ts,packages/everything-dev/src/config.ts"
6
6
  ---
7
7
 
8
8
  # everything-dev Publish & Sync
@@ -33,6 +33,19 @@ After `bos publish --deploy`:
33
33
  2. `bos.config.json` is auto-updated with production URLs + integrity hashes
34
34
  3. Config is published to the FastKV registry at `{account}/bos/gateways/{gateway}/bos.config.json`
35
35
 
36
+ The `--network` flag controls the NEAR network (mainnet by default). With `--network testnet`, publishes go to the NEAR testnet chain under the testnet account specified in config.
37
+
38
+ ### Rollback
39
+
40
+ To revert a publish, restore the previous `bos.config.json` from git and re-publish:
41
+
42
+ ```bash
43
+ git checkout HEAD~1 -- bos.config.json
44
+ bos publish
45
+ ```
46
+
47
+ Or cherry-pick a specific version of `bos.config.json` and publish that snapshot.
48
+
36
49
  Lineage model:
37
50
  - `extends` is the canonical parent edge between published runtimes
38
51
  - `account` is the tenant namespace root for that runtime
@@ -140,13 +153,7 @@ For remix-host browsing with the apps plugin:
140
153
 
141
154
  ### What bos dev writes vs bos publish writes
142
155
 
143
- | Mode | Writes to | File |
144
- |------|-----------|------|
145
- | `bos dev` | `.bos/bos.resolved-config.json` | Full merged config (gitignored) |
146
- | `bos build` | `.bos/bos.resolved-config.json` | Full merged config |
147
- | `bos publish --deploy` | `bos.config.json` | Snapshot with pinned production URLs |
148
- | `bos plugin publish` | `bos.config.json` | Records production URL + integrity |
149
- | `bos sync` | `bos.config.json` | Merges template updates |
156
+ See `everything-dev#extends-config` for the full table. In short: `bos dev` and `bos build` write to `.bos/bos.resolved-config.json` (gitignored); `bos publish --deploy`, `bos plugin publish`, and `bos sync` write to `bos.config.json`.
150
157
 
151
158
  ## Troubleshooting
152
159
 
@@ -155,7 +162,25 @@ bos info # Show current configuration
155
162
  bos status # Check remote health
156
163
  ```
157
164
 
158
- Process issues:
165
+ ### FastKV publish failures
166
+
167
+ - **NEAR RPC error**: Verify the configured NEAR account has sufficient gas and the FastKV contract is deployed at `{account}/bos/gateways/{gateway}/bos.config.json`
168
+ - **Account mismatch**: The `bos.config.json` `account` field must match the on-chain account that owns the FastKV path
169
+ - **Network mismatch**: Ensure `--network` matches where the account is deployed (mainnet vs testnet)
170
+ - **Dry-run first**: Use `bos publish --dry-run` to preview before sending
171
+
172
+ ### Integrity verification
173
+
174
+ During `bos publish --deploy`, integrity SRI hashes are auto-generated for each remote entry and stored in `bos.config.json`. At runtime, the host:
175
+ - Verifies integrity on first load using bounded streaming (not full-response buffering)
176
+ - Uses stale-while-revalidate for asset requests to avoid latency spikes
177
+ - Blocks HTML and SSR requests on integrity mismatch
178
+ - Identifies SSR modules by both URL and `ssrIntegrity` hash in the cache
179
+
180
+ If a remote entry fails integrity check, the host rejects it and falls back to client-rendered output without that remote.
181
+
182
+ ### Process issues
183
+
159
184
  ```bash
160
185
  bos kill # Kill all tracked processes
161
186
  bun install # Reinstall deps
@@ -98,7 +98,7 @@ ALLOW_UNTRUSTED_SSR=false
98
98
  ```
99
99
 
100
100
  Meaning:
101
- - `ALLOW_OVERRIDE` controls which tenant config sections can affect request-scoped composition
101
+ - `ALLOW_OVERRIDE` controls which tenant config sections can affect request-scoped composition. Format: comma-separated list (e.g., `ui,plugins.*`) where `plugins.*` is a glob matching all plugin overrides
102
102
  - `TENANT_WHITELIST` controls which tenants may use SSR
103
103
  - `ALLOW_UNTRUSTED_SSR=true` allows SSR for any valid tenant with SSR config
104
104
 
@@ -128,6 +128,28 @@ The tenant config must:
128
128
  - Asset requests use stale-while-revalidate verification to avoid latency spikes.
129
129
  - HTML and SSR requests use blocking verification.
130
130
  - SSR module cache identity includes `ssrIntegrity`, not just the SSR URL.
131
+ - **On integrity failure**: the host rejects the remote entry. HTML and SSR requests block immediately; asset requests fall back. The page renders client-side without the failed remote.
132
+
133
+ ## Tenant Config Caching
134
+
135
+ The host caches resolved tenant configs in memory. Cache TTL is managed by the tenant runtime service (`host/src/services/tenant-runtime.ts`). After publishing tenant config changes, a host restart is typically required to pick up fresh config unless the cache TTL has expired.
136
+
137
+ ## Debugging Tenant Resolution
138
+
139
+ If tenant overrides are not applying as expected:
140
+
141
+ 1. **Verify the tenant config exists in FastKV**: The config must be published to `{tenantAccount}/bos/gateways/{gateway}/bos.config.json`
142
+ 2. **Check extends chain**: The tenant config must extend the base runtime via its `extends` field
143
+ 3. **Check host logs**: Run `cat .bos/logs/host.log` and look for tenant resolution messages — the host logs which runtime config it resolved for each request
144
+ 4. **Check env vars**: `ALLOW_OVERRIDE` must include the sections you're overriding (e.g., `ui` or `plugins.*`)
145
+ 5. **Verify integrity**: If tenant remote URLs have integrity hashes, the host validates them — mismatches cause rejection
146
+ 6. **Missing tenant config**: If the tenant config is not found in FastKV, the host silently serves the base runtime config without tenant overrides — no error is surfaced to the browser
147
+
148
+ ### Diagnostics
149
+
150
+ - `bos info` shows the active runtime configuration loaded by the CLI
151
+ - The host logs the resolved tenant account per request at startup
152
+ - Compare the tenant's published config against the base runtime using `bos info` in the tenant project directory
131
153
 
132
154
  ## Recommended Workflow
133
155