@ricsam/r5d-worker 0.0.4 → 0.0.6

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 CHANGED
@@ -1,25 +1,25 @@
1
1
  # r5d-worker
2
2
 
3
- `r5d-worker` connects a local or remote machine to a r5d.dev project so the agent can run host commands through the virtual `worker` shell command.
3
+ `r5d-worker` connects a local or remote machine to r5d.dev so the agent can run host commands through the live worker.
4
4
 
5
5
  ```sh
6
- r5d-worker start <project-id> --label macos
6
+ r5d-worker start --label macos
7
+ r5d-worker --version
7
8
  ```
8
9
 
9
10
  The worker uses the existing `r5dctl` config file and accepts `R5D_WORKER_TOKEN` or `R5D_API_KEY`. Project checkouts are managed under:
10
11
 
11
12
  ```text
12
- ~/.r5d/projects/<project-id>/<branch-name>
13
+ ~/.r5d/projects/<namespace-repo>/<branch-name>
13
14
  ```
14
15
 
15
- `main` is cloned from the platform's HTTPS git remote. Other branches are created as git worktrees from the main clone.
16
+ Visible branch checkouts use GitHub `origin` remotes. r5d internal sync git metadata lives separately under `~/.r5d/sync`.
16
17
 
17
- Worker labels are mandatory and unique per project. Choose labels that describe host capabilities, such as `macos`, `linux`, `ios`, or `ec2-build`.
18
+ Worker labels are mandatory and unique per user. Choose labels that describe host capabilities, such as `macos`, `linux`, `ios`, or `ec2-build`.
18
19
 
19
20
  The agent runs commands through the virtual shell command:
20
21
 
21
22
  ```sh
22
- worker exec macos git pull --ff-only build-it-now main
23
23
  worker exec macos docker compose up -d
24
24
  worker exec macos bun test
25
25
  ```
package/dist/cjs/main.cjs CHANGED
@@ -28,16 +28,21 @@ var import_node_path = __toESM(require("node:path"), 1);
28
28
  var import_node_crypto = require("node:crypto");
29
29
  var import_node_os2 = require("node:os");
30
30
  var import_node_child_process = require("node:child_process");
31
+ var import_git_identity = require("./git-identity.cjs");
31
32
  const DEFAULT_BASE_URL = "https://r5d.dev";
33
+ const WORKER_PACKAGE_NAME = "@ricsam/r5d-worker";
32
34
  const LABEL_RE = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,62}$/;
33
35
  const BRANCH_RE = /^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$|^[A-Za-z0-9]$/;
34
36
  const DEFAULT_READ_LIMIT = 2e3;
35
37
  const MAX_LINE_LENGTH = 2e3;
36
38
  const MAX_SYNC_DIFF_BYTES = 5 * 1024 * 1024;
39
+ const R5D_REMOTE_NAME = "r5d";
40
+ const LEGACY_BUILD_IT_NOW_REMOTE_NAME = "build-it-now";
37
41
  const activeProcesses = /* @__PURE__ */ new Map();
38
42
  const activePtys = /* @__PURE__ */ new Map();
39
43
  const branchLocks = /* @__PURE__ */ new Map();
40
44
  let containerRegistryCredential = null;
45
+ let visibleGitIdentity = null;
41
46
  function defaultConfigPath() {
42
47
  return import_node_path.default.join(import_node_os.default.homedir(), ".config", "r5d", "r5dctl", "config.json");
43
48
  }
