spacehub

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

diff: three helpers sit beside their barrels, so the module links under the engine's 512 filesBrowse files
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.
Claude authored on Sep 18, 2026 parent a2468f8 · commit 3dbda69aaff3
13 changed files+72 -81compared with a2468f8
Mmods/diff/hooks/is-outside-working-tree/index.ts
Mmods/diff/hooks/is-outside-working-tree/is-outside-working-tree.ts
Dmods/diff/hooks/is-outside-working-tree/normal-path-of/index.ts
Dmods/diff/hooks/is-outside-working-tree/normal-path-of/normal-path-of.ts
Amods/diff/hooks/is-outside-working-tree/normal-path-of.ts
Dmods/diff/hooks/pane-state/has-session-files/has-session-files.ts
Dmods/diff/hooks/pane-state/has-session-files/index.ts
Amods/diff/hooks/pane-state/has-session-files.ts
Mmods/diff/hooks/pane-state/index.ts
Dmods/diff/hooks/tools/edited-path-of/edited-path-of.ts
Dmods/diff/hooks/tools/edited-path-of/index.ts
Amods/diff/hooks/tools/edited-path-of.ts
Mmods/diff/hooks/tools/index.ts
@@ -1,4 +1,4 @@
11 export * from './is-outside-working-tree.js'
2-export * from './normal-path-of'
2+export * from './normal-path-of.js'
33
44 export * as default from '.'
@@ -1,5 +1,5 @@
11 import Git from '../git'
2-import { normalPathOf } from './normal-path-of'
2+import { normalPathOf } from './normal-path-of.js'
33
44 /**
55 * Whether a file a tool edited lies outside the pinned working tree, by
Dmods/diff/hooks/is-outside-working-tree/normal-path-of/index.ts+0 -3
@@ -1,3 +1,0 @@
1-export * from './normal-path-of.js'
2-
3-export * as default from '.'
Dmods/diff/hooks/is-outside-working-tree/normal-path-of/normal-path-of.ts+0 -25
@@ -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+}
Dmods/diff/hooks/pane-state/has-session-files/has-session-files.ts+0 -22
@@ -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-}
Dmods/diff/hooks/pane-state/has-session-files/index.ts+0 -3
@@ -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 @@
77 export * from './dialog-title-of.js'
88 export * from './empty-state'
99 export * from './empty-state-of.js'
10-export * from './has-session-files'
10+export * from './has-session-files.js'
1111 export * from './header-totals'
1212 export * from './header-totals-of.js'
1313 export * from './initial-model'
Dmods/diff/hooks/tools/edited-path-of/edited-path-of.ts+0 -21
@@ -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-}
Dmods/diff/hooks/tools/edited-path-of/index.ts+0 -3
@@ -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'
22 export * from './editing-tools.js'
33 export * from './shell-tools.js'
44 export * from './todo-tool.js'