@ricsam/r5d-worker 0.0.64 → 0.0.66

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 CHANGED
@@ -807,6 +807,19 @@ function fallbackInternalRemoteUrl(baseUrl, projectId) {
807
807
  }
808
808
  function visibleCheckoutRemoteFor(input) {
809
809
  const canonicalCheckout = input.manifest?.canonicalCheckouts?.find((checkout) => checkout.branchName === input.branchName);
810
+ if (!canonicalCheckout && input.manifest) {
811
+ if (!input.manifest.repoHttpUrl) {
812
+ throw new Error(`Project ${input.projectId} has no connected repository; connect one before opening its checkouts`);
813
+ }
814
+ return {
815
+ remoteUrl: input.manifest.repoHttpUrl,
816
+ authHeader: input.manifest.repoAuthHeader ?? null,
817
+ persistAuth: true,
818
+ reconcileExistingOrigin: true,
819
+ requireRemoteBranch: false,
820
+ requiredBaseCommit: null
821
+ };
822
+ }
810
823
  return {
811
824
  remoteUrl: fallbackInternalRemoteUrl(input.baseUrl, input.projectId),
812
825
  authHeader: `Authorization: Bearer ${input.token}`,
@@ -1149,6 +1162,9 @@ function ensureVisibleGitCheckout(input) {
1149
1162
  if (input.reconcileExistingOrigin) {
1150
1163
  ensureOriginRemote(branchPath, input.remoteUrl);
1151
1164
  }
1165
+ if (!input.requireRemoteBranch) {
1166
+ tryGit(visibleCheckoutFetchArgs("origin", "--prune"), { cwd: branchPath, auth: input.remoteAuth });
1167
+ }
1152
1168
  if (input.requireRemoteBranch && !tryGit(["show-ref", "--verify", "--quiet", `refs/remotes/origin/${input.branchName}`], { cwd: branchPath })) {
1153
1169
  throw new Error(`Existing checkout for ${input.branchName} does not contain its canonical remote branch`);
1154
1170
  }
@@ -2379,6 +2395,14 @@ function projectRootFor(projectsRoot, projectId, manifestByProjectId) {
2379
2395
  return (0, import_managed_paths.managedProjectRoot)(projectsRoot, manifest.checkoutPathSegments);
2380
2396
  }
2381
2397
  async function startWorker(options) {
2398
+ process.on("uncaughtException", (error) => {
2399
+ process.stderr.write(`[r5d-worker] uncaught exception: ${error instanceof Error ? error.stack ?? error.message : String(error)}
2400
+ `);
2401
+ });
2402
+ process.on("unhandledRejection", (reason) => {
2403
+ process.stderr.write(`[r5d-worker] unhandled rejection: ${reason instanceof Error ? reason.stack ?? reason.message : String(reason)}
2404
+ `);
2405
+ });
2382
2406
  const config = readConfig(options.configPath);
2383
2407
  const { baseUrl, token } = resolveCredentials(options, config);
2384
2408
  const label = requireValue(options.label, "Missing required --label <label>");
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "type": "commonjs"
5
5
  }
@@ -138,7 +138,7 @@ function openWorkerPortForwardRelay(options) {
138
138
  socket.once("drain", () => relay.resume());
139
139
  }
140
140
  });
141
- relay.once("error", cleanup);
141
+ relay.on("error", cleanup);
142
142
  relay.once("close", cleanup);
143
143
  socket.pause();
144
144
  }
package/dist/mjs/main.mjs CHANGED
@@ -778,6 +778,19 @@ function fallbackInternalRemoteUrl(baseUrl, projectId) {
778
778
  }
779
779
  function visibleCheckoutRemoteFor(input) {
780
780
  const canonicalCheckout = input.manifest?.canonicalCheckouts?.find((checkout) => checkout.branchName === input.branchName);
781
+ if (!canonicalCheckout && input.manifest) {
782
+ if (!input.manifest.repoHttpUrl) {
783
+ throw new Error(`Project ${input.projectId} has no connected repository; connect one before opening its checkouts`);
784
+ }
785
+ return {
786
+ remoteUrl: input.manifest.repoHttpUrl,
787
+ authHeader: input.manifest.repoAuthHeader ?? null,
788
+ persistAuth: true,
789
+ reconcileExistingOrigin: true,
790
+ requireRemoteBranch: false,
791
+ requiredBaseCommit: null
792
+ };
793
+ }
781
794
  return {
782
795
  remoteUrl: fallbackInternalRemoteUrl(input.baseUrl, input.projectId),
783
796
  authHeader: `Authorization: Bearer ${input.token}`,
@@ -1120,6 +1133,9 @@ function ensureVisibleGitCheckout(input) {
1120
1133
  if (input.reconcileExistingOrigin) {
1121
1134
  ensureOriginRemote(branchPath, input.remoteUrl);
1122
1135
  }
1136
+ if (!input.requireRemoteBranch) {
1137
+ tryGit(visibleCheckoutFetchArgs("origin", "--prune"), { cwd: branchPath, auth: input.remoteAuth });
1138
+ }
1123
1139
  if (input.requireRemoteBranch && !tryGit(["show-ref", "--verify", "--quiet", `refs/remotes/origin/${input.branchName}`], { cwd: branchPath })) {
1124
1140
  throw new Error(`Existing checkout for ${input.branchName} does not contain its canonical remote branch`);
1125
1141
  }
@@ -2350,6 +2366,14 @@ function projectRootFor(projectsRoot, projectId, manifestByProjectId) {
2350
2366
  return managedProjectRoot(projectsRoot, manifest.checkoutPathSegments);
2351
2367
  }
2352
2368
  async function startWorker(options) {
2369
+ process.on("uncaughtException", (error) => {
2370
+ process.stderr.write(`[r5d-worker] uncaught exception: ${error instanceof Error ? error.stack ?? error.message : String(error)}
2371
+ `);
2372
+ });
2373
+ process.on("unhandledRejection", (reason) => {
2374
+ process.stderr.write(`[r5d-worker] unhandled rejection: ${reason instanceof Error ? reason.stack ?? reason.message : String(reason)}
2375
+ `);
2376
+ });
2353
2377
  const config = readConfig(options.configPath);
2354
2378
  const { baseUrl, token } = resolveCredentials(options, config);
2355
2379
  const label = requireValue(options.label, "Missing required --label <label>");
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "type": "module"
5
5
  }
@@ -105,7 +105,7 @@ function openWorkerPortForwardRelay(options) {
105
105
  socket.once("drain", () => relay.resume());
106
106
  }
107
107
  });
108
- relay.once("error", cleanup);
108
+ relay.on("error", cleanup);
109
109
  relay.once("close", cleanup);
110
110
  socket.pause();
111
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",