MCPcopy Create free account
hub / github.com/backnotprop/plannotator / runPlanReview

Function runPlanReview

apps/opencode-plugin/index.ts:231–278  ·  view source on GitHub ↗
(input: {
  client: any;
  runtime: RuntimeMode;
  planContent: string;
  sharingEnabled: boolean;
  shareBaseUrl?: string;
  pasteApiUrl?: string;
  htmlContent: string;
  timeoutSeconds: number | null;
  cwd?: string;
  bridge: OpenCodeBridgeContext;
})

Source from the content-addressed store, hash-verified

229}
230
231async function runPlanReview(input: {
232 client: any;
233 runtime: RuntimeMode;
234 planContent: string;
235 sharingEnabled: boolean;
236 shareBaseUrl?: string;
237 pasteApiUrl?: string;
238 htmlContent: string;
239 timeoutSeconds: number | null;
240 cwd?: string;
241 bridge: OpenCodeBridgeContext;
242}): Promise<OpenCodePlanReviewResult> {
243 if (input.runtime === "embedded" && !hasEmbeddedRuntime()) {
244 throw new Error(getEmbeddedRuntimeError());
245 }
246
247 if (shouldUseEmbeddedRuntime(input.runtime)) {
248 try {
249 const embedded = await importEmbeddedRuntime();
250 return await embedded.runEmbeddedPlanReview({
251 client: input.client,
252 planContent: input.planContent,
253 sharingEnabled: input.sharingEnabled,
254 shareBaseUrl: input.shareBaseUrl,
255 pasteApiUrl: input.pasteApiUrl,
256 htmlContent: input.htmlContent,
257 timeoutSeconds: input.timeoutSeconds,
258 logReady: (url) => logPlannotatorReady(input.client, "plan review", url),
259 });
260 } catch (error) {
261 if (input.runtime === "embedded") throw error;
262 try {
263 void input.client.app.log({
264 level: "error",
265 message: `[Plannotator] Embedded runtime unavailable; falling back to CLI: ${error instanceof Error ? error.message : String(error)}`,
266 });
267 } catch {}
268 }
269 }
270
271 return await runCliPlanReview({
272 client: input.client,
273 planContent: input.planContent,
274 cwd: input.cwd,
275 timeoutSeconds: input.timeoutSeconds,
276 bridge: input.bridge,
277 });
278}
279
280const PlannotatorPlugin: Plugin = async (ctx, rawOptions?: PlannotatorOpenCodeOptions) => {
281 const workflowOptions = normalizeWorkflowOptions(rawOptions);

Callers 1

executeFunction · 0.85

Calls 6

runCliPlanReviewFunction · 0.90
hasEmbeddedRuntimeFunction · 0.85
getEmbeddedRuntimeErrorFunction · 0.85
shouldUseEmbeddedRuntimeFunction · 0.85
importEmbeddedRuntimeFunction · 0.85
logPlannotatorReadyFunction · 0.85

Tested by

no test coverage detected