Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .claude/skills/pkg-add/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ allowed-tools: Bash(brew *) Bash(npm *) Bash(fisher *) Bash(fish *) Bash(bash *)
| Homebrew cask (フォント) | `Brewfile` | `cask 'font-<name>'` | `install.sh` → `brew bundle` |
| Homebrew 非公式 cask (個人 tap) | `projects/homebrew-tap/Casks/<name>.rb` + `Brewfile` | Cask Ruby DSL + `cask 'u-ichi/tap/<name>'` | tap に push → `install.sh` → `brew bundle` |
| npm グローバル | `Npmfile` | 1行1パッケージ名 | `install.sh` → `npm install -g` |
| Node.js の版 (プロジェクトの `.node-version` 用) | `Nodefile` | 1行1版 (例: `24.19.0`) | `install.sh node` → `nodenv install --skip-existing` |
| Node.js の版 (プロジェクトの `.node-version` / `.nvmrc` 用) | `Nodefile` | 1行1版 (例: `24.19.0`、系列指定 `22`) | `install.sh node` → `mise install node@<版>` |
| git ソースビルド (Backlog.md 専用) | `lib/backlog.sh` | `ensure_backlog_head` 関数 | `install.sh backlog` で適用 |
| Fisher プラグイン | `.config/fish/fish_plugins` | 1行1リポジトリパス | `fisher install` 後に自動更新 |

Expand Down Expand Up @@ -98,9 +98,9 @@ npm info <package-name> --json 2>/dev/null | head -20

#### Nodefile

- 1行1版 (`nodenv install --list` に出る完全な版番号)、用途をコメントで添える
- 1行1版 (`mise ls-remote node` に出る版番号、または `22` のような系列指定)、用途をコメントで添える
- `#` で始まる行はコメント
- `nodenv global` は変えない。版を使うプロジェクト側の `.node-version` と一致させる
- mise の global tool には登録しない。版を使うプロジェクト側の `.node-version` / `.nvmrc` が解決できる版を書く

#### fish_plugins

Expand Down
4 changes: 2 additions & 2 deletions .config/bash/bash_profile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# bash login shell でも Homebrew の CLI を優先する。
# Herdr の vendored libghostty-vt 用 Zig 0.15.2 は keg-only のため先頭へ追加する。
# nodenv の shims は .node-version を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
PATH="$HOME/.nodenv/shims:/opt/homebrew/opt/zig@0.15/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
# mise の shims は .node-version / .nvmrc を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
PATH="$HOME/.local/share/mise/shims:/opt/homebrew/opt/zig@0.15/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export PATH
6 changes: 3 additions & 3 deletions .config/fish/config.fish
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Herdr の vendored libghostty-vt は Zig 0.15.2 固定。versioned formula は keg-only のため明示する。
# nodenv の shims は .node-version を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
# .node-version の無い場所では nodenv が system (次に見つかる /opt/homebrew/bin/node) へ解決する。
fish_add_path ~/.nodenv/shims /opt/homebrew/opt/zig@0.15/bin /opt/homebrew/bin ~/.local/bin
# mise の shims は .node-version / .nvmrc を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
# 版指定の無い場所では shims が PATH 上の次の node (/opt/homebrew/bin/node) へ fallback する。
fish_add_path ~/.local/share/mise/shims /opt/homebrew/opt/zig@0.15/bin /opt/homebrew/bin ~/.local/bin

# SSH 経由では接続元の Ghostty TERM が渡るが、接続先に terminfo が無い場合がある。
# tmux は起動前の TERM を参照するため、未知なら広く入っている xterm-256color に落とす。
Expand Down
9 changes: 9 additions & 0 deletions .config/mise/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# mise のグローバル設定 (コピー先: ~/.config/mise/config.toml)
# Node.js の版は Nodefile で導入し、プロジェクトの .node-version / .nvmrc で切り替える。
# [tools] は置かない。版指定の無い場所では shims が PATH 上の次の node (Homebrew) へ fallback する。

