Capture and validate invocation features

This commit is contained in:
2026-11-22 20:52:04 +00:00
parent 68515668de
commit ea3ce25001
8 changed files with 276 additions and 2 deletions

View File

@@ -71,6 +71,7 @@ type commandRecord struct {
summary string
description string
children []Command
features []InvocationFeature
payload commandPayload
issues []error
rootOnly bool
@@ -467,6 +468,15 @@ func validateCommandPlacement(command Command) error {
issues = append(issues, issue)
}
}
for _, feature := range record.features {
if feature.record == nil {
issues = append(issues, fmt.Errorf("command %q: invalid zero invocation feature", record.name))
continue
}
for _, issue := range feature.record.issues {
issues = append(issues, fmt.Errorf("command %q invocation feature: %w", record.name, issue))
}
}
if record.rootOnly && !root {
issues = append(issues, fmt.Errorf("root-only command %q is nested beneath another command", label))
}