From 0edd7235cd861ef77d4ceb37a594ae65df52624b Mon Sep 17 00:00:00 2001 From: Clawd Date: Sat, 28 Feb 2026 15:35:00 -0800 Subject: Add session-specific artifacts, CLAUDE.md, and git worktree support - Store artifacts in .claude-flow/sessions/{sessionId}/ - Each session now has isolated research.md and plan.md - Concurrent sessions no longer conflict - Add CLAUDE.md support for shared codebase documentation - Add git worktree creation on session start - Add git commit/status IPC handlers - Update all artifact APIs to be session-specific - Remove artifact clearing on new session (no longer needed) --- src/main/preload.ts | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'src/main/preload.ts') diff --git a/src/main/preload.ts b/src/main/preload.ts index b3e3f8b..1747763 100644 --- a/src/main/preload.ts +++ b/src/main/preload.ts @@ -3,6 +3,7 @@ import type { SDKMessage } from "@anthropic-ai/claude-agent-sdk"; import type { Project } from "./db/projects"; import type { Session, Message } from "./db/sessions"; import type { Phase, UserPermissionMode } from "./claude/phases"; +import type { GitWorktreeInfo } from "./git/worktree"; export interface ClaudeFlowAPI { // Projects @@ -31,7 +32,24 @@ export interface ClaudeFlowAPI { mode: UserPermissionMode ) => Promise; - // Artifacts + // Session Artifacts (new session-specific) + readSessionArtifact: ( + projectPath: string, + sessionId: string, + filename: string + ) => Promise; + writeSessionArtifact: ( + projectPath: string, + sessionId: string, + filename: string, + content: string + ) => Promise; + + // CLAUDE.md + readClaudeMd: (projectPath: string) => Promise; + writeClaudeMd: (projectPath: string, content: string) => Promise; + + // Legacy Artifacts (backward compat) readArtifact: ( projectPath: string, filename: string @@ -42,6 +60,12 @@ export interface ClaudeFlowAPI { content: string ) => Promise; + // Git + isGitRepo: (projectPath: string) => Promise; + getWorktreeInfo: (projectPath: string, sessionId: string) => Promise; + commitChanges: (worktreePath: string, message: string, files?: string[]) => Promise; + hasUncommittedChanges: (worktreePath: string) => Promise; + // Events onClaudeMessage: ( callback: (sessionId: string, message: SDKMessage) => void @@ -80,12 +104,32 @@ const api: ClaudeFlowAPI = { setPermissionMode: (sessionId, mode) => ipcRenderer.invoke("workflow:setPermissionMode", sessionId, mode), - // Artifacts + // Session Artifacts + readSessionArtifact: (projectPath, sessionId, filename) => + ipcRenderer.invoke("artifact:readSession", projectPath, sessionId, filename), + writeSessionArtifact: (projectPath, sessionId, filename, content) => + ipcRenderer.invoke("artifact:writeSession", projectPath, sessionId, filename, content), + + // CLAUDE.md + readClaudeMd: (projectPath) => ipcRenderer.invoke("claudemd:read", projectPath), + writeClaudeMd: (projectPath, content) => + ipcRenderer.invoke("claudemd:write", projectPath, content), + + // Legacy Artifacts readArtifact: (projectPath, filename) => ipcRenderer.invoke("artifact:read", projectPath, filename), writeArtifact: (projectPath, filename, content) => ipcRenderer.invoke("artifact:write", projectPath, filename, content), + // Git + isGitRepo: (projectPath) => ipcRenderer.invoke("git:isRepo", projectPath), + getWorktreeInfo: (projectPath, sessionId) => + ipcRenderer.invoke("git:worktreeInfo", projectPath, sessionId), + commitChanges: (worktreePath, message, files) => + ipcRenderer.invoke("git:commit", worktreePath, message, files), + hasUncommittedChanges: (worktreePath) => + ipcRenderer.invoke("git:hasChanges", worktreePath), + // Events onClaudeMessage: (callback) => { const handler = ( -- cgit v1.2.3