opencode-codegraph 0.1.7 → 0.1.8

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.8 - 2026-03-20
4
+
5
+ - add normalized workflow states (`refresh_needed`, `trace_pending`, `review_required`, `ready_to_continue`) across dogfooding status and review trace flows
6
+ - surface a recommended command alongside next-action guidance in session-start, status, and post-commit summaries
7
+ - align `/review`, `/audit`, and `/update` around the same status-derived command guidance
8
+
3
9
  ## 0.1.7 - 2026-03-20
4
10
 
5
11
  - add command-oriented next-step guidance (`/status`, `/update`, `/review`) to review-trace and dogfooding status flows
package/README.md CHANGED
@@ -46,6 +46,7 @@ Every conversation includes:
46
46
  - a project summary with file count, top complexity hotspots, and open security findings;
47
47
  - a lightweight dogfooding status block when available, including freshness, current `HEAD`, review-trace state, and recommended next action.
48
48
  - a recommended command (`/status`, `/update`, or `/review`) when the workflow can point to a deterministic next step.
49
+ - a normalized workflow state so the session can distinguish `refresh_needed`, `trace_pending`, `review_required`, and `ready_to_continue`.
49
50
 
50
51
  ### Post-Commit Updates
51
52
 
@@ -56,6 +57,7 @@ After `git commit`, the plugin triggers incremental CPG re-parsing via GoCPG and
56
57
  - top recommendations
57
58
  - one clear next action
58
59
  - one suggested command to run next
60
+ - one normalized workflow state
59
61
 
60
62
  If the durable review trace is not available yet, the plugin still appends a pending summary telling the developer to check `/status` instead of leaving the post-commit state ambiguous.
61
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codegraph",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
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
@@ -26,6 +26,7 @@ import {
26
26
  recommendedCommandFromReviewTrace,
27
27
  recommendedNextActionFromReviewTrace,
28
28
  readReviewTraceSnapshot,
29
+ workflowStateFromReviewTrace,
29
30
  whatChangedFromReviewTrace,
30
31
  whyItMattersFromReviewTrace,
31
32
  } from "./util"
