MCPcopy Create free account
hub / github.com/cli/cli / attachments

Function attachments

evals/src/suites/events/commands.ts:48–67  ·  view source on GitHub ↗
(call: Call)

Source from the content-addressed store, hash-verified

46/** The times a listener reported on stderr that its stream attached, and whether it still is: it reports each
47 * reconnect before attaching again. Changes made while no stream is attached are never delivered. */
48export function attachments(call: Call): { at: number[]; attached: boolean } {
49 const at: number[] = [];
50 let attached = false;
51 if (call.kind !== "gh") return { at, attached };
52 let partial = "";
53 for (const chunk of call.output) {
54 if (chunk.stream !== "stderr") continue;
55 const lines = (partial + chunk.text).split("\n");
56 partial = lines.pop() ?? "";
57 for (const line of lines) {
58 if (line.startsWith("Listening for events")) {
59 at.push(chunk.at);
60 attached = true;
61 } else if (/reconnecting|retrying|creating it again/.test(line)) {
62 attached = false;
63 }
64 }
65 }
66 return { at, attached };
67}
68
69/** When the listener's current stream attached, or undefined while no stream is attached. */
70export function attachedSince(call: Call): number | undefined {

Callers 3

commands.test.tsFile · 0.85
attachedSinceFunction · 0.85
analyseFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected