WisyLink CLI (npm package)

Official CLI contract for WisyLink API operations.

npmGitHub
Sections

Official coding-agent CLI for WisyLink — device login, interactive chat, live build previews, files, and links.

#Availability

Examplebash
npm i -g @wisylink/cli

#Authentication

Examplebash
wisylink login

Opens a browser device-authorization flow (https://wisylink.com/cli/authorize). Approve only a code you just started with wisylink login in your own terminal. Credentials are stored at ~/.config/wisylink/credentials.json (or under an absolute $XDG_CONFIG_HOME) with mode 0600 in a 0700 directory; on Windows the file is private through your user profile's permissions. Works for every plan, including Community.

wisylink logout ends the session on the server and removes the local file.

Examplebash
wisylink whoami
wisylink logout

#Automation / CI

API keys still work for scripts. Usage bills against your subscription limits.

Examplebash
export WISYLINK_API_KEY="your_api_key"
wisylink links list --json

Keep your API key out of shell history and version control: set WISYLINK_API_KEY from your CI's secret store. A value passed with --api-key is visible to other users of the machine in the process list.

#Global Flags

FlagTypeDescription
--api-key <value>stringOverride WISYLINK_API_KEY (automation; visible in the process list, prefer the variable)
--jsonbooleanJSON on stdout, errors as JSON on stderr; no spinners (see Output)
--timeout <ms>numberRequest timeout (1000..120000). Default 30000; a chat turn defaults to 120000
--helpbooleanShow command help
--versionbooleanShow installed CLI version

#Output

  • On a terminal the CLI prints readable text: spinners, the session and preview links, build reports.
  • --json prints the result as one JSON object on stdout and errors as a JSON object on stderr, with no spinners or prompts. Use it in scripts and CI. It takes no value and works before or after the command.
  • wisylink login --json writes the device code and URL as a JSON object to stderr, waits for approval, then prints { "ok": true, "user": … } on stdout.
  • files and links commands also print JSON on their own when stdin or stdout is not a terminal. chat prints text unless --json is given.
  • Versions before 0.3 printed JSON only and rejected --json. A script that reads chat output must add --json when it moves to 0.3 or later.

#Rules

RuleValue
File id format24-char hex (e.g. 67e6f6e6c5a91e4d2d9b0a11)
Link id format6 chars, lowercase a-z0-9 (e.g. k3x9a2)
Max file_ids per chat10
Message max length5000 chars (after trimming)

#Commands

#Auth

Examplebash
wisylink login
wisylink logout
wisylink whoami

#Chat

Interactive REPL (TTY):

Examplebash
wisylink chat

One-shot:

Examplebash
wisylink chat --message "Build a landing page for Ember Coffee." --file-id 67e6f6e6c5a91e4d2d9b0a11

Continue a link (one-shot, or without --message to open the REPL on it):

Examplebash
wisylink chat --link-id k3x9a2 --message "Make the hero darker."
wisylink chat --link-id k3x9a2

After each turn the CLI prints the session URL (https://wisylink.com/chat/<id>) and the hosted preview URL.

  • **Login session:** while a build is running the CLI polls its status, animates the live report, and **Ctrl+C** stops the build. A build waiting behind another one for the same link shows as queued; the CLI keeps waiting.
  • **API key:** the CLI prints the build notice and returns. Check later with wisylink links get <link-id>; status is one of building, queued, completed, aborted, idle.

Automation:

Examplebash
# WISYLINK_API_KEY comes from the CI secret store
wisylink chat --message "…" --json

The JSON has id, url, status, answer, created_at, updated_at and session_url with an API key; with a login session it has id, url, session_url, building and answer, plus rejected_files when a file was left off because it would exceed your storage quota.

#Files

Examplebash
wisylink files upload "./asset.png"
wisylink files get 67e6f6e6c5a91e4d2d9b0a11
wisylink files delete 67e6f6e6c5a91e4d2d9b0a11

Uploads use <=4 MB chunks (up to 25 MB total). The file type is read from the file's content, not its name. Works with a login session or an API key.

Examplebash
wisylink links list --page 1 --limit 20
wisylink links get k3x9a2
wisylink links delete k3x9a2

--limit is 1..100 (default 20) with an API key; a login session returns at most 25 links per page.

#Node client

Examplejs
import { CreateWisyLinkClient } from "@wisylink/cli";

const client = CreateWisyLinkClient({ apiKey: "<api-key>" });
const result = await client.chat({
  message: "Build a landing page for Ember Coffee.",
  fileIds: ["<file-id>"],
});
console.log(result); // { id, url, status, answer, created_at, updated_at }

// Continue the link, then list, read and delete links by their 6-character id.
await client.chat({ message: "Make the hero darker.", linkId: result.id });
const { items } = await client.listLinks({ page: 1, limit: 20 });
await client.getLink("k3x9a2");
await client.deleteLink("k3x9a2");

Methods throw before sending a request when an id, the message (1..5000 characters) or the file id list (at most 10) is invalid.

#Security Notes

  • Session tokens live only in ~/.config/wisylink/credentials.json (mode 0600).
  • API keys from WISYLINK_API_KEY / --api-key are never echoed or logged.
  • All requests go over HTTPS to https://api.wisylink.com.
  • Use --json in CI so output stays machine-readable with no TTY animations (see Output).