Summary
clawpatch map does not create Next.js route features for projects that use Next's valid src/app layout.
clawpatch init can still detect the project as Next.js, but map only emits package script/config features because the Next mapper searches root-level app/ and pages/ directories.
Repro
- Use a Next.js app with routes under
src/app, and no root-level app/ or pages/ directory.
- Run:
clawpatch init
clawpatch map
- Observe the map result.
Example output from a real repo using clawpatch@0.1.0:
features: 7
new: 0
changed: 0
stale: 0
next: clawpatch review --limit 3
The generated feature files were only package scripts/config, for example:
Package script build
Package script lint
Package script start
Project config package.json
Project config tsconfig.json
No route features were created, despite route files such as:
src/app/(main)/page.tsx
src/app/account/login/page.tsx
src/app/api/auth/[...all]/route.ts
src/app/api/community/solutions/route.ts
Expected behavior
clawpatch map should create route features for src/app/**/(page|route).{ts,tsx,js,jsx} and src/pages/**/*.{ts,tsx,js,jsx}, just as it does for root app/ and pages/ projects.
Likely cause
The current Next mapper walks only root-level route directories:
const files = await walk(root, ["app", "pages"]);
It also derives route source/path handling from app/ and pages/ prefixes only.
Suggested fix
Include src/app and src/pages in the Next mapper, then normalize route paths before route derivation. For example, strip an optional leading src/ before applying the existing app/ / pages/ route conversion.
It would also be useful to add mapper tests covering both layouts:
app/page.tsx
src/app/page.tsx
pages/index.tsx
src/pages/index.tsx
- dynamic routes under both roots
Summary
clawpatch mapdoes not create Next.js route features for projects that use Next's validsrc/applayout.clawpatch initcan still detect the project as Next.js, butmaponly emits package script/config features because the Next mapper searches root-levelapp/andpages/directories.Repro
src/app, and no root-levelapp/orpages/directory.Example output from a real repo using
clawpatch@0.1.0:The generated feature files were only package scripts/config, for example:
Package script buildPackage script lintPackage script startProject config package.jsonProject config tsconfig.jsonNo route features were created, despite route files such as:
Expected behavior
clawpatch mapshould create route features forsrc/app/**/(page|route).{ts,tsx,js,jsx}andsrc/pages/**/*.{ts,tsx,js,jsx}, just as it does for rootapp/andpages/projects.Likely cause
The current Next mapper walks only root-level route directories:
It also derives route source/path handling from
app/andpages/prefixes only.Suggested fix
Include
src/appandsrc/pagesin the Next mapper, then normalize route paths before route derivation. For example, strip an optional leadingsrc/before applying the existingapp//pages/route conversion.It would also be useful to add mapper tests covering both layouts:
app/page.tsxsrc/app/page.tsxpages/index.tsxsrc/pages/index.tsx