task-notes 0.1.0__tar.gz
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.
- task_notes-0.1.0/.gitignore +30 -0
- task_notes-0.1.0/.mise.toml +15 -0
- task_notes-0.1.0/.python-version +1 -0
- task_notes-0.1.0/PKG-INFO +146 -0
- task_notes-0.1.0/README.md +131 -0
- task_notes-0.1.0/docs/requirements.md +181 -0
- task_notes-0.1.0/pyproject.toml +31 -0
- task_notes-0.1.0/skills/task_skills/SKILL.md +102 -0
- task_notes-0.1.0/src/task_notes/__init__.py +0 -0
- task_notes-0.1.0/src/task_notes/cli.py +568 -0
- task_notes-0.1.0/src/task_notes/core.py +331 -0
- task_notes-0.1.0/tests/test_cli.py +152 -0
- task_notes-0.1.0/tests/test_core.py +90 -0
- task_notes-0.1.0/uv.lock +57 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# macOS
|
|
2
|
+
.DS_Store
|
|
3
|
+
|
|
4
|
+
# Python bytecode/cache
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*.pyo
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
|
|
13
|
+
# Tool caches
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
.ruff_cache/
|
|
17
|
+
|
|
18
|
+
# Coverage
|
|
19
|
+
.coverage
|
|
20
|
+
.coverage.*
|
|
21
|
+
htmlcov/
|
|
22
|
+
|
|
23
|
+
# Build artifacts
|
|
24
|
+
build/
|
|
25
|
+
dist/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
|
|
28
|
+
# Local task data (if using repo-local custom dir)
|
|
29
|
+
.task-notes/
|
|
30
|
+
tasks/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[tools]
|
|
2
|
+
python = "3.13"
|
|
3
|
+
uv = "latest"
|
|
4
|
+
|
|
5
|
+
[tasks.install]
|
|
6
|
+
description = "Install project dependencies with uv"
|
|
7
|
+
run = "uv sync"
|
|
8
|
+
|
|
9
|
+
[tasks.test]
|
|
10
|
+
description = "Run full test suite"
|
|
11
|
+
run = "uv run python -m unittest discover -s tests -v"
|
|
12
|
+
|
|
13
|
+
[tasks.task-help]
|
|
14
|
+
description = "Show task CLI help"
|
|
15
|
+
run = "uv run task --help"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: task-notes
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LLM-friendly Markdown task notes CLI
|
|
5
|
+
Keywords: agent,cli,llm,markdown,tasks
|
|
6
|
+
Classifier: Environment :: Console
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
11
|
+
Classifier: Topic :: Utilities
|
|
12
|
+
Requires-Python: >=3.13
|
|
13
|
+
Requires-Dist: rich>=14.1.0
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# task-notes
|
|
17
|
+
|
|
18
|
+
一个面向 LLM/Agent 的任务管理 CLI。
|
|
19
|
+
用 Markdown checklist 保存任务,支持多级子任务、稳定 selector(如 `1.2.3`)、文本/JSON 双输出,以及 Rich 终端展示。
|
|
20
|
+
|
|
21
|
+
## 功能
|
|
22
|
+
|
|
23
|
+
- 单项目单文件:`<project>.md`
|
|
24
|
+
- 多级树状任务
|
|
25
|
+
- selector 定位:`1`、`1.2`、`2.1.3`
|
|
26
|
+
- 原子写入 + 文件锁(并发安全)
|
|
27
|
+
- Rich 展示(`ls` 表格、`show` 树)
|
|
28
|
+
- `edit` 支持交互选择(方向键/jk + Space + Enter)
|
|
29
|
+
- `--json` 机读输出
|
|
30
|
+
|
|
31
|
+
## 安装与运行
|
|
32
|
+
|
|
33
|
+
### 使用 uv(推荐)
|
|
34
|
+
|
|
35
|
+
在项目目录内:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv run task --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
临时执行(不安装到全局):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uvx --from . task --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
安装为全局工具:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv tool install --editable .
|
|
51
|
+
task --help
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 使用 pip
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install .
|
|
58
|
+
task --help
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 默认数据目录与安全策略
|
|
62
|
+
|
|
63
|
+
- 默认目录:`~/.task-notes`
|
|
64
|
+
- 可自定义目录:`--tasks-dir <path>`
|
|
65
|
+
- 安全限制:默认禁止写入非 `~/.task-notes` 目录;若要使用其他目录,必须显式加:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
--unsafe-external-dir
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
示例:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
task --unsafe-external-dir --tasks-dir ./tasks ls
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 快速开始
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
task new app-redesign "梳理需求" "实现功能" "验收发布"
|
|
81
|
+
task add app-redesign --parent 2 "实现 task ls/show"
|
|
82
|
+
task show app-redesign
|
|
83
|
+
task next app-redesign
|
|
84
|
+
task check app-redesign --path 1
|
|
85
|
+
task edit app-redesign --path 2.1 "实现 ls/show/tree 输出"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 命令概览
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
task ls [--json]
|
|
92
|
+
task show <project> [--json]
|
|
93
|
+
task next <project> [--json]
|
|
94
|
+
task new <project> <content...> [--json]
|
|
95
|
+
task add <project> [--parent <selector>] <content...> [--json]
|
|
96
|
+
task edit <project> --path <selector> <content> [--json]
|
|
97
|
+
task edit <project> -i [--json]
|
|
98
|
+
task del <project> --path <selector> [--json]
|
|
99
|
+
task rm <project> [--json]
|
|
100
|
+
task check <project> --path <selector> [--json]
|
|
101
|
+
task uncheck <project> --path <selector> [--json]
|
|
102
|
+
task toggle <project> --path <selector> [--json]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 交互式编辑
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
task edit <project> -i
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
按键:
|
|
112
|
+
|
|
113
|
+
- `↑/↓` 或 `j/k`:移动光标
|
|
114
|
+
- `Space`:选择当前任务
|
|
115
|
+
- `Enter`:确认并编辑文本
|
|
116
|
+
- `q` / `Esc`:取消
|
|
117
|
+
|
|
118
|
+
## JSON 输出
|
|
119
|
+
|
|
120
|
+
适合 tools/LLM 集成:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
task show app-redesign --json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
错误时返回非 0,并输出:
|
|
127
|
+
|
|
128
|
+
- `ok: false`
|
|
129
|
+
- `error_code`
|
|
130
|
+
- `error_message`
|
|
131
|
+
|
|
132
|
+
## 开发
|
|
133
|
+
|
|
134
|
+
运行测试:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
uv run python -m unittest discover -s tests -p 'test_*.py' -v
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 发布到 PyPI(建议流程)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
uv build
|
|
144
|
+
uvx twine check dist/*
|
|
145
|
+
# uvx twine upload dist/*
|
|
146
|
+
```
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# task-notes
|
|
2
|
+
|
|
3
|
+
一个面向 LLM/Agent 的任务管理 CLI。
|
|
4
|
+
用 Markdown checklist 保存任务,支持多级子任务、稳定 selector(如 `1.2.3`)、文本/JSON 双输出,以及 Rich 终端展示。
|
|
5
|
+
|
|
6
|
+
## 功能
|
|
7
|
+
|
|
8
|
+
- 单项目单文件:`<project>.md`
|
|
9
|
+
- 多级树状任务
|
|
10
|
+
- selector 定位:`1`、`1.2`、`2.1.3`
|
|
11
|
+
- 原子写入 + 文件锁(并发安全)
|
|
12
|
+
- Rich 展示(`ls` 表格、`show` 树)
|
|
13
|
+
- `edit` 支持交互选择(方向键/jk + Space + Enter)
|
|
14
|
+
- `--json` 机读输出
|
|
15
|
+
|
|
16
|
+
## 安装与运行
|
|
17
|
+
|
|
18
|
+
### 使用 uv(推荐)
|
|
19
|
+
|
|
20
|
+
在项目目录内:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv run task --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
临时执行(不安装到全局):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uvx --from . task --help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
安装为全局工具:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uv tool install --editable .
|
|
36
|
+
task --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 使用 pip
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install .
|
|
43
|
+
task --help
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 默认数据目录与安全策略
|
|
47
|
+
|
|
48
|
+
- 默认目录:`~/.task-notes`
|
|
49
|
+
- 可自定义目录:`--tasks-dir <path>`
|
|
50
|
+
- 安全限制:默认禁止写入非 `~/.task-notes` 目录;若要使用其他目录,必须显式加:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
--unsafe-external-dir
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
示例:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
task --unsafe-external-dir --tasks-dir ./tasks ls
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 快速开始
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
task new app-redesign "梳理需求" "实现功能" "验收发布"
|
|
66
|
+
task add app-redesign --parent 2 "实现 task ls/show"
|
|
67
|
+
task show app-redesign
|
|
68
|
+
task next app-redesign
|
|
69
|
+
task check app-redesign --path 1
|
|
70
|
+
task edit app-redesign --path 2.1 "实现 ls/show/tree 输出"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 命令概览
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
task ls [--json]
|
|
77
|
+
task show <project> [--json]
|
|
78
|
+
task next <project> [--json]
|
|
79
|
+
task new <project> <content...> [--json]
|
|
80
|
+
task add <project> [--parent <selector>] <content...> [--json]
|
|
81
|
+
task edit <project> --path <selector> <content> [--json]
|
|
82
|
+
task edit <project> -i [--json]
|
|
83
|
+
task del <project> --path <selector> [--json]
|
|
84
|
+
task rm <project> [--json]
|
|
85
|
+
task check <project> --path <selector> [--json]
|
|
86
|
+
task uncheck <project> --path <selector> [--json]
|
|
87
|
+
task toggle <project> --path <selector> [--json]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 交互式编辑
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
task edit <project> -i
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
按键:
|
|
97
|
+
|
|
98
|
+
- `↑/↓` 或 `j/k`:移动光标
|
|
99
|
+
- `Space`:选择当前任务
|
|
100
|
+
- `Enter`:确认并编辑文本
|
|
101
|
+
- `q` / `Esc`:取消
|
|
102
|
+
|
|
103
|
+
## JSON 输出
|
|
104
|
+
|
|
105
|
+
适合 tools/LLM 集成:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
task show app-redesign --json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
错误时返回非 0,并输出:
|
|
112
|
+
|
|
113
|
+
- `ok: false`
|
|
114
|
+
- `error_code`
|
|
115
|
+
- `error_message`
|
|
116
|
+
|
|
117
|
+
## 开发
|
|
118
|
+
|
|
119
|
+
运行测试:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
uv run python -m unittest discover -s tests -p 'test_*.py' -v
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 发布到 PyPI(建议流程)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
uv build
|
|
129
|
+
uvx twine check dist/*
|
|
130
|
+
# uvx twine upload dist/*
|
|
131
|
+
```
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Task Notes CLI 需求文档(v2,参考 tdx + nb)
|
|
2
|
+
|
|
3
|
+
## 1. 产品定位
|
|
4
|
+
|
|
5
|
+
一个面向 LLM agent 的纯 CLI 任务管理工具:
|
|
6
|
+
- 使用 Markdown 作为唯一存储介质
|
|
7
|
+
- 使用 checklist 表达任务状态
|
|
8
|
+
- 支持单文件多层嵌套任务树
|
|
9
|
+
- 所有操作均可通过稳定编号选择器完成
|
|
10
|
+
|
|
11
|
+
目标不是替代通用任务系统,而是提供“可脚本化、可追踪、可回放”的任务控制层。
|
|
12
|
+
|
|
13
|
+
## 2. 参考设计与取舍
|
|
14
|
+
|
|
15
|
+
参考 `tdx`:
|
|
16
|
+
- 采用 Markdown + checklist + 嵌套树模型
|
|
17
|
+
- 采用路径式选择器(如 `1.2.3`)定位节点
|
|
18
|
+
|
|
19
|
+
参考 `nb`:
|
|
20
|
+
- 输出中默认提供可复用编号
|
|
21
|
+
- 命令保持简短,适配自动化调用
|
|
22
|
+
|
|
23
|
+
本项目差异化:
|
|
24
|
+
- 更强调 LLM 调度场景
|
|
25
|
+
- 要求所有关键命令可稳定机读(`--json`)
|
|
26
|
+
- 默认按“项目文件”组织,而不是全局扁平任务池
|
|
27
|
+
|
|
28
|
+
## 3. 核心场景
|
|
29
|
+
|
|
30
|
+
LLM 在执行复杂项目时需要:
|
|
31
|
+
- 将项目拆分为多级子任务
|
|
32
|
+
- 随时查询“当前做到哪一步”
|
|
33
|
+
- 对某个子树进行增删改查,不依赖人工打开编辑器
|
|
34
|
+
|
|
35
|
+
## 4. 数据模型
|
|
36
|
+
|
|
37
|
+
- `Project`:一个项目对应一个 Markdown 文件
|
|
38
|
+
- `TaskNode`:一条 checklist 项,可包含子节点
|
|
39
|
+
- `Selector`:节点定位符,使用层级路径(如 `2.1.3`)
|
|
40
|
+
|
|
41
|
+
节点最小字段:
|
|
42
|
+
- 文本内容(必填)
|
|
43
|
+
- 完成状态(`todo`/`done`)
|
|
44
|
+
- 子节点列表
|
|
45
|
+
|
|
46
|
+
## 5. 文件与目录规范
|
|
47
|
+
|
|
48
|
+
### 5.1 目录
|
|
49
|
+
|
|
50
|
+
- 默认目录:`~/.task-notes`(使用当前用户主目录,跨系统兼容)
|
|
51
|
+
- 可通过 `--tasks-dir` 指定其他目录
|
|
52
|
+
- 安全策略:当目录不是 `~/.task-notes` 时,必须额外传 `--unsafe-external-dir`
|
|
53
|
+
- 文件命名:`<project-name>.md`
|
|
54
|
+
- `project-name` 需做 slug 化,避免非法字符
|
|
55
|
+
|
|
56
|
+
### 5.2 Markdown 结构
|
|
57
|
+
|
|
58
|
+
```md
|
|
59
|
+
# project-alpha
|
|
60
|
+
|
|
61
|
+
- [ ] 需求澄清
|
|
62
|
+
- [x] 收集输入
|
|
63
|
+
- [ ] 输出接口定义
|
|
64
|
+
- [ ] 开发实现
|
|
65
|
+
- [ ] CLI 参数解析
|
|
66
|
+
- [ ] 文件读写与原子更新
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
约束:
|
|
70
|
+
- 编码:UTF-8
|
|
71
|
+
- 缩进:2 个空格表示一级嵌套
|
|
72
|
+
- 仅使用 `- [ ]` 和 `- [x]`
|
|
73
|
+
|
|
74
|
+
### 5.3 选择器规则
|
|
75
|
+
|
|
76
|
+
- 顶层按显示顺序编号:`1`、`2`、`3`
|
|
77
|
+
- 子节点编号:`1.1`、`1.2`、`2.1.3`
|
|
78
|
+
- CLI 必须接受 `1.2.3` 形式;可选兼容 `[1.2.3]`
|
|
79
|
+
- 任何会修改节点的命令都必须支持基于选择器定位
|
|
80
|
+
|
|
81
|
+
## 6. 命令设计(MVP)
|
|
82
|
+
|
|
83
|
+
说明:所有命令默认非交互式,适合 LLM 直接调用。
|
|
84
|
+
|
|
85
|
+
### 6.1 查询类
|
|
86
|
+
|
|
87
|
+
`task ls`
|
|
88
|
+
- 列出所有项目文件
|
|
89
|
+
- 每行必须包含:顺序标号、项目名、完成数/总数、文件路径
|
|
90
|
+
|
|
91
|
+
`task show <project>`
|
|
92
|
+
- 展示项目任务树
|
|
93
|
+
- 每行必须包含层级选择器(如 `1.2`)和勾选状态
|
|
94
|
+
|
|
95
|
+
`task next <project>`
|
|
96
|
+
- 返回“下一个可执行任务”
|
|
97
|
+
- 默认规则:第一个未完成叶子节点
|
|
98
|
+
- 用于让 LLM 快速判断下一步行动
|
|
99
|
+
|
|
100
|
+
### 6.2 新增类
|
|
101
|
+
|
|
102
|
+
`task new <project> <content1> <content2> ...`
|
|
103
|
+
- 创建项目文件并写入顶层任务
|
|
104
|
+
- 项目已存在时报错,不覆盖
|
|
105
|
+
|
|
106
|
+
`task add <project> <content1> <content2> ...`
|
|
107
|
+
- 在顶层末尾追加任务
|
|
108
|
+
|
|
109
|
+
`task add <project> --parent <selector> <content1> <content2> ...`
|
|
110
|
+
- 在指定父节点下追加子任务
|
|
111
|
+
|
|
112
|
+
### 6.3 编辑与删除类
|
|
113
|
+
|
|
114
|
+
`task edit <project> --path <selector> <content>`
|
|
115
|
+
- 仅修改文本,不改变勾选状态
|
|
116
|
+
- 也支持交互式:`task edit <project> -i`
|
|
117
|
+
- 交互式支持:`↑/↓`(或 `j/k`)移动,`Space` 选择,`Enter` 确认
|
|
118
|
+
|
|
119
|
+
`task del <project> --path <selector>`
|
|
120
|
+
- 删除目标节点及其整个子树
|
|
121
|
+
|
|
122
|
+
`task rm <project>`
|
|
123
|
+
- 删除整个项目文件
|
|
124
|
+
|
|
125
|
+
### 6.4 状态类
|
|
126
|
+
|
|
127
|
+
`task check <project> --path <selector>`
|
|
128
|
+
- 将目标节点置为完成
|
|
129
|
+
|
|
130
|
+
`task uncheck <project> --path <selector>`
|
|
131
|
+
- 将目标节点置为未完成
|
|
132
|
+
|
|
133
|
+
`task toggle <project> --path <selector>`(可选)
|
|
134
|
+
- 在完成/未完成间切换
|
|
135
|
+
|
|
136
|
+
## 7. 输出规范(LLM 友好)
|
|
137
|
+
|
|
138
|
+
### 7.1 文本模式(默认)
|
|
139
|
+
|
|
140
|
+
- 成功:`OK <action>: <target>`
|
|
141
|
+
- 失败:`ERR <reason>: <target>`
|
|
142
|
+
- 列表输出默认带顺序编号
|
|
143
|
+
- `task show` 默认带层级选择器编号
|
|
144
|
+
|
|
145
|
+
### 7.2 JSON 模式
|
|
146
|
+
|
|
147
|
+
所有核心命令建议支持 `--json`:
|
|
148
|
+
- 至少包含:`ok`、`action`、`project`、`selector`(如有)、`message`
|
|
149
|
+
- 出错时包含:`error_code`、`error_message`
|
|
150
|
+
|
|
151
|
+
## 8. 一致性与安全
|
|
152
|
+
|
|
153
|
+
- 文件写入采用原子替换(tmp + rename)
|
|
154
|
+
- 并发写同一文件时不出现半写入内容
|
|
155
|
+
- 默认仅允许写入 `~/.task-notes`,防止误写任意目录
|
|
156
|
+
- 错误返回非 0 退出码
|
|
157
|
+
- 命令执行应幂等可预期(同输入得同结果)
|
|
158
|
+
|
|
159
|
+
## 9. 验收标准(MVP)
|
|
160
|
+
|
|
161
|
+
- 能创建项目并生成 Markdown checklist
|
|
162
|
+
- 能展示项目列表与任务树,且默认带编号
|
|
163
|
+
- 能基于 `--path` 对任意层级节点增删改查
|
|
164
|
+
- 能正确处理嵌套任务
|
|
165
|
+
- `task next` 能返回第一个未完成叶子节点
|
|
166
|
+
- 任务不存在、路径不存在、重名创建均有明确错误和非 0 退出码
|
|
167
|
+
- 核心命令在 `--json` 下可被程序稳定解析
|
|
168
|
+
|
|
169
|
+
## 10. 示例流程(LLM 调度)
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
task new app-redesign "梳理需求" "实现功能" "验收发布"
|
|
173
|
+
task add app-redesign --parent 2 "实现 task ls/show"
|
|
174
|
+
task add app-redesign --parent 2 "实现 task add/edit/del"
|
|
175
|
+
task show app-redesign
|
|
176
|
+
task next app-redesign
|
|
177
|
+
task check app-redesign --path 1
|
|
178
|
+
task edit app-redesign --path 2.1 "实现 ls/show/tree 输出"
|
|
179
|
+
task del app-redesign --path 2.2
|
|
180
|
+
task show app-redesign --json
|
|
181
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "task-notes"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "LLM-friendly Markdown task notes CLI"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
keywords = ["cli", "tasks", "markdown", "agent", "llm"]
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Environment :: Console",
|
|
10
|
+
"Intended Audience :: Developers",
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"Programming Language :: Python :: 3.13",
|
|
13
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
14
|
+
"Topic :: Utilities",
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"rich>=14.1.0",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.scripts]
|
|
21
|
+
task = "task_notes.cli:main"
|
|
22
|
+
|
|
23
|
+
[build-system]
|
|
24
|
+
requires = ["hatchling"]
|
|
25
|
+
build-backend = "hatchling.build"
|
|
26
|
+
|
|
27
|
+
[tool.uv]
|
|
28
|
+
package = true
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.wheel]
|
|
31
|
+
packages = ["src/task_notes"]
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task-notes-cli
|
|
3
|
+
description: Use this skill when working with the task-notes CLI to create, inspect, update, and automate Markdown task trees, especially for selector-based edits and JSON-safe tool integration.
|
|
4
|
+
metadata:
|
|
5
|
+
short-description: Operate task-notes CLI safely and consistently
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Task Notes CLI Skill
|
|
9
|
+
|
|
10
|
+
## When To Use
|
|
11
|
+
|
|
12
|
+
Use this skill when the user asks to:
|
|
13
|
+
|
|
14
|
+
- manage project tasks with `task` commands
|
|
15
|
+
- create or update nested task trees
|
|
16
|
+
- operate tasks by selector path (`1`, `1.2`, `2.1.3`)
|
|
17
|
+
- integrate task output with tools/LLM pipelines
|
|
18
|
+
|
|
19
|
+
Do not use this skill for unrelated generic to-do apps or external SaaS task systems.
|
|
20
|
+
|
|
21
|
+
## Key Rules
|
|
22
|
+
|
|
23
|
+
1. Default data directory is `~/.task-notes`.
|
|
24
|
+
2. Non-default directories require explicit opt-in:
|
|
25
|
+
`--unsafe-external-dir --tasks-dir <path>`.
|
|
26
|
+
3. Prefer `--json` for machine parsing and tool-to-LLM handoff.
|
|
27
|
+
4. Use `task show <project>` to get selectors before mutating.
|
|
28
|
+
5. Keep slug-safe project names; CLI normalizes project names internally.
|
|
29
|
+
|
|
30
|
+
## Command Patterns
|
|
31
|
+
|
|
32
|
+
### Query
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
task ls
|
|
36
|
+
task show <project>
|
|
37
|
+
task next <project>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Machine-safe:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
task show <project> --json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Create / Add
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
task new <project> "<task1>" "<task2>"
|
|
50
|
+
task add <project> "<task>"
|
|
51
|
+
task add <project> --parent <selector> "<child-task>"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Update / Remove
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
task edit <project> --path <selector> "<new-text>"
|
|
58
|
+
task edit <project> -i
|
|
59
|
+
task del <project> --path <selector>
|
|
60
|
+
task rm <project>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Status
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
task check <project> --path <selector>
|
|
67
|
+
task uncheck <project> --path <selector>
|
|
68
|
+
task toggle <project> --path <selector>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Interactive Edit Mode
|
|
72
|
+
|
|
73
|
+
Use when user wants terminal UI editing:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
task edit <project> -i
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Keys:
|
|
80
|
+
|
|
81
|
+
- `↑/↓` or `j/k`: move cursor
|
|
82
|
+
- `Space`: select item
|
|
83
|
+
- `Enter`: confirm
|
|
84
|
+
- `q`/`Esc`: cancel
|
|
85
|
+
|
|
86
|
+
Interactive edit requires a TTY. In non-interactive subprocess environments, use `--path`.
|
|
87
|
+
|
|
88
|
+
## Recommended Workflow For Agents
|
|
89
|
+
|
|
90
|
+
1. `task ls --json` to inspect projects.
|
|
91
|
+
2. `task show <project> --json` to fetch selectors and status.
|
|
92
|
+
3. Pick exact selector target.
|
|
93
|
+
4. Run mutation command (`add/edit/del/check/...`).
|
|
94
|
+
5. Re-run `task show <project> --json` to verify.
|
|
95
|
+
|
|
96
|
+
## Error Handling
|
|
97
|
+
|
|
98
|
+
- Any failure returns non-zero exit code.
|
|
99
|
+
- In text mode: `ERR <ErrorClass>: <message>`
|
|
100
|
+
- In JSON mode: parse `ok`, `error_code`, `error_message`
|
|
101
|
+
|
|
102
|
+
On path safety errors, user must explicitly approve and add `--unsafe-external-dir`.
|
|
File without changes
|