MCPcopy Index your code
hub / github.com/callstack/agent-device / formatScript

Function formatScript

src/daemon/session-script-writer.ts:156–169  ·  view source on GitHub ↗
(session: SessionState, actions: SessionAction[])

Source from the content-addressed store, hash-verified

154}
155
156function formatScript(session: SessionState, actions: SessionAction[]): string {
157 const lines: string[] = [];
158 const kind = session.device.kind ? ` kind=${session.device.kind}` : '';
159 const theme = 'unknown';
160 lines.push(
161 // approach (b): emit the PUBLIC leaf platform (ios/macos), never the internal `apple`.
162 `context platform=${publicPlatformString(session.device)} device=${formatScriptStringLiteral(session.device.name)}${kind} theme=${theme}`,
163 );
164 for (const action of actions) {
165 if (action.flags?.noRecord) continue;
166 lines.push(formatActionLine(action));
167 }
168 return `${lines.join('\n')}\n`;
169}
170
171function formatActionLine(action: SessionAction): string {
172 const parts: string[] = [action.command];

Callers 1

formatSessionScriptFunction · 0.85

Calls 4

publicPlatformStringFunction · 0.90
formatActionLineFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected