opencode-overclock 0.3.0 → 0.5.0

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.
Files changed (82) hide show
  1. package/README.md +252 -111
  2. package/package.json +6 -4
  3. package/skills/codebase-design/DEEPENING.md +35 -0
  4. package/skills/codebase-design/DESIGN-IT-TWICE.md +34 -0
  5. package/skills/codebase-design/SKILL.md +93 -0
  6. package/skills/diagnosing-bugs/SKILL.md +123 -0
  7. package/skills/domain-modeling/ADR-FORMAT.md +55 -0
  8. package/skills/domain-modeling/CONTEXT-FORMAT.md +32 -0
  9. package/skills/domain-modeling/SKILL.md +102 -0
  10. package/skills/doubt/SKILL.md +80 -0
  11. package/skills/grilling/SKILL.md +96 -0
  12. package/skills/source-discipline/SKILL.md +78 -0
  13. package/skills/tdd/SKILL.md +87 -0
  14. package/skills/to-spec/SKILL.md +69 -0
  15. package/skills/to-spec/SPEC-TEMPLATE.md +50 -0
  16. package/skills/to-tickets/SKILL.md +74 -0
  17. package/skills/to-tickets/TICKET-TEMPLATE.md +41 -0
  18. package/src/bridge.ts +1 -0
  19. package/src/buddy/companion.ts +104 -5
  20. package/src/buddy/sprites.ts +4 -4
  21. package/src/buddy/tui.ts +175 -65
  22. package/src/core/bridge.ts +34 -0
  23. package/src/core/lifecycle.ts +67 -0
  24. package/src/core/policy.ts +128 -0
  25. package/src/core/summary.ts +33 -0
  26. package/src/core/types.ts +193 -0
  27. package/src/features/buddy.ts +1 -2
  28. package/src/features/guard.ts +421 -37
  29. package/src/features/index.ts +18 -4
  30. package/src/features/recovery.ts +153 -0
  31. package/src/features/safety.ts +147 -0
  32. package/src/features/sched.ts +183 -89
  33. package/src/features/tasks.ts +134 -33
  34. package/src/features/truncator.ts +116 -0
  35. package/src/features/usage.ts +46 -65
  36. package/src/features/workflow.ts +256 -0
  37. package/src/index.ts +96 -67
  38. package/src/lib/busy.ts +1 -25
  39. package/src/lib/exec.ts +13 -0
  40. package/src/lib/inject.ts +10 -56
  41. package/src/lib/mirror.ts +13 -0
  42. package/src/lib/probe.ts +1 -15
  43. package/src/lib/state.ts +10 -39
  44. package/src/lib/tmux.ts +1 -0
  45. package/src/lib/ui.ts +208 -0
  46. package/src/merge.ts +2 -66
  47. package/src/platform/probe.ts +25 -0
  48. package/src/platform/process/exec.ts +317 -0
  49. package/src/platform/process/tmux.ts +60 -0
  50. package/src/platform/session/busy.ts +33 -0
  51. package/src/platform/session/inject.ts +89 -0
  52. package/src/platform/session/notify.ts +20 -0
  53. package/src/platform/storage/state.ts +99 -0
  54. package/src/platform/storage/store.ts +61 -0
  55. package/src/summary.ts +1 -0
  56. package/src/tools.ts +8 -244
  57. package/src/tui.ts +57 -186
  58. package/src/types.ts +1 -73
  59. package/src/v2/context.ts +470 -0
  60. package/src/v2/host.ts +120 -0
  61. package/src/v2/loader.ts +150 -0
  62. package/src/workflow/agents/codebase-researcher.ts +27 -0
  63. package/src/workflow/agents/design-explorer.ts +33 -0
  64. package/src/workflow/agents/doubt-reviewer.ts +26 -0
  65. package/src/workflow/agents/engineering-coach.ts +23 -0
  66. package/src/workflow/agents/performance-auditor.ts +29 -0
  67. package/src/workflow/agents/security-auditor.ts +23 -0
  68. package/src/workflow/agents/spec-reviewer.ts +15 -0
  69. package/src/workflow/agents/standards-reviewer.ts +24 -0
  70. package/src/workflow/agents/test-engineer.ts +28 -0
  71. package/src/workflow/catalog.ts +210 -0
  72. package/src/workflow/templates/build.ts +47 -0
  73. package/src/workflow/templates/define.ts +45 -0
  74. package/src/workflow/templates/diagnose.ts +58 -0
  75. package/src/workflow/templates/plan.ts +52 -0
  76. package/src/workflow/templates/ship.ts +64 -0
  77. package/src/buddy/reactions.ts +0 -41
  78. package/src/buddy/types.ts +0 -30
  79. package/src/config.ts +0 -19
  80. package/src/features/checkpoints.ts +0 -128
  81. package/src/features/sandbox.ts +0 -104
  82. package/src/validate.ts +0 -197
