v1.4.0: plain read/grep output outside hashline mode (Claude Code style replace mode)

This commit is contained in:
Agent committed 2026-10-21 18:15:20 +00:00
1 parent de37af4b8c
commit ad5743baec
3 files changed
+10 -3

No files matched your search

+5
View File
@@ -183,6 +183,11 @@ Set options in the `config` of the row in `~/.dsh/profiles/web/cordis.patch.yml`
guardTools: [write, str_replace_editor, apply_patch] # write: only existing files are denied guardTools: [write, str_replace_editor, apply_patch] # write: only existing files are denied
``` ```
Outside `hashline` mode, `read` and `grep` return the plain built-in output with no
`[PATH#TAG]` headers. A grep hit still counts as an observation, so the file can be edited
straight away. For Claude Code–style tools, use `mode: replace`, `strict: true`, and
`guard: false`.
## Tests ## Tests
```bash ```bash
+4 -2
View File
@@ -682,7 +682,7 @@ export function apply(ctx, config = {}) {
function readTool(builtin) { function readTool(builtin) {
return { return {
...builtin, ...builtin,
description: `${builtin.description} Returns at most ${cfg.pageLines} lines per call; continue with offset from the footer.${P.READ_HASHLINE_NOTE}`, description: `${builtin.description} Returns at most ${cfg.pageLines} lines per call; continue with offset from the footer.${cfg.mode === 'hashline' ? P.READ_HASHLINE_NOTE : ''}`,
parameters: capLimit(builtin.parameters, cfg.pageLines), parameters: capLimit(builtin.parameters, cfg.pageLines),
output: { output: {
...builtin.output, ...builtin.output,
@@ -703,6 +703,8 @@ export function apply(ctx, config = {}) {
const target = await resolveTarget(args.file_path, exec) const target = await resolveTarget(args.file_path, exec)
const { text } = await readFile(target, exec) const { text } = await readFile(target, exec)
const tag = storeFor(exec).record(String(target.targetKey), text) const tag = storeFor(exec).record(String(target.targetKey), text)
// Tags only matter to hashline patches; other modes get the plain built-in output.
if (modeFor(exec?.agent) !== 'hashline') return value
return { ...value, tag, rel: relPath(target, exec) } return { ...value, tag, rel: relPath(target, exec) }
} catch { } catch {
return value return value
@@ -721,7 +723,7 @@ export function apply(ctx, config = {}) {
function grepTool(builtin) { function grepTool(builtin) {
return { return {
...builtin, ...builtin,
description: `Search file contents with a ripgrep regular expression. Returns at most ${cfg.pageLines} matching lines per call, grouped by file; pass offset to page through more.${P.GREP_HASHLINE_NOTE}`, description: `Search file contents with a ripgrep regular expression. Returns at most ${cfg.pageLines} matching lines per call, grouped by file; pass offset to page through more.${cfg.mode === 'hashline' ? P.GREP_HASHLINE_NOTE : ' A match counts as having read the file, so it can be edited straight away.'}`,
parameters: withOffset(builtin.parameters, 'Skip this many matches (paging; the footer gives the next offset).'), parameters: withOffset(builtin.parameters, 'Skip this many matches (paging; the footer gives the next offset).'),
output: { output: {
...builtin.output, ...builtin.output,
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@local/omp-edit", "name": "@local/omp-edit",
"version": "1.3.0", "version": "1.4.0",
"description": "oh-my-pi style editing for DSH: replaces the edit tool with hashline patches (content-hash tagged line anchors, block ops, cut/paste registers, multi-file, stale-tag recovery), plus replace/sloppy/apply_patch modes; tags read and grep output.", "description": "oh-my-pi style editing for DSH: replaces the edit tool with hashline patches (content-hash tagged line anchors, block ops, cut/paste registers, multi-file, stale-tag recovery), plus replace/sloppy/apply_patch modes; tags read and grep output.",
"private": true, "private": true,
"type": "module", "type": "module",