Skip to content

refactor(commands): deprecate context command in favor of query (closes #99)#104

Merged
Wolfvin merged 1 commit into
mainfrom
refactor/issue-99-deprecate-context-command
Jun 30, 2026
Merged

refactor(commands): deprecate context command in favor of query (closes #99)#104
Wolfvin merged 1 commit into
mainfrom
refactor/issue-99-deprecate-context-command

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Problem

The context <symbol> command returned a subset of what query <symbol> already provides (code + callers + callees + quality metrics). It added no new information, so it was redundant.

Closes #99.

Approach

context is now a deprecated alias that delegates to query, following the existing deprecation pattern established by scripts/commands/validate.py (which aliases validate -> registry-validate):

  • scripts/commands/context.py now prints a one-line deprecation notice to stderr (stdout stays clean JSON):
    DEPRECATED: codelens context is renamed to codelens query. Use query instead.
  • It then lazily imports commands.query and calls query.execute(args, workspace) with the same args, returning its result unchanged.
  • Args are normalized for query compatibility: context allowed --domain auto (the default), which query does not understand — it is mapped to None (meaning "search both domains"). query.execute reads args.file directly, so a default file=None is set when absent. query already uses getattr-with-defaults for all/limit/fuzzy, so those are safe.
  • The legacy add_args is kept intact so existing scripts that pass --context-lines / --no-code / --domain auto still parse without error (those flags are now accepted but ignored — output comes from query).
  • context is NOT removed; it remains registered with help text DEPRECATED — use \query` instead`.
  • The import of commands.query is done lazily inside execute to avoid module-load-order coupling (the commands/__init__.py auto-imports command modules in sorted order, and context sorts before query).

Verification

  • codelens context cmd_scan prints the deprecation warning to stderr and returns query output (type function, with node/callers/callees) on stdout — confirmed the warning is stderr-only and stdout is clean JSON.
  • Full test suite (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 standalone context implementation with a deprecation wrapper that delegates to query.execute.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud

Copy link
Copy Markdown

@Wolfvin Wolfvin merged commit 7989ab2 into main Jun 30, 2026
2 of 8 checks passed
@Wolfvin Wolfvin deleted the refactor/issue-99-deprecate-context-command branch July 1, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] Deprecate context command — redundant with query

1 participant