@@ -50,6 +55,7 @@ function defaultSyncRoot() {
50
55
  function printHelp() {
51
56
  process.stdout.write(`Usage:
52
57
  r5d-worker start --label <label> [--base-url <url>] [--token <token>] [--api-key <key>]
58
+ r5d-worker --version
53
59
 
54
60
  Options:
55
61
  --label <label> Required unique worker label for this user, e.g. macos or ec2-build
@@ -59,9 +65,53 @@ Options:
59
65
  --config <path> Config path (default ~/.config/r5d/r5dctl/config.json)
60
66
  --project-root <dir> Override projects checkout root (default ~/.r5d/projects)
61
67
  --sync-root <dir> Override r5d internal sync git root (default ~/.r5d/sync)
68
+ -v, --version Show r5d-worker version
62
69
  -h, --help Show this help
63
70
  `);
64
71
  }
72
+ function readVersionFile(filePath) {
73
+ try {
74
+ const version = import_node_fs.default.readFileSync(filePath, "utf8").trim();
75
+ return version || null;
76
+ } catch {
77
+ return null;
78
+ }
79
+ }
80
+ function readInstalledPackageVersion(packageJsonPath) {
81
+ try {
82
+ const parsed = JSON.parse(import_node_fs.default.readFileSync(packageJsonPath, "utf8"));
83
+ if (parsed.name === WORKER_PACKAGE_NAME && typeof parsed.version === "string" && parsed.version.trim()) {
84
+ return parsed.version.trim();
85
+ }
86
+ } catch {
87
+ return null;
88
+ }
89
+ return null;
90
+ }
91
+ function getWorkerVersion() {
92
+ const entrypoint = process.argv[1] ? import_node_path.default.resolve(process.argv[1]) : null;
93
+ let current = entrypoint ? import_node_path.default.dirname(entrypoint) : process.cwd();
94
+ for (let index = 0; index < 12; index += 1) {
95
+ const packageVersion = readInstalledPackageVersion(import_node_path.default.join(current, "package.json"));
96
+ if (packageVersion) {
97
+ return packageVersion;
98
+ }
99
+ const sourceVersion = readVersionFile(import_node_path.default.join(current, "VERSION.txt"));
100
+ if (sourceVersion && import_node_path.default.basename(current) === "binctl-packages") {
101
+ return sourceVersion;
102
+ }
103
+ const parent = import_node_path.default.dirname(current);
104
+ if (parent === current) {
105
+ break;
106
+ }
107
+ current = parent;
108
+ }
109
+ return "unknown";
110
+ }
111
+ function printVersion() {
112
+ process.stdout.write(`r5d-worker ${getWorkerVersion()}
113
+ `);
114
+ }
65
115
  function requireValue(value, message) {
66
116
  if (!value) {
67
117
  throw new Error(message);
@@ -71,7 +121,8 @@ function requireValue(value, message) {
71
121
  function parseArgs(argv) {
72
122
  const options = {
73
123
  configPath: defaultConfigPath(),
74
- help: false
124
+ help: false,
125
+ version: false
75
126
  };
76
127
  const rest = [];
77
128
  for (let index = 0; index < argv.length; index += 1) {
@@ -83,6 +134,10 @@ function parseArgs(argv) {
83
134
  options.help = true;
84
135
  continue;
85
136
  }
137
+ if (arg === "-v" || arg === "--version") {
138
+ options.version = true;
139
+ continue;
140
+ }
86
141
  const readOption = (name) => {
87
142
  if (arg === name) {
88
143
  index += 1;
@@ -128,6 +183,9 @@ function parseArgs(argv) {
128
183
  }
129
184
  rest.push(arg);
130
185
  }
186
+ if (options.version) {
187
+ return { command: "version", options };
188
+ }
131
189
  if (options.help || rest.length === 0) {
132
190
  return { command: "help", options };
133
191
  }
@@ -547,15 +605,19 @@ function ensureVisibleGitCheckout(input) {
547
605
  }
548
606
  ensureOriginRemote(branchPath, input.githubRemoteUrl);
549
607
  configureVisibleGitHubAuth(branchPath, input.githubRemoteUrl, input.githubAuthHeader);
608
+ (0, import_git_identity.configureVisibleGitIdentity)(branchPath, visibleGitIdentity, runGit);
550
609
  tryGit(["fetch", "origin", "--prune"], { cwd: branchPath, auth: input.githubAuth });
551
610
  checkoutVisibleBranch({ branchPath, branchName: input.branchName, defaultBranch: input.defaultBranch });
552
611
  return branchPath;
553
612
  }
554
613
  function configureInternalRepo(context, remoteUrl) {
555
- if (tryInternalGit(context, ["remote", "get-url", "build-it-now"])) {
556
- runInternalGit(context, ["remote", "set-url", "build-it-now", remoteUrl]);
614
+ if (tryInternalGit(context, ["remote", "get-url", R5D_REMOTE_NAME])) {
615
+ runInternalGit(context, ["remote", "set-url", R5D_REMOTE_NAME, remoteUrl]);
557
616
  } else {
558
- runInternalGit(context, ["remote", "add", "build-it-now", remoteUrl]);
617
+ runInternalGit(context, ["remote", "add", R5D_REMOTE_NAME, remoteUrl]);
618
+ }
619
+ if (tryInternalGit(context, ["remote", "get-url", LEGACY_BUILD_IT_NOW_REMOTE_NAME])) {
620
+ runInternalGit(context, ["remote", "remove", LEGACY_BUILD_IT_NOW_REMOTE_NAME]);
559
621
  }
560
622
  runInternalGitDir(context, ["config", "user.name", "r5d.dev Worker"]);
561
623
  runInternalGitDir(context, ["config", "user.email", "worker@r5d.dev"]);
@@ -571,9 +633,9 @@ function ensureInternalSyncGit(input) {
571
633
  const context = { gitDir, workTree: input.branchPath, auth };
572
634
  const remoteUrl = internalRemoteUrlFor(input.baseUrl, input.projectId, input.manifest);
573
635
  configureInternalRepo(context, remoteUrl);
574
- runInternalGit(context, ["fetch", "build-it-now", "--prune", "+refs/heads/*:refs/remotes/build-it-now/*"]);
575
- const hasRemoteBranch = tryInternalGit(context, ["show-ref", "--verify", "--quiet", `refs/remotes/build-it-now/${input.branchName}`]);
576
- const target = hasRemoteBranch ? `refs/remotes/build-it-now/${input.branchName}` : "refs/remotes/build-it-now/main";
636
+ runInternalGit(context, ["fetch", R5D_REMOTE_NAME, "--prune", `+refs/heads/*:refs/remotes/${R5D_REMOTE_NAME}/*`]);
637
+ const hasRemoteBranch = tryInternalGit(context, ["show-ref", "--verify", "--quiet", `refs/remotes/${R5D_REMOTE_NAME}/${input.branchName}`]);
638
+ const target = hasRemoteBranch ? `refs/remotes/${R5D_REMOTE_NAME}/${input.branchName}` : `refs/remotes/${R5D_REMOTE_NAME}/main`;
577
639
  const hasHead = tryInternalGit(context, ["rev-parse", "--verify", "HEAD"]);
578
640
  if (!hasHead || !hasInternalWorktreeChanges(context)) {
579
641
  runInternalGit(context, ["checkout", "-f", "-B", input.branchName, target]);
@@ -842,7 +904,7 @@ function syncBranch(input) {
842
904
  });
843
905
  runInternalGit(workspace.internalGit, ["commit", "-m", message]);
844
906
  const commitHash = getInternalCommitHash(workspace.internalGit);
845
- runInternalGit(workspace.internalGit, ["push", "build-it-now", `HEAD:refs/heads/${input.branchName}`]);
907
+ runInternalGit(workspace.internalGit, ["push", R5D_REMOTE_NAME, `HEAD:refs/heads/${input.branchName}`]);
846
908
  return {
847
909
  type: "sync",
848
910
  changed: true,
@@ -873,8 +935,8 @@ function confirmLargeDiff(input) {
873
935
  }
874
936
  function pullBranch(input) {
875
937
  const workspace = ensureOperationBranch(input);
876
- runInternalGit(workspace.internalGit, ["fetch", "build-it-now", "--prune", "+refs/heads/*:refs/remotes/build-it-now/*"]);
877
- const target = input.commitHash ?? `build-it-now/${input.branchName}`;
938
+ runInternalGit(workspace.internalGit, ["fetch", R5D_REMOTE_NAME, "--prune", `+refs/heads/*:refs/remotes/${R5D_REMOTE_NAME}/*`]);
939
+ const target = input.commitHash ?? `${R5D_REMOTE_NAME}/${input.branchName}`;
878
940
  runInternalGit(workspace.internalGit, ["reset", "--hard", target]);
879
941
  runInternalGit(workspace.internalGit, ["clean", "-fd", "--", ".", ":(exclude).git"]);
880
942
  return {
@@ -1200,8 +1262,8 @@ function openPty(input) {
1200
1262
  ...process.env,
1201
1263
  ...containerRegistryEnv(),
1202
1264
  ...input.message.env ?? {},
1203
- BUILD_IT_NOW_PROJECT_ID: input.projectId,
1204
- BUILD_IT_NOW_BRANCH_NAME: input.message.branchName
1265
+ R5D_PROJECT_ID: input.projectId,
1266
+ R5D_BRANCH_NAME: input.message.branchName
1205
1267
  }
1206
1268
  },
1207
1269
  onOpened: () => {
@@ -1325,7 +1387,7 @@ async function startWorker(options) {
1325
1387
  platform: process.platform,
1326
1388
  arch: process.arch,
1327
1389
  pid: process.pid,
1328
- version: "0.1.0",
1390
+ version: getWorkerVersion(),
1329
1391
  projectRoot: projectsRoot
1330
1392
  }
1331
1393
  };
@@ -1340,6 +1402,7 @@ async function startWorker(options) {
1340
1402
  }
1341
1403
  if (message.type === "project_manifest") {
1342
1404
  configureContainerRegistryAuth(message.githubContainerRegistry);
1405
+ visibleGitIdentity = message.gitIdentity;
1343
1406
  manifestByProjectId.clear();
1344
1407
  for (const project of message.projects) {
1345
1408
  manifestByProjectId.set(project.projectId, project);
@@ -1477,6 +1540,10 @@ async function main() {
1477
1540
  printHelp();
1478
1541
  return;
1479
1542
  }
1543
+ if (parsed.command === "version") {
1544
+ printVersion();
1545
+ return;
1546
+ }
1480
1547
  await startWorker(parsed.options);
1481
1548
  }
1482
1549
  main().catch((error) => {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "commonjs"
5
5
  }
package/dist/mjs/main.mjs CHANGED
@@ -5,16 +5,21 @@ import path from "node:path";
5
5
  import { createHash } from "node:crypto";
6
6
  import { hostname } from "node:os";
7
7
  import { spawn as spawnChildProcess } from "node:child_process";
8
+ import { configureVisibleGitIdentity } from "./git-identity.mjs";
8
9
  const DEFAULT_BASE_URL = "https://r5d.dev";
10
+ const WORKER_PACKAGE_NAME = "@ricsam/r5d-worker";
9
11
  const LABEL_RE = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,62}$/;
10
12
  const BRANCH_RE = /^[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]$|^[A-Za-z0-9]$/;
11
13
  const DEFAULT_READ_LIMIT = 2e3;
12
14
  const MAX_LINE_LENGTH = 2e3;
13
15
  const MAX_SYNC_DIFF_BYTES = 5 * 1024 * 1024;
16
+ const R5D_REMOTE_NAME = "r5d";
17
+ const LEGACY_BUILD_IT_NOW_REMOTE_NAME = "build-it-now";
14
18
  const activeProcesses = /* @__PURE__ */ new Map();
15
19
  const activePtys = /* @__PURE__ */ new Map();
16
20
  const branchLocks = /* @__PURE__ */ new Map();
17
21
  let containerRegistryCredential = null;
22
+ let visibleGitIdentity = null;
18
23
  function defaultConfigPath() {
19
24
  return path.join(os.homedir(), ".config", "r5d", "r5dctl", "config.json");
20
25
  }
@@ -27,6 +32,7 @@ function defaultSyncRoot() {
27
32
  function printHelp() {
28
33
  process.stdout.write(`Usage:
29
34
  r5d-worker start --label <label> [--base-url <url>] [--token <token>] [--api-key <key>]
35
+ r5d-worker --version
30
36
 
31
37
  Options:
32
38
  --label <label> Required unique worker label for this user, e.g. macos or ec2-build
@@ -36,9 +42,53 @@ Options:
36
42
  --config <path> Config path (default ~/.config/r5d/r5dctl/config.json)
37
43
  --project-root <dir> Override projects checkout root (default ~/.r5d/projects)
38
44
  --sync-root <dir> Override r5d internal sync git root (default ~/.r5d/sync)
45
+ -v, --version Show r5d-worker version
39
46
  -h, --help Show this help
40
47
  `);
41
48
  }
49
+ function readVersionFile(filePath) {
50
+ try {
51
+ const version = fs.readFileSync(filePath, "utf8").trim();
52
+ return version || null;
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
57
+ function readInstalledPackageVersion(packageJsonPath) {
58
+ try {
59
+ const parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
60
+ if (parsed.name === WORKER_PACKAGE_NAME && typeof parsed.version === "string" && parsed.version.trim()) {
61
+ return parsed.version.trim();
62
+ }
63
+ } catch {
64
+ return null;
65
+ }
66
+ return null;
67
+ }
68
+ function getWorkerVersion() {
69
+ const entrypoint = process.argv[1] ? path.resolve(process.argv[1]) : null;
70
+ let current = entrypoint ? path.dirname(entrypoint) : process.cwd();
71
+ for (let index = 0; index < 12; index += 1) {
72
+ const packageVersion = readInstalledPackageVersion(path.join(current, "package.json"));
73
+ if (packageVersion) {
74
+ return packageVersion;
75
+ }
76
+ const sourceVersion = readVersionFile(path.join(current, "VERSION.txt"));
77
+ if (sourceVersion && path.basename(current) === "binctl-packages") {
78
+ return sourceVersion;
79
+ }
80
+ const parent = path.dirname(current);
81
+ if (parent === current) {
82
+ break;
83
+ }
84
+ current = parent;
85
+ }
86
+ return "unknown";
87
+ }
88
+ function printVersion() {
89
+ process.stdout.write(`r5d-worker ${getWorkerVersion()}
90
+ `);
91
+ }
42
92
  function requireValue(value, message) {
43
93
  if (!value) {
44
94
  throw new Error(message);
@@ -48,7 +98,8 @@ function requireValue(value, message) {
48
98
  function parseArgs(argv) {
49
99
  const options = {
50
100
  configPath: defaultConfigPath(),
51
- help: false
101
+ help: false,
102
+ version: false
52
103
  };
53
104
  const rest = [];
54
105
  for (let index = 0; index < argv.length; index += 1) {
@@ -60,6 +111,10 @@ function parseArgs(argv) {
60
111
  options.help = true;
61
112
  continue;
62
113
  }
114
+ if (arg === "-v" || arg === "--version") {
115
+ options.version = true;
116
+ continue;
117
+ }
63
118
  const readOption = (name) => {
64
119
  if (arg === name) {
65
120
  index += 1;
@@ -105,6 +160,9 @@ function parseArgs(argv) {
105
160
  }
106
161
  rest.push(arg);
107
162
  }
163
+ if (options.version) {
164
+ return { command: "version", options };
165
+ }
108
166
  if (options.help || rest.length === 0) {
109
167
  return { command: "help", options };
110
168
  }
@@ -524,15 +582,19 @@ function ensureVisibleGitCheckout(input) {
524
582
  }
525
583
  ensureOriginRemote(branchPath, input.githubRemoteUrl);
526
584
  configureVisibleGitHubAuth(branchPath, input.githubRemoteUrl, input.githubAuthHeader);
585
+ configureVisibleGitIdentity(branchPath, visibleGitIdentity, runGit);
527
586
  tryGit(["fetch", "origin", "--prune"], { cwd: branchPath, auth: input.githubAuth });
528
587
  checkoutVisibleBranch({ branchPath, branchName: input.branchName, defaultBranch: input.defaultBranch });
529
588
  return branchPath;
530
589
  }
531
590
  function configureInternalRepo(context, remoteUrl) {
532
- if (tryInternalGit(context, ["remote", "get-url", "build-it-now"])) {
533
- runInternalGit(context, ["remote", "set-url", "build-it-now", remoteUrl]);
591
+ if (tryInternalGit(context, ["remote", "get-url", R5D_REMOTE_NAME])) {
592
+ runInternalGit(context, ["remote", "set-url", R5D_REMOTE_NAME, remoteUrl]);
534
593
  } else {
535
- runInternalGit(context, ["remote", "add", "build-it-now", remoteUrl]);
594
+ runInternalGit(context, ["remote", "add", R5D_REMOTE_NAME, remoteUrl]);
595
+ }
596
+ if (tryInternalGit(context, ["remote", "get-url", LEGACY_BUILD_IT_NOW_REMOTE_NAME])) {
597
+ runInternalGit(context, ["remote", "remove", LEGACY_BUILD_IT_NOW_REMOTE_NAME]);
536
598
  }
537
599
  runInternalGitDir(context, ["config", "user.name", "r5d.dev Worker"]);
538
600
  runInternalGitDir(context, ["config", "user.email", "worker@r5d.dev"]);
@@ -548,9 +610,9 @@ function ensureInternalSyncGit(input) {
548
610
  const context = { gitDir, workTree: input.branchPath, auth };
549
611
  const remoteUrl = internalRemoteUrlFor(input.baseUrl, input.projectId, input.manifest);
550
612
  configureInternalRepo(context, remoteUrl);
551
- runInternalGit(context, ["fetch", "build-it-now", "--prune", "+refs/heads/*:refs/remotes/build-it-now/*"]);
552
- const hasRemoteBranch = tryInternalGit(context, ["show-ref", "--verify", "--quiet", `refs/remotes/build-it-now/${input.branchName}`]);
553
- const target = hasRemoteBranch ? `refs/remotes/build-it-now/${input.branchName}` : "refs/remotes/build-it-now/main";
613
+ runInternalGit(context, ["fetch", R5D_REMOTE_NAME, "--prune", `+refs/heads/*:refs/remotes/${R5D_REMOTE_NAME}/*`]);
614
+ const hasRemoteBranch = tryInternalGit(context, ["show-ref", "--verify", "--quiet", `refs/remotes/${R5D_REMOTE_NAME}/${input.branchName}`]);
615
+ const target = hasRemoteBranch ? `refs/remotes/${R5D_REMOTE_NAME}/${input.branchName}` : `refs/remotes/${R5D_REMOTE_NAME}/main`;
554
616
  const hasHead = tryInternalGit(context, ["rev-parse", "--verify", "HEAD"]);
555
617
  if (!hasHead || !hasInternalWorktreeChanges(context)) {
556
618
  runInternalGit(context, ["checkout", "-f", "-B", input.branchName, target]);
@@ -819,7 +881,7 @@ function syncBranch(input) {
819
881
  });
820
882
  runInternalGit(workspace.internalGit, ["commit", "-m", message]);
821
883
  const commitHash = getInternalCommitHash(workspace.internalGit);
822
- runInternalGit(workspace.internalGit, ["push", "build-it-now", `HEAD:refs/heads/${input.branchName}`]);
884
+ runInternalGit(workspace.internalGit, ["push", R5D_REMOTE_NAME, `HEAD:refs/heads/${input.branchName}`]);
823
885
  return {
824
886
  type: "sync",
825
887
  changed: true,
@@ -850,8 +912,8 @@ function confirmLargeDiff(input) {
850
912
  }
851
913
  function pullBranch(input) {
852
914
  const workspace = ensureOperationBranch(input);
853
- runInternalGit(workspace.internalGit, ["fetch", "build-it-now", "--prune", "+refs/heads/*:refs/remotes/build-it-now/*"]);
854
- const target = input.commitHash ?? `build-it-now/${input.branchName}`;
915
+ runInternalGit(workspace.internalGit, ["fetch", R5D_REMOTE_NAME, "--prune", `+refs/heads/*:refs/remotes/${R5D_REMOTE_NAME}/*`]);
916
+ const target = input.commitHash ?? `${R5D_REMOTE_NAME}/${input.branchName}`;
855
917
  runInternalGit(workspace.internalGit, ["reset", "--hard", target]);
856
918
  runInternalGit(workspace.internalGit, ["clean", "-fd", "--", ".", ":(exclude).git"]);
857
919
  return {
@@ -1177,8 +1239,8 @@ function openPty(input) {
1177
1239
  ...process.env,
1178
1240
  ...containerRegistryEnv(),
1179
1241
  ...input.message.env ?? {},
1180
- BUILD_IT_NOW_PROJECT_ID: input.projectId,
1181
- BUILD_IT_NOW_BRANCH_NAME: input.message.branchName
1242
+ R5D_PROJECT_ID: input.projectId,
1243
+ R5D_BRANCH_NAME: input.message.branchName
1182
1244
  }
1183
1245
  },
1184
1246
  onOpened: () => {
@@ -1302,7 +1364,7 @@ async function startWorker(options) {
1302
1364
  platform: process.platform,
1303
1365
  arch: process.arch,
1304
1366
  pid: process.pid,
1305
- version: "0.1.0",
1367
+ version: getWorkerVersion(),
1306
1368
  projectRoot: projectsRoot
1307
1369
  }
1308
1370
  };
@@ -1317,6 +1379,7 @@ async function startWorker(options) {
1317
1379
  }
1318
1380
  if (message.type === "project_manifest") {
1319
1381
  configureContainerRegistryAuth(message.githubContainerRegistry);
1382
+ visibleGitIdentity = message.gitIdentity;
1320
1383
  manifestByProjectId.clear();
1321
1384
  for (const project of message.projects) {
1322
1385
  manifestByProjectId.set(project.projectId, project);
@@ -1454,6 +1517,10 @@ async function main() {
1454
1517
  printHelp();
1455
1518
  return;
1456
1519
  }
1520
+ if (parsed.command === "version") {
1521
+ printVersion();
1522
+ return;
1523
+ }
1457
1524
  await startWorker(parsed.options);
1458
1525
  }
1459
1526
  main().catch((error) => {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module"
5
5
  }
@@ -0,0 +1,9 @@
1
+ export type WorkerGitIdentity = {
2
+ name: string;
3
+ email: string;
4
+ };
5
+ type RunGit = (args: string[], options?: {
6
+ cwd?: string;
7
+ }) => string | void;
8
+ export declare function configureVisibleGitIdentity(branchPath: string, identity: WorkerGitIdentity | null | undefined, runGit: RunGit): void;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",