feat: add base tool input schema

This commit is contained in:
2026-06-11 14:03:14 +01:00
parent 311f49435e
commit 58fe45b1b3
4 changed files with 275 additions and 5 deletions
+44 -1
View File
@@ -131,4 +131,47 @@ Status: ✅ Complete
---
Phase 2 complete. Phase 3 not yet defined.
## Phase 3 — Tool Inputs and Prompts
### Task 3.1 - Zod input validation schemas
Create `src/tools/schemas.js`.
Requirements:
- Export `baseInputSchema` — a single `z.object({...}).strict()` for the common tool input shape (ARCHITECTURE.md §7).
- Export `validateToolInput(raw)` — returns `{ ok: true, data }` or `{ ok: false, errors }`. Never throws.
- Export `assertValidToolInput(raw)` — returns validated data or throws a `ValidationError`.
- No per-tool schemas. No toolName parameters. Unknown keys must fail via `.strict()`.
Create `test/tools/schemas.test.js`.
Requirements:
- ~26 tests covering schema, validate, and assert paths.
- Test all fields: question (required, min(1)), context, constraints, expectedOutput, projectSummary, taskSummary, relevantFiles (nested object), logs.
- Test strict mode rejects unknown keys.
- Test type rejections for each field.
- Test assert throws `ValidationError` with `.kind` and message content.
- No MCP code. No OpenAI calls. Pure Zod validation only.
Status: ✅ Complete
### Task 3.2 - Base prompt template (NEXT)
Create `src/prompts/base.js`.
Requirements:
- Export a `buildBasePrompt()` function that returns the base system prompt (ARCHITECTURE.md §11).
- The base prompt must be injected as the first message in all tool payloads.
- Must include all rules from ARCHITECTURE.md §10 and §11.
- No per-tool variations yet — that belongs to Task 3.3.
Create `test/prompts/base.test.js`.
Requirements:
- Test that the returned prompt includes all key rules from ARCHITECTURE.md §11.
- Test that the prompt is a non-empty string.
- Test that the prompt does not include tool-specific content (review/code/debug/architecture).
---
Phase 2 complete. Phase 3 in progress.