Commit graph

25 commits

Author SHA1 Message Date
Snider
d73dfa3d73 refactor(process): replace fmt.Errorf and errors.New with coreerr.E()
Replace all 27 instances of fmt.Errorf/errors.New in production code
with coreerr.E() from forge.lthn.ai/core/go-log for structured error
context (op, message, cause). Promote go-log from indirect to direct
dependency in go.mod.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 20:38:08 +00:00
Snider
10adcbe289 fix(test): SetDefault returns error not panic, update test
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 18:41:56 +00:00
Snider
715c14f048 refactor(process): replace os file ops with coreio.Local in pidfile and registry
Replace all os.ReadFile, os.WriteFile, os.MkdirAll, os.Remove calls in
pidfile.go and registry.go with coreio.Local equivalents (Read, Write,
EnsureDir, Delete). Add forge.lthn.ai/core/go-io v0.1.2 as a direct dependency.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-16 18:31:35 +00:00
Snider
c3b9374ae1 feat: add Detach option for process group isolation
RunOptions.Detach creates the process in its own process group
(Setpgid) and uses context.Background() instead of the parent
context. Detached processes survive parent death.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-15 15:55:20 +00:00
Snider
4760cd8c80 chore: bump core/go to v0.3.1
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-15 15:36:39 +00:00
Snider
3694f6e36d chore: add .core/ and .idea/ to .gitignore 2026-03-15 10:17:50 +00:00
Snider
2b93b63a5a fix: update stale import paths and dependency versions from extraction
Resolve stale forge.lthn.ai/core/cli v0.1.0 references (tag never existed,
earliest is v0.0.1) and regenerate go.sum via workspace-aware go mod tidy.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 13:38:59 +00:00
Snider
59e82f74af docs: remove implemented plan files
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 12:45:56 +00:00
Snider
0ae76c2414 feat(ui): add Lit custom elements for process management
Five Lit custom elements following the go-scm UI pattern:
- <core-process-panel> tabbed container (Daemons/Processes/Pipelines)
- <core-process-daemons> daemon registry with health checks and stop
- <core-process-list> managed processes with status badges
- <core-process-output> live stdout/stderr WS stream viewer
- <core-process-runner> pipeline execution results display

Also adds provider.Renderable interface to ProcessProvider with
Element() returning core-process-panel tag, extends WS channels
with process-level events, and embeds the built UI bundle via
go:embed.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 12:25:06 +00:00
Snider
ae321f5344 refactor(api): update import path from go-api to core/api
Part of the polyglot merge — forge.lthn.ai/core/go-api is now
forge.lthn.ai/core/api.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 10:10:43 +00:00
Snider
58e4d37008 feat(api): add process service provider with REST endpoints
Wraps the daemon Registry as a provider.Provider with REST endpoints for
list, get, stop, and health check. Implements Streamable and Describable
for WS event streaming and OpenAPI generation. Adds go-api, go-ws, and
gin as direct dependencies for the pkg/api sub-package.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 09:47:20 +00:00
Snider
d04d042e96 docs: add CLAUDE.md project instructions
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-13 13:38:02 +00:00
Snider
ec95200765 docs: add human-friendly documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:02:40 +00:00
Snider
81de841903 feat: auto-register/unregister daemons via optional Registry
When Registry is set on DaemonOptions, Start() auto-registers the daemon
(filling PID and Health address) and Stop() auto-unregisters it. Consumers
without a registry are completely unaffected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:49:47 +00:00
Snider
2a26948d44 feat: add daemon Registry for tracking running daemons
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:42:25 +00:00
Snider
953a95f26f fix: address code review — HTTP client timeout, errors.Join, remove unused OnReload
- WaitForHealth: use http.Client with 2s timeout instead of DefaultClient
- Daemon.Stop: use errors.Join for proper error unwrapping
- Remove unused OnReload field from DaemonOptions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:19:10 +00:00
Snider
0696d32042 feat: add Daemon orchestrator for managed process lifecycle
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:01:40 +00:00
Snider
8cc3a88ab4 feat: add HealthServer and WaitForHealth for daemon monitoring
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:59:42 +00:00
Snider
4c17be4e46 fix: resolve variable shadowing in test files (core → framework alias)
Local variable `core` shadowed the package import `core`, causing
`core.ServiceFor` to be interpreted as a method call instead of a
package-level function. Aliased import as `framework`.

Also fixes pre-existing compilation failure in go-process test suite.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:58:18 +00:00
Snider
7ea523ee7b feat: add PIDFile for single-instance enforcement
PIDFile manages a process ID lock file with Acquire/Release semantics.
Detects stale PIDs via signal(0) probe, creates parent directories
automatically. Includes standalone ReadPID helper for checking if a
PID file's process is still alive.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 13:53:58 +00:00
Snider
4fc5c3b0e5 fix: correct Signal to use os.Signal, return errors instead of panicking
Signal() now properly forwards to cmd.Process.Signal() instead of
calling Kill(). SetDefault(nil) returns error instead of panicking.
Wait() returns descriptive errors with process context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:26:00 +00:00
Snider
54bfd76104 chore: add .core/ build and release configs
Add go-devops build system configuration for standardised
build, test, and release workflows across the Go ecosystem.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 18:52:37 +00:00
Snider
9bf666a1e1 chore: sync go.mod dependencies
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 15:21:40 +00:00
Snider
85b0e002d6 refactor: swap pkg/framework imports to pkg/core
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 14:10:56 +00:00
Snider
8095807ad6 feat: extract process package from core/go pkg/process
Process management with Core IPC integration, output streaming via
ring buffer, exec wrapper with logging, and dependency-aware runner.

Moved from forge.lthn.ai/core/go/pkg/process to standalone module.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 12:50:09 +00:00