dsh-supermesh 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{channel-C_93wtiQ.js → channel-C1d93AhN.js} +66 -8
- package/dist/client.cjs +96 -13
- package/dist/client.cjs.map +1 -1
- package/dist/index.js +45 -20
- package/dist/shell-DzrnBk4C.js +1 -0
- package/package.json +1 -1
- package/dist/shell-6EeRyaxQ.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as project, c as shell, d as singlet, f as setting, g as db, h as channelProxyEnvironment, i as archive, l as inbox, m as DSH_PLUGIN_HOME, n as server, o as worktree, p as defineService, r as worker$1, s as devops, t as channel, u as session } from "./channel-
|
|
1
|
+
import { a as project, c as shell, d as singlet, f as setting, g as db, h as channelProxyEnvironment, i as archive, l as inbox, m as DSH_PLUGIN_HOME, n as server, o as worktree, p as defineService, r as worker$1, s as devops, t as channel, u as session } from "./channel-C1d93AhN.js";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -417,7 +417,7 @@ function* answerLines(body) {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
// src/channel/_shared/ci.ts
|
|
420
|
-
/** 分支 CI 变更落成 ciWatch、ci
|
|
420
|
+
/** 分支 CI 变更落成 ciWatch、ci 话题与触发;只有订阅了这条话题的票才收到通知。 */
|
|
421
421
|
async function notifyBranchCi(input) {
|
|
422
422
|
const { row: watch } = await db.ciWatch.recordRevision({
|
|
423
423
|
id: `${input.channel}:${input.ref}`,
|
|
@@ -457,17 +457,22 @@ async function notifyBranchCi(input) {
|
|
|
457
457
|
at: now(),
|
|
458
458
|
ref: input.head
|
|
459
459
|
});
|
|
460
|
-
await db.
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
460
|
+
for (const ticketId of await db.ticketThread.listTicketIds(threadId)) {
|
|
461
|
+
const ticket = await db.ticket.findById(ticketId);
|
|
462
|
+
if (!ticket || ["done", "cancelled"].includes(ticket.status)) continue;
|
|
463
|
+
await db.inbox.enqueue({
|
|
464
|
+
id: `${triggerId}:ticket:${ticketId}`,
|
|
465
|
+
type: "project",
|
|
466
|
+
origin: "system",
|
|
467
|
+
kind: "notice",
|
|
468
|
+
projectId: ticket.projectId,
|
|
469
|
+
ticketId,
|
|
470
|
+
triggerId,
|
|
471
|
+
threadId,
|
|
472
|
+
title: input.message,
|
|
473
|
+
message: input.message
|
|
474
|
+
});
|
|
475
|
+
}
|
|
471
476
|
}
|
|
472
477
|
// src/channel/github/service/resource.ts
|
|
473
478
|
const resource$1 = defineService({
|
|
@@ -483,6 +488,15 @@ const resource$1 = defineService({
|
|
|
483
488
|
return null;
|
|
484
489
|
}
|
|
485
490
|
},
|
|
491
|
+
/**
|
|
492
|
+
* 仓库改名或转移后,GitHub 对旧全名仍返回 200,只是 full_name 变成新名。
|
|
493
|
+
* 返回新全名,未改名时返回 null;调用方必须跟随,否则采集会在 probe 阶段永久失败。
|
|
494
|
+
*/
|
|
495
|
+
renamed(configured, fullName) {
|
|
496
|
+
const canonical = resource$1.of(`https://github.com/${fullName}`);
|
|
497
|
+
if (!canonical) throw new GhError("invalid_response");
|
|
498
|
+
return canonical === configured ? null : canonical;
|
|
499
|
+
},
|
|
486
500
|
parse(value) {
|
|
487
501
|
const short = /^github:([^/:]+\/[^/:]+):(issue|pull):([1-9]\d*)$/.exec(value);
|
|
488
502
|
if (short) return {
|
|
@@ -864,6 +878,7 @@ const courier = defineService({
|
|
|
864
878
|
return singlet.immediate(`${port.channel}:exclusive:collect:${projectId}`, async () => {
|
|
865
879
|
const errors = [];
|
|
866
880
|
let scope;
|
|
881
|
+
let project;
|
|
867
882
|
const context = {
|
|
868
883
|
channel: port.channel,
|
|
869
884
|
projectId,
|
|
@@ -888,9 +903,9 @@ const courier = defineService({
|
|
|
888
903
|
}
|
|
889
904
|
};
|
|
890
905
|
try {
|
|
891
|
-
|
|
906
|
+
project = await port.project(projectId);
|
|
892
907
|
const environment = await port.probe(projectId, signal);
|
|
893
|
-
const resolved = await port.scope(project);
|
|
908
|
+
const resolved = await port.scope(await port.project(projectId));
|
|
894
909
|
if (!resolved) throw new ChannelError("unknown_repository");
|
|
895
910
|
scope = resolved;
|
|
896
911
|
const baseline = await courier.state(port.channel, scope, "baseline") ?? now();
|
|
@@ -903,7 +918,8 @@ const courier = defineService({
|
|
|
903
918
|
if (signal?.aborted) throw error;
|
|
904
919
|
errors.push(courier.failure(error, port.detail));
|
|
905
920
|
}
|
|
906
|
-
|
|
921
|
+
const status = scope ?? (project ? await port.scope(project).catch(() => null) : null);
|
|
922
|
+
if (port.status && status) await courier.record(port.channel, status, "collection_status", {
|
|
907
923
|
ok: !errors.length,
|
|
908
924
|
reasons: [...new Set(errors)],
|
|
909
925
|
collectedAt: now()
|
|
@@ -1033,7 +1049,8 @@ const binding$1 = defineService({ of(channel) {
|
|
|
1033
1049
|
project: (projectId) => channel.project(projectId),
|
|
1034
1050
|
probe: (projectId, signal) => channel.probe(projectId, signal),
|
|
1035
1051
|
collect: (context, signal) => channel.collectProject(context, signal),
|
|
1036
|
-
collectBranch: (projectId, branch, signal) => ci$1.branch(channel, projectId, branch, signal)
|
|
1052
|
+
collectBranch: (projectId, branch, signal) => ci$1.branch(channel, projectId, branch, signal),
|
|
1053
|
+
onFailure: (project, reason) => console.error(`[github:collect] ${project.name} ${project.remoteUrl} -> ${reason}`)
|
|
1037
1054
|
},
|
|
1038
1055
|
ingestor: {
|
|
1039
1056
|
channel: "github",
|
|
@@ -1276,16 +1293,24 @@ var GitHubChannel = class {
|
|
|
1276
1293
|
if (!bots.some((bot) => bot.name.toLowerCase() === login.toLowerCase())) throw new GhError("account_mismatch");
|
|
1277
1294
|
const repository = resource$1.of(project.remoteUrl);
|
|
1278
1295
|
const remote = record(await this.request(`repos/${repository}`, signal));
|
|
1279
|
-
|
|
1296
|
+
const canonical = resource$1.renamed(repository, text(remote.full_name)) ?? repository;
|
|
1297
|
+
if (canonical !== repository) {
|
|
1298
|
+
await db.project.setRemoteUrl(project.id, `https://github.com/${canonical}`, now());
|
|
1299
|
+
await db.sourceState.renameScope("github", repository, canonical, now());
|
|
1300
|
+
await courier.record("github", canonical, "repository_renamed", {
|
|
1301
|
+
from: repository,
|
|
1302
|
+
to: canonical
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1280
1305
|
const result = {
|
|
1281
1306
|
providerId,
|
|
1282
1307
|
login,
|
|
1283
1308
|
repositoryId: identity(remote.id),
|
|
1284
1309
|
defaultBranch: typeof remote.default_branch === "string" ? remote.default_branch : null
|
|
1285
1310
|
};
|
|
1286
|
-
const previous = await courier.state("github",
|
|
1311
|
+
const previous = await courier.state("github", canonical, "verified_environment");
|
|
1287
1312
|
if (previous && (previous.providerId !== providerId || previous.repositoryId !== result.repositoryId)) throw new GhError("environment_identity_changed");
|
|
1288
|
-
await courier.record("github",
|
|
1313
|
+
await courier.record("github", canonical, "verified_environment", result);
|
|
1289
1314
|
return result;
|
|
1290
1315
|
}
|
|
1291
1316
|
async pages(path, signal) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { c as shell } from "./channel-C1d93AhN.js";
|
package/package.json
CHANGED
package/dist/shell-6EeRyaxQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { c as shell } from "./channel-C_93wtiQ.js";
|