pgpm-module-naming
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePGPM Module Naming: npm Names vs Control File Names
PGPM模块命名:npm名称 vs 控制文件名
pgpm modules have two different identifiers that serve different purposes. Understanding when to use each is critical for correct dependency management.
pgpm模块有两种作用不同的标识符,了解各自的使用时机对正确进行依赖管理至关重要。
When to Apply
适用场景
Use this skill when:
- Creating or editing files
.control - Writing statements in SQL deploy files
-- requires: - Running commands
pgpm install - Referencing dependencies between modules
- Publishing modules to npm
在以下场景中使用本指南:
- 创建或编辑文件
.control - 在SQL部署文件中编写语句
-- requires: - 运行命令
pgpm install - 引用模块之间的依赖
- 发布模块到npm
The Two Identifiers
两种标识符
Every pgpm module has two names:
每个pgpm模块都有两个名称:
1. npm Package Name (for distribution)
1. npm包名(用于分发)
Defined in as the field. Used for npm distribution and the command.
package.jsonnamepgpm installFormat: (scoped) or (unscoped)
@scope/package-namepackage-nameExamples:
@sf-bot/rag-core@san-francisco/sf-docs-embeddings@pgpm/base32
在的字段中定义,用于npm分发和命令。
package.jsonnamepgpm install格式: (作用域格式)或(无作用域格式)
@scope/package-namepackage-name示例:
@sf-bot/rag-core@san-francisco/sf-docs-embeddings@pgpm/base32
2. Control File Name / Extension Name (for PostgreSQL)
2. 控制文件名/扩展名称(用于PostgreSQL)
Defined by the filename and in . Used in PostgreSQL extension system and SQL dependency declarations.
.control%project=pgpm.planFormat: (no scope, no @ symbol)
module-nameExamples:
rag-coresf-docs-embeddingspgpm-base32
由文件名和中的定义,用于PostgreSQL扩展系统和SQL依赖声明。
.controlpgpm.plan%project=格式: (无作用域,无@符号)
module-name示例:
rag-coresf-docs-embeddingspgpm-base32
When to Use Each
各自的适用场景
Use npm Package Name (@scope/name
)
@scope/name使用npm包名(@scope/name
)的场景
@scope/name1. pgpm install command:
bash
pgpm install @sf-bot/rag-core @sf-bot/rag-functions @sf-bot/rag-indexes2. package.json dependencies:
json
{
"dependencies": {
"@sf-bot/rag-core": "^0.0.3"
}
}1. pgpm install命令:
bash
pgpm install @sf-bot/rag-core @sf-bot/rag-functions @sf-bot/rag-indexes2. package.json依赖:
json
{
"dependencies": {
"@sf-bot/rag-core": "^0.0.3"
}
}Use Control File Name (name
)
name使用控制文件名(name
)的场景
name1. .control file requires line:
sh
undefined1. .control文件的requires行:
sh
undefinedsf-docs-embeddings.control
sf-docs-embeddings.control
requires = 'rag-core'
**2. SQL deploy file requires comments:**
```sql
-- Deploy data/seed_collection to pg
-- requires: rag-core3. pgpm.plan %project declaration:
sh
%project=sf-docs-embeddings4. Cross-package references in pgpm.plan:
sh
data/seed [rag-core:schemas/rag/schema] 2026-01-25T00:00:00Z Author <author@example.com>requires = 'rag-core'
**2. SQL部署文件的requires注释:**
```sql
-- Deploy data/seed_collection to pg
-- requires: rag-core3. pgpm.plan的%project声明:
sh
%project=sf-docs-embeddings4. pgpm.plan中的跨包引用:
sh
data/seed [rag-core:schemas/rag/schema] 2026-01-25T00:00:00Z Author <author@example.com>Real-World Example
实际示例
Consider the module:
sf-docs-embeddingspackage.json (npm name for distribution):
json
{
"name": "@san-francisco/sf-docs-embeddings",
"version": "0.0.3"
}sf-docs-embeddings.control (control name for PostgreSQL):
sh
undefined以模块为例:
sf-docs-embeddingspackage.json(用于分发的npm名称):
json
{
"name": "@san-francisco/sf-docs-embeddings",
"version": "0.0.3"
}sf-docs-embeddings.control(用于PostgreSQL的控制文件名):
sh
undefinedsf-docs-embeddings extension
sf-docs-embeddings extension
comment = 'San Francisco documentation embeddings'
default_version = '0.0.1'
requires = 'rag-core'
**pgpm.plan** (control name for project):
```sh
%project=sf-docs-embeddingsdeploy/data/seed_collection.sql (control name in requires):
sql
-- Deploy data/seed_collection to pg
-- requires: rag-corecomment = 'San Francisco documentation embeddings'
default_version = '0.0.1'
requires = 'rag-core'
**pgpm.plan**(用于项目的控制文件名):
```sh
%project=sf-docs-embeddingsdeploy/data/seed_collection.sql(requires语句中的控制文件名):
sql
-- Deploy data/seed_collection to pg
-- requires: rag-coreThe Mapping
映射关系
pgpm maintains an internal mapping between control names and npm names. When you run , it:
pgpm install- Reads the file's
.controllist (control names)requires - Maps those to npm package names
- Installs the npm packages
For example, if your has , pgpm knows to install from npm.
.controlrequires = 'pgpm-base32'@pgpm/base32pgpm会在内部维护控制文件名和npm名称之间的映射。当你运行时,它会:
pgpm install- 读取文件的
.control列表(控制文件名)requires - 将这些名称映射为npm包名
- 安装对应的npm包
例如,如果你的文件中有,pgpm会自动识别需要从npm安装。
.controlrequires = 'pgpm-base32'@pgpm/base32Common Mistakes
常见错误
Wrong: Using npm name in .control file
错误:在.control文件中使用npm名称
sh
undefinedsh
undefinedWRONG
错误写法
requires = '@sf-bot/rag-core'
requires = '@sf-bot/rag-core'
CORRECT
正确写法
requires = 'rag-core'
undefinedrequires = 'rag-core'
undefinedWrong: Using control name in pgpm install
错误:在pgpm install中使用控制文件名
bash
undefinedbash
undefinedWRONG
错误写法
pgpm install rag-core
pgpm install rag-core
CORRECT
正确写法
pgpm install @sf-bot/rag-core
undefinedpgpm install @sf-bot/rag-core
undefinedWrong: Using npm name in SQL requires
错误:在SQL requires语句中使用npm名称
sql
-- WRONG
-- requires: @sf-bot/rag-core
-- CORRECT
-- requires: rag-coresql
-- 错误写法
-- requires: @sf-bot/rag-core
-- 正确写法
-- requires: rag-coreQuick Reference Table
快速参考表
| Context | Use | Example |
|---|---|---|
| npm name | |
| npm name | |
| npm name | |
| control name | |
SQL | control name | |
| control name | |
| Cross-package deps | control name | |
| 场景 | 使用名称类型 | 示例 |
|---|---|---|
| npm名称 | |
| npm名称 | |
| npm名称 | |
| 控制文件名 | |
SQL | 控制文件名 | |
| 控制文件名 | |
| 跨包依赖 | 控制文件名 | |
Summary
总结
- npm names (): Used for distribution and installation via npm/pgpm install
@scope/name - Control names (): Used for PostgreSQL extension system, .control files, and SQL dependency declarations
name
Think of it this way: npm names are for the JavaScript/npm ecosystem, control names are for the PostgreSQL ecosystem.
- npm名称():用于通过npm/pgpm install进行分发和安装
@scope/name - 控制文件名():用于PostgreSQL扩展系统、.control文件和SQL依赖声明
name
可以这么理解:npm名称适用于JavaScript/npm生态,控制文件名适用于PostgreSQL生态。
References
参考
- Related skill: for CLI commands
pgpm-cli - Related skill: for workspace structure
pgpm-workspace - Related skill: for authoring database changes
pgpm-changes
- 相关技能:CLI命令相关的
pgpm-cli - 相关技能:工作区结构相关的
pgpm-workspace - 相关技能:数据库变更编写相关的
pgpm-changes