---
name: cli
description: Every anchorify subcommand, every flag.
---

# Command-line

The `anchorify` CLI is a small Bun/Node program that wraps the REST API. Every share is one HTTP request; the CLI mostly exists so you can pipe a file path on the command line and get a URL on stdout.

This page is the reference. For an overview, see [Getting started](/docs/getting-started).

## Install

```bash
npm install -g anchorify-cli
# or
bun install -g anchorify-cli
```

The npm package is `anchorify-cli` (suffixed because `anchorify` was
already taken on the registry by an unrelated utility); the binary it
ships is `anchorify`. A `justforwarded` alias keeps working through the
rebrand transition. Run `anchorify help` to see the top-level usage.

## Log in

```bash
anchorify login
```

`login` prompts on the TTY for a token (no echo). The token comes from your dashboard at <https://anchorify.io/dashboard> — see [CLI tokens](/docs/tokens). After verifying the token against `/api/me`, the CLI writes `host` and `token` to `~/.config/anchorify/auth.json` (mode 600).

Flags:

- `--host <url>` — server URL. Default: `https://anchorify.io`.
- `--token <token>` — pass the token non-interactively.

Examples:

```bash
anchorify login
anchorify login --host https://anchorify.io --token jf_...
```

## Log out

```bash
anchorify logout
```

Removes `~/.config/anchorify/auth.json`. Does not invalidate the token on the server. Idempotent: prints `not logged in` if there's nothing to remove.

## Publish or update a file

The bare invocation is the primary entry point:

```bash
anchorify path/to/report.md
```

Behaviour:

- If the file's absolute path is in `~/.config/anchorify/published.json`, the CLI updates the existing share at the recorded id.
- Otherwise the CLI inserts a new share at a random 8-character base36 id.
- Prints the share URL on stdout. Nothing else. (Errors go to stderr.)

Flags on the bare invocation:

- `--slug <slug>` — publish at a chosen slug. Returns `409` if taken; the CLI surfaces the error and you pick another.
- `--id <id>` — explicit update at this id (works for both random ids and chosen slugs).
- `--new` — force a new random id, ignoring the local mapping.
- `--type <type>` — override content type. One of `markdown`, `code`, `json`, `yaml`, `csv`, `tsv`, `html`. Default is detected server-side from the file extension.
- `--public` / `--unlisted` / `--members` — set visibility. Default for new shares is `unlisted`. The legacy `--secret` flag is accepted and treated as `--unlisted`.
- `--force` — required when switching from password-protected to public. Clears the password.
- `--project <slug>` — publish into a specific project in your home org. Defaults to the project the file's mapping entry already points at, or `untitled` for new shares.

Examples:

```bash
anchorify path/to/report.md
anchorify path/to/report.md --slug q1-report
anchorify path/to/report.md --type code
anchorify path/to/report.md --public
anchorify path/to/report.md --members
anchorify path/to/report.md --project q1-acme
anchorify path/to/report.md --new
```

## `anchorify update`

```bash
anchorify update <file> [flags]
```

Strict, explicit form of the bare invocation. Errors out if the file is not already in the local mapping, instead of silently inserting a new share. Identity-changing flags (`--slug`, `--id`, `--new`) are rejected — use `rename` for that.

Flags:

- `--password <pw>` — set a password.
- `--no-password` — remove an existing password.
- `--public` / `--unlisted` / `--members` — change visibility tier. Legacy `--secret` is accepted as `--unlisted`.
- `--type <type>` — override content type.

Examples:

```bash
anchorify update path/to/report.md
anchorify update path/to/report.md --password sekret
anchorify update path/to/report.md --no-password --public
anchorify update path/to/report.md --members
```

## `anchorify list`

```bash
anchorify list
# aliases: anchorify --list, anchorify -l
```

Lists every share owned by the authenticated user. Output is tab-separated: `<url>\t<filename>\t<source-path-or-em-dash>`. Sorted by most recently updated.

The source path comes from the local mapping. Items published from another machine show as `—`.

```bash
anchorify list | grep deliverable
```

## `anchorify view`

```bash
anchorify view <slug-or-id> [--user <username>]
```

Prints a share's raw source content to stdout. Auth required (your own shares). With `--user <username>`, fetches a public share owned by another user — no auth needed.

```bash
anchorify view my-share
anchorify view some-slug --user alice
anchorify view abc12345 > /tmp/share.md
```

## `anchorify delete`

```bash
anchorify delete <file-path>
anchorify delete --slug <slug>
anchorify delete --id <id>
```

Identify the share by file path (resolved via the local mapping), explicit slug, or explicit id. On success, removes the matching mapping entry. Auth required.

```bash
anchorify delete path/to/report.md
anchorify delete --slug old-deliverable
anchorify delete --id abc12345
```

## `anchorify rename`

