@cnzgray/dsh-mattpocock-workflow 0.6.0 → 0.8.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 +152 -169
- package/README.zh-CN.md +185 -0
- package/lib/client.js +3721 -2175
- package/lib/index.js +386 -109
- package/package.json +1 -1
- package/skills/README.md +17 -15
- package/skills/README.zh-CN.md +23 -0
- package/skills/engineering/setup-matt-pocock-skills/issue-tracker-gitea.zh.md +0 -73
package/lib/index.js
CHANGED
|
@@ -31,9 +31,13 @@ import { join } from "node:path";
|
|
|
31
31
|
function isRecord(value) {
|
|
32
32
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33
33
|
}
|
|
34
|
+
function readNonNegativeInteger(value) {
|
|
35
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) return void 0;
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
34
38
|
|
|
35
39
|
// src/core/snapshot-store.ts
|
|
36
|
-
var SNAPSHOT_STORE_VERSION =
|
|
40
|
+
var SNAPSHOT_STORE_VERSION = 7;
|
|
37
41
|
var BACKENDS = ["github", "gitlab", "gitea", "markdown"];
|
|
38
42
|
function serializeSnapshotStoreEntry(entry) {
|
|
39
43
|
return JSON.stringify({
|
|
@@ -141,10 +145,18 @@ function readTicket(value) {
|
|
|
141
145
|
if (number !== null && (typeof number !== "number" || !Number.isInteger(number))) return void 0;
|
|
142
146
|
const labels = readStringArray(value.labels);
|
|
143
147
|
if (labels === void 0) return void 0;
|
|
144
|
-
const assignees =
|
|
148
|
+
const assignees = readAuthorArray(value.assignees);
|
|
145
149
|
if (assignees === void 0) return void 0;
|
|
146
150
|
const author = readAuthor(value.author);
|
|
147
151
|
if (author === void 0) return void 0;
|
|
152
|
+
const excerpt = value.excerpt;
|
|
153
|
+
if (excerpt !== void 0 && (typeof excerpt !== "string" || excerpt.length === 0)) {
|
|
154
|
+
return void 0;
|
|
155
|
+
}
|
|
156
|
+
const commentCount = value.commentCount;
|
|
157
|
+
if (commentCount !== void 0 && (typeof commentCount !== "number" || !Number.isInteger(commentCount) || commentCount < 0)) {
|
|
158
|
+
return void 0;
|
|
159
|
+
}
|
|
148
160
|
const closedAt = value.closedAt;
|
|
149
161
|
if (closedAt !== void 0 && typeof closedAt !== "string") return void 0;
|
|
150
162
|
const url = value.url;
|
|
@@ -172,7 +184,9 @@ function readTicket(value) {
|
|
|
172
184
|
...closedAt === void 0 ? {} : { closedAt },
|
|
173
185
|
...url === void 0 ? {} : { url },
|
|
174
186
|
...blockedBy === void 0 ? {} : { blockedBy },
|
|
175
|
-
...typeof parent === "string" ? { parent } : {}
|
|
187
|
+
...typeof parent === "string" ? { parent } : {},
|
|
188
|
+
...excerpt === void 0 ? {} : { excerpt },
|
|
189
|
+
...commentCount === void 0 ? {} : { commentCount }
|
|
176
190
|
};
|
|
177
191
|
}
|
|
178
192
|
function readHierarchy(value) {
|
|
@@ -226,6 +240,16 @@ function readAuthor(value) {
|
|
|
226
240
|
avatarUrl: avatarUrl ?? null
|
|
227
241
|
};
|
|
228
242
|
}
|
|
243
|
+
function readAuthorArray(value) {
|
|
244
|
+
if (!Array.isArray(value)) return void 0;
|
|
245
|
+
const authors = [];
|
|
246
|
+
for (const entry of value) {
|
|
247
|
+
const author = readAuthor(entry);
|
|
248
|
+
if (author === null || author === void 0) return void 0;
|
|
249
|
+
authors.push(author);
|
|
250
|
+
}
|
|
251
|
+
return authors;
|
|
252
|
+
}
|
|
229
253
|
function readState(value) {
|
|
230
254
|
if (value === "open" || value === "closed") return value;
|
|
231
255
|
return void 0;
|
|
@@ -260,11 +284,11 @@ function createNodeSnapshotStore(deps = {}) {
|
|
|
260
284
|
return {
|
|
261
285
|
read: (workspaceRoot) => readWorkspace(dirFor(root, workspaceRoot)),
|
|
262
286
|
write: (entry) => commitEntry(dirFor(root, entry.workspaceRoot), entry),
|
|
263
|
-
remove: (workspaceRoot) =>
|
|
287
|
+
remove: (workspaceRoot) => removeCachedPath(dirFor(root, workspaceRoot)),
|
|
264
288
|
async list() {
|
|
265
289
|
const entries = [];
|
|
266
290
|
for (const meta of await listMetas(root)) {
|
|
267
|
-
const entry = await readWorkspace(
|
|
291
|
+
const entry = await readWorkspace(meta.dir);
|
|
268
292
|
if (entry !== void 0) entries.push(entry);
|
|
269
293
|
}
|
|
270
294
|
return entries;
|
|
@@ -272,7 +296,7 @@ function createNodeSnapshotStore(deps = {}) {
|
|
|
272
296
|
async clear() {
|
|
273
297
|
const metas = await listMetas(root);
|
|
274
298
|
for (const meta of metas) {
|
|
275
|
-
await
|
|
299
|
+
await removeCachedPath(meta.dir);
|
|
276
300
|
}
|
|
277
301
|
return metas.length + await sweepLegacyFiles(root);
|
|
278
302
|
},
|
|
@@ -310,7 +334,7 @@ async function sweepLegacyFiles(root) {
|
|
|
310
334
|
if (!name2.endsWith(".json")) continue;
|
|
311
335
|
const path = join(root, name2);
|
|
312
336
|
if ((await stat2(path)).isDirectory()) continue;
|
|
313
|
-
await
|
|
337
|
+
await removeCachedPath(path);
|
|
314
338
|
removed += 1;
|
|
315
339
|
}
|
|
316
340
|
return removed;
|
|
@@ -321,12 +345,12 @@ async function pruneDirs(root, now) {
|
|
|
321
345
|
const workspaceRoot = meta.entry.workspaceRoot;
|
|
322
346
|
const gone = await isWorkspaceGone(workspaceRoot);
|
|
323
347
|
if (gone === true) {
|
|
324
|
-
await
|
|
348
|
+
await removeCachedPath(meta.dir);
|
|
325
349
|
removed += 1;
|
|
326
350
|
continue;
|
|
327
351
|
}
|
|
328
352
|
if (gone === false && now - meta.entry.fetchedAt > SNAPSHOT_STORE_TTL_MS) {
|
|
329
|
-
await
|
|
353
|
+
await removeCachedPath(meta.dir);
|
|
330
354
|
removed += 1;
|
|
331
355
|
}
|
|
332
356
|
}
|
|
@@ -334,7 +358,7 @@ async function pruneDirs(root, now) {
|
|
|
334
358
|
if (kept.length > SNAPSHOT_STORE_MAX_ENTRIES) {
|
|
335
359
|
const sorted = [...kept].sort((left, right) => left.entry.fetchedAt - right.entry.fetchedAt);
|
|
336
360
|
for (const meta of sorted.slice(0, kept.length - SNAPSHOT_STORE_MAX_ENTRIES)) {
|
|
337
|
-
await
|
|
361
|
+
await removeCachedPath(meta.dir);
|
|
338
362
|
removed += 1;
|
|
339
363
|
}
|
|
340
364
|
}
|
|
@@ -350,6 +374,7 @@ async function patchTicketAt(root, workspaceRoot, ref, patch) {
|
|
|
350
374
|
if (ticket === void 0) return false;
|
|
351
375
|
const updated = {
|
|
352
376
|
...ticket,
|
|
377
|
+
...patch.title === void 0 ? {} : { title: patch.title },
|
|
353
378
|
...patch.labels === void 0 ? {} : { labels: patch.labels },
|
|
354
379
|
...patch.state === void 0 ? {} : { state: patch.state }
|
|
355
380
|
};
|
|
@@ -481,7 +506,7 @@ async function readMetaAt(dir) {
|
|
|
481
506
|
if (entry === void 0) return void 0;
|
|
482
507
|
const manifest = readManifest(payload.manifest);
|
|
483
508
|
if (manifest === void 0) return void 0;
|
|
484
|
-
return { entry, manifest };
|
|
509
|
+
return { dir, entry, manifest };
|
|
485
510
|
}
|
|
486
511
|
function readManifest(value) {
|
|
487
512
|
if (!Array.isArray(value)) return void 0;
|
|
@@ -557,7 +582,7 @@ async function sweepOrphans(dir, live) {
|
|
|
557
582
|
return;
|
|
558
583
|
}
|
|
559
584
|
for (const name2 of names) {
|
|
560
|
-
if (!live.has(name2)) await
|
|
585
|
+
if (!live.has(name2)) await removeCachedPath(join(ticketsDirOf(dir), name2));
|
|
561
586
|
}
|
|
562
587
|
}
|
|
563
588
|
async function writeAtomic(target, content) {
|
|
@@ -568,7 +593,7 @@ async function writeAtomic(target, content) {
|
|
|
568
593
|
await rename(temporary, target);
|
|
569
594
|
await chmod(target, 384);
|
|
570
595
|
} catch (error) {
|
|
571
|
-
await
|
|
596
|
+
await removeCachedPath(temporary).catch(() => void 0);
|
|
572
597
|
throw error;
|
|
573
598
|
}
|
|
574
599
|
}
|
|
@@ -576,10 +601,20 @@ function digest(content) {
|
|
|
576
601
|
return createHash("sha1").update(content).digest("hex");
|
|
577
602
|
}
|
|
578
603
|
function dirFor(root, workspaceRoot) {
|
|
579
|
-
return join(root,
|
|
604
|
+
return join(root, snapshotKeyOf(workspaceRoot));
|
|
605
|
+
}
|
|
606
|
+
var CACHE_REMOVE_OPTIONS = {
|
|
607
|
+
recursive: true,
|
|
608
|
+
force: true,
|
|
609
|
+
maxRetries: 10,
|
|
610
|
+
retryDelay: 50
|
|
611
|
+
};
|
|
612
|
+
async function removeCachedPath(target, impl = rm) {
|
|
613
|
+
await impl(target, CACHE_REMOVE_OPTIONS);
|
|
580
614
|
}
|
|
581
|
-
function
|
|
582
|
-
|
|
615
|
+
function snapshotKeyOf(workspaceRoot, platform = process.platform) {
|
|
616
|
+
const comparable = platform === "win32" ? workspaceRoot.replaceAll("\\", "/").toLowerCase() : workspaceRoot;
|
|
617
|
+
return createHash("sha256").update(comparable).digest("hex").slice(0, 16);
|
|
583
618
|
}
|
|
584
619
|
function ticketFileFor(ref) {
|
|
585
620
|
return `${createHash("sha256").update(ref).digest("hex").slice(0, 16)}.json`;
|
|
@@ -840,9 +875,13 @@ function commandFailureDetail(error) {
|
|
|
840
875
|
}
|
|
841
876
|
|
|
842
877
|
// src/core/author.ts
|
|
878
|
+
function readLogin(value, field) {
|
|
879
|
+
if (!isRecord(value)) return null;
|
|
880
|
+
return readText(value[field]);
|
|
881
|
+
}
|
|
843
882
|
function readAuthor2(value, fields, avatarBaseUrl2) {
|
|
844
883
|
if (!isRecord(value)) return null;
|
|
845
|
-
const login =
|
|
884
|
+
const login = readLogin(value, fields.login);
|
|
846
885
|
if (login === null) return null;
|
|
847
886
|
return {
|
|
848
887
|
login,
|
|
@@ -850,6 +889,15 @@ function readAuthor2(value, fields, avatarBaseUrl2) {
|
|
|
850
889
|
avatarUrl: normalizeAvatarUrl(value[fields.avatarUrl], avatarBaseUrl2)
|
|
851
890
|
};
|
|
852
891
|
}
|
|
892
|
+
function readAuthors(value, fields, avatarBaseUrl2) {
|
|
893
|
+
if (!Array.isArray(value)) return [];
|
|
894
|
+
const authors = [];
|
|
895
|
+
for (const entry of value) {
|
|
896
|
+
const author = readAuthor2(entry, fields, avatarBaseUrl2);
|
|
897
|
+
if (author !== null) authors.push(author);
|
|
898
|
+
}
|
|
899
|
+
return authors;
|
|
900
|
+
}
|
|
853
901
|
function normalizeAvatarUrl(value, baseUrl) {
|
|
854
902
|
if (typeof value !== "string") return null;
|
|
855
903
|
const trimmed = value.trim();
|
|
@@ -868,6 +916,17 @@ function readText(value) {
|
|
|
868
916
|
return text.length === 0 ? null : text;
|
|
869
917
|
}
|
|
870
918
|
|
|
919
|
+
// src/core/excerpt.ts
|
|
920
|
+
var EXCERPT_LIMIT = 240;
|
|
921
|
+
function plainExcerpt(text, limit = EXCERPT_LIMIT) {
|
|
922
|
+
const max = Math.max(1, Math.trunc(limit));
|
|
923
|
+
const cleaned = text.replace(/\r\n?/g, "\n").replace(/<!--[\s\S]*?-->/g, " ").replace(/<[^>]+>/g, " ").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\[[^\]]*\]/g, "$1").replace(/^\s{0,3}```.*$/gm, "").replace(/^\s{0,3}#{1,6}\s+/gm, "").replace(/^\s{0,3}>\s?/gm, "").replace(/^\s{0,3}(?:[-*+]|\d{1,9}[.)])\s+/gm, "").replace(/^\s*\[[ xX]\]\s*/gm, "").replace(/^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/gm, "").replace(/`+/g, "").replace(/\s+/g, " ").trim();
|
|
924
|
+
if (cleaned.length === 0) return void 0;
|
|
925
|
+
const points = Array.from(cleaned);
|
|
926
|
+
if (points.length <= max) return cleaned;
|
|
927
|
+
return `${points.slice(0, max - 1).join("")}\u2026`;
|
|
928
|
+
}
|
|
929
|
+
|
|
871
930
|
// src/core/ticket-detail.ts
|
|
872
931
|
function diffSets(current, target) {
|
|
873
932
|
const currentSet = new Set(current);
|
|
@@ -1023,6 +1082,8 @@ function parseIssue(value, index, avatarBaseUrl2) {
|
|
|
1023
1082
|
const url = readWebUrl(value.html_url);
|
|
1024
1083
|
const body = typeof value.body === "string" ? value.body : "";
|
|
1025
1084
|
const parent = readParent(body, number);
|
|
1085
|
+
const excerpt = plainExcerpt(giteaExcerptBody(body));
|
|
1086
|
+
const commentCount = readNonNegativeInteger(value.comments);
|
|
1026
1087
|
return {
|
|
1027
1088
|
ticket: {
|
|
1028
1089
|
ref: `#${String(number)}`,
|
|
@@ -1031,18 +1092,23 @@ function parseIssue(value, index, avatarBaseUrl2) {
|
|
|
1031
1092
|
state,
|
|
1032
1093
|
labels: readLabels(value.labels),
|
|
1033
1094
|
author: readAuthor2(value.user, AUTHOR_FIELDS, avatarBaseUrl2),
|
|
1034
|
-
assignees:
|
|
1095
|
+
assignees: readAuthors(value.assignees, AUTHOR_FIELDS, avatarBaseUrl2),
|
|
1035
1096
|
createdAt: readString2(value.created_at, `\u7B2C ${String(number)} \u5F20\u7968\u7684\u521B\u5EFA\u65F6\u95F4`),
|
|
1036
1097
|
updatedAt: readString2(value.updated_at, `\u7B2C ${String(number)} \u5F20\u7968\u7684\u66F4\u65B0\u65F6\u95F4`),
|
|
1037
1098
|
openBlockers: 0,
|
|
1038
1099
|
blockedBy: [],
|
|
1039
1100
|
...closedAt === void 0 ? {} : { closedAt },
|
|
1040
1101
|
...url === void 0 ? {} : { url },
|
|
1041
|
-
...parent === void 0 ? {} : { parent }
|
|
1102
|
+
...parent === void 0 ? {} : { parent },
|
|
1103
|
+
...excerpt === void 0 ? {} : { excerpt },
|
|
1104
|
+
...commentCount === void 0 ? {} : { commentCount }
|
|
1042
1105
|
},
|
|
1043
1106
|
body
|
|
1044
1107
|
};
|
|
1045
1108
|
}
|
|
1109
|
+
function giteaExcerptBody(body) {
|
|
1110
|
+
return body.replace(/^\s*Part of #\d+\s*(?:\r?\n|$)/i, "").replace(/^\s*Blocked by:\s*[^\n]*(?:\r?\n|$)/i, "");
|
|
1111
|
+
}
|
|
1046
1112
|
function readParent(body, number) {
|
|
1047
1113
|
const first = body.split(/\r?\n/).find((line) => line.trim().length > 0);
|
|
1048
1114
|
if (first === void 0) return void 0;
|
|
@@ -1073,16 +1139,6 @@ function parseViewer(body) {
|
|
|
1073
1139
|
const login = payload.login;
|
|
1074
1140
|
return typeof login === "string" && login.length > 0 ? login : null;
|
|
1075
1141
|
}
|
|
1076
|
-
function readAssignees(value) {
|
|
1077
|
-
if (!Array.isArray(value)) return [];
|
|
1078
|
-
const logins = [];
|
|
1079
|
-
for (const assignee of value) {
|
|
1080
|
-
if (!isRecord(assignee)) continue;
|
|
1081
|
-
const login = assignee.login;
|
|
1082
|
-
if (typeof login === "string" && login.length > 0) logins.push(login);
|
|
1083
|
-
}
|
|
1084
|
-
return logins;
|
|
1085
|
-
}
|
|
1086
1142
|
function readString2(value, field) {
|
|
1087
1143
|
if (typeof value !== "string" || value.length === 0) {
|
|
1088
1144
|
throw invalid(`${field} \u4E0D\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
|
|
@@ -1377,6 +1433,9 @@ function parseIssue2(value, index) {
|
|
|
1377
1433
|
const state = readState3(value.state, iid);
|
|
1378
1434
|
const closedAt = readClosedAt2(value.closed_at, iid);
|
|
1379
1435
|
const url = readWebUrl(value.web_url);
|
|
1436
|
+
const description = typeof value.description === "string" ? value.description : "";
|
|
1437
|
+
const excerpt = plainExcerpt(stripLeadingBlockedBy(description));
|
|
1438
|
+
const commentCount = readNonNegativeInteger(value.user_notes_count);
|
|
1380
1439
|
return {
|
|
1381
1440
|
ticket: {
|
|
1382
1441
|
ref: `#${String(iid)}`,
|
|
@@ -1385,18 +1444,23 @@ function parseIssue2(value, index) {
|
|
|
1385
1444
|
state,
|
|
1386
1445
|
labels: readLabels2(value.labels),
|
|
1387
1446
|
author: readAuthor2(value.author, AUTHOR_FIELDS2),
|
|
1388
|
-
assignees:
|
|
1447
|
+
assignees: readAuthors(value.assignees, AUTHOR_FIELDS2),
|
|
1389
1448
|
createdAt: readString3(value.created_at, `\u7B2C ${String(iid)} \u5F20\u7968\u7684\u521B\u5EFA\u65F6\u95F4`),
|
|
1390
1449
|
updatedAt: readString3(value.updated_at, `\u7B2C ${String(iid)} \u5F20\u7968\u7684\u66F4\u65B0\u65F6\u95F4`),
|
|
1391
1450
|
openBlockers: 0,
|
|
1392
1451
|
blockedBy: [],
|
|
1393
1452
|
...closedAt === void 0 ? {} : { closedAt },
|
|
1394
|
-
...url === void 0 ? {} : { url }
|
|
1453
|
+
...url === void 0 ? {} : { url },
|
|
1454
|
+
...excerpt === void 0 ? {} : { excerpt },
|
|
1455
|
+
...commentCount === void 0 ? {} : { commentCount }
|
|
1395
1456
|
},
|
|
1396
|
-
description
|
|
1457
|
+
description,
|
|
1397
1458
|
hasBlockingIssuesCount: Object.hasOwn(value, "blocking_issues_count")
|
|
1398
1459
|
};
|
|
1399
1460
|
}
|
|
1461
|
+
function stripLeadingBlockedBy(text) {
|
|
1462
|
+
return text.replace(/^\s*Blocked by:\s*[^\n]*(?:\r?\n|$)/i, "");
|
|
1463
|
+
}
|
|
1400
1464
|
function readState3(value, iid) {
|
|
1401
1465
|
if (value === "opened") return "open";
|
|
1402
1466
|
if (value === "closed") return "closed";
|
|
@@ -1418,16 +1482,6 @@ function parseViewer2(output) {
|
|
|
1418
1482
|
const username = payload.username;
|
|
1419
1483
|
return typeof username === "string" && username.length > 0 ? username : null;
|
|
1420
1484
|
}
|
|
1421
|
-
function readAssignees2(value) {
|
|
1422
|
-
if (!Array.isArray(value)) return [];
|
|
1423
|
-
const usernames = [];
|
|
1424
|
-
for (const assignee of value) {
|
|
1425
|
-
if (!isRecord(assignee)) continue;
|
|
1426
|
-
const username = assignee.username;
|
|
1427
|
-
if (typeof username === "string" && username.length > 0) usernames.push(username);
|
|
1428
|
-
}
|
|
1429
|
-
return usernames;
|
|
1430
|
-
}
|
|
1431
1485
|
function readIid(value) {
|
|
1432
1486
|
if (typeof value === "number" && Number.isInteger(value) && value > 0) return value;
|
|
1433
1487
|
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
@@ -1856,7 +1910,10 @@ var PANEL_SKILLS = {
|
|
|
1856
1910
|
wayfinder: "wayfinder",
|
|
1857
1911
|
implement: "implement",
|
|
1858
1912
|
codeReview: "code-review",
|
|
1859
|
-
pr: "pr"
|
|
1913
|
+
pr: "pr",
|
|
1914
|
+
research: "research",
|
|
1915
|
+
codebaseDesign: "codebase-design",
|
|
1916
|
+
prototype: "prototype"
|
|
1860
1917
|
};
|
|
1861
1918
|
var REQUIRED_SKILLS = [
|
|
1862
1919
|
PANEL_SKILLS.setup,
|
|
@@ -1921,6 +1978,8 @@ var RPC_METHODS = {
|
|
|
1921
1978
|
ticketGet: "ticket.get",
|
|
1922
1979
|
/** 应用一次工单变更;成功后界面重新读取详情并刷新列表快照。 */
|
|
1923
1980
|
ticketUpdate: "ticket.update",
|
|
1981
|
+
/** 发表一条评论;成功后界面重新读取详情。 */
|
|
1982
|
+
ticketComment: "ticket.comment",
|
|
1924
1983
|
/** 读取仓库的标签与可分配用户,供详情里添加标签、分配人时补全。 */
|
|
1925
1984
|
ticketOptions: "ticket.options",
|
|
1926
1985
|
/** 永久删除一张工单;必须带 `confirm: 'delete'`,宿主再按权限拒绝或执行。 */
|
|
@@ -2093,10 +2152,13 @@ function avatarBaseUrl(remoteUrl, host) {
|
|
|
2093
2152
|
}
|
|
2094
2153
|
return `https://${host}`;
|
|
2095
2154
|
}
|
|
2096
|
-
async function callGiteaApi(run, workspaceRoot, endpoint, method) {
|
|
2155
|
+
async function callGiteaApi(run, workspaceRoot, endpoint, method, options) {
|
|
2097
2156
|
try {
|
|
2098
|
-
const args = method === void 0 ? ["api", "--include", endpoint] : ["api", "--include", "--method", method, endpoint];
|
|
2099
|
-
const output = await run("tea", args, {
|
|
2157
|
+
const args = method === void 0 ? ["api", "--include", endpoint] : ["api", "--include", "--method", method, ...options?.fields ?? [], endpoint];
|
|
2158
|
+
const output = await run("tea", args, {
|
|
2159
|
+
cwd: workspaceRoot,
|
|
2160
|
+
...options?.stdin === void 0 ? {} : { stdin: options.stdin }
|
|
2161
|
+
});
|
|
2100
2162
|
return parseApiResponse(output.stdout, output.stderr);
|
|
2101
2163
|
} catch (error) {
|
|
2102
2164
|
throw mapTeaError(error);
|
|
@@ -2115,9 +2177,9 @@ function ensureSuccess(response, action) {
|
|
|
2115
2177
|
`${action}\u5931\u8D25\uFF1AGitea \u8FD4\u56DE HTTP ${String(response.status)}\u3002`
|
|
2116
2178
|
);
|
|
2117
2179
|
}
|
|
2118
|
-
async function callTea(run, workspaceRoot, args) {
|
|
2180
|
+
async function callTea(run, workspaceRoot, args, options) {
|
|
2119
2181
|
try {
|
|
2120
|
-
return (await run("tea", args, { cwd: workspaceRoot })).stdout;
|
|
2182
|
+
return (await run("tea", args, { cwd: workspaceRoot, ...options })).stdout;
|
|
2121
2183
|
} catch (error) {
|
|
2122
2184
|
throw mapTeaError(error);
|
|
2123
2185
|
}
|
|
@@ -2138,11 +2200,11 @@ function mapTeaError(error) {
|
|
|
2138
2200
|
{ cause: error }
|
|
2139
2201
|
);
|
|
2140
2202
|
}
|
|
2141
|
-
return new TrackerError("fetch-failed", `\
|
|
2203
|
+
return new TrackerError("fetch-failed", `\u64CD\u4F5C Gitea \u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`, {
|
|
2142
2204
|
cause: error
|
|
2143
2205
|
});
|
|
2144
2206
|
}
|
|
2145
|
-
return new TrackerError("fetch-failed", "\
|
|
2207
|
+
return new TrackerError("fetch-failed", "\u64CD\u4F5C Gitea \u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
|
|
2146
2208
|
}
|
|
2147
2209
|
|
|
2148
2210
|
// src/adapters/gitea/delete.ts
|
|
@@ -2222,6 +2284,17 @@ async function applyGiteaChanges(deps, workspaceRoot, reference, patch) {
|
|
|
2222
2284
|
const number = requireTicketNumber(reference);
|
|
2223
2285
|
const repository = await readRepository(deps.run, workspaceRoot);
|
|
2224
2286
|
const current = await readIssue(deps, workspaceRoot, repository, number);
|
|
2287
|
+
const editArgs = [];
|
|
2288
|
+
if (patch.title !== void 0) editArgs.push("--title", patch.title);
|
|
2289
|
+
if (patch.body !== void 0) editArgs.push("--description-file", "-");
|
|
2290
|
+
if (editArgs.length > 0) {
|
|
2291
|
+
await callTea(
|
|
2292
|
+
deps.run,
|
|
2293
|
+
workspaceRoot,
|
|
2294
|
+
["issues", "edit", String(number), ...editArgs],
|
|
2295
|
+
patch.body === void 0 ? void 0 : { stdin: patch.body }
|
|
2296
|
+
);
|
|
2297
|
+
}
|
|
2225
2298
|
if (patch.labels !== void 0) {
|
|
2226
2299
|
const diff = planSetChange(current.labels, patch.labels);
|
|
2227
2300
|
if (!isEmptyDiff(diff)) {
|
|
@@ -2253,6 +2326,18 @@ async function applyGiteaChanges(deps, workspaceRoot, reference, patch) {
|
|
|
2253
2326
|
]);
|
|
2254
2327
|
}
|
|
2255
2328
|
}
|
|
2329
|
+
async function createGiteaComment(deps, workspaceRoot, reference, body) {
|
|
2330
|
+
const number = requireTicketNumber(reference);
|
|
2331
|
+
const repository = await readRepository(deps.run, workspaceRoot);
|
|
2332
|
+
const response = await callGiteaApi(
|
|
2333
|
+
deps.run,
|
|
2334
|
+
workspaceRoot,
|
|
2335
|
+
`/repos/${repository.owner}/${repository.name}/issues/${String(number)}/comments`,
|
|
2336
|
+
"POST",
|
|
2337
|
+
{ fields: ["-F", "body=@-"], stdin: body }
|
|
2338
|
+
);
|
|
2339
|
+
ensureDetailSuccess(response, "\u53D1\u8868 Gitea \u8BC4\u8BBA");
|
|
2340
|
+
}
|
|
2256
2341
|
async function readIssue(deps, workspaceRoot, repository, number) {
|
|
2257
2342
|
const response = await callGiteaApi(
|
|
2258
2343
|
deps.run,
|
|
@@ -2278,22 +2363,34 @@ async function readComments(deps, workspaceRoot, repository, number) {
|
|
|
2278
2363
|
const finish = () => sortCommentsByTime([...collected.values()]);
|
|
2279
2364
|
const first = await readCommentsPage(deps, workspaceRoot, repository, number, 1);
|
|
2280
2365
|
absorb(first.entries);
|
|
2281
|
-
if (first.total !== void 0 && collected.size >= first.total) return finish();
|
|
2282
|
-
if (first.entries.length < deps.pageSize) return finish();
|
|
2283
|
-
const second = await readCommentsPage(deps, workspaceRoot, repository, number, 2);
|
|
2284
|
-
if (absorb(second.entries) === 0) return finish();
|
|
2285
2366
|
const total = first.total;
|
|
2367
|
+
if (total !== void 0) {
|
|
2368
|
+
if (collected.size >= total) return finish();
|
|
2369
|
+
if (Math.ceil(total / deps.pageSize) > MAX_COMMENT_PAGES) {
|
|
2370
|
+
throw incompleteComments(`\u8D85\u8FC7 ${String(MAX_COMMENT_PAGES)} \u9875`);
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
if (total === void 0 && first.entries.length < deps.pageSize) return finish();
|
|
2374
|
+
const second = await readCommentsPage(deps, workspaceRoot, repository, number, 2);
|
|
2375
|
+
if (absorb(second.entries) === 0) {
|
|
2376
|
+
if (total === void 0) return finish();
|
|
2377
|
+
throw incompleteComments(`\u5DF2\u53D6 ${String(collected.size)} / \u5171 ${String(total)} \u6761`);
|
|
2378
|
+
}
|
|
2286
2379
|
if (total === void 0) {
|
|
2287
2380
|
for (let page = 3; page <= MAX_COMMENT_PAGES; page += 1) {
|
|
2288
2381
|
const next = await readCommentsPage(deps, workspaceRoot, repository, number, page);
|
|
2289
2382
|
const added = absorb(next.entries);
|
|
2290
|
-
if (added === 0)
|
|
2291
|
-
if (next.total !== void 0 && collected.size >= next.total)
|
|
2292
|
-
if (next.entries.length < deps.pageSize)
|
|
2383
|
+
if (added === 0) return finish();
|
|
2384
|
+
if (next.total !== void 0 && collected.size >= next.total) return finish();
|
|
2385
|
+
if (next.entries.length < deps.pageSize) return finish();
|
|
2293
2386
|
}
|
|
2294
|
-
|
|
2387
|
+
throw incompleteComments(`\u8D85\u8FC7 ${String(MAX_COMMENT_PAGES)} \u9875`);
|
|
2388
|
+
}
|
|
2389
|
+
const pageCapacity = Math.max(first.entries.length, second.entries.length, 1);
|
|
2390
|
+
const lastPage = Math.ceil(total / pageCapacity);
|
|
2391
|
+
if (lastPage > MAX_COMMENT_PAGES) {
|
|
2392
|
+
throw incompleteComments(`\u8D85\u8FC7 ${String(MAX_COMMENT_PAGES)} \u9875`);
|
|
2295
2393
|
}
|
|
2296
|
-
const lastPage = Math.min(Math.ceil(total / deps.pageSize), MAX_COMMENT_PAGES);
|
|
2297
2394
|
const rest = Array.from({ length: Math.max(0, lastPage - 2) }, (_, index) => index + 3);
|
|
2298
2395
|
const pages = await mapWithConcurrency(
|
|
2299
2396
|
rest,
|
|
@@ -2301,8 +2398,14 @@ async function readComments(deps, workspaceRoot, repository, number) {
|
|
|
2301
2398
|
(page) => readCommentsPage(deps, workspaceRoot, repository, number, page)
|
|
2302
2399
|
);
|
|
2303
2400
|
for (const page of pages) absorb(page.entries);
|
|
2401
|
+
if (collected.size < total) {
|
|
2402
|
+
throw incompleteComments(`\u5DF2\u53D6 ${String(collected.size)} / \u5171 ${String(total)} \u6761`);
|
|
2403
|
+
}
|
|
2304
2404
|
return finish();
|
|
2305
2405
|
}
|
|
2406
|
+
function incompleteComments(detail) {
|
|
2407
|
+
return new TrackerError("fetch-failed", `Gitea \u5DE5\u5355\u8BC4\u8BBA\u672A\u53D6\u5168\uFF1A${detail}\u3002`);
|
|
2408
|
+
}
|
|
2306
2409
|
async function readCommentsPage(deps, workspaceRoot, repository, number, page) {
|
|
2307
2410
|
const endpoint = `/repos/${repository.owner}/${repository.name}/issues/${String(number)}/comments?page=${String(page)}&limit=${String(deps.pageSize)}`;
|
|
2308
2411
|
const response = await callGiteaApi(deps.run, workspaceRoot, endpoint);
|
|
@@ -2358,9 +2461,11 @@ function parseCommentsPage(body) {
|
|
|
2358
2461
|
if (!isRecord(entry)) continue;
|
|
2359
2462
|
const text = typeof entry.body === "string" ? entry.body : "";
|
|
2360
2463
|
if (text.length === 0) continue;
|
|
2464
|
+
const id = typeof entry.id === "number" ? entry.id : null;
|
|
2361
2465
|
comments.push({
|
|
2362
|
-
id
|
|
2466
|
+
id,
|
|
2363
2467
|
comment: {
|
|
2468
|
+
id: id === null ? null : String(id),
|
|
2364
2469
|
author: isRecord(entry.user) ? readOptionalString(entry.user.login) : null,
|
|
2365
2470
|
body: text,
|
|
2366
2471
|
createdAt: readOptionalString(entry.created_at)
|
|
@@ -2389,7 +2494,7 @@ async function readGiteaOptions(deps, workspaceRoot) {
|
|
|
2389
2494
|
const repository = await readRepository(deps.run, workspaceRoot);
|
|
2390
2495
|
return {
|
|
2391
2496
|
labels: await readLabels3(deps, workspaceRoot, repository),
|
|
2392
|
-
assignees: await
|
|
2497
|
+
assignees: await readAssignees(deps, workspaceRoot, repository)
|
|
2393
2498
|
};
|
|
2394
2499
|
}
|
|
2395
2500
|
async function readLabels3(deps, workspaceRoot, repository) {
|
|
@@ -2411,7 +2516,7 @@ async function readLabels3(deps, workspaceRoot, repository) {
|
|
|
2411
2516
|
}
|
|
2412
2517
|
return dedupeBy(labels, (label) => label.name);
|
|
2413
2518
|
}
|
|
2414
|
-
async function
|
|
2519
|
+
async function readAssignees(deps, workspaceRoot, repository) {
|
|
2415
2520
|
const response = await callGiteaApi(
|
|
2416
2521
|
deps.run,
|
|
2417
2522
|
workspaceRoot,
|
|
@@ -2506,6 +2611,7 @@ function createGiteaTracker(deps) {
|
|
|
2506
2611
|
},
|
|
2507
2612
|
fetchDetail: (workspaceRoot, reference) => readGiteaDetail(detailDeps, workspaceRoot, reference),
|
|
2508
2613
|
updateTicket: (workspaceRoot, reference, patch) => applyGiteaChanges(detailDeps, workspaceRoot, reference, patch),
|
|
2614
|
+
createComment: (workspaceRoot, reference, body) => createGiteaComment(detailDeps, workspaceRoot, reference, body),
|
|
2509
2615
|
fetchOptions: (workspaceRoot) => readGiteaOptions(deps, workspaceRoot),
|
|
2510
2616
|
canDeleteTickets: (workspaceRoot) => readGiteaDeletePermission(deps, workspaceRoot),
|
|
2511
2617
|
deleteTicket: (workspaceRoot, reference) => deleteGiteaTicket(deps, workspaceRoot, reference)
|
|
@@ -2690,9 +2796,9 @@ async function readRepository2(run, workspaceRoot) {
|
|
|
2690
2796
|
}
|
|
2691
2797
|
return { owner, name: name2 };
|
|
2692
2798
|
}
|
|
2693
|
-
async function callGh(run, workspaceRoot, args) {
|
|
2799
|
+
async function callGh(run, workspaceRoot, args, options) {
|
|
2694
2800
|
try {
|
|
2695
|
-
return (await run("gh", args, { cwd: workspaceRoot })).stdout;
|
|
2801
|
+
return (await run("gh", args, { cwd: workspaceRoot, ...options })).stdout;
|
|
2696
2802
|
} catch (error) {
|
|
2697
2803
|
throw mapGhError(error);
|
|
2698
2804
|
}
|
|
@@ -2734,11 +2840,11 @@ function mapGhError(error) {
|
|
|
2734
2840
|
retryAfterMsOf(error.stderr)
|
|
2735
2841
|
);
|
|
2736
2842
|
}
|
|
2737
|
-
return new TrackerError("fetch-failed", `\
|
|
2843
|
+
return new TrackerError("fetch-failed", `\u64CD\u4F5C\u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`, {
|
|
2738
2844
|
cause: error
|
|
2739
2845
|
});
|
|
2740
2846
|
}
|
|
2741
|
-
return new TrackerError("fetch-failed", "\
|
|
2847
|
+
return new TrackerError("fetch-failed", "\u64CD\u4F5C\u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
|
|
2742
2848
|
}
|
|
2743
2849
|
function isAuthenticationFailure(stderr) {
|
|
2744
2850
|
return /gh auth login|not logged in|authentication failed|bad credentials|HTTP 401|requires authentication/i.test(
|
|
@@ -2842,6 +2948,19 @@ async function applyGithubChanges(deps, workspaceRoot, reference, patch) {
|
|
|
2842
2948
|
const repository = await readRepository2(deps.run, workspaceRoot);
|
|
2843
2949
|
const repoArgs = ["--repo", repositoryLabel(repository)];
|
|
2844
2950
|
const current = await readDetailWithRepository(deps, workspaceRoot, repository, reference);
|
|
2951
|
+
const editArgs = [];
|
|
2952
|
+
if (patch.title !== void 0) editArgs.push("--title", patch.title);
|
|
2953
|
+
if (patch.body !== void 0) editArgs.push("--body-file", "-");
|
|
2954
|
+
if (editArgs.length > 0) {
|
|
2955
|
+
await editIssue(
|
|
2956
|
+
deps.run,
|
|
2957
|
+
workspaceRoot,
|
|
2958
|
+
number,
|
|
2959
|
+
repoArgs,
|
|
2960
|
+
editArgs,
|
|
2961
|
+
patch.body === void 0 ? void 0 : { stdin: patch.body }
|
|
2962
|
+
);
|
|
2963
|
+
}
|
|
2845
2964
|
if (patch.labels !== void 0) {
|
|
2846
2965
|
const diff = planSetChange(current.labels, patch.labels);
|
|
2847
2966
|
await editIssue(deps.run, workspaceRoot, number, repoArgs, [
|
|
@@ -2867,13 +2986,28 @@ function assigneeChange(current, patch) {
|
|
|
2867
2986
|
}
|
|
2868
2987
|
return planSetChange(current, patch.assignees, patch.assignSelf === true ? "@me" : null);
|
|
2869
2988
|
}
|
|
2870
|
-
async function
|
|
2989
|
+
async function createGithubComment(deps, workspaceRoot, reference, body) {
|
|
2990
|
+
const number = requireTicketNumber(reference);
|
|
2991
|
+
const repository = await readRepository2(deps.run, workspaceRoot);
|
|
2992
|
+
await callGhDetail(
|
|
2993
|
+
deps.run,
|
|
2994
|
+
workspaceRoot,
|
|
2995
|
+
["issue", "comment", String(number), "--body-file", "-", "--repo", repositoryLabel(repository)],
|
|
2996
|
+
{ stdin: body }
|
|
2997
|
+
);
|
|
2998
|
+
}
|
|
2999
|
+
async function editIssue(run, workspaceRoot, number, repoArgs, flags, options) {
|
|
2871
3000
|
if (flags.length === 0) return;
|
|
2872
|
-
await callGhDetail(
|
|
3001
|
+
await callGhDetail(
|
|
3002
|
+
run,
|
|
3003
|
+
workspaceRoot,
|
|
3004
|
+
["issue", "edit", String(number), ...flags, ...repoArgs],
|
|
3005
|
+
options
|
|
3006
|
+
);
|
|
2873
3007
|
}
|
|
2874
|
-
async function callGhDetail(run, workspaceRoot, args) {
|
|
3008
|
+
async function callGhDetail(run, workspaceRoot, args, options) {
|
|
2875
3009
|
try {
|
|
2876
|
-
return await callGh(run, workspaceRoot, args);
|
|
3010
|
+
return await callGh(run, workspaceRoot, args, options);
|
|
2877
3011
|
} catch (error) {
|
|
2878
3012
|
if (error instanceof TrackerError && error.cause instanceof CommandError && NOT_FOUND5.test(error.cause.stderr)) {
|
|
2879
3013
|
throw new TrackerError("ticket-not-found", "\u627E\u4E0D\u5230\u8FD9\u5F20\u5DE5\u5355\uFF0C\u5B83\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\u3002", {
|
|
@@ -2922,6 +3056,7 @@ function readComments2(value) {
|
|
|
2922
3056
|
const body = typeof entry.body === "string" ? entry.body : "";
|
|
2923
3057
|
if (body.length === 0) continue;
|
|
2924
3058
|
comments.push({
|
|
3059
|
+
id: readOptionalString(entry.id),
|
|
2925
3060
|
author: isRecord(entry.author) ? readOptionalString(entry.author.login) : null,
|
|
2926
3061
|
body,
|
|
2927
3062
|
createdAt: readOptionalString(entry.createdAt)
|
|
@@ -2976,7 +3111,7 @@ function readViewer2(payload) {
|
|
|
2976
3111
|
}
|
|
2977
3112
|
function readPageCursor(issues) {
|
|
2978
3113
|
const pageInfo = issues.pageInfo;
|
|
2979
|
-
if (!isRecord(pageInfo))
|
|
3114
|
+
if (!isRecord(pageInfo)) throw invalid3("\u4ED3\u5E93\u7684 issues.pageInfo \u7F3A\u5931");
|
|
2980
3115
|
const hasNextPage = pageInfo.hasNextPage;
|
|
2981
3116
|
if (typeof hasNextPage !== "boolean") {
|
|
2982
3117
|
throw invalid3("\u4ED3\u5E93\u7684 issues.pageInfo.hasNextPage \u4E0D\u662F\u5E03\u5C14\u503C");
|
|
@@ -3001,6 +3136,9 @@ function parseIssueNode(value, index, repository) {
|
|
|
3001
3136
|
const closedAt = readClosedAt3(value.closedAt, number);
|
|
3002
3137
|
const url = readWebUrl(value.url);
|
|
3003
3138
|
const parent = readParent2(value.parent, number, repository);
|
|
3139
|
+
const bodyText = typeof value.bodyText === "string" ? value.bodyText : void 0;
|
|
3140
|
+
const excerpt = bodyText === void 0 ? void 0 : plainExcerpt(bodyText);
|
|
3141
|
+
const commentCount = readCommentTotal(value.comments);
|
|
3004
3142
|
return {
|
|
3005
3143
|
ref: `#${String(number)}`,
|
|
3006
3144
|
number,
|
|
@@ -3008,13 +3146,15 @@ function parseIssueNode(value, index, repository) {
|
|
|
3008
3146
|
state,
|
|
3009
3147
|
labels: readLabels4(value.labels),
|
|
3010
3148
|
author: readAuthor2(value.author, AUTHOR_FIELDS3),
|
|
3011
|
-
assignees:
|
|
3149
|
+
assignees: readUserNodes(value.assignees),
|
|
3012
3150
|
createdAt: readString4(value.createdAt, `\u7B2C ${String(number)} \u5F20\u7968\u7684\u521B\u5EFA\u65F6\u95F4`),
|
|
3013
3151
|
updatedAt: readString4(value.updatedAt, `\u7B2C ${String(number)} \u5F20\u7968\u7684\u66F4\u65B0\u65F6\u95F4`),
|
|
3014
3152
|
openBlockers: readOpenBlockers(value.issueDependenciesSummary),
|
|
3015
3153
|
...closedAt === void 0 ? {} : { closedAt },
|
|
3016
3154
|
...url === void 0 ? {} : { url },
|
|
3017
|
-
...parent === void 0 ? {} : { parent }
|
|
3155
|
+
...parent === void 0 ? {} : { parent },
|
|
3156
|
+
...excerpt === void 0 ? {} : { excerpt },
|
|
3157
|
+
...commentCount === void 0 ? {} : { commentCount }
|
|
3018
3158
|
};
|
|
3019
3159
|
}
|
|
3020
3160
|
function readParent2(value, number, repository) {
|
|
@@ -3070,17 +3210,13 @@ function readLabels4(value) {
|
|
|
3070
3210
|
}
|
|
3071
3211
|
return labels;
|
|
3072
3212
|
}
|
|
3073
|
-
function
|
|
3213
|
+
function readUserNodes(value) {
|
|
3074
3214
|
if (!isRecord(value)) return [];
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
const login = node.login;
|
|
3081
|
-
if (typeof login === "string" && login.length > 0) logins.push(login);
|
|
3082
|
-
}
|
|
3083
|
-
return logins;
|
|
3215
|
+
return readAuthors(value.nodes, AUTHOR_FIELDS3);
|
|
3216
|
+
}
|
|
3217
|
+
function readCommentTotal(value) {
|
|
3218
|
+
if (!isRecord(value)) return void 0;
|
|
3219
|
+
return readNonNegativeInteger(value.totalCount);
|
|
3084
3220
|
}
|
|
3085
3221
|
function readOpenBlockers(value) {
|
|
3086
3222
|
if (value === void 0 || value === null) return 0;
|
|
@@ -3188,14 +3324,16 @@ var DEFAULT_CHANGES_PAGE_LIMIT = 5;
|
|
|
3188
3324
|
var ISSUE_NODES = `nodes {
|
|
3189
3325
|
number
|
|
3190
3326
|
title
|
|
3327
|
+
bodyText
|
|
3191
3328
|
url
|
|
3192
3329
|
state
|
|
3193
3330
|
createdAt
|
|
3194
3331
|
updatedAt
|
|
3195
3332
|
closedAt
|
|
3333
|
+
comments { totalCount }
|
|
3196
3334
|
labels(first: 50) { nodes { name } }
|
|
3197
3335
|
author { login avatarUrl ... on User { name } }
|
|
3198
|
-
assignees(first: 10) { nodes { login } }
|
|
3336
|
+
assignees(first: 10) { nodes { login avatarUrl ... on User { name } } }
|
|
3199
3337
|
issueDependenciesSummary { blockedBy }
|
|
3200
3338
|
parent { number repository { nameWithOwner } }
|
|
3201
3339
|
}`;
|
|
@@ -3263,6 +3401,7 @@ function createGithubTracker(deps) {
|
|
|
3263
3401
|
},
|
|
3264
3402
|
fetchDetail: (workspaceRoot, reference) => readGithubDetail(deps, workspaceRoot, reference),
|
|
3265
3403
|
updateTicket: (workspaceRoot, reference, patch) => applyGithubChanges(deps, workspaceRoot, reference, patch),
|
|
3404
|
+
createComment: (workspaceRoot, reference, body) => createGithubComment(deps, workspaceRoot, reference, body),
|
|
3266
3405
|
fetchOptions: (workspaceRoot) => readGithubOptions(deps, workspaceRoot),
|
|
3267
3406
|
canDeleteTickets: (workspaceRoot) => readGithubDeletePermission(deps, workspaceRoot),
|
|
3268
3407
|
deleteTicket: (workspaceRoot, reference) => deleteGithubTicket(deps, workspaceRoot, reference)
|
|
@@ -3391,9 +3530,9 @@ async function callGlabApi(run, workspaceRoot, endpoint) {
|
|
|
3391
3530
|
async function callGlabApiInclude(run, workspaceRoot, endpoint) {
|
|
3392
3531
|
return callGlab(run, workspaceRoot, ["api", "--include", endpoint]);
|
|
3393
3532
|
}
|
|
3394
|
-
async function callGlab(run, workspaceRoot, args) {
|
|
3533
|
+
async function callGlab(run, workspaceRoot, args, options) {
|
|
3395
3534
|
try {
|
|
3396
|
-
return (await run("glab", args, { cwd: workspaceRoot })).stdout;
|
|
3535
|
+
return (await run("glab", args, { cwd: workspaceRoot, ...options })).stdout;
|
|
3397
3536
|
} catch (error) {
|
|
3398
3537
|
throw mapGlabError(error);
|
|
3399
3538
|
}
|
|
@@ -3419,13 +3558,13 @@ function mapGlabError(error) {
|
|
|
3419
3558
|
}
|
|
3420
3559
|
return new TrackerError(
|
|
3421
3560
|
"fetch-failed",
|
|
3422
|
-
`\
|
|
3561
|
+
`\u64CD\u4F5C GitLab \u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`,
|
|
3423
3562
|
{
|
|
3424
3563
|
cause: error
|
|
3425
3564
|
}
|
|
3426
3565
|
);
|
|
3427
3566
|
}
|
|
3428
|
-
return new TrackerError("fetch-failed", "\
|
|
3567
|
+
return new TrackerError("fetch-failed", "\u64CD\u4F5C GitLab \u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
|
|
3429
3568
|
}
|
|
3430
3569
|
function isAuthenticationFailure2(stderr) {
|
|
3431
3570
|
return /glab auth login|not logged in|no token|token.*(?:expired|invalid)|authentication failed|bad credentials|HTTP 401|Unauthorized/i.test(
|
|
@@ -3594,6 +3733,17 @@ async function applyGitlabChanges(deps, workspaceRoot, reference, patch) {
|
|
|
3594
3733
|
const iid = requireTicketNumber(reference);
|
|
3595
3734
|
const project = await readProjectPath(deps.run, workspaceRoot);
|
|
3596
3735
|
const current = await readIssue2(deps, workspaceRoot, project, iid);
|
|
3736
|
+
const editArgs = [];
|
|
3737
|
+
if (patch.title !== void 0) editArgs.push("--title", patch.title);
|
|
3738
|
+
if (patch.body !== void 0) editArgs.push("--description-file", "-");
|
|
3739
|
+
if (editArgs.length > 0) {
|
|
3740
|
+
await callGlab(
|
|
3741
|
+
deps.run,
|
|
3742
|
+
workspaceRoot,
|
|
3743
|
+
["issue", "update", String(iid), ...editArgs],
|
|
3744
|
+
patch.body === void 0 ? void 0 : { stdin: patch.body }
|
|
3745
|
+
);
|
|
3746
|
+
}
|
|
3597
3747
|
if (patch.labels !== void 0) {
|
|
3598
3748
|
const diff = planSetChange(current.labels, patch.labels);
|
|
3599
3749
|
if (!isEmptyDiff(diff)) {
|
|
@@ -3618,6 +3768,14 @@ async function applyGitlabChanges(deps, workspaceRoot, reference, patch) {
|
|
|
3618
3768
|
]);
|
|
3619
3769
|
}
|
|
3620
3770
|
}
|
|
3771
|
+
async function createGitlabComment(deps, workspaceRoot, reference, body) {
|
|
3772
|
+
const iid = requireTicketNumber(reference);
|
|
3773
|
+
const project = await readProjectPath(deps.run, workspaceRoot);
|
|
3774
|
+
const endpoint = `${projectEndpoint(project)}/issues/${String(iid)}/notes`;
|
|
3775
|
+
await callGlab(deps.run, workspaceRoot, ["api", "--method", "POST", endpoint, "--input", "-"], {
|
|
3776
|
+
stdin: JSON.stringify({ body })
|
|
3777
|
+
});
|
|
3778
|
+
}
|
|
3621
3779
|
async function updateAssignees(deps, workspaceRoot, iid, current, patch, self) {
|
|
3622
3780
|
const target = resolveTargetSet(current, patch.assignees, self);
|
|
3623
3781
|
const assigneeArgs = target.length > 0 ? ["--assignee", target.join(",")] : current.flatMap((username) => ["--assignee", `!${username}`]);
|
|
@@ -3697,6 +3855,7 @@ function parseNotesPage(output) {
|
|
|
3697
3855
|
const body = typeof note.body === "string" ? note.body : "";
|
|
3698
3856
|
if (body.length === 0) continue;
|
|
3699
3857
|
comments.push({
|
|
3858
|
+
id: typeof note.id === "number" ? String(note.id) : null,
|
|
3700
3859
|
author: isRecord(note.author) ? readOptionalString(note.author.username) : null,
|
|
3701
3860
|
body,
|
|
3702
3861
|
createdAt: readOptionalString(note.created_at)
|
|
@@ -3932,6 +4091,7 @@ function createGitlabTracker(deps) {
|
|
|
3932
4091
|
},
|
|
3933
4092
|
fetchDetail: (workspaceRoot, reference) => readGitlabDetail(detailDeps, workspaceRoot, reference),
|
|
3934
4093
|
updateTicket: (workspaceRoot, reference, patch) => applyGitlabChanges(detailDeps, workspaceRoot, reference, patch),
|
|
4094
|
+
createComment: (workspaceRoot, reference, body) => createGitlabComment(detailDeps, workspaceRoot, reference, body),
|
|
3935
4095
|
fetchOptions: (workspaceRoot) => readGitlabOptions(detailDeps, workspaceRoot),
|
|
3936
4096
|
canDeleteTickets: (workspaceRoot) => readGitlabDeletePermission(deps, workspaceRoot),
|
|
3937
4097
|
deleteTicket: (workspaceRoot, reference) => deleteGitlabTicket(deps, workspaceRoot, reference),
|
|
@@ -4215,6 +4375,7 @@ async function readMarkdownDetail(deps, workspaceRoot, reference) {
|
|
|
4215
4375
|
labels: markdownLabels(content),
|
|
4216
4376
|
assignees: [],
|
|
4217
4377
|
comments: parsed.comments.map((body) => ({
|
|
4378
|
+
id: null,
|
|
4218
4379
|
author: null,
|
|
4219
4380
|
body,
|
|
4220
4381
|
createdAt: null
|
|
@@ -4637,6 +4798,7 @@ var SNAPSHOT_STAGES = {
|
|
|
4637
4798
|
var TICKET_ACTIONS = {
|
|
4638
4799
|
get: "get",
|
|
4639
4800
|
update: "update",
|
|
4801
|
+
comment: "comment",
|
|
4640
4802
|
options: "options",
|
|
4641
4803
|
delete: "delete",
|
|
4642
4804
|
attachment: "attachment"
|
|
@@ -5620,7 +5782,9 @@ function toTicketSnapshot(ticket) {
|
|
|
5620
5782
|
...ticket.closedAt === void 0 ? {} : { closedAt: ticket.closedAt },
|
|
5621
5783
|
...ticket.url === void 0 ? {} : { url: ticket.url },
|
|
5622
5784
|
...ticket.blockedBy === void 0 ? {} : { blockedBy: ticket.blockedBy },
|
|
5623
|
-
...ticket.parent === void 0 ? {} : { parent: ticket.parent }
|
|
5785
|
+
...ticket.parent === void 0 ? {} : { parent: ticket.parent },
|
|
5786
|
+
...ticket.excerpt === void 0 ? {} : { excerpt: ticket.excerpt },
|
|
5787
|
+
...ticket.commentCount === void 0 ? {} : { commentCount: ticket.commentCount }
|
|
5624
5788
|
};
|
|
5625
5789
|
}
|
|
5626
5790
|
function buildStoredSnapshot(deps, stored, state) {
|
|
@@ -5914,33 +6078,73 @@ function ticketsDiffer(base, raw) {
|
|
|
5914
6078
|
return JSON.stringify(base.tickets) !== JSON.stringify(raw.tickets);
|
|
5915
6079
|
}
|
|
5916
6080
|
async function respondUnchanged(host, workspaceRoot, resolved, base, raw, ifVersion, startedAt) {
|
|
6081
|
+
const checkedAt = host.now();
|
|
5917
6082
|
if (ifVersion !== void 0 && ifVersion === base.libraryVersion) {
|
|
6083
|
+
const verified = await verifyCachedWorkspace(
|
|
6084
|
+
host,
|
|
6085
|
+
workspaceRoot,
|
|
6086
|
+
resolved,
|
|
6087
|
+
base,
|
|
6088
|
+
raw,
|
|
6089
|
+
checkedAt,
|
|
6090
|
+
startedAt
|
|
6091
|
+
);
|
|
6092
|
+
if (verified !== null) {
|
|
6093
|
+
host.guard.noteFailure(workspaceRoot, host.now());
|
|
6094
|
+
return { ok: false, error: verified };
|
|
6095
|
+
}
|
|
5918
6096
|
host.guard.noteSuccess(workspaceRoot);
|
|
5919
6097
|
return {
|
|
5920
6098
|
ok: true,
|
|
5921
|
-
result: { kind: "not-modified", version: base.libraryVersion, checkedAt
|
|
6099
|
+
result: { kind: "not-modified", version: base.libraryVersion, checkedAt }
|
|
5922
6100
|
};
|
|
5923
6101
|
}
|
|
6102
|
+
const published = await host.publish(workspaceRoot, resolved, raw, startedAt, "full", {
|
|
6103
|
+
skipWrite: true,
|
|
6104
|
+
versionFallback: base.libraryVersion
|
|
6105
|
+
});
|
|
6106
|
+
if (!published.ok) {
|
|
6107
|
+
host.guard.noteFailure(workspaceRoot, host.now());
|
|
6108
|
+
return published;
|
|
6109
|
+
}
|
|
5924
6110
|
if (ifVersion !== void 0 && ifVersion < base.libraryVersion) {
|
|
5925
6111
|
const changes = await host.store?.changesSince(workspaceRoot, ifVersion);
|
|
5926
6112
|
if (changes !== void 0) {
|
|
5927
|
-
const delta = buildDelta(
|
|
6113
|
+
const delta = buildDelta(
|
|
6114
|
+
host,
|
|
6115
|
+
base.libraryVersion,
|
|
6116
|
+
raw.fetchedAt,
|
|
6117
|
+
changes,
|
|
6118
|
+
base,
|
|
6119
|
+
published.result
|
|
6120
|
+
);
|
|
5928
6121
|
if (delta !== void 0) {
|
|
5929
6122
|
host.guard.noteSuccess(workspaceRoot);
|
|
5930
6123
|
return { ok: true, result: delta };
|
|
5931
6124
|
}
|
|
5932
6125
|
}
|
|
5933
6126
|
}
|
|
6127
|
+
host.guard.noteSuccess(workspaceRoot);
|
|
6128
|
+
return { ok: true, result: { kind: "full", snapshot: published.result } };
|
|
6129
|
+
}
|
|
6130
|
+
async function verifyCachedWorkspace(host, workspaceRoot, resolved, base, raw, checkedAt, startedAt) {
|
|
6131
|
+
const repositoryHost = resolved.kind === "markdown" ? null : resolved.address?.host ?? null;
|
|
6132
|
+
const cached = host.cache.get(workspaceRoot);
|
|
6133
|
+
if (cached?.kind === resolved.kind && cached.repositoryHost === repositoryHost && cached.raw.repository === base.repository && cached.snapshot.libraryVersion === base.libraryVersion) {
|
|
6134
|
+
cached.snapshot = {
|
|
6135
|
+
...cached.snapshot,
|
|
6136
|
+
source: "live",
|
|
6137
|
+
stale: false,
|
|
6138
|
+
refreshError: null,
|
|
6139
|
+
fetchedAt: checkedAt
|
|
6140
|
+
};
|
|
6141
|
+
return null;
|
|
6142
|
+
}
|
|
5934
6143
|
const published = await host.publish(workspaceRoot, resolved, raw, startedAt, "full", {
|
|
5935
6144
|
skipWrite: true,
|
|
5936
6145
|
versionFallback: base.libraryVersion
|
|
5937
6146
|
});
|
|
5938
|
-
|
|
5939
|
-
host.guard.noteFailure(workspaceRoot, host.now());
|
|
5940
|
-
return published;
|
|
5941
|
-
}
|
|
5942
|
-
host.guard.noteSuccess(workspaceRoot);
|
|
5943
|
-
return { ok: true, result: { kind: "full", snapshot: published.result } };
|
|
6147
|
+
return published.ok ? null : published.error;
|
|
5944
6148
|
}
|
|
5945
6149
|
async function shapeDelta(host, workspaceRoot, snapshot, ifVersion) {
|
|
5946
6150
|
const full = { kind: "full", snapshot };
|
|
@@ -6292,6 +6496,8 @@ var BACKEND_LABELS = {
|
|
|
6292
6496
|
|
|
6293
6497
|
// src/host/ticket-service.ts
|
|
6294
6498
|
var PATCH_KEYS = {
|
|
6499
|
+
title: true,
|
|
6500
|
+
body: true,
|
|
6295
6501
|
labels: true,
|
|
6296
6502
|
assignees: true,
|
|
6297
6503
|
assignSelf: true,
|
|
@@ -6302,6 +6508,7 @@ function createTicketService(deps) {
|
|
|
6302
6508
|
handle(method, params) {
|
|
6303
6509
|
if (method === RPC_METHODS.ticketGet) return getDetail(deps, params);
|
|
6304
6510
|
if (method === RPC_METHODS.ticketUpdate) return update(deps, params);
|
|
6511
|
+
if (method === RPC_METHODS.ticketComment) return comment(deps, params);
|
|
6305
6512
|
if (method === RPC_METHODS.ticketOptions) return readOptions(deps, params);
|
|
6306
6513
|
if (method === RPC_METHODS.ticketDelete) return remove(deps, params);
|
|
6307
6514
|
if (method === RPC_METHODS.ticketAttachment) return readAttachment(deps, params);
|
|
@@ -6373,6 +6580,36 @@ async function update(deps, params) {
|
|
|
6373
6580
|
return failure3(mapped.code, mapped.message);
|
|
6374
6581
|
}
|
|
6375
6582
|
}
|
|
6583
|
+
async function comment(deps, params) {
|
|
6584
|
+
const target = readTicketParams(params);
|
|
6585
|
+
if (target === void 0) {
|
|
6586
|
+
return failure3(ERROR_CODES.invalidParams, "\u7F3A\u5C11 workspaceRoot\u3001ref \u6216 number \u53C2\u6570\u3002");
|
|
6587
|
+
}
|
|
6588
|
+
const body = readField(params, "body");
|
|
6589
|
+
if (typeof body !== "string" || body.trim().length === 0) {
|
|
6590
|
+
return failure3(ERROR_CODES.invalidParams, "\u8BC4\u8BBA\u6B63\u6587\u4E0D\u80FD\u4E3A\u7A7A\u3002");
|
|
6591
|
+
}
|
|
6592
|
+
const startedAt = deps.now();
|
|
6593
|
+
let kind;
|
|
6594
|
+
try {
|
|
6595
|
+
const resolved = await deps.resolve(target.workspaceRoot);
|
|
6596
|
+
kind = resolved.kind;
|
|
6597
|
+
const createComment = resolved.tracker.createComment;
|
|
6598
|
+
if (createComment === void 0) {
|
|
6599
|
+
return unsupported(kind, "\u53D1\u8868\u8BC4\u8BBA");
|
|
6600
|
+
}
|
|
6601
|
+
if (target.repository !== void 0) {
|
|
6602
|
+
return unsupported(kind, "\u5728\u8DE8\u4ED3\u5E93\u5DE5\u5355\u4E0A\u53D1\u8868\u8BC4\u8BBA");
|
|
6603
|
+
}
|
|
6604
|
+
await createComment(target.workspaceRoot, referenceOf(target), body);
|
|
6605
|
+
logResult(deps, "info", kind, "comment", startedAt);
|
|
6606
|
+
return { ok: true, result: { created: true } };
|
|
6607
|
+
} catch (error) {
|
|
6608
|
+
const mapped = mapError(error);
|
|
6609
|
+
logResult(deps, "warn", kind, "comment", startedAt, mapped.code);
|
|
6610
|
+
return failure3(mapped.code, mapped.message);
|
|
6611
|
+
}
|
|
6612
|
+
}
|
|
6376
6613
|
async function readOptions(deps, params) {
|
|
6377
6614
|
const workspaceRoot = readWorkspaceRoot2(params);
|
|
6378
6615
|
if (workspaceRoot === void 0) {
|
|
@@ -6461,9 +6698,10 @@ async function readAttachment(deps, params) {
|
|
|
6461
6698
|
async function syncCachedTicket(deps, workspaceRoot, ref, patch) {
|
|
6462
6699
|
const store = deps.store;
|
|
6463
6700
|
if (store === void 0) return;
|
|
6464
|
-
if (patch.labels === void 0 && patch.state === void 0) return;
|
|
6701
|
+
if (patch.title === void 0 && patch.labels === void 0 && patch.state === void 0) return;
|
|
6465
6702
|
try {
|
|
6466
6703
|
await store.patchTicket(workspaceRoot, ref, {
|
|
6704
|
+
...patch.title === void 0 ? {} : { title: patch.title },
|
|
6467
6705
|
...patch.labels === void 0 ? {} : { labels: patch.labels },
|
|
6468
6706
|
...patch.state === void 0 ? {} : { state: patch.state }
|
|
6469
6707
|
});
|
|
@@ -6480,7 +6718,11 @@ async function removeCachedTicket(deps, workspaceRoot, ref) {
|
|
|
6480
6718
|
}
|
|
6481
6719
|
function withCapabilities(kind, tracker, detail, canDelete, readOnly) {
|
|
6482
6720
|
const writable = !readOnly && tracker.updateTicket !== void 0;
|
|
6721
|
+
const commentable = !readOnly && tracker.createComment !== void 0;
|
|
6483
6722
|
const capabilities = {
|
|
6723
|
+
title: writable,
|
|
6724
|
+
body: writable,
|
|
6725
|
+
comment: commentable,
|
|
6484
6726
|
labels: writable,
|
|
6485
6727
|
assignees: writable,
|
|
6486
6728
|
state: writable,
|
|
@@ -6501,6 +6743,14 @@ function readPatch(value) {
|
|
|
6501
6743
|
if (!isRecord(value)) return void 0;
|
|
6502
6744
|
if (Object.keys(value).some((key) => !Object.hasOwn(PATCH_KEYS, key))) return void 0;
|
|
6503
6745
|
const patch = {};
|
|
6746
|
+
if ("title" in value) {
|
|
6747
|
+
if (typeof value.title !== "string" || value.title.trim().length === 0) return void 0;
|
|
6748
|
+
patch.title = value.title;
|
|
6749
|
+
}
|
|
6750
|
+
if ("body" in value) {
|
|
6751
|
+
if (typeof value.body !== "string") return void 0;
|
|
6752
|
+
patch.body = value.body;
|
|
6753
|
+
}
|
|
6504
6754
|
if ("labels" in value) {
|
|
6505
6755
|
const labels = readNames(value.labels);
|
|
6506
6756
|
if (labels === void 0) return void 0;
|
|
@@ -6570,6 +6820,9 @@ function failure3(code, message) {
|
|
|
6570
6820
|
}
|
|
6571
6821
|
|
|
6572
6822
|
// src/host/subprocess-runner.ts
|
|
6823
|
+
import { mkdtemp, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
6824
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
6825
|
+
import { join as join3 } from "node:path";
|
|
6573
6826
|
var STDOUT_LIMIT_BYTES = 8 * 1024 * 1024;
|
|
6574
6827
|
var STDERR_LIMIT_BYTES = 256 * 1024;
|
|
6575
6828
|
var COMMAND_TIMEOUT_MS = 3e4;
|
|
@@ -6581,6 +6834,8 @@ var EXECUTABLE_FALLBACKS = {
|
|
|
6581
6834
|
sh: ["/bin/sh"]
|
|
6582
6835
|
};
|
|
6583
6836
|
var BASE64_PIPE_SCRIPT = '(set -o pipefail) 2>/dev/null && set -o pipefail; "$@" | base64';
|
|
6837
|
+
var STDIN_SCRIPT = '(set -o pipefail) 2>/dev/null && set -o pipefail; "$@" < "$0"';
|
|
6838
|
+
var STDIN_BASE64_SCRIPT = '(set -o pipefail) 2>/dev/null && set -o pipefail; "$@" < "$0" | base64';
|
|
6584
6839
|
var QUIET_CLI_ENV = {
|
|
6585
6840
|
GLAB_SEND_TELEMETRY: "false",
|
|
6586
6841
|
GLAB_CHECK_UPDATE: "false"
|
|
@@ -6589,19 +6844,35 @@ function createCommandRunner(subprocess, timer) {
|
|
|
6589
6844
|
return async (command, args, options) => {
|
|
6590
6845
|
const executable = await resolveExecutable(subprocess, command);
|
|
6591
6846
|
const base64 = options?.stdout === "base64";
|
|
6592
|
-
const argv = base64 ? [
|
|
6593
|
-
await resolveExecutable(subprocess, "sh"),
|
|
6594
|
-
"-c",
|
|
6595
|
-
BASE64_PIPE_SCRIPT,
|
|
6596
|
-
"sh",
|
|
6597
|
-
executable,
|
|
6598
|
-
...args
|
|
6599
|
-
] : [executable, ...args];
|
|
6600
6847
|
const abort = new AbortController();
|
|
6601
6848
|
const disposeTimeout = timer.timeout(() => {
|
|
6602
6849
|
abort.abort();
|
|
6603
6850
|
}, COMMAND_TIMEOUT_MS);
|
|
6851
|
+
let stdinDir;
|
|
6604
6852
|
try {
|
|
6853
|
+
let argv;
|
|
6854
|
+
if (options?.stdin === void 0) {
|
|
6855
|
+
argv = base64 ? [
|
|
6856
|
+
await resolveExecutable(subprocess, "sh"),
|
|
6857
|
+
"-c",
|
|
6858
|
+
BASE64_PIPE_SCRIPT,
|
|
6859
|
+
"sh",
|
|
6860
|
+
executable,
|
|
6861
|
+
...args
|
|
6862
|
+
] : [executable, ...args];
|
|
6863
|
+
} else {
|
|
6864
|
+
stdinDir = await mkdtemp(join3(tmpdir2(), "dsh-mattpocock-workflow-"));
|
|
6865
|
+
const stdinPath = join3(stdinDir, "stdin.txt");
|
|
6866
|
+
await writeFile2(stdinPath, options.stdin, "utf8");
|
|
6867
|
+
argv = [
|
|
6868
|
+
await resolveExecutable(subprocess, "sh"),
|
|
6869
|
+
"-c",
|
|
6870
|
+
base64 ? STDIN_BASE64_SCRIPT : STDIN_SCRIPT,
|
|
6871
|
+
stdinPath,
|
|
6872
|
+
executable,
|
|
6873
|
+
...args
|
|
6874
|
+
];
|
|
6875
|
+
}
|
|
6605
6876
|
const handle = subprocess.spawn({
|
|
6606
6877
|
argv,
|
|
6607
6878
|
cwd: options?.cwd ?? process.cwd(),
|
|
@@ -6626,6 +6897,9 @@ function createCommandRunner(subprocess, timer) {
|
|
|
6626
6897
|
return { stdout, stderr, executable };
|
|
6627
6898
|
} finally {
|
|
6628
6899
|
disposeTimeout();
|
|
6900
|
+
if (stdinDir !== void 0) {
|
|
6901
|
+
await rm2(stdinDir, { recursive: true, force: true }).catch(() => void 0);
|
|
6902
|
+
}
|
|
6629
6903
|
}
|
|
6630
6904
|
};
|
|
6631
6905
|
}
|
|
@@ -6696,6 +6970,11 @@ var INTAKE_COMMANDS = {
|
|
|
6696
6970
|
nextSteps: ["triage", "toSpec", "grillWithDocs", "wayfinder"]
|
|
6697
6971
|
}
|
|
6698
6972
|
};
|
|
6973
|
+
var MANUAL_SKILLS = {
|
|
6974
|
+
research: { name: PANEL_SKILLS.research },
|
|
6975
|
+
codebaseDesign: { name: PANEL_SKILLS.codebaseDesign },
|
|
6976
|
+
prototype: { name: PANEL_SKILLS.prototype }
|
|
6977
|
+
};
|
|
6699
6978
|
|
|
6700
6979
|
// src/host/workflow-commands.ts
|
|
6701
6980
|
var INTAKE_COPY = {
|
|
@@ -6935,9 +7214,7 @@ function createRpcHandler(scope, run, timer, log) {
|
|
|
6935
7214
|
if (method === RPC_METHODS.envCheck) return envCheck.handle(method, params);
|
|
6936
7215
|
if (method === RPC_METHODS.snapshotCache) return snapshot.cache(params);
|
|
6937
7216
|
if (method === RPC_METHODS.snapshotRefresh) return snapshot.refresh(params);
|
|
6938
|
-
if (method
|
|
6939
|
-
return ticket.handle(method, params);
|
|
6940
|
-
}
|
|
7217
|
+
if (method.startsWith("ticket.")) return ticket.handle(method, params);
|
|
6941
7218
|
return snapshot.handle(method, params);
|
|
6942
7219
|
}
|
|
6943
7220
|
};
|