emdash-cli
它能做什么
这项技能使用 EmDash 命令行工具检查和管理 EmDash 网站,从内容和媒体到结构和备份。适合习惯在终端中工作的网站所有者和开发者。
适用场景
- ✓当你想在终端中列出、添加或修改 EmDash 网站的内容的时候。
- ✓当你需要导出网站,或将其导入到新的位置的时候。
- ✓当你正在准备数据库迁移,或为项目生成类型的时候。
技能链接
https://github.com/emdash-cms/emdash/blob/main/skills/emdash-cli/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我从命令行列出 EmDash 网站上最新的博客文章,并把整个网站导出为备份?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会为你的请求运行对应的命令,例如列出内容或导出网站。它会先读取当前网站以确认目标,然后只在你设定的范围内做出更改。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
EmDash CLI
The EmDash CLI (emdash, with the short alias em) manages EmDash CMS instances. Commands fall into two categories:
- Local commands work with project files or a configured database:
init,doctor,seed,migrate,export-seed, andsecrets. - Remote commands talk to a running EmDash instance:
types,login,logout,whoami,content,schema,media,search,taxonomy,menu, andsite.
Run npx emdash --help and npx emdash <command> --help for the installed version's exact commands and flags. Resolve the current target with a read command before a destructive or bulk mutation; examples in this skill do not authorize changing an instance the user did not place in scope.
Authentication
Remote commands resolve auth automatically:
--tokenflagEMDASH_TOKENenv var- Stored credentials from
emdash login - Dev bypass (localhost only — no token needed)
For a localhost development server with the development bypass enabled, the client can authenticate automatically. For a remote instance, run emdash login --url https://example.com or provide a scoped token.
Custom Headers & Reverse Proxies
Sites behind Cloudflare Access or other reverse proxies need auth headers on every request. The CLI supports this via --header flags and environment variables.
Service tokens for automation
# Provide sensitive headers through the environment in CI.
export EMDASH_HEADERS="CF-Access-Client-Id: xxx
CF-Access-Client-Secret: yyy"
npx emdash whoami --url https://example.com
emdash login --header persists custom headers to ~/.config/emdash/auth.json for later commands. Prefer environment-provided headers in CI so a service secret is not written to the credential file or shell history.
Cloudflare Access Browser Flow
If you don't have service tokens and cloudflared is installed, the CLI will automatically:
- Detect when Access blocks the request
- Try to get a cached JWT via
cloudflared access token - Fall back to
cloudflared access loginfor browser-based auth
This works for interactive use but isn't suitable for CI. Use service tokens for automation.
Generic Reverse Proxy Auth
The --header flag works with any auth scheme:
# Basic auth
npx emdash login --url https://example.com -H "Authorization: Basic dXNlcjpwYXNz"
# Custom auth header
npx emdash login --url https://example.com -H "X-API-Key: secret123"
Quick Reference
Database Setup
For normal site startup, use the project's package script. The first request runs pending migrations and, before setup is completed, applies the bundled seed's schema and structure once; sample content comes from the setup wizard, /_emdash/api/setup/dev-bypass, or emdash seed. The Astro integration generates emdash-env.d.ts when the server starts.
# Start the site with its package script
pnpm dev
# Export an existing database as a seed file
# (the runtime auto-discovers .emdash/seed.json on first boot;
# `mkdir -p` because the directory may not exist yet)
mkdir -p .emdash
npx emdash export-seed > .emdash/seed.json
npx emdash export-seed --with-content=all > .emdash/seed.json
Type Generation
# Generate types from local dev server
npx emdash types
# Generate from remote
npx emdash types --url https://example.com
# Custom output path
npx emdash types --output src/types/cms.ts
Writes .emdash/types.ts (TypeScript interfaces) and .emdash/schema.json.
Authentication
# Login (OAuth Device Flow)
npx emdash login --url https://example.com
# Check current user
npx emdash whoami
# Logout
npx emdash logout
# Generate an encryption key for deployment
npx emdash secrets generate
Content CRUD
The CLI is designed for agents. Create and update auto-publish by default so agents get read-after-write consistency without managing drafts.
# List content
npx emdash content list posts
npx emdash content list posts --status published --limit 10
# Get a single item (Portable Text fields converted to markdown)
# Returns draft data if a pending draft exists
npx emdash content get posts 01ABC123
npx emdash content get posts 01ABC123 --raw # skip PT->markdown conversion
npx emdash content get posts 01ABC123 --published # ignore pending drafts
# Create content (auto-publishes by default)
npx emdash content create posts --data '{"title": "Hello", "body": "# World"}'
npx emdash content create posts --file po
常见问题
它如何登录?
它使用已保存的登录信息、你提供的令牌,或者在 localhost 上使用开发绕过。
它能用于代理后面的网站吗?
能。它支持自定义请求头,用于 Cloudflare Access 等服务后面的网站。
它会修改我没有指定的网站吗?
不会。这项技能会先确认目标,更改只限于你设定的范围内。
详情
作者的原始描述
Use the EmDash CLI to inspect and manage an EmDash instance from the command line, including content, schema, media, taxonomies, menus, search, authentication, seeds, migrations, generated types, and whole-site export and import.
repo: emdash-cms/emdash
热度
- GitHub 星标
- 14k
- 排名
- #11248
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
adversarial-reviewer
14k帮你的智能体在代码变更中寻找隐藏的缺陷和不安全的假设;当你要求时,它会超越普通的审查。
agent-browser
14k让你的智能体在真实浏览器中测试网页,检查用户看到的内容,验证操作,并截图作为证据。
building-emdash-site
14k帮你的智能体在 Astro 上构建 EmDash CMS 项目的网站部分,涵盖内容、结构、菜单、分类法和部署。
creating-plugins
14k帮你的智能体为 EmDash CMS 构建插件,包括安全的钩子、路由、存储和管理界面。