@goodfoot/agent-hooks 1.0.8 → 1.0.10
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 +13 -0
- package/README.md +67 -34
- package/dist/agents/antigravity/cli-support.js +284 -0
- package/dist/agents/antigravity/constants.js +20 -0
- package/dist/agents/antigravity/events.js +24 -22
- package/dist/agents/antigravity/hooks.js +7 -8
- package/dist/agents/antigravity/index.js +7 -18
- package/dist/agents/antigravity/outputs.js +38 -31
- package/dist/agents/antigravity/scaffold.js +211 -0
- package/dist/agents/antigravity/transport.js +3 -1
- package/dist/agents/antigravity/types.js +14 -7
- package/dist/agents/codex/cli-support.js +4 -2
- package/dist/agents/codex/scaffold.js +1 -1
- package/dist/agents/opencode/cli-support.js +1 -1
- package/dist/cli.js +92 -10
- package/dist/index.js +2 -2
- package/dist/scaffold.js +1 -1
- package/package.json +5 -1
- package/types/agents/antigravity/cli-support.d.ts +100 -0
- package/types/agents/antigravity/constants.d.ts +15 -0
- package/types/agents/antigravity/events.d.ts +24 -22
- package/types/agents/antigravity/hooks.d.ts +7 -8
- package/types/agents/antigravity/index.d.ts +9 -16
- package/types/agents/antigravity/outputs.d.ts +94 -65
- package/types/agents/antigravity/scaffold.d.ts +16 -0
- package/types/agents/antigravity/transport.d.ts +3 -1
- package/types/agents/antigravity/types.d.ts +53 -26
- package/types/cli.d.ts +16 -5
- package/types/index.d.ts +2 -2
package/types/cli.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ type HookContext = "plugin" | "agent";
|
|
|
28
28
|
* Command-line arguments parsed from process.argv.
|
|
29
29
|
*/
|
|
30
30
|
interface CliArgs {
|
|
31
|
-
/** Target agent runtime (required): "claude-code" | "codex" | "antigravity". */
|
|
31
|
+
/** Target agent runtime (required): "claude-code" | "codex" | "antigravity" | "opencode". */
|
|
32
32
|
agent: string;
|
|
33
33
|
/** Glob pattern for hook source files. */
|
|
34
34
|
input: string;
|
|
@@ -54,7 +54,7 @@ interface CliArgs {
|
|
|
54
54
|
pluginRoot?: boolean;
|
|
55
55
|
/** Emit hash-free `<name>.mjs` bundles. Defaults to true; set false with --no-stable-names. */
|
|
56
56
|
stableNames?: boolean;
|
|
57
|
-
/** Embed an inline sourcemap in compiled bundles. Defaults to
|
|
57
|
+
/** Embed an inline sourcemap in compiled bundles. Defaults to false; enable with --sourcemap. */
|
|
58
58
|
sourcemap?: boolean;
|
|
59
59
|
}
|
|
60
60
|
type HookLoaderMap = Record<string, esbuild.Loader>;
|
|
@@ -173,14 +173,14 @@ interface CompileHookOptions {
|
|
|
173
173
|
logEnvVar?: string;
|
|
174
174
|
/** Explicit esbuild loaders for non-code imports. */
|
|
175
175
|
loaders: HookLoaderMap;
|
|
176
|
-
/** Embed an inline sourcemap in the compiled content. Defaults to
|
|
176
|
+
/** Embed an inline sourcemap in the compiled content. Defaults to false; enable with --sourcemap. */
|
|
177
177
|
sourcemap?: boolean;
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
180
|
* Result of compiling a hook.
|
|
181
181
|
*/
|
|
182
182
|
interface CompileHookResult {
|
|
183
|
-
/** Compiled content, with inline sourcemaps
|
|
183
|
+
/** Compiled content, with inline sourcemaps when enabled. */
|
|
184
184
|
content: string;
|
|
185
185
|
/** Stable content hash generated from sourcemap-free output. */
|
|
186
186
|
contentHash: string;
|
|
@@ -203,6 +203,17 @@ interface CompileHookResult {
|
|
|
203
203
|
* checkout-local.
|
|
204
204
|
*/
|
|
205
205
|
declare function symlinkVisiblePath(realPath: string, resolveDir: string): string;
|
|
206
|
+
/**
|
|
207
|
+
* Returns the stable project anchor for a module reached through node_modules.
|
|
208
|
+
*
|
|
209
|
+
* esbuild otherwise uses process.cwd() when rendering module-boundary comments
|
|
210
|
+
* and sourcemap source paths. A workspace script normally runs from the
|
|
211
|
+
* consuming package, while its dependencies may be hoisted several directories
|
|
212
|
+
* higher, making those emitted paths depend on the consumer's nesting depth.
|
|
213
|
+
* Anchoring at the directory which owns the visible node_modules keeps the
|
|
214
|
+
* canonical `node_modules/...` form in every such layout.
|
|
215
|
+
*/
|
|
216
|
+
declare function moduleWorkingDir(modulePath: string, fallback: string): string;
|
|
206
217
|
/**
|
|
207
218
|
* Compiles a TypeScript hook file to a self-contained ESM executable.
|
|
208
219
|
*
|
|
@@ -312,4 +323,4 @@ declare function extractPreservedHooks(existingHooksJson: HooksJson): Partial<Re
|
|
|
312
323
|
*/
|
|
313
324
|
declare function mergeHooksJson(newHooksJson: HooksJson, preservedHooks: Partial<Record<HookEventName, MatcherEntry[]>>): HooksJson;
|
|
314
325
|
export type { CliArgs, CompiledHook, HookConfig, HookLoaderMap, HookMetadata, HooksJson, MatcherEntry };
|
|
315
|
-
export { analyzeHookFile, buildLoaderMap, buildLoaderMap as buildEsbuildLoaderMap, compileHook, detectHookContext, discoverHookFiles, discoverHookFiles as discoverHookSourceFiles, extractPreservedHooks, generateCommandPath, generateContentHash, generateContentHash as sha256Prefix8, generateHooksJson, groupHooksByEventAndMatcher, HOOK_FACTORY_TO_EVENT, mergeHooksJson, parseArgs, parseLoaderFlag, parseLoaderFlag as parseEsbuildLoaderFlag, pruneStaleHashedBundles, readExistingHooksJson, removeOldGeneratedFiles, symlinkVisiblePath, validateArgs, };
|
|
326
|
+
export { analyzeHookFile, buildLoaderMap, buildLoaderMap as buildEsbuildLoaderMap, compileHook, detectHookContext, discoverHookFiles, discoverHookFiles as discoverHookSourceFiles, extractPreservedHooks, generateCommandPath, generateContentHash, generateContentHash as sha256Prefix8, generateHooksJson, groupHooksByEventAndMatcher, HOOK_FACTORY_TO_EVENT, mergeHooksJson, moduleWorkingDir, parseArgs, parseLoaderFlag, parseLoaderFlag as parseEsbuildLoaderFlag, pruneStaleHashedBundles, readExistingHooksJson, removeOldGeneratedFiles, symlinkVisiblePath, validateArgs, };
|
package/types/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* {@link HookBlockError}, the Logger, env utilities, and stdin helpers.
|
|
7
7
|
*
|
|
8
8
|
* Per-agent entry points (`@goodfoot/agent-hooks/claude-code`, `/codex`,
|
|
9
|
-
* `/antigravity`)
|
|
10
|
-
*
|
|
9
|
+
* `/opencode`, `/antigravity`) expose each host's native protocol without
|
|
10
|
+
* leaking host-specific types through this root module.
|
|
11
11
|
* @module
|
|
12
12
|
*/
|
|
13
13
|
export { defineHook } from "./core/define-hook.js";
|