Repository navigation
feat(help): show settable fields with types in create/update --help and get noun - #523
Conversation
| if !cs.BuiltinFlags.Set || (cs.Verb != VerbCreate && cs.Verb != VerbUpdate) { | ||
| return cs.Long | ||
| } | ||
| noun := cs.FullNoun() |
There was a problem hiding this comment.
cs.FullNoun() returns loadtest:from_json and loadtest:from_template, but the registry stores their fields under loadtest. Both create variants accept the base noun’s --set fields at runtime yet omit the new help block because the lookup returns no noun.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| if cs.FieldsNoun != "" { | ||
| noun = cs.FieldsNoun | ||
| } | ||
| fields := MutableFieldsFor(r.GetNoun(noun), cs.Verb) |
There was a problem hiding this comment.
The noun schema is not the input contract for commands that build their own request bodies: create pr --help omits is_draft even though createPRBodyFn reads it, and advertises --del even though that function ignores deletions. Likewise, update loadtest_run --help labels target_users and spawn_rate as scalar even though its body expressions require an integer and a float, respectively.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| Use: use, | ||
| Short: cs.Short, | ||
| Long: cs.Long, | ||
| Long: r.longWithSettableFields(cs), |
There was a problem hiding this comment.
buildAliasCmd still uses cs.Long, so update repo --help omits the field list that update repository --help shows, even though both aliases accept the same fields.
Severity: low
🤖 Was this useful? React with 👍 or 👎
| } | ||
| var verbs []string | ||
| for _, v := range []string{"create", "update"} { | ||
| if nc := cmdByVerb[v]; nc != nil && nc.cs.BuiltinFlags.Set && f.MutableOnVerb(v) { |
There was a problem hiding this comment.
editableNote sees only bare create and update entries, and GetNounHandler only supplies fields from bare get and list commands. For get noun repo_settings, that means the output lists create repo_settings:aicr and update repo_settings:aicr but shows none of their writable fields or types, such as connector_path and system_prompt.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| return cmd | ||
| } | ||
|
|
||
| // longWithSettableFields appends the settable-fields block to the help of a |
There was a problem hiding this comment.
The longWithSettableFields comment repeats the function name and its guard rather than documenting a non-obvious constraint, which the Comments section of AGENTS.md asks us to avoid. Other locations where this applies: pkg/registry/fields.go:183 and modules/core/mgmt/nouns_verbs.go:114.
Severity: low
🤖 Was this useful? React with 👍 or 👎
Part 2 of #508 / #439 (core only). Stacked on #522.
Agents had to run
--list-fieldsto learn which fields--setaccepts and their value shapes.create/update--help(commands with--set) get a block of that verb's settable fields with their type; scoped fields are tagged:long, the short text is kept above the block.get nounreplaces(editable)with(editable: create, update; <type>). Verbs listed are the noun's create/update commands that accept--setand where the field is writable; it falls back to(editable)when none do.spec.FieldDef.TypeLabel()gives the type (scalarwhen unset);--list-fieldsuses it too.get moduleis unchanged.Checked by building the binary:
update repository --help,create repository --help,update feature_flag --helpandget noun repository. No spec usesmutable_onyet, so(create only)is covered by unit tests, not a real command.Tests: help-block test with a scoped field and a command without
--set;get nounnote test;go test ./pkg/... ./modules/...passes.Not decided: the block is always printed, so a noun with many mutable fields (e.g.
fme) gets a long help.