feat(for): add surf for <path> reverse lookup (#31)#33
Merged
Conversation
Closes #31. `hubs/` give documentation a standard home, but nothing answered the inverse of authoring: "I'm about to edit this file — which hubs/claims describe it?" `suggest` only finds *un*anchored functions; `check`/`lint` don't expose a per-path view. So the discoverability half of the thesis wasn't delivered by the tooling. - New `surf for <path> [symbol] [--format human|json]`. Lists every hub + claim anchored into the path, optionally narrowed to a first-segment symbol. - Reuses the existing hub/anchor machinery and matches on the anchored path only — no source parse, no model, no network. A query, not a gate: exits 0. - JSON emits a versioned `{version, path, matches}` envelope for agents. - Path is normalized to workspace-root-relative (strips `./`, relativizes an absolute path under the root). Out of scope (per #31): git-moved-path resolution and blast-radius/call-graph analysis. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d9017f0 to
e0045d1
Compare
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.
Summary
Surface's pitch is that
hubs/give documentation a standard home people and agents actually find — but there was no command for the inverse of authoring: "I'm about to edit this file, which claims govern it?"suggestonly finds unanchored functions;check/lintdon't expose a per-path view. This delivers that discoverability half of the thesis.Changes
surf for <path> [symbol] [--format human|json]— lists every hub + claim anchored into<path>, optionally narrowed to anchors whose first segment matchessymbol.--format jsonemits a versioned{version, path, matches}envelope for agents../, relativizes an absolute path under the root).Out of scope (per #31): git-moved-path resolution and blast-radius / call-graph analysis (those drift and would break the no-model/no-network core).
Verification
surf for surf-cli/src/check.rslists both its claims; narrowing to a symbol returns one; a path with no anchors reports empty and exits 0; JSON envelope verified.hubs/cli-for.mddocumenting the new command;surf lintandsurf checkstay green (the CLI command-list hub was updated to includefor).Closes #31.
🤖 Generated with Claude Code