feat: add documents duplicate command for template instantiation (#40)#47
Merged
Conversation
Adds `huly documents duplicate DOC_ID --title "..."` which compresses the four-to-five-step template-instantiation workflow (describe → save → create → set-file → re-parent) into a single command. Reuses existing CRUD and content paths — `--space` / `--parent` override the source's inherited space and parent respectively, `--json` returns the full new record. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ents-duplicate # Conflicts: # skills/huly-cli/SKILL.md
…ents-duplicate # Conflicts: # skills/huly-cli/SKILL.md
…ents-duplicate # Conflicts: # README.md
…ents-duplicate # Conflicts: # README.md # skills/huly-cli/SKILL.md # src/huly_cli/commands/documents.py
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a new
huly documents duplicate DOC_ID --title "..."subcommand that compresses the 4-5 step template-instantiation workflow (describe → save → create → set-file → re-parent) into a single command. Inherits the source's space and parent by default;--spaceor--parentoverride either.Changes
src/huly_cli/commands/documents.pyduplicateTyper command. Internally composes existing CRUD:_find_document_by_id(source + re-fetch),_resolve_teamspace_by_name(only when--spaceis passed — branches cleanly to avoid resolving the already-ID source space),client.txfor the create, then the same create-content + update-tx pathdescribe --set-fileuses._read_doc_markdown(client, doc)and_write_markdown_to_doc(client, auth, doc, md)— so bothdescribeandduplicateshare the inline-vs-blob read path and the create-content write path.describe --setnow delegates to_write_markdown_to_doc.client.py,markup.py, oroutput.py.tests/test_issue_write_path.pyCliRunnercommand-layer tests covering: inherited space+parent,--spaceoverride (teamspace name resolution),--parentoverride,--jsonfull-record return, source-not-found error, missing--title(required option), and that the content copy path usescreate_content(notset_content) against a brand-new empty doc.--jsontests).README.md— addsdocuments duplicateto the example command block plus a one-paragraph note on inheritance behavior.skills/huly-cli/SKILL.md— listsduplicatein the documents command surface and adds a short "clone the weekly template" agent workflow example.Test plan
uv run pytest -x— 273 tests pass (7 new)uv run ruff format . && uv run ruff check .— cleangit diff master --stat— only the four allowed files touched; no changes toclient.py,markup.py,output.py, or unrelated command modules.--json, not-found, missing-title, and that new-doc content is written throughcreate_content(notset_content).Closes #40