@@ -0,0 +1,193 @@
1
+ import type { Hooks, PluginInput } from "@opencode-ai/plugin"
2
+ import type { PluginContext, Plugin as V2Plugin, PluginOptions } from "@opencode-ai/plugin/v2/promise"
3
+
4
+ /**
5
+ * Tracks live session busy/idle state derived from the host event bus.
6
+ */
7
+ export interface BusyTracker {
8
+ onEvent(event: unknown): void
9
+ isBusy(sessionID?: string): boolean
10
+ }
11
+
12
+ /**
13
+ * Singletons built once by the entry and handed to every module.
14
+ * `busy` is derived from the event bus and requires exactly one subscription -- a per-module
15
+ * copy would be N subscriptions maintaining N identical copies of the same state.
16
+ */
17
+ export interface SharedDeps {
18
+ /** live per-session busy/idle state; the entry owns the subscription that feeds it */
19
+ busy: BusyTracker
20
+ /**
21
+ * Declared tool name -> the name the model was actually offered (see `toolNames` config).
22
+ * Needed wherever a module names one of its own tools in text the model reads: under a
23
+ * remap the declared name is not a tool the model has.
24
+ */
25
+ toolName(declared: string): string
26
+ }
27
+
28
+ /** A problem found in plugin configuration. */
29
+ export interface ConfigIssue {
30
+ path: string
31
+ message: string
32
+ }
33
+
34
+ /** Policy for renaming tools and withholding tools not permitted by allowlists. */
35
+ export interface ToolPolicy {
36
+ /** declared name -> model-visible name */
37
+ readonly rename: Record<string, string>
38
+ /** declared names withheld from the model entirely (not in allowlist) */
39
+ readonly withheld: Set<string>
40
+ }
41
+
42
+ export const EMPTY_POLICY: ToolPolicy = { rename: {}, withheld: new Set() }
43
+
44
+ export interface TasksOptions {
45
+ killOnExit?: boolean
46
+ stallDetection?: boolean
47
+ stallThresholdMs?: number
48
+ stallCheckIntervalMs?: number
49
+ tmux?: boolean
50
+ sanitizeEnv?: boolean
51
+ envAllowlist?: string[]
52
+ maxTasks?: number
53
+ [key: string]: unknown
54
+ }
55
+
56
+ export interface SchedOptions {
57
+ skipIfBusy?: boolean
58
+ [key: string]: unknown
59
+ }
60
+
61
+ export interface GuardHookConfig {
62
+ name: string
63
+ tools?: string[]
64
+ pathFilter?: string
65
+ run: string
66
+ mode?: "inject" | "append"
67
+ debounceMs?: number
68
+ timeoutMs?: number
69
+ onSuccess?: "silent" | "notify"
70
+ maxDeferMs?: number
71
+ [key: string]: unknown
72
+ }
73
+
74
+ export interface FloorGuardOptions {
75
+ allowSkips?: boolean
76
+ allowSuppressions?: boolean
77
+ allowAssertionRemoval?: boolean
78
+ [key: string]: unknown
79
+ }
80
+
81
+ export interface GuardOptions {
82
+ hooks?: GuardHookConfig[]
83
+ recipes?: string[]
84
+ auto?: boolean
85
+ editRecovery?: boolean
86
+ floorGuard?: boolean | FloorGuardOptions
87
+ [key: string]: unknown
88
+ }
89
+
90
+ export interface SafetyOptions {
91
+ blockDestructiveGit?: boolean
92
+ allowForcePush?: boolean
93
+ allowStashDrop?: boolean
94
+ customPatterns?: { name: string; pattern: string; reason: string }[]
95
+ [key: string]: unknown
96
+ }
97
+
98
+ export interface WorkflowOptions {
99
+ enabled?: boolean
100
+ commands?: boolean
101
+ subagents?: boolean
102
+ skillsPath?: string
103
+ [key: string]: unknown
104
+ }
105
+
106
+ export interface RecoveryOptions {
107
+ autoResume?: boolean
108
+ maxAttempts?: number
109
+ cooldownMs?: number
110
+ [key: string]: unknown
111
+ }
112
+
113
+ export interface TruncatorOptions {
114
+ tools?: string[]
115
+ headLines?: number
116
+ tailLines?: number
117
+ maxChars?: number
118
+ [key: string]: unknown
119
+ }
120
+
121
+ /**
122
+ * Accepted formats for declaring V2 plugins:
123
+ * file path, npm package, tuple with options, or plugin object.
124
+ */
125
+ export type V2PluginSpec =
126
+ string | [string, PluginOptions] | V2Plugin | { plugin: V2Plugin; options?: PluginOptions }
127
+
128
+ /**
129
+ * Plugin options passed directly from opencode.json:
130
+ * { "plugin": [ ["opencode-overclock", { "guard": { ... } }] ] }
131
+ */
132
+ export interface OverclockOptions {
133
+ tasks?: boolean | TasksOptions
134
+ sched?: boolean | SchedOptions
135
+ guard?: boolean | GuardOptions
136
+ usage?: boolean | { debounceMs?: number }
137
+ buddy?: boolean
138
+ safety?: boolean | SafetyOptions
139
+ workflow?: boolean | WorkflowOptions
140
+ recovery?: boolean | RecoveryOptions
141
+ truncator?: boolean | TruncatorOptions
142
+ /** Legacy or grouped feature options: { features: { guard: ... } } */
143
+ features?: Record<string, boolean | Record<string, unknown>>
144
+ /** Model-visible tool ids: declared name -> replacement */
145
+ toolNames?: Record<string, string>
146
+ /** Whitelist of tool names the model may be offered */
147
+ toolAllowlist?: string[] | string
148
+ /**
149
+ * V2 plugins to host and run alongside V1:
150
+ * file paths (e.g. "./plugins/custom.ts"), npm specifiers, plugin objects, or [spec, options] tuples.
151
+ */
152
+ plugins?: V2PluginSpec[]
153
+ [key: string]: unknown
154
+ }
155
+
156
+ /**
157
+ * One feature = one module.
158
+ * Can participate in V1 hook composition (`init`), V2 domain transforms (`setup`), or both.
159
+ */
160
+ export interface FeatureModule {
161
+ name: string
162
+ /** on by default? */
163
+ defaultEnabled: boolean
164
+ /** SDK client surfaces (dot-paths) the module needs in V1. Missing -> module skipped + warn. */
165
+ requires?: string[]
166
+ /** Tool names registered. Declared, not derived -- feeds the first-run summary. */
167
+ tools?: string[]
168
+ /** V1 initialization: returns partial Hooks composed in registry order. */
169
+ init(ctx: PluginInput, options: Record<string, unknown>, shared: SharedDeps): Promise<Partial<Hooks>>
170
+ /** V2 setup: receives V2 PluginContext to register domain transforms. */
171
+ setup?(context: PluginContext, options: Record<string, unknown>): Promise<void> | void
172
+ }
173
+
174
+ /**
175
+ * Definition structure for a dual-target plugin (V1 hooks + V2 setup).
176
+ */
177
+ export interface HybridPluginDefinition<TOptions = Record<string, unknown>> {
178
+ readonly id: string
179
+ /** V1 lifecycle: tools, execution interception, event bus hooks */
180
+ readonly server?: (input: PluginInput, options?: TOptions) => Promise<Partial<Hooks>>
181
+ /** V2 lifecycle: domain transforms (agents, commands, catalog, aisdk) */
182
+ readonly setup?: (context: PluginContext, options?: TOptions) => Promise<void> | void
183
+ }
184
+
185
+ /**
186
+ * Plugin instance callable directly in V1 while presenting V2 interface object.
187
+ */
188
+ export interface HybridPlugin<TOptions = Record<string, unknown>> extends V2Plugin {
189
+ (input: PluginInput, options?: TOptions): Promise<Hooks>
190
+ readonly id: string
191
+ readonly server: (input: PluginInput, options?: TOptions) => Promise<Hooks>
192
+ readonly setup: (context: PluginContext) => Promise<void>
193
+ }
@@ -3,8 +3,7 @@ import type { FeatureModule } from "../types.ts"
3
3
  /**
4
4
  * Buddy is a TUI-surface feature (src/buddy/, wired in src/tui.ts): an ASCII pet
5
5
  * beside the prompt. This server module registers no hooks or tools -- it exists
6
- * so `features.buddy` validates in overclock.json (one config file toggles both
7
- * surfaces) and the first-run summary mentions it.
6
+ * so buddy appears in the first-run capability summary.
8
7
  */
9
8
  export const buddy: FeatureModule = {
10
9
  name: "buddy",