Skip to content

feat: identify tasks by property key regardless of value#2139

Open
jcconnects wants to merge 1 commit into
callumalpass:mainfrom
jcconnects:feat/identify-task-by-property-key
Open

feat: identify tasks by property key regardless of value#2139
jcconnects wants to merge 1 commit into
callumalpass:mainfrom
jcconnects:feat/identify-task-by-property-key

Conversation

@jcconnects

Copy link
Copy Markdown

Closes #2138

What

Allow identifying tasks by a frontmatter property key alone, regardless of its value. In property identification mode, leaving the Task property value field empty now means "match any value": a note is treated as a task whenever the configured property key is present with a non-empty value.

Previously, property-based identification required both a property name and an exact value (frontmatter[name] === value), so a field like status — whose value changes over time (open, in-progress, done, …) — could not be used as the sole task marker.

Why

Common workflows mark a note as actionable by the presence of a field such as status, while the value carries state that changes over time. Requiring a fixed value forces a redundant second identifying field or enumerating every possible value (which isn't supported). See #2138 for the full use case.

This also aligns the detection path with TaskNotes' own generated Bases filters, which already treat an empty value as an "exists / not empty" condition (note["<prop>"] && note["<prop>"] != "" && note["<prop>"] != null) rather than an equality check.

Behavior

  • Empty value → the note is a task if the property key exists with a non-empty value.
    • "Present" = non-empty scalar, non-empty/non-whitespace string, or non-empty array.
    • A present-but-empty value (empty string, whitespace, null, empty array) does not count — matching the Bases filter semantics.
  • Non-empty value → unchanged: exact match, including the existing array-some and boolean (true/false) handling.

No new settings or UI surface — just the existing Task property value field left blank. Its help text is updated across all locales to explain the empty = match-any behavior.

Changes

  • src/utils/taskIdentification.tsisTaskFrontmatter treats an empty configured value as a key-existence check via a new hasNonEmptyValue helper; non-empty values keep exact-match behavior.
  • src/i18n/resources/*.ts — updated taskPropertyValue description in all 9 locales; i18n state/manifest updated for that key only.
  • tests/unit/utils/TaskManager.isTaskFile.test.ts — added cases for match-any (present with any value), present-but-empty, absent, array values, exact-match, and the no-property-name guard.

Testing

  • tsc --noEmit passes.
  • npm test for the task-identification and i18n suites passes (existing + new cases).
  • node scripts/i18n-manager.mjs verify passes (all locales up to date, 0 stale).

When identifying tasks by a frontmatter property, allow leaving the task
property value empty to mean "match any value": a note is treated as a task
whenever the configured property key is present with a non-empty value,
regardless of what that value is (e.g. identify tasks by `status` alone).

Previously property-based identification required both a property name and an
exact value, so a field like `status` whose value changes over time could not
be used as the sole task marker. An empty value now maps to an existence check,
which also aligns the detection path with the generated Bases filters that
already treat an empty value as "exists / not empty".

A present-but-empty value (empty string, whitespace, null, or empty array) does
not count as a task, matching the Bases filter semantics. Providing a value
keeps the existing exact-match behavior unchanged.

Update the task property value setting description across all locales and add
unit tests covering the match-any, exact-match, and empty/absent cases.
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.

[FR]: Identify tasks by a frontmatter property key regardless of its value

1 participant