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

Function parseReplayScriptDetailed

src/replay/script.ts:43–67  ·  view source on GitHub ↗
(script: string)

Source from the content-addressed store, hash-verified

41};
42
43export function parseReplayScriptDetailed(script: string): ParsedReplayScript {
44 const actions: SessionAction[] = [];
45 const actionLines: number[] = [];
46 const lines = script.split(/\r?\n/);
47 let sawAction = false;
48 for (const [index, rawLine] of lines.entries()) {
49 const trimmed = rawLine.trim();
50 if (trimmed.length === 0 || trimmed.startsWith('#')) continue;
51 if (isReplayEnvLine(trimmed)) {
52 if (sawAction) {
53 throw new AppError(
54 'INVALID_ARGS',
55 `env directives must precede all actions (line ${index + 1}).`,
56 );
57 }
58 continue;
59 }
60 const parsed = parseReplayScriptLine(rawLine);
61 if (!parsed) continue;
62 actions.push(parsed);
63 actionLines.push(index + 1);
64 sawAction = true;
65 }
66 return { actions, actionLines };
67}
68
69// fallow-ignore-next-line complexity
70export function readReplayScriptMetadata(script: string): ReplayScriptMetadata {

Callers 4

parseReplayInputFunction · 0.90
script.test.tsFile · 0.90

Calls 4

isReplayEnvLineFunction · 0.85
parseReplayScriptLineFunction · 0.85
startsWithMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected