2026-01-30 00:22:47 +00:00
|
|
|
package ci
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bufio"
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
|
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"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// runCIReleaseInit creates a release configuration interactively.
|
|
|
|
|
func runCIReleaseInit() error {
|
|
|
|
|
projectDir, err := os.Getwd()
|
|
|
|
|
if err != nil {
|
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
|
|
|
return fmt.Errorf("%s: %w", i18n.T("cmd.ci.error.working_dir"), err)
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if config already exists
|
|
|
|
|
if release.ConfigExists(projectDir) {
|
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
|
|
|
fmt.Printf("%s %s %s\n",
|
|
|
|
|
releaseDimStyle.Render(i18n.T("cmd.ci.label.note")),
|
|
|
|
|
i18n.T("cmd.ci.init.config_exists"),
|
2026-01-30 00:22:47 +00:00
|
|
|
release.ConfigPath(projectDir))
|
|
|
|
|
|
|
|
|
|
reader := bufio.NewReader(os.Stdin)
|
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
|
|
|
fmt.Print(i18n.T("cmd.ci.init.overwrite_prompt"))
|
2026-01-30 00:22:47 +00:00
|
|
|
response, _ := reader.ReadString('\n')
|
|
|
|
|
response = strings.TrimSpace(strings.ToLower(response))
|
|
|
|
|
if response != "y" && response != "yes" {
|
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
|
|
|
fmt.Println(i18n.T("cli.confirm.abort"))
|
2026-01-30 00:22:47 +00:00
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
fmt.Printf("%s %s\n", releaseHeaderStyle.Render(i18n.T("cmd.ci.label.init")), i18n.T("cmd.ci.init.creating"))
|
2026-01-30 00:22:47 +00:00
|
|
|
fmt.Println()
|
|
|
|
|
|
|
|
|
|
reader := bufio.NewReader(os.Stdin)
|
|
|
|
|
|
|
|
|
|
// Project name
|
|
|
|
|
defaultName := filepath.Base(projectDir)
|
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
|
|
|
fmt.Printf("%s [%s]: ", i18n.T("cmd.ci.init.project_name"), defaultName)
|
2026-01-30 00:22:47 +00:00
|
|
|
name, _ := reader.ReadString('\n')
|
|
|
|
|
name = strings.TrimSpace(name)
|
|
|
|
|
if name == "" {
|
|
|
|
|
name = defaultName
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Repository
|
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
|
|
|
fmt.Printf("%s ", i18n.T("cmd.ci.init.github_repo"))
|
2026-01-30 00:22:47 +00:00
|
|
|
repo, _ := reader.ReadString('\n')
|
|
|
|
|
repo = strings.TrimSpace(repo)
|
|
|
|
|
|
|
|
|
|
// Create config
|
|
|
|
|
cfg := release.DefaultConfig()
|
|
|
|
|
cfg.Project.Name = name
|
|
|
|
|
cfg.Project.Repository = repo
|
|
|
|
|
|
|
|
|
|
// Write config
|
|
|
|
|
if err := release.WriteConfig(cfg, projectDir); err != nil {
|
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
|
|
|
return fmt.Errorf("%s: %w", i18n.T("cmd.ci.error.write_config"), err)
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Println()
|
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
|
|
|
fmt.Printf("%s %s %s\n",
|
|
|
|
|
releaseSuccessStyle.Render(i18n.T("cmd.ci.label.success")),
|
|
|
|
|
i18n.T("cmd.ci.init.config_written"),
|
2026-01-30 00:22:47 +00:00
|
|
|
release.ConfigPath(projectDir))
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|