MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / projectKind

Function projectKind

src/ui-server/api/steps.ts:1646–1659  ·  view source on GitHub ↗
(routes: readonly Node[], navigates: number)

Source from the content-addressed store, hash-verified

1644 * app; both — pages and the endpoints behind them — make a web app.
1645 */
1646export function projectKind(routes: readonly Node[], navigates: number): 'app' | 'api' | 'web' {
1647 let endpoints = 0;
1648 let pages = 0;
1649 for (const r of routes) {
1650 if (splitRouteName(r.name).method !== null) endpoints++;
1651 else if (r.name.startsWith('/')) {
1652 pages++;
1653 // A Next page is a web page whatever else the index holds.
1654 if (nextRouteForFile(r.filePath)?.kind === 'page') return 'web';
1655 }
1656 }
1657 if (endpoints === 0) return 'app';
1658 return navigates > 0 || pages > 0 ? 'web' : 'api';
1659}
1660
1661function basename(p: string): string {
1662 const s = posix(p);

Callers 2

buildStepsFunction · 0.85

Calls 2

splitRouteNameFunction · 0.90
nextRouteForFileFunction · 0.90

Tested by

no test coverage detected