Skip to content

Commit d234bfa

Browse files
Copilothotlong
andcommitted
Clarify naming conventions for package vs code-level identifiers
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 2827c87 commit d234bfa

1 file changed

Lines changed: 37 additions & 7 deletions

File tree

content/docs/developers/plugin-ecosystem.mdx

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ const capabilities: PluginCapabilityManifest = {
223223

224224
## 📝 命名规范 / Naming Conventions
225225

226+
### 概述 / Overview
227+
228+
ObjectStack 采用不同的命名约定来区分**包级标识符**(用于分发和安装)和**代码级标识符**(用于服务和数据访问)。
229+
230+
ObjectStack uses different naming conventions to distinguish between **package-level identifiers** (for distribution and installation) and **code-level identifiers** (for services and data access).
231+
226232
### 1. 插件标识符 / Plugin Identifiers
227233

228234
**格式 / Format:**
@@ -233,16 +239,16 @@ const capabilities: PluginCapabilityManifest = {
233239
**规则 / Rules:**
234240
- 使用反向域名表示法 / Use reverse domain notation
235241
- 全小写字母 / All lowercase
236-
- 使用连字符分隔单词 / Use hyphens for word separation
242+
- 使用连字符分隔单词(NPM 包命名约定)/ Use hyphens for word separation (NPM package naming convention)
237243
- 避免使用下划线和驼峰命名 / Avoid underscores and camelCase
238244

239245
**示例 / Examples:**
240246
```
241247
✅ com.objectstack.driver.postgres
242248
✅ com.acme.crm.customer-management
243249
✅ org.apache.kafka.connector
244-
❌ com.acme.CRM (不要使用大写)
245-
❌ com.acme.crm_plugin (不要使用下划线)
250+
❌ com.acme.CRM (不要使用大写 / Do not use uppercase)
251+
❌ com.acme.crm_plugin (不要使用下划线 / Do not use underscores)
246252
```
247253

248254
### 2. 协议标识符 / Protocol Identifiers
@@ -266,10 +272,15 @@ com.acme.protocol.payment.stripe.v1
266272
{plugin-id}.interface.{interface-name}
267273
```
268274

275+
**规则 / Rules:**
276+
- 接口名称使用 snake_case(与代码中的服务名一致)/ Use snake_case for interface names (consistent with service names in code)
277+
- 遵循 ObjectStack 数据层命名约定 / Follow ObjectStack data layer naming convention
278+
269279
**示例 / Examples:**
270280
```
271-
com.acme.crm.interface.contact_service
272-
com.acme.analytics.interface.metrics_collector
281+
✅ com.acme.crm.interface.contact_service
282+
✅ com.acme.analytics.interface.metrics_collector
283+
✅ com.acme.auth.interface.user_provider
273284
```
274285

275286
### 4. 扩展点标识符 / Extension Point Identifiers
@@ -279,12 +290,31 @@ com.acme.analytics.interface.metrics_collector
279290
{plugin-id}.extension.{extension-name}
280291
```
281292

293+
**规则 / Rules:**
294+
- 扩展点名称使用 snake_case(与方法/函数命名一致)/ Use snake_case for extension names (consistent with method/function naming)
295+
282296
**示例 / Examples:**
283297
```
284-
com.acme.crm.extension.contact_validator
285-
com.acme.app.extension.theme_provider
298+
✅ com.acme.crm.extension.contact_validator
299+
✅ com.acme.app.extension.theme_provider
300+
✅ com.acme.crm.extension.customer_enrichment
286301
```
287302

303+
### 命名约定总结 / Naming Convention Summary
304+
305+
| 类型 Type | 格式 Format | 分隔符 Separator | 示例 Example |
306+
|----------|------------|----------------|--------------|
307+
| 插件 ID<br/>Plugin ID | `{domain}.{category}.{name}` | kebab-case (hyphens) | `com.acme.crm.customer-management` |
308+
| 协议 ID<br/>Protocol ID | `{domain}.protocol.{name}.v{N}` | kebab-case | `com.objectstack.protocol.storage.v1` |
309+
| 接口 ID<br/>Interface ID | `{plugin}.interface.{name}` | snake_case | `com.acme.crm.interface.contact_service` |
310+
| 扩展点 ID<br/>Extension ID | `{plugin}.extension.{name}` | snake_case | `com.acme.crm.extension.contact_validator` |
311+
312+
**重要说明 / Important Notes:**
313+
- **包级标识符**(插件、协议)使用 kebab-case,符合 NPM 包命名约定
314+
- **代码级标识符**(接口、扩展点)使用 snake_case,与 ObjectStack 数据层命名一致
315+
- **Package-level identifiers** (plugins, protocols) use kebab-case, following NPM package naming convention
316+
- **Code-level identifiers** (interfaces, extensions) use snake_case, consistent with ObjectStack data layer naming
317+
288318
---
289319

290320
## 🔄 插件发现与注册 / Plugin Discovery & Registry

0 commit comments

Comments
 (0)