Skip to content

feat(DCP-2190): add collection publish command#289

Merged
keyboSlice merged 5 commits intomainfrom
feat/DCP-2190-aitb-x-gmu-slice-3-collection-publish-command
Jan 30, 2026
Merged

feat(DCP-2190): add collection publish command#289
keyboSlice merged 5 commits intomainfrom
feat/DCP-2190-aitb-x-gmu-slice-3-collection-publish-command

Conversation

@script-this
Copy link
Contributor

@script-this script-this commented Jan 27, 2026

Summary

Add a new CLI command to publish AI Task Builder Collections as studies. This command creates a study from a collection's content and automatically transitions it to the published state, making it available to participants.

Collection Publish Command

Publish an AI Task Builder Collection as a study with a specified number of participants.

# Publish a collection with 100 participants
prolific collection publish <collection-id> --participants 100

# Publish with custom study name and description
prolific collection publish <collection-id> -p 50 --name "My Study" --description "Study description"

Flags

Flag Short Required Description
--participants -p Yes Number of participants required
--name -n No Study name (defaults to collection's task name)
--description -d No Study description (defaults to collection's task introduction)

Output

Displays the created study details including ID, name, status, and the study URL for participants.

Implementation

  • Add DataCollectionMethodAITBCollection constant to model/study.go
  • Create cmd/collection/publish.go with NewPublishCommand
  • Register command in cmd/collection/collection.go
  • Fetches collection to get default name/description from TaskDetails
  • Creates study with data_collection_method: AI_TASK_BUILDER_COLLECTION
  • Transitions study to PUBLISH state
  • Renders study details and URL on success

Testing

Unit tests cover:

  • Command creation and flag configuration
  • Required argument and flag validation
  • Successful publish flow with mocked API calls
  • Error handling (collection not found, study creation failure, transition failure)
  • Custom name/description override behavior

Note

Medium Risk
Touches study creation/publish flow and introduces template-driven input parsing, which can affect how requests are formed and published if field overrides/serialization behave unexpectedly.

Overview
Adds a new collection publish <collection-id> CLI command that creates a study from an AI Task Builder Collection (participants required unless a JSON/YAML template is provided), then automatically transitions it to PUBLISH and prints the rendered study plus a study URL.

When a template is used, the command forces data_collection_method/data_collection_id to the target collection, clears external_study_url as incompatible, and lets CLI flags override template fields with sensible description fallbacks. This also introduces model.DataCollectionMethodAITBCollection, adds an example template JSON, and includes extensive unit coverage for success, error paths, and template/flag override behavior.

Written by Cursor Bugbot for commit 0fd00f1. This will update automatically on new commits. Configure here.

Add command to publish AI Task Builder Collections as studies.
Creates a study with the collection content and transitions it
to published state.
@script-this script-this requested a review from a team as a code owner January 27, 2026 09:15
@prolific-snyk
Copy link

prolific-snyk commented Jan 27, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Copy link
Contributor

@ajmalkhan-eng ajmalkhan-eng left a comment

Choose a reason for hiding this comment

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

LGTM 💪 ..

Comment on lines +68 to +70
if len(opts.Args) < 1 || opts.Args[0] == "" {
return errors.New("please provide a collection ID")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

thought.. if earlier we have cobraMinimumNArgs(1) us this additional check even required?

@keyboSlice keyboSlice merged commit d970e1e into main Jan 30, 2026
5 checks passed
@keyboSlice keyboSlice deleted the feat/DCP-2190-aitb-x-gmu-slice-3-collection-publish-command branch January 30, 2026 15:51
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