@ozyman42/ozy-cli 0.4.8 → 0.4.9-darwin-arm64.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.
Files changed (207) hide show
  1. package/multi-call-binary +0 -0
  2. package/package.json +11 -52
  3. package/bin/ozy +0 -191
  4. package/bin/ozy-signing-agent +0 -191
  5. package/bin/ozy-ssh-keygen +0 -191
  6. package/bin/ozy-virtual-security-key +0 -191
  7. package/dist/commands/git/hosts.js +0 -18
  8. package/dist/commands/git/hosts.js.map +0 -1
  9. package/dist/commands/git/index.js +0 -8
  10. package/dist/commands/git/index.js.map +0 -1
  11. package/dist/commands/git/setup.js +0 -145
  12. package/dist/commands/git/setup.js.map +0 -1
  13. package/dist/commands/index.js +0 -13
  14. package/dist/commands/index.js.map +0 -1
  15. package/dist/commands/npm/index.js +0 -7
  16. package/dist/commands/npm/index.js.map +0 -1
  17. package/dist/commands/npm/setup/git-remote.js +0 -66
  18. package/dist/commands/npm/setup/git-remote.js.map +0 -1
  19. package/dist/commands/npm/setup/index.js +0 -168
  20. package/dist/commands/npm/setup/index.js.map +0 -1
  21. package/dist/commands/npm/setup/npm-auth.js +0 -62
  22. package/dist/commands/npm/setup/npm-auth.js.map +0 -1
  23. package/dist/commands/npm/setup/package-json-validate.js +0 -47
  24. package/dist/commands/npm/setup/package-json-validate.js.map +0 -1
  25. package/dist/commands/npm/setup/package-registry.js +0 -20
  26. package/dist/commands/npm/setup/package-registry.js.map +0 -1
  27. package/dist/commands/npm/setup/setup.test.js +0 -95
  28. package/dist/commands/npm/setup/setup.test.js.map +0 -1
  29. package/dist/commands/npm/setup/trusted-publishing.js +0 -84
  30. package/dist/commands/npm/setup/trusted-publishing.js.map +0 -1
  31. package/dist/commands/npm/setup/workflow.js +0 -19
  32. package/dist/commands/npm/setup/workflow.js.map +0 -1
  33. package/dist/commands/ssh/get-sk-credential.js +0 -104
  34. package/dist/commands/ssh/get-sk-credential.js.map +0 -1
  35. package/dist/commands/ssh/index.js +0 -7
  36. package/dist/commands/ssh/index.js.map +0 -1
  37. package/dist/commands/upgrade.js +0 -199
  38. package/dist/commands/upgrade.js.map +0 -1
  39. package/dist/common/command.js +0 -15
  40. package/dist/common/command.js.map +0 -1
  41. package/dist/common/constants.js +0 -25
  42. package/dist/common/constants.js.map +0 -1
  43. package/dist/common/effective-modules-extensions.js +0 -13
  44. package/dist/common/effective-modules-extensions.js.map +0 -1
  45. package/dist/common/log.js +0 -4
  46. package/dist/common/log.js.map +0 -1
  47. package/dist/common/render-caller-tree.js +0 -20
  48. package/dist/common/render-caller-tree.js.map +0 -1
  49. package/dist/entrypoints/ozy-signing-agent.js +0 -48
  50. package/dist/entrypoints/ozy-signing-agent.js.map +0 -1
  51. package/dist/entrypoints/ozy-ssh-keygen.js +0 -9
  52. package/dist/entrypoints/ozy-ssh-keygen.js.map +0 -1
  53. package/dist/entrypoints/ozy-virtual-security-key.js +0 -18
  54. package/dist/entrypoints/ozy-virtual-security-key.js.map +0 -1
  55. package/dist/entrypoints/ozy.js +0 -3
  56. package/dist/entrypoints/ozy.js.map +0 -1
  57. package/dist/index.js +0 -2
  58. package/dist/index.js.map +0 -1
  59. package/dist/internal/thing.js +0 -4
  60. package/dist/internal/thing.js.map +0 -1
  61. package/dist/modules/cli/agent-client/impl.js +0 -109
  62. package/dist/modules/cli/agent-client/impl.js.map +0 -1
  63. package/dist/modules/cli/agent-client/interface.js +0 -11
  64. package/dist/modules/cli/agent-client/interface.js.map +0 -1
  65. package/dist/modules/cli/git/impl.js +0 -124
  66. package/dist/modules/cli/git/impl.js.map +0 -1
  67. package/dist/modules/cli/git/interface.js +0 -3
  68. package/dist/modules/cli/git/interface.js.map +0 -1
  69. package/dist/modules/cli/git/submodule/fix.js +0 -257
  70. package/dist/modules/cli/git/submodule/fix.js.map +0 -1
  71. package/dist/modules/cli/git/submodule/git-state.js +0 -154
  72. package/dist/modules/cli/git/submodule/git-state.js.map +0 -1
  73. package/dist/modules/cli/git/submodule/gitmodules.js +0 -113
  74. package/dist/modules/cli/git/submodule/gitmodules.js.map +0 -1
  75. package/dist/modules/cli/git/submodule/printer.js +0 -232
  76. package/dist/modules/cli/git/submodule/printer.js.map +0 -1
  77. package/dist/modules/cli/git/submodule/resolve-git-dir.js +0 -16
  78. package/dist/modules/cli/git/submodule/resolve-git-dir.js.map +0 -1
  79. package/dist/modules/cli/github/impl.js +0 -137
  80. package/dist/modules/cli/github/impl.js.map +0 -1
  81. package/dist/modules/cli/github/interface.js +0 -2
  82. package/dist/modules/cli/github/interface.js.map +0 -1
  83. package/dist/modules/cli/index.js +0 -9
  84. package/dist/modules/cli/index.js.map +0 -1
  85. package/dist/modules/common/crypto/impl.js +0 -133
  86. package/dist/modules/common/crypto/impl.js.map +0 -1
  87. package/dist/modules/common/crypto/interface.js +0 -2
  88. package/dist/modules/common/crypto/interface.js.map +0 -1
  89. package/dist/modules/common/index.js +0 -10
  90. package/dist/modules/common/index.js.map +0 -1
  91. package/dist/modules/common/kep-map-store/impl.js +0 -42
  92. package/dist/modules/common/kep-map-store/impl.js.map +0 -1
  93. package/dist/modules/common/kep-map-store/interface.js +0 -2
  94. package/dist/modules/common/kep-map-store/interface.js.map +0 -1
  95. package/dist/modules/common/os-platform/caller-info.js +0 -132
  96. package/dist/modules/common/os-platform/caller-info.js.map +0 -1
  97. package/dist/modules/common/os-platform/impl.js +0 -95
  98. package/dist/modules/common/os-platform/impl.js.map +0 -1
  99. package/dist/modules/common/os-platform/interface.js +0 -2
  100. package/dist/modules/common/os-platform/interface.js.map +0 -1
  101. package/dist/modules/common/os-platform/virtual-hid/index.js +0 -12
  102. package/dist/modules/common/os-platform/virtual-hid/index.js.map +0 -1
  103. package/dist/modules/common/os-platform/virtual-hid/linux.js +0 -5
  104. package/dist/modules/common/os-platform/virtual-hid/linux.js.map +0 -1
  105. package/dist/modules/common/os-platform/virtual-hid/mac.js +0 -119
  106. package/dist/modules/common/os-platform/virtual-hid/mac.js.map +0 -1
  107. package/dist/modules/common/os-platform/virtual-hid/windows.js +0 -5
  108. package/dist/modules/common/os-platform/virtual-hid/windows.js.map +0 -1
  109. package/dist/modules/common/ssh-config/impl.js +0 -116
  110. package/dist/modules/common/ssh-config/impl.js.map +0 -1
  111. package/dist/modules/common/ssh-config/interface.js +0 -10
  112. package/dist/modules/common/ssh-config/interface.js.map +0 -1
  113. package/dist/modules/ssh-agent/index.js +0 -8
  114. package/dist/modules/ssh-agent/index.js.map +0 -1
  115. package/dist/modules/ssh-agent/session/impl.js +0 -265
  116. package/dist/modules/ssh-agent/session/impl.js.map +0 -1
  117. package/dist/modules/ssh-agent/session/interface-rpc.js +0 -20
  118. package/dist/modules/ssh-agent/session/interface-rpc.js.map +0 -1
  119. package/dist/modules/ssh-agent/session/interface.js +0 -32
  120. package/dist/modules/ssh-agent/session/interface.js.map +0 -1
  121. package/dist/modules/ssh-agent/session/passkey-prf-page.js +0 -204
  122. package/dist/modules/ssh-agent/session/passkey-prf-page.js.map +0 -1
  123. package/dist/modules/ssh-agent/session/prf-flow.js +0 -103
  124. package/dist/modules/ssh-agent/session/prf-flow.js.map +0 -1
  125. package/dist/modules/ssh-agent/ssh-agent/impl.js +0 -117
  126. package/dist/modules/ssh-agent/ssh-agent/impl.js.map +0 -1
  127. package/dist/modules/ssh-agent/ssh-agent/interface.js +0 -2
  128. package/dist/modules/ssh-agent/ssh-agent/interface.js.map +0 -1
  129. package/dist/scripts/build.js +0 -410
  130. package/dist/scripts/build.js.map +0 -1
  131. package/dist/scripts/check-npm-version.js +0 -8
  132. package/dist/scripts/check-npm-version.js.map +0 -1
  133. package/dist/scripts/kill-existing-agent.js +0 -21
  134. package/dist/scripts/kill-existing-agent.js.map +0 -1
  135. package/dist/scripts/publish.js +0 -46
  136. package/dist/scripts/publish.js.map +0 -1
  137. package/src/commands/git/hosts.ts +0 -20
  138. package/src/commands/git/index.ts +0 -9
  139. package/src/commands/git/setup.ts +0 -182
  140. package/src/commands/index.ts +0 -15
  141. package/src/commands/npm/index.ts +0 -8
  142. package/src/commands/npm/setup/git-remote.ts +0 -78
  143. package/src/commands/npm/setup/index.ts +0 -189
  144. package/src/commands/npm/setup/npm-auth.ts +0 -58
  145. package/src/commands/npm/setup/package-json-validate.ts +0 -68
  146. package/src/commands/npm/setup/package-registry.ts +0 -24
  147. package/src/commands/npm/setup/publish-workflow.yml +0 -35
  148. package/src/commands/npm/setup/setup.test.ts +0 -117
  149. package/src/commands/npm/setup/trusted-publishing.ts +0 -106
  150. package/src/commands/npm/setup/workflow.ts +0 -20
  151. package/src/commands/ssh/get-sk-credential.ts +0 -110
  152. package/src/commands/ssh/index.ts +0 -8
  153. package/src/commands/upgrade.ts +0 -220
  154. package/src/common/command.ts +0 -16
  155. package/src/common/constants.ts +0 -26
  156. package/src/common/effective-modules-extensions.ts +0 -24
  157. package/src/common/log.ts +0 -3
  158. package/src/common/render-caller-tree.ts +0 -22
  159. package/src/entrypoints/ozy-signing-agent.ts +0 -48
  160. package/src/entrypoints/ozy-ssh-keygen.ts +0 -10
  161. package/src/entrypoints/ozy-virtual-security-key.ts +0 -21
  162. package/src/entrypoints/ozy.ts +0 -2
  163. package/src/index.ts +0 -1
  164. package/src/internal/thing.ts +0 -3
  165. package/src/modules/cli/agent-client/impl.ts +0 -152
  166. package/src/modules/cli/agent-client/interface.ts +0 -17
  167. package/src/modules/cli/git/impl.ts +0 -133
  168. package/src/modules/cli/git/interface.ts +0 -23
  169. package/src/modules/cli/git/submodule/fix.ts +0 -298
  170. package/src/modules/cli/git/submodule/git-state.ts +0 -217
  171. package/src/modules/cli/git/submodule/gitmodules.ts +0 -126
  172. package/src/modules/cli/git/submodule/printer.ts +0 -256
  173. package/src/modules/cli/git/submodule/resolve-git-dir.ts +0 -14
  174. package/src/modules/cli/github/impl.ts +0 -169
  175. package/src/modules/cli/github/interface.ts +0 -29
  176. package/src/modules/cli/index.ts +0 -16
  177. package/src/modules/common/crypto/impl.ts +0 -173
  178. package/src/modules/common/crypto/interface.ts +0 -20
  179. package/src/modules/common/index.ts +0 -19
  180. package/src/modules/common/kep-map-store/impl.ts +0 -47
  181. package/src/modules/common/kep-map-store/interface.ts +0 -9
  182. package/src/modules/common/os-platform/caller-info.ts +0 -152
  183. package/src/modules/common/os-platform/impl.ts +0 -91
  184. package/src/modules/common/os-platform/interface.ts +0 -16
  185. package/src/modules/common/os-platform/virtual-hid/index.ts +0 -12
  186. package/src/modules/common/os-platform/virtual-hid/linux.ts +0 -7
  187. package/src/modules/common/os-platform/virtual-hid/mac.ts +0 -150
  188. package/src/modules/common/os-platform/virtual-hid/windows.ts +0 -7
  189. package/src/modules/common/ssh-config/impl.ts +0 -130
  190. package/src/modules/common/ssh-config/interface.ts +0 -33
  191. package/src/modules/ssh-agent/index.ts +0 -13
  192. package/src/modules/ssh-agent/session/agent-notes.md +0 -210
  193. package/src/modules/ssh-agent/session/design.md +0 -2
  194. package/src/modules/ssh-agent/session/html-refactor.md +0 -23
  195. package/src/modules/ssh-agent/session/impl.ts +0 -328
  196. package/src/modules/ssh-agent/session/interface-rpc.ts +0 -24
  197. package/src/modules/ssh-agent/session/interface.ts +0 -62
  198. package/src/modules/ssh-agent/session/passkey-prf-page.ts +0 -224
  199. package/src/modules/ssh-agent/session/prf-flow.ts +0 -152
  200. package/src/modules/ssh-agent/ssh-agent/impl.ts +0 -136
  201. package/src/modules/ssh-agent/ssh-agent/interface.ts +0 -9
  202. package/src/scripts/build.ts +0 -504
  203. package/src/scripts/check-npm-version.ts +0 -7
  204. package/src/scripts/command-launcher.js.ejs +0 -168
  205. package/src/scripts/kill-existing-agent.ts +0 -22
  206. package/src/scripts/publish.ts +0 -47
  207. package/src/scripts/windows-bin-shims.md +0 -1104
