/** * ProjectSettings component for managing project-specific hooks configuration */ import React, { useState, useEffect } from 'react'; import { HooksEditor } from '@/components/HooksEditor'; import { SlashCommandsManager } from '@/components/SlashCommandsManager'; import { api } from '@/lib/api'; import { AlertTriangle, ArrowLeft, Settings, FolderOpen, GitBranch, Shield, Command } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { cn } from '@/lib/utils'; import { Toast, ToastContainer } from '@/components/ui/toast'; import type { Project } from '@/lib/api'; interface ProjectSettingsProps { project: Project; onBack: () => void; className?: string; } export const ProjectSettings: React.FC = ({ project, onBack, className }) => { const [activeTab, setActiveTab] = useState('commands'); const [toast, setToast] = useState<{ message: string; type: 'success' | 'error' } | null>(null); // Other hooks settings const [gitIgnoreLocal, setGitIgnoreLocal] = useState(true); useEffect(() => { checkGitIgnore(); }, [project]); const checkGitIgnore = async () => { try { // Check if .claude/settings.local.json is in .gitignore const gitignorePath = `${project.path}/.gitignore`; const gitignoreContent = await api.readClaudeMdFile(gitignorePath); setGitIgnoreLocal(gitignoreContent.includes('.claude/settings.local.json')); } catch { // .gitignore might not exist setGitIgnoreLocal(false); } }; const addToGitIgnore = async () => { try { const gitignorePath = `${project.path}/.gitignore`; let content = ''; try { content = await api.readClaudeMdFile(gitignorePath); } catch { // File doesn't exist, create it } if (!content.includes('.claude/settings.local.json')) { content += '\n# Claude local settings (machine-specific)\n.claude/settings.local.json\n'; await api.saveClaudeMdFile(gitignorePath, content); setGitIgnoreLocal(true); setToast({ message: 'Added to .gitignore', type: 'success' }); } } catch (err) { console.error('Failed to update .gitignore:', err); setToast({ message: 'Failed to update .gitignore', type: 'error' }); } }; return (
{/* Header */}

Project Settings

{project.path}
{/* Content */}
Slash Commands Project Hooks Local Hooks

Project Slash Commands

Custom commands that are specific to this project. These commands are stored in .claude/slash-commands/ and can be committed to version control.

Project Hooks

These hooks apply to all users working on this project. They are stored in .claude/settings.json and should be committed to version control.

Local Hooks

These hooks only apply to your machine. They are stored in .claude/settings.local.json and should NOT be committed to version control.

{!gitIgnoreLocal && (

Local settings file is not in .gitignore

)}
{/* Toast Container */} {toast && ( setToast(null)} /> )}
); };