knowns 0.3.1 → 0.4.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.
@@ -31480,6 +31480,22 @@ var FileStore = class {
31480
31480
  return null;
31481
31481
  }
31482
31482
  }
31483
+ /**
31484
+ * Skipped files due to parse errors (for graceful degradation)
31485
+ */
31486
+ skippedFiles = [];
31487
+ /**
31488
+ * Get list of skipped files from last load
31489
+ */
31490
+ getSkippedFiles() {
31491
+ return this.skippedFiles;
31492
+ }
31493
+ /**
31494
+ * Clear skipped files list
31495
+ */
31496
+ clearSkippedFiles() {
31497
+ this.skippedFiles = [];
31498
+ }
31483
31499
  /**
31484
31500
  * Get all tasks
31485
31501
  */
@@ -31488,24 +31504,42 @@ var FileStore = class {
31488
31504
  const files = await readdir(this.tasksPath);
31489
31505
  const taskFiles = files.filter((f) => f.startsWith("task-") && f.endsWith(".md"));
31490
31506
  const allTimeEntries = await this.loadTimeEntries();
31507
+ this.skippedFiles = [];
31491
31508
  const tasksMap = /* @__PURE__ */ new Map();
31492
31509
  for (const taskFile of taskFiles) {
31493
- const filePath = join2(this.tasksPath, taskFile);
31494
- const content = await file2(filePath).text();
31495
- const taskData = parseTaskMarkdown(content);
31496
- if (taskData.id) {
31497
- const timeEntries = (allTimeEntries[taskData.id] || []).map((e) => ({
31498
- ...e,
31499
- startedAt: new Date(e.startedAt),
31500
- endedAt: e.endedAt ? new Date(e.endedAt) : void 0
31501
- }));
31502
- tasksMap.set(taskData.id, {
31503
- ...taskData,
31504
- subtasks: [],
31505
- timeEntries
31510
+ try {
31511
+ const filePath = join2(this.tasksPath, taskFile);
31512
+ const content = await file2(filePath).text();
31513
+ const taskData = parseTaskMarkdown(content);
31514
+ if (taskData.id) {
31515
+ const timeEntries = (allTimeEntries[taskData.id] || []).map((e) => ({
31516
+ ...e,
31517
+ startedAt: new Date(e.startedAt),
31518
+ endedAt: e.endedAt ? new Date(e.endedAt) : void 0
31519
+ }));
31520
+ tasksMap.set(taskData.id, {
31521
+ ...taskData,
31522
+ subtasks: [],
31523
+ timeEntries
31524
+ });
31525
+ } else {
31526
+ this.skippedFiles.push({
31527
+ file: taskFile,
31528
+ error: "Missing task ID in frontmatter"
31529
+ });
31530
+ }
31531
+ } catch (parseError) {
31532
+ this.skippedFiles.push({
31533
+ file: taskFile,
31534
+ error: parseError instanceof Error ? parseError.message : String(parseError)
31506
31535
  });
31507
31536
  }
31508
31537
  }
31538
+ if (this.skippedFiles.length > 0) {
31539
+ console.warn(
31540
+ `\u26A0 Skipped ${this.skippedFiles.length} corrupted task file(s). Run "knowns task validate <id>" or "knowns task repair <id>" to fix.`
31541
+ );
31542
+ }
31509
31543
  for (const task of tasksMap.values()) {
31510
31544
  const subtasks = [];
31511
31545
  for (const otherTask of tasksMap.values()) {