feat(cli): devbase shell-rc サブコマンドを追加#11
Merged
Conversation
`devbase init` が書き込んだ rc ファイルのパスを stdout に 1 行出力する ユーティリティサブコマンド。`source "$(devbase shell-rc)"` のように コマンド置換と組み合わせて使い、ユーザーに環境(zsh / bash on Linux / bash on macOS)の判定を意識させずに rc を再読み込みできるようにする。 ロジックは既存の `get_shell_rc_file()` を再利用。DEVBASE_ROOT は不要。 - lib/devbase/commands/shell.py: 新規(cmd_shell_rc) - lib/devbase/cli.py: subparser 登録、prefix 解決リスト、dispatch (DEVBASE_ROOT 不要グループに配置) - bin/devbase: bash dispatcher の commands 一覧と case 分岐 - etc/devbase-completion.bash: bash 補完 - etc/_devbase: zsh 補完
…s/shell.py をリネーム PR #11 のレビュー指摘 (Codex) への対応。 - docs/user/cli-reference.md: `devbase shell-rc` セクションを追加。 mermaid 図と環境別出力テーブル、`source "$(...)"` の引用符必須注記を含める。 - README.md: クイックスタートを `source "$(./bin/devbase shell-rc)"` ワンライナーに変更し、`devbase build` 行を削除(`devbase up` が 自動でビルド/pull するため)。トップレベルコマンド一覧に shell-rc 追記。 - docs/user/getting-started.md: Step 3 の bash/zsh ケース分岐を `source "$(./bin/devbase shell-rc)"` に統一。引用符必須の注記を追加。 - lib/devbase/commands/shell.py を shell_rc.py にリネーム。 utils/shell.py との名前衝突による検索・補完時の混乱を回避(Codex N-2)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
devbase initが書き込んだ rc ファイルのパスを stdout に 1 行だけ出力するdevbase shell-rcサブコマンドを追加する。source "$(devbase shell-rc)"の形で使うと、ユーザーは zsh / bash on Linux / bash on macOS のどれを使っているかを意識せずに rc を再読み込みできる。判定ロジックは既存の
lib/devbase/utils/shell.py::get_shell_rc_file()をそのまま再利用しているため、devbase initの書き込み先と完全に一致する。devbase shell-rc自体は DEVBASE_ROOT を必要としないため、dispatch では_require_devbase_root()の前に分岐させている。変更ファイル
lib/devbase/commands/shell.py(新規):cmd_shell_rc()を実装lib/devbase/cli.py: subparser 登録、prefix 解決リスト、dispatch(DEVBASE_ROOT 不要グループ)bin/devbase: bash dispatcher の commands 一覧と case 分岐etc/devbase-completion.bash: bash 補完etc/_devbase: zsh 補完想定ユースケース
devbase-ext などのレジストリ README で、初回セットアップ手順を以下のようにシンプルに書けるようになる:
```bash
git clone https://github.com/devbasex/devbase.git
cd devbase
./bin/devbase init
source "$(./bin/devbase shell-rc)"
```
Test plan
SHELL=/bin/zsh devbase shell-rc→~/.zshrcを出力SHELL=/bin/bashon macOS →~/.bash_profileを出力SHELL=/bin/bashon Linux →~/.bashrcを出力(Linux 環境で要確認)devbase shのような prefix 短縮で shell-rc に解決される(status / snapshot / scale / ss と衝突しない)devbase --helpの subparser 一覧にshell-rcが表示されるsource "$(devbase shell-rc)"のコマンド置換が意図通り動作shell-rcがタブ補完候補に出る(要環境確認)