
ViewDoctor
io.github.KamnevVladimir由 GitHub 帳號 KamnevVladimir 發布v0.1.7更新於 Oct 24, 2026
Local SwiftUI changed/staged checks with compact agent output and multi-module ownership.
概覽
在本機對變更或已暫存的 SwiftUI 檔案執行檢查,回傳附帶規則 ID、位置與模組歸屬的發現結果。
- 可以做什麼
- ViewDoctor 會掃描 SwiftUI 原始碼中的三類保守風險:在 body 中建構昂貴或可重複使用的物件(VD001)、在 body 中重複進行集合轉換(VD002)、在 body 中建立分離任務(VD003)。它會從 Swift Package Manager、Tuist、Xcode 專案與常見目錄配置中對應模組,讓每筆發現都帶有模組歸屬。輸出可以是終端文字、精簡的 agent JSON、完整帶版本的 JSON 或 SARIF,另有 graph 指令可檢視找到的模組與相依關係。MCP 工具不經 shell 直接呼叫同一個本機 CLI。
- 適用情境
- 適合在人或編碼代理修改 SwiftUI 差異之後使用,以有界線的本機檢查取代把整個儲存庫送給通用模型。適用於 macOS 上的 pre-commit 鉤子、拉取請求檢查與 CI 閘門,並與 Swift 編譯器、SwiftLint、Periphery 和 Instruments 互補,而非取代建置、效能剖析或架構審查。
- 執行需求
- 本機 macOS 環境,原始碼建置需要 Swift 6.2 或更新版本;發行版另提供內含 CLI 與 stdio 轉接器的 macOS MCP Bundle。未宣告任何帳號、API 金鑰、環境變數或標頭,分析過程不需要網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 ViewDoctor,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
ViewDoctor
[ViewDoctor]Check SwiftUI diffs with module ownership attached.
ViewDoctor maps modules from Swift Package Manager, Tuist, Xcode projects, and common source layouts before it scans SwiftUI code. Run it after a human or coding agent changes a diff; the result stays local and can be read as terminal text, compact agent JSON, full versioned JSON, or SARIF.
The review loop
A small generated diff should not require sending the repository back to a general model just to look for three known SwiftUI risks. ViewDoctor gives those checks stable rule IDs, exact locations, module ownership, and bounded output:
edit -> scan changed files -> fix findings -> verify once
- It reads source locally and has no telemetry.
- Manifest-derived identifiers keep findings useful in large repositories.
- Agent JSON keeps the location, module, message, and fix without repeating verbose human context; full JSON keeps explanations for integrations.
- Deterministic ordering and exit codes make the same command useful in CI.
ViewDoctor complements the Swift compiler, SwiftLint, Periphery, and Instruments. It does not replace builds, profiling, or architecture review.
Install and run
Requires Swift 6.2 or newer for source builds.
Analyze only the current git diff—the recommended mode for coding agents:
--git-diff includes tracked changes and new untracked Swift files. A newly
generated view is therefore not skipped just because it has not been added to
Git yet.
Run a strict pre-commit checkpoint against the index only:
Inspect discovered modules and dependencies:
Generate GitHub Code Scanning output:
Discover commands and the installed version without opening the README:
Changed files, pre-commit, and CI
These are separate checkpoints rather than aliases:
Use --fail-on warning when warnings must block a hook or CI job. The default
remains error, so adopting ViewDoctor does not silently turn every warning
into a breaking gate.
Multi-module architecture
ViewDoctor builds a normalized graph from all manifests it discovers:
When providers overlap, the longest matching source root wins. The graph model exposes a reverse dependency-cone operation for integrations and future affected-module rules. The current three source rules still scan only the selected files; they do not pretend to validate unchanged dependents.
Manifest calls are parsed as bounded SwiftSyntax expressions, so one target's
dependencies cannot bleed into the next target. Tuist .project(target:path:)
edges are resolved relative to the manifest or project root, and self-edges are
discarded. viewdoctor graph . also emits diagnostics when a Tuist manifest
imports ProjectDescriptionHelpers: helper-generated targets are executable
Swift and cannot be expanded by a static parser. ViewDoctor reports that limit
instead of presenting a partial graph as complete.
Rules
Rules intentionally use conservative language: a finding is a reviewable risk, not a claim that profiling has proven a performance regression.
The current release has three rules. It does not yet enforce dependency direction, detect cycles, or prove runtime performance. Those are explicit roadmap items rather than implied capabilities.
GitHub Action
Run ViewDoctor in CI on a macOS runner with Swift 6.2 or newer. The action builds the pinned Swift package, scans the checked-out repository, and can upload SARIF findings to GitHub Code Scanning.
Set upload-sarif: false when the workflow cannot grant
security-events: write, such as a restricted fork workflow. Use a full
release tag such as v0.1.7 when you need an immutable dependency; v0 is
the maintained major-version pointer.
Output contract
Full JSON reports include schemaVersion, relative source locations, stable
rule IDs, module IDs, explanations, remediation, and a module graph summary.
--format agent is a smaller JSON contract for the edit/fix loop: it retains
the exact finding and fix but replaces the repeated module list with a count.
Integrations that need every field should consume full JSON or SARIF.
Optional .viewdoctor.json:
minimumSeverity controls which findings are reported. --fail-on controls
only the process exit code, so a CI gate can be stricter without changing the
shared report configuration.
Exit codes:
0: scan completed below the--fail-onthreshold;1: at least one finding met the threshold;2: arguments or scan startup failed.
Coding-agent integration
The repository contains a Codex/OpenAI skill and local MCP server in plugin/.
The MCP tools call the same CLI without a shell, keep source on the local
machine, and expose scans and module graphs to coding agents. The CLI remains
the source of truth; the skill and MCP server are thin adapters.
The release also includes a macOS MCP Bundle. Install
ViewDoctor-v0.1.7.mcpb
in any client that supports MCPB, or discover it in the official MCP Registry as
io.github.KamnevVladimir/viewdoctor. The bundle contains the local CLI and
stdio adapter; repository source is not sent to a hosted service.
The workflow changes in this release came from concrete integration failures,
not a larger rule wishlist. The evidence and scope decisions are documented in
docs/PAIN_DRIVEN_UX.md.
Roadmap
- baselines for existing findings;
- module dependency-cycle and undeclared-import rules;
- body complexity and identity rules with low-noise fixtures;
- signed release artifacts and package-manager installation;
- incremental cache and dependency-cone analysis.
Privacy
ViewDoctor reads local Swift and manifest files. It does not make network requests during analysis and does not collect telemetry. Public examples and tests use synthetic source only.
Built by KamnevApps while shipping production SwiftUI applications. Licensed under MIT.
來源:README.md,提交 b698739
工具
0版本歷史
1- v0.1.7最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分