Semantic code search. Use alongside grep - grep for exact strings, osgrep for concepts.
Detected risks:
osgrep is a semantic code search tool designed to help developers find code based on concepts rather than exact string matches. Unlike traditional grep or ripgrep, which search for specific text, osgrep enables developers to search for broader concepts, allowing them to locate code related to a particular idea or functionality. For example, instead of searching for exact strings like 'validate user permissions', osgrep can be used to search for the general concept of 'user permissions validation'. This is particularly useful in large codebases where the precise terminology may vary but the overall function remains the same. By enabling searches based on meaning, osgrep helps developers quickly understand how different parts of the codebase relate to each other and makes it easier to trace program logic and architecture.
You can use osgrep by running a command like 'osgrep "where do we validate user permissions"'. This will return code snippets that are conceptually related to the search query, even if the exact phrase doesn't appear in the code.
osgrep works with code that can be processed by a Bash environment. It's not limited to any specific language, but its efficiency depends on the language and the available tooling in your environment.
osgrep ranks its search results based on relevance, with a score indicating the degree of relevance (1 being the best match). This helps you prioritize the most relevant code snippets.
While osgrep provides snippets of relevant code, it also suggests specific line ranges (e.g., 'Read src/auth/handler.ts:45-120') that you can read for a more complete understanding of the context.
If you see 'Indexing' or 'Syncing' during a search, it means the index is still being built. You can wait for it to finish or continue with partial results.
Quick Setup:
.claude/skills/Repository
Ryandonofrio3/osgrep