Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(linear): let AI agents manage Linear issues, comments, projects and teams (#16069)

Odai Ahmad6ad3dbc05cfc
diff --git a/bun.lock b/bun.lock
index 267f7112c92..04ef6a2f2e1 100644
--- a/bun.lock
+++ b/bun.lock
@@ -5172,7 +5172,7 @@
},
"packages/pieces/community/linear": {
"name": "@activepieces/piece-linear",
- "version": "0.8.0",
+ "version": "0.9.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/linear/package.json b/packages/pieces/community/linear/package.json
index 798e5f5b5b7..642a0c069b7 100644
--- a/packages/pieces/community/linear/package.json
+++ b/packages/pieces/community/linear/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-linear",
- "version": "0.8.0",
+ "version": "0.9.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
diff --git a/packages/pieces/community/linear/src/i18n/translation.json b/packages/pieces/community/linear/src/i18n/translation.json
index 13bca7676ec..e595377a663 100644
--- a/packages/pieces/community/linear/src/i18n/translation.json
+++ b/packages/pieces/community/linear/src/i18n/translation.json
@@ -14,6 +14,51 @@
"Attach Link to Issue": "Attach Link to Issue",
"Post Project Status Update": "Post Project Status Update",
"Raw GraphQL Query": "Raw GraphQL Query",
+ "Create Issue (AI)": "Create Issue (AI)",
+ "Update Issue (AI)": "Update Issue (AI)",
+ "Get Issue (AI)": "Get Issue (AI)",
+ "List Issues (AI)": "List Issues (AI)",
+ "Search Issues (AI)": "Search Issues (AI)",
+ "Archive Issue (AI)": "Archive Issue (AI)",
+ "Unarchive Issue (AI)": "Unarchive Issue (AI)",
+ "Delete Issue (AI)": "Delete Issue (AI)",
+ "Create Issue Relation (AI)": "Create Issue Relation (AI)",
+ "Add Label to Issue (AI)": "Add Label to Issue (AI)",
+ "Remove Label from Issue (AI)": "Remove Label from Issue (AI)",
+ "Create Issue Label (AI)": "Create Issue Label (AI)",
+ "List Issue Labels (AI)": "List Issue Labels (AI)",
+ "List Workflow States (AI)": "List Workflow States (AI)",
+ "List Teams (AI)": "List Teams (AI)",
+ "Get Team (AI)": "Get Team (AI)",
+ "Create Team (AI)": "Create Team (AI)",
+ "Update Team (AI)": "Update Team (AI)",
+ "List Users (AI)": "List Users (AI)",
+ "Get Current User (AI)": "Get Current User (AI)",
+ "List Cycles (AI)": "List Cycles (AI)",
+ "Create Comment (AI)": "Create Comment (AI)",
+ "Get Comment (AI)": "Get Comment (AI)",
+ "List Comments (AI)": "List Comments (AI)",
+ "Update Comment (AI)": "Update Comment (AI)",
+ "Resolve Comment Thread (AI)": "Resolve Comment Thread (AI)",
+ "Unresolve Comment Thread (AI)": "Unresolve Comment Thread (AI)",
+ "React to Comment (AI)": "React to Comment (AI)",
+ "Delete Reaction (AI)": "Delete Reaction (AI)",
+ "Attach Link to Issue (AI)": "Attach Link to Issue (AI)",
+ "Get Attachment (AI)": "Get Attachment (AI)",
+ "Download Linear Upload (AI)": "Download Linear Upload (AI)",
+ "Create Project (AI)": "Create Project (AI)",
+ "Update Project (AI)": "Update Project (AI)",
+ "List Projects (AI)": "List Projects (AI)",
+ "Get Project (AI)": "Get Project (AI)",
+ "Delete Project (AI)": "Delete Project (AI)",
+ "Restore Project (AI)": "Restore Project (AI)",
+ "Create Project Milestone (AI)": "Create Project Milestone (AI)",
+ "Post Project Status Update (AI)": "Post Project Status Update (AI)",
+ "Get Project Status Update (AI)": "Get Project Status Update (AI)",
+ "List Project Status Updates (AI)": "List Project Status Updates (AI)",
+ "Edit Project Status Update (AI)": "Edit Project Status Update (AI)",
+ "Archive Project Status Update (AI)": "Archive Project Status Update (AI)",
+ "Unarchive Project Status Update (AI)": "Unarchive Project Status Update (AI)",
"Create an issue in a Linear team.": "Create an issue in a Linear team.",
"Change an issue. Only the fields you fill in are changed.": "Change an issue. Only the fields you fill in are changed.",
"Create a project in a Linear team.": "Create a project in a Linear team.",
@@ -27,6 +72,51 @@
"Link a URL to an issue. Attaching it again updates that link.": "Link a URL to an issue. Attaching it again updates that link.",
"Post a status update, with an optional health rating, on a project.": "Post a status update, with an optional health rating, on a project.",
"Send any GraphQL query or mutation to the Linear API.": "Send any GraphQL query or mutation to the Linear API.",
+ "Create an issue from IDs, with optional project, cycle, parent, due date and estimate.": "Create an issue from IDs, with optional project, cycle, parent, due date and estimate.",
+ "Change only the fields you pass on an issue; labels can be replaced, added or removed.": "Change only the fields you pass on an issue; labels can be replaced, added or removed.",
+ "Get one issue by UUID or identifier.": "Get one issue by UUID or identifier.",
+ "List issues with structured filters (team, project, assignee, status, label, cycle, priority, updated since).": "List issues with structured filters (team, project, assignee, status, label, cycle, priority, updated since).",
+ "Full-text and semantic search over issues, best matches first.": "Full-text and semantic search over issues, best matches first.",
+ "Archive an issue so it leaves active views. It can be restored.": "Archive an issue so it leaves active views. It can be restored.",
+ "Restore an archived or trashed issue.": "Restore an archived or trashed issue.",
+ "Move an issue to the trash (restorable for 30 days).": "Move an issue to the trash (restorable for 30 days).",
+ "Link two issues as blocking, duplicate or related.": "Link two issues as blocking, duplicate or related.",
+ "Add one label to an issue, keeping its other labels.": "Add one label to an issue, keeping its other labels.",
+ "Remove one label from an issue, keeping its other labels.": "Remove one label from an issue, keeping its other labels.",
+ "Get a label by name, or create it if it does not exist yet (team or workspace label).": "Get a label by name, or create it if it does not exist yet (team or workspace label).",
+ "List issue labels, optionally only one team (team labels plus workspace labels) or matching a name.": "List issue labels, optionally only one team (team labels plus workspace labels) or matching a name.",
+ "List the issue statuses (Backlog, Todo, In Progress, Done...) of a team.": "List the issue statuses (Backlog, Todo, In Progress, Done...) of a team.",
+ "List the teams the connected user can access, with IDs and keys.": "List the teams the connected user can access, with IDs and keys.",
+ "Get one team with its issue defaults (default status, estimate, triage, cycles).": "Get one team with its issue defaults (default status, estimate, triage, cycles).",
+ "Create a new team with a name and, optionally, its key, description, icon, color, timezone, cycles and triage.": "Create a new team with a name and, optionally, its key, description, icon, color, timezone, cycles and triage.",
+ "Change only the team settings you pass (name, key, description, icon, color, timezone, cycles, triage).": "Change only the team settings you pass (name, key, description, icon, color, timezone, cycles, triage).",
+ "List workspace members, optionally find one by email or name.": "List workspace members, optionally find one by email or name.",
+ "Get the user who owns the API key, and the workspace.": "Get the user who owns the API key, and the workspace.",
+ "List cycles (sprints), optionally for one team and only the current, next or previous one.": "List cycles (sprints), optionally for one team and only the current, next or previous one.",
+ "Post a comment on an issue, or reply inside an existing comment thread.": "Post a comment on an issue, or reply inside an existing comment thread.",
+ "Get one comment by ID.": "Get one comment by ID.",
+ "List comments, usually the comments of one issue.": "List comments, usually the comments of one issue.",
+ "Replace the text of a comment.": "Replace the text of a comment.",
+ "Mark a comment thread as resolved.": "Mark a comment thread as resolved.",
+ "Reopen a resolved comment thread.": "Reopen a resolved comment thread.",
+ "Add an emoji reaction to a comment.": "Add an emoji reaction to a comment.",
+ "Remove an emoji reaction by its ID.": "Remove an emoji reaction by its ID.",
+ "Attach a URL to an issue, or update the existing attachment with the same URL.": "Attach a URL to an issue, or update the existing attachment with the same URL.",
+ "Get one issue attachment (link) by ID.": "Get one issue attachment (link) by ID.",
+ "Download a file uploaded to Linear (an uploads.linear.app link from an issue or comment).": "Download a file uploaded to Linear (an uploads.linear.app link from an issue or comment).",
+ "Create a project for one or more teams.": "Create a project for one or more teams.",
+ "Change only the project fields you pass. Teams are only changed when Team IDs is given.": "Change only the project fields you pass. Teams are only changed when Team IDs is given.",
+ "List projects, optionally of one team, with a status type or a name fragment.": "List projects, optionally of one team, with a status type or a name fragment.",
+ "Get one project with its teams, lead, status and milestones.": "Get one project with its teams, lead, status and milestones.",
+ "Move a project to the trash. It can be restored.": "Move a project to the trash. It can be restored.",
+ "Restore a trashed or archived project.": "Restore a trashed or archived project.",
+ "Add a milestone to a project.": "Add a milestone to a project.",
+ "Post a progress report (status update with health) on a project.": "Post a progress report (status update with health) on a project.",
+ "Get one project status update by ID.": "Get one project status update by ID.",
+ "List project status updates, usually of one project.": "List project status updates, usually of one project.",
+ "Change the text or health of a posted project status update.": "Change the text or health of a posted project status update.",
+ "Archive (hide) a project status update. It can be restored.": "Archive (hide) a project status update. It can be restored.",
+ "Restore an archived project status update.": "Restore an archived project status update.",
"Team": "Team",
"Title": "Title",
"Description": "Description",
@@ -60,6 +150,53 @@
"Health": "Health",
"Query": "Query",
"Variables": "Variables",
+ "Team ID": "Team ID",
+ "Assignee ID": "Assignee ID",
+ "Status ID": "Status ID",
+ "Label IDs": "Label IDs",
+ "Project ID": "Project ID",
+ "Project Milestone ID": "Project Milestone ID",
+ "Cycle ID": "Cycle ID",
+ "Template ID": "Template ID",
+ "Label IDs (replace all)": "Label IDs (replace all)",
+ "Add Label IDs": "Add Label IDs",
+ "Remove Label IDs": "Remove Label IDs",
+ "Move to Team ID": "Move to Team ID",
+ "Clear Fields": "Clear Fields",
+ "Status Type": "Status Type",
+ "Label ID": "Label ID",
+ "Updated After": "Updated After",
+ "Include Archived": "Include Archived",
+ "Order By": "Order By",
+ "Limit": "Limit",
+ "Page Cursor": "Page Cursor",
+ "Search Comments Too": "Search Comments Too",
+ "Related Issue": "Related Issue",
+ "Relation Type": "Relation Type",
+ "Name Contains": "Name Contains",
+ "Include Archived Teams": "Include Archived Teams",
+ "Key": "Key",
+ "Timezone": "Timezone",
+ "Cycles": "Cycles",
+ "Triage": "Triage",
+ "Email": "Email",
+ "Include Deactivated Users": "Include Deactivated Users",
+ "Which Cycles": "Which Cycles",
+ "Body": "Body",
+ "Reply To Comment ID": "Reply To Comment ID",
+ "Comment ID": "Comment ID",
+ "Thread Comment ID": "Thread Comment ID",
+ "Resolving Reply ID": "Resolving Reply ID",
+ "Emoji": "Emoji",
+ "Reaction ID": "Reaction ID",
+ "Attachment ID": "Attachment ID",
+ "Upload URL": "Upload URL",
+ "File Name": "File Name",
+ "Team IDs": "Team IDs",
+ "Summary": "Summary",
+ "Lead ID": "Lead ID",
+ "Team IDs (replace all)": "Team IDs (replace all)",
+ "Status Update ID": "Status Update ID",
"The team the issue is created in.": "The team the issue is created in.",
"Markdown is supported.": "Markdown is supported.",
"Prefills the issue from one of the team's templates.": "Prefills the issue from one of the team's templates.",
@@ -94,6 +231,117 @@
"The project to post the update on.": "The project to post the update on.",
"Leave empty to post without a health rating.": "Leave empty to post without a health rating.",
"Values for the $variables used in the query.": "Values for the $variables used in the query.",
+ "UUID of the team that owns the issue. Get it from List Teams.": "UUID of the team that owns the issue. Get it from List Teams.",
+ "Issue title, for example \"Login page times out on Safari\".": "Issue title, for example \"Login page times out on Safari\".",
+ "Issue body in Markdown.": "Issue body in Markdown.",
+ "UUID of the user to assign. Get it from List Users or Get Current User.": "UUID of the user to assign. Get it from List Users or Get Current User.",
+ "UUID of a workflow state of this team. Get it from List Workflow States. Leave empty for the team's default status.": "UUID of a workflow state of this team. Get it from List Workflow States. Leave empty for the team's default status.",
+ "0 none, 1 urgent, 2 high, 3 medium, 4 low.": "0 none, 1 urgent, 2 high, 3 medium, 4 low.",
+ "UUIDs of team or workspace labels. Get them from List Issue Labels.": "UUIDs of team or workspace labels. Get them from List Issue Labels.",
+ "UUID of a project the team belongs to. Get it from List Projects.": "UUID of a project the team belongs to. Get it from List Projects.",
+ "UUID of a milestone of that project. Get it from Get Project.": "UUID of a milestone of that project. Get it from Get Project.",
+ "UUID of a cycle of this team. Get it from List Cycles.": "UUID of a cycle of this team. Get it from List Cycles.",
+ "UUID or identifier (for example ENG-123) of the parent issue, to create a sub-issue.": "UUID or identifier (for example ENG-123) of the parent issue, to create a sub-issue.",
+ "Date in YYYY-MM-DD format, for example 2026-10-15.": "Date in YYYY-MM-DD format, for example 2026-10-15.",
+ "Whole number of estimate points in the team's scale, for example 3.": "Whole number of estimate points in the team's scale, for example 3.",
+ "UUID of an issue template of this team. Leave empty for none.": "UUID of an issue template of this team. Leave empty for none.",
+ "UUID or identifier of the issue, for example ENG-123.": "UUID or identifier of the issue, for example ENG-123.",
+ "New title.": "New title.",
+ "New body in Markdown. Replaces the current description.": "New body in Markdown. Replaces the current description.",
+ "UUID of the new assignee. Get it from List Users.": "UUID of the new assignee. Get it from List Users.",
+ "UUID of a workflow state of the issue's team. Get it from List Workflow States.": "UUID of a workflow state of the issue's team. Get it from List Workflow States.",
+ "Replaces every label on the issue with exactly these label UUIDs. Cannot be combined with Add or Remove Label IDs.": "Replaces every label on the issue with exactly these label UUIDs. Cannot be combined with Add or Remove Label IDs.",
+ "Label UUIDs to add, keeping the current labels.": "Label UUIDs to add, keeping the current labels.",
+ "Label UUIDs to remove, keeping the other labels.": "Label UUIDs to remove, keeping the other labels.",
+ "UUID of another team to move the issue to. Leave empty to keep the team.": "UUID of another team to move the issue to. Leave empty to keep the team.",
+ "UUID of the project to move the issue into.": "UUID of the project to move the issue into.",
+ "UUID of a milestone of the project.": "UUID of a milestone of the project.",
+ "UUID of a cycle of the team. Get it from List Cycles.": "UUID of a cycle of the team. Get it from List Cycles.",
+ "UUID or identifier of the new parent issue.": "UUID or identifier of the new parent issue.",
+ "Whole number of estimate points.": "Whole number of estimate points.",
+ "Fields to empty on the issue. A field listed here must not also be given a new value.": "Fields to empty on the issue. A field listed here must not also be given a new value.",
+ "Only issues of this team (UUID from List Teams).": "Only issues of this team (UUID from List Teams).",
+ "Only issues in this project (UUID from List Projects).": "Only issues in this project (UUID from List Projects).",
+ "Only issues assigned to this user (UUID from List Users).": "Only issues assigned to this user (UUID from List Users).",
+ "Only issues in this workflow state (UUID from List Workflow States).": "Only issues in this workflow state (UUID from List Workflow States).",
+ "Only issues whose status is of this type, across teams.": "Only issues whose status is of this type, across teams.",
+ "Only issues that have this label (UUID from List Issue Labels).": "Only issues that have this label (UUID from List Issue Labels).",
+ "Only issues in this cycle (UUID from List Cycles).": "Only issues in this cycle (UUID from List Cycles).",
+ "Only issues with this priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.": "Only issues with this priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.",
+ "Only issues updated after this ISO 8601 time, for example 2026-09-01T00:00:00Z.": "Only issues updated after this ISO 8601 time, for example 2026-09-01T00:00:00Z.",
+ "Sort order. Default: newest created first.": "Sort order. Default: newest created first.",
+ "How many records to return in this page, 1 to 250. Default 50.": "How many records to return in this page, 1 to 250. Default 50.",
+ "Pass end_cursor from the previous call to get the next page. Leave empty for the first page.": "Pass end_cursor from the previous call to get the next page. Leave empty for the first page.",
+ "Words to search for, for example \"login timeout safari\".": "Words to search for, for example \"login timeout safari\".",
+ "Only return issues of this team (UUID from List Teams).": "Only return issues of this team (UUID from List Teams).",
+ "How many records to return in this page, 1 to 100. Default 25.": "How many records to return in this page, 1 to 100. Default 25.",
+ "UUID or identifier of the first issue, for example ENG-12.": "UUID or identifier of the first issue, for example ENG-12.",
+ "UUID or identifier of the second issue, for example ENG-34.": "UUID or identifier of the second issue, for example ENG-34.",
+ "UUID of the label. Get it from List Issue Labels.": "UUID of the label. Get it from List Issue Labels.",
+ "Label name, for example \"Bug\".": "Label name, for example \"Bug\".",
+ "UUID of the team for a team label (from List Teams). Leave empty for a workspace label shared by all teams.": "UUID of the team for a team label (from List Teams). Leave empty for a workspace label shared by all teams.",
+ "Hex color used when the label is created, for example #EB5757.": "Hex color used when the label is created, for example #EB5757.",
+ "Used only when the label is created.": "Used only when the label is created.",
+ "UUID of a team (from List Teams). Returns that team's labels and the workspace labels.": "UUID of a team (from List Teams). Returns that team's labels and the workspace labels.",
+ "Only labels whose name contains this text (case-insensitive).": "Only labels whose name contains this text (case-insensitive).",
+ "How many records to return in this page, 1 to 250. Default 100.": "How many records to return in this page, 1 to 250. Default 100.",
+ "UUID of the team (from List Teams). Leave empty for every team.": "UUID of the team (from List Teams). Leave empty for every team.",
+ "UUID of the team. Get it from List Teams.": "UUID of the team. Get it from List Teams.",
+ "Team name, for example \"Platform\".": "Team name, for example \"Platform\".",
+ "Issue key, for example PLT. Leave empty to let Linear derive one from the name.": "Issue key, for example PLT. Leave empty to let Linear derive one from the name.",
+ "Hex color, for example #5E6AD2.": "Hex color, for example #5E6AD2.",
+ "IANA timezone, for example Europe/Berlin.": "IANA timezone, for example Europe/Berlin.",
+ "Turn cycles on or off. Leave empty for the Linear default.": "Turn cycles on or off. Leave empty for the Linear default.",
+ "Turn triage on or off. Leave empty for the Linear default.": "Turn triage on or off. Leave empty for the Linear default.",
+ "New issue key, for example PLT. Renames every issue identifier of the team.": "New issue key, for example PLT. Renames every issue identifier of the team.",
+ "Turn cycles on or off. Leave empty to keep the current setting.": "Turn cycles on or off. Leave empty to keep the current setting.",
+ "Turn triage on or off. Leave empty to keep the current setting.": "Turn triage on or off. Leave empty to keep the current setting.",
+ "Exact email address to look up, for example [email protected].": "Exact email address to look up, for example [email protected].",
+ "Only users whose name contains this text (case-insensitive).": "Only users whose name contains this text (case-insensitive).",
+ "Leave empty for all cycles.": "Leave empty for all cycles.",
+ "Comment text in Markdown.": "Comment text in Markdown.",
+ "UUID of a comment on the same issue to reply to (from List Comments). Leave empty for a new thread.": "UUID of a comment on the same issue to reply to (from List Comments). Leave empty for a new thread.",
+ "UUID of the comment.": "UUID of the comment.",
+ "UUID or identifier of the issue, for example ENG-123. Leave empty for every issue.": "UUID or identifier of the issue, for example ENG-123. Leave empty for every issue.",
+ "UUID of the comment (from List Comments or Create Comment).": "UUID of the comment (from List Comments or Create Comment).",
+ "The new comment text in Markdown. Replaces the whole body.": "The new comment text in Markdown. Replaces the whole body.",
+ "UUID of the first comment of the thread.": "UUID of the first comment of the thread.",
+ "UUID of the reply that resolved the thread, if any.": "UUID of the reply that resolved the thread, if any.",
+ "Emoji name such as thumbsup or eyes, or the emoji itself.": "Emoji name such as thumbsup or eyes, or the emoji itself.",
+ "UUID of the reaction (from React to Comment).": "UUID of the reaction (from React to Comment).",
+ "Full link, for example https://github.com/acme/app/pull/42.": "Full link, for example https://github.com/acme/app/pull/42.",
+ "Text shown for the link, for example \"PR #42\".": "Text shown for the link, for example \"PR #42\".",
+ "Optional second line, for example \"Merged\".": "Optional second line, for example \"Merged\".",
+ "UUID of the attachment.": "UUID of the attachment.",
+ "The https://uploads.linear.app/... link, copied from the markdown of an issue or comment.": "The https://uploads.linear.app/... link, copied from the markdown of an issue or comment.",
+ "Name for the saved file. Leave empty to use the last part of the link.": "Name for the saved file. Leave empty to use the last part of the link.",
+ "UUIDs of the teams the project belongs to (from List Teams). At least one.": "UUIDs of the teams the project belongs to (from List Teams). At least one.",
+ "Project name, for example \"Website relaunch\".": "Project name, for example \"Website relaunch\".",
+ "Short one-line summary shown under the project name.": "Short one-line summary shown under the project name.",
+ "UUID of the project lead (from List Users).": "UUID of the project lead (from List Users).",
+ "UUID of a project status. Leave empty for the default status.": "UUID of a project status. Leave empty for the default status.",
+ "YYYY-MM-DD, for example 2026-10-01.": "YYYY-MM-DD, for example 2026-10-01.",
+ "YYYY-MM-DD, for example 2026-12-15.": "YYYY-MM-DD, for example 2026-12-15.",
+ "Linear icon name, for example \"Rocket\".": "Linear icon name, for example \"Rocket\".",
+ "UUID of the project (from List Projects).": "UUID of the project (from List Projects).",
+ "Short one-line summary.": "Short one-line summary.",
+ "UUID of the new lead (from List Users).": "UUID of the new lead (from List Users).",
+ "UUID of a project status.": "UUID of a project status.",
+ "YYYY-MM-DD.": "YYYY-MM-DD.",
+ "Replaces the teams of the project with exactly these team UUIDs. Leave empty to keep the current teams.": "Replaces the teams of the project with exactly these team UUIDs. Leave empty to keep the current teams.",
+ "Fields to empty on the project. A field listed here must not also be given a value.": "Fields to empty on the project. A field listed here must not also be given a value.",
+ "Only projects of this team (UUID from List Teams).": "Only projects of this team (UUID from List Teams).",
+ "Case-insensitive name fragment.": "Case-insensitive name fragment.",
+ "Milestone name, for example \"Beta\".": "Milestone name, for example \"Beta\".",
+ "Markdown description.": "Markdown description.",
+ "YYYY-MM-DD, for example 2026-11-30.": "YYYY-MM-DD, for example 2026-11-30.",
+ "Update text in Markdown.": "Update text in Markdown.",
+ "onTrack, atRisk or offTrack. Leave empty for no health rating.": "onTrack, atRisk or offTrack. Leave empty for no health rating.",
+ "UUID of the project status update.": "UUID of the project status update.",
+ "Only updates of this project (UUID from List Projects). Leave empty for all projects.": "Only updates of this project (UUID from List Projects). Leave empty for all projects.",
+ "How many records to return in this page, 1 to 250. Default 25.": "How many records to return in this page, 1 to 250. Default 25.",
+ "New update text in Markdown. Replaces the whole body.": "New update text in Markdown. Replaces the whole body.",
+ "New health. Leave empty to keep the current one.": "New health. Leave empty to keep the current one.",
"Backlog": "Backlog",
"Planned": "Planned",
"In Progress": "In Progress",
@@ -103,6 +351,26 @@
"On track": "On track",
"At risk": "At risk",
"Off track": "Off track",
+ "Due date": "Due date",
+ "Project milestone": "Project milestone",
+ "Parent issue": "Parent issue",
+ "All labels": "All labels",
+ "Unstarted (Todo)": "Unstarted (Todo)",
+ "Started (In progress)": "Started (In progress)",
+ "Created at": "Created at",
+ "Updated at": "Updated at",
+ "Issue blocks related issue": "Issue blocks related issue",
+ "Issue is a duplicate of related issue": "Issue is a duplicate of related issue",
+ "Related": "Related",
+ "Turn on": "Turn on",
+ "Turn off": "Turn off",
+ "Current cycle": "Current cycle",
+ "Next cycle": "Next cycle",
+ "Previous cycle": "Previous cycle",
+ "Lead": "Lead",
+ "Start date": "Start date",
+ "Target date": "Target date",
+ "In progress": "In progress",
"New Comment": "New Comment",
"New Issue": "New Issue",
"Updated Issue": "Updated Issue",
diff --git a/packages/pieces/community/linear/src/index.ts b/packages/pieces/community/linear/src/index.ts
index 130f73490a5..7be740e6e30 100644
--- a/packages/pieces/community/linear/src/index.ts
+++ b/packages/pieces/community/linear/src/index.ts
@@ -22,6 +22,7 @@ import { linearDeleteIssue } from './lib/actions/issues/delete-issue';
import { linearAttachLink } from './lib/actions/attachments/attach-link';
import { linearCreateProjectStatusUpdate } from './lib/actions/projects/create-project-status-update';
import { linearNewProjectStatusUpdate } from './lib/triggers/new-project-status-update';
+import { linearAtomics } from './lib/actions/atomics';
const markdown = `
To get your API key:
@@ -84,6 +85,7 @@ export const linear = createPiece({
linearAttachLink,
linearCreateProjectStatusUpdate,
linearRawGraphqlQuery,
+ ...linearAtomics,
],
triggers: [
linearNewComment,
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/atomics.test.ts b/packages/pieces/community/linear/src/lib/actions/atomics/atomics.test.ts
new file mode 100644
index 00000000000..17a19b2176f
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/atomics.test.ts
@@ -0,0 +1,679 @@
+/// <reference types="vitest/globals" />
+
+import { writeFileSync } from 'node:fs';
+import { vi } from 'vitest';
+import { createMockActionContext } from '@activepieces/pieces-framework';
+
+const rawRequest = vi.fn();
+
+vi.mock('@linear/sdk', () => ({
+ LinearClient: class {
+ client = { rawRequest };
+ },
+ LinearDocument: {},
+}));
+
+import '../../../index';
+import { linearAtomics } from './index';
+import { assertLinearUploadUrl } from './upload-download';
+
+const auth = { type: 'SECRET_TEXT', secret_text: 'lin_api_test' };
+const UUID = '0b6d0a4c-2f0e-4a51-9d8e-4a2b1d1c9f00';
+const UUID2 = '1c7e1b5d-3a1f-4b62-8e9f-5b3c2e2d0a11';
+
+function universal(): unknown {
+ const base: Record<string, unknown> = {
+ success: true,
+ id: UUID,
+ entityId: UUID,
+ totalCount: 0,
+ nodes: [],
+ pageInfo: { hasNextPage: false, endCursor: null },
+ };
+ const proxy: unknown = new Proxy(base, {
+ get(target, prop) {
+ if (typeof prop === 'symbol' || prop === 'then' || prop === 'toJSON') return undefined;
+ if (prop in target) return target[prop];
+ return proxy;
+ },
+ });
+ return proxy;
+}
+
+function populated(): unknown {
+ const base: Record<string, unknown> = {
+ success: true,
+ id: UUID,
+ entityId: UUID,
+ totalCount: 1,
+ pageInfo: { hasNextPage: false, endCursor: null },
+ };
+ const proxy: unknown = new Proxy(base, {
+ get(target, prop) {
+ if (typeof prop === 'symbol' || prop === 'then' || prop === 'toJSON') return undefined;
+ if (prop === 'nodes') return [proxy];
+ if (prop in target) return target[prop];
+ return proxy;
+ },
+ });
+ return proxy;
+}
+
+function schemaKeys(fields: Array<{ key: string; value?: string }>): string[] {
+ return fields.map((field) => field.value ?? field.key).sort();
+}
+
+function action(name: string) {
+ const found = linearAtomics.find((a) => a.name === name);
+ if (!found) throw new Error(`missing atomic ${name}`);
+ return found;
+}
+
+async function run({ name, propsValue }: { name: string; propsValue: Record<string, unknown> }) {
+ return action(name).run({
+ ...createMockActionContext({ propsValue }),
+ auth,
+ files: { write: vi.fn().mockResolvedValue('file://x') },
+ });
+}
+
+function toRecord(value: unknown): Record<string, unknown> {
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
+ throw new Error('expected an object');
+ }
+ return Object.fromEntries(Object.entries(value));
+}
+
+function lastCall(): { query: string; variables: Record<string, unknown> } {
+ const call = rawRequest.mock.calls[rawRequest.mock.calls.length - 1];
+ return { query: call[0], variables: call[1] };
+}
+
+describe('linear atomics', () => {
+ beforeEach(() => {
+ rawRequest.mockReset();
+ rawRequest.mockImplementation(async () => ({ data: universal() }));
+ });
+
+ test('there are 45 atomics, all audience ai with a unique linear_ name', () => {
+ expect(linearAtomics).toHaveLength(45);
+ expect(new Set(linearAtomics.map((a) => a.name)).size).toBe(45);
+ for (const a of linearAtomics) {
+ expect(a.audience).toBe('ai');
+ expect(a.name.startsWith('linear_')).toBe(true);
+ }
+ });
+
+ describe('linear_issue_update is a true partial update', () => {
+ test('sends only the fields that were given', async () => {
+ await run({ name: 'linear_issue_update', propsValue: { issue_id: UUID, title: 'New title' } });
+ expect(lastCall().variables).toEqual({ id: UUID, input: { title: 'New title' } });
+ });
+
+ test('empty strings, empty arrays and unset values are not sent', async () => {
+ await run({ name: 'linear_issue_update', propsValue: {
+ issue_id: UUID,
+ priority: 2,
+ description: '',
+ assignee_id: undefined,
+ label_ids: [],
+ add_label_ids: [],
+ } });
+ expect(lastCall().variables['input']).toEqual({ priority: 2 });
+ });
+
+ test('priority 0 (none) is sent, not dropped as falsy', async () => {
+ await run({ name: 'linear_issue_update', propsValue: { issue_id: UUID, priority: 0 } });
+ expect(lastCall().variables['input']).toEqual({ priority: 0 });
+ });
+
+ test('incremental labels use addedLabelIds / removedLabelIds', async () => {
+ await run({ name: 'linear_issue_update', propsValue: { issue_id: UUID, add_label_ids: ['l1'], remove_label_ids: ['l2'] } });
+ expect(lastCall().variables['input']).toEqual({ addedLabelIds: ['l1'], removedLabelIds: ['l2'] });
+ });
+
+ test('clear_fields sends null, and [] for labels', async () => {
+ await run({ name: 'linear_issue_update', propsValue: { issue_id: UUID, clear_fields: ['assigneeId', 'dueDate', 'labelIds'] } });
+ expect(lastCall().variables['input']).toEqual({ assigneeId: null, dueDate: null, labelIds: [] });
+ });
+
+ test('refuses set and clear on the same field, replace plus incremental labels, and an empty update', async () => {
+ await expect(run({ name: 'linear_issue_update', propsValue: { issue_id: UUID, assignee_id: UUID2, clear_fields: ['assigneeId'] } })).rejects.toThrow('both set and cleared');
+ await expect(run({ name: 'linear_issue_update', propsValue: { issue_id: UUID, label_ids: ['a'], add_label_ids: ['b'] } })).rejects.toThrow('not both');
+ await expect(run({ name: 'linear_issue_update', propsValue: { issue_id: UUID } })).rejects.toThrow('Nothing to update');
+ });
+
+ test('an identifier is resolved to the UUID first', async () => {
+ await run({ name: 'linear_issue_update', propsValue: { issue_id: 'ENG-7', title: 'x' } });
+ expect(rawRequest.mock.calls[0][1]).toEqual({ id: 'ENG-7' });
+ expect(lastCall().variables['id']).toBe(UUID);
+ });
+ });
+
+ describe('linear_project_update never clobbers teams', () => {
+ test('teamIds is not sent unless given', async () => {
+ await run({ name: 'linear_project_update', propsValue: { project_id: UUID, name: 'Renamed' } });
+ expect(lastCall().variables).toEqual({ id: UUID, input: { name: 'Renamed' } });
+ });
+
+ test('teamIds replaces only when given', async () => {
+ await run({ name: 'linear_project_update', propsValue: { project_id: UUID, team_ids: ['t1', 't2'] } });
+ expect(lastCall().variables['input']).toEqual({ teamIds: ['t1', 't2'] });
+ });
+
+ test('clear_fields sends null for dates and lead', async () => {
+ await run({ name: 'linear_project_update', propsValue: { project_id: UUID, clear_fields: ['leadId', 'targetDate'] } });
+ expect(lastCall().variables['input']).toEqual({ leadId: null, targetDate: null });
+ });
+ });
+
+ describe('linear_team_create', () => {
+ test('sends only the settings given, with the key upper-cased', async () => {
+ await run({ name: 'linear_team_create', propsValue: { name: ' Platform ', key: 'plt', triage_enabled: 'true' } });
+ expect(lastCall().variables['input']).toEqual({ name: 'Platform', key: 'PLT', triageEnabled: true });
+ });
+ test('rejects an invalid key before calling Linear', async () => {
+ await expect(run({ name: 'linear_team_create', propsValue: { name: 'Platform', key: 'TOO-LONG-KEY' } })).rejects.toThrow('Key must be 1 to 7 letters or digits');
+ expect(rawRequest).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('linear_team_update tri-state booleans', () => {
+ test('an unset toggle is not sent and "false" is sent as false', async () => {
+ await run({ name: 'linear_team_update', propsValue: { team_id: UUID, cycles_enabled: 'false' } });
+ expect(lastCall().variables['input']).toEqual({ cyclesEnabled: false });
+ });
+ });
+
+ describe('linear_issue_label_create get-or-create', () => {
+ test('returns the existing label with created false and does not create', async () => {
+ rawRequest.mockResolvedValueOnce({
+ data: { issueLabels: { nodes: [{ id: 'lab-1', name: 'Bug', color: '#EB5757', isGroup: false, createdAt: 'x' }], pageInfo: { hasNextPage: false } } },
+ });
+ const result = await run({ name: 'linear_issue_label_create', propsValue: { name: 'bug', team_id: UUID } });
+ expect(result).toMatchObject({ created: false, id: 'lab-1' });
+ expect(rawRequest).toHaveBeenCalledTimes(1);
+ expect(rawRequest.mock.calls[0][1]).toMatchObject({
+ filter: { name: { eqIgnoreCase: 'bug' }, or: [{ team: { id: { eq: UUID } } }, { team: { null: true } }] },
+ });
+ });
+
+ test('with a team, finds a workspace label of that name instead of creating a team copy', async () => {
+ rawRequest.mockResolvedValueOnce({
+ data: { issueLabels: { nodes: [{ id: 'lab-ws', name: 'Security', color: '#000000', isGroup: false, createdAt: 'x', team: null }], pageInfo: { hasNextPage: false } } },
+ });
+ const result = await run({ name: 'linear_issue_label_create', propsValue: { name: 'security', team_id: UUID } });
+ expect(result).toMatchObject({ created: false, id: 'lab-ws' });
+ expect(rawRequest).toHaveBeenCalledTimes(1);
+ expect(rawRequest.mock.calls[0][1]['filter']).not.toHaveProperty('team');
+ });
+
+ test('with a team, prefers the team label when a workspace label has the same name', async () => {
+ rawRequest.mockResolvedValueOnce({
+ data: {
+ issueLabels: {
+ nodes: [
+ { id: 'lab-ws', name: 'Bug', color: '#000000', isGroup: false, createdAt: 'x', team: null },
+ { id: 'lab-team', name: 'Bug', color: '#000000', isGroup: false, createdAt: 'x', team: { id: UUID, key: 'ENG', name: 'Eng' } },
+ ],
+ pageInfo: { hasNextPage: false },
+ },
+ },
+ });
+ const result = await run({ name: 'linear_issue_label_create', propsValue: { name: 'Bug', team_id: UUID } });
+ expect(result).toMatchObject({ created: false, id: 'lab-team' });
+ });
+
+ test('without a team, a same-named team label is reported instead of a raw Linear error', async () => {
+ rawRequest
+ .mockResolvedValueOnce({ data: { issueLabels: { nodes: [], pageInfo: { hasNextPage: false } } } })
+ .mockResolvedValueOnce({
+ data: {
+ issueLabels: {
+ nodes: [{ id: 'lab-t', name: 'APDup', color: '#000000', isGroup: false, createdAt: 'x', team: { id: 't', key: 'E4', name: 'Eng' } }],
+ pageInfo: { hasNextPage: false },
+ },
+ },
+ });
+ await expect(run({ name: 'linear_issue_label_create', propsValue: { name: 'apdup' } })).rejects.toThrow(
+ 'A label named "apdup" already exists in team E4, so Linear will not create a workspace label with that name. Pass that team to get it.',
+ );
+ expect(rawRequest.mock.calls[1][1]).toEqual({ first: 10, filter: { name: { eqIgnoreCase: 'apdup' } } });
+ expect(rawRequest).toHaveBeenCalledTimes(2);
+ });
+
+ test('creates a workspace label when none matches', async () => {
+ rawRequest
+ .mockResolvedValueOnce({ data: { issueLabels: { nodes: [], pageInfo: { hasNextPage: false } } } })
+ .mockResolvedValueOnce({ data: { issueLabels: { nodes: [], pageInfo: { hasNextPage: false } } } });
+ const result = await run({ name: 'linear_issue_label_create', propsValue: { name: 'Customer' } });
+ expect(rawRequest.mock.calls[0][1]).toMatchObject({ filter: { team: { null: true } } });
+ expect(lastCall().variables).toEqual({ input: { name: 'Customer' } });
+ expect(result).toMatchObject({ created: true });
+ });
+ });
+
+ test('issues_search filters by team through the filter, not the teamId boost', async () => {
+ await run({ name: 'linear_issues_search', propsValue: { term: 'login', team_id: UUID } });
+ const { variables } = lastCall();
+ expect(variables['filter']).toEqual({ team: { id: { eq: UUID } } });
+ expect(variables).not.toHaveProperty('teamId');
+ });
+
+ test('issue_delete never asks for a permanent delete', async () => {
+ await run({ name: 'linear_issue_delete', propsValue: { issue_id: UUID } });
+ const { query, variables } = lastCall();
+ expect(query).not.toContain('permanentlyDelete');
+ expect(variables).toEqual({ id: UUID });
+ });
+
+ describe('linear_upload_download host guard', () => {
+ test('accepts only https uploads.linear.app links', () => {
+ expect(assertLinearUploadUrl('https://uploads.linear.app/a/b/c.png').hostname).toBe('uploads.linear.app');
+ for (const bad of [
+ 'http://uploads.linear.app/a.png',
+ 'https://uploads.linear.app.evil.io/a.png',
+ 'https://evil.io/uploads.linear.app/a.png',
+ 'https://[email protected]/a.png',
+ 'https://uploads.linear.app:8443/a.png',
+ '//uploads.linear.app/a.png',
+ 'not a url',
+ ]) {
+ expect(() => assertLinearUploadUrl(bad)).toThrow();
+ }
+ });
+ });
+
+ test('every atomic sends a request that can be captured for schema validation', async () => {
+ const samples: Record<string, Record<string, unknown>> = {
+ linear_issue_create: { team_id: UUID, title: 'T', description: 'D', assignee_id: UUID, state_id: UUID, priority: 2, label_ids: [UUID], project_id: UUID, project_milestone_id: UUID, cycle_id: UUID, parent_id: UUID2, due_date: '2026-10-15', estimate: 3, template_id: UUID },
+ linear_issue_update: { issue_id: UUID, title: 'T', state_id: UUID, add_label_ids: [UUID], due_date: '2026-10-15', estimate: 2, clear_fields: ['assigneeId'] },
+ linear_issue_get: { issue_id: 'ENG-1' },
+ linear_issues_list: { team_id: UUID, project_id: UUID, assignee_id: UUID, state_type: 'started', label_id: UUID, cycle_id: UUID, priority: 1, updated_after: '2026-09-01T00:00:00Z', include_archived: true, order_by: 'updatedAt', limit: 10, cursor: 'abc' },
+ linear_issues_search: { term: 'login', team_id: UUID, include_comments: true, limit: 5 },
+ linear_issue_archive: { issue_id: UUID },
+ linear_issue_unarchive: { issue_id: UUID },
+ linear_issue_delete: { issue_id: UUID },
+ linear_issue_relation_create: { issue_id: UUID, related_issue_id: UUID2, type: 'blocks' },
+ linear_issue_add_label: { issue_id: UUID, label_id: UUID },
+ linear_issue_remove_label: { issue_id: UUID, label_id: UUID },
+ linear_issue_label_create: { name: 'Bug', team_id: UUID, color: '#EB5757', description: 'd' },
+ linear_issue_labels_list: { team_id: UUID, name_contains: 'bu' },
+ linear_workflow_states_list: { team_id: UUID },
+ linear_teams_list: { include_archived: true },
+ linear_team_get: { team_id: UUID },
+ linear_team_create: { name: 'Platform', key: 'plt', cycles_enabled: 'false' },
+ linear_team_update: { team_id: UUID, name: 'Platform 2', triage_enabled: 'true' },
+ linear_users_list: { email: '[email protected]', name_contains: 'ja', include_disabled: true },
+ linear_viewer_get: {},
+ linear_cycles_list: { team_id: UUID, which: 'isNext' },
+ linear_comment_create: { issue_id: UUID, body: 'hello', parent_id: UUID2 },
+ linear_comment_get: { comment_id: UUID },
+ linear_comments_list: { issue_id: UUID },
+ linear_comment_update: { comment_id: UUID, body: 'edited' },
+ linear_comment_resolve: { comment_id: UUID, resolving_comment_id: UUID2 },
+ linear_comment_unresolve: { comment_id: UUID },
+ linear_comment_reaction_create: { comment_id: UUID, emoji: ':thumbsup:' },
+ linear_reaction_delete: { reaction_id: UUID },
+ linear_attachment_create: { issue_id: UUID, url: 'https://github.com/a/b/pull/1', title: 'PR 1', subtitle: 'Open' },
+ linear_attachment_get: { attachment_id: UUID },
+ linear_project_create: { team_ids: [UUID], name: 'P', description: 'S', lead_id: UUID, priority: 3, status_id: UUID, start_date: '2026-10-01', target_date: '2026-12-15', icon: 'Rocket', color: '#5E6AD2' },
+ linear_project_update: { project_id: UUID, name: 'P2', clear_fields: ['leadId'] },
+ linear_projects_list: { team_id: UUID, status_type: 'started', name_contains: 'web', include_archived: true },
+ linear_project_get: { project_id: UUID },
+ linear_project_delete: { project_id: UUID },
+ linear_project_unarchive: { project_id: UUID },
+ linear_project_milestone_create: { project_id: UUID, name: 'Beta', description: 'd', target_date: '2026-11-30' },
+ linear_project_status_update_create: { project_id: UUID, body: 'On track', health: 'onTrack' },
+ linear_project_status_update_get: { status_update_id: UUID },
+ linear_project_status_updates_list: { project_id: UUID },
+ linear_project_status_update_edit: { status_update_id: UUID, health: 'atRisk' },
+ linear_project_status_update_archive: { status_update_id: UUID },
+ linear_project_status_update_unarchive: { status_update_id: UUID },
+ };
+ const captured: Array<{ action: string; query: string; variables: unknown }> = [];
+ for (const atomic of linearAtomics) {
+ if (atomic.name === 'linear_upload_download') continue;
+ const props = samples[atomic.name];
+ expect(props, atomic.name).toBeDefined();
+ rawRequest.mockClear();
+ await run({ name: atomic.name, propsValue: props });
+ expect(rawRequest, atomic.name).toHaveBeenCalled();
+ for (const [query, variables] of rawRequest.mock.calls) {
+ captured.push({ action: atomic.name, query, variables: JSON.parse(JSON.stringify(variables ?? {})) });
+ }
+ }
+ expect(Object.keys(samples)).toHaveLength(44);
+ rawRequest.mockImplementation(async () => ({ data: populated() }));
+ for (const atomic of linearAtomics) {
+ if (atomic.name === 'linear_upload_download' || !atomic.outputSchema) continue;
+ const result = toRecord(await run({ name: atomic.name, propsValue: samples[atomic.name] }));
+ const fields = atomic.outputSchema.fields;
+ expect(Object.keys(result).sort(), atomic.name).toEqual(schemaKeys(fields));
+ const itemsField = fields.find((field) => field.key === 'items');
+ const items = result['items'];
+ if (itemsField?.listItems && Array.isArray(items)) {
+ expect(items.length, atomic.name).toBeGreaterThan(0);
+ expect(Object.keys(items[0]).sort(), `${atomic.name} items`).toEqual(schemaKeys(itemsField.listItems));
+ }
+ const milestones = fields.find((field) => field.key === 'milestones');
+ const milestoneItems = result['milestones'];
+ if (milestones?.listItems && Array.isArray(milestoneItems)) {
+ expect(Object.keys(milestoneItems[0]).sort(), `${atomic.name} milestones`).toEqual(schemaKeys(milestones.listItems));
+ }
+ }
+ const out = process.env['LINEAR_CAPTURE_FILE'];
+ if (out) writeFileSync(out, JSON.stringify(captured, null, 2));
+ });
+
+ describe('second calls stay idempotent (found in Tier-2)', () => {
+ const invalidInput = (message: string) => Object.assign(new Error('x'), { type: 'InvalidInput', errors: [{ message }] });
+
+ test('linear_issue_remove_label returns the issue when the label is already gone', async () => {
+ rawRequest.mockRejectedValueOnce(invalidInput(`Label ${UUID2} is not on issue ${UUID} and cannot be removed.`));
+ const result = toRecord(await run({ name: 'linear_issue_remove_label', propsValue: { issue_id: UUID, label_id: UUID2 } }));
+ expect(result['id']).toBeDefined();
+ expect(lastCall().query).toContain('LinearGetIssue');
+ });
+
+ test('linear_project_status_update_archive returns the update when it is already archived', async () => {
+ rawRequest.mockRejectedValueOnce(invalidInput('Could not find referenced ProjectUpdate.'));
+ rawRequest.mockResolvedValueOnce({ data: { projectUpdate: { id: UUID, body: 'b', url: 'u', isDiffHidden: false, createdAt: 'c', updatedAt: 'u', archivedAt: '2026-09-29T08:20:15.591Z' } } });
+ const result = toRecord(await run({ name: 'linear_project_status_update_archive', propsValue: { status_update_id: UUID } }));
+ expect(result).toMatchObject({ success: true, id: UUID, archived_at: '2026-09-29T08:20:15.591Z' });
+ });
+
+ test('linear_project_status_update_unarchive returns the update when it is already visible', async () => {
+ rawRequest.mockRejectedValueOnce(invalidInput('Could not find referenced ProjectUpdate.'));
+ rawRequest.mockResolvedValueOnce({ data: { projectUpdate: { id: UUID, body: 'b', url: 'u', isDiffHidden: false, createdAt: 'c', updatedAt: 'u', archivedAt: null } } });
+ const result = toRecord(await run({ name: 'linear_project_status_update_unarchive', propsValue: { status_update_id: UUID } }));
+ expect(result).toMatchObject({ success: true, id: UUID, archived_at: null });
+ });
+
+ test('archive still fails when the update does not exist', async () => {
+ rawRequest.mockRejectedValueOnce(invalidInput('Could not find referenced ProjectUpdate.'));
+ rawRequest.mockRejectedValueOnce(invalidInput('Could not find referenced ProjectUpdate.'));
+ await expect(run({ name: 'linear_project_status_update_archive', propsValue: { status_update_id: UUID } })).rejects.toThrow('No Linear project status update found');
+ });
+ });
+});
+
+describe('review fixes', () => {
+ beforeEach(() => {
+ rawRequest.mockReset();
+ rawRequest.mockImplementation(async () => ({ data: universal() }));
+ });
+
+ test('linear_issues_list combines state_id and state_type with AND', async () => {
+ await run({ name: 'linear_issues_list', propsValue: { state_id: UUID, state_type: 'started' } });
+ expect(lastCall().variables['filter']).toEqual({ state: { id: { eq: UUID }, type: { eq: 'started' } } });
+ await run({ name: 'linear_issues_list', propsValue: { state_type: 'started' } });
+ expect(lastCall().variables['filter']).toEqual({ state: { type: { eq: 'started' } } });
+ await run({ name: 'linear_issues_list', propsValue: { state_id: UUID } });
+ expect(lastCall().variables['filter']).toEqual({ state: { id: { eq: UUID } } });
+ await run({ name: 'linear_issues_list', propsValue: {} });
+ expect(lastCall().variables['filter']).toBeUndefined();
+ });
+
+ test('linear_project_get returns every milestone page', async () => {
+ const milestone = (id: string) => ({ id, name: `M ${id}`, targetDate: null, status: 'next' });
+ rawRequest.mockImplementation(async (query: string, variables: Record<string, unknown>) => {
+ if (query.includes('LinearAtomicProjectGet')) {
+ return {
+ data: {
+ project: {
+ id: UUID,
+ name: 'P',
+ projectMilestones: { pageInfo: { hasNextPage: true, endCursor: 'c1' }, nodes: [milestone('m1'), milestone('m2')] },
+ },
+ },
+ };
+ }
+ if (variables['after'] === 'c1') {
+ return { data: { project: { id: UUID, projectMilestones: { pageInfo: { hasNextPage: true, endCursor: 'c2' }, nodes: [milestone('m3')] } } } };
+ }
+ return { data: { project: { id: UUID, projectMilestones: { pageInfo: { hasNextPage: false, endCursor: null }, nodes: [milestone('m4')] } } } };
+ });
+ const result = toRecord(await run({ name: 'linear_project_get', propsValue: { project_id: UUID } }));
+ const milestones = result['milestones'];
+ expect(Array.isArray(milestones) ? milestones.map((m) => m.id) : milestones).toEqual(['m1', 'm2', 'm3', 'm4']);
+ const pageCalls = rawRequest.mock.calls.filter(([query]) => String(query).includes('LinearAtomicProjectMilestonesPage'));
+ expect(pageCalls.map(([, variables]) => variables.after)).toEqual(['c1', 'c2']);
+ });
+});
+
+describe('pre-review fixes', () => {
+ beforeEach(() => {
+ rawRequest.mockReset();
+ rawRequest.mockImplementation(async () => ({ data: universal() }));
+ });
+
+ const labels = ({ from, count }: { from: number; count: number }) =>
+ Array.from({ length: count }, (_, index) => ({ id: `label-${from + index}`, name: `L${from + index}` }));
+ const teams = ({ from, count }: { from: number; count: number }) =>
+ Array.from({ length: count }, (_, index) => ({ id: `team-${from + index}`, key: `T${from + index}`, name: `Team ${from + index}` }));
+ const issue = ({ id, count, hasNextPage }: { id: string; count: number; hasNextPage: boolean }) => ({
+ id,
+ identifier: 'ENG-1',
+ title: 'T',
+ labels: { pageInfo: { hasNextPage, endCursor: `label-${count - 1}` }, nodes: labels({ from: 0, count }) },
+ });
+ const LABEL_TOTAL = 305;
+ const linearIssueLabels = ({ variables }: { variables: Record<string, unknown> }) => {
+ const all = labels({ from: 0, count: LABEL_TOTAL });
+ const first = typeof variables['first'] === 'number' ? variables['first'] : 50;
+ const after = variables['after'];
+ const filter = variables['filter'];
+ const idFilter = typeof filter === 'object' && filter !== null && 'id' in filter ? filter.id : undefined;
+ const excluded = typeof idFilter === 'object' && idFilter !== null && 'nin' in idFilter && Array.isArray(idFilter.nin) ? idFilter.nin : [];
+ const connection = ({ nodes, hasNextPage }: { nodes: typeof all; hasNextPage: boolean }) => ({
+ data: { issue: { labels: { pageInfo: { hasNextPage, endCursor: nodes.length > 0 ? nodes[nodes.length - 1].id : null }, nodes } } },
+ });
+ if (typeof after === 'string') {
+ return connection({ nodes: all.slice(0, Math.max(all.findIndex((label) => label.id === after), 0)).reverse().slice(0, first), hasNextPage: false });
+ }
+ if (filter !== undefined) {
+ const remaining = all.filter((label) => !excluded.includes(label.id)).reverse();
+ return connection({ nodes: remaining.slice(0, first), hasNextPage: remaining.length > first });
+ }
+ return connection({ nodes: all.slice(0, first), hasNextPage: all.length > first });
+ };
+ const project = ({ id, count, hasNextPage }: { id: string; count: number; hasNextPage: boolean }) => ({
+ id,
+ name: 'P',
+ teams: { pageInfo: { hasNextPage, endCursor: hasNextPage ? `${id}-teams-1` : null }, nodes: teams({ from: 0, count }) },
+ projectMilestones: { pageInfo: { hasNextPage: false, endCursor: null }, nodes: [] },
+ });
+ const pagedRelations = (first: Record<string, unknown>) => async (query: string, variables: Record<string, unknown>) => {
+ if (query.includes('LinearIssueLabelsPage')) {
+ return linearIssueLabels({ variables });
+ }
+ if (query.includes('LinearAtomicProjectTeamsPage')) {
+ return { data: { project: { teams: { pageInfo: { hasNextPage: false, endCursor: null }, nodes: teams({ from: 10, count: 12 }) } } } };
+ }
+ return { data: first };
+ };
+
+ test.each([
+ { name: 'linear_issue_get', propsValue: { issue_id: UUID }, first: { issue: issue({ id: UUID, count: 20, hasNextPage: true }) } },
+ { name: 'linear_issue_create', propsValue: { team_id: UUID, title: 'T' }, first: { issueCreate: { success: true, issue: issue({ id: UUID, count: 20, hasNextPage: true }) } } },
+ { name: 'linear_issue_update', propsValue: { issue_id: UUID, title: 'T' }, first: { issueUpdate: { success: true, issue: issue({ id: UUID, count: 20, hasNextPage: true }) } } },
+ { name: 'linear_issue_add_label', propsValue: { issue_id: UUID, label_id: UUID2 }, first: { issueAddLabel: { success: true, issue: issue({ id: UUID, count: 20, hasNextPage: true }) } } },
+ { name: 'linear_issue_remove_label', propsValue: { issue_id: UUID, label_id: UUID2 }, first: { issueRemoveLabel: { success: true, issue: issue({ id: UUID, count: 20, hasNextPage: true }) } } },
+ ])('$name returns every label of an issue with more than 20', async ({ name, propsValue, first }) => {
+ rawRequest.mockImplementation(pagedRelations(first));
+ const result = toRecord(await run({ name, propsValue }));
+ const ids = Array.isArray(result['label_ids']) ? result['label_ids'] : [];
+ expect([...ids].sort()).toEqual(labels({ from: 0, count: LABEL_TOTAL }).map((label) => label.id).sort());
+ expect(new Set(ids).size).toBe(LABEL_TOTAL);
+ expect(result['labels_complete']).toBe(true);
+ const pages = rawRequest.mock.calls.filter(([query]) => String(query).includes('LinearIssueLabelsPage'));
+ expect(pages.map(([, variables]) => variables)).toEqual([
+ { id: UUID, first: 250 },
+ { id: UUID, first: 250, filter: { id: { nin: labels({ from: 0, count: 250 }).map((label) => label.id) } } },
+ ]);
+ });
+
+ test.each([
+ { name: 'linear_issues_list', propsValue: {}, field: 'issues' },
+ { name: 'linear_issues_search', propsValue: { term: 'x' }, field: 'searchIssues' },
+ ])('$name completes the labels only of the issues that have more than 20', async ({ name, propsValue, field }) => {
+ rawRequest.mockImplementation(
+ pagedRelations({ [field]: { totalCount: 2, pageInfo: { hasNextPage: false, endCursor: null }, nodes: [issue({ id: 'a', count: 20, hasNextPage: true }), issue({ id: 'b', count: 3, hasNextPage: false })] } }),
+ );
+ const result = toRecord(await run({ name, propsValue }));
+ const items = Array.isArray(result['items']) ? result['items'].map((item) => toRecord(item)['label_ids']) : [];
+ expect(items.map((ids) => (Array.isArray(ids) ? [...ids].sort() : ids))).toEqual([
+ labels({ from: 0, count: LABEL_TOTAL }).map((label) => label.id).sort(),
+ ['label-0', 'label-1', 'label-2'],
+ ]);
+ const pages = rawRequest.mock.calls.filter(([query]) => String(query).includes('LinearIssueLabelsPage'));
+ expect(pages.map(([, variables]) => variables['id'])).toEqual(['a', 'a']);
+ });
+
+ test.each([
+ { name: 'linear_project_get', propsValue: { project_id: UUID }, first: { project: project({ id: UUID, count: 10, hasNextPage: true }) } },
+ { name: 'linear_project_create', propsValue: { name: 'P', team_ids: [UUID] }, first: { projectCreate: { success: true, project: project({ id: UUID, count: 10, hasNextPage: true }) } } },
+ { name: 'linear_project_update', propsValue: { project_id: UUID, name: 'P' }, first: { projectUpdate: { success: true, project: project({ id: UUID, count: 10, hasNextPage: true }) } } },
+ ])('$name returns every team of a project with more than 10', async ({ name, propsValue, first }) => {
+ rawRequest.mockImplementation(pagedRelations(first));
+ const result = toRecord(await run({ name, propsValue }));
+ expect(result['team_ids']).toEqual(teams({ from: 0, count: 22 }).map((team) => team.id));
+ expect(result['teams_complete']).toBe(true);
+ const pages = rawRequest.mock.calls.filter(([query]) => String(query).includes('LinearAtomicProjectTeamsPage'));
+ expect(pages.map(([, variables]) => variables)).toEqual([{ id: UUID, after: `${UUID}-teams-1` }]);
+ });
+
+ const issueWrite = (field: string) => ({ [field]: { success: true, issue: issue({ id: UUID, count: 20, hasNextPage: true }) } });
+ const projectWrite = (field: string) => ({ [field]: { success: true, project: project({ id: UUID, count: 10, hasNextPage: true }) } });
+ const labelFailure = { pageQuery: 'LinearIssueLabelsPage', field: 'label_ids', flag: 'labels_complete', expected: labels({ from: 0, count: 20 }).map((label) => label.id) };
+ const teamFailure = { pageQuery: 'LinearAtomicProjectTeamsPage', field: 'team_ids', flag: 'teams_complete', expected: teams({ from: 0, count: 10 }).map((team) => team.id) };
+
+ test.each([
+ { name: 'linear_issue_create', propsValue: { team_id: UUID, title: 'T' }, first: issueWrite('issueCreate'), ...labelFailure },
+ { name: 'linear_issue_update', propsValue: { issue_id: UUID, title: 'T' }, first: issueWrite('issueUpdate'), ...labelFailure },
+ { name: 'linear_issue_add_label', propsValue: { issue_id: UUID, label_id: UUID2 }, first: issueWrite('issueAddLabel'), ...labelFailure },
+ { name: 'linear_issue_remove_label', propsValue: { issue_id: UUID, label_id: UUID2 }, first: issueWrite('issueRemoveLabel'), ...labelFailure },
+ { name: 'linear_project_create', propsValue: { name: 'P', team_ids: [UUID] }, first: projectWrite('projectCreate'), ...teamFailure },
+ { name: 'linear_project_update', propsValue: { project_id: UUID, name: 'P' }, first: projectWrite('projectUpdate'), ...teamFailure },
+ ])('$name succeeds with the first page and the flag false when reading the remaining pages fails', async ({ name, propsValue, first, pageQuery, field, flag, expected }) => {
+ rawRequest.mockImplementation(async (query: string) => {
+ if (query.includes(pageQuery)) {
+ throw new Error('Linear rate limit reached.');
+ }
+ return { data: first };
+ });
+ const result = toRecord(await run({ name, propsValue }));
+ expect(result).toMatchObject({ id: UUID });
+ expect(result[field]).toEqual(expected);
+ expect(result[flag]).toBe(false);
+ expect(rawRequest.mock.calls.filter(([query]) => String(query).includes(pageQuery))).toHaveLength(1);
+ });
+
+ test.each([
+ { name: 'linear_issue_get', propsValue: { issue_id: UUID }, first: { issue: issue({ id: UUID, count: 3, hasNextPage: false }) }, flag: 'labels_complete' },
+ { name: 'linear_project_get', propsValue: { project_id: UUID }, first: { project: project({ id: UUID, count: 2, hasNextPage: false }) }, flag: 'teams_complete' },
+ ])('$name sets $flag true without another request when the first page has everything', async ({ name, propsValue, first, flag }) => {
+ rawRequest.mockImplementation(async () => ({ data: first }));
+ const result = toRecord(await run({ name, propsValue }));
+ expect(result[flag]).toBe(true);
+ expect(rawRequest).toHaveBeenCalledTimes(1);
+ });
+
+ test.each([
+ { name: 'linear_issues_list', propsValue: {}, field: 'issues', pageQuery: 'LinearIssueLabelsPage', flag: 'labels_complete' },
+ { name: 'linear_issues_search', propsValue: { term: 'x' }, field: 'searchIssues', pageQuery: 'LinearIssueLabelsPage', flag: 'labels_complete' },
+ { name: 'linear_projects_list', propsValue: {}, field: 'projects', pageQuery: 'LinearAtomicProjectTeamsPage', flag: 'teams_complete' },
+ ])('$name reads the remaining pages of several records at once and marks only the failed one incomplete', async ({ name, propsValue, field, pageQuery, flag }) => {
+ const isIssue = pageQuery === 'LinearIssueLabelsPage';
+ const nodes = ['r1', 'r2', 'r3'].map((id) => (isIssue ? issue({ id, count: 20, hasNextPage: true }) : project({ id, count: 10, hasNextPage: true })));
+ let inFlight = 0;
+ let maxInFlight = 0;
+ rawRequest.mockImplementation(async (query: string, variables: Record<string, unknown>) => {
+ if (!query.includes(pageQuery)) {
+ return { data: { [field]: { totalCount: 3, pageInfo: { hasNextPage: false, endCursor: null }, nodes } } };
+ }
+ inFlight += 1;
+ maxInFlight = Math.max(maxInFlight, inFlight);
+ await new Promise((resolve) => setTimeout(resolve, 10));
+ inFlight -= 1;
+ if (variables['id'] === 'r2') {
+ throw new Error('Linear rate limit reached.');
+ }
+ return isIssue
+ ? { data: { issue: { labels: { pageInfo: { hasNextPage: false, endCursor: null }, nodes: labels({ from: 20, count: 1 }) } } } }
+ : { data: { project: { teams: { pageInfo: { hasNextPage: false, endCursor: null }, nodes: teams({ from: 10, count: 1 }) } } } };
+ });
+ const result = toRecord(await run({ name, propsValue }));
+ const items = Array.isArray(result['items']) ? result['items'].map((item) => toRecord(item)) : [];
+ expect(maxInFlight).toBe(3);
+ expect(items.map((item) => item[flag])).toEqual([true, false, true]);
+ expect(items.map((item) => item['id'])).toEqual(['r1', 'r2', 'r3']);
+ });
+
+ test('linear_project_get keeps the milestones read and sets milestones_complete false when a later page fails', async () => {
+ rawRequest.mockImplementation(async (query: string) => {
+ if (query.includes('LinearAtomicProjectMilestonesPage')) {
+ throw new Error('Linear rate limit reached.');
+ }
+ return {
+ data: {
+ project: {
+ ...project({ id: UUID, count: 2, hasNextPage: false }),
+ projectMilestones: { pageInfo: { hasNextPage: true, endCursor: 'm-1' }, nodes: [{ id: 'm1', name: 'M1', status: 'next' }] },
+ },
+ },
+ };
+ });
+ const result = toRecord(await run({ name: 'linear_project_get', propsValue: { project_id: UUID } }));
+ expect(Array.isArray(result['milestones']) ? result['milestones'].length : 0).toBe(1);
+ expect(result['milestones_complete']).toBe(false);
+ expect(result['teams_complete']).toBe(true);
+ });
+
+ test.each([
+ { name: 'linear_issues_list', fragment: 'labels(first: 20)' },
+ { name: 'linear_projects_list', fragment: 'teams(first: 10)' },
+ ])('$name asks for few enough nested records per item to stay under Linear complexity limit', async ({ name, fragment }) => {
+ await run({ name, propsValue: { limit: 250 } });
+ expect(String(rawRequest.mock.calls[0][0])).toContain(fragment);
+ expect(rawRequest.mock.calls[0][1]).toMatchObject({ first: 250 });
+ });
+
+ test.each(['linear_issue_add_label', 'linear_issue_remove_label'])('%s asks for the label before looking up the issue', async (name) => {
+ await expect(run({ name, propsValue: { issue_id: 'ENG-7', label_id: ' ' } })).rejects.toThrow('Label ID is required.');
+ expect(rawRequest).not.toHaveBeenCalled();
+ });
+
+ test('linear_projects_list completes the teams of each project that has more than 10', async () => {
+ rawRequest.mockImplementation(
+ pagedRelations({ projects: { pageInfo: { hasNextPage: false, endCursor: null }, nodes: [project({ id: 'p1', count: 10, hasNextPage: true }), project({ id: 'p2', count: 2, hasNextPage: false })] } }),
+ );
+ const result = toRecord(await run({ name: 'linear_projects_list', propsValue: {} }));
+ const items = Array.isArray(result['items']) ? result['items'].map((item) => toRecord(item)['team_ids']) : [];
+ expect(items).toEqual([teams({ from: 0, count: 22 }).map((team) => team.id), ['team-0', 'team-1']]);
+ });
+
+ test.each([
+ { name: 'linear_issue_archive', propsValue: { issue_id: UUID }, field: 'issueArchive', entity: { id: UUID, archivedAt: '2026-09-29T15:47:48.633Z' } },
+ { name: 'linear_issue_unarchive', propsValue: { issue_id: UUID }, field: 'issueUnarchive', entity: { id: UUID, archivedAt: null } },
+ { name: 'linear_project_unarchive', propsValue: { project_id: UUID }, field: 'projectUnarchive', entity: { id: UUID, archivedAt: null } },
+ ])('$name: a second call returns normally, as Linear answers success again (probed live)', async ({ name, propsValue, field, entity }) => {
+ rawRequest.mockImplementation(async () => ({ data: { [field]: { success: true, entity } } }));
+ const first = toRecord(await run({ name, propsValue }));
+ const second = toRecord(await run({ name, propsValue }));
+ expect(second).toEqual(first);
+ expect(second).toMatchObject({ success: true, id: UUID, archived_at: entity.archivedAt });
+ });
+
+ test.each([
+ { name: 'linear_comment_resolve', field: 'commentResolve', resolvedAt: '2026-09-29T15:48:09.856Z' },
+ { name: 'linear_comment_unresolve', field: 'commentUnresolve', resolvedAt: null },
+ ])('$name: a second call returns normally, as Linear answers success again (probed live)', async ({ name, field, resolvedAt }) => {
+ rawRequest.mockImplementation(async () => ({ data: { [field]: { success: true, comment: { id: UUID, body: 'b', url: 'u', createdAt: 'c', updatedAt: 'u', resolvedAt } } } }));
+ const first = toRecord(await run({ name, propsValue: { comment_id: UUID } }));
+ const second = toRecord(await run({ name, propsValue: { comment_id: UUID } }));
+ expect(second).toEqual(first);
+ expect(second).toMatchObject({ id: UUID, resolved_at: resolvedAt });
+ });
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/attachment-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/attachment-create.ts
new file mode 100644
index 00000000000..b898d3048d0
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/attachment-create.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearAttachmentNode, linearMappers } from '../../common/mappers';
+import { ATTACHMENT_CREATE_MUTATION } from '../../common/queries';
+import { atomicAttachmentOutputSchema } from './output-schemas';
+
+export const linearAttachmentCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_attachment_create',
+ classification: 'WRITE',
+ displayName: 'Attach Link to Issue (AI)',
+ description: 'Attach a URL to an issue, or update the existing attachment with the same URL.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Attaches an external URL (pull request, support ticket, document) to a Linear issue with a title and optional subtitle, shown in the issue sidebar. Use to link records in other tools to an issue; this does not upload files. Idempotent: attaching the same URL to the same issue again updates the existing attachment instead of adding another.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({ displayName: 'Issue', description: 'UUID or identifier of the issue, for example ENG-123.', required: true }),
+ url: Property.ShortText({ displayName: 'URL', description: 'Full link, for example https://github.com/acme/app/pull/42.', required: true }),
+ title: Property.ShortText({ displayName: 'Title', description: 'Text shown for the link, for example "PR #42".', required: true }),
+ subtitle: Property.ShortText({ displayName: 'Subtitle', description: 'Optional second line, for example "Merged".', required: false }),
+ },
+ outputSchema: atomicAttachmentOutputSchema,
+ async run({ auth, propsValue }) {
+ const url = propsValue.url.trim();
+ if (!/^https?:\/\//i.test(url)) {
+ throw new Error('URL must start with http:// or https://.');
+ }
+ const issueId = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const data = await linearGraphql.request<{
+ attachmentCreate: { success: boolean; attachment: LinearAttachmentNode };
+ }>({
+ auth,
+ query: ATTACHMENT_CREATE_MUTATION,
+ variables: {
+ input: linearGraphql.definedOnly({ issueId, url, title: propsValue.title, subtitle: propsValue.subtitle }),
+ },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.attachmentCreate, what: 'attachment' });
+ return linearMappers.flattenAttachment(payload.attachment);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/attachment-get.ts b/packages/pieces/community/linear/src/lib/actions/atomics/attachment-get.ts
new file mode 100644
index 00000000000..17e126ffd1d
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/attachment-get.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearAttachmentNode, linearMappers } from '../../common/mappers';
+import { ATTACHMENT_GET_QUERY } from './queries';
+import { atomicAttachmentOutputSchema } from './output-schemas';
+
+export const linearAttachmentGetAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_attachment_get',
+ classification: 'READ',
+ displayName: 'Get Attachment (AI)',
+ description: 'Get one issue attachment (link) by ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one Linear issue attachment by ID: its URL, title, subtitle, source type and the issue it belongs to. Use to inspect a link attached to an issue; to fetch the bytes of a file uploaded into Linear, use Download Linear Upload with the uploads.linear.app URL instead. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ attachment_id: Property.ShortText({ displayName: 'Attachment ID', description: 'UUID of the attachment.', required: true }),
+ },
+ outputSchema: atomicAttachmentOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{ attachment: LinearAttachmentNode | null }>({
+ auth,
+ query: ATTACHMENT_GET_QUERY,
+ variables: { id: propsValue.attachment_id.trim() },
+ });
+ if (!data.attachment) {
+ throw new Error(`No Linear attachment found for ${propsValue.attachment_id}.`);
+ }
+ return linearMappers.flattenAttachment(data.attachment);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/comment-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/comment-create.ts
new file mode 100644
index 00000000000..deeee1e0e4a
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/comment-create.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearCommentNode } from './common';
+import { COMMENT_CREATE_MUTATION } from './queries';
+import { atomicCommentOutputSchema } from './output-schemas';
+
+export const linearCommentCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_comment_create',
+ classification: 'WRITE',
+ displayName: 'Create Comment (AI)',
+ description: 'Post a comment on an issue, or reply inside an existing comment thread.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Posts a markdown comment on a Linear issue (UUID or identifier like ENG-123) as the API key owner, optionally as a reply in the thread of an existing comment. Use to add notes or updates to an issue; use Update Comment to edit one. Not idempotent: each call posts a new comment.',
+ idempotent: false,
+ },
+ props: {
+ issue_id: Property.ShortText({ displayName: 'Issue', description: 'UUID or identifier of the issue, for example ENG-123.', required: true }),
+ body: Property.LongText({ displayName: 'Body', description: 'Comment text in Markdown.', required: true }),
+ parent_id: Property.ShortText({ displayName: 'Reply To Comment ID', description: 'UUID of a comment on the same issue to reply to (from List Comments). Leave empty for a new thread.', required: false }),
+ },
+ outputSchema: atomicCommentOutputSchema,
+ async run({ auth, propsValue }) {
+ if (propsValue.body.trim().length === 0) {
+ throw new Error('Body cannot be empty.');
+ }
+ const issueId = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const data = await linearGraphql.request<{
+ commentCreate: { success: boolean; comment: LinearCommentNode };
+ }>({
+ auth,
+ query: COMMENT_CREATE_MUTATION,
+ variables: {
+ input: linearGraphql.definedOnly({ issueId, body: propsValue.body, parentId: propsValue.parent_id }),
+ },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.commentCreate, what: 'comment' });
+ return atomicMappers.flattenComment(payload.comment);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/comment-get.ts b/packages/pieces/community/linear/src/lib/actions/atomics/comment-get.ts
new file mode 100644
index 00000000000..c90f5079450
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/comment-get.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearCommentNode } from './common';
+import { COMMENT_GET_QUERY } from './queries';
+import { atomicCommentOutputSchema } from './output-schemas';
+
+export const linearCommentGetAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_comment_get',
+ classification: 'READ',
+ displayName: 'Get Comment (AI)',
+ description: 'Get one comment by ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one Linear comment by ID with its markdown body, author, issue, parent comment and resolved state. Use when a comment ID is already known (for example from the New Comment trigger); use List Comments to browse an issue\'s comments. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ comment_id: Property.ShortText({ displayName: 'Comment ID', description: 'UUID of the comment.', required: true }),
+ },
+ outputSchema: atomicCommentOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{ comment: LinearCommentNode | null }>({
+ auth,
+ query: COMMENT_GET_QUERY,
+ variables: { id: propsValue.comment_id.trim() },
+ });
+ if (!data.comment) {
+ throw new Error(`No Linear comment found for ${propsValue.comment_id}.`);
+ }
+ return atomicMappers.flattenComment(data.comment);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/comment-reaction-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/comment-reaction-create.ts
new file mode 100644
index 00000000000..6dc87f35e7e
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/comment-reaction-create.ts
@@ -0,0 +1,40 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearReactionNode } from './common';
+import { REACTION_CREATE_MUTATION } from './queries';
+import { atomicReactionOutputSchema } from './output-schemas';
+
+export const linearCommentReactionCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_comment_reaction_create',
+ classification: 'WRITE',
+ displayName: 'React to Comment (AI)',
+ description: 'Add an emoji reaction to a comment.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Adds an emoji reaction from the API key owner to a Linear comment, for example to acknowledge it without writing a reply. Pass the emoji as its name (thumbsup, eyes, white_check_mark) or as the emoji character. Remove it later with Delete Reaction using the returned ID. Not idempotent: a repeat call may add a second reaction or fail.',
+ idempotent: false,
+ },
+ props: {
+ comment_id: Property.ShortText({ displayName: 'Comment ID', description: 'UUID of the comment.', required: true }),
+ emoji: Property.ShortText({ displayName: 'Emoji', description: 'Emoji name such as thumbsup or eyes, or the emoji itself.', required: true }),
+ },
+ outputSchema: atomicReactionOutputSchema,
+ async run({ auth, propsValue }) {
+ const emoji = propsValue.emoji.trim().replace(/^:(.+):$/, '$1');
+ if (emoji.length === 0) {
+ throw new Error('Emoji is required.');
+ }
+ const data = await linearGraphql.request<{
+ reactionCreate: { success: boolean; reaction: LinearReactionNode };
+ }>({
+ auth,
+ query: REACTION_CREATE_MUTATION,
+ variables: { input: { commentId: propsValue.comment_id.trim(), emoji } },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.reactionCreate, what: 'reaction' });
+ return atomicMappers.flattenReaction(payload.reaction);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/comment-resolve.ts b/packages/pieces/community/linear/src/lib/actions/atomics/comment-resolve.ts
new file mode 100644
index 00000000000..1b9f34ca83f
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/comment-resolve.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearCommentNode } from './common';
+import { COMMENT_RESOLVE_MUTATION } from './queries';
+import { atomicCommentOutputSchema } from './output-schemas';
+
+export const linearCommentResolveAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_comment_resolve',
+ classification: 'WRITE',
+ displayName: 'Resolve Comment Thread (AI)',
+ description: 'Mark a comment thread as resolved.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Marks a Linear comment thread as resolved, which collapses it on the issue; pass the top comment of the thread, optionally with the reply that resolved it. Use when a question in a thread has been answered; use Unresolve Comment Thread to reopen it. Idempotent: resolving a resolved thread keeps it resolved.',
+ idempotent: true,
+ },
+ props: {
+ comment_id: Property.ShortText({ displayName: 'Thread Comment ID', description: 'UUID of the first comment of the thread.', required: true }),
+ resolving_comment_id: Property.ShortText({ displayName: 'Resolving Reply ID', description: 'UUID of the reply that resolved the thread, if any.', required: false }),
+ },
+ outputSchema: atomicCommentOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{
+ commentResolve: { success: boolean; comment: LinearCommentNode };
+ }>({
+ auth,
+ query: COMMENT_RESOLVE_MUTATION,
+ variables: {
+ id: propsValue.comment_id.trim(),
+ resolvingCommentId: propsValue.resolving_comment_id?.trim() || undefined,
+ },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.commentResolve, what: 'thread resolve' });
+ return atomicMappers.flattenComment(payload.comment);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/comment-unresolve.ts b/packages/pieces/community/linear/src/lib/actions/atomics/comment-unresolve.ts
new file mode 100644
index 00000000000..be099c27d08
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/comment-unresolve.ts
@@ -0,0 +1,31 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearCommentNode } from './common';
+import { COMMENT_UNRESOLVE_MUTATION } from './queries';
+import { atomicCommentOutputSchema } from './output-schemas';
+
+export const linearCommentUnresolveAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_comment_unresolve',
+ classification: 'WRITE',
+ displayName: 'Unresolve Comment Thread (AI)',
+ description: 'Reopen a resolved comment thread.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reopens a resolved Linear comment thread so it shows as open on the issue again; pass the first comment of the thread. Use to undo Resolve Comment Thread when a discussion needs more work. Idempotent: reopening an open thread keeps it open.',
+ idempotent: true,
+ },
+ props: {
+ comment_id: Property.ShortText({ displayName: 'Thread Comment ID', description: 'UUID of the first comment of the thread.', required: true }),
+ },
+ outputSchema: atomicCommentOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{
+ commentUnresolve: { success: boolean; comment: LinearCommentNode };
+ }>({ auth, query: COMMENT_UNRESOLVE_MUTATION, variables: { id: propsValue.comment_id.trim() } });
+ const payload = linearGraphql.requireSuccess({ payload: data.commentUnresolve, what: 'thread reopen' });
+ return atomicMappers.flattenComment(payload.comment);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/comment-update.ts b/packages/pieces/community/linear/src/lib/actions/atomics/comment-update.ts
new file mode 100644
index 00000000000..5f3dab9800e
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/comment-update.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearCommentNode } from './common';
+import { COMMENT_UPDATE_MUTATION } from './queries';
+import { atomicCommentOutputSchema } from './output-schemas';
+
+export const linearCommentUpdateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_comment_update',
+ classification: 'WRITE',
+ displayName: 'Update Comment (AI)',
+ description: 'Replace the text of a comment.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Replaces the markdown body of an existing Linear comment; Linear normally only lets the author edit their own comment. Use to correct or extend a comment the flow posted earlier; use Create Comment to add a new one. Idempotent: setting the same body again leaves the comment unchanged.',
+ idempotent: true,
+ },
+ props: {
+ comment_id: Property.ShortText({ displayName: 'Comment ID', description: 'UUID of the comment (from List Comments or Create Comment).', required: true }),
+ body: Property.LongText({ displayName: 'Body', description: 'The new comment text in Markdown. Replaces the whole body.', required: true }),
+ },
+ outputSchema: atomicCommentOutputSchema,
+ async run({ auth, propsValue }) {
+ if (propsValue.body.trim().length === 0) {
+ throw new Error('Body cannot be empty.');
+ }
+ const data = await linearGraphql.request<{
+ commentUpdate: { success: boolean; comment: LinearCommentNode };
+ }>({
+ auth,
+ query: COMMENT_UPDATE_MUTATION,
+ variables: { id: propsValue.comment_id.trim(), input: { body: propsValue.body } },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.commentUpdate, what: 'comment update' });
+ return atomicMappers.flattenComment(payload.comment);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/comments-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/comments-list.ts
new file mode 100644
index 00000000000..fe34c323287
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/comments-list.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, linearMappers } from '../../common/mappers';
+import { atomicMappers, atomicProps, LinearCommentNode } from './common';
+import { COMMENTS_LIST_QUERY } from './queries';
+import { atomicCommentsPageOutputSchema } from './output-schemas';
+
+export const linearCommentsListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_comments_list',
+ classification: 'SEARCH',
+ displayName: 'List Comments (AI)',
+ description: 'List comments, usually the comments of one issue.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Linear comments with body, author and thread parent, normally for one issue (UUID or identifier like ENG-123), one page at a time. Without an issue it lists recent comments across the workspace. Use to read a discussion or find the comment ID to reply to, resolve or react to. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({ displayName: 'Issue', description: 'UUID or identifier of the issue, for example ENG-123. Leave empty for every issue.', required: false }),
+ limit: atomicProps.limitProp({ fallback: 50, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicCommentsPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const issueId = propsValue.issue_id?.trim()
+ ? await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id })
+ : undefined;
+ const data = await linearGraphql.request<{ comments: LinearConnection<LinearCommentNode> }>({
+ auth,
+ query: COMMENTS_LIST_QUERY,
+ variables: {
+ filter: issueId ? { issue: { id: { eq: issueId } } } : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 50, max: 250 }),
+ after: propsValue.cursor || undefined,
+ },
+ });
+ return linearMappers.toPage({ connection: data.comments, map: atomicMappers.flattenComment });
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/common.ts b/packages/pieces/community/linear/src/lib/actions/atomics/common.ts
new file mode 100644
index 00000000000..0fb6cbf3d5c
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/common.ts
@@ -0,0 +1,560 @@
+import { Property } from '@activepieces/pieces-framework';
+import { LinearAuth, linearGraphql } from '../../common/graphql';
+import { LinearProjectStatusUpdateNode } from '../../common/mappers';
+import { PROJECT_STATUS_UPDATE_GET_QUERY, PROJECT_TEAMS_PAGE_QUERY } from './queries';
+
+function flattenProject(project: LinearProjectNode) {
+ const teams = project.teams?.nodes ?? [];
+ return {
+ id: project.id,
+ name: project.name,
+ description: project.description ?? null,
+ url: project.url,
+ icon: project.icon ?? null,
+ color: project.color ?? null,
+ priority: project.priority,
+ priority_label: project.priorityLabel,
+ progress: project.progress,
+ health: project.health ?? null,
+ start_date: project.startDate ?? null,
+ target_date: project.targetDate ?? null,
+ status_id: project.status?.id ?? null,
+ status_name: project.status?.name ?? null,
+ status_type: project.status?.type ?? null,
+ lead_id: project.lead?.id ?? null,
+ lead_name: project.lead?.name ?? null,
+ lead_email: project.lead?.email ?? null,
+ creator_id: project.creator?.id ?? null,
+ creator_name: project.creator?.name ?? null,
+ team_ids: teams.map((team) => team.id),
+ team_names: teams.map((team) => team.name).join(', '),
+ teams_complete: project.teams?.pageInfo?.hasNextPage !== true,
+ created_at: project.createdAt,
+ updated_at: project.updatedAt,
+ completed_at: project.completedAt ?? null,
+ canceled_at: project.canceledAt ?? null,
+ archived_at: project.archivedAt ?? null,
+ trashed: project.trashed ?? false,
+ };
+}
+
+function flattenProjectWithMilestones(project: LinearProjectNode) {
+ return {
+ ...flattenProject(project),
+ milestones: (project.projectMilestones?.nodes ?? []).map((milestone) => ({
+ id: milestone.id,
+ name: milestone.name,
+ target_date: milestone.targetDate ?? null,
+ status: milestone.status,
+ })),
+ milestones_complete: project.projectMilestones?.pageInfo?.hasNextPage !== true,
+ };
+}
+
+function flattenArchivedProject(entity: LinearArchivedProjectNode | null | undefined) {
+ return {
+ success: true,
+ id: entity?.id ?? null,
+ name: entity?.name ?? null,
+ url: entity?.url ?? null,
+ trashed: entity?.trashed ?? null,
+ archived_at: entity?.archivedAt ?? null,
+ };
+}
+
+function flattenComment(comment: LinearCommentNode) {
+ return {
+ id: comment.id,
+ body: comment.body,
+ url: comment.url,
+ user_id: comment.user?.id ?? null,
+ user_name: comment.user?.name ?? null,
+ user_email: comment.user?.email ?? null,
+ issue_id: comment.issue?.id ?? null,
+ issue_identifier: comment.issue?.identifier ?? null,
+ issue_title: comment.issue?.title ?? null,
+ parent_id: comment.parent?.id ?? null,
+ resolved_at: comment.resolvedAt ?? null,
+ resolving_user_id: comment.resolvingUser?.id ?? null,
+ resolving_user_name: comment.resolvingUser?.name ?? null,
+ created_at: comment.createdAt,
+ updated_at: comment.updatedAt,
+ edited_at: comment.editedAt ?? null,
+ };
+}
+
+function flattenTeam(team: LinearTeamNode) {
+ return {
+ id: team.id,
+ key: team.key,
+ name: team.name,
+ description: team.description ?? null,
+ icon: team.icon ?? null,
+ color: team.color ?? null,
+ timezone: team.timezone,
+ cycles_enabled: team.cyclesEnabled,
+ triage_enabled: team.triageEnabled,
+ default_issue_estimate: team.defaultIssueEstimate,
+ issue_estimation_type: team.issueEstimationType,
+ created_at: team.createdAt,
+ updated_at: team.updatedAt,
+ archived_at: team.archivedAt ?? null,
+ };
+}
+
+function flattenTeamDetails(team: LinearTeamNode) {
+ return {
+ ...flattenTeam(team),
+ issue_count: team.issueCount ?? null,
+ default_issue_state_id: team.defaultIssueState?.id ?? null,
+ default_issue_state_name: team.defaultIssueState?.name ?? null,
+ default_issue_state_type: team.defaultIssueState?.type ?? null,
+ };
+}
+
+function flattenUser(user: LinearUserNode) {
+ return {
+ id: user.id,
+ name: user.name,
+ display_name: user.displayName,
+ email: user.email,
+ active: user.active,
+ admin: user.admin,
+ guest: user.guest,
+ url: user.url,
+ avatar_url: user.avatarUrl ?? null,
+ timezone: user.timezone ?? null,
+ created_at: user.createdAt,
+ };
+}
+
+function flattenViewer(user: LinearUserNode) {
+ return {
+ ...flattenUser(user),
+ organization_id: user.organization?.id ?? null,
+ organization_name: user.organization?.name ?? null,
+ organization_url_key: user.organization?.urlKey ?? null,
+ };
+}
+
+function flattenCycle(cycle: LinearCycleNode) {
+ return {
+ id: cycle.id,
+ number: cycle.number,
+ name: cycle.name ?? null,
+ starts_at: cycle.startsAt,
+ ends_at: cycle.endsAt,
+ completed_at: cycle.completedAt ?? null,
+ progress: cycle.progress,
+ is_active: cycle.isActive,
+ is_next: cycle.isNext,
+ is_previous: cycle.isPrevious,
+ team_id: cycle.team?.id ?? null,
+ team_key: cycle.team?.key ?? null,
+ team_name: cycle.team?.name ?? null,
+ };
+}
+
+function flattenLabel(label: LinearLabelNode) {
+ return {
+ id: label.id,
+ name: label.name,
+ color: label.color,
+ description: label.description ?? null,
+ is_group: label.isGroup,
+ is_workspace_label: !label.team,
+ team_id: label.team?.id ?? null,
+ team_key: label.team?.key ?? null,
+ team_name: label.team?.name ?? null,
+ parent_id: label.parent?.id ?? null,
+ parent_name: label.parent?.name ?? null,
+ created_at: label.createdAt,
+ };
+}
+
+function flattenWorkflowState(state: LinearWorkflowStateNode) {
+ return {
+ id: state.id,
+ name: state.name,
+ type: state.type,
+ color: state.color,
+ position: state.position,
+ description: state.description ?? null,
+ team_id: state.team?.id ?? null,
+ team_key: state.team?.key ?? null,
+ team_name: state.team?.name ?? null,
+ };
+}
+
+function flattenMilestone(milestone: LinearMilestoneNode) {
+ return {
+ id: milestone.id,
+ name: milestone.name,
+ description: milestone.description ?? null,
+ target_date: milestone.targetDate ?? null,
+ sort_order: milestone.sortOrder,
+ status: milestone.status,
+ progress: milestone.progress,
+ project_id: milestone.project?.id ?? null,
+ project_name: milestone.project?.name ?? null,
+ created_at: milestone.createdAt,
+ };
+}
+
+function flattenRelation(relation: LinearRelationNode) {
+ return {
+ id: relation.id,
+ type: relation.type,
+ issue_id: relation.issue?.id ?? null,
+ issue_identifier: relation.issue?.identifier ?? null,
+ issue_title: relation.issue?.title ?? null,
+ related_issue_id: relation.relatedIssue?.id ?? null,
+ related_issue_identifier: relation.relatedIssue?.identifier ?? null,
+ related_issue_title: relation.relatedIssue?.title ?? null,
+ created_at: relation.createdAt,
+ };
+}
+
+function flattenReaction(reaction: LinearReactionNode) {
+ return {
+ id: reaction.id,
+ emoji: reaction.emoji,
+ user_id: reaction.user?.id ?? null,
+ user_name: reaction.user?.name ?? null,
+ comment_id: reaction.comment?.id ?? null,
+ created_at: reaction.createdAt,
+ };
+}
+
+function limitProp({ fallback, max }: { fallback: number; max: number }) {
+ return Property.Number({
+ displayName: 'Limit',
+ description: `How many records to return in this page, 1 to ${max}. Default ${fallback}.`,
+ required: false,
+ defaultValue: fallback,
+ });
+}
+
+function cursorProp() {
+ return Property.ShortText({
+ displayName: 'Page Cursor',
+ description: 'Pass end_cursor from the previous call to get the next page. Leave empty for the first page.',
+ required: false,
+ });
+}
+
+function triStateProp({ displayName, description }: { displayName: string; description: string }) {
+ return Property.StaticDropdown({
+ displayName,
+ description,
+ required: false,
+ options: {
+ options: [
+ { label: 'Turn on', value: 'true' },
+ { label: 'Turn off', value: 'false' },
+ ],
+ },
+ });
+}
+
+function healthProp({ description }: { description: string }) {
+ return Property.StaticDropdown({
+ displayName: 'Health',
+ description,
+ required: false,
+ options: {
+ options: [
+ { label: 'On track', value: 'onTrack' },
+ { label: 'At risk', value: 'atRisk' },
+ { label: 'Off track', value: 'offTrack' },
+ ],
+ },
+ });
+}
+
+function triStateValue(value: unknown): boolean | undefined {
+ if (value === true || value === 'true') return true;
+ if (value === false || value === 'false') return false;
+ return undefined;
+}
+
+function priorityValue(value: unknown): number | undefined {
+ if (value === undefined || value === null || value === '') return undefined;
+ const parsed = Number(value);
+ if (!Number.isInteger(parsed) || parsed < 0 || parsed > 4) {
+ throw new Error('Priority must be a whole number from 0 to 4 (0 none, 1 urgent, 2 high, 3 medium, 4 low).');
+ }
+ return parsed;
+}
+
+async function setStatusUpdateArchived({
+ auth,
+ id,
+ archived,
+ mutation,
+ field,
+}: {
+ auth: LinearAuth;
+ id: string;
+ archived: boolean;
+ mutation: string;
+ field: 'projectUpdateArchive' | 'projectUpdateUnarchive';
+}): Promise<LinearProjectStatusUpdateNode> {
+ try {
+ const data = await linearGraphql.request<Record<string, { success: boolean; entity: LinearProjectStatusUpdateNode | null }>>({
+ auth,
+ query: mutation,
+ variables: { id },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data[field], what: archived ? 'status update archive' : 'status update restore' });
+ if (!payload.entity) {
+ throw new Error('Linear did not return the status update.');
+ }
+ return payload.entity;
+ } catch (error) {
+ if (!linearGraphql.isNotFoundError(error)) {
+ throw error;
+ }
+ const current = await linearGraphql
+ .request<{ projectUpdate: LinearProjectStatusUpdateNode | null }>({ auth, query: PROJECT_STATUS_UPDATE_GET_QUERY, variables: { id } })
+ .catch(() => ({ projectUpdate: null }));
+ const isArchived = Boolean(current.projectUpdate?.archivedAt);
+ if (!current.projectUpdate || isArchived !== archived) {
+ throw error;
+ }
+ return current.projectUpdate;
+ }
+}
+
+async function withAllProjectTeams({ auth, project }: { auth: LinearAuth; project: LinearProjectNode }): Promise<LinearProjectNode> {
+ let cursor = nextTeamsCursor(project.teams);
+ if (cursor === undefined) {
+ return project;
+ }
+ const nodes = [...(project.teams?.nodes ?? [])];
+ try {
+ while (cursor !== undefined) {
+ const data: ProjectTeamsPage = await linearGraphql.request<ProjectTeamsPage>({
+ auth,
+ query: PROJECT_TEAMS_PAGE_QUERY,
+ variables: { id: project.id, after: cursor },
+ });
+ const page = data.project?.teams;
+ nodes.push(...(page?.nodes ?? []));
+ cursor = nextTeamsCursor(page);
+ }
+ } catch {
+ return { ...project, teams: { nodes, pageInfo: { hasNextPage: true, endCursor: cursor } } };
+ }
+ return { ...project, teams: { nodes, pageInfo: { hasNextPage: false, endCursor: null } } };
+}
+
+async function withAllProjectsTeams({ auth, projects }: { auth: LinearAuth; projects: LinearProjectNode[] }): Promise<LinearProjectNode[]> {
+ return linearGraphql.mapWithConcurrency({
+ items: projects,
+ limit: linearGraphql.FOLLOW_UP_CONCURRENCY,
+ map: (project) => withAllProjectTeams({ auth, project }),
+ });
+}
+
+function nextTeamsCursor(connection: LinearProjectTeamConnection | null | undefined): string | undefined {
+ const pageInfo = connection?.pageInfo;
+ return pageInfo?.hasNextPage === true && typeof pageInfo.endCursor === 'string' ? pageInfo.endCursor : undefined;
+}
+
+function idFilter(value: string | undefined) {
+ return value ? { id: { eq: value } } : undefined;
+}
+
+export const atomicMappers = {
+ flattenProject,
+ flattenProjectWithMilestones,
+ flattenArchivedProject,
+ flattenComment,
+ flattenTeam,
+ flattenTeamDetails,
+ flattenUser,
+ flattenViewer,
+ flattenCycle,
+ flattenLabel,
+ flattenWorkflowState,
+ flattenMilestone,
+ flattenRelation,
+ flattenReaction,
+};
+
+export const atomicStatusUpdates = {
+ setStatusUpdateArchived,
+};
+
+export const atomicRelations = {
+ withAllProjectTeams,
+ withAllProjectsTeams,
+};
+
+export const atomicProps = {
+ limitProp,
+ cursorProp,
+ triStateProp,
+ triStateValue,
+ healthProp,
+ idFilter,
+ priorityValue,
+};
+
+export type LinearProjectNode = {
+ id: string;
+ name: string;
+ description?: string | null;
+ url: string;
+ icon?: string | null;
+ color?: string | null;
+ priority: number;
+ priorityLabel: string;
+ progress: number;
+ health?: string | null;
+ startDate?: string | null;
+ targetDate?: string | null;
+ createdAt: string;
+ updatedAt: string;
+ completedAt?: string | null;
+ canceledAt?: string | null;
+ archivedAt?: string | null;
+ trashed?: boolean | null;
+ status?: { id: string; name: string; type: string } | null;
+ lead?: { id: string; name: string; email: string } | null;
+ creator?: { id: string; name: string } | null;
+ teams?: LinearProjectTeamConnection | null;
+ projectMilestones?: LinearMilestoneConnection | null;
+};
+
+export type LinearProjectTeamConnection = {
+ pageInfo?: { hasNextPage: boolean; endCursor?: string | null };
+ nodes: Array<{ id: string; key: string; name: string }>;
+};
+
+export type LinearMilestoneConnection = {
+ pageInfo?: { hasNextPage: boolean; endCursor?: string | null };
+ nodes: Array<{ id: string; name: string; targetDate?: string | null; status: string }>;
+};
+
+export type LinearArchivedProjectNode = {
+ id: string;
+ name: string;
+ url: string;
+ trashed?: boolean | null;
+ archivedAt?: string | null;
+};
+
+export type LinearCommentNode = {
+ id: string;
+ body: string;
+ url: string;
+ createdAt: string;
+ updatedAt: string;
+ editedAt?: string | null;
+ resolvedAt?: string | null;
+ user?: { id: string; name: string; email: string } | null;
+ resolvingUser?: { id: string; name: string } | null;
+ issue?: { id: string; identifier: string; title: string } | null;
+ parent?: { id: string } | null;
+};
+
+export type LinearTeamNode = {
+ id: string;
+ key: string;
+ name: string;
+ description?: string | null;
+ icon?: string | null;
+ color?: string | null;
+ timezone: string;
+ cyclesEnabled: boolean;
+ triageEnabled: boolean;
+ defaultIssueEstimate: number;
+ issueEstimationType: string;
+ createdAt: string;
+ updatedAt: string;
+ archivedAt?: string | null;
+ issueCount?: number | null;
+ defaultIssueState?: { id: string; name: string; type: string } | null;
+};
+
+export type LinearUserNode = {
+ id: string;
+ name: string;
+ displayName: string;
+ email: string;
+ active: boolean;
+ admin: boolean;
+ guest: boolean;
+ url: string;
+ avatarUrl?: string | null;
+ timezone?: string | null;
+ createdAt: string;
+ organization?: { id: string; name: string; urlKey: string } | null;
+};
+
+export type LinearCycleNode = {
+ id: string;
+ number: number;
+ name?: string | null;
+ startsAt: string;
+ endsAt: string;
+ completedAt?: string | null;
+ progress: number;
+ isActive: boolean;
+ isNext: boolean;
+ isPrevious: boolean;
+ team?: { id: string; key: string; name: string } | null;
+};
+
+export type LinearLabelNode = {
+ id: string;
+ name: string;
+ color: string;
+ description?: string | null;
+ isGroup: boolean;
+ createdAt: string;
+ team?: { id: string; key: string; name: string } | null;
+ parent?: { id: string; name: string } | null;
+};
+
+export type LinearWorkflowStateNode = {
+ id: string;
+ name: string;
+ type: string;
+ color: string;
+ position: number;
+ description?: string | null;
+ team?: { id: string; key: string; name: string } | null;
+};
+
+export type LinearMilestoneNode = {
+ id: string;
+ name: string;
+ description?: string | null;
+ targetDate?: string | null;
+ sortOrder: number;
+ status: string;
+ progress: number;
+ createdAt: string;
+ project?: { id: string; name: string } | null;
+};
+
+export type LinearRelationNode = {
+ id: string;
+ type: string;
+ createdAt: string;
+ issue?: { id: string; identifier: string; title: string } | null;
+ relatedIssue?: { id: string; identifier: string; title: string } | null;
+};
+
+export type LinearReactionNode = {
+ id: string;
+ emoji: string;
+ createdAt: string;
+ user?: { id: string; name: string } | null;
+ comment?: { id: string } | null;
+};
+
+type ProjectTeamsPage = { project: { teams: LinearProjectTeamConnection | null } | null };
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/cycles-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/cycles-list.ts
new file mode 100644
index 00000000000..af85bf587ea
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/cycles-list.ts
@@ -0,0 +1,61 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, linearMappers } from '../../common/mappers';
+import { atomicMappers, atomicProps, LinearCycleNode } from './common';
+import { CYCLES_LIST_QUERY } from './queries';
+import { atomicCyclesPageOutputSchema } from './output-schemas';
+
+export const linearCyclesListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_cycles_list',
+ classification: 'SEARCH',
+ displayName: 'List Cycles (AI)',
+ description: 'List cycles (sprints), optionally for one team and only the current, next or previous one.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Linear cycles (time-boxed sprints) with number, dates and progress, for one team or all teams, optionally only the current, next or previous cycle. Use to find the Cycle ID for Create Issue or Update Issue, for example "put this in the next cycle". Teams without cycles enabled return none. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'UUID of the team (from List Teams). Leave empty for every team.', required: false }),
+ which: Property.StaticDropdown({
+ displayName: 'Which Cycles',
+ description: 'Leave empty for all cycles.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Current cycle', value: 'isActive' },
+ { label: 'Next cycle', value: 'isNext' },
+ { label: 'Previous cycle', value: 'isPrevious' },
+ ],
+ },
+ }),
+ limit: atomicProps.limitProp({ fallback: 50, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicCyclesPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const which = propsValue.which;
+ if (which && !CYCLE_FLAGS.includes(which)) {
+ throw new Error('Which Cycles must be isActive, isNext or isPrevious.');
+ }
+ const filter = linearGraphql.definedOnly({
+ team: atomicProps.idFilter(propsValue.team_id?.trim()),
+ ...(which ? { [which]: { eq: true } } : {}),
+ });
+ const data = await linearGraphql.request<{ cycles: LinearConnection<LinearCycleNode> }>({
+ auth,
+ query: CYCLES_LIST_QUERY,
+ variables: {
+ filter: Object.keys(filter).length > 0 ? filter : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 50, max: 250 }),
+ after: propsValue.cursor || undefined,
+ },
+ });
+ return linearMappers.toPage({ connection: data.cycles, map: atomicMappers.flattenCycle });
+ },
+});
+
+const CYCLE_FLAGS = ['isActive', 'isNext', 'isPrevious'];
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/index.ts b/packages/pieces/community/linear/src/lib/actions/atomics/index.ts
new file mode 100644
index 00000000000..c5f5f092190
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/index.ts
@@ -0,0 +1,93 @@
+import { linearIssueCreateAtomic } from './issue-create';
+import { linearIssueUpdateAtomic } from './issue-update';
+import { linearIssueGetAtomic } from './issue-get';
+import { linearIssuesListAtomic } from './issues-list';
+import { linearIssuesSearchAtomic } from './issues-search';
+import { linearIssueArchiveAtomic } from './issue-archive';
+import { linearIssueUnarchiveAtomic } from './issue-unarchive';
+import { linearIssueDeleteAtomic } from './issue-delete';
+import { linearIssueRelationCreateAtomic } from './issue-relation-create';
+import { linearIssueAddLabelAtomic } from './issue-add-label';
+import { linearIssueRemoveLabelAtomic } from './issue-remove-label';
+import { linearIssueLabelCreateAtomic } from './issue-label-create';
+import { linearIssueLabelsListAtomic } from './issue-labels-list';
+import { linearWorkflowStatesListAtomic } from './workflow-states-list';
+import { linearTeamsListAtomic } from './teams-list';
+import { linearTeamGetAtomic } from './team-get';
+import { linearTeamCreateAtomic } from './team-create';
+import { linearTeamUpdateAtomic } from './team-update';
+import { linearUsersListAtomic } from './users-list';
+import { linearViewerGetAtomic } from './viewer-get';
+import { linearCyclesListAtomic } from './cycles-list';
+import { linearCommentCreateAtomic } from './comment-create';
+import { linearCommentGetAtomic } from './comment-get';
+import { linearCommentsListAtomic } from './comments-list';
+import { linearCommentUpdateAtomic } from './comment-update';
+import { linearCommentResolveAtomic } from './comment-resolve';
+import { linearCommentUnresolveAtomic } from './comment-unresolve';
+import { linearCommentReactionCreateAtomic } from './comment-reaction-create';
+import { linearReactionDeleteAtomic } from './reaction-delete';
+import { linearAttachmentCreateAtomic } from './attachment-create';
+import { linearAttachmentGetAtomic } from './attachment-get';
+import { linearUploadDownloadAtomic } from './upload-download';
+import { linearProjectCreateAtomic } from './project-create';
+import { linearProjectUpdateAtomic } from './project-update';
+import { linearProjectsListAtomic } from './projects-list';
+import { linearProjectGetAtomic } from './project-get';
+import { linearProjectDeleteAtomic } from './project-delete';
+import { linearProjectUnarchiveAtomic } from './project-unarchive';
+import { linearProjectMilestoneCreateAtomic } from './project-milestone-create';
+import { linearProjectStatusUpdateCreateAtomic } from './project-status-update-create';
+import { linearProjectStatusUpdateGetAtomic } from './project-status-update-get';
+import { linearProjectStatusUpdatesListAtomic } from './project-status-updates-list';
+import { linearProjectStatusUpdateEditAtomic } from './project-status-update-edit';
+import { linearProjectStatusUpdateArchiveAtomic } from './project-status-update-archive';
+import { linearProjectStatusUpdateUnarchiveAtomic } from './project-status-update-unarchive';
+
+export const linearAtomics = [
+ linearIssueCreateAtomic,
+ linearIssueUpdateAtomic,
+ linearIssueGetAtomic,
+ linearIssuesListAtomic,
+ linearIssuesSearchAtomic,
+ linearIssueArchiveAtomic,
+ linearIssueUnarchiveAtomic,
+ linearIssueDeleteAtomic,
+ linearIssueRelationCreateAtomic,
+ linearIssueAddLabelAtomic,
+ linearIssueRemoveLabelAtomic,
+ linearIssueLabelCreateAtomic,
+ linearIssueLabelsListAtomic,
+ linearWorkflowStatesListAtomic,
+ linearTeamsListAtomic,
+ linearTeamGetAtomic,
+ linearTeamCreateAtomic,
+ linearTeamUpdateAtomic,
+ linearUsersListAtomic,
+ linearViewerGetAtomic,
+ linearCyclesListAtomic,
+ linearCommentCreateAtomic,
+ linearCommentGetAtomic,
+ linearCommentsListAtomic,
+ linearCommentUpdateAtomic,
+ linearCommentResolveAtomic,
+ linearCommentUnresolveAtomic,
+ linearCommentReactionCreateAtomic,
+ linearReactionDeleteAtomic,
+ linearAttachmentCreateAtomic,
+ linearAttachmentGetAtomic,
+ linearUploadDownloadAtomic,
+ linearProjectCreateAtomic,
+ linearProjectUpdateAtomic,
+ linearProjectsListAtomic,
+ linearProjectGetAtomic,
+ linearProjectDeleteAtomic,
+ linearProjectUnarchiveAtomic,
+ linearProjectMilestoneCreateAtomic,
+ linearProjectStatusUpdateCreateAtomic,
+ linearProjectStatusUpdateGetAtomic,
+ linearProjectStatusUpdatesListAtomic,
+ linearProjectStatusUpdateEditAtomic,
+ linearProjectStatusUpdateArchiveAtomic,
+ linearProjectStatusUpdateUnarchiveAtomic,
+];
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-add-label.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-add-label.ts
new file mode 100644
index 00000000000..894d55475d1
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-add-label.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearIssueNode, linearMappers } from '../../common/mappers';
+import { ISSUE_ADD_LABEL_MUTATION } from '../../common/queries';
+import { atomicIssueOutputSchema } from './output-schemas';
+
+export const linearIssueAddLabelAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_add_label',
+ classification: 'WRITE',
+ displayName: 'Add Label to Issue (AI)',
+ description: 'Add one label to an issue, keeping its other labels.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Adds one label (team or workspace) to a Linear issue and keeps the labels it already has. Use this rather than Update Issue with Label IDs, which replaces the whole set. Resolve the label with List Issue Labels or create it with Create Issue Label. Idempotent: adding a label the issue already has changes nothing. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({
+ displayName: 'Issue',
+ description: 'UUID or identifier of the issue, for example ENG-123.',
+ required: true,
+ }),
+ label_id: Property.ShortText({
+ displayName: 'Label ID',
+ description: 'UUID of the label. Get it from List Issue Labels.',
+ required: true,
+ }),
+ },
+ outputSchema: atomicIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const labelId = propsValue.label_id.trim();
+ if (labelId.length === 0) {
+ throw new Error('Label ID is required.');
+ }
+ const id = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const data = await linearGraphql.request<{
+ issueAddLabel: { success: boolean; issue: LinearIssueNode | null };
+ }>({ auth, query: ISSUE_ADD_LABEL_MUTATION, variables: { id, labelId } });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueAddLabel, what: 'label change' });
+ if (!payload.issue) {
+ throw new Error('Linear did not return the updated issue.');
+ }
+ return linearMappers.flattenIssue(await linearGraphql.withAllIssueLabels({ auth, issue: payload.issue }));
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-archive.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-archive.ts
new file mode 100644
index 00000000000..4a398c67934
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-archive.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearArchivedIssueNode, linearMappers } from '../../common/mappers';
+import { ISSUE_ARCHIVE_MUTATION } from './queries';
+import { atomicArchivedIssueOutputSchema } from './output-schemas';
+
+export const linearIssueArchiveAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_archive',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Archive Issue (AI)',
+ description: 'Archive an issue so it leaves active views. It can be restored.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Archives a Linear issue so it disappears from active views and boards while staying searchable; restore it with Unarchive Issue. Use to tidy finished or obsolete work without deleting it; use Delete Issue to move it to the trash. Idempotent: archiving an already archived issue leaves it archived.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({
+ displayName: 'Issue',
+ description: 'UUID or identifier of the issue, for example ENG-123.',
+ required: true,
+ }),
+ },
+ outputSchema: atomicArchivedIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const id = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const data = await linearGraphql.request<{
+ issueArchive: { success: boolean; entity: LinearArchivedIssueNode | null };
+ }>({ auth, query: ISSUE_ARCHIVE_MUTATION, variables: { id } });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueArchive, what: 'issue archive' });
+ return linearMappers.flattenArchivedIssue(payload.entity);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-create.ts
new file mode 100644
index 00000000000..b4c94801ee7
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-create.ts
@@ -0,0 +1,123 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearIssueNode, linearMappers } from '../../common/mappers';
+import { atomicProps } from './common';
+import { ISSUE_CREATE_MUTATION } from './queries';
+import { atomicIssueOutputSchema } from './output-schemas';
+
+export const linearIssueCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_create',
+ classification: 'WRITE',
+ displayName: 'Create Issue (AI)',
+ description: 'Create an issue from IDs, with optional project, cycle, parent, due date and estimate.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates one Linear issue in a team from plain IDs: title plus optional description (markdown), assignee, status, priority, labels, project, milestone, cycle, parent (making it a sub-issue), due date, estimate and template. Resolve IDs first with List Teams, List Workflow States, List Users, List Issue Labels, List Projects and List Cycles, and check for duplicates with Search Issues. Not idempotent: each call creates a new issue. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
+ idempotent: false,
+ },
+ props: {
+ team_id: Property.ShortText({
+ displayName: 'Team ID',
+ description: 'UUID of the team that owns the issue. Get it from List Teams.',
+ required: true,
+ }),
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'Issue title, for example "Login page times out on Safari".',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'Issue body in Markdown.',
+ required: false,
+ }),
+ assignee_id: Property.ShortText({
+ displayName: 'Assignee ID',
+ description: 'UUID of the user to assign. Get it from List Users or Get Current User.',
+ required: false,
+ }),
+ state_id: Property.ShortText({
+ displayName: 'Status ID',
+ description: "UUID of a workflow state of this team. Get it from List Workflow States. Leave empty for the team's default status.",
+ required: false,
+ }),
+ priority: Property.Number({
+ displayName: 'Priority',
+ description: '0 none, 1 urgent, 2 high, 3 medium, 4 low.',
+ required: false,
+ }),
+ label_ids: Property.Array({
+ displayName: 'Label IDs',
+ description: 'UUIDs of team or workspace labels. Get them from List Issue Labels.',
+ required: false,
+ }),
+ project_id: Property.ShortText({
+ displayName: 'Project ID',
+ description: 'UUID of a project the team belongs to. Get it from List Projects.',
+ required: false,
+ }),
+ project_milestone_id: Property.ShortText({
+ displayName: 'Project Milestone ID',
+ description: 'UUID of a milestone of that project. Get it from Get Project.',
+ required: false,
+ }),
+ cycle_id: Property.ShortText({
+ displayName: 'Cycle ID',
+ description: 'UUID of a cycle of this team. Get it from List Cycles.',
+ required: false,
+ }),
+ parent_id: Property.ShortText({
+ displayName: 'Parent Issue',
+ description: 'UUID or identifier (for example ENG-123) of the parent issue, to create a sub-issue.',
+ required: false,
+ }),
+ due_date: Property.ShortText({
+ displayName: 'Due Date',
+ description: 'Date in YYYY-MM-DD format, for example 2026-10-15.',
+ required: false,
+ }),
+ estimate: Property.Number({
+ displayName: 'Estimate',
+ description: "Whole number of estimate points in the team's scale, for example 3.",
+ required: false,
+ }),
+ template_id: Property.ShortText({
+ displayName: 'Template ID',
+ description: 'UUID of an issue template of this team. Leave empty for none.',
+ required: false,
+ }),
+ },
+ outputSchema: atomicIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const parentId = propsValue.parent_id
+ ? await linearGraphql.resolveIssueId({ auth, value: propsValue.parent_id })
+ : undefined;
+ const input = linearGraphql.definedOnly({
+ teamId: propsValue.team_id.trim(),
+ title: propsValue.title,
+ description: propsValue.description,
+ assigneeId: propsValue.assignee_id,
+ stateId: propsValue.state_id,
+ priority: atomicProps.priorityValue(propsValue.priority),
+ labelIds: linearGraphql.toStringArray(propsValue.label_ids),
+ projectId: propsValue.project_id,
+ projectMilestoneId: propsValue.project_milestone_id,
+ cycleId: propsValue.cycle_id,
+ parentId,
+ dueDate: linearGraphql.toTimelessDate({ value: propsValue.due_date, fieldName: 'Due Date' }),
+ estimate: linearGraphql.toOptionalInteger({ value: propsValue.estimate, fieldName: 'Estimate' }),
+ templateId: propsValue.template_id,
+ });
+ const data = await linearGraphql.request<{
+ issueCreate: { success: boolean; issue: LinearIssueNode | null };
+ }>({ auth, query: ISSUE_CREATE_MUTATION, variables: { input } });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueCreate, what: 'issue creation' });
+ if (!payload.issue) {
+ throw new Error('Linear did not return the created issue.');
+ }
+ return linearMappers.flattenIssue(await linearGraphql.withAllIssueLabels({ auth, issue: payload.issue }));
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-delete.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-delete.ts
new file mode 100644
index 00000000000..60c9d249dd5
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-delete.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearArchivedIssueNode, linearMappers } from '../../common/mappers';
+import { ISSUE_DELETE_MUTATION } from '../../common/queries';
+import { atomicArchivedIssueOutputSchema } from './output-schemas';
+
+export const linearIssueDeleteAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_delete',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Issue (AI)',
+ description: 'Move an issue to the trash (restorable for 30 days).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Moves a Linear issue to the trash; Linear deletes it for good after 30 days, and Unarchive Issue restores it before then. This never deletes permanently. Prefer Archive Issue when the work is only finished. Not idempotent: a second call on a trashed issue may fail.',
+ idempotent: false,
+ },
+ props: {
+ issue_id: Property.ShortText({
+ displayName: 'Issue',
+ description: 'UUID or identifier of the issue, for example ENG-123.',
+ required: true,
+ }),
+ },
+ outputSchema: atomicArchivedIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const id = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const data = await linearGraphql.request<{
+ issueDelete: { success: boolean; entity: LinearArchivedIssueNode | null };
+ }>({ auth, query: ISSUE_DELETE_MUTATION, variables: { id } });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueDelete, what: 'issue deletion' });
+ return linearMappers.flattenArchivedIssue(payload.entity);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-get.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-get.ts
new file mode 100644
index 00000000000..5c6c961ea0a
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-get.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearIssueNode, linearMappers } from '../../common/mappers';
+import { GET_ISSUE_QUERY } from '../../common/queries';
+import { atomicIssueOutputSchema } from './output-schemas';
+
+export const linearIssueGetAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_get',
+ classification: 'READ',
+ displayName: 'Get Issue (AI)',
+ description: 'Get one issue by UUID or identifier.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one Linear issue by UUID or by identifier such as ENG-123, with status, team, assignee, project, milestone, cycle, parent and labels. Use when the issue is already known; use List Issues for structured filters and Search Issues for free text. Read-only and idempotent. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({
+ displayName: 'Issue',
+ description: 'UUID or identifier of the issue, for example ENG-123.',
+ required: true,
+ }),
+ },
+ outputSchema: atomicIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const id = propsValue.issue_id.trim();
+ if (!linearGraphql.isUuid(id) && !linearGraphql.isIssueIdentifier(id)) {
+ throw new Error(`"${id}" is not an issue UUID or an identifier like ENG-123.`);
+ }
+ const data = await linearGraphql.request<{ issue: LinearIssueNode | null }>({
+ auth,
+ query: GET_ISSUE_QUERY,
+ variables: { id: linearGraphql.isUuid(id) ? id : id.toUpperCase() },
+ });
+ if (!data.issue) {
+ throw new Error(`No Linear issue found for ${id}.`);
+ }
+ return linearMappers.flattenIssue(await linearGraphql.withAllIssueLabels({ auth, issue: data.issue }));
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-label-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-label-create.ts
new file mode 100644
index 00000000000..2643495695c
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-label-create.ts
@@ -0,0 +1,79 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection } from '../../common/mappers';
+import { atomicMappers, LinearLabelNode } from './common';
+import { ISSUE_LABEL_CREATE_MUTATION, ISSUE_LABELS_LIST_QUERY } from './queries';
+import { atomicLabelUpsertOutputSchema } from './output-schemas';
+
+export const linearIssueLabelCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_label_create',
+ classification: 'WRITE',
+ displayName: 'Create Issue Label (AI)',
+ description: 'Get a label by name, or create it if it does not exist yet (team or workspace label).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the issue label with this name (case-insensitive) that the given team can use (its own label first, else a workspace label), or the workspace label when no team is given, and creates it only if none exists yet; created tells which happened. Without a team it fails with a clear message when only a team label of that name exists (Linear does not allow the duplicate); pass that team instead. Use before labelling issues by name. Idempotent: repeat calls return the same label, though two calls at the same moment can still race.',
+ idempotent: true,
+ },
+ props: {
+ name: Property.ShortText({ displayName: 'Name', description: 'Label name, for example "Bug".', required: true }),
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'UUID of the team for a team label (from List Teams). Leave empty for a workspace label shared by all teams.', required: false }),
+ color: Property.ShortText({ displayName: 'Color', description: 'Hex color used when the label is created, for example #EB5757.', required: false }),
+ description: Property.ShortText({ displayName: 'Description', description: 'Used only when the label is created.', required: false }),
+ },
+ outputSchema: atomicLabelUpsertOutputSchema,
+ async run({ auth, propsValue }) {
+ const name = propsValue.name.trim();
+ if (name.length === 0) {
+ throw new Error('Name is required.');
+ }
+ const color = propsValue.color?.trim();
+ if (color && !/^#[0-9a-fA-F]{6}$/.test(color)) {
+ throw new Error('Color must be a hex color like #EB5757.');
+ }
+ const teamId = propsValue.team_id?.trim() || undefined;
+ const existing = await linearGraphql.request<{ issueLabels: LinearConnection<LinearLabelNode> }>({
+ auth,
+ query: ISSUE_LABELS_LIST_QUERY,
+ variables: {
+ first: 10,
+ filter: {
+ name: { eqIgnoreCase: name },
+ ...(teamId ? { or: [{ team: { id: { eq: teamId } } }, { team: { null: true } }] } : { team: { null: true } }),
+ },
+ },
+ });
+ const nodes = existing.issueLabels.nodes;
+ const match = nodes.find((label) => teamId !== undefined && label.team?.id === teamId) ?? nodes[0];
+ if (match) {
+ return { created: false, ...atomicMappers.flattenLabel(match) };
+ }
+ if (!teamId) {
+ const inTeams = await linearGraphql.request<{ issueLabels: LinearConnection<LinearLabelNode> }>({
+ auth,
+ query: ISSUE_LABELS_LIST_QUERY,
+ variables: { first: 10, filter: { name: { eqIgnoreCase: name } } },
+ });
+ const teams = inTeams.issueLabels.nodes.flatMap((label) => (label.team ? [label.team.key] : []));
+ if (teams.length > 0) {
+ throw new Error(
+ `A label named "${name}" already exists in team ${teams.join(', ')}, so Linear will not create a workspace label with that name. Pass that team to get it.`,
+ );
+ }
+ }
+ const data = await linearGraphql.request<{
+ issueLabelCreate: { success: boolean; issueLabel: LinearLabelNode };
+ }>({
+ auth,
+ query: ISSUE_LABEL_CREATE_MUTATION,
+ variables: {
+ input: linearGraphql.definedOnly({ name, teamId, color, description: propsValue.description }),
+ },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueLabelCreate, what: 'label creation' });
+ return { created: true, ...atomicMappers.flattenLabel(payload.issueLabel) };
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-labels-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-labels-list.ts
new file mode 100644
index 00000000000..eedf721abf3
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-labels-list.ts
@@ -0,0 +1,46 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, linearMappers } from '../../common/mappers';
+import { atomicMappers, atomicProps, LinearLabelNode } from './common';
+import { ISSUE_LABELS_LIST_QUERY } from './queries';
+import { atomicLabelsPageOutputSchema } from './output-schemas';
+
+export const linearIssueLabelsListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_labels_list',
+ classification: 'SEARCH',
+ displayName: 'List Issue Labels (AI)',
+ description: 'List issue labels, optionally only one team (team labels plus workspace labels) or matching a name.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Linear issue labels with their IDs: every label, or with a team ID that team\'s labels plus the workspace labels every team can use, optionally narrowed by a name fragment. Use to resolve a label name to the ID that Create Issue, Update Issue and Add Label to Issue need. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'UUID of a team (from List Teams). Returns that team\'s labels and the workspace labels.', required: false }),
+ name_contains: Property.ShortText({ displayName: 'Name Contains', description: 'Only labels whose name contains this text (case-insensitive).', required: false }),
+ limit: atomicProps.limitProp({ fallback: 100, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicLabelsPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const teamId = propsValue.team_id?.trim();
+ const nameContains = propsValue.name_contains?.trim();
+ const filter = linearGraphql.definedOnly({
+ name: nameContains ? { containsIgnoreCase: nameContains } : undefined,
+ or: teamId ? [{ team: { id: { eq: teamId } } }, { team: { null: true } }] : undefined,
+ });
+ const data = await linearGraphql.request<{ issueLabels: LinearConnection<LinearLabelNode> }>({
+ auth,
+ query: ISSUE_LABELS_LIST_QUERY,
+ variables: {
+ filter: Object.keys(filter).length > 0 ? filter : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 100, max: 250 }),
+ after: propsValue.cursor || undefined,
+ },
+ });
+ return linearMappers.toPage({ connection: data.issueLabels, map: atomicMappers.flattenLabel });
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-relation-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-relation-create.ts
new file mode 100644
index 00000000000..65c640fe93a
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-relation-create.ts
@@ -0,0 +1,57 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearRelationNode } from './common';
+import { ISSUE_RELATION_CREATE_MUTATION } from './queries';
+import { atomicIssueRelationOutputSchema } from './output-schemas';
+
+export const linearIssueRelationCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_relation_create',
+ classification: 'WRITE',
+ displayName: 'Create Issue Relation (AI)',
+ description: 'Link two issues as blocking, duplicate or related.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Links two Linear issues: "blocks" means the first issue blocks the related issue, "duplicate" marks the first issue as a duplicate of the related one, "related" is a plain link. Use to record dependencies or duplicates; to nest an issue under another use Update Issue with a parent instead. Not idempotent: each call creates a relation record.',
+ idempotent: false,
+ },
+ props: {
+ issue_id: Property.ShortText({ displayName: 'Issue', description: 'UUID or identifier of the first issue, for example ENG-12.', required: true }),
+ related_issue_id: Property.ShortText({ displayName: 'Related Issue', description: 'UUID or identifier of the second issue, for example ENG-34.', required: true }),
+ type: Property.StaticDropdown({
+ displayName: 'Relation Type',
+ required: true,
+ options: {
+ options: [
+ { label: 'Issue blocks related issue', value: 'blocks' },
+ { label: 'Issue is a duplicate of related issue', value: 'duplicate' },
+ { label: 'Related', value: 'related' },
+ ],
+ },
+ }),
+ },
+ outputSchema: atomicIssueRelationOutputSchema,
+ async run({ auth, propsValue }) {
+ if (!RELATION_TYPES.includes(propsValue.type)) {
+ throw new Error('Relation Type must be one of blocks, duplicate or related.');
+ }
+ const issueId = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const relatedIssueId = await linearGraphql.resolveIssueId({ auth, value: propsValue.related_issue_id });
+ if (issueId === relatedIssueId) {
+ throw new Error('An issue cannot be related to itself.');
+ }
+ const data = await linearGraphql.request<{
+ issueRelationCreate: { success: boolean; issueRelation: LinearRelationNode };
+ }>({
+ auth,
+ query: ISSUE_RELATION_CREATE_MUTATION,
+ variables: { input: { issueId, relatedIssueId, type: propsValue.type } },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueRelationCreate, what: 'issue relation' });
+ return atomicMappers.flattenRelation(payload.issueRelation);
+ },
+});
+
+const RELATION_TYPES = ['blocks', 'duplicate', 'related'];
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-remove-label.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-remove-label.ts
new file mode 100644
index 00000000000..e73516e6c66
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-remove-label.ts
@@ -0,0 +1,41 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { linearMappers } from '../../common/mappers';
+import { atomicIssueOutputSchema } from './output-schemas';
+
+export const linearIssueRemoveLabelAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_remove_label',
+ classification: 'WRITE',
+ displayName: 'Remove Label from Issue (AI)',
+ description: 'Remove one label from an issue, keeping its other labels.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes one label from a Linear issue and keeps its other labels; the label itself still exists in the workspace. Use this rather than Update Issue with Label IDs, which replaces the whole set. Idempotent: removing a label the issue does not have changes nothing. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({
+ displayName: 'Issue',
+ description: 'UUID or identifier of the issue, for example ENG-123.',
+ required: true,
+ }),
+ label_id: Property.ShortText({
+ displayName: 'Label ID',
+ description: 'UUID of the label. Get it from List Issue Labels.',
+ required: true,
+ }),
+ },
+ outputSchema: atomicIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const labelId = propsValue.label_id.trim();
+ if (labelId.length === 0) {
+ throw new Error('Label ID is required.');
+ }
+ const id = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const issue = await linearGraphql.removeIssueLabel({ auth, id, labelId });
+ return linearMappers.flattenIssue(issue);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-unarchive.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-unarchive.ts
new file mode 100644
index 00000000000..8aff6590bb2
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-unarchive.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearArchivedIssueNode, linearMappers } from '../../common/mappers';
+import { ISSUE_UNARCHIVE_MUTATION } from './queries';
+import { atomicArchivedIssueOutputSchema } from './output-schemas';
+
+export const linearIssueUnarchiveAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_unarchive',
+ classification: 'WRITE',
+ displayName: 'Unarchive Issue (AI)',
+ description: 'Restore an archived or trashed issue.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Restores a Linear issue that was archived or moved to the trash (within the 30-day grace period), bringing it back to active views. Use to undo Archive Issue or Delete Issue. Idempotent: restoring an active issue leaves it active.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({
+ displayName: 'Issue',
+ description: 'UUID or identifier of the issue, for example ENG-123.',
+ required: true,
+ }),
+ },
+ outputSchema: atomicArchivedIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const id = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const data = await linearGraphql.request<{
+ issueUnarchive: { success: boolean; entity: LinearArchivedIssueNode | null };
+ }>({ auth, query: ISSUE_UNARCHIVE_MUTATION, variables: { id } });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueUnarchive, what: 'issue restore' });
+ return linearMappers.flattenArchivedIssue(payload.entity);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issue-update.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issue-update.ts
new file mode 100644
index 00000000000..8ceaa07c1cc
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issue-update.ts
@@ -0,0 +1,139 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { LinearAuth, linearGraphql } from '../../common/graphql';
+import { LinearIssueNode, linearMappers } from '../../common/mappers';
+import { atomicProps } from './common';
+import { ISSUE_UPDATE_MUTATION } from './queries';
+import { atomicIssueOutputSchema } from './output-schemas';
+
+export const linearIssueUpdateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issue_update',
+ classification: 'WRITE',
+ displayName: 'Update Issue (AI)',
+ description: 'Change only the fields you pass on an issue; labels can be replaced, added or removed.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Partially updates one Linear issue (UUID or identifier like ENG-123): only the fields you pass change and everything else is left as it is. Labels have three modes: Label IDs replaces the whole set, Add Label IDs and Remove Label IDs change it incrementally; to empty a field such as the assignee, due date or project, list it in Clear Fields. Idempotent: repeating the same update leaves the issue in the same state. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
+ idempotent: true,
+ },
+ props: {
+ issue_id: Property.ShortText({
+ displayName: 'Issue',
+ description: 'UUID or identifier of the issue, for example ENG-123.',
+ required: true,
+ }),
+ title: Property.ShortText({ displayName: 'Title', description: 'New title.', required: false }),
+ description: Property.LongText({ displayName: 'Description', description: 'New body in Markdown. Replaces the current description.', required: false }),
+ assignee_id: Property.ShortText({ displayName: 'Assignee ID', description: 'UUID of the new assignee. Get it from List Users.', required: false }),
+ state_id: Property.ShortText({ displayName: 'Status ID', description: "UUID of a workflow state of the issue's team. Get it from List Workflow States.", required: false }),
+ priority: Property.Number({ displayName: 'Priority', description: '0 none, 1 urgent, 2 high, 3 medium, 4 low.', required: false }),
+ label_ids: Property.Array({ displayName: 'Label IDs (replace all)', description: 'Replaces every label on the issue with exactly these label UUIDs. Cannot be combined with Add or Remove Label IDs.', required: false }),
+ add_label_ids: Property.Array({ displayName: 'Add Label IDs', description: 'Label UUIDs to add, keeping the current labels.', required: false }),
+ remove_label_ids: Property.Array({ displayName: 'Remove Label IDs', description: 'Label UUIDs to remove, keeping the other labels.', required: false }),
+ team_id: Property.ShortText({ displayName: 'Move to Team ID', description: 'UUID of another team to move the issue to. Leave empty to keep the team.', required: false }),
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'UUID of the project to move the issue into.', required: false }),
+ project_milestone_id: Property.ShortText({ displayName: 'Project Milestone ID', description: 'UUID of a milestone of the project.', required: false }),
+ cycle_id: Property.ShortText({ displayName: 'Cycle ID', description: 'UUID of a cycle of the team. Get it from List Cycles.', required: false }),
+ parent_id: Property.ShortText({ displayName: 'Parent Issue', description: 'UUID or identifier of the new parent issue.', required: false }),
+ due_date: Property.ShortText({ displayName: 'Due Date', description: 'Date in YYYY-MM-DD format, for example 2026-10-15.', required: false }),
+ estimate: Property.Number({ displayName: 'Estimate', description: 'Whole number of estimate points.', required: false }),
+ clear_fields: Property.StaticMultiSelectDropdown({
+ displayName: 'Clear Fields',
+ description: 'Fields to empty on the issue. A field listed here must not also be given a new value.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Assignee', value: 'assigneeId' },
+ { label: 'Description', value: 'description' },
+ { label: 'Due date', value: 'dueDate' },
+ { label: 'Estimate', value: 'estimate' },
+ { label: 'Project', value: 'projectId' },
+ { label: 'Project milestone', value: 'projectMilestoneId' },
+ { label: 'Cycle', value: 'cycleId' },
+ { label: 'Parent issue', value: 'parentId' },
+ { label: 'All labels', value: 'labelIds' },
+ ],
+ },
+ }),
+ },
+ outputSchema: atomicIssueOutputSchema,
+ async run({ auth, propsValue }) {
+ const id = await linearGraphql.resolveIssueId({ auth, value: propsValue.issue_id });
+ const input = await buildIssueUpdateInput({ auth, values: propsValue });
+ const data = await linearGraphql.request<{
+ issueUpdate: { success: boolean; issue: LinearIssueNode | null };
+ }>({ auth, query: ISSUE_UPDATE_MUTATION, variables: { id, input } });
+ const payload = linearGraphql.requireSuccess({ payload: data.issueUpdate, what: 'issue update' });
+ if (!payload.issue) {
+ throw new Error('Linear did not return the updated issue.');
+ }
+ return linearMappers.flattenIssue(await linearGraphql.withAllIssueLabels({ auth, issue: payload.issue }));
+ },
+});
+
+export async function buildIssueUpdateInput({
+ auth,
+ values,
+}: {
+ auth: LinearAuth;
+ values: IssueUpdateValues;
+}): Promise<Record<string, unknown>> {
+ const labelIds = linearGraphql.toStringArray(values.label_ids);
+ const addedLabelIds = linearGraphql.toStringArray(values.add_label_ids);
+ const removedLabelIds = linearGraphql.toStringArray(values.remove_label_ids);
+ if (labelIds && (addedLabelIds || removedLabelIds)) {
+ throw new Error('Use either Label IDs (replace all) or Add/Remove Label IDs, not both.');
+ }
+ const parentId = values.parent_id
+ ? await linearGraphql.resolveIssueId({ auth, value: values.parent_id })
+ : undefined;
+ const set = linearGraphql.definedOnly({
+ title: values.title,
+ description: values.description,
+ assigneeId: values.assignee_id,
+ stateId: values.state_id,
+ priority: atomicProps.priorityValue(values.priority),
+ labelIds,
+ addedLabelIds,
+ removedLabelIds,
+ teamId: values.team_id,
+ projectId: values.project_id,
+ projectMilestoneId: values.project_milestone_id,
+ cycleId: values.cycle_id,
+ parentId,
+ dueDate: linearGraphql.toTimelessDate({ value: values.due_date, fieldName: 'Due Date' }),
+ estimate: linearGraphql.toOptionalInteger({ value: values.estimate, fieldName: 'Estimate' }),
+ });
+ const cleared = linearGraphql.toStringArray(values.clear_fields) ?? [];
+ const conflicts = cleared.filter((field) => field in set || (field === 'labelIds' && (addedLabelIds || removedLabelIds)));
+ if (conflicts.length > 0) {
+ throw new Error(`These fields are both set and cleared: ${conflicts.join(', ')}. Pick one.`);
+ }
+ const clears = Object.fromEntries(cleared.map((field) => [field, field === 'labelIds' ? [] : null]));
+ const input = { ...set, ...clears };
+ if (Object.keys(input).length === 0) {
+ throw new Error('Nothing to update: pass at least one field to change or clear.');
+ }
+ return input;
+}
+
+type IssueUpdateValues = {
+ title?: string;
+ description?: string;
+ assignee_id?: string;
+ state_id?: string;
+ priority?: number;
+ label_ids?: unknown[];
+ add_label_ids?: unknown[];
+ remove_label_ids?: unknown[];
+ team_id?: string;
+ project_id?: string;
+ project_milestone_id?: string;
+ cycle_id?: string;
+ parent_id?: string;
+ due_date?: string;
+ estimate?: number;
+ clear_fields?: string[];
+};
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issues-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issues-list.ts
new file mode 100644
index 00000000000..9deb661f0f8
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issues-list.ts
@@ -0,0 +1,99 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, LinearIssueNode, linearMappers } from '../../common/mappers';
+import { atomicProps } from './common';
+import { ISSUES_LIST_QUERY } from './queries';
+import { atomicIssuesPageOutputSchema } from './output-schemas';
+
+export const linearIssuesListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issues_list',
+ classification: 'SEARCH',
+ displayName: 'List Issues (AI)',
+ description: 'List issues with structured filters (team, project, assignee, status, label, cycle, priority, updated since).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Linear issues matching structured filters (team, project, assignee, status or status type, label, cycle, priority, updated since), one page at a time with a cursor. Use for exact filtering such as "open issues assigned to X in team Y"; use Search Issues for free-text matching. All filters are combined with AND; with no filter it lists every issue you can access. Read-only and idempotent. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
+ idempotent: true,
+ },
+ props: {
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'Only issues of this team (UUID from List Teams).', required: false }),
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'Only issues in this project (UUID from List Projects).', required: false }),
+ assignee_id: Property.ShortText({ displayName: 'Assignee ID', description: 'Only issues assigned to this user (UUID from List Users).', required: false }),
+ state_id: Property.ShortText({ displayName: 'Status ID', description: 'Only issues in this workflow state (UUID from List Workflow States).', required: false }),
+ state_type: Property.StaticDropdown({
+ displayName: 'Status Type',
+ description: 'Only issues whose status is of this type, across teams.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Triage', value: 'triage' },
+ { label: 'Backlog', value: 'backlog' },
+ { label: 'Unstarted (Todo)', value: 'unstarted' },
+ { label: 'Started (In progress)', value: 'started' },
+ { label: 'Completed', value: 'completed' },
+ { label: 'Canceled', value: 'canceled' },
+ ],
+ },
+ }),
+ label_id: Property.ShortText({ displayName: 'Label ID', description: 'Only issues that have this label (UUID from List Issue Labels).', required: false }),
+ cycle_id: Property.ShortText({ displayName: 'Cycle ID', description: 'Only issues in this cycle (UUID from List Cycles).', required: false }),
+ priority: Property.Number({ displayName: 'Priority', description: 'Only issues with this priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.', required: false }),
+ updated_after: Property.ShortText({ displayName: 'Updated After', description: 'Only issues updated after this ISO 8601 time, for example 2026-09-01T00:00:00Z.', required: false }),
+ include_archived: Property.Checkbox({ displayName: 'Include Archived', required: false, defaultValue: false }),
+ order_by: Property.StaticDropdown({
+ displayName: 'Order By',
+ description: 'Sort order. Default: newest created first.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Created at', value: 'createdAt' },
+ { label: 'Updated at', value: 'updatedAt' },
+ ],
+ },
+ }),
+ limit: atomicProps.limitProp({ fallback: 50, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicIssuesPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const updatedAfter = propsValue.updated_after?.trim();
+ if (updatedAfter && Number.isNaN(Date.parse(updatedAfter))) {
+ throw new Error('Updated After must be an ISO 8601 date-time, for example 2026-09-01T00:00:00Z.');
+ }
+ const priority = atomicProps.priorityValue(propsValue.priority);
+ const filter = linearGraphql.definedOnly({
+ team: atomicProps.idFilter(propsValue.team_id),
+ project: atomicProps.idFilter(propsValue.project_id),
+ assignee: atomicProps.idFilter(propsValue.assignee_id),
+ state: stateFilter({ stateId: propsValue.state_id, stateType: propsValue.state_type }),
+ labels: propsValue.label_id ? { some: { id: { eq: propsValue.label_id } } } : undefined,
+ cycle: atomicProps.idFilter(propsValue.cycle_id),
+ priority: priority === undefined ? undefined : { eq: priority },
+ updatedAt: updatedAfter ? { gt: updatedAfter } : undefined,
+ });
+ const data = await linearGraphql.request<{ issues: LinearConnection<LinearIssueNode> }>({
+ auth,
+ query: ISSUES_LIST_QUERY,
+ variables: {
+ filter: Object.keys(filter).length > 0 ? filter : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 50, max: 250 }),
+ after: propsValue.cursor || undefined,
+ includeArchived: propsValue.include_archived === true,
+ orderBy: propsValue.order_by || undefined,
+ },
+ });
+ const nodes = await linearGraphql.withAllIssuesLabels({ auth, issues: data.issues.nodes });
+ return linearMappers.toPage({ connection: { ...data.issues, nodes }, map: linearMappers.flattenIssue });
+ },
+});
+
+function stateFilter({ stateId, stateType }: { stateId: string | undefined; stateType: string | undefined }) {
+ const filter = linearGraphql.definedOnly({
+ id: stateId ? { eq: stateId } : undefined,
+ type: stateType ? { eq: stateType } : undefined,
+ });
+ return Object.keys(filter).length > 0 ? filter : undefined;
+}
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/issues-search.ts b/packages/pieces/community/linear/src/lib/actions/atomics/issues-search.ts
new file mode 100644
index 00000000000..4249dd65ef8
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/issues-search.ts
@@ -0,0 +1,56 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, LinearIssueNode, linearMappers } from '../../common/mappers';
+import { SEARCH_ISSUES_QUERY } from '../../common/queries';
+import { atomicProps } from './common';
+import { atomicIssueSearchOutputSchema } from './output-schemas';
+
+export const linearIssuesSearchAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_issues_search',
+ classification: 'SEARCH',
+ displayName: 'Search Issues (AI)',
+ description: 'Full-text and semantic search over issues, best matches first.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Searches Linear issues by free text (full-text plus semantic ranking) over titles and descriptions, optionally comments, optionally limited to one team, best matches first. Use to find duplicates or an issue described in words; use List Issues for exact field filters. Rate-limited by Linear to 30 requests per minute and new issues may take a moment to be indexed. Read-only and idempotent. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
+ idempotent: true,
+ },
+ props: {
+ term: Property.ShortText({ displayName: 'Search Text', description: 'Words to search for, for example "login timeout safari".', required: true }),
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'Only return issues of this team (UUID from List Teams).', required: false }),
+ include_comments: Property.Checkbox({ displayName: 'Search Comments Too', required: false, defaultValue: false }),
+ include_archived: Property.Checkbox({ displayName: 'Include Archived', required: false, defaultValue: false }),
+ limit: atomicProps.limitProp({ fallback: 25, max: 100 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicIssueSearchOutputSchema,
+ async run({ auth, propsValue }) {
+ const term = propsValue.term.trim();
+ if (term.length === 0) {
+ throw new Error('Search Text cannot be empty.');
+ }
+ const team = atomicProps.idFilter(propsValue.team_id);
+ const data = await linearGraphql.request<{
+ searchIssues: LinearConnection<LinearIssueNode> & { totalCount: number };
+ }>({
+ auth,
+ query: SEARCH_ISSUES_QUERY,
+ variables: {
+ term,
+ filter: team ? { team } : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 25, max: 100 }),
+ after: propsValue.cursor || undefined,
+ includeComments: propsValue.include_comments === true,
+ includeArchived: propsValue.include_archived === true,
+ },
+ });
+ const nodes = await linearGraphql.withAllIssuesLabels({ auth, issues: data.searchIssues.nodes });
+ return {
+ ...linearMappers.toPage({ connection: { ...data.searchIssues, nodes }, map: linearMappers.flattenIssue }),
+ total_count: data.searchIssues.totalCount,
+ };
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/output-schemas.ts b/packages/pieces/community/linear/src/lib/actions/atomics/output-schemas.ts
new file mode 100644
index 00000000000..47bad263a77
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/output-schemas.ts
@@ -0,0 +1,289 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+import { linearFieldSets } from '../../output-schemas';
+
+const { issueFlatFields, attachmentFlatFields, projectStatusUpdateFlatFields, archivedIssueFields, pageFields } = linearFieldSets;
+
+const projectFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Project ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'color', label: 'Color' },
+ { key: 'priority', label: 'Priority', format: 'number' },
+ { key: 'priority_label', label: 'Priority Label' },
+ { key: 'progress', label: 'Progress', format: 'number' },
+ { key: 'health', label: 'Health' },
+ { key: 'start_date', label: 'Start Date', format: 'date' },
+ { key: 'target_date', label: 'Target Date', format: 'date' },
+ { key: 'status_id', label: 'Status ID' },
+ { key: 'status_name', label: 'Status' },
+ { key: 'status_type', label: 'Status Type' },
+ { key: 'lead_id', label: 'Lead ID' },
+ { key: 'lead_name', label: 'Lead Name' },
+ { key: 'lead_email', label: 'Lead Email', format: 'email' },
+ { key: 'creator_id', label: 'Creator ID' },
+ { key: 'creator_name', label: 'Creator Name' },
+ { key: 'team_ids', label: 'Team IDs' },
+ { key: 'team_names', label: 'Teams' },
+ {
+ key: 'teams_complete',
+ label: 'All Teams Loaded',
+ format: 'boolean',
+ description: 'False when Linear did not return every team page; Team IDs and Teams then hold only the teams read',
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'completed_at', label: 'Completed At', format: 'datetime' },
+ { key: 'canceled_at', label: 'Canceled At', format: 'datetime' },
+ { key: 'archived_at', label: 'Archived At', format: 'datetime' },
+ { key: 'trashed', label: 'In Trash', format: 'boolean' },
+];
+
+const archivedProjectFields: OutputSchema['fields'] = [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'id', label: 'Project ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'trashed', label: 'In Trash', format: 'boolean' },
+ { key: 'archived_at', label: 'Archived At', format: 'datetime' },
+];
+
+const commentFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Comment ID' },
+ { key: 'body', label: 'Body (Markdown)' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'user_id', label: 'Author ID' },
+ { key: 'user_name', label: 'Author Name' },
+ { key: 'user_email', label: 'Author Email', format: 'email' },
+ { key: 'issue_id', label: 'Issue ID' },
+ { key: 'issue_identifier', label: 'Issue Identifier' },
+ { key: 'issue_title', label: 'Issue Title' },
+ { key: 'parent_id', label: 'Parent Comment ID' },
+ { key: 'resolved_at', label: 'Resolved At', format: 'datetime' },
+ { key: 'resolving_user_id', label: 'Resolved By ID' },
+ { key: 'resolving_user_name', label: 'Resolved By' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'edited_at', label: 'Edited At', format: 'datetime' },
+];
+
+const teamFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Team ID' },
+ { key: 'key', label: 'Team Key' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'color', label: 'Color' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'cycles_enabled', label: 'Cycles Enabled', format: 'boolean' },
+ { key: 'triage_enabled', label: 'Triage Enabled', format: 'boolean' },
+ { key: 'default_issue_estimate', label: 'Default Estimate', format: 'number' },
+ { key: 'issue_estimation_type', label: 'Estimation Type' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'archived_at', label: 'Archived At', format: 'datetime' },
+];
+
+const userFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'User ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'admin', label: 'Admin', format: 'boolean' },
+ { key: 'guest', label: 'Guest', format: 'boolean' },
+ { key: 'url', label: 'Profile URL', format: 'url' },
+ { key: 'avatar_url', label: 'Avatar', format: 'image' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const cycleFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Cycle ID' },
+ { key: 'number', label: 'Number', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'starts_at', label: 'Starts At', format: 'datetime' },
+ { key: 'ends_at', label: 'Ends At', format: 'datetime' },
+ { key: 'completed_at', label: 'Completed At', format: 'datetime' },
+ { key: 'progress', label: 'Progress', format: 'number' },
+ { key: 'is_active', label: 'Current Cycle', format: 'boolean' },
+ { key: 'is_next', label: 'Next Cycle', format: 'boolean' },
+ { key: 'is_previous', label: 'Previous Cycle', format: 'boolean' },
+ { key: 'team_id', label: 'Team ID' },
+ { key: 'team_key', label: 'Team Key' },
+ { key: 'team_name', label: 'Team Name' },
+];
+
+const labelFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Label ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'color', label: 'Color' },
+ { key: 'description', label: 'Description' },
+ { key: 'is_group', label: 'Label Group', format: 'boolean' },
+ { key: 'is_workspace_label', label: 'Workspace Label', format: 'boolean' },
+ { key: 'team_id', label: 'Team ID' },
+ { key: 'team_key', label: 'Team Key' },
+ { key: 'team_name', label: 'Team Name' },
+ { key: 'parent_id', label: 'Parent Label ID' },
+ { key: 'parent_name', label: 'Parent Label' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const workflowStateFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Status ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'type', label: 'Type', description: 'triage, backlog, unstarted, started, completed or canceled' },
+ { key: 'color', label: 'Color' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'description', label: 'Description' },
+ { key: 'team_id', label: 'Team ID' },
+ { key: 'team_key', label: 'Team Key' },
+ { key: 'team_name', label: 'Team Name' },
+];
+
+const milestoneFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Milestone ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'target_date', label: 'Target Date', format: 'date' },
+ { key: 'sort_order', label: 'Sort Order', format: 'number' },
+ { key: 'status', label: 'Status' },
+ { key: 'progress', label: 'Progress', format: 'number' },
+ { key: 'project_id', label: 'Project ID' },
+ { key: 'project_name', label: 'Project Name' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+export const atomicIssueOutputSchema: OutputSchema = { fields: issueFlatFields };
+export const atomicIssuesPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Issues', items: issueFlatFields, labelKey: 'identifier' }),
+};
+export const atomicIssueSearchOutputSchema: OutputSchema = {
+ fields: [
+ ...pageFields({ itemsLabel: 'Issues', items: issueFlatFields, labelKey: 'identifier' }),
+ { key: 'total_count', label: 'Total Matches', format: 'number' },
+ ],
+};
+export const atomicArchivedIssueOutputSchema: OutputSchema = { fields: archivedIssueFields };
+export const atomicIssueRelationOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Relation ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'issue_id', label: 'Issue ID' },
+ { key: 'issue_identifier', label: 'Issue Identifier' },
+ { key: 'issue_title', label: 'Issue Title' },
+ { key: 'related_issue_id', label: 'Related Issue ID' },
+ { key: 'related_issue_identifier', label: 'Related Issue Identifier' },
+ { key: 'related_issue_title', label: 'Related Issue Title' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const atomicLabelUpsertOutputSchema: OutputSchema = {
+ fields: [{ key: 'created', label: 'Created Now', format: 'boolean' }, ...labelFields],
+};
+export const atomicLabelsPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Labels', items: labelFields, labelKey: 'name' }),
+};
+export const atomicWorkflowStatesPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Statuses', items: workflowStateFields, labelKey: 'name' }),
+};
+
+export const atomicTeamOutputSchema: OutputSchema = { fields: teamFields };
+export const atomicTeamDetailsOutputSchema: OutputSchema = {
+ fields: [
+ ...teamFields,
+ { key: 'issue_count', label: 'Issue Count', format: 'number' },
+ { key: 'default_issue_state_id', label: 'Default Status ID' },
+ { key: 'default_issue_state_name', label: 'Default Status' },
+ { key: 'default_issue_state_type', label: 'Default Status Type' },
+ ],
+};
+export const atomicTeamsPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Teams', items: teamFields, labelKey: 'name' }),
+};
+
+export const atomicUsersPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Users', items: userFields, labelKey: 'name' }),
+};
+export const atomicViewerOutputSchema: OutputSchema = {
+ fields: [
+ ...userFields,
+ { key: 'organization_id', label: 'Workspace ID' },
+ { key: 'organization_name', label: 'Workspace Name' },
+ { key: 'organization_url_key', label: 'Workspace URL Key' },
+ ],
+};
+
+export const atomicCyclesPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Cycles', items: cycleFields, labelKey: 'number' }),
+};
+
+export const atomicCommentOutputSchema: OutputSchema = { fields: commentFields };
+export const atomicCommentsPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Comments', items: commentFields, labelKey: 'id' }),
+};
+export const atomicReactionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Reaction ID' },
+ { key: 'emoji', label: 'Emoji' },
+ { key: 'user_id', label: 'User ID' },
+ { key: 'user_name', label: 'User Name' },
+ { key: 'comment_id', label: 'Comment ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const atomicAttachmentOutputSchema: OutputSchema = { fields: attachmentFlatFields };
+export const atomicUploadDownloadOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'file', label: 'File' },
+ { key: 'file_name', label: 'File Name' },
+ { key: 'mime_type', label: 'MIME Type' },
+ { key: 'size_bytes', label: 'Size', format: 'filesize' },
+ ],
+};
+
+export const atomicProjectOutputSchema: OutputSchema = { fields: projectFields };
+export const atomicProjectDetailsOutputSchema: OutputSchema = {
+ fields: [
+ ...projectFields,
+ {
+ key: 'milestones',
+ label: 'Milestones',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'Milestone ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'target_date', label: 'Target Date', format: 'date' },
+ { key: 'status', label: 'Status' },
+ ],
+ },
+ {
+ key: 'milestones_complete',
+ label: 'All Milestones Loaded',
+ format: 'boolean',
+ description: 'False when Linear did not return every milestone page; Milestones then holds only the milestones read',
+ },
+ ],
+};
+export const atomicProjectsPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Projects', items: projectFields, labelKey: 'name' }),
+};
+export const atomicArchivedProjectOutputSchema: OutputSchema = { fields: archivedProjectFields };
+export const atomicMilestoneOutputSchema: OutputSchema = { fields: milestoneFields };
+
+export const atomicProjectStatusUpdateOutputSchema: OutputSchema = { fields: projectStatusUpdateFlatFields };
+export const atomicProjectStatusUpdatesPageOutputSchema: OutputSchema = {
+ fields: pageFields({ itemsLabel: 'Status Updates', items: projectStatusUpdateFlatFields, labelKey: 'created_at' }),
+};
+export const atomicArchivedProjectStatusUpdateOutputSchema: OutputSchema = {
+ fields: [{ key: 'success', label: 'Success', format: 'boolean' }, ...projectStatusUpdateFlatFields],
+};
+export const atomicReactionDeleteOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'deleted_id', label: 'Deleted Reaction ID' },
+ ],
+};
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-create.ts
new file mode 100644
index 00000000000..cdcf960eeb2
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-create.ts
@@ -0,0 +1,59 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, atomicRelations, atomicProps, LinearProjectNode } from './common';
+import { PROJECT_CREATE_MUTATION } from './queries';
+import { atomicProjectOutputSchema } from './output-schemas';
+
+export const linearProjectCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_create',
+ classification: 'WRITE',
+ displayName: 'Create Project (AI)',
+ description: 'Create a project for one or more teams.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a Linear project shared by one or more teams, with optional description, lead, priority, status, start and target dates (YYYY-MM-DD), icon and color. Use to set up a new body of work; check List Projects first to avoid a duplicate, and use Create Project Milestone and Post Project Status Update afterwards. Not idempotent: each call creates a new project. teams_complete is false when Linear did not return every team page; team_ids and team_names then hold only the teams read.',
+ idempotent: false,
+ },
+ props: {
+ team_ids: Property.Array({ displayName: 'Team IDs', description: 'UUIDs of the teams the project belongs to (from List Teams). At least one.', required: true }),
+ name: Property.ShortText({ displayName: 'Name', description: 'Project name, for example "Website relaunch".', required: true }),
+ description: Property.ShortText({ displayName: 'Summary', description: 'Short one-line summary shown under the project name.', required: false }),
+ lead_id: Property.ShortText({ displayName: 'Lead ID', description: 'UUID of the project lead (from List Users).', required: false }),
+ priority: Property.Number({ displayName: 'Priority', description: '0 none, 1 urgent, 2 high, 3 medium, 4 low.', required: false }),
+ status_id: Property.ShortText({ displayName: 'Status ID', description: 'UUID of a project status. Leave empty for the default status.', required: false }),
+ start_date: Property.ShortText({ displayName: 'Start Date', description: 'YYYY-MM-DD, for example 2026-10-01.', required: false }),
+ target_date: Property.ShortText({ displayName: 'Target Date', description: 'YYYY-MM-DD, for example 2026-12-15.', required: false }),
+ icon: Property.ShortText({ displayName: 'Icon', description: 'Linear icon name, for example "Rocket".', required: false }),
+ color: Property.ShortText({ displayName: 'Color', description: 'Hex color, for example #5E6AD2.', required: false }),
+ },
+ outputSchema: atomicProjectOutputSchema,
+ async run({ auth, propsValue }) {
+ const teamIds = linearGraphql.toStringArray(propsValue.team_ids);
+ if (!teamIds) {
+ throw new Error('Team IDs needs at least one team UUID.');
+ }
+ const input = linearGraphql.definedOnly({
+ teamIds,
+ name: propsValue.name,
+ description: propsValue.description,
+ leadId: propsValue.lead_id,
+ priority: atomicProps.priorityValue(propsValue.priority),
+ statusId: propsValue.status_id,
+ startDate: linearGraphql.toTimelessDate({ value: propsValue.start_date, fieldName: 'Start Date' }),
+ targetDate: linearGraphql.toTimelessDate({ value: propsValue.target_date, fieldName: 'Target Date' }),
+ icon: propsValue.icon,
+ color: propsValue.color,
+ });
+ const data = await linearGraphql.request<{
+ projectCreate: { success: boolean; project: LinearProjectNode | null };
+ }>({ auth, query: PROJECT_CREATE_MUTATION, variables: { input } });
+ const payload = linearGraphql.requireSuccess({ payload: data.projectCreate, what: 'project creation' });
+ if (!payload.project) {
+ throw new Error('Linear did not return the created project.');
+ }
+ return atomicMappers.flattenProject(await atomicRelations.withAllProjectTeams({ auth, project: payload.project }));
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-delete.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-delete.ts
new file mode 100644
index 00000000000..509875ea17b
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-delete.ts
@@ -0,0 +1,31 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearArchivedProjectNode } from './common';
+import { PROJECT_DELETE_MUTATION } from './queries';
+import { atomicArchivedProjectOutputSchema } from './output-schemas';
+
+export const linearProjectDeleteAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_delete',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Project (AI)',
+ description: 'Move a project to the trash. It can be restored.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Moves a Linear project to the trash; its issues are kept, and Restore Project brings it back. Use only when a project was created by mistake or is no longer wanted; to finish a project set its status with Update Project instead. Not idempotent: a second call on a trashed project may fail.',
+ idempotent: false,
+ },
+ props: {
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'UUID of the project (from List Projects).', required: true }),
+ },
+ outputSchema: atomicArchivedProjectOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{
+ projectDelete: { success: boolean; entity: LinearArchivedProjectNode | null };
+ }>({ auth, query: PROJECT_DELETE_MUTATION, variables: { id: propsValue.project_id.trim() } });
+ const payload = linearGraphql.requireSuccess({ payload: data.projectDelete, what: 'project deletion' });
+ return atomicMappers.flattenArchivedProject(payload.entity);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-get.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-get.ts
new file mode 100644
index 00000000000..ed655684ac1
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-get.ts
@@ -0,0 +1,65 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { LinearAuth, linearGraphql } from '../../common/graphql';
+import { atomicMappers, atomicRelations, LinearMilestoneConnection, LinearProjectNode } from './common';
+import { PROJECT_GET_QUERY, PROJECT_MILESTONES_PAGE_QUERY } from './queries';
+import { atomicProjectDetailsOutputSchema } from './output-schemas';
+
+export const linearProjectGetAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_get',
+ classification: 'READ',
+ displayName: 'Get Project (AI)',
+ description: 'Get one project with its teams, lead, status and milestones.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one Linear project by ID with status, health, progress, dates, lead, teams and its milestones (the Milestone IDs Create Issue accepts). Use when the project is known; use List Projects to find it by name or team. All milestones are returned, however many the project has. teams_complete is false when Linear did not return every team page; team_ids and team_names then hold only the teams read. milestones_complete is false when Linear did not return every milestone page. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'UUID of the project (from List Projects).', required: true }),
+ },
+ outputSchema: atomicProjectDetailsOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{ project: LinearProjectNode | null }>({
+ auth,
+ query: PROJECT_GET_QUERY,
+ variables: { id: propsValue.project_id.trim() },
+ });
+ if (!data.project) {
+ throw new Error(`No Linear project found for ${propsValue.project_id}.`);
+ }
+ const milestones = await remainingMilestones({ auth, projectId: data.project.id, first: data.project.projectMilestones });
+ const project = await atomicRelations.withAllProjectTeams({ auth, project: data.project });
+ return atomicMappers.flattenProjectWithMilestones({ ...project, projectMilestones: milestones });
+ },
+});
+
+async function remainingMilestones({
+ auth,
+ projectId,
+ first,
+}: {
+ auth: LinearAuth;
+ projectId: string;
+ first: LinearMilestoneConnection | null | undefined;
+}): Promise<LinearMilestoneConnection> {
+ const nodes = [...(first?.nodes ?? [])];
+ let pageInfo = first?.pageInfo;
+ try {
+ while (pageInfo?.hasNextPage === true && typeof pageInfo.endCursor === 'string') {
+ const data = await linearGraphql.request<{ project: { projectMilestones: LinearMilestoneConnection | null } | null }>({
+ auth,
+ query: PROJECT_MILESTONES_PAGE_QUERY,
+ variables: { id: projectId, after: pageInfo.endCursor },
+ });
+ const page = data.project?.projectMilestones;
+ nodes.push(...(page?.nodes ?? []));
+ pageInfo = page?.pageInfo;
+ }
+ } catch {
+ return { nodes, pageInfo: { hasNextPage: true, endCursor: pageInfo?.endCursor ?? null } };
+ }
+ return { nodes, pageInfo: { hasNextPage: false, endCursor: null } };
+}
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-milestone-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-milestone-create.ts
new file mode 100644
index 00000000000..7eb93ebd102
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-milestone-create.ts
@@ -0,0 +1,40 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearMilestoneNode } from './common';
+import { PROJECT_MILESTONE_CREATE_MUTATION } from './queries';
+import { atomicMilestoneOutputSchema } from './output-schemas';
+
+export const linearProjectMilestoneCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_milestone_create',
+ classification: 'WRITE',
+ displayName: 'Create Project Milestone (AI)',
+ description: 'Add a milestone to a project.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Adds a milestone (a named checkpoint with an optional target date) to a Linear project; issues can then be assigned to it with Create Issue or Update Issue. Check Get Project first, which lists existing milestones, to avoid a duplicate. Not idempotent: each call adds a milestone.',
+ idempotent: false,
+ },
+ props: {
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'UUID of the project (from List Projects).', required: true }),
+ name: Property.ShortText({ displayName: 'Name', description: 'Milestone name, for example "Beta".', required: true }),
+ description: Property.LongText({ displayName: 'Description', description: 'Markdown description.', required: false }),
+ target_date: Property.ShortText({ displayName: 'Target Date', description: 'YYYY-MM-DD, for example 2026-11-30.', required: false }),
+ },
+ outputSchema: atomicMilestoneOutputSchema,
+ async run({ auth, propsValue }) {
+ const input = linearGraphql.definedOnly({
+ projectId: propsValue.project_id.trim(),
+ name: propsValue.name,
+ description: propsValue.description,
+ targetDate: linearGraphql.toTimelessDate({ value: propsValue.target_date, fieldName: 'Target Date' }),
+ });
+ const data = await linearGraphql.request<{
+ projectMilestoneCreate: { success: boolean; projectMilestone: LinearMilestoneNode };
+ }>({ auth, query: PROJECT_MILESTONE_CREATE_MUTATION, variables: { input } });
+ const payload = linearGraphql.requireSuccess({ payload: data.projectMilestoneCreate, what: 'milestone creation' });
+ return atomicMappers.flattenMilestone(payload.projectMilestone);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-archive.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-archive.ts
new file mode 100644
index 00000000000..76cbf79c1c3
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-archive.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearMappers } from '../../common/mappers';
+import { atomicStatusUpdates } from './common';
+import { PROJECT_STATUS_UPDATE_ARCHIVE_MUTATION } from './queries';
+import { atomicArchivedProjectStatusUpdateOutputSchema } from './output-schemas';
+
+export const linearProjectStatusUpdateArchiveAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_status_update_archive',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Archive Project Status Update (AI)',
+ description: 'Archive (hide) a project status update. It can be restored.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Archives a Linear project status update so it no longer shows in the project Updates tab; Unarchive Project Status Update restores it. Use to retract a report posted by mistake. Idempotent: archiving an archived update keeps it archived.',
+ idempotent: true,
+ },
+ props: {
+ status_update_id: Property.ShortText({ displayName: 'Status Update ID', description: 'UUID of the project status update.', required: true }),
+ },
+ outputSchema: atomicArchivedProjectStatusUpdateOutputSchema,
+ async run({ auth, propsValue }) {
+ const entity = await atomicStatusUpdates.setStatusUpdateArchived({
+ auth,
+ id: propsValue.status_update_id.trim(),
+ archived: true,
+ mutation: PROJECT_STATUS_UPDATE_ARCHIVE_MUTATION,
+ field: 'projectUpdateArchive',
+ });
+ return { success: true, ...linearMappers.flattenProjectStatusUpdate(entity) };
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-create.ts
new file mode 100644
index 00000000000..9212b79b448
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-create.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearProjectStatusUpdateNode, linearMappers } from '../../common/mappers';
+import { PROJECT_STATUS_UPDATE_CREATE_MUTATION } from '../../common/queries';
+import { atomicProps } from './common';
+import { atomicProjectStatusUpdateOutputSchema } from './output-schemas';
+
+export const linearProjectStatusUpdateCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_status_update_create',
+ classification: 'WRITE',
+ displayName: 'Post Project Status Update (AI)',
+ description: 'Post a progress report (status update with health) on a project.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Posts a project status update, the progress report in a Linear project\'s Updates tab: a markdown body with an optional health of onTrack, atRisk or offTrack. This does not edit the project; use Update Project for its fields. Not idempotent: each call posts another update.',
+ idempotent: false,
+ },
+ props: {
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'UUID of the project (from List Projects).', required: true }),
+ body: Property.LongText({ displayName: 'Body', description: 'Update text in Markdown.', required: true }),
+ health: atomicProps.healthProp({ description: 'onTrack, atRisk or offTrack. Leave empty for no health rating.' }),
+ },
+ outputSchema: atomicProjectStatusUpdateOutputSchema,
+ async run({ auth, propsValue }) {
+ if (propsValue.body.trim().length === 0) {
+ throw new Error('Body cannot be empty.');
+ }
+ const data = await linearGraphql.request<{
+ projectUpdateCreate: { success: boolean; projectUpdate: LinearProjectStatusUpdateNode };
+ }>({
+ auth,
+ query: PROJECT_STATUS_UPDATE_CREATE_MUTATION,
+ variables: {
+ input: linearGraphql.definedOnly({
+ projectId: propsValue.project_id.trim(),
+ body: propsValue.body,
+ health: propsValue.health,
+ }),
+ },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.projectUpdateCreate, what: 'project status update' });
+ return linearMappers.flattenProjectStatusUpdate(payload.projectUpdate);
+ },
+});
+
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-edit.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-edit.ts
new file mode 100644
index 00000000000..abf94cf54b6
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-edit.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearProjectStatusUpdateNode, linearMappers } from '../../common/mappers';
+import { atomicProps } from './common';
+import { PROJECT_STATUS_UPDATE_EDIT_MUTATION } from './queries';
+import { atomicProjectStatusUpdateOutputSchema } from './output-schemas';
+
+export const linearProjectStatusUpdateEditAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_status_update_edit',
+ classification: 'WRITE',
+ displayName: 'Edit Project Status Update (AI)',
+ description: 'Change the text or health of a posted project status update.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Edits a posted Linear project status update: replaces its markdown body and/or changes its health; whatever you leave out stays as it is. This edits the progress report, not the project (use Update Project for that). Idempotent: repeating the same edit leaves the update unchanged.',
+ idempotent: true,
+ },
+ props: {
+ status_update_id: Property.ShortText({ displayName: 'Status Update ID', description: 'UUID of the project status update.', required: true }),
+ body: Property.LongText({ displayName: 'Body', description: 'New update text in Markdown. Replaces the whole body.', required: false }),
+ health: atomicProps.healthProp({ description: 'New health. Leave empty to keep the current one.' }),
+ },
+ outputSchema: atomicProjectStatusUpdateOutputSchema,
+ async run({ auth, propsValue }) {
+ const input = linearGraphql.definedOnly({ body: propsValue.body, health: propsValue.health });
+ if (Object.keys(input).length === 0) {
+ throw new Error('Nothing to update: pass a new body or health.');
+ }
+ const data = await linearGraphql.request<{
+ projectUpdateUpdate: { success: boolean; projectUpdate: LinearProjectStatusUpdateNode };
+ }>({
+ auth,
+ query: PROJECT_STATUS_UPDATE_EDIT_MUTATION,
+ variables: { id: propsValue.status_update_id.trim(), input },
+ });
+ const payload = linearGraphql.requireSuccess({ payload: data.projectUpdateUpdate, what: 'status update edit' });
+ return linearMappers.flattenProjectStatusUpdate(payload.projectUpdate);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-get.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-get.ts
new file mode 100644
index 00000000000..cdb2db8599e
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-get.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearProjectStatusUpdateNode, linearMappers } from '../../common/mappers';
+import { PROJECT_STATUS_UPDATE_GET_QUERY } from './queries';
+import { atomicProjectStatusUpdateOutputSchema } from './output-schemas';
+
+export const linearProjectStatusUpdateGetAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_status_update_get',
+ classification: 'READ',
+ displayName: 'Get Project Status Update (AI)',
+ description: 'Get one project status update by ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one Linear project status update (progress report) by ID with its markdown body, health, author and project. Use when the update ID is known, for example from the New Project Status Update trigger; use List Project Status Updates to browse a project\'s history. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ status_update_id: Property.ShortText({ displayName: 'Status Update ID', description: 'UUID of the project status update.', required: true }),
+ },
+ outputSchema: atomicProjectStatusUpdateOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{ projectUpdate: LinearProjectStatusUpdateNode | null }>({
+ auth,
+ query: PROJECT_STATUS_UPDATE_GET_QUERY,
+ variables: { id: propsValue.status_update_id.trim() },
+ });
+ if (!data.projectUpdate) {
+ throw new Error(`No Linear project status update found for ${propsValue.status_update_id}.`);
+ }
+ return linearMappers.flattenProjectStatusUpdate(data.projectUpdate);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-unarchive.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-unarchive.ts
new file mode 100644
index 00000000000..14c83a0c8fa
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-update-unarchive.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearMappers } from '../../common/mappers';
+import { atomicStatusUpdates } from './common';
+import { PROJECT_STATUS_UPDATE_UNARCHIVE_MUTATION } from './queries';
+import { atomicArchivedProjectStatusUpdateOutputSchema } from './output-schemas';
+
+export const linearProjectStatusUpdateUnarchiveAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_status_update_unarchive',
+ classification: 'WRITE',
+ displayName: 'Unarchive Project Status Update (AI)',
+ description: 'Restore an archived project status update.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Restores an archived Linear project status update so it shows in the project Updates tab again. Use to undo Archive Project Status Update. Idempotent: restoring a visible update keeps it visible.',
+ idempotent: true,
+ },
+ props: {
+ status_update_id: Property.ShortText({ displayName: 'Status Update ID', description: 'UUID of the project status update.', required: true }),
+ },
+ outputSchema: atomicArchivedProjectStatusUpdateOutputSchema,
+ async run({ auth, propsValue }) {
+ const entity = await atomicStatusUpdates.setStatusUpdateArchived({
+ auth,
+ id: propsValue.status_update_id.trim(),
+ archived: false,
+ mutation: PROJECT_STATUS_UPDATE_UNARCHIVE_MUTATION,
+ field: 'projectUpdateUnarchive',
+ });
+ return { success: true, ...linearMappers.flattenProjectStatusUpdate(entity) };
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-status-updates-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-updates-list.ts
new file mode 100644
index 00000000000..9e96c96885a
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-status-updates-list.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, LinearProjectStatusUpdateNode, linearMappers } from '../../common/mappers';
+import { atomicProps } from './common';
+import { PROJECT_STATUS_UPDATES_LIST_QUERY } from './queries';
+import { atomicProjectStatusUpdatesPageOutputSchema } from './output-schemas';
+
+export const linearProjectStatusUpdatesListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_status_updates_list',
+ classification: 'SEARCH',
+ displayName: 'List Project Status Updates (AI)',
+ description: 'List project status updates, usually of one project.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Linear project status updates (progress reports with health), normally for one project, one page at a time. Use to read how a project has been reported over time or to find an update ID to edit or archive. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'Only updates of this project (UUID from List Projects). Leave empty for all projects.', required: false }),
+ include_archived: Property.Checkbox({ displayName: 'Include Archived', required: false, defaultValue: false }),
+ limit: atomicProps.limitProp({ fallback: 25, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicProjectStatusUpdatesPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const project = atomicProps.idFilter(propsValue.project_id?.trim());
+ const data = await linearGraphql.request<{ projectUpdates: LinearConnection<LinearProjectStatusUpdateNode> }>({
+ auth,
+ query: PROJECT_STATUS_UPDATES_LIST_QUERY,
+ variables: {
+ filter: project ? { project } : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 25, max: 250 }),
+ after: propsValue.cursor || undefined,
+ includeArchived: propsValue.include_archived === true,
+ },
+ });
+ return linearMappers.toPage({ connection: data.projectUpdates, map: linearMappers.flattenProjectStatusUpdate });
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-unarchive.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-unarchive.ts
new file mode 100644
index 00000000000..96231bed485
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-unarchive.ts
@@ -0,0 +1,31 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearArchivedProjectNode } from './common';
+import { PROJECT_UNARCHIVE_MUTATION } from './queries';
+import { atomicArchivedProjectOutputSchema } from './output-schemas';
+
+export const linearProjectUnarchiveAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_unarchive',
+ classification: 'WRITE',
+ displayName: 'Restore Project (AI)',
+ description: 'Restore a trashed or archived project.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Restores a Linear project that was deleted (trashed) or archived, bringing it back to active views. Use to undo Delete Project. Idempotent: restoring an active project leaves it active.',
+ idempotent: true,
+ },
+ props: {
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'UUID of the project (from List Projects).', required: true }),
+ },
+ outputSchema: atomicArchivedProjectOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{
+ projectUnarchive: { success: boolean; entity: LinearArchivedProjectNode | null };
+ }>({ auth, query: PROJECT_UNARCHIVE_MUTATION, variables: { id: propsValue.project_id.trim() } });
+ const payload = linearGraphql.requireSuccess({ payload: data.projectUnarchive, what: 'project restore' });
+ return atomicMappers.flattenArchivedProject(payload.entity);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/project-update.ts b/packages/pieces/community/linear/src/lib/actions/atomics/project-update.ts
new file mode 100644
index 00000000000..f0b441befa9
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/project-update.ts
@@ -0,0 +1,77 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, atomicRelations, atomicProps, LinearProjectNode } from './common';
+import { PROJECT_UPDATE_MUTATION } from './queries';
+import { atomicProjectOutputSchema } from './output-schemas';
+
+export const linearProjectUpdateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_project_update',
+ classification: 'WRITE',
+ displayName: 'Update Project (AI)',
+ description: 'Change only the project fields you pass. Teams are only changed when Team IDs is given.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Partially edits a Linear project (name, summary, lead, priority, status, dates, icon, color): only the fields you pass change. The team list is only touched when Team IDs is given, and then it replaces the whole list. To post a progress report use Post Project Status Update instead; to empty the lead or a date list it in Clear Fields. Idempotent: repeating the same update leaves the project in the same state. teams_complete is false when Linear did not return every team page; team_ids and team_names then hold only the teams read.',
+ idempotent: true,
+ },
+ props: {
+ project_id: Property.ShortText({ displayName: 'Project ID', description: 'UUID of the project (from List Projects).', required: true }),
+ name: Property.ShortText({ displayName: 'Name', required: false }),
+ description: Property.ShortText({ displayName: 'Summary', description: 'Short one-line summary.', required: false }),
+ lead_id: Property.ShortText({ displayName: 'Lead ID', description: 'UUID of the new lead (from List Users).', required: false }),
+ priority: Property.Number({ displayName: 'Priority', description: '0 none, 1 urgent, 2 high, 3 medium, 4 low.', required: false }),
+ status_id: Property.ShortText({ displayName: 'Status ID', description: 'UUID of a project status.', required: false }),
+ start_date: Property.ShortText({ displayName: 'Start Date', description: 'YYYY-MM-DD.', required: false }),
+ target_date: Property.ShortText({ displayName: 'Target Date', description: 'YYYY-MM-DD.', required: false }),
+ icon: Property.ShortText({ displayName: 'Icon', required: false }),
+ color: Property.ShortText({ displayName: 'Color', description: 'Hex color, for example #5E6AD2.', required: false }),
+ team_ids: Property.Array({ displayName: 'Team IDs (replace all)', description: 'Replaces the teams of the project with exactly these team UUIDs. Leave empty to keep the current teams.', required: false }),
+ clear_fields: Property.StaticMultiSelectDropdown({
+ displayName: 'Clear Fields',
+ description: 'Fields to empty on the project. A field listed here must not also be given a value.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Lead', value: 'leadId' },
+ { label: 'Start date', value: 'startDate' },
+ { label: 'Target date', value: 'targetDate' },
+ ],
+ },
+ }),
+ },
+ outputSchema: atomicProjectOutputSchema,
+ async run({ auth, propsValue }) {
+ const set = linearGraphql.definedOnly({
+ name: propsValue.name,
+ description: propsValue.description,
+ leadId: propsValue.lead_id,
+ priority: atomicProps.priorityValue(propsValue.priority),
+ statusId: propsValue.status_id,
+ startDate: linearGraphql.toTimelessDate({ value: propsValue.start_date, fieldName: 'Start Date' }),
+ targetDate: linearGraphql.toTimelessDate({ value: propsValue.target_date, fieldName: 'Target Date' }),
+ icon: propsValue.icon,
+ color: propsValue.color,
+ teamIds: linearGraphql.toStringArray(propsValue.team_ids),
+ });
+ const cleared = linearGraphql.toStringArray(propsValue.clear_fields) ?? [];
+ const conflicts = cleared.filter((field) => field in set);
+ if (conflicts.length > 0) {
+ throw new Error(`These fields are both set and cleared: ${conflicts.join(', ')}. Pick one.`);
+ }
+ const input = { ...set, ...Object.fromEntries(cleared.map((field) => [field, null])) };
+ if (Object.keys(input).length === 0) {
+ throw new Error('Nothing to update: pass at least one field to change or clear.');
+ }
+ const data = await linearGraphql.request<{
+ projectUpdate: { success: boolean; project: LinearProjectNode | null };
+ }>({ auth, query: PROJECT_UPDATE_MUTATION, variables: { id: propsValue.project_id.trim(), input } });
+ const payload = linearGraphql.requireSuccess({ payload: data.projectUpdate, what: 'project update' });
+ if (!payload.project) {
+ throw new Error('Linear did not return the updated project.');
+ }
+ return atomicMappers.flattenProject(await atomicRelations.withAllProjectTeams({ auth, project: payload.project }));
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/projects-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/projects-list.ts
new file mode 100644
index 00000000000..c2f14b69168
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/projects-list.ts
@@ -0,0 +1,64 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, linearMappers } from '../../common/mappers';
+import { atomicMappers, atomicRelations, atomicProps, LinearProjectNode } from './common';
+import { PROJECTS_LIST_QUERY } from './queries';
+import { atomicProjectsPageOutputSchema } from './output-schemas';
+
+export const linearProjectsListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_projects_list',
+ classification: 'SEARCH',
+ displayName: 'List Projects (AI)',
+ description: 'List projects, optionally of one team, with a status type or a name fragment.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists Linear projects with status, lead, dates, progress and teams, optionally only those of one team, of one status type (backlog, planned, started, paused, completed, canceled) or whose name contains a text. Use to resolve a project name to its ID or to review active work. Read-only and idempotent. teams_complete is false when Linear did not return every team page; team_ids and team_names then hold only the teams read.',
+ idempotent: true,
+ },
+ props: {
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'Only projects of this team (UUID from List Teams).', required: false }),
+ status_type: Property.StaticDropdown({
+ displayName: 'Status Type',
+ required: false,
+ options: {
+ options: [
+ { label: 'Backlog', value: 'backlog' },
+ { label: 'Planned', value: 'planned' },
+ { label: 'In progress', value: 'started' },
+ { label: 'Paused', value: 'paused' },
+ { label: 'Completed', value: 'completed' },
+ { label: 'Canceled', value: 'canceled' },
+ ],
+ },
+ }),
+ name_contains: Property.ShortText({ displayName: 'Name Contains', description: 'Case-insensitive name fragment.', required: false }),
+ include_archived: Property.Checkbox({ displayName: 'Include Archived', required: false, defaultValue: false }),
+ limit: atomicProps.limitProp({ fallback: 50, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicProjectsPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const teamId = propsValue.team_id?.trim();
+ const nameContains = propsValue.name_contains?.trim();
+ const filter = linearGraphql.definedOnly({
+ accessibleTeams: teamId ? { some: { id: { eq: teamId } } } : undefined,
+ status: propsValue.status_type ? { type: { eq: propsValue.status_type } } : undefined,
+ name: nameContains ? { containsIgnoreCase: nameContains } : undefined,
+ });
+ const data = await linearGraphql.request<{ projects: LinearConnection<LinearProjectNode> }>({
+ auth,
+ query: PROJECTS_LIST_QUERY,
+ variables: {
+ filter: Object.keys(filter).length > 0 ? filter : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 50, max: 250 }),
+ after: propsValue.cursor || undefined,
+ includeArchived: propsValue.include_archived === true,
+ },
+ });
+ const nodes = await atomicRelations.withAllProjectsTeams({ auth, projects: data.projects.nodes });
+ return linearMappers.toPage({ connection: { ...data.projects, nodes }, map: atomicMappers.flattenProject });
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/queries.ts b/packages/pieces/community/linear/src/lib/actions/atomics/queries.ts
new file mode 100644
index 00000000000..6b5feb14f13
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/queries.ts
@@ -0,0 +1,488 @@
+import {
+ ATTACHMENT_SELECTION,
+ ISSUE_SELECTION,
+ PROJECT_STATUS_UPDATE_SELECTION,
+} from '../../common/queries';
+
+export const PROJECT_SELECTION = `
+ id
+ name
+ description
+ url
+ icon
+ color
+ priority
+ priorityLabel
+ progress
+ health
+ startDate
+ targetDate
+ createdAt
+ updatedAt
+ completedAt
+ canceledAt
+ archivedAt
+ trashed
+ status { id name type }
+ lead { id name email }
+ creator { id name }
+ teams(first: 10) {
+ pageInfo { hasNextPage endCursor }
+ nodes { id key name }
+ }
+`;
+
+export const COMMENT_SELECTION = `
+ id
+ body
+ url
+ createdAt
+ updatedAt
+ editedAt
+ resolvedAt
+ user { id name email }
+ resolvingUser { id name }
+ issue { id identifier title }
+ parent { id }
+`;
+
+export const TEAM_SELECTION = `
+ id
+ key
+ name
+ description
+ icon
+ color
+ timezone
+ cyclesEnabled
+ triageEnabled
+ defaultIssueEstimate
+ issueEstimationType
+ createdAt
+ updatedAt
+ archivedAt
+`;
+
+export const USER_SELECTION = `
+ id
+ name
+ displayName
+ email
+ active
+ admin
+ guest
+ url
+ avatarUrl
+ timezone
+ createdAt
+`;
+
+export const CYCLE_SELECTION = `
+ id
+ number
+ name
+ startsAt
+ endsAt
+ completedAt
+ progress
+ isActive
+ isNext
+ isPrevious
+ team { id key name }
+`;
+
+export const LABEL_SELECTION = `
+ id
+ name
+ color
+ description
+ isGroup
+ createdAt
+ team { id key name }
+ parent { id name }
+`;
+
+export const WORKFLOW_STATE_SELECTION = `
+ id
+ name
+ type
+ color
+ position
+ description
+ team { id key name }
+`;
+
+export const MILESTONE_SELECTION = `
+ id
+ name
+ description
+ targetDate
+ sortOrder
+ status
+ progress
+ createdAt
+ project { id name }
+`;
+
+export const ISSUE_CREATE_MUTATION = `
+ mutation LinearAtomicIssueCreate($input: IssueCreateInput!) {
+ issueCreate(input: $input) {
+ success
+ issue { ${ISSUE_SELECTION} }
+ }
+ }
+`;
+
+export const ISSUE_UPDATE_MUTATION = `
+ mutation LinearAtomicIssueUpdate($id: String!, $input: IssueUpdateInput!) {
+ issueUpdate(id: $id, input: $input) {
+ success
+ issue { ${ISSUE_SELECTION} }
+ }
+ }
+`;
+
+export const ISSUES_LIST_QUERY = `
+ query LinearAtomicIssuesList($filter: IssueFilter, $first: Int, $after: String, $includeArchived: Boolean, $orderBy: PaginationOrderBy) {
+ issues(filter: $filter, first: $first, after: $after, includeArchived: $includeArchived, orderBy: $orderBy) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${ISSUE_SELECTION} }
+ }
+ }
+`;
+
+export const ISSUE_ARCHIVE_MUTATION = `
+ mutation LinearAtomicIssueArchive($id: String!) {
+ issueArchive(id: $id) {
+ success
+ entity { id identifier title url trashed archivedAt }
+ }
+ }
+`;
+
+export const ISSUE_UNARCHIVE_MUTATION = `
+ mutation LinearAtomicIssueUnarchive($id: String!) {
+ issueUnarchive(id: $id) {
+ success
+ entity { id identifier title url trashed archivedAt }
+ }
+ }
+`;
+
+export const ISSUE_RELATION_CREATE_MUTATION = `
+ mutation LinearAtomicIssueRelationCreate($input: IssueRelationCreateInput!) {
+ issueRelationCreate(input: $input) {
+ success
+ issueRelation {
+ id
+ type
+ createdAt
+ issue { id identifier title }
+ relatedIssue { id identifier title }
+ }
+ }
+ }
+`;
+
+export const ISSUE_LABELS_LIST_QUERY = `
+ query LinearAtomicIssueLabelsList($filter: IssueLabelFilter, $first: Int, $after: String) {
+ issueLabels(filter: $filter, first: $first, after: $after) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${LABEL_SELECTION} }
+ }
+ }
+`;
+
+export const ISSUE_LABEL_CREATE_MUTATION = `
+ mutation LinearAtomicIssueLabelCreate($input: IssueLabelCreateInput!) {
+ issueLabelCreate(input: $input) {
+ success
+ issueLabel { ${LABEL_SELECTION} }
+ }
+ }
+`;
+
+export const WORKFLOW_STATES_LIST_QUERY = `
+ query LinearAtomicWorkflowStatesList($filter: WorkflowStateFilter, $first: Int, $after: String) {
+ workflowStates(filter: $filter, first: $first, after: $after) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${WORKFLOW_STATE_SELECTION} }
+ }
+ }
+`;
+
+export const TEAMS_LIST_QUERY = `
+ query LinearAtomicTeamsList($first: Int, $after: String, $includeArchived: Boolean) {
+ teams(first: $first, after: $after, includeArchived: $includeArchived) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${TEAM_SELECTION} }
+ }
+ }
+`;
+
+export const TEAM_GET_QUERY = `
+ query LinearAtomicTeamGet($id: String!) {
+ team(id: $id) {
+ ${TEAM_SELECTION}
+ issueCount
+ defaultIssueState { id name type }
+ }
+ }
+`;
+
+export const TEAM_CREATE_MUTATION = `
+ mutation LinearAtomicTeamCreate($input: TeamCreateInput!) {
+ teamCreate(input: $input) {
+ success
+ team { ${TEAM_SELECTION} }
+ }
+ }
+`;
+
+export const TEAM_UPDATE_MUTATION = `
+ mutation LinearAtomicTeamUpdate($id: String!, $input: TeamUpdateInput!) {
+ teamUpdate(id: $id, input: $input) {
+ success
+ team { ${TEAM_SELECTION} }
+ }
+ }
+`;
+
+export const USERS_LIST_QUERY = `
+ query LinearAtomicUsersList($filter: UserFilter, $first: Int, $after: String, $includeDisabled: Boolean) {
+ users(filter: $filter, first: $first, after: $after, includeDisabled: $includeDisabled) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${USER_SELECTION} }
+ }
+ }
+`;
+
+export const VIEWER_GET_QUERY = `
+ query LinearAtomicViewerGet {
+ viewer {
+ ${USER_SELECTION}
+ organization { id name urlKey }
+ }
+ }
+`;
+
+export const CYCLES_LIST_QUERY = `
+ query LinearAtomicCyclesList($filter: CycleFilter, $first: Int, $after: String) {
+ cycles(filter: $filter, first: $first, after: $after) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${CYCLE_SELECTION} }
+ }
+ }
+`;
+
+export const COMMENT_CREATE_MUTATION = `
+ mutation LinearAtomicCommentCreate($input: CommentCreateInput!) {
+ commentCreate(input: $input) {
+ success
+ comment { ${COMMENT_SELECTION} }
+ }
+ }
+`;
+
+export const COMMENT_GET_QUERY = `
+ query LinearAtomicCommentGet($id: String!) {
+ comment(id: $id) { ${COMMENT_SELECTION} }
+ }
+`;
+
+export const COMMENTS_LIST_QUERY = `
+ query LinearAtomicCommentsList($filter: CommentFilter, $first: Int, $after: String) {
+ comments(filter: $filter, first: $first, after: $after) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${COMMENT_SELECTION} }
+ }
+ }
+`;
+
+export const COMMENT_UPDATE_MUTATION = `
+ mutation LinearAtomicCommentUpdate($id: String!, $input: CommentUpdateInput!) {
+ commentUpdate(id: $id, input: $input) {
+ success
+ comment { ${COMMENT_SELECTION} }
+ }
+ }
+`;
+
+export const COMMENT_RESOLVE_MUTATION = `
+ mutation LinearAtomicCommentResolve($id: String!, $resolvingCommentId: String) {
+ commentResolve(id: $id, resolvingCommentId: $resolvingCommentId) {
+ success
+ comment { ${COMMENT_SELECTION} }
+ }
+ }
+`;
+
+export const COMMENT_UNRESOLVE_MUTATION = `
+ mutation LinearAtomicCommentUnresolve($id: String!) {
+ commentUnresolve(id: $id) {
+ success
+ comment { ${COMMENT_SELECTION} }
+ }
+ }
+`;
+
+export const REACTION_CREATE_MUTATION = `
+ mutation LinearAtomicReactionCreate($input: ReactionCreateInput!) {
+ reactionCreate(input: $input) {
+ success
+ reaction {
+ id
+ emoji
+ createdAt
+ user { id name }
+ comment { id }
+ }
+ }
+ }
+`;
+
+export const REACTION_DELETE_MUTATION = `
+ mutation LinearAtomicReactionDelete($id: String!) {
+ reactionDelete(id: $id) {
+ success
+ entityId
+ }
+ }
+`;
+
+export const ATTACHMENT_GET_QUERY = `
+ query LinearAtomicAttachmentGet($id: String!) {
+ attachment(id: $id) { ${ATTACHMENT_SELECTION} }
+ }
+`;
+
+export const PROJECT_CREATE_MUTATION = `
+ mutation LinearAtomicProjectCreate($input: ProjectCreateInput!) {
+ projectCreate(input: $input) {
+ success
+ project { ${PROJECT_SELECTION} }
+ }
+ }
+`;
+
+export const PROJECT_UPDATE_MUTATION = `
+ mutation LinearAtomicProjectUpdate($id: String!, $input: ProjectUpdateInput!) {
+ projectUpdate(id: $id, input: $input) {
+ success
+ project { ${PROJECT_SELECTION} }
+ }
+ }
+`;
+
+export const PROJECTS_LIST_QUERY = `
+ query LinearAtomicProjectsList($filter: ProjectFilter, $first: Int, $after: String, $includeArchived: Boolean) {
+ projects(filter: $filter, first: $first, after: $after, includeArchived: $includeArchived) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${PROJECT_SELECTION} }
+ }
+ }
+`;
+
+export const PROJECT_GET_QUERY = `
+ query LinearAtomicProjectGet($id: String!) {
+ project(id: $id) {
+ ${PROJECT_SELECTION}
+ projectMilestones(first: 250) {
+ pageInfo { hasNextPage endCursor }
+ nodes { id name targetDate status }
+ }
+ }
+ }
+`;
+
+export const PROJECT_MILESTONES_PAGE_QUERY = `
+ query LinearAtomicProjectMilestonesPage($id: String!, $after: String) {
+ project(id: $id) {
+ id
+ projectMilestones(first: 250, after: $after) {
+ pageInfo { hasNextPage endCursor }
+ nodes { id name targetDate status }
+ }
+ }
+ }
+`;
+
+export const PROJECT_TEAMS_PAGE_QUERY = `
+ query LinearAtomicProjectTeamsPage($id: String!, $after: String) {
+ project(id: $id) {
+ teams(first: 250, after: $after) {
+ pageInfo { hasNextPage endCursor }
+ nodes { id key name }
+ }
+ }
+ }
+`;
+
+export const PROJECT_DELETE_MUTATION = `
+ mutation LinearAtomicProjectDelete($id: String!) {
+ projectDelete(id: $id) {
+ success
+ entity { id name url trashed archivedAt }
+ }
+ }
+`;
+
+export const PROJECT_UNARCHIVE_MUTATION = `
+ mutation LinearAtomicProjectUnarchive($id: String!) {
+ projectUnarchive(id: $id) {
+ success
+ entity { id name url trashed archivedAt }
+ }
+ }
+`;
+
+export const PROJECT_MILESTONE_CREATE_MUTATION = `
+ mutation LinearAtomicProjectMilestoneCreate($input: ProjectMilestoneCreateInput!) {
+ projectMilestoneCreate(input: $input) {
+ success
+ projectMilestone { ${MILESTONE_SELECTION} }
+ }
+ }
+`;
+
+export const PROJECT_STATUS_UPDATE_GET_QUERY = `
+ query LinearAtomicProjectStatusUpdateGet($id: String!) {
+ projectUpdate(id: $id) { ${PROJECT_STATUS_UPDATE_SELECTION} }
+ }
+`;
+
+export const PROJECT_STATUS_UPDATES_LIST_QUERY = `
+ query LinearAtomicProjectStatusUpdatesList($filter: ProjectUpdateFilter, $first: Int, $after: String, $includeArchived: Boolean) {
+ projectUpdates(filter: $filter, first: $first, after: $after, includeArchived: $includeArchived) {
+ pageInfo { hasNextPage endCursor }
+ nodes { ${PROJECT_STATUS_UPDATE_SELECTION} }
+ }
+ }
+`;
+
+export const PROJECT_STATUS_UPDATE_EDIT_MUTATION = `
+ mutation LinearAtomicProjectStatusUpdateEdit($id: String!, $input: ProjectUpdateUpdateInput!) {
+ projectUpdateUpdate(id: $id, input: $input) {
+ success
+ projectUpdate { ${PROJECT_STATUS_UPDATE_SELECTION} }
+ }
+ }
+`;
+
+export const PROJECT_STATUS_UPDATE_ARCHIVE_MUTATION = `
+ mutation LinearAtomicProjectStatusUpdateArchive($id: String!) {
+ projectUpdateArchive(id: $id) {
+ success
+ entity { ${PROJECT_STATUS_UPDATE_SELECTION} }
+ }
+ }
+`;
+
+export const PROJECT_STATUS_UPDATE_UNARCHIVE_MUTATION = `
+ mutation LinearAtomicProjectStatusUpdateUnarchive($id: String!) {
+ projectUpdateUnarchive(id: $id) {
+ success
+ entity { ${PROJECT_STATUS_UPDATE_SELECTION} }
+ }
+ }
+`;
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/reaction-delete.ts b/packages/pieces/community/linear/src/lib/actions/atomics/reaction-delete.ts
new file mode 100644
index 00000000000..8ea40d7f818
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/reaction-delete.ts
@@ -0,0 +1,30 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { REACTION_DELETE_MUTATION } from './queries';
+import { atomicReactionDeleteOutputSchema } from './output-schemas';
+
+export const linearReactionDeleteAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_reaction_delete',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Reaction (AI)',
+ description: 'Remove an emoji reaction by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes one emoji reaction from a Linear comment, identified by the reaction ID returned by React to Comment. Only the reaction is removed, never the comment. Not idempotent: a second call fails because the reaction is already gone.',
+ idempotent: false,
+ },
+ outputSchema: atomicReactionDeleteOutputSchema,
+ props: {
+ reaction_id: Property.ShortText({ displayName: 'Reaction ID', description: 'UUID of the reaction (from React to Comment).', required: true }),
+ },
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{
+ reactionDelete: { success: boolean; entityId: string };
+ }>({ auth, query: REACTION_DELETE_MUTATION, variables: { id: propsValue.reaction_id.trim() } });
+ const payload = linearGraphql.requireSuccess({ payload: data.reactionDelete, what: 'reaction removal' });
+ return { success: true, deleted_id: payload.entityId };
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/team-create.ts b/packages/pieces/community/linear/src/lib/actions/atomics/team-create.ts
new file mode 100644
index 00000000000..d0d489f233d
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/team-create.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, atomicProps, LinearTeamNode } from './common';
+import { TEAM_CREATE_MUTATION } from './queries';
+import { atomicTeamOutputSchema } from './output-schemas';
+
+export const linearTeamCreateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_team_create',
+ classification: 'WRITE',
+ displayName: 'Create Team (AI)',
+ description: 'Create a new team with a name and, optionally, its key, description, icon, color, timezone, cycles and triage.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a new Linear team, which gets its own issue key, workflow statuses and settings. Only create a team when asked: check List Teams first, since a team with the same name or key may already exist. The key (1 to 7 letters or digits) prefixes every issue identifier of the team; Linear derives one from the name when it is left empty. May need an admin key, and the Free plan allows only 2 teams. Not idempotent: each call adds a team.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({ displayName: 'Name', description: 'Team name, for example "Platform".', required: true }),
+ key: Property.ShortText({ displayName: 'Key', description: 'Issue key, for example PLT. Leave empty to let Linear derive one from the name.', required: false }),
+ description: Property.ShortText({ displayName: 'Description', required: false }),
+ icon: Property.ShortText({ displayName: 'Icon', required: false }),
+ color: Property.ShortText({ displayName: 'Color', description: 'Hex color, for example #5E6AD2.', required: false }),
+ timezone: Property.ShortText({ displayName: 'Timezone', description: 'IANA timezone, for example Europe/Berlin.', required: false }),
+ cycles_enabled: atomicProps.triStateProp({ displayName: 'Cycles', description: 'Turn cycles on or off. Leave empty for the Linear default.' }),
+ triage_enabled: atomicProps.triStateProp({ displayName: 'Triage', description: 'Turn triage on or off. Leave empty for the Linear default.' }),
+ },
+ outputSchema: atomicTeamOutputSchema,
+ async run({ auth, propsValue }) {
+ const name = propsValue.name.trim();
+ if (!name) {
+ throw new Error('Name is required.');
+ }
+ const key = propsValue.key?.trim();
+ if (key && !/^[A-Za-z0-9]{1,7}$/.test(key)) {
+ throw new Error('Key must be 1 to 7 letters or digits, for example PLT.');
+ }
+ const cyclesEnabled = atomicProps.triStateValue(propsValue.cycles_enabled);
+ const triageEnabled = atomicProps.triStateValue(propsValue.triage_enabled);
+ const input = {
+ ...linearGraphql.definedOnly({
+ name,
+ key: key?.toUpperCase(),
+ description: propsValue.description,
+ icon: propsValue.icon,
+ color: propsValue.color,
+ timezone: propsValue.timezone,
+ }),
+ ...(cyclesEnabled === undefined ? {} : { cyclesEnabled }),
+ ...(triageEnabled === undefined ? {} : { triageEnabled }),
+ };
+ const data = await linearGraphql.request<{
+ teamCreate: { success: boolean; team: LinearTeamNode | null };
+ }>({ auth, query: TEAM_CREATE_MUTATION, variables: { input } });
+ const payload = linearGraphql.requireSuccess({ payload: data.teamCreate, what: 'team creation' });
+ if (!payload.team) {
+ throw new Error('Linear did not return the new team.');
+ }
+ return atomicMappers.flattenTeam(payload.team);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/team-get.ts b/packages/pieces/community/linear/src/lib/actions/atomics/team-get.ts
new file mode 100644
index 00000000000..fd9250d3c87
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/team-get.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearTeamNode } from './common';
+import { TEAM_GET_QUERY } from './queries';
+import { atomicTeamDetailsOutputSchema } from './output-schemas';
+
+export const linearTeamGetAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_team_get',
+ classification: 'READ',
+ displayName: 'Get Team (AI)',
+ description: 'Get one team with its issue defaults (default status, estimate, triage, cycles).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one Linear team by ID with the defaults new issues get: default status, default estimate and estimation scale, and whether triage and cycles are on, plus its issue count. Use before creating issues to learn what a team expects, or to check if it has cycles. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'UUID of the team. Get it from List Teams.', required: true }),
+ },
+ outputSchema: atomicTeamDetailsOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{ team: LinearTeamNode | null }>({
+ auth,
+ query: TEAM_GET_QUERY,
+ variables: { id: propsValue.team_id.trim() },
+ });
+ if (!data.team) {
+ throw new Error(`No Linear team found for ${propsValue.team_id}.`);
+ }
+ return atomicMappers.flattenTeamDetails(data.team);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/team-update.ts b/packages/pieces/community/linear/src/lib/actions/atomics/team-update.ts
new file mode 100644
index 00000000000..79f40308b0f
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/team-update.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, atomicProps, LinearTeamNode } from './common';
+import { TEAM_UPDATE_MUTATION } from './queries';
+import { atomicTeamOutputSchema } from './output-schemas';
+
+export const linearTeamUpdateAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_team_update',
+ classification: 'WRITE',
+ displayName: 'Update Team (AI)',
+ description: 'Change only the team settings you pass (name, key, description, icon, color, timezone, cycles, triage).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Partially updates a Linear team: only the settings you pass change (name, key, description, icon, color, timezone, cycles and triage on or off). Changing the key changes every issue identifier of the team, so only do it when asked. May need an admin key. Idempotent: repeating the same update leaves the team in the same state.',
+ idempotent: true,
+ },
+ props: {
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'UUID of the team. Get it from List Teams.', required: true }),
+ name: Property.ShortText({ displayName: 'Name', required: false }),
+ key: Property.ShortText({ displayName: 'Key', description: 'New issue key, for example PLT. Renames every issue identifier of the team.', required: false }),
+ description: Property.ShortText({ displayName: 'Description', required: false }),
+ icon: Property.ShortText({ displayName: 'Icon', required: false }),
+ color: Property.ShortText({ displayName: 'Color', description: 'Hex color, for example #5E6AD2.', required: false }),
+ timezone: Property.ShortText({ displayName: 'Timezone', description: 'IANA timezone, for example Europe/Berlin.', required: false }),
+ cycles_enabled: atomicProps.triStateProp({ displayName: 'Cycles', description: 'Turn cycles on or off. Leave empty to keep the current setting.' }),
+ triage_enabled: atomicProps.triStateProp({ displayName: 'Triage', description: 'Turn triage on or off. Leave empty to keep the current setting.' }),
+ },
+ outputSchema: atomicTeamOutputSchema,
+ async run({ auth, propsValue }) {
+ const key = propsValue.key?.trim();
+ if (key && !/^[A-Za-z0-9]{1,7}$/.test(key)) {
+ throw new Error('Key must be 1 to 7 letters or digits, for example PLT.');
+ }
+ const cyclesEnabled = atomicProps.triStateValue(propsValue.cycles_enabled);
+ const triageEnabled = atomicProps.triStateValue(propsValue.triage_enabled);
+ const input = {
+ ...linearGraphql.definedOnly({
+ name: propsValue.name,
+ key: key?.toUpperCase(),
+ description: propsValue.description,
+ icon: propsValue.icon,
+ color: propsValue.color,
+ timezone: propsValue.timezone,
+ }),
+ ...(cyclesEnabled === undefined ? {} : { cyclesEnabled }),
+ ...(triageEnabled === undefined ? {} : { triageEnabled }),
+ };
+ if (Object.keys(input).length === 0) {
+ throw new Error('Nothing to update: pass at least one setting to change.');
+ }
+ const data = await linearGraphql.request<{
+ teamUpdate: { success: boolean; team: LinearTeamNode | null };
+ }>({ auth, query: TEAM_UPDATE_MUTATION, variables: { id: propsValue.team_id.trim(), input } });
+ const payload = linearGraphql.requireSuccess({ payload: data.teamUpdate, what: 'team update' });
+ if (!payload.team) {
+ throw new Error('Linear did not return the updated team.');
+ }
+ return atomicMappers.flattenTeam(payload.team);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/teams-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/teams-list.ts
new file mode 100644
index 00000000000..ba4106b687d
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/teams-list.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, linearMappers } from '../../common/mappers';
+import { atomicMappers, atomicProps, LinearTeamNode } from './common';
+import { TEAMS_LIST_QUERY } from './queries';
+import { atomicTeamsPageOutputSchema } from './output-schemas';
+
+export const linearTeamsListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_teams_list',
+ classification: 'SEARCH',
+ displayName: 'List Teams (AI)',
+ description: 'List the teams the connected user can access, with IDs and keys.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the Linear teams the API key can access, with ID, key (the ENG in ENG-123) and settings such as cycles and triage. This is the first call to resolve a team name or key to the Team ID that most other actions need. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ include_archived: Property.Checkbox({ displayName: 'Include Archived Teams', required: false, defaultValue: false }),
+ limit: atomicProps.limitProp({ fallback: 100, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicTeamsPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const data = await linearGraphql.request<{ teams: LinearConnection<LinearTeamNode> }>({
+ auth,
+ query: TEAMS_LIST_QUERY,
+ variables: {
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 100, max: 250 }),
+ after: propsValue.cursor || undefined,
+ includeArchived: propsValue.include_archived === true,
+ },
+ });
+ return linearMappers.toPage({ connection: data.teams, map: atomicMappers.flattenTeam });
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/upload-download.test.ts b/packages/pieces/community/linear/src/lib/actions/atomics/upload-download.test.ts
new file mode 100644
index 00000000000..f24880a09b2
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/upload-download.test.ts
@@ -0,0 +1,239 @@
+/// <reference types="vitest/globals" />
+
+import { Readable } from 'stream';
+import { vi } from 'vitest';
+import { httpClient, HttpRequest } from '@activepieces/pieces-common';
+import { createMockActionContext } from '@activepieces/pieces-framework';
+
+vi.mock('@linear/sdk', () => ({
+ LinearClient: class {
+ client = { rawRequest: vi.fn() };
+ },
+ LinearDocument: {},
+}));
+
+import '../../../index';
+import { linearUploadDownloadAtomic } from './upload-download';
+
+const URL_IN = 'https://uploads.linear.app/org/file/abc';
+const KEY = 'lin_api_test';
+
+function chunks({ count, size }: { count: number; size: number }): Readable {
+ const block = Buffer.alloc(size, 1);
+ return Readable.from((function* () {
+ for (let i = 0; i < count; i++) yield block;
+ })());
+}
+
+function reply({ status = 200, headers = {}, body = chunks({ count: 1, size: 4 }) }: ReplyParams) {
+ return { status, headers: { 'content-type': 'image/png', ...headers }, body };
+}
+
+function queue(replies: Array<ReturnType<typeof reply>>) {
+ const spy = vi.spyOn(httpClient, 'sendRequest');
+ for (const next of replies) {
+ spy.mockImplementationOnce(async (_request: HttpRequest) => next);
+ }
+ return spy;
+}
+
+async function drain(stream: Readable): Promise<Buffer> {
+ const parts: Buffer[] = [];
+ for await (const chunk of stream) {
+ parts.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
+ }
+ return Buffer.concat(parts);
+}
+
+async function download(write: WriteFn = async ({ data }) => {
+ if (!(data instanceof Readable)) throw new Error('expected a stream');
+ await drain(data);
+ return 'file://x';
+}) {
+ const received: Array<Buffer | Readable> = [];
+ const out = await linearUploadDownloadAtomic.run({
+ ...createMockActionContext({ propsValue: { url: URL_IN } }),
+ auth: { type: 'SECRET_TEXT', secret_text: KEY },
+ files: {
+ write: async (params: { fileName: string; data: Buffer | Readable }) => {
+ received.push(params.data);
+ return write(params);
+ },
+ },
+ });
+ return { out, received };
+}
+
+describe('linear_upload_download', () => {
+ afterEach(() => vi.restoreAllMocks());
+
+ test('passes a stream to files.write, counts the bytes and sends the key to uploads.linear.app', async () => {
+ const spy = queue([reply({ body: chunks({ count: 3, size: 1024 }) })]);
+ const { out, received } = await download();
+ expect(received[0]).toBeInstanceOf(Readable);
+ expect(out).toMatchObject({ file_name: 'abc.png', mime_type: 'image/png', size_bytes: 3072 });
+ expect(spy.mock.calls[0][0]).toMatchObject({
+ url: URL_IN,
+ responseType: 'stream',
+ followRedirects: false,
+ headers: { Authorization: KEY },
+ });
+ });
+
+ test('has no own size cap: a file larger than 100 MB is handed to files.write', async () => {
+ queue([reply({ headers: { 'content-length': String(150 * 1024 * 1024) }, body: chunks({ count: 150, size: 1024 * 1024 }) })]);
+ const { out } = await download();
+ expect(out.size_bytes).toBe(150 * 1024 * 1024);
+ });
+
+ test('follows a redirect to storage.googleapis.com without the API key', async () => {
+ const first = chunks({ count: 1, size: 1 });
+ const destroyFirst = vi.spyOn(first, 'destroy');
+ const spy = queue([
+ reply({ status: 302, headers: { location: 'https://storage.googleapis.com/bucket/abc?sig=1' }, body: first }),
+ reply({ body: chunks({ count: 2, size: 10 }) }),
+ ]);
+ const { out } = await download();
+ expect(out.size_bytes).toBe(20);
+ expect(destroyFirst).toHaveBeenCalled();
+ expect(spy).toHaveBeenCalledTimes(2);
+ expect(spy.mock.calls[1][0].url).toBe('https://storage.googleapis.com/bucket/abc?sig=1');
+ expect(spy.mock.calls[1][0].headers).toEqual({});
+ });
+
+ test.each([
+ 'https://evil.example.com/file',
+ 'https://internal.service.local/secret',
+ 'http://storage.googleapis.com/bucket/abc',
+ 'https://storage.googleapis.com:8443/bucket/abc',
+ 'https://user:[email protected]/bucket/abc',
+ 'https://uploads.linear.app.evil.com/abc',
+ ])('refuses a redirect to %s before requesting it', async (location) => {
+ const first = chunks({ count: 1, size: 1 });
+ const destroyFirst = vi.spyOn(first, 'destroy');
+ const spy = queue([reply({ status: 302, headers: { location }, body: first })]);
+ await expect(download()).rejects.toThrow('not a Linear file host');
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(destroyFirst).toHaveBeenCalled();
+ });
+
+ test('destroys the stream when a redirect has no location', async () => {
+ const body = chunks({ count: 1, size: 1 });
+ const destroy = vi.spyOn(body, 'destroy');
+ queue([reply({ status: 302, body })]);
+ await expect(download()).rejects.toThrow('no location');
+ expect(destroy).toHaveBeenCalled();
+ });
+
+ test('destroys every stream when there are too many redirects', async () => {
+ const bodies = Array.from({ length: 4 }, () => chunks({ count: 1, size: 1 }));
+ const destroys = bodies.map((body) => vi.spyOn(body, 'destroy'));
+ queue(bodies.map((body) => reply({ status: 302, headers: { location: URL_IN }, body })));
+ await expect(download()).rejects.toThrow('Too many redirects');
+ for (const destroy of destroys) {
+ expect(destroy).toHaveBeenCalled();
+ }
+ });
+
+ test('destroys the source stream when files.write rejects the file part way', async () => {
+ const body = chunks({ count: 50, size: 1024 });
+ const destroy = vi.spyOn(body, 'destroy');
+ queue([reply({ body })]);
+ await expect(
+ download(async ({ data }) => {
+ if (!(data instanceof Readable)) throw new Error('expected a stream');
+ let total = 0;
+ for await (const chunk of data) {
+ total += Buffer.from(chunk).length;
+ if (total > 4096) throw new Error('File size is larger than maximum supported size');
+ }
+ return 'file://x';
+ }),
+ ).rejects.toThrow('maximum supported size');
+ await new Promise((resolve) => setImmediate(resolve));
+ expect(destroy).toHaveBeenCalled();
+ });
+
+ test('destroys the source stream when files.write fails before reading', async () => {
+ const body = chunks({ count: 1, size: 10 });
+ const destroy = vi.spyOn(body, 'destroy');
+ queue([reply({ body })]);
+ await expect(
+ download(async () => {
+ throw new Error('upload failed');
+ }),
+ ).rejects.toThrow('upload failed');
+ await new Promise((resolve) => setImmediate(resolve));
+ expect(destroy).toHaveBeenCalled();
+ });
+
+ test('fails when no chunk arrives for 60 seconds, and destroys the source', async () => {
+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
+ try {
+ const body = new Readable({ read() {} });
+ const destroy = vi.spyOn(body, 'destroy');
+ body.push(Buffer.alloc(8, 1));
+ queue([reply({ body })]);
+ const pending = download();
+ const settled = pending.then(
+ () => 'resolved',
+ (error: unknown) => (error instanceof Error ? error.message : String(error)),
+ );
+ await vi.advanceTimersByTimeAsync(59_000);
+ body.push(Buffer.alloc(8, 1));
+ await vi.advanceTimersByTimeAsync(59_000);
+ expect(destroy).not.toHaveBeenCalled();
+ await vi.advanceTimersByTimeAsync(1_000);
+ expect(await settled).toBe('The download stalled for 60 seconds.');
+ expect(destroy).toHaveBeenCalled();
+ expect(vi.getTimerCount()).toBe(0);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ test('clears the idle timer when the download ends', async () => {
+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
+ try {
+ queue([reply({ body: chunks({ count: 3, size: 16 }) })]);
+ const { out } = await download();
+ expect(out.size_bytes).toBe(48);
+ expect(vi.getTimerCount()).toBe(0);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ test('clears the idle timer when the source fails', async () => {
+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
+ try {
+ const body = new Readable({ read() {} });
+ queue([reply({ body })]);
+ const pending = download();
+ body.destroy(new Error('socket hang up'));
+ await expect(pending).rejects.toThrow('socket hang up');
+ expect(vi.getTimerCount()).toBe(0);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ test('refuses a link that is not on uploads.linear.app before any request', async () => {
+ const spy = vi.spyOn(httpClient, 'sendRequest');
+ await expect(
+ linearUploadDownloadAtomic.run({
+ ...createMockActionContext({ propsValue: { url: 'https://storage.googleapis.com/bucket/abc' } }),
+ auth: { type: 'SECRET_TEXT', secret_text: KEY },
+ }),
+ ).rejects.toThrow('Only https://uploads.linear.app');
+ expect(spy).not.toHaveBeenCalled();
+ });
+});
+
+type ReplyParams = {
+ status?: number;
+ headers?: Record<string, string>;
+ body?: Readable;
+};
+
+type WriteFn = (params: { fileName: string; data: Buffer | Readable }) => Promise<string>;
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/upload-download.ts b/packages/pieces/community/linear/src/lib/actions/atomics/upload-download.ts
new file mode 100644
index 00000000000..a4a9eb762d1
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/upload-download.ts
@@ -0,0 +1,197 @@
+import { pipeline, Readable, Transform } from 'stream';
+import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { atomicUploadDownloadOutputSchema } from './output-schemas';
+
+export const linearUploadDownloadAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_upload_download',
+ classification: 'READ',
+ displayName: 'Download Linear Upload (AI)',
+ description: 'Download a file uploaded to Linear (an uploads.linear.app link from an issue or comment).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Downloads a private file uploaded to Linear, such as an image or log embedded in an issue description or comment, from its https://uploads.linear.app/... link and returns it as a flow file. Only uploads.linear.app links are accepted, because the API key is sent with the request, and redirects are followed only to Linear file hosts. The file size limit of this Activepieces deployment applies. Read-only and idempotent: the same link returns the same file.',
+ idempotent: true,
+ },
+ props: {
+ url: Property.ShortText({
+ displayName: 'Upload URL',
+ description: 'The https://uploads.linear.app/... link, copied from the markdown of an issue or comment.',
+ required: true,
+ }),
+ file_name: Property.ShortText({
+ displayName: 'File Name',
+ description: 'Name for the saved file. Leave empty to use the last part of the link.',
+ required: false,
+ }),
+ },
+ outputSchema: atomicUploadDownloadOutputSchema,
+ async run({ auth, propsValue, files }) {
+ const url = assertLinearUploadUrl(propsValue.url);
+ const response = await openDownload({ url, apiKey: auth.secret_text });
+ const fileName = (propsValue.file_name?.trim() || defaultFileName({ url, mimeType: response.mimeType })).slice(0, 200);
+ const counted = countBytes(response.body);
+ const file = await files.write({ fileName, data: counted.stream }).catch((error: unknown) => {
+ counted.stream.destroy();
+ throw error;
+ });
+ return {
+ file,
+ file_name: fileName,
+ mime_type: response.mimeType,
+ size_bytes: counted.total(),
+ };
+ },
+});
+
+export function assertLinearUploadUrl(raw: string): URL {
+ let parsed: URL;
+ try {
+ parsed = new URL(raw.trim());
+ } catch {
+ throw new Error('Upload URL must be a full https://uploads.linear.app/... link.');
+ }
+ if (!isSafeHttpsUrl({ url: parsed }) || parsed.hostname !== LINEAR_UPLOAD_HOST) {
+ throw new Error('Only https://uploads.linear.app/... links can be downloaded, because the Linear API key is sent with the request.');
+ }
+ return parsed;
+}
+
+function isSafeHttpsUrl({ url }: { url: URL }): boolean {
+ return url.protocol === 'https:' && !url.username && !url.password && !url.port;
+}
+
+function assertAllowedDownloadUrl({ url }: { url: URL }): void {
+ if (!isSafeHttpsUrl({ url }) || !ALLOWED_DOWNLOAD_HOSTS.includes(url.hostname)) {
+ throw new Error(`Linear redirected the download to ${url.host || 'an unexpected address'}, which is not a Linear file host, so it was stopped.`);
+ }
+}
+
+async function openDownload({ url, apiKey }: { url: URL; apiKey: string }): Promise<OpenedDownload> {
+ let current = url;
+ for (let hop = 0; hop <= MAX_REDIRECTS; hop++) {
+ assertAllowedDownloadUrl({ url: current });
+ const sendKey = current.hostname === LINEAR_UPLOAD_HOST;
+ const response = await httpClient.sendRequest<Readable | Buffer | undefined>({
+ method: HttpMethod.GET,
+ url: current.toString(),
+ headers: sendKey ? { Authorization: apiKey } : {},
+ responseType: 'stream',
+ followRedirects: false,
+ timeout: DOWNLOAD_TIMEOUT_MS,
+ });
+ const body = toReadable(response.body);
+ if (response.status >= 300 && response.status < 400) {
+ body.destroy();
+ const location = response.headers?.['location'];
+ if (typeof location !== 'string' || location.length === 0) {
+ throw new Error(`Linear answered with a redirect (${response.status}) but no location.`);
+ }
+ current = parseRedirect({ location, base: current });
+ continue;
+ }
+ const contentType = response.headers?.['content-type'];
+ return { body, mimeType: typeof contentType === 'string' ? contentType : null };
+ }
+ throw new Error('Too many redirects while downloading the Linear upload.');
+}
+
+function parseRedirect({ location, base }: { location: string; base: URL }): URL {
+ try {
+ return new URL(location, base);
+ } catch {
+ throw new Error('Linear answered with a redirect to an address that is not a valid link.');
+ }
+}
+
+function toReadable(body: Readable | Buffer | undefined): Readable {
+ if (body === undefined) return Readable.from([]);
+ if (Buffer.isBuffer(body)) return Readable.from([body]);
+ return body;
+}
+
+function countBytes(body: Readable): { stream: Readable; total: () => number } {
+ let total = 0;
+ let idleTimer: NodeJS.Timeout | undefined;
+ const clearIdleTimer = () => {
+ if (idleTimer !== undefined) {
+ clearTimeout(idleTimer);
+ idleTimer = undefined;
+ }
+ };
+ const counter = new Transform({
+ transform(chunk: unknown, _encoding, callback) {
+ armIdleTimer();
+ const bytes = toBuffer(chunk);
+ total += bytes.length;
+ callback(null, bytes);
+ },
+ flush(callback) {
+ clearIdleTimer();
+ callback();
+ },
+ destroy(error, callback) {
+ clearIdleTimer();
+ callback(error);
+ },
+ });
+ const armIdleTimer = () => {
+ clearIdleTimer();
+ idleTimer = setTimeout(() => counter.destroy(new Error(STALLED_MESSAGE)), DOWNLOAD_IDLE_TIMEOUT_MS);
+ };
+ armIdleTimer();
+ const stream = pipeline(body, counter, () => clearIdleTimer());
+ return { stream, total: () => total };
+}
+
+function toBuffer(chunk: unknown): Buffer {
+ if (Buffer.isBuffer(chunk)) return chunk;
+ if (chunk instanceof Uint8Array) return Buffer.from(chunk);
+ return Buffer.from(String(chunk));
+}
+
+function safeDecode(value: string): string {
+ try {
+ return decodeURIComponent(value);
+ } catch {
+ return value;
+ }
+}
+
+function defaultFileName({ url, mimeType }: { url: URL; mimeType: string | null }): string {
+ const last = url.pathname.split('/').filter((part) => part.length > 0).pop();
+ const name = safeDecode(last ?? 'linear-upload');
+ if (name.includes('.')) return name;
+ const extension = mimeType ? EXTENSION_BY_MIME[mimeType.split(';')[0].trim().toLowerCase()] : undefined;
+ return extension ? `${name}.${extension}` : name;
+}
+
+const EXTENSION_BY_MIME: Record<string, string> = {
+ 'image/png': 'png',
+ 'image/jpeg': 'jpg',
+ 'image/gif': 'gif',
+ 'image/webp': 'webp',
+ 'image/svg+xml': 'svg',
+ 'application/pdf': 'pdf',
+ 'application/zip': 'zip',
+ 'application/json': 'json',
+ 'text/plain': 'txt',
+ 'text/csv': 'csv',
+ 'video/mp4': 'mp4',
+ 'video/quicktime': 'mov',
+};
+
+const LINEAR_UPLOAD_HOST = 'uploads.linear.app';
+const ALLOWED_DOWNLOAD_HOSTS = [LINEAR_UPLOAD_HOST, 'storage.googleapis.com'];
+const MAX_REDIRECTS = 3;
+const DOWNLOAD_TIMEOUT_MS = 60_000;
+const DOWNLOAD_IDLE_TIMEOUT_MS = 60_000;
+const STALLED_MESSAGE = 'The download stalled for 60 seconds.';
+
+type OpenedDownload = {
+ body: Readable;
+ mimeType: string | null;
+};
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/users-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/users-list.ts
new file mode 100644
index 00000000000..9dd337bc0a5
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/users-list.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, linearMappers } from '../../common/mappers';
+import { atomicMappers, atomicProps, LinearUserNode } from './common';
+import { USERS_LIST_QUERY } from './queries';
+import { atomicUsersPageOutputSchema } from './output-schemas';
+
+export const linearUsersListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_users_list',
+ classification: 'SEARCH',
+ displayName: 'List Users (AI)',
+ description: 'List workspace members, optionally find one by email or name.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists members of the Linear workspace with ID, name, email and role flags, optionally matching an exact email (case-insensitive) or a name fragment. Use to turn a person\'s email or name into the Assignee ID other actions need; use Get Current User for the key owner. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ email: Property.ShortText({ displayName: 'Email', description: 'Exact email address to look up, for example [email protected].', required: false }),
+ name_contains: Property.ShortText({ displayName: 'Name Contains', description: 'Only users whose name contains this text (case-insensitive).', required: false }),
+ include_disabled: Property.Checkbox({ displayName: 'Include Deactivated Users', required: false, defaultValue: false }),
+ limit: atomicProps.limitProp({ fallback: 100, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicUsersPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const email = propsValue.email?.trim();
+ const nameContains = propsValue.name_contains?.trim();
+ const filter = linearGraphql.definedOnly({
+ email: email ? { eqIgnoreCase: email } : undefined,
+ name: nameContains ? { containsIgnoreCase: nameContains } : undefined,
+ });
+ const data = await linearGraphql.request<{ users: LinearConnection<LinearUserNode> }>({
+ auth,
+ query: USERS_LIST_QUERY,
+ variables: {
+ filter: Object.keys(filter).length > 0 ? filter : undefined,
+ includeDisabled: propsValue.include_disabled === true,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 100, max: 250 }),
+ after: propsValue.cursor || undefined,
+ },
+ });
+ return linearMappers.toPage({ connection: data.users, map: atomicMappers.flattenUser });
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/viewer-get.ts b/packages/pieces/community/linear/src/lib/actions/atomics/viewer-get.ts
new file mode 100644
index 00000000000..08145a0edd3
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/viewer-get.ts
@@ -0,0 +1,26 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { atomicMappers, LinearUserNode } from './common';
+import { VIEWER_GET_QUERY } from './queries';
+import { atomicViewerOutputSchema } from './output-schemas';
+
+export const linearViewerGetAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_viewer_get',
+ classification: 'READ',
+ displayName: 'Get Current User (AI)',
+ description: 'Get the user who owns the API key, and the workspace.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the Linear user who owns the connection\'s API key (ID, name, email, admin flag) and the workspace it belongs to. Use to assign something to "me", to check whether the key is an admin key before webhook or team actions, or to confirm the connection works. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {},
+ outputSchema: atomicViewerOutputSchema,
+ async run({ auth }) {
+ const data = await linearGraphql.request<{ viewer: LinearUserNode }>({ auth, query: VIEWER_GET_QUERY });
+ return atomicMappers.flattenViewer(data.viewer);
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/atomics/workflow-states-list.ts b/packages/pieces/community/linear/src/lib/actions/atomics/workflow-states-list.ts
new file mode 100644
index 00000000000..4db911b65db
--- /dev/null
+++ b/packages/pieces/community/linear/src/lib/actions/atomics/workflow-states-list.ts
@@ -0,0 +1,40 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { linearAuth } from '../../..';
+import { linearGraphql } from '../../common/graphql';
+import { LinearConnection, linearMappers } from '../../common/mappers';
+import { atomicMappers, atomicProps, LinearWorkflowStateNode } from './common';
+import { WORKFLOW_STATES_LIST_QUERY } from './queries';
+import { atomicWorkflowStatesPageOutputSchema } from './output-schemas';
+
+export const linearWorkflowStatesListAtomic = createAction({
+ auth: linearAuth,
+ name: 'linear_workflow_states_list',
+ classification: 'SEARCH',
+ displayName: 'List Workflow States (AI)',
+ description: 'List the issue statuses (Backlog, Todo, In Progress, Done...) of a team.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists issue workflow states (statuses such as Backlog, Todo, In Progress, Done, Canceled) with IDs and type, for one team or all teams. Statuses belong to a team, so filter by the issue\'s team to get a valid Status ID for Create Issue or Update Issue. Read-only and idempotent.',
+ idempotent: true,
+ },
+ props: {
+ team_id: Property.ShortText({ displayName: 'Team ID', description: 'UUID of the team (from List Teams). Leave empty for every team.', required: false }),
+ limit: atomicProps.limitProp({ fallback: 100, max: 250 }),
+ cursor: atomicProps.cursorProp(),
+ },
+ outputSchema: atomicWorkflowStatesPageOutputSchema,
+ async run({ auth, propsValue }) {
+ const team = atomicProps.idFilter(propsValue.team_id?.trim());
+ const data = await linearGraphql.request<{ workflowStates: LinearConnection<LinearWorkflowStateNode> }>({
+ auth,
+ query: WORKFLOW_STATES_LIST_QUERY,
+ variables: {
+ filter: team ? { team } : undefined,
+ first: linearGraphql.clampLimit({ value: propsValue.limit, fallback: 100, max: 250 }),
+ after: propsValue.cursor || undefined,
+ },
+ });
+ return linearMappers.toPage({ connection: data.workflowStates, map: atomicMappers.flattenWorkflowState });
+ },
+});
diff --git a/packages/pieces/community/linear/src/lib/actions/attachments/attach-link.ts b/packages/pieces/community/linear/src/lib/actions/attachments/attach-link.ts
index 5e68f4ba275..622ed57c756 100644
--- a/packages/pieces/community/linear/src/lib/actions/attachments/attach-link.ts
+++ b/packages/pieces/community/linear/src/lib/actions/attachments/attach-link.ts
@@ -12,7 +12,7 @@ export const linearAttachLink = createAction({
classification: 'WRITE',
displayName: 'Attach Link to Issue',
description: 'Link a URL to an issue. Attaching it again updates that link.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Attaches an external link (support ticket, pull request, document, dashboard) to a Linear issue, shown in the issue sidebar with a title and optional subtitle. Use to connect records in other tools to an issue; use Create Comment to post text instead. Idempotent: Linear updates the existing attachment when the same URL is attached to the same issue again.',
diff --git a/packages/pieces/community/linear/src/lib/actions/comments/create-comment.ts b/packages/pieces/community/linear/src/lib/actions/comments/create-comment.ts
index a228336db4a..15abadf7170 100644
--- a/packages/pieces/community/linear/src/lib/actions/comments/create-comment.ts
+++ b/packages/pieces/community/linear/src/lib/actions/comments/create-comment.ts
@@ -11,7 +11,7 @@ export const linearCreateComment = createAction({
classification: 'WRITE',
displayName: 'Create Comment',
description: 'Post a comment on an issue.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description: 'Posts a new comment on a Linear issue identified by its issue ID. Use to add a note, reply, or status update to an existing issue. Requires the issue ID and comment body; not idempotent, each call appends a new comment.',
idempotent: false,
diff --git a/packages/pieces/community/linear/src/lib/actions/issues/add-label-to-issue.ts b/packages/pieces/community/linear/src/lib/actions/issues/add-label-to-issue.ts
index 2b0aafc3d99..fd9f2c1cd46 100644
--- a/packages/pieces/community/linear/src/lib/actions/issues/add-label-to-issue.ts
+++ b/packages/pieces/community/linear/src/lib/actions/issues/add-label-to-issue.ts
@@ -12,7 +12,7 @@ export const linearAddLabelToIssue = createAction({
classification: 'WRITE',
displayName: 'Add Label to Issue',
description: 'Add one label to an issue and keep its other labels',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Adds one label to a Linear issue and keeps every label it already has. Use instead of Update Issue, whose Labels field replaces the whole label set. Needs the issue and the label ID (team or workspace label). Idempotent: adding a label the issue already has changes nothing. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
diff --git a/packages/pieces/community/linear/src/lib/actions/issues/create-issue.ts b/packages/pieces/community/linear/src/lib/actions/issues/create-issue.ts
index d1188e38365..0c91f9f00ba 100644
--- a/packages/pieces/community/linear/src/lib/actions/issues/create-issue.ts
+++ b/packages/pieces/community/linear/src/lib/actions/issues/create-issue.ts
@@ -12,7 +12,7 @@ export const linearCreateIssue = createAction({
classification: 'WRITE',
displayName: 'Create Issue',
description: 'Create an issue in a Linear team.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description: 'Creates a new issue in a Linear team, with optional assignee, status, labels, priority, template, project, cycle, parent issue (its identifier such as ENG-123, its ID, or its exact title), due date (YYYY-MM-DD) and estimate (points). Use to file a task, bug, or work item. Requires a team ID and title; not idempotent, each call creates a distinct issue.',
idempotent: false,
diff --git a/packages/pieces/community/linear/src/lib/actions/issues/delete-issue.ts b/packages/pieces/community/linear/src/lib/actions/issues/delete-issue.ts
index 25a364b1d7c..ea7511e0a2d 100644
--- a/packages/pieces/community/linear/src/lib/actions/issues/delete-issue.ts
+++ b/packages/pieces/community/linear/src/lib/actions/issues/delete-issue.ts
@@ -12,7 +12,7 @@ export const linearDeleteIssue = createAction({
classification: 'DESTRUCTIVE',
displayName: 'Delete Issue',
description: 'Move an issue to the trash. Linear keeps it for 30 days, so it can be restored.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Moves a Linear issue to the trash, where Linear keeps it for 30 days before deleting it for good; it is never deleted permanently by this action. Use for cleanup or de-duplication flows; to hide a finished issue without deleting it, archive it instead. Not idempotent: a second call on the same issue may fail because it is already in the trash.',
diff --git a/packages/pieces/community/linear/src/lib/actions/issues/get-issue.ts b/packages/pieces/community/linear/src/lib/actions/issues/get-issue.ts
index 535ed4b6b2a..45ed197ca50 100644
--- a/packages/pieces/community/linear/src/lib/actions/issues/get-issue.ts
+++ b/packages/pieces/community/linear/src/lib/actions/issues/get-issue.ts
@@ -12,7 +12,7 @@ export const linearGetIssue = createAction({
classification: 'READ',
displayName: 'Get Issue',
description: 'Get an issue by its key, such as ENG-123, or its ID.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Fetches one Linear issue by its UUID or its human identifier such as ENG-123, returning status, team, assignee, project, cycle, parent and labels. Use when a flow already holds an issue reference (from Slack, email or GitHub) and needs its current details; use Search Issues to find issues by text. Read-only and idempotent. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
diff --git a/packages/pieces/community/linear/src/lib/actions/issues/remove-label-from-issue.ts b/packages/pieces/community/linear/src/lib/actions/issues/remove-label-from-issue.ts
index e49cfb244e7..692d215dbae 100644
--- a/packages/pieces/community/linear/src/lib/actions/issues/remove-label-from-issue.ts
+++ b/packages/pieces/community/linear/src/lib/actions/issues/remove-label-from-issue.ts
@@ -11,7 +11,7 @@ export const linearRemoveLabelFromIssue = createAction({
classification: 'WRITE',
displayName: 'Remove Label from Issue',
description: 'Remove one label from an issue and keep its other labels',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Removes one label from a Linear issue and keeps its other labels; the label itself is not deleted. Use instead of Update Issue, whose Labels field replaces the whole label set. Needs the issue and the label ID. Idempotent: removing a label the issue does not have changes nothing. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
diff --git a/packages/pieces/community/linear/src/lib/actions/issues/search-issues.ts b/packages/pieces/community/linear/src/lib/actions/issues/search-issues.ts
index 0e9b35c85a3..c3bc5216b72 100644
--- a/packages/pieces/community/linear/src/lib/actions/issues/search-issues.ts
+++ b/packages/pieces/community/linear/src/lib/actions/issues/search-issues.ts
@@ -12,7 +12,7 @@ export const linearSearchIssues = createAction({
classification: 'SEARCH',
displayName: 'Search Issues',
description: 'Search issue titles and descriptions for your words.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Runs a Linear full-text and semantic search over issue titles and descriptions (optionally comments), optionally limited to one team, and returns the best matches first. When has_next_page is true, pass end_cursor as cursor to get the next page. Use to find an existing issue before creating a duplicate; use Get Issue when the identifier is already known. Linear limits search to 30 requests per minute, and a just-created issue can take a moment to appear. Read-only and idempotent. labels_complete is false when Linear did not return every label page; label_ids and label_names then hold only the labels read.',
diff --git a/packages/pieces/community/linear/src/lib/actions/issues/update-issue.ts b/packages/pieces/community/linear/src/lib/actions/issues/update-issue.ts
index 5b256b1488b..e0bbd78a3fe 100644
--- a/packages/pieces/community/linear/src/lib/actions/issues/update-issue.ts
+++ b/packages/pieces/community/linear/src/lib/actions/issues/update-issue.ts
@@ -12,7 +12,7 @@ export const linearUpdateIssue = createAction({
classification: 'WRITE',
displayName: 'Update Issue',
description: 'Change an issue. Only the fields you fill in are changed.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description: 'Updates an existing Linear issue identified by its issue ID, changing fields such as title, description, assignee, status, labels, priority, project, cycle, parent issue (its identifier such as ENG-123, its ID, or its exact title), due date (YYYY-MM-DD) or estimate (points). Use to modify an issue already created. Only the provided fields are changed; repeating the same update is idempotent.',
idempotent: true,
diff --git a/packages/pieces/community/linear/src/lib/actions/projects/create-project-status-update.ts b/packages/pieces/community/linear/src/lib/actions/projects/create-project-status-update.ts
index 633fe1191af..1e47d4a2bdd 100644
--- a/packages/pieces/community/linear/src/lib/actions/projects/create-project-status-update.ts
+++ b/packages/pieces/community/linear/src/lib/actions/projects/create-project-status-update.ts
@@ -12,7 +12,7 @@ export const linearCreateProjectStatusUpdate = createAction({
classification: 'WRITE',
displayName: 'Post Project Status Update',
description: 'Post a status update, with an optional health rating, on a project.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Posts a status update on a Linear project: a markdown body plus an optional health of on track, at risk or off track, shown in the project Updates tab. This does not change the project itself; use Update Project to edit its name, dates or status. Not idempotent: each call posts a new update.',
diff --git a/packages/pieces/community/linear/src/lib/actions/projects/create-project.ts b/packages/pieces/community/linear/src/lib/actions/projects/create-project.ts
index f8aca3e6f78..d39875332e7 100644
--- a/packages/pieces/community/linear/src/lib/actions/projects/create-project.ts
+++ b/packages/pieces/community/linear/src/lib/actions/projects/create-project.ts
@@ -10,7 +10,7 @@ export const linearCreateProject = createAction({
classification: 'WRITE',
displayName: 'Create Project',
description: 'Create a project in a Linear team.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description: 'Creates a new project under a Linear team, with optional description, icon, color, start/target dates, and status. Use to set up a new project to group issues. Requires a team ID and project name; not idempotent, each call creates a distinct project.',
idempotent: false,
diff --git a/packages/pieces/community/linear/src/lib/actions/projects/update-project.ts b/packages/pieces/community/linear/src/lib/actions/projects/update-project.ts
index 94084cc9ee6..cab6d58bfee 100644
--- a/packages/pieces/community/linear/src/lib/actions/projects/update-project.ts
+++ b/packages/pieces/community/linear/src/lib/actions/projects/update-project.ts
@@ -12,7 +12,7 @@ export const linearUpdateProject = createAction({
classification: 'WRITE',
displayName: 'Update Project',
description: 'Change a project. Only the fields you fill in are changed.',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description: 'Updates an existing Linear project identified by its project ID, changing fields such as name, description, icon, color, start/target dates, or status, and adds the selected team to the project without removing its other teams. Use to modify a project already created. Repeating the same update is idempotent.',
idempotent: true,