Conversation
- add detailed project overview, workflows, and reference sections
Completed Working on "Auto PR Description"✅ Workflow completed successfully. |
Completed Working on "Code Review"✅ Workflow completed successfully. |
There was a problem hiding this comment.
Review findings: 0 BLOCKER, 0 CRITICAL, 2 MAJOR, 1 MINOR. The new AGENTS.md repeatedly overstates existing guardrails—validateName is still implemented with an unanchored regex and the data source/generator builders return user input verbatim—so the documentation promises safety that the code does not provide. The Testing Style section also claims table-driven specs and printer snapshots that do not exist in the current Jest suites. Next steps: either strengthen the builders to match the documented guarantees (anchored identifier validation, datasource/generator validation) or revise the doc to reflect today’s behavior, and bring the testing guidance in line with the actual specs (or expand the specs to match the described approach).
|
|
||
| ## 🧩 Code Patterns | ||
| - **Builder Validation:** | ||
| - `validateName` enforces `/[A-Za-z][A-Za-z0-9_]*/` naming. |
There was a problem hiding this comment.
[MAJOR]: Both the introductory bullet list and the "Builder Validation" section promise that validateName enforces /[A-Za-z][A-Za-z0-9_]*/, but src/builders.ts still uses an unanchored regex with name.match, so identifiers like 1Model or Foo! pass—the guide overstates the enforcement in multiple places. Either tighten the implementation (e.g., /^[A-Za-z][A-Za-z0-9_]*$/ with .test()) or update both AGENTS.md sections to describe the current weaker check.
| - **Purpose:** `prisma-schema-dsl` exposes TypeScript builders and printers that help programmatically compose Prisma Schema ASTs and render them into `.prisma` files. | ||
| - **Runtime:** Pure TypeScript library compiled to CommonJS (see `tsconfig.json` targeting `es3` with declarations emitted to `dist`). | ||
| - **Key Capabilities:** | ||
| - Validation-heavy builders in `src/builders.ts` ensure model, enum, scalar, relation, data source, and generator definitions are syntactically safe. |
There was a problem hiding this comment.
[MAJOR]: The overview section claims the builders keep data source and generator definitions "syntactically safe," yet createDataSource/createGenerator in src/builders.ts simply return user input without validation, so the added documentation promises guardrails the code does not supply. Either add validation for those builders or change the new documentation to reflect the absence of checks.
| - Scalar defaults (`validateScalarDefault`) guard against invalid literal/call-expression combinations. | ||
| - **Printer Composition:** `src/print.ts` renders schemas by composing helpers (e.g., `printScalarField`, `printRelation`) and injecting documentation via `withDocumentation`. | ||
| - **Testing Style:** | ||
| - Jest specs inside `src/*.spec.ts` use table-driven `test.each` coverage for builder permutations and printer snapshots. |
There was a problem hiding this comment.
[MINOR]: ## 🧩 Code Patterns → Testing Style states that Jest specs rely on table-driven test.each coverage and printer snapshots, but src/builders.spec.ts only has two imperative cases and src/print.spec.ts asserts plain strings, so the guidance misrepresents the actual tests. Align the documentation with the existing minimal tests or enhance the tests to match the described approach.
Summary
This PR adds a comprehensive AGENTS.md guide so future contributors have a single reference for the repository.
Changes
Why
Keeping AGENTS.md up to date ensures automation agents and maintainers understand the expected workflows, quality standards, and prevalent patterns across the codebase.
Summary
Adds a comprehensive AGENTS.md reference that orients contributors by outlining the project’s purpose, repository layout, development workflow, code patterns, quality standards, and common local commands to keep future updates consistent.
Changes
Commits
Testing
npm ci,npm run check-format,npm test,npm run build) execute successfully in a local environment.