aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/preload.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/preload.ts')
-rw-r--r--src/main/preload.ts48
1 files changed, 46 insertions, 2 deletions
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";
3import type { Project } from "./db/projects"; 3import type { Project } from "./db/projects";
4import type { Session, Message } from "./db/sessions"; 4import type { Session, Message } from "./db/sessions";
5import type { Phase, UserPermissionMode } from "./claude/phases"; 5import type { Phase, UserPermissionMode } from "./claude/phases";
6import type { GitWorktreeInfo } from "./git/worktree";
6 7
7export interface ClaudeFlowAPI { 8export interface ClaudeFlowAPI {
8 // Projects 9 // Projects
@@ -31,7 +32,24 @@ export interface ClaudeFlowAPI {
31 mode: UserPermissionMode 32 mode: UserPermissionMode
32 ) => Promise<void>; 33 ) => Promise<void>;
33 34
34 // Artifacts 35 // Session Artifacts (new session-specific)
36 readSessionArtifact: (
37 projectPath: string,
38 sessionId: string,
39 filename: string
40 ) => Promise<string | null>;
41 writeSessionArtifact: (
42 projectPath: string,
43 sessionId: string,
44 filename: string,
45 content: string
46 ) => Promise<void>;
47
48 // CLAUDE.md
49 readClaudeMd: (projectPath: string) => Promise<string | null>;
50 writeClaudeMd: (projectPath: string, content: string) => Promise<void>;
51
52 // Legacy Artifacts (backward compat)
35 readArtifact: ( 53 readArtifact: (
36 projectPath: string, 54 projectPath: string,
37 filename: string 55 filename: string
@@ -42,6 +60,12 @@ export interface ClaudeFlowAPI {
42 content: string 60 content: string
43 ) => Promise<void>; 61 ) => Promise<void>;
44 62
63 // Git
64 isGitRepo: (projectPath: string) => Promise<boolean>;
65 getWorktreeInfo: (projectPath: string, sessionId: string) => Promise<GitWorktreeInfo | null>;
66 commitChanges: (worktreePath: string, message: string, files?: string[]) => Promise<void>;
67 hasUncommittedChanges: (worktreePath: string) => Promise<boolean>;
68
45 // Events 69 // Events
46 onClaudeMessage: ( 70 onClaudeMessage: (
47 callback: (sessionId: string, message: SDKMessage) => void 71 callback: (sessionId: string, message: SDKMessage) => void
@@ -80,12 +104,32 @@ const api: ClaudeFlowAPI = {
80 setPermissionMode: (sessionId, mode) => 104 setPermissionMode: (sessionId, mode) =>
81 ipcRenderer.invoke("workflow:setPermissionMode", sessionId, mode), 105 ipcRenderer.invoke("workflow:setPermissionMode", sessionId, mode),
82 106
83 // Artifacts 107 // Session Artifacts
108 readSessionArtifact: (projectPath, sessionId, filename) =>
109 ipcRenderer.invoke("artifact:readSession", projectPath, sessionId, filename),
110 writeSessionArtifact: (projectPath, sessionId, filename, content) =>
111 ipcRenderer.invoke("artifact:writeSession", projectPath, sessionId, filename, content),
112
113 // CLAUDE.md
114 readClaudeMd: (projectPath) => ipcRenderer.invoke("claudemd:read", projectPath),
115 writeClaudeMd: (projectPath, content) =>
116 ipcRenderer.invoke("claudemd:write", projectPath, content),
117
118 // Legacy Artifacts
84 readArtifact: (projectPath, filename) => 119 readArtifact: (projectPath, filename) =>
85 ipcRenderer.invoke("artifact:read", projectPath, filename), 120 ipcRenderer.invoke("artifact:read", projectPath, filename),
86 writeArtifact: (projectPath, filename, content) => 121 writeArtifact: (projectPath, filename, content) =>
87 ipcRenderer.invoke("artifact:write", projectPath, filename, content), 122 ipcRenderer.invoke("artifact:write", projectPath, filename, content),
88 123
124 // Git
125 isGitRepo: (projectPath) => ipcRenderer.invoke("git:isRepo", projectPath),
126 getWorktreeInfo: (projectPath, sessionId) =>
127 ipcRenderer.invoke("git:worktreeInfo", projectPath, sessionId),
128 commitChanges: (worktreePath, message, files) =>
129 ipcRenderer.invoke("git:commit", worktreePath, message, files),
130 hasUncommittedChanges: (worktreePath) =>
131 ipcRenderer.invoke("git:hasChanges", worktreePath),
132
89 // Events 133 // Events
90 onClaudeMessage: (callback) => { 134 onClaudeMessage: (callback) => {
91 const handler = ( 135 const handler = (