Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

fix(coding-agent): remove dead ./hooks subpath export (#2278)

Seth Kartenc0de2eb29e72
diff --git a/packages/coding-agent/.changes/remove-dead-hooks-export.md b/packages/coding-agent/.changes/remove-dead-hooks-export.md
new file mode 100644
index 0000000000..aff1bfbde0
--- /dev/null
+++ b/packages/coding-agent/.changes/remove-dead-hooks-export.md
@@ -0,0 +1 @@
+- Removed the dead `./hooks` subpath export from `@earendil-works/pi-coding-agent`; the `core/hooks` module was deleted in #454 and the advertised export already resolved to a nonexistent file.
diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json
index d51db75cdd..a17d6f88f1 100644
--- a/packages/coding-agent/package.json
+++ b/packages/coding-agent/package.json
@@ -16,10 +16,6 @@
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
- },
- "./hooks": {
- "types": "./dist/core/hooks/index.d.ts",
- "import": "./dist/core/hooks/index.js"
}
},
"files": [
diff --git a/packages/coding-agent/test/package-exports-resolve.test.ts b/packages/coding-agent/test/package-exports-resolve.test.ts
new file mode 100644
index 0000000000..aa1abe974d
--- /dev/null
+++ b/packages/coding-agent/test/package-exports-resolve.test.ts
@@ -0,0 +1,47 @@
+import { existsSync, readFileSync } from "node:fs";
+import { join, resolve } from "node:path";
+import { describe, expect, it } from "vitest";
+
+const pkgRoot = resolve(import.meta.dirname, "..");
+
+describe("package.json exports resolve to existing paths", () => {
+ const pkg = JSON.parse(readFileSync(join(pkgRoot, "package.json"), "utf-8"));
+
+ it("every subpath export points to a source file that exists", () => {
+ const exports = pkg.exports;
+ for (const [subpath, conditional] of Object.entries(exports)) {
+ if (typeof conditional !== "object" || conditional === null) continue;
+ for (const [condition, distPath] of Object.entries(conditional as Record<string, string>)) {
+ // Skip the root "." export — the main index is always valid
+ if (subpath === ".") continue;
+ // Map dist/ back to src/ to check the source file exists
+ const srcPath = distPath
+ .replace(/^\.\/dist\//, "./src/")
+ .replace(/\.js$/, ".ts")
+ .replace(/\.d\.ts$/, ".ts");
+ const fullPath = join(pkgRoot, srcPath);
+ expect(
+ existsSync(fullPath),
+ `export "${subpath}" condition "${condition}" maps to ${distPath} (src: ${srcPath}), but ${fullPath} does not exist`,
+ ).toBe(true);
+ }
+ }
+ });
+});
+
+describe("tsconfig.examples.json path mappings resolve to existing source files", () => {
+ const tsconfig = JSON.parse(readFileSync(join(pkgRoot, "tsconfig.examples.json"), "utf-8"));
+
+ it("every path mapping points to an existing .ts file", () => {
+ const paths = tsconfig.compilerOptions?.paths ?? {};
+ for (const [alias, targets] of Object.entries(paths)) {
+ for (const target of targets as string[]) {
+ const fullPath = join(pkgRoot, target);
+ expect(
+ existsSync(fullPath),
+ `path mapping "${alias}" -> "${target}" resolves to ${fullPath}, which does not exist`,
+ ).toBe(true);
+ }
+ }
+ });
+});
diff --git a/packages/coding-agent/tsconfig.examples.json b/packages/coding-agent/tsconfig.examples.json
index a313c7c2ed..657adc4595 100644
--- a/packages/coding-agent/tsconfig.examples.json
+++ b/packages/coding-agent/tsconfig.examples.json
@@ -4,7 +4,6 @@
"noEmit": true,
"paths": {
"@earendil-works/pi-coding-agent": ["./src/index.ts"],
- "@earendil-works/pi-coding-agent/hooks": ["./src/core/hooks/index.ts"],
"@earendil-works/pi-tui": ["../tui/src/index.ts"],
"@earendil-works/pi-ai": ["../ai/src/index.ts"],
"typebox": ["../../node_modules/typebox"]