feat: scope archetype file-tree signals to path context - #30
Conversation
Prevent false positives from basename-only matching (e.g. src/api/, seed .sql, email templates, test fixtures) and accept bare YAML tokens in capability applies frontmatter. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (20)
📝 WalkthroughWalkthroughThis PR adds path-context scoping to archetype detection, threads ancestor segments through traversal and classification, relaxes applies token parsing to accept bare YAML tokens, and updates the associated tests and review/verification artifacts. ChangesArchetype path-context scoping and applies parsing relaxation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.dev/features/archetype-path-context/PLAN.md (1)
44-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the new false-negative tradeoff.
The scoping change is described as a precision win, but it also intentionally stops classifying some nonstandard backend layouts (
src/api/, non-approute roots,.sqloutside DB dirs). Please call that out explicitly so reviewers can judge the heuristic with the full tradeoff in view.Suggested wording
+ Note: this intentionally narrows a few nonstandard backend layouts; call out the false-negative tradeoff explicitly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.dev/features/archetype-path-context/PLAN.md around lines 44 - 56, Update the archetype-path-context plan to explicitly mention the false-negative tradeoff introduced by the new scoping rules. In the section that defines Rule 1 through Rule 4, add a brief note that these precision improvements intentionally stop classifying some nonstandard backend layouts such as nested src/api/, route files outside app, and .sql files outside DB-hosting directories. Keep the wording tied to the existing rule definitions in PLAN.md so reviewers can see the heuristic change and its expected misses together.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.dev/features/archetype-path-context/PLAN.md:
- Around line 44-56: Update the archetype-path-context plan to explicitly
mention the false-negative tradeoff introduced by the new scoping rules. In the
section that defines Rule 1 through Rule 4, add a brief note that these
precision improvements intentionally stop classifying some nonstandard backend
layouts such as nested src/api/, route files outside app, and .sql files outside
DB-hosting directories. Keep the wording tied to the existing rule definitions
in PLAN.md so reviewers can see the heuristic change and its expected misses
together.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 215f93b7-f2e3-461b-a3f3-e196727260c8
📒 Files selected for processing (7)
.dev/features/archetype-path-context/GRILL.md.dev/features/archetype-path-context/PLAN.md.pharn/writes-scope.jsonsrc/lib/capability-index.tssrc/lib/detect-archetype.tstests/capability-index.test.tstests/detect-archetype.test.ts
…erage GATE-2 review fix for the archetype-path-context increment: - P3: move the pure file-entry classifier (classifyEntry + SQL_HOST_DIRS / NON_UI_DIRS / TEST_FIXTURE_RE) from the I/O file detect-archetype.ts to the pure-rules file archetype.ts (beside packageSignals); detect-archetype.ts now imports it and owns only the walk + package read (honors the file's stated axis). - P1: add direct classifyEntry unit tests (every branch incl. app/api, route.js/.mjs, a deep DB location) + an app/api integration case. Behaviour-preserving; floor re-verified GREEN (594 vitest tests, verify PASS, regress no-regressions). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…h-context on introduction Human-gated /pharn-dev-memory-promote (accept). Provenance-validated (check-provenance GREEN, id L13 unique); write scope-pinned to lessons-learned.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
classifyEntryfile-tree signals to ancestor path context so basename-only matches no longer misclassify projects (e.g.src/api/client wrappers, rootseed.sql, email templates, test fixtures).appliesfrontmatter ([ssr, backend]parses the same as["ssr","backend"]), with whole-token enum validation preserved.Test plan
npm test— path-context fixtures intests/detect-archetype.test.tsand bare-token parsing intests/capability-index.test.tsMade with Cursor
Summary by CodeRabbit
appliestokens..sqlandmigrations/scoping—top-level.sqlno longer misclassifies as backend.appliesvalues now reliably fail validation instead of being silently ignored.