@enrichlayer/el-linear 1.41.1 → 1.42.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/dist/config/config.d.ts +25 -0
- package/dist/config/config.js +15 -0
- package/dist/config/identity-resolver.d.ts +40 -0
- package/dist/config/identity-resolver.js +253 -0
- package/dist/config/resolver.d.ts +22 -7
- package/dist/config/resolver.js +31 -7
- package/dist/utils/graphql-issues-service.js +11 -3
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
|
@@ -36,6 +36,31 @@ export interface ElLinearConfig {
|
|
|
36
36
|
};
|
|
37
37
|
teamAliases: Record<string, string>;
|
|
38
38
|
teams: Record<string, string>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional identity-resolver hook (DEV-5628). `resolver` is an argv array —
|
|
41
|
+
* el-linear appends the identifier as the final element and reads a Linear
|
|
42
|
+
* user UUID off stdout:
|
|
43
|
+
*
|
|
44
|
+
* "identity": { "resolver": ["el-identity", "resolve"] }
|
|
45
|
+
*
|
|
46
|
+
* Use it when your org has a people registry that knows things Linear does
|
|
47
|
+
* not (that `jd` is a person; that a GitLab handle and a Linear handle are one human).
|
|
48
|
+
*
|
|
49
|
+
* It is a COMMAND rather than a URL + credentials on purpose: el-linear is
|
|
50
|
+
* MIT and most installs are not ours, so it must not bake in anybody's auth
|
|
51
|
+
* scheme. The credential lives entirely inside whatever you point this at —
|
|
52
|
+
* Vault, Infisical, 1Password, a plain env var, SSO. Adding a backend is
|
|
53
|
+
* writing a different script, not patching this package.
|
|
54
|
+
*
|
|
55
|
+
* Entirely optional and fail-open: unconfigured, or on any failure,
|
|
56
|
+
* resolution falls through to Linear's own user lookup exactly as before.
|
|
57
|
+
* See `identity-resolver.ts` for the output contract.
|
|
58
|
+
*/
|
|
59
|
+
identity?: {
|
|
60
|
+
resolver?: string[];
|
|
61
|
+
/** Milliseconds before the resolver is treated as a miss (default 8000). */
|
|
62
|
+
resolverTimeoutMs?: number;
|
|
63
|
+
};
|
|
39
64
|
/**
|
|
40
65
|
* Term-enforcement rules. Each rule has a canonical form and a list of
|
|
41
66
|
* rejected forms; rejected forms in issue titles/descriptions are flagged
|
package/dist/config/config.js
CHANGED
|
@@ -139,6 +139,21 @@ export function loadConfig() {
|
|
|
139
139
|
: {};
|
|
140
140
|
// teamConfigPath inside a team config file would be circular; strip it.
|
|
141
141
|
delete teamRaw.teamConfigPath;
|
|
142
|
+
// `identity.resolver` names a BINARY el-linear will spawn. The team layer is
|
|
143
|
+
// data, not code: it arrives from a different repository via `git pull` (or,
|
|
144
|
+
// for an OSS user, from whatever repo they pointed `teamConfigPath` at), and
|
|
145
|
+
// nobody reviews a config file expecting it to hand them a subprocess. Letting
|
|
146
|
+
// it choose the executable would turn "clone this repo and run el-linear" into
|
|
147
|
+
// arbitrary code execution on every `--assignee` resolution.
|
|
148
|
+
//
|
|
149
|
+
// So the resolver is honored ONLY from the personal config (or the env var) —
|
|
150
|
+
// files the operator owns. Same reasoning as teamConfigPath above, which is
|
|
151
|
+
// stripped for the same "the team layer doesn't get to decide this" reason.
|
|
152
|
+
//
|
|
153
|
+
// An organization that wants to ship a resolver to its developers writes it
|
|
154
|
+
// into their personal config at setup time; that keeps the decision with the
|
|
155
|
+
// machine's owner instead of with whoever can land a commit upstream.
|
|
156
|
+
delete teamRaw.identity;
|
|
142
157
|
// Merge order: defaults → team config → personal config.
|
|
143
158
|
// Arrays (terms, defaultLabels, etc.) are concatenated so personal entries
|
|
144
159
|
// extend team entries rather than replace them.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ElLinearConfig } from "./config.js";
|
|
2
|
+
/** Test seam — the memo would otherwise leak between cases in one vitest process. */
|
|
3
|
+
export declare function clearResolverMemoForTests(): void;
|
|
4
|
+
/**
|
|
5
|
+
* The configured resolver argv, or `null` when the hook is off.
|
|
6
|
+
*
|
|
7
|
+
* Env wins over config so a single invocation can point at a different resolver
|
|
8
|
+
* (or disable one) without editing files: `EL_LINEAR_IDENTITY_RESOLVER=""` is an
|
|
9
|
+
* explicit off switch.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolverCommand(config: Pick<ElLinearConfig, "identity">, env?: NodeJS.ProcessEnv): string[] | null;
|
|
12
|
+
/** True when an identity resolver is configured (env or config). */
|
|
13
|
+
export declare function isResolverConfigured(config: Pick<ElLinearConfig, "identity">, env?: NodeJS.ProcessEnv): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Pull a Linear user UUID out of whatever the resolver printed.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately generous about the shape, because the point of this hook is that
|
|
18
|
+
* anyone can write the resolver — demanding one exact JSON envelope would make
|
|
19
|
+
* the "just shell out to your own script" promise a lie. Accepted:
|
|
20
|
+
*
|
|
21
|
+
* - a bare UUID: `3f2a…`
|
|
22
|
+
* - `{"linearId": "3f2a…"}` (the el-identity record shape)
|
|
23
|
+
* - `{"data": {"linearId": "…"}}` (an el-* CLI `{data, meta}` envelope)
|
|
24
|
+
* - `{"id": "3f2a…"}` (the obvious alternative spelling)
|
|
25
|
+
*
|
|
26
|
+
* Anything else — including a *non*-UUID string, which is the shape a confused
|
|
27
|
+
* resolver most plausibly emits — is a miss. We would rather fall through to
|
|
28
|
+
* Linear's own lookup than hand a bogus id to the API and produce an opaque
|
|
29
|
+
* "Argument Validation Error" (the DEV-4312 failure, in a new costume).
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseResolverOutput(stdout: string): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Run the configured resolver for `identifier`. Returns the Linear user UUID, or
|
|
34
|
+
* `null` on any miss/failure. Never throws.
|
|
35
|
+
*
|
|
36
|
+
* Synchronous (`spawnSync`) on purpose: resolution sits on the critical path of
|
|
37
|
+
* `--assignee` for a short-lived CLI, the callers are already `async` so nothing
|
|
38
|
+
* is starved, and it keeps the failure modes to exactly one place.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveViaCommand(identifier: string, config: Pick<ElLinearConfig, "identity">, env?: NodeJS.ProcessEnv): string | null;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Optional **identity resolver hook** (DEV-5628).
|
|
4
|
+
*
|
|
5
|
+
* Some organizations keep a people registry that knows things Linear does not:
|
|
6
|
+
* that `jd` is a person, that a GitLab handle and a Linear handle belong to the
|
|
7
|
+
* same human. el-linear can consult it — but it must never learn *how* to reach it.
|
|
8
|
+
*
|
|
9
|
+
* So the hook is a **command**, not an HTTP client:
|
|
10
|
+
*
|
|
11
|
+
* identity.resolver = ["el-identity", "resolve"]
|
|
12
|
+
*
|
|
13
|
+
* el-linear appends the identifier as the final argv element, runs the command,
|
|
14
|
+
* and reads a Linear user UUID off stdout. That is the entire contract.
|
|
15
|
+
*
|
|
16
|
+
* Why a command rather than a URL + credentials (which is what
|
|
17
|
+
* `registry-resolve.ts` does, and why that path stayed dormant): el-linear is
|
|
18
|
+
* MIT and published on npm. Most installs are not Enrich Layer. Baking in an
|
|
19
|
+
* auth scheme means baking in *somebody's* auth scheme — and the moment we did,
|
|
20
|
+
* the next organization would need Infisical, or 1Password, or a plain env var,
|
|
21
|
+
* or SSO. A command has no such problem: the credential lives entirely inside
|
|
22
|
+
* whatever the operator points this at. Adding a new secret backend is writing a
|
|
23
|
+
* different script, not patching this package.
|
|
24
|
+
*
|
|
25
|
+
* The command is trusted (the operator configured it) but the *identifier* is
|
|
26
|
+
* not, so it is passed as an argv element with `shell: false` — a name like
|
|
27
|
+
* `"; rm -rf /"` is an argument, never a command.
|
|
28
|
+
*
|
|
29
|
+
* Fail-open by design: unconfigured, a miss, a non-zero exit, a timeout, an
|
|
30
|
+
* unparseable answer, or a missing binary all return `null`, and the caller
|
|
31
|
+
* falls through to Linear's own user lookup (which resolves names and emails
|
|
32
|
+
* perfectly well — see `LinearService.resolveUserId`). This hook is an
|
|
33
|
+
* *enhancement*, so a broken resolver must degrade to plain el-linear rather
|
|
34
|
+
* than break every command. It never throws.
|
|
35
|
+
*/
|
|
36
|
+
/** Env override — a whitespace-separated command, e.g. `el-identity resolve`. */
|
|
37
|
+
const RESOLVER_ENV = "EL_LINEAR_IDENTITY_RESOLVER";
|
|
38
|
+
/** A resolver that hasn't answered in this long is not going to. */
|
|
39
|
+
const DEFAULT_TIMEOUT_MS = 8000;
|
|
40
|
+
/**
|
|
41
|
+
* Per-process memo. A single command can resolve the same person several times —
|
|
42
|
+
* `--subscriber a,b,a`, or an assignee who is also a subscriber — and each miss
|
|
43
|
+
* costs a full subprocess round-trip (seconds, against a network-backed
|
|
44
|
+
* resolver). Nothing here is cached across processes: el-linear is short-lived,
|
|
45
|
+
* and a stale identity cache on disk is exactly the drift this hook exists to
|
|
46
|
+
* remove.
|
|
47
|
+
*/
|
|
48
|
+
const memo = new Map();
|
|
49
|
+
/** Test seam — the memo would otherwise leak between cases in one vitest process. */
|
|
50
|
+
export function clearResolverMemoForTests() {
|
|
51
|
+
memo.clear();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolve the effective timeout.
|
|
55
|
+
*
|
|
56
|
+
* `?? DEFAULT` is not enough: Node treats `timeout <= 0` as *no timeout*, and `0`
|
|
57
|
+
* is the most natural thing to type when you mean "off". That would turn the
|
|
58
|
+
* documented fail-open contract into an unkillable hang inside a synchronous
|
|
59
|
+
* call — the one failure mode the surrounding try/catch cannot save you from.
|
|
60
|
+
*/
|
|
61
|
+
function resolveTimeoutMs(config) {
|
|
62
|
+
const configured = config.identity?.resolverTimeoutMs;
|
|
63
|
+
return typeof configured === "number" && configured > 0
|
|
64
|
+
? configured
|
|
65
|
+
: DEFAULT_TIMEOUT_MS;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The environment handed to the resolver.
|
|
69
|
+
*
|
|
70
|
+
* It inherits the ambient env on purpose — reaching its own secret backend
|
|
71
|
+
* (Vault, Infisical, 1Password, a plain env var) is the entire point, so
|
|
72
|
+
* scrubbing wholesale would defeat the design. But the resolver has no business
|
|
73
|
+
* with *Linear's* token: it resolves people, it never talks to Linear. Dropping
|
|
74
|
+
* it keeps the CLI's most sensitive secret out of the blast radius of a
|
|
75
|
+
* compromised — or merely over-logging — resolver.
|
|
76
|
+
*/
|
|
77
|
+
function resolverEnv(env) {
|
|
78
|
+
const { LINEAR_API_TOKEN: _dropped, ...rest } = env;
|
|
79
|
+
return rest;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Debug-gated diagnosis. Every failure here is a silent `null` by design, which
|
|
83
|
+
* is right for the user but miserable for the operator whose resolver is broken:
|
|
84
|
+
* all they see is an unexplained pause. `EL_LINEAR_DEBUG=1` is this repo's
|
|
85
|
+
* existing convention for "tell me what actually happened", and stderr never
|
|
86
|
+
* corrupts the JSON on stdout.
|
|
87
|
+
*/
|
|
88
|
+
function debugMiss(reason, env) {
|
|
89
|
+
if (!env.EL_LINEAR_DEBUG)
|
|
90
|
+
return;
|
|
91
|
+
process.stderr.write(`el-linear: identity resolver miss — ${reason}\n`);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The configured resolver argv, or `null` when the hook is off.
|
|
95
|
+
*
|
|
96
|
+
* Env wins over config so a single invocation can point at a different resolver
|
|
97
|
+
* (or disable one) without editing files: `EL_LINEAR_IDENTITY_RESOLVER=""` is an
|
|
98
|
+
* explicit off switch.
|
|
99
|
+
*/
|
|
100
|
+
export function resolverCommand(config, env = process.env) {
|
|
101
|
+
const fromEnv = env[RESOLVER_ENV];
|
|
102
|
+
if (fromEnv !== undefined) {
|
|
103
|
+
const argv = fromEnv.trim().split(/\s+/).filter(Boolean);
|
|
104
|
+
return argv.length > 0 ? argv : null;
|
|
105
|
+
}
|
|
106
|
+
const configured = config.identity?.resolver;
|
|
107
|
+
if (!configured || configured.length === 0) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return configured;
|
|
111
|
+
}
|
|
112
|
+
/** True when an identity resolver is configured (env or config). */
|
|
113
|
+
export function isResolverConfigured(config, env = process.env) {
|
|
114
|
+
return resolverCommand(config, env) !== null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Pull a Linear user UUID out of whatever the resolver printed.
|
|
118
|
+
*
|
|
119
|
+
* Deliberately generous about the shape, because the point of this hook is that
|
|
120
|
+
* anyone can write the resolver — demanding one exact JSON envelope would make
|
|
121
|
+
* the "just shell out to your own script" promise a lie. Accepted:
|
|
122
|
+
*
|
|
123
|
+
* - a bare UUID: `3f2a…`
|
|
124
|
+
* - `{"linearId": "3f2a…"}` (the el-identity record shape)
|
|
125
|
+
* - `{"data": {"linearId": "…"}}` (an el-* CLI `{data, meta}` envelope)
|
|
126
|
+
* - `{"id": "3f2a…"}` (the obvious alternative spelling)
|
|
127
|
+
*
|
|
128
|
+
* Anything else — including a *non*-UUID string, which is the shape a confused
|
|
129
|
+
* resolver most plausibly emits — is a miss. We would rather fall through to
|
|
130
|
+
* Linear's own lookup than hand a bogus id to the API and produce an opaque
|
|
131
|
+
* "Argument Validation Error" (the DEV-4312 failure, in a new costume).
|
|
132
|
+
*/
|
|
133
|
+
export function parseResolverOutput(stdout) {
|
|
134
|
+
const trimmed = stdout.trim();
|
|
135
|
+
if (!trimmed) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
if (UUID_RE.test(trimmed)) {
|
|
139
|
+
return trimmed;
|
|
140
|
+
}
|
|
141
|
+
let parsed;
|
|
142
|
+
try {
|
|
143
|
+
parsed = JSON.parse(trimmed);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
const candidate = pickLinearId(parsed);
|
|
149
|
+
return candidate && UUID_RE.test(candidate) ? candidate : null;
|
|
150
|
+
}
|
|
151
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
152
|
+
function pickLinearId(parsed) {
|
|
153
|
+
if (typeof parsed === "string") {
|
|
154
|
+
return parsed;
|
|
155
|
+
}
|
|
156
|
+
if (!parsed || typeof parsed !== "object") {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
const obj = parsed;
|
|
160
|
+
for (const key of ["linearId", "id"]) {
|
|
161
|
+
const value = obj[key];
|
|
162
|
+
if (typeof value === "string") {
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// One level of `{data: …}` unwrapping — the el-* CLI envelope.
|
|
167
|
+
if (obj.data && typeof obj.data === "object") {
|
|
168
|
+
return pickLinearId(obj.data);
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Run the configured resolver for `identifier`. Returns the Linear user UUID, or
|
|
174
|
+
* `null` on any miss/failure. Never throws.
|
|
175
|
+
*
|
|
176
|
+
* Synchronous (`spawnSync`) on purpose: resolution sits on the critical path of
|
|
177
|
+
* `--assignee` for a short-lived CLI, the callers are already `async` so nothing
|
|
178
|
+
* is starved, and it keeps the failure modes to exactly one place.
|
|
179
|
+
*/
|
|
180
|
+
export function resolveViaCommand(identifier, config, env = process.env) {
|
|
181
|
+
const argv = resolverCommand(config, env);
|
|
182
|
+
if (!argv) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
const [command, ...args] = argv;
|
|
186
|
+
if (!command) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
// A leading `-` is never a valid Linear identifier, but it IS a flag to the
|
|
190
|
+
// resolver's own option parser — `--assignee "--output=/tmp/x"` would be
|
|
191
|
+
// presented to it as one. There is no shell escape here (argv, not a shell),
|
|
192
|
+
// but el-linear is increasingly driven by agents over untrusted issue text, so
|
|
193
|
+
// close the class for free rather than trust every resolver to be careful.
|
|
194
|
+
if (identifier.startsWith("-")) {
|
|
195
|
+
debugMiss(`refusing flag-shaped identifier "${identifier}"`, env);
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const cached = memo.get(identifier);
|
|
199
|
+
if (cached !== undefined) {
|
|
200
|
+
return cached;
|
|
201
|
+
}
|
|
202
|
+
const resolved = spawnResolver(command, args, identifier, config, env);
|
|
203
|
+
memo.set(identifier, resolved);
|
|
204
|
+
return resolved;
|
|
205
|
+
}
|
|
206
|
+
function spawnResolver(command, args, identifier, config, env) {
|
|
207
|
+
try {
|
|
208
|
+
const result = spawnSync(command, [...args, identifier], {
|
|
209
|
+
encoding: "utf8",
|
|
210
|
+
timeout: resolveTimeoutMs(config),
|
|
211
|
+
// `spawnSync` waits for the child to fully exit after its timeout. Its
|
|
212
|
+
// default kill signal is SIGTERM, which a broken resolver can trap or
|
|
213
|
+
// ignore forever — defeating this hook's fail-open timeout. The resolver
|
|
214
|
+
// is an isolated lookup helper, so force it down when its time budget is
|
|
215
|
+
// exhausted rather than letting it wedge the whole CLI.
|
|
216
|
+
killSignal: "SIGKILL",
|
|
217
|
+
// The identifier is untrusted input; never hand it to a shell. This also
|
|
218
|
+
// means a Windows npm shim (`el-identity.cmd`) will NOT be found — see
|
|
219
|
+
// the Windows note in docs/configuration.md. Turning `shell: true` on to
|
|
220
|
+
// fix that would hand the untrusted identifier to cmd.exe, which is a
|
|
221
|
+
// far worse trade.
|
|
222
|
+
shell: false,
|
|
223
|
+
// stdin closed: a resolver that decides to prompt must not hang the CLI.
|
|
224
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
225
|
+
env: resolverEnv(env),
|
|
226
|
+
});
|
|
227
|
+
// BOTH conditions are load-bearing; do not "simplify" this to one.
|
|
228
|
+
// - a plain timeout → error ETIMEDOUT, status null
|
|
229
|
+
// - a maxBuffer overflow → error ENOBUFS, status null
|
|
230
|
+
// - a child that leaves a grandchild holding the stdout pipe
|
|
231
|
+
// → error ETIMEDOUT, status **0**
|
|
232
|
+
// Checking only `status` would let that last case through as a success and
|
|
233
|
+
// parse whatever partial output happened to be buffered.
|
|
234
|
+
if (result.error) {
|
|
235
|
+
debugMiss(`${command}: ${result.error.message}`, env);
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
if (result.status !== 0) {
|
|
239
|
+
const stderr = (result.stderr ?? "").trim().split("\n")[0] ?? "";
|
|
240
|
+
debugMiss(`${command} exited ${result.status}${stderr ? `: ${stderr}` : ""}`, env);
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
const parsed = parseResolverOutput(result.stdout ?? "");
|
|
244
|
+
if (!parsed) {
|
|
245
|
+
debugMiss(`${command} printed no usable Linear UUID for "${identifier}"`, env);
|
|
246
|
+
}
|
|
247
|
+
return parsed;
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
debugMiss(err instanceof Error ? err.message : String(err), env);
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -14,14 +14,29 @@ export declare function resolveMember(input: string): string;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function resolveAssignee(input: string, rootOpts: Record<string, unknown>): Promise<string>;
|
|
16
16
|
/**
|
|
17
|
-
* Resolve a member identifier (alias / handle / name) to a UUID
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `--delegate` (DEV-4871 / DEV-4872).
|
|
17
|
+
* Resolve a member identifier (alias / handle / name) to a UUID. The shared
|
|
18
|
+
* async resolution path behind `--assignee` and `--delegate` (DEV-4871 /
|
|
19
|
+
* DEV-4872 / DEV-5628).
|
|
21
20
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* Order, most authoritative first:
|
|
22
|
+
*
|
|
23
|
+
* 1. **The identity-resolver hook** (`identity.resolver`, DEV-5628) — an
|
|
24
|
+
* operator-supplied command. This is the one to reach for: it can answer
|
|
25
|
+
* for aliases and cross-system handles Linear has never heard of, and it
|
|
26
|
+
* owns its own credentials, so el-linear carries no auth scheme.
|
|
27
|
+
* 2. **The HTTP registry** (`EL_IDENTITY_URL`, DEV-4871) — the older,
|
|
28
|
+
* env-gated path. Superseded by (1), which needs no URL or CF-Access
|
|
29
|
+
* credentials in the environment. Kept because it ships and someone may
|
|
30
|
+
* rely on it.
|
|
31
|
+
* 3. **The bundled config** (`resolveMember`) — a local lookup table.
|
|
32
|
+
*
|
|
33
|
+
* All three are optional. With none of them, `resolveMember` hands the raw input
|
|
34
|
+
* back and Linear's own user lookup resolves it (`LinearService.resolveUserId`
|
|
35
|
+
* matches email → displayName → name), which is why an install with no config at
|
|
36
|
+
* all still works.
|
|
37
|
+
*
|
|
38
|
+
* Fail-open throughout: a miss or a failure at any layer falls through to the
|
|
39
|
+
* next. Never throws.
|
|
25
40
|
*/
|
|
26
41
|
export declare function resolveMemberWithRegistry(input: string): Promise<string>;
|
|
27
42
|
/**
|
package/dist/config/resolver.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createGraphQLService } from "../utils/graphql-service.js";
|
|
|
2
2
|
import { outputWarning } from "../utils/output.js";
|
|
3
3
|
import { isUuid, isUuidPrefix } from "../utils/uuid.js";
|
|
4
4
|
import { loadConfig } from "./config.js";
|
|
5
|
+
import { resolveViaCommand } from "./identity-resolver.js";
|
|
5
6
|
import { isRegistryConfigured, resolveViaRegistry, } from "./registry-resolve.js";
|
|
6
7
|
/**
|
|
7
8
|
* Resolve a team key/name/alias to its UUID.
|
|
@@ -102,16 +103,39 @@ export async function resolveAssignee(input, rootOpts) {
|
|
|
102
103
|
return resolveMemberWithRegistry(input);
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
|
-
* Resolve a member identifier (alias / handle / name) to a UUID
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* `--delegate` (DEV-4871 / DEV-4872).
|
|
106
|
+
* Resolve a member identifier (alias / handle / name) to a UUID. The shared
|
|
107
|
+
* async resolution path behind `--assignee` and `--delegate` (DEV-4871 /
|
|
108
|
+
* DEV-4872 / DEV-5628).
|
|
109
109
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
110
|
+
* Order, most authoritative first:
|
|
111
|
+
*
|
|
112
|
+
* 1. **The identity-resolver hook** (`identity.resolver`, DEV-5628) — an
|
|
113
|
+
* operator-supplied command. This is the one to reach for: it can answer
|
|
114
|
+
* for aliases and cross-system handles Linear has never heard of, and it
|
|
115
|
+
* owns its own credentials, so el-linear carries no auth scheme.
|
|
116
|
+
* 2. **The HTTP registry** (`EL_IDENTITY_URL`, DEV-4871) — the older,
|
|
117
|
+
* env-gated path. Superseded by (1), which needs no URL or CF-Access
|
|
118
|
+
* credentials in the environment. Kept because it ships and someone may
|
|
119
|
+
* rely on it.
|
|
120
|
+
* 3. **The bundled config** (`resolveMember`) — a local lookup table.
|
|
121
|
+
*
|
|
122
|
+
* All three are optional. With none of them, `resolveMember` hands the raw input
|
|
123
|
+
* back and Linear's own user lookup resolves it (`LinearService.resolveUserId`
|
|
124
|
+
* matches email → displayName → name), which is why an install with no config at
|
|
125
|
+
* all still works.
|
|
126
|
+
*
|
|
127
|
+
* Fail-open throughout: a miss or a failure at any layer falls through to the
|
|
128
|
+
* next. Never throws.
|
|
113
129
|
*/
|
|
114
130
|
export async function resolveMemberWithRegistry(input) {
|
|
131
|
+
// UUIDs are already canonical — don't spend a subprocess on them.
|
|
132
|
+
if (isUuid(input)) {
|
|
133
|
+
return input;
|
|
134
|
+
}
|
|
135
|
+
const viaCommand = resolveViaCommand(input, loadConfig());
|
|
136
|
+
if (viaCommand) {
|
|
137
|
+
return viaCommand;
|
|
138
|
+
}
|
|
115
139
|
if (isRegistryConfigured()) {
|
|
116
140
|
const viaRegistry = await resolveViaRegistry(input);
|
|
117
141
|
if (viaRegistry) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { loadConfig } from "../config/config.js";
|
|
2
|
+
import { resolveViaCommand } from "../config/identity-resolver.js";
|
|
1
3
|
import { isRegistryConfigured, resolveViaRegistry, } from "../config/registry-resolve.js";
|
|
2
4
|
import { resolveUserDisplayName } from "../config/resolver.js";
|
|
3
5
|
import { ARCHIVE_ISSUE_MUTATION, BATCH_GET_ISSUES_QUERY, BATCH_RESOLVE_FOR_CREATE_QUERY, BATCH_RESOLVE_FOR_SEARCH_QUERY, BATCH_RESOLVE_FOR_UPDATE_QUERY, buildResolveLabelsByNameQuery, CREATE_ISSUE_MUTATION, DELETE_ISSUE_MUTATION, FILTERED_SEARCH_ISSUES_QUERY, GET_ISSUE_BY_ID_QUERY, GET_ISSUE_BY_IDENTIFIER_QUERY, GET_ISSUE_CLAIM_CONTEXT_QUERY, GET_ISSUE_START_CONTEXT_QUERY, GET_ISSUE_TEAM_QUERY, GET_ISSUES_QUERY, SEARCH_ISSUES_QUERY, TEAM_SCOPED_FILTERED_ISSUES_QUERY, TEAM_STARTED_STATUSES_QUERY, UPDATE_ISSUE_MUTATION, } from "../queries/issues.js";
|
|
@@ -1116,9 +1118,15 @@ export class GraphQLIssuesService {
|
|
|
1116
1118
|
if (!assigneeId || isUuid(assigneeId)) {
|
|
1117
1119
|
return assigneeId;
|
|
1118
1120
|
}
|
|
1119
|
-
// Opt-in
|
|
1120
|
-
//
|
|
1121
|
-
//
|
|
1121
|
+
// Opt-in identity resolution, falling back to the Linear-API user lookup
|
|
1122
|
+
// below on a miss. Both layers are optional and fail-open — an install
|
|
1123
|
+
// with neither configured never reaches the network here.
|
|
1124
|
+
// 1. The resolver-command hook (DEV-5628) — brings its own credentials.
|
|
1125
|
+
// 2. The older env-gated HTTP registry (DEV-4872).
|
|
1126
|
+
const viaCommand = resolveViaCommand(assigneeId, loadConfig());
|
|
1127
|
+
if (viaCommand) {
|
|
1128
|
+
return viaCommand;
|
|
1129
|
+
}
|
|
1122
1130
|
if (isRegistryConfigured()) {
|
|
1123
1131
|
const viaRegistry = await resolveViaRegistry(assigneeId);
|
|
1124
1132
|
if (viaRegistry) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enrichlayer/el-linear",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.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",
|