generated from nhcarrigan/template
feat(settings): add includeGitInstructions toggle
Adds an 'Include git instructions' toggle to the Agent Settings panel. When disabled, sets CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 on the Claude process to remove built-in commit and PR workflow guidance from its system prompt. Resolves #209.
This commit is contained in:
@@ -37,6 +37,9 @@ pub struct ClaudeStartOptions {
|
|||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub disable_cron: bool,
|
pub disable_cron: bool,
|
||||||
|
|
||||||
|
#[serde(default = "default_include_git_instructions")]
|
||||||
|
pub include_git_instructions: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
@@ -174,6 +177,9 @@ pub struct HikariConfig {
|
|||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub disable_cron: bool,
|
pub disable_cron: bool,
|
||||||
|
|
||||||
|
#[serde(default = "default_include_git_instructions")]
|
||||||
|
pub include_git_instructions: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HikariConfig {
|
impl Default for HikariConfig {
|
||||||
@@ -221,6 +227,7 @@ impl Default for HikariConfig {
|
|||||||
task_loop_commit_prefix: "feat".to_string(),
|
task_loop_commit_prefix: "feat".to_string(),
|
||||||
task_loop_include_summary: false,
|
task_loop_include_summary: false,
|
||||||
disable_cron: false,
|
disable_cron: false,
|
||||||
|
include_git_instructions: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,6 +272,10 @@ fn default_task_loop_commit_prefix() -> String {
|
|||||||
"feat".to_string()
|
"feat".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_include_git_instructions() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum BudgetAction {
|
pub enum BudgetAction {
|
||||||
@@ -360,6 +371,7 @@ mod tests {
|
|||||||
assert_eq!(config.task_loop_commit_prefix, "feat");
|
assert_eq!(config.task_loop_commit_prefix, "feat");
|
||||||
assert!(!config.task_loop_include_summary);
|
assert!(!config.task_loop_include_summary);
|
||||||
assert!(!config.disable_cron);
|
assert!(!config.disable_cron);
|
||||||
|
assert!(config.include_git_instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -407,6 +419,7 @@ mod tests {
|
|||||||
task_loop_commit_prefix: "fix".to_string(),
|
task_loop_commit_prefix: "fix".to_string(),
|
||||||
task_loop_include_summary: true,
|
task_loop_include_summary: true,
|
||||||
disable_cron: true,
|
disable_cron: true,
|
||||||
|
include_git_instructions: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let json = serde_json::to_string(&config).unwrap();
|
let json = serde_json::to_string(&config).unwrap();
|
||||||
@@ -425,6 +438,7 @@ mod tests {
|
|||||||
assert_eq!(deserialized.task_loop_commit_prefix, "fix");
|
assert_eq!(deserialized.task_loop_commit_prefix, "fix");
|
||||||
assert!(deserialized.task_loop_include_summary);
|
assert!(deserialized.task_loop_include_summary);
|
||||||
assert!(deserialized.disable_cron);
|
assert!(deserialized.disable_cron);
|
||||||
|
assert!(!deserialized.include_git_instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -315,6 +315,11 @@ impl WslBridge {
|
|||||||
cmd.env("CLAUDE_CODE_DISABLE_CRON", "1");
|
cmd.env("CLAUDE_CODE_DISABLE_CRON", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable built-in git instructions if requested
|
||||||
|
if !options.include_git_instructions {
|
||||||
|
cmd.env("CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS", "1");
|
||||||
|
}
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
} else {
|
} else {
|
||||||
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
|
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
|
||||||
@@ -372,6 +377,11 @@ impl WslBridge {
|
|||||||
claude_cmd.push_str("CLAUDE_CODE_DISABLE_CRON=1 ");
|
claude_cmd.push_str("CLAUDE_CODE_DISABLE_CRON=1 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable built-in git instructions if requested
|
||||||
|
if !options.include_git_instructions {
|
||||||
|
claude_cmd.push_str("CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 ");
|
||||||
|
}
|
||||||
|
|
||||||
claude_cmd.push_str(
|
claude_cmd.push_str(
|
||||||
"claude --output-format stream-json --input-format stream-json --verbose",
|
"claude --output-format stream-json --input-format stream-json --verbose",
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ vi.mock("$lib/stores/config", () => ({
|
|||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
max_output_tokens: null,
|
max_output_tokens: null,
|
||||||
|
include_git_instructions: true,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ async function changeDirectory(path: string): Promise<void> {
|
|||||||
use_worktree: config.use_worktree ?? false,
|
use_worktree: config.use_worktree ?? false,
|
||||||
disable_1m_context: config.disable_1m_context ?? false,
|
disable_1m_context: config.disable_1m_context ?? false,
|
||||||
max_output_tokens: config.max_output_tokens ?? null,
|
max_output_tokens: config.max_output_tokens ?? null,
|
||||||
|
include_git_instructions: config.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -143,6 +144,7 @@ async function startNewConversation(): Promise<void> {
|
|||||||
use_worktree: config.use_worktree ?? false,
|
use_worktree: config.use_worktree ?? false,
|
||||||
disable_1m_context: config.disable_1m_context ?? false,
|
disable_1m_context: config.disable_1m_context ?? false,
|
||||||
max_output_tokens: config.max_output_tokens ?? null,
|
max_output_tokens: config.max_output_tokens ?? null,
|
||||||
|
include_git_instructions: config.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
use_worktree: false,
|
use_worktree: false,
|
||||||
disable_1m_context: false,
|
disable_1m_context: false,
|
||||||
disable_cron: false,
|
disable_cron: false,
|
||||||
|
include_git_instructions: true,
|
||||||
max_output_tokens: null,
|
max_output_tokens: null,
|
||||||
trusted_workspaces: [],
|
trusted_workspaces: [],
|
||||||
background_image_path: null,
|
background_image_path: null,
|
||||||
@@ -566,6 +567,22 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Include Git Instructions -->
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="flex items-center gap-3 cursor-pointer">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={config.include_git_instructions}
|
||||||
|
class="w-4 h-4 rounded border-[var(--border-color)] bg-[var(--bg-primary)] text-[var(--accent-primary)] focus:ring-[var(--accent-primary)]"
|
||||||
|
/>
|
||||||
|
<span class="text-sm text-[var(--text-primary)]">Include git instructions</span>
|
||||||
|
</label>
|
||||||
|
<p class="text-xs text-[var(--text-tertiary)] mt-1 ml-7">
|
||||||
|
When disabled, sets <code class="font-mono">CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1</code> to
|
||||||
|
remove Claude's built-in commit and PR workflow guidance from its system prompt
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Max Output Tokens -->
|
<!-- Max Output Tokens -->
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label class="block text-sm text-[var(--text-primary)] mb-1" for="max-output-tokens">
|
<label class="block text-sm text-[var(--text-primary)] mb-1" for="max-output-tokens">
|
||||||
|
|||||||
@@ -402,6 +402,7 @@ User: ${formattedMessage}`;
|
|||||||
allowed_tools: allAllowedTools,
|
allowed_tools: allAllowedTools,
|
||||||
use_worktree: config.use_worktree ?? false,
|
use_worktree: config.use_worktree ?? false,
|
||||||
disable_1m_context: config.disable_1m_context ?? false,
|
disable_1m_context: config.disable_1m_context ?? false,
|
||||||
|
include_git_instructions: config.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
allowed_tools: [...new Set([...newGrantedTools, ...config.auto_granted_tools])],
|
allowed_tools: [...new Set([...newGrantedTools, ...config.auto_granted_tools])],
|
||||||
use_worktree: config.use_worktree ?? false,
|
use_worktree: config.use_worktree ?? false,
|
||||||
disable_1m_context: config.disable_1m_context ?? false,
|
disable_1m_context: config.disable_1m_context ?? false,
|
||||||
|
include_git_instructions: config.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,7 @@
|
|||||||
use_worktree: currentConfig.use_worktree ?? false,
|
use_worktree: currentConfig.use_worktree ?? false,
|
||||||
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
||||||
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
||||||
|
include_git_instructions: currentConfig.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -325,6 +326,7 @@
|
|||||||
use_worktree: currentConfig.use_worktree ?? false,
|
use_worktree: currentConfig.use_worktree ?? false,
|
||||||
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
disable_1m_context: currentConfig.disable_1m_context ?? false,
|
||||||
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
max_output_tokens: currentConfig.max_output_tokens ?? null,
|
||||||
|
include_git_instructions: currentConfig.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,7 @@
|
|||||||
use_worktree: cfg.use_worktree ?? false,
|
use_worktree: cfg.use_worktree ?? false,
|
||||||
disable_1m_context: cfg.disable_1m_context ?? false,
|
disable_1m_context: cfg.disable_1m_context ?? false,
|
||||||
max_output_tokens: cfg.max_output_tokens ?? null,
|
max_output_tokens: cfg.max_output_tokens ?? null,
|
||||||
|
include_git_instructions: cfg.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -108,6 +108,7 @@
|
|||||||
allowed_tools: grantedToolsList,
|
allowed_tools: grantedToolsList,
|
||||||
use_worktree: config.use_worktree ?? false,
|
use_worktree: config.use_worktree ?? false,
|
||||||
disable_1m_context: config.disable_1m_context ?? false,
|
disable_1m_context: config.disable_1m_context ?? false,
|
||||||
|
include_git_instructions: config.include_git_instructions ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ describe("config store", () => {
|
|||||||
task_loop_auto_commit: false,
|
task_loop_auto_commit: false,
|
||||||
task_loop_commit_prefix: "feat",
|
task_loop_commit_prefix: "feat",
|
||||||
task_loop_include_summary: false,
|
task_loop_include_summary: false,
|
||||||
|
include_git_instructions: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(config.model).toBe("claude-sonnet-4");
|
expect(config.model).toBe("claude-sonnet-4");
|
||||||
@@ -279,6 +280,7 @@ describe("config store", () => {
|
|||||||
task_loop_auto_commit: false,
|
task_loop_auto_commit: false,
|
||||||
task_loop_commit_prefix: "feat",
|
task_loop_commit_prefix: "feat",
|
||||||
task_loop_include_summary: false,
|
task_loop_include_summary: false,
|
||||||
|
include_git_instructions: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(config.model).toBeNull();
|
expect(config.model).toBeNull();
|
||||||
@@ -893,6 +895,7 @@ describe("config store", () => {
|
|||||||
task_loop_auto_commit: false,
|
task_loop_auto_commit: false,
|
||||||
task_loop_commit_prefix: "feat",
|
task_loop_commit_prefix: "feat",
|
||||||
task_loop_include_summary: false,
|
task_loop_include_summary: false,
|
||||||
|
include_git_instructions: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockInvokeImpl = vi.mocked(invoke);
|
const mockInvokeImpl = vi.mocked(invoke);
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ export interface HikariConfig {
|
|||||||
task_loop_auto_commit: boolean;
|
task_loop_auto_commit: boolean;
|
||||||
task_loop_commit_prefix: string;
|
task_loop_commit_prefix: string;
|
||||||
task_loop_include_summary: boolean;
|
task_loop_include_summary: boolean;
|
||||||
|
// Git instructions setting
|
||||||
|
include_git_instructions: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultConfig: HikariConfig = {
|
const defaultConfig: HikariConfig = {
|
||||||
@@ -134,6 +136,7 @@ const defaultConfig: HikariConfig = {
|
|||||||
task_loop_auto_commit: false,
|
task_loop_auto_commit: false,
|
||||||
task_loop_commit_prefix: "feat",
|
task_loop_commit_prefix: "feat",
|
||||||
task_loop_include_summary: false,
|
task_loop_include_summary: false,
|
||||||
|
include_git_instructions: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
function createConfigStore() {
|
function createConfigStore() {
|
||||||
|
|||||||
Reference in New Issue
Block a user