sideby 0.35.0 → 0.35.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.
@@ -0,0 +1,48 @@
1
+ export declare const CHECK = "<svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3.5 8.5l3 3 6-7\"/></svg>";
2
+ export type MenuEntry = {
3
+ type?: "item";
4
+ label: string;
5
+ /** 前置图标,已拼好的 svg */
6
+ icon?: string;
7
+ /** 右侧快捷键,例如 "⌘K" */
8
+ shortcut?: string;
9
+ /** 右侧次要文字,例如日期 "11-04":灰字、等宽数字、不换行 */
10
+ meta?: string;
11
+ danger?: boolean;
12
+ disabled?: boolean;
13
+ /** 给了就是勾选项(menuitemcheckbox),点了切换、不关菜单 */
14
+ checked?: boolean;
15
+ /** 单选项(menuitemradio):同一菜单(或同一 role="group")里只有一项 checked;点了选中它并关菜单 */
16
+ radio?: boolean;
17
+ attrs?: string;
18
+ /** 只给状态矩阵定格展示用 */
19
+ force?: "hover" | "active" | "focus" | "disabled" | "checked";
20
+ } | {
21
+ type: "label";
22
+ label: string;
23
+ } | {
24
+ type: "separator";
25
+ };
26
+ /** 一个菜单项。menuId 给了就点完关闭菜单(浏览器原生 popovertargetaction="hide")。 */
27
+ export declare function menuItem(e: Extract<MenuEntry, {
28
+ label: string;
29
+ type?: "item";
30
+ }>, menuId?: string): string;
31
+ export interface MenuOptions {
32
+ id: string;
33
+ items: MenuEntry[];
34
+ /** 读屏软件念的菜单名 */
35
+ label?: string;
36
+ className?: string;
37
+ /** 菜单宽度,CSS 长度,例如 "360px"、"min(420px, 90vw)";不给就随内容(至少 180px) */
38
+ width?: string;
39
+ }
40
+ /** 菜单本体:popover 元素。触发按钮的 attrs 用 menuTrigger(id)。 */
41
+ export declare function menu(o: MenuOptions): string;
42
+ /** 放在按钮的 attrs 里:点击开关菜单。Esc、点外面关闭由浏览器负责。 */
43
+ export declare const menuTrigger: (id: string) => string;
44
+ /**
45
+ * 可选的几行 JS(放进 <script>):打开时聚焦选中的单选项(并滚进可视区),没有就聚焦第一项;↑↓ Home End 移动焦点;
46
+ * 勾选项点击切换 aria-checked,单选项点击选中自己、取消同组其他项。不加也能用:Tab 在菜单项间移动,Esc 关闭。
47
+ */
48
+ export declare const menuScript = "document.addEventListener(\"toggle\",e=>{if(e.newState!==\"open\"||!e.target.matches?.(\".ui-menu\"))return;const m=e.target,f=m.querySelector('.ui-menu-item[role=\"menuitemradio\"][aria-checked=\"true\"]:not(:disabled)')||m.querySelector(\".ui-menu-item:not(:disabled)\");if(f){f.focus({preventScroll:true});f.scrollIntoView({block:\"nearest\"})}},true);\ndocument.addEventListener(\"keydown\",e=>{const m=e.target.closest?.(\".ui-menu\");if(!m||![\"ArrowDown\",\"ArrowUp\",\"Home\",\"End\"].includes(e.key))return;const it=[...m.querySelectorAll(\".ui-menu-item:not(:disabled)\")],n=it.length,i=it.indexOf(e.target),d=e.key===\"ArrowDown\"?1:-1;it[e.key===\"Home\"?0:e.key===\"End\"||(i<0&&d<0)?n-1:(i+d+n)%n]?.focus();e.preventDefault()});\ndocument.addEventListener(\"click\",e=>{const c=e.target.closest?.('.ui-menu [role=\"menuitemcheckbox\"]');if(c)c.setAttribute(\"aria-checked\",String(c.getAttribute(\"aria-checked\")!==\"true\"));const r=e.target.closest?.('.ui-menu [role=\"menuitemradio\"]');if(r&&!r.disabled){const g=r.parentElement.closest('[role=\"group\"],.ui-menu');g.querySelectorAll('[role=\"menuitemradio\"]').forEach(x=>{if(x.parentElement.closest('[role=\"group\"],.ui-menu')===g)x.setAttribute(\"aria-checked\",String(x===r))})}});";
@@ -0,0 +1,38 @@
1
+ import { cn, esc } from "../lib/cn.js";
2
+ export const CHECK = `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7"/></svg>`;
3
+ /** 一个菜单项。menuId 给了就点完关闭菜单(浏览器原生 popovertargetaction="hide")。 */
4
+ export function menuItem(e, menuId) {
5
+ const isRadio = !!e.radio;
6
+ const isCheck = isRadio || e.checked !== undefined;
7
+ const a = [
8
+ 'type="button"',
9
+ `role="${isRadio ? "menuitemradio" : isCheck ? "menuitemcheckbox" : "menuitem"}"`,
10
+ `class="${cn("ui-menu-item", e.danger && "ui-menu-item-danger", isCheck && "ui-menu-item-inset")}"`,
11
+ isCheck && `aria-checked="${!!e.checked}"`,
12
+ (!isCheck || isRadio) && menuId && `popovertarget="${esc(menuId)}" popovertargetaction="hide"`,
13
+ e.disabled && "disabled",
14
+ e.force && `data-force="${e.force}"`,
15
+ e.attrs,
16
+ ].filter(Boolean);
17
+ const ind = isCheck ? `<span class="ui-menu-indicator">${CHECK}</span>` : "";
18
+ const meta = e.meta ? `<span class="ui-menu-meta">${esc(e.meta)}</span>` : "";
19
+ const sc = e.shortcut ? `<kbd class="ui-menu-shortcut">${esc(e.shortcut)}</kbd>` : "";
20
+ return `<button ${a.join(" ")}>${ind}${e.icon ?? ""}<span class="ui-menu-text">${esc(e.label)}</span>${meta}${sc}</button>`;
21
+ }
22
+ /** 菜单本体:popover 元素。触发按钮的 attrs 用 menuTrigger(id)。 */
23
+ export function menu(o) {
24
+ const body = o.items
25
+ .map((e) => e.type === "separator" ? '<hr class="ui-menu-separator" role="separator">' : e.type === "label" ? `<div class="ui-menu-label" role="presentation">${esc(e.label)}</div>` : menuItem(e, o.id))
26
+ .join("");
27
+ const width = o.width ? ` style="width: ${esc(o.width)}"` : "";
28
+ return `<div popover id="${esc(o.id)}" role="menu" class="${cn("ui-menu", o.className)}"${o.label ? ` aria-label="${esc(o.label)}"` : ""}${width}>${body}</div>`;
29
+ }
30
+ /** 放在按钮的 attrs 里:点击开关菜单。Esc、点外面关闭由浏览器负责。 */
31
+ export const menuTrigger = (id) => `popovertarget="${esc(id)}" aria-haspopup="menu"`;
32
+ /**
33
+ * 可选的几行 JS(放进 <script>):打开时聚焦选中的单选项(并滚进可视区),没有就聚焦第一项;↑↓ Home End 移动焦点;
34
+ * 勾选项点击切换 aria-checked,单选项点击选中自己、取消同组其他项。不加也能用:Tab 在菜单项间移动,Esc 关闭。
35
+ */
36
+ export const menuScript = `document.addEventListener("toggle",e=>{if(e.newState!=="open"||!e.target.matches?.(".ui-menu"))return;const m=e.target,f=m.querySelector('.ui-menu-item[role="menuitemradio"][aria-checked="true"]:not(:disabled)')||m.querySelector(".ui-menu-item:not(:disabled)");if(f){f.focus({preventScroll:true});f.scrollIntoView({block:"nearest"})}},true);
37
+ document.addEventListener("keydown",e=>{const m=e.target.closest?.(".ui-menu");if(!m||!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;const it=[...m.querySelectorAll(".ui-menu-item:not(:disabled)")],n=it.length,i=it.indexOf(e.target),d=e.key==="ArrowDown"?1:-1;it[e.key==="Home"?0:e.key==="End"||(i<0&&d<0)?n-1:(i+d+n)%n]?.focus();e.preventDefault()});
38
+ document.addEventListener("click",e=>{const c=e.target.closest?.('.ui-menu [role="menuitemcheckbox"]');if(c)c.setAttribute("aria-checked",String(c.getAttribute("aria-checked")!=="true"));const r=e.target.closest?.('.ui-menu [role="menuitemradio"]');if(r&&!r.disabled){const g=r.parentElement.closest('[role="group"],.ui-menu');g.querySelectorAll('[role="menuitemradio"]').forEach(x=>{if(x.parentElement.closest('[role="group"],.ui-menu')===g)x.setAttribute("aria-checked",String(x===r))})}});`;
@@ -0,0 +1,4 @@
1
+ /** 拼类名,跳过 false / undefined。组件库只用 ui-* 类,不需要 tailwind-merge。 */
2
+ export declare function cn(...parts: Array<string | false | null | undefined>): string;
3
+ /** HTML 版用:转义属性值和文字。 */
4
+ export declare const esc: (s: unknown) => string;
@@ -0,0 +1,6 @@
1
+ /** 拼类名,跳过 false / undefined。组件库只用 ui-* 类,不需要 tailwind-merge。 */
2
+ export function cn(...parts) {
3
+ return parts.filter(Boolean).join(" ");
4
+ }
5
+ /** HTML 版用:转义属性值和文字。 */
6
+ export const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
@@ -0,0 +1,6 @@
1
+ /** Role declarations of the teal theme in light mode, such as `--primary: #0E8C88;`, ready for a rule body. */
2
+ export declare const UI_TOKENS_LIGHT = "--duration-fast: 120ms; --duration-base: 160ms; --duration-slow: 200ms; --ease-out: cubic-bezier(0.2, 0, 0, 1); --ease-in: cubic-bezier(0.4, 0, 1, 1); --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 10px; --radius-pill: 9999px; --background: #F9F9FB; --foreground: #1C2024; --sidebar: #F9F9FB; --card: #FCFCFD; --card-foreground: #1C2024; --popover: #FCFCFD; --popover-foreground: #1C2024; --muted: #F0F0F3; --muted-foreground: #60646C; --subtle-foreground: #8B8D98; --border: #E0E1E6; --border-strong: #CDCED6; --input: #D9D9E0; --hover: #F9F9FB; --primary: #0E8C88; --primary-foreground: #FFFFFF; --accent: color-mix(in srgb, #2BA5A0 12%, #FCFCFD); --accent-foreground: #04706D; --selected: color-mix(in srgb, #2BA5A0 12%, #FCFCFD); --nav-active: color-mix(in srgb, #2BA5A0 15%, transparent); --nav-active-foreground: #04706D; --link: #04706D; --ring: #37A29D; --page-tint: linear-gradient(color-mix(in srgb, #2BA5A0 10%, #F9F9FB) 0, #F9F9FB 180px); --track: #E8E8EC; --success: #27A644; --warning: #F0BF00; --danger: #EB5757; --info: #4EA7FC; --success-soft: color-mix(in srgb, #27A644 16%, transparent); --warning-soft: color-mix(in srgb, #F0BF00 20%, transparent); --danger-soft: color-mix(in srgb, #EB5757 16%, transparent); --warning-text: #A44D00; --danger-text: #641723; --disabled: #F0F0F3; --disabled-foreground: #B9BBC6; --chart-1: #2BA5A0; --chart-2: #4EA7FC; --chart-3: #27A644; --chart-4: #F0BF00; --chart-5: #FC7840; --tint: #F0FBFA; --tint-border: #A7E4E0; --shadow-accent: 0 12px 26px -14px #A7E4E0; --plate: #F7F2E8; --plate-border: #D7CCBA; --success-text: #193B2D; --primary-hover: #007D79; --primary-active: #006E6B; --secondary: #1C2024; --secondary-foreground: #FCFCFD; --secondary-hover: color-mix(in srgb, #1C2024 86%, #FCFCFD); --secondary-active: color-mix(in srgb, #1C2024 76%, #FCFCFD); --active: #F0F0F3; --accent-hover: color-mix(in srgb, #2BA5A0 18%, #FCFCFD); --accent-active: color-mix(in srgb, #2BA5A0 23%, #FCFCFD); --ring-halo: color-mix(in srgb, #37A29D 30%, transparent); --danger-solid: #D93B3B; --danger-solid-foreground: #FFFFFF; --danger-solid-hover: #C42F30; --danger-solid-active: #AE2526; --danger-soft-hover: color-mix(in srgb, #EB5757 24%, transparent); --danger-halo: color-mix(in srgb, #EB5757 22%, transparent); --info-soft: color-mix(in srgb, #4EA7FC 16%, transparent); --info-text: #113264; --overlay: color-mix(in srgb, #000000 40%, transparent); --shadow-popover: 0 12px 32px -12px rgba(0, 0, 0, 0.22), 0 2px 6px -2px rgba(0, 0, 0, 0.08); --nav-hover: color-mix(in srgb, #1C2024 6%, transparent); --nav-pressed: color-mix(in srgb, #1C2024 10%, transparent);";
3
+ /** The same roles in dark mode. */
4
+ export declare const UI_TOKENS_DARK = "--duration-fast: 120ms; --duration-base: 160ms; --duration-slow: 200ms; --ease-out: cubic-bezier(0.2, 0, 0, 1); --ease-in: cubic-bezier(0.4, 0, 1, 1); --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 10px; --radius-pill: 9999px; --background: #111113; --foreground: #EDEEF0; --sidebar: #111113; --card: #212225; --card-foreground: #EDEEF0; --popover: #212225; --popover-foreground: #EDEEF0; --muted: #272A2D; --muted-foreground: #B0B4BA; --subtle-foreground: #696E77; --border: #2E3135; --border-strong: #43484E; --input: #363A3F; --hover: #272A2D; --primary: #0E8C88; --primary-foreground: #FFFFFF; --accent: color-mix(in srgb, #34ABA6 20%, #212225); --accent-foreground: #89C7C3; --selected: color-mix(in srgb, #34ABA6 20%, #212225); --nav-active: color-mix(in srgb, #34ABA6 24%, transparent); --nav-active-foreground: #89C7C3; --link: #89C7C3; --ring: #289591; --page-tint: linear-gradient(color-mix(in srgb, #34ABA6 10%, #111113) 0, #111113 180px); --track: #2E3135; --success: #27A644; --warning: #F0BF00; --danger: #EB5757; --info: #4EA7FC; --success-soft: color-mix(in srgb, #27A644 16%, transparent); --warning-soft: color-mix(in srgb, #F0BF00 20%, transparent); --danger-soft: color-mix(in srgb, #EB5757 16%, transparent); --warning-text: #FFCA16; --danger-text: #FF9592; --disabled: #212225; --disabled-foreground: #5A6169; --chart-1: #34ABA6; --chart-2: #4EA7FC; --chart-3: #27A644; --chart-4: #F0BF00; --chart-5: #FC7840; --tint: #05211F; --tint-border: #015F5C; --shadow-accent: none; --plate: #1A1712; --plate-border: #3B362D; --success-text: #3DD68C; --primary-hover: #007D79; --primary-active: #006E6B; --secondary: #EDEEF0; --secondary-foreground: #111113; --secondary-hover: color-mix(in srgb, #EDEEF0 86%, #212225); --secondary-active: color-mix(in srgb, #EDEEF0 76%, #212225); --active: #2E3135; --accent-hover: color-mix(in srgb, #34ABA6 23%, #212225); --accent-active: color-mix(in srgb, #34ABA6 26%, #212225); --ring-halo: color-mix(in srgb, #289591 18%, transparent); --danger-solid: #D93B3B; --danger-solid-foreground: #FFFFFF; --danger-solid-hover: #C42F30; --danger-solid-active: #AE2526; --danger-soft-hover: color-mix(in srgb, #EB5757 26%, transparent); --danger-halo: color-mix(in srgb, #EB5757 30%, transparent); --info-soft: color-mix(in srgb, #4EA7FC 16%, transparent); --info-text: #70B8FF; --overlay: color-mix(in srgb, #000000 60%, transparent); --shadow-popover: 0 16px 40px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06); --nav-hover: color-mix(in srgb, #EDEEF0 6%, transparent); --nav-pressed: color-mix(in srgb, #EDEEF0 10%, transparent);";
5
+ /** The components' rules (`ui-*` classes); they read only the roles above. */
6
+ export declare const UI_CSS = ".ui-root {\n font-family: -apple-system, BlinkMacSystemFont, \"PingFang SC\", \"Helvetica Neue\", sans-serif;\n font-size: 13px;\n line-height: 1.5;\n font-variant-numeric: tabular-nums;\n color: var(--foreground);\n background: var(--background);\n -webkit-font-smoothing: antialiased;\n}\n.ui-root *, .ui-root *::before, .ui-root *::after { box-sizing: border-box; }\n.ui-root :where(input, button, textarea, select) { font: inherit; }\n.ui-num { font-variant-numeric: tabular-nums; }\n.ui-sr-only {\n position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;\n overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;\n}\n.ui-menu {\n z-index: 50;\n min-width: 180px;\n max-width: calc(100vw - 16px);\n max-height: min(480px, 70vh, var(--radix-dropdown-menu-content-available-height, 70vh));\n padding: 4px;\n overflow: auto;\n overscroll-behavior: contain;\n border: 1px solid var(--border);\n border-radius: 10px;\n background: var(--popover);\n color: var(--popover-foreground);\n box-shadow: var(--shadow-popover);\n font-size: 13px;\n outline: none;\n}\n@supports (position-area: block-end) {\n .ui-menu[popover] { inset: auto; margin: 4px 0; position-area: block-end span-inline-end; position-try-fallbacks: flip-block, flip-inline; }\n}\n.ui-menu-label { padding: 8px 8px 4px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }\n.ui-menu-separator { height: 1px; margin: 4px -4px; border: 0; background: var(--border); }\n.ui-menu-group { display: block; }\n.ui-menu-item {\n position: relative;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n height: 28px;\n padding: 0 8px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: inherit;\n font: inherit;\n text-align: left;\n white-space: nowrap;\n cursor: pointer;\n user-select: none;\n outline: none;\n}\n.ui-menu-item > svg { width: 16px; height: 16px; flex: none; color: var(--muted-foreground); }\n.ui-menu-item-inset { padding-left: 28px; }\n.ui-menu-indicator { position: absolute; left: 8px; display: inline-flex; width: 14px; height: 14px; color: var(--accent-foreground); }\n.ui-menu-indicator > svg { width: 14px; height: 14px; }\n.ui-menu-item[aria-checked=\"false\"] .ui-menu-indicator { visibility: hidden; }\n.ui-menu-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n.ui-menu-meta { flex: none; margin-left: auto; padding-left: 16px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted-foreground); }\n.ui-menu-shortcut { margin-left: auto; font-family: inherit; padding-left: 16px; font-size: 12px; letter-spacing: 0.04em; color: var(--muted-foreground); }\n.ui-menu-item:is(:hover, :focus-visible, [data-highlighted], [data-force=\"hover\"], [data-force=\"focus\"]):not(:disabled, [data-disabled], [aria-disabled=\"true\"]) { background: var(--hover); }\n.ui-menu-item:is(:active, [data-force=\"active\"]):not(:disabled, [data-disabled], [aria-disabled=\"true\"]) { background: var(--active); }\n.ui-menu-item[role=\"menuitemradio\"]:is([aria-checked=\"true\"], [data-force=\"checked\"]) { background: var(--accent); color: var(--accent-foreground); }\n.ui-menu-item[role=\"menuitemradio\"]:is([aria-checked=\"true\"], [data-force=\"checked\"]) .ui-menu-meta { color: var(--accent-foreground); }\n.ui-menu-item[role=\"menuitemradio\"][aria-checked=\"true\"]:is(:hover, [data-highlighted]) { background: var(--accent-hover); }\n.ui-menu-item[role=\"menuitemradio\"][aria-checked=\"true\"]:active { background: var(--accent-active); }\n.ui-menu-item:is(:focus-visible, [data-force=\"focus\"]) { box-shadow: inset 0 0 0 1px var(--ring); }\n.ui-menu-item-danger, .ui-menu-item-danger > svg { color: var(--danger-text); }\n.ui-menu-item-danger:is(:hover, :focus-visible, [data-highlighted], [data-force=\"hover\"], [data-force=\"focus\"]):not(:disabled, [data-disabled], [aria-disabled=\"true\"]) { background: var(--danger-soft); }\n.ui-menu-item-danger:is(:active, [data-force=\"active\"]):not(:disabled, [data-disabled], [aria-disabled=\"true\"]) { background: var(--danger-soft-hover); }\n.ui-menu-item-danger:is(:focus-visible, [data-force=\"focus\"]) { box-shadow: inset 0 0 0 1px var(--danger); }\n.ui-menu-item:is(:disabled, [data-disabled], [aria-disabled=\"true\"], [data-force=\"disabled\"]) { background: transparent; color: var(--disabled-foreground); cursor: not-allowed; }\n.ui-menu-item:is(:disabled, [data-disabled], [aria-disabled=\"true\"], [data-force=\"disabled\"]) :is(svg, .ui-menu-shortcut) { color: var(--disabled-foreground); }\n.ui-menu:is(:popover-open, [data-state=\"open\"]) { animation: ui-menu-in var(--duration-fast) var(--ease-out); }\n@keyframes ui-menu-in { from { opacity: 0; transform: translateY(-2px); } }\n@media (prefers-reduced-motion: reduce) { .ui-menu:is(:popover-open, [data-state=\"open\"]) { animation: none; } }";
@@ -0,0 +1,88 @@
1
+ // Generated from the shared UI component library (commit 975a5950e856). Do not edit by hand: run its
2
+ // add script again with --inline to update. Components: base, dropdown-menu.
3
+ /** Role declarations of the teal theme in light mode, such as `--primary: #0E8C88;`, ready for a rule body. */
4
+ export const UI_TOKENS_LIGHT = `--duration-fast: 120ms; --duration-base: 160ms; --duration-slow: 200ms; --ease-out: cubic-bezier(0.2, 0, 0, 1); --ease-in: cubic-bezier(0.4, 0, 1, 1); --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 10px; --radius-pill: 9999px; --background: #F9F9FB; --foreground: #1C2024; --sidebar: #F9F9FB; --card: #FCFCFD; --card-foreground: #1C2024; --popover: #FCFCFD; --popover-foreground: #1C2024; --muted: #F0F0F3; --muted-foreground: #60646C; --subtle-foreground: #8B8D98; --border: #E0E1E6; --border-strong: #CDCED6; --input: #D9D9E0; --hover: #F9F9FB; --primary: #0E8C88; --primary-foreground: #FFFFFF; --accent: color-mix(in srgb, #2BA5A0 12%, #FCFCFD); --accent-foreground: #04706D; --selected: color-mix(in srgb, #2BA5A0 12%, #FCFCFD); --nav-active: color-mix(in srgb, #2BA5A0 15%, transparent); --nav-active-foreground: #04706D; --link: #04706D; --ring: #37A29D; --page-tint: linear-gradient(color-mix(in srgb, #2BA5A0 10%, #F9F9FB) 0, #F9F9FB 180px); --track: #E8E8EC; --success: #27A644; --warning: #F0BF00; --danger: #EB5757; --info: #4EA7FC; --success-soft: color-mix(in srgb, #27A644 16%, transparent); --warning-soft: color-mix(in srgb, #F0BF00 20%, transparent); --danger-soft: color-mix(in srgb, #EB5757 16%, transparent); --warning-text: #A44D00; --danger-text: #641723; --disabled: #F0F0F3; --disabled-foreground: #B9BBC6; --chart-1: #2BA5A0; --chart-2: #4EA7FC; --chart-3: #27A644; --chart-4: #F0BF00; --chart-5: #FC7840; --tint: #F0FBFA; --tint-border: #A7E4E0; --shadow-accent: 0 12px 26px -14px #A7E4E0; --plate: #F7F2E8; --plate-border: #D7CCBA; --success-text: #193B2D; --primary-hover: #007D79; --primary-active: #006E6B; --secondary: #1C2024; --secondary-foreground: #FCFCFD; --secondary-hover: color-mix(in srgb, #1C2024 86%, #FCFCFD); --secondary-active: color-mix(in srgb, #1C2024 76%, #FCFCFD); --active: #F0F0F3; --accent-hover: color-mix(in srgb, #2BA5A0 18%, #FCFCFD); --accent-active: color-mix(in srgb, #2BA5A0 23%, #FCFCFD); --ring-halo: color-mix(in srgb, #37A29D 30%, transparent); --danger-solid: #D93B3B; --danger-solid-foreground: #FFFFFF; --danger-solid-hover: #C42F30; --danger-solid-active: #AE2526; --danger-soft-hover: color-mix(in srgb, #EB5757 24%, transparent); --danger-halo: color-mix(in srgb, #EB5757 22%, transparent); --info-soft: color-mix(in srgb, #4EA7FC 16%, transparent); --info-text: #113264; --overlay: color-mix(in srgb, #000000 40%, transparent); --shadow-popover: 0 12px 32px -12px rgba(0, 0, 0, 0.22), 0 2px 6px -2px rgba(0, 0, 0, 0.08); --nav-hover: color-mix(in srgb, #1C2024 6%, transparent); --nav-pressed: color-mix(in srgb, #1C2024 10%, transparent);`;
5
+ /** The same roles in dark mode. */
6
+ export const UI_TOKENS_DARK = `--duration-fast: 120ms; --duration-base: 160ms; --duration-slow: 200ms; --ease-out: cubic-bezier(0.2, 0, 0, 1); --ease-in: cubic-bezier(0.4, 0, 1, 1); --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 10px; --radius-pill: 9999px; --background: #111113; --foreground: #EDEEF0; --sidebar: #111113; --card: #212225; --card-foreground: #EDEEF0; --popover: #212225; --popover-foreground: #EDEEF0; --muted: #272A2D; --muted-foreground: #B0B4BA; --subtle-foreground: #696E77; --border: #2E3135; --border-strong: #43484E; --input: #363A3F; --hover: #272A2D; --primary: #0E8C88; --primary-foreground: #FFFFFF; --accent: color-mix(in srgb, #34ABA6 20%, #212225); --accent-foreground: #89C7C3; --selected: color-mix(in srgb, #34ABA6 20%, #212225); --nav-active: color-mix(in srgb, #34ABA6 24%, transparent); --nav-active-foreground: #89C7C3; --link: #89C7C3; --ring: #289591; --page-tint: linear-gradient(color-mix(in srgb, #34ABA6 10%, #111113) 0, #111113 180px); --track: #2E3135; --success: #27A644; --warning: #F0BF00; --danger: #EB5757; --info: #4EA7FC; --success-soft: color-mix(in srgb, #27A644 16%, transparent); --warning-soft: color-mix(in srgb, #F0BF00 20%, transparent); --danger-soft: color-mix(in srgb, #EB5757 16%, transparent); --warning-text: #FFCA16; --danger-text: #FF9592; --disabled: #212225; --disabled-foreground: #5A6169; --chart-1: #34ABA6; --chart-2: #4EA7FC; --chart-3: #27A644; --chart-4: #F0BF00; --chart-5: #FC7840; --tint: #05211F; --tint-border: #015F5C; --shadow-accent: none; --plate: #1A1712; --plate-border: #3B362D; --success-text: #3DD68C; --primary-hover: #007D79; --primary-active: #006E6B; --secondary: #EDEEF0; --secondary-foreground: #111113; --secondary-hover: color-mix(in srgb, #EDEEF0 86%, #212225); --secondary-active: color-mix(in srgb, #EDEEF0 76%, #212225); --active: #2E3135; --accent-hover: color-mix(in srgb, #34ABA6 23%, #212225); --accent-active: color-mix(in srgb, #34ABA6 26%, #212225); --ring-halo: color-mix(in srgb, #289591 18%, transparent); --danger-solid: #D93B3B; --danger-solid-foreground: #FFFFFF; --danger-solid-hover: #C42F30; --danger-solid-active: #AE2526; --danger-soft-hover: color-mix(in srgb, #EB5757 26%, transparent); --danger-halo: color-mix(in srgb, #EB5757 30%, transparent); --info-soft: color-mix(in srgb, #4EA7FC 16%, transparent); --info-text: #70B8FF; --overlay: color-mix(in srgb, #000000 60%, transparent); --shadow-popover: 0 16px 40px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06); --nav-hover: color-mix(in srgb, #EDEEF0 6%, transparent); --nav-pressed: color-mix(in srgb, #EDEEF0 10%, transparent);`;
7
+ /** The components' rules (`ui-*` classes); they read only the roles above. */
8
+ export const UI_CSS = `.ui-root {
9
+ font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
10
+ font-size: 13px;
11
+ line-height: 1.5;
12
+ font-variant-numeric: tabular-nums;
13
+ color: var(--foreground);
14
+ background: var(--background);
15
+ -webkit-font-smoothing: antialiased;
16
+ }
17
+ .ui-root *, .ui-root *::before, .ui-root *::after { box-sizing: border-box; }
18
+ .ui-root :where(input, button, textarea, select) { font: inherit; }
19
+ .ui-num { font-variant-numeric: tabular-nums; }
20
+ .ui-sr-only {
21
+ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
22
+ overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
23
+ }
24
+ .ui-menu {
25
+ z-index: 50;
26
+ min-width: 180px;
27
+ max-width: calc(100vw - 16px);
28
+ max-height: min(480px, 70vh, var(--radix-dropdown-menu-content-available-height, 70vh));
29
+ padding: 4px;
30
+ overflow: auto;
31
+ overscroll-behavior: contain;
32
+ border: 1px solid var(--border);
33
+ border-radius: 10px;
34
+ background: var(--popover);
35
+ color: var(--popover-foreground);
36
+ box-shadow: var(--shadow-popover);
37
+ font-size: 13px;
38
+ outline: none;
39
+ }
40
+ @supports (position-area: block-end) {
41
+ .ui-menu[popover] { inset: auto; margin: 4px 0; position-area: block-end span-inline-end; position-try-fallbacks: flip-block, flip-inline; }
42
+ }
43
+ .ui-menu-label { padding: 8px 8px 4px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
44
+ .ui-menu-separator { height: 1px; margin: 4px -4px; border: 0; background: var(--border); }
45
+ .ui-menu-group { display: block; }
46
+ .ui-menu-item {
47
+ position: relative;
48
+ display: flex;
49
+ align-items: center;
50
+ gap: 8px;
51
+ width: 100%;
52
+ height: 28px;
53
+ padding: 0 8px;
54
+ border: 0;
55
+ border-radius: 6px;
56
+ background: transparent;
57
+ color: inherit;
58
+ font: inherit;
59
+ text-align: left;
60
+ white-space: nowrap;
61
+ cursor: pointer;
62
+ user-select: none;
63
+ outline: none;
64
+ }
65
+ .ui-menu-item > svg { width: 16px; height: 16px; flex: none; color: var(--muted-foreground); }
66
+ .ui-menu-item-inset { padding-left: 28px; }
67
+ .ui-menu-indicator { position: absolute; left: 8px; display: inline-flex; width: 14px; height: 14px; color: var(--accent-foreground); }
68
+ .ui-menu-indicator > svg { width: 14px; height: 14px; }
69
+ .ui-menu-item[aria-checked="false"] .ui-menu-indicator { visibility: hidden; }
70
+ .ui-menu-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
71
+ .ui-menu-meta { flex: none; margin-left: auto; padding-left: 16px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted-foreground); }
72
+ .ui-menu-shortcut { margin-left: auto; font-family: inherit; padding-left: 16px; font-size: 12px; letter-spacing: 0.04em; color: var(--muted-foreground); }
73
+ .ui-menu-item:is(:hover, :focus-visible, [data-highlighted], [data-force="hover"], [data-force="focus"]):not(:disabled, [data-disabled], [aria-disabled="true"]) { background: var(--hover); }
74
+ .ui-menu-item:is(:active, [data-force="active"]):not(:disabled, [data-disabled], [aria-disabled="true"]) { background: var(--active); }
75
+ .ui-menu-item[role="menuitemradio"]:is([aria-checked="true"], [data-force="checked"]) { background: var(--accent); color: var(--accent-foreground); }
76
+ .ui-menu-item[role="menuitemradio"]:is([aria-checked="true"], [data-force="checked"]) .ui-menu-meta { color: var(--accent-foreground); }
77
+ .ui-menu-item[role="menuitemradio"][aria-checked="true"]:is(:hover, [data-highlighted]) { background: var(--accent-hover); }
78
+ .ui-menu-item[role="menuitemradio"][aria-checked="true"]:active { background: var(--accent-active); }
79
+ .ui-menu-item:is(:focus-visible, [data-force="focus"]) { box-shadow: inset 0 0 0 1px var(--ring); }
80
+ .ui-menu-item-danger, .ui-menu-item-danger > svg { color: var(--danger-text); }
81
+ .ui-menu-item-danger:is(:hover, :focus-visible, [data-highlighted], [data-force="hover"], [data-force="focus"]):not(:disabled, [data-disabled], [aria-disabled="true"]) { background: var(--danger-soft); }
82
+ .ui-menu-item-danger:is(:active, [data-force="active"]):not(:disabled, [data-disabled], [aria-disabled="true"]) { background: var(--danger-soft-hover); }
83
+ .ui-menu-item-danger:is(:focus-visible, [data-force="focus"]) { box-shadow: inset 0 0 0 1px var(--danger); }
84
+ .ui-menu-item:is(:disabled, [data-disabled], [aria-disabled="true"], [data-force="disabled"]) { background: transparent; color: var(--disabled-foreground); cursor: not-allowed; }
85
+ .ui-menu-item:is(:disabled, [data-disabled], [aria-disabled="true"], [data-force="disabled"]) :is(svg, .ui-menu-shortcut) { color: var(--disabled-foreground); }
86
+ .ui-menu:is(:popover-open, [data-state="open"]) { animation: ui-menu-in var(--duration-fast) var(--ease-out); }
87
+ @keyframes ui-menu-in { from { opacity: 0; transform: translateY(-2px); } }
88
+ @media (prefers-reduced-motion: reduce) { .ui-menu:is(:popover-open, [data-state="open"]) { animation: none; } }`;
@@ -54,8 +54,13 @@ export interface AliasResult {
54
54
  export interface AliasEditResult {
55
55
  ok: boolean;
56
56
  alias: string;
57
- /** `confirm`: a Pick Command would hide a command on PATH, so nothing was written until the user agrees. */
58
- status: 'added' | 'exists' | 'removed' | 'absent' | 'confirm';
57
+ /**
58
+ * `confirm`: a Pick Command would hide a command on PATH, so nothing was written until the user agrees.
59
+ * `renamed`: `alias` is the new name and `renamedFrom` the old one.
60
+ */
61
+ status: 'added' | 'exists' | 'removed' | 'absent' | 'confirm' | 'renamed';
62
+ /** The old name, for `renamed`. */
63
+ renamedFrom?: string;
59
64
  /** `pick` for a Pick Command, `account` for an Alias; absent for `absent`. */
60
65
  kind?: 'account' | 'pick';
61
66
  /** The Account ref the alias starts (for `rm`, started before it was removed). */
@@ -229,6 +234,11 @@ export interface Runtime {
229
234
  addAlias(alias: string, target: string, args?: readonly string[]): Promise<AliasEditResult>;
230
235
  /** Removes a short command from the config, then rewrites every `shellInitFile`. */
231
236
  removeAlias(alias: string): Promise<AliasEditResult>;
237
+ /**
238
+ * Gives an Alias a new name: the new one starts the same Account with the same arguments, then the old one is
239
+ * removed and every `shellInitFile` rewritten. Refuses a Pick Command, a missing alias and a taken name.
240
+ */
241
+ renameAlias(from: string, to: string): Promise<AliasEditResult>;
232
242
  /**
233
243
  * Adds a Pick Command (spec §3.13, ADR-0035), then rewrites every `shellInitFile`. Without `opts.yes` it only
234
244
  * returns `confirm`, with the command on PATH the name would hide, and writes nothing. Refuses a name taken by an
@@ -259,7 +269,10 @@ export interface Runtime {
259
269
  aliasProblem(alias: string, ref: string): string | null;
260
270
  /** What `sideby shell-init <shell>` prints, from the Accounts on disk and the config aliases. */
261
271
  shellInitScript(shell: Shell): Promise<string>;
262
- /** Rewrites the configured `shellInitFile` of each shell (all configured ones by default). */
272
+ /**
273
+ * Rewrites the configured `shellInitFile` of each shell (all configured ones by default), and the Shell Init Stamp
274
+ * that makes open terminals reload their short commands (spec §3.13).
275
+ */
263
276
  writeShellInitFiles(shells?: readonly Shell[]): Promise<ShellInitWrite[]>;
264
277
  /**
265
278
  * `opts.aiTask`: the Launch is an AI Task's (spec §3.28), so the Family's `aiTaskArgs` removes every permission
@@ -25,7 +25,7 @@ import { findResumeRoute } from './core/resume.js';
25
25
  import { SAME_LOGIN_FAMILIES, sameLoginGroups, sharedQuota } from './core/same-login.js';
26
26
  import { sessionHookArgs } from './core/session-hooks.js';
27
27
  import { shareMeaning } from './core/share-meaning.js';
28
- import { SHELLS, shellInitScript, writeShellInitFile, } from './core/shell-init.js';
28
+ import { SHELLS, shellInitGeneration, shellInitScript, shellInitStampFile, writeShellInitFile, writeShellInitStamp, } from './core/shell-init.js';
29
29
  import { groupSuggestion, MAX_COMPACT_WINDOW, MIN_COMPACT_WINDOW, } from './core/tuning.js';
30
30
  import { applyTune, planTuneApply, readTuneSettings, settingsFileOf, tuneUndoInfo, undoTune, } from './core/tuning-apply.js';
31
31
  import { codexUnattendedTrustLine, UNATTENDED_FAMILIES, unattendedFamilyLine, unattendedHookPart, unattendedSettingsLine, unattendedStatus, } from './core/unattended.js';
@@ -332,6 +332,20 @@ export async function createRuntime(opts = {}) {
332
332
  command,
333
333
  };
334
334
  };
335
+ // What the shell functions are made of; the script and the Shell Init Stamp both come from it.
336
+ const shellInitInputs = async () => {
337
+ const list = await accounts();
338
+ // Routing helps only a Family that can route and has somewhere else to route to (spec §3.15).
339
+ const routes = config.resumeRouting
340
+ ? [...families.values()]
341
+ .filter((f) => f.selectVar &&
342
+ f.resumedSession &&
343
+ f.sessionWrittenAt &&
344
+ list.some((a) => a.family === f.id && !a.isMain))
345
+ .map((f) => ({ family: f.id, bin: f.bin, selectVar: f.selectVar }))
346
+ : [];
347
+ return { list, aliases: { ...config.aliases, ...config.pickCommands }, routes };
348
+ };
335
349
  const aliasEdit = async (alias, status, value) => {
336
350
  const args = aliasArgs(value);
337
351
  const files = await rt.writeShellInitFiles();
@@ -579,6 +593,25 @@ export async function createRuntime(opts = {}) {
579
593
  config.aliases = r.aliases;
580
594
  return aliasEdit(alias, r.status, r.aliases[alias]);
581
595
  },
596
+ async renameAlias(from, to) {
597
+ if (from === to)
598
+ throw new UserError(`"${to}" is already the name`, { code: 'alias-invalid' });
599
+ if (rt.pickCommandFamily(from) !== undefined)
600
+ throw new UserError(`"${from}" is a pick command; rename it with \`sideby alias add ${to} --pick <family>\`, then \`sideby alias rm ${from}\``, { code: 'alias-invalid' });
601
+ const before = ownAlias(from);
602
+ if (before === undefined)
603
+ throw new UserError(`no short command "${from}" in the config; see \`sideby alias list\``, {
604
+ code: 'alias-invalid',
605
+ });
606
+ const added = await rt.addAlias(to, aliasAccount(before), aliasArgs(before));
607
+ if (added.status !== 'added')
608
+ throw new UserError(`"${to}" already starts ${aliasAccount(before)}; remove "${from}" with \`sideby alias rm ${from}\``, {
609
+ code: 'alias-invalid',
610
+ });
611
+ const r = await removeConfigAlias(paths.configFile, from);
612
+ config.aliases = r.aliases;
613
+ return { ...(await aliasEdit(to, 'renamed', before)), renamedFrom: from };
614
+ },
582
615
  async removeAlias(alias) {
583
616
  const pickFamily = rt.pickCommandFamily(alias);
584
617
  if (pickFamily !== undefined) {
@@ -678,18 +711,9 @@ export async function createRuntime(opts = {}) {
678
711
  return `alias "${alias}" already starts ${taken}; pick another name`;
679
712
  return null;
680
713
  },
681
- async shellInitScript() {
682
- const list = await accounts();
683
- // Routing helps only a Family that can route and has somewhere else to route to (spec §3.15).
684
- const routes = config.resumeRouting
685
- ? [...families.values()]
686
- .filter((f) => f.selectVar &&
687
- f.resumedSession &&
688
- f.sessionWrittenAt &&
689
- list.some((a) => a.family === f.id && !a.isMain))
690
- .map((f) => ({ family: f.id, bin: f.bin, selectVar: f.selectVar }))
691
- : [];
692
- return shellInitScript(list, { ...config.aliases, ...config.pickCommands }, routes);
714
+ async shellInitScript(shell) {
715
+ const { list, aliases, routes } = await shellInitInputs();
716
+ return shellInitScript(list, aliases, routes, { shell, stampFile: shellInitStampFile(paths.stateDir) });
693
717
  },
694
718
  async writeShellInitFiles(shells = SHELLS) {
695
719
  // Another process may have changed the other kind of short command since this Runtime read the config: write
@@ -705,6 +729,9 @@ export async function createRuntime(opts = {}) {
705
729
  if (file)
706
730
  out.push(await writeShellInitFile(shell, file, paths.home, await rt.shellInitScript(shell)));
707
731
  }
732
+ // Open terminals reload on their next prompt; a stamp that cannot be written only means they wait for a new one.
733
+ const { list, aliases, routes } = await shellInitInputs();
734
+ await writeShellInitStamp(shellInitStampFile(paths.stateDir), shellInitGeneration(list, aliases, routes)).catch(() => { });
708
735
  return out;
709
736
  },
710
737
  async prepareLaunch(ref, userArgs, command, opts = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.35.0",
3
+ "version": "0.35.2",
4
4
  "description": "Run work, personal and API-key accounts at the same time, without their configs drifting apart.",
5
5
  "license": "MIT",
6
6
  "author": "Adonis0123 (https://github.com/Adonis0123)",
@@ -41,9 +41,17 @@
41
41
  {
42
42
  "type": "string",
43
43
  "const": "confirm"
44
+ },
45
+ {
46
+ "type": "string",
47
+ "const": "renamed"
44
48
  }
45
49
  ],
46
- "description": "`confirm` (exit 10): the pick command would hide a command on PATH, so nothing was written; run again with `--yes`."
50
+ "description": "`confirm` (exit 10): the pick command would hide a command on PATH, so nothing was written; run again with `--yes`. `renamed` (`alias rename`): `alias` is the new name."
51
+ },
52
+ "renamedFrom": {
53
+ "type": "string",
54
+ "description": "The old name, for `renamed`."
47
55
  },
48
56
  "kind": {
49
57
  "anyOf": [
@@ -2,7 +2,7 @@
2
2
  name: sideby
3
3
  description: Use when the user runs, or wants to run, several AI coding accounts (Claude Code, Codex, Grok Build, pi) side by side. Covers installing sideby and setting up a new account ("install sideby", "set up another Claude account", "add cc008", "配置一个 cc00x", "再加一个 Codex 账号"), explaining what accounts share and what stays separate ("what do my accounts share?", "这些账号共享了什么"), showing which account a session is ("show [cc001] in the status line", "加上账号标识"), finding a past session of any account ("找一下我上周改登录页的那个会话"), telling another running session something, in any account ("告诉 cc002 ……", "给跑构建的那个会话发消息"; Claude Code's own SendMessage reaches only sessions of the same account), seeing accounts, quota and usage, moving on when one hits its 5-hour or weekly limit, moving the current task to another account ("用 cc008 继续", "交回 cc008"), adding a short command (alias) or a pick command that starts whichever account has the most quota ("加个 cc"), adding an API account from a vendor's docs ("加一个 DeepSeek API 账号"), supporting a new tool, and repairing drifted account directories (skills, hooks, rules or settings not shared, wrong symlinks, credential file permissions). Drives the `sideby` CLI with `--json`; the agent does every step except browser sign-in, filling in secrets and starting interactive sessions, which it hands to the user as one command (inside an Auto Handoff session, `sideby handoff ready --to` moves the task itself).
4
4
  metadata:
5
- version: "0.35.0"
5
+ version: "0.35.2"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -64,6 +64,7 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
64
64
  | Explain or change the handoff rules ("接力规则", "什么时候换号", "让 Codex 接 Claude", "别用 API 账号接力") | `sideby handoff rules --json`, `sideby config set handoff.<key> <value>` or `sideby handoff enable --other-ai/--api --json` (exit 10 first) | `references/handoff.md` |
65
65
  | Sign an account in again or switch it to another login ("换个账号登录", "两个目录登录的是同一个号", "sign claude:work in with another account") | `sideby list --json` (`identity`, `sameLogin`), then give the user `sideby login <ref>` | `references/accounts.md` |
66
66
  | Create an account with a given name, an API account, or a short command | `sideby new`, `sideby alias add` | `references/accounts.md` |
67
+ | Rename or remove a short command ("把别名 cc-relay 改成 relay") | `sideby alias rename <old> <new> --json`, `sideby alias rm <short> --json` | `references/accounts.md` |
67
68
  | One command that always starts the account with the most quota left ("加个 cc", "自动挑额度最多的账号启动", "start whichever has room") | `sideby alias add <short> --pick <family> --json` (exit 10 first), `sideby alias list --json` | `references/accounts.md` |
68
69
  | Short commands say "command not found" in a new terminal ("cc 用不了", "短命令不生效") | `sideby shell-init setup --json` (exit 10 first) | `references/setup.md` |
69
70
  | Do something in sideby as an AI Task (the first message came from sideby or the Panel's "Let AI do it") | follow the task it names | `references/ai-tasks.md` |
@@ -85,7 +86,7 @@ Read only the reference the task needs.
85
86
 
86
87
  ## Launching and the panel
87
88
 
88
- `eval "$(sideby shell-init zsh)"` defines one function per account (`sideby-claude-work`) plus the config `aliases` and `pickCommands`. Users who source a file instead set config `shellInitFile` (for example `{ "zsh": "~/.config/sideby/shell-init.zsh" }`); `new` and `alias add|rm` keep it current, and `sideby shell-init zsh --write` rewrites it. New functions work in a new shell.
89
+ `eval "$(sideby shell-init zsh)"` defines one function per account (`sideby-claude-work`) plus the config `aliases` and `pickCommands`. Users who source a file instead set config `shellInitFile` (for example `{ "zsh": "~/.config/sideby/shell-init.zsh" }`); `new` and `alias add|rename|rm` keep it current, and `sideby shell-init zsh --write` rewrites it. Open terminals pick up the change at their next prompt.
89
90
 
90
91
  When a terminal manager such as Orca reopens a pane with a bare `claude --resume <id>` (or `codex resume <id>`, `grok --resume <id>`) and the Host says `No conversation found`, the session lives in another account. Suggest config `"resumeRouting": true` followed by `sideby shell-init --write` (or a new shell with `eval`): `shell-init` then defines Host-named functions that call `sideby resume <family>`, which starts the account holding that session. For a one-off, find it with `ls -d ~/.claude*/projects/*/<id>.jsonl` and run `sideby run <ref> -- --resume <id>`. When no account has that file, the session was opened but never got a message, so there is nothing to resume: `ls -d ~/.claude*/session-env/<id>` names the account that started it, and with routing on `sideby resume` starts a new session there by itself.
91
92
 
@@ -49,6 +49,8 @@ To start one account with fixed Host arguments, such as another model, put them
49
49
 
50
50
  - `status: "exists"` means it was already there.
51
51
  - A refusal names the next step (`sideby alias rm <short>` first).
52
+ - To give a short command another name ("把 cc-relay 改成 relay"): `sideby alias rename <old> <new> --json`; it keeps the account and its arguments. In the Panel it is the account menu, "Set short command…".
53
+ - Changes take effect in terminals that are already open: a shell that loads `sideby shell-init` reloads its short commands at its next prompt, so tell the user to press Enter once and type the new name. Only a terminal started before sideby had this needs to be reopened.
52
54
  - Entry points that need environment variables are not aliases: leave them in the user's shell rc.
53
55
  - Do not edit `aliases` in the config by hand.
54
56