feat(stack): wrapper CLI compose + scanner stack (REA modul 2/Dockge) — doctor cek compose & hitung stack
CI / test (push) Successful in 24s

This commit is contained in:
oxpoe committed 2026-10-16 01:45:14 +07:00
1 parent b84afdb494
commit 8a3b92b155
9 files changed
+357 -6

No files matched your search

+16 -2
View File
@@ -14,6 +14,7 @@ import (
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/config"
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/docker"
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/i18n"
"gitea.oxpoe.qzz.io/oxpoe/tia-love/internal/stack"
)
// Doctor memeriksa kesehatan sistem dan menulis laporan ke w.
@@ -51,8 +52,17 @@ func Doctor(w io.Writer) int {
fmt.Fprintf(w, "go : %s (%s/%s)\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
// Konfigurasi & direktori stack.
// Konfigurasi (dipakai compose, stack, dan output config di bawah).
cfg, cfgErr := config.Load()
// Compose — dipakai operasi stack (up/down/pull).
compose := docker.NewCompose(cfg.Docker.ComposeCommand)
if ver, err := compose.Version(ctx); err != nil {
fmt.Fprintf(w, "compose : %s %v\n", i18n.T("error.warn"), err)
} else {
fmt.Fprintf(w, "compose : %s %s\n", i18n.T("error.ok"), i18n.Tf("doctor.composeOk", ver, cfg.Docker.ComposeCommand))
}
cfgPath := config.Path()
switch {
case cfgErr != nil:
@@ -67,7 +77,11 @@ func Doctor(w io.Writer) int {
stacks := config.ExpandPath(cfg.StacksDir)
if st, err := os.Stat(stacks); err == nil && st.IsDir() {
fmt.Fprintf(w, "stacks : %s\n", stacks)
n := 0
if list, err := stack.ScanFS(stacks); err == nil {
n = len(list)
}
fmt.Fprintf(w, "stacks : %s\n", i18n.Tf("doctor.stacksCount", stacks, n))
} else {
fmt.Fprintf(w, "stacks : %s\n", i18n.Tf("doctor.stacksMissing", stacks))
}