CLI
Install the lycana command, sign in with a short code, and read and change your diagrams from a terminal, a script, or an agent.
Install the lycana command, sign in with a short code, and read and change your diagrams from a terminal, a script, or an agent.
Install the lycana command, sign in with a short code, and read and change your diagrams from a terminal, a script, or an agent.
The lycana command lets you, a script, or an AI agent read and change your Lycana diagrams. It offers the same abilities as Lycana's MCP server.
It needs Node 20 or later.
npm install -g lycanaStandalone binaries for macOS, Linux, and Windows, which need no Node, are attached to each cli-v* release on GitHub.
lycana --help explains every command, the edit format, proposals, conflicts, and exit codes. It is written so that an agent can work from it alone, so an agent can learn the tool by running it.
lycana loginlycana loginIt prints a link and a short code, such as BCDF-GHJK, and opens the link in your browser when it can.
Open lycana.ai/activate on any device and enter the code. Check that it matches the one in your terminal, choose whether this connection uses Propose or Full access, and approve. Your password is never asked for in the terminal.
The code expires after 10 minutes.
Only approve your own code
Approve only if you started this sign-in yourself and the code matches the one in your own terminal or agent. If someone sent you a link or code, deny it.
lycana login takes these options:
| Option | What it does |
|---|---|
--name <name> | What Lycana calls this connection. The default is "Lycana CLI on" followed by the computer's name. |
--with-key | Read an agent key from standard input instead of showing a code. |
--no-browser | Don't try to open a browser. |
--insecure-storage | Save the key in a file, not the system credential store. |
Signing in saves a key in the macOS Keychain, the Secret Service on Linux (secret-tool), or the Windows Credential Manager. Without one, it goes to ~/.config/lycana/credentials.json, which only you can read. Keys are kept per API, so --api https://api-dev.lycana.ai and production keep separate keys.
On a machine without a browser, create an agent key in Settings → Connected agents (see Agent keys) and pipe it in. A key is never accepted as a command-line argument.
lycana login --with-key < key.txtYou can also set LYCANA_AGENT_KEY. It takes precedence over a stored key.
lycana logout removes this connection in Lycana, which rejects its pending proposals and stops its key working, then deletes the key on this machine. If Lycana can't be reached, the key is still deleted, and the link to Connected agents is printed so you can remove it there.
| Command | What it does |
|---|---|
lycana login | Sign in with a short code you approve in Lycana. |
lycana logout | Sign out, and remove this agent from Connected agents. |
lycana auth status | Show which API, key, and agent you're signed in as, and whether it uses Propose or Full access. Never prints the key. Also lycana whoami. |
lycana auth token | Print the agent key for another program, only into a pipe or a file unless you pass --reveal. |
| Command | What it does |
|---|---|
lycana orgs | List Personal and the organizations you belong to. |
lycana projects | List projects, the folders diagrams are filed in. |
lycana switch <org> | Choose the organization commands use by default. --clear stops defaulting to one. |
lycana link | Link this directory to an organization, and a project or diagram. |
lycana unlink | Remove this directory's link. |
| Command | What it does |
|---|---|
lycana diagrams | List diagrams, most recently changed first. Also lycana ls. |
lycana get [<diagram id>] [--canvas <id>] | Read a diagram, or one of its subcanvases, with each object's id. A Lycana diagram link works in place of the id. |
lycana outline [<diagram id>] [--canvas <id>] [--depth <n>] | Show a diagram's levels, nested, with each node's source. Reads 3 levels unless --depth (0 to 10) says otherwise. |
lycana find [<diagram id>] [<text>] [--source <path>] | Find objects on every level of a diagram, by text or by the file or folder they describe. --limit <n> returns at most that many (default 50, up to 200). |
lycana selection | Show the diagram open in Lycana and the objects selected on it. |
lycana create <name> | Create an empty diagram. It is created at once, never as a proposal. |
lycana edit [<diagram id>] [--canvas <id>] [--review] [<file> | -] | Change a diagram, or one of its subcanvases, with operations. |
lycana proposal <proposal id> [--no-wait] | Wait for, or check, the user's answer to a proposal. |
lycana help operations | List the edit operations. With --json, their JSON Schema. |
Run lycana <command> --help for a command's details.
| Option | What it does |
|---|---|
--json | Machine-readable output on standard output. |
--api <url> | The Lycana API to use. The default is https://api.lycana.ai. |
--org <id|name> | The organization to use; personal for your own diagrams. |
--project <id|name> | A project in it. |
-y, --yes | Don't ask for confirmation. |
-h, --help | Help for a command. |
-V, --version | Print the version. |
With --json, errors are printed on standard error as {"error": {"code", "message", "hint"}}.
| Variable | What it does |
|---|---|
LYCANA_AGENT_KEY | An agent key, used instead of the stored one. |
LYCANA_API_URL | The API to use, like --api. |
LYCANA_ORG | The organization to use, like --org. |
LYCANA_PROJECT | The project to use, like --project. |
NO_COLOR | No color. |
CI | Never ask questions. |
lycana link saves an organization, and optionally a project and a diagram (--diagram <id>), for the current directory. It writes .lycana/config.json (the API and the ids, nothing secret) and adds .lycana to .gitignore. Commands run in that directory, or below it, then use them, and get and edit use the linked diagram when no id is given.
Organization and project are chosen in this order: the option, then the environment, then a linked directory, then the lycana switch default.
lycana edit reads a JSON list of operations from a file, or from standard input with - or a pipe. Read the diagram first to get its version and the ids of its objects:
lycana get <diagram id> --jsonThen send the operations, with the version you read as expectedVersion:
lycana edit <diagram id> - --json <<'EOF'
{"expectedVersion": 7, "operations": [
{"op": "create_node", "tempId": "cache", "name": "Redis", "service": "redis.redis"},
{"op": "create_link", "from": "<api node id>", "to": "cache", "label": "reads"}
]}
EOFOperations run in order, all or none, at most 50 in one edit. A tempId names a new object for later operations in the same edit, and the result maps it to the real id. A plain list of operations works too: then the diagram is read first and its current version is edited. --canvas <id> edits a subcanvas, and expectedVersion is then that canvas's version.
| Operation | What it does |
|---|---|
create_node | Adds a node. |
upsert_node | Adds a node for a source, or updates the node on this canvas that already has that source. |
create_link | Adds a link between two nodes or boundaries. |
upsert_link | Adds a link, or updates the one already there. |
create_boundary | Adds a boundary that groups related nodes. |
create_note | Adds a note. |
update_node, update_link, update_boundary, update_note | Changes an object. Fields you leave out stay as they are. |
delete | Removes any object. Removing a node or boundary also removes its links. |
move | Moves a node, boundary, or note. |
resize | Resizes a node, boundary, or note. |
create_subcanvas | Gives a node a subcanvas. |
put_in_boundary | Puts an object in a boundary, or takes it out of one. |
lycana help operations lists every operation and its fields.
Put the systems on the top-level canvas, give each a subcanvas with create_subcanvas, and fill that with its services or folders, then their files. Write each node with upsert_node and its source, the path it describes, and each link with upsert_link. Running the same mapping again then updates the nodes and links instead of duplicating them.
Depending on the connection's setting, an edit applies at once or becomes a proposal that the user accepts or rejects in Lycana. lycana get <id> --json says which: changes is apply or propose.
For a proposal, edit waits about 50 seconds for the answer. If it is still waiting, follow it with lycana proposal <proposal id>, which waits again. Pass --no-wait to either command to return at once.
--review sends an edit to the user as a proposal even when the connection could apply it. Use it for changes the user would want to check first: restructuring or replacing large parts of a diagram, removing or renaming what they drew, or guesses about their system. It isn't meant for routine additions, and when the connection proposes changes, every edit is a proposal already. See Propose and Full access.
--request-id <uuid> makes a retried edit apply at most once.
| Code | Meaning |
|---|---|
0 | Done. For an edit or proposal: applied or accepted. |
1 | Error: not found, invalid input the API refused, network, or server. |
2 | Usage: the command line or the edit JSON is wrong. |
3 | Not signed in, or the key was refused (agent removed). |
4 | Conflict: the diagram changed in a way the edit depends on. Read it again and redo the edit. Moves never conflict. |
5 | The proposal was rejected, or could no longer apply. |
6 | The proposal is still waiting for the user's answer. |
7 | Locked: a pending proposal holds objects the edit changes. |
8 | Too many changes too quickly: wait as long as it says, then retry. |
On a free account, creating a second diagram, or editing a personal diagram other than the one that can change, fails with exit code 1 and the code upgrade_required. The message names the diagram that can change and Lycana Pro's price.