Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
run: npm ci
- name: Build and verify delivery
run: npm run check
- name: Verify tool errors and recovery contracts
if: matrix.node == '22'
run: npm run test:error-contracts
- name: Verify real Roslyn semantics and process cleanup
if: matrix.node == '22'
run: |
Expand All @@ -57,6 +60,7 @@ jobs:
name: check-node-${{ matrix.node }}
path: |
test-tmp/check/**/report.json
test-tmp/error-contracts/**/report.json
test-tmp/roslyn-host/**/report.json
test-tmp/roslyn-gateway/**/report.json
if-no-files-found: warn
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.13.1

- Mask comments/literals before local declarations, add TSX/JSX scanning and scoped context, preserve original signatures/lines and invalidate legacy declaration caches. Uncertain lexical boundaries are incomplete and uncached; text references remain heuristic.
- Share the existing C# masker with UI source mapping; bound script interpolation/JSX nesting and preserve cancellation checkpoints.
- Report unknown tools as JSON-RPC InvalidParams during normal admission. Known tool errors retain matching JSON text/structuredContent and domain recovery details. Extend error acceptance and run it in Node 22 CI.
- Return impact analysis once as JSON, retaining formattedReport and both tool names. Consumers reading a second Markdown block must use formattedReport instead.
- Align guides with direct Roslyn delivery and current error contracts. Actual-client Roslyn acceptance remains explicitly deferred by the user.

## 0.13.0

- Retire external Serena and default to local-text, with explicitly configured direct Roslyn for C# semantics. Exact snapshot locations flow through references, impact and refactoring.
- Include the complete Code Host/BuildHost delivery and real Roslyn verification in Windows CI. Add workspace recovery, trash partial outcomes and input/encoding consistency checks.
- Begin unified JSON tool errors; protocol and continuous acceptance follow-up is recorded in 0.13.1.

## 0.12.5

