opencode-codegraph 0.1.26 → 0.1.30

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,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.30 - 2026-03-21
4
+
5
+ - align git-oriented guidance and workflow-transition rendering with the shared workflow guidance block
6
+
7
+ ## 0.1.29 - 2026-03-21
8
+
9
+ - align workflow-transition formatting with the shared guidance block so git-oriented guidance uses the same normalized renderer as other status surfaces
10
+
11
+ ## 0.1.28 - 2026-03-21
12
+
13
+ - surface primary issue and recovery sequence in plugin workflow summaries so competing blockers are shown in a prioritized order
14
+
15
+ ## 0.1.27 - 2026-03-21
16
+
17
+ - surface primary issue and recovery sequence in plugin workflow summaries so competing states are presented in a prioritized order
18
+
3
19
  ## 0.1.26 - 2026-03-21
4
20
 
5
21
  - 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 |
@@ -127,6 +127,8 @@ Place in `.opencode/commands/`:
127
127
  Across status-oriented surfaces, the plugin is converging on one shared summary contract:
128
128
 
129
129
  - workflow state
130
+ - primary issue
131
+ - recovery sequence
130
132
  - blockers
131
133
  - warnings
132
134
  - what improved
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codegraph",
3
- "version": "0.1.26",
3
+ "version": "0.1.30",
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
@@ -68,8 +68,8 @@ const codegraphPlugin: Plugin = async (input) => {
68
68
  }
69
69
 
70
70
  const workflowTransition = (status: Record<string, unknown>) => {
71
- const { workflowState, nextAction, nextCommand } = workflowFields(status)
72
- const message = formatWorkflowStateTransition(lastWorkflowState, workflowState, nextAction, nextCommand)
71
+ const message = formatWorkflowStateTransition(lastWorkflowState, status as any)
72
+ const { workflowState } = workflowFields(status)
73
73
  if (workflowState) {
74
74
  lastWorkflowState = workflowState
75
75
  }
@@ -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,75 @@ 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
+ }
122
+
123
+ function formatSummaryBlock(title: string, snapshot: DogfoodStatusSnapshot): string | null {
124
+ const lines = workflowSummaryLines(snapshot)
125
+ if (!lines.length) {
126
+ return null
127
+ }
128
+ return [title, "", ...lines].join("\n")
129
+ }
59
130
 
60
131
  /**
61
132
  * Extract file references from message parts.
@@ -407,14 +478,9 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
407
478
  const maintenance = snapshot.db_maintenance || null
408
479
  const dbLock = snapshot.db_lock || null
409
480
  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 || {}
481
+ const summaryLines = workflowSummaryLines(snapshot)
416
482
 
417
- if (typeof isFresh === "undefined" && !headCommit && !nextAction) {
483
+ if (typeof isFresh === "undefined" && !headCommit && summaryLines.length === 0) {
418
484
  return null
419
485
  }
420
486
 
@@ -452,110 +518,47 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
452
518
  }
453
519
  }
454
520
  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
- }
521
+ lines.push(...summaryLines)
479
522
  return lines.join("\n")
480
523
  }
481
524
 
482
525
  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
491
-
492
- if (!workflowState && !nextAction && !nextCommand && !blockers.length && !warnings.length) {
493
- return null
494
- }
495
-
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")
526
+ return formatSummaryBlock("## CodeGraph Workflow Guidance", snapshot)
535
527
  }
536
528
 
537
529
  export function formatWorkflowStateTransition(
538
530
  previousState: string | null,
539
- currentState: string | null,
540
- nextAction: string | undefined,
541
- nextCommand: string | undefined,
531
+ snapshot: DogfoodStatusSnapshot,
542
532
  ): string | null {
533
+ const currentState = snapshot.workflow_state || null
543
534
  if (!previousState || !currentState || previousState === currentState) {
544
535
  return null
545
536
  }
546
537
 
538
+ const nextAction = snapshot.recommended_next_action
539
+ const nextCommand = snapshot.recommended_command
540
+ const primaryIssue = snapshot.primary_issue
541
+ const blockers = Array.isArray(snapshot.blockers) ? snapshot.blockers.filter(Boolean) : []
542
+
547
543
  const lines = [
548
544
  "## CodeGraph Workflow Update",
549
545
  "",
550
546
  `- Workflow state changed: ${previousState} -> ${currentState}`,
551
547
  ]
552
548
 
549
+ if (primaryIssue) {
550
+ lines.push(`- Primary issue: ${primaryIssue}`)
551
+ }
552
+
553
553
  if (nextAction) {
554
554
  lines.push(`- Next action: ${nextAction}`)
555
555
  }
556
556
  if (nextCommand) {
557
557
  lines.push(`- Suggested command: ${nextCommand}`)
558
558
  }
559
+ if (blockers.length) {
560
+ lines.push(`- Blockers: ${blockers.join("; ")}`)
561
+ }
559
562
  return lines.join("\n")
560
563
  }
561
564
 
@@ -578,34 +581,7 @@ export function formatAfterTestGuidance(
578
581
  lines.push("- Suggested command: rerun the failing tests after you fix them")
579
582
  return lines.join("\n")
580
583
  }
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
- }
608
- return lines.join("\n")
584
+ return formatSummaryBlock("## CodeGraph After-Test Guidance", snapshot)
609
585
  }
610
586
 
611
587
  // File extensions recognized as source code