2026-01-30 00:22:47 +00:00
|
|
|
package ci
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os"
|
|
|
|
|
|
2026-01-31 11:39:19 +00:00
|
|
|
"github.com/host-uk/core/pkg/cli"
|
feat(i18n): add translation keys to all CLI commands
Replace hardcoded strings with i18n.T() calls across all cmd/* packages:
- ai, build, ci, dev, docs, doctor, go, php, pkg, sdk, setup, test, vm
Adds 500+ translation keys to en.json for command descriptions,
flag descriptions, labels, messages, and error strings.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 02:37:57 +00:00
|
|
|
"github.com/host-uk/core/pkg/i18n"
|
2026-01-30 00:22:47 +00:00
|
|
|
"github.com/host-uk/core/pkg/release"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func runCIReleaseInit() error {
|
2026-01-31 23:36:43 +00:00
|
|
|
cwd, err := os.Getwd()
|
2026-01-30 00:22:47 +00:00
|
|
|
if err != nil {
|
2026-01-31 23:36:43 +00:00
|
|
|
return cli.Err("%s: %w", i18n.T("i18n.fail.get", "working directory"), err)
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
cli.Print("%s %s\n\n", releaseDimStyle.Render(i18n.Label("init")), i18n.T("cmd.ci.init.initializing"))
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
// Check if already initialized
|
|
|
|
|
if release.ConfigExists(cwd) {
|
|
|
|
|
cli.Text(i18n.T("cmd.ci.init.already_initialized"))
|
|
|
|
|
return nil
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
// Create release config
|
|
|
|
|
cfg := release.DefaultConfig()
|
|
|
|
|
if err := release.WriteConfig(cfg, cwd); err != nil {
|
|
|
|
|
return cli.Err("%s: %w", i18n.T("i18n.fail.create", "config"), err)
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
cli.Blank()
|
|
|
|
|
cli.Print("%s %s\n", releaseSuccessStyle.Render("v"), i18n.T("cmd.ci.init.created_config"))
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
// Templates init removed as functionality not exposed
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
cli.Blank()
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
cli.Text(i18n.T("cmd.ci.init.next_steps"))
|
|
|
|
|
cli.Print(" %s\n", i18n.T("cmd.ci.init.edit_config"))
|
|
|
|
|
cli.Print(" %s\n", i18n.T("cmd.ci.init.run_ci"))
|
2026-01-30 00:22:47 +00:00
|
|
|
|
|
|
|
|
return nil
|
2026-01-31 23:36:43 +00:00
|
|
|
}
|