MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / formatHelpMessage

Function formatHelpMessage

lib/commands/help.ts:44–64  ·  view source on GitHub ↗
(state: SessionState, config: PluginConfig)

Source from the content-addressed store, hash-verified

42}
43
44export function formatHelpMessage(state: SessionState, config: PluginConfig): string {
45 const commands = getVisibleCommands(state, config)
46 const colWidth = Math.max(...commands.map(([cmd]) => cmd.length)) + 4
47 const lines: string[] = []
48
49 lines.push("╭─────────────────────────────────────────────────────────────────────────╮")
50 lines.push("│ DCP Commands │")
51 lines.push("╰─────────────────────────────────────────────────────────────────────────╯")
52 lines.push("")
53 lines.push(` ${"Manual mode:".padEnd(colWidth)}${state.manualMode ? "ON" : "OFF"}`)
54 lines.push("")
55 lines.push(" Open the command palette for DCP modal commands.")
56 lines.push(" Use /dcp-compress [focus] when you want DCP to ask the model to run compression.")
57 lines.push("")
58 for (const [cmd, desc] of commands) {
59 lines.push(` ${cmd.padEnd(colWidth)}${desc}`)
60 }
61 lines.push("")
62
63 return lines.join("\n")
64}
65
66export async function handleHelpCommand(ctx: HelpCommandContext): Promise<void> {
67 const { client, state, logger, sessionId, messages } = ctx

Callers 1

handleHelpCommandFunction · 0.85

Calls 1

getVisibleCommandsFunction · 0.85

Tested by

no test coverage detected