opencode-codegraph 0.1.11 → 0.1.13
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 +9 -0
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/index.ts +25 -0
- package/src/util.ts +30 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.13 - 2026-03-20
|
|
4
|
+
|
|
5
|
+
- add after-test guidance so common test commands are followed by workflow state, next action, and recommended command
|
|
6
|
+
|
|
7
|
+
## 0.1.12 - 2026-03-20
|
|
8
|
+
|
|
9
|
+
- add `ready_to_push` workflow state when CPG is fresh, review trace is green, and the worktree is clean
|
|
10
|
+
- let dogfooding status recommend an exact `git push` command when the session is fully ready
|
|
11
|
+
|
|
3
12
|
## 0.1.11 - 2026-03-20
|
|
4
13
|
|
|
5
14
|
- add conversational workflow-intent enrichment when the user asks what to do next, whether the change is ready, or whether they can push
|
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ Every conversation includes:
|
|
|
49
49
|
- a lightweight dogfooding status block when available, including freshness, current `HEAD`, review-trace state, and recommended next action.
|
|
50
50
|
- a recommended command (`/status`, `/update`, or `/review`) when the workflow can point to a deterministic next step.
|
|
51
51
|
- a normalized workflow state so the session can distinguish `refresh_needed`, `trace_pending`, `review_required`, and `ready_to_continue`.
|
|
52
|
+
- a `ready_to_push` state when the session is fresh, the review trace is green, and the worktree is clean.
|
|
52
53
|
|
|
53
54
|
### Post-Commit Updates
|
|
54
55
|
|
|
@@ -112,6 +113,7 @@ Place in `.opencode/commands/`:
|
|
|
112
113
|
| `chat.message` | Add CPG context for mentioned files |
|
|
113
114
|
| `chat.message` (edit intent) | Add pre-edit warnings for files likely to be modified |
|
|
114
115
|
| `chat.message` (workflow intent) | Add dogfooding status when the user asks what to do next |
|
|
116
|
+
| `tool.execute.after` on test commands | Add after-test workflow guidance with the next recommended command |
|
|
115
117
|
| `tool.execute.after` | Trigger CPG update after git commit and append structured post-commit review summary |
|
|
116
118
|
| `permission.ask` | Auto-allow `codegraph_*` tools |
|
|
117
119
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -17,11 +17,13 @@ import { CodeGraphAPI } from "./api"
|
|
|
17
17
|
import {
|
|
18
18
|
extractFileRefs,
|
|
19
19
|
fileNeedsRegistrationCheck,
|
|
20
|
+
formatAfterTestGuidance,
|
|
20
21
|
formatDogfoodStatusSummary,
|
|
21
22
|
formatPendingReviewTraceSummary,
|
|
22
23
|
formatReviewTraceSummary,
|
|
23
24
|
getHeadCommit,
|
|
24
25
|
isGitCommit,
|
|
26
|
+
isTestCommand,
|
|
25
27
|
messageSuggestsEditing,
|
|
26
28
|
messageSuggestsWorkflowGuidance,
|
|
27
29
|
recommendedCommandFromReviewTrace,
|
|
@@ -129,6 +131,29 @@ const codegraphPlugin: Plugin = async (input) => {
|
|
|
129
131
|
// -----------------------------------------------------------------
|
|
130
132
|
"tool.execute.after": async (inp, output) => {
|
|
131
133
|
if (inp.tool !== "bash") return
|
|
134
|
+
const command = typeof inp.args?.command === "string" ? inp.args.command : ""
|
|
135
|
+
|
|
136
|
+
if (isTestCommand(command)) {
|
|
137
|
+
try {
|
|
138
|
+
const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
|
|
139
|
+
const status = JSON.parse(rawStatus)
|
|
140
|
+
const guidance = formatAfterTestGuidance(status)
|
|
141
|
+
if (guidance) {
|
|
142
|
+
output.title = "CodeGraph: after-test guidance ready"
|
|
143
|
+
const existingOutput = output.output?.trimEnd() || ""
|
|
144
|
+
output.output = existingOutput ? `${existingOutput}\n\n${guidance}` : guidance
|
|
145
|
+
output.metadata = {
|
|
146
|
+
...output.metadata,
|
|
147
|
+
codegraph_after_test_workflow_state: status.workflow_state || null,
|
|
148
|
+
codegraph_after_test_next_action: status.recommended_next_action || null,
|
|
149
|
+
codegraph_after_test_recommended_command: status.recommended_command || null,
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} catch {
|
|
153
|
+
// Best-effort guidance only
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
132
157
|
if (!isGitCommit(output.output)) return
|
|
133
158
|
|
|
134
159
|
try {
|
package/src/util.ts
CHANGED
|
@@ -84,6 +84,14 @@ export function isGitCommit(output: string): boolean {
|
|
|
84
84
|
)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export function isTestCommand(command: string): boolean {
|
|
88
|
+
if (!command) return false
|
|
89
|
+
const normalized = command.toLowerCase()
|
|
90
|
+
return ["pytest", "go test", "npm test", "pnpm test", "bun test", "cargo test", "vitest", "jest"].some(
|
|
91
|
+
(pattern) => normalized.includes(pattern),
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
87
95
|
/**
|
|
88
96
|
* Heuristic: detect whether the user is likely asking to modify code.
|
|
89
97
|
*/
|
|
@@ -374,6 +382,28 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
|
|
|
374
382
|
return lines.join("\n")
|
|
375
383
|
}
|
|
376
384
|
|
|
385
|
+
export function formatAfterTestGuidance(snapshot: DogfoodStatusSnapshot): string | null {
|
|
386
|
+
const workflowState = snapshot.workflow_state
|
|
387
|
+
const nextAction = snapshot.recommended_next_action
|
|
388
|
+
const nextCommand = snapshot.recommended_command
|
|
389
|
+
|
|
390
|
+
if (!workflowState && !nextAction && !nextCommand) {
|
|
391
|
+
return null
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const lines = ["## CodeGraph After-Test Guidance", ""]
|
|
395
|
+
if (workflowState) {
|
|
396
|
+
lines.push(`- Workflow state: ${workflowState}`)
|
|
397
|
+
}
|
|
398
|
+
if (nextAction) {
|
|
399
|
+
lines.push(`- Next action: ${nextAction}`)
|
|
400
|
+
}
|
|
401
|
+
if (nextCommand) {
|
|
402
|
+
lines.push(`- Suggested command: ${nextCommand}`)
|
|
403
|
+
}
|
|
404
|
+
return lines.join("\n")
|
|
405
|
+
}
|
|
406
|
+
|
|
377
407
|
// File extensions recognized as source code
|
|
378
408
|
const SOURCE_EXTENSIONS = new Set([
|
|
379
409
|
"py",
|