summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorluo jiyin <[email protected]>2026-01-21 13:03:07 +0800
committerGitHub <[email protected]>2026-01-20 23:03:07 -0600
commitc9ea9668055fee9675412e621f96e815f4ec4e1d (patch)
treeebe4cab042cea70b3d78bd78e115dc76965b8093
parent2049af4d6feb8b79dc864262f2087edbf829d36a (diff)
downloadopencode-c9ea9668055fee9675412e621f96e815f4ec4e1d.tar.gz
opencode-c9ea9668055fee9675412e621f96e815f4ec4e1d.zip
feat: add OPENCODE_DISABLE_FILETIME_CHECK flag (#6581)
Signed-off-by: luojiyin <[email protected]> Co-authored-by: Aiden Cline <[email protected]>
-rw-r--r--packages/opencode/src/file/time.ts7
-rw-r--r--packages/opencode/src/flag/flag.ts1
2 files changed, 7 insertions, 1 deletions
diff --git a/packages/opencode/src/file/time.ts b/packages/opencode/src/file/time.ts
index 770427abe..35c780fbd 100644
--- a/packages/opencode/src/file/time.ts
+++ b/packages/opencode/src/file/time.ts
@@ -1,5 +1,6 @@
import { Instance } from "../project/instance"
import { Log } from "../util/log"
+import { Flag } from "../flag/flag"
export namespace FileTime {
const log = Log.create({ service: "file.time" })
@@ -52,8 +53,12 @@ export namespace FileTime {
}
export async function assert(sessionID: string, filepath: string) {
+ if (Flag.OPENCODE_DISABLE_FILETIME_CHECK === true) {
+ return
+ }
+
const time = get(sessionID, filepath)
- if (!time) throw new Error(`You must read the file ${filepath} before overwriting it. Use the Read tool first`)
+ if (!time) throw new Error(`You must read file ${filepath} before overwriting it. Use the Read tool first`)
const stats = await Bun.file(filepath).stat()
if (stats.mtime.getTime() > time.getTime()) {
throw new Error(
diff --git a/packages/opencode/src/flag/flag.ts b/packages/opencode/src/flag/flag.ts
index 4cdb54909..63b1ac7e5 100644
--- a/packages/opencode/src/flag/flag.ts
+++ b/packages/opencode/src/flag/flag.ts
@@ -38,6 +38,7 @@ export namespace Flag {
export const OPENCODE_EXPERIMENTAL_OXFMT = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_OXFMT")
export const OPENCODE_EXPERIMENTAL_LSP_TY = truthy("OPENCODE_EXPERIMENTAL_LSP_TY")
export const OPENCODE_EXPERIMENTAL_LSP_TOOL = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_LSP_TOOL")
+ export const OPENCODE_DISABLE_FILETIME_CHECK = truthy("OPENCODE_DISABLE_FILETIME_CHECK")
export const OPENCODE_EXPERIMENTAL_PLAN_MODE = OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_PLAN_MODE")
function truthy(key: string) {