Skip to content

Commit 0ee02b5

Browse files
Wolfe-Jamclaude
andcommitted
feat: Add api-platform project type detection
Detects projects with api/ directory + vercel.json or wrangler config as api-platform instead of static-site. Adds slot category mapping for frontend, backend, universal, and human context slots. Use case: Vercel Edge Function projects, Cloudflare Workers platforms, serverless API platforms with HTML frontends. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 22c505c commit 0ee02b5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/core/slots.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export const APP_TYPE_CATEGORIES: Record<string, SlotCategory[]> = {
9898
backend: ['project', 'backend', 'universal', 'human'],
9999
'data-science': ['project', 'backend', 'human'],
100100
frontend: ['project', 'frontend', 'human'],
101+
'api-platform': ['project', 'frontend', 'backend', 'universal', 'human'],
101102
fullstack: ['project', 'frontend', 'backend', 'universal', 'human'],
102103
svelte: ['project', 'frontend', 'backend', 'universal', 'human'],
103104
framework: ['project', 'frontend', 'backend', 'universal', 'human'],

src/detect/scanner.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,16 @@ export function detectProjectType(dir: string): string {
236236

237237
// Static site detection — check for index.html before other detection
238238
const hasIndexHtml = existsSync(join(dir, 'index.html')) || existsSync(join(dir, 'index.htm'));
239-
const hasStaticSiteMarkers = existsSync(join(dir, '404.html')) ||
239+
const hasStaticSiteMarkers = existsSync(join(dir, '404.html')) ||
240240
existsSync(join(dir, 'about.html')) ||
241241
existsSync(join(dir, 'contact.html'));
242242

243+
// API platform detection — has API endpoints alongside HTML (Edge Functions, serverless)
244+
const hasApiDir = existsSync(join(dir, 'api'));
245+
const hasVercelJson = existsSync(join(dir, 'vercel.json'));
246+
const hasWranglerConfig = existsSync(join(dir, 'wrangler.toml')) || existsSync(join(dir, 'wrangler.jsonc'));
247+
if (hasApiDir && (hasIndexHtml || hasVercelJson || hasWranglerConfig)) {return 'api-platform';}
248+
243249
// Full-stack detection
244250
const hasFrontend = frameworks.some(f => f.category === 'frontend');
245251
const hasBackend = frameworks.some(f => f.category === 'backend');

0 commit comments

Comments
 (0)