[settings]
# mise は .node-version / .nvmrc などの言語固有の版ファイルを既定では読まないため、node だけ有効にする。
idiomatic_version_file_enable_tools = ["node"]
# 未導入の版を要求された時に自動ダウンロードしない。導入は Nodefile と ./install.sh node に限定する。
not_found_auto_install = false
4 changes: 2 additions & 2 deletions .config/zsh/zprofile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# macOS の /etc/zprofile は path_helper で PATH を組み直す。
# login zsh では .zshenv の後に読まれるため、ここでも Homebrew の CLI を優先し直す。
# Herdr の vendored libghostty-vt 用 Zig 0.15.2 は keg-only のため先頭へ追加する。
# nodenv の shims は .node-version を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
PATH="$HOME/.nodenv/shims:/opt/homebrew/opt/zig@0.15/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
# mise の shims は .node-version / .nvmrc を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
PATH="$HOME/.local/share/mise/shims:/opt/homebrew/opt/zig@0.15/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export PATH
4 changes: 2 additions & 2 deletions .config/zsh/zshenv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zsh 経由で起動する非対話 shell でも Homebrew の CLI を優先する。
# `#!/usr/bin/env bash` はこの PATH を使うため、brew bash が /bin/bash より先に解決される。
# Herdr の vendored libghostty-vt 用 Zig 0.15.2 は keg-only のため先頭へ追加する。
# nodenv の shims は .node-version を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
PATH="$HOME/.nodenv/shims:/opt/homebrew/opt/zig@0.15/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
# mise の shims は .node-version / .nvmrc を置くプロジェクトで Nodefile の版へ切り替えるため最前列に置く。
PATH="$HOME/.local/share/mise/shims:/opt/homebrew/opt/zig@0.15/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export PATH
2 changes: 1 addition & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ brew 'googleworkspace-cli'
brew 'gradle'
brew 'just'
brew 'kotlin'
brew 'mise'
brew 'mkcert'
brew 'neovim'
# Playwright の import 可能な Node.js package は Npmfile で管理する。
# Homebrew 側は実行基盤の node を管理する(`playwright` formula は存在しない)。
brew 'node'
brew 'nodenv'
brew 'pnpm'
brew 'poppler'
brew 'ripgrep'
Expand Down
7 changes: 5 additions & 2 deletions Nodefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# nodenv で導入する Node.js の版 (1行1版、# 行はコメント)
# 既定の版 (nodenv global) は変えず、.node-version を置くプロジェクトでだけ使われる。
# mise で導入する Node.js の版 (1行1版、# 行はコメント)
# 各行を `mise install node@<版>` に渡す。`22` のような系列指定はその系列の最新版を導入する。
# 既定の node (Homebrew) は変えず、.node-version / .nvmrc を置くプロジェクトでだけ使われる。

# dot-request-dashboard 用 (.node-version = 24.19.0)
24.19.0
# clinial-co-jp (.node-version = 22)、cohort-explorer (.nvmrc = 22) 用
22
3 changes: 2 additions & 1 deletion copy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
# Git
.config/git/config : $HOME/.gitconfig

# Node.js package managers
# Node.js の版管理 (mise) と package managers
.config/mise/config.toml : $HOME/.config/mise/config.toml
.config/npm/npmrc : $HOME/.npmrc
.config/pnpm/rc : $HOME/Library/Preferences/pnpm/rc

