yoi/.yoi/tickets/00001KVJKHAFE/thread.md

332 lines
17 KiB
Markdown

<!-- event: create author: "yoi ticket" at: 2026-06-20T13:29:16Z -->
## 作成
LocalTicketBackend によって作成されました。
---
<!-- event: intake_summary author: hare at: 2026-06-20T13:30:16Z -->
## Intake summary
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: "yoi ticket" at: 2026-06-20T13:30:16Z from: planning to: ready reason: cli_state field: state -->
## State changed
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: workspace-panel at: 2026-06-20T13:31:00Z from: ready to: queued reason: queued field: state -->
## State changed
Ticket を `workspace-panel` が queued にしました。
---
<!-- event: decision author: yoi-orchestrator at: 2026-06-20T13:31:52Z -->
## Decision
Routing decision: implementation_ready_parallel
Reason:
- Workspace Dashboard Queue により、この Ticket は Orchestrator routing 対象として明示許可された。
- User standing directive: blocker が無いものは並列実行する。現在 `00001KVJHYP4Q` Plugin instance lifecycle Coder が inprogress だが、この Ticket は MCP CLI inspection namespaceであり直接 dependency/conflict はない。Potential shared CLI parser edits are manageable in separate worktree and will be resolved at merge/review boundary。
- Ticket body は `yoi mcp` namespace、list/show/tools/resources/prompts commands、human/JSON output、workspace/profile resolution、read-only inspection boundary、static-vs-live availability、secret/content redaction、acceptance testsを実装可能な粒度で定義している。
- 未解決 blocker relation はない。Relations are `related` context to completed MCP foundation Tickets。
- Orchestrator worktree は clean、matching branch/worktree はなし。
- Risk domain は CLI / MCP / inspection / secrets / read-only boundary だが、Ticket は no server process start、no tool execution、no resources/prompts content fetch、secrets/content non-printing、bounded outputを明示している。bounded context check 後も implementation 前に必要な追加 human decision は見つからなかった。
Evidence checked:
- Ticket `00001KVJKHAFE` body / thread / relations / artifacts。
- `TicketRelationQuery(00001KVJKHAFE)`: only non-blocking `related` records to completed MCP config/lifecycle/tools/resources/list_changed Tickets。
- `TicketOrchestrationPlanQuery(00001KVJKHAFE)`: no previous plan records; accepted plan recorded now。
- Workspace state:
- Orchestrator worktree clean at `142fdffb`
- queued: this Ticket only。
- inprogress: `00001KVJHYP4Q` Plugin instance lifecycle。
- visible spawned child: `yoi-coder-00001KVJHYP4Q` running。
- no matching MCP CLI branch/worktree。
IntentPacket:
Intent:
- Add read-only `yoi mcp` CLI inspection namespace for configured/resolved MCP servers and provider-discovered tools/resources/prompts eligibility。
- Provide bounded human-readable and JSON reports without bypassing runtime Tool/resource/prompt paths。
Binding decisions / invariants:
- CLI inspection must not start MCP server processes。
- CLI inspection must not call MCP tools or fetch resource/prompt content。
- Static config/resolution and live Pod state must be distinguished explicitly。
- If live state is unavailable/unimplemented, output must say `not live` / `unavailable`, not silently stale。
- Secrets, resolved secret/env values, resource contents, and prompt full text must not be printed in human or JSON output。
- External server descriptions/schemas/annotations are untrusted and bounded/truncated。
- Keep MCP separate from Plugin CLI namespace。
- No Streamable HTTP/OAuth/sampling/elicitation/install/update/distribution implementation。
Requirements / acceptance criteria:
- `yoi --help` shows MCP CLI namespace。
- `yoi mcp list --json` returns resolved MCP server bounded structured report。
- `yoi mcp show <server> --json` returns server identity, transport kind, trust policy summary, capabilities summary, diagnostics。
- `yoi mcp tools [<server>] --json` returns Yoi stable tool name, MCP server/tool identity, schema availability, registration status/diagnostics。
- `yoi mcp resources [<server>] --json` and `yoi mcp prompts [<server>] --json` return summaries/eligibility without content fetch。
- Human-readable output distinguishes empty/missing/invalid/unavailable。
- Focused CLI tests cover list/show/tools/resources/prompts, missing server, invalid config, JSON output, and secret/content non-leakage。
- Validation includes fmt, focused tests, check, diff, TicketDoctor, Nix build。
Next action:
- Record `queued -> inprogress` and commit Ticket records before creating implementation worktree and spawning Coder。
---
<!-- event: state_changed author: yoi-orchestrator at: 2026-06-20T13:32:15Z from: queued to: inprogress reason: orchestrator_acceptance_parallel_mcp_cli_inspection field: state -->
## State changed
Ticket body/thread, relation metadata, Orchestrator worktree state, visible Pods, existing branch/worktree, and bounded MCP CLI inspection context were checked. There is no unresolved blocking dependency, no direct conflict with current Plugin instance lifecycle work, no matching worktree/branch, and no missing planning decision. Accepting this queued Ticket for parallel implementation before worktree/Pod side effects.
---
<!-- event: implementation_report author: yoi-orchestrator at: 2026-06-20T13:33:06Z -->
## Implementation report
Implementation orchestration start:
- Acceptance records were committed on Orchestrator branch: `12d7e69f ticket: accept mcp cli inspection`
- Created implementation worktree `/home/hare/Projects/yoi/.worktree/00001KVJKHAFE-mcp-cli-inspection` on branch `impl/00001KVJKHAFE-mcp-cli-inspection` at `12d7e69f`
- Spawned Coder Pod `yoi-coder-00001KVJKHAFE` with write scope limited to the implementation worktree and read-only root scope only for runtime workspace identity。
- Coder task explicitly forbids root/original workspace implementation, MCP server process startup, tools/call/resource/prompt content fetch, Plugin CLI namespace mixing, merge, Ticket close, and cleanup。
Next action:
- Wait for Coder implementation report, then inspect branch diff/validation evidence and route to Reviewer。
---
<!-- event: implementation_report author: yoi-orchestrator at: 2026-06-20T13:48:38Z -->
## Implementation report
Coder implementation report received from `yoi-coder-00001KVJKHAFE`.
Implementation commit:
- `c91f5fc9 mcp: add cli inspection`
Changed areas reported:
- Added `crates/yoi/src/mcp_cli.rs`:
- Read-only `yoi mcp` inspection reports。
- Commands: `list`, `show`, `tools`, `resources`, `prompts`
- Human and `--json` output。
- Static resolved config inspection only; no MCP server processes are started。
- Live/provider-discovered state is explicitly reported as `not_live` / `unavailable`
- Env values, secret refs, env refs, args, resource content, and prompt content are redacted/omitted。
- Resource/prompt operation eligibility is reported without content fetch。
- Updated `crates/yoi/src/main.rs`:
- Added `mcp` namespace to parser, dispatcher, help output, and parser tests。
Coder validation reported:
- `cargo test -p yoi mcp`: passed。
- `cargo check -p yoi`: passed。
- `cargo fmt --check`: passed。
- `git diff --check`: passed。
- `cargo run -p yoi -- --help | grep -E 'yoi mcp (list|show|tools)'`: passed; help shows MCP namespace。
- `yoi ticket doctor`: passed。
Package impact:
- No dependency, lockfile, source-filter, or `package.nix` changes。
- Nix not run because packaging inputs were not changed。
Known risks / deferrals:
- Live Pod MCP state is not integrated; provider-discovered tools/resources/prompts are therefore reported as `not_live` / `unavailable` rather than stale or fabricated。
- `tools` cannot list Yoi stable provider tool names without live discovery; JSON schema includes future item shape, but item list is empty in static mode。
- Touched `crates/yoi/src/main.rs` CLI parser/help, so there is possible narrow conflict risk with parallel Plugin Service/Ingress work. No Plugin Service/Ingress files were touched。
Orchestrator evidence checked before review dispatch:
- Implementation worktree is clean。
- HEAD is `c91f5fc9`
- Diff from acceptance `12d7e69f..HEAD` is one implementation commit touching 2 files, about 1438 insertions / 1 deletion。
- `git diff --check 12d7e69f..HEAD` produced no diagnostics。
Next action:
- Dispatch Reviewer for r1 review against Ticket requirements, with focus on read-only inspection boundary, no process start/no tools-call/no resource-prompt content fetch, static vs live unavailable honesty, redaction, JSON/human shape, help/tests, and conflict risk。
---
<!-- event: plan author: yoi-orchestrator at: 2026-06-20T13:49:28Z -->
## Plan
Review dispatch:
- Spawned Reviewer Pod `yoi-reviewer-00001KVJKHAFE-r1` against implementation branch `impl/00001KVJKHAFE-mcp-cli-inspection`
- Review target commit: `c91f5fc9 mcp: add cli inspection`
- Review baseline: `12d7e69f`
- Reviewer task focuses on read-only inspection boundary, no process start/no tools-call/no resource/prompt content fetch, static vs live unavailable honesty, secret/content redaction, JSON/human report shape, namespace separation from Plugin CLI, help/tests, scope creep absence, and parallel CLI merge conflict risk。
- Reviewer is instructed not to edit source, commit, merge, close the Ticket, or use TicketReview directly; it will report verdict/evidence back to Orchestrator。
---
<!-- event: review author: yoi-reviewer-00001KVJKHAFE-r1 at: 2026-06-20T13:54:05Z status: approve -->
## Review: approve
Verdict: `approve`
確認範囲:
- Ticket contract / Orchestrator IntentPacket。
- Implementation diff: `12d7e69f..c91f5fc9`
- 主な対象:
- `crates/yoi/src/mcp_cli.rs`
- `crates/yoi/src/main.rs`
- MCP CLI path の process spawn / MCP client / tool-call / resource-read / prompt-get behavior を検索。
- `crates/yoi/src/main.rs` の merge conflict risk も確認。
Blocking issues: none。
Approval evidence:
- MCP CLI は static/read-only に留まっている。
- `mcp_cli.rs` は manifest/profile config types を使い、MCP runtime/client path を import していない。
- `inspect_static_config` は Profile/config を resolve して static-only diagnostics を report し、stdio lifecycle/client API を呼ばない。
- CLI implementation から `std::process::Command`, `Command::new`, `spawn`, MCP lifecycle/client calls, ToolRegistry calls, `tools/call` path は見つからない。
- Resource/prompt content fetch はない。
- `resources/read` / `prompts/get` は operation label / stable name としてだけ出ており、`registration_status: "not_live"`, `content_state: "not_fetched"` を返す。
- Static vs live state is explicit。
- JSON includes `inspection_mode` booleans: `starts_servers: false`, `calls_tools: false`, `fetches_resource_or_prompt_content: false`
- Reports include `live_state.status = "not_live"`; human output says `live: not live / unavailable`
- Secrets/args are redacted。
- stdio args are summarized as `arg_count` plus `args_redacted: true`
- env config is summarized by counts/kinds with `values_redacted: true`; env literal values, secret refs, and env refs are not emitted。
- Tests cover non-leakage for arg secret, literal env value, secret ref, and env ref。
- MCP namespace remains separate。
- `main.rs` adds distinct top-level `mcp` parser/dispatcher path; Plugin CLI is not mixed beyond adjacency in top-level help/parsing。
- Top-level `yoi --help` shows MCP namespace and commands。
Non-blocking concerns / follow-ups:
- Implementation is intentionally static-only. It does not surface real live provider-discovered tools/resources/prompts or live `notifications/*/list_changed` restart/reinitialize diagnostics. It clearly reports unavailable/not live, which matches this implementation boundary; future live-state inspection can extend it。
- `yoi mcp --help` / subcommand help may flow through `ParseError` and error exit rather than normal help exit. Top-level `yoi --help` satisfies the stated acceptance criterion, so this is not blocking。
Reviewer validation:
- `cargo fmt --check`: passed。
- `git diff --check 12d7e69f..HEAD`: passed。
- `cargo test -p yoi mcp`: passed, 8 tests。
- `cargo check -p yoi`: passed。
- `cargo run -p yoi -- --help`: passed; output includes `yoi mcp list`, `show`, and `tools|resources|prompts`
- `cargo run -p yoi -- ticket doctor`: passed, `doctor: ok`
- Conflict-risk check: `main.rs` merge risk low; trivial merge check produced no conflict markers。
- `nix build .#yoi --no-link` not run because no package/source-filter concern was found。
Worktree status at review end: source tree clean; ignored `target/` only。
---
<!-- event: implementation_report author: yoi-orchestrator at: 2026-06-20T13:56:02Z -->
## Implementation report
Merge and final validation report:
Merged implementation branch into Orchestrator branch:
- Merge commit: `5e0b023a merge: mcp cli inspection`
- Implementation commit included:
- `c91f5fc9 mcp: add cli inspection`
Reviewer outcome:
- r1 approved with no blocking issues。
- Reviewer confirmed CLI inspection is static/read-only, does not start MCP server processes, does not call tools/resources/prompts, distinguishes static vs live unavailable state, redacts/omits secrets/env/args/content, keeps MCP namespace separate from Plugin CLI, and has focused tests。
Orchestrator validation after merge passed:
- `cargo fmt --check`
- `git diff --check HEAD^1..HEAD`
- `cargo test -p yoi mcp`
- `cargo check -p yoi`
- `cargo run -q -p yoi -- --help` with targeted grep for MCP commands。
- `TicketDoctor`: 0 errors, 4 existing warnings unrelated to this Ticket。
Validation log:
- `/run/user/1000/yoi/yoi-orchestrator/bash-output/bash-xrqves.log`
Nix validation:
- Not run because this Ticket changed only Rust source under `crates/yoi` and no dependency/package/source-filter files changed。
Final state:
- Orchestrator worktree clean at `5e0b023a` after validation。
- Implementation worktree remains available for cleanup after Ticket completion records are committed。
- Plugin instance lifecycle Coder continues in parallel。
---
<!-- event: state_changed author: yoi-orchestrator at: 2026-06-20T13:56:11Z from: inprogress to: done reason: merged_reviewed_validated field: state -->
## State changed
Implementation was merged into Orchestrator branch at `5e0b023a`, review approved, and final Orchestrator validation passed: `cargo fmt --check`, `git diff --check HEAD^1..HEAD`, `cargo test -p yoi mcp`, `cargo check -p yoi`, top-level help grep for MCP commands, and `TicketDoctor` with 0 errors.
---
<!-- event: state_changed author: hare at: 2026-06-20T13:56:39Z from: done to: closed reason: closed field: state -->
## State changed
Ticket を closed にしました。
---
<!-- event: close author: hare at: 2026-06-20T13:56:39Z status: closed -->
## 完了
## Resolution
`00001KVJKHAFE` を完了しました。
実装内容:
- `yoi mcp` CLI namespace を追加しました。
- Read-only inspection commands を追加しました。
- `yoi mcp list`
- `yoi mcp show <server>`
- `yoi mcp tools [<server>]`
- `yoi mcp resources [<server>]`
- `yoi mcp prompts [<server>]`
- Human-readable output と `--json` output を追加しました。
- Inspection は static/resolved config のみを扱い、MCP server process を起動しません。
- `tools/call`, `resources/read`, `prompts/get` は実行しません。
- Live/provider-discovered state は `not_live` / `unavailable` と明示します。
- Env values, secret refs, env refs, args, resource content, prompt content は redacted/omitted します。
- Resource/prompt operation eligibility は content fetch なしで報告します。
- MCP namespace は Plugin CLI namespace と分離したままです。
主な commit:
- `c91f5fc9 mcp: add cli inspection`
- `5e0b023a merge: mcp cli inspection`
Review:
- r1 は `approve`
- Reviewer は read-only boundary、no process start、no tools/resource/prompt content fetch、static-vs-live unavailable state、secret/content redaction、MCP namespace separation、help/tests を確認しました。
最終 validation:
- `cargo fmt --check`
- `git diff --check HEAD^1..HEAD`
- `cargo test -p yoi mcp`
- `cargo check -p yoi`
- `cargo run -q -p yoi -- --help` + MCP command grep
- `TicketDoctor`: 0 errors
Known unrelated note:
- `TicketDoctor` は既存 Ticket の warning 4 件を返しましたが、この Ticket の変更とは無関係です。
Nix validation:
- Not run because no dependency/package/source-filter files changed。
Validation log:
- `/run/user/1000/yoi/yoi-orchestrator/bash-output/bash-xrqves.log`
---