@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/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 true; set false with --no-sourcemap. */
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 true; set false with --no-sourcemap. */
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 unless disabled. */
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`) are added to the package `exports` map only in the step
10
- * that lands their implementation — never pre-declared.
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";