-
Notifications
You must be signed in to change notification settings - Fork 3
Description
What
Add database migration tool detection to the scanner. When a repo uses Prisma, Drizzle, Alembic, Rails migrations, etc., report it in the scan results.
Why
Database tools are architecturally significant — they define the data model. Knowing "this project uses Prisma with 8 models" gives Claude important context for writing skills.
How
Edit src/lib/scanner.js. Add a detectDatabaseTools(repoPath) function that checks for these files:
| Tool | Detection Signal |
|---|---|
| Prisma | prisma/schema.prisma |
| Drizzle | drizzle.config.ts or drizzle.config.js or drizzle/ directory |
| TypeORM | ormconfig.json or ormconfig.ts or ormconfig.js |
| Sequelize | .sequelizerc or config/config.json with Sequelize patterns |
| Knex | knexfile.js or knexfile.ts |
| Alembic | alembic.ini and alembic/versions/ directory |
| Django migrations | Any */migrations/ directory inside a directory containing models.py |
| ActiveRecord (Rails) | db/migrate/ directory |
| Flyway | db/migration/ with files matching V*.sql |
| golang-migrate | migrations/ with files matching *.up.sql |
All checks are existsSync() calls. For Prisma, you can optionally count models by grepping schema.prisma for lines matching ^model\s+\w+.
Implementation steps
-
Add
detectDatabaseTools(repoPath)tosrc/lib/scanner.js:function detectDatabaseTools(repoPath) { const detected = []; if (existsSync(join(repoPath, 'prisma', 'schema.prisma'))) { detected.push('prisma'); } if (existsSync(join(repoPath, 'drizzle.config.ts')) || existsSync(join(repoPath, 'drizzle.config.js'))) { detected.push('drizzle'); } if (existsSync(join(repoPath, 'alembic.ini'))) { detected.push('alembic'); } if (existsSync(join(repoPath, 'db', 'migrate'))) { detected.push('activerecord'); } // ... etc return detected; }
-
Call from
scanRepo():result.database = detectDatabaseTools(repoPath); -
Display in
src/commands/scan.js:if (result.database && result.database.length > 0) { console.log(pc.cyan(' Database: ') + result.database.join(', ')); }
-
Add tests in
tests/scanner.test.js:describe('database tool detection', () => { it('detects Prisma', () => { const dir = createFixture('db-prisma', { 'prisma/schema.prisma': 'model User { id Int @id }', }); const scan = scanRepo(dir); expect(scan.database).toContain('prisma'); }); it('detects Alembic', () => { const dir = createFixture('db-alembic', { 'alembic.ini': '[alembic]', }); const scan = scanRepo(dir); expect(scan.database).toContain('alembic'); }); });
Files to change
src/lib/scanner.js— adddetectDatabaseTools(), call fromscanRepo()src/commands/scan.js— display in outputtests/scanner.test.js— add tests
Acceptance criteria
-
npm testpasses - At least Prisma, Drizzle, Alembic, and ActiveRecord detected
-
aspens scandisplays detected database tools