Update spec for NDBS
This commit is contained in:
parent
fcf4121cbe
commit
ac1cef31ac
@ -47,12 +47,16 @@ D:\code\super-mentor\
|
|||||||
**Step 1.2: File System API**
|
**Step 1.2: File System API**
|
||||||
* **Instruction:** Implement endpoints to list and read definitions.
|
* **Instruction:** Implement endpoints to list and read definitions.
|
||||||
* **Endpoints:**
|
* **Endpoints:**
|
||||||
* `GET /api/files/definitions`: Scans `resources/definitions/` and returns a list of `.json` files.
|
* `GET /api/files/definitions`: Scans `resources/definitions/` and returns a list of `.json` AND `.tres` files.
|
||||||
* `GET /api/files/content`: Takes a `filename` query param; returns the parsed JSON content.
|
* `GET /api/files/content`: Takes a `filename` query param.
|
||||||
* `POST /api/files/content`: Takes `filename` and `content` (JSON body); writes it back to `resources/definitions/{filename}` with 2-space indentation.
|
* If `.json`: Returns parsed JSON.
|
||||||
|
* If `.tres`: Parses the `[resource]` section key-value pairs into a JSON object. Handles arrays (e.g., `Tags = [ "a", "b" ]`) and strings.
|
||||||
|
* `POST /api/files/content`: Takes `filename` and `content` (JSON body).
|
||||||
|
* If `.json`: Writes standard JSON.
|
||||||
|
* If `.tres`: Reads the original file, replaces the values in the `[resource]` section with new values from the JSON, and saves preserving the header/metadata.
|
||||||
|
|
||||||
**Step 1.3: Schema Inference (Dynamic Models)**
|
**Step 1.3: Schema Inference (Dynamic Models)**
|
||||||
* **Instruction:** Since we don't have hardcoded Pydantic models for every file, create a utility that reads a JSON file and generates a generic "Schema" description (listing keys and value types) to help the frontend build forms dynamically.
|
* **Instruction:** Since we don't have hardcoded Pydantic models for every file, create a utility that reads a file (JSON or TRES) and generates a generic "Schema" description (listing keys and value types) to help the frontend build forms dynamically.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -150,14 +154,3 @@ D:\code\super-mentor\
|
|||||||
### 4.3 Safety
|
### 4.3 Safety
|
||||||
* **No Overwrite:** When creating a new rule, fail if the file already exists.
|
* **No Overwrite:** When creating a new rule, fail if the file already exists.
|
||||||
* **Backup:** (Bonus) Before saving a JSON file, copy the old version to `tools/ndbs/backups/`.
|
* **Backup:** (Bonus) Before saving a JSON file, copy the old version to `tools/ndbs/backups/`.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## 5. "Get Started" Prompt for AI
|
|
||||||
|
|
||||||
*To begin implementing this spec, paste the following prompt:*
|
|
||||||
|
|
||||||
> "I need to initialize the NDBS server as defined in Phase 1 of `specs/numerical_design_system.md`.
|
|
||||||
> Please create the directory `tools/ndbs/server`, set up a basic FastAPI `main.py` application, and implement the file listing endpoint `GET /api/files/definitions` that reads from `resources/definitions/`.
|
|
||||||
> Use `uvicorn` to run it on port 8000. Ensure CORS is enabled."
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user