mirror of
https://github.com/stablyai/orca.git
synced 2026-10-09 08:02:35 +00:00
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Orca <help@stably.ai> Co-authored-by: brennanb2025 <brennankbenson@gmail.com>
21 lines
596 B
TypeScript
21 lines
596 B
TypeScript
const ANTE_HEADLESS_PROMPT_FLAGS = new Set(['--prompt', '-p'])
|
|
|
|
function optionName(token: string): string {
|
|
const eq = token.indexOf('=')
|
|
return eq === -1 ? token : token.slice(0, eq)
|
|
}
|
|
|
|
function isAnteHeadlessPromptFlag(token: string): boolean {
|
|
const name = optionName(token)
|
|
return ANTE_HEADLESS_PROMPT_FLAGS.has(name) || /^-p[^-]/.test(name)
|
|
}
|
|
|
|
export function isAnteHeadlessOneShotCommand(tokens: readonly string[]): boolean {
|
|
for (let index = 1; index < tokens.length; index += 1) {
|
|
if (isAnteHeadlessPromptFlag(tokens[index])) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|