Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .claude/hooks/src/daemon-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ export interface DaemonResponse {
// Track response fields
hook?: string;
total_invocations?: number;
// Imports/importers response fields
imports?: any[];
importers?: any[];
}

/**
Expand Down
11 changes: 8 additions & 3 deletions .claude/hooks/src/tldr-read-enforcer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

import { readFileSync, existsSync, statSync } from 'fs';
import { basename, extname } from 'path';
import { queryDaemonSync, DaemonResponse, trackHookActivitySync } from './daemon-client';
import { basename, extname, resolve } from 'path';
import { queryDaemonSync, DaemonResponse, trackHookActivitySync } from './daemon-client.js';

// Search context from smart-search-router
interface SearchContext {
Expand Down Expand Up @@ -371,7 +371,12 @@ async function main() {
return;
}

const filePath = input.tool_input.file_path || '';
const rawFilePath = input.tool_input.file_path || '';
// resolve() guarantees an absolute path: if rawFilePath is already absolute it returns
// it as-is; if relative, it resolves against projectCwd. Falls back to process.cwd()
// if input.cwd is absent (hook spec guarantees it, but be defensive).
const projectCwd = input.cwd || process.cwd();
const filePath = resolve(projectCwd, rawFilePath);

// Allow non-code files
if (!isCodeFile(filePath)) {
Expand Down
2 changes: 1 addition & 1 deletion .claude/hooks/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]
"exclude": ["node_modules", "dist", "src/__tests__"]
}