opencode-codegraph 0.1.28 → 0.1.32
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 +16 -0
- package/README.md +3 -0
- package/package.json +1 -1
- package/src/index.ts +17 -10
- package/src/util.ts +28 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.32 - 2026-03-21
|
|
4
|
+
|
|
5
|
+
- align workflow-update blocks with the same closure-oriented framing used by other status-oriented surfaces
|
|
6
|
+
|
|
7
|
+
## 0.1.31 - 2026-03-21
|
|
8
|
+
|
|
9
|
+
- add current workflow guidance to `codegraph_explain_function` so tool-level explanations align with command-level DX
|
|
10
|
+
|
|
11
|
+
## 0.1.30 - 2026-03-21
|
|
12
|
+
|
|
13
|
+
- align git-oriented guidance and workflow-transition rendering with the shared workflow guidance block
|
|
14
|
+
|
|
15
|
+
## 0.1.29 - 2026-03-21
|
|
16
|
+
|
|
17
|
+
- align workflow-transition formatting with the shared guidance block so git-oriented guidance uses the same normalized renderer as other status surfaces
|
|
18
|
+
|
|
3
19
|
## 0.1.28 - 2026-03-21
|
|
4
20
|
|
|
5
21
|
- surface primary issue and recovery sequence in plugin workflow summaries so competing blockers are shown in a prioritized order
|
package/README.md
CHANGED
|
@@ -119,6 +119,7 @@ Place in `.opencode/commands/`:
|
|
|
119
119
|
| `tool.execute.after` | Trigger CPG update after git commit and append structured post-commit review summary |
|
|
120
120
|
| generic `tool.execute.after` | Surface workflow-state transitions after other bash commands when the underlying state changes |
|
|
121
121
|
| `codegraph_review` tool | Returns review results together with current workflow guidance and suggested follow-up command |
|
|
122
|
+
| `codegraph_explain_function` tool | Returns function analysis together with current workflow guidance |
|
|
122
123
|
| `experimental.session.compacting` | Preserve current dogfooding status when OpenCode compacts long sessions |
|
|
123
124
|
| `command.execute.before` | Inject current dogfooding status into `/review`, `/audit`, `/update`, `/status`, `/next`, `/continue`, `/maintain-db`, and `/unlock-db` |
|
|
124
125
|
| `db_locked` recovery path | Surface lock-holder-aware recovery guidance when DuckDB is blocked by another process |
|
|
@@ -127,6 +128,8 @@ Place in `.opencode/commands/`:
|
|
|
127
128
|
Across status-oriented surfaces, the plugin is converging on one shared summary contract:
|
|
128
129
|
|
|
129
130
|
- workflow state
|
|
131
|
+
- primary issue
|
|
132
|
+
- recovery sequence
|
|
130
133
|
- blockers
|
|
131
134
|
- warnings
|
|
132
135
|
- what improved
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -68,8 +68,8 @@ const codegraphPlugin: Plugin = async (input) => {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const workflowTransition = (status: Record<string, unknown>) => {
|
|
71
|
-
const
|
|
72
|
-
const
|
|
71
|
+
const message = formatWorkflowStateTransition(lastWorkflowState, status as any)
|
|
72
|
+
const { workflowState } = workflowFields(status)
|
|
73
73
|
if (workflowState) {
|
|
74
74
|
lastWorkflowState = workflowState
|
|
75
75
|
}
|
|
@@ -425,14 +425,21 @@ const codegraphPlugin: Plugin = async (input) => {
|
|
|
425
425
|
description:
|
|
426
426
|
"Deep analysis of a function using CPG. Shows callers, callees, " +
|
|
427
427
|
"complexity, taint paths, and security findings.",
|
|
428
|
-
args: {
|
|
429
|
-
name: tool.schema.string().describe("Function or method name to analyze"),
|
|
430
|
-
},
|
|
431
|
-
async execute(args) {
|
|
432
|
-
const result = await api.explainFunction(projectId, args.name)
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
428
|
+
args: {
|
|
429
|
+
name: tool.schema.string().describe("Function or method name to analyze"),
|
|
430
|
+
},
|
|
431
|
+
async execute(args) {
|
|
432
|
+
const result = await api.explainFunction(projectId, args.name)
|
|
433
|
+
try {
|
|
434
|
+
const rawStatus = await $`python -m src.cli.import_commands dogfood status --json`.quiet().text()
|
|
435
|
+
const status = JSON.parse(rawStatus)
|
|
436
|
+
const guidance = formatWorkflowGuidanceBlock(status)
|
|
437
|
+
return guidance ? `${result}\n\n${guidance}` : result
|
|
438
|
+
} catch {
|
|
439
|
+
return result
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
}),
|
|
436
443
|
},
|
|
437
444
|
|
|
438
445
|
// -----------------------------------------------------------------
|
package/src/util.ts
CHANGED
|
@@ -119,6 +119,14 @@ function workflowSummaryLines(snapshot: DogfoodStatusSnapshot): string[] {
|
|
|
119
119
|
}
|
|
120
120
|
return lines
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
function formatSummaryBlock(title: string, snapshot: DogfoodStatusSnapshot): string | null {
|
|
124
|
+
const lines = workflowSummaryLines(snapshot)
|
|
125
|
+
if (!lines.length) {
|
|
126
|
+
return null
|
|
127
|
+
}
|
|
128
|
+
return [title, "", ...lines].join("\n")
|
|
129
|
+
}
|
|
122
130
|
|
|
123
131
|
/**
|
|
124
132
|
* Extract file references from message parts.
|
|
@@ -515,30 +523,31 @@ export function formatDogfoodStatusSummary(snapshot: DogfoodStatusSnapshot): str
|
|
|
515
523
|
}
|
|
516
524
|
|
|
517
525
|
export function formatWorkflowGuidanceBlock(snapshot: DogfoodStatusSnapshot): string | null {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
if (!lines.length) {
|
|
521
|
-
return null
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
return ["## CodeGraph Workflow Guidance", "", ...lines].join("\n")
|
|
526
|
+
return formatSummaryBlock("## CodeGraph Workflow Guidance", snapshot)
|
|
525
527
|
}
|
|
526
528
|
|
|
527
529
|
export function formatWorkflowStateTransition(
|
|
528
530
|
previousState: string | null,
|
|
529
|
-
|
|
530
|
-
nextAction: string | undefined,
|
|
531
|
-
nextCommand: string | undefined,
|
|
531
|
+
snapshot: DogfoodStatusSnapshot,
|
|
532
532
|
): string | null {
|
|
533
|
+
const currentState = snapshot.workflow_state || null
|
|
533
534
|
if (!previousState || !currentState || previousState === currentState) {
|
|
534
535
|
return null
|
|
535
536
|
}
|
|
536
537
|
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
538
|
+
const nextAction = snapshot.recommended_next_action
|
|
539
|
+
const nextCommand = snapshot.recommended_command
|
|
540
|
+
const primaryIssue = snapshot.primary_issue
|
|
541
|
+
const blockers = Array.isArray(snapshot.blockers) ? snapshot.blockers.filter(Boolean) : []
|
|
542
|
+
|
|
543
|
+
const lines = ["## CodeGraph Workflow Update", "", "### What changed", ""]
|
|
544
|
+
lines.push(`- Workflow state changed: ${previousState} -> ${currentState}`)
|
|
545
|
+
|
|
546
|
+
if (primaryIssue) {
|
|
547
|
+
lines.push(`- Primary issue: ${primaryIssue}`)
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
lines.push("", "### What to do now", "")
|
|
542
551
|
|
|
543
552
|
if (nextAction) {
|
|
544
553
|
lines.push(`- Next action: ${nextAction}`)
|
|
@@ -546,6 +555,9 @@ export function formatWorkflowStateTransition(
|
|
|
546
555
|
if (nextCommand) {
|
|
547
556
|
lines.push(`- Suggested command: ${nextCommand}`)
|
|
548
557
|
}
|
|
558
|
+
if (blockers.length) {
|
|
559
|
+
lines.push(`- Blockers: ${blockers.join("; ")}`)
|
|
560
|
+
}
|
|
549
561
|
return lines.join("\n")
|
|
550
562
|
}
|
|
551
563
|
|
|
@@ -568,8 +580,7 @@ export function formatAfterTestGuidance(
|
|
|
568
580
|
lines.push("- Suggested command: rerun the failing tests after you fix them")
|
|
569
581
|
return lines.join("\n")
|
|
570
582
|
}
|
|
571
|
-
|
|
572
|
-
return lines.join("\n")
|
|
583
|
+
return formatSummaryBlock("## CodeGraph After-Test Guidance", snapshot)
|
|
573
584
|
}
|
|
574
585
|
|
|
575
586
|
// File extensions recognized as source code
|