Skip to content

feat: add --content support to cards update and pages update - #66

Merged
steveclarke merged 2 commits into
steveclarke:masterfrom
richcorbs:feat/card-content-update
Mar 21, 2026
Merged

steveclarke merged 2 commits into
steveclarke:masterfrom
richcorbs:feat/card-content-update

Conversation

@richcorbs

Copy link
Copy Markdown
Contributor

Summary

Add --content option to suth cards update and suth pages update CLI commands, enabling card and page description updates from the CLI.

Motivation

The Superthread API provides dedicated PUT endpoints for replacing card and page content:

These 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 — Add put_object helper (the connection layer already supports PUT via the generic request(method:), but there was no typed helper)
  • Resources::Cards#update_content — New method that calls PUT /{team_id}/cards/{card_id}/content with {content:, is_html: true}. Supports {{@Name}} mentions via format_mentions.
  • Resources::Pages#update_content — New method that calls PUT /{team_id}/pages/{page_id}/content
  • Updated @note on Cards#update and Pages#update to reference #update_content instead of stating content cannot be updated

CLI 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

  • Add stub_api_put to test helpers
  • Add spec for Cards#update_content
  • Update CLI skill with --content option documentation

Usage

# Update card content only
suth cards update 1234 --content "<p>New description</p>"

# Update content and other fields in one command
suth cards update 1234 --content "<h1>Plan</h1><p>Details...</p>" --title "Refined: Task name" --priority 3

# Update page content
suth pages update 102 --content "<h1>Updated docs</h1>"

# Mentions work in content
suth cards update 1234 --content "<p>{{@Steve Clarke}} updated the spec.</p>"

Tests

733 examples, 0 failures
StandardRB: clean
yard-lint: No offenses found

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
@steveclarke

Copy link
Copy Markdown
Owner

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 steveclarke left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/superthread/cli/cards.rb Outdated
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]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@richcorbs

Copy link
Copy Markdown
Contributor Author

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 steveclarke left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great — all feedback addressed. The boolean fix is exactly right and nice job catching both spots in the workaround condition too. Merging!

@steveclarke
steveclarke merged commit 12fa1cb into steveclarke:master Mar 21, 2026
4 checks passed
@steveclarke

Copy link
Copy Markdown
Owner

This shipped in v0.9.0. Once the release workflow finishes (https://github.com/steveclarke/superthread/actions), Homebrew will be updated automatically:

brew update && brew upgrade superthread

Thanks again for the contribution — really clean work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants