Skip to content

feat: align DB signals with backend archetype (enum has no db member) - #22

Merged
PrzemekGalarowicz merged 1 commit into
mainfrom
archetype-enum-align
Jul 7, 2026
Merged

feat: align DB signals with backend archetype (enum has no db member)#22
PrzemekGalarowicz merged 1 commit into
mainfrom
archetype-enum-align

Conversation

@PrzemekGalarowicz

@PrzemekGalarowicz PrzemekGalarowicz commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Map DB/ORM dependencies (prisma, @prisma/client, drizzle-orm) to the backend archetype in dependency-based detection.
  • Map file-tree DB signals (.sql files, migrations/ dirs) to backend instead of being ignored, reversing archetype-file-tree-scan decision chore(deps): bump @clack/prompts from 1.5.1 to 1.7.0 #2.
  • Add regression coverage for merged signals (e.g. backend + spa, ssr + backend) and ship the archetype-enum-align feature audit trail.

Test plan

  • npm test — archetype and detect-archetype suites pass
  • npm run typecheck
  • npm run lint
  • npm run format:check
  • CI green on PR

Made with Cursor

Summary by CodeRabbit

  • New Features
    • Broadened project detection so database-related files, migrations, and common ORM packages are now recognized as backend signals.
    • Next.js projects using Prisma now surface both SSR and backend archetypes when applicable.
  • Bug Fixes
    • Improved classification for .sql files and migration folders so they’re no longer overlooked.
    • Updated detection behavior to better reflect mixed frontend/backend project setups.

Map prisma/drizzle deps, .sql files, and migrations/ dirs to `backend`
instead of being ignored, reversing archetype-file-tree-scan decision #2.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends backend archetype detection to recognize database-related signals: .sql files, migrations/ directories, and ORM package dependencies (prisma, @prisma/client, drizzle-orm). Tests are updated to reflect the new detection behavior, and process/report documentation artifacts for the increment are added.

Changes

Backend archetype signal expansion

Layer / File(s) Summary
Backend detection logic for DB signals
src/lib/archetype.ts, src/lib/detect-archetype.ts
Extends BACKEND_FRAMEWORKS with Prisma/Drizzle package names and updates classifyEntry() to mark .sql files and migrations/ directories as backend signals.
Test expectation updates for backend detection
tests/archetype.test.ts, tests/detect-archetype.test.ts
Updates and adds test cases for Prisma dependency detection, .sql/migrations file-tree scanning, and merges with ssr/spa signals.
Increment process artifacts and reports
.dev/features/archetype-enum-align/*, .pharn/pharn-dev-verify/results.json, .pharn/writes-scope.json
Adds PLAN, GRILL, REVIEW, REGRESSION, SHIP, VERIFY markdown docs and JSON reports for the increment, and updates scope/results tracking files.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • pharn-dev/pharn-cli#17: Both PRs modify archetype detection logic and its tests in src/lib/archetype.ts and tests/archetype.test.ts, with this PR extending backend signal recognition for Prisma/Drizzle.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: database signals are aligned with the backend archetype and there is no db enum member.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch archetype-enum-align

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.dev/features/archetype-enum-align/PLAN.md:
- Around line 31-34: The PLAN.md scope is missing the existing next + prisma
pinned case in tests/archetype.test.ts, which should now be updated to ['ssr',
'backend'] alongside the other DB-to-backend changes. Update the test/spec entry
for archetype classification to explicitly include this case, and make sure the
plan references the relevant symbols in tests/archetype.test.ts so the required
edit is fully captured.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ed54419-09cf-476d-951b-b239671ceb3f

📥 Commits

Reviewing files that changed from the base of the PR and between 80d7a33 and 7e76187.

📒 Files selected for processing (14)
  • .dev/features/archetype-enum-align/GRILL.md
  • .dev/features/archetype-enum-align/PLAN.md
  • .dev/features/archetype-enum-align/REGRESSION.md
  • .dev/features/archetype-enum-align/REVIEW.md
  • .dev/features/archetype-enum-align/SHIP.md
  • .dev/features/archetype-enum-align/VERIFY.md
  • .dev/features/archetype-enum-align/regression-report.json
  • .dev/features/archetype-enum-align/verify-report.json
  • .pharn/pharn-dev-verify/results.json
  • .pharn/writes-scope.json
  • src/lib/archetype.ts
  • src/lib/detect-archetype.ts
  • tests/archetype.test.ts
  • tests/detect-archetype.test.ts

Comment on lines +31 to +34
- `src/lib/detect-archetype.ts` — in `classifyEntry`, add: a file whose name ends `.sql` → `backend` signal; a dir named `migrations` → `backend` signal; update the "contribute NOTHING" comment (lines 66-68) to record the reversal — layer: I/O boundary
- `src/lib/archetype.ts` — add ORM package names (`prisma`, `@prisma/client`, `drizzle-orm`) to `BACKEND_FRAMEWORKS`; update the set's comment — layer: pure classification rules
- `tests/detect-archetype.test.ts` — **flip** the pinned decision-#2 test (209-216): `.sql` + `migrations/` now → `['backend']`, not `['lib']`; rewrite its comment to cite this plan's reversal — layer: test/spec (P1)
- `tests/archetype.test.ts` — add package-name cases: `drizzle-orm` dep → `backend`; `prisma` / `@prisma/client` dep → `backend`; a DB-only project → `['backend']` — layer: test/spec (P1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the existing next + prisma pin to the plan.

The Files section misses tests/archetype.test.ts:37-41, which flips to ['ssr', 'backend'] under the approved DB→backend change. Update the plan scope or it will understate the required test edit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.dev/features/archetype-enum-align/PLAN.md around lines 31 - 34, The PLAN.md
scope is missing the existing next + prisma pinned case in
tests/archetype.test.ts, which should now be updated to ['ssr', 'backend']
alongside the other DB-to-backend changes. Update the test/spec entry for
archetype classification to explicitly include this case, and make sure the plan
references the relevant symbols in tests/archetype.test.ts so the required edit
is fully captured.

@PrzemekGalarowicz
PrzemekGalarowicz merged commit 43e16b3 into main Jul 7, 2026
6 checks passed
@PrzemekGalarowicz
PrzemekGalarowicz deleted the archetype-enum-align branch July 7, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant