configcmd and version: the config and version standard commands; darwin /var/run

core/configcmd: "<program> config create|validate|upgrade|path" from a
Spec (name, application, minimal/full templates, Validate, Schema),
taken over from yamase-core/pkg/configcmd and generalized: Filename,
Optional (programs that run on defaults) and None (no configuration).

core/version: "<program> version [--json]" over the values each
program stamps into its internal/version; JSON keys match yasta's
existing output (yavebu reads it), VCS fallback for unstamped builds.

paths: macOS CLI/Service system-scope RuntimeDir is /var/run/<app>
instead of /run/<app>, which macOS does not have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-10-23 14:36:48 +02:00
1 parent ca0f06f978
commit 90132e2d76
13 files changed
+1824 -20

No files matched your search

+16
View File
@@ -93,3 +93,19 @@ func TestDarwinServiceUsesXDGLikeLayout(t *testing.T) {
t.Errorf("ConfigDir() = %q, want %q (macOS Service should match Linux layout)", got, want)
}
}
func TestDarwinServiceSystemRuntimeDirIsVarRun(t *testing.T) {
app := core.Application{Name: "yasta", Kind: core.Service, Scope: core.SystemScope}
r := mustResolver(t, app, WithPlatform("darwin"), WithEnvironment(map[string]string{}))
got, err := r.RuntimeDir()
if err != nil {
t.Fatalf("RuntimeDir: %v", err)
}
if want := "/var/run/yasta"; got != want {
t.Errorf("RuntimeDir() = %q, want %q (macOS has no /run)", got, want)
}
lin := mustResolver(t, app, WithPlatform("linux"), WithEnvironment(map[string]string{}))
if got, _ := lin.RuntimeDir(); got != "/run/yasta" {
t.Errorf("linux RuntimeDir() = %q, want /run/yasta", got)
}
}