-
Notifications
You must be signed in to change notification settings - Fork 0
feat(cmd): add vocab façade command surface #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bf7410e
add vocab command scaffold
mdheller f0315f6
feat(cmd): add vocab runtime plumbing
mdheller 3866cf9
Merge pull request #12 from SocioProphet/feat/vocab-runtime-plumbing
mdheller b587da6
Initial plan noted
Copilot ef0d2b7
Merge branch 'main' into feat/vocab-surface
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { | ||
| 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"}) | ||
| }} | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
promotesubcommand setsRunEwithout anArgsvalidator, 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. AddingArgs: cobra.NoArgshere (and similarly on other no-arg verbs likesr gate) would make this command fail fast on malformed input.Useful? React with 👍 / 👎.