@dhruv2mars/offdex 0.0.10 → 0.0.11

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/bin/install.js CHANGED
@@ -12,9 +12,31 @@ import {
12
12
  const here = dirname(fileURLToPath(import.meta.url));
13
13
  const packageRoot = join(here, "..");
14
14
  const packageVersion = resolvePackageVersion(join(packageRoot, "package.json"), process.env);
15
+ const colorEnabled =
16
+ Boolean(process.stderr.isTTY) &&
17
+ process.env.NO_COLOR !== "1" &&
18
+ process.env.NO_COLOR !== "true" &&
19
+ process.env.TERM !== "dumb";
20
+ const paint = (code, text) => colorEnabled ? `\u001b[${code}m${text}\u001b[0m` : text;
21
+ const green = (text) => paint("38;2;16;163;127", text);
22
+ const muted = (text) => paint("38;2;156;163;160", text);
23
+ const red = (text) => paint("38;2;255;91;79", text);
24
+ const bold = (text) => paint("1", text);
25
+
26
+ function title(text) {
27
+ return `${muted("==")} ${bold(green(text))} ${muted("==")}`;
28
+ }
29
+
30
+ function alertTitle(text) {
31
+ return `${red("!")} ${bold(text)}`;
32
+ }
33
+
34
+ function row(label, value) {
35
+ return ` ${muted(label.padEnd(8))} ${value}`;
36
+ }
15
37
 
16
38
  if (shouldSkipPackageInstall({ env: process.env, packageRoot })) {
17
- console.log("offdex: skipping native runtime install inside workspace checkout");
39
+ console.log([title("Offdex setup"), row("Runtime", "workspace checkout; native install skipped")].join("\n"));
18
40
  process.exit(0);
19
41
  }
20
42
 
@@ -29,18 +51,18 @@ installRuntime({
29
51
 
30
52
  lastPercent = Math.floor((receivedBytes / totalBytes) * 100);
31
53
  console.error(
32
- `offdex: downloading native runtime ${lastPercent}% (${Math.round(receivedBytes / 1024 / 1024)}MB/${Math.round(totalBytes / 1024 / 1024)}MB)`
54
+ row("Download", `native runtime ${lastPercent}% (${Math.round(receivedBytes / 1024 / 1024)}MB/${Math.round(totalBytes / 1024 / 1024)}MB)`)
33
55
  );
34
56
  },
35
57
  })
36
58
  .then(({ installBin }) => {
37
- console.log(`offdex: installed ${installBin}`);
59
+ console.log([title("Offdex installed"), row("Runtime", installBin)].join("\n"));
38
60
  })
39
61
  .catch((error) => {
40
62
  const message = error instanceof Error ? error.message : "unknown";
41
- console.error(`offdex: install failed (${message})`);
63
+ console.error([alertTitle("Install failed"), row("Reason", message)].join("\n"));
42
64
  if (typeof message === "string" && message.startsWith("unsupported_platform:")) {
43
- console.error(`offdex: supported targets are ${supportedPlatformList().join(", ")}`);
65
+ console.error(row("Targets", supportedPlatformList().join(", ")));
44
66
  }
45
67
  process.exit(1);
46
68
  });
package/bin/offdex.js CHANGED
@@ -21,78 +21,98 @@ const colorEnabled =
21
21
  const paint = (code, text) => colorEnabled ? `\u001b[${code}m${text}\u001b[0m` : text;
22
22
  const green = (text) => paint("38;2;16;163;127", text);
23
23
  const muted = (text) => paint("38;2;156;163;160", text);
24
+ const red = (text) => paint("38;2;255;91;79", text);
24
25
  const bold = (text) => paint("1", text);
25
26
  const command = (text) => paint("38;2;225;229;226", text);
26
27
  const link = (text) => paint("38;2;203;255;229", text);
27
28
  const controlPlaneUrl = "https://offdex-control-plane.dhruv-sharma10102005.workers.dev";
28
29
 
30
+ function title(text) {
31
+ return `${muted("==")} ${bold(green(text))} ${muted("==")}`;
32
+ }
33
+
34
+ function alertTitle(text) {
35
+ return `${red("!")} ${bold(text)}`;
36
+ }
37
+
38
+ function section(text) {
39
+ return `${green("->")} ${bold(text)}`;
40
+ }
41
+
42
+ function row(label, value) {
43
+ return ` ${muted(label.padEnd(8))} ${value}`;
44
+ }
45
+
46
+ function commandRow(commandText, description) {
47
+ return ` ${command(commandText.padEnd(28))} ${muted(description)}`;
48
+ }
49
+
50
+ function optionRow(option, description) {
51
+ if (!description) {
52
+ return ` ${command(option)}`;
53
+ }
54
+
55
+ return ` ${command(option.padEnd(36))} ${muted(description)}`;
56
+ }
57
+
29
58
  function onboardingText() {
30
59
  return [
31
- bold(green("Offdex")),
60
+ title("Offdex"),
32
61
  muted("Codex mobile app."),
33
62
  "",
34
63
  "Use Codex from your phone while the real Codex session keeps running on this Mac.",
35
64
  "",
36
- green("Get started"),
37
- ` 1. Run ${command("offdex start")}`,
38
- " 2. Open Offdex on your phone.",
39
- " 3. Scan the QR from this terminal.",
40
- " 4. Send a prompt and watch Codex reply live.",
65
+ section("Get started"),
66
+ ` ${muted("[1]")} ${command("offdex start")} Start the bridge on this Mac.`,
67
+ ` ${muted("[2]")} Open Offdex on your phone.`,
68
+ ` ${muted("[3]")} Scan the QR from this terminal.`,
69
+ ` ${muted("[4]")} Send a prompt and watch Codex reply live.`,
41
70
  "",
42
- green("Core commands"),
43
- ` ${command("offdex help")} Commands, docs, GitHub, feedback.`,
44
- ` ${command("offdex start")} Start the bridge and show the QR.`,
45
- ` ${command("offdex status")} Show bridge, Codex, and client status.`,
46
- ` ${command("offdex stop")} Stop the local bridge.`,
71
+ section("Core commands"),
72
+ commandRow("offdex help", "Commands, docs, GitHub, feedback."),
73
+ commandRow("offdex start", "Start the bridge and show the QR."),
74
+ commandRow("offdex status", "Show bridge, Codex, and client status."),
75
+ commandRow("offdex stop", "Stop the local bridge."),
47
76
  "",
48
- `Docs: ${link("https://offdexapp.vercel.app")}`,
77
+ row("Docs", link("https://offdexapp.vercel.app")),
49
78
  ].join("\n");
50
79
  }
