Skip to content

Commit d24d22c

Browse files
committed
Create Class Hierarchy YAML #7246
1 parent fd6f084 commit d24d22c

3 files changed

Lines changed: 44 additions & 2 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Ticket: Create Class Hierarchy YAML
2+
3+
GH ticket id: #7246
4+
5+
**Assignee:** Gemini
6+
**Status:** Done
7+
8+
## Description
9+
10+
The current `docs/output/structure.json` file is too large and inefficient for AI agent consumption. To provide a lean but effective overview of the project's class structure, we will create a new build artifact.
11+
12+
## Goal
13+
14+
Modify the `buildScripts/docs/jsdocx.mjs` script to generate a new file at `docs/output/class-hierarchy.yaml`.
15+
16+
### Requirements:
17+
18+
1. **Format:** The file must be in YAML.
19+
2. **Content:** It will contain a simple key-value mapping of `className: parentClassName`.
20+
3. **Sorting:** The entries must be sorted alphabetically by the `className` (the key).
21+
4. **Implementation:** This will be done within the existing `jsdocx.mjs` script, leveraging the already-parsed documentation data.
22+
5. **Agent Integration:** Update `AGENTS.md` to instruct the agent to parse `docs/output/class-hierarchy.yaml` instead of the old `structure.json` file.

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ about the framework. The **ONLY** source of truth is the content within this rep
1515

1616
At the beginning of every new session, you **MUST** perform the following steps to ground your understanding of the framework:
1717

18-
1. **Read the Codebase Structure:** Parse the file `docs/output/structure.json`. This will give you a complete map of
19-
all files, directories, and class names in the project. If this file is missing, you can generate it by running
18+
1. **Read the Codebase Structure:** Parse the file `docs/output/class-hierarchy.yaml`. This will give you a complete map of
19+
all class names and their inheritance hierarchy. If this file is missing, you can generate it by running
2020
`npm run generate-docs-json`.
2121

2222
2. **Read the Core Concepts (`src/Neo.mjs`):** When reading this file, focus on understanding:

buildScripts/docs/jsdocx.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,26 @@ jsdocx.parse(options)
397397
generateStructure(key + 'Empty', 2, docs);
398398
});
399399

400+
const classHierarchy = {};
401+
402+
docs.forEach(item => {
403+
if (item.$kind === 'class' && item.neoClassName && item.neoClassName !== 'Neo') {
404+
const parentClass = item.augments && item.augments.length > 0 ? item.augments[0] : null;
405+
classHierarchy[item.neoClassName] = parentClass;
406+
}
407+
});
408+
409+
const sortedKeys = Object.keys(classHierarchy).sort();
410+
411+
let yamlString = '# This file is automatically generated. Do not edit.\n\n';
412+
sortedKeys.forEach(key => {
413+
yamlString += `${key}: ${classHierarchy[key] || 'null'}\n`;
414+
});
415+
416+
fs.writeFileSync('./docs/output/class-hierarchy.yaml', yamlString);
417+
418+
console.log('Generated docs/output/class-hierarchy.yaml');
419+
400420
neoStructure.sort(function (a, b) {
401421
if (a.name[0] === a.name[0].toLocaleLowerCase() && b.name[0] === b.name[0].toLocaleLowerCase() ||
402422
a.name[0] === a.name[0].toLocaleUpperCase() && b.name[0] === b.name[0].toLocaleUpperCase()) {

0 commit comments

Comments
 (0)