Skip to content

Commit f6551d2

Browse files
committed
feat: Add relations JSON references to product llms.txt files
Include class relationship graph documentation in llms.txt: - Add /relations/{product}.json to Quick Stats - Add new section explaining relationship graph contents - Add to Additional Resources section This enables LLMs to discover and use the relationship data.
1 parent dacc92c commit f6551d2

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

scripts/generate-product-llms.mjs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ function generateProductLLMSTxt(productData) {
143143
144144
- **Total Hooks:** 0
145145
- **Repository:** ${product.repo}
146-
${product.version ? `- **Version:** ${product.version}\n` : ''}- **JSON API:** \`/api/hooks/${product.id}.json\`
146+
${product.version ? `- **Version:** ${product.version}\n` : ''}- **Hooks JSON:** \`/api/hooks/${product.id}.json\`
147+
- **Relations JSON:** \`/relations/${product.id}.json\` (class relationships for code understanding)
147148
- **Documentation:** \`/docs/${product.id}/\`
148149
149150
## Status
@@ -153,7 +154,8 @@ This product currently has no documented hooks. Hooks documentation will be adde
153154
## Related Resources
154155
155156
- **Full Hook List:** \`/docs/${product.id}/actions/\` and \`/docs/${product.id}/filters/\`
156-
- **JSON API:** \`/api/hooks/${product.id}.json\`
157+
- **Hooks JSON:** \`/api/hooks/${product.id}.json\`
158+
- **Relations JSON:** \`/relations/${product.id}.json\`
157159
- **Support:** https://www.gravitykit.com/support/
158160
- **GitHub:** https://github.com/${product.repo}
159161
@@ -193,7 +195,8 @@ This product currently has no documented hooks. Hooks documentation will be adde
193195
194196
- **Total Hooks:** ${stats.total} (${stats.actions} actions, ${stats.filters} filters)
195197
- **Repository:** ${product.repo}
196-
${product.version ? `- **Version:** ${product.version}\n` : ''}- **JSON API:** \`/api/hooks/${product.id}.json\`
198+
${product.version ? `- **Version:** ${product.version}\n` : ''}- **Hooks JSON:** \`/api/hooks/${product.id}.json\`
199+
- **Relations JSON:** \`/relations/${product.id}.json\` (class relationships for code understanding)
197200
- **Documentation:** \`/docs/${product.id}/\`
198201
199202
## What You Can Do
@@ -293,6 +296,20 @@ Understanding ${product.label} hook naming helps you find what you need:
293296
- \`.../before_...\` - Fires before an action (preparation, validation)
294297
- \`.../after_...\` - Fires after an action (cleanup, logging)
295298
299+
## Class Relationship Graph
300+
301+
For deep code understanding, fetch \`/relations/${product.id}.json\` which contains:
302+
303+
- **extends** - Parent class inheritance
304+
- **implements** - Interface implementations
305+
- **uses** - Trait usage
306+
- **dependencies** - Constructor/method type-hinted dependencies
307+
- **instantiates** - Classes created via \`new\`
308+
- **staticCalls** - Static method calls to other classes
309+
- **usedBy** - Reverse lookup (what uses this class)
310+
311+
This graph enables understanding ${product.label}'s architecture without direct code access.
312+
296313
## Pro Tips for AI Assistants
297314
298315
When helping developers with ${product.label}:
@@ -308,7 +325,8 @@ When helping developers with ${product.label}:
308325
## Additional Resources
309326
310327
- **Full Hook List:** \`/docs/${product.id}/actions/\` and \`/docs/${product.id}/filters/\`
311-
- **JSON API:** \`/api/hooks/${product.id}.json\`
328+
- **Hooks JSON:** \`/api/hooks/${product.id}.json\`
329+
- **Relations JSON:** \`/relations/${product.id}.json\`
312330
- **Support:** https://www.gravitykit.com/support/
313331
- **GitHub:** https://github.com/${product.repo}
314332

0 commit comments

Comments
 (0)