diff --git a/backend/src/index.ts b/backend/src/index.ts index ff0ea1b2..fc3d0e0d 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -68,12 +68,30 @@ Prefer **pnpm** or **bun** over npm for installing dependencies to save disk spa - Use \`bun install\` as an alternative - Both are pre-installed in the container -### Python Packages -Prefer **uv** for Python package management: -- Use \`uv venv\` to create virtual environments instead of \`python -m venv\` -- Use \`uv pip install\` to install packages instead of \`pip install\` -- Use \`uv pip\` for all pip operations -- uv is pre-installed in the container and provides faster package installation + ### Python Packages + Always create a virtual environment in the repository directory before installing packages: + + 1. Create virtual environment in repo: + \`cd \`\` + \`uv venv .venv\` + + 2. Activate the virtual environment: + \`source .venv/bin/activate\` # or \`uv pip sync\` for project-based workflows + + 3. Install packages into activated environment: + \`uv pip install \`\` + \`uv pip install -r requirements.txt\` + + 4. Run Python commands: + \`python script.py\` # Uses activated .venv + + Alternative: Use \`uv run python script.py\` to skip explicit activation + + **Important:** + - Always create .venv in the repository directory (not workspace root) + - Activate the environment before running pip operations + - uv is pre-installed in the container and provides faster package installation + - .venv directories created in repos will persist but can be removed safely ## General Guidelines diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 2de40d46..3ac10026 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -54,6 +54,7 @@ function PermissionDialogWrapper() { respondToPermission, showDialog, setShowDialog, + currentRepoDirectory, } = usePermissionContext() return ( @@ -64,6 +65,7 @@ function PermissionDialogWrapper() { onRespond={respondToPermission} open={showDialog} onOpenChange={setShowDialog} + repoDirectory={currentRepoDirectory} /> ) } diff --git a/frontend/src/components/session/PermissionRequestDialog.tsx b/frontend/src/components/session/PermissionRequestDialog.tsx index e097c841..66275c90 100644 --- a/frontend/src/components/session/PermissionRequestDialog.tsx +++ b/frontend/src/components/session/PermissionRequestDialog.tsx @@ -17,6 +17,7 @@ interface PermissionRequestDialogProps { pendingCount: number isFromDifferentSession?: boolean sessionTitle?: string + repoDirectory?: string | null onRespond: (permissionID: string, sessionID: string, response: PermissionResponse) => Promise open?: boolean onOpenChange?: (open: boolean) => void @@ -113,6 +114,7 @@ export function PermissionRequestDialog({ pendingCount, isFromDifferentSession, sessionTitle, + repoDirectory, onRespond, open: parentOpen, onOpenChange, @@ -144,22 +146,22 @@ export function PermissionRequestDialog({ return ( {})}> - + - - Permission Request + + Permission Request {hasMultiple && ( - + +{pendingCount - 1} more )} - + {permission.title || `Allow ${typeLabel.toLowerCase()}?`} -
+
{typeLabel} @@ -167,39 +169,46 @@ export function PermissionRequestDialog({
{details.primary && ( -
-
+            
+
                 {details.primary}
               
)} {details.secondary && ( -
-
+            
+
                 {details.secondary}
               
)} - {isFromDifferentSession ? ( -
- From another session: {displaySessionName} -
- ) : ( -
- Session: {displaySessionName} -
- )} +
+ {repoDirectory && ( +
+ Repo: {repoDirectory.split('/').pop() || repoDirectory} +
+ )} + {isFromDifferentSession ? ( +
+ From another session: {displaySessionName} +
+ ) : ( +
+ Session: {displaySessionName} +
+ )} +
- + - +
diff --git a/frontend/src/contexts/PermissionContext.tsx b/frontend/src/contexts/PermissionContext.tsx index 7bef22d1..f8971fb6 100644 --- a/frontend/src/contexts/PermissionContext.tsx +++ b/frontend/src/contexts/PermissionContext.tsx @@ -29,6 +29,8 @@ interface PermissionContextValue { currentSessionId: string | null getPermissionForCallID: (callID: string, sessionID: string) => Permission | null hasPermissionsForSession: (sessionID: string) => boolean + currentRepoDirectory: string | null + getRepoForSession: (sessionID: string) => ActiveRepo | null } const PermissionContext = createContext(null) @@ -321,6 +323,21 @@ prevPendingCountRef.current = pendingCount [getClient, dismiss], ) + const getRepoForSession = useCallback((sessionID: string): ActiveRepo | null => { + for (const repo of activeRepos) { + if (repo.sessions.some((s) => s.id === sessionID)) { + return repo + } + } + return null + }, [activeRepos]) + + const currentRepoDirectory = useMemo(() => { + if (!currentPermission) return null + const repo = getRepoForSession(currentPermission.sessionID) + return repo?.directory ?? null + }, [currentPermission, getRepoForSession]) + const value: PermissionContextValue = useMemo( () => ({ currentPermission, @@ -333,6 +350,8 @@ prevPendingCountRef.current = pendingCount currentSessionId, getPermissionForCallID, hasPermissionsForSession, + currentRepoDirectory, + getRepoForSession, }), [ currentPermission, @@ -344,6 +363,8 @@ prevPendingCountRef.current = pendingCount currentSessionId, getPermissionForCallID, hasPermissionsForSession, + currentRepoDirectory, + getRepoForSession, ], ) diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index afb54204..2da0ef59 100644 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -3,7 +3,7 @@ set -e export HOME=/home/node export BUN_INSTALL="$HOME/.bun" -export PATH="$BUN_INSTALL/bin:$HOME/.opencode/bin:$HOME/.local/bin:/usr/local/bin:$PATH" +export PATH="$BUN_INSTALL/bin:$HOME/.opencode/bin:/usr/local/bin:$PATH" echo "🔍 Checking Bun installation..." @@ -22,23 +22,6 @@ else echo "✅ Bun is installed (version: $BUN_VERSION)" fi -echo "🔍 Checking uv installation..." - -if ! command -v uv >/dev/null 2>&1; then - echo "❌ uv not found. Installing..." - curl -LsSf https://astral.sh/uv/install.sh | sh - - if ! command -v uv >/dev/null 2>&1; then - echo "❌ Failed to install uv. Exiting." - exit 1 - fi - - echo "✅ uv installed successfully" -else - UV_VERSION=$(uv --version 2>&1 || echo "unknown") - echo "✅ uv is installed (version: $UV_VERSION)" -fi - echo "🔍 Checking OpenCode installation..." MIN_OPENCODE_VERSION="1.0.137"