MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / createState

Function createState

compatible-shell/src/cli.mjs:69–96  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

67}
68
69function createState(options = {}) {
70 const workspaceDir = path.resolve(
71 options.cwd || process.env.COMPAT_SHELL_WORKSPACE_DIR || process.cwd(),
72 )
73 const clientConfig = getClientConfig({
74 baseUrl: options.baseUrl || process.env.ANTHROPIC_BASE_URL,
75 apiKey: options.apiKey || process.env.ANTHROPIC_API_KEY,
76 model: options.model || process.env.ANTHROPIC_MODEL,
77 maxTokens:
78 options.maxTokens ||
79 parsePositiveInt(process.env.COMPAT_SHELL_MAX_TOKENS, undefined),
80 })
81
82 return {
83 messages: [],
84 workspaceDir,
85 clientConfig,
86 maxToolRounds: parsePositiveInt(
87 options.maxToolRounds || process.env.COMPAT_SHELL_MAX_TOOL_ROUNDS,
88 6,
89 ),
90 autoApproveShell:
91 options.autoApproveShell === true ||
92 process.env.COMPAT_SHELL_AUTO_APPROVE_SHELL === '1',
93 sessionStore: createSessionStore(workspaceDir),
94 noSave: options.noSave === true || process.env.COMPAT_SHELL_NO_SAVE === '1',
95 }
96}
97
98async function runUserTurn(prompt, state, rl) {
99 state.messages.push({

Callers 2

runPromptOnceFunction · 0.85
mainFunction · 0.85

Calls 3

getClientConfigFunction · 0.90
createSessionStoreFunction · 0.90
parsePositiveIntFunction · 0.85

Tested by

no test coverage detected