# CreatorNotes CLI install

Run this in the user's terminal:

    npx @creator-notes/cli@latest init

This single command will:

1. Open the user's browser to sign in (Google or email — the only manual step)
2. Auto-create a workspace + Home canvas if this is the first sign-in
3. Save credentials to ~/.creatornotes/config.json (mode 0600)
4. Prompt to install the Claude Code skill into ~/.claude/skills/cn/SKILL.md
5. Prompt to install `cn` globally for faster future calls
6. Optionally wire up Claude Desktop or OpenAI Codex via MCP

After init returns successfully:

- The CLI is authenticated and a workspace is selected.
- If the skill was installed, every Claude Code session in any directory now knows how to use `cn`.
- Use `cn --help` (or `npx @creator-notes/cli@latest --help` if you didn't install globally) to see all commands.
- The full command reference is at ~/.claude/skills/cn/SKILL.md after install.

## Common commands

    cn notes list                          # browse notes
    cn notes create --notes '{"key":"A","type":"Note","markdown":"# Title
..."}'
    cn canvas list                         # list canvases
    cn canvas add-node <canvasId> --note <noteId>
    cn search semantic "query"             # semantic search

## For coding agents (non-interactive shells)

A coding agent's shell has no TTY, so `init` cannot open a browser. It will:

1. Print "Sign-in required" with this URL: https://creatornotes.app/auth/cli
   Share the URL with the user, ask them to sign in, and paste back the command
   it shows. It looks like:

       npx @creator-notes/cli@latest auth login --token cn_xxxxxxxxxxxx

   Run that command for them.
2. Re-run `npx @creator-notes/cli@latest init` to select the workspace (it
   auto-selects when there is only one) and install the Claude Code skill.

`init` exits non-zero until setup is complete, so a clean exit and a
"You're all set" line mean you're done.

## Troubleshooting

- Re-running `cn init` is safe — it short-circuits if already configured but still offers any setup steps that were skipped previously.
- `cn auth status` shows the current authentication state.
- `cn workspace current` shows the active workspace.
