opencode-codegraph 0.1.26 → 0.1.28

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.28 - 2026-03-21
4
+
5
+ - surface primary issue and recovery sequence in plugin workflow summaries so competing blockers are shown in a prioritized order
6
+
7
+ ## 0.1.27 - 2026-03-21
8
+
9
+ - surface primary issue and recovery sequence in plugin workflow summaries so competing states are presented in a prioritized order
10
+
3
11
  ## 0.1.26 - 2026-03-21
4
12
 
5
13
  - include lock holders, recovery steps, and maintenance action details directly in plugin workflow summaries
package/README.md CHANGED
@@ -115,7 +115,7 @@ Place in `.opencode/commands/`:
115
115
  | `chat.message` (edit intent) | Add pre-edit warnings for files likely to be modified |
116
116
  | `chat.message` (workflow intent) | Add dogfooding status when the user asks what to do next |
117
117
  | `tool.execute.after` on test commands | Add after-test workflow guidance and detect failed test runs before suggesting the next command |
118
- | `tool.execute.after` on `git status` / `git diff` | Add current workflow guidance directly to common git inspection commands |
118
+ | `tool.execute.after` on `git status` / `git diff` | Add the same normalized workflow guidance block used by other status-oriented surfaces |
119
119
  | `tool.execute.after` | Trigger CPG update after git commit and append structured post-commit review summary |
120
120
  | generic `tool.execute.after` | Surface workflow-state transitions after other bash commands when the underlying state changes |
