@makerbi/remodex 1.3.8
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 +483 -0
- package/bin/phodex.js +10 -0
- package/bin/remodex.js +314 -0
- package/package.json +33 -0
- package/src/account-status.js +175 -0
- package/src/bootstrap-codex-cli.js +53 -0
- package/src/bridge.js +2032 -0
- package/src/codex-cli-bootstrap.js +187 -0
- package/src/codex-desktop-refresher.js +780 -0
- package/src/codex-home.js +21 -0
- package/src/codex-transport.js +353 -0
- package/src/daemon-state.js +153 -0
- package/src/desktop-handler.js +465 -0
- package/src/git-handler.js +2371 -0
- package/src/index.js +36 -0
- package/src/ios-app-compatibility.js +244 -0
- package/src/macos-launch-agent.js +506 -0
- package/src/notifications-handler.js +95 -0
- package/src/package-version-status.js +185 -0
- package/src/private-defaults.json +4 -0
- package/src/project-handler.js +359 -0
- package/src/push-notification-completion-dedupe.js +147 -0
- package/src/push-notification-service-client.js +151 -0
- package/src/push-notification-tracker.js +688 -0
- package/src/qr.js +63 -0
- package/src/rollout-live-mirror.js +825 -0
- package/src/rollout-watch.js +834 -0
- package/src/scripts/codex-handoff.applescript +100 -0
- package/src/scripts/codex-refresh.applescript +51 -0
- package/src/secure-device-state.js +430 -0
- package/src/secure-transport.js +738 -0
- package/src/session-state.js +57 -0
- package/src/thread-context-handler.js +80 -0
- package/src/voice-handler.js +321 -0
- package/src/workspace-handler.js +630 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// FILE: codex-cli-bootstrap.js
|
|
2
|
+
// Purpose: Detects, installs, and updates the global Codex CLI with transparent logs for Remodex installs and startup flows.
|
|
3
|
+
// Layer: CLI helper
|
|
4
|
+
// Exports: ensureCodexCLI, shouldSkipCodexBootstrap
|
|
5
|
+
// Depends on: child_process
|
|
6
|
+
|
|
7
|
+
const { execFileSync } = require("child_process");
|
|
8
|
+
|
|
9
|
+
const CODEX_PACKAGE_SPEC = "@openai/codex@latest";
|
|
10
|
+
const SKIP_BOOTSTRAP_ENV_NAME = "REMODEX_SKIP_CODEX_BOOTSTRAP";
|
|
11
|
+
|
|
12
|
+
// Keeps the Codex bootstrap flow explicit and reusable across postinstall and runtime startup paths.
|
|
13
|
+
function ensureCodexCLI({
|
|
14
|
+
env = process.env,
|
|
15
|
+
platform = process.platform,
|
|
16
|
+
execFileSyncImpl = execFileSync,
|
|
17
|
+
logger = console,
|
|
18
|
+
shouldUpdate = true,
|
|
19
|
+
npmInstallArgs = ["install", "-g", CODEX_PACKAGE_SPEC],
|
|
20
|
+
} = {}) {
|
|
21
|
+
if (shouldSkipCodexBootstrap(env)) {
|
|
22
|
+
logInfo(logger, `[remodex] Skipping Codex CLI bootstrap because ${SKIP_BOOTSTRAP_ENV_NAME}=1.`);
|
|
23
|
+
return {
|
|
24
|
+
status: "skipped",
|
|
25
|
+
versionBefore: null,
|
|
26
|
+
versionAfter: null,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
logInfo(logger, "[remodex] Checking Codex CLI...");
|
|
31
|
+
const versionBefore = readExecutableVersion({
|
|
32
|
+
executable: "codex",
|
|
33
|
+
args: ["--version"],
|
|
34
|
+
env,
|
|
35
|
+
platform,
|
|
36
|
+
execFileSyncImpl,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (versionBefore) {
|
|
40
|
+
logInfo(logger, `[remodex] Codex CLI found (${versionBefore}).`);
|
|
41
|
+
} else {
|
|
42
|
+
logInfo(logger, "[remodex] Codex CLI not found.");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (versionBefore && !shouldUpdate) {
|
|
46
|
+
return {
|
|
47
|
+
status: "current",
|
|
48
|
+
versionBefore,
|
|
49
|
+
versionAfter: versionBefore,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const npmVersion = readExecutableVersion({
|
|
54
|
+
executable: "npm",
|
|
55
|
+
args: ["--version"],
|
|
56
|
+
env,
|
|
57
|
+
platform,
|
|
58
|
+
execFileSyncImpl,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (!npmVersion) {
|
|
62
|
+
logWarn(
|
|
63
|
+
logger,
|
|
64
|
+
"[remodex] npm is unavailable, so Remodex could not install or update the Codex CLI automatically."
|
|
65
|
+
);
|
|
66
|
+
return {
|
|
67
|
+
status: "failed",
|
|
68
|
+
versionBefore,
|
|
69
|
+
versionAfter: versionBefore,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const actionVerb = versionBefore ? "Updating" : "Installing";
|
|
74
|
+
logInfo(logger, `[remodex] ${actionVerb} Codex CLI via npm (${CODEX_PACKAGE_SPEC})...`);
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
execFileSyncImpl(resolveExecutableName("npm", platform), npmInstallArgs, {
|
|
78
|
+
env,
|
|
79
|
+
stdio: "inherit",
|
|
80
|
+
});
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const message = extractCommandFailureMessage(error);
|
|
83
|
+
logWarn(
|
|
84
|
+
logger,
|
|
85
|
+
`[remodex] Codex CLI ${versionBefore ? "update" : "install"} failed. ${message}`
|
|
86
|
+
);
|
|
87
|
+
return {
|
|
88
|
+
status: "failed",
|
|
89
|
+
versionBefore,
|
|
90
|
+
versionAfter: versionBefore,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const versionAfter = readExecutableVersion({
|
|
95
|
+
executable: "codex",
|
|
96
|
+
args: ["--version"],
|
|
97
|
+
env,
|
|
98
|
+
platform,
|
|
99
|
+
execFileSyncImpl,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (!versionAfter) {
|
|
103
|
+
logWarn(
|
|
104
|
+
logger,
|
|
105
|
+
"[remodex] Codex CLI bootstrap finished, but `codex --version` is still unavailable in this shell."
|
|
106
|
+
);
|
|
107
|
+
return {
|
|
108
|
+
status: "failed",
|
|
109
|
+
versionBefore,
|
|
110
|
+
versionAfter: versionBefore,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
logInfo(
|
|
115
|
+
logger,
|
|
116
|
+
`[remodex] Codex CLI ${versionBefore ? "updated" : "installed"} (${versionAfter}).`
|
|
117
|
+
);
|
|
118
|
+
return {
|
|
119
|
+
status: versionBefore ? "updated" : "installed",
|
|
120
|
+
versionBefore,
|
|
121
|
+
versionAfter,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function shouldSkipCodexBootstrap(env = process.env) {
|
|
126
|
+
const raw = String(env[SKIP_BOOTSTRAP_ENV_NAME] || "").trim().toLowerCase();
|
|
127
|
+
return raw === "1" || raw === "true" || raw === "yes";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function readExecutableVersion({
|
|
131
|
+
executable,
|
|
132
|
+
args,
|
|
133
|
+
env,
|
|
134
|
+
platform,
|
|
135
|
+
execFileSyncImpl,
|
|
136
|
+
}) {
|
|
137
|
+
try {
|
|
138
|
+
const output = execFileSyncImpl(resolveExecutableName(executable, platform), args, {
|
|
139
|
+
encoding: "utf8",
|
|
140
|
+
env,
|
|
141
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
142
|
+
});
|
|
143
|
+
return parseVersion(output);
|
|
144
|
+
} catch {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function resolveExecutableName(name, platform = process.platform) {
|
|
150
|
+
return platform === "win32" ? `${name}.cmd` : name;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function parseVersion(output) {
|
|
154
|
+
const match = String(output || "").match(/\b\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?\b/);
|
|
155
|
+
return match ? match[0] : null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function extractCommandFailureMessage(error) {
|
|
159
|
+
const stderr = error?.stderr?.toString?.("utf8")?.trim();
|
|
160
|
+
const stdout = error?.stdout?.toString?.("utf8")?.trim();
|
|
161
|
+
const fallback = error?.message?.trim();
|
|
162
|
+
return stderr || stdout || fallback || "No additional details were reported.";
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function logInfo(logger, message) {
|
|
166
|
+
const writer = typeof logger?.log === "function" ? logger.log.bind(logger) : console.log;
|
|
167
|
+
writer(message);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function logWarn(logger, message) {
|
|
171
|
+
if (typeof logger?.warn === "function") {
|
|
172
|
+
logger.warn(message);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (typeof logger?.error === "function") {
|
|
177
|
+
logger.error(message);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
logInfo(logger, message);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
module.exports = {
|
|
185
|
+
ensureCodexCLI,
|
|
186
|
+
shouldSkipCodexBootstrap,
|
|
187
|
+
};
|