refactor(commands): deprecate context command in favor of query (closes #99)#104
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
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.



Problem
The
context <symbol>command returned a subset of whatquery <symbol>already provides (code + callers + callees + quality metrics). It added no new information, so it was redundant.Closes #99.
Approach
contextis now a deprecated alias that delegates toquery, following the existing deprecation pattern established byscripts/commands/validate.py(which aliasesvalidate->registry-validate):scripts/commands/context.pynow prints a one-line deprecation notice to stderr (stdout stays clean JSON):DEPRECATED: codelens context is renamed to codelens query. Use query instead.commands.queryand callsquery.execute(args, workspace)with the same args, returning its result unchanged.contextallowed--domain auto(the default), whichquerydoes not understand — it is mapped toNone(meaning "search both domains").query.executereadsargs.filedirectly, so a defaultfile=Noneis set when absent.queryalready usesgetattr-with-defaults forall/limit/fuzzy, so those are safe.add_argsis kept intact so existing scripts that pass--context-lines/--no-code/--domain autostill parse without error (those flags are now accepted but ignored — output comes fromquery).contextis NOT removed; it remains registered with help textDEPRECATED — use \query` instead`.commands.queryis done lazily insideexecuteto avoid module-load-order coupling (thecommands/__init__.pyauto-imports command modules in sorted order, andcontextsorts beforequery).Verification
codelens context cmd_scanprints the deprecation warning to stderr and returnsqueryoutput (typefunction, withnode/callers/callees) on stdout — confirmed the warning is stderr-only and stdout is clean JSON.PYTHONUTF8=1 python -m pytest tests/ --ignore=tests/test_integration.py): 788 passed, 87 skipped — identical to baseline, no regression.Files Changed
scripts/commands/context.py— replaced the standalonecontextimplementation with a deprecation wrapper that delegates toquery.execute.