Skip to content

[Feat] Add a persisted opt-in setting for DCG - #1061

Open
navedmerchant wants to merge 3 commits into
feat/dcg-binary-servicefrom
feat/dcg-setting
Open

[Feat] Add a persisted opt-in setting for DCG#1061
navedmerchant wants to merge 3 commits into
feat/dcg-binary-servicefrom
feat/dcg-setting

Conversation

@navedmerchant

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes #1057
Part of #1049. Split from #1050.

Description

Adds the persisted destructiveCommandGuardEnabled setting across shared types, extension/provider state, SettingsView's local cached state, save handling, and Auto-Approve settings UI.

Enabling verifies DCG installation. Failure normalizes the setting back to disabled and shows a localized error. Existing allowlist/denylist behavior remains available while DCG is disabled. This PR does not yet change command approval policy.

Stack

3 / 4 — base: feat/dcg-binary-service

Depends on PR 2 only for enable-time installation verification.

Test Procedure

pnpm --dir src exec vitest run core/webview/__tests__/ClineProvider.spec.ts core/webview/__tests__/webviewMessageHandler.spec.ts
pnpm --dir webview-ui exec vitest run src/components/settings/__tests__/AutoApproveSettings.spec.tsx
pnpm --dir packages/types check-types
pnpm --dir src check-types
pnpm --dir webview-ui check-types
node scripts/find-missing-translations.js --area=core
node scripts/find-missing-translations.js --area=webview

Result: 183 extension and 11 webview tests passed; all type-checks, lint, and translation validation passed.

Checklist

  • Full setting round trip implemented
  • SettingsView uses local cached state
  • Tests/type-check/lint/i18n checks passing

@navedmerchant navedmerchant added the enhancement New feature or request label Jul 30, 2026
@navedmerchant navedmerchant added the enhancement New feature or request label Jul 30, 2026
@navedmerchant navedmerchant self-assigned this Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 44fb207d-4a45-490a-8e58-213d5681c989

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.12500% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ui/src/components/settings/AutoApproveSettings.tsx 68.42% 0 Missing and 6 partials ⚠️
src/core/webview/ClineProvider.ts 50.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Jul 30, 2026
@navedmerchant
navedmerchant force-pushed the feat/dcg-binary-service branch from 5c460bd to baade5f Compare July 30, 2026 04:50
@github-actions github-actions Bot added awaiting-review PR changes are ready and waiting for maintainer re-review and removed awaiting-review PR changes are ready and waiting for maintainer re-review labels Jul 30, 2026

@edelauna edelauna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good - mostly minor nits

} catch (error) {
message.updatedSettings.destructiveCommandGuardEnabled = false
vscode.window.showErrorMessage(
t("common:errors.destructive_command_guard_enable_failed", {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When !binaryPath, the already-localized unavailable message gets thrown, caught, and re-interpolated into this wrapper — so the user sees "Unable to enable Destructive Command Guard: Destructive Command Guard is enabled but is not available for this platform". Should the !binaryPath branch just call showErrorMessage directly instead of routing through this generic wrapper?

Comment thread src/i18n/locales/en/common.json Outdated
"destructiveCommandGuard": {
"unavailable": "Destructive Command Guard is enabled but is not available for this platform"
},
"destructive_command_guard_enable_failed": "Unable to enable Destructive Command Guard: {{error}}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sits right next to destructiveCommandGuard.unavailable (nested camelCase) but uses flat snake_case — any reason not to keep both keys under the same destructiveCommandGuard namespace?

@github-actions github-actions Bot added awaiting-author PR is waiting for the author to address requested changes and removed awaiting-review PR changes are ready and waiting for maintainer re-review labels Jul 31, 2026
@navedmerchant
navedmerchant force-pushed the feat/dcg-binary-service branch from baade5f to e1a0c39 Compare August 1, 2026 17:17
@github-actions github-actions Bot removed the awaiting-author PR is waiting for the author to address requested changes label Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants