dsh-patch-edit-plus 0.4.7 → 0.4.8
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/CHANGELOG.de.md +63 -0
- package/CHANGELOG.es.md +63 -0
- package/CHANGELOG.fr.md +63 -0
- package/CHANGELOG.it.md +63 -0
- package/CHANGELOG.ja.md +68 -0
- package/CHANGELOG.ko.md +68 -0
- package/CHANGELOG.md +13 -0
- package/CHANGELOG.ru.md +63 -0
- package/CHANGELOG.zh.md +13 -0
- package/INSTALL.de.md +179 -0
- package/INSTALL.es.md +179 -0
- package/INSTALL.fr.md +179 -0
- package/INSTALL.it.md +179 -0
- package/INSTALL.ja.md +179 -0
- package/INSTALL.ko.md +179 -0
- package/INSTALL.md +179 -0
- package/INSTALL.ru.md +179 -0
- package/INSTALL.zh.md +179 -0
- package/README.md +6 -5
- package/README.zh.md +6 -5
- package/dsh.plugin.json +1 -1
- package/lib/config.js +2 -0
- package/lib/guidance.js +115 -0
- package/lib/index.js +17 -1
- package/lib/register.js +7 -2
- package/lib/tool.js +6 -10
- package/lib/types/config.d.ts +14 -0
- package/lib/types/guidance.d.ts +55 -0
- package/lib/types/register.d.ts +4 -1
- package/lib/types/tool.d.ts +4 -4
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/it.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/ko.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +26 -1
package/INSTALL.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Installation Guide (Official DSH CLI)
|
|
2
|
+
|
|
3
|
+
This guide uses only the official DSH `dsh plugin` command. That command installs the dependency into a profile and synchronizes `dsh.profile.bundles`. Do not replace it with plain `npm install`, a direct `pnpm add` in the profile, or manual edits to the profile manifest.
|
|
4
|
+
|
|
5
|
+
- [English installation guide](./INSTALL.md)
|
|
6
|
+
- [中文安装指南](./INSTALL.zh.md)
|
|
7
|
+
- [日本語インストールガイド](./INSTALL.ja.md)
|
|
8
|
+
- [한국어 설치 안내](./INSTALL.ko.md)
|
|
9
|
+
- [French installation guide](./INSTALL.fr.md)
|
|
10
|
+
- [German installation guide](./INSTALL.de.md)
|
|
11
|
+
- [Italian installation guide](./INSTALL.it.md)
|
|
12
|
+
- [Russian installation guide](./INSTALL.ru.md)
|
|
13
|
+
- [Spanish installation guide](./INSTALL.es.md)
|
|
14
|
+
- [English README](./README.md)
|
|
15
|
+
- [中文 README](./README.zh.md)
|
|
16
|
+
- [日本語 README](./README.ja.md)
|
|
17
|
+
- [한국어 README](./README.ko.md)
|
|
18
|
+
- [French README](./README.fr.md)
|
|
19
|
+
- [German README](./README.de.md)
|
|
20
|
+
- [Italian README](./README.it.md)
|
|
21
|
+
- [Russian README](./README.ru.md)
|
|
22
|
+
- [Spanish README](./README.es.md)
|
|
23
|
+
- [Changelog](./CHANGELOG.md)
|
|
24
|
+
- [日本語 changelog](./CHANGELOG.ja.md)
|
|
25
|
+
- [한국어 changelog](./CHANGELOG.ko.md)
|
|
26
|
+
- [French changelog](./CHANGELOG.fr.md)
|
|
27
|
+
- [German changelog](./CHANGELOG.de.md)
|
|
28
|
+
- [Italian changelog](./CHANGELOG.it.md)
|
|
29
|
+
- [Russian changelog](./CHANGELOG.ru.md)
|
|
30
|
+
- [Spanish changelog](./CHANGELOG.es.md)
|
|
31
|
+
|
|
32
|
+
The placeholders in this guide are:
|
|
33
|
+
|
|
34
|
+
- `<profile>`: the DSH profile to modify, usually `web`;
|
|
35
|
+
- `dsh-patch-edit-plus`: the npm package, the runtime plugin ID, and the id of the single row the bundle patch inserts.
|
|
36
|
+
|
|
37
|
+
> **Supported DSH range: `>=0.1.0-rc.8` through `0.2.0-rc.2` (incl. desktop) — a single release, v0.4.0.**
|
|
38
|
+
>
|
|
39
|
+
> Check the running version with `dsh --version` first.
|
|
40
|
+
>
|
|
41
|
+
> | DSH version | Status | Notes |
|
|
42
|
+
> | --- | --- | --- |
|
|
43
|
+
> | `0.2.0-rc.1` ~ `0.2.0-rc.2` (incl. desktop) | supported | Same v0.4.0. |
|
|
44
|
+
> | `0.1.0-rc.8` ~ `0.1.7-rc.2` | supported | Same v0.4.0 — no branch or dist-tag selection is needed. |
|
|
45
|
+
>
|
|
46
|
+
> Install `latest` on any supported host line: one version serves 0.1.x and 0.2.x alike. After publishing, the dist-tags `latest`, `dsh-0.2.0`, `dsh-0.1.7`, `dsh-0.1.5` and `dsh-0.1.2` all point to 0.4.0.
|
|
47
|
+
|
|
48
|
+
## 0. Prerequisites and profile discovery
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
echo "DSH_HOME=${DSH_HOME:-$HOME/.dsh}"
|
|
52
|
+
dsh --version
|
|
53
|
+
ls "${DSH_HOME:-$HOME/.dsh}/profiles"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use the profile named by your running DSH process. `web` is common, but the active `--profile` argument is authoritative.
|
|
57
|
+
|
|
58
|
+
## 1. Official installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
dsh plugin --profile <profile> add dsh-patch-edit-plus -w
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(the `-w` flag is required when the profile is a pnpm workspace root, as `web` is.)
|
|
65
|
+
|
|
66
|
+
Install a specific version explicitly:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
dsh plugin --profile <profile> add dsh-patch-edit-plus@0.4.0 -w
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The official CLI updates the profile dependency, the lockfile, and `dsh.profile.bundles` automatically. Do not add a manual YAML row.
|
|
73
|
+
|
|
74
|
+
### Supply-chain cooling period
|
|
75
|
+
|
|
76
|
+
The DSH runtime uses pnpm 11, whose `minimumReleaseAge` policy may block a freshly published version with `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`. Add the version to `minimumReleaseAgeExclude` in `~/.dsh/profiles/<profile>/pnpm-workspace.yaml`:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
minimumReleaseAgeExclude:
|
|
80
|
+
- dsh-patch-edit-plus@0.4.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 2. Restart the host
|
|
84
|
+
|
|
85
|
+
This is a **host-only** plugin: it registers a tool and a settings section on the host, and ships no browser half. Restart the DSH host process after installing or upgrading; refreshing the page is neither required nor sufficient.
|
|
86
|
+
|
|
87
|
+
## 3. Upgrade
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
dsh plugin --profile <profile> update dsh-patch-edit-plus -w
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Restart DSH afterwards.
|
|
94
|
+
|
|
95
|
+
## 4. Local-path / `link:` registration (alternative)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# ~/.dsh/profiles/<profile>/package.json dependencies:
|
|
99
|
+
# "dsh-patch-edit-plus": "link:<absolute path to dsh-patch-edit-plus>"
|
|
100
|
+
# ~/.dsh/profiles/<profile>/cordis.patch.yml:
|
|
101
|
+
# - insert:
|
|
102
|
+
# - id: dsh-patch-edit-plus
|
|
103
|
+
# name: dsh-patch-edit-plus
|
|
104
|
+
cd ~/.dsh/profiles/<profile> && pnpm install && dsh web
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Or use the official CLI with a local path (no network needed):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
dsh plugin --profile <profile> add /absolute/path/to/dsh-patch-edit-plus -w
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Building from a source checkout uses these scripts:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install
|
|
117
|
+
npm run build # tsc -p tsconfig.build.json → lib/ + lib/types/
|
|
118
|
+
npm run typecheck # tsc -p tsconfig.json
|
|
119
|
+
npm run verify:source # source-level assertions
|
|
120
|
+
npm run test # vitest run
|
|
121
|
+
npm run smoke # _smoke/load-smoke.mjs
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`lib/` is not committed, so a source checkout must be built before it can be registered by path. Publishing builds it automatically through the `prepublishOnly` hook, so a published tarball always contains compiled output.
|
|
125
|
+
|
|
126
|
+
## 5. Verify installation
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
grep -n "dsh-patch-edit-plus" \
|
|
130
|
+
"${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/package.json"
|
|
131
|
+
node -p "require('${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/node_modules/dsh-patch-edit-plus/package.json').version"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Check the official composition:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
dsh --profile <profile> --dump-default-config
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
It must contain:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
- id: dsh-patch-edit-plus
|
|
144
|
+
name: dsh-patch-edit-plus
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 6. Verify the plugin
|
|
148
|
+
|
|
149
|
+
After the restart, confirm in a session:
|
|
150
|
+
|
|
151
|
+
1. The `apply_patch` tool is available to the model.
|
|
152
|
+
2. A unified-diff patch applies, and the file content matches the diff exactly.
|
|
153
|
+
3. A patch that fails verification leaves the workspace untouched — the engine verifies everything read-only before it writes anything.
|
|
154
|
+
4. A Codex-style patch while `allowCodexPatch` is off returns an actionable hint telling the model how to enable the style or retry in unified diff, rather than a generic parse error.
|
|
155
|
+
|
|
156
|
+
If another plugin already provides a tool named `apply_patch`, the three-layer conflict policy (`rename` by default, or `skip` / `fail`) decides the outcome. With the default `rename`, DSH startup is unaffected and the tool is registered under a suffixed name.
|
|
157
|
+
|
|
158
|
+
## 7. Troubleshooting
|
|
159
|
+
|
|
160
|
+
| Symptom | Action |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| `dsh` is not found | Install or enable the official DSH CLI. |
|
|
163
|
+
| `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` | Add the version to `minimumReleaseAgeExclude` in the profile's `pnpm-workspace.yaml`. |
|
|
164
|
+
| `apply_patch` does not appear | Restart the host process and re-check the composition row. |
|
|
165
|
+
| Tool name clash with another `apply_patch` provider | Set the conflict policy to `rename` (default), `skip`, or `fail` per the README. |
|
|
166
|
+
| Codex syntax rejected | Enable `allowCodexPatch: true`, or resend the change as a unified diff. |
|
|
167
|
+
| Hunk mismatch | Read the four-element diagnostic (file + hunk index, search origin, expected preview, actual excerpt) and re-emit the hunk with matching context. |
|
|
168
|
+
|
|
169
|
+
## 8. Remove
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
dsh plugin --profile <profile> remove dsh-patch-edit-plus
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Restart DSH afterwards.
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
package/INSTALL.ru.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Руководство по установке (официальный DSH CLI)
|
|
2
|
+
|
|
3
|
+
В этом руководстве используется только официальная команда DSH `dsh plugin`. Она устанавливает зависимость в профиль и синхронизирует `dsh.profile.bundles`. Не заменяйте её простым `npm install`, прямым `pnpm add` в профиле или ручными правками манифеста профиля.
|
|
4
|
+
|
|
5
|
+
- [Руководство по установке на английском](./INSTALL.md)
|
|
6
|
+
- [Руководство по установке на китайском](./INSTALL.zh.md)
|
|
7
|
+
- [Руководство по установке на японском](./INSTALL.ja.md)
|
|
8
|
+
- [Руководство по установке на корейском](./INSTALL.ko.md)
|
|
9
|
+
- [Руководство по установке на русском](./INSTALL.ru.md)
|
|
10
|
+
- [Руководство по установке на французском](./INSTALL.fr.md)
|
|
11
|
+
- [Руководство по установке на немецком](./INSTALL.de.md)
|
|
12
|
+
- [Руководство по установке на итальянском](./INSTALL.it.md)
|
|
13
|
+
- [Руководство по установке на испанском](./INSTALL.es.md)
|
|
14
|
+
- [README на английском](./README.md)
|
|
15
|
+
- [README на китайском](./README.zh.md)
|
|
16
|
+
- [README на японском](./README.ja.md)
|
|
17
|
+
- [README на корейском](./README.ko.md)
|
|
18
|
+
- [README на русском](./README.ru.md)
|
|
19
|
+
- [README на французском](./README.fr.md)
|
|
20
|
+
- [README на немецком](./README.de.md)
|
|
21
|
+
- [README на итальянском](./README.it.md)
|
|
22
|
+
- [README на испанском](./README.es.md)
|
|
23
|
+
- [История изменений](./CHANGELOG.md)
|
|
24
|
+
- [История изменений на японском](./CHANGELOG.ja.md)
|
|
25
|
+
- [История изменений на корейском](./CHANGELOG.ko.md)
|
|
26
|
+
- [История изменений на русском](./CHANGELOG.ru.md)
|
|
27
|
+
- [История изменений на французском](./CHANGELOG.fr.md)
|
|
28
|
+
- [История изменений на немецком](./CHANGELOG.de.md)
|
|
29
|
+
- [История изменений на итальянском](./CHANGELOG.it.md)
|
|
30
|
+
- [История изменений на испанском](./CHANGELOG.es.md)
|
|
31
|
+
|
|
32
|
+
Заполнители в этом руководстве:
|
|
33
|
+
|
|
34
|
+
- `<profile>`: изменяемый профиль DSH, обычно `web`;
|
|
35
|
+
- `dsh-patch-edit-plus`: npm-пакет, ID плагина во время выполнения и id единственной строки, которую вставляет патч бандла.
|
|
36
|
+
|
|
37
|
+
> **Поддерживаемый диапазон DSH: от `0.1.0-rc.8` до `0.2.0-rc.2` (включая desktop) — единая версия v0.4.0.**
|
|
38
|
+
>
|
|
39
|
+
> Сначала проверьте запущенную версию командой `dsh --version`.
|
|
40
|
+
>
|
|
41
|
+
> | Версия DSH | Статус | Примечания |
|
|
42
|
+
> | --- | --- | --- |
|
|
43
|
+
> | `0.2.0-rc.1` ~ `0.2.0-rc.2` (включая desktop) | поддерживается | Та же v0.4.0. |
|
|
44
|
+
> | `0.1.0-rc.8` ~ `0.1.7-rc.2` | поддерживается | Та же v0.4.0 — выбирать ветку или dist-tag не нужно. |
|
|
45
|
+
>
|
|
46
|
+
> На любой поддерживаемой линии хостов устанавливайте `latest`: одна версия обслуживает и 0.1.x, и 0.2.x. После публикации dist-tag'и `latest`, `dsh-0.2.0`, `dsh-0.1.7`, `dsh-0.1.5` и `dsh-0.1.2` будут указывать на 0.4.0.
|
|
47
|
+
|
|
48
|
+
## 0. Предварительные требования и обнаружение профиля
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
echo "DSH_HOME=${DSH_HOME:-$HOME/.dsh}"
|
|
52
|
+
dsh --version
|
|
53
|
+
ls "${DSH_HOME:-$HOME/.dsh}/profiles"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Используйте профиль, названный вашим запущенным процессом DSH. `web` — распространённое имя, но определяющим является активный аргумент `--profile`.
|
|
57
|
+
|
|
58
|
+
## 1. Официальная установка
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
dsh plugin --profile <profile> add dsh-patch-edit-plus -w
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(флаг `-w` обязателен, когда профиль является корнем pnpm-workspace, как в случае с `web`.)
|
|
65
|
+
|
|
66
|
+
Явная установка конкретной версии:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
dsh plugin --profile <profile> add dsh-patch-edit-plus@0.4.0 -w
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Официальная CLI автоматически обновляет зависимость профиля, lock-файл и `dsh.profile.bundles`. Не добавляйте строку YAML вручную.
|
|
73
|
+
|
|
74
|
+
### Период охлаждения цепочки поставок
|
|
75
|
+
|
|
76
|
+
Среда выполнения DSH использует pnpm 11, политика которого `minimumReleaseAge` может заблокировать только что опубликованную версию с ошибкой `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`. Добавьте версию в `minimumReleaseAgeExclude` в `~/.dsh/profiles/<profile>/pnpm-workspace.yaml`:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
minimumReleaseAgeExclude:
|
|
80
|
+
- dsh-patch-edit-plus@0.4.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 2. Перезапустите хост
|
|
84
|
+
|
|
85
|
+
Это плагин **только для хоста**: он регистрирует инструмент и секцию настроек на хосте и не содержит браузерной части. После установки или обновления перезапустите процесс хоста DSH; обновление страницы не требуется и не помогает.
|
|
86
|
+
|
|
87
|
+
## 3. Обновление
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
dsh plugin --profile <profile> update dsh-patch-edit-plus -w
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
После этого перезапустите DSH.
|
|
94
|
+
|
|
95
|
+
## 4. Регистрация по локальному пути / `link:` (альтернатива)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# ~/.dsh/profiles/<profile>/package.json dependencies:
|
|
99
|
+
# "dsh-patch-edit-plus": "link:<absolute path to dsh-patch-edit-plus>"
|
|
100
|
+
# ~/.dsh/profiles/<profile>/cordis.patch.yml:
|
|
101
|
+
# - insert:
|
|
102
|
+
# - id: dsh-patch-edit-plus
|
|
103
|
+
# name: dsh-patch-edit-plus
|
|
104
|
+
cd ~/.dsh/profiles/<profile> && pnpm install && dsh web
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Либо используйте официальную CLI с локальным путём (сеть не нужна):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
dsh plugin --profile <profile> add /absolute/path/to/dsh-patch-edit-plus -w
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Сборка из исходного чекаута использует эти скрипты:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install
|
|
117
|
+
npm run build # tsc -p tsconfig.build.json → lib/ + lib/types/
|
|
118
|
+
npm run typecheck # tsc -p tsconfig.json
|
|
119
|
+
npm run verify:source # source-level assertions
|
|
120
|
+
npm run test # vitest run
|
|
121
|
+
npm run smoke # _smoke/load-smoke.mjs
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`lib/` не коммитится, поэтому исходный чекаут нужно собрать, прежде чем регистрировать его по пути. При публикации сборка выполняется автоматически хуком `prepublishOnly`, так что опубликованный tarball всегда содержит скомпилированный вывод.
|
|
125
|
+
|
|
126
|
+
## 5. Проверка установки
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
grep -n "dsh-patch-edit-plus" \
|
|
130
|
+
"${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/package.json"
|
|
131
|
+
node -p "require('${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/node_modules/dsh-patch-edit-plus/package.json').version"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Проверьте официальную композицию:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
dsh --profile <profile> --dump-default-config
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Она должна содержать:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
- id: dsh-patch-edit-plus
|
|
144
|
+
name: dsh-patch-edit-plus
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 6. Проверка плагина
|
|
148
|
+
|
|
149
|
+
После перезапуска подтвердите в сессии:
|
|
150
|
+
|
|
151
|
+
1. Инструмент `apply_patch` доступен модели.
|
|
152
|
+
2. Патч в виде unified diff применяется, и содержимое файла в точности совпадает с диффом.
|
|
153
|
+
3. Патч, не прошедший проверку, оставляет рабочую область нетронутой — движок проверяет всё в режиме только чтение, прежде чем что-либо записывать.
|
|
154
|
+
4. Патч в стиле Codex при выключенном `allowCodexPatch` возвращает действенную подсказку, объясняющую модели, как включить этот стиль или повторить попытку в unified diff, а не общую ошибку разбора.
|
|
155
|
+
|
|
156
|
+
Если другой плагин уже предоставляет инструмент с именем `apply_patch`, исход определяет трёхуровневая политика конфликтов (`rename` по умолчанию, либо `skip` / `fail`). При значении по умолчанию `rename` запуск DSH не страдает, а инструмент регистрируется под именем с суффиксом.
|
|
157
|
+
|
|
158
|
+
## 7. Устранение неполадок
|
|
159
|
+
|
|
160
|
+
| Симптом | Действие |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| `dsh` не найден | Установите или включите официальную CLI DSH. |
|
|
163
|
+
| `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` | Добавьте версию в `minimumReleaseAgeExclude` в `pnpm-workspace.yaml` профиля. |
|
|
164
|
+
| `apply_patch` не появляется | Перезапустите процесс хоста и снова проверьте строку композиции. |
|
|
165
|
+
| Конфликт имени инструмента с другим провайдером `apply_patch` | Установите политику конфликтов в `rename` (по умолчанию), `skip` или `fail`, см. README. |
|
|
166
|
+
| Синтаксис Codex отклонён | Включите `allowCodexPatch: true` или отправьте изменение заново в виде unified diff. |
|
|
167
|
+
| Несовпадение хунка | Прочтите четырёхэлементную диагностику (файл + индекс хунка, начало поиска, ожидаемое превью, фактический фрагмент) и заново отправьте хунк с совпадающим контекстом. |
|
|
168
|
+
|
|
169
|
+
## 8. Удаление
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
dsh plugin --profile <profile> remove dsh-patch-edit-plus
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
После этого перезапустите DSH.
|
|
176
|
+
|
|
177
|
+
## Лицензия
|
|
178
|
+
|
|
179
|
+
MIT
|
package/INSTALL.zh.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# 安装指南(官方 DSH CLI)
|
|
2
|
+
|
|
3
|
+
本指南只使用官方 `dsh plugin` 命令。该命令会把依赖装入 profile 并同步 `dsh.profile.bundles`。请勿改用裸 `npm install`、在 profile 里直接 `pnpm add`,或手工编辑 profile 清单。
|
|
4
|
+
|
|
5
|
+
- [English installation guide](./INSTALL.md)
|
|
6
|
+
- [中文安装指南](./INSTALL.zh.md)
|
|
7
|
+
- [日本語インストールガイド](./INSTALL.ja.md)
|
|
8
|
+
- [한국어 설치 안내](./INSTALL.ko.md)
|
|
9
|
+
- [法语安装指南](./INSTALL.fr.md)
|
|
10
|
+
- [德语安装指南](./INSTALL.de.md)
|
|
11
|
+
- [意大利语安装指南](./INSTALL.it.md)
|
|
12
|
+
- [俄语安装指南](./INSTALL.ru.md)
|
|
13
|
+
- [西班牙语安装指南](./INSTALL.es.md)
|
|
14
|
+
- [English README](./README.md)
|
|
15
|
+
- [中文 README](./README.zh.md)
|
|
16
|
+
- [日本語 README](./README.ja.md)
|
|
17
|
+
- [한국어 README](./README.ko.md)
|
|
18
|
+
- [法语 README](./README.fr.md)
|
|
19
|
+
- [德语 README](./README.de.md)
|
|
20
|
+
- [意大利语 README](./README.it.md)
|
|
21
|
+
- [俄语 README](./README.ru.md)
|
|
22
|
+
- [西班牙语 README](./README.es.md)
|
|
23
|
+
- [Changelog](./CHANGELOG.md)
|
|
24
|
+
- [日本語 changelog](./CHANGELOG.ja.md)
|
|
25
|
+
- [한국어 changelog](./CHANGELOG.ko.md)
|
|
26
|
+
- [法语 changelog](./CHANGELOG.fr.md)
|
|
27
|
+
- [德语 changelog](./CHANGELOG.de.md)
|
|
28
|
+
- [意大利语 changelog](./CHANGELOG.it.md)
|
|
29
|
+
- [俄语 changelog](./CHANGELOG.ru.md)
|
|
30
|
+
- [西班牙语 changelog](./CHANGELOG.es.md)
|
|
31
|
+
|
|
32
|
+
本指南中的占位符:
|
|
33
|
+
|
|
34
|
+
- `<profile>`:要改动的 DSH profile,通常是 `web`;
|
|
35
|
+
- `dsh-patch-edit-plus`:npm 包名、运行时插件 ID,同时也是 bundle 补丁所插入的那一行 id。
|
|
36
|
+
|
|
37
|
+
> **支持的 DSH 范围:`0.1.0-rc.8` 至 `0.2.0-rc.2`(含 desktop)—— 单一版本 v0.4.0。**
|
|
38
|
+
>
|
|
39
|
+
> 先用 `dsh --version` 确认当前版本。
|
|
40
|
+
>
|
|
41
|
+
> | DSH 版本 | 状态 | 说明 |
|
|
42
|
+
> | --- | --- | --- |
|
|
43
|
+
> | `0.2.0-rc.1` ~ `0.2.0-rc.2`(含 desktop) | 支持 | 同一个 v0.4.0。 |
|
|
44
|
+
> | `0.1.0-rc.8` ~ `0.1.7-rc.2` | 支持 | 同一个 v0.4.0 —— 无需选择分支或 dist-tag。 |
|
|
45
|
+
>
|
|
46
|
+
> 任何受支持宿主线一律安装 `latest`:一个版本同时服务 0.1.x 与 0.2.x。发布后 dist-tag `latest`、`dsh-0.2.0`、`dsh-0.1.7`、`dsh-0.1.5`、`dsh-0.1.2` 将全部指向 0.4.0。
|
|
47
|
+
|
|
48
|
+
## 0. 前置条件与 profile 探查
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
echo "DSH_HOME=${DSH_HOME:-$HOME/.dsh}"
|
|
52
|
+
dsh --version
|
|
53
|
+
ls "${DSH_HOME:-$HOME/.dsh}/profiles"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
请使用正在运行的 DSH 进程所使用的那个 profile。`web` 很常见,但以实际生效的 `--profile` 参数为准。
|
|
57
|
+
|
|
58
|
+
## 1. 官方安装
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
dsh plugin --profile <profile> add dsh-patch-edit-plus -w
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(当 profile 是 pnpm workspace 根时,如 `web`,`-w` 是必需的。)
|
|
65
|
+
|
|
66
|
+
显式安装指定版本:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
dsh plugin --profile <profile> add dsh-patch-edit-plus@0.4.0 -w
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
官方 CLI 会自动更新 profile 依赖、锁文件与 `dsh.profile.bundles`。不要手工添加 YAML 行。
|
|
73
|
+
|
|
74
|
+
### 供应链冷却期
|
|
75
|
+
|
|
76
|
+
DSH 运行时使用 pnpm 11,其 `minimumReleaseAge` 策略可能拦截刚发布的版本并报 `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`。把该版本加入 `~/.dsh/profiles/<profile>/pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude`:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
minimumReleaseAgeExclude:
|
|
80
|
+
- dsh-patch-edit-plus@0.4.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 2. 重启宿主
|
|
84
|
+
|
|
85
|
+
本插件是**纯宿主半身**:只在宿主侧注册一个工具与一个设置区,不附带浏览器半身。安装或升级后请重启 DSH 宿主进程;刷新页面既非必需,也不足以生效。
|
|
86
|
+
|
|
87
|
+
## 3. 升级
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
dsh plugin --profile <profile> update dsh-patch-edit-plus -w
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
升级后重启 DSH。
|
|
94
|
+
|
|
95
|
+
## 4. 本地路径 / `link:` 注册(备选)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# ~/.dsh/profiles/<profile>/package.json dependencies:
|
|
99
|
+
# "dsh-patch-edit-plus": "link:<absolute path to dsh-patch-edit-plus>"
|
|
100
|
+
# ~/.dsh/profiles/<profile>/cordis.patch.yml:
|
|
101
|
+
# - insert:
|
|
102
|
+
# - id: dsh-patch-edit-plus
|
|
103
|
+
# name: dsh-patch-edit-plus
|
|
104
|
+
cd ~/.dsh/profiles/<profile> && pnpm install && dsh web
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
或用官方 CLI 直接指定本地路径(无需联网):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
dsh plugin --profile <profile> add /absolute/path/to/dsh-patch-edit-plus -w
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
从源码检出构建时用以下脚本:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install
|
|
117
|
+
npm run build # tsc -p tsconfig.build.json → lib/ + lib/types/
|
|
118
|
+
npm run typecheck # tsc -p tsconfig.json
|
|
119
|
+
npm run verify:source # 源码级断言
|
|
120
|
+
npm run test # vitest run
|
|
121
|
+
npm run smoke # _smoke/load-smoke.mjs
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`lib/` 不入库,因此源码检出必须先构建才能按路径注册。发布时由 `prepublishOnly` 钩子自动构建,因此已发布的 tarball 一定包含编译产物。
|
|
125
|
+
|
|
126
|
+
## 5. 校验安装
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
grep -n "dsh-patch-edit-plus" \
|
|
130
|
+
"${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/package.json"
|
|
131
|
+
node -p "require('${DSH_HOME:-$HOME/.dsh}/profiles/<profile>/node_modules/dsh-patch-edit-plus/package.json').version"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
检查官方装配:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
dsh --profile <profile> --dump-default-config
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
其中必须包含:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
- id: dsh-patch-edit-plus
|
|
144
|
+
name: dsh-patch-edit-plus
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 6. 验证插件
|
|
148
|
+
|
|
149
|
+
重启后,在会话中确认:
|
|
150
|
+
|
|
151
|
+
1. 模型可用的工具里出现 `apply_patch`。
|
|
152
|
+
2. 一个 unified diff 补丁可以应用,且文件内容与 diff 完全一致。
|
|
153
|
+
3. 校验失败的补丁不会改动工作区——引擎在写入任何东西之前已完成全部只读校验。
|
|
154
|
+
4. 在 `allowCodexPatch` 关闭时提交 Codex 风格补丁,会返回可操作的提示(告知如何启用该语法,或以 unified diff 重试),而不是笼统的解析错误。
|
|
155
|
+
|
|
156
|
+
若已有其他插件提供了名为 `apply_patch` 的工具,三层冲突策略(默认 `rename`,另有 `skip` / `fail`)决定结果。默认 `rename` 下 DSH 启动不受影响,本工具会以带后缀的名字注册。
|
|
157
|
+
|
|
158
|
+
## 7. 故障排查
|
|
159
|
+
|
|
160
|
+
| 现象 | 处理 |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| 找不到 `dsh` | 安装或启用官方 DSH CLI。 |
|
|
163
|
+
| `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` | 把该版本加入该 profile 的 `pnpm-workspace.yaml` 中的 `minimumReleaseAgeExclude`。 |
|
|
164
|
+
| `apply_patch` 未出现 | 重启宿主进程,并重新检查装配行。 |
|
|
165
|
+
| 与其他 `apply_patch` 提供方名字冲突 | 按 README 设置冲突策略 `rename`(默认)/ `skip` / `fail`。 |
|
|
166
|
+
| Codex 语法被拒绝 | 开启 `allowCodexPatch: true`,或改用 unified diff 重发该改动。 |
|
|
167
|
+
| hunk 不匹配 | 阅读四元诊断(文件 + hunk 序号、搜索起点、期望片段预览、实际片段),并按匹配的上下文重新提交该 hunk。 |
|
|
168
|
+
|
|
169
|
+
## 8. 卸载
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
dsh plugin --profile <profile> remove dsh-patch-edit-plus
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
卸载后重启 DSH。
|
|
176
|
+
|
|
177
|
+
## 许可
|
|
178
|
+
|
|
179
|
+
MIT
|
package/README.md
CHANGED
|
@@ -21,12 +21,12 @@ Tool capabilities are identical on every line: one `apply_patch` tool, git/unifi
|
|
|
21
21
|
|
|
22
22
|
## Why patch at all? (tool routing guide)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Two surfaces route the model, mirroring what DSH 0.2.2-rc.1 ships for its own built-in `apply_patch`:
|
|
25
25
|
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
- **Tool description** — one line, repeated on every call: prefer `apply_patch` over separate `edit` calls when a change spans several files, several separated regions of one file, or adds/deletes/moves files. A single small replacement in an already-read file is still cheaper through the native `edit` tool.
|
|
27
|
+
- **System-prompt section** (`plugin:patch-edit-plus:apply_patch`, order 1350, right after `tool:edit`) — the full guidance: give every hunk enough surrounding context lines to match exactly one place in the current file; every hunk is matched against the current content before anything is written, so a rejected patch changes nothing and retrying with a corrected patch beats falling back to many small edits; once writing starts, operations stop at the first failure.
|
|
28
|
+
|
|
29
|
+
The section is emitted only while the tool is registered in the acting scope, and `auto` skips it when rename avoidance had to step aside for another `apply_patch` (a host-shipped one, for example) so the two guidance texts never compete. `guidance: 'auto' | 'on' | 'off'` controls this; the default is `auto`.
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
@@ -98,6 +98,7 @@ Enable with `allowCodexPatch: true`. When a Codex patch arrives while disabled,
|
|
|
98
98
|
| `deleteBackend` | `shell` | `shell` or `none` (Delete/Move return a structured error). |
|
|
99
99
|
| `shellDialect` | `auto` | `auto` (pwsh on win32) / `posix` / `pwsh`. |
|
|
100
100
|
| `deleteCommand` / `moveCommand` | built-in | Custom command templates. Paths still arrive **only via env** (`DSH_PATCH_TARGET` / `DSH_PATCH_SOURCE`); never interpolate them into the command string. |
|
|
101
|
+
| `guidance` | `auto` | System-prompt guidance: `auto` (skip when the tool had to be renamed), `on`, `off`. |
|
|
101
102
|
| `dryRunByDefault` | `false` | Treat calls as dry runs unless `dryRun: false`. |
|
|
102
103
|
| `followSymlinks` | `false` | Allow patch paths to traverse symlinks. |
|
|
103
104
|
| `maxFiles` | `50` | Max file sections per patch. |
|
package/README.zh.md
CHANGED
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
|
|
22
22
|
## 工具路由指引(为什么该用谁)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
路由分两个面,形态对齐 DSH 0.2.2-rc.1 给自家内置 `apply_patch` 的做法:
|
|
25
25
|
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
- **工具 description** —— 每次调用都可见的一句话:当改动跨多个文件、同一文件的多个分离区域,或涉及新增/删除/移动文件时,优先用 `apply_patch` 而不是多次 `edit`;单个已读文件里的单点小替换仍然用原生 `edit` 更便宜。
|
|
27
|
+
- **系统提示段**(`plugin:patch-edit-plus:apply_patch`,order 1350,紧跟在 `tool:edit` 之后)—— 完整指导:每个 hunk 给足上下文字段,确保只匹配文件中的一处;所有 hunk 在任何写入之前先对着当前内容匹配,因此被拒绝的 patch 不改变任何文件,修正后重试比退回多次小改更划算;一旦开始写入,首个失败即停。
|
|
28
|
+
|
|
29
|
+
该段只在工具确实注册于当前作用域时输出;`auto` 在因重名避让而改名为其他名字时(例如宿主已自带 `apply_patch`)不再注入,避免两套提示互相竞争。`guidance: 'auto' | 'on' | 'off'` 控制此行为,默认为 `auto`。
|
|
30
30
|
|
|
31
31
|
## 安装
|
|
32
32
|
|
|
@@ -97,6 +97,7 @@ dsh web --dump-config # 确认插件行出现
|
|
|
97
97
|
| `deleteBackend` | `shell` | `shell` 或 `none`(Delete/Move 返回结构化错误)。 |
|
|
98
98
|
| `shellDialect` | `auto` | `auto`(win32 上 pwsh)/ `posix` / `pwsh`。 |
|
|
99
99
|
| `deleteCommand` / `moveCommand` | 内置 | 自定义命令模板。路径仍然**只经 env** 传入(`DSH_PATCH_TARGET` / `DSH_PATCH_SOURCE`),请勿把路径插值进命令串。 |
|
|
100
|
+
| `guidance` | `auto` | 系统提示段:`auto`(工具被改名时跳过)/ `on` / `off`。 |
|
|
100
101
|
| `dryRunByDefault` | `false` | 默认按 dry run 处理,除非调用显式传 `dryRun: false`。 |
|
|
101
102
|
| `followSymlinks` | `false` | 允许补丁路径穿越符号链接。 |
|
|
102
103
|
| `maxFiles` | `50` | 单补丁最大文件段数。 |
|
package/dsh.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-patch-edit-plus",
|
|
3
3
|
"name": "dsh-patch-edit-plus",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.8",
|
|
5
5
|
"description": {
|
|
6
6
|
"en": "Patch-style file editing: one apply_patch tool for git/unified diff (default) and Codex apply_patch syntax (opt-in), with all-or-nothing application and sandbox-aware delete/move.",
|
|
7
7
|
"zh": "补丁风格文件编辑:单个 apply_patch 工具,接受 git/unified diff(默认)与 Codex apply_patch 语法(可选开启),全量验证后原子应用,删除/移动走沙箱感知 shell。"
|
package/lib/config.js
CHANGED
|
@@ -18,6 +18,7 @@ export const Config = z.object({
|
|
|
18
18
|
shellDialect: z.union(['auto', 'posix', 'pwsh']).default('auto'),
|
|
19
19
|
deleteCommand: z.string(),
|
|
20
20
|
moveCommand: z.string(),
|
|
21
|
+
guidance: z.union(['auto', 'on', 'off']).default('auto'),
|
|
21
22
|
dryRunByDefault: z.boolean().default(false),
|
|
22
23
|
followSymlinks: z.boolean().default(false),
|
|
23
24
|
maxFiles: z.number().step(1).min(1).max(500).default(50),
|
|
@@ -45,6 +46,7 @@ export function resolveConfig(config) {
|
|
|
45
46
|
shellDialect: c.shellDialect ?? 'auto',
|
|
46
47
|
deleteCommand: typeof c.deleteCommand === 'string' && c.deleteCommand !== '' ? c.deleteCommand : undefined,
|
|
47
48
|
moveCommand: typeof c.moveCommand === 'string' && c.moveCommand !== '' ? c.moveCommand : undefined,
|
|
49
|
+
guidance: c.guidance ?? 'auto',
|
|
48
50
|
dryRunByDefault: c.dryRunByDefault ?? false,
|
|
49
51
|
followSymlinks: c.followSymlinks ?? false,
|
|
50
52
|
maxFiles: c.maxFiles ?? 50,
|