@ricsam/r5d-worker 0.0.33 → 0.0.34
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/cjs/main.cjs +31 -10
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/main.mjs +30 -10
- package/dist/mjs/package.json +1 -1
- package/dist/types/main.d.ts +12 -1
- package/package.json +1 -1
package/dist/cjs/main.cjs
CHANGED
|
@@ -43,6 +43,7 @@ __export(main_exports, {
|
|
|
43
43
|
resolveHostShell: () => resolveHostShell,
|
|
44
44
|
resolveProjectFilePath: () => resolveProjectFilePath,
|
|
45
45
|
resolveWorkerFilePath: () => resolveWorkerFilePath,
|
|
46
|
+
selectManifestSyncTargets: () => selectManifestSyncTargets,
|
|
46
47
|
syncManifestProjectsFromInternal: () => syncManifestProjectsFromInternal,
|
|
47
48
|
syncProjectPlans: () => syncProjectPlans,
|
|
48
49
|
syncSessionArtifacts: () => syncSessionArtifacts
|
|
@@ -1162,11 +1163,28 @@ function findRepositorySyncBlockers(input) {
|
|
|
1162
1163
|
}
|
|
1163
1164
|
return blockedBy;
|
|
1164
1165
|
}
|
|
1166
|
+
function selectManifestSyncTargets(input) {
|
|
1167
|
+
if (!input.requestedTargets) {
|
|
1168
|
+
return input.manifests.flatMap((manifest) => {
|
|
1169
|
+
const branches = manifest.branches.length > 0 ? manifest.branches : [manifest.defaultBranch || "main"];
|
|
1170
|
+
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
const manifestsByProjectId = new Map(input.manifests.map((manifest) => [manifest.projectId, manifest]));
|
|
1174
|
+
const selected = /* @__PURE__ */ new Map();
|
|
1175
|
+
for (const target of input.requestedTargets) {
|
|
1176
|
+
const manifest = manifestsByProjectId.get(target.projectId);
|
|
1177
|
+
if (!manifest) {
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1180
|
+
selected.set(`${target.projectId}\0${target.branchName}`, { manifest, branchName: target.branchName });
|
|
1181
|
+
}
|
|
1182
|
+
return [...selected.values()];
|
|
1183
|
+
}
|
|
1165
1184
|
async function syncManifestProjectsFromInternal(input) {
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1185
|
+
const targets = selectManifestSyncTargets({
|
|
1186
|
+
manifests: input.manifests,
|
|
1187
|
+
requestedTargets: input.requestedTargets
|
|
1170
1188
|
});
|
|
1171
1189
|
const blockedBy = findRepositorySyncBlockers({
|
|
1172
1190
|
targets: targets.map(({ manifest, branchName }) => ({
|
|
@@ -1185,11 +1203,12 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1185
1203
|
branchName: active.branchName
|
|
1186
1204
|
}))
|
|
1187
1205
|
});
|
|
1188
|
-
|
|
1189
|
-
return { status: "blocked", results: [], blockedBy };
|
|
1190
|
-
}
|
|
1206
|
+
const blockedTargetKeys = new Set(blockedBy.map((blocker) => `${blocker.projectId}\0${blocker.branchName}`));
|
|
1191
1207
|
const results = [];
|
|
1192
1208
|
for (const { manifest, branchName } of targets) {
|
|
1209
|
+
if (blockedTargetKeys.has(`${manifest.projectId}\0${branchName}`)) {
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1193
1212
|
try {
|
|
1194
1213
|
const commitHash = await forceSyncManifestBranchFromInternal({
|
|
1195
1214
|
projectId: manifest.projectId,
|
|
@@ -1217,10 +1236,11 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1217
1236
|
});
|
|
1218
1237
|
}
|
|
1219
1238
|
}
|
|
1239
|
+
const hasFailures = results.some((result) => result.status === "failed");
|
|
1220
1240
|
return {
|
|
1221
|
-
status:
|
|
1241
|
+
status: blockedBy.length > 0 && results.length === 0 ? "blocked" : blockedBy.length > 0 || hasFailures ? "partial" : "completed",
|
|
1222
1242
|
results,
|
|
1223
|
-
blockedBy
|
|
1243
|
+
blockedBy
|
|
1224
1244
|
};
|
|
1225
1245
|
}
|
|
1226
1246
|
function resolveCommandCwd(branchPath, cwd) {
|
|
@@ -2580,7 +2600,7 @@ async function startWorker(options) {
|
|
|
2580
2600
|
projectsRoot,
|
|
2581
2601
|
syncRoot,
|
|
2582
2602
|
manifests: [...manifestByProjectId.values()],
|
|
2583
|
-
|
|
2603
|
+
requestedTargets: message.targets
|
|
2584
2604
|
});
|
|
2585
2605
|
for (const result of syncResult.results) {
|
|
2586
2606
|
if (result.status !== "synced") continue;
|
|
@@ -2948,6 +2968,7 @@ if (isCliEntrypoint()) {
|
|
|
2948
2968
|
resolveHostShell,
|
|
2949
2969
|
resolveProjectFilePath,
|
|
2950
2970
|
resolveWorkerFilePath,
|
|
2971
|
+
selectManifestSyncTargets,
|
|
2951
2972
|
syncManifestProjectsFromInternal,
|
|
2952
2973
|
syncProjectPlans,
|
|
2953
2974
|
syncSessionArtifacts
|
package/dist/cjs/package.json
CHANGED
package/dist/mjs/main.mjs
CHANGED
|
@@ -1112,11 +1112,28 @@ function findRepositorySyncBlockers(input) {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
return blockedBy;
|
|
1114
1114
|
}
|
|
1115
|
+
function selectManifestSyncTargets(input) {
|
|
1116
|
+
if (!input.requestedTargets) {
|
|
1117
|
+
return input.manifests.flatMap((manifest) => {
|
|
1118
|
+
const branches = manifest.branches.length > 0 ? manifest.branches : [manifest.defaultBranch || "main"];
|
|
1119
|
+
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
const manifestsByProjectId = new Map(input.manifests.map((manifest) => [manifest.projectId, manifest]));
|
|
1123
|
+
const selected = /* @__PURE__ */ new Map();
|
|
1124
|
+
for (const target of input.requestedTargets) {
|
|
1125
|
+
const manifest = manifestsByProjectId.get(target.projectId);
|
|
1126
|
+
if (!manifest) {
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
selected.set(`${target.projectId}\0${target.branchName}`, { manifest, branchName: target.branchName });
|
|
1130
|
+
}
|
|
1131
|
+
return [...selected.values()];
|
|
1132
|
+
}
|
|
1115
1133
|
async function syncManifestProjectsFromInternal(input) {
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1134
|
+
const targets = selectManifestSyncTargets({
|
|
1135
|
+
manifests: input.manifests,
|
|
1136
|
+
requestedTargets: input.requestedTargets
|
|
1120
1137
|
});
|
|
1121
1138
|
const blockedBy = findRepositorySyncBlockers({
|
|
1122
1139
|
targets: targets.map(({ manifest, branchName }) => ({
|
|
@@ -1135,11 +1152,12 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1135
1152
|
branchName: active.branchName
|
|
1136
1153
|
}))
|
|
1137
1154
|
});
|
|
1138
|
-
|
|
1139
|
-
return { status: "blocked", results: [], blockedBy };
|
|
1140
|
-
}
|
|
1155
|
+
const blockedTargetKeys = new Set(blockedBy.map((blocker) => `${blocker.projectId}\0${blocker.branchName}`));
|
|
1141
1156
|
const results = [];
|
|
1142
1157
|
for (const { manifest, branchName } of targets) {
|
|
1158
|
+
if (blockedTargetKeys.has(`${manifest.projectId}\0${branchName}`)) {
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1143
1161
|
try {
|
|
1144
1162
|
const commitHash = await forceSyncManifestBranchFromInternal({
|
|
1145
1163
|
projectId: manifest.projectId,
|
|
@@ -1167,10 +1185,11 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1167
1185
|
});
|
|
1168
1186
|
}
|
|
1169
1187
|
}
|
|
1188
|
+
const hasFailures = results.some((result) => result.status === "failed");
|
|
1170
1189
|
return {
|
|
1171
|
-
status:
|
|
1190
|
+
status: blockedBy.length > 0 && results.length === 0 ? "blocked" : blockedBy.length > 0 || hasFailures ? "partial" : "completed",
|
|
1172
1191
|
results,
|
|
1173
|
-
blockedBy
|
|
1192
|
+
blockedBy
|
|
1174
1193
|
};
|
|
1175
1194
|
}
|
|
1176
1195
|
function resolveCommandCwd(branchPath, cwd) {
|
|
@@ -2530,7 +2549,7 @@ async function startWorker(options) {
|
|
|
2530
2549
|
projectsRoot,
|
|
2531
2550
|
syncRoot,
|
|
2532
2551
|
manifests: [...manifestByProjectId.values()],
|
|
2533
|
-
|
|
2552
|
+
requestedTargets: message.targets
|
|
2534
2553
|
});
|
|
2535
2554
|
for (const result of syncResult.results) {
|
|
2536
2555
|
if (result.status !== "synced") continue;
|
|
@@ -2897,6 +2916,7 @@ export {
|
|
|
2897
2916
|
resolveHostShell,
|
|
2898
2917
|
resolveProjectFilePath,
|
|
2899
2918
|
resolveWorkerFilePath,
|
|
2919
|
+
selectManifestSyncTargets,
|
|
2900
2920
|
syncManifestProjectsFromInternal,
|
|
2901
2921
|
syncProjectPlans,
|
|
2902
2922
|
syncSessionArtifacts
|
package/dist/mjs/package.json
CHANGED
package/dist/types/main.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ type WorkerRepositorySyncTarget = {
|
|
|
26
26
|
projectPath: string;
|
|
27
27
|
branchName: string;
|
|
28
28
|
};
|
|
29
|
+
type WorkerRepositorySyncSelector = {
|
|
30
|
+
projectId: string;
|
|
31
|
+
branchName: string;
|
|
32
|
+
};
|
|
29
33
|
type WorkerRepositorySyncResult = {
|
|
30
34
|
status: "completed" | "partial" | "blocked";
|
|
31
35
|
results: Array<WorkerRepositorySyncTarget & ({
|
|
@@ -142,13 +146,20 @@ export declare function findRepositorySyncBlockers(input: {
|
|
|
142
146
|
branchName: string;
|
|
143
147
|
}>;
|
|
144
148
|
}): WorkerRepositorySyncResult["blockedBy"];
|
|
149
|
+
export declare function selectManifestSyncTargets(input: {
|
|
150
|
+
manifests: WorkerProjectManifestEntry[];
|
|
151
|
+
requestedTargets?: WorkerRepositorySyncSelector[];
|
|
152
|
+
}): Array<{
|
|
153
|
+
manifest: WorkerProjectManifestEntry;
|
|
154
|
+
branchName: string;
|
|
155
|
+
}>;
|
|
145
156
|
export declare function syncManifestProjectsFromInternal(input: {
|
|
146
157
|
baseUrl: string;
|
|
147
158
|
token: string;
|
|
148
159
|
projectsRoot: string;
|
|
149
160
|
syncRoot: string;
|
|
150
161
|
manifests: WorkerProjectManifestEntry[];
|
|
151
|
-
|
|
162
|
+
requestedTargets?: WorkerRepositorySyncSelector[];
|
|
152
163
|
}): Promise<WorkerRepositorySyncResult>;
|
|
153
164
|
export declare function readWorkerTextFile(branchPath: string, filePath: string, offset?: number, limit?: number): WorkerReadFileResult;
|
|
154
165
|
export declare function grepWorkerFiles(branchPath: string, input: {
|