Skip to content

Conversation

@tomkowalski
Copy link
Contributor

Overview

Provide parity to the CLI with the Dev Api by including the ability to filter textItems and Components by status when pulling text from Ditto.
Note: This follows the same logic for filtering variants as the fetch textItem and fetch components endpoints. Variants will only be fetched when they match the status filter and their corresponding base text also matches the status filter.

Context

Support for filtering components/textItems by status was added to the Developer api. We are adding support to the cli so that there is parity in how pull operates between the two.
https://developer.dittowords.com/api-reference/text-items/get-text-items
https://developer.dittowords.com/api-reference/components/get-components

Screenshots

Sample Component (Base is WIP variants are WIP or REVIEW)

Screenshot 2025-12-11 at 12 08 17 PM

Sample textItem (Base is WIP)

Screenshot 2025-12-11 at 12 08 35 PM

Sample textItem (Variants are WIP or FINAL)

Screenshot 2025-12-11 at 12 08 43 PM

pull using the above sample data, all variants and FINAL and WIP status filter returns all variants of the textItem and the base component and hobbitish variant. The test1 variant component is not returned as it has a REVIEW status.

Screenshot 2025-12-11 at 12 12 31 PM

pull using all variants and FINAL status filter returns no textItems or components. While the hobbitish textItem has a FINAL status, its base text is WIP so it will not be fetched.

Screenshot 2025-12-11 at 12 13 35 PM

pull using the above sample data, all variants and REVIEW and WIP status filter returns all variants of the componet and the base textItem and test1 variant. The hobbitish variant textItem is not returned as it has a FINAL status.

Screenshot 2025-12-11 at 12 15 23 PM

pull using hobbitish variant and REVIEW and WIP status filter returns only hobbitish component variant. The hobbitish variant textItem is not returned as it has a FINAL status.

Screenshot 2025-12-11 at 12 21 12 PM

pull using hobbitish variant and REVIEW, FINAL, and WIP status filter returns the hobbitish both component and textItem variants.

Screenshot 2025-12-11 at 12 21 54 PM

pull using hobbitish variant and REVIEW and FINAL status filter returns nothing, because neither component nor textItem variants have a base text that matches the status filter.

Screenshot 2025-12-11 at 12 35 38 PM

pull with no status filter or empty status filter defaults to allowing all statuses to be included.

Screenshot 2025-12-11 at 12 38 27 PM Screenshot 2025-12-11 at 12 39 12 PM

Using an invalid status will display a message informing of the type issue.

Screenshot 2025-12-11 at 12 01 26 PM

Test Plan

[] Run pull using yarn sync
[] filtering without statuses should give all textItems/components back
[] filtering with statuses as [] should also return all textItems/components
[] filtering by a specific status WIP or FINAL should only return those items/components
[] Using status filters with variant filter should only return textItems/components that match the variant and status filters and have base text that also matches the status filter. (Only return variants who match the filters from the set of variants that have base text that matches the project and status filters. )

Copy link
Contributor

@marla-hoggard marla-hoggard left a comment

Choose a reason for hiding this comment

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

From a quick scan, things look good! But i'm going to reassign because I've done a ton of reviews this week and need some heads down time. @bparrish17 and @joustrich are also working on the CLI right now, so I'll re-assign to one of them, in case there's any conflicts worth noting.

As a reminder, you'll also need to open up a separate PR in the main ditto repo with docs updates + changelog after this PR goes in and the new CLI version is released.

It would probably be a good idea to include a version bump of the CLI version that we use in our own codebase in that same PR, so that we always have the latest version. I'll add that to the notion doc.

@marla-hoggard marla-hoggard requested review from bparrish17 and removed request for bparrish17 December 11, 2025 18:06
Copy link

@bparrish17 bparrish17 left a comment

Choose a reason for hiding this comment

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

Looks good, just one request to add statuses config support to outputs as well!

let filters: PullFilters = {
projects: this.projectConfig.projects,
variants: this.projectConfig.variants,
statuses: this.projectConfig.statuses

Choose a reason for hiding this comment

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

This should be available on the output filters as well, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes definitely, this was an oversight with not understanding the override capabilities of output

Example of this working after a change

Image

text: z.string(),
richText: z.string().optional(),
status: z.string(),
status: ZTextStatus,

Choose a reason for hiding this comment

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

weird this was string originally!

Copy link
Contributor Author

@tomkowalski tomkowalski Dec 12, 2025

Choose a reason for hiding this comment

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

Actually it might be better to keep it as string for now. It makes changes to the status schema easier (does not require an update to the CLI to fetch new types of statuses) Especially if the status is essentially "unused" from a typing perspective on output

@tomkowalski tomkowalski merged commit 156cf6f into master Dec 16, 2025
1 check passed
@tomkowalski tomkowalski deleted the tom/dit-11721/fetch-textItem-status-filtering branch December 16, 2025 15:19
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.

4 participants