Skip to content

Commit e1e45bc

Browse files
committed
fix(auto): satisfy lint rules
1 parent c7903a8 commit e1e45bc

2 files changed

Lines changed: 22 additions & 12 deletions

File tree

packages/app/src/docker-git/cli/parser-options.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,24 @@ const parseInlineValueToken = (
163163
return applyCommandValueFlag(raw, flag, inlineValue)
164164
}
165165

166+
const legacyAgentFlagError = (token: string): ParseError | null => {
167+
if (token === "--claude") {
168+
return {
169+
_tag: "InvalidOption",
170+
option: token,
171+
reason: "use --auto=claude"
172+
}
173+
}
174+
if (token === "--codex") {
175+
return {
176+
_tag: "InvalidOption",
177+
option: token,
178+
reason: "use --auto=codex"
179+
}
180+
}
181+
return null
182+
}
183+
166184
const parseRawOptionsStep = (
167185
args: ReadonlyArray<string>,
168186
index: number,
@@ -181,15 +199,9 @@ const parseRawOptionsStep = (
181199
return { _tag: "ok", raw: booleanApplied, nextIndex: index + 1 }
182200
}
183201

184-
if (token === "--claude" || token === "--codex") {
185-
return {
186-
_tag: "error",
187-
error: {
188-
_tag: "InvalidOption",
189-
option: token,
190-
reason: "use --auto=claude or --auto=codex"
191-
}
192-
}
202+
const deprecatedAgentFlag = legacyAgentFlagError(token)
203+
if (deprecatedAgentFlag !== null) {
204+
return { _tag: "error", error: deprecatedAgentFlag }
193205
}
194206

195207
if (!token.startsWith("-")) {

packages/lib/src/usecases/agent-auto-select.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { randomInt } from "node:crypto"
2-
31
import type { PlatformError } from "@effect/platform/Error"
42
import * as FileSystem from "@effect/platform/FileSystem"
53
import type * as Path from "@effect/platform/Path"
@@ -131,5 +129,5 @@ export const resolveAutoAgentMode = (
131129
return "codex"
132130
}
133131

134-
return randomInt(0, 2) === 0 ? "claude" : "codex"
132+
return process.hrtime.bigint() % 2n === 0n ? "claude" : "codex"
135133
})

0 commit comments

Comments
 (0)