opencode-codegraph 0.1.16 → 0.1.18

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.18 - 2026-03-20
4
+
5
+ - make after-test guidance test-result aware so failing test runs explicitly block review/push guidance until failures are fixed
6
+
7
+ ## 0.1.17 - 2026-03-20
8
+
9
+ - include git branch and worktree cleanliness in dogfooding status summaries shown in OpenCode
10
+
3
11
  ## 0.1.16 - 2026-03-20
4
12
 
5
13
  - include branch and worktree cleanliness in dogfooding status summaries
package/README.md CHANGED
@@ -46,7 +46,7 @@ If the message suggests workflow guidance intent (`what next`, `am I done`, `can
46
46
  Every conversation includes:
47
47
 
48
48
  - a project summary with file count, top complexity hotspots, and open security findings;
49
- - a lightweight dogfooding status block when available, including freshness, current `HEAD`, review-trace state, and recommended next action.
49
+ - a lightweight dogfooding status block when available, including freshness, current `HEAD`, git branch/worktree cleanliness, review-trace state, and recommended next action.
50
50
  - the same status block now also includes branch and worktree cleanliness, which lets guided commands distinguish `changes_pending_review` from `ready_to_push`.
51
51
  - a recommended command (`/status`, `/update`, or `/review`) when the workflow can point to a deterministic next step.
52
52
  - a normalized workflow state so the session can distinguish `refresh_needed`, `trace_pending`, `review_required`, and `ready_to_continue`.
@@ -114,7 +114,7 @@ Place in `.opencode/commands/`:
114
114
  | `chat.message` | Add CPG context for mentioned files |
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
- | `tool.execute.after` on test commands | Add after-test workflow guidance with the next recommended command |
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` | Trigger CPG update after git commit and append structured post-commit review summary |
119
119
  | `experimental.session.compacting` | Preserve current dogfooding status when OpenCode compacts long sessions |
120
120
  | `command.execute.before` | Inject current dogfooding status into `/review`, `/audit`, `/update`, `/status`, and `/next` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codegraph",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
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
@@ -17,6 +17,7 @@ import { CodeGraphAPI } from "./api"
17
17
  import {
18
18
  extractFileRefs,
19
19
  fileNeedsRegistrationCheck,
20
+ didTestCommandFail,
20
21
  formatAfterTestGuidance,
21
22
  formatDogfoodStatusSummary,
22
23
  formatPendingReviewTraceSummary,
@@ -174,13 +175,15 @@ const codegraphPlugin: Plugin = async (input) => {
174
175
  try {
175
176
  const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
176
177
  const status = JSON.parse(rawStatus)
177
- const guidance = formatAfterTestGuidance(status)
178
+ const testFailed = didTestCommandFail(output.output)
179
+ const guidance = formatAfterTestGuidance(status, testFailed)
178
180
  if (guidance) {
179
181
  output.title = "CodeGraph: after-test guidance ready"
180
182
  const existingOutput = output.output?.trimEnd() || ""
181
183
  output.output = existingOutput ? `${existingOutput}\n\n${guidance}` : guidance
182
184
  output.metadata = {
183
185
  ...output.metadata,
186
+ codegraph_after_test_result: testFailed ? "failed" : "passed_or_unknown",
184
187
  codegraph_after_test_workflow_state: status.workflow_state || null,
185
188
  codegraph_after_test_next_action: status.recommended_next_action || null,
186
189
  codegraph_after_test_recommended_command: status.recommended_command || null,
package/src/util.ts CHANGED
@@ -99,6 +99,19 @@ export function isTestCommand(command: string): boolean {
99
99
  )
100
100
  }
101
101
 
102
+ export function didTestCommandFail(output: string): boolean {
103
+ if (!output) return false
104
+ const normalized = output.toLowerCase()
105
+ return [
106
+ "failed",
107
+ "error:",
108
+ "errors:",
109
+ "assertionerror",
110
+ "test failed",
111
+ "1 failed",
112
+ ].some((pattern) => normalized.includes(pattern))
113
+ }
114
+
102
115
  /**
103
116
  * Heuristic: detect whether the user is likely asking to modify code.
104
117
  */
@@ -398,7 +411,10 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
398
411
  return lines.join("\n")
399
412
  }
400
413
 
401
- export function formatAfterTestGuidance(snapshot: DogfoodStatusSnapshot): string | null {
414
+ export function formatAfterTestGuidance(
415
+ snapshot: DogfoodStatusSnapshot,
416
+ testFailed = false,
417
+ ): string | null {
402
418
  const workflowState = snapshot.workflow_state
403
419
  const nextAction = snapshot.recommended_next_action
404
420
  const nextCommand = snapshot.recommended_command
@@ -408,6 +424,12 @@ export function formatAfterTestGuidance(snapshot: DogfoodStatusSnapshot): string
408
424
  }
409
425
 
410
426
  const lines = ["## CodeGraph After-Test Guidance", ""]
427
+ if (testFailed) {
428
+ lines.push("- Test result: failed")
429
+ lines.push("- Next action: fix the failing tests before trusting review or push guidance")
430
+ lines.push("- Suggested command: rerun the failing tests after you fix them")
431
+ return lines.join("\n")
432
+ }
411
433
  if (workflowState) {
412
434
  lines.push(`- Workflow state: ${workflowState}`)
413
435
  }