Files
Peter Schilling d5baf4ed5a Add template list, template view, and --template on issue and project create
Linear templates were invisible from the CLI: `issue create` could only
apply the team's default template, and there was no way to see which
templates exist, what one pre-fills, or to pick one for a project. The
MCP server exposes list_templates, get_template, and a template
parameter on save_issue/save_project; this mirrors that surface.

`template list` fetches the workspace-wide `templates` list and filters
client-side by `--type` (issue, project, document) and `--team` (that
team's templates plus workspace-level ones, resolved through the shared
team lookup). `template view <name|id>` prints the metadata and every
key of `templateData`, rendering the ProseMirror body Linear stores
under `descriptionData` as markdown. `--json` on both returns the raw
GraphQL objects with `templateData` still a JSON-encoded string.

`--template <name|id>` on `issue create` and `project create` resolves
the reference against the target type and team(s) and sends
`templateId`, so Linear applies the template server-side. Semantics
confirmed against the live API and stated in the help text: explicit
flags override the template's values, `--label` merges with the
template's labels, `--description` replaces the template body (omitting
it keeps the body), and `issue create --template` makes `--title`
optional. Linear rejects `useDefaultTemplate` together with
`templateId`, despite the schema saying `templateId` wins for projects,
so `--template` drops the default-template flag; `--no-use-default-
template` may still be passed alongside it. A wrong-type or other-team
template errors before any mutation; a name shared by several eligible
templates errors with their IDs; `template(id:)` is non-null, so a
missing UUID is translated from Linear's "No template found" error into
the usual not-found error.

`DocumentCreateInput` has no `templateId`, so document templates can be
listed and viewed but not applied; `document create` is unchanged.

Claude-Session: https://claude.ai/code/session_01A9qEGri4p2HZMQSuYsBmub
2026-09-05 10:39:57 -07:00
..