eleven / messenger Public

tools: dev alt takes its slug again — --icon's filter ate argv[0] when absent (#1152)

#1145's icon flag skipped index iconAt+1 as the flag's value, but with no
--icon present iconAt is -1, so index 0 — the slug itself — was filtered
out and every bare `dev alt <slug>` built the default dev alt (and
collided with any session already running it).
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Paul Campbell 23f40ae716e870e61ee4a1c0adf4b120200c7ceb parent d09564f
1 file changed, +5 −1
  • tools/dev +5 −1
diff --git a/tools/dev b/tools/dev
index 1c134a8..cfaa769 100755
--- a/tools/dev
+++ b/tools/dev
@@ -393,7 +393,11 @@ async function altMac(args) {
console.error(`Bad --icon — expected: ${Object.keys(ICONS).join(", ")}`);
process.exit(1);
}
- const rawSlug = args.filter((a, i) => !a.startsWith("--") && i !== iconAt + 1)[0];
+ // Only skip the --icon VALUE when --icon is actually present: with iconAt
+ // at -1, `iconAt + 1` is 0 — which silently ate the slug ("alt dek" built
+ // the default dev alt).
+ const iconValAt = iconAt >= 0 ? iconAt + 1 : -1;
+ const rawSlug = args.filter((a, i) => !a.startsWith("--") && i !== iconValAt)[0];
const slug = (rawSlug || "dev").toLowerCase().replace(/[^a-z0-9-]/g, "");
if (!slug) {
console.error("Bad slug — letters/digits/hyphens only.");