MCPcopy Index your code
hub / github.com/anomalyco/opencode / renderPrompt

Function renderPrompt

packages/opencode/src/tool/shell/prompt.ts:28–34  ·  view source on GitHub ↗
(template: string, values: Record<string, string>)

Source from the content-addressed store, hash-verified

26export type Parameters = Schema.Schema.Type<typeof Parameters>
27
28function renderPrompt(template: string, values: Record<string, string>) {
29 return template.replace(/\$\{(\w+)\}/g, (_, key: string) => {
30 const value = values[key]
31 if (value === undefined) throw new Error(`Missing shell prompt value: ${key}`)
32 return value
33 })
34}
35
36function shellDisplayName(name: string) {
37 if (name === "pwsh") return "PowerShell (7+)"

Callers 1

renderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected