Repository navigation
Add entry clone and delete, tool section removal, and the matching CLI commands - #52
nicoloesch wants to merge 8 commits into
Conversation
86de69c to
5050a16
Compare
5050a16 to
987bd0c
Compare
987bd0c to
2a330c7
Compare
…ed secrets in prompts
34418ad to
e094a35
Compare
gkennos
left a comment
There was a problem hiding this comment.
approving with open very minor issue that you can track with new issue and get releasing I think that's more important than iterating again?
| choice = typer.prompt( | ||
| " Point to an existing entry, or 'new' to create one", default=suggested | ||
| ) | ||
| if choice != "new" and choice in candidates: |
There was a problem hiding this comment.
Minor clone-wizard quirk: after choosing new for a nested reference, pressing Enter accepts the existing reference’s name and reuses it instead of creating a new entry. Entering a distinct name works.
Suggested fix is to leave the new-name prompt blank by default, or reject an already-used name after the user chose new.
There was a problem hiding this comment.
Agreed, folded it in here since we were already in this function. Choosing new now only offers the default name while it is free, and a name that already exists is asked for again, so it can no longer silently reuse an entry. Added a test for it (683728c). Re-requesting review since the change is small.
Summary
Adds
clone_entryanddelete_entryas library functions, withcloneanddeletecommands for every entry section. Also addsremove_tool_sectionwithtools listandtools remove, so a stale[tools.*]section no longer blocks deletes.Changes
references.pyclone_entry(..., overrides=None)copies an entry under a new name and appends it to the section. The source is kept and nothing is repointed.overrideschanges fields of the copy and is validated by the entry's class.delete_entryremoves an entry only when nothing references it. It lists the referencing fields, counts package fields that refer through their default, including packages with no section, and refuses when a tool section has no known package class. There is no force option.remove_tool_sectionremoves one[tools.*]section. It needs no package class.rename_entry. A rejected candidate is reported from sanitized errors, so no value appears in the message.<section> clone NAME NEW_NAMEfor connections, providers, models and vector-stores, anddatabases clone cdmanddatabases clone generic. For example,omop-config connections clone prod testcreates[connections.test]from[connections.prod]. Flags change the copy. Without flags every field is prompted with the source value as the default.newstarts from the entry the source currently points at.<section> delete NAMEconfirms first, or skips the prompt with--yes. When a tool section's package is unusable it prints why and points totools remove.tools listandtools remove NAME.addon an existing entry as well. Enter keeps the stored value.docs/api/stack-config.md. Add library and CLI tests, including a test that fails without the secret fix.Behaviour
save_stack_config.addandconfigureprompts no longer print a stored password.clone,deleteandtools removerefuse to save over a change made to the file after they read it, likeaddandconfigure.deleterefuses while a tool section's package is broken or missing. Remove that section withtools remove, or fix the install.Checklist
feature)pytest -q): 729 passedruff check .,ty check src/ tests/)