linear-cli icon indicating copy to clipboard operation
linear-cli copied to clipboard

project: Add update, delete, and --json support

Open alon-z opened this issue 9 months ago • 8 comments

Context

I'm building automation that syncs planning artifacts to Linear projects (create, rename, delete, list IDs programmatically). The project command is missing several operations that exist in the GraphQL API, forcing a fallback to raw API calls.

Missing capabilities

1. project update subcommand

No way to update a project via CLI. Needed for renaming, changing status, updating descriptions after creation.

The GraphQL API has projectUpdate(id, input: ProjectUpdateInput) with fields for name, description, status, etc.

Example desired usage:

linear project update <projectId> --name "New Name" --status completed

2. project delete subcommand

No way to delete a project via CLI. The GraphQL API has projectDelete(id).

Example desired usage:

linear project delete <projectId>

3. --json on project list

project list outputs a human-readable table with slugs but no UUIDs. There is no --json flag to get machine-readable output. Compare with initiative list which does support --json.

Without this, there is no way to programmatically get project IDs after creation without falling back to the GraphQL API.

Example desired usage:

linear project list --team ENG --json

4. --json on project create

project create prints a human-readable success message with the slug and URL, but does not return the project UUID. A --json flag would eliminate the need for a follow-up API call to resolve the ID.

Example desired usage:

linear project create --name "My Project" --team ENG --json

Workaround

Currently using curl with linear auth token against the GraphQL API directly for all four operations. PR #121 (linear api) would make this safer but these would still benefit from first-class CLI support.

alon-z avatar Feb 09 '26 13:02 alon-z

I'd like to take a crack at this -- will open a PR.

alon-z avatar Feb 09 '26 13:02 alon-z

@alon-z awesome, i use project apis so this will be something i absolutely use! looking forward to it.

schpet avatar Feb 09 '26 17:02 schpet

possibly a separate issue to avoid scope creep but supporting project file uploads would be super nice

schpet avatar Feb 09 '26 17:02 schpet

Fun wrinkle here: project update vs https://linear.app/docs/initiative-and-project-updates. In other words, Linear has a feature called "Project Update" while the CLI uses update as its generic verb for editing. There's a ProjectUpdate object in the GraphQL API, so it's not inconceivable that this conflict could come up if someone was adding a subcommand for project/initiative updates.

bendrucker avatar Feb 09 '26 19:02 bendrucker

@bendrucker Will take a look. I'm not using linear for long and looking to "best practices" and features like this. Thank you!

alon-z avatar Feb 10 '26 07:02 alon-z

Sounds good, I am new-ish too! This is going to be a tricky one, would it be linear update ... given that updates can be made on Projects and Initiatives and largely have the same fields? But both are distinct GQL objects, ProjectUpdate and InitiativeUpdate. And then either way you end up with linear update update to edit an update, which isn't great.

In any case, I only mention it because project update sets up that future naming conflict. So it might be a good idea to make a change to subcommands now to sidestep it.

I don't have any ideas better than deprecating update, adding edit aliases, and eventually removing the deprecated version.

bendrucker avatar Feb 10 '26 17:02 bendrucker

One upside of edit is that it evokes $EDITOR. It could be interesting to offer an interactive mode that gets the current object and opens it up for editing. I'm borrowing this idea from kubectl edit. It uses patch for programmatic updates, which wouldn't be a good fit here for a GQL API. Maybe here edit does both and interactivity editing happens when there is a TTY available and no flags are set.

On a related note, I've been planning Linear projects with Claude recently using Markdown documents with YAML frontmatter. Metadata like title, labels, related issues, etc. goes in the frontmatter, while the markdown is the body. This could be a useful interface for an interactive edit command here too.

bendrucker avatar Feb 10 '26 17:02 bendrucker

I think this is done now:

  • linear project update exists (src/commands/project/project-update.ts)
  • linear project delete exists (src/commands/project/project-delete.ts)
  • linear project list has -j/--json (src/commands/project/project-list.ts), returning UUIDs in the GraphQL connection shape

Closing — please reopen if a specific field or flag is still missing.

schpetbot avatar Jul 17 '26 20:07 schpetbot