fedincms-cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/cli.js +170 -0
- package/package.json +38 -0
- package/templates/skill/SKILL.md +61 -0
- package/templates/skill/reference.md +115 -0
- package/templates/skill/scripts/fedin-cms-cli.js +15657 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# fedincms-cli
|
|
2
|
+
|
|
3
|
+
Fedin CMS Skill 的全局 CLI:通过 `fedincms init` 将 Skill 安装到当前项目,在 Cursor 中通过项目内脚本调用 Fedin CMS API,无需运行 MCP Server。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g fedincms-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
或使用 scope 包名(若已发布):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @your-scope/fedin-cms-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
安装后可使用 `fedincms` 命令。
|
|
18
|
+
|
|
19
|
+
## 使用
|
|
20
|
+
|
|
21
|
+
1. 进入你的项目根目录:
|
|
22
|
+
```bash
|
|
23
|
+
cd /path/to/your-project
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. 初始化并配置站点 ID(必填)与可选 API 地址、密钥:
|
|
27
|
+
```bash
|
|
28
|
+
fedincms init website=你的站点ID
|
|
29
|
+
# 或带可选参数
|
|
30
|
+
fedincms init website=你的站点ID apiUrl=https://... anonKey=你的密钥
|
|
31
|
+
# 或长选项
|
|
32
|
+
fedincms init --website=你的站点ID --api-url=https://... --anon-key=你的密钥
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. 在 Cursor 中打开该项目,AI 将根据 `.cursor/skills/fedin-cms/SKILL.md` 在需要时执行:
|
|
36
|
+
```bash
|
|
37
|
+
node .cursor/skills/fedin-cms/scripts/fedin-cms-cli.js <command> [args]
|
|
38
|
+
```
|
|
39
|
+
脚本为单文件(依赖已打包),无需在 `scripts/` 下执行 `npm install`。
|
|
40
|
+
|
|
41
|
+
## 发布到 npm
|
|
42
|
+
|
|
43
|
+
1. 登录 npm(若未登录):
|
|
44
|
+
```bash
|
|
45
|
+
npm login
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. 若使用 scope 包名,修改 `package.json` 中的 `name`,例如:
|
|
49
|
+
```json
|
|
50
|
+
"name": "@your-username/fedin-cms-cli"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
3. 发布:
|
|
54
|
+
```bash
|
|
55
|
+
npm publish
|
|
56
|
+
```
|
|
57
|
+
若为 scope 包且首次发布,需执行:
|
|
58
|
+
```bash
|
|
59
|
+
npm publish --access public
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
发布时 `prepublishOnly` 会自动将 `src/cli.js` 复制到 `dist/cli.js`,仅 `dist` 与 `templates` 会包含在包中。
|
|
63
|
+
|
|
64
|
+
## 开发
|
|
65
|
+
|
|
66
|
+
- 全局 CLI 源码:`src/cli.js`(发布前会复制到 `dist/cli.js`)
|
|
67
|
+
- Skill 脚本源码:`src/fedin-cms-cli.js`,运行 `npm run build:skill` 打包为 `templates/skill/scripts/fedin-cms-cli.js`(axios、dotenv 已内联,用户无需安装依赖)
|
|
68
|
+
- 模板:`templates/skill/`(SKILL.md、reference.md、scripts/fedin-cms-cli.js)
|
|
69
|
+
- 本地测试:在项目根执行 `npm link`,在任意目录执行 `fedincms init website=test`
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const TEMPLATE_DIR = path.join(__dirname, '..', 'templates', 'skill');
|
|
8
|
+
const SKILL_DIR = '.cursor/skills/fedin-cms';
|
|
9
|
+
const SKILL_SCRIPTS_DIR = '.cursor/skills/fedin-cms/scripts';
|
|
10
|
+
|
|
11
|
+
function parseArgs(argv) {
|
|
12
|
+
const args = { _: [] };
|
|
13
|
+
for (let i = 0; i < argv.length; i++) {
|
|
14
|
+
const arg = argv[i];
|
|
15
|
+
if (arg === '--help' || arg === '-h') {
|
|
16
|
+
args.help = true;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (arg === '--force' || arg === '-f') {
|
|
20
|
+
args.force = true;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (arg.startsWith('--')) {
|
|
24
|
+
const eq = arg.indexOf('=');
|
|
25
|
+
if (eq > 0) {
|
|
26
|
+
const k = arg.slice(2, eq).replace(/-/g, '');
|
|
27
|
+
const v = arg.slice(eq + 1);
|
|
28
|
+
if (k === 'website') args.website = v;
|
|
29
|
+
else if (k === 'apiurl') args.apiUrl = v;
|
|
30
|
+
else if (k === 'anonkey') args.anonKey = v;
|
|
31
|
+
}
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (arg.includes('=')) {
|
|
35
|
+
const [k, v] = arg.split('=').map(s => s.trim());
|
|
36
|
+
if (k === 'website') args.website = v;
|
|
37
|
+
else if (k === 'apiUrl') args.apiUrl = v;
|
|
38
|
+
else if (k === 'anonKey') args.anonKey = v;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
args._.push(arg);
|
|
42
|
+
}
|
|
43
|
+
return args;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function ensureDir(dir) {
|
|
47
|
+
const full = path.isAbsolute(dir) ? dir : path.join(process.cwd(), dir);
|
|
48
|
+
fs.mkdirSync(full, { recursive: true });
|
|
49
|
+
return full;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function copyFile(src, dest, force) {
|
|
53
|
+
const destFull = path.join(process.cwd(), dest);
|
|
54
|
+
if (!force && fs.existsSync(destFull)) return false;
|
|
55
|
+
ensureDir(path.dirname(destFull));
|
|
56
|
+
fs.copyFileSync(src, destFull);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function readOrCreateEnv() {
|
|
61
|
+
const envPath = path.join(process.cwd(), '.env');
|
|
62
|
+
let content = '';
|
|
63
|
+
if (fs.existsSync(envPath)) {
|
|
64
|
+
content = fs.readFileSync(envPath, 'utf8');
|
|
65
|
+
if (!content.endsWith('\n')) content += '\n';
|
|
66
|
+
}
|
|
67
|
+
return { envPath, content };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function appendEnv(lines) {
|
|
71
|
+
const { envPath, content } = readOrCreateEnv();
|
|
72
|
+
const toAdd = lines.filter(line => {
|
|
73
|
+
const key = line.split('=')[0].trim();
|
|
74
|
+
return !content.includes(key + '=');
|
|
75
|
+
});
|
|
76
|
+
if (toAdd.length === 0) return;
|
|
77
|
+
fs.writeFileSync(envPath, content + '\n# Fedin CMS (fedincms init)\n' + toAdd.join('\n') + '\n', 'utf8');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function runInit(options) {
|
|
81
|
+
const cwd = process.cwd();
|
|
82
|
+
const templateBase = path.join(__dirname, '..', 'templates', 'skill');
|
|
83
|
+
if (!fs.existsSync(templateBase)) {
|
|
84
|
+
console.error('fedincms: 模板目录不存在:', templateBase);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const website = options.website;
|
|
89
|
+
if (!website) {
|
|
90
|
+
console.error('fedincms init: 缺少必填参数 website。用法: fedincms init website=xxxxx [apiUrl=...] [anonKey=...]');
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const skillDirFull = path.join(cwd, SKILL_DIR);
|
|
95
|
+
const exists = fs.existsSync(skillDirFull);
|
|
96
|
+
if (exists && !options.force) {
|
|
97
|
+
console.log('fedincms: .cursor/skills/fedin-cms/ 已存在,跳过复制。使用 --force 覆盖。');
|
|
98
|
+
} else {
|
|
99
|
+
ensureDir(SKILL_SCRIPTS_DIR);
|
|
100
|
+
const skillMd = path.join(templateBase, 'SKILL.md');
|
|
101
|
+
const refMd = path.join(templateBase, 'reference.md');
|
|
102
|
+
const scriptJs = path.join(templateBase, 'scripts', 'fedin-cms-cli.js');
|
|
103
|
+
if (fs.existsSync(skillMd)) copyFile(skillMd, path.join(SKILL_DIR, 'SKILL.md'), options.force);
|
|
104
|
+
if (fs.existsSync(refMd)) copyFile(refMd, path.join(SKILL_DIR, 'reference.md'), options.force);
|
|
105
|
+
if (fs.existsSync(scriptJs)) copyFile(scriptJs, path.join(SKILL_DIR, 'scripts', 'fedin-cms-cli.js'), options.force);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const defaultContentTypeUrl = 'https://database.fedin.cn/functions/v1/cms_content-type-manager';
|
|
109
|
+
const defaultContentUrl = 'https://database.fedin.cn/functions/v1/cms_content-manager';
|
|
110
|
+
const envLines = [
|
|
111
|
+
`WEBSITE_ID=${website}`,
|
|
112
|
+
options.apiUrl ? `SUPABASE_CMS_API_URL=${options.apiUrl}` : `SUPABASE_CMS_API_URL=${defaultContentTypeUrl}`,
|
|
113
|
+
`SUPABASE_CONTENT_API_URL=${defaultContentUrl}`,
|
|
114
|
+
options.anonKey ? `SUPABASE_ANON_KEY=${options.anonKey}` : 'SUPABASE_ANON_KEY=',
|
|
115
|
+
].filter(Boolean);
|
|
116
|
+
appendEnv(envLines);
|
|
117
|
+
|
|
118
|
+
console.log('Skill 已安装到 .cursor/skills/fedin-cms/');
|
|
119
|
+
if (!options.apiUrl || !options.anonKey) {
|
|
120
|
+
console.log('如未配置 API 地址或密钥,请在项目根 .env 中设置 SUPABASE_CMS_API_URL、SUPABASE_CONTENT_API_URL、SUPABASE_ANON_KEY。');
|
|
121
|
+
}
|
|
122
|
+
console.log('脚本为单文件打包,无需在 scripts/ 下安装依赖。');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function printHelp() {
|
|
126
|
+
console.log(`
|
|
127
|
+
fedincms init - 将 Fedin CMS Skill 安装到当前项目
|
|
128
|
+
|
|
129
|
+
用法:
|
|
130
|
+
fedincms init website=<站点ID> [apiUrl=<API地址>] [anonKey=<密钥>]
|
|
131
|
+
fedincms init --website=<站点ID> [--api-url=<API地址>] [--anon-key=<密钥>]
|
|
132
|
+
|
|
133
|
+
参数:
|
|
134
|
+
website 必填。站点 ID,对应环境变量 WEBSITE_ID。
|
|
135
|
+
apiUrl 可选。Fedin CMS API 根地址,对应 SUPABASE_CMS_API_URL。
|
|
136
|
+
anonKey 可选。API 密钥,对应 SUPABASE_ANON_KEY。
|
|
137
|
+
|
|
138
|
+
选项:
|
|
139
|
+
--force, -f 已存在 .cursor/skills/fedin-cms/ 时覆盖复制。
|
|
140
|
+
--help, -h 显示此帮助。
|
|
141
|
+
|
|
142
|
+
行为:
|
|
143
|
+
- 创建 .cursor/skills/fedin-cms/ 并复制 SKILL.md 与 scripts/fedin-cms-cli.js
|
|
144
|
+
- 在项目根写入或追加 .env(WEBSITE_ID、SUPABASE_CMS_API_URL、SUPABASE_ANON_KEY)
|
|
145
|
+
`);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function main() {
|
|
149
|
+
const argv = process.argv.slice(2);
|
|
150
|
+
if (argv.length === 0) {
|
|
151
|
+
console.log('用法: fedincms init website=xxxxx [apiUrl=...] [anonKey=...]');
|
|
152
|
+
console.log('查看帮助: fedincms init --help');
|
|
153
|
+
process.exit(0);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const sub = argv[0].toLowerCase();
|
|
157
|
+
if (sub !== 'init') {
|
|
158
|
+
console.error('未知子命令:', sub, '。当前仅支持: init');
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const options = parseArgs(argv.slice(1));
|
|
163
|
+
if (options.help) {
|
|
164
|
+
printHelp();
|
|
165
|
+
process.exit(0);
|
|
166
|
+
}
|
|
167
|
+
runInit(options);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fedincms-cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Fedin CMS Skill CLI",
|
|
5
|
+
"main": "dist/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fedincms": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"templates"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build:skill": "node build-skill.js",
|
|
15
|
+
"prepublishOnly": "npm run build:skill && node -e \"const fs=require('fs');const p='src/cli.js';if(fs.existsSync(p)){fs.mkdirSync('dist',{recursive:true});fs.copyFileSync(p,'dist/cli.js');}\""
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"axios": "^1.6.0",
|
|
19
|
+
"dotenv": "^16.3.1",
|
|
20
|
+
"esbuild": "^0.24.0"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"fedin",
|
|
24
|
+
"cms",
|
|
25
|
+
"cursor",
|
|
26
|
+
"skill",
|
|
27
|
+
"cli"
|
|
28
|
+
],
|
|
29
|
+
"author": "",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=16"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": ""
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fedin-cms
|
|
3
|
+
description: 通过 Fedin CMS 脚本管理内容类型与条目:列出/获取/创建/更新/删除 content types 与 entries。当用户提到 Fedin CMS、内容管理、内容类型、条目、list content types、get entries 等时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fedin CMS Skill
|
|
7
|
+
|
|
8
|
+
## 前提
|
|
9
|
+
|
|
10
|
+
- 项目已通过 `fedincms init website=xxxxx` 初始化。
|
|
11
|
+
- 项目根 `.env` 中已配置 `WEBSITE_ID`;若需调用 API,请配置 `SUPABASE_CMS_API_URL`(内容类型)、`SUPABASE_CONTENT_API_URL`(条目,可选)、`SUPABASE_ANON_KEY`。
|
|
12
|
+
- 脚本为单文件打包(依赖已内联),**无需**在 `scripts/` 下执行 `npm install`。
|
|
13
|
+
|
|
14
|
+
## 执行约定
|
|
15
|
+
|
|
16
|
+
- **必须在项目根目录**执行脚本,以便从项目根加载 `.env`。
|
|
17
|
+
- 唯一入口命令:
|
|
18
|
+
```bash
|
|
19
|
+
node .cursor/skills/fedin-cms/scripts/fedin-cms-cli.js <command> [args]
|
|
20
|
+
```
|
|
21
|
+
- 所有 Fedin CMS 能力(列内容类型、查/增/删/改条目与 content type)**必须**通过上述脚本完成,不得手写请求 CMS API 的代码。
|
|
22
|
+
|
|
23
|
+
## 能力与命令对应
|
|
24
|
+
|
|
25
|
+
| 能力 | 命令 | 必填参数 | 可选参数 |
|
|
26
|
+
|------|------|----------|----------|
|
|
27
|
+
| 列内容类型 | `list_content_types` | - | - |
|
|
28
|
+
| 获取条目列表 | `get_entries` | `--uid=<uid>` | `--options='{"pagination":{"page":1,"pageSize":10},"sort":["updated_at:desc"]}'` |
|
|
29
|
+
| 获取单条条目 | `get_entry` | `--uid=<uid>` `--id=<id>` | - |
|
|
30
|
+
| 创建条目 | `create_entry` | `--uid=<uid>` `--data='...'` 或 `--data-file=path` | `--status=draft\|published` |
|
|
31
|
+
| 更新条目 | `update_entry` | `--uid=<uid>` `--id=<id>` `--data='...'` 或 `--data-file=path` | `--status=` |
|
|
32
|
+
| 删除条目 | `delete_entry` | `--uid=<uid>` `--id=<id>` | - |
|
|
33
|
+
| 获取内容类型 schema | `get_content_type_schema` | `--contentType=<uid>` | - |
|
|
34
|
+
| 创建内容类型 | `create_content_type` | `--uid=` `--title=` | `--description=` |
|
|
35
|
+
| 更新内容类型 | `update_content_type` | `--contentType=<uid>` | `--title=` `--description=` |
|
|
36
|
+
| 删除内容类型 | `delete_content_type` | `--contentType=<uid>` | - |
|
|
37
|
+
|
|
38
|
+
## 输出与错误
|
|
39
|
+
|
|
40
|
+
- **成功**:脚本将结果 JSON 打印到 **stdout**。
|
|
41
|
+
- **失败**:错误信息打印到 **stderr**,并以非 0 退出码退出;可根据 stderr 与退出码判断失败并解析错误信息。
|
|
42
|
+
|
|
43
|
+
## 详细参数说明
|
|
44
|
+
|
|
45
|
+
详见 [reference.md](./reference.md)。
|
|
46
|
+
|
|
47
|
+
## 示例
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# 列出所有内容类型
|
|
51
|
+
node .cursor/skills/fedin-cms/scripts/fedin-cms-cli.js list_content_types
|
|
52
|
+
|
|
53
|
+
# 获取 blog 类型单条
|
|
54
|
+
node .cursor/skills/fedin-cms/scripts/fedin-cms-cli.js get_entry --uid=blog --id=123
|
|
55
|
+
|
|
56
|
+
# 获取 blog 列表(分页)
|
|
57
|
+
node .cursor/skills/fedin-cms/scripts/fedin-cms-cli.js get_entries --uid=blog --options='{"pagination":{"page":1,"pageSize":10},"sort":["updated_at:desc"]}'
|
|
58
|
+
|
|
59
|
+
# 创建条目
|
|
60
|
+
node .cursor/skills/fedin-cms/scripts/fedin-cms-cli.js create_entry --uid=blog --data='{"title":"Hello","body":"World"}'
|
|
61
|
+
```
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Fedin CMS 脚本命令参考
|
|
2
|
+
|
|
3
|
+
所有命令均在**项目根目录**执行:
|
|
4
|
+
`node .cursor/skills/fedin-cms/scripts/fedin-cms-cli.js <command> [args]`
|
|
5
|
+
|
|
6
|
+
## 环境
|
|
7
|
+
|
|
8
|
+
- 脚本从项目根加载 `.env`,与 Fedin CMS MCP 一致:
|
|
9
|
+
- `WEBSITE_ID`(必填)
|
|
10
|
+
- `SUPABASE_CMS_API_URL`(内容类型 API,默认 `cms_content-type-manager`)
|
|
11
|
+
- `SUPABASE_CONTENT_API_URL`(条目 API,默认 `cms_content-manager`,可选,未设时与 MCP 一致使用 content-manager 默认)
|
|
12
|
+
- `SUPABASE_ANON_KEY`、`USER_ID`(可选)
|
|
13
|
+
- 成功时结果 JSON 输出到 stdout;失败时错误信息输出到 stderr 并以非 0 退出码退出。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. list_content_types
|
|
18
|
+
|
|
19
|
+
列出当前站点下所有内容类型。
|
|
20
|
+
|
|
21
|
+
- **命令**:`list_content_types`
|
|
22
|
+
- **参数**:无
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. get_entries
|
|
27
|
+
|
|
28
|
+
获取指定内容类型的条目列表,支持分页与排序。
|
|
29
|
+
|
|
30
|
+
- **命令**:`get_entries`
|
|
31
|
+
- **必填**:`--uid=<contentTypeUid>`(如 `blog`)
|
|
32
|
+
- **可选**:`--options='{"pagination":{"page":1,"pageSize":10},"sort":["updated_at:desc"],"filters":{"status":"published"}}'`
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 3. get_entry
|
|
37
|
+
|
|
38
|
+
根据内容类型 UID 和条目 ID 获取单条条目。
|
|
39
|
+
|
|
40
|
+
- **命令**:`get_entry`
|
|
41
|
+
- **必填**:`--uid=<contentTypeUid>`,`--id=<entryId>`
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 4. create_entry
|
|
46
|
+
|
|
47
|
+
在指定内容类型下创建一条条目。
|
|
48
|
+
|
|
49
|
+
- **命令**:`create_entry`
|
|
50
|
+
- **必填**:`--uid=<contentTypeUid>`,`--data='{"title":"Hello","body":"World"}'` 或 `--data-file=./payload.json`
|
|
51
|
+
- **可选**:`--status=draft` 或 `published`(默认 `published`)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 5. update_entry
|
|
56
|
+
|
|
57
|
+
更新指定内容类型下的一条条目。
|
|
58
|
+
|
|
59
|
+
- **命令**:`update_entry`
|
|
60
|
+
- **必填**:`--uid=<contentTypeUid>`,`--id=<entryId>`,`--data='{"title":"Updated"}'` 或 `--data-file=./payload.json`
|
|
61
|
+
- **可选**:`--status=draft` 或 `published`
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 6. delete_entry
|
|
66
|
+
|
|
67
|
+
删除指定内容类型下的一条条目。
|
|
68
|
+
|
|
69
|
+
- **命令**:`delete_entry`
|
|
70
|
+
- **必填**:`--uid=<contentTypeUid>`,`--id=<entryId>`
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 7. get_content_type_schema
|
|
75
|
+
|
|
76
|
+
获取单个内容类型的 schema(字段定义等)。
|
|
77
|
+
|
|
78
|
+
- **命令**:`get_content_type_schema`
|
|
79
|
+
- **必填**:`--contentType=<contentTypeUid>`(如 `blog`)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 8. create_content_type
|
|
84
|
+
|
|
85
|
+
创建新的内容类型(与 MCP 一致:仅 uid、title、description,字段由后端固定)。
|
|
86
|
+
|
|
87
|
+
- **命令**:`create_content_type`
|
|
88
|
+
- **必填**:`--uid=<uid>`,`--title=<显示名>`
|
|
89
|
+
- **可选**:`--description=<描述>`
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 9. update_content_type
|
|
94
|
+
|
|
95
|
+
更新已有内容类型(与 MCP 一致:仅支持 title、description)。
|
|
96
|
+
|
|
97
|
+
- **命令**:`update_content_type`
|
|
98
|
+
- **必填**:`--contentType=<contentTypeUid>`
|
|
99
|
+
- **可选**:`--title=`,`--description=`
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 10. delete_content_type
|
|
104
|
+
|
|
105
|
+
删除内容类型。
|
|
106
|
+
|
|
107
|
+
- **命令**:`delete_content_type`
|
|
108
|
+
- **必填**:`--contentType=<contentTypeUid>`
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 复杂 JSON 参数
|
|
113
|
+
|
|
114
|
+
- 使用 `--options='...'`、`--data='...'` 时,JSON 字符串需正确转义(如 shell 中单引号包裹)。
|
|
115
|
+
- 支持从文件读取:`--data-file=./payload.json`。
|