switchboard-fyi 0.2.1 → 0.2.2
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/CHANGELOG.md +9 -0
- package/bin/switchboard.mjs +48 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable Switchboard CLI changes are recorded here. Keep this file in sync
|
|
4
4
|
with the hosted release notes at `https://www.switchboard.fyi/release/latest`.
|
|
5
5
|
|
|
6
|
+
## 0.2.2 - 2026-05-26
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- Regenerated `codex` and `claude` shims now launch Switchboard through stable
|
|
11
|
+
`switchboard-fyi`/`switchboard` commands before falling back to direct script
|
|
12
|
+
paths, so Homebrew and npm upgrades no longer leave shims pointing at removed
|
|
13
|
+
versioned install directories.
|
|
14
|
+
|
|
6
15
|
## 0.2.1 - 2026-05-26
|
|
7
16
|
|
|
8
17
|
### Changed
|
package/bin/switchboard.mjs
CHANGED
|
@@ -42,6 +42,7 @@ const HARNESS_COMMANDS = {
|
|
|
42
42
|
codex: "codex",
|
|
43
43
|
claude: "claude",
|
|
44
44
|
};
|
|
45
|
+
const SWITCHBOARD_COMMAND_NAMES = ["switchboard-fyi", "switchboard"];
|
|
45
46
|
const SHIM_PATH_START = "# >>> switchboard PATH >>>";
|
|
46
47
|
const SHIM_PATH_END = "# <<< switchboard PATH <<<";
|
|
47
48
|
const COMPONENT_STATUS_IDS = ["claude", "codex", "api"];
|
|
@@ -1112,6 +1113,25 @@ function switchboardScriptPath() {
|
|
|
1112
1113
|
return path.resolve(decodeURIComponent(new URL(import.meta.url).pathname));
|
|
1113
1114
|
}
|
|
1114
1115
|
|
|
1116
|
+
function isVersionedSwitchboardInstallPath(file) {
|
|
1117
|
+
const normalized = String(file || "").split(path.sep).join("/");
|
|
1118
|
+
return (
|
|
1119
|
+
normalized.includes("/Cellar/switchboard-fyi/") ||
|
|
1120
|
+
normalized.includes("/.npm/_npx/") ||
|
|
1121
|
+
normalized.includes("/_npx/")
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
function stableSwitchboardCommandPath() {
|
|
1126
|
+
for (const name of SWITCHBOARD_COMMAND_NAMES) {
|
|
1127
|
+
for (const candidate of commandPaths(name)) {
|
|
1128
|
+
if (!candidate || isVersionedSwitchboardInstallPath(candidate)) continue;
|
|
1129
|
+
if (isUsableExecutable(candidate)) return candidate;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
return "";
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1115
1135
|
function readInstallState() {
|
|
1116
1136
|
try {
|
|
1117
1137
|
const parsed = JSON.parse(fs.readFileSync(installStatePath(), "utf8"));
|
|
@@ -1518,12 +1538,36 @@ function installTargets(argv) {
|
|
|
1518
1538
|
function writeHarnessShim(harness, realPath) {
|
|
1519
1539
|
const commandName = HARNESS_COMMANDS[harness];
|
|
1520
1540
|
const switchboardCommand = harness === "codex" ? "codex" : "claude-code";
|
|
1541
|
+
const switchboardCommandPath = stableSwitchboardCommandPath();
|
|
1542
|
+
const fallbackNodePath = process.execPath;
|
|
1543
|
+
const fallbackScriptPath = switchboardScriptPath();
|
|
1521
1544
|
const content = [
|
|
1522
1545
|
"#!/bin/sh",
|
|
1523
1546
|
"# switchboard-shim",
|
|
1524
1547
|
`export SWITCHBOARD_SHIM_HARNESS=${shellQuote(harness)}`,
|
|
1525
1548
|
`export ${envRealBinaryName(harness)}=${shellQuote(realPath)}`,
|
|
1526
|
-
`
|
|
1549
|
+
`SWITCHBOARD_CLI=${shellQuote(switchboardCommandPath)}`,
|
|
1550
|
+
'if [ -n "${SWITCHBOARD_CLI_PATH:-}" ]; then',
|
|
1551
|
+
` SWITCHBOARD_CLI="$SWITCHBOARD_CLI_PATH"`,
|
|
1552
|
+
"fi",
|
|
1553
|
+
`if [ -n "$SWITCHBOARD_CLI" ] && [ -x "$SWITCHBOARD_CLI" ]; then`,
|
|
1554
|
+
` exec "$SWITCHBOARD_CLI" ${shellQuote(switchboardCommand)} "$@"`,
|
|
1555
|
+
"fi",
|
|
1556
|
+
`for SWITCHBOARD_CANDIDATE in ${SWITCHBOARD_COMMAND_NAMES.join(" ")}; do`,
|
|
1557
|
+
` SWITCHBOARD_CLI=$(command -v "$SWITCHBOARD_CANDIDATE" 2>/dev/null || true)`,
|
|
1558
|
+
` if [ -n "$SWITCHBOARD_CLI" ] && [ -x "$SWITCHBOARD_CLI" ]; then`,
|
|
1559
|
+
` exec "$SWITCHBOARD_CLI" ${shellQuote(switchboardCommand)} "$@"`,
|
|
1560
|
+
" fi",
|
|
1561
|
+
"done",
|
|
1562
|
+
`if [ -x ${shellQuote(fallbackNodePath)} ] && [ -f ${shellQuote(fallbackScriptPath)} ]; then`,
|
|
1563
|
+
` exec ${shellQuote(fallbackNodePath)} ${shellQuote(fallbackScriptPath)} ${shellQuote(switchboardCommand)} "$@"`,
|
|
1564
|
+
"fi",
|
|
1565
|
+
`SWITCHBOARD_NODE=$(command -v node 2>/dev/null || true)`,
|
|
1566
|
+
`if [ -n "$SWITCHBOARD_NODE" ] && [ -f ${shellQuote(fallbackScriptPath)} ]; then`,
|
|
1567
|
+
` exec "$SWITCHBOARD_NODE" ${shellQuote(fallbackScriptPath)} ${shellQuote(switchboardCommand)} "$@"`,
|
|
1568
|
+
"fi",
|
|
1569
|
+
`echo "Switchboard shim could not find the Switchboard CLI. Reinstall Switchboard, then run \`switchboard install ${harness}\`." >&2`,
|
|
1570
|
+
"exit 127",
|
|
1527
1571
|
"",
|
|
1528
1572
|
].join("\n");
|
|
1529
1573
|
|
|
@@ -1534,8 +1578,9 @@ function writeHarnessShim(harness, realPath) {
|
|
|
1534
1578
|
command: commandName,
|
|
1535
1579
|
shimPath: shimPath(harness),
|
|
1536
1580
|
realPath,
|
|
1537
|
-
|
|
1538
|
-
|
|
1581
|
+
switchboardCommandPath,
|
|
1582
|
+
switchboardScript: fallbackScriptPath,
|
|
1583
|
+
nodePath: fallbackNodePath,
|
|
1539
1584
|
installedAt: new Date().toISOString(),
|
|
1540
1585
|
};
|
|
1541
1586
|
}
|