opencode-codegraph 0.1.19 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.20 - 2026-03-20
4
+
5
+ - append workflow guidance to the `codegraph_review` custom tool so tool results stay aligned with current dogfooding state
6
+
3
7
  ## 0.1.19 - 2026-03-20
4
8
 
5
9
  - add workflow guidance directly to `git status` and `git diff` command output inside OpenCode
package/README.md CHANGED
@@ -117,6 +117,7 @@ Place in `.opencode/commands/`:
117
117
  | `tool.execute.after` on test commands | Add after-test workflow guidance and detect failed test runs before suggesting the next command |
118
118
  | `tool.execute.after` on `git status` / `git diff` | Add current workflow guidance directly to common git inspection commands |
119
119
  | `tool.execute.after` | Trigger CPG update after git commit and append structured post-commit review summary |
120
+ | `codegraph_review` tool | Returns review results together with current workflow guidance and suggested follow-up command |
120
121
  | `experimental.session.compacting` | Preserve current dogfooding status when OpenCode compacts long sessions |
121
122
  | `command.execute.before` | Inject current dogfooding status into `/review`, `/audit`, `/update`, `/status`, and `/next` |
122
123
  | `permission.ask` | Auto-allow `codegraph_*` tools |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codegraph",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "OpenCode plugin for CodeGraph CPG-powered code analysis",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/index.ts CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  formatDogfoodStatusSummary,
23
23
  formatPendingReviewTraceSummary,
24
24
  formatReviewTraceSummary,
25
+ formatWorkflowGuidanceBlock,
25
26
  getHeadCommit,
26
27
  isGitCommit,
27
28
  isGitStatusLikeCommand,
@@ -295,17 +296,22 @@ const codegraphPlugin: Plugin = async (input) => {
295
296
  .optional()
296
297
  .describe("Base git ref to compare against (default: HEAD~1)"),
297
298
  },
298
- async execute(args) {
299
- const baseRef = args.base_ref || "HEAD~1"
300
- const diff = await $`git diff ${baseRef}`.quiet().text()
301
- if (!diff.trim()) {
302
- return "No changes found."
303
- }
304
-
305
- const result = await api.reviewChanges(projectId, diff, baseRef)
306
- return result
307
- },
308
- }),
299
+ async execute(args) {
300
+ const baseRef = args.base_ref || "HEAD~1"
301
+ const diff = await $`git diff ${baseRef}`.quiet().text()
302
+ const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
303
+ const status = JSON.parse(rawStatus)
304
+ const guidance = formatWorkflowGuidanceBlock(status)
305
+ if (!diff.trim()) {
306
+ return guidance ? `No changes found.\n\n${guidance}` : "No changes found."
307
+ }
308
+
309
+ const result = await api.reviewChanges(projectId, diff, baseRef)
310
+ return guidance
311
+ ? `${result}\n\n${guidance}\n\nUse the suggested command if the review result and session state disagree.`
312
+ : result
313
+ },
314
+ }),
309
315
 
310
316
  codegraph_explain_function: tool({
311
317
  description:
package/src/util.ts CHANGED
@@ -417,6 +417,28 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
417
417
  return lines.join("\n")
418
418
  }
419
419
 
420
+ export function formatWorkflowGuidanceBlock(snapshot: DogfoodStatusSnapshot): string | null {
421
+ const workflowState = snapshot.workflow_state
422
+ const nextAction = snapshot.recommended_next_action
423
+ const nextCommand = snapshot.recommended_command
424
+
425
+ if (!workflowState && !nextAction && !nextCommand) {
426
+ return null
427
+ }
428
+
429
+ const lines = ["## CodeGraph Workflow Guidance", ""]
430
+ if (workflowState) {
431
+ lines.push(`- Workflow state: ${workflowState}`)
432
+ }
433
+ if (nextAction) {
434
+ lines.push(`- Next action: ${nextAction}`)
435
+ }
436
+ if (nextCommand) {
437
+ lines.push(`- Suggested command: ${nextCommand}`)
438
+ }
439
+ return lines.join("\n")
440
+ }
441
+
420
442
  export function formatAfterTestGuidance(
421
443
  snapshot: DogfoodStatusSnapshot,
422
444
  testFailed = false,