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
22 changes: 22 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Verify macOS setup

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
smoke:
runs-on: macos-15
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install test prerequisites
run: brew install mise fzf ripgrep git-delta
- name: Verify setup in a fresh home
run: ./tests/smoke.sh --with-tools
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

bwkw の Mac 用開発環境。セットアップ後は新しいターミナルで Node.js・pnpm・uv が使え、いつもの Git エイリアスや dotagents のスキルも読み込まれる。対象は Apple Silicon の Mac と zsh。

自分の環境に流用する場合は、先に Git の `user.name` と `user.email` を設定しておく。セットアップ時に未設定の項目があれば、bwkw の名前と GitHub の noreply アドレスで補う。

## 新しい Mac で始める

GitHub にアクセスできる端末で、次の1行を実行する。SSH 鍵を GitHub に登録済みなら、そのまま使える。
Expand All @@ -10,7 +12,7 @@ GitHub にアクセスできる端末で、次の1行を実行する。SSH 鍵
git clone git@github.com:bwkw/dotfiles.git "$HOME/.dotfiles" && "$HOME/.dotfiles/setup.sh"
```

Git や SSH 鍵をまだ設定していない場合は、ブラウザでこの private リポジトリにログインし、**Code → Download ZIP** を選ぶ。展開したフォルダをホームの `dotfiles` に移して、ターミナルで次を実行する。設定のリンク元になるので、そのフォルダを保管する。
Git や SSH 鍵をまだ設定していない場合は、GitHub の **Code → Download ZIP** から取得する。展開したフォルダをホームの `dotfiles` に移して、ターミナルで次を実行する。設定のリンク元になるので、そのフォルダを保管する。

```sh
/bin/bash ~/dotfiles/setup.sh
Expand All @@ -19,9 +21,9 @@ Git や SSH 鍵をまだ設定していない場合は、ブラウザでこの p
スクリプトは不足している Homebrew と mise を導入してから `mise bootstrap` を実行する。Homebrew が求める管理者パスワードや macOS の許可は画面で入力する。GitHub、AI ツール、AWS のログインは端末ごとに行う。導入後は**新しいターミナル**で確認できる。

```sh
node --version # v24.22.1
pnpm --version # 11.28.10
uv --version # uv 0.13.4
node --version
pnpm --version
uv --version
alias gs
```

Expand All @@ -41,7 +43,7 @@ alias gs
| `scripts/configure-git.sh` | Git のユーザー名・メールと差分ページャーの初期値 |
| `scripts/install-apps.sh` | VS Code、Cursor、Warp、OrbStack、DBeaver、Chrome、Raycast、ChatGPT、Claude。すでにあるアプリはそのまま使う |

Git は名前・メールの未設定項目だけを、`bwkw` と GitHub の noreply アドレスで補う。Git のグローバル ignore には Claude のローカル設定を1行追加する。SSH 鍵、ログイントークン、業務用のシェル関数やプロファイルは端末側で管理する。端末固有の mise 設定は `~/.config/mise/config.local.toml` に置ける。
Git のグローバル ignore には Claude のローカル設定を1行追加する。SSH 鍵、ログイントークン、業務用のシェル関数やプロファイルは端末側で管理する。端末固有の mise 設定は `~/.config/mise/config.local.toml` に置ける。

