feat(hashline): change hashline_edit default from true to false
Hashline edit tool and companion hooks now require explicit opt-in via `"hashline_edit": true` in config. Previously enabled by default. - tool-registry: hashline edit tool not registered unless opted in - create-tool-guard-hooks: hashline-read-enhancer disabled by default - Updated config schema comment and documentation - Added TDD tests for default behavior
This commit is contained in:
@@ -573,13 +573,13 @@ Define `fallback_models` per agent or category:
|
||||
|
||||
### Hashline Edit
|
||||
|
||||
Replaces the built-in `Edit` tool with a hash-anchored version using `LINE#ID` references to prevent stale-line edits. Enabled by default.
|
||||
Replaces the built-in `Edit` tool with a hash-anchored version using `LINE#ID` references to prevent stale-line edits. Disabled by default.
|
||||
|
||||
```json
|
||||
{ "hashline_edit": false }
|
||||
{ "hashline_edit": true }
|
||||
```
|
||||
|
||||
When enabled, two companion hooks are active: `hashline-read-enhancer` (annotates Read output) and `hashline-edit-diff-enhancer` (shows diffs). Disable them individually via `disabled_hooks`.
|
||||
When enabled, two companion hooks are active: `hashline-read-enhancer` (annotates Read output) and `hashline-edit-diff-enhancer` (shows diffs). Opt-in by setting `hashline_edit: true`. Disable the companion hooks individually via `disabled_hooks` if needed.
|
||||
|
||||
### Experimental
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export const OhMyOpenCodeConfigSchema = z.object({
|
||||
disabled_commands: z.array(BuiltinCommandNameSchema).optional(),
|
||||
/** Disable specific tools by name (e.g., ["todowrite", "todoread"]) */
|
||||
disabled_tools: z.array(z.string()).optional(),
|
||||
/** Enable hashline_edit tool/hook integrations (default: true at call site) */
|
||||
/** Enable hashline_edit tool/hook integrations (default: false) */
|
||||
hashline_edit: z.boolean().optional(),
|
||||
/** Enable model fallback on API errors (default: false). Set to true to enable automatic model switching when model errors occur. */
|
||||
model_fallback: z.boolean().optional(),
|
||||
|
||||
@@ -100,7 +100,7 @@ export function createToolGuardHooks(args: {
|
||||
: null
|
||||
|
||||
const hashlineReadEnhancer = isHookEnabled("hashline-read-enhancer")
|
||||
? safeHook("hashline-read-enhancer", () => createHashlineReadEnhancerHook(ctx, { hashline_edit: { enabled: pluginConfig.hashline_edit ?? true } }))
|
||||
? safeHook("hashline-read-enhancer", () => createHashlineReadEnhancerHook(ctx, { hashline_edit: { enabled: pluginConfig.hashline_edit ?? false } }))
|
||||
: null
|
||||
|
||||
const jsonErrorRecovery = isHookEnabled("json-error-recovery")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const { describe, expect, test } = require("bun:test")
|
||||
const { createToolExecuteBeforeHandler } = require("./tool-execute-before")
|
||||
const { createToolRegistry } = require("./tool-registry")
|
||||
|
||||
describe("createToolExecuteBeforeHandler", () => {
|
||||
test("does not execute subagent question blocker hook for question tool", async () => {
|
||||
@@ -219,4 +220,54 @@ describe("createToolExecuteBeforeHandler", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("createToolRegistry", () => {
|
||||
function createRegistryInput(overrides = {}) {
|
||||
return {
|
||||
ctx: {
|
||||
directory: process.cwd(),
|
||||
client: {},
|
||||
},
|
||||
pluginConfig: {
|
||||
...overrides,
|
||||
},
|
||||
managers: {
|
||||
backgroundManager: {},
|
||||
tmuxSessionManager: {},
|
||||
skillMcpManager: {},
|
||||
},
|
||||
skillContext: {
|
||||
mergedSkills: [],
|
||||
availableSkills: [],
|
||||
browserProvider: "playwright",
|
||||
disabledSkills: new Set(),
|
||||
},
|
||||
availableCategories: [],
|
||||
}
|
||||
}
|
||||
|
||||
describe("#given hashline_edit is undefined", () => {
|
||||
describe("#when creating tool registry", () => {
|
||||
test("#then should not register edit tool", () => {
|
||||
const result = createToolRegistry(createRegistryInput())
|
||||
|
||||
expect(result.filteredTools.edit).toBeUndefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given hashline_edit is true", () => {
|
||||
describe("#when creating tool registry", () => {
|
||||
test("#then should register edit tool", () => {
|
||||
const result = createToolRegistry(
|
||||
createRegistryInput({
|
||||
hashline_edit: true,
|
||||
}),
|
||||
)
|
||||
|
||||
expect(result.filteredTools.edit).toBeDefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
export {}
|
||||
|
||||
@@ -113,7 +113,7 @@ export function createToolRegistry(args: {
|
||||
}
|
||||
: {}
|
||||
|
||||
const hashlineEnabled = pluginConfig.hashline_edit ?? true
|
||||
const hashlineEnabled = pluginConfig.hashline_edit ?? false
|
||||
const hashlineToolsRecord: Record<string, ToolDefinition> = hashlineEnabled
|
||||
? { edit: createHashlineEditTool() }
|
||||
: {}
|
||||
|
||||
Reference in New Issue
Block a user