From c38606d675b4c47b90123389a84975f523d4af73 Mon Sep 17 00:00:00 2001 From: sjfhsjfh Date: Thu, 27 Nov 2025 17:27:10 +0800 Subject: [PATCH] =?UTF-8?q?docs(AGENTS):=20=E5=BC=BA=E8=B0=83=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20astro=20sync=20=E7=94=9F=E6=88=90=E9=AB=98=E4=BF=9D?= =?UTF-8?q?=E7=9C=9F=E7=B1=BB=E5=9E=8B=EF=BC=8C=E9=9C=80=E5=9C=A8=E6=B2=99?= =?UTF-8?q?=E7=9B=92=E5=A4=96=E4=B8=94=20Node=20=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index df9f299..8f35039 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -62,6 +62,15 @@ - 若锁文件变更:`pnpm install`(保持本地依赖与团队一致) - 新任务建议开分支:`git switch -c feature/`;提交信息用中文清晰描述变更意图 +### 类型生成与 Astro 同步(重要) + +- Astro 的高保真类型来自 `.astro/types.d.ts`,由 `astro dev` 或 `astro sync` 生成。 +- Node 要求:`>= 18.20.8`(建议 `>= 20`)。Node 版本不足会导致 `astro sync` 失败,类型退化为 `any`(如 `getCollection(...args: any[]): any`)。 +- 操作规范: + - 在“非沙盒/本机环境”执行:`astro sync` 或 `pnpm dev`,以生成 `.astro/types.d.ts`。 + - 如在沙盒内执行需要更高权限,请先申请再运行,或直接在沙盒外执行。 + - 若类型仍不生效:删除 `.astro/` 后重跑 `pnpm sync`;确保编辑器使用工作区 TypeScript 版本。 + ### 依赖版本策略 - 版本范围由 pnpm 写入:不要在 `package.json` 手写 `latest` 或具体版本号。