Add template list, template view, and --template on issue and project create - #283
Open
schpetbot wants to merge 1 commit into
Open
Add template list, template view, and --template on issue and project create#283schpetbot wants to merge 1 commit into
schpetbot wants to merge 1 commit into
Conversation
… 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
schpetbot
force-pushed
the
schpet/templates
branch
from
September 5, 2026 17:40
a532238 to
d5baf4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of a two-PR stack, based on #282. Merge that first; this PR's diff collapses to one commit once it lands.
Templates become a first-class surface, patterned on Linear's MCP
list_templates/get_template/templatetools: atemplate listcommand (--type issue|project|document,--team <key|name|id>which returns that team's templates plus workspace ones,--json),template view <name|id>showing what the template pre-fills, and--template <name|id>onissue createandproject createthat applies the template server-side.Semantics confirmed live: an explicit
--descriptionreplaces the template body and omitting it keeps the body;--labelmerges with the template's labels; explicit flags override template values; the title becomes optional with a template. Linear rejectsuseDefaultTemplatetogether withtemplateIdfor both issues and projects, so--templatetakes the place of the team's default template and--no-use-default-templatealongside it is a no-op.templateDatais a JSON-encoded string whose issue body is ProseMirror JSON, so a small ProseMirror-to-Markdown renderer backstemplate view. Document templates are list and view only becauseDocumentCreateInputhas no template field.template list --jsonreturns a bare array becauseQuery.templatesis an unpaginated list in the API, not a connection.Verified: 777 tests in both color modes, a 17-case QA table with 15 cases live (the workspace had no templates, so scratch ones were created via
templateCreateand deleted, along with the scratch issues and project they produced), and four high-effort Codex review passes whose real findings (Markdown re-interpretation in bodies, nested sub-issue rendering, order-dependent scope diagnostics, code-unit truncation, workspace-first ordering, list-marker escaping, fence sizing) are all fixed. The final pass was clean.https://claude.ai/code/session_01A9qEGri4p2HZMQSuYsBmub