refactor(service_spec_gen): split into 6 packages (types, client, config, normalize, spec, main) + .gitignore

- Split 741-line monolith into 6 independent packages
- All functions exported, no circular deps
- Build: go build -o bin/service_spec_gen ./tools/service_spec_gen/
- Script 01_generate_yamls.sh: go run → ./bin/service_spec_gen
- Add bin/ to .gitignore
This commit is contained in:
“Naeel”
2026-07-05 09:27:25 +04:00
parent 20bb7bc0e9
commit 87666f5c4b
9 changed files with 750 additions and 747 deletions
@@ -0,0 +1,33 @@
// Package spec — построение YAML-спецификации сервиса.
package spec
import (
"fmt"
"path/filepath"
"strings"
"terraform-provider-nubes/tools/service_spec_gen/types"
)
// DefaultOutputParams возвращает стандартный набор выходных параметров.
func DefaultOutputParams() []types.OutputParam {
return []types.OutputParam{
{Code: "state_params", Type: "map"},
{Code: "state_out", Type: "map"},
{Code: "state_params_flat", Type: "map"},
{Code: "state_out_flat", Type: "map"},
{Code: "vault_secrets", Type: "map", Sensitive: true},
{Code: "vault_url", Type: "string"},
{Code: "vault_user_path", Type: "string"},
{Code: "vault_fields", Type: "list"},
}
}
// ValidateOutputDir проверяет, что выходная директория не legacy resources_ops_yaml.
func ValidateOutputDir(path string) error {
base := strings.ToLower(strings.TrimSpace(filepath.Base(path)))
if base == "resources_ops_yaml" {
return fmt.Errorf("invalid output dir %q: use resources_yaml for unified service specs", path)
}
return nil
}