(port: number, token: string)
| 95 | } |
| 96 | |
| 97 | export function buildSessionStartHookConfigArgs(port: number, token: string): string[] { |
| 98 | const { command, args } = getHappyCliCommand([ |
| 99 | 'hook-forwarder', |
| 100 | '--port', |
| 101 | String(port), |
| 102 | '--token', |
| 103 | token |
| 104 | ]); |
| 105 | const hookCommand = shellJoin([command, ...args]); |
| 106 | const escapedHookCommand = escapeTomlString(hookCommand); |
| 107 | const hookConfig = `hooks.SessionStart=[{ hooks = [{ type = "command", command = "${escapedHookCommand}" }] }]`; |
| 108 | const trustedHash = buildSessionStartHookTrustedHash(hookCommand); |
| 109 | const escapedStateKey = escapeTomlString(sessionFlagsHookStateKey()); |
| 110 | const hookState = `hooks.state={"${escapedStateKey}"={trusted_hash="${trustedHash}"}}`; |
| 111 | return ['-c', hookConfig, '-c', hookState]; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Build -c arguments for MCP server configuration. |
no test coverage detected