hacknote 0.3.2

CLI for HackNote — manage notes from the command line
# hacknote-cli

A command-line interface for [HackNote](https://app.hacknote.co) — create, read, update, and delete notes, manage projects and tags, and search across your team, all from the terminal.

## Installation

```bash
cargo install hacknote
```

## Quick Start

### 1. Get an API Key

Log in to HackNote → Account Settings → API Tokens → create a new token.

### 2. Set your API key

```bash
hacknote config set-key <your-api-key>
```

### 3. Find your Team ID

```bash
hacknote teams list
```

```
┌──────────────────┬──────────┬────────┬─────────┐
│ ID               │ Name     │ Slug   │ Role    │
├──────────────────┼──────────┼────────┼─────────┤
│ 17c261f7d8fWbdml │ My Team  │ myteam │ Owner   │
└──────────────────┴──────────┴────────┴─────────┘
```

---

## Finding IDs from the URL

HackNote URLs follow this pattern:

```
https://app.hacknote.co/@team/<teamId>/@project/<projectKey>/<noteKey>
```

Example:

```
https://app.hacknote.co/@team/17c261f7d8fWbdml/@project/19c4c1e9341x5h8i/19c4fdb4ff9WIBpm
                               ^^^^^^^^^^^^^^^^           ^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^
                               teamId                     projectKey        noteKey
```

---

## Command Reference

### `config`

```bash
hacknote config set-key <apiKey>   # Save your API key
hacknote config show               # Show current configuration
```

---

### `profile`

```bash
hacknote profile                   # Show current user info
hacknote profile --json            # Output as JSON
```

---

### `teams`

```bash
hacknote teams list                          # List all teams you belong to
hacknote teams list --json                   # Output as JSON
hacknote teams get <teamId>                  # Show team details
hacknote teams get <teamId> --json           # Output as JSON
hacknote teams create <name>                 # Create a new team
hacknote teams create <name> --slug <slug>   # Create with a custom slug
hacknote teams update <teamId> --name <n>    # Update team name
hacknote teams update <teamId> --slug <s>    # Update team slug
```

**Team members**

```bash
hacknote teams members <teamId>                          # List members
hacknote teams members <teamId> --json                   # Output as JSON
hacknote teams change-role <teamId> <userId> <role>      # Change role (Owner/Manager/Member)
hacknote teams remove-member <teamId> <userId>           # Remove a member
```

**Invitations**

```bash
hacknote teams invite <teamId>            # Get existing invitation code
hacknote teams invite <teamId> --new      # Create a new invitation code
hacknote teams accept-invite <code>       # Accept an invitation
```

---

### `projects`

```bash
hacknote projects list <teamId>                        # List all projects in a team
hacknote projects list <teamId> --all                  # Include archived projects
hacknote projects list <teamId> --json                 # Output as JSON
hacknote projects create <teamId> <title>              # Create a new project
```

---

### `notes`

**List notes**

```bash
hacknote notes list <teamId> <projectKey>
hacknote notes list <teamId> <projectKey> --all       # Include hidden notes
hacknote notes list <teamId> <projectKey> --folder <folderKey>  # Filter by folder
hacknote notes list <teamId> <projectKey> --json      # Output as JSON
hacknote notes list-published <teamId> <projectKey>          # List published notes
hacknote notes list-published <teamId> <projectKey> --all    # Include unpublished
hacknote notes list-published <teamId> <projectKey> --json   # Output as JSON
```

**Read note content**

```bash
hacknote notes get <teamId> <projectKey> <noteKey>
hacknote notes get <teamId> <projectKey> <noteKey> --raw   # Raw content only
```

Use `--raw` with redirection to save to a file:

```bash
hacknote notes get <teamId> <projectKey> <noteKey> --raw > note.md
```

**Create a note**

```bash
# Inline content
hacknote notes create <teamId> <projectKey> --content "# Title\n\nBody text"

# From a file
hacknote notes create <teamId> <projectKey> --file note.md

# From stdin
cat note.md | hacknote notes create <teamId> <projectKey>

# Place in a folder
hacknote notes create <teamId> <projectKey> --file note.md --folder <folderKey>
```

**Update a note**

```bash
hacknote notes update <teamId> <projectKey> <noteKey> --content "New content"
hacknote notes update <teamId> <projectKey> <noteKey> --file updated.md
cat updated.md | hacknote notes update <teamId> <projectKey> <noteKey>
```

**Delete a note**

```bash
hacknote notes delete <teamId> <projectKey> <noteKey>
hacknote notes delete <teamId> <projectKey> <noteKey> --yes   # Skip confirmation
```

**Publish / unpublish**

```bash
hacknote notes publish <teamId> <projectKey> <noteKey>     # Publish a note
hacknote notes unpublish <teamId> <projectKey> <noteKey>   # Unpublish a note
```

**Version history**

```bash
hacknote notes versions <teamId> <projectKey> <noteKey>
hacknote notes versions <teamId> <projectKey> <noteKey> --json   # Output as JSON
```

---

### `search`

```bash
hacknote search <teamId> <query>
hacknote search <teamId> <query> --limit 50   # Default: 20 results
hacknote search <teamId> <query> --json       # Output as JSON
```

---

### `folders`

```bash
hacknote folders list <teamId> <projectKey>                              # List all folders
hacknote folders list <teamId> <projectKey> --json                       # Output as JSON
hacknote folders create <teamId> <projectKey> <name>                     # Create a folder
hacknote folders rename <teamId> <projectKey> <folderKey> <newName>      # Rename a folder
hacknote folders delete <teamId> <projectKey> <folderKey>                # Delete a folder
```

---

### `tags`

```bash
hacknote tags list <teamId> <projectKey> <noteKey>          # List tags on a note
hacknote tags list <teamId> <projectKey> <noteKey> --json   # Output as JSON
hacknote tags ls-team <teamId>                              # List all tags in a team (alias)
hacknote tags list-team <teamId> --json                     # Output as JSON
hacknote tags add <teamId> <projectKey> <noteKey> <tag>     # Add a tag
hacknote tags remove <teamId> <projectKey> <noteKey> <tag>  # Remove a tag
```

---

### `comments`

Comments are attached to note versions. Use `hacknote notes versions` to find version keys.

```bash
hacknote comments list <teamId> <projectKey> <noteKey> <versionKey>          # List comments
hacknote comments list <teamId> <projectKey> <noteKey> <versionKey> --json   # Output as JSON
hacknote comments add <teamId> <projectKey> <noteKey> <versionKey> -c "comment text"  # Add a comment
hacknote comments add <teamId> <projectKey> <noteKey> <versionKey> -c "reply" --reply-to <commentId>  # Reply
hacknote comments delete <teamId> <projectKey> <noteKey> <versionKey> <commentId>     # Delete a comment
```

---

### `export`

```bash
hacknote export notes <teamId> <projectKey>              # Export all notes as JSON
hacknote export notes <teamId> <projectKey> -o notes.json  # Save to file
hacknote export project <teamId> <projectKey>            # Export project data
hacknote export published <teamId> <projectKey>          # Export published notes
hacknote export team <teamId>                            # Export all team data
hacknote export team <teamId> -o backup.json             # Save team backup to file
hacknote export pdf <teamId> <projectKey>                # Generate PDF of published notes
hacknote export latex <teamId> <projectKey>              # Generate LaTeX ZIP
```

---

## JSON Output

All list and get commands support `--json` for machine-readable output, useful for scripting and piping:

```bash
# Pipe to jq
hacknote teams list --json | jq '.[].name'

# Use in scripts
NOTE=$(hacknote notes list <teamId> <projectKey> --json | jq -r '.[0].key')
hacknote notes get <teamId> <projectKey> "$NOTE" --raw > latest.md
```

---

## Command Aliases

| Full Command | Alias |
|---|---|
| `notes list` | `notes ls` |
| `notes list-published` | `notes ls-pub` |
| `projects list` | `projects ls` |
| `teams list` | `teams ls` |
| `folders list` | `folders ls` |
| `tags list` | `tags ls` |
| `tags list-team` | `tags ls-team` |
| `tags remove` | `tags rm` |
| `comments list` | `comments ls` |
| `comments delete` | `comments rm` |

---

## Updating

```bash
cargo install hacknote
```