SLOPSHOPPER

file-view

Click a file path under a Read, Edit or Write row to show that file's contents in a pane beside the transcript, or let the model open one with the open_file…

panerowsguardtoasttool
★ 12v0.1.0no licenseupdated 2026-10-20ushironoko/dotfiles/claude/.claude/skills/file-view
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · file-view
│ ┃ file-view ✕ › fix the failing auth test and add an audit log call │ ┃ file-view │ ┃ Click a file path under a tool row to show ⏺ Read(src/auth.ts) │ ┃ it here. ⎿ Read 6 lines │ ⟨Claude Code's own drawing⟩ │ ⧉ /work/app/src/auth.ts │ ⏺ Bash(bun test) │ ⎿ 3 pass, 1 fail │ │ ● Done. refresh now rejects expired claims and logs an audit event. │ │ ✻ Worked for 42s · done 4:20 PM │ │ │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · file-view
file-view Click a file path under a tool row to show it here.
Tool row
⟨Claude Code's own drawing⟩ ⧉ /work/app/src/auth.ts
README

Dotfiles

ushironoko's dotfiles management system.

Setup

# Initial setup
git clone https://github.com/ushironoko/dotfiles.git
cd dotfiles
./init.sh

# After setup, the dotfiles command is available:
dotfiles install    # Install symlinks
dotfiles list       # List managed files
dotfiles restore    # Restore from backup
dotfiles doctor     # Check environment

# Future updates with ghq (after initial setup):
ghq get ushironoko/dotfiles
cd $(ghq root)/github.com/ushironoko/dotfiles

Commands

dotfiles install

Creates symbolic links from repository to system locations.

  • -d, --dryRun: Preview changes
  • -f, --force: Force overwrite
  • -s, --select: Interactive selection
  • -v, --verbose: Detailed output

dotfiles list

Shows all managed dotfiles and their status.

  • -v, --verbose: Detailed information

dotfiles restore

Restores files from backup.

  • -b, --backup <timestamp>: Specific backup
  • -l, --list: List available backups
  • -v, --verbose: Detailed output

dotfiles doctor

Diagnoses environment issues.

  • -c, --check <categories>: Check specific areas (environment,conflicts,ghq,config,mcp)
  • -v, --verbose: Detailed diagnostics

Troubleshooting

Quick Diagnostics

If you're having issues with the initial setup, run the diagnostic tool:

./init.sh --check

This will show:

  • Binary locations (mise, bun, node)
  • Command availability in PATH
  • mise installation status
  • Installed tools
  • Recommendations for fixing issues

Common Issues

Run dotfiles doctor to diagnose issues. Common fixes:

# If mise commands are not found after installation
# Make sure ~/.local/bin is in your PATH and restart shell
export PATH="$HOME/.local/bin:$PATH"
exec $SHELL

# Remove conflicting Bun installation
rm -rf ~/.bun

# Fix PATH permanently
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(mise activate bash)"' >> ~/.bashrc
exec $SHELL

# Migrate old repos to ghq
./scripts/migrate-to-ghq.sh --dry-run
./scripts/migrate-to-ghq.sh --symlink

Configuration

Edit dotfiles.config.ts to manage your files:

  • file: Single file symlink
  • directory: Entire directory symlink
  • selective: Specific files with permissions

Codex harness

The versioned Codex harness installs global instructions, native custom agents, lifecycle hooks, command restrictions, and the shared Claude skills alongside ~/.codex/config.toml. Each component is linked selectively so Codex runtime state and bundled skills remain intact. After hook changes, review and trust them with /hooks in Codex.

Live config (~/.codex/config.toml)

~/.codex/config.toml is symlinked to codex/config.toml, but codex rewrites that file at runtime, filling it with machine-local state — [projects."<path>"] trust levels (absolute paths, including private/client repo names), [mcp_servers.*] tables wired to Codex.app paths, [marketplaces.*] sources, the notify helper path, per-repo [desktop...perPath] prefs, and [hooks.state] approval hashes. A git clean filter (codex-scrub, codex/scrub-config.awk) drops anything carrying a quoted absolute path, every [projects.*]/[mcp_servers.*] table, and the complete [hooks.state] tree at git add time. The path rule remains content-based so unknown machine state is scrubbed by default; URLs and relative paths are kept. The working tree keeps the live file untouched, so codex keeps functioning.

The filter driver lives in .git/config (never committed), so it must be registered once per clone:

bun run setup:git-filters   # also run automatically by init.sh and run-all

init.sh runs it on initial setup and bun run run-all runs it before every pre-commit check, so under normal use no manual step is needed. If you commit codex/config.toml on a fresh clone without it, trust state would leak — the filter is set to required = true to fail loudly if the scrubber ever errors.

