diff --git a/package.json b/package.json index b0289048..28b1136e 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@mdbase-dev/connect": "0.1.0-beta.114", "@mdbase-dev/connect-protocol": "0.1.0-beta.114", "@tanstack/react-virtual": "3.14.11", - "@tasknotes/model": "file:vendor/tasknotes-model-0.3.0-rc.13.tgz", + "@tasknotes/model": "file:vendor/tasknotes-model-0.3.0-rc.14.tgz", "codemirror": "^6.0.2", "dexie": "4.4.4", "firebase": "12.16.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63a2cfb9..c16e2ee3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,8 +86,8 @@ importers: specifier: 3.14.11 version: 3.14.11(react-dom@19.2.8(react@19.2.8))(react@19.2.8) '@tasknotes/model': - specifier: file:vendor/tasknotes-model-0.3.0-rc.13.tgz - version: file:vendor/tasknotes-model-0.3.0-rc.13.tgz + specifier: file:vendor/tasknotes-model-0.3.0-rc.14.tgz + version: file:vendor/tasknotes-model-0.3.0-rc.14.tgz codemirror: specifier: ^6.0.2 version: 6.0.2 @@ -1067,9 +1067,9 @@ packages: '@tanstack/virtual-core@3.17.9': resolution: {integrity: sha512-M8Bzy7CCMvUjRiuoHVH9mRjyUVczRs8v8RcUEphLFGc445ZP4KQ15Y1sLqhQqJi/HgGJrxfCHnEnIX0x9mVrBg==} - '@tasknotes/model@file:vendor/tasknotes-model-0.3.0-rc.13.tgz': - resolution: {integrity: sha512-8nhai/jRRVqVvw/EuCmmFRzcdRX1nVs+wsa4pwHKq0YD9H6sbjj9DbnbJ/WRjis2RBhGQr48qFHMBVfsStplEQ==, tarball: file:vendor/tasknotes-model-0.3.0-rc.13.tgz} - version: 0.3.0-rc.13 + '@tasknotes/model@file:vendor/tasknotes-model-0.3.0-rc.14.tgz': + resolution: {integrity: sha512-mU22LkvICKlKz5nGznzhiI82fkGF5sJBe1k4UQIuUuvLwSKM5zEllelaTT+hmDsPrYZgns6mQlcC9deS5MWqEQ==, tarball: file:vendor/tasknotes-model-0.3.0-rc.14.tgz} + version: 0.3.0-rc.14 '@testing-library/dom@10.4.1': resolution: {integrity: sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==} @@ -4918,7 +4918,7 @@ snapshots: '@tanstack/virtual-core@3.17.9': {} - '@tasknotes/model@file:vendor/tasknotes-model-0.3.0-rc.13.tgz': + '@tasknotes/model@file:vendor/tasknotes-model-0.3.0-rc.14.tgz': dependencies: rrule: 2.8.1 yaml: 2.9.0 diff --git a/scripts/tasknotes-manifest.test.mjs b/scripts/tasknotes-manifest.test.mjs index 74b55de7..f6a63a07 100644 --- a/scripts/tasknotes-manifest.test.mjs +++ b/scripts/tasknotes-manifest.test.mjs @@ -6,6 +6,7 @@ import { TASKNOTES_APP_TYPE_PACK_VERSION, } from "./tasknotes-manifest.mjs"; import { buildAppTaskNotesResources } from "./tasknotes-resources.mjs"; +import { loadCanonicalTaskNotesTypePack } from "./canonical-task-pack.mjs"; describe("TaskNotes mdbase manifest", () => { it("declares content-free runtime criteria without requiring Firebase", async () => { @@ -153,6 +154,17 @@ describe("TaskNotes mdbase manifest", () => { ]); }); + it("generates exactly the starter type the pinned pack installs", async () => { + const pack = await loadCanonicalTaskNotesTypePack(); + const typeResource = pack.manifest.resources.find( + (resource) => resource.target === "_types/task.md", + ); + const document = pack.resources.find( + (resource) => resource.source === typeResource.source, + ).document; + expect(buildAppTaskNotesResources().typeDocument).toBe(document); + }); + it("provisions TaskNotes-compatible string ranks for manual order", () => { const generated = buildAppTaskNotesResources(); const implementation = generated.type.implements.find( diff --git a/scripts/tasknotes-resources.mjs b/scripts/tasknotes-resources.mjs index 2a455563..9ee7f50d 100644 --- a/scripts/tasknotes-resources.mjs +++ b/scripts/tasknotes-resources.mjs @@ -1,90 +1,7 @@ -import { cloneDefaultModelConfig } from "@tasknotes/model/defaults"; -import { serializeMarkdownDocument } from "@tasknotes/model/frontmatter"; -import { buildTaskNotesMdbaseResources } from "@tasknotes/model/mdbase"; -import { TASKNOTES_SPEC_VERSION } from "@tasknotes/model/types"; +import { buildTaskNotesStarterResources } from "@tasknotes/model/starter"; +// The published TaskNotes starter (the tasknotes.task pack's seed type). It is +// defined, and pinned to the published pack, in @tasknotes/model. export function buildAppTaskNotesResources() { - const modelConfig = cloneDefaultModelConfig(); - const statusColors = { - none: "#94a3b8", - open: "#64748b", - "in-progress": "#3b82f6", - done: "#22c55e", - }; - const priorityColors = { - none: "#94a3b8", - low: "#3b82f6", - normal: "#f59e0b", - high: "#ef4444", - }; - modelConfig.statuses = modelConfig.statuses.map((status) => ({ - ...status, - color: statusColors[status.value] ?? status.color, - })); - modelConfig.priorities = modelConfig.priorities.map((priority) => ({ - ...priority, - color: priorityColors[priority.value] ?? priority.color, - })); - modelConfig.statuses.push({ - id: "cancelled", - value: "cancelled", - label: "Cancelled", - color: "#94a3b8", - isCompleted: false, - isSkipped: true, - excludeFromCycle: true, - order: modelConfig.statuses.length, - autoArchive: false, - autoArchiveDelay: 5, - }); - const resources = buildTaskNotesMdbaseResources({ - profiles: ["core-lite", "recurrence", "materialized-occurrences"], - modelConfig, - }); - const type = structuredClone(resources.type); - const taskSchema = structuredClone(resources.taskSchema); - const implementation = type.implements.find( - (candidate) => - candidate.contract === "tasknotes.task" && - candidate.version === TASKNOTES_SPEC_VERSION, - ); - if (!implementation) - throw new Error( - `The generated type does not implement tasknotes.task ${TASKNOTES_SPEC_VERSION}.`, - ); - const taskDateSchema = { - anyOf: [ - { type: "string", format: "date" }, - { type: "string", format: "date-time" }, - ], - }; - type.schema.value.properties[implementation.fields.due] = taskDateSchema; - type.schema.value.properties[implementation.fields.scheduled] = - taskDateSchema; - taskSchema.properties.due = taskDateSchema; - taskSchema.properties.scheduled = taskDateSchema; - const extension = implementation.binding; - extension.status = { - ...extension.status, - skipped_values: ["cancelled"], - default_skipped: "cancelled", - }; - extension.occurrences = { - ...extension.occurrences, - default_materialization: modelConfig.occurrences.defaultMaterialization, - default_next_trigger: modelConfig.occurrences.defaultNextTrigger, - past_horizon: modelConfig.occurrences.pastHorizon, - future_horizon: modelConfig.occurrences.futureHorizon, - }; - const body = `# Task - -Task records live under \`${resources.paths.records}/\`. -`; - return { - ...resources, - type, - taskSchema, - taskSchemaDocument: `${JSON.stringify(taskSchema, null, 2)}\n`, - typeDocument: serializeMarkdownDocument(type, body), - }; + return buildTaskNotesStarterResources(); } diff --git a/vendor/README.md b/vendor/README.md index 4d354d7f..7c584d73 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -10,7 +10,7 @@ suites passed: - `../mdbase-contracts` (`tasknotes.task` pack `0.3.0-rc.16`, catalog digest `sha256:02aa8b3b…`, see `vendor/mdbase-contracts`) -- `../tasknotes-model` (`0.3.0-rc.13`) +- `../tasknotes-model` (`0.3.0-rc.14`, whose `@tasknotes/model/starter` defines the published starter type) - `../tasknotes-nlp-core` (`62a0d9d`, including wikilink-safe parsing) - `../tasknotes-spec` - `../mdbase` diff --git a/vendor/tasknotes-model-0.3.0-rc.14.tgz b/vendor/tasknotes-model-0.3.0-rc.14.tgz new file mode 100644 index 00000000..3c65f1ad Binary files /dev/null and b/vendor/tasknotes-model-0.3.0-rc.14.tgz differ