[agent/claude:opus] DX audit and fix. 1) Review CLAUDE.md — update any outdate... #3
8 changed files with 31 additions and 19 deletions
|
|
@ -21,15 +21,16 @@ Most implementation code (ansible engine, build system, infra clients, release p
|
|||
|
||||
### Package Layout
|
||||
|
||||
- **`cmd/dev/`** — Multi-repo developer commands registered under `core dev`. The main CLI surface (~4,400 LOC across 21 files).
|
||||
- **`cmd/dev/`** — Multi-repo developer commands registered under `core dev`. The main CLI surface (~4,700 LOC across 21 files).
|
||||
- **`cmd/deploy/`** — `core deploy servers` — Coolify PaaS server/app listing.
|
||||
- **`cmd/docs/`** — `core docs sync` — Documentation sync across the multi-repo workspace.
|
||||
- **`cmd/setup/`** — `core setup repo` — Generate `.core` configuration for a project.
|
||||
- **`cmd/gitcmd/`** — Git helper commands.
|
||||
- **`cmd/gitcmd/`** — Git helper commands (mirrors dev commands under `core git`).
|
||||
- **`cmd/vanity-import/`** — Vanity import path server (the default build target in `.core/build.yaml`).
|
||||
- **`cmd/community/`** — Community-related commands.
|
||||
- **`cmd/community/`** — Community landing page assets.
|
||||
- **`deploy/coolify/`** — Coolify PaaS API HTTP client.
|
||||
- **`deploy/python/`** — Embedded Python 3.13 runtime wrapper (adds ~50 MB to binary).
|
||||
- **`locales/`** — Embedded i18n translation files (en.json).
|
||||
- **`snapshot/`** — `core.json` release manifest generation.
|
||||
- **`playbooks/`** — Ansible YAML playbooks for production infrastructure (Galera, Redis). Executed by the native Go Ansible engine, not `ansible-playbook`.
|
||||
|
||||
|
|
@ -81,7 +82,7 @@ Configuration lives in `.core/build.yaml` (targets, ldflags) and `.core/release.
|
|||
- **Co-Author**: `Co-Authored-By: Virgil <virgil@lethean.io>`
|
||||
- **Licence**: EUPL-1.2
|
||||
- **Imports**: stdlib → forge.lthn.ai → third-party, each group separated by blank line
|
||||
- **Errors**: `core.E()` for contextual errors, or `fmt.Errorf("%w", err)` for wrapping
|
||||
- **Errors**: `log.E(op, msg, err)` from `go-log` for all contextual errors (never `fmt.Errorf` or `errors.New`)
|
||||
|
||||
## Forge
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ package deploy
|
|||
|
||||
import (
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-devops/locales"
|
||||
|
||||
_ "forge.lthn.ai/core/go-devops/locales"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cli.RegisterCommands(AddDeployCommands, locales.FS)
|
||||
cli.RegisterCommands(AddDeployCommands)
|
||||
}
|
||||
|
||||
// AddDeployCommands registers the 'deploy' command and all subcommands.
|
||||
|
|
|
|||
|
|
@ -34,12 +34,13 @@ package dev
|
|||
|
||||
import (
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-devops/locales"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
|
||||
_ "forge.lthn.ai/core/go-devops/locales"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cli.RegisterCommands(AddDevCommands, locales.FS)
|
||||
cli.RegisterCommands(AddDevCommands)
|
||||
}
|
||||
|
||||
// Style aliases from shared package
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@ package docs
|
|||
|
||||
import (
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-devops/locales"
|
||||
|
||||
_ "forge.lthn.ai/core/go-devops/locales"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cli.RegisterCommands(AddDocsCommands, locales.FS)
|
||||
cli.RegisterCommands(AddDocsCommands)
|
||||
}
|
||||
|
||||
// AddDocsCommands registers the 'docs' command and all subcommands.
|
||||
|
|
|
|||
|
|
@ -25,12 +25,13 @@ package setup
|
|||
|
||||
import (
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-devops/locales"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
|
||||
_ "forge.lthn.ai/core/go-devops/locales"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cli.RegisterCommands(AddSetupCommands, locales.FS)
|
||||
cli.RegisterCommands(AddSetupCommands)
|
||||
}
|
||||
|
||||
// AddSetupCommands registers the 'setup' command and all subcommands.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package coolify
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
|
|
@ -78,7 +77,7 @@ func (c *Client) Call(ctx context.Context, operationID string, params map[string
|
|||
}
|
||||
output, err := python.RunScript(ctx, script)
|
||||
if err != nil {
|
||||
return nil, log.E("coolify", fmt.Sprintf("API call %s failed", operationID), err)
|
||||
return nil, log.E("coolify", "API call "+operationID+" failed", err)
|
||||
}
|
||||
|
||||
// Parse JSON result
|
||||
|
|
@ -89,7 +88,7 @@ func (c *Client) Call(ctx context.Context, operationID string, params map[string
|
|||
if err2 := json.Unmarshal([]byte(output), &arrResult); err2 == nil {
|
||||
return map[string]any{"result": arrResult}, nil
|
||||
}
|
||||
return nil, log.E("coolify", fmt.Sprintf("failed to parse response (output: %s)", output), err)
|
||||
return nil, log.E("coolify", "failed to parse response (output: "+output+")", err)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ func RunScript(ctx context.Context, code string, args ...string) (string, error)
|
|||
// Run with context
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
// Try to get stderr for better error message
|
||||
// Include stderr in the error message for better diagnostics
|
||||
if exitErr, ok := err.(*exec.ExitError); ok {
|
||||
return "", log.E("python", "run script", fmt.Errorf("%w: %s", err, string(exitErr.Stderr)))
|
||||
return "", log.E("python", "run script: "+string(exitErr.Stderr), err)
|
||||
}
|
||||
return "", log.E("python", "run script", err)
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ func RunModule(ctx context.Context, module string, args ...string) (string, erro
|
|||
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return "", log.E("python", fmt.Sprintf("run module %s", module), err)
|
||||
return "", log.E("python", "run module "+module, err)
|
||||
}
|
||||
|
||||
return string(output), nil
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
// Package locales embeds translation files for the go-devops module.
|
||||
package locales
|
||||
|
||||
import "embed"
|
||||
import (
|
||||
"embed"
|
||||
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
)
|
||||
|
||||
//go:embed *.json
|
||||
var FS embed.FS
|
||||
|
||||
func init() {
|
||||
i18n.RegisterLocales(FS, ".")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue