opencode-codegraph 0.1.20 → 0.1.22

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.22 - 2026-03-20
4
+
5
+ - add DuckDB maintenance guidance and `/maintain-db` workflow command for local database compaction
6
+
7
+ ## 0.1.21 - 2026-03-20
8
+
9
+ - append workflow guidance to the `codegraph_review` custom tool so tool results stay aligned with current dogfooding state
10
+ - add `/continue` as a safe guided execution command for refresh/review workflow steps
11
+
3
12
  ## 0.1.20 - 2026-03-20
4
13
 
5
14
  - append workflow guidance to the `codegraph_review` custom tool so tool results stay aligned with current dogfooding state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codegraph",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
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
@@ -22,6 +22,7 @@ import {
22
22
  formatDogfoodStatusSummary,
23
23
  formatPendingReviewTraceSummary,
24
24
  formatReviewTraceSummary,
25
+ formatReviewTraceUpdateSummary,
25
26
  formatWorkflowGuidanceBlock,
26
27
  getHeadCommit,
27
28
  isGitCommit,
@@ -44,8 +45,20 @@ const codegraphPlugin: Plugin = async (input) => {
44
45
  const apiUrl = process.env.CODEGRAPH_API_URL || "http://localhost:8000"
45
46
  const api = new CodeGraphAPI(apiUrl)
46
47
 
47
- // Detect project ID from environment or opencode.json
48
- const projectId = process.env.CODEGRAPH_PROJECT || ""
48
+ // Detect project ID from environment or opencode.json
49
+ const projectId = process.env.CODEGRAPH_PROJECT || ""
50
+ let pendingReviewCommit: string | null = null
51
+
52
+ const consumePendingReviewTraceUpdate = async (): Promise<string | null> => {
53
+ if (!pendingReviewCommit) return null
54
+ const commit = pendingReviewCommit
55
+ const traceSnapshot = await readReviewTraceSnapshot(directory, commit, 1, 0)
56
+ if (!traceSnapshot) return null
57
+ const workflowState = traceSnapshot.workflow_state || workflowStateFromReviewTrace(traceSnapshot)
58
+ if (workflowState === "trace_pending") return null
59
+ pendingReviewCommit = null
60
+ return formatReviewTraceUpdateSummary(traceSnapshot)
61
+ }
49
62
 
50
63
  return {
51
64
  // -----------------------------------------------------------------
@@ -96,6 +109,14 @@ const codegraphPlugin: Plugin = async (input) => {
96
109
  }
97
110
 
98
111
  try {
112
+ const pendingUpdate = await consumePendingReviewTraceUpdate()
113
+ if (pendingUpdate) {
114
+ output.parts.push({
115
+ type: "text",
116
+ text: pendingUpdate,
117
+ } as any)
118
+ }
119
+
99
120
  const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
100
121
  const statusSummary = formatDogfoodStatusSummary(JSON.parse(rawStatus))
101
122
  if (statusSummary) {
@@ -120,6 +141,14 @@ const codegraphPlugin: Plugin = async (input) => {
120
141
  if (!files.length && !workflowIntent) return
121
142
 
122
143
  try {
144
+ const pendingUpdate = await consumePendingReviewTraceUpdate()
145
+ if (pendingUpdate) {
146
+ output.parts.push({
147
+ type: "text",
148
+ text: pendingUpdate,
149
+ } as any)
150
+ }
151
+
123
152
  if (workflowIntent) {
124
153
  try {
125
154
  const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
@@ -245,6 +274,7 @@ const codegraphPlugin: Plugin = async (input) => {
245
274
  }
246
275
  } else {
247
276
  traceSummary = formatPendingReviewTraceSummary(commit)
277
+ pendingReviewCommit = commit
248
278
  output.metadata = {
249
279
  ...output.metadata,
250
280
  codegraph_review_trace_status: "pending_or_missing",
package/src/util.ts CHANGED
@@ -33,6 +33,12 @@ export type DogfoodStatusSnapshot = {
33
33
  unstaged_changes?: boolean
34
34
  untracked_files?: boolean
35
35
  }
36
+ db_maintenance?: {
37
+ due?: boolean
38
+ reason?: string
39
+ db_size_mb?: number
40
+ recommended_action?: string
41
+ }
36
42
  review_trace?: ReviewTraceSnapshot | null
37
43
  workflow_state?: string
38
44
  recommended_next_action?: string
@@ -257,6 +263,12 @@ export function formatReviewTraceSummary(snapshot: ReviewTraceSnapshot): string
257
263
  return lines.join("\n")
258
264
  }
259
265
 
266
+ export function formatReviewTraceUpdateSummary(snapshot: ReviewTraceSnapshot): string | null {
267
+ const base = formatReviewTraceSummary(snapshot)
268
+ if (!base) return null
269
+ return base.replace("## CodeGraph Post-Commit Summary", "## CodeGraph Review Trace Update")
270
+ }
271
+
260
272
  export function whatChangedFromReviewTrace(snapshot: ReviewTraceSnapshot): string[] {
261
273
  const items: string[] = []
262
274
  const status = snapshot.status || "unknown"
@@ -380,6 +392,7 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
380
392
  const branch = git.branch
381
393
  const worktreeClean = git.worktree_clean
382
394
  const reviewTrace = snapshot.review_trace || null
395
+ const maintenance = snapshot.db_maintenance || null
383
396
  const traceStatus = reviewTrace?.status || "missing"
384
397
  const workflowState = snapshot.workflow_state
385
398
  const nextAction = snapshot.recommended_next_action
@@ -404,6 +417,11 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
404
417
  if (typeof worktreeClean === "boolean") {
405
418
  lines.push(`- Worktree clean: ${worktreeClean}`)
406
419
  }
420
+ if (maintenance) {
421
+ lines.push(
422
+ `- DB maintenance: ${maintenance.due ? "due" : "ok"} (${maintenance.reason || "unknown"}${typeof maintenance.db_size_mb === "number" ? `, ${maintenance.db_size_mb} MB` : ""})`,
423
+ )
424
+ }
407
425
  lines.push(`- Review trace: ${traceStatus}`)
408
426
  if (workflowState) {
409
427
  lines.push(`- Workflow state: ${workflowState}`)