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
21 changes: 15 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
## [Unreleased]

### Added
- **`devbase list` の対話選択を TUI 化**しました。`simple-term-menu` 導入により、
↑↓ の矢印キーで行移動、先頭 9 件は `1`〜`9` の数字キーで即ジャンプ、`/` で
名前のインクリメンタル検索ができます。Enter で選択プロジェクトを `up` 起動し、
Esc で中止します。非 TTY(パイプ/CI/リダイレクト)では従来どおりプレーンな
一覧表示にフォールバックし、`simple-term-menu` 未導入環境では番号入力方式に
フォールバックします(macOS / Linux 対応)。
- **`devbase list` の対話選択を TUI 化**しました。`questionary` 導入により、↑↓ の
矢印キーで行移動、文字入力でプロジェクト名のインクリメンタル絞り込みができます
(全項目に通し番号を表示)。Enter で決定、Ctrl-C で中止します。
- **選択行が起動中 (running) の場合**は「再起動 (up) / 再ビルド (rebuild --no-cache) /
停止 (down)」を選ぶサブメニューを表示します。それ以外 (stopped / unknown) は
従来どおり `up` を起動します。
- 非 TTY(パイプ/CI/リダイレクト)では従来どおりプレーンな一覧表示にフォールバック
し、`questionary` 未導入環境では番号入力方式にフォールバックします。
- 入力ライブラリを `simple-term-menu` から `questionary` (prompt_toolkit ベース) へ
移行し、↑長押し時にスクロールが取りこぼされて遅くなる問題を解消しました。
- **`devbase rebuild` コマンドを新設**しました。`docker compose build --no-cache` 相当で、
キャッシュを無効化してプロジェクト (compose) イメージを作り直します。`devbase rebuild
[name]` / `devbase project rebuild [name]` として任意のディレクトリから利用できます
(`devbase list` の running サブメニューからも起動できます)。なお `devbase-base` まで
作り直す 2 段ビルドは従来どおり `devbase build --no-cache` を使用してください。
- **`devbase project` サブコマンド群を新設**しました (PLAN06)。CWD に依存せずプロジェクト名でコンテナ操作ができます。
- `devbase project up/down/ps/logs/scale [name]` で、任意のディレクトリから `$DEVBASE_ROOT/projects/<name>` を対象に操作できます。名前解決はラッパー (`bin/devbase`) が対象ディレクトリへ `cd` してから実行するため、シェル実装の `build` を含む全操作が名前指定で成立します(呼び出し元シェルの作業ディレクトリは変わりません)。存在しない名前はエラーになり候補が提示されます。
- `devbase project list` で `$DEVBASE_ROOT/projects/` 配下を `NAME` / `PLUGIN` / `STATUS` の一覧表示します。`PLUGIN` 列はシンボリックリンク先から解決するため、PLAN04 の同名衝突 suffix(例 `carmo.takemi`)が付いていても正しいプラグイン名を表示します。**TTY ではデフォルトで対話選択**になり、一覧から番号で選んだプロジェクトを `project up` で起動します。`--no-interactive`(`--plain` / `-P`)で一覧表示のみに切り替えられ、パイプ・リダイレクト・CI などの非 TTY 環境では自動的に一覧表示へフォールバックします(`--interactive` / `-i` は後方互換として引き続き受け付けます)。
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ devbaseは、Docker Composeを使った再現性の高い開発環境を提供
- **データ永続化**: 名前付きボリュームでコンテナ再起動後もデータを保持
- **スナップショット管理**: `/home/ubuntu` 共通ボリュームの増分バックアップ・復元・世代管理
- **環境変数の自動収集**: `devbase env init`でAWS/Git/GCP認証情報を対話的に設定
- **対話的なプロジェクト選択**: `devbase list` で矢印キー・番号・`/` 検索に対応した TUI メニューから起動対象を選べます
- **対話的なプロジェクト選択**: `devbase list` で矢印キー移動・名前での絞り込みに対応した TUI メニューから起動対象を選べます。起動中のプロジェクトは「再起動 (up) / 再ビルド (rebuild) / 停止 (down)」を選択できます
- **キャッシュ無効リビルド**: `devbase rebuild [name]` で `docker compose build --no-cache` 相当のイメージ再ビルドができます

## クイックスタート

