@enrichlayer/el-linear 1.2.0
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/LICENSE +21 -0
- package/README.md +219 -0
- package/claude-skills/linear-operations/SKILL.md +315 -0
- package/claude-skills/linear-operations/evals/evals.json +46 -0
- package/dist/commands/attachments.d.ts +2 -0
- package/dist/commands/attachments.js +57 -0
- package/dist/commands/batch.d.ts +2 -0
- package/dist/commands/batch.js +309 -0
- package/dist/commands/comments.d.ts +2 -0
- package/dist/commands/comments.js +272 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +15 -0
- package/dist/commands/cycles.d.ts +2 -0
- package/dist/commands/cycles.js +63 -0
- package/dist/commands/documents.d.ts +2 -0
- package/dist/commands/documents.js +175 -0
- package/dist/commands/embeds.d.ts +2 -0
- package/dist/commands/embeds.js +65 -0
- package/dist/commands/gdoc.d.ts +2 -0
- package/dist/commands/gdoc.js +37 -0
- package/dist/commands/graphql.d.ts +2 -0
- package/dist/commands/graphql.js +70 -0
- package/dist/commands/init/aliases.d.ts +109 -0
- package/dist/commands/init/aliases.js +569 -0
- package/dist/commands/init/defaults.d.ts +25 -0
- package/dist/commands/init/defaults.js +112 -0
- package/dist/commands/init/index.d.ts +18 -0
- package/dist/commands/init/index.js +182 -0
- package/dist/commands/init/shared.d.ts +88 -0
- package/dist/commands/init/shared.js +164 -0
- package/dist/commands/init/token.d.ts +50 -0
- package/dist/commands/init/token.js +141 -0
- package/dist/commands/init/workspace.d.ts +20 -0
- package/dist/commands/init/workspace.js +80 -0
- package/dist/commands/issue-id.d.ts +28 -0
- package/dist/commands/issue-id.js +81 -0
- package/dist/commands/issues.d.ts +2 -0
- package/dist/commands/issues.js +1145 -0
- package/dist/commands/labels.d.ts +2 -0
- package/dist/commands/labels.js +100 -0
- package/dist/commands/project-milestones.d.ts +2 -0
- package/dist/commands/project-milestones.js +143 -0
- package/dist/commands/projects.d.ts +2 -0
- package/dist/commands/projects.js +336 -0
- package/dist/commands/read-shortcut.d.ts +6 -0
- package/dist/commands/read-shortcut.js +69 -0
- package/dist/commands/releases.d.ts +2 -0
- package/dist/commands/releases.js +142 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +171 -0
- package/dist/commands/teams.d.ts +2 -0
- package/dist/commands/teams.js +19 -0
- package/dist/commands/templates.d.ts +2 -0
- package/dist/commands/templates.js +58 -0
- package/dist/commands/users.d.ts +2 -0
- package/dist/commands/users.js +17 -0
- package/dist/config/config.d.ts +43 -0
- package/dist/config/config.js +81 -0
- package/dist/config/issue-validation.d.ts +39 -0
- package/dist/config/issue-validation.js +264 -0
- package/dist/config/paths.d.ts +20 -0
- package/dist/config/paths.js +22 -0
- package/dist/config/resolver.d.ts +25 -0
- package/dist/config/resolver.js +183 -0
- package/dist/config/status-defaults.d.ts +13 -0
- package/dist/config/status-defaults.js +20 -0
- package/dist/config/term-enforcer.d.ts +31 -0
- package/dist/config/term-enforcer.js +69 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +76 -0
- package/dist/queries/attachments.d.ts +3 -0
- package/dist/queries/attachments.js +35 -0
- package/dist/queries/comments.d.ts +3 -0
- package/dist/queries/comments.js +64 -0
- package/dist/queries/common.d.ts +2 -0
- package/dist/queries/common.js +109 -0
- package/dist/queries/cycles.d.ts +2 -0
- package/dist/queries/cycles.js +40 -0
- package/dist/queries/documents.d.ts +5 -0
- package/dist/queries/documents.js +67 -0
- package/dist/queries/introspect.d.ts +2 -0
- package/dist/queries/introspect.js +24 -0
- package/dist/queries/issues.d.ts +23 -0
- package/dist/queries/issues.js +380 -0
- package/dist/queries/labels.d.ts +4 -0
- package/dist/queries/labels.js +53 -0
- package/dist/queries/project-milestones.d.ts +6 -0
- package/dist/queries/project-milestones.js +125 -0
- package/dist/queries/projects.d.ts +7 -0
- package/dist/queries/projects.js +104 -0
- package/dist/queries/releases.d.ts +4 -0
- package/dist/queries/releases.js +85 -0
- package/dist/queries/search.d.ts +1 -0
- package/dist/queries/search.js +35 -0
- package/dist/queries/templates.d.ts +2 -0
- package/dist/queries/templates.js +30 -0
- package/dist/types/linear.d.ts +217 -0
- package/dist/types/linear.js +6 -0
- package/dist/utils/auth.d.ts +4 -0
- package/dist/utils/auth.js +23 -0
- package/dist/utils/auto-link-references.d.ts +47 -0
- package/dist/utils/auto-link-references.js +188 -0
- package/dist/utils/date-format.d.ts +4 -0
- package/dist/utils/date-format.js +8 -0
- package/dist/utils/download-uploads.d.ts +7 -0
- package/dist/utils/download-uploads.js +88 -0
- package/dist/utils/embed-parser.d.ts +8 -0
- package/dist/utils/embed-parser.js +54 -0
- package/dist/utils/error-messages.d.ts +4 -0
- package/dist/utils/error-messages.js +17 -0
- package/dist/utils/file-service.d.ts +13 -0
- package/dist/utils/file-service.js +239 -0
- package/dist/utils/gdoc-parser.d.ts +45 -0
- package/dist/utils/gdoc-parser.js +107 -0
- package/dist/utils/graphql-attachments-service.d.ts +12 -0
- package/dist/utils/graphql-attachments-service.js +46 -0
- package/dist/utils/graphql-documents-service.d.ts +18 -0
- package/dist/utils/graphql-documents-service.js +97 -0
- package/dist/utils/graphql-issues-service.d.ts +49 -0
- package/dist/utils/graphql-issues-service.js +925 -0
- package/dist/utils/graphql-service.d.ts +8 -0
- package/dist/utils/graphql-service.js +35 -0
- package/dist/utils/identifier-parser.d.ts +7 -0
- package/dist/utils/identifier-parser.js +20 -0
- package/dist/utils/issue-reference-extractor.d.ts +18 -0
- package/dist/utils/issue-reference-extractor.js +95 -0
- package/dist/utils/issue-reference-wrapper.d.ts +12 -0
- package/dist/utils/issue-reference-wrapper.js +91 -0
- package/dist/utils/linear-service.d.ts +26 -0
- package/dist/utils/linear-service.js +442 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.js +8 -0
- package/dist/utils/markdown-prosemirror.d.ts +24 -0
- package/dist/utils/markdown-prosemirror.js +325 -0
- package/dist/utils/mention-resolver.d.ts +31 -0
- package/dist/utils/mention-resolver.js +234 -0
- package/dist/utils/output.d.ts +7 -0
- package/dist/utils/output.js +125 -0
- package/dist/utils/table-formatter.d.ts +4 -0
- package/dist/utils/table-formatter.js +249 -0
- package/dist/utils/usage.d.ts +2 -0
- package/dist/utils/usage.js +24 -0
- package/dist/utils/uuid.d.ts +2 -0
- package/dist/utils/uuid.js +8 -0
- package/dist/utils/validate-references.d.ts +10 -0
- package/dist/utils/validate-references.js +33 -0
- package/dist/utils/validators.d.ts +7 -0
- package/dist/utils/validators.js +71 -0
- package/dist/utils/workspace-url.d.ts +4 -0
- package/dist/utils/workspace-url.js +44 -0
- package/package.json +71 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CREATE_DOCUMENT_MUTATION, DELETE_DOCUMENT_MUTATION, GET_DOCUMENT_QUERY, LIST_DOCUMENTS_QUERY, UPDATE_DOCUMENT_MUTATION, } from "../queries/documents.js";
|
|
2
|
+
import { createGraphQLService, } from "./graphql-service.js";
|
|
3
|
+
function transformDocument(doc) {
|
|
4
|
+
const creator = doc.creator;
|
|
5
|
+
const project = doc.project;
|
|
6
|
+
const issue = doc.issue;
|
|
7
|
+
return {
|
|
8
|
+
id: doc.id,
|
|
9
|
+
title: doc.title,
|
|
10
|
+
content: doc.content || undefined,
|
|
11
|
+
color: doc.color || undefined,
|
|
12
|
+
icon: doc.icon || undefined,
|
|
13
|
+
slugId: doc.slugId || undefined,
|
|
14
|
+
url: doc.url || undefined,
|
|
15
|
+
creator: creator
|
|
16
|
+
? { id: creator.id, name: creator.name }
|
|
17
|
+
: undefined,
|
|
18
|
+
project: project
|
|
19
|
+
? { id: project.id, name: project.name }
|
|
20
|
+
: undefined,
|
|
21
|
+
issue: issue
|
|
22
|
+
? {
|
|
23
|
+
id: issue.id,
|
|
24
|
+
identifier: issue.identifier,
|
|
25
|
+
title: issue.title,
|
|
26
|
+
}
|
|
27
|
+
: undefined,
|
|
28
|
+
createdAt: doc.createdAt || undefined,
|
|
29
|
+
updatedAt: doc.updatedAt || undefined,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
class GraphQLDocumentsService {
|
|
33
|
+
graphqlService;
|
|
34
|
+
constructor(graphqlService) {
|
|
35
|
+
this.graphqlService = graphqlService;
|
|
36
|
+
}
|
|
37
|
+
async createDocument(input) {
|
|
38
|
+
const result = await this.graphqlService.rawRequest(CREATE_DOCUMENT_MUTATION, { input });
|
|
39
|
+
const createData = result.documentCreate;
|
|
40
|
+
if (!createData.success) {
|
|
41
|
+
throw new Error(`Failed to create document "${input.title}"${input.projectId ? ` in project ${input.projectId}` : ""}${input.teamId ? ` for team ${input.teamId}` : ""}`);
|
|
42
|
+
}
|
|
43
|
+
return transformDocument(createData.document);
|
|
44
|
+
}
|
|
45
|
+
async updateDocument(id, input) {
|
|
46
|
+
const result = await this.graphqlService.rawRequest(UPDATE_DOCUMENT_MUTATION, { id, input });
|
|
47
|
+
const updateData = result.documentUpdate;
|
|
48
|
+
if (!updateData.success) {
|
|
49
|
+
throw new Error(`Failed to update document: ${id}`);
|
|
50
|
+
}
|
|
51
|
+
return transformDocument(updateData.document);
|
|
52
|
+
}
|
|
53
|
+
async getDocument(id) {
|
|
54
|
+
const result = await this.graphqlService.rawRequest(GET_DOCUMENT_QUERY, {
|
|
55
|
+
id,
|
|
56
|
+
});
|
|
57
|
+
if (!result.document) {
|
|
58
|
+
throw new Error(`Document not found: ${id}`);
|
|
59
|
+
}
|
|
60
|
+
return transformDocument(result.document);
|
|
61
|
+
}
|
|
62
|
+
async listDocuments(options) {
|
|
63
|
+
const filter = options?.projectId
|
|
64
|
+
? { project: { id: { eq: options.projectId } } }
|
|
65
|
+
: undefined;
|
|
66
|
+
const result = await this.graphqlService.rawRequest(LIST_DOCUMENTS_QUERY, {
|
|
67
|
+
first: options?.first ?? 50,
|
|
68
|
+
filter,
|
|
69
|
+
});
|
|
70
|
+
return result.documents.nodes.map(transformDocument);
|
|
71
|
+
}
|
|
72
|
+
async deleteDocument(id) {
|
|
73
|
+
const result = await this.graphqlService.rawRequest(DELETE_DOCUMENT_MUTATION, { id });
|
|
74
|
+
const deleteData = result.documentDelete;
|
|
75
|
+
if (!deleteData.success) {
|
|
76
|
+
throw new Error(`Failed to delete document: ${id}`);
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
async listDocumentsBySlugIds(slugIds, limit) {
|
|
81
|
+
if (slugIds.length === 0) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
const filter = {
|
|
85
|
+
or: slugIds.map((slugId) => ({ slugId: { eq: slugId } })),
|
|
86
|
+
};
|
|
87
|
+
const result = await this.graphqlService.rawRequest(LIST_DOCUMENTS_QUERY, {
|
|
88
|
+
first: limit ?? slugIds.length,
|
|
89
|
+
filter,
|
|
90
|
+
});
|
|
91
|
+
return result.documents.nodes.map(transformDocument);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export function createGraphQLDocumentsService(options) {
|
|
95
|
+
const graphqlService = createGraphQLService(options);
|
|
96
|
+
return new GraphQLDocumentsService(graphqlService);
|
|
97
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { GraphQLResponseData, LinearIssue } from "../types/linear.js";
|
|
2
|
+
import type { GraphQLService } from "./graphql-service.js";
|
|
3
|
+
import type { LinearService } from "./linear-service.js";
|
|
4
|
+
export declare class GraphQLIssuesService {
|
|
5
|
+
private readonly graphQLService;
|
|
6
|
+
private readonly linearService;
|
|
7
|
+
constructor(graphQLService: GraphQLService, linearService: LinearService);
|
|
8
|
+
getIssues(limit?: number): Promise<LinearIssue[]>;
|
|
9
|
+
getIssueById(issueId: string): Promise<LinearIssue>;
|
|
10
|
+
updateIssue(args: Record<string, unknown>, labelMode?: string): Promise<LinearIssue>;
|
|
11
|
+
private extractMilestoneNodes;
|
|
12
|
+
private executeUpdateMutation;
|
|
13
|
+
createIssue(args: Record<string, unknown>): Promise<LinearIssue>;
|
|
14
|
+
private resolveCreateFields;
|
|
15
|
+
private executeCreateMutation;
|
|
16
|
+
searchIssues(args: Record<string, unknown>): Promise<LinearIssue[]>;
|
|
17
|
+
private resolveTeamId;
|
|
18
|
+
private resolveProjectId;
|
|
19
|
+
/**
|
|
20
|
+
* Check that the resolved team is associated with the project.
|
|
21
|
+
* If not, auto-switch when the project belongs to exactly one team.
|
|
22
|
+
*/
|
|
23
|
+
private validateProjectTeam;
|
|
24
|
+
private resolveLabels;
|
|
25
|
+
private resolveLabelsWithMode;
|
|
26
|
+
/** Auto-create a missing label on the team. Returns the new label ID or null on failure. */
|
|
27
|
+
private autoCreateLabel;
|
|
28
|
+
private resolveTeamKeyFromResult;
|
|
29
|
+
private collectTeamNodes;
|
|
30
|
+
private resolveMilestoneId;
|
|
31
|
+
private resolveMilestoneIdForCreate;
|
|
32
|
+
private fetchIssueTeamId;
|
|
33
|
+
private buildCreateInput;
|
|
34
|
+
private buildUpdateInput;
|
|
35
|
+
private buildResolveVariablesForTeam;
|
|
36
|
+
private applySearchFilters;
|
|
37
|
+
private buildSearchFilter;
|
|
38
|
+
private resolveAssigneeId;
|
|
39
|
+
private resolveUpdateContext;
|
|
40
|
+
private resolveCycleIdForUpdate;
|
|
41
|
+
private resolveStatusIdForUpdate;
|
|
42
|
+
private buildCreateResolveVariables;
|
|
43
|
+
private resolveParentId;
|
|
44
|
+
transformIssueData(issue: GraphQLResponseData): LinearIssue;
|
|
45
|
+
private transformIssueCoreFields;
|
|
46
|
+
private transformIssueRelations;
|
|
47
|
+
private transformIssueHierarchy;
|
|
48
|
+
private transformIssueComments;
|
|
49
|
+
}
|