Massive cleanup after module extraction sprint. core/go is now a pure DI framework — docs should reflect that, not document CLI commands. - Delete 130+ CLI command/example docs (already in core/cli) - Delete 6 obsolete pkg-batch*-analysis.md files - Delete plans/, skill/, static/, mcp/ (moved to correct repos) - Rewrite index.md for DI framework (not CLI) - Fix PACKAGE_STANDARDS.md: framework.* → core.* references - Fix log.md: correct framework integration example Remaining docs: index.md, pkg/PACKAGE_STANDARDS.md, pkg/log.md Co-Authored-By: Virgil <virgil@lethean.io>
1.9 KiB
1.9 KiB
Core Go Framework — Documentation
Core (forge.lthn.ai/core/go) is a dependency injection and service lifecycle framework for Go. It provides a typed service registry, lifecycle hooks, and a message-passing bus for decoupled communication between services.
This is the foundation layer — it has no CLI, no GUI, and minimal dependencies (go-io, go-log, testify).
Packages
| Package | Description |
|---|---|
pkg/core |
DI container, service registry, lifecycle, query/task bus |
pkg/log |
Structured logger service with Core integration |
Quick Start
import (
"forge.lthn.ai/core/go/pkg/core"
"forge.lthn.ai/core/go/pkg/log"
)
c, err := core.New(
core.WithName("log", log.NewService(log.Options{Level: log.LevelInfo})),
core.WithName("myservice", mypackage.NewService(opts)),
)
// Services implementing Startable/Stoppable are called automatically.
Type-safe service retrieval
svc, err := core.ServiceFor[*mypackage.Service](c, "myservice")
Query/Task bus
Services communicate via typed messages without direct imports:
// Query: request data from a service
result, err := c.Query(log.QueryLevel{})
// Task: ask a service to do something
c.Task(log.TaskSetLevel{Level: log.LevelDebug})
Architecture
See Package Standards for the canonical patterns:
- Service struct with
core.ServiceRuntime[T] - Factory functions for registration
- Lifecycle hooks (
Startable,Stoppable) - Thread-safe APIs
- Query/Task handlers
See Log Service for the reference implementation within this repo.
Ecosystem
This framework is consumed by 20+ standalone Go modules under forge.lthn.ai/core/. The CLI, AI, ML, and infrastructure packages all build on this DI container.
For CLI documentation, see forge.lthn.ai/core/cli.