feat: integrate plannotator as human-in-the-loop review layer#1164
Open
Dfg805 wants to merge 1 commit into
Open
feat: integrate plannotator as human-in-the-loop review layer#1164Dfg805 wants to merge 1 commit into
Dfg805 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Plannotator integration module under packages/opencode/src/integrations/plannotator/ to support a human-in-the-loop review step for both plans and implementation diffs, with accompanying documentation/architecture notes.
Changes:
- Added a Plannotator “review client” that spawns the
plannotatorCLI and exchanges JSON over stdio. - Added hooks/workflow wrappers to insert plan/code review steps and persist review artifacts to a local dataset directory.
- Added docs describing the integration and its architecture.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/opencode/src/integrations/plannotator/skill.ts | High-level workflow wrapper around Plannotator hooks. |
| packages/opencode/src/integrations/plannotator/review_client.ts | CLI bridge that spawns Plannotator and parses its JSON output. |
| packages/opencode/src/integrations/plannotator/hooks.ts | “Before execution / after implementation” hooks and dataset persistence. |
| packages/opencode/src/integrations/plannotator/importer.ts | Parses Plannotator output into a normalized feedback shape. |
| packages/opencode/src/integrations/plannotator/exporter.ts | Formats MiMo plan content into Plannotator-friendly Markdown. |
| packages/opencode/src/integrations/plannotator/README.md | Integration README describing components/workflow. |
| docs/plannotator_integration_guide.md | User guide for enabling/using the integration. |
| docs/integration_architecture.d2 | Architecture diagram for the integration flow. |
| docs/architecture_report.md | Longer-form architecture writeup for the integration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7
to
+12
| import { AppFileSystem } from "../../file" | ||
|
|
||
| export interface ReviewClient { | ||
| submitPlan(plan: string): Effect.Effect<any, Error> | ||
| submitDiff(diff: string, description: string): Effect.Effect<any, Error> | ||
| } |
| const spawner = yield* ChildProcessSpawner.ChildProcessSpawner | ||
| const fsys = yield* AppFileSystem.Service | ||
|
|
||
| const runPlannotator = (mode: string, input: any) => |
Comment on lines
+66
to
+70
| try { | ||
| return JSON.parse(stdout) | ||
| } catch (e) { | ||
| return yield* Effect.fail(new Error(`Failed to parse Plannotator output: ${stdout}`)) | ||
| } |
Comment on lines
+4
to
+6
| import { importFeedback, PlannotatorFeedback } from "./importer" | ||
| import { AppFileSystem } from "../../file" | ||
| import path from "path" |
| const saveToDataset = (data: any) => Effect.gen(function* () { | ||
| const datasetDir = "datasets/plannotator_feedback" | ||
| yield* fsys.mkdir(datasetDir, { recursive: true }) | ||
| const filename = `${Date.now()}.json` |
Comment on lines
+1
to
+16
| import { Instance } from "../../project/instance" | ||
| import path from "path" | ||
|
|
||
| /** | ||
| * Chuyển đổi kế hoạch của MiMo-Code sang định dạng Markdown tương thích với Plannotator. | ||
| */ | ||
| export function exportPlan(planContent: string, taskTitle: string): string { | ||
| const header = `# Task\n\n${taskTitle}\n\n# Plan\n\n` | ||
|
|
||
| // Kiểm tra nếu kế hoạch đã có tiêu đề hoặc định dạng Markdown phù hợp | ||
| if (planContent.trim().startsWith("#")) { | ||
| return `${header}${planContent}` | ||
| } | ||
|
|
||
| return `${header}${planContent}` | ||
| } |
Comment on lines
+1
to
+11
| import { Effect } from "effect" | ||
| import { PlannotatorHooks } from "./hooks" | ||
| import { Question } from "../../question" | ||
|
|
||
| /** | ||
| * Tích hợp Plannotator vào quy trình compose của MiMo-Code. | ||
| */ | ||
| export const PlannotatorWorkflow = Effect.gen(function* () { | ||
| const hooks = yield* PlannotatorHooks | ||
| const question = yield* Question.Service | ||
|
|
| import { PlannotatorWorkflow } from "../../integrations/plannotator/skill" | ||
|
|
||
| // Trong logic lập kế hoạch | ||
| const result = yield* PlannotatorWorkflow.reviewPlan(planContent, taskTitle) |
| approval_status: "approved" | "rejected" | "dismissed" | ||
| } | ||
|
|
||
| export function importFeedback(plannotatorOutput: any): PlannotatorFeedback { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #
Type of change
What does this PR do?
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.