@enrichlayer/el-linear 1.9.0 → 1.10.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/README.md +13 -0
- package/dist/commands/attachments.js +2 -1
- package/dist/commands/comments.js +17 -28
- package/dist/commands/cycles.js +2 -1
- package/dist/commands/documents.js +2 -1
- package/dist/commands/graphql.js +4 -6
- package/dist/commands/issue-id.js +1 -3
- package/dist/commands/issues/description.js +2 -6
- package/dist/commands/issues/link-references.d.ts +21 -0
- package/dist/commands/issues/link-references.js +171 -0
- package/dist/commands/issues/relations.d.ts +55 -0
- package/dist/commands/issues/relations.js +132 -0
- package/dist/commands/issues.js +65 -284
- package/dist/commands/labels.js +13 -23
- package/dist/commands/project-milestones.js +13 -20
- package/dist/commands/projects.js +67 -38
- package/dist/commands/refs.js +8 -0
- package/dist/commands/releases.js +26 -30
- package/dist/commands/search.js +21 -30
- package/dist/commands/teams.js +2 -1
- package/dist/commands/templates.js +9 -14
- package/dist/commands/users.js +2 -1
- package/dist/config/resolver.js +2 -3
- package/dist/queries/attachments-types.d.ts +30 -0
- package/dist/queries/attachments-types.js +5 -0
- package/dist/queries/comments-types.d.ts +49 -0
- package/dist/queries/comments-types.js +5 -0
- package/dist/queries/documents-types.d.ts +61 -0
- package/dist/queries/documents-types.js +9 -0
- package/dist/queries/introspect-types.d.ts +57 -0
- package/dist/queries/introspect-types.js +10 -0
- package/dist/queries/issues-types.d.ts +416 -0
- package/dist/queries/issues-types.js +23 -0
- package/dist/queries/issues.d.ts +2 -0
- package/dist/queries/issues.js +22 -0
- package/dist/queries/labels-types.d.ts +64 -0
- package/dist/queries/labels-types.js +5 -0
- package/dist/queries/project-milestones-types.d.ts +91 -0
- package/dist/queries/project-milestones-types.js +10 -0
- package/dist/queries/projects-types.d.ts +75 -0
- package/dist/queries/projects-types.js +5 -0
- package/dist/queries/projects.d.ts +2 -0
- package/dist/queries/projects.js +22 -0
- package/dist/queries/releases-types.d.ts +84 -0
- package/dist/queries/releases-types.js +5 -0
- package/dist/queries/search-types.d.ts +86 -0
- package/dist/queries/search-types.js +6 -0
- package/dist/queries/templates-types.d.ts +61 -0
- package/dist/queries/templates-types.js +9 -0
- package/dist/types/linear.d.ts +8 -2
- package/dist/utils/auto-link-references.js +29 -24
- package/dist/utils/graphql-attachments-service.js +6 -9
- package/dist/utils/graphql-documents-service.js +19 -25
- package/dist/utils/graphql-issues-service.d.ts +12 -2
- package/dist/utils/graphql-issues-service.js +151 -172
- package/dist/utils/output.d.ts +2 -0
- package/dist/utils/output.js +16 -6
- package/dist/utils/workspace-url.d.ts +5 -1
- package/dist/utils/workspace-url.js +35 -5
- package/package.json +1 -1
|
@@ -4,11 +4,20 @@ import { loadConfig } from "../config/config.js";
|
|
|
4
4
|
* issue URLs). Used to build canonical markdown link URLs like
|
|
5
5
|
* `https://linear.app/<urlKey>/issue/<identifier>/`.
|
|
6
6
|
*
|
|
7
|
-
* Resolution order:
|
|
8
|
-
* 1. `config.workspaceUrlKey` if explicitly set in el-linear config
|
|
9
|
-
* 2. `viewer.organization.urlKey` from the Linear API (fetched once, cached)
|
|
7
|
+
* Resolution order (highest priority first):
|
|
10
8
|
*
|
|
11
|
-
*
|
|
9
|
+
* 1. `options.override` — typically wired from a `--workspace-url-key` CLI flag
|
|
10
|
+
* (per-invocation, wins over everything).
|
|
11
|
+
* 2. `EL_LINEAR_WORKSPACE_URL_KEY` env var.
|
|
12
|
+
* 3. `config.workspaceUrlKey` from `~/.config/el-linear/config.json`.
|
|
13
|
+
* 4. Live `viewer.organization.urlKey` GraphQL query (cached in-process).
|
|
14
|
+
*
|
|
15
|
+
* Layers 1–3 short-circuit without touching the network — this makes
|
|
16
|
+
* `el-linear refs wrap --no-validate` work offline once any one of them
|
|
17
|
+
* is set. Layer 4 is the original behavior preserved as a fallback.
|
|
18
|
+
*
|
|
19
|
+
* The graphQLService is only needed for layer 4 — pass `undefined` (or omit it)
|
|
20
|
+
* when the caller knows the network will not be used.
|
|
12
21
|
*/
|
|
13
22
|
const VIEWER_ORG_URL_KEY_QUERY = /* GraphQL */ `
|
|
14
23
|
query ViewerOrgUrlKey {
|
|
@@ -19,16 +28,37 @@ const VIEWER_ORG_URL_KEY_QUERY = /* GraphQL */ `
|
|
|
19
28
|
}
|
|
20
29
|
}
|
|
21
30
|
`;
|
|
31
|
+
const WORKSPACE_URL_KEY_ENV = "EL_LINEAR_WORKSPACE_URL_KEY";
|
|
22
32
|
let cachedUrlKey;
|
|
23
|
-
export async function getWorkspaceUrlKey(graphQLService) {
|
|
33
|
+
export async function getWorkspaceUrlKey(graphQLService, options = {}) {
|
|
34
|
+
// 1. Per-invocation override — highest priority.
|
|
35
|
+
if (options.override) {
|
|
36
|
+
return options.override;
|
|
37
|
+
}
|
|
38
|
+
// 2. Env var. Read on every call (cheap; lets tests/CI flip the value
|
|
39
|
+
// mid-process without restarting). Not cached, so a test that sets
|
|
40
|
+
// EL_LINEAR_WORKSPACE_URL_KEY then unsets it sees the unset state.
|
|
41
|
+
const envKey = process.env[WORKSPACE_URL_KEY_ENV];
|
|
42
|
+
if (envKey) {
|
|
43
|
+
return envKey;
|
|
44
|
+
}
|
|
45
|
+
// Layers 3-4 are cached in-process — config and the live lookup are
|
|
46
|
+
// both stable for the CLI invocation's lifetime.
|
|
24
47
|
if (cachedUrlKey) {
|
|
25
48
|
return cachedUrlKey;
|
|
26
49
|
}
|
|
50
|
+
// 3. Config override.
|
|
27
51
|
const { workspaceUrlKey } = loadConfig();
|
|
28
52
|
if (workspaceUrlKey) {
|
|
29
53
|
cachedUrlKey = workspaceUrlKey;
|
|
30
54
|
return workspaceUrlKey;
|
|
31
55
|
}
|
|
56
|
+
// 4. Live API lookup — requires a GraphQL service.
|
|
57
|
+
if (!graphQLService) {
|
|
58
|
+
throw new Error("Could not resolve Linear workspace URL key — no override, env, or config set, " +
|
|
59
|
+
"and no GraphQL service was provided for the live lookup. " +
|
|
60
|
+
`Set \`workspaceUrlKey\` in your el-linear config, or \`${WORKSPACE_URL_KEY_ENV}\` in the environment.`);
|
|
61
|
+
}
|
|
32
62
|
const data = await graphQLService.rawRequest(VIEWER_ORG_URL_KEY_QUERY);
|
|
33
63
|
const fetched = data?.viewer?.organization?.urlKey;
|
|
34
64
|
if (!fetched) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enrichlayer/el-linear",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
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",
|