@elizaos/plugin-linear 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +303 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +1333 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# @elizaos/plugin-linear
|
|
2
|
+
|
|
3
|
+
A comprehensive Linear integration plugin for ElizaOS that enables issue tracking, project management, and team collaboration through the Linear API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### 📋 Issue Management
|
|
8
|
+
- **Create Issues**: Create new issues with title, description, priority, assignees, and labels
|
|
9
|
+
- **Get Issue Details**: Retrieve comprehensive information about specific issues
|
|
10
|
+
- **Update Issues**: Modify existing issues with new information
|
|
11
|
+
- **Search Issues**: Find issues using various filters and search criteria
|
|
12
|
+
- **Add Comments**: Comment on existing issues
|
|
13
|
+
|
|
14
|
+
### 👥 Team & User Management
|
|
15
|
+
- **List Teams**: View all teams in your Linear workspace
|
|
16
|
+
- **Get Team Details**: Retrieve specific team information
|
|
17
|
+
- **List Users**: View all users in the workspace
|
|
18
|
+
- **Get Current User**: Retrieve information about the authenticated user
|
|
19
|
+
|
|
20
|
+
### 📊 Project Management
|
|
21
|
+
- **List Projects**: View all projects, optionally filtered by team
|
|
22
|
+
- **Get Project Details**: Retrieve specific project information
|
|
23
|
+
- **Project Status**: Track project states and timelines
|
|
24
|
+
|
|
25
|
+
### 📈 Activity Tracking
|
|
26
|
+
- **Activity Log**: Track all Linear operations performed by the agent
|
|
27
|
+
- **Clear Activity**: Reset the activity log
|
|
28
|
+
- **Success/Error Tracking**: Monitor operation success rates
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @elizaos/plugin-linear
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configuration
|
|
37
|
+
|
|
38
|
+
The plugin requires a Linear API key for authentication. You can obtain one from your [Linear settings](https://linear.app/settings/api).
|
|
39
|
+
|
|
40
|
+
### Environment Variables
|
|
41
|
+
|
|
42
|
+
Create a `.env` file in your project root:
|
|
43
|
+
|
|
44
|
+
```env
|
|
45
|
+
# Required
|
|
46
|
+
LINEAR_API_KEY=your_linear_api_key_here
|
|
47
|
+
|
|
48
|
+
# Optional
|
|
49
|
+
LINEAR_WORKSPACE_ID=your_workspace_id_here
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
### Register the Plugin
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { linearPlugin } from '@elizaos/plugin-linear';
|
|
58
|
+
|
|
59
|
+
// Register with your ElizaOS agent
|
|
60
|
+
agent.registerPlugin(linearPlugin);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Available Actions
|
|
64
|
+
|
|
65
|
+
#### Create Issue
|
|
66
|
+
```typescript
|
|
67
|
+
// Natural language
|
|
68
|
+
"Create a new issue: Fix login button not working on mobile devices"
|
|
69
|
+
|
|
70
|
+
// With options
|
|
71
|
+
{
|
|
72
|
+
action: "CREATE_LINEAR_ISSUE",
|
|
73
|
+
options: {
|
|
74
|
+
title: "Fix login button",
|
|
75
|
+
description: "The login button is not responsive on mobile devices",
|
|
76
|
+
teamId: "team-123",
|
|
77
|
+
priority: 2, // High
|
|
78
|
+
assigneeId: "user-456"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### Get Issue
|
|
84
|
+
```typescript
|
|
85
|
+
// Natural language
|
|
86
|
+
"Show me issue ENG-123"
|
|
87
|
+
|
|
88
|
+
// With options
|
|
89
|
+
{
|
|
90
|
+
action: "GET_LINEAR_ISSUE",
|
|
91
|
+
options: {
|
|
92
|
+
issueId: "issue-id-or-identifier"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### Search Issues
|
|
98
|
+
```typescript
|
|
99
|
+
// Natural language
|
|
100
|
+
"Show me all high priority bugs assigned to me"
|
|
101
|
+
|
|
102
|
+
// With options
|
|
103
|
+
{
|
|
104
|
+
action: "SEARCH_LINEAR_ISSUES",
|
|
105
|
+
options: {
|
|
106
|
+
query: "bug",
|
|
107
|
+
priority: [1, 2], // Urgent and High
|
|
108
|
+
state: ["in-progress", "todo"],
|
|
109
|
+
limit: 20
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Update Issue
|
|
115
|
+
```typescript
|
|
116
|
+
// With options
|
|
117
|
+
{
|
|
118
|
+
action: "UPDATE_LINEAR_ISSUE",
|
|
119
|
+
options: {
|
|
120
|
+
issueId: "issue-id",
|
|
121
|
+
title: "Updated title",
|
|
122
|
+
priority: 1,
|
|
123
|
+
stateId: "state-id"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Add Comment
|
|
129
|
+
```typescript
|
|
130
|
+
// Natural language
|
|
131
|
+
"Comment on ENG-123: This has been fixed in the latest release"
|
|
132
|
+
|
|
133
|
+
// With options
|
|
134
|
+
{
|
|
135
|
+
action: "CREATE_LINEAR_COMMENT",
|
|
136
|
+
options: {
|
|
137
|
+
issueId: "issue-id",
|
|
138
|
+
body: "This has been fixed in the latest release"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### List Teams
|
|
144
|
+
```typescript
|
|
145
|
+
// Natural language
|
|
146
|
+
"Show me all teams"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### List Projects
|
|
150
|
+
```typescript
|
|
151
|
+
// Natural language
|
|
152
|
+
"Show me all projects"
|
|
153
|
+
|
|
154
|
+
// Filter by team
|
|
155
|
+
{
|
|
156
|
+
action: "LIST_LINEAR_PROJECTS",
|
|
157
|
+
options: {
|
|
158
|
+
teamId: "team-id"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Get Activity
|
|
164
|
+
```typescript
|
|
165
|
+
// Natural language
|
|
166
|
+
"Show me recent Linear activity"
|
|
167
|
+
|
|
168
|
+
// With options
|
|
169
|
+
{
|
|
170
|
+
action: "GET_LINEAR_ACTIVITY",
|
|
171
|
+
options: {
|
|
172
|
+
limit: 50,
|
|
173
|
+
filter: { resource_type: "issue" }
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Providers
|
|
179
|
+
|
|
180
|
+
The plugin includes several context providers that supply Linear data to the agent:
|
|
181
|
+
|
|
182
|
+
#### LINEAR_ISSUES
|
|
183
|
+
Provides context about recent Linear issues:
|
|
184
|
+
```typescript
|
|
185
|
+
"Recent Linear Issues:
|
|
186
|
+
- ENG-123: Fix login button (In Progress, John Doe)
|
|
187
|
+
- BUG-456: Memory leak in dashboard (Todo, Unassigned)
|
|
188
|
+
..."
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### LINEAR_TEAMS
|
|
192
|
+
Provides context about Linear teams:
|
|
193
|
+
```typescript
|
|
194
|
+
"Linear Teams:
|
|
195
|
+
- Engineering (ENG): Core development team
|
|
196
|
+
- Design (DES): Product design team
|
|
197
|
+
..."
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### LINEAR_PROJECTS
|
|
201
|
+
Provides context about active Linear projects:
|
|
202
|
+
```typescript
|
|
203
|
+
"Active Linear Projects:
|
|
204
|
+
- Q1 2024 Roadmap: started (Jan 1 - Mar 31)
|
|
205
|
+
- Mobile App Redesign: planned (Feb 1 - Apr 30)
|
|
206
|
+
..."
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### LINEAR_ACTIVITY
|
|
210
|
+
Provides context about recent Linear activity:
|
|
211
|
+
```typescript
|
|
212
|
+
"Recent Linear Activity:
|
|
213
|
+
✓ 2:30 PM: create_issue issue ENG-789
|
|
214
|
+
✗ 2:25 PM: update_issue issue BUG-456
|
|
215
|
+
..."
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Service API
|
|
219
|
+
|
|
220
|
+
The plugin exposes a `LinearService` that can be accessed programmatically:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
const linearService = runtime.getService<LinearService>('linear');
|
|
224
|
+
|
|
225
|
+
// Create an issue
|
|
226
|
+
const issue = await linearService.createIssue({
|
|
227
|
+
title: "New feature request",
|
|
228
|
+
description: "Detailed description",
|
|
229
|
+
teamId: "team-123",
|
|
230
|
+
priority: 3
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// Search issues
|
|
234
|
+
const issues = await linearService.searchIssues({
|
|
235
|
+
query: "authentication",
|
|
236
|
+
state: ["todo", "in-progress"],
|
|
237
|
+
limit: 10
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// Get teams
|
|
241
|
+
const teams = await linearService.getTeams();
|
|
242
|
+
|
|
243
|
+
// Activity tracking
|
|
244
|
+
const recentActivity = linearService.getActivityLog(50);
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Error Handling
|
|
248
|
+
|
|
249
|
+
The plugin includes custom error classes for better error handling:
|
|
250
|
+
|
|
251
|
+
- `LinearAPIError`: General API errors
|
|
252
|
+
- `LinearAuthenticationError`: Authentication failures
|
|
253
|
+
- `LinearRateLimitError`: Rate limit exceeded
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
try {
|
|
257
|
+
await linearService.createIssue(issueData);
|
|
258
|
+
} catch (error) {
|
|
259
|
+
if (error instanceof LinearAuthenticationError) {
|
|
260
|
+
// Handle auth error
|
|
261
|
+
} else if (error instanceof LinearRateLimitError) {
|
|
262
|
+
// Handle rate limit
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Priority Levels
|
|
268
|
+
|
|
269
|
+
Linear uses numeric priority levels:
|
|
270
|
+
- 0: No priority
|
|
271
|
+
- 1: Urgent
|
|
272
|
+
- 2: High
|
|
273
|
+
- 3: Normal (default)
|
|
274
|
+
- 4: Low
|
|
275
|
+
|
|
276
|
+
## Development
|
|
277
|
+
|
|
278
|
+
### Building
|
|
279
|
+
```bash
|
|
280
|
+
npm run build
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Testing
|
|
284
|
+
```bash
|
|
285
|
+
npm run test
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Linting
|
|
289
|
+
```bash
|
|
290
|
+
npm run lint
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## License
|
|
294
|
+
|
|
295
|
+
MIT
|
|
296
|
+
|
|
297
|
+
## Contributing
|
|
298
|
+
|
|
299
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
300
|
+
|
|
301
|
+
## Support
|
|
302
|
+
|
|
303
|
+
For issues and feature requests, please create an issue on the [GitHub repository](https://github.com/elizaos/eliza).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Service, IAgentRuntime, Plugin } from '@elizaos/core';
|
|
2
|
+
import { Team, Issue, Comment, Project, User, IssueLabel, WorkflowState } from '@linear/sdk';
|
|
3
|
+
|
|
4
|
+
interface LinearConfig {
|
|
5
|
+
LINEAR_API_KEY: string;
|
|
6
|
+
LINEAR_WORKSPACE_ID?: string;
|
|
7
|
+
}
|
|
8
|
+
interface LinearActivityItem {
|
|
9
|
+
id: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
action: string;
|
|
12
|
+
resource_type: 'issue' | 'project' | 'comment' | 'label' | 'user' | 'team';
|
|
13
|
+
resource_id: string;
|
|
14
|
+
details: Record<string, any>;
|
|
15
|
+
success: boolean;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
interface LinearIssueInput {
|
|
19
|
+
title: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
teamId: string;
|
|
22
|
+
priority?: number;
|
|
23
|
+
assigneeId?: string;
|
|
24
|
+
labelIds?: string[];
|
|
25
|
+
projectId?: string;
|
|
26
|
+
stateId?: string;
|
|
27
|
+
estimate?: number;
|
|
28
|
+
dueDate?: Date;
|
|
29
|
+
}
|
|
30
|
+
interface LinearCommentInput {
|
|
31
|
+
body: string;
|
|
32
|
+
issueId: string;
|
|
33
|
+
}
|
|
34
|
+
interface LinearSearchFilters {
|
|
35
|
+
state?: string[];
|
|
36
|
+
assignee?: string[];
|
|
37
|
+
label?: string[];
|
|
38
|
+
project?: string;
|
|
39
|
+
team?: string;
|
|
40
|
+
priority?: number[];
|
|
41
|
+
query?: string;
|
|
42
|
+
limit?: number;
|
|
43
|
+
}
|
|
44
|
+
declare class LinearAPIError extends Error {
|
|
45
|
+
status?: number | undefined;
|
|
46
|
+
response?: any | undefined;
|
|
47
|
+
constructor(message: string, status?: number | undefined, response?: any | undefined);
|
|
48
|
+
}
|
|
49
|
+
declare class LinearAuthenticationError extends LinearAPIError {
|
|
50
|
+
constructor(message: string);
|
|
51
|
+
}
|
|
52
|
+
declare class LinearRateLimitError extends LinearAPIError {
|
|
53
|
+
resetTime: number;
|
|
54
|
+
constructor(message: string, resetTime: number);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare class LinearService extends Service {
|
|
58
|
+
static serviceType: string;
|
|
59
|
+
capabilityDescription: string;
|
|
60
|
+
private client;
|
|
61
|
+
private activityLog;
|
|
62
|
+
private linearConfig;
|
|
63
|
+
private workspaceId?;
|
|
64
|
+
constructor(runtime?: IAgentRuntime);
|
|
65
|
+
static start(runtime: IAgentRuntime): Promise<LinearService>;
|
|
66
|
+
stop(): Promise<void>;
|
|
67
|
+
private validateConnection;
|
|
68
|
+
private logActivity;
|
|
69
|
+
getActivityLog(limit?: number, filter?: Partial<LinearActivityItem>): LinearActivityItem[];
|
|
70
|
+
clearActivityLog(): void;
|
|
71
|
+
getTeams(): Promise<Team[]>;
|
|
72
|
+
getTeam(teamId: string): Promise<Team>;
|
|
73
|
+
createIssue(input: LinearIssueInput): Promise<Issue>;
|
|
74
|
+
getIssue(issueId: string): Promise<Issue>;
|
|
75
|
+
updateIssue(issueId: string, updates: Partial<LinearIssueInput>): Promise<Issue>;
|
|
76
|
+
searchIssues(filters: LinearSearchFilters): Promise<Issue[]>;
|
|
77
|
+
createComment(input: LinearCommentInput): Promise<Comment>;
|
|
78
|
+
getProjects(teamId?: string): Promise<Project[]>;
|
|
79
|
+
getProject(projectId: string): Promise<Project>;
|
|
80
|
+
getUsers(): Promise<User[]>;
|
|
81
|
+
getCurrentUser(): Promise<User>;
|
|
82
|
+
getLabels(teamId?: string): Promise<IssueLabel[]>;
|
|
83
|
+
getWorkflowStates(teamId: string): Promise<WorkflowState[]>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare const linearPlugin: Plugin;
|
|
87
|
+
|
|
88
|
+
export { LinearAPIError, type LinearActivityItem, LinearAuthenticationError, type LinearCommentInput, type LinearConfig, type LinearIssueInput, LinearRateLimitError, type LinearSearchFilters, LinearService, linearPlugin };
|