@abhishek944/pi-tasks 0.4.0 → 0.5.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/dist/tools.js CHANGED
@@ -31,14 +31,17 @@ export function registerTaskTools(pi, state) {
31
31
  pi.registerTool({
32
32
  name: "WorkList",
33
33
  label: "WorkList",
34
- description: "List session-scoped works and their associated todos. Results include detailed workInfo and taskInfo and are truncated at 50KB or 2000 lines.",
34
+ description: "List session-scoped works and their associated todos. Optional limit returns the newest N matching works after filtering, in chronological order; omitted returns all. Results include detailed workInfo and taskInfo and are truncated at 50KB or 2000 lines.",
35
35
  parameters: Type.Object({
36
36
  workId: Type.Optional(Type.String()),
37
37
  status: Type.Optional(WorkStatusSchema),
38
+ limit: Type.Optional(Type.Integer({ minimum: 1, description: "Return only the newest N matching works; omit for all." })),
38
39
  }, { additionalProperties: false }),
39
40
  execute(_id, params) {
40
- const works = state.listWorks({ workId: params.workId, status: params.status });
41
- return Promise.resolve(taskResult(bounded(formatWorks(works)), "work-list", { count: works.length }, `${works.length} work${works.length === 1 ? "" : "s"} found`));
41
+ const matches = state.listWorks({ workId: params.workId, status: params.status });
42
+ const works = params.limit === undefined ? matches : matches.slice(-params.limit);
43
+ const summary = `Showing ${works.length} of ${matches.length} matching works`;
44
+ return Promise.resolve(taskResult(bounded(`${summary}\n\n${formatWorks(works)}`), "work-list", { count: works.length, total: matches.length }, summary));
42
45
  },
43
46
  renderCall: renderTaskCall("WorkList"),
44
47
  renderResult: renderTaskResult,
@@ -103,15 +106,18 @@ export function registerTaskTools(pi, state) {
103
106
  pi.registerTool({
104
107
  name: "TodoList",
105
108
  label: "TodoList",
106
- description: "List todos by task, work, or status. Results include detailed taskInfo and are truncated at 50KB or 2000 lines.",
109
+ description: "List todos by task, work, or status. Optional limit returns the newest N matching todos after filtering, in chronological order; omitted returns all. Results include detailed taskInfo and are truncated at 50KB or 2000 lines.",
107
110
  parameters: Type.Object({
108
111
  taskId: Type.Optional(Type.String()),
109
112
  workId: Type.Optional(Type.String()),
110
113
  status: Type.Optional(TodoStatusSchema),
114
+ limit: Type.Optional(Type.Integer({ minimum: 1, description: "Return only the newest N matching todos; omit for all." })),
111
115
  }, { additionalProperties: false }),
112
116
  execute(_id, params) {
113
- const todos = state.listTodos({ taskId: params.taskId, workId: params.workId, status: params.status });
114
- return Promise.resolve(taskResult(bounded(formatTodos(todos)), "todo-list", { count: todos.length }, `${todos.length} todo${todos.length === 1 ? "" : "s"} found`));
117
+ const matches = state.listTodos({ taskId: params.taskId, workId: params.workId, status: params.status });
118
+ const todos = params.limit === undefined ? matches : matches.slice(-params.limit);
119
+ const summary = `Showing ${todos.length} of ${matches.length} matching todos`;
120
+ return Promise.resolve(taskResult(bounded(`${summary}\n\n${formatTodos(todos)}`), "todo-list", { count: todos.length, total: matches.length }, summary));
115
121
  },
116
122
  renderCall: renderTaskCall("TodoList"),
117
123
  renderResult: renderTaskResult,
package/docs/REFERENCE.md CHANGED
@@ -14,6 +14,8 @@ Limits:
14
14
  - 10,000 characters per information field
15
15
  - list tool text is truncated at 50KB or 2,000 lines
16
16
 
17
+ `WorkList` and `TodoList` accept an optional positive integer `limit`. Without it, they return all matching records (subject to the output truncation above). With it, filters are applied first, then the newest `limit` matching works or todos are returned in oldest-to-newest order within that selection. A `WorkList` limit applies to works, not their nested todos: all todos belonging to each selected work are included. Both tools report the number returned and the total number matching the filters; those counts describe records selected before any text truncation.
18
+
17
19
  ## Data
18
20
 
19
21
  A work contains `workId`, `workName`, `workInfo`, `status`, `createdAt`, and `updatedAt`. Work status is `planned`, `active`, `blocked`, `completed`, or `cancelled`.
@@ -18,12 +18,14 @@ The extension applies this guidance across all loaded skills and does not skip w
18
18
  ```text
19
19
  WorkCreate workName="Improve authentication" workInfo="Detailed context..." status="active"
20
20
  WorkList
21
+ WorkList limit=10
22
+ WorkList status="active" limit=5
21
23
  WorkList workId="W1"
22
24
  WorkUpdate workId="W1" status="blocked" workInfo="Detailed blocker and retained context..."
23
25
  WorkDelete workId="W1"
24
26
  ```
25
27
 
26
- `WorkDelete` also removes associated todos.
28
+ `WorkList` returns all matching works when `limit` is omitted. A positive integer `limit` selects the newest matching works after filters, displayed oldest-to-newest; every selected work still includes all of its todos. The result shows how many works were returned and how many matched in total. `WorkDelete` also removes associated todos.
27
29
 
28
30
  ## Todo tools
29
31
 
@@ -31,10 +33,13 @@ WorkDelete workId="W1"
31
33
  TodoCreate workId="W1" taskName="Inspect token flow" taskInfo="Detailed context..."
32
34
  TodoList workId="W1"
33
35
  TodoList status="active"
36
+ TodoList workId="W1" limit=10
34
37
  TodoUpdate taskId="T1" status="completed" taskInfo="Detailed outcome..."
35
38
  TodoDelete taskId="T1"
36
39
  ```
37
40
 
41
+ `TodoList` returns all matching todos when `limit` is omitted. A positive integer `limit` selects the newest matching todos after filters, displayed oldest-to-newest. The result shows how many todos were returned and how many matched in total. Both list tools can still truncate very long text output at 50KB or 2,000 lines.
42
+
38
43
  ## TUI
39
44
 
40
45
  The panel defaults to a floating top-right layout and does not take keyboard focus. It hides on small terminals. In fullscreen TUI mode, click Copy in its title bar to copy every work and todo as Markdown, or click Minimize to collapse the panel to a small title bar. Copy remains available while minimized, and Maximize restores the rows. When more rows exist than fit, the floating panel starts at the newest rows; move the mouse over it and use the wheel to scroll older or newer rows without taking focus from the editor. In regular terminal mode, open `/works` to browse and copy the complete list.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abhishek944/pi-tasks",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Session-scoped work and todo tracking for Pi.",
5
5
  "license": "MIT",
6
6
  "type": "module",