dsh-hashline-edit 0.3.10 → 0.3.11
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/package.json +1 -1
- package/prompts/apply-patch-guidelines.md +3 -2
- package/prompts/apply-patch.md +1 -1
- package/prompts/zh/apply-patch-guidelines.md +0 -9
- package/prompts/zh/apply-patch.md +0 -1
- package/prompts/zh/read-guidelines.md +0 -6
- package/prompts/zh/read-snippet.md +0 -1
- package/prompts/zh/read.md +0 -1
- package/prompts/zh/undo-last-edit-guidelines.md +0 -2
- package/prompts/zh/undo-last-edit-snippet.md +0 -1
- package/prompts/zh/undo-last-edit.md +0 -1
- package/prompts/zh/write-guidelines.md +0 -2
- package/prompts/zh/write.md +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-hashline-edit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Hash-anchored read/apply_patch tools for DeepSeek Harness (dsh). Every line gets a unique 3- or 4-char hash (A-Za-z0-9, configurable) that stays stable across edits; apply_patch is the only file-mutation entry point and commits one patch batch per transaction. Undo persists across restarts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anchors",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
- apply_patch: one call = one transaction; batch related changes and split only when an earlier RESULT decides the next.
|
|
2
2
|
- apply_patch: an identity hunk is `@@<anchor>` or `@@<from>-<to>` followed by `+` lines; an empty body deletes every row of the span. Minimal shape: `*** Begin Patch` / `*** Update File: <path>` / `@@<anchor>` / `+<new line>` / `*** End Patch`.
|
|
3
3
|
- apply_patch: an identity anchor is the bare `{{HASH_LEN}}` characters before `│` in a served row — never the whole row, never a line number; syntax is `@@` plus the anchor with no space between them.
|
|
4
|
-
- apply_patch: served beats text — when this session served the file, an identity hunk is REQUIRED, not preferred; a fragment hunk is limited to a file or region this session never served.
|
|
5
|
-
- apply_patch: anchors in hand mean no re-read — apply the identity hunk to the served rows instead of reading the file again.
|
|
4
|
+
- apply_patch: served beats text — when this session served the file, an identity hunk is REQUIRED, not preferred; a fragment hunk is limited to a file or region this session never served, and a text match never licenses one.
|
|
5
|
+
- apply_patch: anchors in hand mean no re-read — apply the identity hunk to the served rows instead of reading the file again; a rejection already serves the current rows back.
|
|
6
|
+
- apply_patch: change only what the task changes — an identity hunk carries `+` lines for the edited region and no unchanged rows, so a small edit stays a small patch.
|
|
6
7
|
- apply_patch: for a one-line or single-region change to a served file, one identity hunk is the whole call; do not switch to `write` because the file content is already in context.
|
|
7
8
|
- apply_patch: hunks are validated against the pre-call file in order (overlapping ranges reject the batch); a fragment hunk must match exactly once — `E_UNIQUE_MATCH` writes nothing — while a stale or unknown anchor is rejected; both serve the current rows back.
|
|
8
9
|
- apply_patch: a rejection writes nothing; retry from the served `HASH│content` rows without another `read`.
|
package/prompts/apply-patch.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Change an existing file with `apply_patch`; it is the default for every change to an existing file, including a one-line change. `write` is only for a new file or a
|
|
1
|
+
Change an existing file with `apply_patch`; it is the default for every change to an existing file, including a one-line change. `write` is only for a new file or for a rewrite where every line changes; a partial change is never a whole-file replacement. Pass the complete patch as `input`. When this session already served the file — through `read`, `grep`, a `bash` view, or a previous `apply_patch` result — every hunk MUST be an identity hunk on a served row: reuse the bare anchor before `│` (`@@<anchor>` to replace that row, `@@<from>-<to>` to replace a span whose anchors you hold), and add only the changed `+` lines rather than re-emitting rows you are not changing. Anchors already in hand need no re-read: patch them directly instead of calling `read` again. A fragment hunk (`@@` or `@@ <context>` matched by file text) is legal only for a file or region this session never served; if the file was served, a fragment hunk is the wrong tool even when the text matches, because it discards the anchor check that proves you edited the version you actually saw.
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
- apply_patch:一次调用 = 一个事务;把相关改动成批处理,只有当先前的结果决定下一步时才拆分。
|
|
2
|
-
- apply_patch:身份 hunk 形如 `@@<anchor>` 或 `@@<from>-<to>` 后接 `+` 行;空正文会删除该跨度内所有行。最小形状:`*** Begin Patch` / `*** Update File: <path>` / `@@<anchor>` / `+<新行>` / `*** End Patch`。
|
|
3
|
-
- apply_patch:身份锚点是已服务行中 `│` 之前的 {{HASH_LEN}} 个字符——不是整行,也不是行号;语法是 `@@` 直接加锚点,中间不留空格。
|
|
4
|
-
- apply_patch:已服务优先于文本匹配——本会话服务过该文件时必须用身份 hunk(REQUIRED),不是"优先";片段 hunk 仅限本会话从未服务过的文件或区域。
|
|
5
|
-
- apply_patch:锚点在手上就不要重读——直接把身份 hunk 应用到已服务行,而不是再次 `read` 该文件。
|
|
6
|
-
- apply_patch:对已服务文件的单行或单区域改动,一个身份 hunk 就是整次调用;不要因为文件内容已在上下文里就改用 `write`。
|
|
7
|
-
- apply_patch:各 hunk 按顺序针对调用前的文件校验(重叠范围会拒绝整批);片段 hunk 必须恰好匹配一次——`E_UNIQUE_MATCH` 时不写入任何内容——陈旧或未知锚点会被拒绝;两者都会回送当前行。
|
|
8
|
-
- apply_patch:拒绝时不写入任何内容;从回送的 `HASH│content` 行重试,无需再次 `read`。
|
|
9
|
-
- apply_patch:成功时返回改动行的新锚点;补丁只携带改动的行,新建文件或整文件重写留给 `write`。
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
用 `apply_patch` 修改已有文件;对已有文件的每一处改动都默认用它,包括只改一行。`write` 只用于新建文件,或每一行都改变的重写。把完整补丁作为 `input` 传入。当本会话已服务过该文件(`read`、`grep` 或 `bash` 视图)时,每个 hunk 都必须是基于已服务行的身份 hunk:复制 `│` 之前的裸锚点(`@@<anchor>` 或 `@@<anchor>-<anchor>`),只携带改动的 `+` 行,绝不把已服务内容粘回 hunk。锚点已在手上时不要再调 `read` 重取——直接对它们应用补丁。片段 hunk(`@@` 或按文件文本匹配的 `@@ <context>`)仅用于本会话从未服务过的文件或区域。
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
- read:仅在工具尚未服务给你信息时调用,例如自动读取 diff 之外的内容。bash 视图或自动读取已经服务过该文件,因此直接用那些行 apply_patch。
|
|
2
|
-
- read:当一次替换需要多个块或两端边界时,把每个范围放进同一次调用。用 `{ file, windows: [{ offset, limit }] }`。每个窗口都在当轮被服务,因此其锚点可在同一次 apply_patch 调用中使用。窗口也可以是 `{ around_anchor, radius }`,以本会话已服务的某行为中心。本会话未服务过的锚点会被省略,并内联标注 `[Window warning: ...]`。
|
|
3
|
-
- read:61 行及以内的请求窗口可扩展到其所在块;重叠或相邻窗口在此判定前合并。上限为:代码与 Markdown 80 行,纯文本 40 行。扩展的行以 `[widened <requested> -> <served>, <label>]` 开头;超过三个请求窗口的提示为 `[widened N windows: <ranges>]`。超限的 Markdown 章节会裁剪并标注 `(section <extent>)`;超限的代码或纯文本则拒绝且无提示。`mode: "verbatim"` 也会扩展,但不加锚点。
|
|
4
|
-
- read:当你不打算对该文件 apply_patch 时,用 `mode: "verbatim"` 获取无锚点的纯内容。例如配置值、文档、README 或技能内容(SKILL.md 或其所处目录中的任意文件)。当你打算用锚点配合 apply_patch 时,就不要指定 `mode`,让这些行带上锚点。
|
|
5
|
-
- read:每次调用只发送一个文件,形式为 `{ file, windows?, mode? }`,与 `apply_patch` 相同。单个顶层 `mode` 作用于该文件。要读多个文件就并行发起多次 `read` 调用。
|
|
6
|
-
- read:PNG/JPG 图像以图像附件形式返回,供多模态模型使用。像其他文件一样用 `file` 请求。
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
通过 `file`、`windows?`、`mode?` 读取文件;默认返回可直接编辑的 HASH│content 行,`mode: "verbatim"` 在你不编辑时返回纯文本;用 `windows` 在一次调用中批量读取多个范围
|
package/prompts/zh/read.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
通过 `file` 读取一个文本文件,可选 `windows` 与顶层 `mode`。要读多个文件就并行发起多次 `read` 调用。服务模式(默认)把每行返回为 HASH│content,带一个 {{HASH_LEN}} 字符的字母数字哈希。该哈希就是 `apply_patch` 的身份锚点,因此只复制 `│` 之前的 {{HASH_LEN}} 个字符。当你不打算 apply_patch 该文件时,用 `mode: "verbatim"` 获取无锚点的纯文本。`mode: "verbatim"` 不受行数上限限制。用 `windows` 指定范围:`[{ offset, limit }]`(offset 从 1 开始,limit 为行数,最多 16 个窗口)或 `[{ around_anchor: "<anchor>", radius: 10 }]`(针对本会话已服务的某行)。当页面未取全时,用 `windows: [{ offset, limit }]` 从下一个未显示行继续。61 行及以内的请求窗口在返回前可能扩展到其所在块;重叠或相邻的窗口在此判定前会合并。上限为:代码与 Markdown 80 行,纯文本 40 行。扩展页以 `[widened <requested> -> <served>, <label>]` 开头;超过三个请求窗口时折叠为 `[widened N windows: <ranges>]`。超限的 Markdown 章节会裁剪为上限大小的窗口并标注 `(section <extent>)`;超限的代码或纯文本块则拒绝,只返回所请求的窗口。`mode: "verbatim"` 同样会扩展,但不加锚点。行内的 `[...]` 提示描述的是返回结果,而非文件内容。空文件返回 `HASH│`(用 apply_patch 身份 hunk 插入)。PNG/JPG/GIF/WebP 以图像附件形式返回,供多模态模型使用。二进制与目录文件会被拒绝。哈希是文件作用域的:一个锚点绑定于它被服务时所在的文件。
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
- undo_last_edit:还原最近一次触及 `path` 处文件的 `apply_patch` 批次及其每个成员:文本 hunk 加文件生命周期操作(增/删/移动)。例外是外来 `cut`:此时撤销也会还原源文件。文件必须仍保有被编辑后的字节。带外写入会让调用以 `E_UNDO_STALE` 失败,且文件保持字节不变。一旦结果不对就立刻调用它。
|
|
2
|
-
- undo_last_edit:对该文件的 `write`,或之后的一次 `apply_patch` 批次,会替换撤销记录。一次读取、bash 视图或带外写入会保留该记录。当一次 apply_patch 的 diff 显示出你本想保留的行的 `-HASH│` 行时,该结果就是错的。例子包括一个收尾花括号、一句 import 或一个声明。
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
撤销对 `path` 处文件最近一次的 `apply_patch` 批次
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
撤销最近一次触及 `path` 处文件的 `apply_patch` 批次,把整批——每个文本 hunk 加上文件生命周期操作(增/删/移动)——还原到先前状态。当某次 `apply_patch` 产生了错误结果(例如内容错误、重复行、语法损坏)时使用。该文件自那批之后必须未被改动。
|
package/prompts/zh/write.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
用 `write` 覆盖文件前先读取它。`write` 替换整个文件:用于新建文件,或每一行都改变的重写。要改已有文件的一部分,改用已服务行上的 `apply_patch` 身份 hunk。
|