fix: 更新 AGENTS.md — 去除非当前架构内容(分类、合规检测、fork 等)

This commit is contained in:
2026-07-13 16:38:14 +00:00
parent 14e4da3f50
commit 519c7d0de6
+32 -44
View File
@@ -12,8 +12,8 @@
你的代码 → 打包为脚本包 → 发布到套件市场 你的代码 → 打包为脚本包 → 发布到套件市场
用户执行套件 → gis-actions 从市场下载脚本包 → docker run 用户执行套件 → gis-actions 从市场下载脚本包 → docker run
→ 用户本地文件挂载到容器内 → 脚本处理 → 结果写入 /tmp/output/ → 用户数据复制到容器内 → 脚本处理 → 结果写入 /tmp/output/
→ 脚本包销毁 → 结果留在用户机器 → 脚本包清理 → 结果留在用户机器
``` ```
**用户不上传文件,永远提供本地路径。** **用户不上传文件,永远提供本地路径。**
@@ -21,66 +21,54 @@
### 1. 分析需求 ### 1. 分析需求
用户需要什么处理能力?输入是什么?期望输出是什么? 用户需要什么处理能力?输入是什么?期望输出是什么?
### 1.5 归分类
确定脚本处理的数据类型和套件的业务类型。
**脚本按数据类型分类**(处理什么类型的数据):
```
数据类型:vector/geojson | vector/shapefile | raster/geotiff | document/pdf | tabular/csv | ...
```
**套件按业务类型分类**(解决什么业务问题):
```
业务类型:国土变更调查 | 不动产登记 | 城市规划 | 应急测绘 | ...
```
**优先使用系统中已有的分类。** 查阅 `knowledge/script-data-types.md` 获取完整数据类型列表。
仅在现有分类确实无法覆盖时才新增类型,不要打"近义标签"或自创"同义分类"。
### 2. 查市场,找复用 ### 2. 查市场,找复用
**写代码前,先查市场有没有现成的:** 写代码前,先查市场有没有现成的套件
``` ```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
curl -s https://suites.mercator.cn/api/v1/suites | python3 -m json.tool
``` ```
能找到现成的 Suite 就复用——用 `suite_id` 引用即可 有现成的就直接用,不重复造轮子
能找到相似的 Suite 就 fork 改造,不从头写。
不要每次从头造轮子。复用 = 少写代码 + 少出 bug。 ### 3. 设计步骤
- 确定需要几个步骤
### 3. 设计套件 - 步骤间数据通过 `/tmp/output/` 目录共享
- 有现成 Suite → 在 workflow.yaml 中用 `type: script` + `suite_id` 引用 - 参数用 `$params.xxx` 引用用户输入
- 没有现成 Suite → 写自己的脚本,发布为新 Suite
- 多个步骤串联 → 组成 Suite
- **参数设计**:所有输入文件路径用参数传递,不硬编码路径
### 4. 实现 ### 4. 实现
写 workflow.yaml + scripts/run.py。 写 workflow.yaml + scripts/run.py。
```yaml ```yaml
# workflow.yaml 参数设计示例 name: 我的套件
description: 套件功能描述
version: 1.0.0
tags: [标签1]
base_image: gis-base:latest
params: params:
type: object
required: ["input_path"]
properties:
input_path: input_path:
type: string type: string
description: "输入文件路径(用户本地的 .shp 或 .geojson 文件)" required: true
buffer_distance: desc: 输入文件路径
type: number
default: 100 steps:
description: "缓冲区半径(米)" - id: step1
name: 第一步
script_id: run
params:
input: $params.input_path
``` ```
### 5. 测试 ### 5. 测试
`agc run` 验证结果。传入本地测试文件路径即可。
```bash
agc run /tmp/test-output \
--suite-id <suite-id> \
--input input_path=/path/to/test.shp
```
### 6. 发布 ### 6. 发布
通过 API 上传 → 合规检测 → 上线 打包为 `scripts.tar.gz`,通过 API 上传到 SuiteHub Packages,在套件市场注册
### 7. 迭代 ### 7. 迭代
根据用户反馈修 bug、发新版本。 根据用户反馈修 bug、发新版本。