opencode-command-hooks 0.1.6 ā 0.1.8
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/README.md +31 -26
- package/dist/config/global.d.ts +1 -1
- package/dist/config/global.d.ts.map +1 -1
- package/dist/config/global.js +8 -8
- package/dist/config/global.js.map +1 -1
- package/dist/config/markdown.d.ts +5 -5
- package/dist/config/markdown.d.ts.map +1 -1
- package/dist/config/markdown.js +14 -14
- package/dist/config/markdown.js.map +1 -1
- package/dist/config/merge.d.ts +2 -2
- package/dist/config/merge.d.ts.map +1 -1
- package/dist/config/merge.js +8 -8
- package/dist/config/merge.js.map +1 -1
- package/dist/execution/shell.js +4 -4
- package/dist/execution/shell.js.map +1 -1
- package/dist/execution/template.d.ts +1 -1
- package/dist/execution/template.d.ts.map +1 -1
- package/dist/execution/template.js +4 -4
- package/dist/execution/template.js.map +1 -1
- package/dist/executor.d.ts +21 -0
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +69 -10
- package/dist/executor.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -78
- package/dist/index.js.map +1 -1
- package/dist/logging.d.ts +3 -3
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +6 -6
- package/dist/logging.js.map +1 -1
- package/dist/schemas.d.ts +5 -5
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +10 -10
- package/dist/schemas.js.map +1 -1
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +10 -0
- package/dist/utils.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# šŖ OpenCode Command Hooks
|
|
1
|
+
# šŖ OpenCode Command Hooks šŖ
|
|
2
2
|
|
|
3
3
|
Use simple configs to declaratively define shell command hooks on tool/subagent invocations. With a single line of configuration, you can inject a hook's output directly into context for your agent to read.
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ Use simple configs to declaratively define shell command hooks on tool/subagent
|
|
|
6
6
|
|
|
7
7
|
Define hooks in just a couple lines of markdown frontmatter. Putting them here is also really nice because you can see your entire agent's config in one place.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```yaml
|
|
10
10
|
---
|
|
11
11
|
description: Analyzes the codebase and implements code changes.
|
|
12
12
|
mode: subagent
|
|
@@ -15,7 +15,8 @@ hooks:
|
|
|
15
15
|
- run: "npm run test"
|
|
16
16
|
inject: "Test Output:\n{stdout}\n{stderr}"
|
|
17
17
|
---
|
|
18
|
-
|
|
18
|
+
```
|
|
19
|
+
**This plugin was not built by the OpenCode team nor is it affiliated with them.**
|
|
19
20
|
|
|
20
21
|
## Table of Contents
|
|
21
22
|
|
|
@@ -34,11 +35,11 @@ hooks:
|
|
|
34
35
|
|
|
35
36
|
## Why?
|
|
36
37
|
|
|
37
|
-
When working with a fleet of subagents, automatic validation of the state of your codebase is really useful. By setting up quality gates (lint/typecheck/test/etc.) or other automation, you can catch and prevent errors quickly and reliably.
|
|
38
|
+
When working with a fleet of subagents, automatic validation of the state of your codebase is really useful. By setting up quality gates (lint/typecheck/test/etc.) or other automation, you can catch and prevent errors quickly and reliably.
|
|
38
39
|
|
|
39
|
-
Doing this by asking your orchestrator agent to use the bash tool (or call a validator subagent) is non-deterministic and can cost a lot of tokens over time. You could always write your own custom plugin to achieve this automatic validation behavior, but I found myself writing the same boilerplate, error handling, output capture, and session injection logic over and over again.
|
|
40
|
+
Doing this by asking your orchestrator agent to use the bash tool (or call a validator subagent) is non-deterministic and can cost a lot of tokens over time. You could always write your own custom plugin to achieve this automatic validation behavior, but I found myself writing the same boilerplate, error handling, output capture, and session injection logic over and over again.
|
|
40
41
|
|
|
41
|
-
Though this plugin is mostly a wrapper around accessing hooks that
|
|
42
|
+
Though this plugin is mostly a wrapper around accessing hooks that OpenCode already exposes, it provides basic plumbing that reduces overhead, giving you a simple, opinionated system for integrating command hooks into your OpenCode workflow. I also just like having hooks/config for my agents all colocated in one place (markdown files) and thought that maybe somebody else would like this too.
|
|
42
43
|
|
|
43
44
|
---
|
|
44
45
|
|
|
@@ -136,14 +137,12 @@ You can set up tool hooks to only trigger on specific arguments via `when.toolAr
|
|
|
136
137
|
"when": {
|
|
137
138
|
"phase": "after",
|
|
138
139
|
"tool": "playwright_browser_navigate",
|
|
139
|
-
"toolArgs": { "url": "http://localhost:3000]" }
|
|
140
|
+
"toolArgs": { "url": "http://localhost:3000]" },
|
|
140
141
|
},
|
|
141
|
-
"run": [
|
|
142
|
-
"osascript -e 'display notification \"Agent triggered playwright\"'"
|
|
143
|
-
],
|
|
142
|
+
"run": ["osascript -e 'display notification \"Agent triggered playwright\"'"],
|
|
144
143
|
"toast": {
|
|
145
|
-
"message": "Agent used the playwright {tool} tool"
|
|
146
|
-
}
|
|
144
|
+
"message": "Agent used the playwright {tool} tool",
|
|
145
|
+
},
|
|
147
146
|
}
|
|
148
147
|
```
|
|
149
148
|
|
|
@@ -166,7 +165,7 @@ Add to your `opencode.json`:
|
|
|
166
165
|
|
|
167
166
|
```jsonc
|
|
168
167
|
{
|
|
169
|
-
"plugin": ["opencode-command-hooks"]
|
|
168
|
+
"plugin": ["opencode-command-hooks"],
|
|
170
169
|
}
|
|
171
170
|
```
|
|
172
171
|
|
|
@@ -192,11 +191,11 @@ Create `.opencode/command-hooks.jsonc` in your project (the plugin searches upwa
|
|
|
192
191
|
|
|
193
192
|
#### JSON Config Options
|
|
194
193
|
|
|
195
|
-
| Option
|
|
196
|
-
|
|
|
197
|
-
| `truncationLimit` | `number`
|
|
198
|
-
| `tool`
|
|
199
|
-
| `session`
|
|
194
|
+
| Option | Type | Description |
|
|
195
|
+
| ----------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
196
|
+
| `truncationLimit` | `number` | Maximum characters to capture from command output. Defaults to 30,000 (matching OpenCode's bash tool). Must be a positive integer. |
|
|
197
|
+
| `tool` | `ToolHook[]` | Array of tool execution hooks |
|
|
198
|
+
| `session` | `SessionHook[]` | Array of session lifecycle hooks |
|
|
200
199
|
|
|
201
200
|
### Markdown Frontmatter
|
|
202
201
|
|
|
@@ -349,8 +348,10 @@ All inject/toast string templates support these placeholders:
|
|
|
349
348
|
---
|
|
350
349
|
|
|
351
350
|
## Why Use This Plugin?
|
|
351
|
+
|
|
352
352
|
**It lets you easily set up bash hooks with ~3-5 lines of YAML which are cleanly colocated with your subagent configuration.**
|
|
353
353
|
Conversely, rolling your own looks something like this (for each project and set of hooks you want to set up):
|
|
354
|
+
|
|
354
355
|
```ts
|
|
355
356
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
356
357
|
|
|
@@ -377,22 +378,26 @@ export const MyHooks: Plugin = async ({ $, client }) => {
|
|
|
377
378
|
try {
|
|
378
379
|
// Run commands sequentially, even if they fail
|
|
379
380
|
let lastResult = { exitCode: 0, stdout: "", stderr: "" };
|
|
380
|
-
|
|
381
|
+
|
|
381
382
|
for (const cmd of ["npm run typecheck", "npm run lint"]) {
|
|
382
383
|
try {
|
|
383
384
|
const result = await $`sh -c ${cmd}`.nothrow().quiet();
|
|
384
385
|
const stdout = result.stdout?.toString() || "";
|
|
385
386
|
const stderr = result.stderr?.toString() || "";
|
|
386
|
-
|
|
387
|
+
|
|
387
388
|
// Truncate to 30k chars to match OpenCode's bash tool
|
|
388
389
|
lastResult = {
|
|
389
390
|
exitCode: result.exitCode ?? 0,
|
|
390
|
-
stdout:
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
391
|
+
stdout:
|
|
392
|
+
stdout.length > 30000
|
|
393
|
+
? stdout.slice(0, 30000) +
|
|
394
|
+
"\n[Output truncated: exceeded 30000 character limit]"
|
|
395
|
+
: stdout,
|
|
396
|
+
stderr:
|
|
397
|
+
stderr.length > 30000
|
|
398
|
+
? stderr.slice(0, 30000) +
|
|
399
|
+
"\n[Output truncated: exceeded 30000 character limit]"
|
|
400
|
+
: stderr,
|
|
396
401
|
};
|
|
397
402
|
} catch (err) {
|
|
398
403
|
lastResult = { exitCode: 1, stdout: "", stderr: String(err) };
|
package/dist/config/global.d.ts
CHANGED
|
@@ -23,5 +23,5 @@ export type GlobalConfigResult = {
|
|
|
23
23
|
*
|
|
24
24
|
* @returns Promise resolving to GlobalConfigResult
|
|
25
25
|
*/
|
|
26
|
-
export declare
|
|
26
|
+
export declare const loadGlobalConfig: () => Promise<GlobalConfigResult>;
|
|
27
27
|
//# sourceMappingURL=global.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/config/global.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAK5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAuIF;;;;;;;;;;;;;GAaG;AACH,
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/config/global.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAK5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAuIF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,kBAAkB,CA2EnE,CAAA"}
|
package/dist/config/global.js
CHANGED
|
@@ -11,7 +11,7 @@ import { logger } from "../logging.js";
|
|
|
11
11
|
* Strip comments from JSONC content
|
|
12
12
|
* Handles both line comments and block comments
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
const stripJsoncComments = (content) => {
|
|
15
15
|
let result = "";
|
|
16
16
|
let i = 0;
|
|
17
17
|
let inString = false;
|
|
@@ -77,11 +77,11 @@ function stripJsoncComments(content) {
|
|
|
77
77
|
i++;
|
|
78
78
|
}
|
|
79
79
|
return result;
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
81
|
/**
|
|
82
82
|
* Parse JSON content, handling parse errors gracefully
|
|
83
83
|
*/
|
|
84
|
-
|
|
84
|
+
const parseJson = (content) => {
|
|
85
85
|
try {
|
|
86
86
|
return JSON.parse(content);
|
|
87
87
|
}
|
|
@@ -89,12 +89,12 @@ function parseJson(content) {
|
|
|
89
89
|
const message = error instanceof Error ? error.message : String(error);
|
|
90
90
|
throw new Error(`Failed to parse JSON: ${message}`);
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
};
|
|
93
93
|
/**
|
|
94
94
|
* Find command hooks config file by walking up directory tree
|
|
95
95
|
* Looks for .opencode/command-hooks.jsonc
|
|
96
96
|
*/
|
|
97
|
-
async
|
|
97
|
+
const findConfigFile = async (startDir) => {
|
|
98
98
|
let currentDir = startDir;
|
|
99
99
|
// Limit search depth to avoid infinite loops
|
|
100
100
|
const maxDepth = 20;
|
|
@@ -123,7 +123,7 @@ async function findConfigFile(startDir) {
|
|
|
123
123
|
}
|
|
124
124
|
logger.debug(`No config file found after searching ${depth} directories`);
|
|
125
125
|
return null;
|
|
126
|
-
}
|
|
126
|
+
};
|
|
127
127
|
/**
|
|
128
128
|
* Load and parse global command hooks configuration
|
|
129
129
|
*
|
|
@@ -138,7 +138,7 @@ async function findConfigFile(startDir) {
|
|
|
138
138
|
*
|
|
139
139
|
* @returns Promise resolving to GlobalConfigResult
|
|
140
140
|
*/
|
|
141
|
-
export async
|
|
141
|
+
export const loadGlobalConfig = async () => {
|
|
142
142
|
let configPath = null;
|
|
143
143
|
try {
|
|
144
144
|
// Find config file
|
|
@@ -202,5 +202,5 @@ export async function loadGlobalConfig() {
|
|
|
202
202
|
error: `Unexpected error loading global config: ${message}`,
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
}
|
|
205
|
+
};
|
|
206
206
|
//# sourceMappingURL=global.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/config/global.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAOvC;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/config/global.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAOvC;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAU,EAAE;IACrD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,WAAW,GAAsB,IAAI,CAAC;IAC1C,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE5B,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,IAAI,OAAO,CAAC;YAClB,IAAI,SAAS,EAAE,CAAC;gBACd,SAAS,GAAG,KAAK,CAAC;YACpB,CAAC;iBAAM,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBAC5B,SAAS,GAAG,IAAI,CA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M,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,gBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,gBAAgB,CACxJ,CAAC;QAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,kCAAkC;QAClC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,CAAC,IAAI,CAAC,2CAA2C,OAAO,EAAE,CAAC,CAAC;QAClE,OAAO;YACL,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YACjC,KAAK,EAAE,2CAA2C,OAAO,EAAE;SAC5D,CAAC;IACJ,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -27,7 +27,7 @@ import type { AgentHooks, CommandHooksConfig } from "../types/hooks.js";
|
|
|
27
27
|
* ```
|
|
28
28
|
* Returns the YAML between the delimiters
|
|
29
29
|
*/
|
|
30
|
-
export declare
|
|
30
|
+
export declare const extractYamlFrontmatter: (content: string) => string | null;
|
|
31
31
|
/**
|
|
32
32
|
* Parse YAML content and return the parsed object
|
|
33
33
|
*
|
|
@@ -37,7 +37,7 @@ export declare function extractYamlFrontmatter(content: string): string | null;
|
|
|
37
37
|
* @param yamlContent - Raw YAML string to parse
|
|
38
38
|
* @returns Parsed YAML object, or null if parsing failed
|
|
39
39
|
*/
|
|
40
|
-
export declare
|
|
40
|
+
export declare const parseYamlFrontmatter: (content: string) => unknown;
|
|
41
41
|
/**
|
|
42
42
|
* Parse simplified agent hooks from YAML frontmatter content
|
|
43
43
|
*
|
|
@@ -58,7 +58,7 @@ export declare function parseYamlFrontmatter(content: string): unknown;
|
|
|
58
58
|
* inject: "Results:\n{stdout}"
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
|
-
export declare
|
|
61
|
+
export declare const parseAgentHooks: (yamlContent: string) => AgentHooks | null;
|
|
62
62
|
/**
|
|
63
63
|
* Convert simplified agent hooks to internal CommandHooksConfig format
|
|
64
64
|
*
|
|
@@ -78,7 +78,7 @@ export declare function parseAgentHooks(yamlContent: string): AgentHooks | null;
|
|
|
78
78
|
* // Results in: { tool: [{ id: "engineer-after-0", when: {...}, run: ..., inject: ... }] }
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
export declare
|
|
81
|
+
export declare const convertToCommandHooksConfig: (agentHooks: AgentHooks, agentName: string) => CommandHooksConfig;
|
|
82
82
|
/**
|
|
83
83
|
* Load and parse command hooks configuration from a markdown file
|
|
84
84
|
*
|
|
@@ -101,5 +101,5 @@ export declare function convertToCommandHooksConfig(agentHooks: AgentHooks, agen
|
|
|
101
101
|
* // Returns { tool: [...], session: [...] } or { tool: [], session: [] }
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
|
-
export declare
|
|
104
|
+
export declare const loadMarkdownConfig: (filePath: string) => Promise<CommandHooksConfig>;
|
|
105
105
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/config/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAkB,kBAAkB,EAAY,MAAM,mBAAmB,CAAC;AAOlG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/config/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAkB,kBAAkB,EAAY,MAAM,mBAAmB,CAAC;AAOlG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,MAAM,GAAG,IAmBjE,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,OAStD,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,GAC1B,aAAa,MAAM,KAClB,UAAU,GAAG,IA8Cf,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,2BAA2B,GACtC,YAAY,UAAU,EACtB,WAAW,MAAM,KAChB,kBAqCF,CAAA;AAqDD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kBAAkB,GAC3B,UAAU,MAAM,KACjB,OAAO,CAAC,kBAAkB,CAmG5B,CAAA"}
|
package/dist/config/markdown.js
CHANGED
|
@@ -29,7 +29,7 @@ import { logger } from "../logging.js";
|
|
|
29
29
|
* ```
|
|
30
30
|
* Returns the YAML between the delimiters
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export const extractYamlFrontmatter = (content) => {
|
|
33
33
|
// Check if content starts with ---
|
|
34
34
|
if (!content.startsWith("---")) {
|
|
35
35
|
return null;
|
|
@@ -44,7 +44,7 @@ export function extractYamlFrontmatter(content) {
|
|
|
44
44
|
// Extract YAML between the delimiters
|
|
45
45
|
const yamlContent = content.substring(3, secondDelimiterIndex).trim();
|
|
46
46
|
return yamlContent;
|
|
47
|
-
}
|
|
47
|
+
};
|
|
48
48
|
/**
|
|
49
49
|
* Parse YAML content and return the parsed object
|
|
50
50
|
*
|
|
@@ -54,7 +54,7 @@ export function extractYamlFrontmatter(content) {
|
|
|
54
54
|
* @param yamlContent - Raw YAML string to parse
|
|
55
55
|
* @returns Parsed YAML object, or null if parsing failed
|
|
56
56
|
*/
|
|
57
|
-
export
|
|
57
|
+
export const parseYamlFrontmatter = (content) => {
|
|
58
58
|
try {
|
|
59
59
|
const parsed = parseYaml(content);
|
|
60
60
|
return parsed === undefined ? null : parsed;
|
|
@@ -64,7 +64,7 @@ export function parseYamlFrontmatter(content) {
|
|
|
64
64
|
logger.debug(`Failed to parse YAML: ${message}`);
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
};
|
|
68
68
|
/**
|
|
69
69
|
* Parse simplified agent hooks from YAML frontmatter content
|
|
70
70
|
*
|
|
@@ -85,7 +85,7 @@ export function parseYamlFrontmatter(content) {
|
|
|
85
85
|
* inject: "Results:\n{stdout}"
|
|
86
86
|
* ```
|
|
87
87
|
*/
|
|
88
|
-
export
|
|
88
|
+
export const parseAgentHooks = (yamlContent) => {
|
|
89
89
|
const parsed = parseYamlFrontmatter(yamlContent);
|
|
90
90
|
if (parsed === null || typeof parsed !== "object") {
|
|
91
91
|
return null;
|
|
@@ -122,7 +122,7 @@ export function parseAgentHooks(yamlContent) {
|
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
124
124
|
return result;
|
|
125
|
-
}
|
|
125
|
+
};
|
|
126
126
|
/**
|
|
127
127
|
* Convert simplified agent hooks to internal CommandHooksConfig format
|
|
128
128
|
*
|
|
@@ -142,7 +142,7 @@ export function parseAgentHooks(yamlContent) {
|
|
|
142
142
|
* // Results in: { tool: [{ id: "engineer-after-0", when: {...}, run: ..., inject: ... }] }
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
|
-
export
|
|
145
|
+
export const convertToCommandHooksConfig = (agentHooks, agentName) => {
|
|
146
146
|
const toolHooks = [];
|
|
147
147
|
// Convert before hooks
|
|
148
148
|
if (agentHooks.before) {
|
|
@@ -166,11 +166,11 @@ export function convertToCommandHooksConfig(agentHooks, agentName) {
|
|
|
166
166
|
tool: toolHooks,
|
|
167
167
|
session: [],
|
|
168
168
|
};
|
|
169
|
-
}
|
|
169
|
+
};
|
|
170
170
|
/**
|
|
171
171
|
* Convert a single AgentHookEntry to ToolHook format
|
|
172
172
|
*/
|
|
173
|
-
|
|
173
|
+
const convertAgentHookEntryToToolHook = (entry, agentName, phase, index) => {
|
|
174
174
|
if (!entry.run) {
|
|
175
175
|
logger.debug("Hook entry missing required 'run' field");
|
|
176
176
|
return null;
|
|
@@ -187,7 +187,7 @@ function convertAgentHookEntryToToolHook(entry, agentName, phase, index) {
|
|
|
187
187
|
inject: entry.inject,
|
|
188
188
|
toast: entry.toast,
|
|
189
189
|
};
|
|
190
|
-
}
|
|
190
|
+
};
|
|
191
191
|
/**
|
|
192
192
|
* Extract agent name from file path
|
|
193
193
|
*
|
|
@@ -203,10 +203,10 @@ function convertAgentHookEntryToToolHook(entry, agentName, phase, index) {
|
|
|
203
203
|
* // Returns: "engineer"
|
|
204
204
|
* ```
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
const extractAgentNameFromPath = (filePath) => {
|
|
207
207
|
const fileName = filePath.split("/").pop() || "";
|
|
208
208
|
return fileName.replace(/\.md$/, "");
|
|
209
|
-
}
|
|
209
|
+
};
|
|
210
210
|
/**
|
|
211
211
|
* Load and parse command hooks configuration from a markdown file
|
|
212
212
|
*
|
|
@@ -229,7 +229,7 @@ function extractAgentNameFromPath(filePath) {
|
|
|
229
229
|
* // Returns { tool: [...], session: [...] } or { tool: [], session: [] }
|
|
230
230
|
* ```
|
|
231
231
|
*/
|
|
232
|
-
export async
|
|
232
|
+
export const loadMarkdownConfig = async (filePath) => {
|
|
233
233
|
try {
|
|
234
234
|
// Try to read the file
|
|
235
235
|
let content;
|
|
@@ -298,5 +298,5 @@ export async function loadMarkdownConfig(filePath) {
|
|
|
298
298
|
logger.info(`Unexpected error loading markdown config from ${filePath}: ${message}`);
|
|
299
299
|
return { tool: [], session: [] };
|
|
300
300
|
}
|
|
301
|
-
}
|
|
301
|
+
};
|
|
302
302
|
//# sourceMappingURL=markdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/config/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EA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QAED,MAAM,CAAC,KAAK,CACV,6BAA6B,QAAQ,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,gBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,gBAAgB,CAC9H,CAAC;QAEJ,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,kCAAkC;QAClC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,CAAC,IAAI,CACT,iDAAiD,QAAQ,KAAK,OAAO,EAAE,CACxE,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACnC,CAAC;AACL,CAAC,CAAA"}
|
package/dist/config/merge.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ import type { CommandHooksConfig, ToolHook, SessionHook, HookValidationError } f
|
|
|
27
27
|
* findDuplicateIds(hooks) // Returns ["hook-1"]
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export declare
|
|
30
|
+
export declare const findDuplicateIds: (hooks: (ToolHook | SessionHook)[]) => string[];
|
|
31
31
|
/**
|
|
32
32
|
* Merge global and markdown configs with proper precedence
|
|
33
33
|
*
|
|
@@ -60,7 +60,7 @@ export declare function findDuplicateIds(hooks: (ToolHook | SessionHook)[]): str
|
|
|
60
60
|
* // result.errors === [] (no duplicates)
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export declare
|
|
63
|
+
export declare const mergeConfigs: (global: CommandHooksConfig, markdown: CommandHooksConfig) => {
|
|
64
64
|
config: CommandHooksConfig;
|
|
65
65
|
errors: HookValidationError[];
|
|
66
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/config/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACtB,MAAM,mBAAmB,CAAA;AAG1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/config/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACtB,MAAM,mBAAmB,CAAA;AAG1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,KAAG,MAAM,EAa1E,CAAA;AA+GD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,YAAY,GACtB,QAAQ,kBAAkB,EAC1B,UAAU,kBAAkB,KAC5B;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,mBAAmB,EAAE,CAAA;CAqC7D,CAAA"}
|
package/dist/config/merge.js
CHANGED
|
@@ -27,7 +27,7 @@ import { logger } from "../logging.js";
|
|
|
27
27
|
* findDuplicateIds(hooks) // Returns ["hook-1"]
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export const findDuplicateIds = (hooks) => {
|
|
31
31
|
const idCounts = new Map();
|
|
32
32
|
// Count occurrences of each ID
|
|
33
33
|
for (const hook of hooks) {
|
|
@@ -38,7 +38,7 @@ export function findDuplicateIds(hooks) {
|
|
|
38
38
|
return Array.from(idCounts.entries())
|
|
39
39
|
.filter(([, count]) => count > 1)
|
|
40
40
|
.map(([id]) => id);
|
|
41
|
-
}
|
|
41
|
+
};
|
|
42
42
|
/**
|
|
43
43
|
* Validate a single config source for duplicate IDs
|
|
44
44
|
*
|
|
@@ -49,7 +49,7 @@ export function findDuplicateIds(hooks) {
|
|
|
49
49
|
* @param source - Source identifier for error reporting (e.g., "global", "markdown")
|
|
50
50
|
* @returns Array of validation errors (empty if no duplicates)
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
const validateConfigForDuplicates = (config, source) => {
|
|
53
53
|
const errors = [];
|
|
54
54
|
// Check tool hooks for duplicates
|
|
55
55
|
if (config.tool && config.tool.length > 0) {
|
|
@@ -76,7 +76,7 @@ function validateConfigForDuplicates(config, source) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return errors;
|
|
79
|
-
}
|
|
79
|
+
};
|
|
80
80
|
/**
|
|
81
81
|
* Merge two hook arrays with markdown taking precedence
|
|
82
82
|
*
|
|
@@ -103,7 +103,7 @@ function validateConfigForDuplicates(config, source) {
|
|
|
103
103
|
* // Returns: [{ id: "hook-1", ... (markdown version) }, { id: "hook-2", ... }, { id: "hook-3", ... }]
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
const mergeHookArrays = (globalHooks, markdownHooks) => {
|
|
107
107
|
// Create a map of markdown hooks by ID for quick lookup
|
|
108
108
|
const markdownMap = new Map();
|
|
109
109
|
const markdownIds = new Set();
|
|
@@ -132,7 +132,7 @@ function mergeHookArrays(globalHooks, markdownHooks) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
return result;
|
|
135
|
-
}
|
|
135
|
+
};
|
|
136
136
|
/**
|
|
137
137
|
* Merge global and markdown configs with proper precedence
|
|
138
138
|
*
|
|
@@ -165,7 +165,7 @@ function mergeHookArrays(globalHooks, markdownHooks) {
|
|
|
165
165
|
* // result.errors === [] (no duplicates)
|
|
166
166
|
* ```
|
|
167
167
|
*/
|
|
168
|
-
export
|
|
168
|
+
export const mergeConfigs = (global, markdown) => {
|
|
169
169
|
const errors = [];
|
|
170
170
|
// Validate global config for duplicates
|
|
171
171
|
const globalErrors = validateConfigForDuplicates(global, "global");
|
|
@@ -190,5 +190,5 @@ export function mergeConfigs(global, markdown) {
|
|
|
190
190
|
};
|
|
191
191
|
logger.debug(`Merged configs: ${mergedToolHooks.length} tool hooks, ${mergedSessionHooks.length} session hooks, truncationLimit: ${mergedConfig.truncationLimit}, ${errors.length} errors`);
|
|
192
192
|
return { config: mergedConfig, errors };
|
|
193
|
-
}
|
|
193
|
+
};
|
|
194
194
|
//# sourceMappingURL=merge.js.map
|
package/dist/config/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/config/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/config/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAiC,EAAY,EAAE;IAC7E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE1C,+BAA+B;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;QACxC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IAClC,CAAC;IAED,wCAAwC;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,EAAE,CA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30000;
|
|
|
16
16
|
/**
|
|
17
17
|
* Truncate text to a maximum length, matching OpenCode's bash tool behavior
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
const truncateText = (text, limit) => {
|
|
20
20
|
if (!text)
|
|
21
21
|
return "";
|
|
22
22
|
if (text.length <= limit)
|
|
@@ -24,7 +24,7 @@ function truncateText(text, limit) {
|
|
|
24
24
|
const truncated = text.slice(0, limit);
|
|
25
25
|
const metadata = `\n\n[Output truncated: exceeded ${limit} character limit]`;
|
|
26
26
|
return truncated + metadata;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
/**
|
|
29
29
|
* Execute a single shell command
|
|
30
30
|
*
|
|
@@ -147,7 +147,7 @@ export async function executeCommands(commands, hookId, options) {
|
|
|
147
147
|
* @param command - Shell command to execute
|
|
148
148
|
* @returns Object with stdout, stderr, and exitCode
|
|
149
149
|
*/
|
|
150
|
-
async
|
|
150
|
+
const executeShellCommand = async (command) => {
|
|
151
151
|
try {
|
|
152
152
|
// Use Bun's $ template literal to execute the command
|
|
153
153
|
// The nothrow() method prevents throwing on non-zero exit codes
|
|
@@ -174,5 +174,5 @@ async function executeShellCommand(command) {
|
|
|
174
174
|
exitCode: 1,
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
}
|
|
177
|
+
};
|
|
178
178
|
//# sourceMappingURL=shell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/execution/shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,sBAAsB,GAAG,KAAM,CAAA;AAErC;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/execution/shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,M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MAAM,CAAC,MAAM,YAAY,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACjG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,YAAY,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACjG,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAA;QAErC,OAAO;YACL,MAAM;YACN,MAAM;YACN,QAAQ;SACT,CAAA;IACF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,kEAAkE;QAClE,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3E,MAAM,CAAC,KAAK,CAAC,uCAAuC,YAAY,EAAE,CAAC,CAAA;QAErE,OAAO;YACL,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,YAAY;YACpB,QAAQ,EAAE,CAAC;SACZ,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -51,5 +51,5 @@ import type { TemplateContext } from "../types/hooks.js";
|
|
|
51
51
|
* // Result: "Hook tests-after-task for task completed: exit 0\n```\nā All tests passed\n```"
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
export declare
|
|
54
|
+
export declare const interpolateTemplate: (template: string | undefined, context: TemplateContext) => string;
|
|
55
55
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/execution/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAoBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/execution/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAoBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,GAAG,SAAS,EAAE,SAAS,eAAe,KAAG,MAmC5F,CAAA"}
|