Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Execute() {
}

func NewRootCommand() *cobra.Command {
root := &cobra.Command{Use: "prophet", Short: "Prophet facade CLI", SilenceUsage: true}
root := &cobra.Command{Use: "prophet", Short: "Prophet façade CLI", SilenceUsage: true}
root.PersistentFlags().StringVar(&flags.Profile, "profile", "", "named profile")
root.PersistentFlags().StringVar(&flags.Space, "space", "", "execution space")
root.PersistentFlags().StringVarP(&flags.Output, "output", "o", "text", "output format")
Expand All @@ -38,11 +38,12 @@ func NewRootCommand() *cobra.Command {
root.PersistentFlags().BoolVar(&flags.NoPager, "no-pager", false, "disable pager")
root.AddCommand(
newBootstrapCmd(),
newVocabCmd(),
newA2ACmd(),
newPlaceholderCmd("ask", "Agent assist: explain or inspect without mutating state"),
newPlaceholderCmd("plan", "Agent assist: generate a plan over deterministic tools"),
newPlaceholderCmd("agent", "Agent execute facade"),
newPlaceholderCmd("mcp", "MCP boundary facade"),
newPlaceholderCmd("agent", "Agent execute façade (approval-gated scaffold)"),
newPlaceholderCmd("mcp", "MCP boundary façade"),
)
return root
}
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ func TestRootCommandHasExpectedTopLevelCommands(t *testing.T) {
root := NewRootCommand()
want := map[string]bool{
"bootstrap": false,
"vocab": false,
"a2a": false,
"ask": false,
"plan": false,
Expand Down
57 changes: 57 additions & 0 deletions internal/cmd/vocab.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package cmd

import "github.com/spf13/cobra"

func newVocabCmd() *cobra.Command {
cmd := &cobra.Command{Use: "vocab", Short: "Ontogenesis vocabulary and policy-pack façade"}
cmd.AddCommand(
newVocabLeaf("fetch", "fetch or refresh Ontogenesis semantic assets"),
&cobra.Command{Use: "validate [graph-path ...]", Short: "Run Ontogenesis semantic-core validation", Args: cobra.ArbitraryArgs, RunE: func(cmd *cobra.Command, args []string) error {
return emit(map[string]any{
"command": "prophet vocab validate",
"graph_paths": args,
"delegated_to": "socioprophet-standards-knowledge",
"validator": "policy/tools/validate_all.py",
"status": "scaffold",
})
}},
&cobra.Command{Use: "promote", Short: "Promote the current validated context set", RunE: func(cmd *cobra.Command, args []string) error {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject unexpected positional args for promote

The promote subcommand sets RunE without an Args validator, so Cobra will accept extra positional arguments and still return success (for example, prophet vocab promote typo). That makes automation and operator mistakes hard to detect because invalid invocations look successful. Adding Args: cobra.NoArgs here (and similarly on other no-arg verbs like sr gate) would make this command fail fast on malformed input.

Useful? React with 👍 / 👎.

return emit(map[string]any{
"command": "prophet vocab promote",
"delegated_to": "socioprophet-standards-knowledge",
"record_target": "/ontology/promotions/<ts>.jsonld",
"status": "scaffold",
})
}},
newVocabSRCmd(),
)
return cmd
}

func newVocabSRCmd() *cobra.Command {
cmd := &cobra.Command{Use: "sr", Short: "Symbolic regression façade over Ontogenesis runners"}
cmd.AddCommand(
&cobra.Command{Use: "run <module>", Short: "Extract, train, and register SR for a module", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error {
return emit(map[string]any{
"command": "prophet vocab sr run",
"module": args[0],
"delegated_to": "socioprophet-standards-knowledge",
"status": "scaffold",
})
}},
&cobra.Command{Use: "gate", Short: "Evaluate SR promotion thresholds", RunE: func(cmd *cobra.Command, args []string) error {
return emit(map[string]any{
"command": "prophet vocab sr gate",
"delegated_to": "socioprophet-standards-knowledge",
"status": "scaffold",
})
}},
)
return cmd
}

func newVocabLeaf(name, summary string) *cobra.Command {
return &cobra.Command{Use: name, Short: summary, RunE: func(cmd *cobra.Command, args []string) error {
return emit(map[string]any{"command": "prophet vocab " + name, "summary": summary, "delegated_to": "socioprophet-standards-knowledge", "status": "scaffold"})
}}
}
23 changes: 23 additions & 0 deletions internal/cmd/vocab_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import "testing"

func TestVocabCommandHasExpectedSubcommands(t *testing.T) {
cmd := newVocabCmd()
want := map[string]bool{
"fetch": false,
"validate": false,
"promote": false,
"sr": false,
}
for _, c := range cmd.Commands() {
if _, ok := want[c.Name()]; ok {
want[c.Name()] = true
}
}
for name, seen := range want {
if !seen {
t.Fatalf("missing vocab subcommand: %s", name)
}
}
}
Loading