Expand Down
8 changes: 4 additions & 4 deletions bin/devbase
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ run_python() {
# Resolve abbreviated command to full command name via unique prefix matching
resolve_command() {
local input="$1"
local commands="init status shell-rc project container ct env plugin pl snapshot ss up down login build ps scale list help"
local commands="init status shell-rc project container ct env plugin pl snapshot ss up down login build rebuild ps scale list help"
local matches=()
for cmd in $commands; do
[[ "$cmd" == "$input"* ]] && matches+=("$cmd")
Expand Down Expand Up @@ -331,8 +331,8 @@ _DEVBASE_ARGS=("${@:2}")
# そのプロジェクトへ切り替えてから (cd 済みの状態で) コマンドを実行すること。
# こうすれば name 解決トークンを与える必要がなくなり、index/image/service を
# 意図どおり渡せる。
_PROJECT_NAME_SUBCOMMANDS=" up down ps logs scale "
_NAME_RESOLVABLE_SHORTCUTS=" up down ps scale login build "
_PROJECT_NAME_SUBCOMMANDS=" up down ps logs scale rebuild "
_NAME_RESOLVABLE_SHORTCUTS=" up down ps scale login build rebuild "
case "$_resolved_cmd" in
project|container|ct)
# `ct` は container の alias (cli.py: add_parser('container', aliases=['ct']))。
Expand All @@ -355,7 +355,7 @@ case "$_resolved_cmd" in
# Python-implemented commands
--version|-V)
run_python "$@" ;;
init|status|shell-rc|project|container|ct|env|plugin|pl|snapshot|ss|up|down|login|ps|scale|list)
init|status|shell-rc|project|container|ct|env|plugin|pl|snapshot|ss|up|down|login|ps|scale|rebuild|list)
run_python "${_resolved_cmd}" "${_DEVBASE_ARGS[@]}" ;;
# Shell-implemented commands
build) cmd_build "${_DEVBASE_ARGS[@]}" ;;
Expand Down
9 changes: 6 additions & 3 deletions etc/_devbase
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ _devbase() {
'down:Stop containers (shortcut)'
'login:Login to container (shortcut)'
'build:Build container images'
'rebuild:Rebuild images without cache (shortcut)'
'ps:Show container status (shortcut)'
'scale:Scale containers online (shortcut)'
'list:List projects (shortcut)'
Expand All @@ -78,6 +79,7 @@ _devbase() {
'logs:Show container logs'
'scale:Scale containers online'
'build:Build container images'
'rebuild:Rebuild images without cache (docker compose build --no-cache)'
'list:List projects (NAME / PLUGIN / STATUS)'
)

Expand All @@ -89,6 +91,7 @@ _devbase() {
'logs:Show container logs'
'scale:Scale containers online'
'build:Build container images'
'rebuild:Rebuild images without cache (docker compose build --no-cache)'
)

env_subcommands=(
Expand Down Expand Up @@ -134,8 +137,8 @@ _devbase() {
login)
_values 'index' 1 2
;;
# トップレベルシノニム: up/down/ps/scale は [name] を取るためプロジェクト名を補完。
up|down)
# トップレベルシノニム: up/down/ps/scale/rebuild は [name] を取るためプロジェクト名を補完。
up|down|rebuild)
_devbase_project_names
;;
ps)
Expand All @@ -158,7 +161,7 @@ _devbase() {
;;
project)
case "$words[3]" in
up|down)
up|down|rebuild)
_devbase_project_names
;;
login)
Expand Down
12 changes: 6 additions & 6 deletions etc/devbase-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ _devbase_completions() {
cword=$COMP_CWORD
}

local commands="init status shell-rc project container ct env plugin pl snapshot ss up down login build ps scale list help"
local commands="init status shell-rc project container ct env plugin pl snapshot ss up down login build rebuild ps scale list help"
# project / container は同じサブコマンド群 (container は非推奨だが補完は維持)。
local project_subcommands="up down ps login logs scale build list"
local container_subcommands="up down ps login logs scale build"
local project_subcommands="up down ps login logs scale build rebuild list"
local container_subcommands="up down ps login logs scale build rebuild"
local env_subcommands="init sync list set get delete edit project export import"
local plugin_subcommands="list install uninstall update info sync repo"
local repo_subcommands="add remove list refresh"
Expand All @@ -49,9 +49,9 @@ _devbase_completions() {
login)
COMPREPLY=($(compgen -W "1 2" -- "$cur"))
;;
# トップレベルシノニム: up/down/scale は [name] を取るため
# トップレベルシノニム: up/down/scale/rebuild は [name] を取るため
# プロジェクト名を補完する (login=index / build=image は対象外)。
up|down|scale)
up|down|scale|rebuild)
COMPREPLY=($(compgen -W "$(_devbase_project_names)" -- "$cur"))
;;
# ps は [name] と -a フラグの両方を取る (project ps と同じ挙動)。
Expand Down Expand Up @@ -96,7 +96,7 @@ _devbase_completions() {
# project subcommand arguments (推奨グループ)
if [ "$group" = "project" ]; then
case "$prev" in
up|down)
up|down|rebuild)
COMPREPLY=($(compgen -W "$(_devbase_project_names)" -- "$cur"))
;;
login)
Expand Down
Loading
Loading