opencode-codegraph 0.1.14 → 0.1.16

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.16 - 2026-03-20
4
+
5
+ - include branch and worktree cleanliness in dogfooding status summaries
6
+ - distinguish `changes_pending_review` from `ready_to_push` using git worktree state
7
+
8
+ ## 0.1.15 - 2026-03-20
9
+
10
+ - inject current dogfooding status into guided commands via `command.execute.before` so `/review`, `/audit`, `/update`, `/status`, and `/next` start from the same context
11
+
3
12
  ## 0.1.14 - 2026-03-20
4
13
 
5
14
  - preserve dogfooding status across OpenCode session compaction so freshness and workflow guidance survive long chats
package/README.md CHANGED
@@ -47,6 +47,7 @@ Every conversation includes:
47
47
 
48
48
  - a project summary with file count, top complexity hotspots, and open security findings;
49
49
  - a lightweight dogfooding status block when available, including freshness, current `HEAD`, review-trace state, and recommended next action.
50
+ - the same status block now also includes branch and worktree cleanliness, which lets guided commands distinguish `changes_pending_review` from `ready_to_push`.
50
51
  - a recommended command (`/status`, `/update`, or `/review`) when the workflow can point to a deterministic next step.
51
52
  - a normalized workflow state so the session can distinguish `refresh_needed`, `trace_pending`, `review_required`, and `ready_to_continue`.
52
53
  - a `ready_to_push` state when the session is fresh, the review trace is green, and the worktree is clean.
@@ -116,6 +117,7 @@ Place in `.opencode/commands/`:
116
117
  | `tool.execute.after` on test commands | Add after-test workflow guidance with the next recommended command |
117
118
  | `tool.execute.after` | Trigger CPG update after git commit and append structured post-commit review summary |
118
119
  | `experimental.session.compacting` | Preserve current dogfooding status when OpenCode compacts long sessions |
120
+ | `command.execute.before` | Inject current dogfooding status into `/review`, `/audit`, `/update`, `/status`, and `/next` |
119
121
  | `permission.ask` | Auto-allow `codegraph_*` tools |
120
122
 
121
123
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codegraph",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
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
@@ -84,6 +84,28 @@ const codegraphPlugin: Plugin = async (input) => {
84
84
  }
85
85
  },
86
86
 
87
+ // -----------------------------------------------------------------
88
+ // 1c. Command execution: inject current dogfooding status into guided commands
89
+ // -----------------------------------------------------------------
90
+ "command.execute.before": async (inp, output) => {
91
+ if (!["review", "audit", "update", "status", "next"].includes(inp.command)) {
92
+ return
93
+ }
94
+
95
+ try {
96
+ const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
97
+ const statusSummary = formatDogfoodStatusSummary(JSON.parse(rawStatus))
98
+ if (statusSummary) {
99
+ output.parts.push({
100
+ type: "text",
101
+ text: statusSummary,
102
+ } as any)
103
+ }
104
+ } catch {
105
+ // Keep command execution resilient if status lookup fails
106
+ }
107
+ },
108
+
87
109
  // -----------------------------------------------------------------
88
110
  // 2. Chat message: auto-enrich with CPG context for mentioned files
89
111
  // -----------------------------------------------------------------
package/src/util.ts CHANGED
@@ -26,6 +26,13 @@ export type DogfoodStatusSnapshot = {
26
26
  db_exists?: boolean
27
27
  }
28
28
  head_commit?: string
29
+ git?: {
30
+ branch?: string
31
+ worktree_clean?: boolean
32
+ staged_changes?: boolean
33
+ unstaged_changes?: boolean
34
+ untracked_files?: boolean
35
+ }
29
36
  review_trace?: ReviewTraceSnapshot | null
30
37
  workflow_state?: string
31
38
  recommended_next_action?: string
@@ -350,6 +357,9 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
350
357
  const freshnessReason = cpg.freshness_reason || "unknown"
351
358
  const commitsBehind = cpg.commits_behind
352
359
  const headCommit = snapshot.head_commit ? snapshot.head_commit.slice(0, 12) : null
360
+ const git = snapshot.git || {}
361
+ const branch = git.branch
362
+ const worktreeClean = git.worktree_clean
353
363
  const reviewTrace = snapshot.review_trace || null
354
364
  const traceStatus = reviewTrace?.status || "missing"
355
365
  const workflowState = snapshot.workflow_state
@@ -369,6 +379,12 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
369
379
  if (headCommit) {
370
380
  lines.push(`- HEAD: ${headCommit}`)
371
381
  }
382
+ if (branch) {
383
+ lines.push(`- Branch: ${branch}`)
384
+ }
385
+ if (typeof worktreeClean === "boolean") {
386
+ lines.push(`- Worktree clean: ${worktreeClean}`)
387
+ }
372
388
  lines.push(`- Review trace: ${traceStatus}`)
373
389
  if (workflowState) {
374
390
  lines.push(`- Workflow state: ${workflowState}`)