A CLI tool for interacting with HackMD API
npm install hackmd-cliA command-line interface for interacting with the HackMD API.
``bash`
npm install -g hackmd-cli
Or run directly with npx:
`bash`
npx hackmd-cli
1. Get your API token from HackMD Settings
2. Set the environment variable:
`bash`
export HACKMD_TOKEN=your_api_token
Or create a .env file in your project directory:
``
HACKMD_TOKEN=your_api_token
`bashGet current user profile
hackmd me
$3
`bash
List all notes
hackmd notes listGet a specific note
hackmd notes get Create a new note
hackmd notes create
hackmd notes create --title "My Note" --content "# Hello"
hackmd notes create --read-permission guest --write-permission signed_inUpdate a note
hackmd notes update --content "# Updated content"
hackmd notes update --read-permission owner --permalink my-noteDelete a note
hackmd notes delete
`$3
`bash
List all teams
hackmd teams listList team notes
hackmd teams notes Get a team note
hackmd teams note Create a team note
hackmd teams create-note
hackmd teams create-note --title "Team Note" --content "# Hello"Update a team note
hackmd teams update-note --content "# Updated"Delete a team note
hackmd teams delete-note
`$3
#### Permission Values
-
owner - Only the owner can access
- signed_in - Any signed-in user can access
- guest - Anyone can access (including anonymous users)API Coverage
This CLI covers all HackMD API v1 endpoints:
| Endpoint | Command |
|----------|---------|
| GET /me |
hackmd me |
| GET /history | hackmd history |
| GET /notes | hackmd notes list |
| GET /notes/:noteId | hackmd notes get |
| POST /notes | hackmd notes create |
| PATCH /notes/:noteId | hackmd notes update |
| DELETE /notes/:noteId | hackmd notes delete |
| GET /teams | hackmd teams list |
| GET /teams/:teamPath/notes | hackmd teams notes |
| GET /teams/:teamPath/notes/:noteId | hackmd teams note |
| POST /teams/:teamPath/notes | hackmd teams create-note |
| PATCH /teams/:teamPath/notes/:noteId | hackmd teams update-note |
| DELETE /teams/:teamPath/notes/:noteId | hackmd teams delete-note |Development
`bash
Install dependencies
npm installBuild
npm run buildRun tests
npm testRun tests in watch mode
npm run test:watchType check
npm run lint
``MIT