MCPcopy Create free account
hub / github.com/anomalyco/opencode / detectSlashCommand

Function detectSlashCommand

packages/opencode/src/acp/service.ts:803–814  ·  view source on GitHub ↗
(parts: ReturnType<typeof promptContentToParts>)

Source from the content-addressed store, hash-verified

801}
802
803function detectSlashCommand(parts: ReturnType<typeof promptContentToParts>) {
804 const text = parts
805 .filter((part): part is Extract<(typeof parts)[number], { type: "text" }> => part.type === "text")
806 .map((part) => part.text)
807 .join("")
808 .trim()
809 if (!text.startsWith("/")) return
810
811 const [name, ...rest] = text.slice(1).split(/\s+/)
812 if (!name) return
813 return { name, args: rest.join(" ").trim() }
814}
815
816const promptResponse = Effect.fn("ACP.promptResponse")(function* (
817 info: AssistantInfo,

Callers 1

makeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected