SLOPSHOPPER

git-context

会話の最初のメッセージに現在ブランチ・git status・main からの差分コミットを注入する

newpromptprocess
★ 1v0.1.0no licenseupdated 2026-09-21void2610/dotfiles/.claude/mods/git-context
A shopper browsing a rack in a slop shop
README

dotfiles

個人用のdotfiles設定リポジトリです。 パッケージ管理と Homebrew 管理は別の nix-config リポジトリで行い、このリポジトリは主にシェルやアプリ設定を管理します。

セットアップ手順

1. リポジトリのクローン

git clone https://github.com/yourusername/dotfiles.git ~/dotfiles
cd ~/dotfiles

2. Nix / nix-darwin 設定の適用

cd ~/nix-config
darwin-rebuild switch --flake .#<nix-configで定義したホスト名>

3. dotfilesのシンボリックリンク作成

./install.sh

既存の設定ファイルは~/backupディレクトリにバックアップされます。

ファイル構成

  • install.sh: dotfilesのシンボリックリンク作成スクリプト
  • MANUAL_APPS.md: 手動インストールが必要なアプリケーション一覧
  • .config/: 各種アプリケーションの設定ファイル
  • .zshrc: Zshシェルの設定
  • .gitconfig: Git設定
  • .tmux.conf: tmux設定
  • .claude/: Claude Code の設定
  • .codex/: Codex の設定
Source 1 files
hooks/index.ts 25 lines
1import type { Register } from "claude-code";
2
3export const register: Register = (on) => {
4  on("prompt.context", async ($, e, next) => {
5    const run = async (argv: readonly string[]) => {
6      const r = await $.process.run(argv);
7      return r.exitCode === 0 ? r.stdout.replace(/\n$/, "") : undefined;
8    };
9
10    const inRepo = await run(["git", "rev-parse", "--is-inside-work-tree"]);
11    if (inRepo === undefined) return next(e);
12
13    const branch =
14      (await run(["git", "rev-parse", "--abbrev-ref", "HEAD"])) ?? "?";
15    const status = (await run(["git", "status", "--short"])) || "(クリーン)";
16    let text = `現在のブランチ: ${branch}\n\n## git status --short\n${status}`;
17    if (branch !== "main") {
18      const log = await run(["git", "log", "--oneline", "main..HEAD"]);
19      text += `\n\n## main からの差分コミット\n${log || "(なし)"}`;
20    }
21
22    return next({ ...e, blocks: [...e.blocks, { name: "gitStatus", text }] });
23  });
24};
25