@elnora-ai/linear 1.0.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/.claude-plugin/marketplace.json +19 -0
- package/.claude-plugin/plugin.json +19 -0
- package/CHANGELOG.md +29 -0
- package/LICENSE +201 -0
- package/README.md +61 -0
- package/agents/linear-issue-creator.md +45 -0
- package/agents/linear-issue-reviewer.md +44 -0
- package/agents/linear-issue-updater.md +45 -0
- package/agents/linear-url-to-issues.md +51 -0
- package/commands/linear-bulk.md +42 -0
- package/commands/linear-cleanup.md +45 -0
- package/commands/linear-curator-run.md +39 -0
- package/commands/linear-my-issues.md +25 -0
- package/commands/linear-search.md +32 -0
- package/commands/linear-sync.md +54 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +126 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/auth.d.ts +21 -0
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/auth.js +74 -0
- package/dist/client/auth.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/linear-client.d.ts +5 -0
- package/dist/client/linear-client.d.ts.map +1 -0
- package/dist/client/linear-client.js +18 -0
- package/dist/client/linear-client.js.map +1 -0
- package/dist/commands/bulk.d.ts +39 -0
- package/dist/commands/bulk.d.ts.map +1 -0
- package/dist/commands/bulk.js +103 -0
- package/dist/commands/bulk.js.map +1 -0
- package/dist/commands/cleanup.d.ts +39 -0
- package/dist/commands/cleanup.d.ts.map +1 -0
- package/dist/commands/cleanup.js +100 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/curator.d.ts +23 -0
- package/dist/commands/curator.d.ts.map +1 -0
- package/dist/commands/curator.js +66 -0
- package/dist/commands/curator.js.map +1 -0
- package/dist/commands/index.d.ts +7 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +7 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/my-issues.d.ts +7 -0
- package/dist/commands/my-issues.d.ts.map +1 -0
- package/dist/commands/my-issues.js +24 -0
- package/dist/commands/my-issues.js.map +1 -0
- package/dist/commands/search.d.ts +20 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +54 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/sync.d.ts +87 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +229 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +12 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +140 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/types.d.ts +133 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +13 -0
- package/dist/config/types.js.map +1 -0
- package/dist/output/formatter.d.ts +16 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +34 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/index.d.ts +2 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +2 -0
- package/dist/output/index.js.map +1 -0
- package/dist/signals/external-command.d.ts +30 -0
- package/dist/signals/external-command.d.ts.map +1 -0
- package/dist/signals/external-command.js +96 -0
- package/dist/signals/external-command.js.map +1 -0
- package/dist/signals/index.d.ts +4 -0
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/index.js +4 -0
- package/dist/signals/index.js.map +1 -0
- package/dist/signals/registry.d.ts +5 -0
- package/dist/signals/registry.d.ts.map +1 -0
- package/dist/signals/registry.js +29 -0
- package/dist/signals/registry.js.map +1 -0
- package/dist/signals/types.d.ts +25 -0
- package/dist/signals/types.d.ts.map +1 -0
- package/dist/signals/types.js +9 -0
- package/dist/signals/types.js.map +1 -0
- package/package.json +76 -0
- package/references/projects.example.json +26 -0
- package/references/projects.placeholder.json +6 -0
- package/references/repos.example.json +21 -0
- package/references/repos.placeholder.json +6 -0
- package/references/signal-sources.example.json +42 -0
- package/references/signal-sources.placeholder.json +6 -0
- package/references/slack.example.json +10 -0
- package/references/slack.placeholder.json +8 -0
- package/references/teams.example.json +21 -0
- package/references/teams.placeholder.json +6 -0
- package/references/users.example.json +18 -0
- package/references/users.placeholder.json +6 -0
- package/references/workflows.example.json +44 -0
- package/references/workflows.placeholder.json +7 -0
- package/schemas/projects.json +47 -0
- package/schemas/repos.json +41 -0
- package/schemas/signal-sources.json +90 -0
- package/schemas/slack.json +45 -0
- package/schemas/teams.json +43 -0
- package/schemas/users.json +41 -0
- package/schemas/workflows.json +61 -0
- package/skills/linear-workspace/SKILL.md +52 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// `elnora-linear sync` — populate or refresh the reference data files.
|
|
2
|
+
//
|
|
3
|
+
// Subcommands:
|
|
4
|
+
// sync Refresh every auto-discoverable target (no prompts)
|
|
5
|
+
// sync teams|projects|users|workflows Fetch and write one target from the Linear API
|
|
6
|
+
// sync verify Validate all references against their schemas
|
|
7
|
+
// sync import --from <path> Import a JSON bundle into individual reference files
|
|
8
|
+
//
|
|
9
|
+
// Where it writes:
|
|
10
|
+
// - LINEAR_REFERENCES_DIR (if set)
|
|
11
|
+
// - ~/.config/elnora-linear/ (auto-created if it would otherwise fall back to bundled)
|
|
12
|
+
// - Never writes to the bundled `references/` shipped in the npm package.
|
|
13
|
+
//
|
|
14
|
+
// What it does NOT do (yet — coming with the curator PR):
|
|
15
|
+
// - Interactive prompts for slack channels, repos, signal sources
|
|
16
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { homedir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import { getLinearClient } from "../client/index.js";
|
|
20
|
+
import { BUNDLED_REFERENCES_DIR, loadConfig, REFERENCE_NAMES, resolveReferencesDir, } from "../config/index.js";
|
|
21
|
+
export const AUTO_SYNC_TARGETS = ["teams", "projects", "users", "workflows"];
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the directory the sync command should write to.
|
|
24
|
+
*
|
|
25
|
+
* Refuses to write to the bundled `references/` dir shipped in the npm package
|
|
26
|
+
* (would corrupt the install). Instead, falls back to ~/.config/elnora-linear/
|
|
27
|
+
* (auto-creating it).
|
|
28
|
+
*/
|
|
29
|
+
export function resolveSyncWriteDir(override) {
|
|
30
|
+
const dir = resolveReferencesDir(override);
|
|
31
|
+
if (dir === BUNDLED_REFERENCES_DIR) {
|
|
32
|
+
const home = join(homedir(), ".config", "elnora-linear");
|
|
33
|
+
mkdirSync(home, { recursive: true });
|
|
34
|
+
return home;
|
|
35
|
+
}
|
|
36
|
+
return dir;
|
|
37
|
+
}
|
|
38
|
+
export function mapTeam(t) {
|
|
39
|
+
return {
|
|
40
|
+
key: t.key,
|
|
41
|
+
name: t.name,
|
|
42
|
+
...(t.description ? { description: t.description } : {}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function mapProjectStatus(linearState) {
|
|
46
|
+
if (!linearState)
|
|
47
|
+
return undefined;
|
|
48
|
+
const m = {
|
|
49
|
+
backlog: "Backlog",
|
|
50
|
+
planned: "Planned",
|
|
51
|
+
started: "In Progress",
|
|
52
|
+
paused: "In Progress",
|
|
53
|
+
completed: "Completed",
|
|
54
|
+
canceled: "Canceled",
|
|
55
|
+
};
|
|
56
|
+
return m[linearState.toLowerCase()];
|
|
57
|
+
}
|
|
58
|
+
export function mapProject(p, teamKey) {
|
|
59
|
+
const status = mapProjectStatus(p.state);
|
|
60
|
+
return {
|
|
61
|
+
name: p.name,
|
|
62
|
+
team: teamKey,
|
|
63
|
+
...(status ? { status } : {}),
|
|
64
|
+
...(p.description ? { description: p.description } : {}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export function mapUser(u) {
|
|
68
|
+
const source = u.displayName ?? u.email?.split("@")[0] ?? u.name;
|
|
69
|
+
const key = source
|
|
70
|
+
.toLowerCase()
|
|
71
|
+
.replace(/[^a-z0-9_-]+/g, "-")
|
|
72
|
+
.replace(/^-+|-+$/g, "") || "user";
|
|
73
|
+
return {
|
|
74
|
+
key,
|
|
75
|
+
name: u.name,
|
|
76
|
+
...(u.email ? { email: u.email } : {}),
|
|
77
|
+
linear_user_id: u.id,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const WORKFLOW_STATE_TYPES = new Set([
|
|
81
|
+
"backlog",
|
|
82
|
+
"unstarted",
|
|
83
|
+
"started",
|
|
84
|
+
"completed",
|
|
85
|
+
"canceled",
|
|
86
|
+
"triage",
|
|
87
|
+
]);
|
|
88
|
+
export function mapWorkflowState(s) {
|
|
89
|
+
if (!WORKFLOW_STATE_TYPES.has(s.type))
|
|
90
|
+
return null;
|
|
91
|
+
return { name: s.name, type: s.type };
|
|
92
|
+
}
|
|
93
|
+
// ---------- file write helpers ----------
|
|
94
|
+
function writeReferenceJson(dir, name, body) {
|
|
95
|
+
const path = join(dir, `${name}.json`);
|
|
96
|
+
writeFileSync(path, `${JSON.stringify(body, null, 2)}\n`);
|
|
97
|
+
return path;
|
|
98
|
+
}
|
|
99
|
+
function emitReport(report, mode) {
|
|
100
|
+
if (mode === "json") {
|
|
101
|
+
process.stdout.write(`${JSON.stringify(report)}\n`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
process.stdout.write(`Wrote ${report.written} ${report.target} to ${report.path}\n`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// ---------- live sync (network) ----------
|
|
108
|
+
async function syncTeams(client, dir) {
|
|
109
|
+
const result = await client.teams({ first: 250 });
|
|
110
|
+
const teams = result.nodes.map((t) => mapTeam({ key: t.key, name: t.name, description: t.description }));
|
|
111
|
+
const path = writeReferenceJson(dir, "teams", { teams });
|
|
112
|
+
return { target: "teams", written: teams.length, path };
|
|
113
|
+
}
|
|
114
|
+
async function syncProjects(client, dir) {
|
|
115
|
+
const teamsResult = await client.teams({ first: 250 });
|
|
116
|
+
const projects = [];
|
|
117
|
+
for (const team of teamsResult.nodes) {
|
|
118
|
+
const result = await team.projects({ first: 100 });
|
|
119
|
+
for (const p of result.nodes) {
|
|
120
|
+
projects.push(mapProject({ name: p.name, description: p.description, state: p.state }, team.key));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const path = writeReferenceJson(dir, "projects", { projects });
|
|
124
|
+
return { target: "projects", written: projects.length, path };
|
|
125
|
+
}
|
|
126
|
+
async function syncUsers(client, dir) {
|
|
127
|
+
const result = await client.users({ first: 250 });
|
|
128
|
+
const users = result.nodes.map((u) => mapUser({ id: u.id, name: u.name, email: u.email, displayName: u.displayName }));
|
|
129
|
+
const path = writeReferenceJson(dir, "users", { users });
|
|
130
|
+
return { target: "users", written: users.length, path };
|
|
131
|
+
}
|
|
132
|
+
async function syncWorkflows(client, dir) {
|
|
133
|
+
const teamsResult = await client.teams({ first: 250 });
|
|
134
|
+
const seen = new Set();
|
|
135
|
+
const states = [];
|
|
136
|
+
for (const team of teamsResult.nodes) {
|
|
137
|
+
const result = await team.states({ first: 100 });
|
|
138
|
+
for (const s of result.nodes) {
|
|
139
|
+
const mapped = mapWorkflowState({ name: s.name, type: s.type });
|
|
140
|
+
if (!mapped)
|
|
141
|
+
continue;
|
|
142
|
+
const key = `${mapped.name}|${mapped.type}`;
|
|
143
|
+
if (seen.has(key))
|
|
144
|
+
continue;
|
|
145
|
+
seen.add(key);
|
|
146
|
+
states.push(mapped);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const path = writeReferenceJson(dir, "workflows", { states, rules: [] });
|
|
150
|
+
return { target: "workflows", written: states.length, path };
|
|
151
|
+
}
|
|
152
|
+
async function dispatchSync(target, client, dir) {
|
|
153
|
+
switch (target) {
|
|
154
|
+
case "teams":
|
|
155
|
+
return syncTeams(client, dir);
|
|
156
|
+
case "projects":
|
|
157
|
+
return syncProjects(client, dir);
|
|
158
|
+
case "users":
|
|
159
|
+
return syncUsers(client, dir);
|
|
160
|
+
case "workflows":
|
|
161
|
+
return syncWorkflows(client, dir);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export async function runSyncTarget(target, opts) {
|
|
165
|
+
const dir = resolveSyncWriteDir(opts.referencesDir);
|
|
166
|
+
const client = await getLinearClient({ allowPrompt: true });
|
|
167
|
+
emitReport(await dispatchSync(target, client, dir), opts.output);
|
|
168
|
+
}
|
|
169
|
+
export async function runSyncAll(opts) {
|
|
170
|
+
const dir = resolveSyncWriteDir(opts.referencesDir);
|
|
171
|
+
const client = await getLinearClient({ allowPrompt: true });
|
|
172
|
+
for (const target of AUTO_SYNC_TARGETS) {
|
|
173
|
+
emitReport(await dispatchSync(target, client, dir), opts.output);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export function runSyncVerify(opts) {
|
|
177
|
+
const cfg = loadConfig({ referencesDir: opts.referencesDir, strict: false });
|
|
178
|
+
const report = {
|
|
179
|
+
referencesDir: cfg.meta.referencesDir,
|
|
180
|
+
sources: cfg.meta.sources,
|
|
181
|
+
};
|
|
182
|
+
if (opts.output === "json") {
|
|
183
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
process.stdout.write(`References dir: ${report.referencesDir}\n`);
|
|
187
|
+
for (const name of REFERENCE_NAMES) {
|
|
188
|
+
const source = report.sources[name];
|
|
189
|
+
const label = source === "user-file" ? "[ok]" : source === "placeholder" ? "[--]" : "[!!]";
|
|
190
|
+
process.stdout.write(` ${label} ${name}: ${source}\n`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return report;
|
|
194
|
+
}
|
|
195
|
+
/** Pure: given parsed JSON, decide which reference targets to write. */
|
|
196
|
+
export function planImport(parsed) {
|
|
197
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
198
|
+
throw new Error("Import file must be a JSON object.");
|
|
199
|
+
}
|
|
200
|
+
const obj = parsed;
|
|
201
|
+
const targets = REFERENCE_NAMES.filter((n) => n in obj);
|
|
202
|
+
if (targets.length === 0) {
|
|
203
|
+
throw new Error(`Import file must be a bundle with top-level keys matching reference names: ${REFERENCE_NAMES.join(", ")}.`);
|
|
204
|
+
}
|
|
205
|
+
return targets;
|
|
206
|
+
}
|
|
207
|
+
export function runSyncImport(opts) {
|
|
208
|
+
const dir = resolveSyncWriteDir(opts.referencesDir);
|
|
209
|
+
const raw = readFileSync(opts.from, "utf8");
|
|
210
|
+
const parsed = JSON.parse(raw);
|
|
211
|
+
const targets = planImport(parsed);
|
|
212
|
+
const written = [];
|
|
213
|
+
const obj = parsed;
|
|
214
|
+
for (const target of targets) {
|
|
215
|
+
const path = writeReferenceJson(dir, target, obj[target]);
|
|
216
|
+
written.push({ target, path });
|
|
217
|
+
}
|
|
218
|
+
const report = { written };
|
|
219
|
+
if (opts.output === "json") {
|
|
220
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
for (const w of written) {
|
|
224
|
+
process.stdout.write(`Wrote ${w.target} to ${w.path}\n`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return report;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,eAAe;AACf,mFAAmF;AACnF,yFAAyF;AACzF,6EAA6E;AAC7E,oFAAoF;AACpF,EAAE;AACF,mBAAmB;AACnB,qCAAqC;AACrC,yFAAyF;AACzF,4EAA4E;AAC5E,EAAE;AACF,0DAA0D;AAC1D,oEAAoE;AAEpE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAA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IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACP,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type LinearConfig } from "./types.js";
|
|
2
|
+
export declare const BUNDLED_SCHEMAS_DIR: string;
|
|
3
|
+
export declare const BUNDLED_REFERENCES_DIR: string;
|
|
4
|
+
export interface LoadConfigOptions {
|
|
5
|
+
/** Explicit references directory; overrides env var and home/bundled defaults. */
|
|
6
|
+
referencesDir?: string;
|
|
7
|
+
/** If false, schema-validation failures warn instead of throwing. Default true. */
|
|
8
|
+
strict?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function resolveReferencesDir(override?: string): string;
|
|
11
|
+
export declare function loadConfig(opts?: LoadConfigOptions): LinearConfig;
|
|
12
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AA4BA,OAAO,EACN,KAAK,YAAY,EAWjB,MAAM,YAAY,CAAC;AAOpB,eAAO,MAAM,mBAAmB,QAAgC,CAAC;AACjE,eAAO,MAAM,sBAAsB,QAAmC,CAAC;AAcvE,MAAM,WAAW,iBAAiB;IACjC,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM9D;AAkED,wBAAgB,UAAU,CAAC,IAAI,GAAE,iBAAsB,GAAG,YAAY,CAkCrE"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Runtime loader for elnora-linear's reference data.
|
|
2
|
+
//
|
|
3
|
+
// Resolution precedence for the references directory (highest first):
|
|
4
|
+
// 1. explicit `referencesDir` option
|
|
5
|
+
// 2. LINEAR_REFERENCES_DIR env var
|
|
6
|
+
// 3. ~/.config/elnora-linear/ (if it exists)
|
|
7
|
+
// 4. the bundled `references/` shipped in the npm package (placeholders only)
|
|
8
|
+
//
|
|
9
|
+
// For each of the 7 reference names, the loader looks for `<name>.json` first
|
|
10
|
+
// (populated by the user) and falls back to `<name>.placeholder.json`. Missing
|
|
11
|
+
// schemas or invalid JSON throw. Schema-validation failures throw in strict
|
|
12
|
+
// mode (default) and warn-and-continue in non-strict mode.
|
|
13
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
import { homedir } from "node:os";
|
|
16
|
+
import { dirname, join, resolve } from "node:path";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
// ajv@8 and ajv-formats@3 ship as CommonJS. TypeScript's Node16 module
|
|
19
|
+
// resolution doesn't synthesize default exports cleanly for CJS, so we load
|
|
20
|
+
// them via createRequire. Types still come from the package via `import type`.
|
|
21
|
+
const cjsRequire = createRequire(import.meta.url);
|
|
22
|
+
const { Ajv2020 } = cjsRequire("ajv/dist/2020.js");
|
|
23
|
+
const addFormats = cjsRequire("ajv-formats");
|
|
24
|
+
import { REFERENCE_NAMES, } from "./types.js";
|
|
25
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
// In source: src/config/loader.ts → repo root is two up.
|
|
27
|
+
// In dist: dist/config/loader.js → package root is two up.
|
|
28
|
+
// Either way, schemas/ and references/ are siblings of src/dist.
|
|
29
|
+
const PACKAGE_ROOT = resolve(HERE, "..", "..");
|
|
30
|
+
export const BUNDLED_SCHEMAS_DIR = join(PACKAGE_ROOT, "schemas");
|
|
31
|
+
export const BUNDLED_REFERENCES_DIR = join(PACKAGE_ROOT, "references");
|
|
32
|
+
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
33
|
+
addFormats(ajv);
|
|
34
|
+
const validators = (() => {
|
|
35
|
+
const out = {};
|
|
36
|
+
for (const name of REFERENCE_NAMES) {
|
|
37
|
+
const schema = JSON.parse(readFileSync(join(BUNDLED_SCHEMAS_DIR, `${name}.json`), "utf8"));
|
|
38
|
+
out[name] = ajv.compile(schema);
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
})();
|
|
42
|
+
export function resolveReferencesDir(override) {
|
|
43
|
+
if (override)
|
|
44
|
+
return resolve(override);
|
|
45
|
+
if (process.env.LINEAR_REFERENCES_DIR)
|
|
46
|
+
return resolve(process.env.LINEAR_REFERENCES_DIR);
|
|
47
|
+
const home = join(homedir(), ".config", "elnora-linear");
|
|
48
|
+
if (existsSync(home))
|
|
49
|
+
return home;
|
|
50
|
+
return BUNDLED_REFERENCES_DIR;
|
|
51
|
+
}
|
|
52
|
+
function formatAjvErrors(errors) {
|
|
53
|
+
if (!errors || errors.length === 0)
|
|
54
|
+
return "(no error details)";
|
|
55
|
+
return errors
|
|
56
|
+
.map((e) => {
|
|
57
|
+
const path = e.instancePath || "/";
|
|
58
|
+
return ` - ${path}: ${e.message}`;
|
|
59
|
+
})
|
|
60
|
+
.join("\n");
|
|
61
|
+
}
|
|
62
|
+
function loadReference(name, dir, strict) {
|
|
63
|
+
const populated = join(dir, `${name}.json`);
|
|
64
|
+
const placeholder = join(dir, `${name}.placeholder.json`);
|
|
65
|
+
const bundledPlaceholder = join(BUNDLED_REFERENCES_DIR, `${name}.placeholder.json`);
|
|
66
|
+
let path;
|
|
67
|
+
let source;
|
|
68
|
+
if (existsSync(populated)) {
|
|
69
|
+
path = populated;
|
|
70
|
+
source = "user-file";
|
|
71
|
+
}
|
|
72
|
+
else if (existsSync(placeholder)) {
|
|
73
|
+
path = placeholder;
|
|
74
|
+
source = "placeholder";
|
|
75
|
+
}
|
|
76
|
+
else if (existsSync(bundledPlaceholder)) {
|
|
77
|
+
path = bundledPlaceholder;
|
|
78
|
+
source = "placeholder";
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error(`Could not find ${name}.json or ${name}.placeholder.json in ${dir} or bundled defaults at ${BUNDLED_REFERENCES_DIR}.`);
|
|
82
|
+
}
|
|
83
|
+
let raw;
|
|
84
|
+
try {
|
|
85
|
+
raw = readFileSync(path, "utf8");
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
throw new Error(`Failed to read ${path}: ${err.message}`);
|
|
89
|
+
}
|
|
90
|
+
let parsed;
|
|
91
|
+
try {
|
|
92
|
+
parsed = JSON.parse(raw);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
throw new Error(`${path}: invalid JSON: ${err.message}`);
|
|
96
|
+
}
|
|
97
|
+
const validate = validators[name];
|
|
98
|
+
if (!validate(parsed)) {
|
|
99
|
+
const message = `${path} failed schema validation:\n${formatAjvErrors(validate.errors)}`;
|
|
100
|
+
if (strict) {
|
|
101
|
+
throw new Error(message);
|
|
102
|
+
}
|
|
103
|
+
console.warn(message);
|
|
104
|
+
}
|
|
105
|
+
return { data: parsed, source, path };
|
|
106
|
+
}
|
|
107
|
+
export function loadConfig(opts = {}) {
|
|
108
|
+
const strict = opts.strict !== false;
|
|
109
|
+
const referencesDir = resolveReferencesDir(opts.referencesDir);
|
|
110
|
+
const teams = loadReference("teams", referencesDir, strict);
|
|
111
|
+
const projects = loadReference("projects", referencesDir, strict);
|
|
112
|
+
const users = loadReference("users", referencesDir, strict);
|
|
113
|
+
const slack = loadReference("slack", referencesDir, strict);
|
|
114
|
+
const repos = loadReference("repos", referencesDir, strict);
|
|
115
|
+
const signalSources = loadReference("signal-sources", referencesDir, strict);
|
|
116
|
+
const workflows = loadReference("workflows", referencesDir, strict);
|
|
117
|
+
return {
|
|
118
|
+
teams: teams.data,
|
|
119
|
+
projects: projects.data,
|
|
120
|
+
users: users.data,
|
|
121
|
+
slack: slack.data,
|
|
122
|
+
repos: repos.data,
|
|
123
|
+
signalSources: signalSources.data,
|
|
124
|
+
workflows: workflows.data,
|
|
125
|
+
meta: {
|
|
126
|
+
referencesDir,
|
|
127
|
+
bundledReferencesDir: BUNDLED_REFERENCES_DIR,
|
|
128
|
+
sources: {
|
|
129
|
+
teams: teams.source,
|
|
130
|
+
projects: projects.source,
|
|
131
|
+
users: users.source,
|
|
132
|
+
slack: slack.source,
|
|
133
|
+
repos: repos.source,
|
|
134
|
+
"signal-sources": signalSources.source,
|
|
135
|
+
workflows: workflows.source,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,uCAAuC;AACvC,qCAAqC;AACrC,+CAA+C;AAC/C,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,2DAA2D;AAE3D,OAAO,EAAE,UAAU,EAA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,CAAC,IAAI;QACjB,aAAa,EAAE,aAAa,CAAC,IAAI;QACjC,SAAS,EAAE,SAAS,CAAC,IAAI;QACzB,IAAI,EAAE;YACL,aAAa;YACb,oBAAoB,EAAE,sBAAsB;YAC5C,OAAO,EAAE;gBACR,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,QAAQ,EAAE,QAAQ,CAAC,MAAM;gBACzB,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,gBAAgB,EAAE,aAAa,CAAC,MAAM;gBACtC,SAAS,EAAE,SAAS,CAAC,MAAM;aAC3B;SACD;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export type ReferenceName = "teams" | "projects" | "users" | "slack" | "repos" | "signal-sources" | "workflows";
|
|
2
|
+
export declare const REFERENCE_NAMES: ReferenceName[];
|
|
3
|
+
interface MetaFlags {
|
|
4
|
+
$schema?: string;
|
|
5
|
+
_placeholder?: boolean;
|
|
6
|
+
_example?: boolean;
|
|
7
|
+
_populated_by?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Team {
|
|
10
|
+
key: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
default_project?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TeamsConfig extends MetaFlags {
|
|
16
|
+
teams: Team[];
|
|
17
|
+
}
|
|
18
|
+
export type ProjectPriority = "Urgent" | "High" | "Normal" | "Low";
|
|
19
|
+
export type ProjectStatus = "Planned" | "In Progress" | "Backlog" | "Completed" | "Canceled";
|
|
20
|
+
export interface Project {
|
|
21
|
+
name: string;
|
|
22
|
+
team: string;
|
|
23
|
+
lead?: string;
|
|
24
|
+
priority?: ProjectPriority;
|
|
25
|
+
status?: ProjectStatus;
|
|
26
|
+
description?: string;
|
|
27
|
+
sla?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ProjectsConfig extends MetaFlags {
|
|
30
|
+
projects: Project[];
|
|
31
|
+
}
|
|
32
|
+
export interface User {
|
|
33
|
+
key: string;
|
|
34
|
+
name: string;
|
|
35
|
+
email?: string;
|
|
36
|
+
linear_user_id?: string;
|
|
37
|
+
slack_user_id?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface UsersConfig extends MetaFlags {
|
|
40
|
+
users: User[];
|
|
41
|
+
}
|
|
42
|
+
export interface SlackChannel {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
purpose?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SlackConfig extends MetaFlags {
|
|
48
|
+
channels: SlackChannel[];
|
|
49
|
+
allowed_channels: string[];
|
|
50
|
+
allowed_dm_users: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface Repo {
|
|
53
|
+
name: string;
|
|
54
|
+
org?: string;
|
|
55
|
+
local_path?: string;
|
|
56
|
+
default_branch?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ReposConfig extends MetaFlags {
|
|
59
|
+
repos: Repo[];
|
|
60
|
+
}
|
|
61
|
+
export type SignalSourceType = "github_commits" | "github_pr" | "slack_messages" | "linear_issues" | "external_command" | "mcp_tool";
|
|
62
|
+
export interface SignalSourceBase {
|
|
63
|
+
type: SignalSourceType;
|
|
64
|
+
name: string;
|
|
65
|
+
enabled?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface GithubCommitsSource extends SignalSourceBase {
|
|
68
|
+
type: "github_commits";
|
|
69
|
+
repos?: string[];
|
|
70
|
+
lookback_days?: number;
|
|
71
|
+
}
|
|
72
|
+
export interface GithubPrSource extends SignalSourceBase {
|
|
73
|
+
type: "github_pr";
|
|
74
|
+
repos?: string[];
|
|
75
|
+
}
|
|
76
|
+
export interface SlackMessagesSource extends SignalSourceBase {
|
|
77
|
+
type: "slack_messages";
|
|
78
|
+
channels?: string[];
|
|
79
|
+
match_patterns?: string[];
|
|
80
|
+
}
|
|
81
|
+
export interface LinearIssuesSource extends SignalSourceBase {
|
|
82
|
+
type: "linear_issues";
|
|
83
|
+
}
|
|
84
|
+
export interface ExternalCommandSource extends SignalSourceBase {
|
|
85
|
+
type: "external_command";
|
|
86
|
+
command: string;
|
|
87
|
+
parse_as?: "json" | "lines" | "regex";
|
|
88
|
+
issue_match_field?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface McpToolSource extends SignalSourceBase {
|
|
91
|
+
type: "mcp_tool";
|
|
92
|
+
server: string;
|
|
93
|
+
tool: string;
|
|
94
|
+
args?: Record<string, unknown>;
|
|
95
|
+
}
|
|
96
|
+
export type SignalSource = GithubCommitsSource | GithubPrSource | SlackMessagesSource | LinearIssuesSource | ExternalCommandSource | McpToolSource;
|
|
97
|
+
export interface SignalSourcesConfig extends MetaFlags {
|
|
98
|
+
sources: SignalSource[];
|
|
99
|
+
}
|
|
100
|
+
export type WorkflowStateType = "backlog" | "unstarted" | "started" | "completed" | "canceled" | "triage";
|
|
101
|
+
export interface WorkflowState {
|
|
102
|
+
name: string;
|
|
103
|
+
type: WorkflowStateType;
|
|
104
|
+
}
|
|
105
|
+
export type WorkflowRuleTier = "high" | "medium" | "low";
|
|
106
|
+
export interface WorkflowRule {
|
|
107
|
+
id: string;
|
|
108
|
+
tier: WorkflowRuleTier;
|
|
109
|
+
description: string;
|
|
110
|
+
when: Record<string, unknown>;
|
|
111
|
+
action: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
export interface WorkflowsConfig extends MetaFlags {
|
|
114
|
+
states: WorkflowState[];
|
|
115
|
+
rules: WorkflowRule[];
|
|
116
|
+
}
|
|
117
|
+
export type ReferenceSource = "user-file" | "placeholder" | "missing";
|
|
118
|
+
export interface LinearConfig {
|
|
119
|
+
teams: TeamsConfig;
|
|
120
|
+
projects: ProjectsConfig;
|
|
121
|
+
users: UsersConfig;
|
|
122
|
+
slack: SlackConfig;
|
|
123
|
+
repos: ReposConfig;
|
|
124
|
+
signalSources: SignalSourcesConfig;
|
|
125
|
+
workflows: WorkflowsConfig;
|
|
126
|
+
meta: {
|
|
127
|
+
referencesDir: string;
|
|
128
|
+
bundledReferencesDir: string;
|
|
129
|
+
sources: Record<ReferenceName, ReferenceSource>;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export {};
|
|
133
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAEhH,eAAO,MAAM,eAAe,EAAE,aAAa,EAQ1C,CAAC;AAEF,UAAU,SAAS;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC7C,KAAK,EAAE,IAAI,EAAE,CAAC;CACd;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AACnE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAE7F,MAAM,WAAW,OAAO;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,MAAM,CAA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aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IACjD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,KAAK,EAAE,YAAY,EAAE,CAAC;CACtB;AAMD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;AAEtE,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,aAAa,EAAE,mBAAmB,CAAC;IACnC,SAAS,EAAE,eAAe,CAAC;IAC3B,IAAI,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;KAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// TypeScript types mirroring schemas/*.json. Manually kept in sync.
|
|
2
|
+
// The runtime loader validates parsed JSON against the schemas, so these
|
|
3
|
+
// types describe the post-validation shape callers can rely on.
|
|
4
|
+
export const REFERENCE_NAMES = [
|
|
5
|
+
"teams",
|
|
6
|
+
"projects",
|
|
7
|
+
"users",
|
|
8
|
+
"slack",
|
|
9
|
+
"repos",
|
|
10
|
+
"signal-sources",
|
|
11
|
+
"workflows",
|
|
12
|
+
];
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,yEAAyE;AACzE,gEAAgE;AAIhE,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC/C,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,OAAO;IACP,gBAAgB;IAChB,WAAW;CACX,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type OutputMode = "text" | "json";
|
|
2
|
+
export interface FormattedIssue {
|
|
3
|
+
identifier: string;
|
|
4
|
+
title: string;
|
|
5
|
+
state?: string;
|
|
6
|
+
assignee?: string;
|
|
7
|
+
team?: string;
|
|
8
|
+
project?: string;
|
|
9
|
+
priority?: number;
|
|
10
|
+
url?: string;
|
|
11
|
+
updatedAt?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function formatIssuesText(issues: FormattedIssue[]): string;
|
|
14
|
+
export declare function formatIssuesJson(issues: FormattedIssue[]): string;
|
|
15
|
+
export declare function formatIssues(issues: FormattedIssue[], mode: OutputMode): string;
|
|
16
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAejE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAEjE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAE/E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Output formatters for issue lists.
|
|
2
|
+
// Text mode = aligned columns for humans. JSON mode = pretty-printed JSON for scripts / agents.
|
|
3
|
+
const COLUMN_WIDTHS = { identifier: 10, state: 14, assignee: 24 };
|
|
4
|
+
const TITLE_MAX = 70;
|
|
5
|
+
function truncate(text, max) {
|
|
6
|
+
if (text.length <= max)
|
|
7
|
+
return text;
|
|
8
|
+
return `${text.slice(0, max - 1)}…`;
|
|
9
|
+
}
|
|
10
|
+
function padRight(text, width) {
|
|
11
|
+
if (text.length >= width)
|
|
12
|
+
return `${text.slice(0, width - 1)} `;
|
|
13
|
+
return text + " ".repeat(width - text.length);
|
|
14
|
+
}
|
|
15
|
+
export function formatIssuesText(issues) {
|
|
16
|
+
if (issues.length === 0)
|
|
17
|
+
return "No issues found.";
|
|
18
|
+
const header = padRight("ID", COLUMN_WIDTHS.identifier) +
|
|
19
|
+
padRight("State", COLUMN_WIDTHS.state) +
|
|
20
|
+
padRight("Assignee", COLUMN_WIDTHS.assignee) +
|
|
21
|
+
"Title";
|
|
22
|
+
const rows = issues.map((issue) => padRight(issue.identifier, COLUMN_WIDTHS.identifier) +
|
|
23
|
+
padRight(issue.state ?? "-", COLUMN_WIDTHS.state) +
|
|
24
|
+
padRight(issue.assignee ?? "-", COLUMN_WIDTHS.assignee) +
|
|
25
|
+
truncate(issue.title, TITLE_MAX));
|
|
26
|
+
return [header, ...rows].join("\n");
|
|
27
|
+
}
|
|
28
|
+
export function formatIssuesJson(issues) {
|
|
29
|
+
return JSON.stringify(issues, null, 2);
|
|
30
|
+
}
|
|
31
|
+
export function formatIssues(issues, mode) {
|
|
32
|
+
return mode === "json" ? formatIssuesJson(issues) : formatIssuesText(issues);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,gGAAgG;AAgBhG,MAAM,aAAa,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAW,CAAC;AAC3E,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW;IAC1C,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;AACrC,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,KAAa;IAC5C,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC;IAChE,OAAO,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACxD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,kBAAkB,CAAC;IACnD,MAAM,MAAM,GACX,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC;QACxC,QAAQ,CAAC,OAAO,EAAE,aAAa,C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