Source 1 files
hooks/register.tsx 323 lines
1import type { ElementTable, On, RenderSurface } from "claude-code";
2
3const PANE_ID = "file-view";
4const TOOL_NAME = "open_file";
5const TOOL_ID = "mcp__file-view__open_file";
6const PAGE_CHARS = 90000;
7const MARKDOWN_PATH = /\.(md|markdown)$/i;
8const FILE_TOOLS: ReadonlySet<string> = new Set([
9  "Read",
10  "Edit",
11  "Write",
12  "MultiEdit",
13  "NotebookEdit",
14]);
15
16interface Page {
17  source: string;
18  startLine: number;
19}
20
21type Viewed =
22  | { kind: "loading"; path: string }
23  | {
24      kind: "text";
25      path: string;
26      pages: readonly Page[];
27      page: number;
28      isMarkdown: boolean;
29      full: string;
30    }
31  | { kind: "error"; path: string; message: string };
32
33interface Engine {
34  read: (path: string) => Promise<string>;
35  open: (title: string) => Promise<unknown>;
36  redraw: () => void;
37}
38
39type BodyKit = Pick<ElementTable<"terminal">, "Text" | "Code" | "Markdown">;
40
41const filePathOf = (input: unknown): string | null => {
42  if (typeof input !== "object" || input === null) {
43    return null;
44  }
45
46  const record = input as Record<string, unknown>;
47  const path = record.file_path ?? record.notebook_path;
48
49  return typeof path === "string" && path !== "" ? path : null;
50};
51
52const absoluteOf = (path: string, root: string): string =>
53  path.startsWith("/") ? path : `${root.replace(/\/+$/, "")}/${path}`;
54
55const basenameOf = (path: string): string => {
56  const trimmed = path.endsWith("/") ? path.slice(0, -1) : path;
57
58  return trimmed.slice(trimmed.lastIndexOf("/") + 1) || path;
59};
60
61const isDrawable = (char: string): boolean => {
62  const code = char.codePointAt(0) ?? 0;
63
64  return code === 9 || code === 10 || (code >= 32 && code !== 127);
65};
66
67const drawableOf = (text: string): string =>
68  [...text.replaceAll("\r\n", "\n")].filter(isDrawable).join("");
69
70const linesIn = (text: string): number => text.split("\n").length - 1;
71
72const pagesOf = (text: string, startLine = 1): Page[] => {
73  if (text.length <= PAGE_CHARS) {
74    return [{ source: text, startLine }];
75  }
76
77  const cut = text.lastIndexOf("\n", PAGE_CHARS);
78  const end = cut > 0 ? cut : PAGE_CHARS;
79  const source = text.slice(0, end);
80  const rest = text.slice(cut > 0 ? end + 1 : end);
81  const nextLine = startLine + linesIn(source) + (cut > 0 ? 1 : 0);
82
83  return [{ source, startLine }, ...pagesOf(rest, nextLine)];
84};
85
86const messageOf = (error: unknown): string =>
87  error instanceof Error ? error.message : String(error);
88
89const loadedOf = async (engine: Engine, path: string): Promise<Viewed> => {
90  try {
91    const raw = await engine.read(path);
92
93    if (raw.includes("\u0000")) {
94      return { kind: "error", path, message: "Binary file" };
95    }
96
97    return {
98      kind: "text",
99      path,
100      pages: pagesOf(drawableOf(raw)),
101      page: 0,
102      isMarkdown: MARKDOWN_PATH.test(path),
103      full: raw,
104    };
105  } catch (error) {
106    return { kind: "error", path, message: messageOf(error) };
107  }
108};
109
110const bodyOf = ({ Text, Code, Markdown }: BodyKit, shown: Viewed | null) => {
111  if (shown === null) {
112    return (
113      <Text dimColor>Click a file path under a tool row to show it here.</Text>
114    );
115  }
116
117  switch (shown.kind) {
118    case "loading": {
119      return <Text dimColor>Loading…</Text>;
120    }
121    case "error": {
122      return <Text color="red">{shown.message}</Text>;
123    }
124    case "text": {
125      const page = shown.pages[shown.page] ?? { source: "", startLine: 1 };
126
127      return shown.isMarkdown ? (
128        <Markdown key={`md:${shown.page}`} text={page.source} />
129      ) : (
130        <Code
131          source={page.source}
132          path={shown.path}
133          startLine={page.startLine}
134        />
135      );
136    }
137  }
138};
139
140export const register = (on: On) => {
141  let viewed: Viewed | null = null;
142  let generation = 0;
143
144  const show = async (engine: Engine, path: string) => {
145    generation += 1;
146    const current = generation;
147
148    viewed = { kind: "loading", path };
149    await engine.open(basenameOf(path));
150    engine.redraw();
151
152    const loaded = await loadedOf(engine, path);
153
154    if (current === generation) {
155      viewed = loaded;
156      engine.redraw();
157    }
158  };
159
160  on("session.start", async ($, e, next) => {
161    await $.tool.register({
162      name: TOOL_NAME,
163      description:
164        "Show a file's contents with syntax highlighting in the file-view pane beside the transcript. Use when the user asks to open, show or display a file in the pane.",
165      inputSchema: {
166        type: "object",
167        properties: {
168          path: {
169            type: "string",
170            description:
171              "Absolute path, or a path relative to the project root",
172          },
173        },
174        required: ["path"],
175      },
176      isDeferred: false,
177    });
178
179    return next(e);
180  });
181
182  on("tool.call", { tool: TOOL_ID }, async ($, e) => {
183    const raw = (e as Record<string, unknown>).path;
184
185    if (typeof raw !== "string" || raw.trim() === "") {
186      return { deny: "path must be a non-empty string." };
187    }
188
189    const path = absoluteOf(raw.trim(), await $.session.root());
190    const engine: Engine = {
191      read: (file) => $.fs.read(file),
192      open: (title) => $.ui.open({ id: PANE_ID, title }),
193      redraw: () => $.ui.invalidate("ui.render"),
194    };
195
196    await show(engine, path);
197
198    return viewed?.kind === "error"
199      ? { deny: `${path}: ${viewed.message}` }
200      : { result: `Opened ${path} in the file-view pane.` };
201  }).catch((_, e) => ({
202    deny: `file-view could not open ${String((e as Record<string, unknown>).path)}.`,
203  }));
204
205  on("ui.render", { component: "ToolUse" }, async ($, e, next) => {
206    const drawn = await next(e);
207    const path = FILE_TOOLS.has(e.props.tool)
208      ? filePathOf(e.props.input)
209      : null;
210
211    if (path === null || e.surface !== "terminal") {
212      return drawn;
213    }
214
215    const { Box, Button } = $.ui.resolve(e);
216
217    const engine: Engine = {
218      read: (file) => $.fs.read(file),
219      open: (title) => $.ui.open({ id: PANE_ID, title }),
220      redraw: () => $.ui.invalidate("ui.render"),
221    };
222
223    return (
224      <Box flexDirection="column">
225        {drawn}
226        <Box paddingLeft={2}>
227          <Button
228            key={`open:${e.requestId}`}
229            plain
230            dimColor
231            label={`⧉ ${path}`}
232            onPress={() => void show(engine, path).catch(() => undefined)}
233          />
234        </Box>
235      </Box>
236    );
237  });
238
239  on("ui.render", { component: "Pane" }, async ($, e, next) => {
240    if (e.requestId !== PANE_ID || e.surface !== "terminal") {
241      return next(e);
242    }
243
244    const { Box, Text, Code, Markdown, Button } = $.ui.resolve(e);
245    const shown = viewed;
246
247    const copy = async (text: string, surface: RenderSurface) => {
248      const copied = await $.ui.copy({ text, surface });
249
250      $.ui.toast(
251        copied.isCopied
252          ? `Copied ${text.length.toLocaleString()} characters`
253          : `Copy failed: ${copied.reason}`,
254      );
255    };
256
257    const turn = async (page: number) => {
258      if (viewed?.kind !== "text" || viewed.pages[page] === undefined) {
259        return;
260      }
261
262      viewed = { ...viewed, page };
263      $.ui.invalidate("ui.render");
264      await $.ui.scroll({ in: PANE_ID, to: "start", block: "start" });
265    };
266
267    const pager =
268      shown?.kind === "text" && shown.pages.length > 1 ? (
269        <Box flexDirection="row" gap={1}>
270          <Button
271            key="prev"
272            plain
273            dimColor={shown.page === 0}
274            label="◀"
275            onPress={() => void turn(shown.page - 1).catch(() => undefined)}
276          />
277          <Text dimColor>
278            {shown.page + 1}/{shown.pages.length}
279          </Text>
280          <Button
281            key="next"
282            plain
283            dimColor={shown.page === shown.pages.length - 1}
284            label="▶"
285            onPress={() => void turn(shown.page + 1).catch(() => undefined)}
286          />
287        </Box>
288      ) : null;
289
290    return (
291      <Box flexDirection="column" paddingRight={1}>
292        <Box flexDirection="row" justifyContent="space-between" gap={1}>
293          <Text bold wrap="truncate-start">
294            {shown?.path ?? "file-view"}
295          </Text>
296          {shown?.kind === "text" ? (
297            <Box flexDirection="row" gap={2}>
298              {pager}
299              <Button
300                key="copy"
301                plain
302                dimColor
303                label="⎘ copy"
304                onPress={(press) =>
305                  void copy(shown.full, press.surface).catch(() => undefined)
306                }
307              />
308            </Box>
309          ) : null}
310        </Box>
311        {bodyOf({ Text, Code, Markdown }, shown)}
312      </Box>
313    );
314  });
315
316  on("ui.close", { id: PANE_ID }, (_, e, next) => {
317    viewed = null;
318    generation += 1;
319
320    return next(e);
321  });
322};
323