Skip to content

Commit 1da83f2

Browse files
authored
docs: translate all comments and docs to English (#9)
This is a public repository, so rewrite the Japanese comments and documentation added in this branch into English: the CI workflow, script/setup-ubuntu.sh, the setup.d/ubuntu/*env scripts, and AGENTS.md. No behavior changes.
1 parent 06ed228 commit 1da83f2

7 files changed

Lines changed: 99 additions & 85 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- name: Syntax check shell scripts
1414
run: |
15-
# リポジトリ内の追跡対象シェルスクリプトを網羅的に構文チェックする。
16-
# shebang を見てインタプリタを判定する:
15+
# Exhaustively syntax-check every tracked shell script in the repo.
16+
# Pick the interpreter from the shebang:
1717
# - bash shebang -> bash -n
18-
# - #!/bin/sh (= dash) -> sh -n (bash -n は dash で落ちる構文を見逃す)
19-
# - shebang なし -> bash -n (env.sh / env.d/* は bash/zsh が source
20-
# する断片で bash 構文を含むため sh -n だと誤検知)
18+
# - #!/bin/sh (= dash) -> sh -n (bash -n misses syntax that fails under dash)
19+
# - no shebang -> bash -n (env.sh / env.d/* are fragments sourced by
20+
# bash/zsh and contain bash syntax, so sh -n false-flags)
2121
st=0
2222
while IFS= read -r f; do
2323
case "$(head -n1 "$f")" in
@@ -31,7 +31,7 @@ jobs:
3131
exit $st
3232
3333
ubuntu-setup:
34-
# Codespaces / WSL Ubuntu セットアップ (apt + 並列 *env install) を実走する
34+
# Actually run the Codespaces / WSL Ubuntu setup (apt + parallel *env install)
3535
runs-on: ubuntu-latest
3636
timeout-minutes: 60
3737
env:
@@ -50,8 +50,8 @@ jobs:
5050
pyenv="$HOME/.pyenv/bin/pyenv"
5151
goenv="$HOME/.goenv/bin/goenv"
5252
53-
# ピン留めバージョンは各 setup スクリプトの VERSION= から抽出し、
54-
# ここでハードコードしないことで定義のドリフトを防ぐ。
53+
# Extract the pinned version from each setup script's VERSION= line
54+
# rather than hardcoding it here, so the check never drifts from the source.
5555
expected_version() {
5656
sed -n 's/^VERSION=\(.*\)$/\1/p' "$1" | head -n1
5757
}
@@ -72,21 +72,21 @@ jobs:
7272
python_expected="$(expected_version setup.d/ubuntu/004-pyenv.sh)"
7373
go_expected="$(expected_version setup.d/ubuntu/005-goenv.sh)"
7474
75-
# *env exec は PATH/shims に依存せず、各 *env が選択中バージョンの管理下
76-
# バイナリを直接実行する。ただし *env はカレントディレクトリ階層の
77-
# .ruby-version 等のローカル pin を global より優先する。このリポジトリ自身は
78-
# ルートに `.ruby-version = system` を持つため、setup が入れた global を検証
79-
# するには中立なディレクトリ ($HOME) で実行する必要がある。
80-
# node --version → "v24.16.0" の先頭 v を除去
75+
# `*env exec` runs each *env's selected-version binary directly, without
76+
# depending on PATH/shims ordering. However, *env honors a directory-local
77+
# pin (e.g. .ruby-version) over the global one. This repo itself has
78+
# `.ruby-version = system` at its root, so to verify the global that setup
79+
# installed we must run from a neutral directory ($HOME).
80+
# node --version → "v24.16.0": strip the leading v
8181
assert_version node "$node_expected" "$(cd "$HOME" && "$nodenv" exec node --version | sed 's/^v//')"
82-
# ruby --version → "ruby 4.0.5 (...) ..." の 2 フィールド目
82+
# ruby --version → "ruby 4.0.5 (...) ...": 2nd field
8383
assert_version ruby "$ruby_expected" "$(cd "$HOME" && "$rbenv" exec ruby --version | awk '{print $2}')"
84-
# python --version → "Python 3.14.6" の 2 フィールド目
84+
# python --version → "Python 3.14.6": 2nd field
8585
assert_version python "$python_expected" "$(cd "$HOME" && "$pyenv" exec python --version | awk '{print $2}')"
86-
# go version → "go version go1.26.4 linux/amd64"go プレフィックスを除去
86+
# go version → "go version go1.26.4 linux/amd64": strip the go prefix
8787
assert_version go "$go_expected" "$(cd "$HOME" && "$goenv" exec go version | awk '{print $3}' | sed 's/^go//')"
8888
89-
# 不一致時は原因切り分け用に各 *env の選択状況をダンプする
89+
# On mismatch, dump each *env's selection to help diagnose the cause
9090
if [ "$st" -ne 0 ]; then
9191
echo "--- diagnostics ---"
9292
"$rbenv" version || true

AGENTS.md

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,63 @@
11
# AGENTS.md
22

3-
このリポジトリで作業する AI エージェント向けのガイド。リポジトリ固有のハマりどころを集約する。
4-
5-
## シェル / 実行環境
6-
7-
- **デフォルトシェルは zsh**(エージェントの Bash ツールも zsh で動く)。スクリプト内で
8-
`status` を変数名に使わないこと — zsh では `status` は読み取り専用で `read-only variable`
9-
エラーになる。`st` などに置き換える。
10-
- `jq` のフィルタで `!=` を使うと zsh が `\!=` にエスケープしてパースエラーになる。
11-
`select(.x | . == null | not)` のように `| not` パターンで書く。
12-
13-
## シェルスクリプトの構文チェック / lint
14-
15-
- `env.sh``env.d/**/*.sh`**shebang を持たない**。シェル起動時に source される断片で、
16-
bash/zsh 構文(関数定義・`[[ ]]` 等)を含む。したがって `sh -n`(dash)では誤検知する。
17-
これらは `bash -n` で検査する。
18-
- CI(`.github/workflows/ci.yml` の lint ジョブ)は追跡対象の全 `*.sh``git ls-files`
19-
列挙し、shebang で判定する: `*bash*``bash -n``#!...sh``sh -n`**shebang なし →
20-
`bash -n`**(上記の source 断片のため)。
21-
22-
## *env(言語ランタイム)
23-
24-
- バージョンのピン留めは `setup.d/ubuntu/00X-*.sh``VERSION=` に一元化されている
25-
(nodenv=002 / rbenv=003 / pyenv=004 / goenv=005)。変更はこのファイルだけを書き換える。
26-
- CI はインストール結果がこのピン留め値と一致するかをアサートする(不一致で fail)。期待値は
27-
各 setup スクリプトの `VERSION=` から抽出するのでハードコードしない。
28-
- **バージョン検証時は shims を PATH 先頭に置くこと。** `rbenv init -` / `goenv init -`
29-
shims を PATH 先頭に入れない実装があり、ランナー同梱の system ruby/go が優先されてしまう。
30-
`export PATH="$HOME/.rbenv/shims:$HOME/.goenv/shims:...:$PATH"` のように明示する
31-
(nodenv/pyenv は `init -` だけで効く)。
32-
- リポジトリ更新は `git clone` 以外(パッケージ・手動展開・symlink)で配置された場合に備え、
33-
`[ -d ~/.Xenv/.git ]` ガードで囲み `git pull --ff-only`(意図しない merge を作らない)。
3+
Guide for AI agents working in this repository. It collects repo-specific
4+
gotchas.
5+
6+
## Shell / execution environment
7+
8+
- **The default shell is zsh** (the agent's Bash tool runs under zsh too). Do not
9+
use `status` as a variable name in scripts — in zsh `status` is read-only and
10+
assigning to it raises a `read-only variable` error. Use `st` or similar.
11+
- Using `!=` in a `jq` filter gets escaped by zsh to `\!=` and causes a parse
12+
error. Write it with the `| not` pattern, e.g. `select(.x | . == null | not)`.
13+
14+
## Shell script syntax checking / linting
15+
16+
- `env.sh` and `env.d/**/*.sh` have **no shebang**. They are fragments sourced at
17+
shell startup and contain bash/zsh syntax (function definitions, `[[ ]]`, etc.),
18+
so `sh -n` (dash) false-flags them. Check these with `bash -n`.
19+
- CI (the lint job in `.github/workflows/ci.yml`) enumerates every tracked `*.sh`
20+
via `git ls-files` and decides the interpreter from the shebang: `*bash*`
21+
`bash -n`, `#!...sh``sh -n`, **no shebang → `bash -n`** (for the sourced
22+
fragments above).
23+
24+
## *env (language runtimes)
25+
26+
- Version pins are centralized in the `VERSION=` line of each
27+
`setup.d/ubuntu/00X-*.sh` (nodenv=002 / rbenv=003 / pyenv=004 / goenv=005).
28+
Change only that file.
29+
- CI asserts that the installed result matches this pin (and fails on mismatch).
30+
The expected value is extracted from each setup script's `VERSION=` line, so do
31+
not hardcode it.
32+
- **When verifying versions, run from a neutral directory and don't rely on
33+
PATH/shims.** `rbenv init -` / `goenv init -` may not prepend shims to PATH, so
34+
the runner's system ruby/go can win. Also, *env honors a directory-local pin
35+
(e.g. `.ruby-version`) over the global one — and this repo's root has
36+
`.ruby-version = system`. CI therefore runs `*env exec` from `$HOME` to check
37+
the global version that setup installed.
38+
- For repo updates, guard with `[ -d ~/.Xenv/.git ]` and use `git pull --ff-only`
39+
so a non-git install (package / manual extraction / symlink) doesn't break and
40+
no unintended merge commit is created.
3441

3542
## GnuPG
3643

37-
- `~/.gnupg``rc.d/gnupg` への symlink。`gpg-agent.conf`**生成物で gitignore 対象**
38-
ソースは `rc.d/gnupg/gpg-agent.conf.linux` / `.darwin` で、`setup.d/dotfiles.sh`
39-
プラットフォーム別にコピー生成する。設定変更は生成物ではなく `.linux` / `.darwin` を編集する。
40-
キャッシュ TTL は 1 年(一度 unlock すれば保持)。
41-
- コミットは GPG 署名される(鍵 `036459B1`)。エージェントの非 tty シェルでは対話的 pinentry が
42-
動かずコミットがハングする。**セッション開始時に一度ユーザーが**
43-
`echo | gpg --clearsign -u 036459B1 -o /dev/null` を実行してパスフレーズを agent に
44-
キャッシュさせてから、コミット系の作業を進める。
44+
- `~/.gnupg` is a symlink to `rc.d/gnupg`. `gpg-agent.conf` is a **generated file
45+
and is gitignored**. Its sources are `rc.d/gnupg/gpg-agent.conf.linux` /
46+
`.darwin`, which `setup.d/dotfiles.sh` copies into place per platform. Edit the
47+
`.linux` / `.darwin` sources, not the generated file. The cache TTL is one year
48+
(unlock once and it stays cached).
49+
- Commits are GPG-signed (key `036459B1`). The agent's non-tty shell can't run an
50+
interactive pinentry, so a commit would hang. **At the start of a session, have
51+
the user run** `echo | gpg --clearsign -u 036459B1 -o /dev/null` **once** to
52+
cache the passphrase in the agent before doing any commit work.
4553

46-
## dotfiles symlink 規約
54+
## dotfiles symlink conventions
4755

48-
- プラットフォーム固有ファイルは `*.darwin` / `*.linux` サフィックスで管理し、
49-
`setup.d/dotfiles.sh` `resolve_os_name` が OS に応じて実体名へ解決する。
50-
- push は必ず `git push origin <current-branch>`bare push 禁止)。
56+
- Platform-specific files are managed with a `*.darwin` / `*.linux` suffix;
57+
`resolve_os_name` in `setup.d/dotfiles.sh` resolves them to the real name per OS.
58+
- Always push with `git push origin <current-branch>` (no bare push).
5159

52-
## このファイルと CLAUDE.md
60+
## This file and CLAUDE.md
5361

54-
- `CLAUDE.md` はこの `AGENTS.md` への symlink。内容は AGENTS.md 側を編集する。
62+
- `CLAUDE.md` is a symlink to this `AGENTS.md`. Edit the content on the AGENTS.md
63+
side.

script/setup-ubuntu.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/bash
22
#
3-
# setup.d/ubuntu/*.sh を実行する。001-apt.sh で依存パッケージを入れてから、
4-
# 残り (002〜 の *env 系・gcloud.sh) は互いに独立なので並列実行する。
5-
# 出力の interleave を避けるため各スクリプトのログはファイルに分離し、
6-
# 失敗時は末尾を表示する。setup.sh から呼ばれるほか、CI から単体でも実行できる。
3+
# Run setup.d/ubuntu/*.sh. First 001-apt.sh installs dependency packages, then
4+
# the rest (the 002+ *env scripts and gcloud.sh) are independent of each other
5+
# and run in parallel. To avoid interleaved output, each script's log is written
6+
# to a separate file, and its tail is shown on failure. Called from setup.sh, and
7+
# can also be run standalone from CI.
78
set -eu
89

910
DOTFILES=$(cd "$(dirname "$0")/.." && pwd)
@@ -24,7 +25,7 @@ for f in "$DOTFILES"/setup.d/ubuntu/*.sh ; do
2425
fi
2526
done
2627

27-
# どれか 1 つでも失敗したら非ゼロで exit する (全 PID を wait 済みなのでハングはしない)
28+
# Exit non-zero if any one of them failed (we wait on every PID, so no hang)
2829
status=0
2930
for job in $jobs; do
3031
pid=${job%%:*}

setup.d/ubuntu/002-nodenv.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ if [ ! -d ~/.nodenv/plugins/node-build ]; then
1212
git clone https://github.com/nodenv/node-build.git ~/.nodenv/plugins/node-build
1313
fi
1414

15-
# merge を作らないよう --ff-only で安全に更新する (git リポジトリのときだけ)
15+
# Update safely with --ff-only so no merge commit is created, and only when
16+
# it is actually a git repository.
1617
if [ -d ~/.nodenv/plugins/node-build/.git ]; then
1718
git -C ~/.nodenv/plugins/node-build pull --ff-only
1819
fi
1920

2021
eval "$(~/.nodenv/bin/nodenv init -)"
21-
# Node.js 24 = Active LTS "Krypton" (サポートは 2028-04 まで)
22+
# Node.js 24 = Active LTS "Krypton" (supported until 2028-04)
2223
VERSION=24.16.0
23-
# ソースビルドになった場合に make を並列化 (node-build は通常プリビルドバイナリを取得)
24+
# Parallelize make in case a source build happens (node-build normally fetches a prebuilt binary)
2425
export MAKE_OPTS="-j$(nproc)"
2526
nodenv install -s $VERSION
2627
nodenv global $VERSION

setup.d/ubuntu/003-rbenv.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ if [ ! -d ~/.rbenv/plugins/ruby-build ]; then
1212
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
1313
fi
1414

15-
# merge を作らないよう --ff-only で安全に更新する (git リポジトリのときだけ)
15+
# Update safely with --ff-only so no merge commit is created, and only when
16+
# it is actually a git repository.
1617
if [ -d ~/.rbenv/plugins/ruby-build/.git ]; then
1718
git -C ~/.rbenv/plugins/ruby-build pull --ff-only
1819
fi
1920

2021
eval "$(~/.rbenv/bin/rbenv init -)"
21-
# Ruby LTS はないため最新安定版を使用 (4.0 )
22+
# Ruby has no LTS, so use the latest stable release (4.0 series)
2223
VERSION=4.0.5
23-
# make を並列化し、rdoc/ri の生成をスキップしてビルドを高速化
24+
# Parallelize make and skip rdoc/ri generation to speed up the build
2425
export MAKE_OPTS="-j$(nproc)"
2526
export RUBY_CONFIGURE_OPTS="--disable-install-doc"
2627
rbenv install -s $VERSION

setup.d/ubuntu/004-pyenv.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@ if [ ! -d ~/.pyenv ]; then
77
cd ~/.pyenv && src/configure && make -C src
88
fi
99

10-
# 新しいバージョン定義を取得するため更新する。git clone 以外 (パッケージ
11-
# 管理・手動展開・シンボリックリンク等) で配置された場合に備え、git リポジトリ
12-
# のときだけ更新する。merge を作らないよう --ff-only で安全に取得する。
10+
# Update to pick up new version definitions. In case it was installed by
11+
# something other than git clone (package manager, manual extraction, symlink,
12+
# etc.), only update when it is a git repository. Use --ff-only so no merge
13+
# commit is created.
1314
if [ -d ~/.pyenv/.git ]; then
1415
git -C ~/.pyenv pull --ff-only
1516
fi
1617

17-
# pyenv init - の出力が pyenv コマンド自体を呼ぶため、先に PATH を通しておく
18+
# `pyenv init -` output invokes the pyenv command itself, so put it on PATH first
1819
export PATH="${HOME}/.pyenv/bin:$PATH"
1920
eval "$(~/.pyenv/bin/pyenv init -)"
2021

21-
# Python LTS はないため最新安定版を使用 (3.14 系、サポートは 2030-10 まで)
22+
# Python has no LTS, so use the latest stable release (3.14 series, supported until 2030-10)
2223
VERSION=3.14.6
2324

24-
# make を並列化してビルドを高速化
25+
# Parallelize make to speed up the build
2526
export MAKE_OPTS="-j$(nproc)"
2627
export PYTHON_CONFIGURE_OPTS="--enable-shared"
2728

setup.d/ubuntu/005-goenv.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ if [ ! -d ~/.goenv ]; then
77
cd ~/.goenv && src/configure && make -C src
88
fi
99

10-
# 新しいバージョン定義を取得するため更新する。git clone 以外 (パッケージ
11-
# 管理・手動展開・シンボリックリンク等) で配置された場合に備え、git リポジトリ
12-
# のときだけ更新する。merge を作らないよう --ff-only で安全に取得する。
10+
# Update to pick up new version definitions. In case it was installed by
11+
# something other than git clone (package manager, manual extraction, symlink,
12+
# etc.), only update when it is a git repository. Use --ff-only so no merge
13+
# commit is created.
1314
if [ -d ~/.goenv/.git ]; then
1415
git -C ~/.goenv pull --ff-only
1516
fi
1617

1718
export PATH="${HOME}/.goenv/bin:$PATH"
1819
eval "$(~/.goenv/bin/goenv init -)"
1920

20-
# Go LTS はなく最新 2 系列がサポート対象のため最新安定版を使用
21+
# Go has no LTS; the latest two release series are supported, so use the latest stable
2122
VERSION=1.26.4
2223

23-
# goenv install は通常バイナリ取得のためビルドは走らないが、ソースビルド時に備えて並列化
24+
# goenv install usually fetches a binary so no build runs, but parallelize in case of a source build
2425
export MAKE_OPTS="-j$(nproc)"
2526

2627
goenv install -s $VERSION

0 commit comments

Comments
 (0)