Conversation
Ship src/** in the npm tarball (excluding tests, stories, generated files) and document its location in doc/llms.md so LLMs can read the real component source as a complement to the docs and type defs. Refs WEB-2431
|
Size stats
|
|
Accessibility report ℹ️ You can run this locally by executing |
|
Screenshot tests report ✔️ All passing |
Replace the broad "Source code location" section with a concise "Source code" section that tells LLMs where source lives and when to read it (debugging layout/CSS, event handling, skin authoring) — and when not to (greenfield UI work). Research across 9 A/B iterations showed that verbose source-reading instructions pull agents toward low-level escape hatches when documented composite components would produce simpler code. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Deploy preview for mistica-web ready!
Deployed with vercel-action |
| If you cannot find a documentation file in `node_modules`, fetch the equivalent file from the GitHub | ||
| repository at `https://github.com/Telefonica/mistica-web/blob/master/doc/<filename>`. | ||
|
|
||
| ## Source code |
There was a problem hiding this comment.
should we add instructions to avoid the agent to change the source code in node_modules?
There was a problem hiding this comment.
It did not every try to modify source code in my tests. I think it knows this source code shouldn't be modified implicitly
| "doc/**", | ||
| "src/**", | ||
| "!src/generated/**", | ||
| "!src/**/__tests__/**", |
There was a problem hiding this comment.
Some tests may be relevant to understand how to use a component
There was a problem hiding this comment.
Hmm...
Actually we found there are very few cases where reading the source code helps the llm answers prompts. I am not so sure having the tests too would add any additional context in those cases
|
🎉 This PR is included in version 16.61.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [16.61.0](Telefonica/mistica-web@v16.60.0...v16.61.0) (2026-04-24) ### Bug Fixes * **Image:** handle SSR image already complete before inline script runs ([Telefonica#1536](Telefonica#1536)) ([ec1e35c](Telefonica@ec1e35c)) ### Features * **chore:** Minimal github conventions ([Telefonica#1530](Telefonica#1530)) ([f7ca38a](Telefonica@f7ca38a)) * **fixedFooterLayout:** include footerScrollEffect prop ([Telefonica#1532](Telefonica#1532)) ([bd56fb2](Telefonica@bd56fb2)) * **llms:** Include source code in mistica package ([Telefonica#1531](Telefonica#1531)) ([bf6280b](Telefonica@bf6280b))
Summary
Adds source code to Mistica published package. To make up the instructions for the LLMs we conducted a series of experiments that are detailed below. The conclusions were:
.d.tsfor prop questions — Reading .d.ts files is 10-17% cheaper than reading.tsxsource, and LLMs understand these types. Also JSDoc is preserved in .d.ts files and taken in account by LLMs..tsx/.css.tssource can help LLMs when asked specifically about library internals or debugging errors caused by Mistica lib itself. When source files are not present LLMs read the compiled files reaching essentially the same conclusions, but reading the compiled code is more expensive in tokens/time.Following these, we concluded adding the source code can be helpful, but we tailored the instructions so LLMs just read it when needed and don't default to it.
Iteration 1 — Beta v16.59.0-beta.1 (with source code) vs Stable v16.58.0 (without source code)
Setup: Four greenfield UI evals (baseline vs "imperative read source")
Beta has the "Source code location" section; stable v16.58.0's llms.md doesn't ship it.
*Stable Netflix hit API error after completing — screenshot/code succeeded.
Settings page
Beta v16.59.0-beta.1
Stable v16.58.0
Stable used
HeaderLayout + HeaderandCallout— more polished structure. Both usedRow switchandRowListidiomatically.Checkout form
Beta v16.59.0-beta.1
Stable v16.58.0
Stable added a
Steppercomponent (Cart/Shipping/Payment/Confirmation) — a composite the beta version didn't reach for. Ignore the misalignment, the stable version didn't include last changes from: #1526Dashboard
Beta v16.59.0-beta.1
Stable v16.58.0
Stable used
GridLayout template="8+4"for side-by-side composition of data usage and connected devices. Beta used simpler vertical stack and MainNavigationBar.Netflix page
Beta v16.59.0-beta.1
Stable v16.58.0
Both visually striking with custom dark skins. Roughly tied.
Iteration 1 — Baseline vs "imperative read source" (same beta version)
Added a "Step 3" to llms.md forcing agents to read component source before coding.
Settings page
Baseline
Modified (imperative read source)
Checkout form
Baseline
Modified (imperative read source)
Dashboard
Baseline
Modified (imperative read source)
Netflix page
Baseline
Modified (imperative read source)
switch, NegativeBox, StartIconWhile the results are inconsistent, token usage and time consumption was much higher for the modified version. Avg tokens: Baseline 67.6k, Modified 74.5k (+10%). Mixed results — source reading helped discover composites but regressed idiomatic patterns.
Iteration 1b — Three-way: baseline vs imperative vs "why-driven" rationale
Settings page
Baseline
V1 (imperative)
V2 (why-driven)
Checkout form
Baseline
V1 (imperative)
V2 (why-driven)
Dashboard
Baseline
V1 (imperative)
V2 (why-driven)
Netflix page
Baseline
V1 (imperative)
V2 (why-driven)
Produced code has essentially the same quality.
Iterations 2–3 — Image upload: with/without Source location section
Here we don't include screenshots because they were essentially the same.
Prompt: "Generate a wireframe with mistica where the user can attach images to upload..."
FileUploadcomponent — both built custom drop zones. Source location hint didn't help with component discovery.FileUpload): WITHOUT-source used the cleaner declarative API (renderButton/renderFiles/withDropZone). WITH-source reached for the low-levelrenderprop.Iteration 4 — beta (source code) vs v16.58.0 (no source code) + FileUpload
WITH source (beta v16.59.0-beta.1)
WITHOUT source (stable v16.58.0)
<img>renderpropIteration 5 — Fix DataCard accessibility (
segregateTouchableContent)Prompt
Fix the accessibility of the DataCard in example-fix-data-card/card.tsx so that all sections within the card (headline, title, subtitle, description, slot) are read one by one by screen readers.
Code
Both found the same correct answer:
segregateTouchableContentprop.card-internal.tsxcard-internal.d.tsIteration 6 — Card with custom "hola" aria-label
Prompt
Generate a DataCard whose elements (headline, title, subtitle, description, slot) are read one by one by screen readers, AND whose clickable/touchable accessibility label is the word 'hola' (instead of the title text).
Both found the same compound solution:
segregateTouchableContent+touchableAriaLabel="hola".Iteration 7 — Debug "aria-label ignored, title announced"
Prompt
I have a DataCard at example-fix-data-card/card.tsx. I added aria-label='hola' because I want screen readers to announce the clickable card as 'hola'. I also added segregateTouchableContent so each section is read individually. But when I test it with my screen reader, it announces the title 'Title' as the button label instead of 'hola'. The aria-label seems to be ignored. Why?
Both found the root cause:
aria-labellabels the outer container, not the touchable button. Fix:touchableAriaLabel.card-internal.tsxline 1359 + namedhasTouchableInContentvariable.d.tsIteration 8 — Debug "search field not expanding in MainNavigationBar"
Here we asked the llm to reason about a ticket Vivo opened recently. It would need to inspect the source code in order to know why components weren't working as expected.
Prompt
I have a page with a MainNavigationBar at example-fix-data-card/page-example.tsx. The right prop contains an with a and a (Avatar + 'Entrar' text). The right portion of the navigation bar is NOT being stretched to occupy the full width of the available area. The SearchField does not expand horizontally to fill space — it just renders at its natural minimum width. I want the SearchField to grow and fill the available horizontal space inside the navbar's right slot, while the 'Entrar' button stays at its natural size on the right edge. Why is this happening, and how do I fix it?
Code
Both found the same 4-layer root cause and fixed with
flex: 1wrapper.Key findings
.d.tsis an underrated discovery channel — for prop questions, same answer at a fraction of the cost