vite-plugin-zephyr 1.4.2 → 1.6.0
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 +25 -0
- package/dist/lib/vite-plugin-zephyr.js +11 -1
- package/dist/lib/vite-plugin-zephyr.mjs +12 -2
- package/package.json +7 -2
- package/skills/zephyr-core/LICENSE +201 -0
- package/skills/zephyr-core/README.md +13 -0
- package/skills/zephyr-core/SKILL.md +114 -0
- package/skills/zephyr-core/references/attribution-storage.md +144 -0
- package/skills/zephyr-core/references/change-attribution.md +172 -0
- package/skills/zephyr-core/references/deployment-model.md +123 -0
- package/skills/zephyr-core/references/docs-map.md +27 -0
- package/skills/zephyr-core/references/env-vars.md +75 -0
- package/skills/zephyr-core/references/examples-resume.md +81 -0
- package/skills/zephyr-core/references/sdk-setup.md +202 -0
- package/skills/zephyr-core/references/troubleshooting.md +48 -0
- package/skills/zephyr-module-federation/LICENSE +201 -0
- package/skills/zephyr-module-federation/README.md +12 -0
- package/skills/zephyr-module-federation/SKILL.md +62 -0
- package/skills/zephyr-module-federation/references/docs-map.md +10 -0
- package/skills/zephyr-module-federation/references/examples.md +33 -0
- package/skills/zephyr-module-federation/references/gotchas.md +54 -0
- package/skills/zephyr-module-federation/references/remote-resolution.md +98 -0
- package/skills/zephyr-module-federation/references/setup-patterns.md +128 -0
- package/skills/zephyr-vite/SKILL.md +122 -0
- package/skills/zephyr-vite/references/build-lifecycle.md +70 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Change Attribution
|
|
2
|
+
|
|
3
|
+
Use when enabling optional human/AI attribution or comparing versions built from
|
|
4
|
+
uncommitted source. The Zephyr Attribution integration uses Git AI; a skill alone
|
|
5
|
+
cannot reliably observe file writes.
|
|
6
|
+
|
|
7
|
+
## Enable with consent
|
|
8
|
+
|
|
9
|
+
The `with-zephyr` CLI offers **Enable Change Attribution** after SDK setup in an
|
|
10
|
+
interactive terminal. It links to [Git AI installation](https://usegitai.com/docs/get-started)
|
|
11
|
+
and separately offers **Install Agent Integrations**. Non-interactive invocation
|
|
12
|
+
does not opt in; `--dry-run` and `--no-attribution` do not create configuration.
|
|
13
|
+
Explicit non-interactive setup:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm dlx with-zephyr . --attribution --attribution-agents codex claude grok
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Storage defaults to **local**. The interactive offer also asks local versus
|
|
20
|
+
remote; `--attribution-storage remote` selects remote explicitly. Read
|
|
21
|
+
[repository storage and policy](attribution-storage.md) before enabling remote:
|
|
22
|
+
free accounts include patches/changed-line text; paid/BYOC defaults omit them.
|
|
23
|
+
|
|
24
|
+
This writes repository-root `.zephyr/attribution.json` and merges hooks into
|
|
25
|
+
`.codex/hooks.json`, `.claude/settings.json`, and/or `.grok/hooks/zephyr-attribution.json`. Codex/Grok also install `.zephyr/attribution-hook.cjs` for metadata. It preserves existing hooks
|
|
26
|
+
and settings, validates documents before writing, and does not modify global
|
|
27
|
+
settings or grant hook trust. Review the Codex project hooks with `/hooks` and
|
|
28
|
+
restart agent sessions. Grok requires its native project trust review (`/hooks-trust`); this grants folder trust for its other project integrations too. T3 uses the same Grok integration through ACP. Install the Git AI binary separately through its linked
|
|
29
|
+
instructions; the codemod does not run a downloaded installer. Skip the agents
|
|
30
|
+
flag for source capture only, or when existing Git AI hooks already cover the
|
|
31
|
+
agents. The installer may also configure agent hooks globally; avoid duplicating
|
|
32
|
+
the same integration at global and project scope.
|
|
33
|
+
|
|
34
|
+
Known human evidence needs a Git AI editor integration, available through the
|
|
35
|
+
same setup link. Agent hooks alone do not establish which remaining edits were
|
|
36
|
+
human. Missing evidence always remains **unknown**.
|
|
37
|
+
|
|
38
|
+
## Source records and comparisons
|
|
39
|
+
|
|
40
|
+
An opted-in SDK captures repository-wide Git-eligible working-tree files,
|
|
41
|
+
including unstaged and untracked files, rather than substituting HEAD or the
|
|
42
|
+
index. A deterministic fingerprint covers paths, file modes, and content hashes.
|
|
43
|
+
Private immutable source copies and version-to-source receipts stay under the
|
|
44
|
+
worktree's Git directory, in `zephyr-attribution/`. They are never build assets.
|
|
45
|
+
Comparisons require those local copies; a fresh clone cannot retrieve them from
|
|
46
|
+
Zephyr or Git AI notes. They are not synchronized or pruned automatically.
|
|
47
|
+
|
|
48
|
+
Install `zephyr-cli` to inspect the records without login or deployment:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm exec ze-cli attribution status
|
|
52
|
+
pnpm exec ze-cli attribution capture --format json
|
|
53
|
+
# Use the two sourceId values returned by capture, or local Zephyr snapshot IDs.
|
|
54
|
+
pnpm exec ze-cli attribution compare <before> <after> --format json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Use `-C <project>` to select another project. Differences report additions,
|
|
58
|
+
removals, binary changes, and file modes. Attribution on a removed line describes
|
|
59
|
+
its original contributor; it does not identify who deleted it. Reverted edits
|
|
60
|
+
disappear from the net source difference.
|
|
61
|
+
|
|
62
|
+
Local mode attaches no attribution to uploaded snapshots or build stats. Remote
|
|
63
|
+
mode sends full evidence to a dedicated private endpoint and includes a small
|
|
64
|
+
acknowledged record reference in snapshot/build-stat `changeAttribution`. The
|
|
65
|
+
authenticated snapshot `creator` remains the deployer; contributor identities
|
|
66
|
+
are self-reported Git AI evidence, not verified people. Server endpoint/policy
|
|
67
|
+
persistence and a dashboard version-difference UI require control-plane support
|
|
68
|
+
and are not implemented in this SDK workspace.
|
|
69
|
+
|
|
70
|
+
## Harness, prompt initiator, effort, and usage
|
|
71
|
+
|
|
72
|
+
`workspaceHuman` identifies the Git author associated with a capture. Hooks-off AI
|
|
73
|
+
changes can appear under this identity, but their edit origin remains unknown.
|
|
74
|
+
The Git author, prompting human, and authenticated snapshot creator are separate.
|
|
75
|
+
Set `ZE_ATTRIBUTION_INITIATOR` in each person's launcher environment to record the
|
|
76
|
+
prompt initiator, and `ZE_ATTRIBUTION_HARNESS` to identify a wrapper such as `t3`
|
|
77
|
+
versus `codex-cli`. For T3, configure these in the selected project/provider's
|
|
78
|
+
environment settings. These are self-reports, not verified account assertions;
|
|
79
|
+
do not put a shared person's identity into team-wide hooks. Missing values stay
|
|
80
|
+
absent. A skill cannot reliably prove which person typed a prompt.
|
|
81
|
+
|
|
82
|
+
Codex/Grok collect a private metadata ledger under the worktree Git directory.
|
|
83
|
+
Line origins join exact tool-call identities into `sessions`, keyed by agent,
|
|
84
|
+
native session, and turn. Model and effort changes retain the earlier turn's
|
|
85
|
+
metadata. Codex effort/provider/counters use a bounded optional rollout adapter
|
|
86
|
+
tested with CLI 0.160.0; rollout parsing is not a stable API. Grok model/effort
|
|
87
|
+
use its observed summary and usage files, tested with CLI 1.0.46 and T3 0.0.44.
|
|
88
|
+
Unsupported/missing metadata does not invent defaults. Grok uses Git AI's public
|
|
89
|
+
`agent-v1` interface; no fork is required for this bridge.
|
|
90
|
+
|
|
91
|
+
Grok 1.0.46 omits prompt IDs on tool events. The bridge brackets an active prompt
|
|
92
|
+
from `UserPromptSubmit` to `Stop`/cancellation and marks `turnAssociation` as
|
|
93
|
+
`active-prompt`, an inferred association. Native Codex turn IDs are marked
|
|
94
|
+
`native-turn-id`. Unassociated/background completions stay unknown. Concurrent
|
|
95
|
+
or background Grok work needs stronger native event linkage before claiming an
|
|
96
|
+
exact prompt association. Integration labels alone do not prove the harness.
|
|
97
|
+
|
|
98
|
+
Usage and cost belong to sessions, not individual lines. Session-cumulative
|
|
99
|
+
snapshots are **not additive**, including across model switches or versions.
|
|
100
|
+
The captured cost is either unavailable or harness-reported USD ticks with an
|
|
101
|
+
observation timestamp and partial flag. It is not inferred from token counts or
|
|
102
|
+
presented as an invoice. [xAI defines one USD as 10 billion USD ticks](https://docs.x.ai/developers/cost-tracking).
|
|
103
|
+
Hook-time Grok counters can lag a turn; only a native
|
|
104
|
+
finished-turn match refreshes them, otherwise they remain incomplete/partial.
|
|
105
|
+
Historical source receipts retain their observed metadata. Raw prompts,
|
|
106
|
+
responses, transcript paths, and arbitrary provider fields are not published.
|
|
107
|
+
|
|
108
|
+
## Coverage and correctness
|
|
109
|
+
|
|
110
|
+
- Git-ignored files, common build output (`dist`, `build`, `.next`, `.nuxt`,
|
|
111
|
+
`.output`), dependency/cache folders, `.env*`, `.npmrc`, `.netrc`, and private
|
|
112
|
+
key extensions are excluded. Add repository-relative prefixes to `exclude`
|
|
113
|
+
in the configuration. This is a scoped source record, not a complete build
|
|
114
|
+
reproduction or a general secret detector.
|
|
115
|
+
- Captures are limited to 20,000 files and 50 MiB. Submodules need exclusions.
|
|
116
|
+
Failures produce `unavailable` metadata rather than a partial source claim.
|
|
117
|
+
- Vite and `ze-cli <build>` observe source at build start and snapshot creation.
|
|
118
|
+
`boundary-match` means those two observations match; it does not prove no
|
|
119
|
+
transient edit occurred between observations. `changed-during-build` means
|
|
120
|
+
the records differ and neither should be presented as the exact consumed
|
|
121
|
+
inputs. Other engine adapters observe their generation start and publication;
|
|
122
|
+
prebuilt deployments observe upload preparation rather than the earlier compiler
|
|
123
|
+
invocation. Each generation uses at most one start and one publication copy.
|
|
124
|
+
- The Git AI working-log adapter supports `checkpoint/1.0.0` from Git AI 1.7.x,
|
|
125
|
+
tested with 1.7.5. It accepts attribution only when the checkpoint's content
|
|
126
|
+
hash matches the captured file. Stale checkpoints remain unknown. Committed
|
|
127
|
+
blame is deferred to files changed in local/remote comparisons, only for bytes
|
|
128
|
+
matching the captured commit. Captures retain working-checkpoint ranges and
|
|
129
|
+
mark matching committed bytes privately; unchanged files do not trigger blame
|
|
130
|
+
processes at build start. HEAD trees are read once and missing baseline blobs
|
|
131
|
+
in one batch. Comparison enrichment never rewrites the original receipts. Legacy untracked
|
|
132
|
+
`Human` checkpoints are not known-human evidence.
|
|
133
|
+
Since Git AI 1.7 JSON blame omits known humans, the adapter follows native Git
|
|
134
|
+
line origins into explicit `authorship/3.0.0` human attestations in local
|
|
135
|
+
`refs/notes/ai`. A commit's ordinary author is never sufficient evidence.
|
|
136
|
+
- `gitAiPath` can point to a compatible fork. Keep format changes behind the
|
|
137
|
+
adapter; don't infer authorship from file style or the absence of AI marks.
|
|
138
|
+
|
|
139
|
+
To disable capture, set `enabled` to `false`. Remove the installed Git AI and metadata command
|
|
140
|
+
entries from project hook documents to stop those hooks, retaining other hooks.
|
|
141
|
+
Existing local receipts remain available until explicitly deleted.
|
|
142
|
+
|
|
143
|
+
## Maintainer verification
|
|
144
|
+
|
|
145
|
+
`scripts/verify-change-attribution.mjs` builds an actual generated React/Vite app
|
|
146
|
+
three times with the local SDK. It uses the real Git AI binary and replays Codex
|
|
147
|
+
and editor hook fixtures, including a model field. It replaces the cloud transport
|
|
148
|
+
and checks same-commit source differences containing AI, known-human, and unknown
|
|
149
|
+
origins. Hook replays verify integration compatibility; they do not establish
|
|
150
|
+
that a real human typed the fixture or that a live Codex session used that model.
|
|
151
|
+
|
|
152
|
+
After building `create-zephyr-apps`, `with-zephyr`, `zephyr-agent`, `zephyr-cli`,
|
|
153
|
+
and `vite-plugin-zephyr` locally:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
node libs/create-zephyr-apps/dist/index.js /tmp/zephyr-attribution-demo --template react-vite --package-manager pnpm --git --install --json
|
|
157
|
+
node libs/with-zephyr/dist/index.js /tmp/zephyr-attribution-demo --attribution --attribution-agents codex --git-ai-path /absolute/path/to/git-ai
|
|
158
|
+
node scripts/verify-change-attribution.mjs /tmp/zephyr-attribution-demo /absolute/path/to/git-ai
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Use a disposable app: the verifier edits its template source and writes a private
|
|
162
|
+
`demo-report.json`. It needs Git AI's background service running. A replay failure
|
|
163
|
+
or missing evidence must fail verification, not be relabeled as human or AI.
|
|
164
|
+
|
|
165
|
+
For live trials, retain a source receipt after each real agent edit. The
|
|
166
|
+
`scripts/verify-live-attribution.mjs <generated-app> <manifest.json>` verifier
|
|
167
|
+
loads those private records, checks the expected model/effort/harness and actual
|
|
168
|
+
added line, compares versions sharing a commit, then builds the final app using
|
|
169
|
+
real Vite/SDK snapshot construction with cloud transport disabled. Manifest
|
|
170
|
+
cases specify `name`, `sourceId`, `file`, `text`, `kind`, and optional `model`,
|
|
171
|
+
`effort`, `harness`. These receipts are local observations, not cloud deployments.
|
|
172
|
+
Do not substitute hook replay for a requested live model/harness trial.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Deployment Model
|
|
2
|
+
|
|
3
|
+
Use this file when the user asks what Zephyr builds produce, what a snapshot is, how version URLs relate to tags/envs, what the dashboard deploy model is, or how rollback/promotion works.
|
|
4
|
+
|
|
5
|
+
## Plain-English model
|
|
6
|
+
|
|
7
|
+
- Build integration creates an immutable build artifact.
|
|
8
|
+
- The user gets a permanent version URL for that exact build.
|
|
9
|
+
- Tags and environments are mutable routing layers on top of immutable builds.
|
|
10
|
+
- Rollback is fast because Zephyr changes pointers, not app artifacts.
|
|
11
|
+
|
|
12
|
+
## Quick glossary
|
|
13
|
+
|
|
14
|
+
| Term | Meaning | Best use |
|
|
15
|
+
| ----------- | -------------------------------------------------------------- | --------------------------------------------------- |
|
|
16
|
+
| Build | The bundler/framework build that Zephyr observes and publishes | The starting action |
|
|
17
|
+
| Version | Immutable deployed build state with a permanent URL | Exact preview, debugging, rollback target |
|
|
18
|
+
| Snapshot | Underlying stored artifact record for what was built on edge | Internal precision when explaining architecture |
|
|
19
|
+
| Tag | Mutable named selector, rule-based or manually pinned | Moving channel like `main`, `beta`, `stable` |
|
|
20
|
+
| Environment | Mutable deployment target with config/domains/overrides | Stable deploy target like `staging` or `production` |
|
|
21
|
+
|
|
22
|
+
## Terms
|
|
23
|
+
|
|
24
|
+
### Version
|
|
25
|
+
|
|
26
|
+
- Immutable build state.
|
|
27
|
+
- Has a permanent version URL.
|
|
28
|
+
- Good for previewing, sharing, debugging, and exact rollback targets.
|
|
29
|
+
|
|
30
|
+
### Snapshot
|
|
31
|
+
|
|
32
|
+
- Edge-side record of what was built: assets + build identity.
|
|
33
|
+
- In the architecture docs, snapshot and build-stats are different.
|
|
34
|
+
- Snapshot is the immutable artifact record; build-stats are the metadata used by the async publish flow.
|
|
35
|
+
|
|
36
|
+
Source: `https://docs.zephyr-cloud.io/reference/architecture.md`
|
|
37
|
+
|
|
38
|
+
### Tag
|
|
39
|
+
|
|
40
|
+
- Mutable named selector.
|
|
41
|
+
- Usually resolves to the newest matching version based on rules, but can also be pinned manually to a fixed version.
|
|
42
|
+
- Good for dynamic channels like `main`, `beta`, `release`, `stable`.
|
|
43
|
+
|
|
44
|
+
### Environment
|
|
45
|
+
|
|
46
|
+
- Mutable deployment target with its own config, domains, and optional overrides.
|
|
47
|
+
- Can point to a tag or a fixed version.
|
|
48
|
+
- Good for `development`, `staging`, `production`, previews, and white-label targets.
|
|
49
|
+
- Can also be locked/protected in stricter production workflows.
|
|
50
|
+
|
|
51
|
+
## Stage 0 vs Stage 1
|
|
52
|
+
|
|
53
|
+
Use this if the user asks why a build returns before publish work is fully done.
|
|
54
|
+
|
|
55
|
+
- Stage 0: upload files and snapshot fast; produce the version URL.
|
|
56
|
+
- Stage 1: async publish flow computes and updates tags/envs/cnames.
|
|
57
|
+
- `build-stats` acceptance does not mean every mutable target already switched.
|
|
58
|
+
|
|
59
|
+
## URLs
|
|
60
|
+
|
|
61
|
+
Version URL mental model:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
https://{username}-{buildId}-{app-name}-{project}-{hash}.{edge-domain}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Tag URL mental model:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
https://t-{tagname}-{app-uid}-{hash}.{domain}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Environment URL mental model:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
https://{env-name}-{app-uid}-{hash}.{domain}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Which URL to share:
|
|
80
|
+
|
|
81
|
+
| URL | Share when | Why |
|
|
82
|
+
| --------------- | -------------------------------------------------------------- | ----------------------------------- |
|
|
83
|
+
| Version URL | You need an exact build preview or debugging link | Immutable |
|
|
84
|
+
| Tag URL | You want a moving channel like `main` or `beta` | Follows tag resolution |
|
|
85
|
+
| Environment URL | You want the stable deployment target users or QA should visit | Carries environment behavior/config |
|
|
86
|
+
|
|
87
|
+
## Dashboard workflow
|
|
88
|
+
|
|
89
|
+
- Build creates versions automatically.
|
|
90
|
+
- Dashboard lets users inspect versions and their metadata.
|
|
91
|
+
- Users create tags with matching rules.
|
|
92
|
+
- Users create environments that point to a tag or a fixed version.
|
|
93
|
+
- Promotion usually means moving an environment or tag pointer to a chosen version.
|
|
94
|
+
- Rollback usually means repointing back to an older known-good version.
|
|
95
|
+
- Tags and environments can also be locked/protected to prevent accidental changes.
|
|
96
|
+
|
|
97
|
+
## Built output notes worth calling out
|
|
98
|
+
|
|
99
|
+
- Zephyr is deployment-first and build-integrated; it observes bundler output and uploads assets after build.
|
|
100
|
+
- Docs describe a permanent version URL, and example/build output commonly surfaces that URL after build completes.
|
|
101
|
+
- The public mental model should stay on version URL first; mention snapshot internals only when useful.
|
|
102
|
+
|
|
103
|
+
## Smallest first-time path
|
|
104
|
+
|
|
105
|
+
1. Identify the stack and pick the right SDK or fallback upload path.
|
|
106
|
+
2. Run `with-zephyr` or add the correct Zephyr integration.
|
|
107
|
+
3. Build the app.
|
|
108
|
+
4. Start by using the version URL for exact preview/testing.
|
|
109
|
+
5. Add tags or environments later when the user needs moving channels or stable deploy targets.
|
|
110
|
+
|
|
111
|
+
## Correctness notes
|
|
112
|
+
|
|
113
|
+
- Do not say tags are immutable; they are not.
|
|
114
|
+
- Do not say environments are just aliases; they also carry config and custom-domain behavior.
|
|
115
|
+
- Do not say snapshot is the same thing as version URL; the URL points at the immutable build, while snapshot is the stored artifact record underneath.
|
|
116
|
+
|
|
117
|
+
## Best docs to link
|
|
118
|
+
|
|
119
|
+
- Versions: `https://docs.zephyr-cloud.io/features/versions.md`
|
|
120
|
+
- Tags & environments: `https://docs.zephyr-cloud.io/features/tags-environments.md`
|
|
121
|
+
- Instant rollbacks: `https://docs.zephyr-cloud.io/features/instant-rollbacks.md`
|
|
122
|
+
- Architecture: `https://docs.zephyr-cloud.io/reference/architecture.md`
|
|
123
|
+
- Core concepts: `https://docs.zephyr-cloud.io/reference/concepts.md`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Docs Map
|
|
2
|
+
|
|
3
|
+
Use this file when you need to send the user to the right Zephyr docs quickly.
|
|
4
|
+
|
|
5
|
+
## Main docs site
|
|
6
|
+
|
|
7
|
+
- Site: `https://docs.zephyr-cloud.io`
|
|
8
|
+
- Raw markdown path pattern: `https://docs.zephyr-cloud.io/<path>.md`
|
|
9
|
+
- Up-to-date index: `https://docs.zephyr-cloud.io/llms.txt`
|
|
10
|
+
- Discord help: `https://discord.gg/zephyrcloud`
|
|
11
|
+
|
|
12
|
+
## Best first links
|
|
13
|
+
|
|
14
|
+
- Quick start: `https://docs.zephyr-cloud.io/getting-started/quick-start.md`
|
|
15
|
+
- SDK picker: `https://docs.zephyr-cloud.io/getting-started/find-your-sdk.md`
|
|
16
|
+
- Core concepts: `https://docs.zephyr-cloud.io/reference/concepts.md`
|
|
17
|
+
- Architecture: `https://docs.zephyr-cloud.io/reference/architecture.md`
|
|
18
|
+
- Versions: `https://docs.zephyr-cloud.io/features/versions.md`
|
|
19
|
+
- Tags & environments: `https://docs.zephyr-cloud.io/features/tags-environments.md`
|
|
20
|
+
- Environment overrides: `https://docs.zephyr-cloud.io/features/environment-overrides.md`
|
|
21
|
+
- Existing app integration: `https://docs.zephyr-cloud.io/integrations/existing-app.md`
|
|
22
|
+
|
|
23
|
+
## When to route elsewhere
|
|
24
|
+
|
|
25
|
+
- MF setup and remote resolution -> `../../zephyr-module-federation/SKILL.md`
|
|
26
|
+
- BYOC/provider setup -> docs cloud section from `llms.txt`
|
|
27
|
+
- Errors -> docs error encyclopedia
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Environment Variables
|
|
2
|
+
|
|
3
|
+
Use this file when the user asks about `ZE_PUBLIC_*`, runtime config, build once deploy everywhere, or per-environment variable overrides.
|
|
4
|
+
|
|
5
|
+
## Core rule
|
|
6
|
+
|
|
7
|
+
- `ZE_PUBLIC_*` variables are public client-facing values captured at build time.
|
|
8
|
+
- They are not secret storage.
|
|
9
|
+
- Zephyr can override them per environment at runtime.
|
|
10
|
+
- Public docs currently describe environment-level overrides as beta.
|
|
11
|
+
|
|
12
|
+
## How it works
|
|
13
|
+
|
|
14
|
+
1. Build-time capture: Zephyr records variables prefixed with `ZE_PUBLIC_`.
|
|
15
|
+
2. Manifest generation: captured values are written into `zephyr-manifest.json`.
|
|
16
|
+
3. Runtime override: an environment can inject different values without rebuilding.
|
|
17
|
+
|
|
18
|
+
Why this matters: the same built artifact can run in development, staging, and production with different public config.
|
|
19
|
+
|
|
20
|
+
This applies to public client-facing values. Secure server-only values are a separate concern and should not be modeled as `ZE_PUBLIC_*`.
|
|
21
|
+
|
|
22
|
+
If the user asks where secrets should go instead, route them to the server-side environment variable path rather than public runtime overrides.
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
Build-time `.env`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
DATABASE_URL=postgres://localhost/myapp
|
|
30
|
+
ZE_PUBLIC_API_URL=https://api.development.example.com
|
|
31
|
+
ZE_PUBLIC_FEATURE_FLAGS=beta-ui,new-checkout
|
|
32
|
+
ZE_PUBLIC_ANALYTICS_KEY=dev_analytics_12345
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Application usage:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
export const config = {
|
|
39
|
+
apiUrl: process.env.ZE_PUBLIC_API_URL,
|
|
40
|
+
flags: process.env.ZE_PUBLIC_FEATURE_FLAGS,
|
|
41
|
+
analyticsKey: process.env.ZE_PUBLIC_ANALYTICS_KEY,
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Environment-level overrides example:
|
|
46
|
+
|
|
47
|
+
| Environment | ZE_PUBLIC_API_URL | ZE_PUBLIC_FEATURE_FLAGS |
|
|
48
|
+
| ----------- | --------------------------------- | -------------------------------- |
|
|
49
|
+
| Development | `https://api.dev.example.com` | `beta-ui,new-checkout,analytics` |
|
|
50
|
+
| Staging | `https://api.staging.example.com` | `new-checkout,analytics` |
|
|
51
|
+
| Production | `https://api.example.com` | `analytics` |
|
|
52
|
+
|
|
53
|
+
## Remote overrides relationship
|
|
54
|
+
|
|
55
|
+
The same environment-level override system also supports remote dependency overrides. If the user is asking about both env vars and remotes together, also read `../../zephyr-module-federation/references/remote-resolution.md`.
|
|
56
|
+
|
|
57
|
+
## Dashboard flow
|
|
58
|
+
|
|
59
|
+
- Go to the Zephyr dashboard DevOps section.
|
|
60
|
+
- Select the environment.
|
|
61
|
+
- Set override values for the `ZE_PUBLIC_*` entries.
|
|
62
|
+
- Requests served from that environment use the environment values, not the original build-time values.
|
|
63
|
+
|
|
64
|
+
## Guardrails
|
|
65
|
+
|
|
66
|
+
- Keep secrets out of `ZE_PUBLIC_*`.
|
|
67
|
+
- Do not tell users they need a rebuild for normal per-environment public config changes.
|
|
68
|
+
- If the value is server-only or sensitive, Zephyr public env var overrides are the wrong tool.
|
|
69
|
+
- If the user needs secure server-side environment variables, explain that this is a different path than public runtime overrides.
|
|
70
|
+
|
|
71
|
+
## Best docs to link
|
|
72
|
+
|
|
73
|
+
- Environment overrides: `https://docs.zephyr-cloud.io/features/environment-overrides.md`
|
|
74
|
+
- Tags & environments: `https://docs.zephyr-cloud.io/features/tags-environments.md`
|
|
75
|
+
- Architecture manifest section: `https://docs.zephyr-cloud.io/reference/architecture.md`
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Examples Resume
|
|
2
|
+
|
|
3
|
+
Use this file when the user wants concrete Zephyr setup examples for frontend stacks.
|
|
4
|
+
|
|
5
|
+
## Fast starting points
|
|
6
|
+
|
|
7
|
+
- Vite SPA: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/bundlers/react-vite`
|
|
8
|
+
- Rspack SPA: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/bundlers/react-rspack`
|
|
9
|
+
- TanStack Start: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/frameworks/tanstack-start`
|
|
10
|
+
- Astro: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/frameworks/astro`
|
|
11
|
+
- Cross-bundler MF: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/module-federation/react-vite-rspack-webpack`
|
|
12
|
+
- Monorepo MF: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/build-systems/turborepo-rspack-mf`
|
|
13
|
+
|
|
14
|
+
Repo root: `https://github.com/ZephyrCloudIO/zephyr-examples`
|
|
15
|
+
|
|
16
|
+
## Core pattern
|
|
17
|
+
|
|
18
|
+
- Install the Zephyr integration that matches the stack.
|
|
19
|
+
- Add `withZephyr()` to the plugin list or wrap the final config with it. Placement is stack-specific, not always last; follow the installed package's dedicated skill.
|
|
20
|
+
- For special frameworks, use the framework-specific Zephyr integration instead of the generic bundler plugin.
|
|
21
|
+
|
|
22
|
+
## Good references
|
|
23
|
+
|
|
24
|
+
### Minimal Vite
|
|
25
|
+
|
|
26
|
+
File: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/bundlers/react-vite/vite.config.ts`
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { defineConfig } from 'vite';
|
|
30
|
+
import react from '@vitejs/plugin-react';
|
|
31
|
+
import { withZephyr } from 'vite-plugin-zephyr';
|
|
32
|
+
|
|
33
|
+
export default defineConfig({
|
|
34
|
+
plugins: [react(), withZephyr()],
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Minimal Rspack
|
|
39
|
+
|
|
40
|
+
File: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/bundlers/react-rspack/rspack.config.ts`
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { defineConfig } from '@rspack/cli';
|
|
44
|
+
import { withZephyr } from 'zephyr-rspack-plugin';
|
|
45
|
+
|
|
46
|
+
const config = defineConfig({
|
|
47
|
+
entry: { main: './src/main.tsx' },
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export default withZephyr()(config);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### TanStack Start
|
|
54
|
+
|
|
55
|
+
File: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/frameworks/tanstack-start/vite.config.ts`
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { withZephyr } from 'vite-plugin-tanstack-start-zephyr';
|
|
59
|
+
|
|
60
|
+
plugins: [tanstackStart(), viteReact(), withZephyr()];
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Astro
|
|
64
|
+
|
|
65
|
+
File: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/frameworks/astro/astro.config.mjs`
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
import { defineConfig } from 'astro/config';
|
|
69
|
+
import { withZephyr } from 'zephyr-astro-integration';
|
|
70
|
+
|
|
71
|
+
export default defineConfig({
|
|
72
|
+
integrations: [mdx(), sitemap(), withZephyr()],
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Gotchas worth reusing
|
|
77
|
+
|
|
78
|
+
- Use the framework-specific integration when one exists.
|
|
79
|
+
- Build remotes before hosts in MF setups.
|
|
80
|
+
- Do not assume every example uses the same remote manifest format.
|
|
81
|
+
- Cross-bundler MF hosts may need explicit remote `type` values.
|