iterate-plugin 2.7.0 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,79 +1,92 @@
1
1
  # iterate-plugin for DeepSeek Harness (dsh)
2
2
 
3
- > **开发与评审在 [iterate-skill 主仓库](https://github.com/jingzhao-l/iterate-skill) 完成**:插件代码由主仓库统一维护,通过 `git subtree` 同步到本仓库;**版本发版与 npm 发布在本仓库(插件仓库)进行**,作为 dsh 生态的正式发布位。欢迎 **star / fork 主仓库** 并在 [主仓库 Issues](https://github.com/jingzhao-l/iterate-skill/issues) 反馈问题。
3
+ <p align="center">
4
+ <a href="README.md"><strong>English</strong></a> ·
5
+ <a href="README.zh-CN.md"><strong>简体中文</strong></a>
6
+ </p>
4
7
 
5
- `iterate-plugin` [iterate](https://github.com/jingzhao-l/iterate-skill) 技能的 [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness) 插件,提供**自治闭环代码迭代**和 **dry-run 纯多轮审查**能力。除 13 个纯函数工具外,还内置一套**免构建的 Web UI 层**(分诊面板、收敛看板、统计卡片、主题皮肤等),直接挂在 dsh 客户端的既有 UI 槽位上。
8
+ > **Developed and reviewed in the [iterate-skill monorepo](https://github.com/jingzhao-l/iterate-skill)**: the plugin code is maintained in the main repository and synced here via `git subtree`; **releases and npm publishing happen in this (plugin) repository**, which is the canonical publish point for the dsh ecosystem. Please **star / fork the main repository** and file issues at the [main repository Issues](https://github.com/jingzhao-l/iterate-skill/issues).
6
9
 
7
- ## 特性
10
+ ## About This Plugin
8
11
 
9
- ### 两种运行模式
12
+ **iterate** is an open-source project that gives AI coding assistants the ability to review and fix code in multi-round autonomous loops. It targets a concrete pain point:
10
13
 
11
- | 功能 | dry-run 模式 | normal 模式 |
12
- |------|-------------|------------|
13
- | 多轮收敛反复审查 | ✅ | ✅ |
14
- | 并行维度评审 | ✅ | ✅ |
15
- | 确定性聚合去重/排序 | ✅ | ✅ |
16
- | meta-review 报告一致性审计 | ✅ | ✅ |
17
- | 零文件修改(只读) | ✅ | ❌ |
18
- | 原子问题自动修复 | ❌ | ✅ |
19
- | 每轮修复后验证 | ❌ | ✅ |
20
- | 修复失败回滚 | ❌ | ✅ |
21
- | 达标自停 | ✅ | ✅ |
22
- | 只修改 atomic 问题,保留 architectural 留待后续 | ❌ | ✅ |
23
- | 断点保存 / 恢复(长迭代续跑) | ✅ | ✅ |
14
+ > AI assistants tend to "talk a lot but do little": a single conversation only touches a few lines, stops caring about the rest of the repo after seeing one file, and rarely double-checks what they broke. iterate automates these closing chores — itemized review, per-dimension triage, fix, validate, and iterate again — so AI actually finishes changes and gets them right.
24
15
 
25
- ### 工具层
16
+ `iterate-plugin` is the [iterate](https://github.com/jingzhao-l/iterate-skill) integration for the [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness) desktop client. It brings iterate's review loop (review → triage → fix → validate → converge) directly into the dsh UI, offering **autonomous closed-loop code iteration** (normal mode) and **dry-run read-only multi-round review**.
26
17
 
27
- - **13 个注册工具**:`iterate_config` / `iterate_validate` / `iterate_decision_log` / `iterate_context` / `iterate_review` / `iterate_triage` / `iterate_fix` / `iterate_diff` / `iterate_rollback` / `iterate_checkpoint` / `iterate_status` / `iterate_history` / `iterate_prune`
28
- - **findings 分诊闭环**:审查 → UI 分诊(y/n/a)→ `iterate_triage` 写回 `known_intentional` → 下一轮自动过滤
29
- - **结构化修复系统**:每次修复先备份、写注册表、记录 diff,验证失败可 `iterate_rollback` 还原
30
- - **断点续跑**:长迭代在每轮开头保存 checkpoint,中断后可恢复进度
31
- - **历史审计**:`iterate_history` 读取决策日志(按类型/时间/数量过滤)与修复注册表汇总,审查运行过程与修复明细
32
- - **运行时清理**:`iterate_prune` 清理过期的决策日志条目、陈旧断点、孤儿修复备份与空轮次;默认 dry-run 只报告不删除,显式 `dryRun:false` 才真正清理,每次清理写入决策日志
33
- - **配置读写**:`iterate_config` 支持带校验、备份、回滚的局部写入
18
+ Besides 13 pure-function tools, it ships a **build-free Web UI layer** (triage panel, convergence dashboard, stats card, theme skin, etc.) that plugs straight into dsh's existing UI slots. Configuration (`iterate.config.yaml` and the review dimensions) is identical across the other two components of the iterate ecosystem (skill / headless engine) — zero migration cost.
34
19
 
35
- ### UI 层(客户端免构建槽位)
20
+ ## Features
36
21
 
37
- | UI 组件 | 挂载槽位 | 功能 |
38
- |---------|---------|------|
39
- | 收敛看板 `ConvergenceDashboard` | `conversation.input.dock` | 输入框上方实时显示轮次进度条、严重度统计、维度徽章、趋势迷你图,normal 模式另显示修复计数徽章 |
40
- | Findings 分诊面板 `TriagePanel` | `conversation.chat.turnTail` | 逐条 y/n/a 判定,支持筛选、批量(含一键全选所有 findings)、键盘快捷键、localStorage 持久化、复制 YAML/应用指令 |
41
- | 收敛统计卡片 `StatsCard` | `conversation.chat.turnTail` | 无 findings 时显示收敛统计、历史轮次表、趋势图、完成摘要 |
42
- | iterate 主题皮肤 | `theme.overrideTokens` | 暖琥珀配色的 13 个 dsw token 覆盖,明暗双模式,可在设置页开关 |
43
- | 进度胶囊 `ProgressCapsule` | `shell.overlay` | 每轮完成/收敛时右下角弹出通知(含收敛确认) |
44
- | iterate 设置区 `SettingsPanel` | `settings.section` | 主题开关、分诊持久化说明、配置管理指引、运行时状态概览(产物布局 + 查看/清理工具指引)、一键清空分诊数据 |
22
+ ### Two modes
45
23
 
46
- UI 层为**防御式设计**:`slots` / `theme` / `React` 任一不可用时自动降级,不会崩溃客户端。
24
+ | Capability | dry-run | normal |
25
+ | --- | --- | --- |
26
+ | Repeated review until convergence | ✅ | ✅ |
27
+ | Parallel dimension review | ✅ | ✅ |
28
+ | Deterministic aggregation / dedupe / sort | ✅ | ✅ |
29
+ | meta-review report consistency audit | ✅ | ✅ |
30
+ | Zero file modification (read-only) | ✅ | ❌ |
31
+ | Automatic atomic fix | ❌ | ✅ |
32
+ | Validation after each round's fixes | ❌ | ✅ |
33
+ | Rollback on failed fixes | ❌ | ✅ |
34
+ | Self-stop when converged | ✅ | ✅ |
35
+ | Fix atomic findings only, keep architectural for later | ❌ | ✅ |
36
+ | Breakpoint save / resume (long iterations) | ✅ | ✅ |
47
37
 
48
- ## 安装
38
+ ### Tool layer
49
39
 
50
- ### npm 安装
40
+ - **13 registered tools**: `iterate_config` / `iterate_validate` / `iterate_decision_log` / `iterate_context` / `iterate_review` / `iterate_triage` / `iterate_fix` / `iterate_diff` / `iterate_rollback` / `iterate_checkpoint` / `iterate_status` / `iterate_history` / `iterate_prune`
41
+ - **Findings triage loop**: review → UI triage (y/n/a) → `iterate_triage` writes back `known_intentional` → auto-filtered next round
42
+ - **Structured fix system**: each fix backs up first, writes a registry entry, records the diff; a failed validation can be reverted with `iterate_rollback`
43
+ - **Breakpoint resume**: checkpoints saved at the start of each round; interrupted long iterations can resume
44
+ - **History audit**: `iterate_history` reads the decision log (filtered by type / time / count) and the fix registry summary to audit run process and fix details
45
+ - **Runtime cleanup**: `iterate_prune` removes stale decision-log entries, stale checkpoints, orphaned fix backups and empty rounds; dry-run by default (report-only), real cleanup requires `dryRun:false`, and every cleanup is logged
46
+ - **Config read / write**: `iterate_config` supports validated, backed-up, rollback-capable partial writes
47
+
48
+ ### UI layer (build-free client slots)
49
+
50
+ | UI component | Mounted slot | Function |
51
+ | --- | --- | --- |
52
+ | ConvergenceDashboard | `conversation.input.dock` | Live round progress bar, severity stats, dimension badges, trend mini-chart above the input; normal mode also shows fix-count badges |
53
+ | TriagePanel | `conversation.chat.turnTail` | Per-finding y/n/a triage, filtering, batch (incl. select-all), keyboard shortcuts, localStorage persistence, copy-YAML / apply-instruction |
54
+ | StatsCard | `conversation.chat.turnTail` | When no findings remain: convergence stats, round history table, trend chart, completion summary |
55
+ | iterate theme skin | `theme.overrideTokens` | Warm-amber 13-dsw-token override, light/dark modes, togglable in settings |
56
+ | ProgressCapsule | `shell.overlay` | Popup notification on each round completion / convergence (incl. convergence confirm) |
57
+ | SettingsPanel | `settings.section` | Theme toggle, triage-persistence notes, config-management guide, runtime status overview (artifact layout + view/cleanup tool guide), one-click triage data reset |
58
+
59
+ The UI layer is **defensive by design**: it degrades gracefully if any of `slots` / `theme` / `React` is unavailable — it never crashes the client.
60
+
61
+ ## Installation
62
+
63
+ ### From npm
51
64
 
52
65
  ```bash
53
66
  dsh plugin --profile web add iterate-plugin
54
- #
67
+ # or
55
68
  pnpm add iterate-plugin
56
69
  ```
57
70
 
58
- ### GitHub 安装(dsh 生态第三方安装方式)
71
+ ### From GitHub (dsh ecosystem third-party install)
59
72
 
60
- dsh 官方支持从 GitHub 插件仓库直接安装:`dsh plugin --profile web add "github:owner/repo#ref"`(仓库根即插件,声明 `dsh.bundle` 后自动启用)。本插件在 [iterate-plugin 独立仓库](https://github.com/jingzhao-l/iterate-plugin) 维护仓库根即插件的发布位,由主仓库通过 `git subtree` 同步,内容与 npm 包一致:
73
+ dsh officially supports installing plugins directly from a GitHub repo: `dsh plugin --profile web add "github:owner/repo#ref"` (repo root is the plugin, auto-enabled once `dsh.bundle` is declared). This plugin's standalone [iterate-plugin repository](https://github.com/jingzhao-l/iterate-plugin) has the repo-root-is-plugin publish point, synced from the main repo via `git subtree`, content identical to the npm package:
61
74
 
62
75
  ```bash
63
76
  dsh plugin --profile web add "github:jingzhao-l/iterate-plugin#main"
64
77
  ```
65
78
 
66
- 安装完成后需重启 dsh 服务(建议 `dsh web --patch`)并刷新页面,宿主与客户端 UI 层才会加载。
79
+ After installation, restart the dsh service (recommended `dsh web --patch`) and refresh the page so both the host and the client UI layer load.
67
80
 
68
- ### 本地开发 / 源码挂载
81
+ ### Local development / source mount
69
82
 
70
83
  ```bash
71
84
  dsh plugin --profile web add /path/to/iterate-skill/harness/iterate-plugin
72
- #
85
+ # or
73
86
  pnpm add /path/to/iterate-skill/harness/iterate-plugin
74
87
  ```
75
88
 
76
- 然后在你的 profile `cordis.patch.yml` 添加:
89
+ Then add to your profile `cordis.patch.yml`:
77
90
 
78
91
  ```yaml
79
92
  - insert:
@@ -81,120 +94,120 @@ pnpm add /path/to/iterate-skill/harness/iterate-plugin
81
94
  name: 'iterate-plugin'
82
95
  ```
83
96
 
84
- > 插件包自带 `dsh.bundle.patch`(即 `cordis.patch.yml`),npm 包内 `files` 已白名单化(`src` / `lib` / `cordis.patch.yml` / `README.md` / `LICENSE`)。
97
+ > The package carries its own `dsh.bundle.patch` (i.e. `cordis.patch.yml`); the npm package's `files` whitelist is `src` / `lib` / `dist` / `cordis.patch.yml` / `README.md` / `LICENSE`. `dist/` is the compiled output of the TypeScript server-side logic, shipped with the package so it works with dsh's `github:owner/repo#ref` git-clone install (Node does not strip TS types under `node_modules`).
85
98
 
86
- ## 使用
99
+ ## Usage
87
100
 
88
- ### dry-run 模式(纯反复审查,不修改文件)
101
+ ### dry-run mode (read-only review, no file changes)
89
102
 
90
- 当你想要 "只是反复审查,不修改文件"prompt 示例:
103
+ When you want "just review repeatedly, modify nothing", an example prompt:
91
104
 
92
105
  ```
93
106
  dry-run review this project, find all issues across all dimensions
94
107
  ```
95
108
 
96
- 插件会自动触发 iterate 工作流:
109
+ The plugin auto-triggers the iterate workflow:
97
110
 
98
- 1. `plan` → 读取配置,生成评审计划
99
- 2. `loop` → 每轮并行评审,只找新问题确定性聚合去重统计收敛无新问题则停止
100
- 3. `meta-review` → 审计报告一致性
101
- 4. `report` → 输出最终结果
111
+ 1. `plan` → read config, generate the review plan
112
+ 2. `loop` → review dimensions in parallel each round, only new findings deterministic aggregation / dedupe convergence stats stop when no new findings
113
+ 3. `meta-review` → audit report consistency
114
+ 4. `report` → output final result
102
115
 
103
- ### normal 模式(自治闭环迭代)
116
+ ### normal mode (autonomous closed-loop iteration)
104
117
 
105
- 当你想要 "iterate this project / fix the issues found"prompt 示例:
118
+ When you want "iterate this project / fix the issues found", an example prompt:
106
119
 
107
120
  ```
108
121
  iterate on this project, fix all atomic issues
109
122
  ```
110
123
 
111
- 工作流:
124
+ Workflow:
112
125
 
113
- 1. `plan` → 读取配置
114
- 2. `loop` → 并行评审聚合去重原子问题并行修复执行验证命令验证失败则回滚记录日志无新问题则停止
115
- 3. `report` → 输出修复统计
126
+ 1. `plan` → read config
127
+ 2. `loop` → parallel review aggregate / dedupe parallel atomic fixes run validation commands rollback on failure logstop when no new findings
128
+ 3. `report` → output fix statistics
116
129
 
117
- ## 项目配置
130
+ ## Project configuration
118
131
 
119
- 在项目根目录放 `iterate.config.yaml`:
132
+ Put `iterate.config.yaml` at the project root:
120
133
 
121
134
  ```yaml
122
- # 评审目标(例如 "提高代码质量,修复潜在bug,改善可维护性"
135
+ # Review goal (e.g. "Improve code quality of the project")
123
136
  goal: "Improve code quality of the project"
124
- # 评审维度(从本插件预定义维度选或自定义)
137
+ # Review dimensions (pick from the plugin's predefined set or customize)
125
138
  dimensions:
126
139
  - correctness
127
140
  - security
128
141
  - performance
129
142
  - maintainability
130
143
  - code-style
131
- # 最大评审轮次
144
+ # Max review rounds
132
145
  max_rounds: 3
133
- # 评审范围
146
+ # Review scope
134
147
  review:
135
- scope: full # full = 全项目,changed-only = 只看变更文件
136
- # 原子修复阈值(单次修复允许改动的最大行数,超过需 force
148
+ scope: full # full = whole project, changed-only = only changed files
149
+ # Atomic fix threshold (max lines a single fix may change; beyond requires force)
137
150
  atomic:
138
151
  max_lines: 20
139
- # 已知故意不修复的问题(评审会过滤掉,不再重复报告)
152
+ # Known intentionally-unfixed issues (filtered out, never re-reported)
140
153
  personalization:
141
154
  known_intentional:
142
155
  - file: src/example.ts
143
156
  line: 42
144
157
  dimension: security
145
158
  reason: "Intentional for demonstration"
146
- # 验证命令(修复后自动跑,结果记入日志)
159
+ # Validation commands (run after fixes; results logged)
147
160
  validation:
148
161
  commands:
149
162
  - npm test
150
163
  - npm run typecheck
151
164
  ```
152
165
 
153
- > 配置可通过 `iterate_config` 工具读取与**校验式局部写入**(自动备份,写入失败自动回滚)。
166
+ > The config can be read and **validated-partially-written** via `iterate_config` (auto backup, auto rollback on write failure).
154
167
 
155
- ## 注册工具(13 个)
168
+ ## Registered tools (13)
156
169
 
157
- | 工具 | 功能 |
158
- |------|------|
159
- | `iterate_config` | 读取 / 写入 `iterate.config.yaml`。`operation=read` 返回完整配置或指定 section;`operation=write` schema 校验、备份后局部合并写入,失败自动回滚 |
160
- | `iterate_validate` | 运行白名单验证命令,返回结果 |
161
- | `iterate_decision_log` | 追加决策日志(只追加,不改旧),存储于 `.iterate/decision-log.jsonl` |
162
- | `iterate_context` | 读取 `SKILL.md` / `ITERATE.md` 上下文 |
163
- | `iterate_review` | 确定性评审引擎:`plan` 生成计划,`aggregate` 聚合去重 + 收敛统计,`meta-review` 审计报告一致性。纯计算,不触碰文件系统 |
164
- | `iterate_triage` | 管理 `personalization.known_intentional`:`apply` 校验、去重(file\|dimension\|line)、备份后写回配置;`list` 读回当前条目。是浏览器分诊面板写回配置的唯一通道 |
165
- | `iterate_fix` | 应用**一个原子修复**:校验相对路径、备份原文件、按 `atomic.max_lines` 强制原子性(可 `force` 跳过)、写入新内容、记录 FixRecord `atomic_fix` 日志。normal 模式唯一合法的改文件入口 |
166
- | `iterate_diff` | 查看修复累积变更:指定 `file` 返回相对首个备份的 unified diff;省略则返回每个已修复文件的汇总 |
167
- | `iterate_rollback` | 回滚一个已应用的修复:从备份还原文件、从注册表移除该 FixRecord、追加 `revert` 日志。用于某轮验证失败后 |
168
- | `iterate_checkpoint` | 迭代断点:`save` 保存当前进度到 `.iterate/checkpoint.json`,`load` 读回,`clear` 清除。长迭代可中断续跑 |
169
- | `iterate_status` | 汇总当前迭代状态:模式、当前轮/总轮、已修复数、剩余 architectural、决策日志条数、是否存在 checkpoint |
170
- | `iterate_history` | 读取迭代历史(只读):决策日志条目(可按 `type` / `since` / `limit` 过滤,默认取最新 50 条,上限 200 条)+ 修复注册表汇总(各轮 fixed/failed 计数)。用于审查运行过程、审计日志、盘点修复 |
171
- | `iterate_prune` | 清理运行时产物:过期决策日志条目(按 `retainDays`,默认 30 天)、陈旧断点、孤儿修复备份、空轮次。默认 dry-run 只报告不删除;`dryRun:false` 才真正清理,每次清理写入决策日志 |
170
+ | Tool | Function |
171
+ | --- | --- |
172
+ | `iterate_config` | Read / write `iterate.config.yaml`. `operation=read` returns the full config or a named section; `operation=write` schema-validates, backs up, then merges and writes — auto rollback on failure |
173
+ | `iterate_validate` | Run a whitelisted validation command, return the result |
174
+ | `iterate_decision_log` | Append a decision log entry (append-only, never edits old ones), stored in `.iterate/decision-log.jsonl` |
175
+ | `iterate_context` | Read the `SKILL.md` / `ITERATE.md` context |
176
+ | `iterate_review` | Deterministic review engine: `plan` builds the plan, `aggregate` dedupes + converges, `meta-review` audits report consistency. Pure computation, no filesystem access |
177
+ | `iterate_triage` | Manage `personalization.known_intentional`: `apply` validates, dedupes (file\|dimension\|line), backs up and writes back to config; `list` reads back the current entries. The only channel for the browser triage panel to write back to config |
178
+ | `iterate_fix` | Apply **one atomic fix**: validates the relative path, backs up the original file, enforces atomicity via `atomic.max_lines` (skippable with `force`), writes new content, records a FixRecord and an `atomic_fix` log. The only legal file-modifying entry in normal mode |
179
+ | `iterate_diff` | View accumulated fix changes: with `file`, returns the unified diff against the first backup; without it, a per-fixed-file summary |
180
+ | `iterate_rollback` | Roll back an applied fix: restore the file from backup, remove that FixRecord from the registry, append a `revert` log. Used after a failed round validation |
181
+ | `iterate_checkpoint` | Iteration breakpoint: `save` persists progress to `.iterate/checkpoint.json`, `load` reads it back, `clear` removes it. Resumable interrupted long iterations |
182
+ | `iterate_status` | Summarize current iteration state: mode, current/last round, fixes applied, remaining architectural, decision-log entry count, whether a checkpoint exists |
183
+ | `iterate_history` | Read iteration history (read-only): decision-log entries (filter by `type` / `since` / `limit`, default latest 50, cap 200) + fix-registry summary (per-round fixed/failed counts). For auditing the run, tracing logs, and inventorying fixes |
184
+ | `iterate_prune` | Clean runtime artifacts: stale decision-log entries (by `retainDays`, default 30), stale checkpoints, orphaned fix backups, empty rounds. Dry-run by default (report-only); real cleanup with `dryRun:false`, each cleanup logged |
172
185
 
173
- ## 运行时产物布局
186
+ ## Runtime artifact layout
174
187
 
175
- 所有运行时状态都落在项目根目录的 `.iterate/` 下(可由 `.gitignore` 排除):
188
+ All runtime state lives under `.iterate/` at the project root (can be excluded via `.gitignore`):
176
189
 
177
190
  ```
178
191
  .iterate/
179
- decision-log.jsonl # 追加式决策日志(plan/review/fix/revert…)
180
- checkpoint.json # 迭代断点(断点续跑)
192
+ decision-log.jsonl # append-only decision log (plan/review/fix/revert…)
193
+ checkpoint.json # iteration breakpoint (resume)
181
194
  fixes/
182
- registry.json # 修复注册表(FixRecord 列表,按轮次组织)
183
- <fix-id>_<ts>.bak # 每次修复前的原文件备份
195
+ registry.json # fix registry (list of FixRecords, grouped by round)
196
+ <fix-id>_<ts>.bak # original file backup before each fix
184
197
  ```
185
198
 
186
- ## 设计
199
+ ## Design
187
200
 
188
- 插件遵循 dsh "everything-is-a-plugin" 架构:
201
+ The plugin follows dsh's "everything-is-a-plugin" architecture:
189
202
 
190
- - **只做两件事**:注入系统 prompt 教模型写 iterate workflow + 注册 13 个纯函数工具
191
- - **所有 orchestration 通过 dsh 原生 `workflow` + `agent` + `parallel` 完成**
192
- - **核心逻辑全部纯函数**(去重/过滤/排序/收敛/meta-audit/diff 计算/历史过滤/清理报告),可单元测试,无 I/O
193
- - **安全模型**:文件写入限定在解析后的项目根目录内(路径遍历防护);写文件前必备份,失败回滚;配置写入同样备份 + 回滚;`iterate_prune` 默认 dry-run、只清理 `.iterate/` 下产物、每次清理写日志;`iterate_fix` content 设字符上限、`iterate_triage` entries 设数量上限,防止异常超大负载
194
- - **UI 免构建**:`lib/client.js` `React.createElement` + 注入 `<style>` 标签,全部颜色走 `--dsw-*` 令牌,缺服务自动降级
195
- - 遵循 iterate 原技能的设计原则:确定性收敛,可审计,最小权限
203
+ - **Does exactly two things**: injects the system prompt teaching the model the iterate workflow + registers 13 pure-function tools
204
+ - **All orchestration runs through dsh native `workflow` + `agent` + `parallel`**
205
+ - **Core logic is entirely pure functions** (dedupe / filter / sort / converge / meta-audit / diff computation / history filtering / cleanup reporting) — unit-testable, no I/O
206
+ - **Security model**: file writes confined to the resolved project root (path-traversal protection); always back up before writing, roll back on failure; config writes also back up + roll back; `iterate_prune` is dry-run by default and only clears artifacts under `.iterate/` with every cleanup logged; `iterate_fix` caps content length and `iterate_triage` caps entry count to fend off abnormal oversized payloads
207
+ - **Build-free UI**: `lib/client.js` uses a `React.createElement` tree + injected `<style>` tags, all colors via `--dsw-*` tokens, degrading gracefully when a service is missing
208
+ - Follows the iterate skill's design principles: deterministic convergence, auditable, least privilege
196
209
 
197
- ## 运行测试
210
+ ## Running the tests
198
211
 
199
212
  ```bash
200
213
  cd harness/iterate-plugin
@@ -203,11 +216,11 @@ npm run typecheck
203
216
  npm test
204
217
  ```
205
218
 
206
- 所有测试通过:
219
+ All tests pass:
207
220
 
208
- - **212 个单元测试全绿**,类型检查通过
209
- - 覆盖:去重、过滤、排序、多轮收敛、meta-review 审计、路径安全、超时钳制、配置读写与回滚、triage 合并、diff 计算、checkpoint 校验、修复注册表、历史读取与过滤、prune 清理报告与 dry-run 语义、UI 纯函数(select-all 键、运行时状态指引)等
221
+ - **212 unit tests green**, type-check clean
222
+ - Coverage: dedupe, filter, sort, multi-round convergence, meta-review audit, path safety, timeout clamping, config read/write + rollback, triage merge, diff computation, checkpoint validation, fix registry, history read + filter, prune cleanup report + dry-run semantics, UI pure functions (select-all key, runtime status guide).
210
223
 
211
224
  ## License
212
225
 
213
- MIT
226
+ MIT
@@ -0,0 +1,226 @@
1
+ # iterate-plugin for DeepSeek Harness (dsh)
2
+
3
+ <p align="center">
4
+ <a href="README.md"><strong>English</strong></a> ·
5
+ <a href="README.zh-CN.md"><strong>简体中文</strong></a>
6
+ </p>
7
+
8
+ > **开发与评审在 [iterate-skill 主仓库](https://github.com/jingzhao-l/iterate-skill) 完成**:插件代码由主仓库统一维护,通过 `git subtree` 同步到本仓库;**版本发版与 npm 发布在本仓库(插件仓库)进行**,作为 dsh 生态的正式发布位。欢迎 **star / fork 主仓库** 并在 [主仓库 Issues](https://github.com/jingzhao-l/iterate-skill/issues) 反馈问题。
9
+
10
+ ## 这是什么 / About This Plugin
11
+
12
+ **iterate** 是一个让 AI 编程助手具备多轮自主代码审查与修复能力的开源项目。它解决很具体的痛点:
13
+
14
+ > AI 助手往往"说得多、做得浅":一次对话只改几行、看过一个文件就不再管全局,也很少回头复核自己改坏的东西。iterate 把这些收尾工作——逐项审查、分维度排查、修复、验证、再迭代——自动化,让 AI 真正像资深工程师一样把改动做完、做对。
15
+
16
+ `iterate-plugin` 是 [iterate](https://github.com/jingzhao-l/iterate-skill) 项目在 [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness) 桌面客户端中的落地插件。它把 iterate 的开环审查闭环(review → triage → fix → validate → 收敛)直接带进 dsh 的界面:提供**自治闭环代码迭代**(normal 模式)与 **dry-run 纯多轮审查**(只读)两种能力。
17
+
18
+ 除 13 个纯函数工具外,还内置一套**免构建的 Web UI 层**(分诊面板、收敛看板、统计卡片、主题皮肤等),直接挂在 dsh 客户端的既有 UI 槽位上。配置方式(`iterate.config.yaml` 与审查维度)与迭代生态的另外两个组件(技能 / 无头引擎)完全一致,迁移零成本。
19
+
20
+ ## 特性
21
+
22
+ ### 两种运行模式
23
+
24
+ | 功能 | dry-run 模式 | normal 模式 |
25
+ |------|-------------|------------|
26
+ | 多轮收敛反复审查 | ✅ | ✅ |
27
+ | 并行维度评审 | ✅ | ✅ |
28
+ | 确定性聚合去重/排序 | ✅ | ✅ |
29
+ | meta-review 报告一致性审计 | ✅ | ✅ |
30
+ | 零文件修改(只读) | ✅ | ❌ |
31
+ | 原子问题自动修复 | ❌ | ✅ |
32
+ | 每轮修复后验证 | ❌ | ✅ |
33
+ | 修复失败回滚 | ❌ | ✅ |
34
+ | 达标自停 | ✅ | ✅ |
35
+ | 只修改 atomic 问题,保留 architectural 留待后续 | ❌ | ✅ |
36
+ | 断点保存 / 恢复(长迭代续跑) | ✅ | ✅ |
37
+
38
+ ### 工具层
39
+
40
+ - **13 个注册工具**:`iterate_config` / `iterate_validate` / `iterate_decision_log` / `iterate_context` / `iterate_review` / `iterate_triage` / `iterate_fix` / `iterate_diff` / `iterate_rollback` / `iterate_checkpoint` / `iterate_status` / `iterate_history` / `iterate_prune`
41
+ - **findings 分诊闭环**:审查 → UI 分诊(y/n/a)→ `iterate_triage` 写回 `known_intentional` → 下一轮自动过滤
42
+ - **结构化修复系统**:每次修复先备份、写注册表、记录 diff,验证失败可 `iterate_rollback` 还原
43
+ - **断点续跑**:长迭代在每轮开头保存 checkpoint,中断后可恢复进度
44
+ - **历史审计**:`iterate_history` 读取决策日志(按类型/时间/数量过滤)与修复注册表汇总,审查运行过程与修复明细
45
+ - **运行时清理**:`iterate_prune` 清理过期的决策日志条目、陈旧断点、孤儿修复备份与空轮次;默认 dry-run 只报告不删除,显式 `dryRun:false` 才真正清理,每次清理写入决策日志
46
+ - **配置读写**:`iterate_config` 支持带校验、备份、回滚的局部写入
47
+
48
+ ### UI 层(客户端免构建槽位)
49
+
50
+ | UI 组件 | 挂载槽位 | 功能 |
51
+ |---------|---------|------|
52
+ | 收敛看板 `ConvergenceDashboard` | `conversation.input.dock` | 输入框上方实时显示轮次进度条、严重度统计、维度徽章、趋势迷你图,normal 模式另显示修复计数徽章 |
53
+ | Findings 分诊面板 `TriagePanel` | `conversation.chat.turnTail` | 逐条 y/n/a 判定,支持筛选、批量(含一键全选所有 findings)、键盘快捷键、localStorage 持久化、复制 YAML/应用指令 |
54
+ | 收敛统计卡片 `StatsCard` | `conversation.chat.turnTail` | 无 findings 时显示收敛统计、历史轮次表、趋势图、完成摘要 |
55
+ | iterate 主题皮肤 | `theme.overrideTokens` | 暖琥珀配色的 13 个 dsw token 覆盖,明暗双模式,可在设置页开关 |
56
+ | 进度胶囊 `ProgressCapsule` | `shell.overlay` | 每轮完成/收敛时右下角弹出通知(含收敛确认) |
57
+ | iterate 设置区 `SettingsPanel` | `settings.section` | 主题开关、分诊持久化说明、配置管理指引、运行时状态概览(产物布局 + 查看/清理工具指引)、一键清空分诊数据 |
58
+
59
+ UI 层为**防御式设计**:`slots` / `theme` / `React` 任一不可用时自动降级,不会崩溃客户端。
60
+
61
+ ## 安装
62
+
63
+ ### 从 npm 安装
64
+
65
+ ```bash
66
+ dsh plugin --profile web add iterate-plugin
67
+ # 或
68
+ pnpm add iterate-plugin
69
+ ```
70
+
71
+ ### 从 GitHub 安装(dsh 生态第三方安装方式)
72
+
73
+ dsh 官方支持从 GitHub 插件仓库直接安装:`dsh plugin --profile web add "github:owner/repo#ref"`(仓库根即插件,声明 `dsh.bundle` 后自动启用)。本插件在 [iterate-plugin 独立仓库](https://github.com/jingzhao-l/iterate-plugin) 维护仓库根即插件的发布位,由主仓库通过 `git subtree` 同步,内容与 npm 包一致:
74
+
75
+ ```bash
76
+ dsh plugin --profile web add "github:jingzhao-l/iterate-plugin#main"
77
+ ```
78
+
79
+ 安装完成后需重启 dsh 服务(建议 `dsh web --patch`)并刷新页面,宿主与客户端 UI 层才会加载。
80
+
81
+ ### 本地开发 / 源码挂载
82
+
83
+ ```bash
84
+ dsh plugin --profile web add /path/to/iterate-skill/harness/iterate-plugin
85
+ # 或
86
+ pnpm add /path/to/iterate-skill/harness/iterate-plugin
87
+ ```
88
+
89
+ 然后在你的 profile `cordis.patch.yml` 添加:
90
+
91
+ ```yaml
92
+ - insert:
93
+ - id: iterate-plugin
94
+ name: 'iterate-plugin'
95
+ ```
96
+
97
+ > 插件包自带 `dsh.bundle.patch`(即 `cordis.patch.yml`),npm 包内 `files` 已白名单化(`src` / `lib` / `dist` / `cordis.patch.yml` / `README.md` / `LICENSE`)。其中 `dist/` 为 TypeScript 服务端逻辑的编译产物,随包分发以兼容 dsh 的 `github:owner/repo#ref` git-clone 安装方式(Node 不擦除 `node_modules` 下的 TS 类型)。
98
+
99
+ ## 使用
100
+
101
+ ### dry-run 模式(纯反复审查,不修改文件)
102
+
103
+ 当你想要 "只是反复审查,不修改文件",prompt 示例:
104
+
105
+ ```
106
+ dry-run review this project, find all issues across all dimensions
107
+ ```
108
+
109
+ 插件会自动触发 iterate 工作流:
110
+
111
+ 1. `plan` → 读取配置,生成评审计划
112
+ 2. `loop` → 每轮并行评审,只找新问题 → 确定性聚合去重 → 统计收敛 → 无新问题则停止
113
+ 3. `meta-review` → 审计报告一致性
114
+ 4. `report` → 输出最终结果
115
+
116
+ ### normal 模式(自治闭环迭代)
117
+
118
+ 当你想要 "iterate this project / fix the issues found",prompt 示例:
119
+
120
+ ```
121
+ iterate on this project, fix all atomic issues
122
+ ```
123
+
124
+ 工作流:
125
+
126
+ 1. `plan` → 读取配置
127
+ 2. `loop` → 并行评审 → 聚合去重 → 原子问题并行修复 → 执行验证命令 → 验证失败则回滚 → 记录日志 → 无新问题则停止
128
+ 3. `report` → 输出修复统计
129
+
130
+ ## 项目配置
131
+
132
+ 在项目根目录放 `iterate.config.yaml`:
133
+
134
+ ```yaml
135
+ # 评审目标(例如 "提高代码质量,修复潜在bug,改善可维护性")
136
+ goal: "Improve code quality of the project"
137
+ # 评审维度(从本插件预定义维度选或自定义)
138
+ dimensions:
139
+ - correctness
140
+ - security
141
+ - performance
142
+ - maintainability
143
+ - code-style
144
+ # 最大评审轮次
145
+ max_rounds: 3
146
+ # 评审范围
147
+ review:
148
+ scope: full # full = 全项目,changed-only = 只看变更文件
149
+ # 原子修复阈值(单次修复允许改动的最大行数,超过需 force)
150
+ atomic:
151
+ max_lines: 20
152
+ # 已知故意不修复的问题(评审会过滤掉,不再重复报告)
153
+ personalization:
154
+ known_intentional:
155
+ - file: src/example.ts
156
+ line: 42
157
+ dimension: security
158
+ reason: "Intentional for demonstration"
159
+ # 验证命令(修复后自动跑,结果记入日志)
160
+ validation:
161
+ commands:
162
+ - npm test
163
+ - npm run typecheck
164
+ ```
165
+
166
+ > 配置可通过 `iterate_config` 工具读取与**校验式局部写入**(自动备份,写入失败自动回滚)。
167
+
168
+ ## 注册工具(13 个)
169
+
170
+ | 工具 | 功能 |
171
+ |------|------|
172
+ | `iterate_config` | 读取 / 写入 `iterate.config.yaml`。`operation=read` 返回完整配置或指定 section;`operation=write` 做 schema 校验、备份后局部合并写入,失败自动回滚 |
173
+ | `iterate_validate` | 运行白名单验证命令,返回结果 |
174
+ | `iterate_decision_log` | 追加决策日志(只追加,不改旧),存储于 `.iterate/decision-log.jsonl` |
175
+ | `iterate_context` | 读取 `SKILL.md` / `ITERATE.md` 上下文 |
176
+ | `iterate_review` | 确定性评审引擎:`plan` 生成计划,`aggregate` 聚合去重 + 收敛统计,`meta-review` 审计报告一致性。纯计算,不触碰文件系统 |
177
+ | `iterate_triage` | 管理 `personalization.known_intentional`:`apply` 校验、去重(file\|dimension\|line)、备份后写回配置;`list` 读回当前条目。是浏览器分诊面板写回配置的唯一通道 |
178
+ | `iterate_fix` | 应用**一个原子修复**:校验相对路径、备份原文件、按 `atomic.max_lines` 强制原子性(可 `force` 跳过)、写入新内容、记录 FixRecord 与 `atomic_fix` 日志。normal 模式唯一合法的改文件入口 |
179
+ | `iterate_diff` | 查看修复累积变更:指定 `file` 返回相对首个备份的 unified diff;省略则返回每个已修复文件的汇总 |
180
+ | `iterate_rollback` | 回滚一个已应用的修复:从备份还原文件、从注册表移除该 FixRecord、追加 `revert` 日志。用于某轮验证失败后 |
181
+ | `iterate_checkpoint` | 迭代断点:`save` 保存当前进度到 `.iterate/checkpoint.json`,`load` 读回,`clear` 清除。长迭代可中断续跑 |
182
+ | `iterate_status` | 汇总当前迭代状态:模式、当前轮/总轮、已修复数、剩余 architectural、决策日志条数、是否存在 checkpoint |
183
+ | `iterate_history` | 读取迭代历史(只读):决策日志条目(可按 `type` / `since` / `limit` 过滤,默认取最新 50 条,上限 200 条)+ 修复注册表汇总(各轮 fixed/failed 计数)。用于审查运行过程、审计日志、盘点修复 |
184
+ | `iterate_prune` | 清理运行时产物:过期决策日志条目(按 `retainDays`,默认 30 天)、陈旧断点、孤儿修复备份、空轮次。默认 dry-run 只报告不删除;`dryRun:false` 才真正清理,每次清理写入决策日志 |
185
+
186
+ ## 运行时产物布局
187
+
188
+ 所有运行时状态都落在项目根目录的 `.iterate/` 下(可由 `.gitignore` 排除):
189
+
190
+ ```
191
+ .iterate/
192
+ decision-log.jsonl # 追加式决策日志(plan/review/fix/revert…)
193
+ checkpoint.json # 迭代断点(断点续跑)
194
+ fixes/
195
+ registry.json # 修复注册表(FixRecord 列表,按轮次组织)
196
+ <fix-id>_<ts>.bak # 每次修复前的原文件备份
197
+ ```
198
+
199
+ ## 设计
200
+
201
+ 插件遵循 dsh "everything-is-a-plugin" 架构:
202
+
203
+ - **只做两件事**:注入系统 prompt 教模型写 iterate workflow + 注册 13 个纯函数工具
204
+ - **所有 orchestration 通过 dsh 原生 `workflow` + `agent` + `parallel` 完成**
205
+ - **核心逻辑全部纯函数**(去重/过滤/排序/收敛/meta-audit/diff 计算/历史过滤/清理报告),可单元测试,无 I/O
206
+ - **安全模型**:文件写入限定在解析后的项目根目录内(路径遍历防护);写文件前必备份,失败回滚;配置写入同样备份 + 回滚;`iterate_prune` 默认 dry-run、只清理 `.iterate/` 下产物、每次清理写日志;`iterate_fix` 对 content 设字符上限、`iterate_triage` 对 entries 设数量上限,防止异常超大负载
207
+ - **UI 免构建**:`lib/client.js` 用 `React.createElement` 树 + 注入 `<style>` 标签,全部颜色走 `--dsw-*` 令牌,缺服务自动降级
208
+ - 遵循 iterate 原技能的设计原则:确定性收敛,可审计,最小权限
209
+
210
+ ## 运行测试
211
+
212
+ ```bash
213
+ cd harness/iterate-plugin
214
+ npm install
215
+ npm run typecheck
216
+ npm test
217
+ ```
218
+
219
+ 所有测试通过:
220
+
221
+ - **212 个单元测试全绿**,类型检查通过
222
+ - 覆盖:去重、过滤、排序、多轮收敛、meta-review 审计、路径安全、超时钳制、配置读写与回滚、triage 合并、diff 计算、checkpoint 校验、修复注册表、历史读取与过滤、prune 清理报告与 dry-run 语义、UI 纯函数(select-all 键、运行时状态指引)等
223
+
224
+ ## License
225
+
226
+ MIT
package/dist/index.js CHANGED
@@ -2,11 +2,13 @@
2
2
  * iterate-plugin — dsh plugin for the iterate autonomous closed-loop workflow
3
3
  *
4
4
  * Architecture:
5
- * - The plugin registers 6 tools (config, validate, decision-log, context, review, triage)
5
+ * - The plugin registers 13 tools (config, validate, decision-log, context, review,
6
+ * triage, fix, diff, rollback, checkpoint, status, history, prune)
6
7
  * - The plugin injects a system prompt section teaching the iterate workflow pattern
7
8
  * - The model (prompted by the skill) writes a workflow script using dsh's `workflow` tool
8
9
  * - The workflow script uses `agent()` / `parallel()` / `phase()` / `log()` to orchestrate
9
- * - Subagents use the 6 tools to do real work (read config, run validation, log decisions, review, triage)
10
+ * - Subagents use the 13 tools to do real work (read config, run validation, log decisions,
11
+ * review, triage, apply/rollback/fixing, checkpoint, status, history, prune)
10
12
  *
11
13
  * Tool invocation model:
12
14
  * - Workflow script CANNOT call tools directly (sandboxed vm, no Node API)
@@ -16,7 +18,7 @@
16
18
  *
17
19
  * Key files:
18
20
  * - src/index.ts — Plugin entry: register tools + inject skill prompt
19
- * - src/tools/ — 6 tool implementations + meta-review/review engines
21
+ * - src/tools/ — 13 tool implementations + meta-review/review engines
20
22
  * - src/config-loader.ts — YAML config loading
21
23
  * - src/types.ts — Shared types
22
24
  */
@@ -34,7 +36,7 @@ import { ITERATE_SKILL_PROMPT } from "./skill-prompt.js";
34
36
  export const name = 'iterate-plugin';
35
37
  export const inject = ['tools', 'systemPrompt'];
36
38
  export function apply(ctx) {
37
- // 1. Register the 11 tools
39
+ // 1. Register the 13 tools
38
40
  registerConfigTool(ctx);
39
41
  registerValidateTool(ctx);
40
42
  registerDecisionLogTool(ctx);
package/dist/review.js CHANGED
@@ -208,6 +208,11 @@ export function buildReviewReport(input) {
208
208
  const lastRound = filteredRounds.length > 0 ? filteredRounds[filteredRounds.length - 1].round : 0;
209
209
  const lastRoundCount = lastRound > 0 ? (findingsByRound[lastRound - 1] ?? 0) : 0;
210
210
  const converged = filteredRounds.length > 0 && lastRoundCount === 0;
211
+ // Attach the normal-mode fix count to the summary (dry-run leaves it absent).
212
+ const computed = summarize(sorted);
213
+ if (input.mode === 'normal' && typeof input.fixedCount === 'number' && Number.isInteger(input.fixedCount)) {
214
+ computed.fixedCount = input.fixedCount;
215
+ }
211
216
  return {
212
217
  mode: input.mode,
213
218
  goal: input.goal,
@@ -225,7 +230,7 @@ export function buildReviewReport(input) {
225
230
  ? 'converged'
226
231
  : 'max_rounds_reached',
227
232
  },
228
- summary: summarize(sorted),
233
+ summary: computed,
229
234
  };
230
235
  }
231
236
  /**