Skip to content

Commit 06538d6

Browse files
committed
Add feature toggle for single-branch mode
1 parent 9c0f350 commit 06538d6

File tree

9 files changed

+39
-3
lines changed

9 files changed

+39
-3
lines changed

apps/desktop/src/components/profileSettings/ExperimentalSettings.svelte

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@
7070
{/snippet}
7171
</SectionCard>
7272

73+
<SectionCard labelFor="single-branch" roundedTop={false} orientation="row">
74+
{#snippet title()}
75+
Single-branch mode
76+
{/snippet}
77+
{#snippet caption()}
78+
Stay in the workspace view when leaving the gitbutler/workspace branch.
79+
{/snippet}
80+
{#snippet actions()}
81+
<Toggle
82+
id="rules"
83+
checked={$settingsStore?.featureFlags.singleBranch}
84+
onclick={() =>
85+
settingsService.updateFeatureFlags({
86+
singleBranch: !$settingsStore?.featureFlags.singleBranch
87+
})}
88+
/>
89+
{/snippet}
90+
</SectionCard>
91+
7392
{#if $user?.role === 'admin'}
7493
<Spacer margin={20} />
7594
{#if $settingsStore?.featureFlags.actions}

apps/desktop/src/lib/codegen/messages.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ export function formatMessages(events: ClaudeMessage[]): Message[] {
7676
if (Array.isArray(content) && content[0]!.type === 'tool_result') {
7777
const result = content[0]!;
7878
const foundToolCall = toolCalls[result.tool_use_id];
79-
if (!foundToolCall || !result.content) throw new Error("Ahh! I can't handle this");
80-
if (typeof result.content === 'string') {
79+
if (!foundToolCall) {
80+
return [];
81+
} else if (!result.content) {
82+
foundToolCall.result = undefined;
83+
} else if (typeof result.content === 'string') {
8184
foundToolCall.result = result.content;
8285
} else if (result.content[0]!.type === 'text') {
8386
foundToolCall.result = result.content[0]!.text;

apps/desktop/src/lib/config/appSettingsV2.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ export type FeatureFlags = {
123123
butbot: boolean;
124124
/** Enable processing of workspace rules. */
125125
rules: boolean;
126+
/** Enable single-branch mode. */
127+
singleBranch: boolean;
126128
};
127129

128130
export type Fetch = {

crates/but-settings/assets/defaults.jsonc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
/// Enable the usage of the butbot chat.
3030
"butbot": false,
3131
/// Enable processing of workspace rules.
32-
"rules": false
32+
"rules": false,
33+
/// Enable single branch mode.
34+
"singleBranch": false
3335
},
3436
// Allows for additional "connect-src" hosts to be included. Requires app restart.
3537
"extraCsp": {

crates/but-settings/src/api.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub struct FeatureFlagsUpdate {
1919
pub actions: Option<bool>,
2020
pub butbot: Option<bool>,
2121
pub rules: Option<bool>,
22+
pub single_branch: Option<bool>,
2223
}
2324

2425
/// Mutation, immediately followed by writing everything to disk.
@@ -56,6 +57,7 @@ impl AppSettingsWithDiskSync {
5657
actions,
5758
butbot,
5859
rules,
60+
single_branch,
5961
}: FeatureFlagsUpdate,
6062
) -> Result<()> {
6163
let mut settings = self.get_mut_enforce_save()?;
@@ -71,6 +73,9 @@ impl AppSettingsWithDiskSync {
7173
if let Some(rules) = rules {
7274
settings.feature_flags.rules = rules;
7375
}
76+
if let Some(single_branch) = single_branch {
77+
settings.feature_flags.single_branch = single_branch;
78+
}
7479
settings.save()
7580
}
7681
}

crates/but-settings/src/app_settings.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pub struct FeatureFlags {
4747
pub butbot: bool,
4848
/// Enable processing of workspace rules.
4949
pub rules: bool,
50+
/// Enable single branch mode.
51+
pub single_branch: bool,
5052
}
5153

5254
fn default_true() -> bool {

crates/but-testing/src/command/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ pub mod stacks {
347347
actions: false,
348348
butbot: false,
349349
rules: false,
350+
single_branch: false,
350351
},
351352
..AppSettings::default()
352353
};

crates/but/src/mcp_internal/stack.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub fn create_stack_with_branch(
3636
actions: false,
3737
butbot: false,
3838
rules: false,
39+
single_branch: false,
3940
},
4041
..AppSettings::load_from_default_path_creating()?
4142
};

crates/but/src/mcp_internal/status.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn project_status(project_dir: &Path) -> anyhow::Result<but_tools::workspace
1616
actions: false,
1717
butbot: false,
1818
rules: false,
19+
single_branch: false,
1920
},
2021
..AppSettings::load_from_default_path_creating()?
2122
};

0 commit comments

Comments
 (0)