Classifier: match markers on token/basename boundaries, tighten ProjectNamer - #3
Open
AadhilFarhan wants to merge 1 commit into
Open
Classifier: match markers on token/basename boundaries, tighten ProjectNamer#3AadhilFarhan wants to merge 1 commit into
AadhilFarhan wants to merge 1 commit into
Conversation
…ctNamer
framework() checked whether a marker like "rails" or "webpack" was a
substring anywhere in the full lowercased args string, including the
executable's whole path. A project directory that happens to contain
the marker's text (~/my-rails-experiments, ~/webpack-notes) got
misclassified as that framework even when run through an unrelated
runtime. Single-word markers now must match a whole token or a
token's path basename; multi-word markers ("next dev", "manage.py
runserver") keep the substring check, since they're specific enough
phrases that a false positive is unlikely.
ProjectNamer.projectName also had a third, undocumented fallback:
any cwd under the user's home directory returned the folder name as
a "project" even with zero manifest or project files present.
CLAUDE.md already documented the narrower, manifest-gated behavior —
removed the fallback so the code matches what was already written
there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two related classification-accuracy bugs, both in
Classifier.swift:framework()false positives from substring matching. Single-word markers (rails,webpack,vite, ...) were matched with a raw.containsagainst the entire lowercased args string — full executable path plus all CLI args. A project directory that happens to contain the marker's text (~/my-rails-experiments,~/webpack-notes) got misclassified as that framework even when run through an unrelated interpreter. Multi-word markers ("next dev","manage.py runserver") keep the substring check since they're specific consecutive phrases with low false-positive risk. Single-word markers now must match a whole token or a token's path basename.ProjectNamer.projectName's undocumented broad fallback. Beyond the two documented cases (package.json name, or folder name when a manifest/project file exists), the code had a third: any cwd under the user's home directory returned its folder name as a "project," even with zero manifest files present.CLAUDE.mdalready documented only the narrower, manifest-gated behavior — this brings the code back in line with what was already written there rather than changing the docs to match the looser code.Test plan
testDoesNotMatchMarkerAsSubstringOfUnrelatedPathandtestFolderUnderHomeWithoutManifestIsNotAProject..rails/.webpack/a leaked folder name), then confirmed they pass with the fix.