## Summary Implements [SECRT-1880](https://linear.app/autogpt/issue/SECRT-1880) - Improve Linear Search Block ## Changes ### Models (`models.py`) - Added `State` model with `id`, `name`, and `type` fields for workflow state information - Added `state: State | None` field to `Issue` model ### API Client (`_api.py`) - Updated `try_search_issues()` to: - Add `max_results` parameter (default 10, was ~50) to reduce token usage - Add `team_id` parameter for team filtering - Return `createdAt`, `state`, `project`, and `assignee` fields in results - Fixed `try_get_team_by_name()` to return descriptive error message when team not found instead of crashing with `IndexError` ### Block (`issues.py`) - Added `max_results` input parameter (1-100, default 10) - Added `team_name` input parameter for optional team filtering - Added `error` output field for graceful error handling - Added categories (`PRODUCTIVITY`, `ISSUE_TRACKING`) - Updated test fixtures to include new fields ## Breaking Changes | Change | Before | After | Mitigation | |--------|--------|-------|------------| | Default result count | ~50 | 10 | Users can set `max_results` up to 100 if needed | ## Non-Breaking Changes - `state` field added to `Issue` (optional, defaults to `None`) - `max_results` param added (has default value) - `team_name` param added (optional, defaults to `None`) - `error` output added (follows established pattern from GitHub blocks) ## Testing - [x] Format/lint checks pass - [x] Unit test fixtures updated Resolves SECRT-1880 --------- Co-authored-by: Toran Bruce Richards <toran.richards@gmail.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Toran Bruce Richards <Torantulino@users.noreply.github.com>
4.4 KiB
Linear Issues
Blocks for creating and managing Linear issues.
Linear Create Issue
What it is
Creates a new issue on Linear
How it works
This block creates a new issue in Linear using the GraphQL API. Specify the team, title, description, and optionally priority and project. The issue is created immediately and assigned to the specified team's workflow.
Returns the created issue's ID and title for tracking or further operations.
Inputs
| Input | Description | Type | Required |
|---|---|---|---|
| title | Title of the issue | str | Yes |
| description | Description of the issue | str | Yes |
| team_name | Name of the team to create the issue on | str | Yes |
| priority | Priority of the issue | int | No |
| project_name | Name of the project to create the issue on | str | No |
Outputs
| Output | Description | Type |
|---|---|---|
| error | Error message if the operation failed | str |
| issue_id | ID of the created issue | str |
| issue_title | Title of the created issue | str |
Possible use case
Bug Reporting: Automatically create issues from error monitoring or customer reports.
Feature Requests: Convert feature requests from forms or support tickets into Linear issues.
Task Automation: Create issues based on scheduled events or external triggers.
Linear Get Project Issues
What it is
Gets issues from a Linear project filtered by status and assignee
How it works
This block retrieves issues from a Linear project with optional filtering by status and assignee. It queries the Linear GraphQL API and returns matching issues with their details.
Optionally include comments in the response for comprehensive issue data.
Inputs
| Input | Description | Type | Required |
|---|---|---|---|
| project | Name of the project to get issues from | str | Yes |
| status | Status/state name to filter issues by (e.g., 'In Progress', 'Done') | str | Yes |
| is_assigned | Filter by assignee status - True to get assigned issues, False to get unassigned issues | bool | No |
| include_comments | Whether to include comments in the response | bool | No |
Outputs
| Output | Description | Type |
|---|---|---|
| error | Error message if the operation failed | str |
| issues | List of issues matching the criteria | List[Issue] |
Possible use case
Sprint Reports: Generate reports of issues in specific states for sprint reviews.
Workload Analysis: Find unassigned or overdue issues across projects.
Status Dashboards: Build dashboards showing issue distribution by status.
Linear Search Issues
What it is
Searches for issues on Linear
How it works
This block searches for issues in Linear using a text query. It searches across issue titles, descriptions, and other fields to find matching issues. You can limit the number of results returned using the max_results parameter (default: 10, max: 100) to control token consumption and response size.
Optionally filter results by team name to narrow searches to specific workspaces. If a team name is provided, the block resolves it to a team ID before searching. Returns matching issues with their state, creation date, project, and assignee information. If the search or team resolution fails, an error message is returned.
Inputs
| Input | Description | Type | Required |
|---|---|---|---|
| term | Term to search for issues | str | Yes |
| max_results | Maximum number of results to return | int | No |
| team_name | Optional team name to filter results (e.g., 'Internal', 'Open Source') | str | No |
Outputs
| Output | Description | Type |
|---|---|---|
| error | Error message if the search failed | str |
| issues | List of issues | List[Issue] |
Possible use case
Duplicate Detection: Search for existing issues before creating new ones.
Related Issues: Find issues related to a specific topic or feature.
Quick Lookup: Search for issues by keyword for customer support or research.