You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BACK-400 - Add milestone filter support to task list (CLI and MCP) (#552)
## Summary
- add CLI task list -m, --milestone <milestone> filter wiring
- extend shared TaskListFilter + core filtering for case-insensitive
exact milestone matching
- add MCP task_list milestone schema/handler support, including Draft
status path
- add/extend tests for CLI and MCP milestone filtering behavior
## Verification
- bun test src/test/cli-milestone-filter.test.ts
- bun test src/test/mcp-tasks.test.ts
- bun test src/test/cli-parent-filter.test.ts
- bun test src/test/mcp-tasks-local-filter.test.ts
- bunx tsc --noEmit
- bun run check .
## Scope
Solves #546
-[]#2 Core task filtering supports milestone matching as a case-insensitive exact match, consistent with existing status/priority filtering style.
32
-
-[]#3 MCP `task_list` accepts a `milestone` parameter in its input schema without validation errors.
33
-
-[]#4 MCP `task_list` applies the milestone filter and returns only tasks whose milestone matches the requested value.
34
-
-[]#5 Automated tests cover CLI and MCP milestone filter behavior, including case-insensitive matching and combination with at least one existing filter.
35
-
-[]#6 Existing task listing behavior is unchanged when no milestone filter is provided.
-[x]#2 Core task filtering supports milestone matching as a case-insensitive exact match, consistent with existing status/priority filtering style.
34
+
-[x]#3 MCP `task_list` accepts a `milestone` parameter in its input schema without validation errors.
35
+
-[x]#4 MCP `task_list` applies the milestone filter and returns only tasks whose milestone matches the requested value.
36
+
-[x]#5 Automated tests cover CLI and MCP milestone filter behavior, including case-insensitive matching and combination with at least one existing filter.
37
+
-[x]#6 Existing task listing behavior is unchanged when no milestone filter is provided.
36
38
<!-- AC:END -->
37
39
40
+
## Implementation Plan
41
+
42
+
<!-- SECTION:PLAN:BEGIN -->
43
+
1. Extend task list filter contract and core filtering.
44
+
- Update `TaskListFilter` in `src/types/index.ts` to include optional `milestone`.
45
+
- Add milestone filtering in `Core.applyTaskFilters` (`src/core/backlog.ts`) as a case-insensitive exact match, aligned with current status/priority filter semantics.
46
+
- Keep behavior unchanged when `milestone` is not provided.
47
+
48
+
2. Wire CLI `task list` milestone filter.
49
+
- Add `-m, --milestone <milestone>` option to `task list` in `src/cli.ts`.
50
+
- Include `options.milestone` in `baseFilters` passed to `core.queryTasks`.
51
+
- Include milestone in active-filter display text and `runUnifiedView` filter payload so TUI header/filter state reflects the new flag.
- Add `milestone` to `taskListSchema` in `src/mcp/tools/tasks/schemas.ts` so the tool accepts the field.
56
+
- Extend `TaskListArgs` in `src/mcp/tools/tasks/handlers.ts` with optional `milestone`.
57
+
- Add `filters.milestone` in the non-draft `task_list` handler before calling `core.queryTasks`.
58
+
- Apply the same milestone filter in the draft branch for consistent `task_list` behavior when `status: Draft` is requested.
59
+
60
+
4. Add automated coverage for CLI and MCP milestone filtering.
61
+
- Add/extend CLI tests (likely new focused test file under `src/test/`) to verify:
62
+
- milestone filtering returns only matching tasks,
63
+
- matching is case-insensitive,
64
+
- milestone filter combines correctly with an existing filter (status),
65
+
- listing behavior remains unchanged without `--milestone`.
66
+
- Add/extend MCP tests (likely `src/test/mcp-tasks.test.ts`) to verify:
67
+
-`task_list` accepts `milestone` without schema errors,
68
+
- milestone filtering works and is case-insensitive,
69
+
- milestone combines with at least one existing filter.
70
+
71
+
5. Validate and regression-check.
72
+
- Run targeted tests for changed CLI/MCP suites first.
73
+
- Run `bunx tsc --noEmit` and scoped `bun test` for changed files; run broader checks if targeted results indicate regressions.
74
+
- Confirm no output/behavior changes when milestone filter is omitted.
75
+
<!-- SECTION:PLAN:END -->
76
+
77
+
## Implementation Notes
78
+
79
+
<!-- SECTION:NOTES:BEGIN -->
80
+
TPM directive: treat GitHub issue #546 as authoritative scope anchor for this task.
81
+
82
+
Implementation started after TPM approval. Proceeding with focused scope: CLI task list + MCP task_list + shared core filter path; raw milestone exact match (case-insensitive), including Draft task_list path.
83
+
84
+
Implemented milestone filtering for task listing across CLI and MCP using the shared `TaskListFilter` + `Core.applyTaskFilters` path with case-insensitive exact raw milestone matching.
85
+
86
+
CLI updates: added `task list -m, --milestone <milestone>`; wired milestone into `baseFilters`, active filter display text, and unified-view filter payload.
87
+
88
+
MCP updates: `task_list` schema now accepts `milestone`; handler applies milestone filter in both regular and Draft status paths.
89
+
90
+
Added automated coverage: new `src/test/cli-milestone-filter.test.ts` and new milestone-focused MCP integration tests in `src/test/mcp-tasks.test.ts` (including Draft path).
91
+
92
+
Verification evidence: `bun test src/test/cli-milestone-filter.test.ts` (pass), `bun test src/test/mcp-tasks.test.ts` (pass), `bun test src/test/cli-parent-filter.test.ts` (pass regression), `bun test src/test/mcp-tasks-local-filter.test.ts` (pass regression), `bunx tsc --noEmit` (pass), `bun run check .` (pass after formatting).
93
+
94
+
User-perspective verification: manual CLI run shows `task list --milestone RELEASE-1 --plain` returns only Release-1 tasks; `task list -m release-1 --status "To Do" --plain` returns only matching To Do task; `task list --plain` remains unchanged. Manual MCP call verifies `task_list` accepts `milestone` and filters both regular and Draft paths.
95
+
<!-- SECTION:NOTES:END -->
96
+
97
+
## Final Summary
98
+
99
+
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
100
+
Implemented milestone filtering for task listing across CLI and MCP, aligned to issue #546 scope.
101
+
102
+
What changed:
103
+
- Added `milestone?: string` to `TaskListFilter` and implemented case-insensitive exact raw milestone matching in `Core.applyTaskFilters`.
104
+
- Added CLI support for `task list -m, --milestone <milestone>` and wired it through task query filters, active filter labels, and unified-view filter state.
105
+
- Extended MCP `task_list` schema to accept `milestone` and updated handler logic to apply milestone filtering in both regular task listing and Draft-status listing paths.
106
+
- Added automated test coverage:
107
+
- New `src/test/cli-milestone-filter.test.ts` for CLI milestone filtering, case-insensitive matching, combined filter behavior, and no-filter regression behavior.
108
+
- Extended `src/test/mcp-tasks.test.ts` with milestone filtering tests for normal and Draft task_list paths.
109
+
110
+
Verification run:
111
+
-`bun test src/test/cli-milestone-filter.test.ts`
112
+
-`bun test src/test/mcp-tasks.test.ts`
113
+
-`bun test src/test/cli-parent-filter.test.ts`
114
+
-`bun test src/test/mcp-tasks-local-filter.test.ts`
115
+
-`bunx tsc --noEmit`
116
+
-`bun run check .`
117
+
118
+
Manual user-perspective verification:
119
+
- CLI: `task list --milestone RELEASE-1 --plain` returned only Release-1 tasks.
120
+
- CLI: `task list -m release-1 --status "To Do" --plain` returned only matching To Do task.
121
+
- CLI: `task list --plain` remained unchanged when no milestone filter was provided.
122
+
- MCP: direct tool calls confirmed `task_list` accepts `milestone` and filters in both regular and Draft paths.
123
+
<!-- SECTION:FINAL_SUMMARY:END -->
124
+
38
125
## Definition of Done
39
126
<!-- DOD:BEGIN -->
40
-
-[]#1 bunx tsc --noEmit passes when TypeScript touched
41
-
-[]#2 bun run check . passes when formatting/linting touched
42
-
-[]#3 bun test (or scoped test) passes
127
+
-[x]#1 bunx tsc --noEmit passes when TypeScript touched
128
+
-[x]#2 bun run check . passes when formatting/linting touched
0 commit comments