You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- If a change is a direct fix for a specific previous commit, place it immediately after that commit with a `fix:` prefix in the message.
96
96
- Typical commit order: source changes → test changes → regenerated examples. Example updates should be the last commit in the branch.
97
97
98
+
## Pull Request Style
99
+
100
+
- PR body should be a bullet list summarizing changes — no section headers, no test plan.
101
+
- Use two-level nesting to group related items when the list is long; keep it flat when short.
102
+
- Keep bullets concise and focused on what changed, not why.
103
+
- When a PR changes generated code or user-facing API, include before/after code examples.
104
+
- Add a short motivation line before each example explaining why the change was made.
105
+
98
106
## Development Guidelines
99
107
100
108
### TypeScript Configuration
@@ -198,6 +206,29 @@ Located in `src/api/writer-generator/`:
198
206
- Each writer traverses TypeSchema index and generates code
199
207
- Maintains language-specific idioms and conventions
200
208
209
+
## Static Assets for Generators
210
+
211
+
Static files that are copied verbatim into generated output live in `assets/api/writer-generator/<language>/`. Each language writer has a resolver function (e.g., `resolveTsAssets`, `resolvePyAssets`) that handles path resolution for both dev (`src/`) and dist (`dist/`) builds.
212
+
213
+
**Pattern:**
214
+
```
215
+
assets/api/writer-generator/
216
+
├── typescript/profile-helpers.ts # Runtime helpers for TS profile classes
217
+
└── python/
218
+
├── requirements.txt
219
+
├── fhirpy_base_model.py
220
+
└── resource_family_validator.py
221
+
```
222
+
223
+
**How it works:**
224
+
1. Asset files are authored/maintained directly in `assets/` (included in biome linting)
225
+
2. Writers copy them to output via `this.cp("filename", "filename")` — uses `Writer.cp()` which resolves via `resolveAssets`
226
+
3. Each language writer sets `resolveAssets` in its constructor (e.g., TypeScript writer defaults to `resolveTsAssets`)
227
+
228
+
**When to use assets vs programmatic generation:**
229
+
- Use assets for static runtime code shared across all generated profiles (helpers, validators, base models)
230
+
- Use programmatic generation (`w.lineSM()`, `w.curlyBlock()`) for code that varies per schema/profile
231
+
201
232
## Common Development Patterns
202
233
203
234
### Adding a New Generator Feature
@@ -235,10 +266,11 @@ Located in `src/api/writer-generator/`:
0 commit comments