首页
/ Project: My Awesome TypeScript Library

Project: My Awesome TypeScript Library

2026-09-06 17:33:15作者:虞亚竹Luna

General Instructions:

  • When generating new TypeScript code, follow the existing coding style.
  • Ensure all new functions and classes have JSDoc comments.
  • Prefer functional programming paradigms where appropriate.
  • All code should be compatible with TypeScript 5.0 and Node.js 20+.

Coding Style:

  • Use 2 spaces for indentation.
  • Interface names should be prefixed with I (for example, IUserService).
  • Private class members should be prefixed with an underscore (_).
  • Always use strict equality (=== and !==).

Specific Component: src/api/client.ts

  • This file handles all outbound API requests.
  • When adding new API call functions, ensure they include robust error handling and logging.
  • Use the existing fetchWithRetry utility for all GET requests.

Regarding Dependencies:

  • Avoid introducing new external dependencies unless absolutely necessary.
  • If a new dependency is required, state the reason.

**层级加载与优先级**:CLI 实现了精细的层级记忆系统,从多处加载上下文文件;列表中越靠下(越具体)的内容通常覆盖或补充更靠上(更通用)的内容。可用 `/memory show` 命令检查最终拼接顺序与上下文内容。典型加载顺序:

1. **全局上下文文件**:`~/.gemini/<configured-context-filename>`(例如 `~/.gemini/GEMINI.md`)。作用域:为所有项目提供默认指令。
2. **项目根及祖先目录上下文文件**:CLI 从当前工作目录开始逐级向上查找,直到项目根(以 `.git` 标识)或主目录。作用域:覆盖整个项目或其中重要部分的上下文。
3. **子目录上下文文件(上下文/局部)**:CLI 还会扫描当前工作目录**以下**的子目录(尊重 `node_modules`、`.git` 等常见忽略模式)。搜索广度默认限制为 200 个目录,可用 `context.discoveryMaxDirs` 配置。作用域:针对特定组件、模块或子部分的精细指令。

**拼接与 UI 提示**:所有找到的上下文文件内容会被拼接(以分隔符标明来源与路径)并作为系统提示词的一部分提供给模型;页脚显示已加载上下文文件计数。

**内容导入**:可用 `@path/to/file.md` 语法导入其他 Markdown 文件来模块化上下文文件,详见 [Memory Import Processor 文档](https://gitcode.com/GitHub_Trending/gemi/gemini-cli/blob/3c311beac2e78336816dd4a123db39743f9fbf85/docs/reference/memport.md?utm_source=gitcode_repo_files)。

**memory 管理命令**:

- `/memory refresh`:强制重新扫描并重新加载所有位置的上下文文件,更新 AI 的指令上下文。
- `/memory show`:显示当前加载的组合指令上下文,便于核对层级与内容。
- 完整 `/memory` 子命令说明见 [Commands 文档](https://gitcode.com/GitHub_Trending/gemi/gemini-cli/blob/3c311beac2e78336816dd4a123db39743f9fbf85/docs/reference/commands.md?utm_source=gitcode_repo_files)。

## 九、使用统计

为改进 Gemini CLI,官方会收集匿名使用统计,以了解使用方式、定位常见问题并优先排期新特性。

**收集内容:**

- **工具调用**:记录被调用工具的名称、成功与否及执行耗时;不收集传给工具的参数及其返回数据。
- **API 请求**:记录每次请求使用的 Gemini 模型、耗时及是否成功;不收集提示词或响应的内容。
- **会话信息**:CLI 配置信息,如启用的工具与审批模式。

**明确不收集:**

- 任何个人身份信息(PII):姓名、邮箱、API 密钥等;
- 提示词与模型响应的内容;
- CLI 读取或写入的任何文件内容。

**如何退出:** 在 `settings.json` 的 `privacy` 类别中将 `usageStatisticsEnabled` 设为 `false`:

```json
{
  "privacy": {
    "usageStatisticsEnabled": false
  }
}
登录后查看全文
热门项目推荐
相关项目推荐