Spot the bug in the IDE bridge

from AI IDEs
Node 24 intermediate 7 min 3 issues to find

Find the scope, command, and completion bugs in this generated IDE bridge.

JavaScript
import { readFileSync, writeFileSync } from "node:fs";
import { exec } from "node:child_process";

function applySuggestion(workspace, request, proposal) {
  const contextPath = `${workspace}/${request.context}`;
  const context = readFileSync(contextPath, "utf8");
  const command = `cd ${workspace} && ${proposal.command}`;
  exec(command, () => console.log("checked"));
  const target = `${workspace}/${proposal.path}`;
  writeFileSync(target, proposal.content);
  return { status: "done", context };
}
Open in playground
Report an error