Binary file
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@ozyman42/ozy-cli",
3
- "version": "0.4.8",
4
- "description": "Tools for setting up new packages, configuring with git & npm",
3
+ "version": "0.4.9-darwin-arm64.0",
5
4
  "type": "module",
5
+ "os": [
6
+ "darwin"
7
+ ],
8
+ "cpu": [
9
+ "arm64"
10
+ ],
11
+ "files": [
12
+ "multi-call-binary"
13
+ ],
14
+ "description": "Tools for setting up new packages, configuring with git & npm",
6
15
  "license": "MIT",
7
16
  "repository": {
8
17
  "type": "git",
@@ -11,55 +20,5 @@
11
20
  "publishConfig": {
12
21
  "access": "public",
13
22
  "provenance": true
14
- },
15
- "main": "./dist/index.js",
16
- "module": "./dist/index.js",
17
- "types": "./src/index.ts",
18
- "exports": {
19
- ".": {
20
- "types": "./src/index.ts",
21
- "import": "./dist/index.js"
22
- },
23
- "./entrypoints": null,
24
- "./entrypoints/*": null,
25
- "./agents": null,
26
- "./agents/*": null,
27
- "./internal": null,
28
- "./internal/*": null,
29
- "./*": {
30
- "types": "./src/*.ts",
31
- "import": "./dist/*.js"
32
- }
33
- },
34
- "files": [
35
- "dist",
36
- "src",
37
- "bin"
38
- ],
39
- "bin": {
40
- "ozy": "./bin/ozy",
41
- "ozy-signing-agent": "./bin/ozy-signing-agent",
42
- "ozy-ssh-keygen": "./bin/ozy-ssh-keygen",
43
- "ozy-virtual-security-key": "./bin/ozy-virtual-security-key"
44
- },
45
- "dependencies": {
46
- "@effect/platform-bun": "^4.0.0-beta.70",
47
- "@ozyman42/interactive-cli-select": "^0.2.0",
48
- "bip39": "^3.1.0",
49
- "bs58": "^6.0.0",
50
- "commander": "^13.1.0",
51
- "effect": "4.0.0-beta.70",
52
- "effective-modules": "0.3.1-effect4",
53
- "expand-tilde": "^2.0.2",
54
- "friendly-words": "^1.3.1",
55
- "ssh-config": "^5.0.3",
56
- "zod": "^3.24.2"
57
- },
58
- "optionalDependencies": {
59
- "@ozyman42/ozy-cli-darwin-arm64": "npm:@ozyman42/ozy-cli@0.4.8-darwin-arm64.0",
60
- "@ozyman42/ozy-cli-darwin-x64": "npm:@ozyman42/ozy-cli@0.4.8-darwin-x64.0",
61
- "@ozyman42/ozy-cli-linux-arm64": "npm:@ozyman42/ozy-cli@0.4.8-linux-arm64.0",
62
- "@ozyman42/ozy-cli-linux-x64": "npm:@ozyman42/ozy-cli@0.4.8-linux-x64.0",
63
- "@ozyman42/ozy-cli-windows-x64": "npm:@ozyman42/ozy-cli@0.4.8-windows-x64.0"
64
23
  }
65
24
  }
