MCPcopy Index your code
hub / github.com/github/awesome-copilot / buildState

Function buildState

extensions/java-modernization-studio/server.mjs:33–49  ·  view source on GitHub ↗
(rec, { recheckEnv = false } = {})

Source from the content-addressed store, hash-verified

31 * (real instances), so unit tests stay fast and deterministic.
32 */
33export async function buildState(rec, { recheckEnv = false } = {}) {
34 const state = await scanRepo(rec.repoPath);
35 if (state && state.ok && typeof rec.runDoctor === "function") {
36 if (recheckEnv || rec.doctor == null) {
37 try {
38 rec.doctor = await rec.runDoctor(state);
39 } catch {
40 rec.doctor = rec.doctor || null;
41 }
42 }
43 state.doctor = rec.doctor;
44 } else if (state && state.ok) {
45 state.doctor = rec.doctor || null;
46 }
47 if (state && state.ok) state.autopilot = rec.autopilot || null;
48 return state;
49}
50
51/** Write an SSE payload to every connected client of an instance. */
52export function broadcast(rec, payload) {

Callers 3

pushStateFunction · 0.70
startAutopilotFunction · 0.70
makeHandlerFunction · 0.70

Calls 1

scanRepoFunction · 0.90

Tested by

no test coverage detected