@@ -124,6 +125,8 @@ const codegraphPlugin: Plugin = async (input) => {
124
125
  output.metadata = {
125
126
  ...output.metadata,
126
127
  codegraph_review_trace_status: traceSnapshot.status || "unknown",
128
+ codegraph_review_trace_workflow_state:
129
+ traceSnapshot.workflow_state || workflowStateFromReviewTrace(traceSnapshot),
127
130
  codegraph_review_trace_phase: traceSnapshot.phase || "unknown",
128
131
  codegraph_review_trace_findings: traceSnapshot.review_findings_count ?? null,
129
132
  codegraph_review_trace_recommendations:
@@ -139,6 +142,7 @@ const codegraphPlugin: Plugin = async (input) => {
139
142
  output.metadata = {
140
143
  ...output.metadata,
141
144
  codegraph_review_trace_status: "pending_or_missing",
145
+ codegraph_review_trace_workflow_state: "trace_pending",
142
146
  codegraph_review_trace_phase: "awaiting_trace",
143
147
  codegraph_review_trace_findings: null,
144
148
  codegraph_review_trace_recommendations: [],
package/src/util.ts CHANGED
@@ -14,6 +14,7 @@ export type ReviewTraceSnapshot = {
14
14
  review_severity_counts?: Record<string, number>
15
15
  review_recommendations?: string[]
16
16
  error?: string | null
17
+ workflow_state?: string
17
18
  recommended_command?: string
18
19
  }
19
20
 
@@ -26,7 +27,9 @@ export type DogfoodStatusSnapshot = {
26
27
  }
27
28
  head_commit?: string
28
29
  review_trace?: ReviewTraceSnapshot | null
30
+ workflow_state?: string
29
31
  recommended_next_action?: string
32
+ recommended_command?: string
30
33
  }
31
34
 
32
35
  /**
@@ -160,6 +163,7 @@ export function formatPendingReviewTraceSummary(commit: string | null): string {
160
163
  "",
161
164
  "- Wait briefly for review trace completion, then run `/status` to check the latest result.",
162
165
  "- Suggested command: `/status`",
166
+ "- Workflow state: `trace_pending`",
163
167
  ].join("\n")
164
168
  }
165
169
 
@@ -171,6 +175,7 @@ export function formatReviewTraceSummary(snapshot: ReviewTraceSnapshot): string
171
175
  const whyItMatters = whyItMattersFromReviewTrace(snapshot)
172
176
  const nextAction = recommendedNextActionFromReviewTrace(snapshot)
173
177
  const nextCommand = recommendedCommandFromReviewTrace(snapshot)
178
+ const workflowState = workflowStateFromReviewTrace(snapshot)
174
179
 
175
180
  const lines = ["## CodeGraph Post-Commit Summary", ""]
176
181
 
@@ -192,6 +197,7 @@ export function formatReviewTraceSummary(snapshot: ReviewTraceSnapshot): string
192
197
 
193
198
  lines.push("### What to do now", "", `- ${nextAction}`)
194
199
  lines.push(`- Suggested command: \`${nextCommand}\``)
200
+ lines.push(`- Workflow state: \`${workflowState}\``)
195
201
 
196
202
  return lines.join("\n")
197
203
  }
@@ -252,12 +258,12 @@ export function recommendedNextActionFromReviewTrace(snapshot: ReviewTraceSnapsh
252
258
  ? snapshot.review_recommendations.filter(Boolean)
253
259
  : []
254
260
 
261
+ if (workflowStateFromReviewTrace(snapshot) === "trace_pending") {
262
+ return "Wait for review trace completion, then inspect findings and recommendations."
263
+ }
255
264
  if (snapshot.error) {
256
265
  return "Investigate the review-trace error, then run /review once the pipeline is healthy."
257
266
  }
258
- if (status === "running") {
259
- return "Wait for review trace completion, then inspect findings and recommendations."
260
- }
261
267
  if (status && status !== "completed") {
262
268
  return "Check the latest review trace status again and rerun /review if the result is incomplete."
263
269
  }
@@ -273,13 +279,14 @@ export function recommendedNextActionFromReviewTrace(snapshot: ReviewTraceSnapsh
273
279
  export function recommendedCommandFromReviewTrace(snapshot: ReviewTraceSnapshot): string {
274
280
  const status = (snapshot.status || "").toLowerCase()
275
281
  const findingsCount = snapshot.review_findings_count
282
+ const workflowState = workflowStateFromReviewTrace(snapshot)
276
283
 
284
+ if (workflowState === "trace_pending") {
285
+ return "/status"
286
+ }
277
287
  if (snapshot.error) {
278
288
  return "/review"
279
289
  }
280
- if (status === "running") {
281
- return "/status"
282
- }
283
290
  if (status && status !== "completed") {
284
291
  return "/review"
285
292
  }
@@ -289,6 +296,25 @@ export function recommendedCommandFromReviewTrace(snapshot: ReviewTraceSnapshot)
289
296
  return "/review"
290
297
  }
291
298
 
299
+ export function workflowStateFromReviewTrace(snapshot: ReviewTraceSnapshot): string {
300
+ const status = (snapshot.status || "").toLowerCase()
301
+ const findingsCount = snapshot.review_findings_count
302
+
303
+ if (snapshot.error) {
304
+ return "review_required"
305
+ }
306
+ if (status === "running" || status === "pending_or_missing") {
307
+ return "trace_pending"
308
+ }
309
+ if (status && status !== "completed") {
310
+ return "review_required"
311
+ }
312
+ if (typeof findingsCount === "number" && findingsCount > 0) {
313
+ return "review_required"
314
+ }
315
+ return "ready_to_continue"
316
+ }
317
+
292
318
  export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): string | null {
293
319
  const cpg = snapshot.cpg_status || {}
294
320
  const isFresh = cpg.is_fresh
@@ -297,6 +323,7 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
297
323
  const headCommit = snapshot.head_commit ? snapshot.head_commit.slice(0, 12) : null
298
324
  const reviewTrace = snapshot.review_trace || null
299
325
  const traceStatus = reviewTrace?.status || "missing"
326
+ const workflowState = snapshot.workflow_state
300
327
  const nextAction = snapshot.recommended_next_action
301
328
  const nextCommand = (snapshot as { recommended_command?: string }).recommended_command
302
329
 
@@ -314,6 +341,9 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
314
341
  lines.push(`- HEAD: ${headCommit}`)
315
342
  }
316
343
  lines.push(`- Review trace: ${traceStatus}`)
344
+ if (workflowState) {
345
+ lines.push(`- Workflow state: ${workflowState}`)
346
+ }
317
347
  if (nextAction) {
318
348
  lines.push(`- Next action: ${nextAction}`)
319
349
  }