Skip to content

feat(preferences): include-paths UI wiring#195

Merged
ldm0 merged 4 commits intocardisoft:masterfrom
buggerman:feat/include-paths-frontend
May 2, 2026
Merged

feat(preferences): include-paths UI wiring#195
ldm0 merged 4 commits intocardisoft:masterfrom
buggerman:feat/include-paths-frontend

Conversation

@buggerman
Copy link
Copy Markdown
Contributor

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

  • new useIncludePaths hook: mirrors useIgnorePaths, persists to localStorage under cardinal.includePaths, defaults to an empty array since include paths are opt-in.
  • useAppPreferences reads the new hook, sends includePaths on the start_logic invoke, and ships it through setWatchConfig whenever preferences change. equality check now considers all three fields.
  • PreferencesOverlay gains an "Include paths" textarea right under "Ignore paths". same one-path-per-line shape, same absolute-path validation, same save/reset behaviour.
  • WatchConfigPayload gained includePaths: string[] so the type forces every call site to ship it.
  • i18n: includePaths.label / includePaths.help / includePaths.errors.absolute translated into all 15 locales.

what it lets you do

with /Volumes ignored 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

verified

npm test                                         # 244 passed
npm run format:check                             # clean (only pre-existing src-tauri/gen/* warnings remain)
npm run build                                    # ok
cargo check --workspace --all-targets            # ok
cargo check --all-targets   (in cardinal/src-tauri) # ok
cargo fmt --check                                # clean (both nightly-2025-12-11 and CI's nightly-2025-05-09)

new tests:

  • useIncludePaths spec: defaults, hydrate, clean+persist, invalid-JSON fallback.
  • useAppPreferences: include-paths-only change path drives setIncludePaths and setWatchConfig.
  • PreferencesOverlay: save-include-paths, validation-blocks-save, include-paths reset to default.

buggerman added 3 commits May 2, 2026 10:07
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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 threads includePaths through useAppPreferences into start_logic / set_watch_config.
  • Extends PreferencesOverlay with an “Include paths” textarea (parse/validate/save/reset behavior aligned with ignore paths).
  • Updates IPC typing (WatchConfigPayload) and adds i18n strings for includePaths across 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.

Comment thread cardinal/src/hooks/useIncludePaths.ts Outdated
`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.
@ldm0
Copy link
Copy Markdown
Member

ldm0 commented May 2, 2026

LGTM, awesome feature addition.

Found several existing issues though, but not related to current PR.

@ldm0 ldm0 merged commit c1cefd9 into cardisoft:master May 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants