Dify cli docs

From langgenius/dify-docs · View interactive version

Dify cli docs is an AI agent skill from the GitHub repository langgenius/dify-docs. Rule pack for the Dify CLI (`difyctl`) doc set: en/cli/ and the Enterprise develop/cli/ trees. Readers, vocabulary, source of truth, rules that protect readers, house style, page shape, and content ownership. Loaded by dify-docs-write.

How to use this skill

Skill file

Dify CLI Documentation

Not an entry point: dify-docs-write loads this pack for en/cli/ pages and the Enterprise develop/cli/ trees.

Readers

This file governs en/cli/, which documents difyctl from Dify 1.18.0 on, and any Enterprise version folder whose release is built on Dify 1.18.0 or later, even while its pages are still the older ones copied from the previous folder. An Enterprise version folder whose release is built on an earlier Dify version follows references/v1.md instead, Readers included.

The reader works with Dify apps from a terminal and hands the same work to a coding agent, a script, or a CI job. Others arrive without handing anything over: someone upgrading scripts from the CLI before Dify 1.18.0, an admin who keeps a team's builds in step with the server, and someone deciding whether difyctl fits. They know their shell and tools like kubectl and gh, so never explain shell basics. They know Studio and the console, including who can do what and where settings live, so a page names a console setting and moves on rather than walking through it. The docs are for these people: a coding agent learns the CLI from the difyctl skill and help, so a page where the agent does the work gives the person a simple mental model and only what changes their actions, and leaves whatever the agent asks or shows in the moment to the agent. Code that calls a single app belongs to the Service API, not to these pages. SSO sign-in (dfoe_ tokens) is Enterprise-only and is documented only in the Enterprise trees.

Vocabulary

Source of truth (S2)

Business commands come from the server, not from cli/. Each route in api/controllers/openapi/*.py declares an @endpoint with its op id, summary, effect, requirements, and the Pydantic models that become its flags, and _catalog.py serves them as the catalog difyctl turns into commands. So an op's flags, requirements, and refusals are verified in api/controllers/openapi/, with auth/requirements.py for who may call it, and difyctl help <command> against a server at the same release prints the same descriptor. cli/ holds the rest:

Read everything at the Dify release the pages describe (its tag), or at the branch the user names for work ahead of a release, per writing-guides/index.md § "Syncing the Dify codebase safely", and record that SHA. cli/README.md drifts from what shipped, so it is not a source. The difyctl skill (skills/difyctl/) ships inside the build, so a page agrees with it or says nothing on that point; where the skill is wrong for the release, the page states what the code does and the gap goes to the user. A claim you cannot verify is left out or marked {/* VERIFY: … */}, never softened into a fact. For project context (known bugs, what is shipped versus planned), ask the user.

Live tests (S2)

A test that runs difyctl against a real server is isolated from its first command, version and help included: run every call as env -i PATH=/usr/bin:/bin HOME=<scratch>/home DIFY_CONFIG_DIR=<scratch>/cfg <full path to difyctl> …, sign in only with login --no-keyring, and report any call made outside that. The fake home keeps the run out of the tester's own config, cache, and keychain. Isolation doesn't cover the server side: signing in as an account ends that account's other sign-ins on the machine, so test with an account the tester isn't using, or expect to sign them back in.

Reader tasks (S3)

Run the pipeline's task analysis, at the depth the change sets, for each command or concept a change adds or alters. CLI readers arrive with a job rather than a command name: sign in on a server or in a container, run an app from a script, let a coding agent drive the CLI, recover from an exit code. The questions on the way to that job decide what a page says beyond the CLI's own help: what to set up first, how to confirm it worked, what to do when it fails. They go into the S4 scope report.

Content ownership (S3, S7)

Each cross-cutting fact lives on one page. The research summary applies this table to the page: what the page owns, it states in full; anything else it needs, it states in one line, only where the reader needs it to act, and links the owner. The Upgrade page restates old-to-new facts as migration steps; that is its job, not a second home.

| Content | Owner |

|---|---|

| Where difyctl installs from; the first sign-in, --insecure, and its approval checks; the two server switches; the version rule | Get Started |

| Setting up a coding agent and the difyctl skill | Get Started § Set Up Your Coding Agent |

| Which app types run, and how each one runs | Run Apps § Find Your Apps |

| Human Input pause and resume | Run Apps § Answer a Human Input Form |

| What an update import does; DSL files versus app packages | Create and Update Apps from DSL Files |

| A job's sign-in through DIFY_TOKEN | Use difyctl in CI and Automation |

| Personal access tokens with difyctl: when to use one, giving it to difyctl, and what each scope lets it run | Use a Personal Access Token |

| Creating, changing, replacing, and deleting a personal access token | Personal Settings § Personal Access Tokens, in the self-host user guide |

| Sign-in lifetime, sessions, signing out, where the token lives and the config folder per OS | Manage Your Sign-In |

| Switching workspaces, and what overrides a switch | Manage Your Sign-In § Switch Your Workspace |

| Updating the build, reinstalling the difyctl skill, refreshing the command list | Update or Uninstall |

| help, --help, effect labels, --input; difyctl never asks before running a command | Find and Run Commands |

| Every command and what it requires | Command Index |

| Environment and installer variables, and which workspace setting wins; the files difyctl keeps | Configuration |

| Where output goes, --json, and --verbose; run results; error codes, exit codes, retries, rate limits | Results, Errors, and Exit Codes |

| The crossing from the CLI before Dify 1.18.0 | Upgrade Across Dify 1.18.0 |

An error's fix lives in one Troubleshooting table. An error any command can raise goes in Results, Errors, and Exit Codes. An error that only one task or feature raises goes on that task's or feature's page, so a person or a coding agent finds the fix where they're working. An error that is a normal branch of a task, such as draft_changed on an update import, is handled in the task itself.

Rules that protect readers (S5)

House style (S5)

A section opens with when and why you would do it and front-loads its key limitation, because a reader scanning for their case decides in the first line whether to stay. The conventions this doc set has settled on:

Page shape (S5)

The set has five kinds of page, and a kind doesn't do another kind's job. Read the sibling of the page's kind before writing and match it where the content is alike:

Upgrade Across Dify 1.18.0 stands alone. A page that owns a Troubleshooting table ends with ## Troubleshooting (| Message | What to do |). No page carries per-command Arguments or Flags sections: flags come from the server, and difyctl help <command> shows them for the reader's own server, so a page names a flag only where its task needs one. Describe failures rather than quoting error strings, except in a Troubleshooting table, where the message is how the reader finds the row.

Checks (S7)

In each check pass, after the format and terminology checks: python3 tools/check-links.py --internal must print Broken links: 0 and Broken anchors: 0. A <Badge> in a heading joins the anchor slug (## Agent Knowledge Bases <Badge color="blue">Cloud</Badge> is #agent-knowledge-bases-cloud) unless the heading carries an explicit {#id}. Then confirm against the Content ownership table that no owned fact is re-explained on the changed page.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.