Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ baselines, and rc.18 is hidden. A collection that edited its status
definitions (for example their colours) conflicts on that list and the
upgrade is blocked for review; TaskNotes upgrades such a type itself.

rc.21 provides `mdbase.app-settings` 2.0.0 and `tasknotes.settings` 1.1.0 with
inline schemas, and upgrades the settings starter from v1 to v2. New settings
records live at `_mdbase/settings/dev.tasknotes.md`. Clients read the legacy
`_settings/dev.tasknotes.md` only when the new path is absent, save back to the
record they read, and never move it; `_mdbase/settings` wins when both exist.
The 1.0.0 contracts and their schemas stay installed for older types, and rc.20
is hidden.

Starter files are named by revision (`types/tasknotes-task/<revision>.md`); a
revision that does not change the task data keeps the type `version`, so
collections already at that version upgrade without a version conflict.
Expand Down
104 changes: 104 additions & 0 deletions contracts/mdbase.app-settings/2.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
kind: mdbase.contract
contract_type: record
id: mdbase.app-settings
version: 2.0.0
name: App settings
description: One record per app holding the policy that app's clients honour in this collection.
record_schema:
dialect: json-schema-2020-12
value:
$schema: https://json-schema.org/draft/2020-12/schema
title: mdbase.app-settings 2.0.0 record contract view
description: The reserved fields every app settings record shares. Everything else in the record belongs to the app and is described by the app's own settings contract.
type: object
required:
- app
- scope
- settings_version
properties:
app:
type: string
pattern: ^[a-z0-9]+([.-][a-z0-9]+)*$
description: The app whose clients honour these settings, such as tasknotes or dev.mdbase.reader.
scope:
enum:
- collection
- user
description: "Who the values apply to: everyone using the app in this collection, or one person."
user:
type: string
minLength: 1
description: A link to the mdbase.person record the values apply to. Present only when scope is user.
settings_version:
type: integer
minimum: 1
description: The version of the app's settings schema that last wrote the record. A client that does not understand it treats the settings as read-only.
allOf:
- if:
properties:
scope:
const: user
required:
- scope
then:
required:
- user
else:
not:
required:
- user
additionalProperties: true
---

# App settings

An app settings record holds values that every client of one app honours in this
collection, such as how new files are named. The values change client behaviour,
never what another record means.

## Location and identity

A collection-scope record lives at `_mdbase/settings/<app>.md`, where `<app>` is
the record's `app` field. Clients read it by that path, without a query.

A collection set up before 2.0.0 may hold the record at `_settings/<app>.md`, the
1.0.0 location. A client that finds no record at `_mdbase/settings/<app>.md` reads
`_settings/<app>.md`, and saves back to the record it read. Clients never move a
record between the two paths. When both exist, the `_mdbase/settings` record is
used.

Each implementing type declares `collection.unique` on `app` with `scope: type`,
so a collection holds at most one collection-scope record per app.

The record's `type` field names the app's own settings type, not a shared value.
Generic tools find every settings record through this contract.

## Reserved fields

- `app`: the app id.
- `scope`: `collection`, or `user` for one person's overrides.
- `user`: a link to an `mdbase.person` record, present only when `scope` is
`user`.
- `settings_version`: the version of the app's settings schema that last wrote
the record.

Every other frontmatter field belongs to the app and is described by the app's
own settings contract. The body is free Markdown for people; apps never parse it.

## Client behaviour

- A missing record means every setting has its default. Clients never create the
record on read.
- A missing or invalid field takes its default; valid fields are used as
written. The record is not rewritten until someone saves.
- A save patches the record it read, only the fields it changes, guarded by the
record's revision. When there is no record, the save creates it at
`_mdbase/settings/<app>.md`.
- A client that finds a `settings_version` newer than it understands treats the
settings as read-only and uses them as written.

## Authority

