@paradow/ledge 0.28.0 → 0.29.0-snapshot.41297455946.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 +8 -0
- package/dist/cli/{action-NQRSZEC5.js → action-MCR4BCSE.js} +5 -5
- package/dist/cli/ask-L3PSQZ2K.js +17 -0
- package/dist/cli/{attach-KXOSFUHO.js → attach-R7FT7LFH.js} +9 -14
- package/dist/cli/brain-BJTBN2ZK.js +20 -0
- package/dist/cli/{bridge-XCTXVWKH.js → bridge-YBHXFEFX.js} +2 -2
- package/dist/cli/{chunk-VKRFHDRK.js → chunk-2X56ZRK7.js} +1122 -1164
- package/dist/cli/{chunk-3NQNWGDX.js → chunk-6EW2FD2U.js} +3 -5
- package/dist/cli/chunk-DJMFCYF4.js +60 -0
- package/dist/cli/chunk-DLKJOK3B.js +6 -0
- package/dist/cli/{chunk-VMGACWNP.js → chunk-FWLT3SAN.js} +1 -1
- package/dist/cli/{chunk-6IYPRUQG.js → chunk-G3ST5WKR.js} +1 -1
- package/dist/cli/{chunk-ZI47U5CQ.js → chunk-GY35ZR5I.js} +102 -72
- package/dist/cli/{chunk-NLL2EQJ2.js → chunk-KBSXP63H.js} +22 -7
- package/dist/cli/chunk-LOXLGCGN.js +57 -0
- package/dist/cli/{chunk-LG3XFIPV.js → chunk-O4MUYFPH.js} +6 -7
- package/dist/cli/{chunk-JLUHY5AB.js → chunk-OR2NHT5O.js} +4 -4
- package/dist/cli/chunk-S6BZV7AY.js +57 -0
- package/dist/cli/{chunk-CR3LGTZQ.js → chunk-TCQ5PYIF.js} +3 -3
- package/dist/cli/{chunk-RYZ6FHYT.js → chunk-UMQGRTA4.js} +17 -39
- package/dist/cli/{chunk-3CF4FQWG.js → chunk-VQR5ME75.js} +4 -3
- package/dist/cli/{chunk-HOOHS3MX.js → chunk-W724IVDC.js} +1 -1
- package/dist/cli/{chunk-K7UEKSB2.js → chunk-WYRQZA4G.js} +2 -2
- package/dist/cli/chunk-XTDE2URL.js +365 -0
- package/dist/cli/daemon-ICC6LBCO.js +16562 -0
- package/dist/cli/{decide-OSSTI3FE.js → decide-JSY46QZC.js} +14 -16
- package/dist/cli/{handover-2G7OEWIG.js → handover-5RUSRVAD.js} +5 -5
- package/dist/cli/{hook-XY4E5H7O.js → hook-QQP3ENGA.js} +87 -81
- package/dist/cli/index.js +40 -28
- package/dist/cli/launch-RTBGUJSC.js +28 -0
- package/dist/cli/{send-RUHGKLMA.js → send-BIIH6SQW.js} +5 -5
- package/dist/cli/{setup-K42IVMHS.js → setup-OLVRJLJE.js} +4 -4
- package/dist/cli/{status-4Z2VJFID.js → status-Z3I33KZJ.js} +3 -3
- package/dist/cli/{tui-4IRYQXYU.js → tui-AIXCETOB.js} +6036 -3629
- package/dist/cli/{uninstall-4IMMR55T.js → uninstall-X65CWHIJ.js} +4 -4
- package/dist/cli/{version-L2Y7MRH6.js → version-QMHFVP3N.js} +1 -1
- package/dist/cli/who-C2VMEM35.js +12 -0
- package/package.json +21 -6
- package/dist/cli/chunk-CIQAFCX3.js +0 -118
- package/dist/cli/chunk-JHFKBKSO.js +0 -159
- package/dist/cli/chunk-OYDTU6AP.js +0 -9482
- package/dist/cli/chunk-QSRB3F5Y.js +0 -198
- package/dist/cli/chunk-UME2F7VM.js +0 -6
- package/dist/cli/daemon-ZUHJKLSL.js +0 -2322
- package/dist/cli/launch-7WOARLZM.js +0 -35
- package/dist/cli/task-2GESYTOL.js +0 -19
- package/dist/cli/team-MTSKNMAE.js +0 -205
- package/dist/cli/who-PSKHASMK.js +0 -12
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
SERVICE,
|
|
4
4
|
execRunner,
|
|
5
5
|
stopDetachedDaemon
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-WYRQZA4G.js";
|
|
7
|
+
import "./chunk-KBSXP63H.js";
|
|
8
|
+
import "./chunk-G3ST5WKR.js";
|
|
9
9
|
import {
|
|
10
10
|
paths
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-W724IVDC.js";
|
|
12
12
|
import "./chunk-U67V476Y.js";
|
|
13
13
|
|
|
14
14
|
// src/cli/uninstall.ts
|
package/package.json
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paradow/ledge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0-snapshot.41297455946.1",
|
|
4
4
|
"description": "Follow and answer your WSL agent sessions (Claude Code, Codex, Cursor Agent) from the Ledge island on Windows.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
6
|
+
"bin": {
|
|
7
|
+
"ledge": "dist/cli/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"assets/ledge.ico"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/Lyssaen/ledge.git",
|
|
19
|
+
"directory": "packages/ledge"
|
|
20
|
+
},
|
|
10
21
|
"homepage": "https://github.com/Lyssaen/ledge#readme",
|
|
11
22
|
"license": "UNLICENSED",
|
|
12
|
-
"publishConfig": {
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
|
+
},
|
|
13
27
|
"scripts": {
|
|
14
28
|
"dev": "tsx src/cli/index.ts",
|
|
15
29
|
"build": "tsup",
|
|
@@ -22,6 +36,7 @@
|
|
|
22
36
|
"react": "^19.3.0",
|
|
23
37
|
"string-width": "^8.3.0",
|
|
24
38
|
"ws": "^8.18.0",
|
|
39
|
+
"yaml": "^2.9.1",
|
|
25
40
|
"zod": "^3.23.8"
|
|
26
41
|
},
|
|
27
42
|
"devDependencies": {
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CODEX_HOOK_VAR
|
|
3
|
-
} from "./chunk-LG3XFIPV.js";
|
|
4
|
-
import {
|
|
5
|
-
connect
|
|
6
|
-
} from "./chunk-VMGACWNP.js";
|
|
7
|
-
import {
|
|
8
|
-
LEDGE_GIVER,
|
|
9
|
-
TASK_TEXT_MAX,
|
|
10
|
-
TASK_TITLE_MAX
|
|
11
|
-
} from "./chunk-VKRFHDRK.js";
|
|
12
|
-
|
|
13
|
-
// src/cli/task.ts
|
|
14
|
-
import { randomUUID } from "crypto";
|
|
15
|
-
var TASK_USAGE = `ledge task give <nom|@r\xF4le> "<titre>" ["<d\xE9tail>"] confier un travail \xE0 une session (@r\xF4le : dans ton \xE9quipe)
|
|
16
|
-
ledge task give ledge "<question>" "<options, recommandation>" une d\xE9cision pour l'utilisateur ; sa r\xE9ponse te r\xE9veille
|
|
17
|
-
ledge task list [--all] tes t\xE2ches (tenues ou confi\xE9es), ouvertes ; --all : closes aussi
|
|
18
|
-
ledge task show <id> une t\xE2che, son d\xE9tail et son historique
|
|
19
|
-
ledge task take <id> la prendre
|
|
20
|
-
ledge task done <id> "<r\xE9sultat>" la terminer, avec ce qui en est sorti (la session qui l'a confi\xE9e est pr\xE9venue)
|
|
21
|
-
ledge task refuse <id> "<raison>" la refuser, ou l'annuler si tu l'as confi\xE9e
|
|
22
|
-
ledge task pass <id> <nom|@r\xF4le> ["<note>"] la passer \xE0 une autre session`;
|
|
23
|
-
var TASK_MS = 4e3;
|
|
24
|
-
var ID = /^t[0-9a-f]{6}$/;
|
|
25
|
-
function taskArgs(args) {
|
|
26
|
-
const [op, ...rest] = args;
|
|
27
|
-
const id = rest[0] && ID.test(rest[0]) ? rest[0] : void 0;
|
|
28
|
-
const fits = (min, max) => rest.length >= min && rest.length <= max && rest.slice(0, min).every((a) => a.trim() !== "");
|
|
29
|
-
switch (op) {
|
|
30
|
-
case "give":
|
|
31
|
-
return fits(2, 3) && rest[1].length <= TASK_TITLE_MAX && (rest[2]?.length ?? 0) <= TASK_TEXT_MAX ? { op, to: rest[0], title: rest[1], ...rest[2] ? { text: rest[2] } : {} } : void 0;
|
|
32
|
-
case "list":
|
|
33
|
-
return rest.length === 0 ? { op } : rest.length === 1 && rest[0] === "--all" ? { op, all: true } : void 0;
|
|
34
|
-
case "show":
|
|
35
|
-
case "take":
|
|
36
|
-
return fits(1, 1) && id ? { op, task: id } : void 0;
|
|
37
|
-
case "done":
|
|
38
|
-
return fits(2, 2) && id && rest[1].length <= TASK_TEXT_MAX ? { op, task: id, text: rest[1] } : void 0;
|
|
39
|
-
case "refuse":
|
|
40
|
-
return fits(2, 2) && id && rest[1].length <= TASK_TEXT_MAX ? { op, task: id, text: rest[1] } : void 0;
|
|
41
|
-
case "pass":
|
|
42
|
-
return fits(2, 3) && id && (rest[2]?.length ?? 0) <= TASK_TEXT_MAX ? { op, task: id, to: rest[1], ...rest[2] ? { text: rest[2] } : {} } : void 0;
|
|
43
|
-
default:
|
|
44
|
-
return void 0;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
var STATE = { open: "\xE0 prendre", taken: "prise", done: "termin\xE9e", refused: "refus\xE9e", dropped: "abandonn\xE9e" };
|
|
48
|
-
var time = (iso) => iso.slice(0, 16).replace("T", " ");
|
|
49
|
-
function formatTask(t) {
|
|
50
|
-
return [
|
|
51
|
-
`${t.id} \xB7 ${STATE[t.state]} \xB7 de ${t.giverName} \xE0 ${t.ownerName} \xB7 ${time(t.at)}`,
|
|
52
|
-
t.title,
|
|
53
|
-
...t.text ? ["", t.text] : [],
|
|
54
|
-
...t.result ? ["", `${t.state === "done" ? "R\xE9sultat" : "Raison"} : ${t.result}`] : [],
|
|
55
|
-
"",
|
|
56
|
-
"Historique :",
|
|
57
|
-
...t.log.map((l) => ` ${time(l.at)} ${l.by} : ${l.what}`)
|
|
58
|
-
].join("\n");
|
|
59
|
-
}
|
|
60
|
-
async function taskOnClient(client, args, by, ms) {
|
|
61
|
-
const op = taskArgs(args);
|
|
62
|
-
if (!op) return { line: TASK_USAGE, code: 1 };
|
|
63
|
-
if (by === LEDGE_GIVER) return { line: "refus\xE9 : seul Ledge confie une t\xE2che en son nom", code: 1 };
|
|
64
|
-
try {
|
|
65
|
-
client.send({ type: "task.cmd", rid: randomUUID(), by, ...op });
|
|
66
|
-
const r = await client.next("task.result", ms);
|
|
67
|
-
if (r.reason !== void 0) return { line: `refus\xE9 : ${r.reason}`, code: 1 };
|
|
68
|
-
if (op.op === "list") {
|
|
69
|
-
const list = r.tasks ?? [];
|
|
70
|
-
if (!list.length) return { line: op.all ? "aucune t\xE2che" : "aucune t\xE2che ouverte", code: 0 };
|
|
71
|
-
return { line: list.map((t2) => `${t2.id} ${STATE[t2.state].padEnd(10)} ${t2.giverName} \u2192 ${t2.ownerName} ${t2.title}`).join("\n"), code: 0 };
|
|
72
|
-
}
|
|
73
|
-
const t = r.task;
|
|
74
|
-
switch (op.op) {
|
|
75
|
-
case "give":
|
|
76
|
-
return { line: t.owner === LEDGE_GIVER ? `d\xE9cision ${t.id} pos\xE9e \xE0 l'utilisateur (ledge decide) : sa r\xE9ponse t'arrivera comme une t\xE2che termin\xE9e` : `t\xE2che ${t.id} confi\xE9e \xE0 ${t.ownerName} : elle lui arrive \xE0 son prochain moment libre`, code: 0 };
|
|
77
|
-
case "take":
|
|
78
|
-
return { line: `t\xE2che ${t.id} prise`, code: 0 };
|
|
79
|
-
case "done":
|
|
80
|
-
return { line: `t\xE2che ${t.id} termin\xE9e ; Ledge pr\xE9vient ${t.giverName}`, code: 0 };
|
|
81
|
-
case "refuse":
|
|
82
|
-
return { line: t.giver === by ? `t\xE2che ${t.id} annul\xE9e ; Ledge pr\xE9vient ${t.ownerName}` : `t\xE2che ${t.id} refus\xE9e ; Ledge pr\xE9vient ${t.giverName}`, code: 0 };
|
|
83
|
-
case "pass":
|
|
84
|
-
return { line: `t\xE2che ${t.id} pass\xE9e \xE0 ${t.ownerName}`, code: 0 };
|
|
85
|
-
default:
|
|
86
|
-
return { line: formatTask(t), code: 0 };
|
|
87
|
-
}
|
|
88
|
-
} catch (e) {
|
|
89
|
-
return { line: `pas de r\xE9ponse de Ledge : ${e.message}`, code: 1 };
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async function runTask(args, opts = {}) {
|
|
93
|
-
if (!taskArgs(args)) return { line: TASK_USAGE, code: args.length ? 1 : 0 };
|
|
94
|
-
const env = opts.env ?? process.env;
|
|
95
|
-
const by = env[CODEX_HOOK_VAR] || env.LEDGE_SESSION;
|
|
96
|
-
if (!by) return { line: "ledge task ne marche que dans une session lanc\xE9e par Ledge", code: 1 };
|
|
97
|
-
const deadline = Date.now() + (opts.timeoutMs ?? TASK_MS);
|
|
98
|
-
const left = () => Math.max(0, deadline - Date.now());
|
|
99
|
-
let client;
|
|
100
|
-
try {
|
|
101
|
-
client = await connect({ port: opts.port, timeoutMs: left() });
|
|
102
|
-
} catch {
|
|
103
|
-
return { line: "daemon not running (start a session with `ledge claude`, or run `ledge daemon`)", code: 1 };
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
return await taskOnClient(client, args, by, left());
|
|
107
|
-
} finally {
|
|
108
|
-
await client.close();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export {
|
|
113
|
-
TASK_USAGE,
|
|
114
|
-
taskArgs,
|
|
115
|
-
formatTask,
|
|
116
|
-
taskOnClient,
|
|
117
|
-
runTask
|
|
118
|
-
};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ROLE_LABEL_MAX,
|
|
3
|
-
ROLE_PROMPT_MAX,
|
|
4
|
-
RoleSchema
|
|
5
|
-
} from "./chunk-VKRFHDRK.js";
|
|
6
|
-
import {
|
|
7
|
-
log
|
|
8
|
-
} from "./chunk-6IYPRUQG.js";
|
|
9
|
-
import {
|
|
10
|
-
ledgeDir
|
|
11
|
-
} from "./chunk-HOOHS3MX.js";
|
|
12
|
-
|
|
13
|
-
// src/daemon/roles.ts
|
|
14
|
-
import { createHash } from "crypto";
|
|
15
|
-
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|
|
16
|
-
import { dirname, join, resolve } from "path";
|
|
17
|
-
var FILE_MAX = 64 * 1024;
|
|
18
|
-
function repoRoot(cwd) {
|
|
19
|
-
const start = resolve(cwd);
|
|
20
|
-
for (let dir = start; ; dir = dirname(dir)) {
|
|
21
|
-
if (existsSync(join(dir, ".git"))) return dir;
|
|
22
|
-
if (dirname(dir) === dir) return start;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function definitionDirs(kind, cwd) {
|
|
26
|
-
const home = join(ledgeDir(), kind);
|
|
27
|
-
const repo = cwd ? join(repoRoot(cwd), ".ledge", kind) : void 0;
|
|
28
|
-
return [...repo && resolve(repo) !== resolve(home) ? [{ dir: repo, source: "repo" }] : [], { dir: home, source: "home" }];
|
|
29
|
-
}
|
|
30
|
-
function definitionFiles(dir, ext) {
|
|
31
|
-
let names;
|
|
32
|
-
try {
|
|
33
|
-
names = readdirSync(dir);
|
|
34
|
-
} catch {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
return names.filter((n) => ext.some((e) => n.endsWith(e)) && !n.startsWith(".")).sort().map((n) => join(dir, n)).filter((p) => {
|
|
38
|
-
try {
|
|
39
|
-
return statSync(p).isFile();
|
|
40
|
-
} catch {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function readSmall(path) {
|
|
46
|
-
if (statSync(path).size > FILE_MAX) throw new Error(`file over ${FILE_MAX / 1024} KB`);
|
|
47
|
-
return readFileSync(path, "utf8");
|
|
48
|
-
}
|
|
49
|
-
function frontMatter(text) {
|
|
50
|
-
const src = text.replace(/^/, "").replace(/\r\n/g, "\n");
|
|
51
|
-
const m = /^---\n([\s\S]*?)\n---[ \t]*(?:\n|$)/.exec(src);
|
|
52
|
-
if (!m) return { fields: {}, body: src.trim() };
|
|
53
|
-
const fields = {};
|
|
54
|
-
for (const raw of m[1].split("\n")) {
|
|
55
|
-
const line = raw.trim();
|
|
56
|
-
if (!line || line.startsWith("#")) continue;
|
|
57
|
-
const i = line.indexOf(":");
|
|
58
|
-
if (i <= 0) throw new Error(`front matter line without a key: ${line.replace(/\s+#.*$/, "").slice(0, 60)}`);
|
|
59
|
-
fields[line.slice(0, i).trim()] = scalarValue(line.slice(i + 1));
|
|
60
|
-
}
|
|
61
|
-
return { fields, body: src.slice(m[0].length).trim() };
|
|
62
|
-
}
|
|
63
|
-
function scalarValue(raw) {
|
|
64
|
-
const v = raw.trim();
|
|
65
|
-
const q = v[0];
|
|
66
|
-
if (q === '"' || q === "'") {
|
|
67
|
-
const end = v.indexOf(q, 1);
|
|
68
|
-
if (end > 0 && /^(\s+#.*)?$/.test(v.slice(end + 1))) return v.slice(1, end);
|
|
69
|
-
}
|
|
70
|
-
return unquote(v.replace(/(^|\s)#.*$/, "").trim());
|
|
71
|
-
}
|
|
72
|
-
function quoteScalar(v) {
|
|
73
|
-
if (/[\r\n]/.test(v)) return null;
|
|
74
|
-
if (/^[\w./@:+-]+$/.test(v) && !/^(true|false|null|yes|no|~)$/i.test(v)) return v;
|
|
75
|
-
if (!v.includes('"')) return `"${v}"`;
|
|
76
|
-
if (!v.includes("'")) return `'${v}'`;
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
var definitionHash = (text) => createHash("sha256").update(text).digest("hex").slice(0, 16);
|
|
80
|
-
var unquote = (v) => v.length >= 2 && (v[0] === '"' || v[0] === "'") && v.at(-1) === v[0] ? v.slice(1, -1) : v;
|
|
81
|
-
var ROLE_KEYS = /* @__PURE__ */ new Set(["label", "tool", "model", "effort", "autonomy"]);
|
|
82
|
-
function parseRole(id, text, source, path) {
|
|
83
|
-
let parsed;
|
|
84
|
-
try {
|
|
85
|
-
parsed = frontMatter(text);
|
|
86
|
-
} catch (e) {
|
|
87
|
-
return e.message;
|
|
88
|
-
}
|
|
89
|
-
const { fields, body } = parsed;
|
|
90
|
-
const unknown = Object.keys(fields).find((k) => !ROLE_KEYS.has(k));
|
|
91
|
-
if (unknown) return `unknown key ${unknown}`;
|
|
92
|
-
if (body.length > ROLE_PROMPT_MAX) return `prompt over ${ROLE_PROMPT_MAX} characters`;
|
|
93
|
-
const label = (fields.label ?? id).slice(0, ROLE_LABEL_MAX);
|
|
94
|
-
const r = RoleSchema.safeParse({
|
|
95
|
-
id,
|
|
96
|
-
label,
|
|
97
|
-
prompt: body,
|
|
98
|
-
source,
|
|
99
|
-
path,
|
|
100
|
-
...fields.tool ? { tool: fields.tool } : {},
|
|
101
|
-
...fields.model ? { model: fields.model } : {},
|
|
102
|
-
...fields.effort ? { effort: fields.effort } : {},
|
|
103
|
-
...fields.autonomy ? { autonomy: fields.autonomy } : {}
|
|
104
|
-
});
|
|
105
|
-
if (!r.success) {
|
|
106
|
-
const issue = r.error.issues[0];
|
|
107
|
-
return `${issue.path.join(".") || "role"}: ${issue.message}`;
|
|
108
|
-
}
|
|
109
|
-
return r.data;
|
|
110
|
-
}
|
|
111
|
-
function loadRole(id, path, source, problems) {
|
|
112
|
-
let r;
|
|
113
|
-
try {
|
|
114
|
-
const text = readSmall(path);
|
|
115
|
-
r = parseRole(id, text, source, path);
|
|
116
|
-
if (typeof r !== "string") r = { ...r, hash: definitionHash(text) };
|
|
117
|
-
} catch (e) {
|
|
118
|
-
r = e.message;
|
|
119
|
-
}
|
|
120
|
-
if (typeof r === "string") {
|
|
121
|
-
log(`role ${path} skipped: ${r}`);
|
|
122
|
-
problems.push({ path, reason: r });
|
|
123
|
-
return void 0;
|
|
124
|
-
}
|
|
125
|
-
return r;
|
|
126
|
-
}
|
|
127
|
-
function listRoles(cwd) {
|
|
128
|
-
const roles = /* @__PURE__ */ new Map();
|
|
129
|
-
const problems = [];
|
|
130
|
-
for (const { dir, source } of definitionDirs("roles", cwd)) {
|
|
131
|
-
for (const path of definitionFiles(dir, [".md"])) {
|
|
132
|
-
const id = path.slice(dir.length + 1, -".md".length);
|
|
133
|
-
const won = roles.get(id);
|
|
134
|
-
if (won) {
|
|
135
|
-
if (source === "home") roles.set(id, { ...won, shadows: path });
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
const r = loadRole(id, path, source, problems);
|
|
139
|
-
if (r) roles.set(id, r);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return { roles: [...roles.values()].sort((a, b) => a.id.localeCompare(b.id)), problems };
|
|
143
|
-
}
|
|
144
|
-
function findRole(id, cwd) {
|
|
145
|
-
return listRoles(cwd).roles.find((r) => r.id === id);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export {
|
|
149
|
-
repoRoot,
|
|
150
|
-
definitionDirs,
|
|
151
|
-
definitionFiles,
|
|
152
|
-
readSmall,
|
|
153
|
-
scalarValue,
|
|
154
|
-
quoteScalar,
|
|
155
|
-
definitionHash,
|
|
156
|
-
loadRole,
|
|
157
|
-
listRoles,
|
|
158
|
-
findRole
|
|
159
|
-
};
|