Skip to content

refactor(cli): fold gateway into call, drop the local-command machinery - #16

Merged
Miyamura80 merged 10 commits into
mainfrom
claude/call-gateway
Aug 29, 2026
Merged

Miyamura80 merged 10 commits into
mainfrom
claude/call-gateway

Conversation

@Miyamura80

@Miyamura80 Miyamura80 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Collapses sealg to its intended thin shape: a client to the SealGate gateway, nothing more. sealg call <tool> now is the gateway tools/call (previously it ran a local demo-command registry, and the gateway call lived under a separate gw-call). Connection overrides like pointing at a local instance are a flag, not a subcommand. All the Rust-CLI template's onboarding/scaffolding/stub machinery is deleted.

Final command surface: doctor | list | call.

Changes

  • call is the gateway call: sealg call <tool> [--args '<json>'] [--gateway-url <url>] → MCP tools/call. Pretty-prints the result; exits 6 on an MCP isError: true result, 1 on transport failure. gw-call removed.
  • --gateway-url: overrides the gateway base URL (default $SEALGATE_URL, else localhost) for local/other instances. Implemented as GatewayConfig::from_env_with_url_override (trims trailing /, ignores blank and degenerate all-slash values; unit-tested). No other flags — API key / secret stay env-only.
  • list gains the same --gateway-url (keeps --json).
  • Deleted the local-command machinery (dead once call is the gateway): the engine::commands module (Command/Expose/CommandRegistry + all six demo commands), scenario.rs + scenario types, probes.rs, context.rs/traits.rs/platform.rs, and the scaffold/new command. The probe and run-scenario subcommands go with them.
  • Deleted init (the template "onboard this project" wizard) and its module, plus 7 dependencies only it used.
  • Deleted the mcp stub subcommand (inherited template scaffolding that only printed a not-implemented notice). The MCP protocol client in engine::gateway is untouched — that's how list/call talk to the gateway.
  • Kept: doctor (local env facts).
  • Docs: root/cli/engine READMEs, CLAUDE.md, and the Makefile updated to match; the architecture diagram regenerated with aligned boxes.

Net across the branch: roughly −4800 lines — almost entirely deletion of template scaffolding.

Testing

  • cargo build --workspace — clean
  • cargo clippy --workspace --all-targets -- -D warnings — 0 warnings
  • cargo test --workspace — 0 failed (gateway tests + url_override tests included)
  • cargo fmt --all --check — clean
  • cargo build --release -p sealg; sealg --help lists exactly doctor, list, call; sealg call --help shows <tool> [--args] [--gateway-url]

The gateway transport itself was verified end-to-end against a live local gateway in #15; this PR only changes how it's surfaced and deletes dead code.

Related Issues

Follow-up to #15. Tracked by the multi-interface design doc in edison-watch/edison-watch.

Notes / out of scope

  • A couple of engine Cargo.toml deps (e.g. inventory, schemars) are now unused; not a build/clippy/deny failure, left for a separate dependency trim.
  • HUMANS_SHOULD_TEST.md and the .claude/skills/{update-backend,onboarding} docs still describe parts of the old template workflow (a serve HTTP API); rewriting those fully is separate, larger work.

claude added 3 commits August 28, 2026 15:48
`sealg` is a thin MCP client to the gateway, so `call` now hits the gateway
`tools/call` (replacing the old local demo-command registry) and `gw-call` is
gone. Command surface is now: init, mcp (stub), doctor, list, call.

- `call <tool> [--args] [--gateway-url]` → gateway tools/call (pretty-prints
  the MCP result, exits 6 on isError, 1 on transport error).
- `list [--gateway-url]` → gateway tools/list (keeps --json).
- `--gateway-url` overrides the gateway origin over `GatewayConfig::from_env()`
  via new `from_env_with_url_override` (trims a trailing `/`, ignores blank).
- Remove the local-command machinery entirely: `engine::commands` (Command/
  Expose/CommandRegistry + all demo commands), `scenario`, `probes`, and the
  now-dead `context`/`traits`/`platform` (doctor needs none of them). `doctor`
  keeps working on env facts; the `gateway` module and its tests are untouched.
- Drop the `new` scaffold command + template, and the `probe`/`run-scenario`
  subcommands and their diagnostics handlers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y
Update the root/cli/engine READMEs, CLAUDE.md, and the Makefile to describe the
thin MCP-client model (list/call/doctor/init) and drop references to the removed
local `call`, `gw-call`, `probe`, `run-scenario`, and `new` subcommands. Removes
the now-dead `make new` target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y
The mcp subcommand stub referenced the deleted local command registry,
`sealg serve`, and `new`. Reword it as a placeholder for a future local
stdio MCP transport that bridges an MCP client to the gateway.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 27 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread README.md Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 27 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="README.md">

