docs: fix publish endpoints, add gitea_token requirement, fix knowledge refs in MEMORY.md

This commit is contained in:
2026-07-16 07:23:42 +00:00
parent 984b25850a
commit 6866062830
+32 -16
View File
@@ -2,7 +2,7 @@
## 平台入口
- **API:** https://suites.mercator.cn
- **市场:** https://suites.mercator.cn
- **API Key 获取:** https://auth.mercator.cn
- **API 文档:** https://suites.mercator.cn/docs
@@ -10,8 +10,7 @@
| 文件 | 内容 |
|------|------|
| `script-data-types.md` | 脚本数据类型分类规范(矢量/栅格/点云/文档/表格... |
| `script-dependencies.md` | 脚本依赖管理规范(运行时 pip / 扩展镜像 / 自定义镜像) |
| `data-execution-model.md` | 数据执行模型(本地执行设计 |
## Workflow.yaml 核心规则
@@ -76,30 +75,47 @@ steps:
## 核心原则:先查市场,再动手写
开发新套件前,先搜索市场是否已有能复用的 Suite
开发新套件前,先搜索市场是否已有能复用的套件
```bash
curl -s "https://suites.mercator.cn/api/v1/suites/search?q=缓冲区"
curl -s https://suites.mercator.cn/api/v1/suites | python3 -m json.tool
```
找到现成的 Suite → 在 workflow.yaml 中引用,不写新代码。
找不到 → 写新脚本 → 发布 Suite → 方便后续者复用。
找到现成的套件 → 直接使用,不写新代码。
找不到 → 写新脚本 → 发布套件 → 方便后续者复用。
## 发布流程
通过 API 上传:
### 前置条件
1. **API Key**(从 https://auth.mercator.cn 获取)
2. **Gitea Token**(从 https://git.mercator.cn 用户设置中生成,需 `write:packages` 权限)
### 文件上传发布
```bash
tar czf suite.tgz --exclude='.git' --exclude='__pycache__' my-suite/
curl -X POST https://suites.mercator.cn/api/v1/publish \
-H "Authorization: Bearer $KEY" \
-F "file=@suite.tgz"
# 打包套件(不含 git 历史)
tar czf my-suite.tar.gz --exclude='.git' --exclude='__pycache__' my-suite/
# 发布
curl -X POST https://suites.mercator.cn/publish/upload \
-H "Authorization: Bearer $API_KEY" \
-F "file=@my-suite.tar.gz" \
-F "gitea_token=YOUR_GITEA_TOKEN"
```
## 执行环境
### Git 仓库发布
- 每个任务跑在独立 Docker 容器中,用完即销毁
- 容器使用 gis-base 镜像(`gis-base:latest`,本地加载)
- 工作目录 `/tmp/output`(步骤间共享)
- 参数通过 `PARAMS_FILE` 环境变量(指向 JSON 文件)或 `sys.argv[1]` JSON 传入
```bash
curl -X POST https://suites.mercator.cn/publish \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"repo_url": "https://github.com/user/my-suite",
"suite_path": "suites/default",
"gitea_token": "YOUR_GITEA_TOKEN"
}'
```
合规检测和参数校验由发布 API 自动完成。