Expand Down
33 changes: 20 additions & 13 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
│ ├── aws.sh # AWS config を config.d パターンで組み立て
│ ├── herdr.sh # Herdr 本体確認と plugin 同期
│ ├── gws.sh # Google Workspace CLI (gws) の明示導入・更新補助
│ ├── node.sh # Nodefile の Node.js 版を nodenv で導入 (global は変えない)
│ ├── node.sh # Nodefile の Node.js 版を mise で導入 (global tool には登録しない)
│ ├── orca.sh # HW フォント導入と Orca のフォント設定適用
│ ├── python.sh # Pythonfile を素の python3 から import できる形で同期
│ └── maintenance.sh # 日次メンテナンス LaunchAgent の同期
├── Brewfile # Homebrew パッケージ・cask 定義
├── Nodefile # nodenv で導入する Node.js の版 (プロジェクトの .node-version 用)
├── Nodefile # mise で導入する Node.js の版 (プロジェクトの .node-version / .nvmrc 用)
├── Npmfile # npm グローバルパッケージ定義
├── Pythonfile # uv 経由で導入する Python パッケージ定義 (python-pptx 等)
├── Vscodefile # Visual Studio Code 拡張一覧
Expand All @@ -41,6 +41,7 @@
│ │ ├── fish_plugins # Fisher プラグイン一覧
│ │ ├── completions/ # 補完定義 (gcloud, gsutil)
│ │ └── functions/ # カスタム関数 (claude/codex/ai-panes/sidebar 等、テーマ系は .gitignore)
│ ├── mise/config.toml # mise のグローバル設定 (.node-version / .nvmrc の読み取り、自動導入の無効化)
│ ├── zsh/{zshenv,zprofile} # zsh 起動時の Homebrew PATH 優先設定
│ ├── bash/bash_profile # bash login shell の Homebrew PATH 優先設定
│ ├── git/config # Git 設定 (共通、個人情報は config.local に分離)
Expand Down Expand Up @@ -88,7 +89,7 @@ dotfiles 側では扱わない。詳細は claude.codex の `install.sh` と `do

| スクリプト | 役割 |
|-----------|------|
| `install.sh` | 初回セットアップと日常更新の単一エントリポイント。Brewfile 適用 / 更新、設定ファイルコピー、Git ローカル設定の対話的入力、AWS 設定の再展開、Claude Code / Herdr / Herdr plugin / mkcert / Fisher / Terraform / Node.js 版 (nodenv) / npm / Backlog.md / Playwright browser binary / Python tools の同期、macOS defaults と Spotlight 除外の適用、日次メンテナンス LaunchAgent 登録を行う。第 1 引数で MODE (`brew` / `antigravity` / `orca` / `herdr` / `gws` / `python` / `node` / `npm` / `backlog` / `playwright` / `vscode` / `fish` / `docker` / `maintenance` / `spotlight`) を指定するとそのモジュールだけ再実行する |
| `install.sh` | 初回セットアップと日常更新の単一エントリポイント。Brewfile 適用 / 更新、設定ファイルコピー、Git ローカル設定の対話的入力、AWS 設定の再展開、Claude Code / Herdr / Herdr plugin / mkcert / Fisher / Terraform / Node.js 版 (mise) / npm / Backlog.md / Playwright browser binary / Python tools の同期、macOS defaults と Spotlight 除外の適用、日次メンテナンス LaunchAgent 登録を行う。第 1 引数で MODE (`brew` / `antigravity` / `orca` / `herdr` / `gws` / `python` / `node` / `npm` / `backlog` / `playwright` / `vscode` / `fish` / `docker` / `maintenance` / `spotlight`) を指定するとそのモジュールだけ再実行する |
| `lib/backlog.sh` | Backlog.md の公式 `origin` を確認し、通常は `origin/main` を取得してビルドする。managed manifest がある場合は指定した base commit を一時展開し、管理済み patch を順番に適用してビルドする |
| `lib/antigravity.sh` | Brewfile から Antigravity CLI だけを導入し、管理する設定項目を利用者の設定へ反映する |
| `lib/herdr.sh` | Herdr 本体の存在確認、Herdrfile の plugin 同期、Herdr 専用 mode の設定コピーを行う。版不一致は非破壊の警告として扱い、`all` では後続の dotfiles 同期を継続する |
Expand Down Expand Up @@ -137,8 +138,8 @@ macOS では標準の `/bin/bash` が古い Bash 3.2 のため、`#!/usr/bin/env
Bash 4 以降の構文に依存していると失敗する。dotfiles では `brew 'bash'` を管理対象にし、
Fish は `.config/fish/config.fish`、zsh は `.config/zsh/zshenv` と `.config/zsh/zprofile`、bash login shell は
`.config/bash/bash_profile` で `/opt/homebrew/bin` と `/opt/homebrew/sbin` を PATH の先頭へ寄せる。
同じ箇所で `~/.nodenv/shims` をさらに前へ置き、`.node-version` による Node.js の版切り替え
(「補助モジュールと MODE 引数」の `Nodefile`) を全 shell で有効にする。
同じ箇所で `~/.local/share/mise/shims` をさらに前へ置き、`.node-version` / `.nvmrc` による
Node.js の版切り替え (「補助モジュールと MODE 引数」の `Nodefile`) を全 shell で有効にする。

`.zshenv` は非対話 zsh でも読まれるため、出力や重い処理は置かず PATH 整備だけに限定する。
login zsh では macOS の `/etc/zprofile` が `.zshenv` の後に PATH を組み直すため、`.zprofile` でも
Expand All @@ -161,7 +162,7 @@ MODE を追加・変更する場合、認証情報や手動ログインなど re
| `herdr` | Herdr 本体確認、Herdr 設定ファイルコピー、`Herdrfile` の plugin 同期。同期失敗は専用 mode の終了codeへ反映 |
| `gws` | `update_gws` (未導入なら install、導入済みなら brew outdated 判定) |
| `python` | `ensure_python_tools` (`Pythonfile` を `~/.local/share/dotfiles/python-site/<X.Y>` へ `uv pip install --target` し、user site の `.pth` で素の python3 に載せる。python の minor 更新は state 比較で検出して入れ直す) |
| `node` | `ensure_node_versions` (`Nodefile` の各版を `nodenv install --skip-existing` で導入。`nodenv global` は変えず、`.node-version` を置くプロジェクトでだけ切り替わる) |
| `node` | `ensure_node_versions` (`Nodefile` の各版を `mise install node@<版>` で導入。mise の global tool には登録せず、`.node-version` / `.nvmrc` を置くプロジェクトでだけ切り替わる) |
| `npm` | `update_npm_globals` (Npmfile) |
| `orca` | Brewfile の `font-moralerspace-hw` だけを導入し、`.config/orca/settings.json` を終了中のローカル Orca に適用 |
| `backlog` | `ensure_backlog_head` (Backlog.md の main HEAD を Bun でビルドし、`~/.local/bin/backlog` へ配置) |
Expand Down Expand Up @@ -193,13 +194,19 @@ managed patch を使用している間は manifest の `base_commit` に対応
(`command -v`) を先頭で確認する。`Brewfile` には依存ツール (uv / googleworkspace-cli /
ffmpeg / bun) を明示し、`Nodefile` / `Npmfile` / `Pythonfile` は各 lib/ が読む形式で行単位に列挙する。