```bash
anchorify rename <slug-or-id> <new-slug>
```

Changes a share's slug — the id stays the same; only the URL changes. The CLI updates the local mapping so re-publishing the same path shows the new URL in `list`.

```bash
anchorify rename old-slug new-slug
anchorify rename abc12345 new-slug
```

## `anchorify visibility`

```bash
anchorify visibility <slug-or-id> public|unlisted|members [--force]
```

Set the visibility tier:

- `public` — listed on the owner's profile; indexable; URL is enough.
- `unlisted` — `noindex`; URL is enough. The V2 `secret` semantics, renamed. The legacy value `secret` is accepted as an alias.
- `members` — only signed-in org admins + project viewers can read; anonymous viewers get `404`. No password (membership IS the gate).

Switching from password-protected to `public` requires `--force`, which clears the password. Switching to `members` clears any password automatically.

```bash
anchorify visibility my-share unlisted
anchorify visibility my-share public
anchorify visibility my-share members
anchorify visibility my-share public --force
```

## `anchorify --version`

```bash
anchorify --version
```

Prints the CLI version on stdout (e.g. `0.2.2`) and exits. Stamped at build time from `package.json` so it always reflects the binary you have installed. The Claude Code skill references this command to verify CLI compatibility (`requires-cli: ">=0.2.2"`).

## `anchorify skill install`

```bash
anchorify skill install [--force]
anchorify skill update  [--force]   # alias
```

Installs or refreshes the bundled Claude Code skill at `~/.claude/skills/anchorify/SKILL.md`. Fetches the canonical version from `https://anchorify.io/docs/anchorify-skill.md` — no auth required.

Refuses to overwrite when the local file differs from the canonical version (assumes user edits); pass `--force` to overwrite. The skill version is pinned to the CLI version, so re-run whenever you upgrade the CLI.

```bash
npm install -g anchorify-cli@latest && anchorify skill install --force
```

## `anchorify lint`

```bash
anchorify lint <file> [--type <type>]
```

Pre-publish format check. Calls `POST /api/v1/lint` with the file's content and (optionally) an explicit type override, then prints warnings to stderr.

- **Exit 0** with `ok — <file> lints clean as <type>` when there are no issues, or when the issues are only `info`/`warn`-severity.
- **Exit 1** when at least one `error`-severity issue is present (file will look broken to recipients).

```bash
anchorify lint deck.md
anchorify lint data.txt --type csv
```

See [Lint API](/docs/lint) for the warning catalog and the full HTTP shape.

## `anchorify type`

```bash
anchorify type <slug-or-id> <type>
```

Changes how a share is rendered. `<type>` is one of `markdown`, `code`, `json`, `yaml`, `csv`, `tsv`, `html`. Content is untouched; only the renderer changes.

```bash
anchorify type my-share code
anchorify type my-share json
anchorify type my-share markdown
```

## `anchorify password`

```bash
anchorify password set <slug-or-id> [--password <pw>]
anchorify password clear <slug-or-id>
```

`set` without `--password` prompts on the TTY (no echo) or reads the first line from stdin (non-TTY). `clear` removes any existing password.

```bash
anchorify password set my-share
anchorify password set my-share --password sekret
echo sekret | anchorify password set my-share
anchorify password clear my-share
```

## `anchorify move`

```bash
anchorify move <slug-or-id> --to <project>
```

Move a share into a different project in your home org. The canonical URL changes; the old URL `301`s to the new one (slug redirect history is preserved per project).

```bash
anchorify move my-share --to q1-acme
anchorify move abc12345 --to retainer
```

## `anchorify org`

```bash
anchorify org show [--json]
anchorify org rename <new-slug> [--yes]
```

Inspect or rename your home org. `show` prints slug, name, plan, and member/project counts. `rename` changes the org slug — every existing share URL at the old slug `301`s to the new slug, and the old slug is permanently retired (tombstoned). Type-to-confirm the old slug unless `--yes` is passed.

```bash
anchorify org show
anchorify org show --json
anchorify org rename my-new-slug
anchorify org rename my-new-slug --yes
```

## `anchorify project`

```bash
anchorify project list
anchorify project create <slug> [--name "..."]
anchorify project rename <old-slug> <new-slug>
anchorify project delete <slug> [--yes]
```

Manage projects inside your home org.

- `list` — every project in your home org with slug, name, and share count.
- `create` — new project. `--name` defaults to the slug.
- `rename` — change a project slug. Old URLs `301` via `project_redirects`.
- `delete` — delete an empty project. Blocked if it still contains shares (move them first) or if it is the last project in the org. Type-to-confirm unless `--yes`.

```bash
anchorify project list
anchorify project create q1-acme --name "Q1 — Acme"
anchorify project rename q1-acme acme-q1
anchorify project delete old-project
```

## `anchorify upload-folder`

