diff --git a/package.json b/package.json index bb60053e..a7414d61 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@sqlite.org/sqlite-wasm": "3.53.4-build2", "@tanstack/react-virtual": "3.14.11", "@tasknotes/calendar": "0.1.4", - "@tasknotes/model": "0.3.0-rc.19", + "@tasknotes/model": "0.3.0-rc.20", "codemirror": "^6.0.2", "dexie": "4.4.4", "firebase": "12.16.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 96588afe..f2e7977c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -91,8 +91,8 @@ importers: specifier: 0.1.4 version: 0.1.4(react@19.2.8) '@tasknotes/model': - specifier: 0.3.0-rc.19 - version: 0.3.0-rc.19 + specifier: 0.3.0-rc.20 + version: 0.3.0-rc.20 codemirror: specifier: ^6.0.2 version: 6.0.2 @@ -1277,8 +1277,8 @@ packages: react: optional: true - '@tasknotes/model@0.3.0-rc.19': - resolution: {integrity: sha512-OEvRh6hP6yFHDLdyxrswdkwFoUYjP0sDZD8wxnyH+gZT33KbtvM/wmrlJ/gP0Q5NoCs8TgCR7H0j+LJitg7mVA==} + '@tasknotes/model@0.3.0-rc.20': + resolution: {integrity: sha512-Id8bJjU0HhBJAqxJLkJOhtkWjq7MV1JWBm/q0yeTeQLiDw05jctceheh9xiM1hJ86PiH6Qu6E+MVwuxNfUnPJQ==} '@testing-library/dom@10.4.1': resolution: {integrity: sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==} @@ -5507,7 +5507,7 @@ snapshots: optionalDependencies: react: 19.2.8 - '@tasknotes/model@0.3.0-rc.19': + '@tasknotes/model@0.3.0-rc.20': dependencies: rrule: 2.8.1 yaml: 2.9.0 diff --git a/scripts/canonical-task-pack.mjs b/scripts/canonical-task-pack.mjs index 0be63b61..2c030dc0 100644 --- a/scripts/canonical-task-pack.mjs +++ b/scripts/canonical-task-pack.mjs @@ -3,14 +3,14 @@ import { readFile } from "node:fs/promises"; import { resolve } from "node:path"; export const TASKNOTES_CONTRACT_CATALOG_URL = - "https://mdbase.dev/contracts/packs/tasknotes.task/0.3.0-rc.18.json"; + "https://mdbase.dev/contracts/packs/tasknotes.task/0.3.0-rc.19.json"; export const TASKNOTES_CONTRACT_CATALOG_DIGEST = - "sha256:9a9ebc26e6f63ad2fc3d92f87d38f6c140a3af90408de47d667ae7b9ba0dc9ef"; -export const TASKNOTES_APP_TYPE_PACK_VERSION = "0.3.0-rc.18"; + "sha256:ca9ac8ad5c90c7d9a19be226153a32b619b9156f83f95c38ad7ad2346e094b63"; +export const TASKNOTES_APP_TYPE_PACK_VERSION = "0.3.0-rc.19"; export const TASKNOTES_CONTRACT_VENDOR_PATH = resolve( process.cwd(), - "vendor/mdbase-contracts/tasknotes.task-0.3.0-rc.18.json", + "vendor/mdbase-contracts/tasknotes.task-0.3.0-rc.19.json", ); export async function loadCanonicalTaskNotesTypePack() { diff --git a/scripts/tasknotes-manifest.mjs b/scripts/tasknotes-manifest.mjs index ca649046..9739e115 100644 --- a/scripts/tasknotes-manifest.mjs +++ b/scripts/tasknotes-manifest.mjs @@ -63,8 +63,12 @@ export async function buildTaskNotesManifest({ installation_origins: TASKNOTES_INSTALLATION_ORIGINS, requirements: { people: { version: 1, optional: ["identity", "members"] }, + // A provision may only provide contracts the app requires. The task + // pack also provides tasknotes.settings and mdbase.app-settings, for + // the TaskNotes settings record. contracts: [ taskContract, + ...typePack.provides.filter((contract) => contract !== taskContract), ...basePack.provides, ...mdbaseViewPack.provides, ], diff --git a/scripts/tasknotes-manifest.test.mjs b/scripts/tasknotes-manifest.test.mjs index 0e83e69b..b1fddadb 100644 --- a/scripts/tasknotes-manifest.test.mjs +++ b/scripts/tasknotes-manifest.test.mjs @@ -61,9 +61,11 @@ describe("TaskNotes mdbase manifest", () => { expect(manifest.requirements.contracts).toEqual([ expect.objectContaining({ id: "tasknotes.task", - version: "0.3.0-rc.5", + version: "0.3.0-rc.6", digest: expect.stringMatching(/^sha256:[0-9a-f]{64}$/), }), + expect.objectContaining({ id: "tasknotes.settings", version: "1.0.0" }), + expect.objectContaining({ id: "mdbase.app-settings", version: "1.0.0" }), expect.objectContaining({ id: "obsidian.base", version: "1.0.0" }), expect.objectContaining({ id: "mdbase.view", version: "1.0.0" }), ]); @@ -125,12 +127,12 @@ describe("TaskNotes mdbase manifest", () => { }, ]); expect(manifest.provisions.type_packs[0].manifest.resources).toHaveLength( - 4, + 10, ); expect(manifest.provisions.type_packs[0].manifest.version).toBe( TASKNOTES_APP_TYPE_PACK_VERSION, ); - expect(TASKNOTES_APP_TYPE_PACK_VERSION).toBe("0.3.0-rc.18"); + expect(TASKNOTES_APP_TYPE_PACK_VERSION).toBe("0.3.0-rc.19"); const taskSeed = manifest.provisions.type_packs[0].manifest.resources.find( (resource) => resource.kind === "type", ); @@ -140,7 +142,7 @@ describe("TaskNotes mdbase manifest", () => { taskSeed.upgrade_from.map( (baseline) => parse(baseline.document.split("---\n")[1]).version, ), - ).toEqual([4, 3, 2, 1]); + ).toEqual([4, 4, 3, 2, 1]); for (const baseline of taskSeed.upgrade_from) { expect(baseline.digest).toBe( `sha256:${createHash("sha256").update(baseline.document).digest("hex")}`, @@ -335,7 +337,7 @@ describe("TaskNotes mdbase manifest", () => { const implementation = generated.type.implements.find( (candidate) => candidate.contract === "tasknotes.task" && - candidate.version === "0.3.0-rc.5", + candidate.version === "0.3.0-rc.6", ); const field = implementation.fields.sortOrder; expect(generated.type.schema.value.properties[field]).toEqual({ @@ -359,7 +361,7 @@ describe("TaskNotes mdbase manifest", () => { const implementation = generated.type.implements.find( (candidate) => candidate.contract === "tasknotes.task" && - candidate.version === "0.3.0-rc.5", + candidate.version === "0.3.0-rc.6", ); const taskDateSchema = { anyOf: [ diff --git a/src/cloud/next-installation-model.test.ts b/src/cloud/next-installation-model.test.ts index d5e91672..6b523552 100644 --- a/src/cloud/next-installation-model.test.ts +++ b/src/cloud/next-installation-model.test.ts @@ -15,7 +15,7 @@ import { modelResourceInventory } from "../storage/next-model-resources"; import bases from "../../vendor/obsidian-base-1.0.0.json"; import { taskNotesDefaultBaseSources } from "../domain/default-view-source"; import { resourceSetupPlan } from "../test/resource-setup-plan"; -import publisher from "../../vendor/mdbase-contracts/tasknotes.task-0.3.0-rc.18.json"; +import publisher from "../../vendor/mdbase-contracts/tasknotes.task-0.3.0-rc.19.json"; import { initializeModelPackCore } from "./next-model-pack-core"; import { nativeModelPackAssessment, @@ -474,7 +474,7 @@ describe("original Worker model journal and held repository wiring", () => { packs: [ expect.objectContaining({ id: "tasknotes.task", - version: "0.3.0-rc.18", + version: "0.3.0-rc.19", }), expect.objectContaining({ id: "tasknotes.scratch", diff --git a/src/components/task-model-settings.tsx b/src/components/task-model-settings.tsx index bdfe9797..a3c1bfe4 100644 --- a/src/components/task-model-settings.tsx +++ b/src/components/task-model-settings.tsx @@ -10,6 +10,7 @@ import { } from "react"; import { useRepository } from "../app/repository-context"; +import type { TaskModelSettingsAccess } from "../domain/task-configuration"; import { DurationField } from "./duration-field"; import { OperationErrorNotice } from "./operation-error-notice"; import { TaskNotesSelectField } from "./tasknotes-controls"; @@ -80,11 +81,7 @@ export function TaskModelSettingsEditor() { const { t } = useLingui(); const { configuration, repository, updateTaskModelSettings } = useRepository(); - const [access, setAccess] = useState<{ - writable: boolean; - source: string; - reason?: string; - } | null>(null); + const [access, setAccess] = useState(null); const { draft, original, dirty, change, discard } = useTaskModelDraft( repository, configuration, @@ -127,6 +124,11 @@ export function TaskModelSettingsEditor() { }, [dirty]); const writable = access?.writable === true; + // App behaviour lives in the TaskNotes settings record, which can be + // read-only while the task type is writable (an rc.5 collection, or a + // connection that may not change the record). + const appWritable = writable && access?.appSettings?.writable !== false; + const appReason = writable ? access?.appSettings?.reason : undefined; function update(patch: Partial) { change(patch); @@ -206,6 +208,10 @@ export function TaskModelSettingsEditor() {

{access.reason}

+ ) : !appWritable && appReason ? ( +

+ {appReason} +

) : null}
@@ -227,25 +233,27 @@ export function TaskModelSettingsEditor() { onChange={(defaultPriority) => update({ defaultPriority })} /> - update({ templatingEnabled })} - /> - {draft.templatingEnabled ? ( - - ) : null} +
+ update({ templatingEnabled })} + /> + {draft.templatingEnabled ? ( + + ) : null} +
@@ -309,141 +317,147 @@ export function TaskModelSettingsEditor() { update({ maintainDueDateOffset }) } /> - - update({ resetCheckboxesOnRecurrence }) - } - /> +
+ + update({ resetCheckboxesOnRecurrence }) + } + /> +
- update({ moveOnArchive })} - /> - {draft.moveOnArchive ? ( - - ) : null} -
-

- Archive automatically -

-

- - Archive a task once it has been in a chosen status for a while. - Repeating tasks are never archived automatically. - -

-
- {configuration.statuses.map((status) => { - const automation = draft.statusAutomation[status.value] ?? { - autoArchive: false, - autoArchiveDelay: 5, - }; - const inputId = `${ids}-archive-${status.value}`; - function automate(patch: Partial): void { - update({ - statusAutomation: { - ...draft.statusAutomation, - [status.value]: { ...automation, ...patch }, - }, - }); - } - return ( -
-
- - automate({ autoArchive: event.target.checked }) - } - /> - -
- {automation.autoArchive ? ( -
+ {automation.autoArchive ? ( + + ) : null} +
+ ); + })} + +
+
-
- - update({ - writeFormat: value as TaskModelSettingsDraft["writeFormat"], - }) - } +
+
+ + update({ + writeFormat: value as TaskModelSettingsDraft["writeFormat"], + }) + } + /> +

+ + Used when TaskNotes writes links to projects, people, and + other tasks, for example{" "} + + {linkFormat?.description}. +

+
+ update({ autoStopOnComplete })} /> -

- - Used when TaskNotes writes links to projects, people, and other - tasks, for example{" "} - - {linkFormat?.description}. -

