@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.
Files changed (48) hide show
  1. package/README.md +8 -0
  2. package/dist/cli/{action-NQRSZEC5.js → action-MCR4BCSE.js} +5 -5
  3. package/dist/cli/ask-L3PSQZ2K.js +17 -0
  4. package/dist/cli/{attach-KXOSFUHO.js → attach-R7FT7LFH.js} +9 -14
  5. package/dist/cli/brain-BJTBN2ZK.js +20 -0
  6. package/dist/cli/{bridge-XCTXVWKH.js → bridge-YBHXFEFX.js} +2 -2
  7. package/dist/cli/{chunk-VKRFHDRK.js → chunk-2X56ZRK7.js} +1122 -1164
  8. package/dist/cli/{chunk-3NQNWGDX.js → chunk-6EW2FD2U.js} +3 -5
  9. package/dist/cli/chunk-DJMFCYF4.js +60 -0
  10. package/dist/cli/chunk-DLKJOK3B.js +6 -0
  11. package/dist/cli/{chunk-VMGACWNP.js → chunk-FWLT3SAN.js} +1 -1
  12. package/dist/cli/{chunk-6IYPRUQG.js → chunk-G3ST5WKR.js} +1 -1
  13. package/dist/cli/{chunk-ZI47U5CQ.js → chunk-GY35ZR5I.js} +102 -72
  14. package/dist/cli/{chunk-NLL2EQJ2.js → chunk-KBSXP63H.js} +22 -7
  15. package/dist/cli/chunk-LOXLGCGN.js +57 -0
  16. package/dist/cli/{chunk-LG3XFIPV.js → chunk-O4MUYFPH.js} +6 -7
  17. package/dist/cli/{chunk-JLUHY5AB.js → chunk-OR2NHT5O.js} +4 -4
  18. package/dist/cli/chunk-S6BZV7AY.js +57 -0
  19. package/dist/cli/{chunk-CR3LGTZQ.js → chunk-TCQ5PYIF.js} +3 -3
  20. package/dist/cli/{chunk-RYZ6FHYT.js → chunk-UMQGRTA4.js} +17 -39
  21. package/dist/cli/{chunk-3CF4FQWG.js → chunk-VQR5ME75.js} +4 -3
  22. package/dist/cli/{chunk-HOOHS3MX.js → chunk-W724IVDC.js} +1 -1
  23. package/dist/cli/{chunk-K7UEKSB2.js → chunk-WYRQZA4G.js} +2 -2
  24. package/dist/cli/chunk-XTDE2URL.js +365 -0
  25. package/dist/cli/daemon-ICC6LBCO.js +16562 -0
  26. package/dist/cli/{decide-OSSTI3FE.js → decide-JSY46QZC.js} +14 -16
  27. package/dist/cli/{handover-2G7OEWIG.js → handover-5RUSRVAD.js} +5 -5
  28. package/dist/cli/{hook-XY4E5H7O.js → hook-QQP3ENGA.js} +87 -81
  29. package/dist/cli/index.js +40 -28
  30. package/dist/cli/launch-RTBGUJSC.js +28 -0
  31. package/dist/cli/{send-RUHGKLMA.js → send-BIIH6SQW.js} +5 -5
  32. package/dist/cli/{setup-K42IVMHS.js → setup-OLVRJLJE.js} +4 -4
  33. package/dist/cli/{status-4Z2VJFID.js → status-Z3I33KZJ.js} +3 -3
  34. package/dist/cli/{tui-4IRYQXYU.js → tui-AIXCETOB.js} +6036 -3629
  35. package/dist/cli/{uninstall-4IMMR55T.js → uninstall-X65CWHIJ.js} +4 -4
  36. package/dist/cli/{version-L2Y7MRH6.js → version-QMHFVP3N.js} +1 -1
  37. package/dist/cli/who-C2VMEM35.js +12 -0
  38. package/package.json +21 -6
  39. package/dist/cli/chunk-CIQAFCX3.js +0 -118
  40. package/dist/cli/chunk-JHFKBKSO.js +0 -159
  41. package/dist/cli/chunk-OYDTU6AP.js +0 -9482
  42. package/dist/cli/chunk-QSRB3F5Y.js +0 -198
  43. package/dist/cli/chunk-UME2F7VM.js +0 -6
  44. package/dist/cli/daemon-ZUHJKLSL.js +0 -2322
  45. package/dist/cli/launch-7WOARLZM.js +0 -35
  46. package/dist/cli/task-2GESYTOL.js +0 -19
  47. package/dist/cli/team-MTSKNMAE.js +0 -205
  48. package/dist/cli/who-PSKHASMK.js +0 -12
