From 519c7d0de64e5aca1d69c60fb46ddf8127e890b0 Mon Sep 17 00:00:00 2001 From: Huawei Date: Mon, 13 Jul 2026 16:38:14 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=20AGENTS.md=20?= =?UTF-8?q?=E2=80=94=20=E5=8E=BB=E9=99=A4=E9=9D=9E=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E5=86=85=E5=AE=B9=EF=BC=88=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E3=80=81=E5=90=88=E8=A7=84=E6=A3=80=E6=B5=8B=E3=80=81fork=20?= =?UTF-8?q?=E7=AD=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suite-developer/AGENTS.md | 80 +++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/suite-developer/AGENTS.md b/suite-developer/AGENTS.md index 2a53e73..78c21a9 100644 --- a/suite-developer/AGENTS.md +++ b/suite-developer/AGENTS.md @@ -12,8 +12,8 @@ 你的代码 → 打包为脚本包 → 发布到套件市场 ↓ 用户执行套件 → gis-actions 从市场下载脚本包 → docker run -→ 用户本地文件挂载到容器内 → 脚本处理 → 结果写入 /tmp/output/ -→ 脚本包销毁 → 结果留在用户机器 +→ 用户数据复制到容器内 → 脚本处理 → 结果写入 /tmp/output/ +→ 脚本包清理 → 结果留在用户机器 ``` **用户不上传文件,永远提供本地路径。** @@ -21,66 +21,54 @@ ### 1. 分析需求 用户需要什么处理能力?输入是什么?期望输出是什么? -### 1.5 归分类 -确定脚本处理的数据类型和套件的业务类型。 - -**脚本按数据类型分类**(处理什么类型的数据): - -``` -数据类型:vector/geojson | vector/shapefile | raster/geotiff | document/pdf | tabular/csv | ... -``` - -**套件按业务类型分类**(解决什么业务问题): - -``` -业务类型:国土变更调查 | 不动产登记 | 城市规划 | 应急测绘 | ... -``` - -**优先使用系统中已有的分类。** 查阅 `knowledge/script-data-types.md` 获取完整数据类型列表。 -仅在现有分类确实无法覆盖时才新增类型,不要打"近义标签"或自创"同义分类"。 - ### 2. 查市场,找复用 -**写代码前,先查市场有没有现成的:** +写代码前,先查市场有没有现成的套件: -``` -curl -s "https://suites.mercator.cn/api/v1/suites/search?q=<关键词>" -curl -s https://suites.mercator.cn/api/v1/suites | python3 -m json.tool +```bash +curl -s "https://suites.mercator.cn/api/v1/suites" | python3 -m json.tool ``` -能找到现成的 Suite 就复用——用 `suite_id` 引用即可。 -能找到相似的 Suite 就 fork 改造,不从头写。 +有现成的就直接用,不重复造轮子。 -不要每次从头造轮子。复用 = 少写代码 + 少出 bug。 - -### 3. 设计套件 -- 有现成 Suite → 在 workflow.yaml 中用 `type: script` + `suite_id` 引用 -- 没有现成 Suite → 写自己的脚本,发布为新 Suite -- 多个步骤串联 → 组成 Suite -- **参数设计**:所有输入文件路径用参数传递,不硬编码路径 +### 3. 设计步骤 +- 确定需要几个步骤 +- 步骤间数据通过 `/tmp/output/` 目录共享 +- 参数用 `$params.xxx` 引用用户输入 ### 4. 实现 写 workflow.yaml + scripts/run.py。 ```yaml -# workflow.yaml 参数设计示例 +name: 我的套件 +description: 套件功能描述 +version: 1.0.0 +tags: [标签1] +base_image: gis-base:latest + params: - type: object - required: ["input_path"] - properties: - input_path: - type: string - description: "输入文件路径(用户本地的 .shp 或 .geojson 文件)" - buffer_distance: - type: number - default: 100 - description: "缓冲区半径(米)" + input_path: + type: string + required: true + desc: 输入文件路径 + +steps: + - id: step1 + name: 第一步 + script_id: run + params: + input: $params.input_path ``` ### 5. 测试 -`agc run` 验证结果。传入本地测试文件路径即可。 + +```bash +agc run /tmp/test-output \ + --suite-id \ + --input input_path=/path/to/test.shp +``` ### 6. 发布 -通过 API 上传 → 合规检测 → 上线。 +打包为 `scripts.tar.gz`,通过 API 上传到 SuiteHub Packages,在套件市场注册。 ### 7. 迭代 根据用户反馈修 bug、发新版本。