Skip to content

Commit 7f66047

Browse files
Yukaiicursoragent
andcommitted
feat: drop enterprise mode and expand CodiMD TUI
Limit codimd-cli to self-hosted CodiMD instances and remove HackMD Enterprise paths. Add TUI compose, markdown preview, URL open/copy, history pin, and matching CLI commands. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e6245b9 commit 7f66047

15 files changed

Lines changed: 369 additions & 274 deletions

File tree

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# codimd-cli
22

3-
Command-line tool for [CodiMD](https://github.com/hackmdio/codimd) and HackMD Enterprise, using **cookie session authentication** (no API token required).
3+
Command-line tool for self-hosted [CodiMD](https://github.com/hackmdio/codimd) instances, using **cookie session authentication** (no API token required).
44

55
Built with [Bun](https://bun.sh), [Cliffy](https://cliffy.io/) for the traditional CLI, and [OpenTUI](https://github.com/anomalyco/opentui) for interactive mode.
66

7+
For HackMD Enterprise or HackMD Cloud, use [hackmd-cli](https://github.com/hackmdio/hackmd-cli) instead.
8+
79
## Requirements
810

911
- [Bun](https://bun.sh) >= 1.2
@@ -35,13 +37,11 @@ codimd-cli list
3537

3638
| Variable | Description |
3739
|----------|-------------|
38-
| `CMD_CLI_SERVER_URL` | CodiMD / HackMD server URL |
40+
| `CMD_CLI_SERVER_URL` | CodiMD server URL |
3941
| `CMD_CLI_CONFIG_DIR` | Config directory (default `~/.codimd`) |
4042
| `CMD_CLI_COOKIE_PATH` | Cookie file path |
4143
| `CMD_CLI_ID` / `CMD_CLI_PASSWORD` | Non-interactive login |
4244

43-
For HackMD Enterprise, pass `--enterprise` or set `HMD_CLI_ENTERPRISE=true`.
44-
4545
## Commands
4646

4747
| Command | Description |
@@ -57,16 +57,14 @@ For HackMD Enterprise, pass `--enterprise` or set `HMD_CLI_ENTERPRISE=true`.
5757
| `update <noteId> [file]` | Update note content (`PUT /api/notes/:id`) |
5858
| `delete <noteId>` | Delete owned note (`DELETE /api/notes/:id`) |
5959
| `export <noteId> [file]` | Export note (`--md`, `--html`, `--pdf`) |
60-
| `history` | Browsing history (`GET /history`) |
60+
| `history` | Browsing history (`GET /history`, `--pin` / `--unpin`) |
61+
| `open <noteId>` | Open note URL in the default browser |
6162
| `status` | Server stats (`GET /status`) |
62-
| `teams` | List teams (enterprise only) |
63-
| `tui` | Interactive note browser (OpenTUI) — tabs, search, preview, delete |
63+
| `tui` | Interactive note browser (OpenTUI) |
6464
| *(stdin pipe)* | `cat doc.md \| codimd-cli` creates a note |
6565

6666
## CodiMD API mapping
6767

68-
This CLI targets the [CodiMD](https://github.com/hackmdio/codimd) HTTP surface:
69-
7068
| Operation | CodiMD endpoint |
7169
|-----------|-----------------|
7270
| Login | `POST /login` (form: email, password) |
@@ -77,8 +75,7 @@ This CLI targets the [CodiMD](https://github.com/hackmdio/codimd) HTTP surface:
7775
| Update | `PUT /api/notes/:noteId` `{ "content": "..." }` |
7876
| Delete | `DELETE /api/notes/:noteId` |
7977
| Create | `POST /new` (raw markdown body) |
80-
81-
HackMD Enterprise mode (`--enterprise`) uses `/api/overview`, CSRF tokens, and form-encoded note creation instead.
78+
| History pin | `POST /history/:noteId` (form: pinned=true/false) |
8279

8380
## Interactive TUI
8481

@@ -89,11 +86,16 @@ codimd-cli tui
8986
| Key | Action |
9087
|-----|--------|
9188
| `` / `` | Navigate list |
92-
| `Enter` | Preview selected note |
89+
| `Enter` | Preview selected note (rendered markdown) |
9390
| `Tab` / `` `` | Switch Notes / History tabs |
9491
| `/` | Focus search filter |
92+
| `n` | Compose a new note |
93+
| `Meta+Enter` | Create note (while composing) |
94+
| `o` | Copy note URL (or open in browser) |
95+
| `p` | Pin/unpin history entry |
9596
| `r` | Refresh current view |
9697
| `d` `d` | Delete selected note (double confirm) |
98+
| `Esc` | Cancel compose / unfocus search |
9799
| `Ctrl+C` | Quit |
98100

99101
## Development
@@ -131,7 +133,6 @@ Cookie-session flow adapted from [hackmd-cli v1](https://github.com/hackmdio/hac
131133
- POST credentials to `/login`
132134
- Persist session cookies to disk (`~/.codimd/cookies.json`)
133135
- Reuse cookies on subsequent requests
134-
- CSRF token scraping when `--enterprise` is enabled
135136

136137
## License
137138

bun.lock

Lines changed: 0 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codimd-cli",
33
"version": "0.1.0",
4-
"description": "Command-line interface for CodiMD and HackMD (cookie session auth)",
4+
"description": "Command-line interface for self-hosted CodiMD instances (cookie session auth)",
55
"type": "module",
66
"bin": {
77
"codimd-cli": "./dist/cli.js"
@@ -20,7 +20,6 @@
2020
},
2121
"keywords": [
2222
"codimd",
23-
"hackmd",
2423
"cli",
2524
"markdown"
2625
],
@@ -30,7 +29,6 @@
3029
"@cliffy/prompt": "npm:@jsr/cliffy__prompt",
3130
"@cliffy/table": "npm:@jsr/cliffy__table",
3231
"@opentui/core": "^0.1.0",
33-
"cheerio": "^1.0.0",
3432
"tough-cookie": "^5.1.2"
3533
},
3634
"devDependencies": {

0 commit comments

Comments
 (0)