Compare commits

...
Author SHA1 Message Date
Trevor Hudson 6ef153b957 changeset 2025-05-12 15:11:20 -07:00
Trevor Hudson cf7d73e72a add close button at bottom 2025-05-12 15:10:13 -07:00
Trevor Hudson 12e9bb129d show items that are checked 2025-05-12 14:59:30 -07:00
Trevor Hudson 6bea3ae42f ship with good defaults 2025-05-12 13:58:56 -07:00
4 changed files with 86 additions and 40 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
ship with defaults
+4 -4
View File
@@ -22,18 +22,18 @@ export interface AutoApprovalSettings {
export const DEFAULT_AUTO_APPROVAL_SETTINGS: AutoApprovalSettings = {
version: 1,
enabled: false,
enabled: true,
actions: {
readFiles: false,
readFiles: true,
readFilesExternally: false,
editFiles: false,
editFilesExternally: false,
executeSafeCommands: false,
executeSafeCommands: true,
executeAllCommands: false,
useBrowser: false,
useMcp: false,
},
maxRequests: 20,
enableNotifications: false,
favorites: [],
favorites: ["enableAll", "readFiles", "editFiles"],
}
@@ -5,7 +5,7 @@ import { AutoApprovalSettings } from "@shared/AutoApprovalSettings"
import { CODE_BLOCK_BG_COLOR } from "@/components/common/CodeBlock"
import AutoApproveMenuItem from "./AutoApproveMenuItem"
import { vscode } from "@/utils/vscode"
import { getAsVar, VSC_FOREGROUND, VSC_TITLEBAR_INACTIVE_FOREGROUND, VSC_DESCRIPTION_FOREGROUND } from "@/utils/vscStyles"
import { getAsVar, VSC_FOREGROUND, VSC_TITLEBAR_INACTIVE_FOREGROUND, VSC_FOREGROUND_MUTED } from "@/utils/vscStyles"
import { useClickAway } from "react-use"
import HeroTooltip from "@/components/common/HeroTooltip"
@@ -281,6 +281,43 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
)
}
// Render a favorited item with a checkbox
const getQuickAccessItems = () => {
const notificationsEnabled = autoApprovalSettings.enableNotifications
const enabledActionsNames = Object.keys(autoApprovalSettings.actions).filter(
(key) => autoApprovalSettings.actions[key as keyof AutoApprovalSettings["actions"]],
)
const enabledActions = enabledActionsNames.map((action) => {
return ACTION_METADATA.flatMap((a) => [a, a.subAction]).find((a) => a?.id === action)
})
let minusFavorites = enabledActions.filter((action) => !favorites.includes(action?.id ?? "") && action?.shortName)
if (notificationsEnabled) {
minusFavorites.push(NOTIFICATIONS_SETTING)
}
return [
...favorites.map((favId) => renderFavoritedItem(favId)),
minusFavorites.length > 0 ? (
<span style={{ color: getAsVar(VSC_FOREGROUND_MUTED), paddingLeft: "10px", opacity: 0.6 }} key="separator">
</span>
) : null,
...minusFavorites.map((action, index) => (
<span
style={{
color: getAsVar(VSC_FOREGROUND_MUTED),
opacity: 0.6,
}}
key={action?.id}>
{action?.shortName}
{index < minusFavorites.length - 1 && ","}
</span>
)),
]
}
const isChecked = (action: ActionMetadata): boolean => {
if (action.id === "enableNotifications") {
return autoApprovalSettings.enableNotifications
@@ -320,38 +357,20 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
justifyContent: "space-between",
gap: "8px",
}}>
{favorites.length > 0 ? (
<div
style={{
display: "flex",
flexWrap: "nowrap",
alignItems: "center",
overflowX: "auto",
msOverflowStyle: "none",
scrollbarWidth: "none",
WebkitOverflowScrolling: "touch",
gap: "4px",
whiteSpace: "nowrap", // Prevent text wrapping
}}>
{favorites.map((favId) => renderFavoritedItem(favId))}
</div>
) : (
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
cursor: "pointer",
}}>
<div style={{ display: "flex", alignItems: "center", gap: "8px" }}>
<HeroTooltip
content="Auto-approve allows Cline to perform the following actions without asking for permission. Please use with caution and only enable if you understand the risks."
placement="top">
<span style={{ color: getAsVar(VSC_FOREGROUND), left: "0" }}>Auto-approve</span>
</HeroTooltip>
</div>
</div>
)}
<div
style={{
display: "flex",
flexWrap: "nowrap",
alignItems: "center",
overflowX: "auto",
msOverflowStyle: "none",
scrollbarWidth: "none",
WebkitOverflowScrolling: "touch",
gap: "4px",
whiteSpace: "nowrap", // Prevent text wrapping
}}>
{getQuickAccessItems()}
</div>
<span className="codicon codicon-chevron-right" />
</div>
)}
@@ -362,7 +381,10 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
maxHeight: isExpanded ? "1000px" : favorites.length > 0 ? "40px" : "22px", // Large enough to fit content
opacity: isExpanded ? 1 : 0,
overflow: "hidden",
transition: "max-height 0.3s ease-in-out, opacity 0.3s ease-in-out", // Removed padding to transition
transition: "max-height 0.3s ease-in-out, opacity 0.3s ease-in-out",
display: "flex",
flexDirection: "column",
gap: "4px",
}}>
{isExpanded && ( // Re-added conditional rendering for content
<>
@@ -450,7 +472,7 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
<span className="codicon codicon-settings" style={{ color: "#CCCCCC", fontSize: "14px" }} />
<span style={{ color: "#CCCCCC", fontSize: "12px", fontWeight: 500 }}>Max Requests:</span>
<VSCodeTextField
style={{ flex: "1", width: "100%" }}
style={{ flex: "1", width: "100%", paddingRight: "35px" }}
value={autoApprovalSettings.maxRequests.toString()}
onInput={(e) => {
const input = e.target as HTMLInputElement
@@ -475,6 +497,13 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
</HeroTooltip>
</>
)}
{isExpanded && (
<span
className="codicon codicon-chevron-up"
style={{ paddingBottom: "4px", marginLeft: "auto", marginTop: "-20px", cursor: "pointer" }}
onClick={() => setIsExpanded(false)}
/>
)}
</div>
</div>
)
@@ -97,11 +97,23 @@ const AutoApproveMenuItem = ({
<span className="label">{condensed ? action.shortName : action.label}</span>
</div>
{onToggleFavorite && !condensed && (
<HeroTooltip content={favorited ? "Remove from quick-access menu" : "Add to quick-access menu"}>
<HeroTooltip
delay={500}
content={
action.id === "enableAll"
? "Required"
: favorited
? "Remove from quick-access menu"
: "Add to quick-access menu"
}>
<span
className={`codicon codicon-${favorited ? "star-full" : "star-empty"} star`}
style={{
cursor: action.id === "enableAll" ? "not-allowed" : "pointer",
}}
onClick={(e) => {
e.stopPropagation()
if (action.id === "enableAll") return
onToggleFavorite?.(action.id)
}}
/>