Skip to content

Commit 9c7b99e

Browse files
Apply PR #14677: feat: add experimental hashline edit mode with dual-schema support
2 parents dd73bdf + 52b4225 commit 9c7b99e

14 files changed

Lines changed: 1708 additions & 99 deletions

File tree

packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,9 @@ function Edit(props: ToolProps<typeof EditTool>) {
19991999
</Match>
20002000
<Match when={true}>
20012001
<InlineTool icon="←" pending="Preparing edit..." complete={props.input.filePath} part={props.part}>
2002-
Edit {normalizePath(props.input.filePath!)} {input({ replaceAll: props.input.replaceAll })}
2002+
Edit{" "}
2003+
{normalizePath(props.input.filePath!)}{" "}
2004+
{input({ replaceAll: "replaceAll" in props.input ? props.input.replaceAll : undefined })}
20032005
</InlineTool>
20042006
</Match>
20052007
</Switch>

packages/opencode/src/config/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,16 @@ export namespace Config {
11551155
.object({
11561156
disable_paste_summary: z.boolean().optional(),
11571157
batch_tool: z.boolean().optional().describe("Enable the batch tool"),
1158+
hashline_edit: z
1159+
.boolean()
1160+
.optional()
1161+
.describe("Enable hashline-backed edit/read tool behavior (default true, set false to disable)"),
1162+
hashline_autocorrect: z
1163+
.boolean()
1164+
.optional()
1165+
.describe(
1166+
"Enable hashline autocorrect cleanup for copied prefixes and formatting artifacts (default true)",
1167+
),
11581168
openTelemetry: z
11591169
.boolean()
11601170
.optional()

packages/opencode/src/session/prompt/codex_header.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ You are an interactive CLI tool that helps users with software engineering tasks
55
## Editing constraints
66
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
77
- Only add comments if they are necessary to make a non-obvious block easier to understand.
8-
- Try to use apply_patch for single file edits, but it is fine to explore other options to make the edit if it does not work well. Do not use apply_patch for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase).
8+
- Prefer the edit tool for file edits. Use apply_patch only when it is available and clearly a better fit. Do not use apply_patch for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase).
99

1010
## Tool usage
1111
- Prefer specialized tools over shell for file operations:

0 commit comments

Comments
 (0)