---
name: cloud-notes-cli
description: "Teach an AI coding agent how to use the npm-installed Cloud Markdown Notes `notes` CLI. Use when an agent needs to operate the notes service through the CLI entrypoint: configure the API URL, log in, inspect health, manage folders and Markdown notes, commit and restore versions, search content, import/export zip archives, publish shares, use JSON output, or handle CLI/API errors."
---
# Cloud Notes CLI
This skill teaches an AI agent to operate Cloud Markdown Notes through the npm-installed `notes` CLI.
## Install And Entry Point
Install the CLI from npm:
```bash
npm install -g cloud-markdown-notes
```
Always invoke the CLI through the public command:
```bash
notes <command>
```
Do not edit config files directly. Configure and inspect CLI state only through `notes config`, `notes auth`, and normal command flags.
`note replace` automatically reads the current file version when `--if-match` is omitted. Use `--if-match <fileVersion>` only when explicitly testing conflict behavior.
Use `--token` only for an explicit one-off command. Prefer `notes auth login` for normal sessions.
## Common Errors
Use these codes to decide the next command:
- `UNAUTHENTICATED`: run `notes auth login ...` or pass `--token` for a one-off command.
- `FORBIDDEN`: current user lacks permission, often admin-only command.
- `USER_PENDING`: log in as admin and activate the user.
- `VALIDATION_ERROR`: command arguments or path format are invalid.
- `PATH_NOT_FOUND`: create the parent folder or correct the path.
- `PATH_ALREADY_EXISTS`: choose another path or remove the existing item.
- `EDIT_CONFLICT`: re-read the note, then retry with the current file version.
- `NO_CHANGES_TO_COMMIT`: there is nothing to commit.
- `IMPORT_CONFLICT`: run `notes import <zip> --dry-run --json` and inspect conflicts.
- `NOTE_NOT_COMMITTED`: commit the note before publishing a share.
- `SHARE_NOT_FOUND`: the share id or slug is invalid or inactive.
## Agent Workflow
Use this sequence for reliable CLI operation:
1. Run `notes config set-api-url <server-url>`.
2. Run `notes health --json`.
3. Log in with `notes auth login <username> <password>`, or register and ask/admin-activate if needed.
4. Verify identity with `notes auth me --json`.
5. Inspect state with `notes tree --json`, `notes status --json`, and `notes history --json`; use `notes show <sha> --json` for a specific commit's details and patch.
6. Run mutating commands only after the target path and active user are clear.
7. Prefer `--json` for machine-readable outputs and parse `data` or `error`.
8. Quote every path, glob, regex, and Markdown string that may contain shell metacharacters.