[dotagents](https://github.com/bwkw/dotagents) は `~/private/dotagents` に取得し、同リポジトリのインストーラでスキルと hooks を導入する。編集中の変更があるチェックアウトはスキップする。Codex の hooks は初回に `/hooks` で信頼する。

Expand All @@ -50,10 +52,13 @@ Git は名前・メールの未設定項目だけを、`bwkw` と GitHub の nor
リポジトリのディレクトリで実行する。途中で止まった場合も原因を直して同じコマンドを再実行できる。

```sh
./setup.sh --dry-run # Homebrew と mise の導入後に適用予定を表示
./setup.sh # 足りないものを導入して設定を反映
mise bootstrap status # mise が宣言として管理する項目を確認
./tests/smoke.sh # 一時ホームで設定の適用と再実行を検証
./setup.sh --dry-run # Homebrew と mise の導入後に、適用予定を確認する
./setup.sh # 足りないものを導入して設定を反映する
mise bootstrap status # mise の設定と現在の状態を照合する
```

プレビューでも、このリポジトリの設定を mise に信頼登録する。初回はまだ存在しない `10-dotfiles.toml` への警告が出ることがある。導入予定のバージョンは `config/tools.toml` から読み込まれ、各ツールの `would install` 行に表示される。

別の Mac で変更した設定を取り込む場合は、Git で取得した checkout 内で `git pull --ff-only && ./setup.sh` を実行する。ZIP から始めた場合は、更新版を同じ場所に展開して再実行する。

設定を変えたら `./tests/smoke.sh` を実行する。一時ホームで初回のプレビュー、既存設定の引き継ぎ、再実行をオフラインで確認できる。PR の macOS CI では `./tests/smoke.sh --with-tools` を使い、Node.js・pnpm・uv をダウンロードして、新しい zsh で指定版が起動するところまで確かめる。
1 change: 1 addition & 0 deletions mise/config.toml
42 changes: 39 additions & 3 deletions tests/smoke.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash
# Real mise and zsh, isolated from the user's config, tools and Homebrew.
set -euo pipefail
if [[ $# -gt 1 || ($# -eq 1 && ${1:-} != --with-tools) ]]; then
echo "Usage: $0 [--with-tools]" >&2
exit 2
fi
repo=$(cd "$(dirname "$0")/.." && pwd -P)
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
Expand All @@ -14,7 +18,8 @@ for tool in mise brew fzf rg delta; do
ln -s "$executable" "$scratch/bin/$tool"
done
env -i HOME="$scratch/home" PATH="$scratch/bin:/usr/bin:/bin:/usr/sbin:/sbin" \
TMPDIR="$scratch" TERM=xterm-256color MISE_OFFLINE=1 GIT_CONFIG_NOSYSTEM=1 /bin/bash -se -- "$scratch/checkout" <<'CHECK'
TMPDIR="$scratch" TERM=xterm-256color MISE_OFFLINE=1 GIT_CONFIG_NOSYSTEM=1 /bin/bash -se -- "$scratch/checkout" "${1:-}" <<'CHECK'
set -uo pipefail
repo=$1
cd "$HOME"
mkdir -p "$HOME/.config/mise" "$HOME/.config/git"
Expand All @@ -23,13 +28,44 @@ cp "$HOME/.config/mise/config.toml" "$HOME/before.toml"
printf '%s\n' 'alias preexisting=true' > "$HOME/.zshrc"
printf '%s\n' 'user-local-pattern' > "$HOME/.config/git/ignore"
[[ -x "$repo/setup.sh" ]] || { echo 'Missing setup.sh' >&2; exit 1; }
"$repo/setup.sh" --only dotfiles,mise-shell-activate
if ! preview=$("$repo/setup.sh" --dry-run --only dotfiles,mise-shell-activate,tools 2>&1); then
echo "$preview" >&2
exit 1
fi
for tool in node pnpm uv; do
if ! grep -Eq "$tool@[^ ]+.*would install" <<< "$preview"; then
echo "Missing $tool in first-run preview:" >&2
echo "$preview" >&2
exit 1
fi
done
test ! -e "$HOME/.config/mise/conf.d/10-dotfiles.toml"
if [[ $2 == --with-tools ]]; then
MISE_OFFLINE=0 "$repo/setup.sh" --only dotfiles,mise-shell-activate,tools
zsh -lic '
set -e
for tool in node pnpm uv; do
expected=$(mise current "$tool")
binary=$(command -v "$tool")
[[ "$binary" == "$HOME/"* ]] || { echo "Unexpected path: $binary" >&2; exit 1; }
version=$("$tool" --version)
case "$tool" in
node) version=${version#v} ;;
uv) version=${version#uv }; version=${version%% *} ;;
esac
[[ "$version" == "$expected" ]] || { echo "$tool: expected $expected, got $version" >&2; exit 1; }
echo "$tool $version"
done
'
else
"$repo/setup.sh" --only dotfiles,mise-shell-activate
fi
cmp "$HOME/.config/mise/config.toml" "$HOME/before.toml"
grep -Fxq 'alias preexisting=true' "$HOME/.zshrc"
grep -Fxq 'user-local-pattern' "$HOME/.config/git/ignore"
grep -Fq 'brew shellenv' "$HOME/.zprofile"
zsh -ic 'alias gs' | grep -F 'git status -s'
mise current | grep -E 'node[[:space:]]+24\.22\.1'
cmp "$repo/config/tools.toml" "$HOME/.config/mise/conf.d/10-dotfiles.toml"
git init -q sample
git -C sample check-ignore -q .claude/settings.local.json
cd sample
Expand Down
Loading