This artifact is passive. A settings record grants nothing and must never hold
secrets: anyone who can read or write records can read or edit it.
155 changes: 155 additions & 0 deletions contracts/tasknotes.settings/1.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
---
kind: mdbase.contract
contract_type: record
id: tasknotes.settings
version: 1.1.0
name: TaskNotes settings
description: Collection-wide TaskNotes behaviour, such as templates, archive moves and status cycling.
record_schema:
dialect: json-schema-2020-12
value:
$schema: https://json-schema.org/draft/2020-12/schema
title: tasknotes.settings 1.1.0
description: Collection-wide behaviour that every TaskNotes client honours. Every field is optional and has a default, so a record with none of them behaves like no record at all.
type: object
required:
- app
- scope
- settings_version
properties:
app:
const: dev.tasknotes
description: Marks this record as TaskNotes' settings.
scope:
const: collection
description: These settings apply to everyone using TaskNotes in this collection.
settings_version:
type: integer
minimum: 1
description: The version of these settings that last wrote the record. TaskNotes writes 1.
nlp_triggers:
type: array
items:
type: object
required:
- property_id
- trigger
- enabled
properties:
property_id:
type: string
minLength: 1
trigger:
type: string
minLength: 1
enabled:
type: boolean
additionalProperties: false
description: Natural-language capture triggers, such as @ for contexts. Without the field each client uses its own defaults.
template_enabled:
type: boolean
default: false
description: Apply template_path to the body of new tasks.
template_path:
type: string
description: The template for new task bodies. Empty or absent means none.
occurrence_template_enabled:
type: boolean
default: false
description: Apply occurrence_template_path to new materialized occurrences.
occurrence_template_path:
type: string
description: The template for new occurrence bodies. Empty or absent means none.
template_failure_mode:
enum:
- error
- warning_fallback
description: What a client does when a template cannot be applied.
template_unknown_variable_policy:
enum:
- preserve
- empty
description: What a client writes for a template variable it does not know.
move_on_archive:
type: boolean
default: false
description: Move a task's file to archive_folder when it is archived.
archive_folder:
type: string
description: Where archived tasks move to. Empty or absent means the client's default.
auto_stop_time_tracking_on_complete:
type: boolean
default: false
description: Stop a running timer when its task is completed.
reset_body_checkboxes_on_recurrence:
type: boolean
default: false
description: Uncheck body checkboxes when a recurring task moves to its next occurrence.
link_write_format:
enum:
- wikilink
- markdown
default: wikilink
description: How clients write links into task frontmatter. Both formats are always read.
status_behavior:
type: object
description: Behaviour per status value. A status without an entry has no next status and no auto-archive, and is out of the status cycle exactly when it is a skipped status.
additionalProperties:
type: object
properties:
next_status:
type: string
minLength: 1
description: The status the cycle moves to next.
exclude_from_cycle:
type: boolean
description: Leave this status out of the status cycle.
auto_archive:
type: boolean
description: Archive a task some time after it takes this status.
auto_archive_delay_minutes:
type: number
minimum: 0
description: How long after taking this status a task is archived.
additionalProperties: false
default: {}
additionalProperties: true
---

# TaskNotes settings

The collection's settings record for TaskNotes (`app: dev.tasknotes`) implements
`mdbase.app-settings` 2.0.0, so it lives at `_mdbase/settings/dev.tasknotes.md`, or
at `_settings/dev.tasknotes.md` in a collection set up before then. It shares
that contract's reserved fields (`app`, `scope`, `settings_version`).

These settings change what TaskNotes clients do, never what a task record
means: that stays in the `tasknotes.task` binding of each task type.
`tasknotes.task` 0.3.0-rc.6 moved them here from the binding. A client reads
each setting from this record, then from an earlier binding that still holds
it, then uses its default, so a collection whose task type is still on rc.5
keeps its behaviour until it is upgraded.

## Fields

