Skip to content

feat(cli): add setup select for explicit multi-host plugin install - #1311

Open
knqiufan wants to merge 3 commits into
oceanbase:masterfrom
knqiufan:feat/cli-setup-select
Open

feat(cli): add setup select for explicit multi-host plugin install#1311
knqiufan wants to merge 3 commits into
oceanbase:masterfrom
knqiufan:feat/cli-setup-select

Conversation

@knqiufan

@knqiufan knqiufan commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #1301

Rationale for this change

Multi-agent machines still have to run one fail-closed setup <host> command per integration. Concatenating those commands aborts on the first missing CLI. PATH-driven auto-install would also treat “the CLI is present” as “install this plugin,” including Claude prompt capture.

This PR adds an opt-in orchestration command that installs only the first-class hosts the user selects, keeps the existing single-target commands unchanged, and isolates one host failure from the others.

What changes are included in this PR?

  • Add powercontext setup select over a shared first-class catalog: codex, claude-code, dsh, openclaw, pi, and hermes.
  • Reuse the current installers. Do not scan PATH to build or filter the menu. Do not start the Server or launch a host process.
  • Repeatable --host is the scriptable path. A TTY without --host prints the catalog and accepts numbers or names. --json and non-TTY require --host.
  • Preserve host-specific setup defaults: Claude Code uses http://127.0.0.1:8000; OpenClaw uses http://127.0.0.1:8765 and --scope-mode agent. An explicit --server-url overrides the selected Claude Code/OpenClaw hosts, and --scope-mode is forwarded to OpenClaw.
  • Run the existing post-install diagnostics for Codex, DSH, Pi, and Hermes before reporting installed. A verification failure marks only that host as failed and setup continues for the remaining selections.
  • Selected hosts that fail (missing CLI, unbuilt DSH plugin, Claude marketplace conflict, or post-install verification) report failed and continue. Unselected hosts are skipped.
  • Print the additional hermes memory setup / select PowerContext instruction when Hermes is installed successfully.
  • Empty powercontext setup still prints help. setup <host> remains fail-closed. doctor is unchanged; doctor integrations is left for a follow-up PR.
  • Docs: English and Chinese install, troubleshoot, and interfaces pages, including OpenClaw options and per-host next steps.
  • Tests: tests/test_setup_select.py covers selection, isolation, TTY/non-TTY, JSON, flag pass-through, OpenClaw defaults and overrides, post-install verification, Hermes guidance, and the single-target fail-closed regression.

Are there any user-facing changes?

Yes. New optional command:

powercontext setup select --host codex --host dsh
powercontext setup select --host openclaw --scope-mode agent
powercontext setup select --host codex --json

Without --server-url, selected Claude Code and OpenClaw integrations keep their existing default server URLs. No breaking API or storage-format change. Per-host setup commands keep their current behavior.

How was this change tested?

  • python -m pytest tests/test_setup_select.py
  • python -m pytest tests/test_system_cli.py tests/test_dsh_cli.py tests/test_hermes_cli.py tests/test_openclaw_cli.py tests/test_pi_cli.py
  • ruff check on the changed Python files
  • ty check on the project scope
  • uv lock --locked
  • Strict Zensical documentation build

AI usage statement

Used for implementation and review against the issue contract. The design, command surface, and acceptance criteria follow #1301 and the follow-up comment on that issue.

HostSpec("dsh", "DeepSeek Harness"),
HostSpec("pi", "Pi"),
HostSpec("hermes", "Hermes"),
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catalog is already stale against the current master, which now provides powercontext setup openclaw. After merging this PR, setup select --host openclaw still fails with unknown host. Please add OpenClaw while preserving its existing --scope-mode and server URL defaults.

@knqiufan knqiufan Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this. I rebased onto the current master and added OpenClaw to the first-class catalog. setup select now preserves Claude Code's http://127.0.0.1:8000 and OpenClaw's http://127.0.0.1:8765 defaults when no override is supplied, and forwards OpenClaw's --scope-mode default (agent) and explicit overrides. This is included in 5f1e7e6.

except SetupError as error:
rows.append(HostSetupRow(host=host.name, status="failed", error=str(error)))
continue
rows.append(HostSetupRow(host=host.name, status="installed"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup select reports installed as soon as the installer returns, but the existing Codex, DSH, Pi, and Hermes setup commands run post-install diagnostics first. This can exit successfully even when the host does not actually list or load the plugin. Please preserve the per-host verification before marking the row as installed.

@knqiufan knqiufan Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing this out. setup select now runs the existing post-install diagnostics for Codex, DSH, Pi, and Hermes before marking a row as installed. A non-OK diagnostic marks only that host as failed, preserves the diagnostic details, and the remaining selected hosts continue. This is included in 5f1e7e6.

continue
typer.echo(f"{row.host}: {row.status}")
if report.has_installed:
typer.echo("Next: run `powercontext server run`, then start a new host session.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic next step is incomplete for Hermes. Users still need to run hermes memory setup and select PowerContext before starting a new session. Please include this host-specific instruction when Hermes is installed.

@knqiufan knqiufan Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the reminder. The human-readable report now prints the Hermes-specific hermes memory setup / select PowerContext instruction when Hermes is successfully installed. JSON output remains unchanged. This is included in 5f1e7e6.

@knqiufan
knqiufan force-pushed the feat/cli-setup-select branch from 19bf317 to 5f1e7e6 Compare August 24, 2026 07:51
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.

feat: add opt-in setup for all detected local agent CLIs

2 participants