---
id: 7896
title: Index `ai/` directory in Knowledge Base via JSDoc
state: CLOSED
labels:
  - documentation
  - enhancement
  - ai
assignees:
  - tobiu
createdAt: '2025-11-24T12:37:24Z'
updatedAt: '2025-11-24T13:07:21Z'
githubUrl: 'https://github.com/neomjs/neo/issues/7896'
author: tobiu
commentsCount: 1
parentIssue: null
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2025-11-24T13:02:52Z'
---
# Index `ai/` directory in Knowledge Base via JSDoc

# Index `ai/` directory in Knowledge Base via JSDoc

The `ai/` directory contains the SDK, MCP servers, and examples, which are critical parts of the platform. This content should be:
1.  Visible in the **Docs App** for developers.
2.  Indexed in the **AI Knowledge Base** for agents.

The current `DatabaseService.mjs` consumes `docs/output/all.json`, which is generated by `buildScripts/docs/jsdocx.mjs`. Currently, `jsdocx.mjs` only scans `src/` and `apps/`.

## Goal
Extend `buildScripts/docs/jsdocx.mjs` to parse the `ai/` directory.

## Tasks
- [ ] Update `buildScripts/docs/jsdocx.mjs` to include `ai/**/*.mjs` in the input files.
- [ ] Adjust the `neoStructure` and `processPath` logic in `jsdocx.mjs` to correctly categorize and name `ai` namespace items (e.g., `Neo.ai.services`).
- [ ] Ensure that the resulting `docs/output/all.json` contains the AI classes.
- [ ] Verify that `DatabaseService` picks up these new items (it should happen automatically if `all.json` is populated correctly).


## Timeline

- 2025-11-24T12:37:25Z @tobiu added the `documentation` label
- 2025-11-24T12:37:25Z @tobiu added the `enhancement` label
- 2025-11-24T12:37:25Z @tobiu added the `ai` label
- 2025-11-24T12:38:00Z @tobiu cross-referenced by #7887
- 2025-11-24T13:00:08Z @tobiu assigned to @tobiu
- 2025-11-24T13:02:52Z @tobiu closed this issue
### @tobiu - 2025-11-24T13:07:21Z

**Input from Gemini:**

> ✦ The implementation is complete and verified.
> 
> **Changes:**
> 1.  **Documentation (`ai` directory):**
>     *   Modified `buildScripts/docs/jsdocx.mjs` to include `ai/**/*.mjs`.
>     *   Added logic to correctly map the `ai` directory to the `Neo.ai` namespace in the JSDoc output.
>     *   Fixed multiple invalid JSDoc type definitions in AI services to ensure successful parsing.
>     *   Verified that `docs/output/all.json` now contains `Neo.ai` entries.
> 
> 2.  **Tests (`test/playwright` directory):**
>     *   Updated `ai/mcp/server/knowledge-base/openapi.yaml` to add `test` as a valid query type.
>     *   Enhanced `DatabaseService.mjs` with `indexRawDirectory` to scan and index the `test/playwright` folder as raw source files with `type: 'test'`.
> 
> **Verification:**
> *   A Knowledge Base sync was performed using the Code Execution pattern (`sync_knowledge_base.mjs`).
> *   Manual testing in a parallel session confirmed that queries with `type: 'test'` correctly return relevant Playwright specs (e.g., `test/playwright/unit/button/Base.spec.mjs` for query "button").
> 
> The Knowledge Base now covers the SDK, MCP servers, and the automated testing suite.


