Skip to content

Commit 85aa1a0

Browse files
authored
Merge pull request #10409 from gitbutlerapp/kv-branch-55
feat(cursor): add Cursor action source and render Cursor hook in UI
2 parents 9a39d02 + f58eb2e commit 85aa1a0

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

apps/desktop/src/components/FeedItem.svelte

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ButlerAction,
99
getDisplayNameForWorkflowKind,
1010
isClaudeCodeActionSource,
11+
isCursorActionSource,
1112
isDefinedMCPActionSource,
1213
isStringActionSource,
1314
isUndefinedMCPActionSource,
@@ -84,6 +85,13 @@
8485
{@html butbotSvg}
8586
</div>
8687
</div>
88+
{:else if isCursorActionSource(action.source)}
89+
<div class="action-item__editor-logo">
90+
<EditorLogo name="cursor" />
91+
<div class="action-item__editor-source">
92+
{@html butbotSvg}
93+
</div>
94+
</div>
8795
{/if}
8896
<div class="action-item__content">
8997
<div class="action-item__content__header">
@@ -101,6 +109,8 @@
101109
<span class="text-13 text-greyer" title={new Date(action.createdAt).toLocaleString()}>
102110
{#if isClaudeCodeActionSource(action.source)}
103111
Claude Hook
112+
{:else if isCursorActionSource(action.source)}
113+
Cursor Hook
104114
{:else}
105115
MCP call
106116
{/if}

apps/desktop/src/lib/actions/types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ type ClaudeCodeActionSource = {
3030
ClaudeCode: string;
3131
};
3232

33+
type CursorActionSource = {
34+
ClaudeCode: string;
35+
};
36+
3337
export type ActionSource =
3438
| 'ButCli'
3539
| 'GitButler'
3640
| 'Unknown'
3741
| MCPActionSource
38-
| ClaudeCodeActionSource;
42+
| ClaudeCodeActionSource
43+
| CursorActionSource;
3944

4045
export function isStringActionSource(
4146
source: ActionSource
@@ -59,6 +64,10 @@ export function isClaudeCodeActionSource(source: ActionSource): source is Claude
5964
return typeof source === 'object' && source !== null && 'ClaudeCode' in source;
6065
}
6166

67+
export function isCursorActionSource(source: ActionSource): source is CursorActionSource {
68+
return typeof source === 'object' && source !== null && 'Cursor' in source;
69+
}
70+
6271
/** Represents a snapshot of an automatic action taken by a GitButler automation. */
6372
export class ButlerAction {
6473
/** UUID identifier of the action */

crates/but-action/src/action.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub enum Source {
2727
GitButler,
2828
Mcp(Option<McpClientInfo>),
2929
ClaudeCode(String),
30+
Cursor(String),
3031
#[default]
3132
Unknown,
3233
}

crates/but-cursor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pub async fn handle_stop(nightly: bool) -> anyhow::Result<CursorHookOutput> {
216216
&summary,
217217
Some(prompt.clone()),
218218
ActionHandler::HandleChangesSimple,
219-
Source::ClaudeCode(input.conversation_id),
219+
Source::Cursor(input.conversation_id),
220220
Some(stack_id),
221221
)?;
222222

0 commit comments

Comments
 (0)