feat(assets): wire builder into dispatch, shim, smoke, docs
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"os"
|
||||
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/app"
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/assets"
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/buildinfo"
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/depot"
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/menu"
|
||||
@@ -103,6 +104,21 @@ var Registry = []Builder{
|
||||
},
|
||||
Wired: true,
|
||||
},
|
||||
{
|
||||
Name: "assets",
|
||||
Bin: "crucible-assets",
|
||||
Summary: "compile/convert/upscale NWN assets + mdl/dupe integrity",
|
||||
Commands: []Command{
|
||||
{Name: "compile", Summary: "compile ASCII .mdl models to binary in place", Usage: "crucible assets compile [--nwn INSTALL] [--non-recursive] <dir>..."},
|
||||
{Name: "convert", Summary: "convert textures to/from NWN DDS (flips vertically)", Usage: "crucible assets convert [--to dds|png|tga] [--backend PATH] [--non-recursive] <dir>..."},
|
||||
{Name: "upscale", Summary: "upscale textures through an installed backend", Usage: "crucible assets upscale [--scale N] [--backend PATH] [--non-recursive] <dir>..."},
|
||||
{Name: "check-mdl", Summary: "report uncompiled ASCII .mdl and model-name mismatches", Usage: "crucible assets check-mdl <path>..."},
|
||||
{Name: "fix-mdl", Summary: "lowercase .mdl names and rewrite model identity to match", Usage: "crucible assets fix-mdl [--dry-run] <path>..."},
|
||||
{Name: "check-dupes", Summary: "report runtime-name (basename) collisions across dirs", Usage: "crucible assets check-dupes <dir>..."},
|
||||
{Name: "clean-dupes", Summary: "delete clean-tree files whose basename collides with primary", Usage: "crucible assets clean-dupes [--dry-run] <primary> <clean>"},
|
||||
},
|
||||
Wired: true,
|
||||
},
|
||||
{
|
||||
Name: "hak",
|
||||
Bin: "crucible-hak",
|
||||
@@ -375,11 +391,16 @@ func runBuilder(name string, args []string, out, errw io.Writer) int {
|
||||
return exitOK
|
||||
}
|
||||
}
|
||||
if b.Name == "depot" && b.Wired {
|
||||
// depot parses its own subcommand (status/push/verify/get/pull) and
|
||||
// has its own richer exit contract (0/1/2/64/70), so it bypasses the
|
||||
// b.Commands/delegateLegacy routing entirely.
|
||||
return depot.Run(args, out, errw, os.Getenv)
|
||||
if b.Wired {
|
||||
// depot and assets are self-contained builders: they parse their own
|
||||
// subcommands and own their exit contract, bypassing the
|
||||
// b.Commands/delegateLegacy legacy routing entirely.
|
||||
switch b.Name {
|
||||
case "depot":
|
||||
return depot.Run(args, out, errw, os.Getenv)
|
||||
case "assets":
|
||||
return assets.Run(args, out, errw, os.Getenv)
|
||||
}
|
||||
}
|
||||
if !b.Wired {
|
||||
// No migrated logic yet (depot): fail closed, never fake an artifact.
|
||||
|
||||
@@ -151,6 +151,7 @@ func TestBuilderHelpIsOK(t *testing.T) {
|
||||
func TestCanonicalCommandSurface(t *testing.T) {
|
||||
want := map[string][]string{
|
||||
"depot": {"status", "push", "verify", "get", "pull"},
|
||||
"assets": {"compile", "convert", "upscale", "check-mdl", "fix-mdl", "check-dupes", "clean-dupes"},
|
||||
"hak": {"build", "manifest"},
|
||||
"module": {"build", "extract", "validate", "compare", "manifest"},
|
||||
"topdata": {"validate", "build", "package", "compare", "convert"},
|
||||
@@ -172,10 +173,10 @@ func TestRegistryCommandNamesAndAliasesAreUnambiguous(t *testing.T) {
|
||||
for _, builder := range Registry {
|
||||
seen := map[string]bool{}
|
||||
for _, command := range builder.Commands {
|
||||
// depot parses its own subcommands and bypasses AppCommand routing
|
||||
// entirely (see the depot special-case in runBuilder), so its
|
||||
// Commands carry no AppCommand.
|
||||
requireAppCommand := builder.Name != "depot"
|
||||
// depot and assets parse their own subcommands and bypass AppCommand
|
||||
// routing entirely (see the self-contained-builder branch in
|
||||
// runBuilder), so their Commands carry no AppCommand.
|
||||
requireAppCommand := builder.Name != "depot" && builder.Name != "assets"
|
||||
if command.Name == "" || command.Summary == "" || command.Usage == "" || (requireAppCommand && command.AppCommand == "") {
|
||||
t.Errorf("%s has incomplete command metadata: %#v", builder.Name, command)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user