fix(config): promote hashline_edit to top-level flag
Move hashline_edit out of experimental so it is a stable top-level config with default-on runtime behavior and explicit disable support. Add migration and tests to preserve existing experimental.hashline_edit users without breaking configs.
This commit is contained in:
+49
-52
@@ -644,6 +644,55 @@ describe("OhMyOpenCodeConfigSchema - browser_automation_engine", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("OhMyOpenCodeConfigSchema - hashline_edit", () => {
|
||||
test("accepts hashline_edit as true", () => {
|
||||
//#given
|
||||
const input = { hashline_edit: true }
|
||||
|
||||
//#when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(input)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
expect(result.data?.hashline_edit).toBe(true)
|
||||
})
|
||||
|
||||
test("accepts hashline_edit as false", () => {
|
||||
//#given
|
||||
const input = { hashline_edit: false }
|
||||
|
||||
//#when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(input)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
expect(result.data?.hashline_edit).toBe(false)
|
||||
})
|
||||
|
||||
test("hashline_edit is optional", () => {
|
||||
//#given
|
||||
const input = { auto_update: true }
|
||||
|
||||
//#when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(input)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
expect(result.data?.hashline_edit).toBeUndefined()
|
||||
})
|
||||
|
||||
test("rejects non-boolean hashline_edit", () => {
|
||||
//#given
|
||||
const input = { hashline_edit: "true" }
|
||||
|
||||
//#when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(input)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("ExperimentalConfigSchema feature flags", () => {
|
||||
test("accepts plugin_load_timeout_ms as number", () => {
|
||||
//#given
|
||||
@@ -699,48 +748,6 @@ describe("ExperimentalConfigSchema feature flags", () => {
|
||||
}
|
||||
})
|
||||
|
||||
test("accepts hashline_edit as true", () => {
|
||||
//#given
|
||||
const config = { hashline_edit: true }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.hashline_edit).toBe(true)
|
||||
}
|
||||
})
|
||||
|
||||
test("accepts hashline_edit as false", () => {
|
||||
//#given
|
||||
const config = { hashline_edit: false }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.hashline_edit).toBe(false)
|
||||
}
|
||||
})
|
||||
|
||||
test("hashline_edit is optional", () => {
|
||||
//#given
|
||||
const config = { safe_hook_creation: true }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.hashline_edit).toBeUndefined()
|
||||
}
|
||||
})
|
||||
|
||||
test("accepts disable_omo_env as true", () => {
|
||||
//#given
|
||||
const config = { disable_omo_env: true }
|
||||
@@ -794,16 +801,6 @@ describe("ExperimentalConfigSchema feature flags", () => {
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
test("rejects non-boolean hashline_edit", () => {
|
||||
//#given
|
||||
const config = { hashline_edit: "true" }
|
||||
|
||||
//#when
|
||||
const result = ExperimentalConfigSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("GitMasterConfigSchema", () => {
|
||||
|
||||
@@ -17,8 +17,6 @@ export const ExperimentalConfigSchema = z.object({
|
||||
safe_hook_creation: z.boolean().optional(),
|
||||
/** Disable auto-injected <omo-env> context in prompts (experimental) */
|
||||
disable_omo_env: z.boolean().optional(),
|
||||
/** Enable hashline_edit tool for improved file editing with hash-based line anchors */
|
||||
hashline_edit: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export type ExperimentalConfig = z.infer<typeof ExperimentalConfigSchema>
|
||||
|
||||
@@ -33,6 +33,8 @@ 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) */
|
||||
hashline_edit: z.boolean().optional(),
|
||||
agents: AgentOverridesSchema.optional(),
|
||||
categories: CategoriesConfigSchema.optional(),
|
||||
claude_code: ClaudeCodeConfigSchema.optional(),
|
||||
|
||||
Reference in New Issue
Block a user