Repository navigation
Add headless CLI and stdio MCP entry points (plan-only write gates) - #3
Open
xiaquwan1001 wants to merge 2 commits into
Open
xiaquwan1001 wants to merge 2 commits into
xiaquwan1001 wants to merge 2 commits into
Conversation
The 14 service classes were already Avalonia-free, so the orchestration is reused as-is instead of being copied: - Cli/: command registry, arg parser, exit codes (0/1/2/3/4/5), read-only commands info/doctor/getvar/extract/dump, and gated write commands flash-ota/flash-xml/vcom-unlock/oeminfo/downgrade-enable that print their plan and exit 4 without ever touching a device. - KirinTool.Cli/: thin console project referencing the main project so the command implementations exist only once. - --mcp / mcp subcommand: newline-delimited JSON-RPC 2.0 over stdio with tools/list and tools/call; write tools require confirm:true and still only return the plan. All diagnostics go to stderr so stdout stays protocol-clean. - Program.cs routes --mcp before Avalonia starts, so the MCP server never initializes a GUI.
Add a narrow GitHub Actions workflow that gates the headless CLI + stdio MCP entry points: restore/build Kirin-Tool.csproj and KirinTool.Cli.csproj on .NET 8, run hardware-free smoke tests (--help, version, doctor against a stub fastboot, and an MCP initialize/tools-list session), then upload the CLI build output. Firmware loaders and the bundled fastboot payload are excluded from the artifact; only runtimes/linux-x64 is kept. The upstream release pipeline in build.yml only runs on v* tags, so it cannot gate a branch push.
xiaquwan1001
added a commit
to xiaquwan1001/kirin-tool-linux-refresh
that referenced
this pull request
Nov 10, 2026
把 CLI/MCP(Redminote11tech#3 的内容)与 Full OTA 真实写入路径(feat/ota-flash)合并进 fork 主线;上游 PR #2/Redminote11tech#3 的分支保持不动,等上游评审。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1. Depends on nothing in #2 — the two branches are independent and can be merged in either order.
Why
The useful capability in this project is not the window:
VcomFlasher,FastbootClient,FastbootFlasherService,OemInfoService,PartitionExtractor,Utils/UpdateApp,Utils/SuperMerger,Utils/ProcessRunnerare already free of Avalonia. Reaching them currently requires a desktop session and a human clicking buttons, which makes scripted or agent-driven use impossible and makes diagnostics manual.What
Cli/(compiled into the main assembly):0ok /1usage /2no device /3device refused /4gated /5file or environment;info,doctor,getvar <name>,extract <UPDATE.APP> [outdir],dump <partition> -o <dir>;flash-ota,flash-xml,vcom-unlock,oeminfo,downgrade-enableimplemented as plan-only gates: they print/return the exact partition list, sizes and image paths and exit4. With--yesthe status becomesconfirmed-but-write-path-not-implementedand it still exits4— this build cannot write to a device;--jsonon every command, diagnostics on stderr.--mcp/mcp(also on the main executable, routed before Avalonia starts):initialize,notifications/initialized,ping,tools/list,tools/call;confirm: trueand still only return the plan;exit 4is reported as a normal result (isError: false) because a gate is not a failure;KirinTool.Cli/is a thin console project referencing the main project, so command implementations exist once.Program.csroutes--mcp/mcpbeforeStartWithClassicDesktopLifetime, so the MCP server never initializes a GUI.Kirin-Tool.csprojgains fourRemove="KirinTool.Cli/**"entries to stop the root glob from compiling the sub-project's generatedAssemblyInfo.cstwice (CS0579).Verification
Same warning count as the
mainbaseline.tools/listandtools/callwere exercised through a piped stdin session (initialize→notifications/initialized→tools/list→ fourtools/callrequests:extractexit 0,flash_otawithoutconfirmexit 4 with a plan,getvaragainst a refusing device exit 3, unknown tool exit 1), withjqparsing each stdout line to confirm the frames are valid and that stderr stays separate.Deliberate limits
Content-Lengthframing, batching, SSE/HTTP transport, auth, ortools/listpagination;Services/USBUpdate/*(bareActionprogress) andDialogService→IUserInteractionare not extracted yet, so the USB Update path has no CLI equivalent;vcom-unlockcurrently only builds a static plan; the interactive cable-swap step andObservableCollection<ProgressItemViewModel>progress model are untouched;-s/--deviceselection yet.Happy to restructure into a separate assembly, drop the MCP half, or extend the gate to a real write path behind an explicit flag — whichever direction you prefer.