@@ -1,198 +0,0 @@
1
- import {
2
- definitionDirs,
3
- definitionFiles,
4
- definitionHash,
5
- listRoles,
6
- quoteScalar,
7
- readSmall,
8
- scalarValue
9
- } from "./chunk-JHFKBKSO.js";
10
- import {
11
- SeatsSchema,
12
- TeamNameSchema
13
- } from "./chunk-VKRFHDRK.js";
14
- import {
15
- log
16
- } from "./chunk-6IYPRUQG.js";
17
- import {
18
- ledgeDir
19
- } from "./chunk-HOOHS3MX.js";
20
-
21
- // src/daemon/teams.ts
22
- import { existsSync, writeFileSync, mkdirSync, renameSync } from "fs";
23
- import { join } from "path";
24
- var scalar = scalarValue;
25
- function flowMap(raw) {
26
- const inner = raw.trim().replace(/^\{/, "").replace(/\}$/, "");
27
- const out = {};
28
- for (const part of inner.split(",")) {
29
- if (!part.trim()) continue;
30
- const i = part.indexOf(":");
31
- if (i <= 0) throw new Error(`not a key: value pair: ${part.trim().slice(0, 40)}`);
32
- out[part.slice(0, i).trim()] = scalar(part.slice(i + 1));
33
- }
34
- return out;
35
- }
36
- function parseTemplateText(text) {
37
- const src = text.replace(/^/, "").replace(/\r\n/g, "\n");
38
- if (src.trimStart().startsWith("{")) return JSON.parse(src);
39
- const out = {};
40
- let list = null;
41
- let item = null;
42
- let itemIndent = -1;
43
- for (const raw of src.split("\n")) {
44
- if (!raw.trim() || raw.trimStart().startsWith("#")) continue;
45
- if (raw.includes(" ")) throw new Error("tabs are not allowed in YAML");
46
- const indent = raw.length - raw.trimStart().length;
47
- const line = raw.trim();
48
- if (indent === 0 && !line.startsWith("- ")) {
49
- item = null;
50
- list = null;
51
- const i2 = line.indexOf(":");
52
- if (i2 <= 0) throw new Error(`line without a key: ${line.slice(0, 60)}`);
53
- const key = line.slice(0, i2).trim();
54
- const rest = line.slice(i2 + 1).trim();
55
- if (rest === "") {
56
- list = [];
57
- out[key] = list;
58
- } else if (rest.startsWith("[")) out[key] = rest.replace(/^\[|\]$/g, "").split(",").map(scalar).filter(Boolean);
59
- else out[key] = scalar(rest);
60
- continue;
61
- }
62
- if (!list) throw new Error(`indented line outside a list: ${line.slice(0, 60)}`);
63
- if (line.startsWith("- ") || line === "-") {
64
- const rest = line.slice(1).trim();
65
- if (rest.startsWith("{")) {
66
- list.push(flowMap(rest));
67
- item = null;
68
- continue;
69
- }
70
- item = {};
71
- itemIndent = indent;
72
- list.push(item);
73
- if (rest) {
74
- const i2 = rest.indexOf(":");
75
- if (i2 <= 0) {
76
- list[list.length - 1] = scalar(rest);
77
- item = null;
78
- continue;
79
- }
80
- item[rest.slice(0, i2).trim()] = scalar(rest.slice(i2 + 1));
81
- }
82
- continue;
83
- }
84
- if (!item || indent <= itemIndent) throw new Error(`line outside a seat: ${line.slice(0, 60)}`);
85
- const i = line.indexOf(":");
86
- if (i <= 0) throw new Error(`line without a key: ${line.slice(0, 60)}`);
87
- item[line.slice(0, i).trim()] = scalar(line.slice(i + 1));
88
- }
89
- return out;
90
- }
91
- function parseTemplate(id, text, source, path) {
92
- let raw;
93
- try {
94
- raw = parseTemplateText(text);
95
- } catch (e) {
96
- return e.message;
97
- }
98
- const name = TeamNameSchema.safeParse(typeof raw.name === "string" ? raw.name : id);
99
- if (!name.success) return "name: a name of 1 to 60 characters";
100
- const seats = SeatsSchema.safeParse(raw.seats);
101
- if (!seats.success) {
102
- const issue = seats.error.issues[0];
103
- return `seats${issue.path.length ? `.${issue.path.join(".")}` : ""}: ${issue.message}`;
104
- }
105
- return { id, name: name.data, seats: seats.data, source, path };
106
- }
107
- function loadTemplate(id, path, source, problems) {
108
- let t;
109
- try {
110
- const text = readSmall(path);
111
- t = parseTemplate(id, text, source, path);
112
- if (typeof t !== "string") t = { ...t, hash: definitionHash(text) };
113
- } catch (e) {
114
- t = e.message;
115
- }
116
- if (typeof t === "string") {
117
- log(`team ${path} skipped: ${t}`);
118
- problems.push({ path, reason: t });
119
- return void 0;
120
- }
121
- return t;
122
- }
123
- function listTemplates(cwd) {
124
- const templates = /* @__PURE__ */ new Map();
125
- const problems = [];
126
- for (const { dir, source } of definitionDirs("teams", cwd)) {
127
- for (const path of definitionFiles(dir, [".yaml", ".yml"])) {
128
- const id = path.slice(dir.length + 1).replace(/\.ya?ml$/, "");
129
- if (templates.has(id)) continue;
130
- const t = loadTemplate(id, path, source, problems);
131
- if (t) templates.set(id, t);
132
- }
133
- }
134
- return { templates: [...templates.values()].sort((a, b) => a.id.localeCompare(b.id)), problems };
135
- }
136
- function resolveSeats(seats, roles, defaults = { tool: "claude" }) {
137
- const byId = new Map(roles.map((r) => [r.id, r]));
138
- const unknown = seats.filter((s) => !byId.has(s.role)).map((s) => s.role);
139
- if (unknown.length) return { unknown };
140
- return seats.map((s) => {
141
- const role = byId.get(s.role);
142
- const tool = s.tool ?? role.tool ?? defaults.tool;
143
- const own = s.tool === void 0 || s.tool === role.tool;
144
- const model = s.model ?? (own ? role.model : void 0) ?? (tool === defaults.tool ? defaults.model : void 0);
145
- const effort = s.effort ?? (own ? role.effort : void 0) ?? (tool === defaults.tool ? defaults.effort : void 0);
146
- return { role, tool, ...model ? { model } : {}, ...effort ? { effort } : {}, ...s.name ? { name: s.name } : {} };
147
- });
148
- }
149
- function listDefinitions(cwd) {
150
- const r = listRoles(cwd);
151
- const t = listTemplates(cwd);
152
- return { roles: r.roles, templates: t.templates, problems: [...r.problems, ...t.problems] };
153
- }
154
- function templateId(name) {
155
- const id = name.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64);
156
- return id || "team";
157
- }
158
- var SEAT_KEYS = ["role", "tool", "model", "effort", "name"];
159
- function templateText(name, seats) {
160
- const q = (v) => v.includes(" ") ? null : quoteScalar(v);
161
- const head = q(name);
162
- if (head === null) return null;
163
- const lines = [`name: ${head}`, "seats:"];
164
- for (const s of seats) {
165
- let first = true;
166
- for (const k of SEAT_KEYS) {
167
- if (s[k] === void 0) continue;
168
- const v = q(String(s[k]));
169
- if (v === null) return null;
170
- lines.push(`${first ? " - " : " "}${k}: ${v}`);
171
- first = false;
172
- }
173
- }
174
- return `${lines.join("\n")}
175
- `;
176
- }
177
- var templatePath = (name, dir) => join(dir, `${templateId(name)}.yaml`);
178
- var templateExists = (name, dir = join(ledgeDir(), "teams")) => existsSync(templatePath(name, dir));
179
- function saveTemplate(name, seats, dir = join(ledgeDir(), "teams")) {
180
- const path = templatePath(name, dir);
181
- const text = templateText(name, seats);
182
- if (text === null) throw new Error("a team name or seat value cannot be written as YAML");
183
- mkdirSync(dir, { recursive: true });
184
- const tmp = `${path}.tmp`;
185
- writeFileSync(tmp, text);
186
- renameSync(tmp, path);
187
- return path;
188
- }
189
-
190
- export {
191
- loadTemplate,
192
- resolveSeats,
193
- listDefinitions,
194
- templateId,
195
- templateText,
196
- templateExists,
197
- saveTemplate
198
- };
@@ -1,6 +0,0 @@
1
- // src/version.ts
2
- var LEDGE_VERSION = true ? "0.28.0" : "0.0.0-dev";
3
-
4
- export {
5
- LEDGE_VERSION
6
- };