mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-01 08:59:46 +02:00
chore: add Conductor per-worktree dev setup (.conductor/ + .worktreeinclude)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0a6f7673b5
commit
c099dad03d
10 changed files with 352 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import PostHogIdentify from "@/components/PostHogIdentify";
|
|||
import { SentryErrorBoundary } from "@/components/SentryErrorBoundary";
|
||||
import SpinLoader from "@/components/SpinLoader";
|
||||
import { ThemeProvider } from "@/components/ThemeProvider";
|
||||
import WorkspaceBadge from "@/components/WorkspaceBadge";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
import { AppConfigProvider } from "@/context/AppConfigContext";
|
||||
import { OnboardingProvider } from "@/context/OnboardingContext";
|
||||
|
|
@ -87,6 +88,7 @@ export default function RootLayout({
|
|||
</AuthProvider>
|
||||
</SentryErrorBoundary>
|
||||
</ThemeProvider>
|
||||
<WorkspaceBadge />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
|
|
|||
43
ui/src/components/WorkspaceBadge.tsx
Normal file
43
ui/src/components/WorkspaceBadge.tsx
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
/**
|
||||
* Dev-only badge that proves which Conductor workspace this UI belongs to.
|
||||
*
|
||||
* Renders nothing unless NEXT_PUBLIC_WORKSPACE_NAME is set — which only happens
|
||||
* when the UI is launched via .conductor/run-ui.sh. So production builds and a
|
||||
* plain `npm run dev` are completely unaffected.
|
||||
*
|
||||
* The pill color is derived deterministically from the workspace name, so two
|
||||
* worktrees running side by side are instantly distinguishable at a glance.
|
||||
*/
|
||||
export default function WorkspaceBadge() {
|
||||
const workspace = process.env.NEXT_PUBLIC_WORKSPACE_NAME;
|
||||
const backend = process.env.NEXT_PUBLIC_BACKEND_URL;
|
||||
const [port, setPort] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
setPort(window.location.port);
|
||||
}, []);
|
||||
|
||||
if (!workspace) return null;
|
||||
|
||||
// Deterministic hue from the workspace name.
|
||||
let hash = 0;
|
||||
for (let i = 0; i < workspace.length; i++) {
|
||||
hash = (hash * 31 + workspace.charCodeAt(i)) >>> 0;
|
||||
}
|
||||
const hue = hash % 360;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="pointer-events-none fixed bottom-2 left-2 z-[9999] select-none rounded-full px-2.5 py-1 font-mono text-[11px] font-medium text-white shadow-md"
|
||||
style={{ backgroundColor: `hsl(${hue} 70% 38% / 0.92)` }}
|
||||
title={`Conductor workspace: ${workspace}\nUI port: ${port}\nBackend: ${backend ?? "?"}`}
|
||||
>
|
||||
⬡ {workspace}
|
||||
{port ? ` :${port}` : ""}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue