@cvr/linear 0.5.0 → 0.5.1

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 CHANGED
@@ -145,7 +145,7 @@ Built with:
145
145
 
146
146
  - **[Bun](https://bun.sh)**: Fast JavaScript runtime with native compilation
147
147
  - **[Effect](https://effect.website)**: TypeScript library for type-safe, composable code
148
- - **[Effect CLI](https://github.com/Effect-TS/effect/tree/main/packages/effect/src/unstable/cli)**: CLI framework with prompts and argument parsing
148
+ - **[Effect CLI](https://github.com/Effect-TS/effect/tree/main/packages/effect/src/cli)**: CLI framework with prompts and argument parsing
149
149
  - **[@linear/sdk](https://github.com/linear/linear)**: Official Linear GraphQL SDK
150
150
 
151
151
  ## Credits
package/bin/linear CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/linear
3
- size: 84186592 bytes
4
- sha256: d2e8660ed2ec348271c4ec15f498e46fda5ea587ecc1ed7235a309446af2d2c8
3
+ size: 83912160 bytes
4
+ sha256: 128240f654731526d32f5ed7b9e5d23650f7dfe5308684ec93e5cebb16b9757f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cvr/linear",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cevr/linear-cli.git"
@@ -34,17 +34,17 @@
34
34
  "release": "changeset publish"
35
35
  },
36
36
  "dependencies": {
37
- "@effect/platform-bun": "4.0.0-beta.98",
37
+ "@effect/platform-bun": "4.0.0",
38
38
  "@linear/sdk": "^88.2.0",
39
- "effect": "4.0.0-beta.98",
39
+ "effect": "4.0.0",
40
40
  "graphql": "^17.0.2",
41
41
  "toml": "^5.0.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@changesets/changelog-github": "^1.0.1",
45
45
  "@changesets/cli": "^3.0.3",
46
- "@effect/tsgo": "^0.23.0",
47
- "@effect/vitest": "4.0.0-beta.98",
46
+ "@effect/tsgo": "^0.47.2",
47
+ "@effect/vitest": "4.0.0",
48
48
  "@types/bun": "^1.3.14",
49
49
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
50
50
  "concurrently": "^10.0.3",
package/src/cli.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Command } from "effect/unstable/cli";
1
+ import { Command } from "effect/cli";
2
2
  import packageJson from "../package.json" with { type: "json" };
3
3
  import { api } from "./commands/api.js";
4
4
  import { auth } from "./commands/auth.js";
@@ -1,27 +1,28 @@
1
1
  import { Console, Effect, FileSystem, Option, Path, Schema } from "effect";
2
- import { Command, Flag } from "effect/unstable/cli";
2
+ import { Command, Flag } from "effect/cli";
3
3
  import { Kind } from "graphql/language/kinds.js";
4
4
  import { parse } from "graphql/language/parser.js";
5
5
  import { InvalidInputError } from "../lib/errors.js";
6
6
  import { encodeJson } from "../lib/json.js";
7
7
  import { LinearService } from "../services/Linear.js";
8
8
 
9
- const queryOption = Flag.string("query").pipe(
9
+ const queryOption = Flag.String("query").pipe(
10
10
  Flag.withDescription("GraphQL document"),
11
11
  Flag.optional,
12
12
  );
13
13
 
14
- const queryFileOption = Flag.string("query-file").pipe(
14
+ const queryFileOption = Flag.String("query-file").pipe(
15
15
  Flag.withDescription("Read the GraphQL document from a file"),
16
16
  Flag.optional,
17
17
  );
18
18
 
19
- const variablesOption = Flag.string("variables").pipe(
19
+ const variablesOption = Flag.String("variables").pipe(
20
20
  Flag.withDescription("GraphQL variables as a JSON object"),
21
21
  Flag.withDefault("{}"),
22
22
  );
23
23
 
24
- const allowMutationOption = Flag.boolean("allow-mutation").pipe(
24
+ const allowMutationOption = Flag.Boolean("allow-mutation").pipe(
25
+ Flag.withDefault(false),
25
26
  Flag.withDescription("Explicitly authorize a raw GraphQL mutation"),
26
27
  );
27
28
 
@@ -1,5 +1,5 @@
1
- import { Command, Prompt } from "effect/unstable/cli";
2
- import { ChildProcess } from "effect/unstable/process";
1
+ import { Command, Prompt } from "effect/cli";
2
+ import { ChildProcess } from "effect/process";
3
3
  import { Console, Effect } from "effect";
4
4
  import { jsonFlag } from "../lib/flags.js";
5
5
  import { encodeJson } from "../lib/json.js";
@@ -27,7 +27,7 @@ export const authCommand = Command.make("auth", {}, () =>
27
27
  yield* Console.log(`Could not open browser. Please visit the URL manually.`);
28
28
  }
29
29
 
30
- const token = yield* Prompt.hidden({ message: "Paste your API key" });
30
+ const token = yield* Prompt.Hidden({ message: "Paste your API key" });
31
31
 
32
32
  // Validate token by making an API call
33
33
  yield* Console.log("\nValidating token...");
@@ -1,4 +1,4 @@
1
- import { Argument, Command } from "effect/unstable/cli";
1
+ import { Argument, Command } from "effect/cli";
2
2
  import { Console, Effect } from "effect";
3
3
  import type { SavedFile } from "../domain/Linear.js";
4
4
  import { parseUploadUrl } from "../domain/Input.js";
@@ -7,7 +7,7 @@ import { InvalidInputError } from "../lib/errors.js";
7
7
  import { jsonFlag, outputDirFlag, overwriteFlag } from "../lib/flags.js";
8
8
  import { encodeJson } from "../lib/json.js";
9
9
 
10
- const uploadUrlsArg = Argument.string("url").pipe(
10
+ const uploadUrlsArg = Argument.String("url").pipe(
11
11
  Argument.withDescription("https://uploads.linear.app/... URL (repeat for several files)"),
12
12
  Argument.variadic(),
13
13
  );
@@ -1,4 +1,4 @@
1
- import { Argument, Command, Flag, Prompt } from "effect/unstable/cli";
1
+ import { Argument, Command, Flag, Prompt } from "effect/cli";
2
2
  import { Console, Effect, Option } from "effect";
3
3
  import type { IssueDetails } from "../domain/Linear.js";
4
4
  import { extractUploadLinks, uniqueByUrl } from "../domain/Files.js";
@@ -13,70 +13,77 @@ import { LinearService } from "../services/Linear.js";
13
13
  import { ConfigService } from "../services/Config.js";
14
14
 
15
15
  // Options
16
- const stateOption = Flag.string("state").pipe(
16
+ const stateOption = Flag.String("state").pipe(
17
17
  Flag.withAlias("s"),
18
18
  Flag.withDescription("Filter by state type (started, unstarted, backlog, etc.)"),
19
19
  Flag.optional,
20
20
  );
21
21
 
22
- const limitOption = Flag.integer("limit").pipe(
22
+ const limitOption = Flag.Int("limit").pipe(
23
23
  Flag.withAlias("n"),
24
24
  Flag.withDefault(20),
25
25
  Flag.withDescription("Number of issues to show"),
26
26
  );
27
27
 
28
- const commentsOption = Flag.boolean("comments").pipe(
28
+ const commentsOption = Flag.Boolean("comments").pipe(
29
+ Flag.withDefault(false),
29
30
  Flag.withDescription("Include issue comments"),
30
31
  );
31
32
 
32
- const childrenOption = Flag.boolean("children").pipe(Flag.withDescription("Include sub-issues"));
33
+ const childrenOption = Flag.Boolean("children").pipe(
34
+ Flag.withDefault(false),
35
+ Flag.withDescription("Include sub-issues"),
36
+ );
33
37
 
34
- const relationsOption = Flag.boolean("relations").pipe(
38
+ const relationsOption = Flag.Boolean("relations").pipe(
39
+ Flag.withDefault(false),
35
40
  Flag.withDescription("Include inbound and outbound issue relations"),
36
41
  );
37
42
 
38
- const titleOption = Flag.string("title").pipe(
43
+ const titleOption = Flag.String("title").pipe(
39
44
  Flag.withDescription("Issue title; enables non-interactive creation"),
40
45
  Flag.optional,
41
46
  );
42
47
 
43
- const descriptionOption = Flag.string("description").pipe(
48
+ const descriptionOption = Flag.String("description").pipe(
44
49
  Flag.withDescription("Issue description in Markdown"),
45
50
  Flag.optional,
46
51
  );
47
52
 
48
- const teamOption = Flag.string("team").pipe(
53
+ const teamOption = Flag.String("team").pipe(
49
54
  Flag.withDescription("Team key or UUID"),
50
55
  Flag.optional,
51
56
  );
52
57
 
53
- const parentOption = Flag.string("parent").pipe(
58
+ const parentOption = Flag.String("parent").pipe(
54
59
  Flag.withDescription("Parent issue identifier or UUID"),
55
60
  Flag.optional,
56
61
  );
57
62
 
58
- const projectOption = Flag.string("project").pipe(
63
+ const projectOption = Flag.String("project").pipe(
59
64
  Flag.withDescription("Project name, slug, or UUID"),
60
65
  Flag.optional,
61
66
  );
62
67
 
63
- const priorityOption = Flag.integer("priority").pipe(
68
+ const priorityOption = Flag.Int("priority").pipe(
64
69
  Flag.withDescription("Priority from 0 (none) to 4 (low)"),
65
70
  Flag.optional,
66
71
  );
67
72
 
68
- const dryRunOption = Flag.boolean("dry-run").pipe(
73
+ const dryRunOption = Flag.Boolean("dry-run").pipe(
74
+ Flag.withDefault(false),
69
75
  Flag.withDescription("Validate and print the mutation without writing"),
70
76
  );
71
77
 
72
- const interactiveOption = Flag.boolean("interactive").pipe(
78
+ const interactiveOption = Flag.Boolean("interactive").pipe(
79
+ Flag.withDefault(false),
73
80
  Flag.withDescription("Allow prompts when required input is missing"),
74
81
  );
75
82
 
76
- const bodyOption = Flag.string("body").pipe(Flag.withDescription("Comment body in Markdown"));
83
+ const bodyOption = Flag.String("body").pipe(Flag.withDescription("Comment body in Markdown"));
77
84
 
78
85
  // Args
79
- const issueIdsArg = Argument.string("id").pipe(
86
+ const issueIdsArg = Argument.String("id").pipe(
80
87
  Argument.withDescription("Issue ID, URL, or identifier (repeat for bulk reads)"),
81
88
  Argument.variadic(),
82
89
  );
@@ -187,7 +194,7 @@ export const issueViewCommand = Command.make(
187
194
  );
188
195
 
189
196
  // linear issue start [id] - Start working on an issue
190
- const optionalIssueIdArg = Argument.string("id").pipe(
197
+ const optionalIssueIdArg = Argument.String("id").pipe(
191
198
  Argument.withDescription("Issue ID, URL, or identifier"),
192
199
  Argument.optional,
193
200
  );
@@ -291,13 +298,13 @@ export const issueCreateCommand = Command.make(
291
298
  const requestedTeam = Option.getOrUndefined(team) ?? linearConfig.teamId;
292
299
  const teamId = yield* resolveTeamId(teams, requestedTeam, isInteractive);
293
300
  const issueTitle = yield* Option.match(title, {
294
- onNone: () => Prompt.text({ message: "Issue title" }),
301
+ onNone: () => Prompt.String({ message: "Issue title" }),
295
302
  onSome: Effect.succeed,
296
303
  });
297
304
  const issueDescription = yield* Option.match(description, {
298
305
  onNone: () => {
299
306
  if (isInteractive) {
300
- return Prompt.text({
307
+ return Prompt.String({
301
308
  message: "Description (optional, press Enter to skip)",
302
309
  default: "",
303
310
  });
@@ -374,7 +381,7 @@ export const issueCreateCommand = Command.make(
374
381
  export const issueCommentCommand = Command.make(
375
382
  "comment",
376
383
  {
377
- id: Argument.string("id").pipe(Argument.withDescription("Issue ID, URL, or identifier")),
384
+ id: Argument.String("id").pipe(Argument.withDescription("Issue ID, URL, or identifier")),
378
385
  body: bodyOption,
379
386
  dryRun: dryRunOption,
380
387
  json: jsonFlag,
@@ -420,7 +427,8 @@ export const issueCommentCommand = Command.make(
420
427
  ]),
421
428
  );
422
429
 
423
- const downloadOption = Flag.boolean("download").pipe(
430
+ const downloadOption = Flag.Boolean("download").pipe(
431
+ Flag.withDefault(false),
424
432
  Flag.withDescription("Save every listed file into --output-dir"),
425
433
  );
426
434
 
@@ -428,7 +436,7 @@ const downloadOption = Flag.boolean("download").pipe(
428
436
  export const issueFilesCommand = Command.make(
429
437
  "files",
430
438
  {
431
- id: Argument.string("id").pipe(Argument.withDescription("Issue ID, URL, or identifier")),
439
+ id: Argument.String("id").pipe(Argument.withDescription("Issue ID, URL, or identifier")),
432
440
  download: downloadOption,
433
441
  outputDir: outputDirFlag,
434
442
  overwrite: overwriteFlag,
@@ -517,7 +525,7 @@ const selectIssue = Effect.gen(function* () {
517
525
  description: candidate.state?.name ?? "Unknown state",
518
526
  }));
519
527
 
520
- const selected = yield* Prompt.select({
528
+ const selected = yield* Prompt.Select({
521
529
  message: "Select an issue",
522
530
  choices,
523
531
  });
@@ -570,7 +578,7 @@ const renderIssueDetails = Effect.fn("IssueCommand.renderDetails")(function* (
570
578
  });
571
579
 
572
580
  function selectTeam(teams: readonly { id: string; key: string; name: string }[]) {
573
- return Prompt.select({
581
+ return Prompt.Select({
574
582
  message: "Select a team",
575
583
  choices: teams.map((team) => ({
576
584
  title: `${team.key}: ${team.name}`,
@@ -1,5 +1,5 @@
1
1
  import { Console, Effect } from "effect";
2
- import { Command } from "effect/unstable/cli";
2
+ import { Command } from "effect/cli";
3
3
  import { jsonFlag } from "../lib/flags.js";
4
4
  import { encodeJson } from "../lib/json.js";
5
5
  import { LinearService } from "../services/Linear.js";
@@ -1,4 +1,4 @@
1
- import { Command } from "effect/unstable/cli";
1
+ import { Command } from "effect/cli";
2
2
  import { Console, Effect } from "effect";
3
3
  import { jsonFlag } from "../lib/flags.js";
4
4
  import { encodeJson } from "../lib/json.js";
package/src/lib/errors.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- export class ConfigError extends Schema.TaggedErrorClass<ConfigError>()("ConfigError", {
3
+ export class ConfigError extends Schema.TaggedError<ConfigError>()("ConfigError", {
4
4
  message: Schema.String,
5
5
  }) {}
6
6
 
7
- export class LinearApiError extends Schema.TaggedErrorClass<LinearApiError>()("LinearApiError", {
7
+ export class LinearApiError extends Schema.TaggedError<LinearApiError>()("LinearApiError", {
8
8
  message: Schema.String,
9
9
  code: Schema.optional(Schema.String),
10
10
  }) {}
11
11
 
12
- export class TokenNotFoundError extends Schema.TaggedErrorClass<TokenNotFoundError>()(
12
+ export class TokenNotFoundError extends Schema.TaggedError<TokenNotFoundError>()(
13
13
  "TokenNotFoundError",
14
14
  {
15
15
  message: Schema.String,
@@ -20,26 +20,26 @@ export class TokenNotFoundError extends Schema.TaggedErrorClass<TokenNotFoundErr
20
20
  });
21
21
  }
22
22
 
23
- export class InvalidTokenError extends Schema.TaggedErrorClass<InvalidTokenError>()(
23
+ export class InvalidTokenError extends Schema.TaggedError<InvalidTokenError>()(
24
24
  "InvalidTokenError",
25
25
  {
26
26
  message: Schema.String,
27
27
  },
28
28
  ) {}
29
29
 
30
- export class NoIssuesError extends Schema.TaggedErrorClass<NoIssuesError>()("NoIssuesError", {
30
+ export class NoIssuesError extends Schema.TaggedError<NoIssuesError>()("NoIssuesError", {
31
31
  message: Schema.String,
32
32
  }) {
33
33
  static readonly default = NoIssuesError.make({ message: "No issues found to select from." });
34
34
  }
35
35
 
36
- export class InvalidInputError extends Schema.TaggedErrorClass<InvalidInputError>()(
36
+ export class InvalidInputError extends Schema.TaggedError<InvalidInputError>()(
37
37
  "InvalidInputError",
38
38
  {
39
39
  message: Schema.String,
40
40
  },
41
41
  ) {}
42
42
 
43
- export class FileWriteError extends Schema.TaggedErrorClass<FileWriteError>()("FileWriteError", {
43
+ export class FileWriteError extends Schema.TaggedError<FileWriteError>()("FileWriteError", {
44
44
  message: Schema.String,
45
45
  }) {}
package/src/lib/flags.ts CHANGED
@@ -1,15 +1,17 @@
1
- import { Flag } from "effect/unstable/cli";
1
+ import { Flag } from "effect/cli";
2
2
 
3
- export const jsonFlag = Flag.boolean("json").pipe(
3
+ export const jsonFlag = Flag.Boolean("json").pipe(
4
+ Flag.withDefault(false),
4
5
  Flag.withDescription("Emit stable JSON for scripts and agents"),
5
6
  );
6
7
 
7
- export const outputDirFlag = Flag.string("output-dir").pipe(
8
+ export const outputDirFlag = Flag.String("output-dir").pipe(
8
9
  Flag.withAlias("o"),
9
10
  Flag.withDefault("."),
10
11
  Flag.withDescription("Directory to save files in; created when missing"),
11
12
  );
12
13
 
13
- export const overwriteFlag = Flag.boolean("overwrite").pipe(
14
+ export const overwriteFlag = Flag.Boolean("overwrite").pipe(
15
+ Flag.withDefault(false),
14
16
  Flag.withDescription("Replace files that already exist in the output directory"),
15
17
  );
package/src/main.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Command } from "effect/unstable/cli";
1
+ import { Command } from "effect/cli";
2
2
  import { BunRuntime, BunServices } from "@effect/platform-bun";
3
3
  import { Console, Effect, Layer } from "effect";
4
4
  import packageJson from "../package.json" with { type: "json" };
@@ -23,8 +23,8 @@ export class ConfigService extends Context.Service<
23
23
  Effect.gen(function* () {
24
24
  const fs = yield* FileSystem.FileSystem;
25
25
  const path = yield* Path.Path;
26
- const homeDir = yield* Config.string("HOME").pipe(Config.withDefault(""));
27
- const envToken = yield* Config.redacted("LINEAR_API_KEY").pipe(Config.option);
26
+ const homeDir = yield* Config.String("HOME").pipe(Config.withDefault(""));
27
+ const envToken = yield* Config.Redacted("LINEAR_API_KEY").pipe(Config.option);
28
28
  const configDir = path.join(homeDir, ".config", "linear");
29
29
  const tokenPath = path.join(configDir, "token");
30
30
  const configPath = path.join(configDir, "config.toml");
@@ -98,7 +98,7 @@ const readTokenFile = (
98
98
  ),
99
99
  Effect.flatMap((exists) => {
100
100
  if (!exists) {
101
- return Effect.succeed(Option.none());
101
+ return Effect.succeedNone;
102
102
  }
103
103
  return fs.readFileString(tokenPath).pipe(
104
104
  Effect.mapError((error) =>
package/tsconfig.json CHANGED
@@ -49,8 +49,10 @@
49
49
  "processEnv": "off",
50
50
  "processEnvInEffect": "off",
51
51
  "deterministicKeys": "error",
52
- "importFromBarrel": "warning",
53
52
  "instanceOfSchema": "warning",
53
+ // Effect 4.0.0 marks the whole effect/cli module @stability unstable. This CLI is
54
+ // built on it, so the rule would flag every command, flag, and prompt definition.
55
+ "unstableApiUsage": "off",
54
56
  "missedPipeableOpportunity": "suggestion",
55
57
  "missingEffectServiceDependency": "warning",
56
58
  "schemaUnionOfLiterals": "warning",