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
package/README.md
CHANGED
|
@@ -36,6 +36,31 @@ pnpm add --dev vite-plugin-zephyr
|
|
|
36
36
|
bun add --dev vite-plugin-zephyr
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## AI Agent Skills (Optional)
|
|
40
|
+
|
|
41
|
+
This package ships the `zephyr-vite` Agent Skill for AI coding agents, together
|
|
42
|
+
with the shared `zephyr-core` and `zephyr-module-federation` guides. The
|
|
43
|
+
skills are versioned with the package, so your agent reads guidance that
|
|
44
|
+
matches the release you installed.
|
|
45
|
+
|
|
46
|
+
Zephyr does not need Intent at runtime. Coding agents only find these skills
|
|
47
|
+
after you opt in with
|
|
48
|
+
[TanStack Intent](https://tanstack.com/intent/latest/docs/getting-started/quick-start-consumers):
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
pnpm add -D @tanstack/intent
|
|
52
|
+
pnpm dlx @tanstack/intent@latest install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Allow `vite-plugin-zephyr` when `install` asks. Intent saves that choice in the
|
|
56
|
+
`intent.skills` allowlist in your `package.json`. To check or load the skill
|
|
57
|
+
yourself:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
pnpm exec intent list
|
|
61
|
+
pnpm exec intent load 'vite-plugin-zephyr#zephyr-vite'
|
|
62
|
+
```
|
|
63
|
+
|
|
39
64
|
## Usage
|
|
40
65
|
|
|
41
66
|
### Basic Configuration
|
|
@@ -554,8 +554,18 @@ function withZephyrCore(options = {}) {
|
|
|
554
554
|
return null;
|
|
555
555
|
}
|
|
556
556
|
},
|
|
557
|
-
buildStart () {
|
|
557
|
+
async buildStart () {
|
|
558
558
|
environmentBuildStarted = true;
|
|
559
|
+
try {
|
|
560
|
+
const engine = await zephyr_engine_defer;
|
|
561
|
+
if (engine.sourceContext && engine.sourceCapture?.phase !== 'build-start' && !engine.pendingSourceCapture) {
|
|
562
|
+
const capture = (0, external_zephyr_agent_namespaceObject.captureSource)(engine.sourceContext, 'build-start');
|
|
563
|
+
if (engine.hasActiveBuild) engine.sourceCapture = capture;
|
|
564
|
+
else engine.pendingSourceCapture = capture;
|
|
565
|
+
}
|
|
566
|
+
} catch (error) {
|
|
567
|
+
(0, external_zephyr_agent_namespaceObject.handleGlobalError)(error);
|
|
568
|
+
}
|
|
559
569
|
},
|
|
560
570
|
buildEnd (error) {
|
|
561
571
|
if (error) directBuildFailed = true;
|
|
@@ -2,7 +2,7 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import magic_string from "magic-string";
|
|
5
|
-
import { ApplicationContext, ZeErrors, ZephyrEngine, ZephyrError, assertZephyrBuildTarget, claimPartialAssetMapBatch, commitPartialAssetMapClaimBatch, createManifestContent, handleGlobalError, logFn, normalizeBasePath, rewriteEnvReadsToVirtualModule, rollbackPartialAssetMapClaimBatch, savePartialAssetMap, zeBuildAssets, zeBuildDashData, ze_log } from "zephyr-agent";
|
|
5
|
+
import { ApplicationContext, ZeErrors, ZephyrEngine, ZephyrError, assertZephyrBuildTarget, captureSource, claimPartialAssetMapBatch, commitPartialAssetMapClaimBatch, createManifestContent, handleGlobalError, logFn, normalizeBasePath, rewriteEnvReadsToVirtualModule, rollbackPartialAssetMapClaimBatch, savePartialAssetMap, zeBuildAssets, zeBuildDashData, ze_log } from "zephyr-agent";
|
|
6
6
|
import { extractEntrypoint } from "./internal/extract/extract-entrypoint.mjs";
|
|
7
7
|
import { extract_mf_plugins } from "./internal/extract/extract_mf_plugin.mjs";
|
|
8
8
|
import { extract_vite_assets_map } from "./internal/extract/extract_vite_assets_map.mjs";
|
|
@@ -514,8 +514,18 @@ function withZephyrCore(options = {}) {
|
|
|
514
514
|
return null;
|
|
515
515
|
}
|
|
516
516
|
},
|
|
517
|
-
buildStart () {
|
|
517
|
+
async buildStart () {
|
|
518
518
|
environmentBuildStarted = true;
|
|
519
|
+
try {
|
|
520
|
+
const engine = await zephyr_engine_defer;
|
|
521
|
+
if (engine.sourceContext && engine.sourceCapture?.phase !== 'build-start' && !engine.pendingSourceCapture) {
|
|
522
|
+
const capture = captureSource(engine.sourceContext, 'build-start');
|
|
523
|
+
if (engine.hasActiveBuild) engine.sourceCapture = capture;
|
|
524
|
+
else engine.pendingSourceCapture = capture;
|
|
525
|
+
}
|
|
526
|
+
} catch (error) {
|
|
527
|
+
handleGlobalError(error);
|
|
528
|
+
}
|
|
519
529
|
},
|
|
520
530
|
buildEnd (error) {
|
|
521
531
|
if (error) directBuildFailed = true;
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/vitejs/vite-plugin-registry/refs/heads/main/data/schema/extended-package-json.schema.json",
|
|
3
3
|
"name": "vite-plugin-zephyr",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"description": "Vite plugin for Zephyr",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"deploy",
|
|
8
8
|
"module-federation",
|
|
9
|
+
"tanstack-intent",
|
|
9
10
|
"vite",
|
|
10
11
|
"vite-plugin",
|
|
11
12
|
"zephyr"
|
|
@@ -24,6 +25,9 @@
|
|
|
24
25
|
"dist",
|
|
25
26
|
"README.md",
|
|
26
27
|
"LICENSE",
|
|
28
|
+
"skills",
|
|
29
|
+
"!skills/_artifacts",
|
|
30
|
+
"!skills/**/.zephyr-generated",
|
|
27
31
|
"!dist/**/*.map"
|
|
28
32
|
],
|
|
29
33
|
"type": "commonjs",
|
|
@@ -51,12 +55,13 @@
|
|
|
51
55
|
"acorn": "^8.18.0",
|
|
52
56
|
"acorn-walk": "^8.3.5",
|
|
53
57
|
"magic-string": "1.2.3",
|
|
54
|
-
"zephyr-agent": "1.
|
|
58
|
+
"zephyr-agent": "1.6.0"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
57
61
|
"@module-federation/vite": "1.21.2",
|
|
58
62
|
"@rslib/core": "1.0.0",
|
|
59
63
|
"@rstest/core": "0.11.12",
|
|
64
|
+
"@tanstack/intent": "0.5.3",
|
|
60
65
|
"@types/node": "^24.13.3",
|
|
61
66
|
"rollup": "^4.63.1",
|
|
62
67
|
"typescript": "~7.0.0",
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026-present Zephyr Cloud and contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# zephyr-core
|
|
2
|
+
|
|
3
|
+
Skill for general Zephyr frontend setup and deployment workflows.
|
|
4
|
+
|
|
5
|
+
Includes:
|
|
6
|
+
|
|
7
|
+
- `SKILL.md` for the main trigger and workflow
|
|
8
|
+
- `references/sdk-setup.md` for plugin and codemod setup
|
|
9
|
+
- `references/deployment-model.md` for versions, snapshots, tags, and environments
|
|
10
|
+
- `references/env-vars.md` for `ZE_PUBLIC_*` and environment overrides
|
|
11
|
+
- `references/examples-resume.md` for concrete starter examples
|
|
12
|
+
- `references/docs-map.md` for docs links and `llms.txt`
|
|
13
|
+
- `references/troubleshooting.md` for common setup issues
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zephyr-core
|
|
3
|
+
description: Use when the user asks about Zephyr setup, with-zephyr, SDK selection, Change Attribution, human/AI contributions, dirty-source version differences, versions, tags, environments, snapshot/version URLs, dashboard workflows, docs, or public env vars.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: Zephyr Cloud IO
|
|
7
|
+
purpose: Use when the user asks about Zephyr setup, with-zephyr, SDK selection, versions, tags, environments, snapshot/version URLs, dashboard workflows, docs, or public env vars.
|
|
8
|
+
domain: sdk
|
|
9
|
+
type: core
|
|
10
|
+
sources:
|
|
11
|
+
- ZephyrCloudIO/zephyr-packages:**/skills/zephyr-core/references/*.md
|
|
12
|
+
- ZephyrCloudIO/zephyr-packages:**/scripts/sync-package-skills.mjs
|
|
13
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/attribution.ts
|
|
14
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/hooks/*.cjs
|
|
15
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/index.ts
|
|
16
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/rstack.ts
|
|
17
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/bundlers/rstack.ts
|
|
18
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/bundlers/index.ts
|
|
19
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/engine/ast-grep.ts
|
|
20
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/operations.ts
|
|
21
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/types.ts
|
|
22
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/tests/bundler-configs.test.ts
|
|
23
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/tests/rstack.test.ts
|
|
24
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/tests/rstack-inheritance.test.ts
|
|
25
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/tests/codemod.test.ts
|
|
26
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/src/tests/attribution.test.ts
|
|
27
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/with-zephyr/README.md
|
|
28
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/change-attribution/*.ts
|
|
29
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/transformers/ze-build-snapshot.ts
|
|
30
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/transformers/ze-build-dash-data.ts
|
|
31
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/zephyr-engine/index.ts
|
|
32
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-edge-contract/src/lib/change-attribution.ts
|
|
33
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-edge-contract/src/index.ts
|
|
34
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-edge-contract/src/lib/snapshot.ts
|
|
35
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-edge-contract/src/lib/zephyr-build-stats.ts
|
|
36
|
+
- ZephyrCloudIO/zephyr-packages:**/scripts/verify-change-attribution.mjs
|
|
37
|
+
- ZephyrCloudIO/zephyr-packages:**/scripts/verify-live-attribution.mjs
|
|
38
|
+
- ZephyrCloudIO/zephyr-packages:**/scripts/verify-attribution-storage.mjs
|
|
39
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/index.ts
|
|
40
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/http/http-request.ts
|
|
41
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/http/http-request.test.ts
|
|
42
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/http/fetch-with-retries.ts
|
|
43
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/http/fetch-with-retries.test.ts
|
|
44
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/lib/node-persist/upload-provider-options.ts
|
|
45
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-agent/src/zephyr-engine/__test__/upload_assets.test.ts
|
|
46
|
+
- ZephyrCloudIO/zephyr-packages:**/libs/zephyr-edge-contract/src/lib/api-contract-negotiation/get-api-contract.ts
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
# Zephyr Core
|
|
50
|
+
|
|
51
|
+
Use this skill for Zephyr SDK adoption and build-integrated deployment. It ships
|
|
52
|
+
with every published Zephyr package, including supporting libraries that are not
|
|
53
|
+
themselves build plugins. Do not assume the package containing this guide exports
|
|
54
|
+
`withZephyr`; choose the actual integration for the application's stack.
|
|
55
|
+
|
|
56
|
+
Prefer a more specific skill shipped alongside this one for its supported task,
|
|
57
|
+
such as `zephyr-vite` or `create-zephyr-apps`. Check the installed integration's
|
|
58
|
+
README, exported types, and peer compatibility before applying code examples.
|
|
59
|
+
|
|
60
|
+
Zephyr is a build-integrated deployment platform for frontend and frontend-adjacent apps: it plugs into the build, publishes immutable versions, and lets users route traffic through tags and environments.
|
|
61
|
+
|
|
62
|
+
## What to cover
|
|
63
|
+
|
|
64
|
+
- Start with the smallest useful answer.
|
|
65
|
+
- Prefer Zephyr's user-facing model first: setup -> build -> version URL -> tags/envs -> promote/rollback.
|
|
66
|
+
- Use repo/code-path nuance only when it clarifies behavior or corrects docs drift.
|
|
67
|
+
- If the question is really about remote resolution, hosts/remotes, `zephyr:dependencies`, or multi-bundler Module Federation, switch to `../zephyr-module-federation/SKILL.md`.
|
|
68
|
+
- First-time users usually need: a supported stack or fallback upload path, Zephyr auth/account access, and git metadata for repo/branch/commit identity.
|
|
69
|
+
|
|
70
|
+
## What Zephyr does
|
|
71
|
+
|
|
72
|
+
- Zephyr integrates with the build and publishes immutable frontend versions.
|
|
73
|
+
- Zephyr gives users permanent version URLs plus mutable tags and environments.
|
|
74
|
+
- Zephyr can manage public runtime config overrides and deployment routing.
|
|
75
|
+
- Zephyr does not replace the app's own framework/bundler config; it integrates into it.
|
|
76
|
+
- Zephyr does not make public `ZE_PUBLIC_*` values secret.
|
|
77
|
+
|
|
78
|
+
## Core mental model
|
|
79
|
+
|
|
80
|
+
- Zephyr plugs into the app build through a bundler/framework integration.
|
|
81
|
+
- A build creates an immutable version/snapshot and a permanent version URL.
|
|
82
|
+
- Tags and environments are mutable pointers on top of immutable builds.
|
|
83
|
+
- Promotion and rollback are mostly pointer changes, not rebuilds.
|
|
84
|
+
- `ZE_PUBLIC_*` values can be captured at build time and overridden per environment later.
|
|
85
|
+
|
|
86
|
+
## Answer flow
|
|
87
|
+
|
|
88
|
+
1. Identify the user's stack and deployment goal.
|
|
89
|
+
2. Read `references/sdk-setup.md` for setup guidance.
|
|
90
|
+
3. Read `references/deployment-model.md` for versions, snapshots, tags, envs, and dashboard workflows.
|
|
91
|
+
4. Read `references/env-vars.md` if the task mentions env vars, runtime config, build once deploy everywhere, or `ZE_PUBLIC_*`.
|
|
92
|
+
5. Read `references/examples-resume.md` when the user wants concrete starter patterns.
|
|
93
|
+
6. Read `references/docs-map.md` when deeper docs links are useful.
|
|
94
|
+
7. Read `references/troubleshooting.md` when setup/build/auth/git issues appear.
|
|
95
|
+
8. Read `references/change-attribution.md` for optional tracking, agent/editor hooks,
|
|
96
|
+
source fingerprints, and version comparisons involving local changes. Obtain
|
|
97
|
+
explicit opt-in before enabling capture or installing hooks.
|
|
98
|
+
|
|
99
|
+
## Source priorities
|
|
100
|
+
|
|
101
|
+
- Canonical public docs: `https://docs.zephyr-cloud.io`
|
|
102
|
+
- Raw docs path pattern: `https://docs.zephyr-cloud.io/<path>.md`
|
|
103
|
+
- Docs index: `https://docs.zephyr-cloud.io/llms.txt`
|
|
104
|
+
- Community help: `https://discord.gg/zephyrcloud`
|
|
105
|
+
- Architecture docs: `https://docs.zephyr-cloud.io/reference/architecture.md`
|
|
106
|
+
- Public docs source: `https://docs.zephyr-cloud.io`
|
|
107
|
+
- Examples source: `https://github.com/ZephyrCloudIO/zephyr-examples`
|
|
108
|
+
|
|
109
|
+
## Guardrails
|
|
110
|
+
|
|
111
|
+
- Do not invent SDK names; verify against `references/sdk-setup.md`.
|
|
112
|
+
- Do not blur version vs tag vs environment; explain the distinction plainly.
|
|
113
|
+
- Do not present `ZE_PUBLIC_*` as secret storage. They are public client-facing values.
|
|
114
|
+
- Call out docs drift when relevant instead of silently repeating conflicting details.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Attribution storage and repository policy
|
|
2
|
+
|
|
3
|
+
Read this when selecting storage, controlling source-text sharing, or implementing
|
|
4
|
+
the endpoint. First enable tracking with [Change Attribution](change-attribution.md).
|
|
5
|
+
|
|
6
|
+
## Repository preferences
|
|
7
|
+
|
|
8
|
+
Commit `.zephyr/attribution.json` at the Git root. Each repo has its own file;
|
|
9
|
+
apps in a monorepo share its capture preferences. It contains preferences, never
|
|
10
|
+
credentials, custom endpoint URLs, or a claimed account tier:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{ "schemaVersion": 1, "enabled": true, "storage": "local" }
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Storage configuration requires an existing enabled repository; enable with
|
|
17
|
+
`with-zephyr . --attribution` first. A blank codemod storage answer preserves
|
|
18
|
+
existing preferences. Missing `storage`, including older configs, means **local**. Source copies,
|
|
19
|
+
attribution, and version receipts stay in the worktree Git directory. Local
|
|
20
|
+
mode neither resolves attribution credentials nor makes attribution requests,
|
|
21
|
+
and attaches no attribution to uploaded snapshots/build stats. Ordinary Zephyr
|
|
22
|
+
deployment still uploads its assets and normal deployment metadata.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm exec ze-cli attribution configure --storage remote
|
|
26
|
+
# Paid/BYOC: independently choose source-text fields.
|
|
27
|
+
pnpm exec ze-cli attribution configure --storage remote --patches include --lines omit
|
|
28
|
+
pnpm exec ze-cli attribution status
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
| Mode/account | Source text sent |
|
|
32
|
+
| ------------------ | ------------------------------------------------------- |
|
|
33
|
+
| Local, any account | None |
|
|
34
|
+
| Remote, free | Unified patch and structured changed-line text required |
|
|
35
|
+
| Remote, paid | Neither by default; either/both optional |
|
|
36
|
+
| Remote, BYOC | Neither by default; either/both optional |
|
|
37
|
+
|
|
38
|
+
Free remote source-text opt-out is rejected before sending. Choose local to keep
|
|
39
|
+
it local. Tier comes from authenticated service policy, not repo configuration
|
|
40
|
+
or deployment provider. Paid/BYOC shared preferences can include
|
|
41
|
+
`"content": { "patch": false, "lines": false }` or enable either field.
|
|
42
|
+
|
|
43
|
+
All remote records include file hashes, attribution ranges/origins, and available
|
|
44
|
+
session/model/effort/usage metadata. `patch` is the unified difference against the
|
|
45
|
+
**captured Git HEAD**, with ordinary context. `lines` contains text/origin of
|
|
46
|
+
added/removed lines. A patch inherently contains line text even when `lines` is
|
|
47
|
+
false; omit both to share no source text. Range positions/origins remain metadata.
|
|
48
|
+
New files can have every line in their difference. Full source snapshots and
|
|
49
|
+
binary contents are not uploaded. Exclusions apply to working source and HEAD.
|
|
50
|
+
Remote payloads are limited to 20 MiB. Server version comparisons need the Git
|
|
51
|
+
baseline; patches cannot reconstruct unchanged committed files on their own.
|
|
52
|
+
|
|
53
|
+
## Private restriction and precedence
|
|
54
|
+
|
|
55
|
+
Keep this checkout local even when its shared config selects remote:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pnpm exec ze-cli attribution configure --storage local --local
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This atomically writes `zephyr-attribution/config.local.json` inside the worktree
|
|
62
|
+
Git directory with owner-only POSIX file permissions. It preserves shared config
|
|
63
|
+
and cannot enable remote or additional content. Deliberately remove that file
|
|
64
|
+
to resume shared settings. Local receipts also use owner-only files: this is
|
|
65
|
+
filesystem protection, not disk encryption. Windows relies on worktree ACLs.
|
|
66
|
+
|
|
67
|
+
Private restrictions apply first. Sharing requires both repo opt-in and server
|
|
68
|
+
authorization. An optional shared `repositoryId` must match the service's
|
|
69
|
+
application/repository binding. Unknown fields, including tokens, URLs, and tier,
|
|
70
|
+
are rejected by configuration commands. Invalid or newer configuration at build
|
|
71
|
+
time disables sharing without blocking deployment; the SDK does not ignore
|
|
72
|
+
unrecognized permissions and accidentally authorize remote uploads. Credentials use existing SDK authentication/private storage; CI
|
|
73
|
+
supplies credentials through its secret environment.
|
|
74
|
+
|
|
75
|
+
## Control-plane contract and secure persistence
|
|
76
|
+
|
|
77
|
+
The SDK implements the client and shared types. **Server endpoints, policy
|
|
78
|
+
management, encryption, retention, and BYOC routing are not implemented in this
|
|
79
|
+
workspace.** Remote publication requires `ATTRIBUTION_POLICY` in authenticated
|
|
80
|
+
application configuration, with this shape:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"schemaVersion": 1,
|
|
85
|
+
"repositoryId": "repo-123",
|
|
86
|
+
"revision": "policy-revision-7",
|
|
87
|
+
"storage": "remote",
|
|
88
|
+
"tier": "paid",
|
|
89
|
+
"content": { "patch": true, "lines": true }
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Policy `content` is the server's allowlist, not source-text opt-in. Paid/BYOC
|
|
94
|
+
repo preferences still default off; free requires both allowed and included.
|
|
95
|
+
Persist policy by organization/repository, allow repo-admin updates, retain
|
|
96
|
+
revision/audit history, and derive tier from billing/BYOC entitlement. A repo
|
|
97
|
+
file must never be able to claim a different tier.
|
|
98
|
+
|
|
99
|
+
The client sends `AttributionUploadRequest` to **`POST /attribution`** on the
|
|
100
|
+
existing authenticated API gateway. It includes application/repository/build/
|
|
101
|
+
snapshot IDs, policy revision, effective content flags, attribution metadata,
|
|
102
|
+
and optional HEAD comparison. It resolves bearer credentials at request time,
|
|
103
|
+
requires HTTPS (loopback HTTP for fixtures), refuses redirects, and omits response
|
|
104
|
+
bodies from diagnostics. Raw prompts, agent responses, transcript paths, and
|
|
105
|
+
full source copies are excluded.
|
|
106
|
+
|
|
107
|
+
The server must authenticate the caller, authorize repository access, verify
|
|
108
|
+
application/build ownership, independently enforce current tier/content policy
|
|
109
|
+
and revision, and reject stale or unauthorized requests. Deduplicate the
|
|
110
|
+
repository/application/build `Idempotency-Key`: return the original record for
|
|
111
|
+
retries and reject conflicting evidence for the same build. Store immutable
|
|
112
|
+
records tied to those IDs and source fingerprint.
|
|
113
|
+
|
|
114
|
+
Return `AttributionUploadResponse`: `status: "ok"`, opaque record ID, matching
|
|
115
|
+
application/repository/build/snapshot IDs, and source fingerprint. Only after
|
|
116
|
+
acknowledgment does the client put a small record reference in snapshots and
|
|
117
|
+
build stats. Full evidence stays at the private endpoint. A private delivery
|
|
118
|
+
receipt stays locally. If policy, source capture, credentials, delivery, or
|
|
119
|
+
acknowledgment is unavailable, deployment continues without an attribution
|
|
120
|
+
reference and emits a warning; source evidence stays local when capture succeeded.
|
|
121
|
+
This also permits deployment before the control-plane endpoint ships. Reconcile pending records when the build publishes and expire
|
|
122
|
+
orphaned records from failed deployments.
|
|
123
|
+
|
|
124
|
+
Store policy in an access-controlled database and source evidence in private
|
|
125
|
+
encrypted object storage using managed keys. Keep storage credentials in a
|
|
126
|
+
service secret manager. Authorize evidence reads by repo membership, enforce
|
|
127
|
+
retention/deletion, and audit policy changes/access without logging source
|
|
128
|
+
bodies. Resolve BYOC destinations/credentials through authorized server
|
|
129
|
+
configuration, never a repo-supplied URL. These are server requirements, not
|
|
130
|
+
guarantees established by the client test.
|
|
131
|
+
|
|
132
|
+
## Verification
|
|
133
|
+
|
|
134
|
+
Build the agent and CLI, then run against a disposable generated app:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
node scripts/verify-attribution-storage.mjs /tmp/zephyr-attribution-demo
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The built CLI/SDK and real loopback HTTP fixture verify tier defaults, independent
|
|
141
|
+
content flags, local isolation, build IDs, stable retry identity, rejected
|
|
142
|
+
acknowledgments/redirects, and private restrictions. The verifier restores shared
|
|
143
|
+
config and writes a private `storage-test-report.json`. Production authorization,
|
|
144
|
+
encryption, retention, and BYOC routing require separate server verification.
|