<violation number="1" location="README.md:51">
P3: The rewritten architecture diagram is misaligned: the first box's content lines (e.g. `sealg list ...`) are one character narrower than the box's own border, and the vertical connectors (`engine::gateway`, `HTTPS`) sit one column right of the `┬`/`▼` glyphs they join, with the two boxes having different widths. Rendered in markdown the diagram looks broken. Pad each content line of the first box by one space so its right `│` lines up with the border's `┐`/`┘`, and shift the `│` connectors left by one column so they line up under the `┬` glyphs.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread README.md Outdated
claude added 2 commits August 28, 2026 16:00
`sealg init` was Rust-CLI-template machinery for onboarding the template
into a real project - no place in the shipped gateway client. Remove it so
the command surface is exactly mcp | doctor | list | call.

- Drop the `Init` variant, dispatch arm, and `mod init;` from main.rs;
  update the crate doc comment.
- Delete the entire crates/cli/src/init/ module.
- Remove now-unreferenced deps from crates/cli/Cargo.toml: dialoguer,
  walkdir, toml_edit, comfy-table, serde_yaml, anyhow, and the tempfile
  dev-dependency (all were used only by init).
- Update README.md, crates/cli/README.md, and the Makefile to match the
  mcp | doctor | list | call surface (drop the `init` make target).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y
Regenerate the ASCII diagram with uniform box widths and the vertical
connectors aligned under the ┬/▼ glyphs (cubic review on #16).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/cli/src/main.rs">

<violation number="1" location="crates/cli/src/main.rs:33">
P1: The new command enum drops `Init`, so `sealg init` now fails as an unknown subcommand even though this PR promises to retain it. Restore the init module and variant, or update the CLI contract and documentation consistently.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread crates/cli/src/main.rs Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 36 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/engine/src/gateway/config.rs">

<violation number="1" location="crates/engine/src/gateway/config.rs:73">
P3: An override that trims down to an empty string silently produces an empty `base_url`. `u.trim()` on `/`, `///`, or `/?x` is non-empty, and `trim_end_matches('/')` then yields `""`, so `cfg.base_url` becomes empty and `mcp_url()` becomes `/mcp/` instead of falling back to the env/default. Guard the trimmed value with a non-empty check before assigning, so a degenerate override is ignored like a blank one.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread crates/engine/src/gateway/config.rs Outdated
claude added 4 commits August 28, 2026 16:10
An override like `/` or `///` passed the non-blank guard but
trim_end_matches('/') then yielded "", leaving base_url empty and mcp_url()
= /mcp/. Trim first, then check non-empty, so a degenerate override is
ignored like a blank one. Added a test.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y
Drop the inherited-template `sealg mcp` stub (it did nothing but print a
not-implemented notice). The command surface is now `doctor | list | call`.
Removes crates/cli/src/mcp.rs, the Mcp variant + dispatch, and the doc
references (READMEs, architecture diagram, HUMANS_SHOULD_TEST). MCP-protocol
code in the gateway client is untouched.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y
Remove two isolated template scaffolding crates that were unused:
- crates/assetgen (asset-gen banner/logo generator)
- crates/config (app-config crate)

After deletion, workspace contains exactly two members:
- crates/engine (gateway client + config, doctor env facts, stable result contract)
- crates/cli (sealg binary with doctor/list/call surface)

Updated:
- Cargo.toml: removed both crates from [workspace] members
- Makefile: removed banner/logo targets and updated bump-version
- README.md: removed Config row from features table, removed config/assetgen
  architecture bullets, removed entire Configuration section
- CLAUDE.md: removed crates/config reference from Architecture section,
  removed Configuration Pattern section

Verified:
- cargo build --workspace passes
- cargo clippy --workspace --all-targets -- -D warnings passes
- cargo test --workspace passes (12 tests)
- cargo fmt --all passes
- sealg release binary unchanged: still lists doctor, list, call commands
The crate-removal commit deleted CLAUDE.md's Configuration Pattern section
(it documented the removed app-config crate), which the agents_validate CI
check requires. Replace it with an accurate section describing sealg's real
config: env-resolved GatewayConfig (SEALGATE_* vars, CENTAUR_THREAD_KEY,
CA bundle, --gateway-url). Re-synced AGENTS.md via make sync-agent-config.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpwFmgQPfugKFF9zugay6Y
@Miyamura80
Miyamura80 merged commit e1c9511 into main Aug 29, 2026
11 checks passed
@github-actions
github-actions Bot deleted the claude/call-gateway branch August 29, 2026 11:00
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.

2 participants