opencode-codegraph 0.1.17 → 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 +4 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/util.ts +23 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
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
|
+
|
|
3
7
|
## 0.1.17 - 2026-03-20
|
|
4
8
|
|
|
5
9
|
- include git branch and worktree cleanliness in dogfooding status summaries shown in OpenCode
|
package/README.md
CHANGED
|
@@ -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
|
|
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
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
|
|
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(
|
|
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
|
}
|