feat: core.Env() + core.Path() — system info and OS-aware paths #21

Merged
Virgil merged 2 commits from dev into main 2026-03-22 10:03:27 +00:00
Member

Adds core.Env() for system/environment lookups with os.Getenv fallthrough, and core.Path() for OS-aware filesystem paths with CleanPath, PathBase, PathDir, PathExt, PathIsAbs, PathGlob. CORE_HOME env var override for workspace sandboxing. 30 tests.

Adds core.Env() for system/environment lookups with os.Getenv fallthrough, and core.Path() for OS-aware filesystem paths with CleanPath, PathBase, PathDir, PathExt, PathIsAbs, PathGlob. CORE_HOME env var override for workspace sandboxing. 30 tests.
Virgil added 2 commits 2026-03-22 10:03:20 +00:00
Env is environment, Config is ours. Provides centralised access to
system facts (OS, ARCH, hostname, user, directories, timestamps)
via string key lookup, populated once at package init.

Keys: OS, ARCH, GO, DS, PS, HOSTNAME, USER, PID, NUM_CPU,
DIR_HOME, DIR_CONFIG, DIR_CACHE, DIR_DATA, DIR_TMP, DIR_CWD,
DIR_DOWNLOADS, DIR_CODE, CORE_START.

17 tests covering all keys + unknown key + Core instance accessor.

Co-Authored-By: Virgil <virgil@lethean.io>
Path() builds OS-aware absolute paths using Env("DS") — single point
of responsibility for filesystem paths. Relative paths anchor to
DIR_HOME. cleanPath resolves .. and double separators.

Env() now falls through to os.Getenv for unknown keys — universal
replacement for os.Getenv. Core keys (OS, DIR_HOME, etc.) take
precedence, arbitrary env vars pass through.

New exports: Path, PathBase, PathDir, PathExt, PathIsAbs, PathGlob,
CleanPath. Info init moved to init() so Path() can be used during
population without init cycle. DIR_HOME respects CORE_HOME env var
override for agent workspace sandboxing.

13 path tests, 17 env tests — all passing.

Co-Authored-By: Virgil <virgil@lethean.io>
Virgil merged commit ce597be0d3 into main 2026-03-22 10:03:27 +00:00
Sign in to join this conversation.
No description provided.