@enrichlayer/el-linear 1.38.1 → 1.38.2

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.
@@ -65,8 +65,9 @@ async function handleCreateDocument(options, command) {
65
65
  outputSuccess(document);
66
66
  }
67
67
  async function handleListDocuments(options, command) {
68
- if (options.project && options.issue) {
69
- throw new Error("Cannot use --project and --issue together. Choose one filter.");
68
+ const filters = [options.project, options.issue, options.attachedTo].filter(Boolean);
69
+ if (filters.length > 1) {
70
+ throw new Error("Cannot combine --project, --issue, and --attached-to. Choose one filter.");
70
71
  }
71
72
  const rootOpts = getRootOpts(command);
72
73
  const documentsService = await createGraphQLDocumentsService(rootOpts);
@@ -75,9 +76,9 @@ async function handleListDocuments(options, command) {
75
76
  if (Number.isNaN(limit) || limit < 1) {
76
77
  throw new Error(`Invalid limit "${options.limit}": must be a positive number`);
77
78
  }
78
- if (options.issue) {
79
+ if (options.attachedTo) {
79
80
  const attachmentsService = await createGraphQLAttachmentsService(rootOpts);
80
- const issueId = await linearService.resolveIssueId(options.issue);
81
+ const issueId = await linearService.resolveIssueId(options.attachedTo);
81
82
  const attachments = await attachmentsService.listAttachments(issueId);
82
83
  const documentSlugIds = [
83
84
  ...new Set(attachments
@@ -96,8 +97,13 @@ async function handleListDocuments(options, command) {
96
97
  if (options.project) {
97
98
  projectId = await linearService.resolveProjectId(options.project);
98
99
  }
100
+ let issueId;
101
+ if (options.issue) {
102
+ issueId = await linearService.resolveIssueId(options.issue);
103
+ }
99
104
  const docs = await documentsService.listDocuments({
100
105
  projectId,
106
+ issueId,
101
107
  first: limit,
102
108
  });
103
109
  outputSuccess({ data: docs, meta: { count: docs.length } });
@@ -119,8 +125,8 @@ export function setupDocumentsCommands(program) {
119
125
  .option("--team <team>", "team key or name")
120
126
  .option("--icon <icon>", "document icon")
121
127
  .option("--color <color>", "icon color")
122
- .option("--issue <issue>", "link document to issue (e.g., ABC-123)")
123
- .option("--attach-to <issue>", "also attach document to issue (e.g., ABC-123)")
128
+ .option("--issue <issue>", "link document directly to issue (e.g., ABC-123)")
129
+ .option("--attach-to <issue>", "also create a URL attachment on issue (e.g., ABC-123)")
124
130
  .action(handleAsyncCommand(handleCreateDocument));
125
131
  documents
126
132
  .command("update <documentId>")
@@ -164,7 +170,8 @@ export function setupDocumentsCommands(program) {
164
170
  .command("list")
165
171
  .description("List documents")
166
172
  .option("--project <project>", "filter by project name or ID")
167
- .option("--issue <issue>", "filter by issue (shows documents attached to the issue)")
173
+ .option("--issue <issue>", "filter by direct issue link (set by documents create --issue)")
174
+ .option("--attached-to <issue>", "filter by URL attachments (set by documents create --attach-to)")
168
175
  .option("-l, --limit <limit>", "maximum number of documents", "50")
169
176
  .action(handleAsyncCommand(handleListDocuments));
170
177
  documents
@@ -9,6 +9,7 @@ declare class GraphQLDocumentsService {
9
9
  getDocument(id: string): Promise<LinearDocument>;
10
10
  listDocuments(options?: {
11
11
  projectId?: string;
12
+ issueId?: string;
12
13
  first?: number;
13
14
  }): Promise<LinearDocument[]>;
14
15
  deleteDocument(id: string): Promise<boolean>;
@@ -55,9 +55,13 @@ class GraphQLDocumentsService {
55
55
  return transformDocument(result.document);
56
56
  }
57
57
  async listDocuments(options) {
58
- const filter = options?.projectId
59
- ? { project: { id: { eq: options.projectId } } }
60
- : undefined;
58
+ let filter;
59
+ if (options?.projectId) {
60
+ filter = { project: { id: { eq: options.projectId } } };
61
+ }
62
+ else if (options?.issueId) {
63
+ filter = { issue: { id: { eq: options.issueId } } };
64
+ }
61
65
  const result = await this.graphqlService.rawRequest(LIST_DOCUMENTS_QUERY, {
62
66
  first: options?.first ?? 50,
63
67
  filter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enrichlayer/el-linear",
3
- "version": "1.38.1",
3
+ "version": "1.38.2",
4
4
  "description": "A pragmatic CLI for Linear.app — deterministic team/label/member resolution, structured issue validation, configurable term enforcement, and a GraphQL escape hatch.",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",