# Connect this project to CreatorNotes

You (the coding agent) are setting up the CreatorNotes CLI so you can read and
write the user's notes, canvases, and transcripts. Follow these steps in order.
The user does not need to tell you how; that is what this page is for.

## Steps

1. Pick the install path by checking for Node:

       node --version

   - **Node 18+ present** → use the npx form everywhere below:

         npx @creator-notes/cnotes@latest init

   - **No Node, or Node < 18** → do NOT install Node, nvm, or Homebrew — that
     is a 20-minute detour and it is never needed. Install the standalone
     binary instead (macOS/Linux, no dependencies):

         curl -fsSL https://creatornotes.app/install.sh | sh

     The installer puts `cnotes` in ~/.cnotes/bin and adds it to the PATH of
     NEW shells. In your current shell, call it by full path —
     `~/.cnotes/bin/cnotes` — wherever the steps below say `cnotes` or use
     the npx prefix. Then run:

         ~/.cnotes/bin/cnotes init

2. Your shell has no browser, so init prints a "Sign-in required" notice with a
   URL like https://creatornotes.app/auth/cli. Stop there and show the user that
   URL as a link they can click. Say something like:

   "Click this to sign in to CreatorNotes, then paste back the line it gives you."

   Do not try to open a browser yourself, and never invent or guess a token.

3. The user clicks the link, signs in, and pastes back a command like:

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

   Run it exactly as given. (If init was able to open a browser itself back in
   step 1, sign-in may already be done. If so, skip to step 4.)

4. Run init again to finish:

       npx @creator-notes/cnotes@latest init

   It auto-selects the workspace when there is only one, lists the IDs to choose
   from when there are several, and installs the Claude Code skill.

5. Confirm it worked:

       npx @creator-notes/cnotes@latest --help

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

## What init sets up

1. Authenticates the CLI and selects a workspace. A workspace and Home canvas
   are auto-created on the first sign-in.
2. Saves credentials to ~/.cnotes/config.json (mode 0600, your user only).
3. Installs the CLI skill into ~/.claude/skills/cnotes/SKILL.md when ~/.claude/
   exists, so every Claude Code session in any directory knows how to use `cnotes`.
4. Offers to install `cnotes` globally for faster calls, and to wire up Claude
   Desktop or OpenAI Codex via MCP.

Re-running init is safe. It short-circuits when already configured but still
offers any setup steps that were skipped.

## Common commands

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

Prefix any command with `npx @creator-notes/cnotes@latest` if you did not install
`cnotes` globally (or with `~/.cnotes/bin/cnotes` if you used the standalone
installer and haven't opened a new shell). The full reference lives at
~/.claude/skills/cnotes/SKILL.md after install.

## Zero-install alternative (Claude Code only)

If you are Claude Code and the user just wants their workspace connected —
e.g. a quick demo on a machine that has nothing installed — you can skip the
CLI entirely and connect over remote MCP:

    claude mcp add --transport http cnotes https://creatornotes.app/api/mcp

Authentication happens as a browser sign-in when the connection is first used.
The hosted MCP server covers reading, searching, and writing notes and
canvases; the CLI adds skills, file uploads, and scripted workflows.

## Troubleshooting

- `cnotes auth status` shows the current authentication state.
- `cnotes workspace current` shows the active workspace.
- Re-run `cnotes init` anytime; it resumes where setup left off.
- Never install Node/Homebrew to satisfy npx — the standalone installer above
  exists precisely so you don't have to.