51
80
 
52
81
  function helpText() {
53
82
  return [
54
- bold(green("Offdex help")),
83
+ title("Offdex help"),
55
84
  muted("Codex mobile app."),
56
85
  "",
57
- green("Commands"),
58
- ` ${command("offdex")}`,
59
- " Open the Offdex home screen.",
60
- "",
61
- ` ${command("offdex help")}`,
62
- " Show commands, docs, and support links.",
63
- "",
64
- ` ${command("offdex start")} ${muted("[options]")}`,
65
- " Start the bridge and show the pairing QR.",
66
- "",
67
- ` ${command("offdex status")} ${muted("[options]")}`,
68
- " Show bridge, Codex, client, and remote status.",
69
- "",
70
- ` ${command("offdex stop")} ${muted("[options]")}`,
71
- " Stop the local bridge started by Offdex.",
86
+ section("Commands"),
87
+ commandRow("offdex", "Open the Offdex home screen."),
88
+ commandRow("offdex help", "Show commands, docs, and support links."),
89
+ commandRow("offdex start [options]", "Start the bridge and show the pairing QR."),
90
+ commandRow("offdex status [options]", "Show bridge, Codex, client, and remote status."),
91
+ commandRow("offdex stop [options]", "Stop the local bridge started by Offdex."),
72
92
  "",
73
- green("Start options"),
74
- ` ${command("--host <host>")} Default: 0.0.0.0`,
75
- ` ${command("--port <port>")} Default: 42420`,
76
- ` ${command("--mode <codex|demo>")} Default: codex`,
77
- ` ${command("--control-plane-url <url>")} Override managed remote pairing.`,
93
+ section("Start options"),
94
+ optionRow("--host <host>", "Default: 0.0.0.0"),
95
+ optionRow("--port <port>", "Default: 42420"),
96
+ optionRow("--mode <codex|demo>", "Default: codex"),
97
+ optionRow("--control-plane-url <url>", "Override managed remote pairing."),
78
98
  "",
79
- green("Environment fallbacks"),
80
- ` ${command("OFFDEX_BRIDGE_HOST")}`,
81
- ` ${command("OFFDEX_BRIDGE_PORT")}`,
82
- ` ${command("OFFDEX_BRIDGE_MODE")}`,
83
- ` ${command("OFFDEX_CONTROL_PLANE_URL")} Default: ${controlPlaneUrl}`,
99
+ section("Environment fallbacks"),
100
+ optionRow("OFFDEX_BRIDGE_HOST", ""),
101
+ optionRow("OFFDEX_BRIDGE_PORT", ""),
102
+ optionRow("OFFDEX_BRIDGE_MODE", ""),
103
+ optionRow("OFFDEX_CONTROL_PLANE_URL", `Default: ${controlPlaneUrl}`),
84
104
  "",
85
- green("Links"),
86
- ` Docs: ${link("https://offdexapp.vercel.app")}`,
87
- ` GitHub: ${link("https://github.com/Dhruv2mars/offdex")}`,
88
- ` Feedback: ${link("https://github.com/Dhruv2mars/offdex/issues")}`,
105
+ section("Links"),
106
+ row("Docs", link("https://offdexapp.vercel.app")),
107
+ row("GitHub", link("https://github.com/Dhruv2mars/offdex")),
108
+ row("Feedback", link("https://github.com/Dhruv2mars/offdex/issues")),
89
109
  ].join("\n");
90
110
  }
91
111
 
92
112
  function offlineText() {
93
113
  return [
94
- bold("Offdex is not running"),
95
- `Start it with: ${command("offdex start")}`,
114
+ alertTitle("Offdex is not running"),
115
+ row("Next", command("offdex start")),
96
116
  ].join("\n");
97
117
  }
98
118
 
@@ -156,7 +176,7 @@ if (
156
176
  packageVersion
157
177
  })
158
178
  ) {
159
- console.error("offdex: setting up native runtime...");
179
+ console.error([title("Offdex setup"), row("Runtime", "installing native runtime")].join("\n"));
160
180
  const here = resolvePackageBinDir(import.meta.url);
161
181
  const installer = join(here, "install.js");
162
182
  const install = spawnSync(process.execPath, [installer], {
@@ -164,7 +184,7 @@ if (
164
184
  env: process.env
165
185
  });
166
186
  if (install.status !== 0 || !existsSync(installedBin)) {
167
- console.error("offdex: install missing. try reinstall: npm i -g @dhruv2mars/offdex");
187
+ console.error([alertTitle("Install missing"), row("Retry", "npm i -g @dhruv2mars/offdex")].join("\n"));
168
188
  process.exit(1);
169
189
  }
170
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhruv2mars/offdex",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Codex mobile bridge CLI for Offdex",
5
5
  "type": "module",
6
6
  "bin": {