chatmd 0.2.7__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.
- chatmd-0.2.7/.gitignore +31 -0
- chatmd-0.2.7/CHANGELOG.md +196 -0
- chatmd-0.2.7/CONTRIBUTING.md +146 -0
- chatmd-0.2.7/LICENSE +21 -0
- chatmd-0.2.7/PKG-INFO +477 -0
- chatmd-0.2.7/README.md +446 -0
- chatmd-0.2.7/pyproject.toml +74 -0
- chatmd-0.2.7/src/chatmd/__init__.py +3 -0
- chatmd-0.2.7/src/chatmd/__main__.py +6 -0
- chatmd-0.2.7/src/chatmd/cli.py +214 -0
- chatmd-0.2.7/src/chatmd/commands/__init__.py +1 -0
- chatmd-0.2.7/src/chatmd/commands/agent_lifecycle.py +327 -0
- chatmd-0.2.7/src/chatmd/commands/init_workspace.py +189 -0
- chatmd-0.2.7/src/chatmd/commands/migrations.py +246 -0
- chatmd-0.2.7/src/chatmd/commands/mode.py +43 -0
- chatmd-0.2.7/src/chatmd/commands/service.py +418 -0
- chatmd-0.2.7/src/chatmd/commands/upgrade.py +76 -0
- chatmd-0.2.7/src/chatmd/commands/win_service.py +348 -0
- chatmd-0.2.7/src/chatmd/engine/__init__.py +1 -0
- chatmd-0.2.7/src/chatmd/engine/agent.py +1213 -0
- chatmd-0.2.7/src/chatmd/engine/confirm.py +179 -0
- chatmd-0.2.7/src/chatmd/engine/cron_inline.py +118 -0
- chatmd-0.2.7/src/chatmd/engine/cron_log.py +51 -0
- chatmd-0.2.7/src/chatmd/engine/cron_parser.py +523 -0
- chatmd-0.2.7/src/chatmd/engine/cron_safety.py +58 -0
- chatmd-0.2.7/src/chatmd/engine/cron_scheduler.py +395 -0
- chatmd-0.2.7/src/chatmd/engine/cron_state.py +122 -0
- chatmd-0.2.7/src/chatmd/engine/parser.py +350 -0
- chatmd-0.2.7/src/chatmd/engine/reference_resolver.py +204 -0
- chatmd-0.2.7/src/chatmd/engine/router.py +217 -0
- chatmd-0.2.7/src/chatmd/engine/scheduler.py +251 -0
- chatmd-0.2.7/src/chatmd/engine/state.py +134 -0
- chatmd-0.2.7/src/chatmd/exceptions.py +33 -0
- chatmd-0.2.7/src/chatmd/i18n/__init__.py +76 -0
- chatmd-0.2.7/src/chatmd/i18n/en.py +647 -0
- chatmd-0.2.7/src/chatmd/i18n/zh_CN.py +626 -0
- chatmd-0.2.7/src/chatmd/infra/__init__.py +1 -0
- chatmd-0.2.7/src/chatmd/infra/config.py +205 -0
- chatmd-0.2.7/src/chatmd/infra/file_writer.py +256 -0
- chatmd-0.2.7/src/chatmd/infra/git_sync.py +166 -0
- chatmd-0.2.7/src/chatmd/infra/git_utils.py +122 -0
- chatmd-0.2.7/src/chatmd/infra/index_manager.py +88 -0
- chatmd-0.2.7/src/chatmd/infra/notification.py +456 -0
- chatmd-0.2.7/src/chatmd/infra/offline_queue.py +97 -0
- chatmd-0.2.7/src/chatmd/providers/__init__.py +1 -0
- chatmd-0.2.7/src/chatmd/providers/base.py +16 -0
- chatmd-0.2.7/src/chatmd/providers/liteagent.py +183 -0
- chatmd-0.2.7/src/chatmd/providers/litestartup.py +477 -0
- chatmd-0.2.7/src/chatmd/providers/openai_compat.py +146 -0
- chatmd-0.2.7/src/chatmd/security/__init__.py +1 -0
- chatmd-0.2.7/src/chatmd/security/kernel_gate.py +91 -0
- chatmd-0.2.7/src/chatmd/skills/__init__.py +5 -0
- chatmd-0.2.7/src/chatmd/skills/ai.py +233 -0
- chatmd-0.2.7/src/chatmd/skills/base.py +81 -0
- chatmd-0.2.7/src/chatmd/skills/bind.py +244 -0
- chatmd-0.2.7/src/chatmd/skills/builtin.py +610 -0
- chatmd-0.2.7/src/chatmd/skills/canvas.py +341 -0
- chatmd-0.2.7/src/chatmd/skills/confirm.py +67 -0
- chatmd-0.2.7/src/chatmd/skills/cron.py +518 -0
- chatmd-0.2.7/src/chatmd/skills/hot_reload.py +109 -0
- chatmd-0.2.7/src/chatmd/skills/inbox.py +132 -0
- chatmd-0.2.7/src/chatmd/skills/infra.py +272 -0
- chatmd-0.2.7/src/chatmd/skills/loader.py +303 -0
- chatmd-0.2.7/src/chatmd/skills/notify.py +137 -0
- chatmd-0.2.7/src/chatmd/skills/upload.py +320 -0
- chatmd-0.2.7/src/chatmd/watcher/__init__.py +1 -0
- chatmd-0.2.7/src/chatmd/watcher/auto_upload.py +166 -0
- chatmd-0.2.7/src/chatmd/watcher/file_watcher.py +186 -0
- chatmd-0.2.7/src/chatmd/watcher/suffix_trigger.py +91 -0
- chatmd-0.2.7/tests/__init__.py +0 -0
- chatmd-0.2.7/tests/conftest.py +51 -0
- chatmd-0.2.7/tests/test_ai_preserve_text.py +147 -0
- chatmd-0.2.7/tests/test_ai_skills.py +98 -0
- chatmd-0.2.7/tests/test_ai_writing_skills.py +200 -0
- chatmd-0.2.7/tests/test_auto_upload.py +349 -0
- chatmd-0.2.7/tests/test_bind_skill.py +236 -0
- chatmd-0.2.7/tests/test_bot_notification.py +299 -0
- chatmd-0.2.7/tests/test_builtin_skills.py +160 -0
- chatmd-0.2.7/tests/test_canvas_skill.py +327 -0
- chatmd-0.2.7/tests/test_config.py +89 -0
- chatmd-0.2.7/tests/test_confirm.py +313 -0
- chatmd-0.2.7/tests/test_cron_inline.py +189 -0
- chatmd-0.2.7/tests/test_cron_integration.py +501 -0
- chatmd-0.2.7/tests/test_cron_parser.py +471 -0
- chatmd-0.2.7/tests/test_cron_safety.py +186 -0
- chatmd-0.2.7/tests/test_cron_scheduler.py +400 -0
- chatmd-0.2.7/tests/test_cron_skill.py +191 -0
- chatmd-0.2.7/tests/test_cron_skill_extended.py +206 -0
- chatmd-0.2.7/tests/test_cron_state.py +249 -0
- chatmd-0.2.7/tests/test_daily_note_skill.py +299 -0
- chatmd-0.2.7/tests/test_datetime_skills.py +167 -0
- chatmd-0.2.7/tests/test_e2e.py +170 -0
- chatmd-0.2.7/tests/test_e2e_v020.py +298 -0
- chatmd-0.2.7/tests/test_e2e_v022.py +291 -0
- chatmd-0.2.7/tests/test_fence_parser.py +241 -0
- chatmd-0.2.7/tests/test_file_watcher_assistant.py +134 -0
- chatmd-0.2.7/tests/test_file_writer.py +91 -0
- chatmd-0.2.7/tests/test_git_sync.py +129 -0
- chatmd-0.2.7/tests/test_git_utils.py +201 -0
- chatmd-0.2.7/tests/test_graceful_shutdown.py +363 -0
- chatmd-0.2.7/tests/test_hot_reload.py +61 -0
- chatmd-0.2.7/tests/test_i18n.py +114 -0
- chatmd-0.2.7/tests/test_inbox_skill.py +153 -0
- chatmd-0.2.7/tests/test_index_manager.py +58 -0
- chatmd-0.2.7/tests/test_init.py +70 -0
- chatmd-0.2.7/tests/test_inline_cmd.py +158 -0
- chatmd-0.2.7/tests/test_interaction_dir.py +150 -0
- chatmd-0.2.7/tests/test_kernel_gate.py +104 -0
- chatmd-0.2.7/tests/test_litestartup_provider.py +281 -0
- chatmd-0.2.7/tests/test_markdown_skills.py +230 -0
- chatmd-0.2.7/tests/test_migrations.py +328 -0
- chatmd-0.2.7/tests/test_mode.py +186 -0
- chatmd-0.2.7/tests/test_network_placeholder.py +179 -0
- chatmd-0.2.7/tests/test_new_session.py +271 -0
- chatmd-0.2.7/tests/test_notification.py +281 -0
- chatmd-0.2.7/tests/test_notify_skill.py +564 -0
- chatmd-0.2.7/tests/test_offline_queue.py +78 -0
- chatmd-0.2.7/tests/test_output_format.py +173 -0
- chatmd-0.2.7/tests/test_parser.py +127 -0
- chatmd-0.2.7/tests/test_parser_enhanced.py +208 -0
- chatmd-0.2.7/tests/test_plugin_loader.py +461 -0
- chatmd-0.2.7/tests/test_po_validation.py +684 -0
- chatmd-0.2.7/tests/test_providers.py +384 -0
- chatmd-0.2.7/tests/test_readme_smoke.py +438 -0
- chatmd-0.2.7/tests/test_reference_resolver.py +243 -0
- chatmd-0.2.7/tests/test_router.py +121 -0
- chatmd-0.2.7/tests/test_router_conflict.py +109 -0
- chatmd-0.2.7/tests/test_scheduler.py +147 -0
- chatmd-0.2.7/tests/test_service.py +215 -0
- chatmd-0.2.7/tests/test_skill_loader.py +95 -0
- chatmd-0.2.7/tests/test_state.py +86 -0
- chatmd-0.2.7/tests/test_suffix_integration.py +165 -0
- chatmd-0.2.7/tests/test_suffix_trigger.py +60 -0
- chatmd-0.2.7/tests/test_system_channel.py +69 -0
- chatmd-0.2.7/tests/test_upgrade.py +87 -0
- chatmd-0.2.7/tests/test_upload_skill.py +421 -0
chatmd-0.2.7/.gitignore
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.venv/
|
|
9
|
+
.eggs/
|
|
10
|
+
|
|
11
|
+
# IDE
|
|
12
|
+
.vscode/
|
|
13
|
+
.idea/
|
|
14
|
+
|
|
15
|
+
# ChatMD runtime (user workspace, not this repo)
|
|
16
|
+
# .chatmd/state.json
|
|
17
|
+
# .chatmd/tasks.json
|
|
18
|
+
# .chatmd/queue.json
|
|
19
|
+
# .chatmd/logs/
|
|
20
|
+
|
|
21
|
+
# Secrets
|
|
22
|
+
.env
|
|
23
|
+
|
|
24
|
+
# OS
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# Test / coverage
|
|
29
|
+
.coverage
|
|
30
|
+
htmlcov/
|
|
31
|
+
.pytest_cache/
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
> Format follows [Keep a Changelog](https://keepachangelog.com/). Versioning follows [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## [0.2.7] — 2026-04-15
|
|
8
|
+
|
|
9
|
+
Windows Service management + `/notify` channel filtering + multi-service convenience commands.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Windows Service (pywin32)**: proper SCM-managed Windows Service replacing Task Scheduler
|
|
14
|
+
- `chatmd service install -w <path>` — install per-workspace service with auto-start
|
|
15
|
+
- Auto-detect `pywin32_postinstall.py` DLL status with clear fix instructions
|
|
16
|
+
- Idempotent install (existing service auto-removed before reinstall)
|
|
17
|
+
- Failure recovery: auto-restart on crash (5s delay, max 3/day)
|
|
18
|
+
- **Multi-service convenience commands**:
|
|
19
|
+
- `chatmd service status` (no `-w`) — list all installed ChatMD services
|
|
20
|
+
- `chatmd service uninstall --all` — uninstall all ChatMD services at once
|
|
21
|
+
- **`/notify` channel filtering**: target specific notification channels
|
|
22
|
+
- `/notify(email) msg` — send via email only
|
|
23
|
+
- `/notify(bot) msg` — send via Bot only
|
|
24
|
+
- `/notify(email,bot) msg` — send via email + Bot
|
|
25
|
+
- `/notify msg` — all channels (default, unchanged)
|
|
26
|
+
- `chatmd init` now creates `.chatmd/agent.yaml.example` + `.chatmd/user.yaml.example` (committed to git as safe templates)
|
|
27
|
+
- `.chatmd/agent.yaml` and `.chatmd/user.yaml` added to workspace `.gitignore` (may contain API keys)
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Windows Service Error 1073 (service already exists) — idempotent reinstall
|
|
32
|
+
- Windows Service Error 1053 (DLL / PythonPath / SCM issues) — auto-detection + registry fix
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## [0.2.6] — 2026-04-14
|
|
37
|
+
|
|
38
|
+
`/sync` quality improvements + Bot notification pipeline + CI.
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- `/sync` detailed feedback: shows `↓N pulled, ↑N pushed` counts
|
|
43
|
+
- `chatmd upgrade` migration 0.2.4→0.2.5: auto-add `.gitignore` runtime patterns
|
|
44
|
+
- LiteStartup `POST /api/bot/notify` — push notifications to bound Telegram Bot
|
|
45
|
+
- LiteStartup `POST /api/bot/sync-complete` — reset pending messages after sync
|
|
46
|
+
- GitHub Actions CI: Ruff lint + pytest (Python 3.10–3.13, ubuntu/windows/macos)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## [0.2.5] — 2026-04-14
|
|
51
|
+
|
|
52
|
+
Bot binding + reverse notifications + inbox + security fixes.
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- `/bind <token>` — one-step Telegram Bot binding (auto-detect git remote, SSH→HTTPS)
|
|
57
|
+
- `BotNotificationChannel` — push notifications to Telegram Bot
|
|
58
|
+
- `/inbox` — view messages received via Bot
|
|
59
|
+
- Inbox deduplication (monotonic `message_id`)
|
|
60
|
+
- Timezone support for Bot messages (`notification.bot.timezone` config)
|
|
61
|
+
|
|
62
|
+
### Security
|
|
63
|
+
|
|
64
|
+
- `strip_url_credentials()` — strip plaintext credentials from repo URLs before API calls
|
|
65
|
+
- `mask_repo_url()` — sanitize repo URLs for display
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## [0.2.4] — 2026-04-13
|
|
70
|
+
|
|
71
|
+
Confirmation window + open-source preparation + CLI improvements.
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- Confirmation window for destructive commands (`/sync`, `/upload`, `/new`)
|
|
76
|
+
- `chatmd restart` / `chatmd upgrade -w <path>` CLI commands
|
|
77
|
+
- `CONTRIBUTING.md` for open-source contributors
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## [0.2.3] — 2026-04-12
|
|
82
|
+
|
|
83
|
+
Custom Skill plugins + Git Sync Cron + `/notify` notifications.
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
|
|
87
|
+
- Custom Skill plugin system (YAML declarative + Python dynamic)
|
|
88
|
+
- `/notify` — send notifications through file/desktop/email channels
|
|
89
|
+
- Git Sync as Cron job (`@every 5m /sync`)
|
|
90
|
+
- Cron task management: `/cron list`, `/cron pause`, `/cron resume`
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## [0.2.2] — 2026-04-10
|
|
95
|
+
|
|
96
|
+
Cron scheduled tasks + Notification system + `/help` improvements.
|
|
97
|
+
|
|
98
|
+
### Added
|
|
99
|
+
|
|
100
|
+
- Cron task engine (crontab syntax + `@every` intervals)
|
|
101
|
+
- Notification system (FileChannel + SystemChannel desktop toast)
|
|
102
|
+
- `/help` grouped by category with rich Markdown output
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## [0.2.1] — 2026-04-02
|
|
107
|
+
|
|
108
|
+
Cross-platform startup experience improvements + configuration audit + code quality fixes.
|
|
109
|
+
|
|
110
|
+
### Added
|
|
111
|
+
|
|
112
|
+
- `chatmd mode suffix/save` — trigger mode switching command
|
|
113
|
+
- `chatmd start --daemon` — background daemon mode (Unix nohup/double-fork + Windows pythonw)
|
|
114
|
+
- `chatmd service install/uninstall/status` — system service registration (systemd/launchd/Windows Service)
|
|
115
|
+
- Windows graceful shutdown via signal file (replaces SIGTERM)
|
|
116
|
+
|
|
117
|
+
### Fixed
|
|
118
|
+
|
|
119
|
+
- Assistant mode (`--mode assistant`) now monitors all `.md` files across the entire workspace via `watch_dirs: ["."]`, with internal directories (`.chatmd`, `.git`, `node_modules`, etc.) excluded
|
|
120
|
+
- Windows `chatmd service install` and `_start_agent_now` now use `pythonw.exe` instead of `python.exe`, eliminating the cmd window popup when the service starts
|
|
121
|
+
- Removed unimplemented default config entries (`trigger.confirm`, `async.retry`, `commands.natural_language`, `display_name`, `preferences`) to avoid misleading users
|
|
122
|
+
- `KernelGate` now respects `logging.audit` config toggle
|
|
123
|
+
- `Scheduler` async task timeout (`async.timeout` config + watchdog timer)
|
|
124
|
+
- `file_writer` atomic write auto-retry + fallback on Windows PermissionError
|
|
125
|
+
- `logging.level` config now correctly applies to file log handler
|
|
126
|
+
|
|
127
|
+
### Changed
|
|
128
|
+
|
|
129
|
+
- Recommend `pipx` as the primary installation method
|
|
130
|
+
- README updated with Python installation guide
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## [0.2.0] — 2026-04-01
|
|
135
|
+
|
|
136
|
+
Provider unified abstraction + long text + AI writing + Canvas + upload + date/time + Markdown templates. 595 tests passed.
|
|
137
|
+
|
|
138
|
+
### Added
|
|
139
|
+
|
|
140
|
+
- LiteStartupProvider unified abstraction (multi-endpoint routing: AI/upload, backward compatible)
|
|
141
|
+
- Parser extensions: `:::` fenced long text + `/cmd{text}` inline command + `@` reference markers
|
|
142
|
+
- AI writing commands: `/rewrite`, `/expand`, `/polish`, `/summary`, `/tag`, `/title`
|
|
143
|
+
- `/canvas` — AI Canvas mind map (structured AI output + tree layout + .canvas export)
|
|
144
|
+
- `/upload` — manual image upload + auto-upload mode (Watcher integration)
|
|
145
|
+
- `/new` — archive conversation and start new session
|
|
146
|
+
- Date/time extensions: `/datetime`, `/timestamp`, `/week`, `/weekday`, `/progress`, `/daynum`, `/countdown`
|
|
147
|
+
- Markdown templates: `/todo`, `/done`, `/table`, `/code`, `/link`, `/img`, `/hr`, `/heading`, `/quote`
|
|
148
|
+
- `/help` grouped by category (datetime/ai/markdown/utility/custom)
|
|
149
|
+
|
|
150
|
+
### Fixed
|
|
151
|
+
|
|
152
|
+
- Alias conflict: `/q` restored to `/quote`
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## [0.1.0] — 2026-03-30
|
|
157
|
+
|
|
158
|
+
First official release. 168 tests passed. 6 sprints, 35 development tasks.
|
|
159
|
+
|
|
160
|
+
### Added
|
|
161
|
+
|
|
162
|
+
- Project skeleton: pyproject.toml + src/chatmd/ modular structure + CLI entry point
|
|
163
|
+
- `chatmd init` — workspace initialization (full/assistant mode + Git + config generation)
|
|
164
|
+
- `chatmd start/stop/status` — Agent lifecycle management (PID dedup + graceful stop)
|
|
165
|
+
- `chatmd upgrade --full` — assistant → full workspace conversion
|
|
166
|
+
- Config loading (agent.yaml + user.yaml + defaults merge + ${ENV} variable resolution)
|
|
167
|
+
- FileWatcher (watchdog + 300ms debounce + Agent write-back filter)
|
|
168
|
+
- Parser (`/command(args) input` syntax + `@ai{}` inline/multi-line + code block protection)
|
|
169
|
+
- Router (deterministic match + alias chain resolution + Levenshtein fuzzy suggestions)
|
|
170
|
+
- FileWriter (task ID anchor replacement + atomic write + thread-lock serialization)
|
|
171
|
+
- Scheduler (sync/async task dispatch + 6-state machine + ThreadPool)
|
|
172
|
+
- AI Skills: `/ask` conversation + `/translate` multi-language translation
|
|
173
|
+
- LiteAgent AI Provider (httpx + timeout/401/429 error handling)
|
|
174
|
+
- KernelGate security filter (AI output `/command` escaping + audit log)
|
|
175
|
+
- Multi-turn AI conversation context (ChatSession + max_turns truncation)
|
|
176
|
+
- Multi-session state management (StateManager + JSON persistence)
|
|
177
|
+
- Offline queue (OfflineQueue + FIFO + disk persistence)
|
|
178
|
+
- Git auto-sync + `/sync` (auto-commit + pull --rebase + push)
|
|
179
|
+
- Suffix signal trigger (SuffixTrigger + custom marker + enable/disable)
|
|
180
|
+
- Confirmation window (ConfirmationWindow + delay timer + delete-to-cancel)
|
|
181
|
+
- `@ai{}` enhanced (inline + multi-line block + code block protection)
|
|
182
|
+
- YAML/Python Skill Loader (declarative templates + dynamic import)
|
|
183
|
+
- Command conflict detection and priority (builtin > ai > custom > remote)
|
|
184
|
+
- Skill hot reload (SkillReloader + YAML/Python dynamic loading)
|
|
185
|
+
- `chat/_index.md` auto-maintenance (IndexManager)
|
|
186
|
+
- Built-in Skills: `/help`, `/date`, `/time`, `/now`, `/status`, `/list`, `/log`, `/sync`
|
|
187
|
+
|
|
188
|
+
### Fixed
|
|
189
|
+
|
|
190
|
+
- Skill base class `field()` compatibility on non-dataclass ABC
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## [0.0.0] — 2026-03-30
|
|
195
|
+
|
|
196
|
+
Project initialization.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Contributing to ChatMarkdown
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to ChatMarkdown! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Fork and clone
|
|
9
|
+
git clone https://github.com/<your-username>/chatmd.git
|
|
10
|
+
cd chatmd
|
|
11
|
+
|
|
12
|
+
# 2. Create a virtual environment
|
|
13
|
+
python -m venv .venv
|
|
14
|
+
source .venv/bin/activate # Linux/macOS
|
|
15
|
+
# .venv\Scripts\activate # Windows
|
|
16
|
+
|
|
17
|
+
# 3. Install dev dependencies
|
|
18
|
+
pip install -e ".[dev]"
|
|
19
|
+
|
|
20
|
+
# 4. Verify everything works
|
|
21
|
+
pytest
|
|
22
|
+
ruff check src/
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Development Guidelines
|
|
26
|
+
|
|
27
|
+
### Code Style
|
|
28
|
+
|
|
29
|
+
- **Python 3.10+** — use modern type hints (`list[str]`, `X | None`)
|
|
30
|
+
- **Ruff** for linting — run `ruff check src/ tests/` before committing
|
|
31
|
+
- **100-character** line width
|
|
32
|
+
- **Google-style** docstrings for all public functions
|
|
33
|
+
- **English** for all code, comments, variable names, and commit messages
|
|
34
|
+
|
|
35
|
+
### Testing
|
|
36
|
+
|
|
37
|
+
- **pytest + pytest-asyncio** — tests live in `tests/`
|
|
38
|
+
- Run the full suite: `pytest`
|
|
39
|
+
- Run with coverage: `coverage run -m pytest && coverage report`
|
|
40
|
+
- Markers: `@pytest.mark.unit`, `@pytest.mark.integration`, `@pytest.mark.e2e`, `@pytest.mark.slow`
|
|
41
|
+
- **All new features must include tests** — aim for ≥ 80% coverage
|
|
42
|
+
|
|
43
|
+
### Commit Messages
|
|
44
|
+
|
|
45
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
<type>(<scope>): <description>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Types**: `feat`, `fix`, `docs`, `test`, `refactor`, `chore`, `ci`, `perf`
|
|
52
|
+
|
|
53
|
+
**Examples**:
|
|
54
|
+
- `feat(skills): add /weather skill`
|
|
55
|
+
- `fix(parser): handle empty lines in fenced blocks`
|
|
56
|
+
- `docs: update README with new CLI commands`
|
|
57
|
+
- `test(cron): add persistence edge case tests`
|
|
58
|
+
|
|
59
|
+
### Branch Strategy
|
|
60
|
+
|
|
61
|
+
| Branch | Purpose |
|
|
62
|
+
|--------|---------|
|
|
63
|
+
| `main` | Stable releases |
|
|
64
|
+
| `dev` | Integration branch |
|
|
65
|
+
| `feat/<name>` | New features |
|
|
66
|
+
| `fix/<name>` | Bug fixes |
|
|
67
|
+
|
|
68
|
+
## How to Contribute
|
|
69
|
+
|
|
70
|
+
### Reporting Bugs
|
|
71
|
+
|
|
72
|
+
1. Search [existing issues](https://github.com/litestartup-com/chatmd/issues) first
|
|
73
|
+
2. Use the **Bug Report** issue template
|
|
74
|
+
3. Include: Python version, OS, steps to reproduce, expected vs actual behavior
|
|
75
|
+
|
|
76
|
+
### Suggesting Features
|
|
77
|
+
|
|
78
|
+
1. Open a **Feature Request** issue
|
|
79
|
+
2. Describe the use case and expected behavior
|
|
80
|
+
3. We'll discuss feasibility before implementation
|
|
81
|
+
|
|
82
|
+
### Submitting Pull Requests
|
|
83
|
+
|
|
84
|
+
1. **Fork** the repo and create a branch from `dev`
|
|
85
|
+
2. **Write tests** for your changes
|
|
86
|
+
3. **Run checks** before pushing:
|
|
87
|
+
```bash
|
|
88
|
+
pytest
|
|
89
|
+
ruff check src/ tests/
|
|
90
|
+
```
|
|
91
|
+
4. **Open a PR** against `dev` with a clear description
|
|
92
|
+
5. Link related issues (e.g., "Closes #42")
|
|
93
|
+
|
|
94
|
+
### Creating Custom Skills
|
|
95
|
+
|
|
96
|
+
ChatMarkdown supports a plugin system for custom skills. See [`rules/custom_skills.md`](rules/custom_skills.md) for the full guide.
|
|
97
|
+
|
|
98
|
+
Quick overview:
|
|
99
|
+
1. Create a Python module with a class extending `Skill`
|
|
100
|
+
2. Register it in `.chatmd/skills.yaml`
|
|
101
|
+
3. Skills support `configure()` / `teardown()` lifecycle hooks
|
|
102
|
+
|
|
103
|
+
## Project Structure
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
src/chatmd/
|
|
107
|
+
├── cli.py # CLI entry point (Click)
|
|
108
|
+
├── commands/ # CLI subcommands (init, start, stop, upgrade)
|
|
109
|
+
├── engine/ # Core engine (parser, router, agent, scheduler, cron)
|
|
110
|
+
├── watcher/ # File watcher + suffix trigger
|
|
111
|
+
├── skills/ # Built-in skills (ai, cron, infra, builtin)
|
|
112
|
+
├── providers/ # AI provider backends
|
|
113
|
+
├── security/ # KernelGate safety checks
|
|
114
|
+
├── infra/ # Config, file writer, git sync, notifications
|
|
115
|
+
└── i18n/ # Internationalization (en, zh_CN)
|
|
116
|
+
|
|
117
|
+
tests/ # All tests (unit, integration, e2e)
|
|
118
|
+
rules/ # Development rules and conventions
|
|
119
|
+
docs/ # Project documentation
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## i18n
|
|
123
|
+
|
|
124
|
+
- All user-facing strings use `t("key.name")` from `chatmd.i18n`
|
|
125
|
+
- Default locale: `en`, supported: `zh-CN`
|
|
126
|
+
- **Never hardcode user-facing text** — always use i18n keys
|
|
127
|
+
- Add keys to both `i18n/en.py` and `i18n/zh_CN.py`
|
|
128
|
+
|
|
129
|
+
## Security
|
|
130
|
+
|
|
131
|
+
- **No hardcoded API keys** — use environment variables or `.env`
|
|
132
|
+
- Commands in `security/kernel_gate.py` blacklist are blocked
|
|
133
|
+
- Destructive operations require explicit `/confirm`
|
|
134
|
+
|
|
135
|
+
## Code of Conduct
|
|
136
|
+
|
|
137
|
+
Be respectful, constructive, and inclusive. We follow the [Contributor Covenant](https://www.contributor-covenant.org/) Code of Conduct.
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE).
|
|
142
|
+
|
|
143
|
+
## Questions?
|
|
144
|
+
|
|
145
|
+
- Open a [Discussion](https://github.com/litestartup-com/chatmd/discussions) for general questions
|
|
146
|
+
- Check the [README](README.md) for usage documentation
|
chatmd-0.2.7/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Litestartup
|
|
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.
|