Repository navigation
feat(cli): add powercontext scope command group - #2093
happy-v587 wants to merge 9 commits into
Conversation
# Conflicts: # src/powercontext/client/cli.py
|
Two failing checks are not introduced by this PR (which only touches
|
Flaky evidence in oceanbase#2093 comments: tests/e2e/test_topic_memory_qwen_settings.py[inferred] fails only on the CI runner with _WorkerTerminationError, passes 3/3 locally; validate is tracked as a broken master baseline in oceanbase#2098.
hidb4ai
left a comment
There was a problem hiding this comment.
Two Scope CLI correctness issues remain: metadata updates discard existing relationships, and Codex workspace resolution can select the default Scope despite an existing binding.
Which issue or RFC does this PR close?
Closes #2092
Rationale for this change
Scope creation and binding currently exist only as HTTP operations and wizard-printed
curlsteps. Users cannot quickly mint the opaquescp_*Scope ID that clientSCOPE_IDenvironment variables require, and when that setting references a missing Scope the agent plugins surface a misleadingversion_mismatchdiagnostic. A first-classpowercontext scopecommand group closes both gaps: it wraps the existing Scope contract one command per operation, without inventing behavior.What changes are included in this PR?
powercontext scopegroup in the Server-backed CLI (src/powercontext/client/cli.py):scope create(prints the returned opaque Scope ID and a next-step hint;--idempotency-keydefaults to a generated value so reruns stay idempotent)scope list,scope get,scope update(--expected-versionis required, matching the contract's optimistic lock)scope default/scope set-defaultscope resolvemirrors the agent plugins' resolution order: explicit ID → session binding key → workspace binding key → default;--no-allow-defaultreproduces the strict plugin behaviorscope binding set/scope binding cleartests/test_cli_scope.pycovering request construction, output, malformed external-reference rejection, and the binding key derivation.scope deletebecause the contract has no such operation.Are there any user-facing changes?
New user-facing CLI commands (
powercontext scope ...). No breaking changes to existing commands or public Python APIs; documentation for the new group can follow in a separate docs PR.How was this change tested?
.venv/bin/python -m pytest tests/test_cli_scope.py tests/test_cli.py→ 69 passeduv run prek run -a(ruff check, ruff format, ty check) → all passedpowercontext scope listandpowercontext scope resolve --scope-id <id>returned expected Scope descriptors.AI usage statement
Built with opencode (Claude Code CLI harness) powered by GLM (Z.ai) as the coding agent; the assistant implemented the command group and tests under human direction, with human review of the design decisions.