linear-sdk-cli 0.5.3 → 0.7.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/CHANGELOG.md +17 -0
- package/README.md +10 -1
- package/package.json +1 -1
- package/skills/linear-sdk-cli/SKILL.md +29 -0
- package/skills/linear-sdk-cli/references/auth.md +4 -0
- package/skills/linear-sdk-cli/references/changelog.md +24 -0
- package/skills/linear-sdk-cli/references/project-label.md +170 -0
- package/skills/linear-sdk-cli/references/project-status.md +158 -0
- package/skills/linear-sdk-cli/references/project.md +35 -35
- package/skills/linear-sdk-cli/references/whoami.md +1 -0
- package/src/cli.ts +6 -0
- package/src/commands/changelog.ts +108 -0
- package/src/commands/meta.ts +18 -8
- package/src/commands/project-label.ts +144 -0
- package/src/commands/project-status.ts +166 -0
- package/src/commands/project.ts +10 -2
- package/src/lib/action.ts +7 -2
- package/src/lib/authorization.ts +91 -0
- package/src/lib/errors.ts +11 -2
- package/src/lib/options.ts +11 -1
- package/src/lib/output-shapes.ts +49 -0
- package/src/lib/resolve.ts +24 -7
- package/src/output/format.ts +1 -0
- package/src/services/project-label.ts +238 -0
- package/src/services/project-status.ts +225 -0
- package/src/services/project.ts +5 -25
package/src/services/project.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
resolveProjectLabelIds,
|
|
24
24
|
isUuid,
|
|
25
25
|
} from "../lib/resolve.js";
|
|
26
|
+
import { resolveProjectStatusId } from "./project-status.js";
|
|
26
27
|
|
|
27
28
|
export interface ProjectRow {
|
|
28
29
|
id: string;
|
|
@@ -291,7 +292,8 @@ export async function createProject(
|
|
|
291
292
|
const input: Record<string, any> = { name: opts.name, teamIds };
|
|
292
293
|
if (opts.description !== undefined) input.description = opts.description;
|
|
293
294
|
if (opts.content !== undefined) input.content = opts.content;
|
|
294
|
-
if (opts.state)
|
|
295
|
+
if (opts.state)
|
|
296
|
+
input.statusId = await resolveProjectStatusId(client, opts.state, { allowType: true });
|
|
295
297
|
if (opts.lead) input.leadId = await resolveUserId(client, opts.lead);
|
|
296
298
|
if (opts.startDate) input.startDate = opts.startDate;
|
|
297
299
|
if (opts.targetDate) input.targetDate = opts.targetDate;
|
|
@@ -335,7 +337,8 @@ export async function updateProject(client: LinearClient, idArg: string, opts: U
|
|
|
335
337
|
if (opts.content !== undefined) input.content = opts.content;
|
|
336
338
|
if (opts.team?.length) input.teamIds = await resolveTeamIds(client, opts.team, undefined);
|
|
337
339
|
if (opts.lead) input.leadId = await resolveUserId(client, opts.lead);
|
|
338
|
-
if (opts.state)
|
|
340
|
+
if (opts.state)
|
|
341
|
+
input.statusId = await resolveProjectStatusId(client, opts.state, { allowType: true });
|
|
339
342
|
if (opts.startDate) input.startDate = opts.startDate;
|
|
340
343
|
if (opts.targetDate) input.targetDate = opts.targetDate;
|
|
341
344
|
if (opts.priority !== undefined) input.priority = resolvePriority(opts.priority);
|
|
@@ -480,26 +483,3 @@ async function resolveTeamIds(
|
|
|
480
483
|
}
|
|
481
484
|
return ids;
|
|
482
485
|
}
|
|
483
|
-
|
|
484
|
-
/** Resolve a project status (by name or type) to a status id. */
|
|
485
|
-
async function resolveStatusId(client: LinearClient, input: string): Promise<string> {
|
|
486
|
-
if (isUuid(input)) return input;
|
|
487
|
-
const conn = await withRetry(() => client.projectStatuses({ first: 250 }));
|
|
488
|
-
const statuses = (await collect(conn as any, Infinity)) as Array<{
|
|
489
|
-
id: string;
|
|
490
|
-
name: string;
|
|
491
|
-
type: string;
|
|
492
|
-
}>;
|
|
493
|
-
const lower = input.toLowerCase();
|
|
494
|
-
const byName = statuses.filter((s) => s.name.toLowerCase() === lower);
|
|
495
|
-
const matches = byName.length ? byName : statuses.filter((s) => s.type.toLowerCase() === lower);
|
|
496
|
-
if (matches.length === 0)
|
|
497
|
-
throw notFound(
|
|
498
|
-
`No project status '${input}'. Available: ${statuses.map((s) => s.name).join(", ")}`,
|
|
499
|
-
);
|
|
500
|
-
if (matches.length > 1)
|
|
501
|
-
throw ambiguous(
|
|
502
|
-
`Multiple project statuses match '${input}': ${matches.map((s) => s.name).join(", ")}`,
|
|
503
|
-
);
|
|
504
|
-
return matches[0]!.id;
|
|
505
|
-
}
|