Skip to content

Commit bea38bd

Browse files
authored
Merge pull request #100 from hackmdio/release/2.5.0
Release v2.5.0
2 parents 4d6adc4 + f5631fc commit bea38bd

25 files changed

Lines changed: 1503 additions & 57 deletions

‎CHANGELOG.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
All notable changes to HackMD-CLI will be documented in this file.
44

5+
## 2.5.0
6+
7+
### Added
8+
9+
- Personal folder commands: `folders`, `folders create`, `folders update`, `folders delete`, and `folders order`
10+
- Team folder commands: `team-folders`, `team-folders create`, `team-folders update`, `team-folders delete`, and `team-folders order`
11+
- Agent skill (`hackmd-cli/SKILL.md`) with auto-packaging scripts for Cursor and other AI tooling
12+
13+
### Changed
14+
15+
- Upgraded `@hackmd/api` to v2.6.0
16+
17+
### Fixed
18+
19+
- Folder update command now returns silently on success
20+
- Folder command examples use hex color codes
21+
522
## 2.4.0
623

724
### Added

‎README.md‎

Lines changed: 334 additions & 29 deletions
Large diffs are not rendered by default.

‎hackmd-cli.skill‎

2.18 KB
Binary file not shown.

‎hackmd-cli/SKILL.md‎

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
---
2+
name: hackmd-cli
3+
description: HackMD command-line interface for managing personal/team notes and folders. Use this skill when users want to create, read, update, delete, reorder, or export HackMD notes and folders via CLI, manage team content, list teams, view browsing history, or automate HackMD workflows.
4+
---
5+
6+
# HackMD CLI
7+
8+
Command-line tool for managing HackMD notes, team notes, personal folders, and team folders via the HackMD API.
9+
10+
## Setup
11+
12+
### Install
13+
14+
```bash
15+
npm install -g @hackmd/hackmd-cli
16+
```
17+
18+
### Configure Access Token
19+
20+
Create an API token at [hackmd.io/settings#api](https://hackmd.io/settings#api), then configure:
21+
22+
```bash
23+
# Interactive login (saves to ~/.hackmd/config.json)
24+
hackmd-cli login
25+
26+
# Or via environment variable
27+
export HMD_API_ACCESS_TOKEN=YOUR_TOKEN
28+
```
29+
30+
For HackMD EE instances, also set the API endpoint:
31+
32+
```bash
33+
export HMD_API_ENDPOINT_URL=https://your.hackmd-ee.endpoint
34+
```
35+
36+
## Commands
37+
38+
### Authentication
39+
40+
```bash
41+
hackmd-cli login # Set access token interactively
42+
hackmd-cli logout # Clear stored credentials
43+
hackmd-cli whoami # Show current user info
44+
```
45+
46+
### Personal Notes
47+
48+
```bash
49+
# List all notes
50+
hackmd-cli notes
51+
52+
# Get specific note
53+
hackmd-cli notes --noteId=<id>
54+
55+
# Create note
56+
hackmd-cli notes create --content='# Title' --title='My Note'
57+
hackmd-cli notes create --readPermission=owner --writePermission=owner
58+
59+
# Create note inside a folder
60+
hackmd-cli notes create --parentFolderId=<folder-id> --content='# Title'
61+
62+
# Create from file/stdin
63+
cat README.md | hackmd-cli notes create
64+
65+
# Create with editor
66+
hackmd-cli notes create -e
67+
68+
# Update note
69+
hackmd-cli notes update --noteId=<id> --content='# New Content'
70+
71+
# Move note into a folder
72+
hackmd-cli notes update --noteId=<id> --parentFolderId=<folder-id>
73+
74+
# Delete note
75+
hackmd-cli notes delete --noteId=<id>
76+
```
77+
78+
### Team Notes
79+
80+
```bash
81+
# List team notes
82+
hackmd-cli team-notes --teamPath=<team-path>
83+
84+
# Create team note
85+
hackmd-cli team-notes create --teamPath=<team-path> --content='# Team Doc'
86+
87+
# Create team note inside a folder
88+
hackmd-cli team-notes create --teamPath=<team-path> --parentFolderId=<folder-id> --content='# Team Doc'
89+
90+
# Update team note
91+
hackmd-cli team-notes update --teamPath=<team-path> --noteId=<id> --content='# Updated'
92+
93+
# Move team note into a folder
94+
hackmd-cli team-notes update --teamPath=<team-path> --noteId=<id> --parentFolderId=<folder-id>
95+
96+
# Delete team note
97+
hackmd-cli team-notes delete --teamPath=<team-path> --noteId=<id>
98+
```
99+
100+
### Personal Folders
101+
102+
```bash
103+
# List all folders
104+
hackmd-cli folders
105+
106+
# Get specific folder
107+
hackmd-cli folders --folderId=<id>
108+
109+
# Create folder
110+
hackmd-cli folders create --name='Docs'
111+
112+
# Create nested folder
113+
hackmd-cli folders create --name='Docs' --parentFolderId=<folder-id>
114+
115+
# Create folder with metadata
116+
hackmd-cli folders create --name='Docs' --description='Project docs' --icon=1F600 --color='#4F46E5'
117+
118+
# Update folder
119+
hackmd-cli folders update --folderId=<id> --name='Updated Docs'
120+
121+
# Delete folder
122+
hackmd-cli folders delete --folderId=<id>
123+
124+
# Get / update folder order
125+
hackmd-cli folders order
126+
hackmd-cli folders order --order='{"root":["folder-id-1","folder-id-2"]}'
127+
```
128+
129+
### Team Folders
130+
131+
```bash
132+
# List all team folders
133+
hackmd-cli team-folders --teamPath=<team-path>
134+
135+
# Get specific team folder
136+
hackmd-cli team-folders --teamPath=<team-path> --folderId=<id>
137+
138+
# Create team folder
139+
hackmd-cli team-folders create --teamPath=<team-path> --name='Team Docs'
140+
141+
# Create nested team folder
142+
hackmd-cli team-folders create --teamPath=<team-path> --name='Team Docs' --parentFolderId=<folder-id>
143+
144+
# Create team folder with metadata
145+
hackmd-cli team-folders create --teamPath=<team-path> --name='Team Docs' --description='Project docs' --icon=1F600 --color='#4F46E5'
146+
147+
# Update team folder
148+
hackmd-cli team-folders update --teamPath=<team-path> --folderId=<id> --name='Updated Team Docs'
149+
150+
# Delete team folder
151+
hackmd-cli team-folders delete --teamPath=<team-path> --folderId=<id>
152+
153+
# Get / update team folder order
154+
hackmd-cli team-folders order --teamPath=<team-path>
155+
hackmd-cli team-folders order --teamPath=<team-path> --order='{"root":["folder-id-1","folder-id-2"]}'
156+
```
157+
158+
### Teams & History
159+
160+
```bash
161+
hackmd-cli teams # List accessible teams
162+
hackmd-cli history # List browsing history
163+
```
164+
165+
### Export
166+
167+
```bash
168+
hackmd-cli export --noteId=<id> # Export note content to stdout
169+
```
170+
171+
## Permissions
172+
173+
Available permission values:
174+
175+
| Permission Type | Values |
176+
| --------------------- | ---------------------------------------------------------------- |
177+
| `--readPermission` | `owner`, `signed_in`, `guest` |
178+
| `--writePermission` | `owner`, `signed_in`, `guest` |
179+
| `--commentPermission` | `disabled`, `forbidden`, `owners`, `signed_in_users`, `everyone` |
180+
181+
## Folder Flags
182+
183+
```bash
184+
--parentFolderId=<folder-id> # Put note/folder inside another folder
185+
--icon=1F600 # Emoji unified codepoint string
186+
--color='#4F46E5' # Hex color string
187+
--order='{"root":["id1","id2"]}' # Folder ordering JSON
188+
```
189+
190+
## Output Formats
191+
192+
All list commands support:
193+
194+
```bash
195+
--output=json # JSON output
196+
--output=yaml # YAML output
197+
--output=csv # CSV output (or --csv)
198+
--no-header # Hide table headers
199+
--no-truncate # Don't truncate long values
200+
--columns=id,title # Show specific columns
201+
--columns=id,name,color
202+
--filter=name=foo # Filter by property
203+
--sort=title # Sort by property (prepend '-' for descending)
204+
--sort=name
205+
-x, --extended # Show additional columns
206+
```
207+
208+
## Common Workflows
209+
210+
### Sync local file to HackMD
211+
212+
```bash
213+
# Create new note from file
214+
cat doc.md | hackmd-cli notes create --title="My Doc"
215+
216+
# Update existing note from file
217+
cat doc.md | hackmd-cli notes update --noteId=<id>
218+
```
219+
220+
### Create a folder and put a note inside it
221+
222+
```bash
223+
hackmd-cli folders create --name='Docs'
224+
hackmd-cli notes create --parentFolderId=<folder-id> --title='My Note'
225+
```
226+
227+
### Create a nested folder
228+
229+
```bash
230+
hackmd-cli folders create --name='Parent'
231+
hackmd-cli folders create --name='Child' --parentFolderId=<folder-id>
232+
```
233+
234+
### Move an existing note into a folder
235+
236+
```bash
237+
hackmd-cli notes update --noteId=<note-id> --parentFolderId=<folder-id>
238+
```
239+
240+
### Organize team docs in team folders
241+
242+
```bash
243+
hackmd-cli team-folders create --teamPath=<team-path> --name='Team Docs'
244+
hackmd-cli team-notes create --teamPath=<team-path> --parentFolderId=<folder-id> --content='# Team Note'
245+
```
246+
247+
### Export note to local file
248+
249+
```bash
250+
hackmd-cli export --noteId=<id> > note.md
251+
```
252+
253+
### List notes as JSON for scripting
254+
255+
```bash
256+
hackmd-cli notes --output=json | jq '.[] | .id'
257+
```
258+
259+
### Find note by title
260+
261+
```bash
262+
hackmd-cli notes --filter=title=README
263+
```

‎package.json‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@hackmd/hackmd-cli",
3-
"version": "2.4.0",
3+
"version": "2.5.0",
44
"author": "HackMD Team",
55
"bin": {
66
"hackmd-cli": "./bin/run"
77
},
88
"bugs": "https://github.com/hackmdio/hackmd-cli/issues",
99
"dependencies": {
10-
"@hackmd/api": "^2.5.0",
10+
"@hackmd/api": "2.6.0",
1111
"@hackmd/oclif-plugin-autocomplete": "^2.1.9-fish",
1212
"@oclif/core": "2.8.2",
1313
"@oclif/plugin-help": "5.2.9",
@@ -77,7 +77,9 @@
7777
"test": "mocha --forbid-only \"test/**/*.test.ts\" --exclude \"test/smoke/**/*\"",
7878
"test:unit": "mocha --forbid-only \"test/**/*.test.ts\" --exclude \"test/integration/**/*\" --exclude \"test/smoke/**/*\"",
7979
"test:smoke": "pnpm run build && mocha --forbid-only \"test/smoke/**/*.test.ts\"",
80-
"version": "oclif readme && git add README.md"
80+
"version": "oclif readme && git add README.md",
81+
"skill:package": "node scripts/package-skill.mjs",
82+
"skill:watch": "node scripts/watch-skill.mjs"
8183
},
8284
"types": "dist/index.d.ts"
8385
}

‎pnpm-lock.yaml‎

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

0 commit comments

Comments
 (0)