build(docs-gen): add simple extension name extractor#1157
Conversation
Reviewer's GuideAdds a new docs-gen CLI extractor that walks extension directories, uses the TypeScript AST to detect extension-like exports, filters them (including a blacklist and extra references), and writes a minimal extensions.json file, plus corresponding tests and npm scripts/wiring. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="infra/docs-gen/src/extract-extension-data.mjs" line_range="201-41" />
<code_context>
+ writeExtensionsJson();
+}
+
+if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
+ main();
+}
</code_context>
<issue_to_address>
**issue (bug_risk):** The CLI entry-point check may fail depending on how the script is invoked (relative vs absolute path, Windows path differences).
Directly comparing `fileURLToPath(import.meta.url)` with `process.argv[1]` is brittle because `argv[1]` may be relative while `fileURLToPath` is absolute, and path string formats differ across platforms. Consider normalizing both sides, e.g. `if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)` or comparing `resolve(process.argv[1])` to `fileURLToPath(import.meta.url)` so `main()` reliably runs when the script is invoked via `node path/to/extract-extension-data.mjs`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| firstChar === firstChar.toUpperCase() && | ||
| firstChar !== firstChar.toLowerCase() | ||
| ); | ||
| } |
There was a problem hiding this comment.
issue (bug_risk): The CLI entry-point check may fail depending on how the script is invoked (relative vs absolute path, Windows path differences).
Directly comparing fileURLToPath(import.meta.url) with process.argv[1] is brittle because argv[1] may be relative while fileURLToPath is absolute, and path string formats differ across platforms. Consider normalizing both sides, e.g. if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) or comparing resolve(process.argv[1]) to fileURLToPath(import.meta.url) so main() reliably runs when the script is invoked via node path/to/extract-extension-data.mjs.
52eac20 to
6de3079
Compare
6de3079 to
abe5aee
Compare
What changed
Adds a deliberately small docs-gen extractor that builds raw extension name records for future extension docs pages.
The key idea is that every configured
.ts/.tsxsource is parsed by TypeScript itself viats.createSourceFile, and extension export names are detected on TypeScript AST nodes instead of regex/string matching.The output stays minimal:
{ "extensions": [{"name": "Bold"}] }Implementation notes:
Validation
Full project tests were not run locally because AGENTS.md requires Docker/Podman for test runs.
Summary by Sourcery
Add a docs-gen CLI to extract public editor extension names into a JSON file for future documentation generation.
New Features:
Enhancements: