feat(cli): refactor elemes.sh to modular Python CLI, interactive TUI, and multi-OS support
- Modularize orchestrator into Python modules under cli/ (config, runner, commands, tui)
- Introduce interactive Rich-based TUI with live container status, focused description panel, and arrow navigation
- Add multi-OS launcher wrappers: elemes.sh (Unix), elemes.bat (Windows CMD), elemes.ps1 (PowerShell), elemes.py
- Default isolated virtualenv to parent folder (../venv) to keep repository clean
- Add stopclean command for compose down with container & image pruning
- Fix submenu navigation when pressing ENTER on Kembali and Keluar
- Prevent keystroke bleeding across subprocess executions with DEVNULL stdin and tcflush
- Add unit test suite (make test-cli) covering 27 isolated CLI/TUI tests
- Maintain 100% backward compatibility with existing elemes.sh commands and shell regression tests
2026-09-06 12:28:07 +07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Elemes LMS Orchestrator - Portable Unix Wrapper (Linux / macOS)
|
|
|
|
|
# Default virtualenv selalu berada di parent folder (../venv) agar elemes/ tetap bersih
|
|
|
|
|
|
|
|
|
|
set -e
|
2026-03-31 12:08:42 +07:00
|
|
|
|
2026-03-31 14:31:15 +07:00
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
2026-04-01 09:37:09 +07:00
|
|
|
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
|
2026-08-29 13:28:06 +07:00
|
|
|
|
feat(cli): refactor elemes.sh to modular Python CLI, interactive TUI, and multi-OS support
- Modularize orchestrator into Python modules under cli/ (config, runner, commands, tui)
- Introduce interactive Rich-based TUI with live container status, focused description panel, and arrow navigation
- Add multi-OS launcher wrappers: elemes.sh (Unix), elemes.bat (Windows CMD), elemes.ps1 (PowerShell), elemes.py
- Default isolated virtualenv to parent folder (../venv) to keep repository clean
- Add stopclean command for compose down with container & image pruning
- Fix submenu navigation when pressing ENTER on Kembali and Keluar
- Prevent keystroke bleeding across subprocess executions with DEVNULL stdin and tcflush
- Add unit test suite (make test-cli) covering 27 isolated CLI/TUI tests
- Maintain 100% backward compatibility with existing elemes.sh commands and shell regression tests
2026-09-06 12:28:07 +07:00
|
|
|
# Tentukan direktori virtualenv di parent
|
|
|
|
|
if [ -d "$PARENT_DIR/.venv" ]; then
|
|
|
|
|
VENV_DIR="$PARENT_DIR/.venv"
|
|
|
|
|
else
|
|
|
|
|
VENV_DIR="$PARENT_DIR/venv"
|
|
|
|
|
fi
|
|
|
|
|
VENV_PYTHON="$VENV_DIR/bin/python"
|
|
|
|
|
|
|
|
|
|
# 1. Buat virtualenv di parent jika belum ada
|
|
|
|
|
if [ ! -x "$VENV_PYTHON" ] && [ "${ELEMES_NO_VENV:-0}" != "1" ]; then
|
|
|
|
|
echo "📦 Menyiapkan virtualenv di $(basename "$VENV_DIR")/ (parent folder agar elemes tetap bersih)..."
|
|
|
|
|
python3 -m venv "$VENV_DIR" || {
|
|
|
|
|
echo "⚠️ Gagal membuat virtualenv dengan python3 -m venv."
|
feat(teacher): manajemen akun guru canonical + first-run otomatis; cabut backend CSV (PG only)
- feat: ./elemes.sh teacher — upsert satu akun guru canonical (prompt nama default TEACHER_NAME, token tersembunyi via stdin, rotasi token saat guru sudah ada, idempotent); TEACHER_NAME/TEACHER_TOKEN di .env
- feat: first-run otomatis — db_init jalankan alembic upgrade head + bootstrap guru bila TEACHER_TOKEN terisi (run/runbuild/runclearbuild)
- refactor: backend CSV dicabut penuh — hapus mount tokens_siswa.csv, TOKENS_FILE, STORAGE_BACKEND=csv, csv_backend.py, csv_importer.py, generate_tokens.py, script migrate/verify/export CSV, command generatetoken/dbimport/dbverify/dbexport/synclessons; storage fail-loud postgresql-only
- fix: dbrestore gagal diam-diam saat restore ke DB berisi data (dump tanpa --clean) — dbbackup kini --clean --if-exists + dbrestore reset schema public; roundtrip terverifikasi
- test: suite kontrak PG-native + route auth/progress integrasi PG; 183 passed container, 96 passed host, frontend 91 passed
- docs: README, documentation.md, docs/01/02/11, load-test/README disinkronkan ke realita PostgreSQL-only; proposal.md dipertahankan (historis)
- chore: load-test token sintetis di-seed ke PG (content_parser), config.py bersih TOKENS_FILE, .dockerignore/.gitignore dibersihkan
2026-08-09 11:21:08 +07:00
|
|
|
}
|
feat(cli): refactor elemes.sh to modular Python CLI, interactive TUI, and multi-OS support
- Modularize orchestrator into Python modules under cli/ (config, runner, commands, tui)
- Introduce interactive Rich-based TUI with live container status, focused description panel, and arrow navigation
- Add multi-OS launcher wrappers: elemes.sh (Unix), elemes.bat (Windows CMD), elemes.ps1 (PowerShell), elemes.py
- Default isolated virtualenv to parent folder (../venv) to keep repository clean
- Add stopclean command for compose down with container & image pruning
- Fix submenu navigation when pressing ENTER on Kembali and Keluar
- Prevent keystroke bleeding across subprocess executions with DEVNULL stdin and tcflush
- Add unit test suite (make test-cli) covering 27 isolated CLI/TUI tests
- Maintain 100% backward compatibility with existing elemes.sh commands and shell regression tests
2026-09-06 12:28:07 +07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# 2. Pastikan dependensi rich terpasang di venv
|
|
|
|
|
if [ -x "$VENV_PYTHON" ]; then
|
|
|
|
|
if ! "$VENV_PYTHON" -c "import rich" >/dev/null 2>&1; then
|
|
|
|
|
echo "📦 Memasang dependensi CLI (rich) ke $(basename "$VENV_DIR")..."
|
|
|
|
|
if [ -f "$SCRIPT_DIR/requirements-cli.txt" ]; then
|
|
|
|
|
"$VENV_PYTHON" -m pip install -q -r "$SCRIPT_DIR/requirements-cli.txt" || true
|
2026-08-29 13:28:06 +07:00
|
|
|
else
|
feat(cli): refactor elemes.sh to modular Python CLI, interactive TUI, and multi-OS support
- Modularize orchestrator into Python modules under cli/ (config, runner, commands, tui)
- Introduce interactive Rich-based TUI with live container status, focused description panel, and arrow navigation
- Add multi-OS launcher wrappers: elemes.sh (Unix), elemes.bat (Windows CMD), elemes.ps1 (PowerShell), elemes.py
- Default isolated virtualenv to parent folder (../venv) to keep repository clean
- Add stopclean command for compose down with container & image pruning
- Fix submenu navigation when pressing ENTER on Kembali and Keluar
- Prevent keystroke bleeding across subprocess executions with DEVNULL stdin and tcflush
- Add unit test suite (make test-cli) covering 27 isolated CLI/TUI tests
- Maintain 100% backward compatibility with existing elemes.sh commands and shell regression tests
2026-09-06 12:28:07 +07:00
|
|
|
"$VENV_PYTHON" -m pip install -q "rich>=13.0.0" || true
|
2026-08-29 13:28:06 +07:00
|
|
|
fi
|
|
|
|
|
fi
|
feat(cli): refactor elemes.sh to modular Python CLI, interactive TUI, and multi-OS support
- Modularize orchestrator into Python modules under cli/ (config, runner, commands, tui)
- Introduce interactive Rich-based TUI with live container status, focused description panel, and arrow navigation
- Add multi-OS launcher wrappers: elemes.sh (Unix), elemes.bat (Windows CMD), elemes.ps1 (PowerShell), elemes.py
- Default isolated virtualenv to parent folder (../venv) to keep repository clean
- Add stopclean command for compose down with container & image pruning
- Fix submenu navigation when pressing ENTER on Kembali and Keluar
- Prevent keystroke bleeding across subprocess executions with DEVNULL stdin and tcflush
- Add unit test suite (make test-cli) covering 27 isolated CLI/TUI tests
- Maintain 100% backward compatibility with existing elemes.sh commands and shell regression tests
2026-09-06 12:28:07 +07:00
|
|
|
exec "$VENV_PYTHON" "$SCRIPT_DIR/elemes.py" "$@"
|
|
|
|
|
else
|
|
|
|
|
exec python3 "$SCRIPT_DIR/elemes.py" "$@"
|
|
|
|
|
fi
|