- `nlp_triggers`: natural-language capture triggers. Without it, each client
uses its own defaults.
- `template_enabled`, `template_path`, `occurrence_template_enabled`,
`occurrence_template_path`, `template_failure_mode`,
`template_unknown_variable_policy`: body templates for new tasks and
materialized occurrences.
- `move_on_archive`, `archive_folder`: whether archiving moves the file, and
where to.
- `auto_stop_time_tracking_on_complete`: stop a running timer on completion.
- `reset_body_checkboxes_on_recurrence`: uncheck body checkboxes when a
recurring task advances.
- `link_write_format`: `wikilink` or `markdown` for links written to task
frontmatter.
- `status_behavior`: per status value, `next_status`, `exclude_from_cycle`,
`auto_archive` and `auto_archive_delay_minutes`. A status without an entry
has no next status and no auto-archive (5 minute delay), and is out of the
cycle exactly when it is a skipped status.

## Authority

This artifact is passive and grants nothing.
104 changes: 104 additions & 0 deletions dist/artifacts/contracts/mdbase.app-settings/2.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
kind: mdbase.contract
contract_type: record
id: mdbase.app-settings
version: 2.0.0
name: App settings
description: One record per app holding the policy that app's clients honour in this collection.
record_schema:
dialect: json-schema-2020-12
value:
$schema: https://json-schema.org/draft/2020-12/schema
title: mdbase.app-settings 2.0.0 record contract view
description: The reserved fields every app settings record shares. Everything else in the record belongs to the app and is described by the app's own settings contract.
type: object
required:
- app
- scope
- settings_version
properties:
app:
type: string
pattern: ^[a-z0-9]+([.-][a-z0-9]+)*$
description: The app whose clients honour these settings, such as tasknotes or dev.mdbase.reader.
scope:
enum:
- collection
- user
description: "Who the values apply to: everyone using the app in this collection, or one person."
user:
type: string
minLength: 1
description: A link to the mdbase.person record the values apply to. Present only when scope is user.
settings_version:
type: integer
minimum: 1
description: The version of the app's settings schema that last wrote the record. A client that does not understand it treats the settings as read-only.
allOf:
- if:
properties:
scope:
const: user
required:
- scope
then:
required:
- user
else:
not:
required:
- user
additionalProperties: true
---

# App settings

An app settings record holds values that every client of one app honours in this
collection, such as how new files are named. The values change client behaviour,
never what another record means.

## Location and identity

A collection-scope record lives at `_mdbase/settings/<app>.md`, where `<app>` is
the record's `app` field. Clients read it by that path, without a query.

A collection set up before 2.0.0 may hold the record at `_settings/<app>.md`, the
1.0.0 location. A client that finds no record at `_mdbase/settings/<app>.md` reads
`_settings/<app>.md`, and saves back to the record it read. Clients never move a
record between the two paths. When both exist, the `_mdbase/settings` record is
used.

Each implementing type declares `collection.unique` on `app` with `scope: type`,
so a collection holds at most one collection-scope record per app.

The record's `type` field names the app's own settings type, not a shared value.
Generic tools find every settings record through this contract.

## Reserved fields

- `app`: the app id.
- `scope`: `collection`, or `user` for one person's overrides.
- `user`: a link to an `mdbase.person` record, present only when `scope` is
`user`.
- `settings_version`: the version of the app's settings schema that last wrote
the record.

Every other frontmatter field belongs to the app and is described by the app's
own settings contract. The body is free Markdown for people; apps never parse it.

## Client behaviour

- A missing record means every setting has its default. Clients never create the
record on read.
- A missing or invalid field takes its default; valid fields are used as
written. The record is not rewritten until someone saves.
- A save patches the record it read, only the fields it changes, guarded by the
record's revision. When there is no record, the save creates it at
`_mdbase/settings/<app>.md`.
- A client that finds a `settings_version` newer than it understands treats the
settings as read-only and uses them as written.

## Authority

This artifact is passive. A settings record grants nothing and must never hold
secrets: anyone who can read or write records can read or edit it.
Loading
Loading