mcp-tasker 1.0.0__py3-none-any.whl

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.
@@ -0,0 +1,259 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-tasker
3
+ Version: 1.0.0
4
+ Summary: Simple file-based task tracker for git repos
5
+ License: MIT License
6
+
7
+ Copyright (c) [2026] [Evgeniy A. Cymbalyuk <cimbaluk@gmail.com>]
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ License-File: LICENSE
27
+ Author: Evgeniy A. Cymbalyuk
28
+ Author-email: cimbaluk@gmail.com
29
+ Requires-Python: >=3.10
30
+ Classifier: License :: Other/Proprietary License
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: Programming Language :: Python :: 3.10
33
+ Classifier: Programming Language :: Python :: 3.11
34
+ Classifier: Programming Language :: Python :: 3.12
35
+ Classifier: Programming Language :: Python :: 3.13
36
+ Classifier: Programming Language :: Python :: 3.14
37
+ Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
38
+ Requires-Dist: mcp (>=1.26.0,<2.0.0)
39
+ Requires-Dist: pydantic (>=2.0)
40
+ Requires-Dist: typer (>=0.12.0)
41
+ Requires-Dist: typer-di (>=0.1.0)
42
+ Project-URL: Repository, https://github.com/greendwin/mcp-tasker
43
+ Description-Content-Type: text/markdown
44
+
45
+ # Tasker
46
+
47
+ [![tests](https://github.com/greendwin/mcp-tasker/actions/workflows/ci.yml/badge.svg)](https://github.com/greendwin/mcp-tasker/actions/workflows/ci.yml)
48
+
49
+ A simple file-based task tracker for git repositories. Tasks are stored as plain Markdown files inside a `tasker/` directory, tracked alongside your code with git.
50
+
51
+ ## Installation
52
+
53
+ Install with [pipx](https://pipx.pypa.io/) (recommended — installs in an isolated environment):
54
+
55
+ ```bash
56
+ pipx install mcp-tasker
57
+ ```
58
+
59
+ Or with pip:
60
+
61
+ ```bash
62
+ pip install mcp-tasker
63
+ ```
64
+
65
+ For development (requires [Poetry](https://python-poetry.org/)):
66
+
67
+ ```bash
68
+ git clone https://github.com/greendwin/mcp-tasker.git
69
+ cd mcp-tasker
70
+ poetry install --with dev
71
+ ```
72
+
73
+ ## Quick Start
74
+
75
+ ```bash
76
+ # Create a story
77
+ tasker new "Build authentication"
78
+
79
+ # Add subtasks
80
+ tasker add s01 "Design login flow"
81
+ tasker add s01 "Implement JWT tokens" --details "Use RS256 signing"
82
+
83
+ # Work on a task
84
+ tasker start s01t01
85
+
86
+ # View what's on your plate
87
+ tasker list
88
+
89
+ # Mark tasks done
90
+ tasker done s01t01
91
+
92
+ # Edit a task in your editor
93
+ tasker edit s01t02
94
+ ```
95
+
96
+ Tasks are stored as Markdown in `tasker/` and committed with your code:
97
+
98
+ ```
99
+ tasker/
100
+ s01-build-authentication/
101
+ README.md
102
+ s01t01-design-login-flow.md
103
+ s01t02-implement-jwt-tokens.md
104
+ ```
105
+
106
+ ## Usage
107
+
108
+ ### Create tasks
109
+
110
+ ```bash
111
+ tasker new <title> # new root story
112
+ tasker new <title> --details "..." --slug <slug> # with description and slug
113
+ tasker add <parent-id> <title> # inline subtask
114
+ tasker add <parent-id> <title> --details "..." # subtask with description
115
+ tasker add-many <parent-id> # add multiple subtasks interactively
116
+ ```
117
+
118
+ ### Update status
119
+
120
+ ```bash
121
+ tasker start <task-id>... # mark in-progress
122
+ tasker done <task-id>... # mark done
123
+ tasker cancel <task-id>... # cancel
124
+ tasker reset <task-id>... # reset to pending
125
+
126
+ # Force-close a parent with open subtasks
127
+ tasker done <task-id> --force
128
+ ```
129
+
130
+ ### View tasks
131
+
132
+ ```bash
133
+ tasker list # all open root tasks
134
+ tasker list -a # include closed tasks
135
+ tasker list <task-id> # subtasks of a specific task
136
+ tasker view <task-id> # full task details
137
+ ```
138
+
139
+ ### Edit tasks
140
+
141
+ ```bash
142
+ tasker edit <task-id> # open in $EDITOR
143
+ tasker edit <task-id> --title "New title"
144
+ tasker edit <task-id> --details "New description"
145
+ tasker edit <task-id> --slug new-slug
146
+ ```
147
+
148
+ ### Organize
149
+
150
+ ```bash
151
+ tasker move <task-id> --parent <new-parent> # reparent
152
+ tasker move <task-id> --root # promote to story
153
+ tasker archive <task-id> # archive completed story
154
+ tasker archive --closed # archive all closed stories
155
+ tasker unarchive <task-id> # restore from archive
156
+ ```
157
+
158
+ ### Shortcuts
159
+
160
+ Reference recent tasks without typing full IDs:
161
+
162
+ | Shortcut | Meaning |
163
+ |---|---|
164
+ | `q` | Last referenced task |
165
+ | `q01` | Subtask 01 of recent |
166
+ | `p` | Parent of recent |
167
+ | `p03` | Sibling 03 via parent |
168
+
169
+ ```bash
170
+ tasker view s01t02 # sets recent = s01t02
171
+ tasker start q # starts s01t02
172
+ tasker view p # views s01 (parent)
173
+ tasker done q01 # marks s01t0201 done
174
+ ```
175
+
176
+ ## MCP Server
177
+
178
+ `tasker` can run as a [Model Context Protocol](https://modelcontextprotocol.io/) server, allowing AI agents to manage your tasks directly.
179
+
180
+ ### Configure in Claude Code
181
+
182
+ ```bash
183
+ claude mcp add tasker -- tasker mcp
184
+ ```
185
+
186
+ ### Configure per-project (`.mcp.json`)
187
+
188
+ ```json
189
+ {
190
+ "mcpServers": {
191
+ "tasker": {
192
+ "command": "tasker",
193
+ "args": ["mcp"]
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ If running from a Poetry project:
200
+
201
+ ```json
202
+ {
203
+ "mcpServers": {
204
+ "tasker": {
205
+ "command": "poetry",
206
+ "args": ["run", "tasker", "mcp"]
207
+ }
208
+ }
209
+ }
210
+ ```
211
+
212
+ ### HTTP transport
213
+
214
+ For network-accessible clients, start with `--port`:
215
+
216
+ ```bash
217
+ tasker mcp --port 8080
218
+ ```
219
+
220
+ ### Available tools
221
+
222
+ Once connected, the MCP server exposes:
223
+
224
+ | Tool | Description |
225
+ |---|---|
226
+ | `create_task` | Create a root task or subtask |
227
+ | `list_tasks` | List all root tasks |
228
+ | `view_task` | View task details and subtasks |
229
+ | `start_task` | Mark task in-progress |
230
+ | `reset_task` | Reset task to pending |
231
+ | `finish_task` | Mark task done |
232
+
233
+ ## Development
234
+
235
+ ```bash
236
+ poetry install --with dev
237
+
238
+ # Run all checks (lint + tests)
239
+ poetry run tox
240
+
241
+ # Run tests only
242
+ poetry run tox -e test
243
+
244
+ # Lint (black, isort, flake8, mypy)
245
+ poetry run tox -e lint
246
+
247
+ # Format code
248
+ black src tests
249
+ isort src tests
250
+ ```
251
+
252
+ ## Requirements
253
+
254
+ - Python >= 3.10
255
+
256
+ ## Release Notes
257
+
258
+ ### 1.0.0
259
+ - `pip` release
@@ -0,0 +1,32 @@
1
+ tasker/__init__.py,sha256=XO80-qROIXr9L0MbIk7lqORPy6rwj4EwXCSBPXhGZi0,79
2
+ tasker/base_types.py,sha256=kUMGLxvthFDCoccUzDeJLZ7ShcjyIWGpgml2YZwFLxs,1444
3
+ tasker/cli/__init__.py,sha256=lqVQHcRMQC2TLyNQV7xiO2iJXUim7I5JmduH3lRyPJ0,359
4
+ tasker/cli/_common.py,sha256=TCDLiOkMah0rBd6HWKNWS_8MMq79TndLLJKUyd87FDU,3944
5
+ tasker/cli/_create_commands.py,sha256=Jh1fXMIL4psu_4qytQ3_coO4S5jTT4JPSew7pWWOYOo,3464
6
+ tasker/cli/_mcp_commands.py,sha256=5rPWU6XMiqGnLBi-L-n1O6MhFtEI5ZAO1ejE7a5fNLM,533
7
+ tasker/cli/_organize_commands.py,sha256=7pxn-jznlCbM-Pl49k5SeePJFa1Wldt5pqi1iKy8wfE,6548
8
+ tasker/cli/_task_commands.py,sha256=rqVjT0_eLk_Js6PrqECiUxbzLp8hk-ZHd3eDDyh1rmw,10934
9
+ tasker/cli/_view_commands.py,sha256=eApAsZUcT63BljgRHHwVPl_uKvXSKY33PgeNAxl6RKg,5106
10
+ tasker/exceptions.py,sha256=H87OqIOafi2OdL4L5ZIaQjLmBqNkEjeUzV5YVY5jNLI,1244
11
+ tasker/main.py,sha256=bUzAjKetL-S1mQGN61GLBtiVXez9ubn795k8HKtaFm8,65
12
+ tasker/mcp/__init__.py,sha256=6JzQ4v85zmCUM3-jXR_HdIGorUewerg-qAV27isgO7c,476
13
+ tasker/mcp/_common.py,sha256=VIdoF-uyuERrqo3dBHT3LJcB6yw6lYM8Dze4uI_cQcw,320
14
+ tasker/mcp/_create_methods.py,sha256=XylMFG2VJXJnIP3xLGrRYWSzPwtWUXAw5g3EbLeXGoQ,642
15
+ tasker/mcp/_model.py,sha256=NiTcR2gskzlKRzSZEX-38hwpkUB3zkp_L-Dky7GTfBU,1028
16
+ tasker/mcp/_status_methods.py,sha256=lbkqdbTEdvC5_eVWGZCkoawOCyzIjtDNkBEd4hvGIhY,864
17
+ tasker/mcp/_view_methods.py,sha256=ruxAHLWhJezECklvdmtsRrFUnt2jzhWPXdLvsoJAgIY,1252
18
+ tasker/parse.py,sha256=BDZRnNCLACUQ67zPZvq1pHYBMZhS0TgwKLaXoOAPpUg,9751
19
+ tasker/render.py,sha256=CYUYcXrN3YvgYCg-MQxYRQ7yqer8n-3Zu44SdigsPLI,1070
20
+ tasker/repo/__init__.py,sha256=A6jbPGNCLmrHPhWh0KmRDpl7ERt2AvWLaVpX9oTz_eU,117
21
+ tasker/repo/_archive_task.py,sha256=Yd_ckktf2qThP5p3lOcau81FzuDMqKJgETM7qG5y8o4,2237
22
+ tasker/repo/_move_task.py,sha256=X3GuyQSjZihPmB25MxpArWS0_B3SOLWH3YWG0q4aqP4,3687
23
+ tasker/repo/_task_loader.py,sha256=pedrWaPW4XMnktH0doZzPLfgKbDpDK8KhlfTbN5MfjI,8782
24
+ tasker/repo/_task_repo.py,sha256=n01rICR81knOA0ykdZKGxWEUN23u4RePb_pyoBeKk9E,6250
25
+ tasker/repo/_utils.py,sha256=pqI3o4x3Y8z6pAU0tAH__fq2PhrDW5IT1iIpjEG6oxc,4133
26
+ tasker/templates/task.md.j2,sha256=inVS1mZfJiZmLFzW83zLIao0BGcD3K6VczpNIS71CtI,895
27
+ tasker/utils.py,sha256=wv0Q2nO8G8kT2kmzC4Wdy4Rz1IgcMB4r-B_kMii0VQc,2588
28
+ mcp_tasker-1.0.0.dist-info/METADATA,sha256=SoTdhQH7rkNziBiNSXVAUf8kIO4mwKfAbj11UV3Le4g,6654
29
+ mcp_tasker-1.0.0.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
30
+ mcp_tasker-1.0.0.dist-info/entry_points.txt,sha256=6HZSWaOQnqTv1GCbedl26WwDVle0AetUfnnP-7oDlgA,42
31
+ mcp_tasker-1.0.0.dist-info/licenses/LICENSE,sha256=kvbvfQ_OYOvMw66Znic1UBqub9iMNUwMldTiokYoOYQ,1102
32
+ mcp_tasker-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.3.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ tasker=tasker.main:app
3
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2026] [Evgeniy A. Cymbalyuk <cimbaluk@gmail.com>]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
tasker/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """tasker — file-based task tracker for git repos."""
2
+
3
+ __version__ = "0.1.0"
tasker/base_types.py ADDED
@@ -0,0 +1,57 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+ from pydantic import BaseModel
6
+
7
+ EXTENDED_TASK_FILENAME = "README.md"
8
+
9
+
10
+ class TaskStatus(str, Enum):
11
+ PENDING = "pending"
12
+ IN_PROGRESS = "in-progress"
13
+ DONE = "done"
14
+ CANCELLED = "cancelled"
15
+
16
+
17
+ class Task(BaseModel):
18
+ id: str # unique id that can be used to reference a task
19
+ title: str # short summary of a task
20
+ status: TaskStatus = TaskStatus.PENDING
21
+
22
+ # file-task fields (None/defaults for inline tasks)
23
+ slug: str | None = None
24
+ extended: bool = False
25
+ description: str | None = None
26
+ extra_sections: str | None = None
27
+ subtasks: list[Task] = []
28
+
29
+ @property
30
+ def is_inline(self) -> bool:
31
+ return self.slug is None
32
+
33
+ @property
34
+ def is_closed(self) -> bool:
35
+ return self.status in (TaskStatus.DONE, TaskStatus.CANCELLED)
36
+
37
+ @property
38
+ def ref(self) -> str:
39
+ if self.slug is not None:
40
+ return build_task_ref(self.id, self.slug)
41
+ return self.id
42
+
43
+
44
+ def build_task_ref(task_id: str, slug: str) -> str:
45
+ return f"{task_id}-{slug}"
46
+
47
+
48
+ def is_root_task_id(task_id: str) -> bool:
49
+ assert "-" not in task_id, "task id must be provided, not task ref"
50
+ # HACK: tasks are in form s123t4567, root tasks are always s123 without `t` suffix
51
+ return "t" not in task_id
52
+
53
+
54
+ def is_nonleaf_task(task: Task) -> bool:
55
+ if not task.is_inline and task.subtasks:
56
+ return True
57
+ return False
tasker/cli/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ __all__ = ["app"]
2
+
3
+ from . import _create_commands as _create_commands # noqa: F401
4
+ from . import _mcp_commands as _mcp_commands # noqa: F401
5
+ from . import _organize_commands as _organize_commands # noqa: F401
6
+ from . import _task_commands as _task_commands # noqa: F401
7
+ from . import _view_commands as _view_commands # noqa: F401
8
+ from ._common import app
tasker/cli/_common.py ADDED
@@ -0,0 +1,138 @@
1
+ import re
2
+ from pathlib import Path
3
+ from typing import Annotated
4
+
5
+ import typer
6
+ from typer_di import TyperDI
7
+
8
+ from tasker.base_types import Task
9
+ from tasker.exceptions import TaskArchivedError, TaskValidateError
10
+ from tasker.parse import make_child_ref, parse_task_ref
11
+ from tasker.repo import TaskRepo
12
+ from tasker.utils import JsonAppend, console, read_text, write_text
13
+
14
+ _RECENT_FILE = ".recent"
15
+ _GITIGNORE_FILE = ".gitignore"
16
+
17
+
18
+ app = TyperDI(
19
+ name="tasker",
20
+ help="File-based task tracker for git repos.",
21
+ no_args_is_help=True,
22
+ pretty_exceptions_show_locals=False,
23
+ )
24
+
25
+
26
+ @app.callback()
27
+ def common_options(
28
+ debug: Annotated[
29
+ bool, typer.Option("--debug", help="Show full tracebacks on errors.")
30
+ ] = False,
31
+ json_output: Annotated[
32
+ bool, typer.Option("--json-output", help="Output result in json format.")
33
+ ] = False,
34
+ ) -> None:
35
+ console.debug = debug
36
+ console.json_output = json_output
37
+
38
+
39
+ def get_task_repo() -> TaskRepo:
40
+ tasker_dir = Path("tasker")
41
+ tasker_dir.mkdir(exist_ok=True)
42
+ return TaskRepo(tasker_dir)
43
+
44
+
45
+ def resolve_ref(
46
+ repo: TaskRepo,
47
+ task_ref: str,
48
+ *,
49
+ save_recent: bool = False,
50
+ auto_unarchive: bool = False,
51
+ ) -> Task:
52
+ is_direct_link = task_ref.startswith("s")
53
+ if not is_direct_link:
54
+ task_ref = _resolve_recent(repo, task_ref)
55
+
56
+ if auto_unarchive and repo.is_archived_task(task_ref):
57
+ ref = parse_task_ref(task_ref)
58
+ repo.unarchive_root_task(ref.root_id)
59
+ root = repo.resolve_ref(ref.root_id)
60
+ console.print(
61
+ f"[yellow]Unarchiving [blue]{root.ref}[/blue] automatically.[/yellow]",
62
+ json_output={"unarchived_ref": JsonAppend(ref.root_id)},
63
+ )
64
+
65
+ try:
66
+ task = repo.resolve_ref(task_ref)
67
+ except TaskArchivedError as ex:
68
+ if console.json_output:
69
+ raise
70
+
71
+ console.print(f"[yellow]Task [blue]{ex.task_ref}[/blue] is archived.[/yellow]")
72
+ console.print("Unarchive it first before performing actions on it.")
73
+ raise typer.Exit(1) from ex
74
+
75
+ if save_recent and is_direct_link:
76
+ save_recent_task(repo, task.id)
77
+
78
+ return task
79
+
80
+
81
+ def save_recent_task(repo: TaskRepo, task_id: str) -> None:
82
+ _ensure_gitignore(repo.root)
83
+ write_text(repo.root / _RECENT_FILE, task_id + "\n")
84
+
85
+
86
+ def _resolve_recent(repo: TaskRepo, task_ref: str) -> str:
87
+ if not task_ref.startswith(("p", "q")):
88
+ # resolve as-is, try to resolve in repo
89
+ return task_ref
90
+
91
+ recent_ref = _load_recent(repo, task_ref)
92
+
93
+ if task_ref == "q":
94
+ return recent_ref
95
+
96
+ # links like q0102
97
+ if m := re.fullmatch(r"q((?:\d{2})+)", task_ref):
98
+ return make_child_ref(recent_ref, m.group(1))
99
+
100
+ # links like p, p01, pp, pp0102
101
+ if m := re.fullmatch(r"(p+)((?:\d{2})+)?", task_ref):
102
+ ancestor_id = recent_ref
103
+ for _ in range(len(m.group(1))):
104
+ ancestor_id = parse_task_ref(ancestor_id).parent_id
105
+ digits = m.group(2)
106
+
107
+ if digits:
108
+ return make_child_ref(ancestor_id, digits)
109
+ return ancestor_id
110
+
111
+ raise TaskValidateError(f"Invalid recent reference {task_ref!r}", task_ref=task_ref)
112
+
113
+
114
+ def _load_recent(repo: TaskRepo, task_ref: str) -> str:
115
+ path = repo.root / _RECENT_FILE
116
+ if not path.exists():
117
+ raise TaskValidateError("Recent task was not set yet", task_ref=task_ref)
118
+
119
+ text = path.read_text().strip()
120
+ if not text:
121
+ raise TaskValidateError("Recent task was not set yet", task_ref=task_ref)
122
+
123
+ return text
124
+
125
+
126
+ def _ensure_gitignore(root: Path) -> None:
127
+ gitignore = root / _GITIGNORE_FILE
128
+ if not gitignore.exists():
129
+ write_text(gitignore, _GITIGNORE_FILE + "\n" + _RECENT_FILE + "\n")
130
+ return
131
+
132
+ content = read_text(gitignore)
133
+ if _RECENT_FILE in content.splitlines():
134
+ return
135
+ if not content.endswith("\n"):
136
+ content += "\n"
137
+ content += _RECENT_FILE + "\n"
138
+ write_text(gitignore, content)
@@ -0,0 +1,103 @@
1
+ import sys
2
+ from typing import Annotated, Optional
3
+
4
+ import typer
5
+ from typer_di import Depends
6
+
7
+ from tasker.repo import TaskRepo
8
+ from tasker.utils import console
9
+
10
+ from ._common import app, get_task_repo, resolve_ref, save_recent_task
11
+
12
+
13
+ @app.command("new", help="Create a new top-level task.")
14
+ def cmd_new_task(
15
+ *,
16
+ title: Annotated[str, typer.Argument(help="Task title.")],
17
+ details: Annotated[
18
+ Optional[str], typer.Option("--details", "-d", help="Task description.")
19
+ ] = None,
20
+ slug: Annotated[
21
+ Optional[str], typer.Option("--slug", help="Override auto-derived slug.")
22
+ ] = None,
23
+ extended: Annotated[
24
+ bool, typer.Option("--extended", help="Create task as a directory.")
25
+ ] = False,
26
+ repo: TaskRepo = Depends(get_task_repo),
27
+ ) -> None:
28
+ with console.catching_output():
29
+ task = repo.create_root_task(
30
+ title=title, description=details, slug=slug, extended=extended
31
+ )
32
+ repo.flush_to_disk()
33
+ save_recent_task(repo, task.id)
34
+
35
+ console.print(
36
+ f"[green]Task [blue]{task.ref}[/blue] created[/green]",
37
+ json_output={"task_ref": task.ref},
38
+ )
39
+
40
+
41
+ @app.command("add", help="Add a subtask to an existing task.")
42
+ def cmd_add_task(
43
+ *,
44
+ parent_ref: Annotated[str, typer.Argument(help="Parent task ID.")],
45
+ title: Annotated[str, typer.Argument(help="Subtask title.")],
46
+ details: Annotated[
47
+ Optional[str], typer.Option("--details", "-d", help="Task description.")
48
+ ] = None,
49
+ slug: Annotated[
50
+ Optional[str], typer.Option("--slug", help="Override auto-derived slug.")
51
+ ] = None,
52
+ repo: TaskRepo = Depends(get_task_repo),
53
+ ) -> None:
54
+ with console.catching_output():
55
+ parent = resolve_ref(repo, parent_ref, save_recent=True, auto_unarchive=True)
56
+ child = repo.add_subtask(parent, title=title, description=details, slug=slug)
57
+ repo.flush_to_disk()
58
+
59
+ console.print(
60
+ f"[green]Task [blue]{child.ref}[/blue]"
61
+ f" added to [blue]{parent.ref}[/blue][/green]",
62
+ json_output={"task_ref": child.ref},
63
+ )
64
+
65
+
66
+ @app.command("add-many", help="Interactively add multiple subtasks.")
67
+ def cmd_add_many_tasks(
68
+ *,
69
+ parent_ref: Annotated[str, typer.Argument(help="Parent task ID.")],
70
+ repo: TaskRepo = Depends(get_task_repo),
71
+ ) -> None:
72
+ with console.catching_output():
73
+ parent = resolve_ref(repo, parent_ref, save_recent=True)
74
+
75
+ console.print(
76
+ f"[cyan]Adding tasks to [blue]{parent.ref}[/blue][/cyan]"
77
+ " (empty line to finish):",
78
+ json_output={"parent_ref": parent_ref},
79
+ )
80
+
81
+ task_refs: list[str] = []
82
+ while True:
83
+ console.print(" [dim]>[/dim] ", end="")
84
+ line = sys.stdin.readline()
85
+ if not line or not line.strip():
86
+ break
87
+ child = repo.add_subtask(parent, title=line.strip())
88
+ repo.flush_to_disk()
89
+ task_refs.append(child.ref)
90
+ console.print(f" [green]task [blue]{child.ref}[/blue] added[/green]")
91
+
92
+ if not task_refs:
93
+ console.print(
94
+ "[yellow]No tasks added.[/yellow]",
95
+ json_output={"task_refs": []},
96
+ )
97
+ return
98
+
99
+ console.print(
100
+ f"[green]Done:[/green] {len(task_refs)} task(s) added"
101
+ f" to [blue]{parent.id}[/blue]",
102
+ json_output={"task_refs": task_refs},
103
+ )
@@ -0,0 +1,25 @@
1
+ import asyncio
2
+ from typing import Annotated
3
+
4
+ import typer
5
+
6
+ from tasker.mcp import mcp
7
+
8
+ from ._common import app
9
+
10
+
11
+ @app.command(
12
+ "mcp", help="Start MCP server (stdio transport, or HTTP if --port is given)."
13
+ )
14
+ def cmd_mcp(
15
+ port: Annotated[
16
+ int | None,
17
+ typer.Option("--port", help="Port to listen on (starts HTTP/SSE server)."),
18
+ ] = None,
19
+ ) -> None:
20
+ if port is None:
21
+ asyncio.run(mcp.run_stdio_async())
22
+ return
23
+
24
+ mcp.settings.port = port
25
+ asyncio.run(mcp.run_streamable_http_async())