MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / takeSystemPrompt

Function takeSystemPrompt

src/index.tsx:104–120  ·  view source on GitHub ↗

* Pop the `-s` / `--system-prompt` flag (and its value) out of `args`. * Unlike `takeFlagValue` this accepts a value that starts with `-`, because * a system-prompt override is free-form text. Supports three forms: * -s " " --value in next arg * --system-prompt " " *

(args: string[])

Source from the content-addressed store, hash-verified

102 * --system-prompt=-<text>
103 */
104function takeSystemPrompt(args: string[]): string | undefined {
105 const longWithEq = args.findIndex((a) => a.startsWith("--system-prompt="))
106 if (longWithEq !== -1) {
107 const value = args[longWithEq].slice("--system-prompt=".length)
108 args.splice(longWithEq, 1)
109 return value.length > 0 ? value : undefined
110 }
111 const index = args.findIndex((a) => a === "-s" || a === "--system-prompt")
112 if (index === -1) return undefined
113 const value = args[index + 1]
114 if (value === undefined) {
115 console.error("Missing value after -s / --system-prompt")
116 process.exit(1)
117 }
118 args.splice(index, 2)
119 return value
120}
121
122async function main(): Promise<void> {
123 // Override Node's default process title so terminals (iTerm2 "current job

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected