Skip to content

Commit cef16d6

Browse files
committed
fix: resolve all 19 Copilot review comments
- fix: 'bate' → 'beta' typo in skill.json, plugin.json, marketplace.json - fix: skill.json version desc v10.4.6 → v10.5.0-beta.4 - fix: template.ts missing readFile import, platform path hardcoding - fix: init.ts --ai all now routes to generateAllPlatformFiles - fix: generate.ts command injection (execSync→spawnSync+argv) - fix: extract.ts path injection (exec→execFile) - fix: _sync_all.py filecmp shallow=False + --verify detects NEEDS SYNC - fix: release.yml Windows paths on Linux runner - fix: sync CLI assets after source changes Co-Authored-By: Claude <noreply@anthropic.com
1 parent 62311ed commit cef16d6

33 files changed

Lines changed: 572 additions & 421 deletions

.claude-plugin/marketplace.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
},
77
"metadata": {
88
"description": ".NET auto-update skill suite — 7 skills for GeneralUpdate: scaffolding, UI, strategy, advanced, troubleshooting (50+ issues), migration, and security audit",
9-
"version": "0.0.1-bate.1"
9+
"version": "0.0.1-beta.1"
1010
},
1111
"plugins": [
1212
{
1313
"name": "generalupdate-skill",
1414
"source": "./",
15-
"description": "Complete GeneralUpdate (.NET auto-update) integration skill suite. Generates dual-project scaffolding, full-state update UI (6 frameworks), 6 update strategies decision tree (Client-Server/OSS/Silent/Differential/CVP/Push), advanced extension points (Bowl crash daemon, IPC replacement, AOT), BM25-powered troubleshooting search (50+ known issues), v9.x→v10 migration guide, and 14-point security audit matrix. All templates target NuGet v10.4.6 stable API.",
16-
"version": "0.0.1-bate.1",
15+
"description": "Complete GeneralUpdate (.NET auto-update) integration skill suite. Generates dual-project scaffolding, full-state update UI (6 frameworks), 6 update strategies decision tree (Client-Server/OSS/Silent/Differential/CVP/Push), advanced extension points (Bowl crash daemon, IPC replacement, AOT), BM25-powered troubleshooting search (50+ known issues), v9.x→v10 migration guide, and 14-point security audit matrix. All templates target NuGet v10.5.0-beta.4.",
16+
"version": "0.0.1-beta.1",
1717
"author": {
1818
"name": "JusterZhu"
1919
},

.claude-plugin/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "generalupdate-skill",
3-
"description": "Complete .NET auto-update skill suite for GeneralUpdate. 7 skills covering: Bootstrap scaffolding, update UI (6 frameworks), 6 strategies (Client-Server/OSS/Silent/Differential/CVP/Push), advanced extension points (Bowl, IPC, AOT), 50+ known issues diagnosis with BM25 search engine, version migration, and security audit. All templates target NuGet v10.4.6 stable.",
4-
"version": "0.0.1-bate.1",
3+
"description": "Complete .NET auto-update skill suite for GeneralUpdate. 7 skills covering: Bootstrap scaffolding, update UI (6 frameworks), 6 strategies (Client-Server/OSS/Silent/Differential/CVP/Push), advanced extension points (Bowl, IPC, AOT), 50+ known issues diagnosis with BM25 search engine, version migration, and security audit. All templates target NuGet v10.5.0-beta.4.",
4+
"version": "0.0.1-beta.1",
55
"author": {
66
"name": "JusterZhu"
77
},

.claude/scripts/_sync_all.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ def sync_file(src: Path, dst: Path, apply: bool, dry_run: bool) -> str:
3939
if not src.exists():
4040
return f"⚠️ SOURCE MISSING: {src.relative_to(REPO_ROOT)}"
4141

42-
if dst.exists() and filecmp.cmp(src, dst) if src.is_file() else _dirs_equal(src, dst):
43-
return f"✓ UP TO DATE: {src.relative_to(REPO_ROOT)}"
42+
if dst.exists():
43+
if src.is_file():
44+
up_to_date = filecmp.cmp(src, dst, shallow=False)
45+
else:
46+
up_to_date = _dirs_equal(src, dst)
47+
if up_to_date:
48+
return f"✓ UP TO DATE: {src.relative_to(REPO_ROOT)}"
4449

4550
if dry_run or not apply:
4651
return f"→ NEEDS SYNC: {src.relative_to(REPO_ROOT)}{dst.relative_to(REPO_ROOT)}"
@@ -105,11 +110,11 @@ def main():
105110
for desc, status in statuses:
106111
print(f" {status}")
107112

108-
if args.verify and not all_ok:
109-
print("\n❌ Verify FAILED: some sources are missing")
110-
sys.exit(1)
111-
112113
if args.verify:
114+
needs_sync = any(status.startswith("→") for _, status in statuses)
115+
if not all_ok or needs_sync:
116+
print("\n❌ Verify FAILED: sources are out of sync")
117+
sys.exit(1)
113118
print("\n✅ Verify PASSED: all sources are in sync")
114119
sys.exit(0)
115120

.github/workflows/release.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,8 @@ jobs:
2828
with:
2929
python-version: '3.12'
3030

31-
- name: Setup .NET
32-
uses: actions/setup-dotnet@v5
33-
with:
34-
dotnet-version: '10.0.x'
35-
3631
# ======================
37-
# Validate everything first
32+
# Validate before release
3833
# ======================
3934

4035
- name: Validate — BM25 search
@@ -50,17 +45,6 @@ jobs:
5045
--project-name ReleaseTest --version 0.1.0.0 -o /tmp/release-verify
5146
grep -q "ReleaseTest.exe" /tmp/release-verify/Client/Integration.cs && echo "✅ Generator OK"
5247
53-
- name: Validate — Scaffold builds
54-
run: |
55-
$scaffoldDir = ".claude/skills/generalupdate-init/project-scaffold"
56-
$testDir = "C:\tmp\release-verify-scaffold"
57-
New-Item -ItemType Directory -Path $testDir -Force | Out-Null
58-
Copy-Item "$scaffoldDir\*" $testDir
59-
dotnet build "$testDir\ClientApp.csproj" 2>&1
60-
if ($LASTEXITCODE -ne 0) { throw "Scaffold build failed" }
61-
Write-Host "✅ Scaffold builds"
62-
shell: pwsh
63-
6448
# ======================
6549
# Build CLI
6650
# ======================

cli/assets/skills/generalupdate-advanced/SKILL.md

Lines changed: 101 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: generalupdate-advanced
33
description: |
44
Reference guide for GeneralUpdate internal architecture — Pipeline, middleware,
55
Strategy, Differential engine, Bowl crash monitor, FileTree, blacklist, and AOT.
6-
Covers what is and isn't available in v10.4.6 stable release vs dev branch.
6+
Covers all extension points available in v10.5.0-beta.4 including Pipeline, Hooks, Bowl, AOT, and DiffPipeline.
77
Triggers on: "extension points", "custom hooks", "Bowl", "crash dump", "IPC",
88
"named pipe", "shared memory", "custom strategy", "download pipeline",
99
"SSL policy", "auth provider", "custom download", "extension management",
@@ -24,15 +24,17 @@ allowed-tools: "Read, Write, Edit, Glob"
2424

2525
涵盖扩展点架构、Pipeline 管道、差分引擎、Bowl 崩溃守护、事件系统、文件系统工具等。
2626

27-
> ⚠️ **API 版本说明**:本指南基于 **NuGet v10.4.6 稳定版**
28-
> 以下功能在稳定版中**不存在**(但在开发分支 v10.5.0-beta.2 中已有):
29-
> - `IUpdateHooks` 生命周期钩子
30-
> - `IProcessInfoProvider` IPC 替换接口
31-
> - `SilentPollOrchestrator` 静默轮询器
32-
> - `Option` 可编程配置系统(v10.4.6 仅使用 `Configinfo` 属性)
33-
> - `ISslValidationPolicy` SSL 策略接口
27+
> ⚠️ **API 版本说明**:本指南基于 **NuGet v10.5.0-beta.4**
28+
> 以下功能在 v10.5.0-beta.4 中全部**可用**
29+
> -`IUpdateHooks` 生命周期钩子(`Hooks<T>()`
30+
> -`IStrategy` 自定义策略注入(`Strategy<T>()`
31+
> -`SilentPollOrchestrator` 静默轮询器(`Option.Silent`
32+
> -`Option` 可编程配置系统
33+
> -`ISslValidationPolicy` SSL 策略接口
34+
> -`IHttpAuthProvider` HTTP 认证提供者
35+
> -`DiffPipelineBuilder` 差分管道配置
3436
>
35-
> 各功能的可用性在文中已标注
37+
> 各功能的命名空间和用法在文中已标注
3638
3739
---
3840

@@ -63,15 +65,14 @@ allowed-tools: "Read, Write, Edit, Glob"
6365

6466
---
6567

66-
## 1. Pipeline 管道系统(v10.4.6 可用)
68+
## 1. Pipeline 管道系统(v10.5.0-beta.4 可用)
6769

6870
GeneralUpdate 使用 Pipeline 管道模式处理更新包的校验、解压、补丁应用。
6971

7072
### PipelineBuilder API
7173

7274
```csharp
73-
using GeneralUpdate.Common.Internal.Pipeline;
74-
using GeneralUpdate.Common.Internal.Strategy;
75+
using GeneralUpdate.Core.Pipeline;
7576

7677
// 创建管道上下文
7778
var context = new PipelineContext();
@@ -86,7 +87,7 @@ context.Add("PatchEnabled", true);
8687
await new PipelineBuilder(context)
8788
.UseMiddleware<HashMiddleware>() // 哈希校验
8889
.UseMiddleware<CompressMiddleware>() // 解压
89-
.UseMiddleware<PatchMiddleware>() // 差分补丁(需安装 Differential 包)
90+
.UseMiddleware<PatchMiddleware>() // 差分补丁
9091
.Build();
9192
```
9293

@@ -99,35 +100,31 @@ await new PipelineBuilder(context)
99100

100101
---
101102

102-
## 2. 策略系统(v10.4.6 可用)
103+
## 2. 策略系统(v10.5.0-beta.4 可用)
103104

104-
GeneralUpdate 内置三种平台策略,通过 `AbstractStrategy` 模板方法模式实现
105+
GeneralUpdate 内置三种平台策略,通过 `IStrategy` 接口实现
105106

106107
| 策略 | 类名 | 平台 |
107108
|------|------|------|
108109
| Windows | `WindowsStrategy` | Windows |
109110
| Linux | `LinuxStrategy` | Linux |
110111
| OSS | `OSSStrategy` | 跨平台(对象存储) |
111112

112-
> ⚠️ 稳定版**不支持**通过 `bootstrap.Strategy<T>()` 注入自定义策略。
113-
> 自定义策略需要继承 `AbstractStrategy` 并直接调用
113+
> ✅ 支持通过 `bootstrap.Strategy&lt;T&gt;()` 注入自定义策略。
114+
> 自定义策略需要实现 `IStrategy` 接口
114115
115116
---
116117

117-
## 3. Bowl 崩溃守护(v10.4.6 存在但功能有限
118+
## 3. Bowl 崩溃守护(v10.5.0-beta.4
118119

119120
Bowl 是一个崩溃监控组件,通过 `MonitorParameter` 配置。
120121

121-
> ⚠️ **注意**:v10.4.6 的 Bowl 仅提供基础类型定义,`Bowl` 类没有公开的 `LaunchAsync` 方法。
122-
> 完整功能在开发分支(v10.5.0-beta.2)中。
123-
124-
### MonitorParameter 配置
122+
### BowlContext 配置
125123

126124
```csharp
127125
using GeneralUpdate.Bowl;
128-
using GeneralUpdate.Bowl.Strategys;
129126

130-
var param = new MonitorParameter
127+
var context = new BowlContext
131128
{
132129
ProcessNameOrId = "MyApp.exe",
133130
DumpFileName = "v1.0.0.0_fail.dmp",
@@ -136,22 +133,40 @@ var param = new MonitorParameter
136133
FailDirectory = @"C:\Program Files\MyApp\fail",
137134
BackupDirectory = @"C:\Program Files\MyApp\backup",
138135
WorkModel = "Upgrade",
136+
TimeoutMs = 30_000,
137+
AutoRestore = true,
138+
OnCrash = async (info, ct) => Console.WriteLine($"Crash: {info.DumpFilePath}"),
139139
};
140140

141-
// Bowl 实例(v10.4.6 无公开 LaunchAsync,此为占位)
142141
var bowl = new Bowl();
142+
var result = await bowl.LaunchAsync(context);
143+
Console.WriteLine($"Result: Success={result.Success}, Restored={result.Restored}");
143144
```
144145

145-
完整 Bowl 崩溃守护功能请关注 GeneralUpdate 后续版本。
146+
| 属性 | 类型 | 说明 | 默认值 |
147+
|------|------|------|--------|
148+
| `ProcessNameOrId` | string | 被监控的进程名或 PID | 必填 |
149+
| `TargetPath` | string | 应用安装根目录 | 必填 |
150+
| `DumpFileName` | string | Dump 文件名 | 必填 |
151+
| `FailFileName` | string | 故障报告文件名 | 必填 |
152+
| `FailDirectory` | string | 崩溃报告输出目录 | 必填 |
153+
| `BackupDirectory` | string | 备份目录 | 必填 |
154+
| `WorkModel` | string | "Upgrade" 或 "Normal" | "Upgrade" |
155+
| `TimeoutMs` | int | 监控超时(毫秒) | 30000 |
156+
| `AutoRestore` | bool | 崩溃后自动回滚 | false |
157+
| `DumpType` | DumpType | Mini / Full | Full |
158+
| `OnCrash` | delegate | 崩溃回调 | null |
159+
160+
> ⚠️ Bowl 和 Core 不能同时引用(CS0433)。使用 Bowl 时**只引用 `GeneralUpdate.Bowl`**,它传递依赖 Core 的所有功能。
146161
147162
---
148163

149-
## 4. EventManager 事件系统(v10.4.6 可用)
164+
## 4. EventManager 事件系统(v10.5.0-beta.4 可用)
150165

151166
EventManager 是一个全局单例,提供事件的发布和订阅:
152167

153168
```csharp
154-
using GeneralUpdate.Common.Internal.Event;
169+
using GeneralUpdate.Core.Event;
155170

156171
// 添加监听
157172
EventManager.Instance.AddListener((object? sender, UpdateInfoEventArgs e) =>
@@ -169,54 +184,79 @@ EventManager.Instance.Clear();
169184
EventManager.Instance.Dispose();
170185
```
171186

172-
> ⚠️ EventManager 是全局单例,`Dispose()``Instance` 仍然可访问(代码审计发现)
187+
> ⚠️ EventManager 是全局单例,`Dispose()``Instance` 仍然可访问。
173188
174189
---
175190

176-
## 5. 文件系统工具(v10.4.6 可用)
191+
## 5. 文件系统工具(v10.5.0-beta.4 可用)
177192

178193
### BlackList(黑名单)
179194

180-
`Configinfo` 支持通过以下属性排除文件:
195+
`UpdateRequest` 支持通过以下属性排除文件:
181196

182197
```csharp
183-
var config = new Configinfo
198+
var config = new UpdateRequest
184199
{
185200
// ...
186-
BlackFiles = new List<string> { "*.log", "*.tmp" },
187-
BlackFormats = new List<string> { ".pdb", ".vshost.exe" },
188-
SkipDirectorys = new List<string> { "logs", "cache", "temp" },
201+
Files = new List<string> { "*.log", "*.tmp" },
202+
Formats = new List<string> { ".pdb", ".vshost.exe" },
203+
Directories = new List<string> { "logs", "cache", "temp" },
189204
};
190205
```
191206

207+
黑名单内部通过 `ToBlackPolicy()` 转换为 `BlackPolicy` 记录。
208+
192209
### FileTree(文件树对比)
193210

194211
```csharp
195-
using GeneralUpdate.Common.FileBasic;
212+
using GeneralUpdate.Core.FileSystem;
196213

197214
var tree = new FileTree();
198215
var snapshot = tree.CreateSnapshot(@"C:\Program Files\MyApp");
199-
// 或从 StorageManager 获取比较结果
200216
```
201217

202218
---
203219

204-
## 6. 差分引擎(v10.4.6 可用,需安装 Differential 包
220+
## 6. 差分引擎(v10.5.0-beta.4 可用,无需额外安装包
205221

206-
安装 `GeneralUpdate.Differential` 包后可用:
222+
差分类型已内嵌在 `GeneralUpdate.Core` 中,**无需额外**安装 `GeneralUpdate.Differential` 包。
223+
224+
### DiffPipelineBuilder 方式(推荐)
207225

208226
```csharp
209-
// DifferentialCore 提供核心差分能力
210-
using GeneralUpdate.Differential;
227+
using GeneralUpdate.Core.Pipeline;
228+
229+
var pipeline = new DiffPipelineBuilder()
230+
.UseDiffer(new StreamingHdiffDiffer()) // 差分算法
231+
.UseCleanMatcher(new DefaultCleanMatcher()) // 文件匹配器(服务端)
232+
.UseDirtyMatcher(new DefaultDirtyMatcher()) // 文件匹配器(客户端)
233+
.WithParallelism(4)
234+
.WithStopOnFirstError(true)
235+
.WithProgress(new Progress<DiffProgress>(p =>
236+
Console.WriteLine($"[{p.Completed}/{p.Total}] {p.FileName}")))
237+
.Build();
211238

212-
// 清理模式(服务端):对比新旧版本生成补丁
213-
await DifferentialCore.CleanAsync(srcDir, tgtDir, patchDir);
239+
// 服务端:生成补丁
240+
await pipeline.CleanAsync(oldDir, newDir, patchDir);
214241

215-
// 脏模式(客户端):应用补丁
216-
await DifferentialCore.DirtyAsync(installDir, patchDir);
242+
// 客户端:应用补丁
243+
await pipeline.DirtyAsync(appDir, patchDir);
244+
```
245+
246+
### Bootstrap 集成方式
247+
248+
```csharp
249+
new GeneralUpdateBootstrap()
250+
.SetConfig(config)
251+
.UseDiffPipeline(pipeline =>
252+
{
253+
pipeline.WithParallelism(2)
254+
.WithStopOnFirstError(true);
255+
})
256+
.LaunchAsync();
217257
```
218258

219-
自定义匹配器(v10.4.6 可用):
259+
### 自定义匹配器
220260

221261
```csharp
222262
using GeneralUpdate.Differential.Matchers;
@@ -230,7 +270,7 @@ var dirtyMatcher = new DefaultDirtyMatcher(); // 或实现 IDirtyMatcher
230270

231271
## 7. AOT / NativeAOT 兼容性
232272

233-
GeneralUpdate.Core v10.4.6 支持 .NET Native AOT:
273+
GeneralUpdate.Core v10.5.0-beta.4 支持 .NET Native AOT`net8.0``net10.0`
234274

235275
```xml
236276
<PropertyGroup>
@@ -242,10 +282,10 @@ GeneralUpdate.Core v10.4.6 支持 .NET Native AOT:
242282
JSON 序列化上下文(减少 AOT 大小):
243283

244284
```csharp
245-
using GeneralUpdate.Common.Internal.JsonContext;
285+
using GeneralUpdate.Core.JsonContext;
246286

247287
// 使用内置的 JsonSerializerContext
248-
// VersionRespJsonContext, PacketJsonContext, ProcessInfoJsonContext
288+
// VersionRespJsonContext, ProcessContractJsonContext, HttpParameterJsonContext
249289
```
250290

251291
---
@@ -273,19 +313,19 @@ var result = GeneralDrivelution.InstallDriver(driverPath);
273313

274314
| 主题 | 可用性 | 参考 |
275315
|------|--------|------|
276-
| Pipeline 管道 | ✅ v10.4.6 | `GeneralUpdate.Common.Internal.Pipeline` |
277-
| 策略系统 | ✅ v10.4.6 | `GeneralUpdate.Common.Internal.Strategy` |
278-
| FileTree | ✅ v10.4.6 | `GeneralUpdate.Common.FileBasic` |
279-
| BlackList | ✅ v10.4.6 | `Configinfo.BlackFiles` 等属性 |
280-
| 差分引擎 |`GeneralUpdate.Differential` | `DifferentialCore` |
281-
| AOT | ✅ v10.4.6 | `JsonSerializerContext` 子类 |
282-
| EventManager | ✅ v10.4.6 | `GeneralUpdate.Common.Internal.Event` |
316+
| Pipeline 管道 | ✅ v10.5.0-beta.4 | `GeneralUpdate.Core.Pipeline` |
317+
| 策略系统 | ✅ v10.5.0-beta.4 | `GeneralUpdate.Core.Strategy` |
318+
| FileTree | ✅ v10.5.0-beta.4 | `GeneralUpdate.Core.FileSystem` |
319+
| BlackList | ✅ v10.5.0-beta.4 | `UpdateRequest.Files/Formats/Directories``ToBlackPolicy()` |
320+
| 差分引擎 |内嵌 Core | `DiffPipelineBuilder` / `DiffPipeline` |
321+
| AOT | ✅ v10.5.0-beta.4 | `JsonSerializerContext` 子类 |
322+
| EventManager | ✅ v10.5.0-beta.4 | `GeneralUpdate.Core.Event` |
283323
| Bowl 崩溃守护 | ⚠️ 基础类型 | `GeneralUpdate.Bowl.Bowl` |
284-
| IUpdateHooks | v10.4.6 不支持 | 开发分支 v10.5.0-beta.2 中 |
285-
| 自定义 Strategy 注入 | v10.4.6 不支持 | 开发分支 v10.5.0-beta.2 中 |
286-
| IPC 替换接口 |v10.4.6 不支持 | 开发分支 v10.5.0-beta.2 中 |
287-
| SilentPollOrchestrator | v10.4.6 不支持 | 开发分支 v10.5.0-beta.2 中 |
288-
| Option 系统 | v10.4.6 不支持 | 仅 Configinfo 属性 |
324+
| IUpdateHooks | v10.5.0-beta.4 | `GeneralUpdate.Core.Hooks``Hooks<T>()` |
325+
| 自定义 Strategy 注入 | v10.5.0-beta.4 | `Strategy<T>()` |
326+
| IPC 替换接口 |暂不支持 | 使用 NamedPipe 替代方案 |
327+
| SilentPollOrchestrator | v10.5.0-beta.4 | `Option.Silent` + `SetOption()` |
328+
| Option 系统 | v10.5.0-beta.4 | `SetOption<T>(Option<T>, T)` |
289329

290330
---
291331

0 commit comments

Comments
 (0)