feat(settings): add maxNestingDepth and autoFlattenOnLimit settings round-trip - #11
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(settings): add
maxNestingDepthandautoFlattenOnLimitsettings round-tripPart of the Task Tree unified subtask management plan (issue #9, P1.2). This PR wires two new persisted settings through the complete AGENTS.md round trip so that later PRs (auto-flatten inline mode) can read them from both the extension host and the webview.
Settings
maxNestingDepth20disables delegation entirely (all subtasks run inline).autoFlattenOnLimittruefalse, such calls are rejected so work continues directly.Round-trip (per AGENTS.md persisted-setting checklist)
packages/types/src/global-settings.ts:DEFAULT_MAX_NESTING_DEPTH = 2,DEFAULT_AUTO_FLATTEN_ON_LIMIT = true; schema fieldsmaxNestingDepth: z.number().int().min(0).max(5).optional()andautoFlattenOnLimit: z.boolean().optional(). Old data stays compatible (both optional).packages/types/src/vscode-extension-host.ts: both fields added as optional.webview-ui/.../SettingsView.tsxdestructures from localcachedState(not live state), includes both in thehandleSubmit()payload, and passes them toContextManagementSettings, which renders a 0–5 slider (max-nesting-depth-slider) and a checkbox (auto-flatten-on-limit-checkbox) with i18n keys undersettings:taskTree.*.webviewMessageHandler.ts:maxNestingDepthis normalized to an integer clamped 0–5 (non-numeric falls back to the default);autoFlattenOnLimitis coerced to a boolean; unset values are skipped so they never clobber stored state. Final value persisted via genericcontextProxy.setValue().ClineProvider.getState()returns both with defaults (?? DEFAULT_...);getStateToPostToWebview()destructures and passes them through, completing storage → webview so a saved control never visually reverts.Tests (true / false / unset covered)
webview-ui/.../ContextManagementSettings.spec.tsx: slider renders default 2 when unset, explicit value passthrough, change callback; checkbox checked by default, unchecked when explicitly false, toggle callback.src/core/webview/__tests__/ClineProvider.spec.ts(taskTree settings round-trip):getState()defaults (unset → 2 / true); handler clamping (3→3, 9→5, -1→0, non-numeric→default) and skip-when-unset; boolean normalization (false stays false, truthy coerces to true) and skip-when-unset;getStateToPostToWebview()saved-value passthrough and defaults when unset.Verification
pnpm run check-types— 14/14 packages passContextManagementSettings.spec.tsx— 35/35 (incl. 6 new)ClineProvider.spec.ts— 132/132 (incl. 4 new round-trip tests)SettingsView.change-detection+SettingsView.unsaved-changes— 15/15--max-warnings=0) clean; no eslint suppression count increasesOut of scope (later PRs)
Runtime consumption of these settings (auto-flatten inline mode, depth enforcement in
new_task) lands in the follow-up PRs per issue #9. This PR is purely the settings plumbing.