-
- update({ autoStopOnComplete })} - /> +
{error ? ( diff --git a/src/demo/demo-task-repository.ts b/src/demo/demo-task-repository.ts index f6185d04..08b54ff4 100644 --- a/src/demo/demo-task-repository.ts +++ b/src/demo/demo-task-repository.ts @@ -7,6 +7,10 @@ import { buildTaskNotesMdbaseResources, patchTaskNotesMdbaseTypeSettings, } from "@tasknotes/model/mdbase"; +import { + buildTaskNotesSettingsPatch, + newTaskNotesSettingsFrontmatter, +} from "@tasknotes/model/settings"; import { parse } from "yaml"; import { completeTaskValues } from "../storage/completions"; @@ -17,7 +21,11 @@ import { findOccurrenceParent, occurrenceRecordId, } from "../domain/task-occurrence"; -import { resolveTaskCollectionConfiguration } from "../domain/task-configuration"; +import { + resolveTaskCollectionConfiguration, + splitTaskModelSettingsPatch, + taskNotesSettingsChanges, +} from "../domain/task-configuration"; import { compareTasks, selectTaskSummaries, @@ -103,6 +111,8 @@ export class DemoTaskRepository implements TaskRepository { readonly files = new DemoFileStore(); private modelDefinition: Record = buildTaskNotesMdbaseResources({ profiles: ["core-lite"] }).type; + /** The demo's TaskNotes settings record, created by the first save. */ + private settingsRecord: Record | undefined; private model = new TaskNotesTaskModel( resolveTaskCollectionConfiguration(this.modelDefinition), ); @@ -839,12 +849,29 @@ export class DemoTaskRepository implements TaskRepository { async updateTaskModelSettings( patch: TaskModelSettingsPatch, ): Promise { - this.modelDefinition = patchTaskNotesMdbaseTypeSettings( - this.modelDefinition, + const split = splitTaskModelSettingsPatch( patch, + this.model.configuration(), + ); + const modelDefinition = patchTaskNotesMdbaseTypeSettings( + this.modelDefinition, + split.type, ); + if (Object.keys(split.app).length) { + const changes = taskNotesSettingsChanges(split.app, this.settingsRecord); + this.settingsRecord = this.settingsRecord + ? applySettingsPatch( + this.settingsRecord, + buildTaskNotesSettingsPatch(this.settingsRecord, changes), + ) + : newTaskNotesSettingsFrontmatter(changes); + } + this.modelDefinition = modelDefinition; this.model = new TaskNotesTaskModel( - resolveTaskCollectionConfiguration(this.modelDefinition), + resolveTaskCollectionConfiguration( + this.modelDefinition, + this.settingsRecord ? { settings: this.settingsRecord } : {}, + ), ); for (const [id, task] of this.tasks) this.tasks.set(id, this.model.read(task)); @@ -1251,3 +1278,15 @@ function nextScratchpadRevision(revision: string): string { function clone(value: T): T { return structuredClone(value); } + +function applySettingsPatch( + frontmatter: Record, + patch: Record, +): Record { + const next = { ...frontmatter }; + for (const [key, value] of Object.entries(patch)) { + if (value === null) delete next[key]; + else next[key] = value; + } + return next; +} diff --git a/src/domain/task-configuration.test.ts b/src/domain/task-configuration.test.ts index 8d14a7cf..e442f358 100644 --- a/src/domain/task-configuration.test.ts +++ b/src/domain/task-configuration.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it } from "vitest"; -import { resolveTaskCollectionConfiguration } from "./task-configuration"; +import { + resolveTaskCollectionConfiguration, + splitTaskModelSettingsPatch, + taskNotesSettingsChanges, +} from "./task-configuration"; function taskType(input: Record): Record { const binding = structuredClone( @@ -92,6 +96,43 @@ describe("TaskNotes collection configuration", () => { }); }); + it("reads the settings record over an rc.5 binding, and the binding over the default", () => { + const rc5 = taskType({ + binding: { + archive: { move_on_archive: true, folder: "Archive/Binding" }, + templating: { enabled: true, template_path: "Templates/Binding.md" }, + }, + }); + const settings = { + app: "dev.tasknotes", + scope: "collection", + settings_version: 1, + archive_folder: "Archive/Record", + }; + + const configuration = resolveTaskCollectionConfiguration(rc5, { + settings, + }); + // The record wins where it has a value; the binding fills the rest. + expect(configuration.archive).toEqual({ + moveOnArchive: true, + folder: "Archive/Record", + }); + expect(configuration.templating).toMatchObject({ + enabled: true, + templatePath: "Templates/Binding.md", + }); + // No record yet (missing or late): the binding's values are kept. + expect(resolveTaskCollectionConfiguration(rc5).archive).toEqual({ + moveOnArchive: true, + folder: "Archive/Binding", + }); + // Neither: the defaults. + expect( + resolveTaskCollectionConfiguration(taskType({})).archive, + ).toMatchObject({ moveOnArchive: false }); + }); + it("resolves skipped statuses and occurrence defaults", () => { const configuration = resolveTaskCollectionConfiguration( taskType({ @@ -310,4 +351,96 @@ describe("TaskNotes collection configuration", () => { }, ]); }); + + it("routes moved settings to the record and the rest to the type, keeping only changes", () => { + const current = resolveTaskCollectionConfiguration( + taskType({ + binding: { + status: { + values: ["open", "done"], + completed_values: ["done"], + default: "open", + }, + archive: { move_on_archive: true, folder: "Archive/Tasks" }, + }, + }), + ); + + const { type, app } = splitTaskModelSettingsPatch( + { + defaultStatus: "done", + recurrence: { + maintainDueDateOffset: false, + resetCheckboxesOnRecurrence: + !current.recurrence.resetCheckboxesOnRecurrence, + }, + links: { writeFormat: "markdown" }, + // Unchanged values never reach the record. + archive: { moveOnArchive: true, folder: "/Archive/Tasks/" }, + templating: { enabled: true, templatePath: " Templates/Task.md " }, + statusAutomation: { + done: { autoArchive: true, autoArchiveDelay: 15 }, + }, + }, + current, + ); + + expect(type).toEqual({ + defaultStatus: "done", + recurrence: { maintainDueDateOffset: false }, + }); + expect(app).toEqual({ + reset_body_checkboxes_on_recurrence: + !current.recurrence.resetCheckboxesOnRecurrence, + link_write_format: "markdown", + template_path: "Templates/Task.md", + template_enabled: true, + status_behavior: { + done: { auto_archive: true, auto_archive_delay_minutes: 15 }, + }, + }); + + expect(() => + splitTaskModelSettingsPatch({ templating: { enabled: true } }, current), + ).toThrow(/template path/); + expect(() => + splitTaskModelSettingsPatch( + { archive: { folder: "../Elsewhere" } }, + current, + ), + ).toThrow(/inside the collection/); + expect(() => + splitTaskModelSettingsPatch( + { statusAutomation: { done: { autoArchiveDelay: -1 } } }, + current, + ), + ).toThrow(/non-negative integer/); + }); + + it("merges a status behaviour change into the record without dropping other statuses", () => { + const record = { + app: "dev.tasknotes", + scope: "collection", + settings_version: 1, + status_behavior: { + open: { next_status: "done" }, + done: { auto_archive: false, exclude_from_cycle: true }, + }, + }; + + expect( + taskNotesSettingsChanges( + { status_behavior: { done: { auto_archive: true } } }, + record, + ), + ).toEqual({ + status_behavior: { + open: { next_status: "done" }, + done: { auto_archive: true, exclude_from_cycle: true }, + }, + }); + expect(taskNotesSettingsChanges({ move_on_archive: true }, record)).toEqual( + { move_on_archive: true }, + ); + }); }); diff --git a/src/domain/task-configuration.ts b/src/domain/task-configuration.ts index 35969998..85947d41 100644 --- a/src/domain/task-configuration.ts +++ b/src/domain/task-configuration.ts @@ -1,6 +1,12 @@ import { resolveModelConfig } from "@tasknotes/model/config"; import { resolveTaskNotesModelConfigFromMdbaseType } from "@tasknotes/model/mdbase"; -import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; +import { + applyTaskNotesAppSettingsToModelConfig, + resolveTaskNotesAppSettings, + type TaskNotesAppSettingsChanges, + type TaskNotesAppSettingsValues, + type TaskNotesStatusBehavior, +} from "@tasknotes/model/settings"; import type { PriorityConfig, @@ -12,13 +18,42 @@ import type { import type { TaskNotesMdbaseTypeSettingsPatch } from "@tasknotes/model/mdbase"; import { editableFieldSchema } from "./editable-field-schema"; +import { taskNotesImplementationOf } from "./tasknotes-contract"; -export type TaskModelSettingsPatch = TaskNotesMdbaseTypeSettingsPatch; +/** + * A settings save as the settings screen describes it. Fields the + * tasknotes.task binding keeps go to the task type; app behaviour + * (templating, archive moves, time tracking, checkbox resets, link format and + * per-status automation) goes to the TaskNotes settings record. See + * splitTaskModelSettingsPatch. + */ +export interface TaskModelSettingsPatch extends Omit< + TaskNotesMdbaseTypeSettingsPatch, + "recurrence" +> { + recurrence?: { + maintainDueDateOffset?: boolean; + resetCheckboxesOnRecurrence?: boolean; + }; + timeTracking?: { autoStopOnComplete?: boolean }; + links?: { writeFormat?: "wikilink" | "markdown" }; + archive?: { moveOnArchive?: boolean; folder?: string }; + templating?: { enabled?: boolean; templatePath?: string }; + statusAutomation?: Record< + string, + { autoArchive?: boolean; autoArchiveDelay?: number } + >; +} export interface TaskModelSettingsAccess { writable: boolean; source: string; reason?: string; + /** + * Whether app behaviour, kept in the TaskNotes settings record, can be + * saved. Absent means it follows `writable`. + */ + appSettings?: { writable: boolean; reason?: string }; } export interface TaskTemplatingConfiguration { @@ -68,10 +103,26 @@ export function defaultTaskCollectionConfiguration(): TaskCollectionConfiguratio */ export function resolveTaskCollectionConfiguration( value: Record, + options: { + /** + * Frontmatter of the TaskNotes settings record, when there is one. Each + * of its fields wins over an earlier binding's, which wins over the + * default, so a missing or late record never loses a value. + */ + settings?: Readonly>; + } = {}, ): TaskCollectionConfiguration { - const base = resolveTaskNotesModelConfigFromMdbaseType(value); - const implementation = taskNotesImplementation(value); + const base = resolveTaskNotesModelConfigFromMdbaseType( + value, + {}, + options.settings ? { settings: options.settings } : {}, + ); + const implementation = taskNotesImplementationOf(value) ?? {}; const extension = record(implementation.binding); + const appSettings = resolveTaskNotesAppSettings(options.settings, { + legacyBinding: extension, + fallback: legacyAliases(extension), + }).values; const schema = record(record(value.schema).value); const properties = record(schema.properties); const required = new Set(stringList(schema.required)); @@ -95,88 +146,219 @@ export function resolveTaskCollectionConfiguration( ); return withCollectionDefaults( - resolveModelConfig({ - ...base, - statuses, - priorities, - occurrences: resolveOccurrences( - base.occurrences, - record(extension.occurrences), - ), - userFields: [ - ...explicitFields, - ...inferredFields.filter((field) => !explicitKeys.has(field.key)), - ], - }), - extension, + applyTaskNotesAppSettingsToModelConfig( + resolveModelConfig({ + ...base, + statuses, + priorities, + occurrences: resolveOccurrences( + base.occurrences, + record(extension.occurrences), + ), + userFields: [ + ...explicitFields, + ...inferredFields.filter((field) => !explicitKeys.has(field.key)), + ], + }), + appSettings, + ), + appSettings, properties, collectionLinks, ); } -function taskNotesImplementation( - value: Record, -): Record { - const implementations = Array.isArray(value.implements) - ? value.implements - : []; - return ( - implementations - .map(record) - .find( - (implementation) => - implementation.contract === "tasknotes.task" && - implementation.version === TASKNOTES_SPEC_VERSION, - ) ?? {} - ); -} +/** The default app folder for archived tasks when the collection names none. */ +export const DEFAULT_ARCHIVE_FOLDER = "TaskNotes/Archive"; function withCollectionDefaults( model: TaskNotesModelConfig, - extension: Record = {}, + settings?: TaskNotesAppSettingsValues, properties: Record = {}, collectionLinks: Record = {}, ): TaskCollectionConfiguration { - const templating = record(extension.templating); - const archive = record(extension.archive); - const links = record(extension.links); return { ...model, templating: { - enabled: boolean(templating.enabled) ?? false, - templatePath: - string(templating.template_path) ?? string(templating.templatePath), - failureMode: - templating.failure_mode === "error" || - templating.failureMode === "error" - ? "error" - : "warning_fallback", + enabled: settings?.template_enabled ?? false, + templatePath: settings?.template_path || undefined, + failureMode: settings?.template_failure_mode ?? "warning_fallback", unknownVariablePolicy: - templating.unknown_variable_policy === "empty" || - templating.unknownVariablePolicy === "empty" - ? "empty" - : "preserve", + settings?.template_unknown_variable_policy ?? "preserve", }, archive: { - moveOnArchive: - boolean(archive.move_on_archive) ?? - boolean(archive.moveOnArchive) ?? - false, - folder: string(archive.folder) ?? "TaskNotes/Archive", + moveOnArchive: settings?.move_on_archive ?? false, + folder: settings?.archive_folder || DEFAULT_ARCHIVE_FOLDER, }, fieldCompletions: completionConfiguration( model, properties, collectionLinks, ), - linkWriteFormat: - links.write_format === "markdown" || - links.writeFormat === "markdown" || - links.use_markdown_format === true || - links.useMarkdownFormat === true - ? "markdown" - : "wikilink", + linkWriteFormat: settings?.link_write_format ?? "wikilink", + }; +} + +/** + * Camel-case spellings early TaskNotes bindings used. They are read after the + * settings record and the binding's own fields. + */ +function legacyAliases( + extension: Record, +): Partial { + const templating = record(extension.templating); + const archive = record(extension.archive); + const links = record(extension.links); + const templatePath = string(templating.templatePath); + const moveOnArchive = boolean(archive.moveOnArchive); + return { + ...(templatePath ? { template_path: templatePath } : {}), + ...(templating.failureMode === "error" || + templating.failureMode === "warning_fallback" + ? { template_failure_mode: templating.failureMode } + : {}), + ...(templating.unknownVariablePolicy === "empty" || + templating.unknownVariablePolicy === "preserve" + ? { template_unknown_variable_policy: templating.unknownVariablePolicy } + : {}), + ...(moveOnArchive !== undefined ? { move_on_archive: moveOnArchive } : {}), + ...(links.writeFormat === "markdown" || + links.use_markdown_format === true || + links.useMarkdownFormat === true + ? { link_write_format: "markdown" as const } + : {}), + }; +} + +/** + * Split a settings save between the task type and the TaskNotes settings + * record. Only app settings whose value differs from `current` become record + * changes. `status_behavior` holds only the statuses that changed; expand it + * with taskNotesSettingsChanges before saving. + */ +export function splitTaskModelSettingsPatch( + patch: TaskModelSettingsPatch, + current: TaskCollectionConfiguration, +): { + type: TaskNotesMdbaseTypeSettingsPatch; + app: TaskNotesAppSettingsChanges; +} { + const type: TaskNotesMdbaseTypeSettingsPatch = { + ...(patch.defaultStatus !== undefined + ? { defaultStatus: patch.defaultStatus } + : {}), + ...(patch.defaultPriority !== undefined + ? { defaultPriority: patch.defaultPriority } + : {}), + ...(patch.recurrence?.maintainDueDateOffset !== undefined + ? { + recurrence: { + maintainDueDateOffset: patch.recurrence.maintainDueDateOffset, + }, + } + : {}), + ...(patch.occurrences ? { occurrences: patch.occurrences } : {}), }; + const app: TaskNotesAppSettingsChanges = {}; + const reset = patch.recurrence?.resetCheckboxesOnRecurrence; + if ( + reset !== undefined && + reset !== current.recurrence.resetCheckboxesOnRecurrence + ) + app.reset_body_checkboxes_on_recurrence = reset; + const autoStop = patch.timeTracking?.autoStopOnComplete; + if ( + autoStop !== undefined && + autoStop !== current.timeTracking.autoStopOnComplete + ) + app.auto_stop_time_tracking_on_complete = autoStop; + const writeFormat = patch.links?.writeFormat; + if (writeFormat !== undefined && writeFormat !== current.linkWriteFormat) + app.link_write_format = writeFormat; + const moveOnArchive = patch.archive?.moveOnArchive; + if ( + moveOnArchive !== undefined && + moveOnArchive !== current.archive.moveOnArchive + ) + app.move_on_archive = moveOnArchive; + if (patch.archive?.folder !== undefined) { + const folder = cleanFolder(patch.archive.folder, "archive folder"); + if ((folder || DEFAULT_ARCHIVE_FOLDER) !== current.archive.folder) + app.archive_folder = folder; + } + const templatePath = + patch.templating?.templatePath !== undefined + ? cleanFolder(patch.templating.templatePath, "template path") + : undefined; + if ( + templatePath !== undefined && + templatePath !== (current.templating.templatePath ?? "") + ) + app.template_path = templatePath; + const templateEnabled = patch.templating?.enabled; + if ( + templateEnabled !== undefined && + templateEnabled !== current.templating.enabled + ) + app.template_enabled = templateEnabled; + if ( + (templateEnabled ?? current.templating.enabled) && + !(templatePath ?? current.templating.templatePath ?? "") + ) + throw new Error( + "template path must be set before task templating is enabled.", + ); + const behaviors: Record = {}; + for (const [value, automation] of Object.entries( + patch.statusAutomation ?? {}, + )) { + const status = current.statuses.find( + (candidate) => candidate.value === value, + ); + if (!status) throw new Error(`Unknown task status "${value}".`); + const delay = automation.autoArchiveDelay; + if (delay !== undefined && (!Number.isInteger(delay) || delay < 0)) + throw new Error( + `Auto-archive delay for "${value}" must be a non-negative integer.`, + ); + const behavior: TaskNotesStatusBehavior = {}; + if ( + automation.autoArchive !== undefined && + automation.autoArchive !== status.autoArchive + ) + behavior.auto_archive = automation.autoArchive; + if (delay !== undefined && delay !== status.autoArchiveDelay) + behavior.auto_archive_delay_minutes = delay; + if (Object.keys(behavior).length) behaviors[value] = behavior; + } + if (Object.keys(behaviors).length) app.status_behavior = behaviors; + return { type, app }; +} + +/** + * The record changes for `app`, with `status_behavior` merged into the map + * the record already holds, so a save never drops another status's entry. + */ +export function taskNotesSettingsChanges( + app: TaskNotesAppSettingsChanges, + frontmatter: Readonly> | undefined, +): TaskNotesAppSettingsChanges { + if (!app.status_behavior) return app; + const stored = + resolveTaskNotesAppSettings(frontmatter).stored.status_behavior ?? {}; + const merged: Record = { + ...structuredClone(stored), + }; + for (const [status, behavior] of Object.entries(app.status_behavior)) + merged[status] = { ...merged[status], ...behavior }; + return { ...app, status_behavior: merged }; +} + +function cleanFolder(value: string, label: string): string { + const path = value.trim().replace(/^\/+|\/+$/g, ""); + if (path.split("/").some((part) => part === ".." || part === ".")) + throw new Error(`The ${label} must stay inside the collection.`); + return path; } function completionConfiguration( @@ -248,22 +430,8 @@ function resolveStatuses( boolean(definition.isSkipped) ?? (skippedValues.size ? skippedValues.has(entry.value) : undefined) ?? entry.isSkipped, - excludeFromCycle: - boolean(definition.exclude_from_cycle) ?? - boolean(definition.excludeFromCycle) ?? - entry.excludeFromCycle, - nextStatus: - string(definition.next_status) ?? - string(definition.nextStatus) ?? - entry.nextStatus, - autoArchive: - boolean(definition.auto_archive) ?? - boolean(definition.autoArchive) ?? - entry.autoArchive, - autoArchiveDelay: - integer(definition.auto_archive_delay_minutes) ?? - integer(definition.autoArchiveDelay) ?? - entry.autoArchiveDelay, + // Cycling and auto-archive are app settings: the settings record, then + // an earlier binding's definitions (see resolveTaskNotesAppSettings). }; }); } diff --git a/src/domain/tasknotes-contract.ts b/src/domain/tasknotes-contract.ts new file mode 100644 index 00000000..35c7e009 --- /dev/null +++ b/src/domain/tasknotes-contract.ts @@ -0,0 +1,62 @@ +import { + TASKNOTES_ACCEPTED_CONTRACT_VERSIONS, + TASKNOTES_CONTRACT_DIGEST, + TASKNOTES_LEGACY_CONTRACT_DIGESTS, +} from "@tasknotes/model/mdbase"; +import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; + +/** + * The tasknotes.task contracts TaskNotes reads, newest first: the current + * contract, then each earlier one whose published digest is known. A type on + * an earlier contract keeps working; its binding may still hold settings the + * current contract moved to the TaskNotes settings record. + */ +export const TASKNOTES_READABLE_CONTRACTS: readonly { + version: string; + digest: string; +}[] = [ + { version: TASKNOTES_SPEC_VERSION, digest: TASKNOTES_CONTRACT_DIGEST }, + ...Object.entries(TASKNOTES_LEGACY_CONTRACT_DIGESTS).map( + ([version, digest]) => ({ version, digest }), + ), +]; + +/** The newest readable tasknotes.task contract a catalog provides. */ +export function readableTaskNotesContract< + Contract extends { id: string; version: string; digest: string }, +>(contracts: readonly Contract[]): Contract | undefined { + for (const readable of TASKNOTES_READABLE_CONTRACTS) { + const match = contracts.find( + (candidate) => + candidate.id === "tasknotes.task" && + candidate.version === readable.version && + candidate.digest === readable.digest, + ); + if (match) return match; + } + return undefined; +} + +/** The newest TaskNotes implementation a type definition declares. */ +export function taskNotesImplementationOf( + definition: Record, +): Record | undefined { + const implementations = Array.isArray(definition.implements) + ? definition.implements.filter( + (candidate): candidate is Record => + candidate !== null && + typeof candidate === "object" && + !Array.isArray(candidate) && + (candidate as Record).contract === "tasknotes.task", + ) + : []; + for (const version of TASKNOTES_ACCEPTED_CONTRACT_VERSIONS) { + const match = implementations.find( + (candidate) => candidate.version === version, + ); + if (match) return match; + } + return undefined; +} + +export const TASKNOTES_MISSING_CONTRACT_MESSAGE = `This collection does not provide tasknotes.task ${TASKNOTES_SPEC_VERSION}.`; diff --git a/src/generated/mdbase-app.json b/src/generated/mdbase-app.json index 13d66b3e..5eed92a8 100644 --- a/src/generated/mdbase-app.json +++ b/src/generated/mdbase-app.json @@ -21,8 +21,18 @@ "contracts": [ { "id": "tasknotes.task", - "version": "0.3.0-rc.5", - "digest": "sha256:dde71d0d776aa0069ee627fe3c10b1a20f87ba36929a16790598ebfb4e8ebf04" + "version": "0.3.0-rc.6", + "digest": "sha256:c400ead6e218b715d86ad31125bb3d4b2e276817da6ba8065449fd0947b24d67" + }, + { + "id": "tasknotes.settings", + "version": "1.0.0", + "digest": "sha256:a61d55535871d27e9599cb3588148a0590d9e2198d6ee7a0bf3197350b60dc53" + }, + { + "id": "mdbase.app-settings", + "version": "1.0.0", + "digest": "sha256:4ae872a56290e2739ff876df1ca8fdac428753c854d65fd8e8e62045bd643a4e" }, { "id": "obsidian.base", @@ -78,9 +88,9 @@ "manifest": { "kind": "mdbase.type-pack", "id": "tasknotes.task", - "version": "0.3.0-rc.18", + "version": "0.3.0-rc.19", "name": "TaskNotes task type pack", - "description": "Portable tasks whose assignments link to person records, with a reviewed, atomic upgrade from every TaskNotes starter published before.", + "description": "Portable tasks whose app behaviour (templates, archive moves, status cycling, time tracking and link format) lives in a TaskNotes settings record, with a reviewed, atomic upgrade from every TaskNotes starter published before.", "resources": [ { "kind": "contract", @@ -89,13 +99,25 @@ "target": "_contracts/tasknotes.task.md", "digest": "sha256:ecadd00700e249940f4244aaa5b5985a96557d13340463ec491dfa5e89b032a4" }, + { + "kind": "contract", + "mode": "managed", + "source": "contracts/tasknotes.task/0.3.0-rc.6.md", + "target": "_contracts/tasknotes.task/0.3.0-rc.6.md", + "digest": "sha256:3f4eb90782948ed68112ffcc99575911036020544cf501de3d2265b588b38456" + }, { "kind": "type", "mode": "seed", - "source": "types/tasknotes-task/5.md", + "source": "types/tasknotes-task/6.md", "target": "_types/task.md", - "digest": "sha256:b3cf8dbe8885b331c494d2eeb36abfb052890e06b757877d655c269e666487dc", + "digest": "sha256:87e52c25b474a06283b29e2983ae4fc6e618fd1a4cbcc5856ff9a67328df605b", "upgrade_from": [ + { + "digest": "sha256:b3cf8dbe8885b331c494d2eeb36abfb052890e06b757877d655c269e666487dc", + "version": 4, + "document": "---\nkind: mdbase.type\nname: task\nversion: 4\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a2\n - none\n - open\n - in-progress\n - done\n - cancelled\n default: open\n priority:\n enum: &a4\n - none\n - low\n - normal\n - high\n default: normal\n due: &a1\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled: *a1\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a3\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n assignees[]:\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.5\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - materialized-occurrences\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a2\n default: open\n completed_values: *a3\n skipped_values:\n - cancelled\n default_skipped: cancelled\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 0\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: open\n label: Open\n color: \"#64748b\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 1\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: in-progress\n label: In progress\n color: \"#3b82f6\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 2\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: done\n label: Done\n color: \"#22c55e\"\n is_completed: true\n is_skipped: false\n exclude_from_cycle: false\n order: 3\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: cancelled\n label: Cancelled\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: true\n exclude_from_cycle: true\n order: 4\n auto_archive: false\n auto_archive_delay_minutes: 5\n priority:\n values: *a4\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n weight: 0\n - value: low\n label: Low\n color: \"#3b82f6\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#f59e0b\"\n weight: 2\n - value: high\n label: High\n color: \"#ef4444\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n reset_body_checkboxes: false\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n write_format: wikilink\n archive:\n archived_tag: archived\n move_on_archive: false\n time_tracking:\n auto_stop_on_complete: false\n templating:\n enabled: false\n occurrence_enabled: false\nx-tasknotes-generator:\n managed_fields:\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n# Task\n\nTask records live under `tasks/`.\n" + }, { "digest": "sha256:2b6016c3543c0dfff491cc6262aed3afd4d672360484174042a261acd1d8ff5f", "version": 4, @@ -121,16 +143,51 @@ { "kind": "schema", "mode": "managed", - "source": "schemas/tasknotes.task/0.3.0-rc.5.schema.json", + "source": "schemas/tasknotes.task/0.3.0-rc.6.schema.json", "target": "_schemas/tasknotes/tasknotes-task.schema.json", - "digest": "sha256:aec95578a093be95cbce0fb500964e7aeaeeacc611624fc2893074637dbd4125" + "digest": "sha256:ac78a55f46669d6e8bd08d608b7c25338fec8ba7606dbf54ebd6b8d4e66b7035" }, { "kind": "schema", "mode": "managed", - "source": "schemas/tasknotes.task.binding/0.3.0-rc.5.schema.json", + "source": "schemas/tasknotes.task.binding/0.3.0-rc.6.schema.json", "target": "_schemas/tasknotes/tasknotes-task-binding.schema.json", - "digest": "sha256:5b38e8a1c426b7f7fa92d8353fe35dd98e632305cbb15ffccde387473166b267" + "digest": "sha256:4f8f3288f593ce06a04525697308173147ff957e7066f83d9a922468d06be659" + }, + { + "kind": "schema", + "mode": "managed", + "source": "schemas/mdbase.app-settings/1.0.0.schema.json", + "target": "schemas/mdbase.app-settings/1.0.0.schema.json", + "digest": "sha256:f37ed43b57fe86465b5bb67216da71d6e351bc1b85bf55a20f95edf886f0749e" + }, + { + "kind": "contract", + "mode": "managed", + "source": "contracts/mdbase.app-settings/1.0.0.md", + "target": "_contracts/mdbase.app-settings/1.0.0.md", + "digest": "sha256:9028d8ccd99cfbb4034399777376315486eb8e699aea7757a6b193743f1084c8" + }, + { + "kind": "schema", + "mode": "managed", + "source": "schemas/tasknotes.settings/1.0.0.schema.json", + "target": "schemas/tasknotes.settings/1.0.0.schema.json", + "digest": "sha256:3a4fc207e14ab1579ca478ce84b25cb8dd85b804b3aa79d01eda08e4554dfbb1" + }, + { + "kind": "contract", + "mode": "managed", + "source": "contracts/tasknotes.settings/1.0.0.md", + "target": "_contracts/tasknotes.settings/1.0.0.md", + "digest": "sha256:e8c25653ef37c032fb4cb1f1c3f7c618092a09c4911a41aba42c0476796fe0d1" + }, + { + "kind": "type", + "mode": "seed", + "source": "types/tasknotes-settings/1.md", + "target": "_types/tasknotes-settings.md", + "digest": "sha256:22ec312c75df356b0b26ba3c46961212efe2803a5d57071fa5753bab7638c2cc" } ] }, @@ -140,23 +197,57 @@ "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: tasknotes.task\nversion: 0.3.0-rc.5\nname: TaskNotes task\ndescription: Portable task data and behavior defined by tasknotes-spec 0.3.0-rc.5.\nrecord_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task.schema.json\n title: TaskNotes portable task view\n description: The storage-neutral record view exposed by the tasknotes.task 0.3.0-rc.5 record contract.\n type: object\n required:\n - status\n - dateCreated\n additionalProperties: false\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n type: string\n minLength: 1\n priority:\n type: string\n minLength: 1\n due:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n pattern: \\S\n description: Links to records implementing mdbase.person, such as [[Alex Rivera]]. Implementing types declare this field in collection.links. These references never grant collection access.\n attachments:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrenceAnchor:\n enum:\n - scheduled\n - completion\n recurrenceParent:\n type: string\n occurrenceDate:\n type: string\n format: date\n occurrenceMaterialization:\n enum:\n - manual\n - on_completion\n - rolling\n occurrenceNextTrigger:\n enum:\n - completion\n - completion_or_skip\n occurrenceTemplate:\n type: string\n occurrencePastHorizon:\n type: string\n occurrenceFutureHorizon:\n type: string\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n reminders:\n type: array\n items:\n type: object\n blockedBy:\n type: array\n items:\n type: object\n completeInstances:\n type: array\n items:\n type: string\n format: date\n skippedInstances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n sortOrder:\n type: string\nbinding_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task-binding.schema.json\n title: TaskNotes task data-contract binding\n description: Semantic configuration supplied by an mdbase type that implements tasknotes.task 0.3.0-rc.3.\n type: object\n required:\n - profiles\n - capabilities\n - title\n - status\n - priority\n - recurrence\n - occurrences\n - links\n - archive\n - time_tracking\n - templating\n properties:\n profiles:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - core-lite\n - recurrence\n - templating\n - materialized-occurrences\n - extended\n capabilities:\n type: array\n uniqueItems: true\n items:\n enum:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - rename\n - archive\n - batch\n - concurrency\n - dry-run\n - migration\n - templating\n title:\n $ref: \"#/$defs/titlePolicy\"\n status:\n $ref: \"#/$defs/statusPolicy\"\n priority:\n $ref: \"#/$defs/priorityPolicy\"\n recurrence:\n $ref: \"#/$defs/recurrencePolicy\"\n occurrences:\n $ref: \"#/$defs/occurrencePolicy\"\n links:\n $ref: \"#/$defs/linkPolicy\"\n archive:\n $ref: \"#/$defs/archivePolicy\"\n time_tracking:\n $ref: \"#/$defs/timeTrackingPolicy\"\n templating:\n $ref: \"#/$defs/templatingPolicy\"\n nlp:\n $ref: \"#/$defs/nlpPolicy\"\n additionalProperties: false\n $defs:\n nonEmptyString:\n type: string\n minLength: 1\n stringSet:\n type: array\n uniqueItems: true\n items:\n $ref: \"#/$defs/nonEmptyString\"\n titlePolicy:\n type: object\n required:\n - storage\n properties:\n storage:\n enum:\n - filename\n - frontmatter\n filename_format:\n enum:\n - title\n - zettel\n - timestamp\n - uuid\n - custom\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n allOf:\n - if:\n properties:\n filename_format:\n const: custom\n required:\n - filename_format\n then:\n properties:\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n required:\n - custom_filename_template\n additionalProperties: true\n statusDefinition:\n type: object\n required:\n - value\n - label\n - color\n - is_completed\n - is_skipped\n - exclude_from_cycle\n - order\n - auto_archive\n - auto_archive_delay_minutes\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n is_completed:\n type: boolean\n is_skipped:\n type: boolean\n exclude_from_cycle:\n type: boolean\n next_status:\n $ref: \"#/$defs/nonEmptyString\"\n order:\n type: number\n auto_archive:\n type: boolean\n auto_archive_delay_minutes:\n type: number\n minimum: 0\n additionalProperties: true\n statusPolicy:\n type: object\n required:\n - values\n - default\n - completed_values\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n completed_values:\n $ref: \"#/$defs/stringSet\"\n skipped_values:\n $ref: \"#/$defs/stringSet\"\n default_skipped:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/statusDefinition\"\n additionalProperties: false\n priorityDefinition:\n type: object\n required:\n - value\n - label\n - color\n - weight\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n weight:\n type: number\n additionalProperties: true\n priorityPolicy:\n type: object\n required:\n - values\n - default\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/priorityDefinition\"\n additionalProperties: false\n recurrencePolicy:\n type: object\n required:\n - syntax\n - maintain_due_date_offset\n - reset_body_checkboxes\n properties:\n syntax:\n const: tasknotes\n maintain_due_date_offset:\n type: boolean\n reset_body_checkboxes:\n type: boolean\n additionalProperties: false\n occurrencePolicy:\n type: object\n required:\n - identity_roles\n - default_materialization\n - default_next_trigger\n properties:\n identity_roles:\n const:\n - recurrenceParent\n - occurrenceDate\n default_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default_next_trigger:\n enum:\n - completion\n - completion_or_skip\n past_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n future_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n linkPolicy:\n type: object\n required:\n - accepted_formats\n - write_format\n properties:\n accepted_formats:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - wikilink\n - markdown\n write_format:\n enum:\n - wikilink\n - markdown\n additionalProperties: false\n archivePolicy:\n type: object\n required:\n - archived_tag\n - move_on_archive\n properties:\n archived_tag:\n $ref: \"#/$defs/nonEmptyString\"\n move_on_archive:\n type: boolean\n folder:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n timeTrackingPolicy:\n type: object\n required:\n - auto_stop_on_complete\n properties:\n auto_stop_on_complete:\n type: boolean\n additionalProperties: false\n templatingPolicy:\n type: object\n required:\n - enabled\n - occurrence_enabled\n properties:\n enabled:\n type: boolean\n template_path:\n $ref: \"#/$defs/nonEmptyString\"\n occurrence_enabled:\n type: boolean\n occurrence_template_path:\n $ref: \"#/$defs/nonEmptyString\"\n failure_mode:\n enum:\n - error\n - warning_fallback\n unknown_variable_policy:\n enum:\n - preserve\n - empty\n additionalProperties: false\n nlpTrigger:\n type: object\n required:\n - property_id\n - trigger\n - enabled\n properties:\n property_id:\n $ref: \"#/$defs/nonEmptyString\"\n trigger:\n $ref: \"#/$defs/nonEmptyString\"\n enabled:\n type: boolean\n additionalProperties: false\n nlpPolicy:\n type: object\n required:\n - triggers\n properties:\n triggers:\n type: array\n items:\n $ref: \"#/$defs/nlpTrigger\"\n additionalProperties: false\n---\n\n# TaskNotes task contract\n\nTypes implement this contract through `implements`; applications consume\nthe normalized contract view rather than assuming frontmatter names.\n" }, { - "source": "types/tasknotes-task/5.md", - "document": "---\nkind: mdbase.type\nname: task\nversion: 4\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a2\n - none\n - open\n - in-progress\n - done\n - cancelled\n default: open\n priority:\n enum: &a4\n - none\n - low\n - normal\n - high\n default: normal\n due: &a1\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled: *a1\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a3\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n assignees[]:\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.5\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - materialized-occurrences\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a2\n default: open\n completed_values: *a3\n skipped_values:\n - cancelled\n default_skipped: cancelled\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 0\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: open\n label: Open\n color: \"#64748b\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 1\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: in-progress\n label: In progress\n color: \"#3b82f6\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 2\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: done\n label: Done\n color: \"#22c55e\"\n is_completed: true\n is_skipped: false\n exclude_from_cycle: false\n order: 3\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: cancelled\n label: Cancelled\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: true\n exclude_from_cycle: true\n order: 4\n auto_archive: false\n auto_archive_delay_minutes: 5\n priority:\n values: *a4\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n weight: 0\n - value: low\n label: Low\n color: \"#3b82f6\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#f59e0b\"\n weight: 2\n - value: high\n label: High\n color: \"#ef4444\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n reset_body_checkboxes: false\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n write_format: wikilink\n archive:\n archived_tag: archived\n move_on_archive: false\n time_tracking:\n auto_stop_on_complete: false\n templating:\n enabled: false\n occurrence_enabled: false\nx-tasknotes-generator:\n managed_fields:\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n# Task\n\nTask records live under `tasks/`.\n" + "source": "contracts/tasknotes.task/0.3.0-rc.6.md", + "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: tasknotes.task\nversion: 0.3.0-rc.6\nname: TaskNotes task\ndescription: Portable task data and behavior defined by tasknotes-spec 0.3.0-rc.6.\nrecord_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task.schema.json\n title: TaskNotes portable task view\n description: The storage-neutral record view exposed by the tasknotes.task 0.3.0-rc.6 record contract.\n type: object\n required:\n - status\n - dateCreated\n additionalProperties: false\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n type: string\n minLength: 1\n priority:\n type: string\n minLength: 1\n due:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n pattern: \\S\n description: Links to records implementing mdbase.person, such as [[Alex Rivera]]. Implementing types declare this field in collection.links. These references never grant collection access.\n attachments:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrenceAnchor:\n enum:\n - scheduled\n - completion\n recurrenceParent:\n type: string\n occurrenceDate:\n type: string\n format: date\n occurrenceMaterialization:\n enum:\n - manual\n - on_completion\n - rolling\n occurrenceNextTrigger:\n enum:\n - completion\n - completion_or_skip\n occurrenceTemplate:\n type: string\n occurrencePastHorizon:\n type: string\n occurrenceFutureHorizon:\n type: string\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n reminders:\n type: array\n items:\n type: object\n blockedBy:\n type: array\n items:\n type: object\n completeInstances:\n type: array\n items:\n type: string\n format: date\n skippedInstances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n sortOrder:\n type: string\nbinding_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task-binding.schema.json\n title: TaskNotes task data-contract binding\n description: Semantic configuration supplied by an mdbase type that implements tasknotes.task 0.3.0-rc.6. App behaviour, such as templates, archive moves, status cycling and natural-language triggers, lives in the app's tasknotes.settings record instead.\n type: object\n required:\n - profiles\n - capabilities\n - title\n - status\n - priority\n - recurrence\n - occurrences\n - links\n - archive\n properties:\n profiles:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - core-lite\n - recurrence\n - templating\n - materialized-occurrences\n - extended\n capabilities:\n type: array\n uniqueItems: true\n items:\n enum:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - rename\n - archive\n - batch\n - concurrency\n - dry-run\n - migration\n - templating\n title:\n $ref: \"#/$defs/titlePolicy\"\n status:\n $ref: \"#/$defs/statusPolicy\"\n priority:\n $ref: \"#/$defs/priorityPolicy\"\n recurrence:\n $ref: \"#/$defs/recurrencePolicy\"\n occurrences:\n $ref: \"#/$defs/occurrencePolicy\"\n links:\n $ref: \"#/$defs/linkPolicy\"\n archive:\n $ref: \"#/$defs/archivePolicy\"\n additionalProperties: false\n $defs:\n nonEmptyString:\n type: string\n minLength: 1\n stringSet:\n type: array\n uniqueItems: true\n items:\n $ref: \"#/$defs/nonEmptyString\"\n titlePolicy:\n type: object\n required:\n - storage\n properties:\n storage:\n enum:\n - filename\n - frontmatter\n filename_format:\n enum:\n - title\n - zettel\n - timestamp\n - uuid\n - custom\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n allOf:\n - if:\n properties:\n filename_format:\n const: custom\n required:\n - filename_format\n then:\n properties:\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n required:\n - custom_filename_template\n additionalProperties: true\n statusDefinition:\n type: object\n required:\n - value\n - label\n - color\n - is_completed\n - is_skipped\n - order\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n is_completed:\n type: boolean\n is_skipped:\n type: boolean\n order:\n type: number\n additionalProperties: true\n statusPolicy:\n type: object\n required:\n - values\n - default\n - completed_values\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n completed_values:\n $ref: \"#/$defs/stringSet\"\n skipped_values:\n $ref: \"#/$defs/stringSet\"\n default_skipped:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/statusDefinition\"\n additionalProperties: false\n priorityDefinition:\n type: object\n required:\n - value\n - label\n - color\n - weight\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n weight:\n type: number\n additionalProperties: true\n priorityPolicy:\n type: object\n required:\n - values\n - default\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/priorityDefinition\"\n additionalProperties: false\n recurrencePolicy:\n type: object\n required:\n - syntax\n - maintain_due_date_offset\n properties:\n syntax:\n const: tasknotes\n maintain_due_date_offset:\n type: boolean\n additionalProperties: false\n occurrencePolicy:\n type: object\n required:\n - identity_roles\n - default_materialization\n - default_next_trigger\n properties:\n identity_roles:\n const:\n - recurrenceParent\n - occurrenceDate\n default_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default_next_trigger:\n enum:\n - completion\n - completion_or_skip\n past_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n future_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n linkPolicy:\n type: object\n required:\n - accepted_formats\n properties:\n accepted_formats:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - wikilink\n - markdown\n additionalProperties: false\n archivePolicy:\n type: object\n required:\n - archived_tag\n properties:\n archived_tag:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n---\n\n# TaskNotes task contract\n\nTypes implement this contract through `implements`; applications consume\nthe normalized contract view rather than assuming frontmatter names.\n" + }, + { + "source": "types/tasknotes-task/6.md", + "document": "---\nkind: mdbase.type\nname: task\nversion: 5\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a2\n - none\n - open\n - in-progress\n - done\n - cancelled\n default: open\n priority:\n enum: &a4\n - none\n - low\n - normal\n - high\n default: normal\n due: &a1\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled: *a1\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a3\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n assignees[]:\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.6\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - materialized-occurrences\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a2\n default: open\n completed_values: *a3\n skipped_values:\n - cancelled\n default_skipped: cancelled\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: false\n order: 0\n - value: open\n label: Open\n color: \"#64748b\"\n is_completed: false\n is_skipped: false\n order: 1\n - value: in-progress\n label: In progress\n color: \"#3b82f6\"\n is_completed: false\n is_skipped: false\n order: 2\n - value: done\n label: Done\n color: \"#22c55e\"\n is_completed: true\n is_skipped: false\n order: 3\n - value: cancelled\n label: Cancelled\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: true\n order: 4\n priority:\n values: *a4\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n weight: 0\n - value: low\n label: Low\n color: \"#3b82f6\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#f59e0b\"\n weight: 2\n - value: high\n label: High\n color: \"#ef4444\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n archive:\n archived_tag: archived\nx-tasknotes-generator:\n managed_fields:\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n# Task\n\nTask records live under `tasks/`.\n" + }, + { + "source": "schemas/tasknotes.task/0.3.0-rc.6.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://tasknotes.dev/schemas/tasknotes-task.schema.json\",\n \"title\": \"TaskNotes portable task view\",\n \"description\": \"The storage-neutral record view exposed by the tasknotes.task 0.3.0-rc.6 record contract.\",\n \"type\": \"object\",\n \"required\": [\n \"status\",\n \"dateCreated\"\n ],\n \"additionalProperties\": false,\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"status\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"priority\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"due\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ]\n },\n \"scheduled\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ]\n },\n \"contexts\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"projects\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"assignees\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"description\": \"Links to records implementing mdbase.person, such as [[Alex Rivera]]. Implementing types declare this field in collection.links. These references never grant collection access.\"\n },\n \"attachments\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"timeEstimate\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"completedDate\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"dateCreated\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"dateModified\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"recurrence\": {\n \"type\": \"string\"\n },\n \"recurrenceAnchor\": {\n \"enum\": [\n \"scheduled\",\n \"completion\"\n ]\n },\n \"recurrenceParent\": {\n \"type\": \"string\"\n },\n \"occurrenceDate\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"occurrenceMaterialization\": {\n \"enum\": [\n \"manual\",\n \"on_completion\",\n \"rolling\"\n ]\n },\n \"occurrenceNextTrigger\": {\n \"enum\": [\n \"completion\",\n \"completion_or_skip\"\n ]\n },\n \"occurrenceTemplate\": {\n \"type\": \"string\"\n },\n \"occurrencePastHorizon\": {\n \"type\": \"string\"\n },\n \"occurrenceFutureHorizon\": {\n \"type\": \"string\"\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"timeEntries\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"reminders\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"blockedBy\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"completeInstances\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"skippedInstances\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"icsEventId\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"googleCalendarEventId\": {\n \"type\": \"string\"\n },\n \"googleCalendarExceptionEventId\": {\n \"type\": \"string\"\n },\n \"googleCalendarExceptionOriginalScheduled\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"googleCalendarMovedOriginalDates\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"sortOrder\": {\n \"type\": \"string\"\n }\n }\n}\n" + }, + { + "source": "schemas/tasknotes.task.binding/0.3.0-rc.6.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://tasknotes.dev/schemas/tasknotes-task-binding.schema.json\",\n \"title\": \"TaskNotes task data-contract binding\",\n \"description\": \"Semantic configuration supplied by an mdbase type that implements tasknotes.task 0.3.0-rc.6. App behaviour, such as templates, archive moves, status cycling and natural-language triggers, lives in the app's tasknotes.settings record instead.\",\n \"type\": \"object\",\n \"required\": [\n \"profiles\",\n \"capabilities\",\n \"title\",\n \"status\",\n \"priority\",\n \"recurrence\",\n \"occurrences\",\n \"links\",\n \"archive\"\n ],\n \"properties\": {\n \"profiles\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"core-lite\",\n \"recurrence\",\n \"templating\",\n \"materialized-occurrences\",\n \"extended\"\n ]\n }\n },\n \"capabilities\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"dependencies\",\n \"reminders\",\n \"attachments\",\n \"links\",\n \"time-tracking\",\n \"materialized-occurrences\",\n \"rename\",\n \"archive\",\n \"batch\",\n \"concurrency\",\n \"dry-run\",\n \"migration\",\n \"templating\"\n ]\n }\n },\n \"title\": {\n \"$ref\": \"#/$defs/titlePolicy\"\n },\n \"status\": {\n \"$ref\": \"#/$defs/statusPolicy\"\n },\n \"priority\": {\n \"$ref\": \"#/$defs/priorityPolicy\"\n },\n \"recurrence\": {\n \"$ref\": \"#/$defs/recurrencePolicy\"\n },\n \"occurrences\": {\n \"$ref\": \"#/$defs/occurrencePolicy\"\n },\n \"links\": {\n \"$ref\": \"#/$defs/linkPolicy\"\n },\n \"archive\": {\n \"$ref\": \"#/$defs/archivePolicy\"\n }\n },\n \"additionalProperties\": false,\n \"$defs\": {\n \"nonEmptyString\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"stringSet\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"titlePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"storage\"\n ],\n \"properties\": {\n \"storage\": {\n \"enum\": [\n \"filename\",\n \"frontmatter\"\n ]\n },\n \"filename_format\": {\n \"enum\": [\n \"title\",\n \"zettel\",\n \"timestamp\",\n \"uuid\",\n \"custom\"\n ]\n },\n \"custom_filename_template\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"filename_format\": {\n \"const\": \"custom\"\n }\n },\n \"required\": [\n \"filename_format\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"custom_filename_template\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"required\": [\n \"custom_filename_template\"\n ]\n }\n }\n ],\n \"additionalProperties\": true\n },\n \"statusDefinition\": {\n \"type\": \"object\",\n \"required\": [\n \"value\",\n \"label\",\n \"color\",\n \"is_completed\",\n \"is_skipped\",\n \"order\"\n ],\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"color\": {\n \"type\": \"string\"\n },\n \"icon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"is_completed\": {\n \"type\": \"boolean\"\n },\n \"is_skipped\": {\n \"type\": \"boolean\"\n },\n \"order\": {\n \"type\": \"number\"\n }\n },\n \"additionalProperties\": true\n },\n \"statusPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"values\",\n \"default\",\n \"completed_values\",\n \"definitions\"\n ],\n \"properties\": {\n \"values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"completed_values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"skipped_values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default_skipped\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"definitions\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/statusDefinition\"\n }\n }\n },\n \"additionalProperties\": false\n },\n \"priorityDefinition\": {\n \"type\": \"object\",\n \"required\": [\n \"value\",\n \"label\",\n \"color\",\n \"weight\"\n ],\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"color\": {\n \"type\": \"string\"\n },\n \"icon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"weight\": {\n \"type\": \"number\"\n }\n },\n \"additionalProperties\": true\n },\n \"priorityPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"values\",\n \"default\",\n \"definitions\"\n ],\n \"properties\": {\n \"values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"definitions\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/priorityDefinition\"\n }\n }\n },\n \"additionalProperties\": false\n },\n \"recurrencePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"syntax\",\n \"maintain_due_date_offset\"\n ],\n \"properties\": {\n \"syntax\": {\n \"const\": \"tasknotes\"\n },\n \"maintain_due_date_offset\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"occurrencePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"identity_roles\",\n \"default_materialization\",\n \"default_next_trigger\"\n ],\n \"properties\": {\n \"identity_roles\": {\n \"const\": [\n \"recurrenceParent\",\n \"occurrenceDate\"\n ]\n },\n \"default_materialization\": {\n \"enum\": [\n \"manual\",\n \"on_completion\",\n \"rolling\"\n ]\n },\n \"default_next_trigger\": {\n \"enum\": [\n \"completion\",\n \"completion_or_skip\"\n ]\n },\n \"past_horizon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"future_horizon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false\n },\n \"linkPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"accepted_formats\"\n ],\n \"properties\": {\n \"accepted_formats\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"wikilink\",\n \"markdown\"\n ]\n }\n }\n },\n \"additionalProperties\": false\n },\n \"archivePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"archived_tag\"\n ],\n \"properties\": {\n \"archived_tag\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false\n }\n }\n}\n" }, { - "source": "schemas/tasknotes.task/0.3.0-rc.5.schema.json", - "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://tasknotes.dev/schemas/tasknotes-task.schema.json\",\n \"title\": \"TaskNotes portable task view\",\n \"description\": \"The storage-neutral record view exposed by the tasknotes.task 0.3.0-rc.5 record contract.\",\n \"type\": \"object\",\n \"required\": [\n \"status\",\n \"dateCreated\"\n ],\n \"additionalProperties\": false,\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"status\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"priority\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"due\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ]\n },\n \"scheduled\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ]\n },\n \"contexts\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"projects\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"assignees\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"description\": \"Links to records implementing mdbase.person, such as [[Alex Rivera]]. Implementing types declare this field in collection.links. These references never grant collection access.\"\n },\n \"attachments\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"timeEstimate\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"completedDate\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"dateCreated\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"dateModified\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"recurrence\": {\n \"type\": \"string\"\n },\n \"recurrenceAnchor\": {\n \"enum\": [\n \"scheduled\",\n \"completion\"\n ]\n },\n \"recurrenceParent\": {\n \"type\": \"string\"\n },\n \"occurrenceDate\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"occurrenceMaterialization\": {\n \"enum\": [\n \"manual\",\n \"on_completion\",\n \"rolling\"\n ]\n },\n \"occurrenceNextTrigger\": {\n \"enum\": [\n \"completion\",\n \"completion_or_skip\"\n ]\n },\n \"occurrenceTemplate\": {\n \"type\": \"string\"\n },\n \"occurrencePastHorizon\": {\n \"type\": \"string\"\n },\n \"occurrenceFutureHorizon\": {\n \"type\": \"string\"\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"timeEntries\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"reminders\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"blockedBy\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"completeInstances\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"skippedInstances\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"icsEventId\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"googleCalendarEventId\": {\n \"type\": \"string\"\n },\n \"googleCalendarExceptionEventId\": {\n \"type\": \"string\"\n },\n \"googleCalendarExceptionOriginalScheduled\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"googleCalendarMovedOriginalDates\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"sortOrder\": {\n \"type\": \"string\"\n }\n }\n}\n" + "source": "schemas/mdbase.app-settings/1.0.0.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"mdbase.app-settings 1.0.0 record contract view\",\n \"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.\",\n \"type\": \"object\",\n \"required\": [\"app\", \"scope\", \"settings_version\"],\n \"properties\": {\n \"app\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9]+([.-][a-z0-9]+)*$\",\n \"description\": \"The app whose clients honour these settings, such as tasknotes or dev.mdbase.reader.\"\n },\n \"scope\": {\n \"enum\": [\"collection\", \"user\"],\n \"description\": \"Who the values apply to: everyone using the app in this collection, or one person.\"\n },\n \"user\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"A link to the mdbase.person record the values apply to. Present only when scope is user.\"\n },\n \"settings_version\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"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.\"\n }\n },\n \"allOf\": [\n {\n \"if\": { \"properties\": { \"scope\": { \"const\": \"user\" } }, \"required\": [\"scope\"] },\n \"then\": { \"required\": [\"user\"] },\n \"else\": { \"not\": { \"required\": [\"user\"] } }\n }\n ],\n \"additionalProperties\": true\n}\n" }, { - "source": "schemas/tasknotes.task.binding/0.3.0-rc.5.schema.json", - "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://tasknotes.dev/schemas/tasknotes-task-binding.schema.json\",\n \"title\": \"TaskNotes task data-contract binding\",\n \"description\": \"Semantic configuration supplied by an mdbase type that implements tasknotes.task 0.3.0-rc.3.\",\n \"type\": \"object\",\n \"required\": [\n \"profiles\",\n \"capabilities\",\n \"title\",\n \"status\",\n \"priority\",\n \"recurrence\",\n \"occurrences\",\n \"links\",\n \"archive\",\n \"time_tracking\",\n \"templating\"\n ],\n \"properties\": {\n \"profiles\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"core-lite\",\n \"recurrence\",\n \"templating\",\n \"materialized-occurrences\",\n \"extended\"\n ]\n }\n },\n \"capabilities\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"dependencies\",\n \"reminders\",\n \"attachments\",\n \"links\",\n \"time-tracking\",\n \"materialized-occurrences\",\n \"rename\",\n \"archive\",\n \"batch\",\n \"concurrency\",\n \"dry-run\",\n \"migration\",\n \"templating\"\n ]\n }\n },\n \"title\": {\n \"$ref\": \"#/$defs/titlePolicy\"\n },\n \"status\": {\n \"$ref\": \"#/$defs/statusPolicy\"\n },\n \"priority\": {\n \"$ref\": \"#/$defs/priorityPolicy\"\n },\n \"recurrence\": {\n \"$ref\": \"#/$defs/recurrencePolicy\"\n },\n \"occurrences\": {\n \"$ref\": \"#/$defs/occurrencePolicy\"\n },\n \"links\": {\n \"$ref\": \"#/$defs/linkPolicy\"\n },\n \"archive\": {\n \"$ref\": \"#/$defs/archivePolicy\"\n },\n \"time_tracking\": {\n \"$ref\": \"#/$defs/timeTrackingPolicy\"\n },\n \"templating\": {\n \"$ref\": \"#/$defs/templatingPolicy\"\n },\n \"nlp\": {\n \"$ref\": \"#/$defs/nlpPolicy\"\n }\n },\n \"additionalProperties\": false,\n \"$defs\": {\n \"nonEmptyString\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"stringSet\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"titlePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"storage\"\n ],\n \"properties\": {\n \"storage\": {\n \"enum\": [\n \"filename\",\n \"frontmatter\"\n ]\n },\n \"filename_format\": {\n \"enum\": [\n \"title\",\n \"zettel\",\n \"timestamp\",\n \"uuid\",\n \"custom\"\n ]\n },\n \"custom_filename_template\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"filename_format\": {\n \"const\": \"custom\"\n }\n },\n \"required\": [\n \"filename_format\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"custom_filename_template\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"required\": [\n \"custom_filename_template\"\n ]\n }\n }\n ],\n \"additionalProperties\": true\n },\n \"statusDefinition\": {\n \"type\": \"object\",\n \"required\": [\n \"value\",\n \"label\",\n \"color\",\n \"is_completed\",\n \"is_skipped\",\n \"exclude_from_cycle\",\n \"order\",\n \"auto_archive\",\n \"auto_archive_delay_minutes\"\n ],\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"color\": {\n \"type\": \"string\"\n },\n \"icon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"is_completed\": {\n \"type\": \"boolean\"\n },\n \"is_skipped\": {\n \"type\": \"boolean\"\n },\n \"exclude_from_cycle\": {\n \"type\": \"boolean\"\n },\n \"next_status\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"order\": {\n \"type\": \"number\"\n },\n \"auto_archive\": {\n \"type\": \"boolean\"\n },\n \"auto_archive_delay_minutes\": {\n \"type\": \"number\",\n \"minimum\": 0\n }\n },\n \"additionalProperties\": true\n },\n \"statusPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"values\",\n \"default\",\n \"completed_values\",\n \"definitions\"\n ],\n \"properties\": {\n \"values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"completed_values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"skipped_values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default_skipped\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"definitions\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/statusDefinition\"\n }\n }\n },\n \"additionalProperties\": false\n },\n \"priorityDefinition\": {\n \"type\": \"object\",\n \"required\": [\n \"value\",\n \"label\",\n \"color\",\n \"weight\"\n ],\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"color\": {\n \"type\": \"string\"\n },\n \"icon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"weight\": {\n \"type\": \"number\"\n }\n },\n \"additionalProperties\": true\n },\n \"priorityPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"values\",\n \"default\",\n \"definitions\"\n ],\n \"properties\": {\n \"values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"definitions\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/priorityDefinition\"\n }\n }\n },\n \"additionalProperties\": false\n },\n \"recurrencePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"syntax\",\n \"maintain_due_date_offset\",\n \"reset_body_checkboxes\"\n ],\n \"properties\": {\n \"syntax\": {\n \"const\": \"tasknotes\"\n },\n \"maintain_due_date_offset\": {\n \"type\": \"boolean\"\n },\n \"reset_body_checkboxes\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"occurrencePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"identity_roles\",\n \"default_materialization\",\n \"default_next_trigger\"\n ],\n \"properties\": {\n \"identity_roles\": {\n \"const\": [\n \"recurrenceParent\",\n \"occurrenceDate\"\n ]\n },\n \"default_materialization\": {\n \"enum\": [\n \"manual\",\n \"on_completion\",\n \"rolling\"\n ]\n },\n \"default_next_trigger\": {\n \"enum\": [\n \"completion\",\n \"completion_or_skip\"\n ]\n },\n \"past_horizon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"future_horizon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false\n },\n \"linkPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"accepted_formats\",\n \"write_format\"\n ],\n \"properties\": {\n \"accepted_formats\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"wikilink\",\n \"markdown\"\n ]\n }\n },\n \"write_format\": {\n \"enum\": [\n \"wikilink\",\n \"markdown\"\n ]\n }\n },\n \"additionalProperties\": false\n },\n \"archivePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"archived_tag\",\n \"move_on_archive\"\n ],\n \"properties\": {\n \"archived_tag\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"move_on_archive\": {\n \"type\": \"boolean\"\n },\n \"folder\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false\n },\n \"timeTrackingPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"auto_stop_on_complete\"\n ],\n \"properties\": {\n \"auto_stop_on_complete\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"templatingPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"enabled\",\n \"occurrence_enabled\"\n ],\n \"properties\": {\n \"enabled\": {\n \"type\": \"boolean\"\n },\n \"template_path\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"occurrence_enabled\": {\n \"type\": \"boolean\"\n },\n \"occurrence_template_path\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"failure_mode\": {\n \"enum\": [\n \"error\",\n \"warning_fallback\"\n ]\n },\n \"unknown_variable_policy\": {\n \"enum\": [\n \"preserve\",\n \"empty\"\n ]\n }\n },\n \"additionalProperties\": false\n },\n \"nlpTrigger\": {\n \"type\": \"object\",\n \"required\": [\n \"property_id\",\n \"trigger\",\n \"enabled\"\n ],\n \"properties\": {\n \"property_id\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"trigger\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"enabled\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"nlpPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"triggers\"\n ],\n \"properties\": {\n \"triggers\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/nlpTrigger\"\n }\n }\n },\n \"additionalProperties\": false\n }\n }\n}\n" + "source": "contracts/mdbase.app-settings/1.0.0.md", + "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: mdbase.app-settings\nversion: 1.0.0\nname: App settings\ndescription: One record per app holding the policy that app's clients honour in this collection.\nrecord_schema:\n dialect: json-schema-2020-12\n ref: ../../schemas/mdbase.app-settings/1.0.0.schema.json\n---\n\n# App settings\n\nAn app settings record holds values that every client of one app honours in this\ncollection, such as how new files are named. The values change client behaviour,\nnever what another record means.\n\n## Location and identity\n\nA collection-scope record lives at `_settings/.md`, where `` is the\nrecord's `app` field. Clients read it by that path, without a query. Each\nimplementing type declares `collection.unique` on `app` with `scope: type`, so a\ncollection holds at most one collection-scope record per app.\n\nThe record's `type` field names the app's own settings type, not a shared value.\nGeneric tools find every settings record through this contract.\n\n## Reserved fields\n\n- `app`: the app id.\n- `scope`: `collection`, or `user` for one person's overrides.\n- `user`: a link to an `mdbase.person` record, present only when `scope` is\n `user`.\n- `settings_version`: the version of the app's settings schema that last wrote\n the record.\n\nEvery other frontmatter field belongs to the app and is described by the app's\nown settings contract. The body is free Markdown for people; apps never parse it.\n\n## Client behaviour\n\n- A missing record means every setting has its default. Clients never create the\n record on read.\n- A missing or invalid field takes its default; valid fields are used as\n written. The record is not rewritten until someone saves.\n- A save creates the record at its fixed path the first time, and otherwise\n patches only the fields it changes, guarded by the record's revision.\n- A client that finds a `settings_version` newer than it understands treats the\n settings as read-only and uses them as written.\n\n## Authority\n\nThis artifact is passive. A settings record grants nothing and must never hold\nsecrets: anyone who can read or write records can read or edit it.\n" + }, + { + "source": "schemas/tasknotes.settings/1.0.0.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"tasknotes.settings 1.0.0\",\n \"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.\",\n \"type\": \"object\",\n \"required\": [\n \"app\",\n \"scope\",\n \"settings_version\"\n ],\n \"properties\": {\n \"app\": {\n \"const\": \"dev.tasknotes\",\n \"description\": \"Marks this record as TaskNotes' settings.\"\n },\n \"scope\": {\n \"const\": \"collection\",\n \"description\": \"These settings apply to everyone using TaskNotes in this collection.\"\n },\n \"settings_version\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"description\": \"The version of these settings that last wrote the record. TaskNotes writes 1.\"\n },\n \"nlp_triggers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"property_id\",\n \"trigger\",\n \"enabled\"\n ],\n \"properties\": {\n \"property_id\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"trigger\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"enabled\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"description\": \"Natural-language capture triggers, such as @ for contexts. Without the field each client uses its own defaults.\"\n },\n \"template_enabled\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Apply template_path to the body of new tasks.\"\n },\n \"template_path\": {\n \"type\": \"string\",\n \"description\": \"The template for new task bodies. Empty or absent means none.\"\n },\n \"occurrence_template_enabled\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Apply occurrence_template_path to new materialized occurrences.\"\n },\n \"occurrence_template_path\": {\n \"type\": \"string\",\n \"description\": \"The template for new occurrence bodies. Empty or absent means none.\"\n },\n \"template_failure_mode\": {\n \"enum\": [\n \"error\",\n \"warning_fallback\"\n ],\n \"description\": \"What a client does when a template cannot be applied.\"\n },\n \"template_unknown_variable_policy\": {\n \"enum\": [\n \"preserve\",\n \"empty\"\n ],\n \"description\": \"What a client writes for a template variable it does not know.\"\n },\n \"move_on_archive\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Move a task's file to archive_folder when it is archived.\"\n },\n \"archive_folder\": {\n \"type\": \"string\",\n \"description\": \"Where archived tasks move to. Empty or absent means the client's default.\"\n },\n \"auto_stop_time_tracking_on_complete\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Stop a running timer when its task is completed.\"\n },\n \"reset_body_checkboxes_on_recurrence\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Uncheck body checkboxes when a recurring task moves to its next occurrence.\"\n },\n \"link_write_format\": {\n \"enum\": [\n \"wikilink\",\n \"markdown\"\n ],\n \"default\": \"wikilink\",\n \"description\": \"How clients write links into task frontmatter. Both formats are always read.\"\n },\n \"status_behavior\": {\n \"type\": \"object\",\n \"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.\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"properties\": {\n \"next_status\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The status the cycle moves to next.\"\n },\n \"exclude_from_cycle\": {\n \"type\": \"boolean\",\n \"description\": \"Leave this status out of the status cycle.\"\n },\n \"auto_archive\": {\n \"type\": \"boolean\",\n \"description\": \"Archive a task some time after it takes this status.\"\n },\n \"auto_archive_delay_minutes\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"description\": \"How long after taking this status a task is archived.\"\n }\n },\n \"additionalProperties\": false\n },\n \"default\": {}\n }\n },\n \"additionalProperties\": true\n}\n" + }, + { + "source": "contracts/tasknotes.settings/1.0.0.md", + "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: tasknotes.settings\nversion: 1.0.0\nname: TaskNotes settings\ndescription: Collection-wide TaskNotes behaviour, such as templates, archive moves and status cycling.\nrecord_schema:\n dialect: json-schema-2020-12\n ref: ../../schemas/tasknotes.settings/1.0.0.schema.json\n---\n\n# TaskNotes settings\n\nThe collection's settings record for TaskNotes, at `_settings/dev.tasknotes.md`.\nIt also implements `mdbase.app-settings`, whose reserved fields (`app`, `scope`,\n`settings_version`) it shares.\n\nThese settings change what TaskNotes clients do, never what a task record\nmeans: that stays in the `tasknotes.task` binding of each task type.\n`tasknotes.task` 0.3.0-rc.6 moved them here from the binding. A client reads\neach setting from this record, then from an earlier binding that still holds\nit, then uses its default, so a collection whose task type is still on rc.5\nkeeps its behaviour until it is upgraded.\n\n## Fields\n\n- `nlp_triggers`: natural-language capture triggers. Without it, each client\n uses its own defaults.\n- `template_enabled`, `template_path`, `occurrence_template_enabled`,\n `occurrence_template_path`, `template_failure_mode`,\n `template_unknown_variable_policy`: body templates for new tasks and\n materialized occurrences.\n- `move_on_archive`, `archive_folder`: whether archiving moves the file, and\n where to.\n- `auto_stop_time_tracking_on_complete`: stop a running timer on completion.\n- `reset_body_checkboxes_on_recurrence`: uncheck body checkboxes when a\n recurring task advances.\n- `link_write_format`: `wikilink` or `markdown` for links written to task\n frontmatter.\n- `status_behavior`: per status value, `next_status`, `exclude_from_cycle`,\n `auto_archive` and `auto_archive_delay_minutes`. A status without an entry\n has no next status and no auto-archive (5 minute delay), and is out of the\n cycle exactly when it is a skipped status.\n\n## Authority\n\nThis artifact is passive and grants nothing.\n" + }, + { + "source": "types/tasknotes-settings/1.md", + "document": "---\nkind: mdbase.type\nname: tasknotes-settings\nversion: 1\ndescription: TaskNotes' collection-wide settings, one record at _settings/dev.tasknotes.md.\nmatch:\n where:\n app:\n eq: dev.tasknotes\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n title: tasknotes.settings 1.0.0\n 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.\n type: object\n required:\n - app\n - scope\n - settings_version\n properties:\n app:\n const: dev.tasknotes\n description: Marks this record as TaskNotes' settings.\n scope:\n const: collection\n description: These settings apply to everyone using TaskNotes in this collection.\n settings_version:\n type: integer\n minimum: 1\n description: The version of these settings that last wrote the record. TaskNotes writes 1.\n nlp_triggers:\n type: array\n items:\n type: object\n required:\n - property_id\n - trigger\n - enabled\n properties:\n property_id:\n type: string\n minLength: 1\n trigger:\n type: string\n minLength: 1\n enabled:\n type: boolean\n additionalProperties: false\n description: Natural-language capture triggers, such as @ for contexts. Without the field each client uses its own defaults.\n template_enabled:\n type: boolean\n default: false\n description: Apply template_path to the body of new tasks.\n template_path:\n type: string\n description: The template for new task bodies. Empty or absent means none.\n occurrence_template_enabled:\n type: boolean\n default: false\n description: Apply occurrence_template_path to new materialized occurrences.\n occurrence_template_path:\n type: string\n description: The template for new occurrence bodies. Empty or absent means none.\n template_failure_mode:\n enum:\n - error\n - warning_fallback\n description: What a client does when a template cannot be applied.\n template_unknown_variable_policy:\n enum:\n - preserve\n - empty\n description: What a client writes for a template variable it does not know.\n move_on_archive:\n type: boolean\n default: false\n description: Move a task's file to archive_folder when it is archived.\n archive_folder:\n type: string\n description: Where archived tasks move to. Empty or absent means the client's default.\n auto_stop_time_tracking_on_complete:\n type: boolean\n default: false\n description: Stop a running timer when its task is completed.\n reset_body_checkboxes_on_recurrence:\n type: boolean\n default: false\n description: Uncheck body checkboxes when a recurring task moves to its next occurrence.\n link_write_format:\n enum:\n - wikilink\n - markdown\n default: wikilink\n description: How clients write links into task frontmatter. Both formats are always read.\n status_behavior:\n type: object\n 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.\n additionalProperties:\n type: object\n properties:\n next_status:\n type: string\n minLength: 1\n description: The status the cycle moves to next.\n exclude_from_cycle:\n type: boolean\n description: Leave this status out of the status cycle.\n auto_archive:\n type: boolean\n description: Archive a task some time after it takes this status.\n auto_archive_delay_minutes:\n type: number\n minimum: 0\n description: How long after taking this status a task is archived.\n additionalProperties: false\n default: {}\n additionalProperties: true\ncollection:\n unique:\n - field: app\n scope: type\nimplements:\n - contract: mdbase.app-settings\n version: 1.0.0\n fields:\n app: app\n scope: scope\n settings_version: settings_version\n - contract: tasknotes.settings\n version: 1.0.0\n fields:\n app: app\n scope: scope\n settings_version: settings_version\n nlp_triggers: nlp_triggers\n template_enabled: template_enabled\n template_path: template_path\n occurrence_template_enabled: occurrence_template_enabled\n occurrence_template_path: occurrence_template_path\n template_failure_mode: template_failure_mode\n template_unknown_variable_policy: template_unknown_variable_policy\n move_on_archive: move_on_archive\n archive_folder: archive_folder\n auto_stop_time_tracking_on_complete: auto_stop_time_tracking_on_complete\n reset_body_checkboxes_on_recurrence: reset_body_checkboxes_on_recurrence\n link_write_format: link_write_format\n status_behavior: status_behavior\n---\n\n# TaskNotes settings\n\nSettings that every TaskNotes client honours in this collection, such as body\ntemplates, archive moves and status cycling. TaskNotes reads them from\n`_settings/dev.tasknotes.md` and writes only the fields a save changes.\n" } ], "provides": [ { "id": "tasknotes.task", - "version": "0.3.0-rc.5", - "digest": "sha256:dde71d0d776aa0069ee627fe3c10b1a20f87ba36929a16790598ebfb4e8ebf04" + "version": "0.3.0-rc.6", + "digest": "sha256:c400ead6e218b715d86ad31125bb3d4b2e276817da6ba8065449fd0947b24d67" + }, + { + "id": "tasknotes.settings", + "version": "1.0.0", + "digest": "sha256:a61d55535871d27e9599cb3588148a0590d9e2198d6ee7a0bf3197350b60dc53" + }, + { + "id": "mdbase.app-settings", + "version": "1.0.0", + "digest": "sha256:4ae872a56290e2739ff876df1ca8fdac428753c854d65fd8e8e62045bd643a4e" } ] }, diff --git a/src/storage/app-settings-store.test.ts b/src/storage/app-settings-store.test.ts new file mode 100644 index 00000000..113d9c8e --- /dev/null +++ b/src/storage/app-settings-store.test.ts @@ -0,0 +1,94 @@ +import { tasknotesSettingsDefinition } from "@tasknotes/model/settings"; +import { describe, expect, it, vi } from "vitest"; + +import { + AppSettingsStore, + type AppSettingsRecord, + type AppSettingsRecordPort, +} from "./app-settings-store"; + +/** One settings record behind a port, revisioned like a collection. */ +function recordPort(initial?: Record) { + let record: AppSettingsRecord | null = initial + ? { frontmatter: initial, revision: "r1" } + : null; + let revision = 1; + const next = (frontmatter: Record) => + (record = { frontmatter, revision: `r${(revision += 1)}` }); + const port = { + read: vi.fn(async () => record), + create: vi.fn(async (input: { frontmatter: Record }) => + next(input.frontmatter), + ), + update: vi.fn( + async (input: { revision?: string; patch: Record }) => { + if (input.revision !== record?.revision) + throw new Error("concurrent_modification"); + const frontmatter = { ...record!.frontmatter }; + for (const [key, value] of Object.entries(input.patch)) + if (value === null) delete frontmatter[key]; + else frontmatter[key] = value; + return next(frontmatter); + }, + ), + classify: (reason: unknown) => + reason instanceof Error && reason.message === "concurrent_modification" + ? ("raced" as const) + : undefined, + } satisfies AppSettingsRecordPort; + /** Another client's write. */ + const external = (patch: Record) => + next({ ...record!.frontmatter, ...patch }); + return { port, external }; +} + +const RECORD = { + app: "dev.tasknotes", + scope: "collection", + settings_version: 1, + archive_folder: "Archive", + move_on_archive: true, +}; + +describe("app settings store", () => { + it("creates the record on the first save and then patches only changed fields", async () => { + const { port } = recordPort(); + const store = new AppSettingsStore(port, tasknotesSettingsDefinition); + expect((await store.current()).settings.values.move_on_archive).toBe(false); + expect(port.create).not.toHaveBeenCalled(); + + await store.save({ move_on_archive: true }); + expect(port.create).toHaveBeenCalledOnce(); + expect(port.create.mock.calls[0]![0].frontmatter).toEqual({ + app: "dev.tasknotes", + scope: "collection", + settings_version: 1, + move_on_archive: true, + }); + + const saved = await store.save({ + move_on_archive: true, + archive_folder: "Done", + }); + expect(saved.ok).toBe(true); + expect(port.update.mock.calls.map(([input]) => input.patch)).toEqual([ + { archive_folder: "Done" }, + ]); + }); + + it("refuses a save that conflicts with another client's change, writing nothing", async () => { + const { port, external } = recordPort(RECORD); + const store = new AppSettingsStore(port, tasknotesSettingsDefinition); + const prepared = await store.current(); + external({ archive_folder: "Elsewhere" }); + await store.reload(); + + const result = await store.save({ archive_folder: "Mine" }, prepared); + expect(result).toMatchObject({ + ok: false, + reason: "conflict", + fields: ["archive_folder"], + }); + expect(port.update).not.toHaveBeenCalled(); + }); +}); diff --git a/src/storage/app-settings-store.ts b/src/storage/app-settings-store.ts new file mode 100644 index 00000000..c3944a28 --- /dev/null +++ b/src/storage/app-settings-store.ts @@ -0,0 +1,276 @@ +/** + * One app's collection-scope settings record (mdbase.app-settings 1.0.0), + * modelled on mdbase Reader's store: read by path, defaults when it is + * missing, created on the first save, then patched field by field against the + * revision that was read. Nothing here creates the record on read or rewrites + * it to repair a field: an unusable field takes its default with a warning + * until someone saves it. + * + * The store is storage-neutral. Each repository supplies a port over its own + * client and says how that client's failures read: a missing record, a + * refusal for lack of access, or a race with another writer. + */ +import { + appSettingsPatch, + appSettingsPath, + conflictingAppSettings, + defaultAppSettings, + newAppSettingsFrontmatter, + resolveAppSettings, + type AppSettingsChanges, + type AppSettingsDefinition, + type ResolvedAppSettings, +} from "@tasknotes/model/settings"; + +export interface AppSettingsRecord { + readonly frontmatter: Readonly>; + readonly revision?: string; +} + +/** How a port failure reads. Anything else is a plain failure. */ +export type AppSettingsFailure = "not_found" | "read_only" | "raced"; + +export interface AppSettingsRecordPort { + /** The record, or null when there is none (a `not_found` failure also means none). */ + read(path: string, signal?: AbortSignal): Promise; + create( + input: { + path: string; + type: string; + frontmatter: Record; + }, + signal?: AbortSignal, + ): Promise; + /** `patch` sets fields; a null value removes the field. */ + update( + input: { + path: string; + revision?: string; + patch: Record; + }, + signal?: AbortSignal, + ): Promise; + classify(reason: unknown): AppSettingsFailure | undefined; +} + +export interface AppSettingsSnapshot { + /** `loading` until the first read, `failed` when it could not be read: defaults apply. */ + readonly status: "loading" | "ready" | "failed"; + readonly settings: ResolvedAppSettings; + /** The record's frontmatter as read; undefined when there is no record (yet). */ + readonly frontmatter?: Readonly>; + readonly revision?: string; + readonly problem?: string; +} + +export type AppSettingsSaveResult = + | { readonly ok: true; readonly snapshot: AppSettingsSnapshot } + | { + readonly ok: false; + /** + * `conflict`: someone else changed `fields` since the save was prepared; + * nothing was written. `read_only`: this client may not change these + * settings. `failed`: anything else. + */ + readonly reason: "conflict" | "read_only" | "failed"; + readonly message: string; + readonly fields?: readonly string[]; + readonly snapshot: AppSettingsSnapshot; + }; + +export const APP_SETTINGS_READ_ONLY_MESSAGE = + "This connection cannot change the collection's settings."; +export const APP_SETTINGS_CONFLICT_MESSAGE = + "These settings were changed somewhere else. Review them and save again."; + +export class AppSettingsStore { + readonly path: string; + #snapshot: AppSettingsSnapshot; + /** Set when a write was refused for lack of access; it holds for this store. */ + #refused: string | undefined; + + constructor( + private readonly port: AppSettingsRecordPort, + private readonly definition: AppSettingsDefinition, + ) { + this.path = appSettingsPath(definition.app); + this.#snapshot = { + status: "loading", + settings: defaultAppSettings(definition), + }; + } + + getSnapshot(): AppSettingsSnapshot { + return this.#snapshot; + } + + /** The settings as last read, reading them first when they have not been. */ + async current(signal?: AbortSignal): Promise> { + return this.#snapshot.status === "ready" + ? this.#snapshot + : this.reload(signal); + } + + /** Read the record again. A read failure gives defaults, read-only. */ + async reload(signal?: AbortSignal): Promise> { + // No record: the defaults. The first save creates it, never a read. + const missing = () => + this.#withRefusal({ + status: "ready", + settings: defaultAppSettings(this.definition), + }); + let snapshot: AppSettingsSnapshot; + try { + const record = await this.port.read(this.path, signal); + snapshot = record ? this.#resolved(record) : missing(); + } catch (reason) { + signal?.throwIfAborted(); + snapshot = + this.port.classify(reason) === "not_found" + ? missing() + : this.#failed(message(reason, "The settings could not be read.")); + } + this.#snapshot = snapshot; + return snapshot; + } + + /** + * Save `changes`: a value per changed setting, or null to go back to its + * default. `prepared` is the snapshot the changes were made against + * (default: the settings as now read); a setting someone else changed since + * then is a conflict, and nothing is written. A write that races another + * writer is read again and retried once. + */ + async save( + changes: AppSettingsChanges, + prepared?: AppSettingsSnapshot, + signal?: AbortSignal, + ): Promise> { + let latest = await this.current(signal); + const base = (prepared ?? latest).frontmatter; + for (let attempt = 0; ; attempt += 1) { + const refused = this.#refuseBefore(latest, base, changes); + if (refused) return refused; + const written = await this.#write(latest, changes, signal); + if (!("raced" in written)) return written; + if (attempt > 0) return this.#refusal("failed", written.raced); + // Someone else created or changed the record first: read it, go again once. + latest = await this.reload(signal); + } + } + + #refuseBefore( + latest: AppSettingsSnapshot, + base: Readonly> | undefined, + changes: AppSettingsChanges, + ): AppSettingsSaveResult | undefined { + if (latest.status === "failed") + return this.#refusal( + "failed", + latest.problem ?? "The settings could not be read.", + ); + if (latest.settings.readOnly) + return this.#refusal("read_only", latest.settings.readOnly); + const conflicts = conflictingAppSettings( + this.definition, + base, + latest.frontmatter ?? {}, + changes, + ); + return conflicts.length + ? this.#refusal("conflict", APP_SETTINGS_CONFLICT_MESSAGE, conflicts) + : undefined; + } + + async #write( + latest: AppSettingsSnapshot, + changes: AppSettingsChanges, + signal?: AbortSignal, + ): Promise | { readonly raced: string }> { + let record: AppSettingsRecord; + try { + if (latest.frontmatter) { + const patch = appSettingsPatch( + this.definition, + latest.frontmatter, + changes, + ); + if (!Object.keys(patch).length) return { ok: true, snapshot: latest }; + record = await this.port.update( + { + path: this.path, + ...(latest.revision ? { revision: latest.revision } : {}), + patch, + }, + signal, + ); + } else { + const frontmatter = newAppSettingsFrontmatter(this.definition, changes); + record = await this.port.create( + { path: this.path, type: this.definition.type, frontmatter }, + signal, + ); + } + } catch (reason) { + signal?.throwIfAborted(); + const failure = this.port.classify(reason); + if (failure === "read_only") { + this.#refused = APP_SETTINGS_READ_ONLY_MESSAGE; + this.#snapshot = this.#withRefusal(this.#snapshot); + return this.#refusal("read_only", this.#refused); + } + const text = message(reason, "The settings could not be saved."); + return failure === "raced" + ? { raced: text } + : this.#refusal("failed", text); + } + this.#snapshot = this.#resolved(record); + return { ok: true, snapshot: this.#snapshot }; + } + + #resolved(record: AppSettingsRecord): AppSettingsSnapshot { + return this.#withRefusal({ + status: "ready", + settings: resolveAppSettings(this.definition, record.frontmatter), + frontmatter: record.frontmatter, + ...(record.revision ? { revision: record.revision } : {}), + }); + } + + #failed(problem: string): AppSettingsSnapshot { + return { + status: "failed", + settings: { ...defaultAppSettings(this.definition), readOnly: problem }, + problem, + }; + } + + #withRefusal( + snapshot: AppSettingsSnapshot, + ): AppSettingsSnapshot { + return this.#refused && !snapshot.settings.readOnly + ? { + ...snapshot, + settings: { ...snapshot.settings, readOnly: this.#refused }, + } + : snapshot; + } + + #refusal( + reason: "conflict" | "read_only" | "failed", + text: string, + fields?: readonly string[], + ): AppSettingsSaveResult { + return { + ok: false, + reason, + message: text, + ...(fields ? { fields } : {}), + snapshot: this.#snapshot, + }; + } +} + +function message(reason: unknown, fallback: string): string { + return reason instanceof Error && reason.message ? reason.message : fallback; +} diff --git a/src/storage/mdbase-app-settings.ts b/src/storage/mdbase-app-settings.ts new file mode 100644 index 00000000..6ea3c568 --- /dev/null +++ b/src/storage/mdbase-app-settings.ts @@ -0,0 +1,79 @@ +import type { JsonObject, MdbaseConnection } from "@mdbase-dev/connect"; +import { + tasknotesSettingsDefinition, + type TaskNotesAppSettingsValues, +} from "@tasknotes/model/settings"; + +import { connectProblemFromError } from "../cloud/outcome"; +import { + AppSettingsStore, + type AppSettingsFailure, + type AppSettingsRecord, +} from "./app-settings-store"; +import { validResult } from "./mdbase-operation"; + +/** + * How Connect problems read for a settings record, as in mdbase Reader: + * `file_not_found` is no record; `not_authorized` and `access_denied` are a + * connection that may not change it; `concurrent_modification` and + * `path_taken` are a race with another writer. + */ +export function classifyConnectSettingsFailure( + reason: unknown, +): AppSettingsFailure | undefined { + const code = connectProblemFromError(reason)?.code; + if (code === "file_not_found") return "not_found"; + if (code === "not_authorized" || code === "access_denied") return "read_only"; + if (code === "concurrent_modification" || code === "path_taken") + return "raced"; + return undefined; +} + +/** The TaskNotes settings record over a Connect connection. */ +export function connectTaskNotesSettingsStore( + connect: MdbaseConnection, + request: () => { signal: AbortSignal }, +): AppSettingsStore { + const record = (value: { + frontmatter?: JsonObject; + revision?: string; + }): AppSettingsRecord => ({ + frontmatter: value.frontmatter ?? {}, + ...(value.revision ? { revision: value.revision } : {}), + }); + return new AppSettingsStore( + { + read: async (path) => + record(validResult(await connect.read({ path }, request()))), + create: async (input) => + record( + validResult( + await connect.create( + { + path: input.path, + type: input.type, + frontmatter: input.frontmatter as JsonObject, + body: "", + }, + request(), + ), + ), + ), + update: async (input) => + record( + validResult( + await connect.update( + { + path: input.path, + patch: input.patch as JsonObject, + ...(input.revision ? { ifRevision: input.revision } : {}), + }, + request(), + ), + ), + ), + classify: classifyConnectSettingsFailure, + }, + tasknotesSettingsDefinition, + ); +} diff --git a/src/storage/mdbase-repository.test.ts b/src/storage/mdbase-repository.test.ts index 72dcb571..2233aa32 100644 --- a/src/storage/mdbase-repository.test.ts +++ b/src/storage/mdbase-repository.test.ts @@ -441,7 +441,7 @@ describe("mdbase task repository", () => { title: "Ship relay support", body: "Tested through Connect.", }); - expect(fixture.read).toHaveBeenCalledTimes(1); + expect(taskReads(fixture.read)).toBe(1); expect( fixture.update.mock.calls.map(([input]) => input.ifRevision), ).toEqual(["r1", "r2"]); @@ -742,7 +742,7 @@ describe("mdbase task repository", () => { await repository.get("delete-me"); await repository.delete("delete-me"); - expect(fixture.read).toHaveBeenCalledTimes(1); + expect(taskReads(fixture.read)).toBe(1); expect(fixture.remove).toHaveBeenCalledWith( expect.objectContaining({ ifRevision: "r1" }), expect.objectContaining({ signal: expect.anything() }), @@ -1417,3 +1417,10 @@ describe("mdbase task repository", () => { ).toBeInstanceOf(MdbaseTaskRepository); }); }); + +/** Task reads, leaving out the settings record's read by path. */ +function taskReads(read: { mock: { calls: { path: string }[][] } }): number { + return read.mock.calls.filter( + ([input]) => input?.path !== "_settings/dev.tasknotes.md", + ).length; +} diff --git a/src/storage/mdbase-repository.ts b/src/storage/mdbase-repository.ts index 2dd74912..4e06064b 100644 --- a/src/storage/mdbase-repository.ts +++ b/src/storage/mdbase-repository.ts @@ -16,6 +16,9 @@ import { serializeMarkdownDocument, } from "@tasknotes/model/frontmatter"; import { patchTaskNotesMdbaseTypeSettings } from "@tasknotes/model/mdbase"; +import { TASKNOTES_SETTINGS_TYPE } from "@tasknotes/model/settings"; +import { connectTaskNotesSettingsStore } from "./mdbase-app-settings"; +import { appSettingsAccess, saveAppSettings } from "./task-app-settings"; import { linksTo, type CollectionDescription, @@ -105,9 +108,11 @@ import type { TaskTimeEntry, UpdateTaskInput, } from "../domain/task"; -import type { - TaskCollectionConfiguration, - TaskModelSettingsPatch, +import { + splitTaskModelSettingsPatch, + taskNotesSettingsChanges, + type TaskCollectionConfiguration, + type TaskModelSettingsPatch, } from "../domain/task-configuration"; import type { CollectionRecord, @@ -171,6 +176,8 @@ export class MdbaseTaskRepository implements TaskRepository { private readonly documents = new TaskDocumentCache(); private changeCursor?: number; private descriptionSignature?: string; + /** The TaskNotes settings record (_settings/dev.tasknotes.md). */ + private readonly settings: ReturnType; private description?: CollectionDescription; private readonly views: MdbaseViewAdapter; private collectionId = ""; @@ -208,6 +215,9 @@ export class MdbaseTaskRepository implements TaskRepository { }; constructor(private readonly connect: MdbaseConnection) { + this.settings = connectTaskNotesSettingsStore(connect, () => + this.requestOptions(), + ); this.views = new MdbaseViewAdapter( connect, () => this.requestOptions(), @@ -334,6 +344,8 @@ export class MdbaseTaskRepository implements TaskRepository { const signal = this.operationController.signal; const description = validResult(await this.connect.describe({ signal })); signal.throwIfAborted(); + await this.settings.reload(signal); + signal.throwIfAborted(); if (this.configureDescription(description)) this.taskIndexReady = false; this.collectionId = description.collectionId; if (!this.taskIndexReady) @@ -372,6 +384,8 @@ export class MdbaseTaskRepository implements TaskRepository { // A failed initial load must not prevent refresh from discovering a new schema. await this.taskIndexLoading?.catch(() => undefined); signal.throwIfAborted(); + await this.settings.reload(signal); + signal.throwIfAborted(); let configurationChanged = this.configureDescription(description); await this.ensureTaskIndex(); signal.throwIfAborted(); @@ -1186,6 +1200,10 @@ export class MdbaseTaskRepository implements TaskRepository { return { writable: true as const, source: `${this.taskTypeName} type definition`, + appSettings: appSettingsAccess( + this.hasSettingsType(), + await this.settings.current(this.requestOptions().signal), + ), }; } catch { return { @@ -1197,9 +1215,35 @@ export class MdbaseTaskRepository implements TaskRepository { } } + private hasSettingsType(): boolean { + return ( + this.description?.types.some( + (type) => type.name === TASKNOTES_SETTINGS_TYPE, + ) === true + ); + } + async updateTaskModelSettings( patch: TaskModelSettingsPatch, ): Promise { + const split = splitTaskModelSettingsPatch( + patch, + this.model.configuration(), + ); + // App behaviour goes to the settings record, never to the binding. + if (Object.keys(split.app).length) { + const prepared = await this.settings.current( + this.requestOptions().signal, + ); + const access = appSettingsAccess(this.hasSettingsType(), prepared); + if (!access.writable) throw new Error(access.reason); + await saveAppSettings( + this.settings, + taskNotesSettingsChanges(split.app, prepared.frontmatter), + prepared, + this.requestOptions().signal, + ); + } const current = validResult( await this.connect.readType( { name: this.taskTypeName }, @@ -1209,7 +1253,7 @@ export class MdbaseTaskRepository implements TaskRepository { const parsed = parseFrontmatter(current.document); const definition = patchTaskNotesMdbaseTypeSettings( parsed.frontmatter, - patch, + split.type, ); const operationInput = { path: current.path, @@ -1220,6 +1264,7 @@ export class MdbaseTaskRepository implements TaskRepository { const updatedDefinition = parseFrontmatter(updated.document).frontmatter; const provider = resolveTaskTypeDefinition(updatedDefinition, { typeName: this.taskTypeName, + settings: this.settings.getSnapshot().frontmatter, }); this.model = provider.model; this.taskProviders.set(this.taskTypeName, provider.model); @@ -2112,18 +2157,20 @@ export class MdbaseTaskRepository implements TaskRepository { // SDK cache hits share the same read-only object. Compare schema contents // only on a refetch: expiry can refetch without advancing schemaGeneration. if (this.description === description) return false; + const settings = this.settings.getSnapshot().frontmatter; const nextSignature = JSON.stringify([ description.displayName, description.types, description.contracts, description.configuration, + settings, ]); this.displayName = description.displayName; if (nextSignature === this.descriptionSignature) { this.description = description; return false; } - const resolved = resolveTaskCollection(description); + const resolved = resolveTaskCollection(description, { settings }); this.description = description; this.descriptionSignature = nextSignature; this.changeCursor = undefined; diff --git a/src/storage/next-app-settings.ts b/src/storage/next-app-settings.ts new file mode 100644 index 00000000..62958f65 --- /dev/null +++ b/src/storage/next-app-settings.ts @@ -0,0 +1,117 @@ +import { + MdbaseError, + toPlain, + type MdbaseClient, + type PlainValue, + type wire, +} from "@mdbase-dev/sdk"; +import { + tasknotesSettingsDefinition, + type TaskNotesAppSettingsValues, +} from "@tasknotes/model/settings"; + +import { + AppSettingsStore, + type AppSettingsFailure, + type AppSettingsRecord, + type AppSettingsRecordPort, +} from "./app-settings-store"; +import type { NextMutations } from "./next-mutations"; + +export type TaskNotesSettingsStore = + AppSettingsStore; + +/** + * How native SDK failures read for a settings record: `not_found` is no + * record; `forbidden` is a connection that may not change it; a revision + * conflict or a taken path is a race with another writer. + */ +export function classifyNativeSettingsFailure( + reason: unknown, +): AppSettingsFailure | undefined { + if (!(reason instanceof MdbaseError)) return undefined; + if (reason.code === "not_found") return "not_found"; + if (reason.code === "forbidden") return "read_only"; + if ( + reason.code === "conflict" && + (reason.reason === "revision" || reason.reason === "path_taken") + ) + return "raced"; + return undefined; +} + +/** The TaskNotes settings record over the native SDK client. Writes go + * through the repository's confirmed mutation stream. */ +export function nativeTaskNotesSettingsStore( + client: MdbaseClient, + mutations: NextMutations, + owner: () => AbortSignal, +): TaskNotesSettingsStore { + const read = async (path: string, signal?: AbortSignal) => { + const record = await client.find({ path }, undefined, signal); + return record ? settingsRecord(record) : null; + }; + const readCreated = async (path: string, signal: AbortSignal) => { + const record = await read(path, signal); + if (!record) throw new Error("The saved settings record is not readable."); + return record; + }; + const port: AppSettingsRecordPort = { + read, + create: (input) => + mutations.run( + { + key: JSON.stringify(["settings:create", input]), + prepare: async (mutationId, signal) => () => + client.create( + { + type: input.type, + path: input.path, + frontmatter: input.frontmatter as Record, + body: "", + }, + { mutationId, signal }, + ), + confirmed: (_receipt, signal) => readCreated(input.path, signal), + }, + owner(), + ), + update: (input) => + mutations.run( + { + key: JSON.stringify(["settings:update", input]), + prepare: async (mutationId, signal) => { + const set: Record = {}; + const unset: string[] = []; + for (const [key, value] of Object.entries(input.patch)) { + if (value === null) unset.push(key); + else set[key] = value as PlainValue; + } + return () => + client.update( + { path: input.path }, + { + patch: set, + ...(unset.length ? { unset } : {}), + ...(input.revision ? { ifRevision: input.revision } : {}), + }, + { mutationId, signal }, + ); + }, + confirmed: (_receipt, signal) => readCreated(input.path, signal), + }, + owner(), + ), + classify: classifyNativeSettingsFailure, + }; + return new AppSettingsStore(port, tasknotesSettingsDefinition); +} + +function settingsRecord(record: wire.RecordView): AppSettingsRecord { + return { + frontmatter: Object.fromEntries( + [...record.frontmatter].map(([key, value]) => [key, toPlain(value)]), + ), + revision: record.revision, + }; +} diff --git a/src/storage/next-model-plan.ts b/src/storage/next-model-plan.ts index 07ec4e21..3f2e6b63 100644 --- a/src/storage/next-model-plan.ts +++ b/src/storage/next-model-plan.ts @@ -17,7 +17,7 @@ import { initializeModelPackCore } from "../cloud/next-model-pack-core"; // loader verifies its vendor digest; no rc.15 builder/profile selection occurs. export const TASKNOTES_MODEL_PACK = Object.freeze({ id: "tasknotes.task", - version: "0.3.0-rc.18", + version: "0.3.0-rc.19", }); // Legacy v2 journals bind ONE task pack. New setup installs the full application // declaration in next-resource-plan; never enlarge a persisted v2 operation. @@ -32,7 +32,7 @@ if ( provision.manifest.kind !== "mdbase.type-pack" || provision.manifest.id !== TASKNOTES_MODEL_PACK.id || provision.manifest.version !== TASKNOTES_MODEL_PACK.version || - provision.manifest.resources.length !== 4 || + provision.manifest.resources.length !== 10 || provision.resources.length !== provision.manifest.resources.length ) throw new Error("The pinned TaskNotes catalog provision is invalid."); diff --git a/src/storage/next-model-setup.test.ts b/src/storage/next-model-setup.test.ts index 9af6565c..5b6cfa09 100644 --- a/src/storage/next-model-setup.test.ts +++ b/src/storage/next-model-setup.test.ts @@ -1,7 +1,11 @@ import { connect, MdbaseError, toValue, type wire } from "@mdbase-dev/sdk"; import { MemoryReplica } from "@mdbase-dev/sdk/testing"; import { parseFrontmatter } from "@tasknotes/model/frontmatter"; -import { TASKNOTES_CONTRACT_DIGEST } from "@tasknotes/model/mdbase"; +import { + TASKNOTES_CONTRACT_DIGEST, + TASKNOTES_LEGACY_CONTRACT_DIGESTS, +} from "@tasknotes/model/mdbase"; +import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; import { afterEach, describe, expect, it, vi } from "vitest"; import { init } from "mdbase"; import { @@ -109,9 +113,16 @@ async function fixture( vi.spyOn(client, "describe").mockImplementation(async (input) => { const signal = input && "aborted" in input ? input : input?.signal; const sources = await client.resources.list({ text: true, signal }); - const contract = sources.resources.find( - (r) => r.path === "_contracts/tasknotes.task.md", - ); + // Each tasknotes.task contract resource, at its published digest. + const contracts = sources.resources.flatMap((r) => { + if (!r.path.startsWith("_contracts/tasknotes.task") || !r.text) return []; + const version = String(parseFrontmatter(r.text).frontmatter.version); + const digest = + version === TASKNOTES_SPEC_VERSION + ? TASKNOTES_CONTRACT_DIGEST + : TASKNOTES_LEGACY_CONTRACT_DIGESTS[version]; + return digest ? [{ version, digest, path: r.path }] : []; + }); const type = sources.resources.find((r) => r.path === "_types/task.md"); const definition = type?.text ? parseFrontmatter(type.text).frontmatter @@ -129,18 +140,12 @@ async function fixture( inclusion: { include: [] }, issues: [], settings: new Map(), - contracts: contract - ? [ - { - id: "tasknotes.task", - version: "0.3.0-rc.5", - digest: TASKNOTES_CONTRACT_DIGEST, - path: contract.path, - contractType: "record", - implementedBy: type ? ["task"] : [], - }, - ] - : [], + contracts: contracts.map((contract) => ({ + id: "tasknotes.task", + ...contract, + contractType: "record", + implementedBy: type ? ["task"] : [], + })), types: type ? [ { diff --git a/src/storage/next-repository.test.ts b/src/storage/next-repository.test.ts index fff38b34..94ac1ef5 100644 --- a/src/storage/next-repository.test.ts +++ b/src/storage/next-repository.test.ts @@ -523,7 +523,13 @@ describe("native TaskRepository operations (SDK stand-in, not LAB/Core/Noise)", const get = vi.spyOn(f.client, "get"); const summaries = await f.repository.listSummaries(); expect(summaries[0]).not.toHaveProperty("body"); - expect(get).not.toHaveBeenCalled(); + // Only the settings record is read by path; no task is read. + expect( + get.mock.calls.filter( + ([ref]) => + JSON.stringify(ref) !== '{"path":"_settings/dev.tasknotes.md"}', + ), + ).toEqual([]); expect((await f.repository.get(s.portableId))!.body).toBe("Original body"); expect(get.mock.calls.at(-1)![1]).toMatchObject({ body: true }); }); diff --git a/src/storage/next-repository.ts b/src/storage/next-repository.ts index d123d292..5fd64520 100644 --- a/src/storage/next-repository.ts +++ b/src/storage/next-repository.ts @@ -50,7 +50,11 @@ import type { import { summarizeTask } from "../domain/task"; import { taskPathCandidates } from "../domain/task-path-policy"; import type { TaskNotesTaskModel } from "../domain/tasknotes-model"; -import type { TaskModelSettingsPatch } from "../domain/task-configuration"; +import { + splitTaskModelSettingsPatch, + taskNotesSettingsChanges, + type TaskModelSettingsPatch, +} from "../domain/task-configuration"; import type { FieldCompletionRequest, CollectionRecord, @@ -141,7 +145,16 @@ import { type TaskNotesModelSetup, type ModelSetupProgressListener, } from "../application/ports/model-setup"; -import { nextTaskProviders, type NextTaskProvider } from "./next-task-catalog"; +import { + nextTaskCatalog, + nextTaskProviders, + type NextTaskProvider, +} from "./next-task-catalog"; +import { + nativeTaskNotesSettingsStore, + type TaskNotesSettingsStore, +} from "./next-app-settings"; +import { appSettingsAccess, saveAppSettings } from "./task-app-settings"; import { nextTaskDocument, nextTaskSummary } from "./next-task-records"; import { peopleView } from "./mdbase-people"; import { ConnectedTaskIndex } from "./connected-task-index"; @@ -368,6 +381,10 @@ export class NextTaskRepository implements TaskRepository { this.listeners.forEach((listener) => listener({ kind: "data" })); }); private changesWatch: ChangesWatch | null = null; + /** The TaskNotes settings record (_settings/dev.tasknotes.md). */ + private readonly settings: TaskNotesSettingsStore; + /** Whether the collection defines the tasknotes-settings type. */ + private settingsType = false; private readonly clientOwnership: "owned" | "borrowed"; private readonly peopleClient?: Pick; @@ -443,6 +460,11 @@ export class NextTaskRepository implements TaskRepository { this.emit("data"); }; this.mutations = new NextMutations(client, this.readCurrentWrites); + this.settings = nativeTaskNotesSettingsStore( + client, + this.mutations, + () => this.scope.signal, + ); this.stopLedger = client.ledger.subscribe(() => { if (!this.disposed && !this.scope.signal.aborted) this.emit("status"); }); @@ -750,9 +772,17 @@ export class NextTaskRepository implements TaskRepository { if (!this.initialization) { const revision = this.dataRevision; const loading = (async () => { - const providers = await nextTaskProviders(this.client, signal); + // The record is read first: its fields win over the type binding's. + const settings = await this.settings.reload(signal); + signal.throwIfAborted(); + const { providers, settingsType } = await nextTaskCatalog( + this.client, + signal, + { settings: settings.frontmatter }, + ); signal.throwIfAborted(); this.assertCurrentData(revision); + this.settingsType = settingsType; this.providers = providers; this.models = new Map(providers.map((p) => [p.typeName, p.model])); this.reached(false); @@ -2710,7 +2740,14 @@ export class NextTaskRepository implements TaskRepository { try { await this.client.resources.get(source, signal); signal.throwIfAborted(); - return { writable: true as const, source }; + return { + writable: true as const, + source, + appSettings: appSettingsAccess( + this.settingsType, + this.settings.getSnapshot(), + ), + }; } catch (reason) { if (reason instanceof MdbaseError && reason.code === "forbidden") return { @@ -2731,9 +2768,29 @@ export class NextTaskRepository implements TaskRepository { "This collection has several task types. Edit each type's settings in mdbase.", ); const source = this.providers[0]!.sourcePath; + const split = splitTaskModelSettingsPatch( + patch, + this.providers[0]!.model.configuration(), + ); + // App behaviour goes to the settings record, never to the binding. It is + // saved first: a conflict there stops the save before anything is written. + if (Object.keys(split.app).length) { + const prepared = await this.settings.current(this.signal()); + const access = appSettingsAccess(this.settingsType, prepared); + if (!access.writable) throw new Error(access.reason); + await saveAppSettings( + this.settings, + taskNotesSettingsChanges(split.app, prepared.frontmatter), + prepared, + ); + this.invalidateRemoteData(); + await this.initialize({ deferTaskIndex: true }); + owner.throwIfAborted(); + } + const typePatch = split.type; await this.mutations.run( { - key: JSON.stringify(["task:settings", patch]), + key: JSON.stringify(["task:settings", typePatch]), prepare: async (mutationId, signal) => { const providers = await nextTaskProviders(this.client, signal); if (providers.length !== 1 || providers[0]!.sourcePath !== source) @@ -2745,9 +2802,11 @@ export class NextTaskRepository implements TaskRepository { throw new Error("The replica did not supply the task type source."); const parsed = parseFrontmatter(resource.text); const text = serializeMarkdownDocument( - patchTaskNotesMdbaseTypeSettings(parsed.frontmatter, patch), + patchTaskNotesMdbaseTypeSettings(parsed.frontmatter, typePatch), parsed.body, ); + // Nothing the type keeps changed: leave its revision alone. + if (text === resource.text) return { value: undefined }; return () => this.client.resources.put(source, text, { baseRevision: resource.revision, @@ -2756,7 +2815,9 @@ export class NextTaskRepository implements TaskRepository { }); }, confirmed: async (_r, signal) => { - const providers = await nextTaskProviders(this.client, signal); + const providers = await nextTaskProviders(this.client, signal, { + settings: this.settings.getSnapshot().frontmatter, + }); signal.throwIfAborted(); this.providers = providers; this.models = new Map(providers.map((p) => [p.typeName, p.model])); diff --git a/src/storage/next-resource-plan.test.ts b/src/storage/next-resource-plan.test.ts index 5f53de91..650286a0 100644 --- a/src/storage/next-resource-plan.test.ts +++ b/src/storage/next-resource-plan.test.ts @@ -43,7 +43,7 @@ describe("actual resource Core planner with unchanged publisher inputs", () => { expect(uuid).not.toHaveBeenCalled(); expect(held.listAppBasesViews).not.toHaveBeenCalled(); // CURRENT resolved Base contract absent; occupancy UNKNOWN. expect(assessment.packs.map((p) => [p.id, p.version])).toEqual([ - ["tasknotes.task", "0.3.0-rc.18"], + ["tasknotes.task", "0.3.0-rc.19"], ["tasknotes.scratch", "1.2.0"], ["tasknotes.scratch-image", "1.2.0"], ["obsidian.base", "1.0.0"], diff --git a/src/storage/next-resource-plan.ts b/src/storage/next-resource-plan.ts index fec6d145..9cbe48b6 100644 --- a/src/storage/next-resource-plan.ts +++ b/src/storage/next-resource-plan.ts @@ -10,8 +10,7 @@ import { import { stringify } from "yaml"; import { MdbaseError, type MdbaseClient } from "@mdbase-dev/sdk"; import type { JsonObject, TypePackProvision } from "@mdbase-dev/connect"; -import { TASKNOTES_CONTRACT_DIGEST } from "@tasknotes/model/mdbase"; -import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; +import { TASKNOTES_READABLE_CONTRACTS } from "../domain/tasknotes-contract"; import manifest from "../generated/mdbase-app.json"; import bases from "../../vendor/obsidian-base-1.0.0.json"; import { initializeModelPackCore } from "../cloud/next-model-pack-core"; @@ -139,12 +138,16 @@ async function configuration( signal.throwIfAborted(); if (!catalog.valid) throw new Error("The staged resource catalog is invalid."); - const implementations = catalog.implementations.filter( - (i) => - i.contract === "tasknotes.task" && - i.version === TASKNOTES_SPEC_VERSION && - i.contract_digest === TASKNOTES_CONTRACT_DIGEST, - ); + // Prefer the current contract; a preserved rc.5 type still resolves. + const implementations = + TASKNOTES_READABLE_CONTRACTS.map((readable) => + catalog.implementations.filter( + (i) => + i.contract === "tasknotes.task" && + i.version === readable.version && + i.contract_digest === readable.digest, + ), + ).find((found) => found.length) ?? []; if (implementations.length !== 1) throw new Error( "The staged/preserved TaskNotes implementation is unavailable or ambiguous.", @@ -157,6 +160,7 @@ async function configuration( typeName: type.name, fields: Object.fromEntries(implementation.fields), configuration: implementation.binding as JsonObject, + version: implementation.version, }).model.configuration(); } function readback( diff --git a/src/storage/next-task-catalog.ts b/src/storage/next-task-catalog.ts index 0b9d11df..6daea76e 100644 --- a/src/storage/next-task-catalog.ts +++ b/src/storage/next-task-catalog.ts @@ -1,8 +1,11 @@ import { toPlain, type MdbaseClient } from "@mdbase-dev/sdk"; import { parseFrontmatter } from "@tasknotes/model/frontmatter"; -import { TASKNOTES_CONTRACT_DIGEST } from "@tasknotes/model/mdbase"; -import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; +import { TASKNOTES_SETTINGS_TYPE } from "@tasknotes/model/settings"; import { TaskNotesModelRequiredError } from "../application/ports/model-setup"; +import { + readableTaskNotesContract, + TASKNOTES_MISSING_CONTRACT_MESSAGE, +} from "../domain/tasknotes-contract"; import { resolveTaskTypeDefinition, type ResolvedTaskProvider, @@ -18,19 +21,28 @@ export interface NextTaskProvider extends ResolvedTaskProvider { export async function nextTaskProviders( client: MdbaseClient, signal: AbortSignal, + options: { settings?: Readonly> } = {}, ): Promise { + return (await nextTaskCatalog(client, signal, options)).providers; +} + +export interface NextTaskCatalog { + providers: NextTaskProvider[]; + /** Whether the collection defines the TaskNotes settings type. */ + settingsType: boolean; +} + +/** The current tasknotes.task contract is preferred; rc.5 collections still resolve. */ +export async function nextTaskCatalog( + client: MdbaseClient, + signal: AbortSignal, + options: { settings?: Readonly> } = {}, +): Promise { const catalog = await client.describe(signal); signal.throwIfAborted(); - const contract = catalog.contracts.find( - (item) => - item.id === "tasknotes.task" && - item.version === TASKNOTES_SPEC_VERSION && - item.digest === TASKNOTES_CONTRACT_DIGEST, - ); + const contract = readableTaskNotesContract(catalog.contracts); if (!contract) - throw new TaskNotesModelRequiredError( - `This collection does not provide tasknotes.task ${TASKNOTES_SPEC_VERSION}.`, - ); + throw new TaskNotesModelRequiredError(TASKNOTES_MISSING_CONTRACT_MESSAGE); const providers: NextTaskProvider[] = []; for (const type of catalog.types) { const implementations = type.implements.filter( @@ -67,6 +79,8 @@ export async function nextTaskProviders( typeName: type.name, fields: Object.fromEntries(implementation.fields), configuration: binding, + version: contract.version, + settings: options.settings, }), sourcePath: type.path, }); @@ -75,5 +89,10 @@ export async function nextTaskProviders( throw new TaskNotesModelRequiredError( "The TaskNotes contract has no implementing types.", ); - return providers; + return { + providers, + settingsType: catalog.types.some( + (type) => type.name === TASKNOTES_SETTINGS_TYPE, + ), + }; } diff --git a/src/storage/task-app-settings.ts b/src/storage/task-app-settings.ts new file mode 100644 index 00000000..7363f4da --- /dev/null +++ b/src/storage/task-app-settings.ts @@ -0,0 +1,39 @@ +import type { + TaskNotesAppSettingsChanges, + TaskNotesAppSettingsValues, +} from "@tasknotes/model/settings"; + +import type { + AppSettingsSnapshot, + AppSettingsStore, +} from "./app-settings-store"; + +/** Why app settings are read-only when the collection has no settings type. */ +export const TASKNOTES_SETTINGS_TYPE_MISSING_MESSAGE = + "Templates, archiving, checklist resets, link format and timers stay read-only here until this collection's TaskNotes definitions are updated."; + +/** Whether TaskNotes app settings can be saved to the settings record. */ +export function appSettingsAccess( + settingsType: boolean, + snapshot: AppSettingsSnapshot, +): { writable: boolean; reason?: string } { + // An rc.5 collection the pack upgrade has not reached: the record cannot be + // created, and the moved settings are never written back to the binding. + if (!settingsType) + return { writable: false, reason: TASKNOTES_SETTINGS_TYPE_MISSING_MESSAGE }; + if (snapshot.settings.readOnly) + return { writable: false, reason: snapshot.settings.readOnly }; + return { writable: true }; +} + +/** Save record changes, or throw the store's refusal. */ +export async function saveAppSettings( + store: AppSettingsStore, + changes: TaskNotesAppSettingsChanges, + prepared: AppSettingsSnapshot, + signal?: AbortSignal, +): Promise> { + const result = await store.save(changes, prepared, signal); + if (!result.ok) throw new Error(result.message); + return result.snapshot; +} diff --git a/src/storage/tasknotes-collection.test.ts b/src/storage/tasknotes-collection.test.ts new file mode 100644 index 00000000..3c306c2a --- /dev/null +++ b/src/storage/tasknotes-collection.test.ts @@ -0,0 +1,31 @@ +import { TASKNOTES_LEGACY_CONTRACT_DIGESTS } from "@tasknotes/model/mdbase"; +import { describe, expect, it } from "vitest"; + +import { description } from "../test/mdbase-fixture"; +import { resolveTaskCollection } from "./tasknotes-collection"; + +/** A collection still on tasknotes.task rc.5, its moved settings in the binding. */ +function rc5Collection() { + const described = description(false, true); + const contract = described.contracts[0]!; + contract.version = "0.3.0-rc.5"; + contract.digest = TASKNOTES_LEGACY_CONTRACT_DIGESTS["0.3.0-rc.5"]!; + const definition = described.types[0]!.definition as { + implements: { contract: string; version: string }[]; + }; + for (const implementation of definition.implements) + if (implementation.contract === "tasknotes.task") + implementation.version = "0.3.0-rc.5"; + return described; +} + +describe("TaskNotes collection resolution", () => { + it("still resolves an rc.5 collection, reading moved settings from its binding", () => { + const resolved = resolveTaskCollection(rc5Collection()); + expect(resolved.typeName).toBe("task"); + expect(resolved.model.configuration().archive).toEqual({ + moveOnArchive: true, + folder: "TaskNotes/Archive", + }); + }); +}); diff --git a/src/storage/tasknotes-collection.ts b/src/storage/tasknotes-collection.ts index c5bdcb89..ba5b2cb2 100644 --- a/src/storage/tasknotes-collection.ts +++ b/src/storage/tasknotes-collection.ts @@ -4,9 +4,13 @@ import type { JsonObject, } from "@mdbase-dev/connect"; import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; -import { TASKNOTES_CONTRACT_DIGEST } from "@tasknotes/model/mdbase"; import { TaskNotesTaskModel } from "../domain/tasknotes-model"; import { resolveTaskCollectionConfiguration } from "../domain/task-configuration"; +import { + readableTaskNotesContract, + taskNotesImplementationOf, + TASKNOTES_MISSING_CONTRACT_MESSAGE, +} from "../domain/tasknotes-contract"; export interface TaskCollectionResources { contracts: CollectionContractDescriptor[]; @@ -24,19 +28,17 @@ export interface ResolvedTaskProvider { typeName: string; } +/** + * The collection's TaskNotes providers. The current tasknotes.task contract + * is preferred; a collection still on an earlier readable contract (rc.5) + * resolves too, reading moved settings from its binding after the record. + */ export function resolveTaskCollection( resources: TaskCollectionResources, + options: { settings?: Readonly> } = {}, ): ResolvedTaskCollection { - const contract = resources.contracts.find( - (candidate) => - candidate.id === "tasknotes.task" && - candidate.version === TASKNOTES_SPEC_VERSION && - candidate.digest === TASKNOTES_CONTRACT_DIGEST, - ); - if (!contract) - throw new Error( - `This collection does not provide tasknotes.task ${TASKNOTES_SPEC_VERSION}.`, - ); + const contract = readableTaskNotesContract(resources.contracts); + if (!contract) throw new Error(TASKNOTES_MISSING_CONTRACT_MESSAGE); const providers = contract.implementations.map((implementation) => { const type = resources.types.find( (candidate) => candidate.name === implementation.typeName, @@ -51,6 +53,8 @@ export function resolveTaskCollection( fields: implementation.fields, collection: type.collection, configuration: implementation.binding, + version: contract.version, + settings: options.settings, }); }); if (!providers.length) @@ -66,22 +70,27 @@ export function resolveTaskTypeDefinition( fields?: JsonObject; collection?: JsonObject; configuration?: JsonObject; + /** The tasknotes.task version the catalog says the type implements. */ + version?: string; + /** Frontmatter of the TaskNotes settings record, when there is one. */ + settings?: Readonly>; } = {}, ): ResolvedTaskProvider { - const configuration = - overrides.configuration ?? taskNotesImplementation(definition)?.binding; - const fields = - overrides.fields ?? taskNotesImplementation(definition)?.fields; + const declared = taskNotesImplementationOf(definition) as + { version?: string; fields?: JsonObject; binding?: JsonObject } | undefined; + const configuration = overrides.configuration ?? declared?.binding; + const fields = overrides.fields ?? declared?.fields; const implementation = { contract: "tasknotes.task", - version: TASKNOTES_SPEC_VERSION, + version: + overrides.version ?? + (typeof declared?.version === "string" + ? declared.version + : TASKNOTES_SPEC_VERSION), fields: fields ?? {}, binding: configuration ?? {}, }; - if ( - overrides.configuration === undefined && - !taskNotesImplementation(definition) - ) + if (overrides.configuration === undefined && !declared) throw new Error("This type does not provide the TaskNotes task contract."); const schema = overrides.schema ?? @@ -98,12 +107,15 @@ export function resolveTaskTypeDefinition( return { typeName, model: new TaskNotesTaskModel( - resolveTaskCollectionConfiguration({ - ...definition, - schema: { value: schema }, - collection, - implements: [implementation], - }), + resolveTaskCollectionConfiguration( + { + ...definition, + schema: { value: schema }, + collection, + implements: [implementation], + }, + overrides.settings ? { settings: overrides.settings } : {}, + ), { recordsFolder: taskRecordsFolder, pathPattern: @@ -114,29 +126,6 @@ export function resolveTaskTypeDefinition( }; } -function taskNotesImplementation( - definition: Record, -): { fields?: JsonObject; binding?: JsonObject } | undefined { - const implementations = Array.isArray(definition.implements) - ? definition.implements - : []; - return implementations.find( - ( - candidate, - ): candidate is { - contract: string; - version: string; - fields?: JsonObject; - binding?: JsonObject; - } => - candidate !== null && - typeof candidate === "object" && - !Array.isArray(candidate) && - (candidate as Record).contract === "tasknotes.task" && - (candidate as Record).version === TASKNOTES_SPEC_VERSION, - ); -} - function pathPattern(collection: JsonObject | undefined): string | undefined { const path = collection?.path; if (!path || typeof path !== "object" || Array.isArray(path)) diff --git a/src/test/mdbase-fixture.ts b/src/test/mdbase-fixture.ts index 70e385ab..30cfbaed 100644 --- a/src/test/mdbase-fixture.ts +++ b/src/test/mdbase-fixture.ts @@ -26,6 +26,8 @@ import { parseFrontmatter, serializeMarkdownDocument, } from "@tasknotes/model/frontmatter"; +import { buildTaskNotesSettingsResources } from "@tasknotes/model/settings"; +import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; import { vi } from "vitest"; import { stringify } from "yaml"; @@ -714,7 +716,7 @@ export function description( const implementation = type.implements.find( (candidate) => candidate.contract === "tasknotes.task" && - candidate.version === "0.3.0-rc.5", + candidate.version === TASKNOTES_SPEC_VERSION, )!; const configuration = structuredClone(implementation.binding); if (templating) @@ -759,12 +761,13 @@ export function description( definition: generated.type, extensions: {}, }, + settingsTypeDescriptor(), ], contracts: [ { id: "tasknotes.task", contractType: "record", - version: "0.3.0-rc.5", + version: TASKNOTES_SPEC_VERSION, digest: TASKNOTES_CONTRACT_DIGEST, schema: generated.taskSchema, bindingSchema: generated.bindingSchema, @@ -782,6 +785,22 @@ export function description( }; } +/** The tasknotes-settings type the rc.19 pack seeds. */ +function settingsTypeDescriptor(): CollectionDescription["types"][number] { + const type = buildTaskNotesSettingsResources().type as { + name: string; + version: number; + schema: { value: JsonObject }; + }; + return { + name: type.name, + version: type.version, + schema: type.schema.value, + definition: type as unknown as JsonObject, + extensions: {}, + }; +} + export function multipleProviderDescription(): CollectionDescription { const result = description(false, false, crypto.randomUUID()); const taskType = result.types[0]!; diff --git a/vendor/README.md b/vendor/README.md index 1b72aeba..b8c5bc4a 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -8,9 +8,11 @@ their source commit, byte size, and SHA-512 digest. Current snapshots were packed from sibling checkouts after their full test suites passed: -- `../mdbase-contracts` (`tasknotes.task` pack `0.3.0-rc.18`, catalog digest - `sha256:9a9ebc26…`, see `vendor/mdbase-contracts`) -- `../tasknotes-model` (`0.3.0-rc.15`, whose `@tasknotes/model/starter` defines the published starter type) +- `../mdbase-contracts` (`tasknotes.task` pack `0.3.0-rc.19` from + mdbase-contracts PR #18, not yet published at mdbase.dev, so + `pnpm contracts:sync` fails until it is; see `vendor/mdbase-contracts`) +- `../tasknotes-model` (`0.3.0-rc.20` from tasknotes-model PR #25, unpublished; + replace with the registry version once it is published) - `../tasknotes-nlp-core` (`62a0d9d`, including wikilink-safe parsing) - `../tasknotes-spec` - `../mdbase` diff --git a/vendor/mdbase-contracts/tasknotes.task-0.3.0-rc.19.json b/vendor/mdbase-contracts/tasknotes.task-0.3.0-rc.19.json new file mode 100644 index 00000000..0e7dcb7c --- /dev/null +++ b/vendor/mdbase-contracts/tasknotes.task-0.3.0-rc.19.json @@ -0,0 +1,167 @@ +{ + "manifest": { + "kind": "mdbase.type-pack", + "id": "tasknotes.task", + "version": "0.3.0-rc.19", + "name": "TaskNotes task type pack", + "description": "Portable tasks whose app behaviour (templates, archive moves, status cycling, time tracking and link format) lives in a TaskNotes settings record, with a reviewed, atomic upgrade from every TaskNotes starter published before.", + "resources": [ + { + "kind": "contract", + "mode": "managed", + "source": "contracts/tasknotes.task/0.3.0-rc.5.md", + "target": "_contracts/tasknotes.task.md", + "digest": "sha256:ecadd00700e249940f4244aaa5b5985a96557d13340463ec491dfa5e89b032a4" + }, + { + "kind": "contract", + "mode": "managed", + "source": "contracts/tasknotes.task/0.3.0-rc.6.md", + "target": "_contracts/tasknotes.task/0.3.0-rc.6.md", + "digest": "sha256:3f4eb90782948ed68112ffcc99575911036020544cf501de3d2265b588b38456" + }, + { + "kind": "type", + "mode": "seed", + "source": "types/tasknotes-task/6.md", + "target": "_types/task.md", + "digest": "sha256:87e52c25b474a06283b29e2983ae4fc6e618fd1a4cbcc5856ff9a67328df605b", + "upgrade_from": [ + { + "digest": "sha256:b3cf8dbe8885b331c494d2eeb36abfb052890e06b757877d655c269e666487dc", + "version": 4, + "document": "---\nkind: mdbase.type\nname: task\nversion: 4\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a2\n - none\n - open\n - in-progress\n - done\n - cancelled\n default: open\n priority:\n enum: &a4\n - none\n - low\n - normal\n - high\n default: normal\n due: &a1\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled: *a1\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a3\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n assignees[]:\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.5\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - materialized-occurrences\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a2\n default: open\n completed_values: *a3\n skipped_values:\n - cancelled\n default_skipped: cancelled\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 0\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: open\n label: Open\n color: \"#64748b\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 1\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: in-progress\n label: In progress\n color: \"#3b82f6\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 2\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: done\n label: Done\n color: \"#22c55e\"\n is_completed: true\n is_skipped: false\n exclude_from_cycle: false\n order: 3\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: cancelled\n label: Cancelled\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: true\n exclude_from_cycle: true\n order: 4\n auto_archive: false\n auto_archive_delay_minutes: 5\n priority:\n values: *a4\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n weight: 0\n - value: low\n label: Low\n color: \"#3b82f6\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#f59e0b\"\n weight: 2\n - value: high\n label: High\n color: \"#ef4444\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n reset_body_checkboxes: false\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n write_format: wikilink\n archive:\n archived_tag: archived\n move_on_archive: false\n time_tracking:\n auto_stop_on_complete: false\n templating:\n enabled: false\n occurrence_enabled: false\nx-tasknotes-generator:\n managed_fields:\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n# Task\n\nTask records live under `tasks/`.\n" + }, + { + "digest": "sha256:2b6016c3543c0dfff491cc6262aed3afd4d672360484174042a261acd1d8ff5f", + "version": 4, + "document": "---\nkind: mdbase.type\nname: task\nversion: 4\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a2\n - none\n - open\n - in-progress\n - done\n - cancelled\n default: open\n priority:\n enum: &a4\n - none\n - low\n - normal\n - high\n default: normal\n due: &a1\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled: *a1\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a3\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n assignees[]:\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.5\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - materialized-occurrences\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a2\n default: open\n completed_values: *a3\n skipped_values:\n - cancelled\n default_skipped: cancelled\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 0\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: open\n label: Open\n color: \"#64748b\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 1\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: in-progress\n label: In progress\n color: \"#3b82f6\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 2\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: done\n label: Done\n color: \"#22c55e\"\n is_completed: true\n is_skipped: false\n exclude_from_cycle: false\n order: 3\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: cancelled\n label: Cancelled\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: true\n exclude_from_cycle: true\n order: 4\n auto_archive: false\n auto_archive_delay_minutes: 5\n priority:\n values: *a4\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n weight: 0\n - value: low\n label: Low\n color: \"#3b82f6\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#f59e0b\"\n weight: 2\n - value: high\n label: High\n color: \"#ef4444\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n reset_body_checkboxes: false\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n write_format: wikilink\n archive:\n archived_tag: archived\n move_on_archive: false\n time_tracking:\n auto_stop_on_complete: false\n templating:\n enabled: false\n occurrence_enabled: false\nx-tasknotes-generator:\n managed_fields:\n - assignees\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n# Task\n\nTask records live under `tasks/`.\n" + }, + { + "digest": "sha256:02d1a2a04f26937dd7eec3cde3070dd770c73625e06f386d6214044d176788dd", + "version": 3, + "document": "---\nkind: mdbase.type\nname: task\nversion: 3\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a1\n - none\n - open\n - in-progress\n - done\n default: open\n priority:\n enum: &a3\n - none\n - low\n - normal\n - high\n default: normal\n due:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a2\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n assignees[]:\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.5\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - templating\n - materialized-occurrences\n - extended\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a1\n default: open\n completed_values: *a2\n skipped_values: []\n definitions:\n - value: none\n label: None\n color: \"#cccccc\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 0\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: open\n label: Open\n color: \"#808080\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 1\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: in-progress\n label: In progress\n color: \"#0066cc\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 2\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: done\n label: Done\n color: \"#00aa00\"\n is_completed: true\n is_skipped: false\n exclude_from_cycle: false\n order: 3\n auto_archive: false\n auto_archive_delay_minutes: 5\n priority:\n values: *a3\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#cccccc\"\n weight: 0\n - value: low\n label: Low\n color: \"#00aa00\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#ffaa00\"\n weight: 2\n - value: high\n label: High\n color: \"#ff0000\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n reset_body_checkboxes: false\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n write_format: wikilink\n archive:\n archived_tag: archived\n move_on_archive: false\n time_tracking:\n auto_stop_on_complete: false\n templating:\n enabled: false\n occurrence_enabled: false\nx-tasknotes-generator:\n managed_fields:\n - assignees\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n\n# Task\n\nThis type definition implements the TaskNotes contract for this mdbase collection.\nIts JSON Schema describes persisted task frontmatter; collection and lifecycle\nmetadata describe generic mdbase behavior; `implements` maps the portable\nTaskNotes task view and supplies TaskNotes behavior.\n\nChanges made here are loaded by TaskNotes. Portable changes made in TaskNotes\nsettings are written back while unknown extensions are preserved.\n" + }, + { + "digest": "sha256:ade71117bd31e571f403511c48d432bab7a05dfd25e730ca2931f3afda7f7cd5", + "version": 2, + "document": "---\nkind: mdbase.type\nname: task\nversion: 2\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a1\n - none\n - open\n - in-progress\n - done\n default: open\n priority:\n enum: &a3\n - none\n - low\n - normal\n - high\n default: normal\n due:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a2\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.4\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - templating\n - materialized-occurrences\n - extended\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a1\n default: open\n completed_values: *a2\n skipped_values: []\n definitions:\n - value: none\n label: None\n color: \"#cccccc\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 0\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: open\n label: Open\n color: \"#808080\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 1\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: in-progress\n label: In progress\n color: \"#0066cc\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 2\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: done\n label: Done\n color: \"#00aa00\"\n is_completed: true\n is_skipped: false\n exclude_from_cycle: false\n order: 3\n auto_archive: false\n auto_archive_delay_minutes: 5\n priority:\n values: *a3\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#cccccc\"\n weight: 0\n - value: low\n label: Low\n color: \"#00aa00\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#ffaa00\"\n weight: 2\n - value: high\n label: High\n color: \"#ff0000\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n reset_body_checkboxes: false\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n write_format: wikilink\n archive:\n archived_tag: archived\n move_on_archive: false\n time_tracking:\n auto_stop_on_complete: false\n templating:\n enabled: false\n occurrence_enabled: false\nx-tasknotes-generator:\n managed_fields:\n - assignees\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n\n# Task\n\nThis type definition implements the TaskNotes contract for this mdbase collection.\nIts JSON Schema describes persisted task frontmatter; collection and lifecycle\nmetadata describe generic mdbase behavior; `implements` maps the portable\nTaskNotes task view and supplies TaskNotes behavior.\n\nChanges made here are loaded by TaskNotes. Portable changes made in TaskNotes\nsettings are written back while unknown extensions are preserved.\n" + }, + { + "digest": "sha256:b7f8af7b18d77859dab1f1532c1b55c08c7c39879f55e4ef2a94cb7d2d2284eb", + "version": 1, + "document": "---\nkind: mdbase.type\nname: task\nversion: 1\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a2\n - none\n - open\n - in-progress\n - done\n - cancelled\n default: open\n priority:\n enum: &a4\n - none\n - low\n - normal\n - high\n default: normal\n due: &a1\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled: *a1\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a3\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.3\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - materialized-occurrences\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a2\n default: open\n completed_values: *a3\n skipped_values:\n - cancelled\n default_skipped: cancelled\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 0\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: open\n label: Open\n color: \"#64748b\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 1\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: in-progress\n label: In progress\n color: \"#3b82f6\"\n is_completed: false\n is_skipped: false\n exclude_from_cycle: false\n order: 2\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: done\n label: Done\n color: \"#22c55e\"\n is_completed: true\n is_skipped: false\n exclude_from_cycle: false\n order: 3\n auto_archive: false\n auto_archive_delay_minutes: 5\n - value: cancelled\n label: Cancelled\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: true\n exclude_from_cycle: true\n order: 4\n auto_archive: false\n auto_archive_delay_minutes: 5\n priority:\n values: *a4\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n weight: 0\n - value: low\n label: Low\n color: \"#3b82f6\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#f59e0b\"\n weight: 2\n - value: high\n label: High\n color: \"#ef4444\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n reset_body_checkboxes: false\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n write_format: wikilink\n archive:\n archived_tag: archived\n move_on_archive: false\n time_tracking:\n auto_stop_on_complete: false\n templating:\n enabled: false\n occurrence_enabled: false\nx-tasknotes-generator:\n managed_fields:\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n# Task\n\nTask records live under `tasks/`.\n" + } + ] + }, + { + "kind": "schema", + "mode": "managed", + "source": "schemas/tasknotes.task/0.3.0-rc.6.schema.json", + "target": "_schemas/tasknotes/tasknotes-task.schema.json", + "digest": "sha256:ac78a55f46669d6e8bd08d608b7c25338fec8ba7606dbf54ebd6b8d4e66b7035" + }, + { + "kind": "schema", + "mode": "managed", + "source": "schemas/tasknotes.task.binding/0.3.0-rc.6.schema.json", + "target": "_schemas/tasknotes/tasknotes-task-binding.schema.json", + "digest": "sha256:4f8f3288f593ce06a04525697308173147ff957e7066f83d9a922468d06be659" + }, + { + "kind": "schema", + "mode": "managed", + "source": "schemas/mdbase.app-settings/1.0.0.schema.json", + "target": "schemas/mdbase.app-settings/1.0.0.schema.json", + "digest": "sha256:f37ed43b57fe86465b5bb67216da71d6e351bc1b85bf55a20f95edf886f0749e" + }, + { + "kind": "contract", + "mode": "managed", + "source": "contracts/mdbase.app-settings/1.0.0.md", + "target": "_contracts/mdbase.app-settings/1.0.0.md", + "digest": "sha256:9028d8ccd99cfbb4034399777376315486eb8e699aea7757a6b193743f1084c8" + }, + { + "kind": "schema", + "mode": "managed", + "source": "schemas/tasknotes.settings/1.0.0.schema.json", + "target": "schemas/tasknotes.settings/1.0.0.schema.json", + "digest": "sha256:3a4fc207e14ab1579ca478ce84b25cb8dd85b804b3aa79d01eda08e4554dfbb1" + }, + { + "kind": "contract", + "mode": "managed", + "source": "contracts/tasknotes.settings/1.0.0.md", + "target": "_contracts/tasknotes.settings/1.0.0.md", + "digest": "sha256:e8c25653ef37c032fb4cb1f1c3f7c618092a09c4911a41aba42c0476796fe0d1" + }, + { + "kind": "type", + "mode": "seed", + "source": "types/tasknotes-settings/1.md", + "target": "_types/tasknotes-settings.md", + "digest": "sha256:22ec312c75df356b0b26ba3c46961212efe2803a5d57071fa5753bab7638c2cc" + } + ] + }, + "resources": [ + { + "source": "contracts/tasknotes.task/0.3.0-rc.5.md", + "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: tasknotes.task\nversion: 0.3.0-rc.5\nname: TaskNotes task\ndescription: Portable task data and behavior defined by tasknotes-spec 0.3.0-rc.5.\nrecord_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task.schema.json\n title: TaskNotes portable task view\n description: The storage-neutral record view exposed by the tasknotes.task 0.3.0-rc.5 record contract.\n type: object\n required:\n - status\n - dateCreated\n additionalProperties: false\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n type: string\n minLength: 1\n priority:\n type: string\n minLength: 1\n due:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n pattern: \\S\n description: Links to records implementing mdbase.person, such as [[Alex Rivera]]. Implementing types declare this field in collection.links. These references never grant collection access.\n attachments:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrenceAnchor:\n enum:\n - scheduled\n - completion\n recurrenceParent:\n type: string\n occurrenceDate:\n type: string\n format: date\n occurrenceMaterialization:\n enum:\n - manual\n - on_completion\n - rolling\n occurrenceNextTrigger:\n enum:\n - completion\n - completion_or_skip\n occurrenceTemplate:\n type: string\n occurrencePastHorizon:\n type: string\n occurrenceFutureHorizon:\n type: string\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n reminders:\n type: array\n items:\n type: object\n blockedBy:\n type: array\n items:\n type: object\n completeInstances:\n type: array\n items:\n type: string\n format: date\n skippedInstances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n sortOrder:\n type: string\nbinding_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task-binding.schema.json\n title: TaskNotes task data-contract binding\n description: Semantic configuration supplied by an mdbase type that implements tasknotes.task 0.3.0-rc.3.\n type: object\n required:\n - profiles\n - capabilities\n - title\n - status\n - priority\n - recurrence\n - occurrences\n - links\n - archive\n - time_tracking\n - templating\n properties:\n profiles:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - core-lite\n - recurrence\n - templating\n - materialized-occurrences\n - extended\n capabilities:\n type: array\n uniqueItems: true\n items:\n enum:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - rename\n - archive\n - batch\n - concurrency\n - dry-run\n - migration\n - templating\n title:\n $ref: \"#/$defs/titlePolicy\"\n status:\n $ref: \"#/$defs/statusPolicy\"\n priority:\n $ref: \"#/$defs/priorityPolicy\"\n recurrence:\n $ref: \"#/$defs/recurrencePolicy\"\n occurrences:\n $ref: \"#/$defs/occurrencePolicy\"\n links:\n $ref: \"#/$defs/linkPolicy\"\n archive:\n $ref: \"#/$defs/archivePolicy\"\n time_tracking:\n $ref: \"#/$defs/timeTrackingPolicy\"\n templating:\n $ref: \"#/$defs/templatingPolicy\"\n nlp:\n $ref: \"#/$defs/nlpPolicy\"\n additionalProperties: false\n $defs:\n nonEmptyString:\n type: string\n minLength: 1\n stringSet:\n type: array\n uniqueItems: true\n items:\n $ref: \"#/$defs/nonEmptyString\"\n titlePolicy:\n type: object\n required:\n - storage\n properties:\n storage:\n enum:\n - filename\n - frontmatter\n filename_format:\n enum:\n - title\n - zettel\n - timestamp\n - uuid\n - custom\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n allOf:\n - if:\n properties:\n filename_format:\n const: custom\n required:\n - filename_format\n then:\n properties:\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n required:\n - custom_filename_template\n additionalProperties: true\n statusDefinition:\n type: object\n required:\n - value\n - label\n - color\n - is_completed\n - is_skipped\n - exclude_from_cycle\n - order\n - auto_archive\n - auto_archive_delay_minutes\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n is_completed:\n type: boolean\n is_skipped:\n type: boolean\n exclude_from_cycle:\n type: boolean\n next_status:\n $ref: \"#/$defs/nonEmptyString\"\n order:\n type: number\n auto_archive:\n type: boolean\n auto_archive_delay_minutes:\n type: number\n minimum: 0\n additionalProperties: true\n statusPolicy:\n type: object\n required:\n - values\n - default\n - completed_values\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n completed_values:\n $ref: \"#/$defs/stringSet\"\n skipped_values:\n $ref: \"#/$defs/stringSet\"\n default_skipped:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/statusDefinition\"\n additionalProperties: false\n priorityDefinition:\n type: object\n required:\n - value\n - label\n - color\n - weight\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n weight:\n type: number\n additionalProperties: true\n priorityPolicy:\n type: object\n required:\n - values\n - default\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/priorityDefinition\"\n additionalProperties: false\n recurrencePolicy:\n type: object\n required:\n - syntax\n - maintain_due_date_offset\n - reset_body_checkboxes\n properties:\n syntax:\n const: tasknotes\n maintain_due_date_offset:\n type: boolean\n reset_body_checkboxes:\n type: boolean\n additionalProperties: false\n occurrencePolicy:\n type: object\n required:\n - identity_roles\n - default_materialization\n - default_next_trigger\n properties:\n identity_roles:\n const:\n - recurrenceParent\n - occurrenceDate\n default_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default_next_trigger:\n enum:\n - completion\n - completion_or_skip\n past_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n future_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n linkPolicy:\n type: object\n required:\n - accepted_formats\n - write_format\n properties:\n accepted_formats:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - wikilink\n - markdown\n write_format:\n enum:\n - wikilink\n - markdown\n additionalProperties: false\n archivePolicy:\n type: object\n required:\n - archived_tag\n - move_on_archive\n properties:\n archived_tag:\n $ref: \"#/$defs/nonEmptyString\"\n move_on_archive:\n type: boolean\n folder:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n timeTrackingPolicy:\n type: object\n required:\n - auto_stop_on_complete\n properties:\n auto_stop_on_complete:\n type: boolean\n additionalProperties: false\n templatingPolicy:\n type: object\n required:\n - enabled\n - occurrence_enabled\n properties:\n enabled:\n type: boolean\n template_path:\n $ref: \"#/$defs/nonEmptyString\"\n occurrence_enabled:\n type: boolean\n occurrence_template_path:\n $ref: \"#/$defs/nonEmptyString\"\n failure_mode:\n enum:\n - error\n - warning_fallback\n unknown_variable_policy:\n enum:\n - preserve\n - empty\n additionalProperties: false\n nlpTrigger:\n type: object\n required:\n - property_id\n - trigger\n - enabled\n properties:\n property_id:\n $ref: \"#/$defs/nonEmptyString\"\n trigger:\n $ref: \"#/$defs/nonEmptyString\"\n enabled:\n type: boolean\n additionalProperties: false\n nlpPolicy:\n type: object\n required:\n - triggers\n properties:\n triggers:\n type: array\n items:\n $ref: \"#/$defs/nlpTrigger\"\n additionalProperties: false\n---\n\n# TaskNotes task contract\n\nTypes implement this contract through `implements`; applications consume\nthe normalized contract view rather than assuming frontmatter names.\n" + }, + { + "source": "contracts/tasknotes.task/0.3.0-rc.6.md", + "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: tasknotes.task\nversion: 0.3.0-rc.6\nname: TaskNotes task\ndescription: Portable task data and behavior defined by tasknotes-spec 0.3.0-rc.6.\nrecord_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task.schema.json\n title: TaskNotes portable task view\n description: The storage-neutral record view exposed by the tasknotes.task 0.3.0-rc.6 record contract.\n type: object\n required:\n - status\n - dateCreated\n additionalProperties: false\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n type: string\n minLength: 1\n priority:\n type: string\n minLength: 1\n due:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled:\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n pattern: \\S\n description: Links to records implementing mdbase.person, such as [[Alex Rivera]]. Implementing types declare this field in collection.links. These references never grant collection access.\n attachments:\n type: array\n uniqueItems: true\n items:\n type: string\n minLength: 1\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrenceAnchor:\n enum:\n - scheduled\n - completion\n recurrenceParent:\n type: string\n occurrenceDate:\n type: string\n format: date\n occurrenceMaterialization:\n enum:\n - manual\n - on_completion\n - rolling\n occurrenceNextTrigger:\n enum:\n - completion\n - completion_or_skip\n occurrenceTemplate:\n type: string\n occurrencePastHorizon:\n type: string\n occurrenceFutureHorizon:\n type: string\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n reminders:\n type: array\n items:\n type: object\n blockedBy:\n type: array\n items:\n type: object\n completeInstances:\n type: array\n items:\n type: string\n format: date\n skippedInstances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n sortOrder:\n type: string\nbinding_schema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n $id: https://tasknotes.dev/schemas/tasknotes-task-binding.schema.json\n title: TaskNotes task data-contract binding\n description: Semantic configuration supplied by an mdbase type that implements tasknotes.task 0.3.0-rc.6. App behaviour, such as templates, archive moves, status cycling and natural-language triggers, lives in the app's tasknotes.settings record instead.\n type: object\n required:\n - profiles\n - capabilities\n - title\n - status\n - priority\n - recurrence\n - occurrences\n - links\n - archive\n properties:\n profiles:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - core-lite\n - recurrence\n - templating\n - materialized-occurrences\n - extended\n capabilities:\n type: array\n uniqueItems: true\n items:\n enum:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - rename\n - archive\n - batch\n - concurrency\n - dry-run\n - migration\n - templating\n title:\n $ref: \"#/$defs/titlePolicy\"\n status:\n $ref: \"#/$defs/statusPolicy\"\n priority:\n $ref: \"#/$defs/priorityPolicy\"\n recurrence:\n $ref: \"#/$defs/recurrencePolicy\"\n occurrences:\n $ref: \"#/$defs/occurrencePolicy\"\n links:\n $ref: \"#/$defs/linkPolicy\"\n archive:\n $ref: \"#/$defs/archivePolicy\"\n additionalProperties: false\n $defs:\n nonEmptyString:\n type: string\n minLength: 1\n stringSet:\n type: array\n uniqueItems: true\n items:\n $ref: \"#/$defs/nonEmptyString\"\n titlePolicy:\n type: object\n required:\n - storage\n properties:\n storage:\n enum:\n - filename\n - frontmatter\n filename_format:\n enum:\n - title\n - zettel\n - timestamp\n - uuid\n - custom\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n allOf:\n - if:\n properties:\n filename_format:\n const: custom\n required:\n - filename_format\n then:\n properties:\n custom_filename_template:\n $ref: \"#/$defs/nonEmptyString\"\n required:\n - custom_filename_template\n additionalProperties: true\n statusDefinition:\n type: object\n required:\n - value\n - label\n - color\n - is_completed\n - is_skipped\n - order\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n is_completed:\n type: boolean\n is_skipped:\n type: boolean\n order:\n type: number\n additionalProperties: true\n statusPolicy:\n type: object\n required:\n - values\n - default\n - completed_values\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n completed_values:\n $ref: \"#/$defs/stringSet\"\n skipped_values:\n $ref: \"#/$defs/stringSet\"\n default_skipped:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/statusDefinition\"\n additionalProperties: false\n priorityDefinition:\n type: object\n required:\n - value\n - label\n - color\n - weight\n properties:\n value:\n $ref: \"#/$defs/nonEmptyString\"\n label:\n type: string\n color:\n type: string\n icon:\n $ref: \"#/$defs/nonEmptyString\"\n weight:\n type: number\n additionalProperties: true\n priorityPolicy:\n type: object\n required:\n - values\n - default\n - definitions\n properties:\n values:\n $ref: \"#/$defs/stringSet\"\n default:\n $ref: \"#/$defs/nonEmptyString\"\n definitions:\n type: array\n items:\n $ref: \"#/$defs/priorityDefinition\"\n additionalProperties: false\n recurrencePolicy:\n type: object\n required:\n - syntax\n - maintain_due_date_offset\n properties:\n syntax:\n const: tasknotes\n maintain_due_date_offset:\n type: boolean\n additionalProperties: false\n occurrencePolicy:\n type: object\n required:\n - identity_roles\n - default_materialization\n - default_next_trigger\n properties:\n identity_roles:\n const:\n - recurrenceParent\n - occurrenceDate\n default_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default_next_trigger:\n enum:\n - completion\n - completion_or_skip\n past_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n future_horizon:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n linkPolicy:\n type: object\n required:\n - accepted_formats\n properties:\n accepted_formats:\n type: array\n minItems: 1\n uniqueItems: true\n items:\n enum:\n - wikilink\n - markdown\n additionalProperties: false\n archivePolicy:\n type: object\n required:\n - archived_tag\n properties:\n archived_tag:\n $ref: \"#/$defs/nonEmptyString\"\n additionalProperties: false\n---\n\n# TaskNotes task contract\n\nTypes implement this contract through `implements`; applications consume\nthe normalized contract view rather than assuming frontmatter names.\n" + }, + { + "source": "types/tasknotes-task/6.md", + "document": "---\nkind: mdbase.type\nname: task\nversion: 5\ndescription: A task managed by TaskNotes.\nmatch:\n where:\n tags:\n contains: task\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n type: object\n additionalProperties: true\n properties:\n id:\n type: string\n minLength: 1\n title:\n type: string\n minLength: 1\n status:\n enum: &a2\n - none\n - open\n - in-progress\n - done\n - cancelled\n default: open\n priority:\n enum: &a4\n - none\n - low\n - normal\n - high\n default: normal\n due: &a1\n anyOf:\n - type: string\n format: date\n - type: string\n format: date-time\n scheduled: *a1\n contexts:\n type: array\n items:\n type: string\n projects:\n type: array\n items:\n type: string\n assignees:\n type: array\n items:\n type: string\n minLength: 1\n pattern: \\S\n uniqueItems: true\n attachments:\n type: array\n items:\n type: string\n minLength: 1\n uniqueItems: true\n timeEstimate:\n type: integer\n minimum: 0\n completedDate:\n type: string\n format: date\n dateCreated:\n type: string\n format: date-time\n dateModified:\n type: string\n format: date-time\n recurrence:\n type: string\n recurrence_anchor:\n enum:\n - scheduled\n - completion\n default: scheduled\n occurrence_materialization:\n enum:\n - manual\n - on_completion\n - rolling\n default: manual\n occurrence_next_trigger:\n enum:\n - completion\n - completion_or_skip\n default: completion\n occurrence_template:\n type: string\n occurrence_past_horizon:\n type: string\n occurrence_future_horizon:\n type: string\n recurrence_parent:\n type: string\n occurrence_date:\n type: string\n format: date\n tags:\n type: array\n items:\n type: string\n timeEntries:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n startTime:\n type: string\n format: date-time\n endTime:\n type: string\n format: date-time\n description:\n type: string\n duration:\n type: integer\n reminders:\n type: array\n items:\n oneOf:\n - type: object\n required:\n - id\n - type\n - absoluteTime\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: absolute\n description:\n type: string\n absoluteTime:\n type: string\n format: date-time\n - type: object\n required:\n - id\n - type\n - relatedTo\n - offset\n additionalProperties: false\n properties:\n id:\n type: string\n type:\n const: relative\n description:\n type: string\n relatedTo:\n enum:\n - due\n - scheduled\n offset:\n type: string\n blockedBy:\n type: array\n items:\n type: object\n additionalProperties: false\n properties:\n uid:\n type: string\n reltype:\n type: string\n gap:\n type: string\n required:\n - uid\n complete_instances:\n type: array\n items:\n type: string\n format: date\n skipped_instances:\n type: array\n items:\n type: string\n format: date\n icsEventId:\n type: array\n items:\n type: string\n googleCalendarEventId:\n type: string\n googleCalendarExceptionEventId:\n type: string\n googleCalendarExceptionOriginalScheduled:\n type: string\n format: date\n googleCalendarMovedOriginalDates:\n type: array\n items:\n type: string\n format: date\n tasknotes_manual_order:\n type: string\n allOf:\n - if:\n required:\n - status\n properties:\n status:\n enum: &a3\n - done\n not:\n required:\n - recurrence\n then:\n required:\n - completedDate\n required:\n - title\n - status\n - dateCreated\ncollection:\n read_defaults:\n status: open\n priority: normal\n recurrence_anchor: scheduled\n occurrence_materialization: manual\n occurrence_next_trigger: completion\n links:\n projects[]:\n target_type: any\n validate_exists: false\n assignees[]:\n validate_exists: false\n attachments[]:\n validate_exists: false\n occurrence_template:\n target_type: any\n validate_exists: false\n recurrence_parent:\n target_type: task\n validate_exists: false\n blockedBy[].uid:\n target_type: task\n validate_exists: false\n path:\n runtime: tasknotes\n template: \"{{zettel}}\"\n folder: tasks\n generated_by: tasknotes.filename.create\n display:\n name_field: title\n unique:\n - field: id\n scope: type\nlifecycle:\n on_create:\n set:\n id:\n uuid: true\n dateCreated:\n now: true\n dateModified:\n now: true\n on_update:\n set:\n dateModified:\n now: true\nimplements:\n - contract: tasknotes.task\n version: 0.3.0-rc.6\n fields:\n id: id\n title: title\n status: status\n priority: priority\n due: due\n scheduled: scheduled\n contexts: contexts\n projects: projects\n assignees: assignees\n attachments: attachments\n timeEstimate: timeEstimate\n completedDate: completedDate\n dateCreated: dateCreated\n dateModified: dateModified\n recurrence: recurrence\n recurrenceAnchor: recurrence_anchor\n occurrenceMaterialization: occurrence_materialization\n occurrenceNextTrigger: occurrence_next_trigger\n occurrenceTemplate: occurrence_template\n occurrencePastHorizon: occurrence_past_horizon\n occurrenceFutureHorizon: occurrence_future_horizon\n recurrenceParent: recurrence_parent\n occurrenceDate: occurrence_date\n tags: tags\n timeEntries: timeEntries\n reminders: reminders\n blockedBy: blockedBy\n completeInstances: complete_instances\n skippedInstances: skipped_instances\n icsEventId: icsEventId\n googleCalendarEventId: googleCalendarEventId\n googleCalendarExceptionEventId: googleCalendarExceptionEventId\n googleCalendarExceptionOriginalScheduled: googleCalendarExceptionOriginalScheduled\n googleCalendarMovedOriginalDates: googleCalendarMovedOriginalDates\n sortOrder: tasknotes_manual_order\n binding:\n profiles:\n - core-lite\n - recurrence\n - materialized-occurrences\n capabilities:\n - dependencies\n - reminders\n - attachments\n - links\n - time-tracking\n - materialized-occurrences\n - archive\n - templating\n title:\n storage: frontmatter\n filename_format: zettel\n status:\n values: *a2\n default: open\n completed_values: *a3\n skipped_values:\n - cancelled\n default_skipped: cancelled\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: false\n order: 0\n - value: open\n label: Open\n color: \"#64748b\"\n is_completed: false\n is_skipped: false\n order: 1\n - value: in-progress\n label: In progress\n color: \"#3b82f6\"\n is_completed: false\n is_skipped: false\n order: 2\n - value: done\n label: Done\n color: \"#22c55e\"\n is_completed: true\n is_skipped: false\n order: 3\n - value: cancelled\n label: Cancelled\n color: \"#94a3b8\"\n is_completed: false\n is_skipped: true\n order: 4\n priority:\n values: *a4\n default: normal\n definitions:\n - value: none\n label: None\n color: \"#94a3b8\"\n weight: 0\n - value: low\n label: Low\n color: \"#3b82f6\"\n weight: 1\n - value: normal\n label: Normal\n color: \"#f59e0b\"\n weight: 2\n - value: high\n label: High\n color: \"#ef4444\"\n weight: 3\n recurrence:\n syntax: tasknotes\n maintain_due_date_offset: true\n occurrences:\n identity_roles:\n - recurrenceParent\n - occurrenceDate\n default_materialization: manual\n default_next_trigger: completion\n past_horizon: P0D\n future_horizon: P14D\n links:\n accepted_formats:\n - wikilink\n - markdown\n archive:\n archived_tag: archived\nx-tasknotes-generator:\n managed_fields:\n - attachments\n - blockedBy\n - complete_instances\n - completedDate\n - contexts\n - dateCreated\n - dateModified\n - due\n - googleCalendarEventId\n - googleCalendarExceptionEventId\n - googleCalendarExceptionOriginalScheduled\n - googleCalendarMovedOriginalDates\n - icsEventId\n - id\n - occurrence_date\n - occurrence_future_horizon\n - occurrence_materialization\n - occurrence_next_trigger\n - occurrence_past_horizon\n - occurrence_template\n - priority\n - projects\n - recurrence\n - recurrence_anchor\n - recurrence_parent\n - reminders\n - scheduled\n - skipped_instances\n - status\n - tags\n - tasknotes_manual_order\n - timeEntries\n - timeEstimate\n - title\n---\n# Task\n\nTask records live under `tasks/`.\n" + }, + { + "source": "schemas/tasknotes.task/0.3.0-rc.6.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://tasknotes.dev/schemas/tasknotes-task.schema.json\",\n \"title\": \"TaskNotes portable task view\",\n \"description\": \"The storage-neutral record view exposed by the tasknotes.task 0.3.0-rc.6 record contract.\",\n \"type\": \"object\",\n \"required\": [\n \"status\",\n \"dateCreated\"\n ],\n \"additionalProperties\": false,\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"status\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"priority\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"due\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ]\n },\n \"scheduled\": {\n \"anyOf\": [\n {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n ]\n },\n \"contexts\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"projects\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"assignees\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"description\": \"Links to records implementing mdbase.person, such as [[Alex Rivera]]. Implementing types declare this field in collection.links. These references never grant collection access.\"\n },\n \"attachments\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n },\n \"timeEstimate\": {\n \"type\": \"integer\",\n \"minimum\": 0\n },\n \"completedDate\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"dateCreated\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"dateModified\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"recurrence\": {\n \"type\": \"string\"\n },\n \"recurrenceAnchor\": {\n \"enum\": [\n \"scheduled\",\n \"completion\"\n ]\n },\n \"recurrenceParent\": {\n \"type\": \"string\"\n },\n \"occurrenceDate\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"occurrenceMaterialization\": {\n \"enum\": [\n \"manual\",\n \"on_completion\",\n \"rolling\"\n ]\n },\n \"occurrenceNextTrigger\": {\n \"enum\": [\n \"completion\",\n \"completion_or_skip\"\n ]\n },\n \"occurrenceTemplate\": {\n \"type\": \"string\"\n },\n \"occurrencePastHorizon\": {\n \"type\": \"string\"\n },\n \"occurrenceFutureHorizon\": {\n \"type\": \"string\"\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"timeEntries\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"reminders\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"blockedBy\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n }\n },\n \"completeInstances\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"skippedInstances\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"icsEventId\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"googleCalendarEventId\": {\n \"type\": \"string\"\n },\n \"googleCalendarExceptionEventId\": {\n \"type\": \"string\"\n },\n \"googleCalendarExceptionOriginalScheduled\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"googleCalendarMovedOriginalDates\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"date\"\n }\n },\n \"sortOrder\": {\n \"type\": \"string\"\n }\n }\n}\n" + }, + { + "source": "schemas/tasknotes.task.binding/0.3.0-rc.6.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://tasknotes.dev/schemas/tasknotes-task-binding.schema.json\",\n \"title\": \"TaskNotes task data-contract binding\",\n \"description\": \"Semantic configuration supplied by an mdbase type that implements tasknotes.task 0.3.0-rc.6. App behaviour, such as templates, archive moves, status cycling and natural-language triggers, lives in the app's tasknotes.settings record instead.\",\n \"type\": \"object\",\n \"required\": [\n \"profiles\",\n \"capabilities\",\n \"title\",\n \"status\",\n \"priority\",\n \"recurrence\",\n \"occurrences\",\n \"links\",\n \"archive\"\n ],\n \"properties\": {\n \"profiles\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"core-lite\",\n \"recurrence\",\n \"templating\",\n \"materialized-occurrences\",\n \"extended\"\n ]\n }\n },\n \"capabilities\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"dependencies\",\n \"reminders\",\n \"attachments\",\n \"links\",\n \"time-tracking\",\n \"materialized-occurrences\",\n \"rename\",\n \"archive\",\n \"batch\",\n \"concurrency\",\n \"dry-run\",\n \"migration\",\n \"templating\"\n ]\n }\n },\n \"title\": {\n \"$ref\": \"#/$defs/titlePolicy\"\n },\n \"status\": {\n \"$ref\": \"#/$defs/statusPolicy\"\n },\n \"priority\": {\n \"$ref\": \"#/$defs/priorityPolicy\"\n },\n \"recurrence\": {\n \"$ref\": \"#/$defs/recurrencePolicy\"\n },\n \"occurrences\": {\n \"$ref\": \"#/$defs/occurrencePolicy\"\n },\n \"links\": {\n \"$ref\": \"#/$defs/linkPolicy\"\n },\n \"archive\": {\n \"$ref\": \"#/$defs/archivePolicy\"\n }\n },\n \"additionalProperties\": false,\n \"$defs\": {\n \"nonEmptyString\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"stringSet\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"titlePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"storage\"\n ],\n \"properties\": {\n \"storage\": {\n \"enum\": [\n \"filename\",\n \"frontmatter\"\n ]\n },\n \"filename_format\": {\n \"enum\": [\n \"title\",\n \"zettel\",\n \"timestamp\",\n \"uuid\",\n \"custom\"\n ]\n },\n \"custom_filename_template\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"filename_format\": {\n \"const\": \"custom\"\n }\n },\n \"required\": [\n \"filename_format\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"custom_filename_template\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"required\": [\n \"custom_filename_template\"\n ]\n }\n }\n ],\n \"additionalProperties\": true\n },\n \"statusDefinition\": {\n \"type\": \"object\",\n \"required\": [\n \"value\",\n \"label\",\n \"color\",\n \"is_completed\",\n \"is_skipped\",\n \"order\"\n ],\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"color\": {\n \"type\": \"string\"\n },\n \"icon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"is_completed\": {\n \"type\": \"boolean\"\n },\n \"is_skipped\": {\n \"type\": \"boolean\"\n },\n \"order\": {\n \"type\": \"number\"\n }\n },\n \"additionalProperties\": true\n },\n \"statusPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"values\",\n \"default\",\n \"completed_values\",\n \"definitions\"\n ],\n \"properties\": {\n \"values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"completed_values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"skipped_values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default_skipped\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"definitions\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/statusDefinition\"\n }\n }\n },\n \"additionalProperties\": false\n },\n \"priorityDefinition\": {\n \"type\": \"object\",\n \"required\": [\n \"value\",\n \"label\",\n \"color\",\n \"weight\"\n ],\n \"properties\": {\n \"value\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"color\": {\n \"type\": \"string\"\n },\n \"icon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"weight\": {\n \"type\": \"number\"\n }\n },\n \"additionalProperties\": true\n },\n \"priorityPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"values\",\n \"default\",\n \"definitions\"\n ],\n \"properties\": {\n \"values\": {\n \"$ref\": \"#/$defs/stringSet\"\n },\n \"default\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"definitions\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/priorityDefinition\"\n }\n }\n },\n \"additionalProperties\": false\n },\n \"recurrencePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"syntax\",\n \"maintain_due_date_offset\"\n ],\n \"properties\": {\n \"syntax\": {\n \"const\": \"tasknotes\"\n },\n \"maintain_due_date_offset\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"occurrencePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"identity_roles\",\n \"default_materialization\",\n \"default_next_trigger\"\n ],\n \"properties\": {\n \"identity_roles\": {\n \"const\": [\n \"recurrenceParent\",\n \"occurrenceDate\"\n ]\n },\n \"default_materialization\": {\n \"enum\": [\n \"manual\",\n \"on_completion\",\n \"rolling\"\n ]\n },\n \"default_next_trigger\": {\n \"enum\": [\n \"completion\",\n \"completion_or_skip\"\n ]\n },\n \"past_horizon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"future_horizon\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false\n },\n \"linkPolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"accepted_formats\"\n ],\n \"properties\": {\n \"accepted_formats\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"wikilink\",\n \"markdown\"\n ]\n }\n }\n },\n \"additionalProperties\": false\n },\n \"archivePolicy\": {\n \"type\": \"object\",\n \"required\": [\n \"archived_tag\"\n ],\n \"properties\": {\n \"archived_tag\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false\n }\n }\n}\n" + }, + { + "source": "schemas/mdbase.app-settings/1.0.0.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"mdbase.app-settings 1.0.0 record contract view\",\n \"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.\",\n \"type\": \"object\",\n \"required\": [\"app\", \"scope\", \"settings_version\"],\n \"properties\": {\n \"app\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9]+([.-][a-z0-9]+)*$\",\n \"description\": \"The app whose clients honour these settings, such as tasknotes or dev.mdbase.reader.\"\n },\n \"scope\": {\n \"enum\": [\"collection\", \"user\"],\n \"description\": \"Who the values apply to: everyone using the app in this collection, or one person.\"\n },\n \"user\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"A link to the mdbase.person record the values apply to. Present only when scope is user.\"\n },\n \"settings_version\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"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.\"\n }\n },\n \"allOf\": [\n {\n \"if\": { \"properties\": { \"scope\": { \"const\": \"user\" } }, \"required\": [\"scope\"] },\n \"then\": { \"required\": [\"user\"] },\n \"else\": { \"not\": { \"required\": [\"user\"] } }\n }\n ],\n \"additionalProperties\": true\n}\n" + }, + { + "source": "contracts/mdbase.app-settings/1.0.0.md", + "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: mdbase.app-settings\nversion: 1.0.0\nname: App settings\ndescription: One record per app holding the policy that app's clients honour in this collection.\nrecord_schema:\n dialect: json-schema-2020-12\n ref: ../../schemas/mdbase.app-settings/1.0.0.schema.json\n---\n\n# App settings\n\nAn app settings record holds values that every client of one app honours in this\ncollection, such as how new files are named. The values change client behaviour,\nnever what another record means.\n\n## Location and identity\n\nA collection-scope record lives at `_settings/.md`, where `` is the\nrecord's `app` field. Clients read it by that path, without a query. Each\nimplementing type declares `collection.unique` on `app` with `scope: type`, so a\ncollection holds at most one collection-scope record per app.\n\nThe record's `type` field names the app's own settings type, not a shared value.\nGeneric tools find every settings record through this contract.\n\n## Reserved fields\n\n- `app`: the app id.\n- `scope`: `collection`, or `user` for one person's overrides.\n- `user`: a link to an `mdbase.person` record, present only when `scope` is\n `user`.\n- `settings_version`: the version of the app's settings schema that last wrote\n the record.\n\nEvery other frontmatter field belongs to the app and is described by the app's\nown settings contract. The body is free Markdown for people; apps never parse it.\n\n## Client behaviour\n\n- A missing record means every setting has its default. Clients never create the\n record on read.\n- A missing or invalid field takes its default; valid fields are used as\n written. The record is not rewritten until someone saves.\n- A save creates the record at its fixed path the first time, and otherwise\n patches only the fields it changes, guarded by the record's revision.\n- A client that finds a `settings_version` newer than it understands treats the\n settings as read-only and uses them as written.\n\n## Authority\n\nThis artifact is passive. A settings record grants nothing and must never hold\nsecrets: anyone who can read or write records can read or edit it.\n" + }, + { + "source": "schemas/tasknotes.settings/1.0.0.schema.json", + "document": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"title\": \"tasknotes.settings 1.0.0\",\n \"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.\",\n \"type\": \"object\",\n \"required\": [\n \"app\",\n \"scope\",\n \"settings_version\"\n ],\n \"properties\": {\n \"app\": {\n \"const\": \"dev.tasknotes\",\n \"description\": \"Marks this record as TaskNotes' settings.\"\n },\n \"scope\": {\n \"const\": \"collection\",\n \"description\": \"These settings apply to everyone using TaskNotes in this collection.\"\n },\n \"settings_version\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"description\": \"The version of these settings that last wrote the record. TaskNotes writes 1.\"\n },\n \"nlp_triggers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\n \"property_id\",\n \"trigger\",\n \"enabled\"\n ],\n \"properties\": {\n \"property_id\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"trigger\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"enabled\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"description\": \"Natural-language capture triggers, such as @ for contexts. Without the field each client uses its own defaults.\"\n },\n \"template_enabled\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Apply template_path to the body of new tasks.\"\n },\n \"template_path\": {\n \"type\": \"string\",\n \"description\": \"The template for new task bodies. Empty or absent means none.\"\n },\n \"occurrence_template_enabled\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Apply occurrence_template_path to new materialized occurrences.\"\n },\n \"occurrence_template_path\": {\n \"type\": \"string\",\n \"description\": \"The template for new occurrence bodies. Empty or absent means none.\"\n },\n \"template_failure_mode\": {\n \"enum\": [\n \"error\",\n \"warning_fallback\"\n ],\n \"description\": \"What a client does when a template cannot be applied.\"\n },\n \"template_unknown_variable_policy\": {\n \"enum\": [\n \"preserve\",\n \"empty\"\n ],\n \"description\": \"What a client writes for a template variable it does not know.\"\n },\n \"move_on_archive\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Move a task's file to archive_folder when it is archived.\"\n },\n \"archive_folder\": {\n \"type\": \"string\",\n \"description\": \"Where archived tasks move to. Empty or absent means the client's default.\"\n },\n \"auto_stop_time_tracking_on_complete\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Stop a running timer when its task is completed.\"\n },\n \"reset_body_checkboxes_on_recurrence\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Uncheck body checkboxes when a recurring task moves to its next occurrence.\"\n },\n \"link_write_format\": {\n \"enum\": [\n \"wikilink\",\n \"markdown\"\n ],\n \"default\": \"wikilink\",\n \"description\": \"How clients write links into task frontmatter. Both formats are always read.\"\n },\n \"status_behavior\": {\n \"type\": \"object\",\n \"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.\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"properties\": {\n \"next_status\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The status the cycle moves to next.\"\n },\n \"exclude_from_cycle\": {\n \"type\": \"boolean\",\n \"description\": \"Leave this status out of the status cycle.\"\n },\n \"auto_archive\": {\n \"type\": \"boolean\",\n \"description\": \"Archive a task some time after it takes this status.\"\n },\n \"auto_archive_delay_minutes\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"description\": \"How long after taking this status a task is archived.\"\n }\n },\n \"additionalProperties\": false\n },\n \"default\": {}\n }\n },\n \"additionalProperties\": true\n}\n" + }, + { + "source": "contracts/tasknotes.settings/1.0.0.md", + "document": "---\nkind: mdbase.contract\ncontract_type: record\nid: tasknotes.settings\nversion: 1.0.0\nname: TaskNotes settings\ndescription: Collection-wide TaskNotes behaviour, such as templates, archive moves and status cycling.\nrecord_schema:\n dialect: json-schema-2020-12\n ref: ../../schemas/tasknotes.settings/1.0.0.schema.json\n---\n\n# TaskNotes settings\n\nThe collection's settings record for TaskNotes, at `_settings/dev.tasknotes.md`.\nIt also implements `mdbase.app-settings`, whose reserved fields (`app`, `scope`,\n`settings_version`) it shares.\n\nThese settings change what TaskNotes clients do, never what a task record\nmeans: that stays in the `tasknotes.task` binding of each task type.\n`tasknotes.task` 0.3.0-rc.6 moved them here from the binding. A client reads\neach setting from this record, then from an earlier binding that still holds\nit, then uses its default, so a collection whose task type is still on rc.5\nkeeps its behaviour until it is upgraded.\n\n## Fields\n\n- `nlp_triggers`: natural-language capture triggers. Without it, each client\n uses its own defaults.\n- `template_enabled`, `template_path`, `occurrence_template_enabled`,\n `occurrence_template_path`, `template_failure_mode`,\n `template_unknown_variable_policy`: body templates for new tasks and\n materialized occurrences.\n- `move_on_archive`, `archive_folder`: whether archiving moves the file, and\n where to.\n- `auto_stop_time_tracking_on_complete`: stop a running timer on completion.\n- `reset_body_checkboxes_on_recurrence`: uncheck body checkboxes when a\n recurring task advances.\n- `link_write_format`: `wikilink` or `markdown` for links written to task\n frontmatter.\n- `status_behavior`: per status value, `next_status`, `exclude_from_cycle`,\n `auto_archive` and `auto_archive_delay_minutes`. A status without an entry\n has no next status and no auto-archive (5 minute delay), and is out of the\n cycle exactly when it is a skipped status.\n\n## Authority\n\nThis artifact is passive and grants nothing.\n" + }, + { + "source": "types/tasknotes-settings/1.md", + "document": "---\nkind: mdbase.type\nname: tasknotes-settings\nversion: 1\ndescription: TaskNotes' collection-wide settings, one record at _settings/dev.tasknotes.md.\nmatch:\n where:\n app:\n eq: dev.tasknotes\nschema:\n dialect: json-schema-2020-12\n value:\n $schema: https://json-schema.org/draft/2020-12/schema\n title: tasknotes.settings 1.0.0\n 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.\n type: object\n required:\n - app\n - scope\n - settings_version\n properties:\n app:\n const: dev.tasknotes\n description: Marks this record as TaskNotes' settings.\n scope:\n const: collection\n description: These settings apply to everyone using TaskNotes in this collection.\n settings_version:\n type: integer\n minimum: 1\n description: The version of these settings that last wrote the record. TaskNotes writes 1.\n nlp_triggers:\n type: array\n items:\n type: object\n required:\n - property_id\n - trigger\n - enabled\n properties:\n property_id:\n type: string\n minLength: 1\n trigger:\n type: string\n minLength: 1\n enabled:\n type: boolean\n additionalProperties: false\n description: Natural-language capture triggers, such as @ for contexts. Without the field each client uses its own defaults.\n template_enabled:\n type: boolean\n default: false\n description: Apply template_path to the body of new tasks.\n template_path:\n type: string\n description: The template for new task bodies. Empty or absent means none.\n occurrence_template_enabled:\n type: boolean\n default: false\n description: Apply occurrence_template_path to new materialized occurrences.\n occurrence_template_path:\n type: string\n description: The template for new occurrence bodies. Empty or absent means none.\n template_failure_mode:\n enum:\n - error\n - warning_fallback\n description: What a client does when a template cannot be applied.\n template_unknown_variable_policy:\n enum:\n - preserve\n - empty\n description: What a client writes for a template variable it does not know.\n move_on_archive:\n type: boolean\n default: false\n description: Move a task's file to archive_folder when it is archived.\n archive_folder:\n type: string\n description: Where archived tasks move to. Empty or absent means the client's default.\n auto_stop_time_tracking_on_complete:\n type: boolean\n default: false\n description: Stop a running timer when its task is completed.\n reset_body_checkboxes_on_recurrence:\n type: boolean\n default: false\n description: Uncheck body checkboxes when a recurring task moves to its next occurrence.\n link_write_format:\n enum:\n - wikilink\n - markdown\n default: wikilink\n description: How clients write links into task frontmatter. Both formats are always read.\n status_behavior:\n type: object\n 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.\n additionalProperties:\n type: object\n properties:\n next_status:\n type: string\n minLength: 1\n description: The status the cycle moves to next.\n exclude_from_cycle:\n type: boolean\n description: Leave this status out of the status cycle.\n auto_archive:\n type: boolean\n description: Archive a task some time after it takes this status.\n auto_archive_delay_minutes:\n type: number\n minimum: 0\n description: How long after taking this status a task is archived.\n additionalProperties: false\n default: {}\n additionalProperties: true\ncollection:\n unique:\n - field: app\n scope: type\nimplements:\n - contract: mdbase.app-settings\n version: 1.0.0\n fields:\n app: app\n scope: scope\n settings_version: settings_version\n - contract: tasknotes.settings\n version: 1.0.0\n fields:\n app: app\n scope: scope\n settings_version: settings_version\n nlp_triggers: nlp_triggers\n template_enabled: template_enabled\n template_path: template_path\n occurrence_template_enabled: occurrence_template_enabled\n occurrence_template_path: occurrence_template_path\n template_failure_mode: template_failure_mode\n template_unknown_variable_policy: template_unknown_variable_policy\n move_on_archive: move_on_archive\n archive_folder: archive_folder\n auto_stop_time_tracking_on_complete: auto_stop_time_tracking_on_complete\n reset_body_checkboxes_on_recurrence: reset_body_checkboxes_on_recurrence\n link_write_format: link_write_format\n status_behavior: status_behavior\n---\n\n# TaskNotes settings\n\nSettings that every TaskNotes client honours in this collection, such as body\ntemplates, archive moves and status cycling. TaskNotes reads them from\n`_settings/dev.tasknotes.md` and writes only the fields a save changes.\n" + } + ], + "provides": [ + { + "id": "tasknotes.task", + "version": "0.3.0-rc.6", + "digest": "sha256:c400ead6e218b715d86ad31125bb3d4b2e276817da6ba8065449fd0947b24d67" + }, + { + "id": "tasknotes.settings", + "version": "1.0.0", + "digest": "sha256:a61d55535871d27e9599cb3588148a0590d9e2198d6ee7a0bf3197350b60dc53" + }, + { + "id": "mdbase.app-settings", + "version": "1.0.0", + "digest": "sha256:4ae872a56290e2739ff876df1ca8fdac428753c854d65fd8e8e62045bd643a4e" + } + ] +}