md-task-viewer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -0
- package/dist/cli.js +639 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/assets/index-CJzl_cjb.js +53 -0
- package/dist/client/assets/index-D8W_VwBM.css +1 -0
- package/dist/client/index.html +13 -0
- package/dist/server.js +579 -0
- package/dist/server.js.map +1 -0
- package/package.json +65 -0
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/server.ts","../src/taskStore.ts","../src/types.ts"],"sourcesContent":["#!/usr/bin/env node\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport open from \"open\";\nimport { createServer } from \"./server.js\";\n\ninterface CliOptions {\n rootDir: string;\n port: number;\n host: string;\n shouldOpen: boolean;\n}\n\nfunction parseArgs(argv: string[]): CliOptions {\n let rootDir = process.cwd();\n let port = 3847;\n let host = \"127.0.0.1\";\n let shouldOpen = true;\n\n for (let index = 0; index < argv.length; index += 1) {\n const current = argv[index];\n if (current === \"--port\") {\n port = Number(argv[index + 1] ?? port);\n index += 1;\n continue;\n }\n if (current === \"--host\") {\n host = argv[index + 1] ?? host;\n index += 1;\n continue;\n }\n if (current === \"--no-open\") {\n shouldOpen = false;\n continue;\n }\n if (!current.startsWith(\"--\")) {\n rootDir = path.resolve(current);\n }\n }\n\n return { rootDir, port, host, shouldOpen };\n}\n\nasync function main(): Promise<void> {\n const options = parseArgs(process.argv.slice(2));\n const app = await createServer({ rootDir: options.rootDir });\n const address = await app.listen({\n port: options.port,\n host: options.host\n });\n\n const browserUrl = address.replace(options.host, options.host === \"0.0.0.0\" ? \"127.0.0.1\" : options.host);\n process.stdout.write(`Markdown Task Viewer\\nRoot: ${options.rootDir}\\nURL: ${browserUrl}\\n`);\n\n if (options.shouldOpen) {\n await open(browserUrl);\n }\n\n const shutdown = async (): Promise<void> => {\n await app.close();\n process.exit(0);\n };\n\n process.on(\"SIGINT\", shutdown);\n process.on(\"SIGTERM\", shutdown);\n}\n\nmain().catch((error) => {\n process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\\n`);\n process.exit(1);\n});\n","import Fastify, { type FastifyInstance } from \"fastify\";\nimport fastifyStatic from \"@fastify/static\";\nimport chokidar from \"chokidar\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n ConflictError,\n ValidationError,\n createTask,\n deleteTask,\n listTasks,\n parseOrderPayload,\n patchTaskFields,\n readConfig,\n saveConfig,\n saveOrder,\n updateTask\n} from \"./taskStore.js\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nexport interface CreateServerOptions {\n rootDir: string;\n clientDir?: string | null;\n}\n\nfunction resolveClientDir(explicitClientDir?: string | null): string | null {\n if (explicitClientDir === null) {\n return null;\n }\n if (explicitClientDir) {\n return explicitClientDir;\n }\n return path.resolve(__dirname, \"client\");\n}\n\nfunction sendJsonError(reply: { code: (statusCode: number) => { send: (payload: unknown) => void } }, error: unknown): void {\n if (error instanceof ValidationError) {\n reply.code(400).send({ error: error.message });\n return;\n }\n if (error instanceof ConflictError) {\n reply.code(409).send({ error: error.message });\n return;\n }\n reply.code(500).send({ error: error instanceof Error ? error.message : \"Internal server error\" });\n}\n\nexport async function createServer(options: CreateServerOptions): Promise<FastifyInstance> {\n const app = Fastify({ logger: false });\n const listeners = new Set<{ send: (payload: string) => void; close: () => void }>();\n const clientDir = resolveClientDir(options.clientDir);\n\n app.addHook(\"onClose\", async () => {\n for (const listener of listeners) {\n listener.close();\n }\n });\n\n app.get(\"/api/tasks\", async () => listTasks(options.rootDir));\n\n app.post(\"/api/tasks\", async (request, reply) => {\n try {\n const task = await createTask(options.rootDir, (request.body ?? {}) as never);\n return reply.code(201).send(task);\n } catch (error) {\n sendJsonError(reply, error);\n }\n });\n\n app.patch(\"/api/tasks/*\", async (request, reply) => {\n const currentPath = decodeURIComponent((request.params as { \"*\": string })[\"*\"] ?? \"\");\n try {\n const task = await updateTask(options.rootDir, currentPath, (request.body ?? {}) as never);\n return reply.send(task);\n } catch (error) {\n sendJsonError(reply, error);\n }\n });\n\n app.delete(\"/api/tasks/*\", async (request, reply) => {\n const currentPath = decodeURIComponent((request.params as { \"*\": string })[\"*\"] ?? \"\");\n try {\n await deleteTask(options.rootDir, currentPath);\n return reply.code(204).send();\n } catch (error) {\n sendJsonError(reply, error);\n }\n });\n\n app.patch(\"/api/task-fields/*\", async (request, reply) => {\n const currentPath = decodeURIComponent((request.params as { \"*\": string })[\"*\"] ?? \"\");\n try {\n const task = await patchTaskFields(options.rootDir, currentPath, (request.body ?? {}) as never);\n return reply.send(task);\n } catch (error) {\n sendJsonError(reply, error);\n }\n });\n\n app.put(\"/api/order\", async (request, reply) => {\n try {\n const order = parseOrderPayload((request.body as { order?: unknown } | null)?.order ?? []);\n await saveOrder(options.rootDir, order);\n return reply.code(204).send();\n } catch (error) {\n sendJsonError(reply, error);\n }\n });\n\n app.get(\"/api/config\", async () => {\n try {\n return await readConfig(options.rootDir);\n } catch (error) {\n return { version: 1, taskDirs: [\".\"], order: [] };\n }\n });\n\n app.put(\"/api/config\", async (request, reply) => {\n try {\n const body = request.body as { taskDirs?: unknown; ignorePaths?: unknown } | null;\n const taskDirs = body?.taskDirs;\n if (!Array.isArray(taskDirs) || taskDirs.some((item) => typeof item !== \"string\")) {\n throw new ValidationError(\"taskDirs must be an array of strings.\");\n }\n let ignorePaths: string[] | undefined;\n if (body?.ignorePaths !== undefined) {\n if (!Array.isArray(body.ignorePaths) || body.ignorePaths.some((item) => typeof item !== \"string\")) {\n throw new ValidationError(\"ignorePaths must be an array of strings.\");\n }\n ignorePaths = body.ignorePaths as string[];\n }\n const config = await saveConfig(options.rootDir, taskDirs as string[], ignorePaths);\n return reply.send(config);\n } catch (error) {\n sendJsonError(reply, error);\n }\n });\n\n app.get(\"/api/events\", async (_request, reply) => {\n reply.raw.writeHead(200, {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache, no-transform\",\n Connection: \"keep-alive\"\n });\n reply.raw.write(\"\\n\");\n\n const listener = {\n send(payload: string) {\n reply.raw.write(`data: ${payload}\\n\\n`);\n },\n close() {\n reply.raw.end();\n }\n };\n\n listeners.add(listener);\n reply.raw.on(\"close\", () => {\n listeners.delete(listener);\n });\n\n return reply.hijack();\n });\n\n const watcher = chokidar.watch(options.rootDir, {\n ignoreInitial: true,\n ignored: (watchPath) => watchPath.includes(`${path.sep}.git`) || watchPath.includes(`${path.sep}node_modules`)\n });\n\n watcher.on(\"all\", (eventName, changedPath) => {\n const isMarkdown = changedPath.endsWith(\".md\") || changedPath.endsWith(\".markdown\");\n const isConfigFile = path.basename(changedPath) === \".md-task-viewer.json\";\n if (!isMarkdown && !isConfigFile) {\n return;\n }\n\n const payload = JSON.stringify({\n type: \"tasks-changed\",\n eventName,\n path: path.relative(options.rootDir, changedPath)\n });\n\n for (const listener of listeners) {\n listener.send(payload);\n }\n });\n\n app.addHook(\"onClose\", async () => {\n await watcher.close();\n });\n\n if (clientDir) {\n await app.register(fastifyStatic, {\n root: clientDir,\n prefix: \"/\"\n });\n\n app.setNotFoundHandler(async (request, reply) => {\n if (request.raw.url?.startsWith(\"/api/\")) {\n return reply.code(404).send({ error: \"Not found\" });\n }\n return reply.sendFile(\"index.html\");\n });\n }\n\n return app;\n}\n","import matter from \"gray-matter\";\nimport picomatch from \"picomatch\";\nimport path from \"node:path\";\nimport { promises as fs } from \"node:fs\";\nimport {\n CONFIG_FILE_NAME,\n type ConfigFile,\n type CreateTaskInput,\n type PatchTaskFieldsInput,\n type TaskFrontmatter,\n type TaskListResponse,\n type TaskParseError,\n type TaskPriority,\n type TaskRecord,\n type TaskStatus,\n type UpdateTaskInput\n} from \"./types.js\";\n\nconst MARKDOWN_EXTENSIONS = new Set([\".md\", \".markdown\"]);\nconst REQUIRED_PRIORITY: TaskPriority[] = [\"MUST\", \"WANT\"];\nconst REQUIRED_STATUS: TaskStatus[] = [\"TODO\", \"WIP\", \"DONE\"];\n\nexport class ConflictError extends Error {}\nexport class ValidationError extends Error {}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.split(path.sep).join(\"/\");\n}\n\nfunction normalizeRelativePath(candidate: string): string {\n const normalized = toPosixPath(path.posix.normalize(candidate.trim()));\n if (!normalized || normalized === \".\" || normalized.startsWith(\"../\") || normalized.includes(\"/../\")) {\n throw new ValidationError(\"Path must stay within the workspace root.\");\n }\n\n return normalized.replace(/^\\.\\/+/, \"\");\n}\n\nfunction ensureMarkdownExtension(filePath: string): string {\n return path.posix.extname(filePath) ? filePath : `${filePath}.md`;\n}\n\nfunction asUtcISOString(date: Date): string {\n return date.toISOString();\n}\n\nfunction slugify(value: string): string {\n const slug = value\n .toLowerCase()\n .normalize(\"NFKD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n\n return slug || \"untitled-task\";\n}\n\nfunction buildDefaults(filePath: string, stats: { birthtime: Date; mtime: Date }): TaskFrontmatter {\n const basename = path.basename(filePath, path.extname(filePath));\n const title = basename.replace(/[-_]+/g, \" \").replace(/\\b\\w/g, (char) => char.toUpperCase());\n\n return {\n title,\n priority: \"WANT\",\n status: \"TODO\",\n createdAt: asUtcISOString(stats.birthtime),\n updatedAt: asUtcISOString(stats.mtime)\n };\n}\n\nfunction splitFrontmatter(data: Record<string, unknown>, statsDefaults: TaskFrontmatter): {\n frontmatter: TaskFrontmatter;\n extraFrontmatter: Record<string, unknown>;\n normalized: boolean;\n} {\n const extraFrontmatter: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(data)) {\n if (![\"title\", \"priority\", \"status\", \"createdAt\", \"updatedAt\"].includes(key)) {\n extraFrontmatter[key] = value;\n }\n }\n\n const title = typeof data.title === \"string\" && data.title.trim() ? data.title : statsDefaults.title;\n const priority = REQUIRED_PRIORITY.includes(data.priority as TaskPriority)\n ? (data.priority as TaskPriority)\n : statsDefaults.priority;\n const status = REQUIRED_STATUS.includes(data.status as TaskStatus)\n ? (data.status as TaskStatus)\n : statsDefaults.status;\n const createdAt =\n typeof data.createdAt === \"string\" && !Number.isNaN(Date.parse(data.createdAt))\n ? new Date(data.createdAt).toISOString()\n : statsDefaults.createdAt;\n const updatedAt =\n typeof data.updatedAt === \"string\" && !Number.isNaN(Date.parse(data.updatedAt))\n ? new Date(data.updatedAt).toISOString()\n : statsDefaults.updatedAt;\n\n const normalized =\n title !== data.title ||\n priority !== data.priority ||\n status !== data.status ||\n createdAt !== data.createdAt ||\n updatedAt !== data.updatedAt;\n\n return {\n frontmatter: { title, priority, status, createdAt, updatedAt },\n extraFrontmatter,\n normalized\n };\n}\n\nexport function serializeTask(record: TaskRecord): string {\n const data = {\n ...record.extraFrontmatter,\n title: record.frontmatter.title,\n priority: record.frontmatter.priority,\n status: record.frontmatter.status,\n createdAt: record.frontmatter.createdAt,\n updatedAt: record.frontmatter.updatedAt\n };\n\n return matter.stringify(record.content, data);\n}\n\nasync function readDirectoryRecursive(rootDir: string, currentDir: string, results: string[]): Promise<void> {\n const entries = await fs.readdir(currentDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.name === \".git\" || entry.name === \"node_modules\") {\n continue;\n }\n\n const absolutePath = path.join(currentDir, entry.name);\n if (entry.isDirectory()) {\n await readDirectoryRecursive(rootDir, absolutePath, results);\n continue;\n }\n\n if (entry.name === CONFIG_FILE_NAME) {\n continue;\n }\n\n if (!MARKDOWN_EXTENSIONS.has(path.extname(entry.name).toLowerCase())) {\n continue;\n }\n\n results.push(toPosixPath(path.relative(rootDir, absolutePath)));\n }\n}\n\nasync function listMarkdownFiles(rootDir: string, taskDirs: string[], ignorePaths: string[]): Promise<string[]> {\n const results: string[] = [];\n const seen = new Set<string>();\n\n const isIgnored = ignorePaths.length > 0 ? picomatch(ignorePaths) : null;\n\n for (const taskDir of taskDirs) {\n const scanDir = path.resolve(rootDir, taskDir);\n try {\n await fs.access(scanDir);\n } catch {\n continue;\n }\n const dirResults: string[] = [];\n await readDirectoryRecursive(rootDir, scanDir, dirResults);\n for (const filePath of dirResults) {\n if (!seen.has(filePath)) {\n seen.add(filePath);\n if (isIgnored && isIgnored(filePath)) {\n continue;\n }\n results.push(filePath);\n }\n }\n }\n\n return results.sort();\n}\n\nexport async function parseTask(rootDir: string, relativePath: string): Promise<TaskRecord> {\n const absolutePath = path.join(rootDir, relativePath);\n const raw = await fs.readFile(absolutePath, \"utf8\");\n const stats = await fs.stat(absolutePath);\n const parsed = matter(raw);\n const defaults = buildDefaults(relativePath, stats);\n const { frontmatter, extraFrontmatter, normalized } = splitFrontmatter(parsed.data, defaults);\n\n return {\n path: toPosixPath(relativePath),\n content: parsed.content,\n frontmatter,\n extraFrontmatter,\n raw,\n normalized\n };\n}\n\nexport async function readConfig(rootDir: string): Promise<ConfigFile> {\n const configFilePath = path.join(rootDir, CONFIG_FILE_NAME);\n\n try {\n const raw = await fs.readFile(configFilePath, \"utf8\");\n const parsed = JSON.parse(raw) as Partial<ConfigFile>;\n const taskDirs = Array.isArray(parsed.taskDirs)\n ? parsed.taskDirs.filter((item): item is string => typeof item === \"string\")\n : [\".\"];\n const ignorePaths = Array.isArray(parsed.ignorePaths)\n ? parsed.ignorePaths.filter((item): item is string => typeof item === \"string\")\n : [];\n const order = Array.isArray(parsed.order)\n ? parsed.order.filter((item): item is string => typeof item === \"string\")\n : [];\n return { version: parsed.version ?? 1, taskDirs, ignorePaths, order };\n } catch (error) {\n const maybeError = error as NodeJS.ErrnoException;\n if (maybeError.code !== \"ENOENT\") {\n throw error;\n }\n return { version: 1, taskDirs: [\".\"], ignorePaths: [], order: [] };\n }\n}\n\nasync function reconcileOrder(rootDir: string, taskPaths: string[]): Promise<{ order: string[]; changed: boolean }> {\n const config = await readConfig(rootDir);\n const order = config.order;\n\n const known = new Set(taskPaths);\n const nextOrder = order.filter((item) => known.has(item));\n for (const taskPath of taskPaths) {\n if (!nextOrder.includes(taskPath)) {\n nextOrder.push(taskPath);\n }\n }\n\n const changed = nextOrder.length !== order.length || nextOrder.some((item, index) => item !== order[index]);\n return { order: nextOrder, changed };\n}\n\nexport async function saveOrder(rootDir: string, order: string[]): Promise<void> {\n const normalized = Array.from(\n new Set(\n order.map((item) => ensureMarkdownExtension(normalizeRelativePath(item)))\n )\n );\n const existing = await readConfig(rootDir);\n const payload: ConfigFile = { version: 1, taskDirs: existing.taskDirs, ignorePaths: existing.ignorePaths, order: normalized };\n await fs.writeFile(path.join(rootDir, CONFIG_FILE_NAME), `${JSON.stringify(payload, null, 2)}\\n`, \"utf8\");\n}\n\nexport async function saveConfig(rootDir: string, taskDirs: string[], ignorePaths?: string[]): Promise<ConfigFile> {\n const validated = taskDirs.map((dir) => {\n const normalized = dir.trim().replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\") || \".\";\n if (normalized.startsWith(\"../\") || normalized.includes(\"/../\")) {\n throw new ValidationError(\"taskDirs must stay within the workspace root.\");\n }\n return normalized;\n });\n if (validated.length === 0) {\n throw new ValidationError(\"taskDirs must contain at least one directory.\");\n }\n const existing = await readConfig(rootDir);\n const validatedIgnorePaths = ignorePaths ?? existing.ignorePaths;\n const payload: ConfigFile = { version: 1, taskDirs: validated, ignorePaths: validatedIgnorePaths, order: existing.order };\n await fs.writeFile(path.join(rootDir, CONFIG_FILE_NAME), `${JSON.stringify(payload, null, 2)}\\n`, \"utf8\");\n return payload;\n}\n\nexport async function listTasks(rootDir: string): Promise<TaskListResponse> {\n const config = await readConfig(rootDir);\n const files = await listMarkdownFiles(rootDir, config.taskDirs, config.ignorePaths);\n const errors: TaskParseError[] = [];\n const tasks = await Promise.all(\n files.map(async (relativePath) => {\n try {\n return await parseTask(rootDir, relativePath);\n } catch (error) {\n errors.push({\n path: relativePath,\n message: error instanceof Error ? error.message : \"Unknown parse error\"\n });\n return null;\n }\n })\n );\n\n const taskRecords = tasks.filter((task): task is TaskRecord => task !== null);\n const { order, changed } = await reconcileOrder(\n rootDir,\n taskRecords.map((task) => task.path)\n );\n\n if (changed) {\n await saveOrder(rootDir, order);\n }\n\n const orderIndex = new Map(order.map((item, index) => [item, index]));\n taskRecords.sort((left, right) => {\n const leftIndex = orderIndex.get(left.path) ?? Number.MAX_SAFE_INTEGER;\n const rightIndex = orderIndex.get(right.path) ?? Number.MAX_SAFE_INTEGER;\n return leftIndex - rightIndex || left.path.localeCompare(right.path);\n });\n\n return { tasks: taskRecords, errors };\n}\n\nasync function ensureDirectoryForFile(rootDir: string, relativeFilePath: string): Promise<string> {\n const normalized = ensureMarkdownExtension(normalizeRelativePath(relativeFilePath));\n const absolutePath = path.join(rootDir, normalized);\n const directory = path.dirname(absolutePath);\n await fs.mkdir(directory, { recursive: true });\n return normalized;\n}\n\nasync function nextAvailablePath(rootDir: string, directory: string, title: string): Promise<string> {\n const safeDirectory = directory ? normalizeRelativePath(directory) : \"\";\n const slug = slugify(title);\n const base = safeDirectory ? `${safeDirectory}/${slug}` : slug;\n\n let attempt = 0;\n while (true) {\n const candidate = ensureMarkdownExtension(attempt === 0 ? base : `${base}-${attempt + 1}`);\n try {\n await fs.access(path.join(rootDir, candidate));\n attempt += 1;\n } catch {\n return candidate;\n }\n }\n}\n\nexport async function createTask(rootDir: string, input: CreateTaskInput): Promise<TaskRecord> {\n if (!input.title.trim()) {\n throw new ValidationError(\"Title is required.\");\n }\n\n const now = asUtcISOString(new Date());\n const relativePath = input.path?.trim()\n ? await ensureDirectoryForFile(rootDir, input.path)\n : await nextAvailablePath(rootDir, input.directory ?? \"\", input.title);\n const absolutePath = path.join(rootDir, relativePath);\n\n try {\n await fs.access(absolutePath);\n } catch (error) {\n const maybeError = error as NodeJS.ErrnoException;\n if (maybeError.code === \"ENOENT\") {\n // The target path is available.\n } else if (maybeError.code) {\n throw error;\n } else {\n throw new ValidationError(\"A task already exists at that path.\");\n }\n }\n\n const record: TaskRecord = {\n path: relativePath,\n content: input.content ?? \"\",\n raw: \"\",\n normalized: false,\n extraFrontmatter: input.extraFrontmatter ?? {},\n frontmatter: {\n title: input.title.trim(),\n priority: input.priority ?? \"MUST\",\n status: input.status ?? \"TODO\",\n createdAt: now,\n updatedAt: now\n }\n };\n\n await fs.mkdir(path.dirname(absolutePath), { recursive: true });\n await fs.writeFile(absolutePath, serializeTask(record), \"utf8\");\n\n const current = await listTasks(rootDir);\n await saveOrder(rootDir, current.tasks.map((task) => task.path).concat(relativePath));\n return parseTask(rootDir, relativePath);\n}\n\nexport async function updateTask(rootDir: string, currentPath: string, input: UpdateTaskInput): Promise<TaskRecord> {\n const normalizedCurrentPath = ensureMarkdownExtension(normalizeRelativePath(currentPath));\n const absoluteCurrentPath = path.join(rootDir, normalizedCurrentPath);\n\n let existing: TaskRecord;\n try {\n existing = await parseTask(rootDir, normalizedCurrentPath);\n } catch (error) {\n const maybeError = error as NodeJS.ErrnoException;\n if (maybeError.code === \"ENOENT\") {\n throw new ConflictError(\"The task no longer exists.\");\n }\n throw error;\n }\n\n if (input.baseUpdatedAt && existing.frontmatter.updatedAt !== input.baseUpdatedAt) {\n throw new ConflictError(\"The task changed on disk. Reload before saving.\");\n }\n\n const nextPath = input.path?.trim()\n ? await ensureDirectoryForFile(rootDir, input.path)\n : normalizedCurrentPath;\n const absoluteNextPath = path.join(rootDir, nextPath);\n\n if (nextPath !== normalizedCurrentPath) {\n try {\n await fs.access(absoluteNextPath);\n } catch (error) {\n const maybeError = error as NodeJS.ErrnoException;\n if (maybeError.code === \"ENOENT\") {\n // The target path is available.\n } else if (maybeError.code) {\n throw error;\n } else {\n throw new ValidationError(\"A task already exists at the target path.\");\n }\n }\n }\n\n const record: TaskRecord = {\n path: nextPath,\n raw: existing.raw,\n normalized: false,\n content: input.content,\n extraFrontmatter: input.extraFrontmatter ?? existing.extraFrontmatter,\n frontmatter: {\n title: input.title.trim(),\n priority: input.priority,\n status: input.status,\n createdAt: existing.frontmatter.createdAt,\n updatedAt: asUtcISOString(new Date())\n }\n };\n\n await fs.writeFile(absoluteCurrentPath, serializeTask(record), \"utf8\");\n if (nextPath !== normalizedCurrentPath) {\n await fs.mkdir(path.dirname(absoluteNextPath), { recursive: true });\n await fs.rename(absoluteCurrentPath, absoluteNextPath);\n }\n\n const current = await listTasks(rootDir);\n const updatedOrder = current.tasks.map((task) => task.path);\n await saveOrder(rootDir, updatedOrder);\n return parseTask(rootDir, nextPath);\n}\n\nexport async function deleteTask(rootDir: string, relativePath: string): Promise<void> {\n const normalizedPath = ensureMarkdownExtension(normalizeRelativePath(relativePath));\n const absolutePath = path.join(rootDir, normalizedPath);\n\n try {\n await fs.unlink(absolutePath);\n } catch (error) {\n const maybeError = error as NodeJS.ErrnoException;\n if (maybeError.code === \"ENOENT\") {\n throw new ConflictError(\"The task no longer exists.\");\n }\n throw error;\n }\n\n const current = await listTasks(rootDir);\n await saveOrder(\n rootDir,\n current.tasks.map((task) => task.path)\n );\n}\n\nexport async function patchTaskFields(rootDir: string, currentPath: string, input: PatchTaskFieldsInput): Promise<TaskRecord> {\n const normalizedCurrentPath = ensureMarkdownExtension(normalizeRelativePath(currentPath));\n const absoluteCurrentPath = path.join(rootDir, normalizedCurrentPath);\n\n let existing: TaskRecord;\n try {\n existing = await parseTask(rootDir, normalizedCurrentPath);\n } catch (error) {\n const maybeError = error as NodeJS.ErrnoException;\n if (maybeError.code === \"ENOENT\") {\n throw new ConflictError(\"The task no longer exists.\");\n }\n throw error;\n }\n\n const priority = input.priority && REQUIRED_PRIORITY.includes(input.priority) ? input.priority : existing.frontmatter.priority;\n const status = input.status && REQUIRED_STATUS.includes(input.status) ? input.status : existing.frontmatter.status;\n\n if (priority === existing.frontmatter.priority && status === existing.frontmatter.status) {\n return existing;\n }\n\n const record: TaskRecord = {\n path: normalizedCurrentPath,\n raw: existing.raw,\n normalized: false,\n content: existing.content,\n extraFrontmatter: existing.extraFrontmatter,\n frontmatter: {\n ...existing.frontmatter,\n priority,\n status,\n updatedAt: asUtcISOString(new Date())\n }\n };\n\n await fs.writeFile(absoluteCurrentPath, serializeTask(record), \"utf8\");\n return parseTask(rootDir, normalizedCurrentPath);\n}\n\nexport function parseOrderPayload(input: unknown): string[] {\n if (!Array.isArray(input)) {\n throw new ValidationError(\"Order payload must be an array.\");\n }\n\n return input.map((item) => ensureMarkdownExtension(normalizeRelativePath(String(item))));\n}\n\nexport async function readOrder(rootDir: string): Promise<ConfigFile> {\n const config = await readConfig(rootDir);\n const { order } = await reconcileOrder(\n rootDir,\n (await listTasks(rootDir)).tasks.map((task) => task.path)\n );\n return { version: 1, taskDirs: config.taskDirs, ignorePaths: config.ignorePaths, order };\n}\n\nexport const taskStoreUtils = {\n slugify,\n normalizeRelativePath,\n ensureMarkdownExtension,\n splitFrontmatter,\n buildDefaults\n};\n","export const CONFIG_FILE_NAME = \".md-task-viewer.json\";\n\nexport type TaskPriority = \"MUST\" | \"WANT\";\nexport type TaskStatus = \"TODO\" | \"WIP\" | \"DONE\";\n\nexport interface TaskFrontmatter {\n title: string;\n priority: TaskPriority;\n status: TaskStatus;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n}\n\nexport interface TaskRecord {\n path: string;\n content: string;\n frontmatter: TaskFrontmatter;\n extraFrontmatter: Record<string, unknown>;\n raw: string;\n normalized: boolean;\n}\n\nexport interface TaskParseError {\n path: string;\n message: string;\n}\n\nexport interface TaskListResponse {\n tasks: TaskRecord[];\n errors: TaskParseError[];\n}\n\nexport interface CreateTaskInput {\n title: string;\n priority?: TaskPriority;\n status?: TaskStatus;\n content?: string;\n directory?: string;\n path?: string;\n extraFrontmatter?: Record<string, unknown>;\n}\n\nexport interface UpdateTaskInput {\n path?: string;\n title: string;\n priority: TaskPriority;\n status: TaskStatus;\n content: string;\n extraFrontmatter?: Record<string, unknown>;\n baseUpdatedAt?: string;\n}\n\nexport interface PatchTaskFieldsInput {\n priority?: TaskPriority;\n status?: TaskStatus;\n}\n\nexport interface ConfigFile {\n version: number;\n taskDirs: string[];\n ignorePaths: string[];\n order: string[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