[agent/claude] Migrate module path to dappco.re/go/core/container. Update g... #1
32 changed files with 82 additions and 70 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Consumers of go-container
|
||||
|
||||
These modules import `forge.lthn.ai/core/go-container`:
|
||||
These modules import `dappco.re/go/core/container`:
|
||||
|
||||
- core
|
||||
- go-devops
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import (
|
|||
"text/tabwriter"
|
||||
"time"
|
||||
|
||||
"dappco.re/go/core/container"
|
||||
"dappco.re/go/core/i18n"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-container"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import (
|
|||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"dappco.re/go/core/container"
|
||||
"dappco.re/go/core/i18n"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-container"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// addVMTemplatesCommand adds the 'templates' command under vm.
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"dappco.re/go/core/i18n"
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// ClaudeOptions configures the Claude sandbox session.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"dappco.re/go/core/io"
|
||||
"forge.lthn.ai/core/config"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
)
|
||||
|
||||
// Config holds global devops configuration from ~/.core/config.yaml.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/io"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import (
|
|||
"runtime"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go-container"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/container"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go-container"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/container"
|
||||
"dappco.re/go/core/io"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go-container/sources"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/container/sources"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// ImageManager handles image downloads and updates.
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go-container/sources"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/container/sources"
|
||||
"dappco.re/go/core/io"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import (
|
|||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// ServeOptions configures the dev server.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/io"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// ShellOptions configures the shell connection.
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
coreio "forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
coreio "dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// ensureHostKey ensures that the host key for the dev environment is in the known hosts file.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/io"
|
||||
)
|
||||
|
||||
func TestDetectTestCommand_Good_ComposerJSON(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ description: How to build, test, and contribute to go-container.
|
|||
## Prerequisites
|
||||
|
||||
- **Go 1.26+** -- The module uses Go 1.26 features.
|
||||
- **Go workspace** -- This module is part of a Go workspace at `~/Code/go.work`. Local development of sibling modules (go-io, config, go-i18n, cli) requires the workspace file.
|
||||
- **Go workspace** -- This module is part of a Go workspace at `~/Code/go.work`. Local development of sibling modules (core/io, config, core/i18n, cli) requires the workspace file.
|
||||
|
||||
Optional (for actually running VMs):
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ go-container/
|
|||
- **UK English** in all strings, comments, and documentation (colour, organisation, honour).
|
||||
- **Strict typing** -- All function parameters and return values are typed. No `interface{}` without justification.
|
||||
- **Error wrapping** -- Use `fmt.Errorf("context: %w", err)` for all error returns.
|
||||
- **`io.Medium` abstraction** -- File system operations go through `io.Medium` (from `go-io`) rather than directly calling `os` functions. This enables testing with mock file systems. The `io.Local` singleton is used for real file system access.
|
||||
- **`io.Medium` abstraction** -- File system operations go through `io.Medium` (from `core/io`) rather than directly calling `os` functions. This enables testing with mock file systems. The `io.Local` singleton is used for real file system access.
|
||||
- **Compile-time interface checks** -- Use `var _ Interface = (*Impl)(nil)` to verify implementations at compile time (see `sources/cdn.go` and `sources/github.go`).
|
||||
- **Context propagation** -- All operations that might block accept a `context.Context` as their first parameter.
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ description: Container runtime, LinuxKit image builder, and portable development
|
|||
|
||||
# go-container
|
||||
|
||||
`forge.lthn.ai/core/go-container` provides a container runtime built on LinuxKit and lightweight hypervisors. It manages the full lifecycle of LinuxKit virtual machines -- from building images with embedded templates, to running them via QEMU or Hyperkit, to offering a portable development environment with shell access, project mounting, test execution, and Claude AI integration.
|
||||
`dappco.re/go/core/container` provides a container runtime built on LinuxKit and lightweight hypervisors. It manages the full lifecycle of LinuxKit virtual machines -- from building images with embedded templates, to running them via QEMU or Hyperkit, to offering a portable development environment with shell access, project mounting, test execution, and Claude AI integration.
|
||||
|
||||
This is **not** a Docker wrapper. It runs real VMs from LinuxKit images (ISO, qcow2, VMDK, raw) using platform-native acceleration (KVM on Linux, HVF on macOS, Hyperkit where available).
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ This is **not** a Docker wrapper. It runs real VMs from LinuxKit images (ISO, qc
|
|||
## Module path
|
||||
|
||||
```
|
||||
forge.lthn.ai/core/go-container
|
||||
dappco.re/go/core/container
|
||||
```
|
||||
|
||||
Requires **Go 1.26+**.
|
||||
|
|
@ -26,8 +26,8 @@ Requires **Go 1.26+**.
|
|||
```go
|
||||
import (
|
||||
"context"
|
||||
container "forge.lthn.ai/core/go-container"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
container "dappco.re/go/core/container"
|
||||
"dappco.re/go/core/io"
|
||||
)
|
||||
|
||||
manager, err := container.NewLinuxKitManager(io.Local)
|
||||
|
|
@ -54,8 +54,8 @@ fmt.Printf("Started container %s (PID %d)\n", c.ID, c.PID)
|
|||
|
||||
```go
|
||||
import (
|
||||
"forge.lthn.ai/core/go-container/devenv"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/container/devenv"
|
||||
"dappco.re/go/core/io"
|
||||
)
|
||||
|
||||
dev, err := devenv.New(io.Local)
|
||||
|
|
@ -77,7 +77,7 @@ err = dev.Test(ctx, "/path/to/project", devenv.TestOptions{})
|
|||
### Build and run from a LinuxKit template
|
||||
|
||||
```go
|
||||
import container "forge.lthn.ai/core/go-container"
|
||||
import container "dappco.re/go/core/container"
|
||||
|
||||
// List available templates (built-in + user-defined)
|
||||
templates := container.ListTemplates()
|
||||
|
|
@ -95,24 +95,24 @@ content, err := container.ApplyTemplate("core-dev", map[string]string{
|
|||
|
||||
| Package | Import path | Purpose |
|
||||
|---------|-------------|---------|
|
||||
| `container` (root) | `forge.lthn.ai/core/go-container` | Container struct, Manager interface, hypervisor abstraction, LinuxKit manager, state persistence, template engine |
|
||||
| `devenv` | `forge.lthn.ai/core/go-container/devenv` | Portable dev environment orchestration: boot, shell, serve, test, Claude sandbox, image management |
|
||||
| `sources` | `forge.lthn.ai/core/go-container/sources` | Image download backends: CDN and GitHub Releases with progress reporting |
|
||||
| `cmd/vm` | `forge.lthn.ai/core/go-container/cmd/vm` | CLI commands (`core vm run`, `core vm ps`, `core vm stop`, `core vm logs`, `core vm exec`, `core vm templates`) |
|
||||
| `container` (root) | `dappco.re/go/core/container` | Container struct, Manager interface, hypervisor abstraction, LinuxKit manager, state persistence, template engine |
|
||||
| `devenv` | `dappco.re/go/core/container/devenv` | Portable dev environment orchestration: boot, shell, serve, test, Claude sandbox, image management |
|
||||
| `sources` | `dappco.re/go/core/container/sources` | Image download backends: CDN and GitHub Releases with progress reporting |
|
||||
| `cmd/vm` | `dappco.re/go/core/container/cmd/vm` | CLI commands (`core vm run`, `core vm ps`, `core vm stop`, `core vm logs`, `core vm exec`, `core vm templates`) |
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
| Module | Purpose |
|
||||
|--------|---------|
|
||||
| `forge.lthn.ai/core/go-io` | File system abstraction (`Medium` interface), process utilities |
|
||||
| `dappco.re/go/core/io` | File system abstraction (`Medium` interface), process utilities |
|
||||
| `forge.lthn.ai/core/config` | Configuration loading (used by `devenv` for `~/.core/config.yaml`) |
|
||||
| `forge.lthn.ai/core/go-i18n` | Internationalised UI strings (used by `cmd/vm`) |
|
||||
| `dappco.re/go/core/i18n` | Internationalised UI strings (used by `cmd/vm`) |
|
||||
| `forge.lthn.ai/core/cli` | CLI framework (used by `cmd/vm` for command registration) |
|
||||
| `github.com/stretchr/testify` | Test assertions |
|
||||
| `gopkg.in/yaml.v3` | YAML parsing for test configuration |
|
||||
|
||||
The root `container` package has only two direct dependencies: `go-io` and the standard library. The `devenv` and `cmd/vm` packages pull in the heavier dependencies.
|
||||
The root `container` package has only two direct dependencies: `core/io` and the standard library. The `devenv` and `cmd/vm` packages pull in the heavier dependencies.
|
||||
|
||||
|
||||
## CLI commands
|
||||
|
|
|
|||
12
go.mod
12
go.mod
|
|
@ -1,20 +1,24 @@
|
|||
module forge.lthn.ai/core/go-container
|
||||
module dappco.re/go/core/container
|
||||
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
dappco.re/go/core/i18n v0.2.0
|
||||
dappco.re/go/core/io v0.2.0
|
||||
dappco.re/go/core/log v0.1.0
|
||||
forge.lthn.ai/core/cli v0.3.7
|
||||
forge.lthn.ai/core/config v0.1.8
|
||||
forge.lthn.ai/core/go-i18n v0.1.7
|
||||
forge.lthn.ai/core/go-io v0.1.7
|
||||
forge.lthn.ai/core/go-log v0.0.4
|
||||
github.com/stretchr/testify v1.11.1
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
dappco.re/go/core v0.5.0 // indirect
|
||||
forge.lthn.ai/core/go v0.3.3 // indirect
|
||||
forge.lthn.ai/core/go-i18n v0.1.7 // indirect
|
||||
forge.lthn.ai/core/go-inference v0.1.6 // indirect
|
||||
forge.lthn.ai/core/go-io v0.1.7 // indirect
|
||||
forge.lthn.ai/core/go-log v0.0.4 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/charmbracelet/bubbletea v1.3.10 // indirect
|
||||
github.com/charmbracelet/colorprofile v0.4.3 // indirect
|
||||
|
|
|
|||
8
go.sum
8
go.sum
|
|
@ -1,3 +1,11 @@
|
|||
dappco.re/go/core v0.5.0 h1:P5DJoaCiK5Q+af5UiTdWqUIW4W4qYKzpgGK50thm21U=
|
||||
dappco.re/go/core v0.5.0/go.mod h1:f2/tBZ3+3IqDrg2F5F598llv0nmb/4gJVCFzM5geE4A=
|
||||
dappco.re/go/core/i18n v0.2.0 h1:NHzk6RCU93/qVRA3f2jvMr9P1R6FYheR/sHL+TnvKbI=
|
||||
dappco.re/go/core/i18n v0.2.0/go.mod h1:9eSVJXr3OpIGWQvDynfhqcp27xnLMwlYLgsByU+p7ok=
|
||||
dappco.re/go/core/io v0.2.0 h1:zuudgIiTsQQ5ipVt97saWdGLROovbEB/zdVyy9/l+I4=
|
||||
dappco.re/go/core/io v0.2.0/go.mod h1:1QnQV6X9LNgFKfm8SkOtR9LLaj3bDcsOIeJOOyjbL5E=
|
||||
dappco.re/go/core/log v0.1.0 h1:pa71Vq2TD2aoEUQWFKwNcaJ3GBY8HbaNGqtE688Unyc=
|
||||
dappco.re/go/core/log v0.1.0/go.mod h1:Nkqb8gsXhZAO8VLpx7B8i1iAmohhzqA20b9Zr8VUcJs=
|
||||
forge.lthn.ai/core/cli v0.3.7 h1:1GrbaGg0wDGHr6+klSbbGyN/9sSbHvFbdySJznymhwg=
|
||||
forge.lthn.ai/core/cli v0.3.7/go.mod h1:DBUppJkA9P45ZFGgI2B8VXw1rAZxamHoI/KG7fRvTNs=
|
||||
forge.lthn.ai/core/config v0.1.8 h1:xP2hys7T94QGVF/OTh84/Zr5Dm/dL/0vzjht8zi+LOg=
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// Hypervisor defines the interface for VM hypervisors.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# go-container
|
||||
|
||||
Module: `forge.lthn.ai/core/go-container`
|
||||
Module: `dappco.re/go/core/container`
|
||||
|
||||
Container runtime for managing LinuxKit VMs as lightweight containers. Supports running LinuxKit images (ISO, qcow2, vmdk, raw) via QEMU or Hyperkit hypervisors. Includes a dev environment system for Claude Code agents and development workflows.
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ Container runtime for managing LinuxKit VMs as lightweight containers. Supports
|
|||
## Usage
|
||||
|
||||
```go
|
||||
import "forge.lthn.ai/core/go-container"
|
||||
import "dappco.re/go/core/container"
|
||||
|
||||
// Auto-detect hypervisor
|
||||
hv, _ := container.DetectHypervisor()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Hypervisors
|
||||
|
||||
Module: `forge.lthn.ai/core/go-container`
|
||||
Module: `dappco.re/go/core/container`
|
||||
|
||||
## Interface
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// LinuxKitManager implements the Manager interface for LinuxKit VMs.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/io"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// CDNSource downloads images from a CDN or S3 bucket.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/io"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import (
|
|||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// GitHubSource downloads images from GitHub Releases.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
// Package sources provides image download sources for go-container.
|
||||
// Package sources provides image download sources for container.
|
||||
package sources
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/io"
|
||||
)
|
||||
|
||||
// ImageSource defines the interface for downloading dev images.
|
||||
|
|
|
|||
2
state.go
2
state.go
|
|
@ -6,7 +6,7 @@ import (
|
|||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"dappco.re/go/core/io"
|
||||
)
|
||||
|
||||
// State manages persistent container state.
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import (
|
|||
"slices"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go-io"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
"dappco.re/go/core/io"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
//go:embed templates/*.yml
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue