mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
feat: Add --language parameter for localized content generation
Adds --language parameter to /understand command to generate knowledge graph content in user-specified language. Changes: - Update argument-hint and Options documentation in SKILL.md - Add language parsing logic in Phase 0 (language normalization, config persistence, LANGUAGE_DIRECTIVE template) - Inject language directive into agent dispatch prompts for all content-generating phases (Phase 1-5) - Add language directive handling instructions in agent definitions - Create locales/ directory with template files for: - English (en.md) - default - Chinese Simplified (zh.md) - Chinese Traditional (zh-TW.md) - Japanese (ja.md) - Korean (ko.md) Locale files provide language-specific guidance for: - Tag naming conventions - Summary writing style - Technical term handling - Layer name translations Closes #141
This commit is contained in:
@@ -14,6 +14,11 @@ You are an expert software architect. Your job is to analyze a codebase's file s
|
||||
|
||||
Given a list of file nodes (with paths, summaries, tags, and node types) and import edges, identify 3-10 logical architecture layers and assign every file node to exactly one layer. You will accomplish this in two phases: first, write and execute a script that computes structural patterns from the import graph and file paths; second, use those structural insights to make semantic layer assignments.
|
||||
|
||||
**Language directive:** If the dispatch prompt includes a language directive (e.g., "Generate all textual content in **Chinese**"), apply it to:
|
||||
- Layer `name` — Translate to the specified language (e.g., "API 层", "服务层", "基础设施层")
|
||||
- Layer `description` — Write in the specified language using natural phrasing
|
||||
Use native-level terminology. Keep established English terms when appropriate (e.g., "CI/CD", "ORM", "REST API" may remain untranslated in some languages).
|
||||
|
||||
---
|
||||
|
||||
## Phase 1 -- Structural Analysis Script
|
||||
|
||||
@@ -17,6 +17,12 @@ For each file in the batch provided to you, extract structural data via a script
|
||||
|
||||
**File categories in this batch:** Each file has a `fileCategory` field indicating its type: `code`, `config`, `docs`, `infra`, `data`, `script`, or `markup`. Adapt your analysis approach accordingly — see the category-specific guidance below.
|
||||
|
||||
**Language directive:** If the dispatch prompt includes a language directive (e.g., "Generate all textual content in **Chinese**"), apply it to ALL textual output:
|
||||
- `summary` — Write in the specified language
|
||||
- `tags` — Use localized tags when natural (e.g., Chinese tags like "入口点", "工具函数") or keep English tags for universal technical terms (e.g., "middleware", "api-handler", "test")
|
||||
- `languageNotes` — Write in the specified language when present
|
||||
Use natural, native-level phrasing. Keep technical terms in English when no standard translation exists.
|
||||
|
||||
---
|
||||
|
||||
## Phase 1 -- Structural Extraction (Bundled Script)
|
||||
|
||||
@@ -14,6 +14,8 @@ You are a meticulous project inventory specialist. Your job is to scan a codebas
|
||||
|
||||
Scan the project directory provided in the prompt and produce a JSON inventory. You will accomplish this in two phases: first, write and execute a discovery script that performs all deterministic file scanning; second, review the script's results and add a human-readable project description.
|
||||
|
||||
**Language directive:** If the dispatch prompt includes a language directive (e.g., "Generate all textual content in **Chinese**"), apply it to the `description` field you synthesize in Phase 2. Write the description in the specified language using natural, native-level phrasing. Keep technical terms in English when no standard translation exists (e.g., "middleware", "hook", "barrel").
|
||||
|
||||
---
|
||||
|
||||
## Phase 1 -- Discovery Script
|
||||
|
||||
@@ -14,6 +14,12 @@ You are an expert technical educator who designs learning paths through codebase
|
||||
|
||||
Given a codebase's nodes, edges, and layers, design a guided tour that teaches the project's architecture and key concepts. The tour must reference only real node IDs from the provided graph data. The tour should include both code and non-code files (documentation, infrastructure, data schemas) to give a complete picture of the project. You will accomplish this in two phases: first, write and execute a script that computes structural properties of the graph to identify key files and dependency paths; second, use those insights to design the pedagogical flow.
|
||||
|
||||
**Language directive:** If the dispatch prompt includes a language directive (e.g., "Generate all textual content in **Chinese**"), apply it to:
|
||||
- Tour `title` — Write in the specified language (e.g., "项目概览", "应用入口", "数据库架构")
|
||||
- Tour `description` — Write in the specified language using natural, pedagogical phrasing
|
||||
- `languageLesson` — Write in the specified language when present. Keep technical terms clear — some concepts like "generic", "closure", "decorator" may benefit from bilingual explanation (English term + local translation)
|
||||
Use native-level terminology appropriate for technical education.
|
||||
|
||||
---
|
||||
|
||||
## Phase 1 -- Graph Topology Script
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: understand
|
||||
description: Analyze a codebase to produce an interactive knowledge graph for understanding architecture, components, and relationships
|
||||
argument-hint: ["[path] [--full|--auto-update|--no-auto-update|--review]"]
|
||||
argument-hint: ["[path] [--full|--auto-update|--no-auto-update|--review|--language <lang>]"]
|
||||
---
|
||||
|
||||
# /understand
|
||||
@@ -15,6 +15,7 @@ Analyze the current codebase and produce a `knowledge-graph.json` file in `.unde
|
||||
- `--auto-update` — Enable automatic graph updates on commit (writes `autoUpdate: true` to `.understand-anything/config.json`)
|
||||
- `--no-auto-update` — Disable automatic graph updates (writes `autoUpdate: false` to `.understand-anything/config.json`)
|
||||
- `--review` — Run full LLM graph-reviewer instead of inline deterministic validation
|
||||
- `--language <lang>` — Generate all textual content (summaries, descriptions, tags, titles, languageNotes, languageLesson) in the specified language. Accepts ISO 639-1 codes (`zh`, `ja`, `ko`, `en`, `es`, `fr`, `de`, etc.) or friendly names (`chinese`, `japanese`, `korean`, `english`, `spanish`, etc.). Locale variants supported: `zh-TW`, `zh-HK`, etc. Defaults to `en` (English). Stores preference in `.understand-anything/config.json` for consistency across incremental updates.
|
||||
- A directory path (e.g. `/path/to/repo` or `../other-project`) — Analyze the given directory instead of the current working directory
|
||||
|
||||
---
|
||||
@@ -110,11 +111,27 @@ Determine whether to run a full analysis or incremental update.
|
||||
mkdir -p $PROJECT_ROOT/.understand-anything/tmp
|
||||
```
|
||||
3.5. **Auto-update configuration:**
|
||||
- If `--auto-update` is in `$ARGUMENTS`: write `{"autoUpdate": true}` to `$PROJECT_ROOT/.understand-anything/config.json`
|
||||
- If `--no-auto-update` is in `$ARGUMENTS`: write `{"autoUpdate": false}` to `$PROJECT_ROOT/.understand-anything/config.json`
|
||||
- These flags only set the config — analysis proceeds normally regardless.
|
||||
- If `--auto-update` is in `$ARGUMENTS`: write `{"autoUpdate": true}` to `$PROJECT_ROOT/.understand-anything/config.json`
|
||||
- If `--no-auto-update` is in `$ARGUMENTS`: write `{"autoUpdate": false}` to `$PROJECT_ROOT/.understand-anything/config.json`
|
||||
- These flags only set the config — analysis proceeds normally regardless.
|
||||
|
||||
4. **Check for subdomain knowledge graphs to merge:**
|
||||
3.6. **Language configuration:**
|
||||
- Parse `$ARGUMENTS` for `--language <lang>` flag. If found, extract the language code.
|
||||
- **Language code normalization:** Map friendly names to ISO codes:
|
||||
- `chinese` → `zh`, `japanese` → `ja`, `korean` → `ko`, `english` → `en`, `spanish` → `es`, `french` → `fr`, `german` → `de`, `portuguese` → `pt`, `russian` → `ru`, `arabic` → `ar`, etc.
|
||||
- Locale variants: `zh-TW`, `zh-HK`, `zh-CN`, `pt-BR`, etc. are preserved as-is.
|
||||
- If `--language` is NOT specified:
|
||||
- Check `$PROJECT_ROOT/.understand-anything/config.json` for an existing `language` field. If present, use that.
|
||||
- If no stored preference, default to `en` (English).
|
||||
- If `--language` IS specified:
|
||||
- Update `$PROJECT_ROOT/.understand-anything/config.json` with the new language: merge `{"language": "<lang>"}` into existing config.
|
||||
- Store as `$OUTPUT_LANGUAGE` for use throughout all phases.
|
||||
- **Language directive template:** Store as `$LANGUAGE_DIRECTIVE`:
|
||||
```markdown
|
||||
> **Language directive**: Generate all textual content (summaries, descriptions, tags, titles, languageNotes, languageLesson) in **{language}**. Maintain technical accuracy while using natural, native-level phrasing in the target language. Keep technical terms in English when no standard translation exists (e.g., "middleware", "hook", "barrel").
|
||||
```
|
||||
|
||||
4. **Check for subdomain knowledge graphs to merge:**
|
||||
List all `*knowledge-graph*.json` files in `$PROJECT_ROOT/.understand-anything/` **excluding** `knowledge-graph.json` itself (e.g. `frontend-knowledge-graph.json`, `backend-knowledge-graph.json`). If any subdomain graphs exist, run the merge script bundled with this skill (located next to this SKILL.md file — use the skill directory path, not the project root):
|
||||
```bash
|
||||
python <SKILL_DIR>/merge-subdomain-graphs.py $PROJECT_ROOT
|
||||
@@ -211,6 +228,8 @@ Dispatch a subagent using the `project-scanner` agent definition (at `agents/pro
|
||||
> ```
|
||||
>
|
||||
> Use this context to produce more accurate project name, description, and framework detection. The README and manifest are authoritative — prefer their information over heuristics.
|
||||
>
|
||||
> $LANGUAGE_DIRECTIVE
|
||||
|
||||
Pass these parameters in the dispatch prompt:
|
||||
|
||||
@@ -257,6 +276,8 @@ For each batch, dispatch a subagent using the `file-analyzer` agent definition (
|
||||
>
|
||||
> Project: `<projectName>` — `<projectDescription>`
|
||||
> Languages: `<languages from Phase 1>`
|
||||
>
|
||||
> $LANGUAGE_DIRECTIVE
|
||||
|
||||
Before dispatching each batch, construct `batchImportData` from `$IMPORT_MAP`:
|
||||
```json
|
||||
@@ -348,9 +369,10 @@ After the subagent completes, read `$PROJECT_ROOT/.understand-anything/intermedi
|
||||
## Phase 4 — ARCHITECTURE
|
||||
|
||||
**Build the combined prompt template:**
|
||||
1. Use the `architecture-analyzer` agent definition (at `agents/architecture-analyzer.md`).
|
||||
2. **Language context injection:** For each language detected in Phase 1 (e.g., `python`, `markdown`, `dockerfile`, `yaml`, `sql`, `terraform`, `graphql`, `protobuf`, `shell`, `html`, `css`), read the file at `./languages/<language-id>.md` (e.g., `./languages/python.md`, `./languages/dockerfile.md`) and append its content after the base template under a `## Language Context` header. If the file does not exist for a detected language, skip it silently and continue. These files are in the `languages/` subdirectory next to this SKILL.md file. **Include non-code language snippets** — they provide edge patterns and summary styles for non-code files.
|
||||
3. **Framework addendum injection:** For each framework detected in Phase 1 (e.g., `Django`), read the file at `./frameworks/<framework-id-lowercase>.md` (e.g., `./frameworks/django.md`) and append its full content after the language context. If the file does not exist for a detected framework, skip it silently and continue. These files are in the `frameworks/` subdirectory next to this SKILL.md file.
|
||||
1. Use the `architecture-analyzer` agent definition (at `agents/architecture-analyzer.md`).
|
||||
2. **Language context injection:** For each language detected in Phase 1 (e.g., `python`, `markdown`, `dockerfile`, `yaml`, `sql`, `terraform`, `graphql`, `protobuf`, `shell`, `html`, `css`), read the file at `./languages/<language-id>.md` (e.g., `./languages/python.md`, `./languages/dockerfile.md`) and append its content after the base template under a `## Language Context` header. If the file does not exist for a detected language, skip it silently and continue. These files are in the `languages/` subdirectory next to this SKILL.md file. **Include non-code language snippets** — they provide edge patterns and summary styles for non-code files.
|
||||
3. **Framework addendum injection:** For each framework detected in Phase 1 (e.g., `Django`), read the file at `./frameworks/<framework-id-lowercase>.md` (e.g., `./frameworks/django.md`) and append its full content after the language context. If the file does not exist for a detected framework, skip it silently and continue. These files are in the `frameworks/` subdirectory next to this SKILL.md file.
|
||||
4. **Output locale injection:** If `$OUTPUT_LANGUAGE` is NOT `en` (English), read the locale guidance file at `./locales/<language-code>.md` (e.g., `./locales/zh.md`, `./locales/ja.md`, `./locales/ko.md`) and append its content after the framework addendums under a `## Output Language Guidelines` header. This provides language-specific guidance for tag naming conventions, summary style, and layer name translations. If the locale file does not exist for the specified language, skip silently — the `$LANGUAGE_DIRECTIVE` still applies. These files are in the `locales/` subdirectory next to this SKILL.md file.
|
||||
|
||||
Append the language/framework context and the following additional context to the agent's prompt:
|
||||
|
||||
@@ -364,6 +386,8 @@ Append the language/framework context and the following additional context to th
|
||||
> ```
|
||||
>
|
||||
> Use the directory tree, language context, and framework addendums (appended above) to inform layer assignments. Directory structure is strong evidence for layer boundaries. Non-code files (config, docs, infrastructure, data) should be assigned to appropriate layers — see the prompt template for guidance.
|
||||
>
|
||||
> $LANGUAGE_DIRECTIVE
|
||||
|
||||
Pass these parameters in the dispatch prompt:
|
||||
|
||||
@@ -437,6 +461,8 @@ Dispatch a subagent using the `tour-builder` agent definition (at `agents/tour-b
|
||||
> Project entry point: `$ENTRY_POINT`
|
||||
>
|
||||
> Use the README to align the tour narrative with the project's own documentation. Start the tour from the entry point if one was detected. The tour should tell the same story the README tells, but through the lens of actual code structure.
|
||||
>
|
||||
> $LANGUAGE_DIRECTIVE
|
||||
|
||||
Pass these parameters in the dispatch prompt:
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# English Output Guidelines
|
||||
|
||||
This file provides language-specific guidance for generating knowledge graph content in English.
|
||||
|
||||
## Tag Conventions
|
||||
|
||||
Use lowercase, hyphenated tags in English:
|
||||
|
||||
| Pattern | Recommended Tags |
|
||||
|---------|-----------------|
|
||||
| Entry point file | `entry-point`, `barrel`, `exports` |
|
||||
| Utility functions | `utility`, `helpers`, `common` |
|
||||
| API handlers | `api-handler`, `controller`, `endpoint` |
|
||||
| Data models | `data-model`, `entity`, `schema` |
|
||||
| Test files | `test`, `spec`, `unit-test` |
|
||||
| Configuration | `configuration`, `build-system`, `settings` |
|
||||
| Infrastructure | `infrastructure`, `deployment`, `containerization` |
|
||||
| Documentation | `documentation`, `guide`, `reference` |
|
||||
|
||||
## Summary Style
|
||||
|
||||
Write 1-2 sentence summaries that:
|
||||
- Describe **purpose** and **role** in the project
|
||||
- Use active voice ("Provides...", "Handles...", "Manages...")
|
||||
- Avoid restating the filename
|
||||
|
||||
**Examples:**
|
||||
- Good: "Provides date formatting and string sanitization helpers used across the API layer."
|
||||
- Bad: "The utils file contains utility functions."
|
||||
|
||||
## Technical Terms
|
||||
|
||||
Keep these terms in English (no translation needed):
|
||||
- `middleware`, `hook`, `barrel`, `entry-point`
|
||||
- `ORM`, `REST API`, `CI/CD`, `CRUD`
|
||||
- `singleton`, `factory`, `observer`
|
||||
- `middleware`, `interceptor`, `guard`
|
||||
|
||||
## Layer Names
|
||||
|
||||
Use standard English layer names:
|
||||
- `API Layer`, `Service Layer`, `Data Layer`, `UI Layer`
|
||||
- `Infrastructure`, `Configuration`, `Documentation`
|
||||
- `Utility Layer`, `Middleware Layer`, `Test Layer`
|
||||
@@ -0,0 +1,49 @@
|
||||
# 日本語出力ガイドライン (Japanese)
|
||||
|
||||
本ファイルは、日本語でナレッジグラフコンテンツを生成する際の言語固有のガイドラインを提供します。
|
||||
|
||||
## タグの命名規則
|
||||
|
||||
日本語タグまたは英語の一般的な技術用語を使用:
|
||||
|
||||
| パターン | 推奨タグ |
|
||||
|---------|---------|
|
||||
| エントリーポイント | `入口点`, `barrel`, `exports` または `entry-point` |
|
||||
| ユーティリティ | `ユーティリティ`, `helpers`, `utility` |
|
||||
| APIハンドラー | `api-handler`, `controller`, `endpoint` |
|
||||
| データモデル | `データモデル`, `entity`, `schema` または `data-model` |
|
||||
| テストファイル | `テスト`, `unit-test`, `test` |
|
||||
| 設定ファイル | `設定`, `build-system`, `configuration` |
|
||||
| インフラ | `インフラ`, `deployment`, `infrastructure` |
|
||||
| ドキュメント | `ドキュメント`, `guide`, `documentation` |
|
||||
|
||||
**混合戦略:** 一般的な技術用語は英語を保持(`middleware`, `api-handler`など)、説明用タグは日本語を使用可能。
|
||||
|
||||
## サマリーのスタイル
|
||||
|
||||
1-2文のサマリーを日本語で記述:
|
||||
- ファイルの**目的**と**役割**を説明
|
||||
- 能動態を使用(「提供する...」「処理する...」「管理する...」)
|
||||
- ファイル名の繰り返しを避ける
|
||||
|
||||
**例:**
|
||||
- 良い: "API層全体で使用される日付フォーマットと文字列サニタイズのヘルパー関数を提供。"
|
||||
- 悪い: "utilsファイルにはユーティリティ関数が含まれています。"
|
||||
|
||||
## 技術用語
|
||||
|
||||
以下の用語は英語を保持(標準翻訳がない場合):
|
||||
- `middleware`, `hook`, `barrel`, `entry-point`
|
||||
- `ORM`, `REST API`, `CI/CD`, `CRUD`
|
||||
- `singleton`, `factory`, `observer`
|
||||
- `interceptor`, `guard`
|
||||
|
||||
## レイヤー名
|
||||
|
||||
日本語のレイヤー名を使用:
|
||||
- `API層`, `サービス層`, `データ層`, `UI層`
|
||||
- `インフラ`, `設定`, `ドキュメント`
|
||||
- `ユーティリティ層`, `ミドルウェア層`, `テスト層`
|
||||
|
||||
または英語を保持(チームの慣習に従う):
|
||||
- `API Layer`, `Service Layer`, `Data Layer`
|
||||
@@ -0,0 +1,49 @@
|
||||
# 한국어 출력 가이드라인 (Korean)
|
||||
|
||||
이 파일은 한국어로 지식 그래프 콘텐츠를 생성할 때의 언어별 가이드를 제공합니다.
|
||||
|
||||
## 태그 명명 규칙
|
||||
|
||||
한국어 태그 또는 영어 일반 기술 용어 사용:
|
||||
|
||||
| 패턴 | 추천 태그 |
|
||||
|------|---------|
|
||||
| 진입점 파일 | `진입점`, `barrel`, `exports` 또는 `entry-point` |
|
||||
| 유틸리티 함수 | `유틸리티`, `helpers`, `utility` |
|
||||
| API 핸들러 | `api-handler`, `controller`, `endpoint` |
|
||||
| 데이터 모델 | `데이터모델`, `entity`, `schema` 또는 `data-model` |
|
||||
| 테스트 파일 | `테스트`, `unit-test`, `test` |
|
||||
| 설정 파일 | `설정`, `build-system`, `configuration` |
|
||||
| 인프라 | `인프라`, `deployment`, `infrastructure` |
|
||||
| 문서 | `문서`, `guide`, `documentation` |
|
||||
|
||||
**혼합 전략:** 일반 기술 용어는 영어 유지 (`middleware`, `api-handler` 등), 설명용 태그는 한국어 사용 가능.
|
||||
|
||||
## 요약 스타일
|
||||
|
||||
1-2문장 요약을 한국어로 작성:
|
||||
- 파일의 **목적**과 **역할** 설명
|
||||
- 능동태 사용 ("제공하는...", "처리하는...", "관리하는...")
|
||||
- 파일명 반복 피하기
|
||||
|
||||
**예시:**
|
||||
- 좋음: "API 레이어 전체에서 사용되는 날짜 포맷 및 문자열 정제 헬per 함수를 제공."
|
||||
- 나쁨: "utils 파일에는 유틸리티 함수가 포함되어 있습니다."
|
||||
|
||||
## 기술 용어
|
||||
|
||||
다음 용어는 영어 유지 (표준 번역 없음):
|
||||
- `middleware`, `hook`, `barrel`, `entry-point`
|
||||
- `ORM`, `REST API`, `CI/CD`, `CRUD`
|
||||
- `singleton`, `factory`, `observer`
|
||||
- `interceptor`, `guard`
|
||||
|
||||
## 레이어 이름
|
||||
|
||||
한국어 레이어 이름 사용:
|
||||
- `API 레이어`, `서비스 레이어`, `데이터 레이어`, `UI 레이어`
|
||||
- `인프라`, `설정`, `문서`
|
||||
- `유틸리티 레이어`, `미들웨어 레이어`, `테스트 레이어`
|
||||
|
||||
또는 영어 유지 (팀 관습에 따라):
|
||||
- `API Layer`, `Service Layer`, `Data Layer`
|
||||
@@ -0,0 +1,49 @@
|
||||
# 繁體中文輸出指南 (Chinese Traditional)
|
||||
|
||||
本文件提供生成繁體中文知識圖譜內容的語言指導。
|
||||
|
||||
## 標籤約定
|
||||
|
||||
推薦使用繁體中文標籤或英文通用技術術語:
|
||||
|
||||
| 模式 | 推薦標籤 |
|
||||
|------|---------|
|
||||
| 入口檔案 | `入口點`, `barrel`, `匯出` 或 `entry-point` |
|
||||
| 工具函數 | `工具函數`, `helpers`, `common` 或 `utility` |
|
||||
| API處理器 | `api-handler`, `控制器`, `端點` |
|
||||
| 資料模型 | `資料模型`, `entity`, `schema` 或 `data-model` |
|
||||
| 測試檔案 | `測試`, `單元測試`, `test` |
|
||||
| 設定檔 | `設定`, `建構系統`, `settings` 或 `configuration` |
|
||||
| 基礎架構 | `基礎架構`, `部署`, `容器化` 或 `infrastructure` |
|
||||
| 文件 | `文件`, `指南`, `參考` 或 `documentation` |
|
||||
|
||||
**混合策略:** 通用技術術語保留英文(如 `middleware`, `api-handler`),描述性標籤可使用繁體中文。
|
||||
|
||||
## 摘要風格
|
||||
|
||||
用繁體中文撰寫1-2句摘要:
|
||||
- 描述檔案的**目的**和**作用**
|
||||
- 使用主動語態("提供...", "處理...", "管理...")
|
||||
- 避免重複檔名
|
||||
|
||||
**範例:**
|
||||
- 好: "提供日期格式化和字串清洗工具函數,被 API 層廣泛使用。"
|
||||
- 差: "utils 檔案包含工具函數。"
|
||||
|
||||
## 技術術語
|
||||
|
||||
以下術語建議保留英文(暫無標準翻譯):
|
||||
- `middleware`, `hook`, `barrel`, `entry-point`
|
||||
- `ORM`, `REST API`, `CI/CD`, `CRUD`
|
||||
- `singleton`, `factory`, `observer`
|
||||
- `interceptor`, `guard`
|
||||
|
||||
## 層級名稱
|
||||
|
||||
使用繁體中文層級名稱:
|
||||
- `API 層`, `服務層`, `資料層`, `UI 層`
|
||||
- `基礎架構`, `設定`, `文件`
|
||||
- `工具層`, `中介軟體層`, `測試層`
|
||||
|
||||
或保留英文(根據團隊習慣):
|
||||
- `API Layer`, `Service Layer`, `Data Layer`
|
||||
@@ -0,0 +1,49 @@
|
||||
# 中文输出指南 (Chinese Simplified)
|
||||
|
||||
本文件提供生成中文知识图谱内容的语言指导。
|
||||
|
||||
## 标签约定
|
||||
|
||||
推荐使用中文标签或英文通用技术术语:
|
||||
|
||||
| 模式 | 推荐标签 |
|
||||
|------|---------|
|
||||
| 入口文件 | `入口点`, `barrel`, `导出` 或 `entry-point` |
|
||||
| 工具函数 | `工具函数`, `helpers`, `common` 或 `utility` |
|
||||
| API处理器 | `api-handler`, `控制器`, `端点` |
|
||||
| 数据模型 | `数据模型`, `entity`, `schema` 或 `data-model` |
|
||||
| 测试文件 | `测试`, `单元测试`, `test` |
|
||||
| 配置文件 | `配置`, `构建系统`, `settings` 或 `configuration` |
|
||||
| 基础设施 | `基础设施`, `部署`, `容器化` 或 `infrastructure` |
|
||||
| 文档 | `文档`, `指南`, `参考` 或 `documentation` |
|
||||
|
||||
**混合策略:** 通用技术术语保留英文(如 `middleware`, `api-handler`),描述性标签可使用中文。
|
||||
|
||||
## 摘要风格
|
||||
|
||||
用中文撰写1-2句摘要:
|
||||
- 描述文件的**目的**和**作用**
|
||||
- 使用主动语态("提供...", "处理...", "管理...")
|
||||
- 避免重复文件名
|
||||
|
||||
**示例:**
|
||||
- 好: "提供日期格式化和字符串清洗工具函数,被 API 层广泛使用。"
|
||||
- 差: "utils 文件包含工具函数。"
|
||||
|
||||
## 技术术语
|
||||
|
||||
以下术语建议保留英文(暂无标准翻译):
|
||||
- `middleware`, `hook`, `barrel`, `entry-point`
|
||||
- `ORM`, `REST API`, `CI/CD`, `CRUD`
|
||||
- `singleton`, `factory`, `observer`
|
||||
- `interceptor`, `guard`
|
||||
|
||||
## 层级名称
|
||||
|
||||
使用中文层级名称:
|
||||
- `API 层`, `服务层`, `数据层`, `UI 层`
|
||||
- `基础设施`, `配置`, `文档`
|
||||
- `工具层`, `中间件层`, `测试层`
|
||||
|
||||
或保留英文(根据团队习惯):
|
||||
- `API Layer`, `Service Layer`, `Data Layer`
|
||||
Reference in New Issue
Block a user