package/bin/ozy DELETED
@@ -1,191 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- import { spawnSync } from "node:child_process";
4
- import {
5
- chmodSync,
6
- copyFileSync,
7
- existsSync,
8
- linkSync,
9
- mkdirSync,
10
- readFileSync,
11
- renameSync,
12
- rmSync,
13
- writeFileSync,
14
- } from "node:fs";
15
- import { basename, dirname, join } from "node:path";
16
- import { fileURLToPath } from "node:url";
17
-
18
- const PLATFORM_MAP = {
19
- "darwin-arm64": "darwin-arm64",
20
- "darwin-x64": "darwin-x64",
21
- "linux-arm64": "linux-arm64",
22
- "linux-x64": "linux-x64",
23
- "win32-x64": "windows-x64"
24
- };
25
- const PLATFORM_PACKAGES = {
26
- "darwin-arm64": "@ozyman42/ozy-cli-darwin-arm64",
27
- "darwin-x64": "@ozyman42/ozy-cli-darwin-x64",
28
- "linux-arm64": "@ozyman42/ozy-cli-linux-arm64",
29
- "linux-x64": "@ozyman42/ozy-cli-linux-x64",
30
- "windows-x64": "@ozyman42/ozy-cli-windows-x64"
31
- };
32
- const PLATFORM_BINARIES = {
33
- "darwin-arm64": "multi-call-binary",
34
- "darwin-x64": "multi-call-binary",
35
- "linux-arm64": "multi-call-binary",
36
- "linux-x64": "multi-call-binary",
37
- "windows-x64": "multi-call-binary.exe"
38
- };
39
- const COMMANDS = [
40
- "ozy",
41
- "ozy-signing-agent",
42
- "ozy-ssh-keygen",
43
- "ozy-virtual-security-key"
44
- ];
45
- const WINDOWS_EXECUTABLE_SUFFIX = ".exe";
46
- const INSTALLED_JSON = "installed.json";
47
-
48
- const require = createRequire(import.meta.url);
49
- const launcherPath = fileURLToPath(import.meta.url);
50
- const launcherDir = dirname(launcherPath);
51
- const commandName = basename(launcherPath);
52
-
53
- function fail(message) {
54
- console.error(message);
55
- process.exit(1);
56
- }
57
-
58
- function currentPlatformKey() {
59
- const platformKey = PLATFORM_MAP[`${process.platform}-${process.arch}`];
60
- if (!platformKey) {
61
- fail(`Unsupported platform: ${process.platform}-${process.arch}`);
62
- }
63
- return platformKey;
64
- }
65
-
66
- function currentPlatformPackageName() {
67
- const platformKey = currentPlatformKey();
68
- const packageName = PLATFORM_PACKAGES[platformKey];
69
- if (!packageName) {
70
- fail(`No platform package is configured for ${platformKey}`);
71
- }
72
- return packageName;
73
- }
74
-
75
- /**
76
- * When a Jive library contains any number of CLIs (entrypoints or agents), then the base package
77
- * will have an optional dependency for each possible architecture, with those platform-specific
78
- * packages containing a platform build of the CLI.
79
- * @returns the path to the platform binary and the exact version of the platform package.
80
- */
81
- function currentPlatformPackage() {
82
- const platformKey = currentPlatformKey();
83
- const binaryFile = PLATFORM_BINARIES[platformKey];
84
- if (!binaryFile) {
85
- fail(`No platform binary is configured for ${platformKey}`);
86
- }
87
-
88
- const packageName = currentPlatformPackageName();
89
- try {
90
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
91
- const packageDir = dirname(packageJsonPath);
92
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
93
- return {
94
- binaryPath: join(packageDir, binaryFile),
95
- version: packageJson.version,
96
- };
97
- } catch (error) {
98
- fail(`Could not resolve optional platform package ${packageName}. Reinstall dependencies for ${process.platform}-${process.arch}.`);
99
- }
100
- }
101
-
102
- function targetPathFor(command) {
103
- const suffix = process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : "";
104
- return join(launcherDir, `${command}${suffix}`);
105
- }
106
-
107
- function installedJsonPath() {
108
- return join(launcherDir, INSTALLED_JSON);
109
- }
110
-
111
- function windowsTargetsAreCurrent(version) {
112
- if (process.platform !== "win32") return false;
113
- if (!COMMANDS.every((command) => existsSync(targetPathFor(command)))) return false;
114
-
115
- try {
116
- const installed = JSON.parse(readFileSync(installedJsonPath(), "utf-8"));
117
- return installed.version === version;
118
- } catch {
119
- return false;
120
- }
121
- }
122
-
123
- function linkOrCopyFirstExecutable(sourcePath, targetPath) {
124
- mkdirSync(dirname(targetPath), { recursive: true });
125
- const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp${process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : ""}`;
126
- rmSync(tempPath, { force: true });
127
-
128
- try {
129
- try {
130
- linkSync(sourcePath, tempPath);
131
- } catch {
132
- copyFileSync(sourcePath, tempPath);
133
- }
134
-
135
- chmodSync(tempPath, 0o755);
136
- rmSync(targetPath, { force: true });
137
- renameSync(tempPath, targetPath);
138
- } finally {
139
- rmSync(tempPath, { force: true });
140
- }
141
- }
142
-
143
- function hardLinkCommandTarget(sourcePath, targetPath) {
144
- if (sourcePath === targetPath) return;
145
-
146
- const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp${process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : ""}`;
147
- rmSync(tempPath, { force: true });
148
-
149
- try {
150
- linkSync(sourcePath, tempPath);
151
- chmodSync(tempPath, 0o755);
152
- rmSync(targetPath, { force: true });
153
- renameSync(tempPath, targetPath);
154
- } finally {
155
- rmSync(tempPath, { force: true });
156
- }
157
- }
158
-
159
- function repairCommandTargets() {
160
- const platformPackage = currentPlatformPackage();
161
-
162
- if (windowsTargetsAreCurrent(platformPackage.version)) {
163
- return targetPathFor(commandName);
164
- }
165
-
166
- const firstTargetPath = targetPathFor(COMMANDS[0]);
167
- linkOrCopyFirstExecutable(platformPackage.binaryPath, firstTargetPath);
168
-
169
- for (const command of COMMANDS.slice(1)) {
170
- hardLinkCommandTarget(firstTargetPath, targetPathFor(command));
171
- }
172
-
173
- if (process.platform === "win32") {
174
- writeFileSync(installedJsonPath(), `${JSON.stringify({ version: platformPackage.version }, null, 2)}\n`);
175
- }
176
-
177
- return targetPathFor(commandName);
178
- }
179
-
180
- function runExecutable(executablePath) {
181
- const result = spawnSync(executablePath, process.argv.slice(2), { stdio: "inherit" });
182
-
183
- if (result.error) {
184
- fail(result.error.message);
185
- }
186
- if (result.status !== 0) {
187
- process.exit(result.status ?? 1);
188
- }
189
- }
190
-
191
- runExecutable(repairCommandTargets());
@@ -1,191 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- import { spawnSync } from "node:child_process";
4
- import {
5
- chmodSync,
6
- copyFileSync,
7
- existsSync,
8
- linkSync,
9
- mkdirSync,
10
- readFileSync,
11
- renameSync,
12
- rmSync,
13
- writeFileSync,
14
- } from "node:fs";
15
- import { basename, dirname, join } from "node:path";
16
- import { fileURLToPath } from "node:url";
17
-
18
- const PLATFORM_MAP = {
19
- "darwin-arm64": "darwin-arm64",
20
- "darwin-x64": "darwin-x64",
21
- "linux-arm64": "linux-arm64",
22
- "linux-x64": "linux-x64",
23
- "win32-x64": "windows-x64"
24
- };
25
- const PLATFORM_PACKAGES = {
26
- "darwin-arm64": "@ozyman42/ozy-cli-darwin-arm64",
27
- "darwin-x64": "@ozyman42/ozy-cli-darwin-x64",
28
- "linux-arm64": "@ozyman42/ozy-cli-linux-arm64",
29
- "linux-x64": "@ozyman42/ozy-cli-linux-x64",
30
- "windows-x64": "@ozyman42/ozy-cli-windows-x64"
31
- };
32
- const PLATFORM_BINARIES = {
33
- "darwin-arm64": "multi-call-binary",
34
- "darwin-x64": "multi-call-binary",
35
- "linux-arm64": "multi-call-binary",
36
- "linux-x64": "multi-call-binary",
37
- "windows-x64": "multi-call-binary.exe"
38
- };
39
- const COMMANDS = [
40
- "ozy",
41
- "ozy-signing-agent",
42
- "ozy-ssh-keygen",
43
- "ozy-virtual-security-key"
44
- ];
45
- const WINDOWS_EXECUTABLE_SUFFIX = ".exe";
46
- const INSTALLED_JSON = "installed.json";
47
-
48
- const require = createRequire(import.meta.url);
49
- const launcherPath = fileURLToPath(import.meta.url);
50
- const launcherDir = dirname(launcherPath);
51
- const commandName = basename(launcherPath);
52
-
53
- function fail(message) {
54
- console.error(message);
55
- process.exit(1);
56
- }
57
-
58
- function currentPlatformKey() {
59
- const platformKey = PLATFORM_MAP[`${process.platform}-${process.arch}`];
60
- if (!platformKey) {
61
- fail(`Unsupported platform: ${process.platform}-${process.arch}`);
62
- }
63
- return platformKey;
64
- }
65
-
66
- function currentPlatformPackageName() {
67
- const platformKey = currentPlatformKey();
68
- const packageName = PLATFORM_PACKAGES[platformKey];
69
- if (!packageName) {
70
- fail(`No platform package is configured for ${platformKey}`);
71
- }
72
- return packageName;
73
- }
74
-
75
- /**
76
- * When a Jive library contains any number of CLIs (entrypoints or agents), then the base package
77
- * will have an optional dependency for each possible architecture, with those platform-specific
78
- * packages containing a platform build of the CLI.
79
- * @returns the path to the platform binary and the exact version of the platform package.
80
- */
81
- function currentPlatformPackage() {
82
- const platformKey = currentPlatformKey();
83
- const binaryFile = PLATFORM_BINARIES[platformKey];
84
- if (!binaryFile) {
85
- fail(`No platform binary is configured for ${platformKey}`);
86
- }
87
-
88
- const packageName = currentPlatformPackageName();
89
- try {
90
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
91
- const packageDir = dirname(packageJsonPath);
92
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
93
- return {
94
- binaryPath: join(packageDir, binaryFile),
95
- version: packageJson.version,
96
- };
97
- } catch (error) {
98
- fail(`Could not resolve optional platform package ${packageName}. Reinstall dependencies for ${process.platform}-${process.arch}.`);
99
- }
100
- }
101
-
102
- function targetPathFor(command) {
103
- const suffix = process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : "";
104
- return join(launcherDir, `${command}${suffix}`);
105
- }
106
-
107
- function installedJsonPath() {
108
- return join(launcherDir, INSTALLED_JSON);
109
- }
110
-
111
- function windowsTargetsAreCurrent(version) {
112
- if (process.platform !== "win32") return false;
113
- if (!COMMANDS.every((command) => existsSync(targetPathFor(command)))) return false;
114
-
115
- try {
116
- const installed = JSON.parse(readFileSync(installedJsonPath(), "utf-8"));
117
- return installed.version === version;
118
- } catch {
119
- return false;
120
- }
121
- }
122
-
123
- function linkOrCopyFirstExecutable(sourcePath, targetPath) {
124
- mkdirSync(dirname(targetPath), { recursive: true });
125
- const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp${process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : ""}`;
126
- rmSync(tempPath, { force: true });
127
-
128
- try {
129
- try {
130
- linkSync(sourcePath, tempPath);
131
- } catch {
132
- copyFileSync(sourcePath, tempPath);
133
- }
134
-
135
- chmodSync(tempPath, 0o755);
136
- rmSync(targetPath, { force: true });
137
- renameSync(tempPath, targetPath);
138
- } finally {
139
- rmSync(tempPath, { force: true });
140
- }
141
- }
142
-
143
- function hardLinkCommandTarget(sourcePath, targetPath) {
144
- if (sourcePath === targetPath) return;
145
-
146
- const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp${process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : ""}`;
147
- rmSync(tempPath, { force: true });
148
-
149
- try {
150
- linkSync(sourcePath, tempPath);
151
- chmodSync(tempPath, 0o755);
152
- rmSync(targetPath, { force: true });
153
- renameSync(tempPath, targetPath);
154
- } finally {
155
- rmSync(tempPath, { force: true });
156
- }
157
- }
158
-
159
- function repairCommandTargets() {
160
- const platformPackage = currentPlatformPackage();
161
-
162
- if (windowsTargetsAreCurrent(platformPackage.version)) {
163
- return targetPathFor(commandName);
164
- }
165
-
166
- const firstTargetPath = targetPathFor(COMMANDS[0]);
167
- linkOrCopyFirstExecutable(platformPackage.binaryPath, firstTargetPath);
168
-
169
- for (const command of COMMANDS.slice(1)) {
170
- hardLinkCommandTarget(firstTargetPath, targetPathFor(command));
171
- }
172
-
173
- if (process.platform === "win32") {
174
- writeFileSync(installedJsonPath(), `${JSON.stringify({ version: platformPackage.version }, null, 2)}\n`);
175
- }
176
-
177
- return targetPathFor(commandName);
178
- }
179
-
180
- function runExecutable(executablePath) {
181
- const result = spawnSync(executablePath, process.argv.slice(2), { stdio: "inherit" });
182
-
183
- if (result.error) {
184
- fail(result.error.message);
185
- }
186
- if (result.status !== 0) {
187
- process.exit(result.status ?? 1);
188
- }
189
- }
190
-
191
- runExecutable(repairCommandTargets());
@@ -1,191 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- import { spawnSync } from "node:child_process";
4
- import {
5
- chmodSync,
6
- copyFileSync,
7
- existsSync,
8
- linkSync,
9
- mkdirSync,
10
- readFileSync,
11
- renameSync,
12
- rmSync,
13
- writeFileSync,
14
- } from "node:fs";
15
- import { basename, dirname, join } from "node:path";
16
- import { fileURLToPath } from "node:url";
17
-
18
- const PLATFORM_MAP = {
19
- "darwin-arm64": "darwin-arm64",
20
- "darwin-x64": "darwin-x64",
21
- "linux-arm64": "linux-arm64",
22
- "linux-x64": "linux-x64",
23
- "win32-x64": "windows-x64"
24
- };
25
- const PLATFORM_PACKAGES = {
26
- "darwin-arm64": "@ozyman42/ozy-cli-darwin-arm64",
27
- "darwin-x64": "@ozyman42/ozy-cli-darwin-x64",
28
- "linux-arm64": "@ozyman42/ozy-cli-linux-arm64",
29
- "linux-x64": "@ozyman42/ozy-cli-linux-x64",
30
- "windows-x64": "@ozyman42/ozy-cli-windows-x64"
31
- };
32
- const PLATFORM_BINARIES = {
33
- "darwin-arm64": "multi-call-binary",
34
- "darwin-x64": "multi-call-binary",
35
- "linux-arm64": "multi-call-binary",
36
- "linux-x64": "multi-call-binary",
37
- "windows-x64": "multi-call-binary.exe"
38
- };
39
- const COMMANDS = [
40
- "ozy",
41
- "ozy-signing-agent",
42
- "ozy-ssh-keygen",
43
- "ozy-virtual-security-key"
44
- ];
45
- const WINDOWS_EXECUTABLE_SUFFIX = ".exe";
46
- const INSTALLED_JSON = "installed.json";
47
-
48
- const require = createRequire(import.meta.url);
49
- const launcherPath = fileURLToPath(import.meta.url);
50
- const launcherDir = dirname(launcherPath);
51
- const commandName = basename(launcherPath);
52
-
53
- function fail(message) {
54
- console.error(message);
55
- process.exit(1);
56
- }
57
-
58
- function currentPlatformKey() {
59
- const platformKey = PLATFORM_MAP[`${process.platform}-${process.arch}`];
60
- if (!platformKey) {
61
- fail(`Unsupported platform: ${process.platform}-${process.arch}`);
62
- }
63
- return platformKey;
64
- }
65
-
66
- function currentPlatformPackageName() {
67
- const platformKey = currentPlatformKey();
68
- const packageName = PLATFORM_PACKAGES[platformKey];
69
- if (!packageName) {
70
- fail(`No platform package is configured for ${platformKey}`);
71
- }
72
- return packageName;
73
- }
74
-
75
- /**
76
- * When a Jive library contains any number of CLIs (entrypoints or agents), then the base package
77
- * will have an optional dependency for each possible architecture, with those platform-specific
78
- * packages containing a platform build of the CLI.
79
- * @returns the path to the platform binary and the exact version of the platform package.
80
- */
81
- function currentPlatformPackage() {
82
- const platformKey = currentPlatformKey();
83
- const binaryFile = PLATFORM_BINARIES[platformKey];
84
- if (!binaryFile) {
85
- fail(`No platform binary is configured for ${platformKey}`);
86
- }
87
-
88
- const packageName = currentPlatformPackageName();
89
- try {
90
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
91
- const packageDir = dirname(packageJsonPath);
92
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
93
- return {
94
- binaryPath: join(packageDir, binaryFile),
95
- version: packageJson.version,
96
- };
97
- } catch (error) {
98
- fail(`Could not resolve optional platform package ${packageName}. Reinstall dependencies for ${process.platform}-${process.arch}.`);
99
- }
100
- }
101
-
102
- function targetPathFor(command) {
103
- const suffix = process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : "";
104
- return join(launcherDir, `${command}${suffix}`);
105
- }
106
-
107
- function installedJsonPath() {
108
- return join(launcherDir, INSTALLED_JSON);
109
- }
110
-
111
- function windowsTargetsAreCurrent(version) {
112
- if (process.platform !== "win32") return false;
113
- if (!COMMANDS.every((command) => existsSync(targetPathFor(command)))) return false;
114
-
115
- try {
116
- const installed = JSON.parse(readFileSync(installedJsonPath(), "utf-8"));
117
- return installed.version === version;
118
- } catch {
119
- return false;
120
- }
121
- }
122
-
123
- function linkOrCopyFirstExecutable(sourcePath, targetPath) {
124
- mkdirSync(dirname(targetPath), { recursive: true });
125
- const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp${process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : ""}`;
126
- rmSync(tempPath, { force: true });
127
-
128
- try {
129
- try {
130
- linkSync(sourcePath, tempPath);
131
- } catch {
132
- copyFileSync(sourcePath, tempPath);
133
- }
134
-
135
- chmodSync(tempPath, 0o755);
136
- rmSync(targetPath, { force: true });
137
- renameSync(tempPath, targetPath);
138
- } finally {
139
- rmSync(tempPath, { force: true });
140
- }
141
- }
142
-
143
- function hardLinkCommandTarget(sourcePath, targetPath) {
144
- if (sourcePath === targetPath) return;
145
-
146
- const tempPath = `${targetPath}.${process.pid}.${Date.now()}.tmp${process.platform === "win32" ? WINDOWS_EXECUTABLE_SUFFIX : ""}`;
147
- rmSync(tempPath, { force: true });
148
-
149
- try {
150
- linkSync(sourcePath, tempPath);
151
- chmodSync(tempPath, 0o755);
152
- rmSync(targetPath, { force: true });
153
- renameSync(tempPath, targetPath);
154
- } finally {
155
- rmSync(tempPath, { force: true });
156
- }
157
- }
158
-
159
- function repairCommandTargets() {
160
- const platformPackage = currentPlatformPackage();
161
-
162
- if (windowsTargetsAreCurrent(platformPackage.version)) {
163
- return targetPathFor(commandName);
164
- }
165
-
166
- const firstTargetPath = targetPathFor(COMMANDS[0]);
167
- linkOrCopyFirstExecutable(platformPackage.binaryPath, firstTargetPath);
168
-
169
- for (const command of COMMANDS.slice(1)) {
170
- hardLinkCommandTarget(firstTargetPath, targetPathFor(command));
171
- }
172
-
173
- if (process.platform === "win32") {
174
- writeFileSync(installedJsonPath(), `${JSON.stringify({ version: platformPackage.version }, null, 2)}\n`);
175
- }
176
-
177
- return targetPathFor(commandName);
178
- }
179
-
180
- function runExecutable(executablePath) {
181
- const result = spawnSync(executablePath, process.argv.slice(2), { stdio: "inherit" });
182
-
183
- if (result.error) {
184
- fail(result.error.message);
185
- }
186
- if (result.status !== 0) {
187
- process.exit(result.status ?? 1);
188
- }
189
- }
190
-
191
- runExecutable(repairCommandTargets());