`Nodefile` は `nodenv` (Brewfile で管理) に導入する Node.js の版を 1 行 1 版で列挙する。
プロジェクトの `.node-version` が要求する版を揃えるためのもので、`nodenv global` は設定しない。
`nodenv` の shims を PATH の先頭に置くことで、`.node-version` のあるディレクトリではその版、
ない場所では `system` (PATH 上の次の `node`、つまり Homebrew の `node`) に解決される。
`.node-version` に書かれた版が `Nodefile` にない (= 未導入) と、そのディレクトリでは
`node` が "version is not installed" で失敗するので、必要な版を `Nodefile` へ足して
`./install.sh node` を実行する。
`Nodefile` は `mise` (Brewfile で管理) に導入する Node.js の版を 1 行 1 版で列挙する。
`22` のような系列指定も書け、その系列の最新版が入る。プロジェクトの `.node-version` /
`.nvmrc` が要求する版を揃えるためのもので、mise の global tool (`[tools]`) には登録しない。
`mise` の shims を PATH の先頭に置くことで、版ファイルのあるディレクトリではその版
(`22` は導入済みの 22.x) に解決され、版ファイルのない場所では shims が PATH 上の次の
`node` (Homebrew の `node`) へ fallback する。

mise の設定は `.config/mise/config.toml` (コピー先 `~/.config/mise/config.toml`) に置く。
mise は `.node-version` 等の言語固有の版ファイルを既定では読まないため
`idiomatic_version_file_enable_tools = ["node"]` で node だけ有効にし、
`not_found_auto_install = false` で未導入の版の自動ダウンロードを止める。
版ファイルの版が `Nodefile` にない (= 未導入) 場合も shims は Homebrew の `node` へ fallback
するので、要求どおりの版を使うには `Nodefile` へ足して `./install.sh node` を実行する。

`Pythonfile` の導入先は専用 venv ではなく、`~/.local/share/dotfiles/python-site/<X.Y>`
(dotfiles 専用 dir) で、これを `command -v python3` が指す python の user site へ置く
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ echo "--- Terraform ---"
ensure_terraform_latest
echo ""

# === Node.js の版 (nodenv) ===
# === Node.js の版 (mise) ===
ensure_node_versions

# === npm グローバルパッケージ ===
Expand Down
19 changes: 10 additions & 9 deletions lib/node.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# nodenv 経由で Nodefile に列挙した Node.js の版を導入する
# mise 経由で Nodefile に列挙した Node.js の版を導入する
#
# プロジェクトの .node-version が要求する版を揃えるためのもので、既定の版 (nodenv global)
# は変えない。.node-version の無い場所では nodenv の system 解決で従来の node が使われる。
# プロジェクトの .node-version / .nvmrc が要求する版を揃えるためのもので、mise の global tool
# には登録しない。版指定の無い場所では mise の shims が PATH 上の次の node (Homebrew) へ fallback する。

ensure_node_versions() {
local nodefile="$SCRIPT_DIR/Nodefile"
Expand All @@ -11,17 +11,18 @@ ensure_node_versions() {
return 0
fi

if ! command -v nodenv &>/dev/null; then
echo "スキップ: nodenv がインストールされていません"
if ! command -v mise &>/dev/null; then
echo "スキップ: mise がインストールされていません"
return 0
fi

echo "--- Node.js (nodenv) ---"
echo "--- Node.js (mise) ---"
while IFS= read -r version || [ -n "$version" ]; do
[[ -z "$version" || "$version" =~ ^# ]] && continue
echo "導入: node $version"
nodenv install --skip-existing "$version"
echo "導入: node@$version"
mise install "node@$version"
done < "$nodefile"
echo "導入済み: $(nodenv versions --bare | tr '\n' ' ')"
echo "導入済み:"
mise ls --installed node
echo ""
}
Loading