diff --git a/README.md b/README.md index 0e5c9f8..71bdc66 100644 --- a/README.md +++ b/README.md @@ -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 ``` +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 ```bash diff --git a/index.js b/index.js index 4dbc38e..bc462d2 100644 --- a/index.js +++ b/index.js @@ -682,7 +682,7 @@ export function apply(ctx, config = {}) { function readTool(builtin) { return { ...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), output: { ...builtin.output, @@ -703,6 +703,8 @@ export function apply(ctx, config = {}) { const target = await resolveTarget(args.file_path, exec) const { text } = await readFile(target, exec) 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) } } catch { return value @@ -721,7 +723,7 @@ export function apply(ctx, config = {}) { function grepTool(builtin) { return { ...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).'), output: { ...builtin.output, diff --git a/package.json b/package.json index 83dfae7..8e81026 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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.", "private": true, "type": "module",