tpmjs/packages/db/check-tool.js
Ajax Davis d5e8d50082 fix: update API route to use catch-all pattern for clean URLs
- Rename API route from [slug] to [...slug] for catch-all routing
- Update API handler to join slug segments for scoped packages
- Remove encodeURIComponent from frontend API call

This fixes the 404 error when accessing tool pages with scoped package names.
The sync workers will need to run to populate README data for existing tools.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:57:54 +10:00

30 lines
898 B
JavaScript

const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function main() {
const tool = await prisma.tool.findUnique({
where: { npmPackageName: '@tpmjs/text-transformer' },
select: {
npmPackageName: true,
npmVersion: true,
npmReadme: true,
},
});
if (tool) {
console.log('Tool found:', tool.npmPackageName, tool.npmVersion);
console.log('Has README:', tool.npmReadme ? `Yes (${tool.npmReadme.length} chars)` : 'No');
} else {
console.log('Tool @tpmjs/text-transformer not found in database');
// List all tools to see what's available
const allTools = await prisma.tool.findMany({
select: { npmPackageName: true },
take: 10,
});
console.log('\nAvailable tools:');
allTools.forEach((t) => console.log(' -', t.npmPackageName));
}
}
main().finally(() => prisma.$disconnect());