Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(dev): add a local-only bottom bar that shows current branch (#2763)
Seamus45a94572c28a
diff --git a/js/app/packages/app/component/DevStatusBar.tsx b/js/app/packages/app/component/DevStatusBar.tsxnew file mode 100644index 0000000000..74b0c72594--- /dev/null+++ b/js/app/packages/app/component/DevStatusBar.tsx@@ -0,0 +1,64 @@+import GitBranchIcon from '@icon/regular/git-branch.svg';+import { makePersisted } from '@solid-primitives/storage';+import { createSignal, createMemo, Show } from 'solid-js';++const PORT_COLORS = [+ '#2563eb', // blue - 3000+ '#059669', // green - 3001+ '#d97706', // amber - 3002+ '#dc2626', // red - 3003+ '#7c3aed', // violet - 3004+ '#db2777', // pink - 3005+ '#0891b2', // cyan - 3006+ '#ea580c', // orange - 3007+ '#65a30d', // lime - 3008+ '#0d9488', // teal - 3009+];++export const [gitBranch, setGitBranch] = createSignal<string>(+ import.meta.env.__GIT_BRANCH__ ?? ''+);++if (import.meta.env.DEV && import.meta.hot) {+ import.meta.hot.on('git-branch:update', (data: string) => setGitBranch(data));+}++export const [devStatusBarOpen, setDevStatusBarOpen] = makePersisted(+ createSignal<boolean>(false),+ { name: 'dev-status-bar-open' }+);++export const DevStatusBar = () => {+ const portInfo = createMemo(() => {+ if (typeof window === 'undefined') return null;+ const port = window.location.port || '80';+ const portNum = Number.parseInt(port, 10);+ const colorIndex = portNum >= 3000 ? portNum - 3000 : 0;+ const color = PORT_COLORS[colorIndex % PORT_COLORS.length];+ return { port, color };+ });++ return (+ <Show when={import.meta.env.DEV && devStatusBarOpen() && gitBranch()}>+ {(branch) => (+ <div class="shrink-0 flex items-center gap-1.5 pb-2 px-4 text-[0.6875rem] text-ink-muted select-none">+ <GitBranchIcon class="size-3 shrink-0" />+ <span class="truncate font-mono">{branch()}</span>+ <Show when={portInfo()}>+ {(info) => (+ <span+ class="px-1.5 py-0.5 rounded font-mono font-medium"+ style={{+ 'background-color': info().color,+ color: 'white',+ }}+ >+ :{info().port}+ </span>+ )}+ </Show>+ </div>+ )}+ </Show>+ );+};diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsxindex 3b40dd39c8..a1c92ca73a 100644--- a/js/app/packages/app/component/Layout.tsx+++ b/js/app/packages/app/component/Layout.tsx@@ -17,6 +17,7 @@ import {} from 'solid-js';import Banner from './banner/Banner';import { BundleUpdateProgressBar } from './BundleUpdateProgressBar';+import { DevStatusBar } from './DevStatusBar';import { GlobalBulkEditEntityModal } from './bulk-edit-entity/BulkEditEntityModal';import { GlobalShareModal } from './global-share-modal/GlobalShareModal';import { MacroMcpSetupModal } from './macro-mcp-setup-modal/MacroMcpSetupModal';@@ -195,6 +196,7 @@ function LayoutInner(props: RouteSectionProps) {<AutomationComposer /></Show></Suspense>+ <DevStatusBar /></div>);}diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsxindex 3d7d7db1b2..85eb8ee37e 100644--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx@@ -1,62 +1,64 @@-import { AnimatedUsersIcon } from '@macro-icons/wide/animating/users';-import { AnimatedGearIcon } from '@macro-icons/wide/animating/gear';+import { useAnalytics } from '@app/component/analytics-context';+import { ChannelsUnreadWidget } from '@app/component/app-sidebar/channels-unread-widget';import {- type Component,- createMemo,- createSignal,- For,- type JSX,- Show,-} from 'solid-js';-import { Dynamic } from 'solid-js/web';-import { AnimatedStarIcon } from '@macro-icons/wide/animating/star';-import { AnimatedEmailIcon } from '@macro-icons/wide/animating/email';-import { AnimatedTaskIcon } from '@macro-icons/wide/animating/task';-import { AnimatedChannelIcon } from '@macro-icons/wide/animating/channel';-import { AnimatedFileMdIcon } from '@macro-icons/wide/animating/fileMd';-import { AnimatedFolderIcon } from '@macro-icons/wide/animating/folder';-import { AnimatedInboxIcon } from '@macro-icons/wide/animating/inbox';-import { AnimatedSearchIcon } from '@macro-icons/wide/animating/search';-import { AnimatedSidebarIcon } from '@macro-icons/wide/animating/sidebar';-import { AnimatedPlusIcon } from '@macro-icons/wide/animating/plus';-import { AnimatedNewSplitIcon } from '@macro-icons/wide/animating/newSplit';-import { AnimatedCommandIcon } from '@macro-icons/wide/animating/command';-import { useLocation } from '@solidjs/router';-import LogoIcon from '@macro-icons/macro-logo.svg';+ InviteModal,+ setInviteModalOpen,+} from '@app/component/app-sidebar/invite-modal';+import { CommandState } from '@app/component/command';+import { gitBranch, setDevStatusBarOpen } from '@app/component/DevStatusBar';+import { createMenuOpen, setCreateMenuOpen } from '@app/component/Launcher';+import { useSplitLayout } from '@app/component/split-layout/layout';+import { GO_TO_COMMAND_SCOPE, GO_TO_LEADER_KEY } from '@app/constants/hotkeys';import {LIST_VIEW_ID,LIST_VIEW_PATHS,type ListView,} from '@app/constants/list-views';-import { LabelAndHotKey } from '@core/component/Tooltip';-import { createMenuOpen, setCreateMenuOpen } from '@app/component/Launcher';-import { CommandState } from '@app/component/command';-import { cn } from '@ui/utils/classname';-import { Button } from '@ui/components/Button';-import { useSplitLayout } from '@app/component/split-layout/layout';-import { ChannelsUnreadWidget } from '@app/component/app-sidebar/channels-unread-widget';+import { useHotkeyInterceptor } from '@app/signal/hotkeyRoot';import { globalSplitManager } from '@app/signal/splitLayout';+import { Hotkey } from '@core/component/Hotkey';+import { ContextMenuContent, MenuItem } from '@core/component/Menu';+import { LabelAndHotKey } from '@core/component/Tooltip';+import { ENABLE_CALLS, LOCAL_ONLY } from '@core/constant/featureFlags';import { useSettingsState } from '@core/constant/SettingsState';-import type { ValidHotkey } from '@core/hotkey/types';import { registerHotkey } from '@core/hotkey/hotkeys';-import { GO_TO_COMMAND_SCOPE, GO_TO_LEADER_KEY } from '@app/constants/hotkeys';-import { debounce } from '@solid-primitives/scheduled';-import { Hotkey } from '@core/component/Hotkey';import { clearPressedKeys } from '@core/hotkey/state';-import { activateClosestDOMScope } from '@core/hotkey/utils';import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';-import { ContextMenuContent, MenuItem } from '@core/component/Menu';+import type { ValidHotkey } from '@core/hotkey/types';+import { activateClosestDOMScope } from '@core/hotkey/utils';+import BellIcon from '@icon/regular/bell.svg';+import TerminalIcon from '@icon/regular/terminal.svg';import { ContextMenu } from '@kobalte/core/context-menu';-import { useAnalytics } from '@app/component/analytics-context';-import { useHotkeyInterceptor } from '@app/signal/hotkeyRoot';-import {- InviteModal,- setInviteModalOpen,-} from '@app/component/app-sidebar/invite-modal';-import { ENABLE_CALLS } from '@core/constant/featureFlags';+import LogoIcon from '@macro-icons/macro-logo.svg';import { AnimatedCallIcon } from '@macro-icons/wide/animating/call';-import BellIcon from '@icon/regular/bell.svg';+import { AnimatedChannelIcon } from '@macro-icons/wide/animating/channel';+import { AnimatedCommandIcon } from '@macro-icons/wide/animating/command';+import { AnimatedEmailIcon } from '@macro-icons/wide/animating/email';+import { AnimatedFileMdIcon } from '@macro-icons/wide/animating/fileMd';+import { AnimatedFolderIcon } from '@macro-icons/wide/animating/folder';+import { AnimatedGearIcon } from '@macro-icons/wide/animating/gear';+import { AnimatedInboxIcon } from '@macro-icons/wide/animating/inbox';+import { AnimatedNewSplitIcon } from '@macro-icons/wide/animating/newSplit';+import { AnimatedPlusIcon } from '@macro-icons/wide/animating/plus';+import { AnimatedSearchIcon } from '@macro-icons/wide/animating/search';+import { AnimatedSidebarIcon } from '@macro-icons/wide/animating/sidebar';+import { AnimatedStarIcon } from '@macro-icons/wide/animating/star';+import { AnimatedTaskIcon } from '@macro-icons/wide/animating/task';+import { AnimatedUsersIcon } from '@macro-icons/wide/animating/users';import { useNotificationSettings } from '@notifications';+import { debounce } from '@solid-primitives/scheduled';+import { useLocation } from '@solidjs/router';+import { Button } from '@ui/components/Button';+import { cn } from '@ui/utils/classname';+import {+ type Component,+ createMemo,+ createSignal,+ For,+ type JSX,+ Show,+} from 'solid-js';+import { Dynamic } from 'solid-js/web';interface SidebarItem {id: ListView;@@ -571,6 +573,15 @@ export const AppSidebar = (props: AppSidebarProps) => {onClick={toggleSettings}icon={AnimatedGearIcon}/>++ <Show when={LOCAL_ONLY && gitBranch()}>+ <SidebarActionButton+ label="Dev Toolbar"+ isSlim={isSlim}+ onClick={() => setDevStatusBarOpen((v) => !v)}+ icon={TerminalIcon}+ />+ </Show></div><InviteModal /></div>diff --git a/js/app/packages/app/vite-env.d.ts b/js/app/packages/app/vite-env.d.tsindex ba3d3d84b8..dcbec3a025 100644--- a/js/app/packages/app/vite-env.d.ts+++ b/js/app/packages/app/vite-env.d.ts@@ -1,6 +1,7 @@interface ImportMetaEnv {readonly __APP_VERSION__: string;readonly __LOCAL_JWT__: string;+ readonly __GIT_BRANCH__: string;readonly VITE_PLATFORM: 'web' | 'desktop' | 'ios' | 'android';readonly VITE_SEGMENT_WRITE_KEY: string;diff --git a/js/app/packages/app/vite.base.ts b/js/app/packages/app/vite.base.tsindex a74d6d7414..b3fbf5f6db 100644--- a/js/app/packages/app/vite.base.ts+++ b/js/app/packages/app/vite.base.ts@@ -1,8 +1,9 @@import { execSync } from 'node:child_process';import { resolve } from 'node:path';import tailwind from '@tailwindcss/vite';+import chokidar from 'chokidar';import { Features } from 'lightningcss';-import type { UserConfigFn } from 'vite';+import type { Plugin, UserConfigFn } from 'vite';import solid from 'vite-plugin-solid';import solidSvg from 'vite-plugin-solid-svg';import wasm from 'vite-plugin-wasm';@@ -14,6 +15,51 @@ import { version } from './package.json';const shortSha = execSync('git rev-parse --short HEAD').toString().trim();const appVersion = `${version}+${shortSha}`;+function readGitBranch(): string {+ try {+ return execSync('git rev-parse --abbrev-ref HEAD').toString().trim();+ } catch {+ return '';+ }+}++function gitBranchHmrPlugin(): Plugin {+ return {+ name: 'git-branch-hmr',+ apply: 'serve',+ configureServer(server) {+ let gitDir: string;+ try {+ gitDir = execSync('git rev-parse --absolute-git-dir').toString().trim();+ } catch {+ return;+ }+ const headPath = resolve(gitDir, 'HEAD');+ const watcher = chokidar.watch(headPath, {+ ignoreInitial: true,+ persistent: false,+ usePolling: true,+ interval: 100,+ });+ watcher.on('all', () => {+ server.ws.send({+ type: 'custom',+ event: 'git-branch:update',+ data: readGitBranch(),+ });+ });+ server.ws.on('connection', () => {+ server.ws.send({+ type: 'custom',+ event: 'git-branch:update',+ data: readGitBranch(),+ });+ });+ server.httpServer?.once('close', () => void watcher.close());+ },+ };+}+const PLATFORMS = ['web', 'desktop', 'ios', 'android'] as const;export type AppPlatform = (typeof PLATFORMS)[number];@@ -50,6 +96,7 @@ export const createAppViteConfig = ({tsconfigpaths({root: '../../',}),+ gitBranchHmrPlugin(),],define: defineEnv(ENV_MODE, command, platform),clearScreen: false,@@ -176,5 +223,8 @@ function defineEnv(mode: string, command: string, platform: AppPlatform) {'import.meta.env.ASSETS_PATH': JSON.stringify(getAssetsPath(mode, command)),'import.meta.env.__LOCAL_DOCKER__': process.env.LOCAL_DOCKER === 'true','import.meta.env.__LOCAL_JWT__': JSON.stringify(process.env.LOCAL_JWT),+ 'import.meta.env.__GIT_BRANCH__': JSON.stringify(+ command === 'serve' ? readGitBranch() : ''+ ),};}