```bash
anchorify upload-folder <local-dir> [--project <slug>] [--visibility <tier>] [--dry-run]
```

Recursively walk a local directory and publish every file as its own share. Slugs are derived from each file's relative path (subdir slashes become hyphens). One URL is printed per file to stdout. With `--dry-run`, the planned slugs/URLs are listed without hitting the server.

Flags:

- `--project <slug>` — target project. Defaults to `untitled`.
- `--visibility <tier>` — `public`, `unlisted`, or `members`. Default is `unlisted` (legacy `secret` accepted).
- `--dry-run` — list planned URLs without publishing.

```bash
anchorify upload-folder ./deliverables
anchorify upload-folder ./deliverables --project q1-acme
anchorify upload-folder ./deliverables --visibility members --dry-run
```

## `anchorify admin`

```bash
anchorify admin upgrade-org <slug> --plan free|pro
```

**Operator-only.** Requires the legacy operator bearer token (`REPO_SHARE_TOKEN`), not a per-user CLI token. Flips an org's plan tier — `pro` unlocks custom-domain affordances; `free` is the default. There is no self-serve upgrade path during the validation cohort.

```bash
anchorify admin upgrade-org acme --plan pro
anchorify admin upgrade-org acme --plan free
```

## `anchorify notifications`

```bash
anchorify notifications [--unread] [--limit N]
```

List your in-app notifications, newest first. Tab-separated output:

```
<id>\t<kind>\t<created_at_iso>\t<title>\t<link>
```

Use `--unread` to filter to unread rows only; `--limit` sets page size (default 50, max 200). See [Notifications](/docs/notifications) for the kinds.

## `anchorify link-perm`

```bash
anchorify link-perm <slug-or-id> none|can_view|can_comment|can_suggest
```

Sets the share's link-permission tier — the additive grant for anyone with the URL. See [Link permissions](/docs/link-permissions) for the matrix. Prints `ok` on success.

## `anchorify versions`

```bash
anchorify versions <slug-or-id>
anchorify versions restore <slug-or-id> <version-id>
```

`versions <slug>` lists every version of a share, newest first:

```
<version-id>\t<created_at_iso>\t<source>\t<author>\t<status>
```

`versions restore <slug> <vid>` rolls the share back to that version. The restore is itself versioned (a new `rollback`-source row is appended). Prints `ok` on success. See [Version history](/docs/versions).

## `anchorify audit`

```bash
anchorify audit [--org <slug>] [--limit N] [--action <name>]
```

Lists audit events for an org, newest first. `--org` defaults to your home org. `--action` filters to a single event type (e.g. `share.delete`, `share.visibility`, `org.member.add`). Tab-separated output:

```
<created_at_iso>\t<action>\t<actor>\t<target_type>:<target_id>
```

See [Audit log](/docs/audit) for the action catalog.

## `anchorify suggestions`

```bash
anchorify suggestions <slug-or-id>   # owner-only: open suggestions on a share
anchorify suggestions mine           # your own submitted suggestions
```

`mine` output: `<version-id>\t<share-url>\t<status>\t<created_at_iso>`. Approve and reject from the web dashboard — the CLI only lists. See [Suggest changes](/docs/suggestions).

## Environment variables

- **`ANCHORIFY_CONFIG_DIR`** — override the config directory. Default: `~/.config/anchorify`. Redirects both `auth.json` and `published.json`. Useful for sandboxed testing, so a logged-in session does not accidentally publish to prod. The legacy `JF_CONFIG_DIR` is still honored as a fallback.
- **`ANCHORIFY_HOST`** — server URL. When set together with `ANCHORIFY_TOKEN`, these override `auth.json`. (A one-line stderr notice is printed if `auth.json` exists and the env vars are taking precedence.) The legacy `REPO_SHARE_HOST` is still honored as a fallback.
- **`ANCHORIFY_TOKEN`** — bearer token. Both env vars must be set for the override to fire; setting only one falls back to `auth.json`. The legacy `REPO_SHARE_TOKEN` is still honored as a fallback.

## Local mapping

The CLI stores a per-machine file-to-slug mapping at `~/.config/anchorify/published.json`:

```json
{
  "/abs/path/to/file.md": {
    "id": "chosen-or-random-slug",
    "url": "https://anchorify.io/you/chosen-or-random-slug",
    "filename": "file.md",
    "last_published_at": "2026-05-06T07:19:38.781Z"
  }
}
```

Plain JSON, mode 644. Rebuilt by re-publishing files; not yet auto-synced from the server. Items published from another machine or before the mapping existed show as `—` in `anchorify list`.

## Next steps

- [Web dashboard](/docs/web) — the same actions in the browser.
- [REST API](/docs/api) — the underlying HTTP surface.
- [Slug rules](/docs/slug-rules) — the slug regex.
