@vyriy/request 0.9.16 → 0.9.18
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/AGENTS.md +120 -39
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Vyriy Package Agent Guide
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Always read the root `AGENTS.md` first for current project direction, then use this package guide as the stricter local contract for package work. If the root guide gains new package-relevant knowledge, sync it here in the same change or in the next package-touching change so this file does not drift behind.
|
|
3
|
+
Keep this package or project calm, explicit, reusable, and easy to maintain. Read its README, manifest, configuration, and tests before changing behavior. Use the actual package names, supported runtimes, directory layout, and scripts defined by the project. Apply specialized sections only when they match the package or project purpose and its configured tooling and documentation contract.
|
|
6
4
|
|
|
7
5
|
## Package Principles
|
|
8
6
|
|
|
@@ -15,15 +13,33 @@ Always read the root `AGENTS.md` first for current project direction, then use t
|
|
|
15
13
|
- Add packages only when they reduce real complexity, clarify boundaries, or improve reuse.
|
|
16
14
|
- Prefer the option that is simpler to explain, easier to evolve, and calmer to maintain.
|
|
17
15
|
- Grow package functionality in small, calm, reviewable steps that are easy to test and continue.
|
|
16
|
+
- Prefer designs that support localization, versioning, and replaceable CMS integrations without coupling consumers to one content source.
|
|
17
|
+
- When infrastructure choices are open, prefer AWS managed/serverless services; use Fargate when a container workload needs it. Keep cloud assumptions out of packages whose contract is runtime-agnostic.
|
|
18
|
+
|
|
19
|
+
## Applying Website Guidance
|
|
20
|
+
|
|
21
|
+
The English documentation, articles, and examples at [vyriy.dev](https://vyriy.dev/) provide architectural context. Apply their guidance to the relevant package or preset; examples are not a requirement to add every runtime or integration to every package.
|
|
22
|
+
|
|
23
|
+
- Verify website examples against current source, manifests, tests, and generated output before turning them into instructions. Published CLI packages, website examples, and this checkout can differ.
|
|
24
|
+
- Preserve this repository's validation contracts when articles show illustrative alternatives, including older examples that disable coverage or lower thresholds.
|
|
25
|
+
- Read toolchain versions from `package.json` and the project's version files rather than copying version numbers from articles.
|
|
26
|
+
|
|
27
|
+
## Application And Preset Boundaries
|
|
28
|
+
|
|
29
|
+
- In generated applications, put reusable behavior and typed contracts in `packages/*`; keep `workspaces/*` as thin runtime, build, or deployment composition points.
|
|
30
|
+
- Share tooling through thin local configs that extend the existing Vyriy configs. Keep overrides explicit and limited to real project needs.
|
|
31
|
+
- Keep environment parsing at an explicit boundary. Distinguish public asset/API origins from server ports and runtime-only configuration.
|
|
32
|
+
- Keep starter assets local and deterministic; scaffolding and builds must not download required starter media from the live website.
|
|
33
|
+
- Use `vs` from `@vyriy/static` to preview and check generated static output when applicable.
|
|
18
34
|
|
|
19
35
|
## Standard Package Shape
|
|
20
36
|
|
|
21
|
-
|
|
37
|
+
Follow an existing ordinary runtime package in the project when adding a similar package. Use the following shape when no suitable local example exists.
|
|
22
38
|
|
|
23
39
|
Expected files for a typical package:
|
|
24
40
|
|
|
25
41
|
- `README.md`
|
|
26
|
-
- `doc.mdx`
|
|
42
|
+
- `doc.mdx` when it is part of the documentation contract
|
|
27
43
|
- `index.ts`
|
|
28
44
|
- `index.test.ts` when public re-exports need coverage
|
|
29
45
|
- `package.json`
|
|
@@ -31,7 +47,7 @@ Expected files for a typical package:
|
|
|
31
47
|
- `<package>.test.ts`
|
|
32
48
|
- `types.ts` when public shared types are part of the package contract
|
|
33
49
|
|
|
34
|
-
|
|
50
|
+
Use the existing shared build configuration and output layout. Add package-local build configs only for a real special-purpose build shape. Configuration-only packages need not follow the ordinary runtime package layout.
|
|
35
51
|
|
|
36
52
|
## File Responsibility
|
|
37
53
|
|
|
@@ -63,13 +79,13 @@ export type * from './types.js';
|
|
|
63
79
|
|
|
64
80
|
## Package Manifest
|
|
65
81
|
|
|
66
|
-
Keep source `package.json` files minimal
|
|
82
|
+
Keep source `package.json` files minimal. When the project generates publishing metadata, let its distribution tooling own that metadata.
|
|
67
83
|
|
|
68
84
|
Typical runtime package fields:
|
|
69
85
|
|
|
70
|
-
- `"private": true`
|
|
86
|
+
- `"private": true` for internal packages or source workspace manifests whose distribution build generates a publishable manifest
|
|
71
87
|
- `"type": "module"`
|
|
72
|
-
- `
|
|
88
|
+
- `engines` matching the project's supported Node.js versions
|
|
73
89
|
- `"main": "index.js"` when the package has a runtime entry
|
|
74
90
|
- runtime dependencies only when package source imports them at runtime
|
|
75
91
|
|
|
@@ -78,32 +94,82 @@ Typical runtime package fields:
|
|
|
78
94
|
Documentation must move with code. Do not finish a package change while docs describe a different API than the implementation.
|
|
79
95
|
|
|
80
96
|
- Every package must have a concise, usage-oriented `README.md`.
|
|
81
|
-
-
|
|
82
|
-
- Start package READMEs with
|
|
97
|
+
- When `doc.mdx` is part of the package documentation contract, keep it wrapping the README in the project's Storybook/docs style.
|
|
98
|
+
- Start package READMEs with the actual package name from `package.json`.
|
|
83
99
|
- Document real public exports, supported options, behavior expectations, and examples that actually work.
|
|
84
100
|
- Update README examples whenever imports, parameters, return values, configuration, or behavior changes.
|
|
85
|
-
- Keep `doc.mdx` aligned with the README and package title when packages are added, renamed, or reorganized.
|
|
101
|
+
- Keep existing or required `doc.mdx` files aligned with the README and package title when packages are added, renamed, or reorganized.
|
|
86
102
|
- Add or update JSDoc for public exports when behavior, parameters, return values, errors, side effects, or usage expectations need explanation.
|
|
87
103
|
- For component packages, include visual documentation, stories, or examples for supported states, variants, and interaction states.
|
|
88
104
|
- Keep reusable components as dumb as practical: push data shaping, stateful orchestration, and demo-specific logic into the entry point or owning composition layer.
|
|
89
105
|
- Store demo data in stories instead of embedding it in reusable component source.
|
|
90
106
|
- Avoid broad architecture essays in package READMEs; keep architectural direction in root-level docs unless it is necessary to use the package.
|
|
91
107
|
|
|
108
|
+
## Reusable UI And Rendering
|
|
109
|
+
|
|
110
|
+
- Treat a reusable component folder as a local contract: colocate implementation, public types, local styles, behavior tests, export tests, README, stories, and `doc.mdx` when those files serve the component. Tiny one-off components do not need the full reusable-component shape.
|
|
111
|
+
- Use explicit public type names such as `ProfileCardProps`; preserve the package's established styling approach rather than enforcing an article's sample stylesheet naming.
|
|
112
|
+
- Keep rendering deterministic: the same props should produce the same markup. Avoid browser APIs, layout measurements, random values, and current time during reusable server rendering; pass variable data explicitly.
|
|
113
|
+
- Use semantic HTML, useful image alternative text, visible keyboard focus, and accessible names for icon-only controls. Demonstrate and test relevant accessibility behavior.
|
|
114
|
+
- Keep rendering adapters separate from routing, data fetching, bundling, and asset discovery. Choose browser rendering, hydration, HTML, streaming, or static prerendering explicitly for the owning runtime.
|
|
115
|
+
- Treat README as the usage contract and Storybook as its browsable documentation and visual examples, including for non-UI packages. Reuse README content through `doc.mdx` rather than maintaining a second API description.
|
|
116
|
+
|
|
117
|
+
## MFE Contracts
|
|
118
|
+
|
|
119
|
+
Apply these rules when changing MFE packages or presets:
|
|
120
|
+
|
|
121
|
+
- Keep custom-element attributes as explicit inputs and typed browser events as outputs. Keep reusable UI separate from custom-element registration and host integration.
|
|
122
|
+
- Keep attribute/query normalization, defaults, event names and payloads, prerendered markup, semantic JSON-LD, and manifest metadata consistent across API and browser consumers.
|
|
123
|
+
- Treat demo HTML, prerender output, semantic output, manifest, browser bundles, and public media as distinct contracts. Their public URLs should remain predictable even when development and production serve them from different origins.
|
|
124
|
+
- Keep public static assets CDN-friendly and independent of the API runtime where practical. Do not assume a particular workspace name, port, or output directory without checking the preset.
|
|
125
|
+
- When hydration is used, ensure server markup and client props agree and preserve the rendering adapter's mount-node and marker contract. Distinguish hydration from progressive enhancement.
|
|
126
|
+
|
|
127
|
+
## Server And Automation Composition
|
|
128
|
+
|
|
129
|
+
- Keep routing, handler adaptation, and runtime startup separate: `@vyriy/router` owns route dispatch, `@vyriy/handler` owns handler pipelines, and `@vyriy/server` owns runtime startup/adaptation. Compose static serving with `@vyriy/static` when needed.
|
|
130
|
+
- Choose the appropriate Lambda-compatible, native HTTP, or streaming contract explicitly. Native HTTP protocols such as MCP should retain the request/response access their transport needs.
|
|
131
|
+
- Keep protocol or business behavior independent of server startup so local Node.js, Docker/Fargate, and Lambda entry points can reuse it where the runtime contract permits.
|
|
132
|
+
- Build reusable operational scripts on `@vyriy/script`; keep each script responsible for one visible step and let CI or the project composition control ordering.
|
|
133
|
+
- Keep image publishing, deployment, smoke checks, and post-deploy preparation separate. For Lambda-backed APIs, check the function, then HTTP healthcheck, then project-specific scenarios; use only checks that match the deployment target.
|
|
134
|
+
|
|
135
|
+
## Content Delivery Contracts
|
|
136
|
+
|
|
137
|
+
For generated content, translations, or search artifacts:
|
|
138
|
+
|
|
139
|
+
- Prefer the CMS as an editing source and generated, validated artifacts as the CDN delivery contract when live CMS access is unnecessary.
|
|
140
|
+
- Keep CMS-specific transformation in the generator; consumers should depend on stable fields, paths, and versioned schemas rather than raw CMS responses.
|
|
141
|
+
- Generate and validate before publishing. For versioned delivery, upload complete artifacts before switching the manifest or stable pointer; a failed generation must leave the previous valid content available.
|
|
142
|
+
- Make cache behavior explicit: immutable versioned assets can have long lifetimes while the active manifest can refresh more frequently.
|
|
143
|
+
- Choose Lambda for short generation work and Fargate for workloads that need a longer-running container; add a queue only when workload behavior requires it.
|
|
144
|
+
|
|
145
|
+
## Website References
|
|
146
|
+
|
|
147
|
+
Use these sources for rationale and examples, then verify concrete APIs locally:
|
|
148
|
+
|
|
149
|
+
- [Calm App Structure](https://vyriy.dev/blog/vyriy-calm-app-structure/)
|
|
150
|
+
- [Calm Component Structure](https://vyriy.dev/blog/calm-component-structure/)
|
|
151
|
+
- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/)
|
|
152
|
+
- [MFE Starter Contracts](https://vyriy.dev/blog/vyriy-mfe-profile-card-starter/)
|
|
153
|
+
- [The Vyriy Server Family](https://vyriy.dev/blog/from-static-sites-to-mcp-the-vyriy-server-family/)
|
|
154
|
+
- [Calm Deployment](https://vyriy.dev/blog/calm-deployment-with-vyriy-scripts/)
|
|
155
|
+
- [Calm Content Pipelines](https://vyriy.dev/blog/calm-content-pipelines/)
|
|
156
|
+
- [AGENTS.md as a Calm Contract](https://vyriy.dev/blog/agents-md-calm-contract/)
|
|
157
|
+
|
|
92
158
|
## Tests Are Required
|
|
93
159
|
|
|
94
160
|
Tests should protect public behavior and meaningful regression risk.
|
|
95
161
|
|
|
96
|
-
- Add or update
|
|
97
|
-
-
|
|
162
|
+
- Add or update tests with the project's test runner for changed public behavior, public exports, and meaningful edge cases.
|
|
163
|
+
- Start each new package with a minimal test of one already defined public behavior. Expand coverage as its public contract grows.
|
|
98
164
|
- Prefer behavior-focused tests over private implementation lock-in.
|
|
99
165
|
- Keep tests deterministic and avoid real network, timers, browser, filesystem, or cloud dependencies unless that dependency is the behavior under test.
|
|
100
166
|
- Mock external dependencies from `node_modules` in unit tests so package behavior stays deterministic and local.
|
|
167
|
+
- Treat linked workspace imports as internal dependencies and published dependencies as external. Mock internal packages only when the test specifically needs to isolate that boundary.
|
|
101
168
|
- When mocking modules, install mocks before loading the module under test.
|
|
102
169
|
- Use `@jest/globals` in Jest tests.
|
|
103
|
-
- Keep coverage enabled for normal validation.
|
|
104
|
-
- For small changes, run Jest against the changed tests or changed package with coverage enabled. For larger package changes, public API changes, or cross-package changes, run the full Jest suite with coverage.
|
|
170
|
+
- Keep coverage enabled for normal validation. Preserve 100% coverage for branches, functions, lines, and statements where the Vyriy or preset configuration establishes that contract. In other projects, meet their configured thresholds; do not lower them to make a check pass.
|
|
105
171
|
|
|
106
|
-
Typical
|
|
172
|
+
Typical test naming for projects using Jest:
|
|
107
173
|
|
|
108
174
|
- `<package>.test.ts` for single-file packages
|
|
109
175
|
- `<feature>.test.ts` for multi-entry packages
|
|
@@ -115,47 +181,52 @@ Before finishing package work, keep the package surface synchronized and run foc
|
|
|
115
181
|
|
|
116
182
|
Required sync checks:
|
|
117
183
|
|
|
118
|
-
- implementation matches public types
|
|
119
|
-
- public
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
- `doc.mdx` exists and points at the correct README/title for ordinary packages
|
|
124
|
-
- JSDoc is updated for public API changes that need explanation
|
|
125
|
-
- source manifests stay minimal and accurate
|
|
126
|
-
- `.js` relative specifiers are used where required
|
|
184
|
+
- implementation matches public types and exports
|
|
185
|
+
- tests cover changed public behavior and public exports
|
|
186
|
+
- README examples match the actual API; required `doc.mdx` files match the README and title
|
|
187
|
+
- JSDoc explains public API changes where needed
|
|
188
|
+
- source manifests and relative specifiers follow the project's publishing and module conventions
|
|
127
189
|
- no unrelated refactors, formatting churn, or generated artifacts are included
|
|
128
190
|
|
|
129
|
-
|
|
191
|
+
Choose validation according to the change:
|
|
192
|
+
|
|
193
|
+
- For a small behavior change, run the affected tests or package tests with coverage. In Jest projects, `--collectCoverageFrom` may limit collection to the affected production files for a focused run while preserving configured thresholds.
|
|
194
|
+
- For larger package changes, public API changes, cross-package changes, or coverage-sensitive refactors, run the full configured test suite with coverage. For larger package changes, also prefer running the affected package’s configured build when available.
|
|
195
|
+
- For package export, manifest, build-shape, or generated-distribution changes, run the project's distribution build and inspect the affected output.
|
|
196
|
+
- For preset or generator changes, create a disposable project through the existing consumer workflow, inspect its generated files including `AGENTS.md`, install dependencies, and run appropriate lint, test, build, and runtime checks. Report creation, installation, and verification results separately, then remove the temporary project.
|
|
197
|
+
- For documentation-only changes, check formatting and links or references affected by the edit. When changing a guide distributed by a generator, also verify that its updated text reaches generated output.
|
|
198
|
+
|
|
199
|
+
Use the project's configured validation scripts. Typical focused commands, when these tools are available:
|
|
130
200
|
|
|
131
201
|
```bash
|
|
132
202
|
yarn tsc --pretty false
|
|
133
203
|
yarn eslint <changed files or package>
|
|
134
204
|
yarn prettier --check <changed files or package>
|
|
135
|
-
yarn jest <changed tests or package> --runInBand
|
|
136
205
|
```
|
|
137
206
|
|
|
138
|
-
|
|
207
|
+
For projects using Jest, a typical focused test command is:
|
|
139
208
|
|
|
140
|
-
|
|
209
|
+
```bash
|
|
210
|
+
yarn jest <changed tests or package> --runInBand --coverage
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Run ESLint after YAML/YML changes too, for example `yarn eslint <changed.yml>`, when the project's ESLint setup validates YAML files.
|
|
141
214
|
|
|
142
215
|
If a required validation command cannot be run, state why and report the remaining risk.
|
|
143
216
|
|
|
144
217
|
## New Package Checklist
|
|
145
218
|
|
|
146
|
-
When creating a new workspace package
|
|
219
|
+
When creating a new workspace package:
|
|
147
220
|
|
|
148
|
-
1. Create
|
|
149
|
-
2.
|
|
150
|
-
3.
|
|
151
|
-
4.
|
|
152
|
-
5. Keep `.js` relative import/export specifiers.
|
|
153
|
-
6. Add a real test immediately, or a valid placeholder test with a clear public API expectation when behavior is not finalized.
|
|
154
|
-
7. Keep source `package.json` minimal and let `build:dist` generate publish metadata.
|
|
155
|
-
8. Run relevant type, lint, format, test, and build checks.
|
|
221
|
+
1. Create the package in the project's workspace layout, following a suitable existing package or the standard shape above.
|
|
222
|
+
2. Use its actual name consistently in symbols, metadata, paths, README, and docs title.
|
|
223
|
+
3. Add a minimal test of one already defined public behavior immediately.
|
|
224
|
+
4. Complete the synchronization and validation checks in Quality Gate using the project's publishing and module conventions.
|
|
156
225
|
|
|
157
226
|
## Change Discipline
|
|
158
227
|
|
|
228
|
+
- Read the nearest README, manifest, implementation, and tests before editing; follow the established local patterns.
|
|
229
|
+
- Preserve user changes and unrelated untracked files. Remove only temporary projects and artifacts created for the current task.
|
|
159
230
|
- Keep changes scoped to the requested package behavior.
|
|
160
231
|
- Prefer small, reviewable changes over broad rewrites.
|
|
161
232
|
- Split multi-responsibility files into cohesive modules when it makes behavior easier to understand, test, or reuse.
|
|
@@ -164,3 +235,13 @@ When creating a new workspace package `@vyriy/<package>`:
|
|
|
164
235
|
- Preserve existing package conventions unless there is a clear reason to change them.
|
|
165
236
|
- Never leave package docs, tests, exports, or public types behind the implementation.
|
|
166
237
|
- When you learn something package-relevant while working, update the nearest durable guide or docs so future package work starts from that knowledge.
|
|
238
|
+
|
|
239
|
+
## External Links
|
|
240
|
+
|
|
241
|
+
For projects that adopt Vyriy's external-link policy, apply the following rules to rendered HTML:
|
|
242
|
+
|
|
243
|
+
- Always add `rel="nofollow noopener noreferrer"` to external HTTP(S) anchors in rendered HTML, including navigation, README-derived documentation, and generated pages.
|
|
244
|
+
- Keep relative links and links to the site's own domains internal; determine internal domains from the project's site configuration.
|
|
245
|
+
- Apply the attributes in the Markdown-to-HTML renderer so Markdown READMEs remain portable and new links inherit the policy automatically. Markdown cannot express `rel` attributes itself.
|
|
246
|
+
- Preserve useful external references instead of removing them. Check rendered link attributes when changing link generation.
|
|
247
|
+
- `nofollow` expresses the project's search-engine linking policy; it does not guarantee preserved ranking or prevent destination indexing. `noopener` and `noreferrer` protect the browser opener and referrer information.
|