121
121
  | `codegraph_review` tool | Returns review results together with current workflow guidance and suggested follow-up command |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codegraph",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
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
@@ -280,7 +280,7 @@ const codegraphPlugin: Plugin = async (input) => {
280
280
  const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
281
281
  const status = JSON.parse(rawStatus)
282
282
  const transition = workflowTransition(status)
283
- const guidance = formatDogfoodStatusSummary(status)
283
+ const guidance = formatWorkflowGuidanceBlock(status)
284
284
  if (guidance) {
285
285
  output.title = "CodeGraph: git workflow guidance ready"
286
286
  const existingOutput = output.output?.trimEnd() || ""
package/src/util.ts CHANGED
@@ -48,6 +48,8 @@ export type DogfoodStatusSnapshot = {
48
48
  workflow_state?: string
49
49
  recommended_next_action?: string
50
50
  recommended_command?: string
51
+ primary_issue?: string
52
+ recovery_sequence?: string[]
51
53
  blockers?: string[]
52
54
  warnings?: string[]
53
55
  closure?: {
@@ -56,6 +58,67 @@ export type DogfoodStatusSnapshot = {
56
58
  before_push?: string
57
59
  }
58
60
  }
61
+
62
+ function workflowSummaryLines(snapshot: DogfoodStatusSnapshot): string[] {
63
+ const workflowState = snapshot.workflow_state
64
+ const nextAction = snapshot.recommended_next_action
65
+ const nextCommand = snapshot.recommended_command
66
+ const primaryIssue = snapshot.primary_issue
67
+ const recoverySequence = Array.isArray(snapshot.recovery_sequence)
68
+ ? snapshot.recovery_sequence.filter(Boolean)
69
+ : []
70
+ const blockers = Array.isArray(snapshot.blockers) ? snapshot.blockers.filter(Boolean) : []
71
+ const warnings = Array.isArray(snapshot.warnings) ? snapshot.warnings.filter(Boolean) : []
72
+ const closure = snapshot.closure || {}
73
+ const dbLock = snapshot.db_lock || null
74
+ const maintenance = snapshot.db_maintenance || null
75
+
76
+ const lines: string[] = []
77
+ if (workflowState) {
78
+ lines.push(`- Workflow state: ${workflowState}`)
79
+ }
80
+ if (nextAction) {
81
+ lines.push(`- Next action: ${nextAction}`)
82
+ }
83
+ if (nextCommand) {
84
+ lines.push(`- Suggested command: ${nextCommand}`)
85
+ }
86
+ if (primaryIssue) {
87
+ lines.push(`- Primary issue: ${primaryIssue}`)
88
+ }
89
+ if (recoverySequence.length) {
90
+ lines.push(`- Recovery sequence: ${recoverySequence.join(" -> ")}`)
91
+ }
92
+ if (blockers.length) {
93
+ lines.push(`- Blockers: ${blockers.join("; ")}`)
94
+ }
95
+ if (warnings.length) {
96
+ lines.push(`- Warnings: ${warnings.join("; ")}`)
97
+ }
98
+ if (closure.what_improved) {
99
+ lines.push(`- What improved: ${closure.what_improved}`)
100
+ }
101
+ if (closure.still_blocked) {
102
+ lines.push(`- Still blocked: ${closure.still_blocked}`)
103
+ }
104
+ if (closure.before_push) {
105
+ lines.push(`- Before push: ${closure.before_push}`)
106
+ }
107
+ if (maintenance?.recommended_action) {
108
+ lines.push(`- Maintenance action: ${maintenance.recommended_action}`)
109
+ }
110
+ if (dbLock?.locked) {
111
+ const holders = Array.isArray(dbLock.holders) ? dbLock.holders.filter(Boolean) : []
112
+ const recovery = Array.isArray(dbLock.recovery) ? dbLock.recovery.filter(Boolean) : []
113
+ if (holders.length) {
114
+ lines.push(`- Lock holders: ${holders.join("; ")}`)
115
+ }
116
+ if (recovery.length) {
117
+ lines.push(`- Lock recovery: ${recovery.join("; ")}`)
118
+ }
119
+ }
120
+ return lines
121
+ }
59
122
 
60
123
  /**
61
124
  * Extract file references from message parts.
@@ -407,14 +470,9 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
407
470
  const maintenance = snapshot.db_maintenance || null
408
471
  const dbLock = snapshot.db_lock || null
409
472
  const traceStatus = reviewTrace?.status || "missing"
410
- const workflowState = snapshot.workflow_state
411
- const nextAction = snapshot.recommended_next_action
412
- const nextCommand = (snapshot as { recommended_command?: string }).recommended_command
413
- const blockers = Array.isArray(snapshot.blockers) ? snapshot.blockers.filter(Boolean) : []
414
- const warnings = Array.isArray(snapshot.warnings) ? snapshot.warnings.filter(Boolean) : []
415
- const closure = snapshot.closure || {}
473
+ const summaryLines = workflowSummaryLines(snapshot)
416
474
 
417
- if (typeof isFresh === "undefined" && !headCommit && !nextAction) {
475
+ if (typeof isFresh === "undefined" && !headCommit && summaryLines.length === 0) {
418
476
  return null
419
477
  }
420
478
 
@@ -452,86 +510,18 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
452
510
  }
453
511
  }
454
512
  lines.push(`- Review trace: ${traceStatus}`)
455
- if (workflowState) {
456
- lines.push(`- Workflow state: ${workflowState}`)
457
- }
458
- if (nextAction) {
459
- lines.push(`- Next action: ${nextAction}`)
460
- }
461
- if (nextCommand) {
462
- lines.push(`- Suggested command: ${nextCommand}`)
463
- }
464
- if (blockers.length) {
465
- lines.push(`- Blockers: ${blockers.join("; ")}`)
466
- }
467
- if (warnings.length) {
468
- lines.push(`- Warnings: ${warnings.join("; ")}`)
469
- }
470
- if (closure.what_improved) {
471
- lines.push(`- What improved: ${closure.what_improved}`)
472
- }
473
- if (closure.still_blocked) {
474
- lines.push(`- Still blocked: ${closure.still_blocked}`)
475
- }
476
- if (closure.before_push) {
477
- lines.push(`- Before push: ${closure.before_push}`)
478
- }
513
+ lines.push(...summaryLines)
479
514
  return lines.join("\n")
480
515
  }
481
516
 
482
517
  export function formatWorkflowGuidanceBlock(snapshot: DogfoodStatusSnapshot): string | null {
483
- const workflowState = snapshot.workflow_state
484
- const nextAction = snapshot.recommended_next_action
485
- const nextCommand = snapshot.recommended_command
486
- const blockers = Array.isArray(snapshot.blockers) ? snapshot.blockers.filter(Boolean) : []
487
- const warnings = Array.isArray(snapshot.warnings) ? snapshot.warnings.filter(Boolean) : []
488
- const closure = snapshot.closure || {}
489
- const dbLock = snapshot.db_lock || null
490
- const maintenance = snapshot.db_maintenance || null
518
+ const lines = workflowSummaryLines(snapshot)
491
519
 
492
- if (!workflowState && !nextAction && !nextCommand && !blockers.length && !warnings.length) {
520
+ if (!lines.length) {
493
521
  return null
494
522
  }
495
523
 
496
- const lines = ["## CodeGraph Workflow Guidance", ""]
497
- if (workflowState) {
498
- lines.push(`- Workflow state: ${workflowState}`)
499
- }
500
- if (nextAction) {
501
- lines.push(`- Next action: ${nextAction}`)
502
- }
503
- if (nextCommand) {
504
- lines.push(`- Suggested command: ${nextCommand}`)
505
- }
506
- if (blockers.length) {
507
- lines.push(`- Blockers: ${blockers.join("; ")}`)
508
- }
509
- if (warnings.length) {
510
- lines.push(`- Warnings: ${warnings.join("; ")}`)
511
- }
512
- if (closure.what_improved) {
513
- lines.push(`- What improved: ${closure.what_improved}`)
514
- }
515
- if (closure.still_blocked) {
516
- lines.push(`- Still blocked: ${closure.still_blocked}`)
517
- }
518
- if (closure.before_push) {
519
- lines.push(`- Before push: ${closure.before_push}`)
520
- }
521
- if (maintenance?.recommended_action) {
522
- lines.push(`- Maintenance action: ${maintenance.recommended_action}`)
523
- }
524
- if (dbLock?.locked) {
525
- const holders = Array.isArray(dbLock.holders) ? dbLock.holders.filter(Boolean) : []
526
- const recovery = Array.isArray(dbLock.recovery) ? dbLock.recovery.filter(Boolean) : []
527
- if (holders.length) {
528
- lines.push(`- Lock holders: ${holders.join("; ")}`)
529
- }
530
- if (recovery.length) {
531
- lines.push(`- Lock recovery: ${recovery.join("; ")}`)
532
- }
533
- }
534
- return lines.join("\n")
524
+ return ["## CodeGraph Workflow Guidance", "", ...lines].join("\n")
535
525
  }
536
526
 
537
527
  export function formatWorkflowStateTransition(
@@ -578,33 +568,7 @@ export function formatAfterTestGuidance(
578
568
  lines.push("- Suggested command: rerun the failing tests after you fix them")
579
569
  return lines.join("\n")
580
570
  }
581
- if (workflowState) {
582
- lines.push(`- Workflow state: ${workflowState}`)
583
- }
584
- if (nextAction) {
585
- lines.push(`- Next action: ${nextAction}`)
586
- }
587
- if (nextCommand) {
588
- lines.push(`- Suggested command: ${nextCommand}`)
589
- }
590
- const blockers = Array.isArray(snapshot.blockers) ? snapshot.blockers.filter(Boolean) : []
591
- const warnings = Array.isArray(snapshot.warnings) ? snapshot.warnings.filter(Boolean) : []
592
- const closure = snapshot.closure || {}
593
- if (blockers.length) {
594
- lines.push(`- Blockers: ${blockers.join("; ")}`)
595
- }
596
- if (warnings.length) {
597
- lines.push(`- Warnings: ${warnings.join("; ")}`)
598
- }
599
- if (closure.what_improved) {
600
- lines.push(`- What improved: ${closure.what_improved}`)
601
- }
602
- if (closure.still_blocked) {
603
- lines.push(`- Still blocked: ${closure.still_blocked}`)
604
- }
605
- if (closure.before_push) {
606
- lines.push(`- Before push: ${closure.before_push}`)
607
- }
571
+ lines.push(...workflowSummaryLines(snapshot))
608
572
  return lines.join("\n")
609
573
  }
610
574