
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 分