surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
This branch's hooks module linked exactly 512 files, the most the engine
reads for one module; with the two is-checkpointing files from main it
linked 514 and did not load ("is past the 512 files a hooks module may
link and was not read"). editedPathOf, hasSessionFiles and normalPathOf
each lose their own folder and index and sit as one file beside the
barrel that exports them, as editing-tools.ts and partition-of.ts do: 511
files linked.
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | export * from './is-outside-working-tree.js' |
| 2 | -export * from './normal-path-of' | |
| 2 | +export * from './normal-path-of.js' | |
| 3 | 3 | |
| 4 | 4 | export * as default from '.' |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | import Git from '../git' |
| 2 | -import { normalPathOf } from './normal-path-of' | |
| 2 | +import { normalPathOf } from './normal-path-of.js' | |
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Whether a file a tool edited lies outside the pinned working tree, by |
| @@ -1,3 +1,0 @@ | ||
| 1 | -export * from './normal-path-of.js' | |
| 2 | - | |
| 3 | -export * as default from '.' |
| @@ -1,25 +1,0 @@ | ||
| 1 | -/** | |
| 2 | - * An absolute path spelled one way, its names joined by `/` with no | |
| 3 | - * leading or trailing one: either separator splits, `.` and empty names | |
| 4 | - * drop, `..` drops the name before it. No disk is read, no link followed. | |
| 5 | - * | |
| 6 | - * A drive-letter path is lowercased, as its file system compares names. | |
| 7 | - * | |
| 8 | - * @param path an absolute path, POSIX or drive-letter | |
| 9 | - * @returns the names joined, empty for the root | |
| 10 | - */ | |
| 11 | -export function normalPathOf(path: string): string { | |
| 12 | - const names: string[] = [] | |
| 13 | - | |
| 14 | - for (const name of path.split(/[\\/]/)) { | |
| 15 | - if (name === '..') { | |
| 16 | - names.pop() | |
| 17 | - } else if (name !== '' && name !== '.') { | |
| 18 | - names.push(name) | |
| 19 | - } | |
| 20 | - } | |
| 21 | - | |
| 22 | - const spelled = names.join('/') | |
| 23 | - | |
| 24 | - return /^[A-Za-z]:/.test(spelled) ? spelled.toLowerCase() : spelled | |
| 25 | -} |
| @@ -1,0 +1,25 @@ | ||
| 1 | +/** | |
| 2 | + * An absolute path spelled one way, its names joined by `/` with no | |
| 3 | + * leading or trailing one: either separator splits, `.` and empty names | |
| 4 | + * drop, `..` drops the name before it. No disk is read, no link followed. | |
| 5 | + * | |
| 6 | + * A drive-letter path is lowercased, as its file system compares names. | |
| 7 | + * | |
| 8 | + * @param path an absolute path, POSIX or drive-letter | |
| 9 | + * @returns the names joined, empty for the root | |
| 10 | + */ | |
| 11 | +export function normalPathOf(path: string): string { | |
| 12 | + const names: string[] = [] | |
| 13 | + | |
| 14 | + for (const name of path.split(/[\\/]/)) { | |
| 15 | + if (name === '..') { | |
| 16 | + names.pop() | |
| 17 | + } else if (name !== '' && name !== '.') { | |
| 18 | + names.push(name) | |
| 19 | + } | |
| 20 | + } | |
| 21 | + | |
| 22 | + const spelled = names.join('/') | |
| 23 | + | |
| 24 | + return /^[A-Za-z]:/.test(spelled) ? spelled.toLowerCase() : spelled | |
| 25 | +} |
| @@ -1,22 +1,0 @@ | ||
| 1 | -import type Git from '../../git' | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Whether a fetch settled with a file the header would count, so a pane | |
| 5 | - * opened on it lists something where emptyStateOf would find a headline. | |
| 6 | - * | |
| 7 | - * No repository, a diff git could not read, and rows that all predate the | |
| 8 | - * session count nothing. | |
| 9 | - * | |
| 10 | - * @param outcome how the fetch ended | |
| 11 | - * @returns whether the header's session file count is above zero | |
| 12 | - */ | |
| 13 | -export function hasSessionFiles(outcome: Git.FetchOutcome): boolean { | |
| 14 | - if (outcome.kind !== 'data') { | |
| 15 | - return false | |
| 16 | - } | |
| 17 | - | |
| 18 | - const { stats, files } = outcome.data | |
| 19 | - const before = files.filter(file => file.isPreSession) | |
| 20 | - | |
| 21 | - return stats.filesCount - before.length > 0 | |
| 22 | -} |
| @@ -1,3 +1,0 @@ | ||
| 1 | -export * from './has-session-files.js' | |
| 2 | - | |
| 3 | -export * as default from '.' |
| @@ -1,0 +1,22 @@ | ||
| 1 | +import type Git from '../git' | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Whether a fetch settled with a file the header would count, so a pane | |
| 5 | + * opened on it lists something where emptyStateOf would find a headline. | |
| 6 | + * | |
| 7 | + * No repository, a diff git could not read, and rows that all predate the | |
| 8 | + * session count nothing. | |
| 9 | + * | |
| 10 | + * @param outcome how the fetch ended | |
| 11 | + * @returns whether the header's session file count is above zero | |
| 12 | + */ | |
| 13 | +export function hasSessionFiles(outcome: Git.FetchOutcome): boolean { | |
| 14 | + if (outcome.kind !== 'data') { | |
| 15 | + return false | |
| 16 | + } | |
| 17 | + | |
| 18 | + const { stats, files } = outcome.data | |
| 19 | + const before = files.filter(file => file.isPreSession) | |
| 20 | + | |
| 21 | + return stats.filesCount - before.length > 0 | |
| 22 | +} |
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | export * from './dialog-title-of.js' |
| 8 | 8 | export * from './empty-state' |
| 9 | 9 | export * from './empty-state-of.js' |
| 10 | -export * from './has-session-files' | |
| 10 | +export * from './has-session-files.js' | |
| 11 | 11 | export * from './header-totals' |
| 12 | 12 | export * from './header-totals-of.js' |
| 13 | 13 | export * from './initial-model' |
| @@ -1,21 +1,0 @@ | ||
| 1 | -import type { ToolCallInput } from 'claude-code' | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * The file an editing tool was called on, as its input names it: | |
| 5 | - * `file_path` for Edit and Write, `notebook_path` for NotebookEdit. | |
| 6 | - * | |
| 7 | - * @param e the `tool.call` event | |
| 8 | - * @returns the path as given, or null when the input names none | |
| 9 | - */ | |
| 10 | -export function editedPathOf(e: ToolCallInput): string | null { | |
| 11 | - const isFileEdit = e.tool === 'Edit' || e.tool === 'Write' | |
| 12 | - const isNotebookEdit = e.tool === 'NotebookEdit' | |
| 13 | - | |
| 14 | - const path = isFileEdit | |
| 15 | - ? e.file_path | |
| 16 | - : isNotebookEdit | |
| 17 | - ? e.notebook_path | |
| 18 | - : null | |
| 19 | - | |
| 20 | - return typeof path === 'string' && path !== '' ? path : null | |
| 21 | -} |
| @@ -1,3 +1,0 @@ | ||
| 1 | -export * from './edited-path-of.js' | |
| 2 | - | |
| 3 | -export * as default from '.' |
| @@ -1,0 +1,21 @@ | ||
| 1 | +import type { ToolCallInput } from 'claude-code' | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * The file an editing tool was called on, as its input names it: | |
| 5 | + * `file_path` for Edit and Write, `notebook_path` for NotebookEdit. | |
| 6 | + * | |
| 7 | + * @param e the `tool.call` event | |
| 8 | + * @returns the path as given, or null when the input names none | |
| 9 | + */ | |
| 10 | +export function editedPathOf(e: ToolCallInput): string | null { | |
| 11 | + const isFileEdit = e.tool === 'Edit' || e.tool === 'Write' | |
| 12 | + const isNotebookEdit = e.tool === 'NotebookEdit' | |
| 13 | + | |
| 14 | + const path = isFileEdit | |
| 15 | + ? e.file_path | |
| 16 | + : isNotebookEdit | |
| 17 | + ? e.notebook_path | |
| 18 | + : null | |
| 19 | + | |
| 20 | + return typeof path === 'string' && path !== '' ? path : null | |
| 21 | +} |
| @@ -1,4 +1,4 @@ | ||
| 1 | -export * from './edited-path-of' | |
| 1 | +export * from './edited-path-of.js' | |
| 2 | 2 | export * from './editing-tools.js' |
| 3 | 3 | export * from './shell-tools.js' |
| 4 | 4 | export * from './todo-tool.js' |