@1medium/cli 1.3.1 → 1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/mcp-server.js +29 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1medium/cli",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "CLI and MCP server for 1Medium AI task management",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/mcp-server.js CHANGED
@@ -97,7 +97,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
97
97
  },
98
98
  {
99
99
  name: "task_list",
100
- description: "List tasks from 1Medium. Returns open tasks by default.",
100
+ description: "List tasks from 1Medium. Returns open tasks by default. Filters by active project unless project_id is explicitly set or all_projects is true.",
101
101
  inputSchema: {
102
102
  type: "object",
103
103
  properties: {
@@ -115,6 +115,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
115
115
  type: "number",
116
116
  description: "Maximum number of tasks to return",
117
117
  },
118
+ project_id: {
119
+ type: "string",
120
+ description: "Filter by specific project ID. Overrides active project.",
121
+ },
122
+ all_projects: {
123
+ type: "boolean",
124
+ description: "Set to true to list tasks from all projects, ignoring active project filter.",
125
+ },
118
126
  },
119
127
  },
120
128
  },
@@ -506,18 +514,34 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
506
514
  if (args.priority) params.priority = args.priority;
507
515
  if (args.limit) params.limit = args.limit;
508
516
 
517
+ // Filter by project: explicit arg > active project (unless all_projects is true)
518
+ if (args.project_id) {
519
+ params.project_id = args.project_id;
520
+ } else if (!args.all_projects) {
521
+ const activeProjectId = sessionState.get("projectId");
522
+ if (activeProjectId) {
523
+ params.project_id = activeProjectId;
524
+ }
525
+ }
526
+
509
527
  result = await api.listTasks(params);
510
528
  const tasks = result.tasks || [];
511
529
 
530
+ // Build header with filter info
531
+ const activeProjectName = sessionState.get("projectName");
532
+ const filterInfo = params.project_id
533
+ ? ` in project "${activeProjectName || params.project_id}"`
534
+ : " (all projects)";
535
+
512
536
  if (tasks.length === 0) {
513
537
  return {
514
- content: [{ type: "text", text: "No tasks found." }],
538
+ content: [{ type: "text", text: `No tasks found${filterInfo}.` }],
515
539
  };
516
540
  }
517
541
 
518
542
  const taskList = tasks
519
543
  .map((t) => {
520
- const check = t.completedAt ? "[x]" : "[ ]";
544
+ const check = t.completed_at ? "[x]" : "[ ]";
521
545
  return `${check} ${t.priority} ${t.title}\n ID: ${t.id}`;
522
546
  })
523
547
  .join("\n\n");
@@ -526,7 +550,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
526
550
  content: [
527
551
  {
528
552
  type: "text",
529
- text: `Tasks (${result.total} total):\n\n${taskList}`,
553
+ text: `Tasks${filterInfo} (${result.total} total):\n\n${taskList}`,
530
554
  },
531
555
  ],
532
556
  };
@@ -535,7 +559,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
535
559
  case "task_get": {
536
560
  result = await api.getTask(args.id);
537
561
  const t = result.task;
538
- const status = t.completedAt ? "completed" : "open";
562
+ const status = t.completed_at ? "completed" : "open";
539
563
 
540
564
  let text = `${t.title}\n\n ID: ${t.id}\n Status: ${status}\n Priority: ${t.priority}`;
541
565