@hasna/todos 0.9.7 → 0.9.9

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/dist/index.js CHANGED
@@ -203,6 +203,11 @@ var MIGRATIONS = [
203
203
  CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_short_id ON tasks(short_id) WHERE short_id IS NOT NULL;
204
204
 
205
205
  INSERT OR IGNORE INTO _migrations (id) VALUES (6);
206
+ `,
207
+ `
208
+ ALTER TABLE tasks ADD COLUMN due_at TEXT;
209
+ CREATE INDEX IF NOT EXISTS idx_tasks_due_at ON tasks(due_at);
210
+ INSERT OR IGNORE INTO _migrations (id) VALUES (7);
206
211
  `
207
212
  ];
208
213
  var _db = null;
@@ -711,8 +716,8 @@ function createTask(input, db) {
711
716
  const tags = input.tags || [];
712
717
  const shortId = input.project_id ? nextTaskShortId(input.project_id, d) : null;
713
718
  const title = shortId ? `${shortId}: ${input.title}` : input.title;
714
- d.run(`INSERT INTO tasks (id, short_id, project_id, parent_id, plan_id, task_list_id, title, description, status, priority, agent_id, assigned_to, session_id, working_dir, tags, metadata, version, created_at, updated_at)
715
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)`, [
719
+ d.run(`INSERT INTO tasks (id, short_id, project_id, parent_id, plan_id, task_list_id, title, description, status, priority, agent_id, assigned_to, session_id, working_dir, tags, metadata, version, created_at, updated_at, due_at)
720
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?)`, [
716
721
  id,
717
722
  shortId,
718
723
  input.project_id || null,
@@ -730,7 +735,8 @@ function createTask(input, db) {
730
735
  JSON.stringify(tags),
731
736
  JSON.stringify(input.metadata || {}),
732
737
  timestamp,
733
- timestamp
738
+ timestamp,
739
+ input.due_at || null
734
740
  ]);
735
741
  if (tags.length > 0) {
736
742
  insertTaskTags(id, tags, d);
@@ -831,12 +837,18 @@ function listTasks(filter = {}, db) {
831
837
  params.push(filter.task_list_id);
832
838
  }
833
839
  const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
834
- const limitVal = filter.limit || 100;
835
- const offsetVal = filter.offset || 0;
836
- params.push(limitVal, offsetVal);
840
+ let limitClause = "";
841
+ if (filter.limit) {
842
+ limitClause = " LIMIT ?";
843
+ params.push(filter.limit);
844
+ if (filter.offset) {
845
+ limitClause += " OFFSET ?";
846
+ params.push(filter.offset);
847
+ }
848
+ }
837
849
  const rows = d.query(`SELECT * FROM tasks ${where} ORDER BY
838
850
  CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END,
839
- created_at DESC LIMIT ? OFFSET ?`).all(...params);
851
+ created_at DESC${limitClause}`).all(...params);
840
852
  return rows.map(rowToTask);
841
853
  }
842
854
  function updateTask(id, input, db) {
@@ -892,6 +904,10 @@ function updateTask(id, input, db) {
892
904
  sets.push("task_list_id = ?");
893
905
  params.push(input.task_list_id);
894
906
  }
907
+ if (input.due_at !== undefined) {
908
+ sets.push("due_at = ?");
909
+ params.push(input.due_at);
910
+ }
895
911
  params.push(id, input.version);
896
912
  const result = d.run(`UPDATE tasks SET ${sets.join(", ")} WHERE id = ? AND version = ?`, params);
897
913
  if (result.changes === 0) {
package/dist/mcp/index.js CHANGED
@@ -4264,6 +4264,11 @@ var MIGRATIONS = [
4264
4264
  CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_short_id ON tasks(short_id) WHERE short_id IS NOT NULL;
4265
4265
 
4266
4266
  INSERT OR IGNORE INTO _migrations (id) VALUES (6);
4267
+ `,
4268
+ `
4269
+ ALTER TABLE tasks ADD COLUMN due_at TEXT;
4270
+ CREATE INDEX IF NOT EXISTS idx_tasks_due_at ON tasks(due_at);
4271
+ INSERT OR IGNORE INTO _migrations (id) VALUES (7);
4267
4272
  `
4268
4273
  ];
4269
4274
  var _db = null;
@@ -4616,8 +4621,8 @@ function createTask(input, db) {
4616
4621
  const tags = input.tags || [];
4617
4622
  const shortId = input.project_id ? nextTaskShortId(input.project_id, d) : null;
4618
4623
  const title = shortId ? `${shortId}: ${input.title}` : input.title;
4619
- d.run(`INSERT INTO tasks (id, short_id, project_id, parent_id, plan_id, task_list_id, title, description, status, priority, agent_id, assigned_to, session_id, working_dir, tags, metadata, version, created_at, updated_at)
4620
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)`, [
4624
+ d.run(`INSERT INTO tasks (id, short_id, project_id, parent_id, plan_id, task_list_id, title, description, status, priority, agent_id, assigned_to, session_id, working_dir, tags, metadata, version, created_at, updated_at, due_at)
4625
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?)`, [
4621
4626
  id,
4622
4627
  shortId,
4623
4628
  input.project_id || null,
@@ -4635,7 +4640,8 @@ function createTask(input, db) {
4635
4640
  JSON.stringify(tags),
4636
4641
  JSON.stringify(input.metadata || {}),
4637
4642
  timestamp,
4638
- timestamp
4643
+ timestamp,
4644
+ input.due_at || null
4639
4645
  ]);
4640
4646
  if (tags.length > 0) {
4641
4647
  insertTaskTags(id, tags, d);
@@ -4736,12 +4742,18 @@ function listTasks(filter = {}, db) {
4736
4742
  params.push(filter.task_list_id);
4737
4743
  }
4738
4744
  const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
4739
- const limitVal = filter.limit || 100;
4740
- const offsetVal = filter.offset || 0;
4741
- params.push(limitVal, offsetVal);
4745
+ let limitClause = "";
4746
+ if (filter.limit) {
4747
+ limitClause = " LIMIT ?";
4748
+ params.push(filter.limit);
4749
+ if (filter.offset) {
4750
+ limitClause += " OFFSET ?";
4751
+ params.push(filter.offset);
4752
+ }
4753
+ }
4742
4754
  const rows = d.query(`SELECT * FROM tasks ${where} ORDER BY
4743
4755
  CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END,
4744
- created_at DESC LIMIT ? OFFSET ?`).all(...params);
4756
+ created_at DESC${limitClause}`).all(...params);
4745
4757
  return rows.map(rowToTask);
4746
4758
  }
4747
4759
  function updateTask(id, input, db) {
@@ -4797,6 +4809,10 @@ function updateTask(id, input, db) {
4797
4809
  sets.push("task_list_id = ?");
4798
4810
  params.push(input.task_list_id);
4799
4811
  }
4812
+ if (input.due_at !== undefined) {
4813
+ sets.push("due_at = ?");
4814
+ params.push(input.due_at);
4815
+ }
4800
4816
  params.push(id, input.version);
4801
4817
  const result = d.run(`UPDATE tasks SET ${sets.join(", ")} WHERE id = ? AND version = ?`, params);
4802
4818
  if (result.changes === 0) {