- Handle the real Serena 1.7/FastMCP structuredContent.result string envelope before parsing symbols or references. Preserve error, empty-result, malformed and shortened-response semantics; do not discard unknown envelope metadata or silently prefer text over unsupported structured data.
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ On 2026-09-08, the owner authorized applying main protection. The read-back conf
SDK policy follows [Microsoft global.json guidance](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json); dependency locking uses [NuGet locked restore](https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#locking-dependencies).

Current implementation is described in the [architecture guide](WinCode-架构与数据流说明.md). Remaining work is maintained in the [active engineering plan](WinCode-下一轮工程化迭代计划书.md); completed work belongs in CHANGELOG and the append-only work log. For documentation-only changes, verify local links, commands, version claims and evidence boundaries; do not claim a new runtime regression without running it.

Node 22 CI runs `npm run test:error-contracts` and uploads its bounded report. It exercises protocol errors, matching tool-error text/structured payloads, real generated-file trash failures and workspace recovery; injected UI images test serialization only. Run it locally after changes to these boundaries.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ WinCode is a local MCP server built for Windows and .NET engineering. It bridges
- **Inspect the running app:** Enumerate visible windows, query specific controls or subtrees, and capture numbered visual overlays without activating or stealing focus from the target.
- **Review with evidence:** Trace on-screen widgets back to literal XAML declaration tags, line numbers, and file hashes, with transparent reporting for ambiguity, truncation, or degraded upstreams.

Current source version: **0.13.0**. All UI tools are strictly read-only and non-destructive. See [CHANGELOG](CHANGELOG.md) for full version history.
Current source version: **0.13.1**. All UI tools are strictly read-only and non-destructive. See [CHANGELOG](CHANGELOG.md) for full version history.

### Quick start

Expand Down Expand Up @@ -117,6 +117,8 @@ Optionally add `candidateCodeFiles: ["ViewModels/MainWindowViewModel.cs"]` (1–

### Tool reference

Local declaration search supports C#/TS/TSX/JS/JSX/Python with bounded comment/literal/JSX masking; uncertain lexical boundaries are reported as incomplete. Text references remain heuristic. Impact analysis returns one JSON text block, including formattedReport once. Known tool errors expose matching JSON text and structuredContent; unknown tools use JSON-RPC -32602 during normal admission.

The default provider is `local-text`, with an explicit semantic-unconfigured status. Configure direct Roslyn to obtain compiler-backed identities. Pass a returned `location` unchanged as `symbolLocation` to references, impact, or refactoring, and use the returned plain symbol name. Old Serena namePath identities and external startup settings are retired; stale snapshots require a new explicit search.

`wincode_hello_world` reports a frozen running instance ID and build fingerprint, plus a hash of the tool definitions actually registered by that instance. Pass `toolName: "wincode_prepare_context"` to inspect just that tool's input schema. Compare it with `tools/list` on the same connection. `npm run build` emits a manifest; direct `tsc`, missing/mismatched artifacts or source development mode can report `unknown`. The build fingerprint checks local output consistency, not release authenticity. Workspace changes do not change the running build.
Expand Down Expand Up @@ -204,7 +206,7 @@ The default `compact` response contains one JSON text block; `responseFormat: "l

### Development and validation

The [CI workflow](.github/workflows/ci.yml) runs `npm run check` on pull requests and main pushes using Windows, Node.js 22/24 and .NET SDK 10.0.303. It performs locked builds, core regression, production stdio and delivery verification, and uploads bounded reports even on failure. Node 22 also runs real Roslyn Host and MCP acceptance on generated projects. Interactive desktop/UI acceptance remains separate. Check the actual run result. Main protection was verified on 2026-09-08 with required Node 22/24 and three CodeQL checks; approvals are zero under the single-maintainer policy. See [CONTRIBUTING](CONTRIBUTING.md) for enforcement and evidence boundaries.
The [CI workflow](.github/workflows/ci.yml) runs `npm run check` on pull requests and main pushes using Windows, Node.js 22/24 and .NET SDK 10.0.303. It performs locked builds, core regression, production stdio and delivery verification, and uploads bounded reports even on failure. Node 22 also runs error/recovery contracts and real Roslyn Host/MCP acceptance on generated projects. Interactive desktop/UI acceptance remains separate. Check the actual run result. Main protection was verified on 2026-09-08 with required Node 22/24 and three CodeQL checks; approvals are zero under the single-maintainer policy. See [CONTRIBUTING](CONTRIBUTING.md) for enforcement and evidence boundaries.

```powershell
npm ci
Expand Down Expand Up @@ -232,7 +234,7 @@ WinCode 是面向 Windows 与 .NET 工程研发的本地 MCP 服务。它将项
- **观察实际界面:**发现系统可见窗口,按条件定向查询目标控件或子树,并在不激活、不抢占前台焦点的前提下获取数字标注截图。
- **源码双向印证:**将运行时抓取的控件关联回 XAML 源码声明的起始行号、代码片段与文件哈希,清晰报告歧义、截断与降级状态。

当前源码版本为 **0.13.0**。所有 UI 取证工具均为纯只读与非侵入设计。版本历史见 [CHANGELOG](CHANGELOG.md)。
当前源码版本为 **0.13.1**。所有 UI 取证工具均为纯只读与非侵入设计。版本历史见 [CHANGELOG](CHANGELOG.md)。

### 快速上手

Expand Down Expand Up @@ -327,6 +329,8 @@ npm run delivery:verify

### 工具一览

本地声明扫描支持 C#/TS/TSX/JS/JSX/Python,有界屏蔽注释、字符串及 JSX;词法边界不确定时报告不完整。引用仍为文本线索。影响分析仅返回一个 JSON 文本块(含一份 formattedReport);已知工具失败的 JSON 文本与 structuredContent 一致,正常受理的未知工具走 JSON-RPC -32602。

默认以 `local-text` 启动,并明确报告语义能力未配置。显式配置直接 Roslyn 后,将搜索返回的完整 `location` 作为 `symbolLocation` 传给引用、影响分析或重构工具,名称使用原结果的简单名称。外部 Serena 启动配置及 namePath 身份已退役;过期快照须重新显式搜索。

`wincode_hello_world` 返回启动时固定的实例 ID、构建指纹及当前注册工具定义的 hash。传 `toolName: "wincode_prepare_context"` 可按需查看单个工具参数,与同一连接的 `tools/list` 对照。`npm run build` 生成 manifest;直接运行 `tsc`、产物缺失/失配或源码开发模式会明确报告 `unknown`。构建指纹校验本地产物一致性,不证明发布来源可信;切换分析工作区不会改变运行构建。
Expand Down Expand Up @@ -412,7 +416,7 @@ Coding Agent ── stdio MCP ── WinCode

### 本地开发与测试验证

[CI 工作流](.github/workflows/ci.yml) 在 PR 和 main 推送时使用 Windows、Node.js 22/24 与 .NET SDK 10.0.303 执行 `npm run check`,覆盖锁定构建、核心回归、生产 stdio 和交付校验,失败时也上传有界报告。Node 22 另运行生成项目的真实 Roslyn HostMCP 验收;交互桌面/UI 验收仍单独执行。通过与否以实际运行结果为准。2026-09-08 已核对 main 保护要求 Node 22/24 和三项 CodeQL 检查;单维护者策略要求 approval=0,不代表已获独立审核。详见 [贡献指南](CONTRIBUTING.md)。
[CI 工作流](.github/workflows/ci.yml) 在 PR 和 main 推送时使用 Windows、Node.js 22/24 与 .NET SDK 10.0.303 执行 `npm run check`,覆盖锁定构建、核心回归、生产 stdio 和交付校验,失败时也上传有界报告。Node 22 另运行错误/恢复契约专项与生成项目的真实 Roslyn Host/MCP 验收;交互桌面/UI 验收仍单独执行。通过与否以实际运行结果为准。2026-09-08 已核对 main 保护要求 Node 22/24 和三项 CodeQL 检查;单维护者策略要求 approval=0,不代表已获独立审核。详见 [贡献指南](CONTRIBUTING.md)。

```powershell
npm ci
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Security policy / 安全策略

The latest 0.12.x version and current `main` are maintained. Older versions do not have a separate backport commitment. Supported runtimes are Node 24 (primary) and Node 22 (compatibility), on Windows x64; build requirements are in [CONTRIBUTING](CONTRIBUTING.md).
The latest 0.13.x version and current `main` are maintained. Older versions do not have a separate backport commitment. Supported runtimes are Node 24 (primary) and Node 22 (compatibility), on Windows x64; build requirements are in [CONTRIBUTING](CONTRIBUTING.md).

目前维护最新 0.12.x 版本与 `main`,不承诺对旧版本单独回补。Windows x64 上以 Node 24 为主要环境、22 为兼容环境;构建要求见贡献指南。
目前维护最新 0.13.x 版本与 `main`,不承诺对旧版本单独回补。Windows x64 上以 Node 24 为主要环境、22 为兼容环境;构建要求见贡献指南。

Report suspected vulnerabilities through [GitHub private vulnerability reporting](https://github.com/linnnn89/WinCode/security/advisories/new). Include the affected version/build identity, reproduction steps, expected and observed behavior, and a minimal sanitized example. Do not include credentials, personal databases or private source unnecessarily. Avoid publishing exploit details in a public issue before coordination with the maintainer.

Expand Down
10 changes: 6 additions & 4 deletions WinCode-Skill制作与MCP配置指南.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WinCode Skill 安装、维护与 MCP 配置指南

适用于 **0.12.5**,核对日期 2026-09-08(北京时间)。以下使用本机 `I:/WinCode` 路径举例;其他机器必须替换路径。客户端界面名称随版本变化,以实际界面为准。
适用于 **0.13.1**,核对日期 2026-09-08(北京时间)。以下使用本机 `I:/WinCode` 路径举例;其他机器必须替换路径。客户端界面名称随版本变化,以实际界面为准。

## 1. 三个独立对象

Expand All @@ -22,7 +22,7 @@ npm run check
npm run delivery:verify
```

`check` 进行类型检查、Gateway 构建、锁定 NuGet restore、Release Host/控制台夹具构建、核心回归、新 stdio 验证与交付清单生成。交互桌面验收另执行 `npm run check:desktop`,需要可用 Windows 桌面。真实 Serena/TavernDesk 验收单独选择,详见 [CONTRIBUTING](CONTRIBUTING.md)。
`check` 进行类型检查、Gateway 构建、锁定 NuGet restore、Release UIA/Code Host 与控制台夹具构建、核心回归、新 stdio 验证与交付清单生成。交互桌面验收另执行 `npm run check:desktop`,需要可用 Windows 桌面。真实 Roslyn/TavernDesk 验收按对应入口执行,详见 [CONTRIBUTING](CONTRIBUTING.md)。

`npm run build` 只构建 Gateway,不能单独证明原生 Host、Skill 和整个交付物一致。生产使用发布的 Release Host;`npm run dev` 才显式启用开发回退。报告位于 `test-tmp/check/`,内容哈希不是发布签名。

Expand Down Expand Up @@ -77,7 +77,7 @@ npm run skill:check -- C:/Users/40218/.agents/skills/wincode

0.12.1 起 hello 不主动启动探测进程;unknown/null 表示未探测,不代表不可用。已知健康结果也可能陈旧。旧版本 hello 的行为不能套用新版说明。

0.12.5 已通过固定 Serena 1.7.0/Roslyn 的隔离真实验收;隔离安装不表示默认客户端已启用上游。0.12.4 起 Repomix 直接执行已安装 JavaScript bin,不再使用 cmd/npx 包装链,也不会自动下载;非标准安装和降级边界见诊断手册。
0.13 系列已经退役外部 Serena,默认 local-text;C# 语义使用随产品交付的 Code Host,通过显式 --roslyn-config 配置入口项目、Configuration、TFM、SDK 与求值许可,字段示例见代码手册。真实 Host/MCP 验收通过也不代表实际客户端已启用 Roslyn。0.12.4 起 Repomix 直接执行已安装 JavaScript bin,不再使用 cmd/npx 包装链,也不会自动下载;非标准安装和降级边界见诊断手册。

## 6. 常见偏差

Expand All @@ -86,7 +86,9 @@ npm run skill:check -- C:/Users/40218/.agents/skills/wincode
| 源码是新版,hello 返回旧版 | 核对实际命令、路径、instanceId 和启动时间;通过客户端重连,不以强杀宿主或复制文件冒充完成 |
| 字段被忽略,结果不像预期 | 对照规范字段表和实际工具 schema;容忍未知字段并不赋予其语义 |
| Host 缺失或身份不符 | 完整执行锁定构建和 delivery:verify;不混用旧 DLL、新 Gateway 或开发 Host |
| Serena/Repomix 不可用 | 先区分策略禁用、尚未探测、命令缺失、握手成功但语义不可用;检查 source/fallbackReason,不把降级当语义验收成功 |
| Roslyn/Repomix 不可用 | 先核对 provider、显式配置、项目求值许可、已知健康和恢复动作;Roslyn 失败不会暗中换成本地文本,Repomix 降级不代表语义验收成功 |
| UI 查不到或出现多个目标 | 核对 PID/HWND 和大小写准确的查询;只有 complete 且 unique 才能声称唯一定位 |

更新后仍无法核对客户端身份时,保留“客户端未验收”状态与实际证据,不反复尝试未声明参数。

0.13.1 的已知工具失败以同源 JSON 文本和 structuredContent 表达,UI/trash 保留领域信息;未知工具在正常受理时返回 JSON-RPC -32602。未知字段容忍策略与未知工具的协议错误是两回事。影响分析只返回一个 JSON 文本块,formattedReport 在对象内。
Loading