Repository navigation
feat: add --content support to cards update and pages update - #66
Conversation
Implement card and page content updates via the documented PUT endpoints:
- PUT /{team_id}/cards/{card_id}/content
- PUT /{team_id}/pages/{page_id}/content
The standard PATCH endpoints for cards and pages do not support content
changes — content is managed through separate PUT endpoints that proxy
to the collaboration server.
Changes:
- Add put_object helper to Resources::Base
- Add Cards#update_content resource method
- Add Pages#update_content resource method
- Add --content option to 'suth cards update' CLI command
- Add --content option to 'suth pages update' CLI command
- Add stub_api_put test helper
- Add specs for Cards#update_content
- Update CLI skill documentation
API docs:
- Cards: https://superthread.com/docs/api-docs/cards/replace-a-card-description
- Pages: https://superthread.com/docs/api-docs/pages/replace-a-page-description
|
Nice! Thanks for this. The API endpoint didn't exist when I first started writing this CLI tool so I'm glad you picked up on it. I'll review this today. I'll also take another look at all the API endpoints to see if there are any other new/updated ones that can be implemented. |
steveclarke
left a comment
There was a problem hiding this comment.
Really solid work here — the PUT/PATCH separation is clean, the docs and skill file updates are thorough, and the mention support in content is a nice touch. Just one bug to fix and a couple of small suggestions.
One more thing that's not in the diff so I can't comment inline: since Cards#update_content runs format_mentions, it might be worth adding card content to the Mentions section in the skill file where it lists "comments, replies, and checklist items." Up to you.
| card = client.cards.update(workspace_id, card_id, **opts) | ||
| # Update other fields via PATCH (skip if only content was provided) | ||
| has_patch_fields = options[:title] || options[:list] || options[:priority] || | ||
| options[:archived] || options[:epic] || options[:position] || options[:sprint] |
There was a problem hiding this comment.
The truthy check here means --no-archived gets silently skipped. When Thor sees --no-archived it sets options[:archived] to false, which is falsy, so has_patch_fields evaluates to false and the PATCH never fires.
Should be !options[:archived].nil? instead of options[:archived]. Same thing applies in pages.rb with both :archived and :is_public.
| end | ||
| end | ||
|
|
||
| describe "#update_content" do |
There was a problem hiding this comment.
Would you mind adding a matching spec for Pages#update_content too? Doesn't need to be elaborate — just verifying the PUT goes to the right endpoint with is_html: true.
- Fix boolean option detection for --no-archived and --no-is-public (Thor sets false, which is falsy — use !options[:x].nil? instead) - Add Pages#update_content spec - Add card/page content to Mentions section in skill file
|
Thanks and thanks for making this! Lemme know here, please, when brew gets updated so I can replace my monkey patch with the real thing. :-) |
steveclarke
left a comment
There was a problem hiding this comment.
Looks great — all feedback addressed. The boolean fix is exactly right and nice job catching both spots in the workaround condition too. Merging!
|
This shipped in v0.9.0. Once the release workflow finishes (https://github.com/steveclarke/superthread/actions), Homebrew will be updated automatically: Thanks again for the contribution — really clean work. |
Summary
Add
--contentoption tosuth cards updateandsuth pages updateCLI commands, enabling card and page description updates from the CLI.Motivation
The Superthread API provides dedicated PUT endpoints for replacing card and page content:
PUT /{team_id}/cards/{card_id}/contentPUT /{team_id}/pages/{page_id}/contentThese endpoints were not yet supported by the gem. Content updates are essential for agents and scripts that manage card descriptions programmatically (e.g., writing refined specs back to cards).
Changes
Resources layer
Resources::Base— Addput_objecthelper (the connection layer already supports PUT via the genericrequest(method:), but there was no typed helper)Resources::Cards#update_content— New method that callsPUT /{team_id}/cards/{card_id}/contentwith{content:, is_html: true}. Supports{{@Name}}mentions viaformat_mentions.Resources::Pages#update_content— New method that callsPUT /{team_id}/pages/{page_id}/content@noteonCards#updateandPages#updateto reference#update_contentinstead of stating content cannot be updatedCLI layer
suth cards update CARD --content HTML— Routes content through the PUT endpoint, independent of other PATCH fields. Both can be combined in a single command.suth pages update PAGE --content HTML— Same pattern for pages.Tests & docs
stub_api_putto test helpersCards#update_content--contentoption documentationUsage
Tests