mirror of
https://github.com/sweetwisdom/everything-claude-code-zh.git
synced 2026-03-22 06:20:10 +00:00
docs: 完成所有文档的中文翻译并应用到项目
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
# Plugin Manifest Schema Notes
|
||||
# 插件清单模式(Manifest Schema)注意事项
|
||||
|
||||
This document captures **undocumented but enforced constraints** of the Claude Code plugin manifest validator.
|
||||
本文档记录了 Claude Code 插件清单校验器中**未见于文档但强制执行的约束**。
|
||||
|
||||
These rules are based on real installation failures, validator behavior, and comparison with known working plugins.
|
||||
They exist to prevent silent breakage and repeated regressions.
|
||||
这些规则基于真实的安装失败案例、校验器行为以及与已知可用插件的对比。
|
||||
设置这些规则是为了防止隐性故障和重复的回归问题。
|
||||
|
||||
If you edit `.claude-plugin/plugin.json`, read this first.
|
||||
如果你编辑 `.claude-plugin/plugin.json`,请先阅读本文。
|
||||
|
||||
---
|
||||
|
||||
## Summary (Read This First)
|
||||
## 摘要(优先阅读)
|
||||
|
||||
The Claude plugin manifest validator is **strict and opinionated**.
|
||||
It enforces rules that are not fully documented in public schema references.
|
||||
Claude 插件清单校验器**极其严格且具有主观性**。
|
||||
它执行了一些在公开模式(Schema)参考文档中未完全说明的规则。
|
||||
|
||||
The most common failure mode is:
|
||||
最常见的失败模式是:
|
||||
|
||||
> The manifest looks reasonable, but the validator rejects it with vague errors like
|
||||
> 清单看起来很合理,但校验器以模糊的错误拒绝它,例如:
|
||||
> `agents: Invalid input`
|
||||
|
||||
This document explains why.
|
||||
本文档将解释其原因。
|
||||
|
||||
---
|
||||
|
||||
## Required Fields
|
||||
## 必填字段
|
||||
|
||||
### `version` (MANDATORY)
|
||||
### `version`(强制性)
|
||||
|
||||
The `version` field is required by the validator even if omitted from some examples.
|
||||
即便在某些示例中被省略,校验器也要求必须包含 `version` 字段。
|
||||
|
||||
If missing, installation may fail during marketplace install or CLI validation.
|
||||
如果缺失,在应用市场安装或 CLI 校验期间可能会失败。
|
||||
|
||||
Example:
|
||||
示例:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -41,18 +41,18 @@ Example:
|
||||
|
||||
---
|
||||
|
||||
## Field Shape Rules
|
||||
## 字段形态规则
|
||||
|
||||
The following fields **must always be arrays**:
|
||||
以下字段**必须始终为数组(Arrays)**:
|
||||
|
||||
* `agents`
|
||||
* `commands`
|
||||
* `skills`
|
||||
* `hooks` (if present)
|
||||
* `hooks`(如果存在)
|
||||
|
||||
Even if there is only one entry, **strings are not accepted**.
|
||||
即便只有一个条目,**也不接受字符串(Strings)**。
|
||||
|
||||
### Invalid
|
||||
### 错误写法(Invalid)
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -60,7 +60,7 @@ Even if there is only one entry, **strings are not accepted**.
|
||||
}
|
||||
```
|
||||
|
||||
### Valid
|
||||
### 正确写法(Valid)
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -68,17 +68,17 @@ Even if there is only one entry, **strings are not accepted**.
|
||||
}
|
||||
```
|
||||
|
||||
This applies consistently across all component path fields.
|
||||
这适用于所有组件路径字段。
|
||||
|
||||
---
|
||||
|
||||
## Path Resolution Rules (Critical)
|
||||
## 路径解析规则(至关重要)
|
||||
|
||||
### Agents MUST use explicit file paths
|
||||
### Agents 必须使用显式文件路径
|
||||
|
||||
The validator **does not accept directory paths for `agents`**.
|
||||
校验器**不接受 `agents` 使用目录路径**。
|
||||
|
||||
Even the following will fail:
|
||||
即便如下写法也会失败:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -86,7 +86,7 @@ Even the following will fail:
|
||||
}
|
||||
```
|
||||
|
||||
Instead, you must enumerate agent files explicitly:
|
||||
相反,你必须显式列举智能体(Agent)文件:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -98,41 +98,41 @@ Instead, you must enumerate agent files explicitly:
|
||||
}
|
||||
```
|
||||
|
||||
This is the most common source of validation errors.
|
||||
这是校验错误最常见的来源。
|
||||
|
||||
### Commands and Skills
|
||||
### Commands 和 Skills
|
||||
|
||||
* `commands` and `skills` accept directory paths **only when wrapped in arrays**
|
||||
* Explicit file paths are safest and most future-proof
|
||||
* `commands` 和 `skills` 仅在**包裹在数组中**时才接受目录路径。
|
||||
* 使用显式文件路径是最安全且面向未来的做法。
|
||||
|
||||
---
|
||||
|
||||
## Validator Behavior Notes
|
||||
## 校验器行为备注
|
||||
|
||||
* `claude plugin validate` is stricter than some marketplace previews
|
||||
* Validation may pass locally but fail during install if paths are ambiguous
|
||||
* Errors are often generic (`Invalid input`) and do not indicate root cause
|
||||
* Cross-platform installs (especially Windows) are less forgiving of path assumptions
|
||||
* `claude plugin validate` 比某些应用市场预览更严格。
|
||||
* 校验可能在本地通过,但如果路径含义模糊,则在安装时可能会失败。
|
||||
* 错误通常很笼统(`Invalid input`),且不指示根本原因。
|
||||
* 跨平台安装(尤其是 Windows)对路径假设的容忍度较低。
|
||||
|
||||
Assume the validator is hostile and literal.
|
||||
请假设校验器是“带有敌意的”且完全字面化的。
|
||||
|
||||
---
|
||||
|
||||
## Known Anti-Patterns
|
||||
## 已知的反模式(Anti-Patterns)
|
||||
|
||||
These look correct but are rejected:
|
||||
这些看起来正确但会被拒绝:
|
||||
|
||||
* String values instead of arrays
|
||||
* Arrays of directories for `agents`
|
||||
* Missing `version`
|
||||
* Relying on inferred paths
|
||||
* Assuming marketplace behavior matches local validation
|
||||
* 使用字符串值而非数组
|
||||
* 为 `agents` 提供目录数组
|
||||
* 缺失 `version`
|
||||
* 依赖推断路径
|
||||
* 假设应用市场的行为与本地校验一致
|
||||
|
||||
Avoid cleverness. Be explicit.
|
||||
不要耍小聪明。请保持显式。
|
||||
|
||||
---
|
||||
|
||||
## Minimal Known-Good Example
|
||||
## 最小已知有效示例
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -146,35 +146,35 @@ Avoid cleverness. Be explicit.
|
||||
}
|
||||
```
|
||||
|
||||
This structure has been validated against the Claude plugin validator.
|
||||
该结构已通过 Claude 插件校验器的验证。
|
||||
|
||||
---
|
||||
|
||||
## Recommendation for Contributors
|
||||
## 对贡献者的建议
|
||||
|
||||
Before submitting changes that touch `plugin.json`:
|
||||
在提交涉及 `plugin.json` 的更改之前:
|
||||
|
||||
1. Use explicit file paths for agents
|
||||
2. Ensure all component fields are arrays
|
||||
3. Include a `version`
|
||||
4. Run:
|
||||
1. 为 agents 使用显式文件路径
|
||||
2. 确保所有组件字段均为数组
|
||||
3. 包含 `version`
|
||||
4. 运行:
|
||||
|
||||
```bash
|
||||
claude plugin validate .claude-plugin/plugin.json
|
||||
```
|
||||
|
||||
If in doubt, choose verbosity over convenience.
|
||||
如有疑问,宁可繁琐也不要追求便利。
|
||||
|
||||
---
|
||||
|
||||
## Why This File Exists
|
||||
## 为什么存在此文件
|
||||
|
||||
This repository is widely forked and used as a reference implementation.
|
||||
此仓库被广泛 fork 并用作参考实现。
|
||||
|
||||
Documenting validator quirks here:
|
||||
在此记录校验器的特性:
|
||||
|
||||
* Prevents repeated issues
|
||||
* Reduces contributor frustration
|
||||
* Preserves plugin stability as the ecosystem evolves
|
||||
* 防止重复出现的问题
|
||||
* 减少贡献者的挫败感
|
||||
* 随着生态系统的演进保持插件的稳定性
|
||||
|
||||
If the validator changes, update this document first.
|
||||
如果校验器发生变化,请首先更新本文档。
|
||||
|
||||
Reference in New Issue
Block a user