feat(preferences): include-paths UI wiring#195
Merged
ldm0 merged 4 commits intocardisoft:masterfrom May 2, 2026
Merged
Conversation
ships the frontend half of the include-paths feature merged in cardisoft#187. the rust side already accepts an optional `includePaths` arg on start_logic and set_watch_config; this PR drives them. - new useIncludePaths hook, mirroring useIgnorePaths (storage key `cardinal.includePaths`, defaults to empty) - thread includePaths through useAppPreferences: read from the new hook, pass to start_logic on first launch, send via setWatchConfig when the user edits preferences, include in the change-detection equality check - new textarea section in PreferencesOverlay below the existing ignore paths, with the same one-path-per-line shape and absolute-path validation - WatchConfigPayload gains includePaths so the type forces every call site to ship it
mirrors the existing ignorePaths block — label, help, errors.absolute — across en-US, ar-SA, de-DE, es-ES, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, uk-UA, zh-CN, zh-TW.
- new useIncludePaths spec mirroring useIgnorePaths (default empty, hydrate, clean+persist updates, fallback on invalid JSON) - useAppPreferences: mock useIncludePaths, thread includePaths through every existing start_logic / setWatchConfig assertion, add a test for the include-paths-only change path - PreferencesOverlay: include the new textarea and field in baseProps, add a save-include-paths test, add a validation-blocks-save test, and cover the include-paths reset
There was a problem hiding this comment.
Pull request overview
Adds the frontend wiring for the previously introduced Rust include_paths capability, allowing users to configure “include paths” from Preferences and ensuring the config is sent to Tauri commands and persisted locally.
Changes:
- Introduces
useIncludePaths(localStorage-backed) and threadsincludePathsthroughuseAppPreferencesintostart_logic/set_watch_config. - Extends
PreferencesOverlaywith an “Include paths” textarea (parse/validate/save/reset behavior aligned with ignore paths). - Updates IPC typing (
WatchConfigPayload) and adds i18n strings forincludePathsacross all locales, plus adds/updates related tests.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cardinal/src/utils/watchConfig.ts | Extends watch-config payload type to require includePaths. |
| cardinal/src/hooks/useIncludePaths.ts | New hook to persist/clean include paths in localStorage. |
| cardinal/src/hooks/useAppPreferences.ts | Reads include paths and sends them through start_logic and setWatchConfig; equality check updated. |
| cardinal/src/components/PreferencesOverlay.tsx | Adds include-paths textarea with validation + save/reset wiring. |
| cardinal/src/App.tsx | Passes includePaths/defaultIncludePaths props into PreferencesOverlay. |
| cardinal/src/hooks/tests/useIncludePaths.test.ts | New unit tests for include-paths persistence/cleanup/fallback behavior. |
| cardinal/src/hooks/tests/useAppPreferences.test.ts | Updates existing tests + adds include-paths-only change test. |
| cardinal/src/components/tests/PreferencesOverlay.test.tsx | Adds coverage for include-path save/validation/reset behavior. |
| cardinal/src/i18n/resources/ar-SA.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/de-DE.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/en-US.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/es-ES.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/fr-FR.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/hi-IN.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/it-IT.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/ja-JP.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/ko-KR.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/pt-BR.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/ru-RU.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/tr-TR.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/uk-UA.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/zh-CN.json | Adds includePaths translations. |
| cardinal/src/i18n/resources/zh-TW.json | Adds includePaths translations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`useStoredState` uses `writeErrorMessage` for any write failure, not just the initial default-persist. dropping "default" from the text so a later user-initiated save that fails doesn't get logged as if the default write was the problem. per Copilot's review on cardisoft#195.
Member
|
LGTM, awesome feature addition. Found several existing issues though, but not related to current PR. |
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.
follow-up to #187. ships the frontend half so users can actually configure include paths from preferences. targeting v0.1.24 per the comment on the previous PR.
what this does
useIncludePathshook: mirrorsuseIgnorePaths, persists tolocalStorageundercardinal.includePaths, defaults to an empty array since include paths are opt-in.useAppPreferencesreads the new hook, sendsincludePathson thestart_logicinvoke, and ships it throughsetWatchConfigwhenever preferences change. equality check now considers all three fields.PreferencesOverlaygains an "Include paths" textarea right under "Ignore paths". same one-path-per-line shape, same absolute-path validation, same save/reset behaviour.WatchConfigPayloadgainedincludePaths: string[]so the type forces every call site to ship it.includePaths.label/includePaths.help/includePaths.errors.absolutetranslated into all 15 locales.what it lets you do
with
/Volumesignored by default, you can now add/Volumes/media(or whatever) to the include list and that subtree stays indexed even though its parent is ignored. nested override semantics from #187 still apply: a deeper ignore wins over a shallower include.risks
includePathsgracefully (it'sOption<Vec<String>>on bothstart_logicandset_watch_configfrom feat(ignore-paths): allow re-including subpaths of ignored directories #187), so older clients keep working.verified
new tests:
useIncludePathsspec: defaults, hydrate, clean+persist, invalid-JSON fallback.useAppPreferences: include-paths-only change path drivessetIncludePathsandsetWatchConfig.PreferencesOverlay: save-include-paths, validation-blocks-save, include-paths reset to default.