@fateforge/xpedition-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/AGENT.md +59 -0
- package/.agent/AGENT_zh.md +59 -0
- package/.agent/CLI-SPEC.md +1073 -0
- package/.agent/CLI-SPEC_zh.md +891 -0
- package/.agent/SEC-SPEC.md +158 -0
- package/.agent/SEC-SPEC_zh.md +132 -0
- package/.agent/SKILL-SPEC.md +266 -0
- package/.agent/SKILL-SPEC_zh.md +221 -0
- package/.agent/SPEC_VERSION +1 -0
- package/AGENTS.md +34 -0
- package/AGENTS_zh.md +33 -0
- package/CHANGELOG.md +795 -0
- package/CODE_OF_CONDUCT.md +35 -0
- package/CODE_OF_CONDUCT_zh.md +35 -0
- package/CONTRIBUTING.md +50 -0
- package/CONTRIBUTING_zh.md +42 -0
- package/LICENSE +21 -0
- package/NOTICE.md +16 -0
- package/NOTICE_zh.md +13 -0
- package/README.md +200 -0
- package/README_zh.md +178 -0
- package/SECURITY.md +108 -0
- package/SECURITY_zh.md +83 -0
- package/docs/AGENT_HARDENING_EVIDENCE.md +102 -0
- package/docs/AGENT_READS.md +74 -0
- package/docs/AGENT_READS_METRICS.json +216 -0
- package/docs/AGENT_READS_VALIDATION.json +13 -0
- package/docs/API_INVENTORY_BINDING_VALIDATION.json +16 -0
- package/docs/API_INVENTORY_DESIGN.md +90 -0
- package/docs/API_INVENTORY_REVIEW.md +59 -0
- package/docs/API_INVENTORY_VALIDATION.json +29 -0
- package/docs/API_INVENTORY_WINDOWS_VALIDATION.json +29 -0
- package/docs/COMPATIBILITY.md +499 -0
- package/docs/CONFIRMATION_CONCURRENCY_VALIDATION.json +33 -0
- package/docs/DIAGNOSTIC_BOUNDARIES.md +33 -0
- package/docs/DIAGNOSTIC_BOUNDARIES_VALIDATION.json +12 -0
- package/docs/E2E.md +445 -0
- package/docs/EVALS.md +134 -0
- package/docs/MCP.md +20 -0
- package/docs/NATIVE_ADAPTER.md +141 -0
- package/docs/OPEN_SOURCE_CHECKLIST.md +61 -0
- package/docs/OPEN_SOURCE_CHECKLIST_zh.md +61 -0
- package/docs/PIN_WORKFLOW_VALIDATION.json +28 -0
- package/docs/PLACEMENT_TASKS.md +99 -0
- package/docs/PLACEMENT_TASKS_VALIDATION.json +36 -0
- package/docs/REFERENCE_ADOPTION.md +67 -0
- package/package.json +48 -0
- package/scripts/run.js +46 -0
- package/skills/xpedition-cli/SKILL.md +300 -0
- package/skills/xpedition-cli/reference/agent-hardening.md +58 -0
- package/skills/xpedition-cli/reference/api-inventory.md +58 -0
- package/skills/xpedition-cli/reference/confirmation-safety.md +55 -0
- package/skills/xpedition-cli/test-prompts.json +62 -0
- package/skills/xpedition-pcb/SKILL.md +244 -0
- package/skills/xpedition-pcb/reference/fabrication.md +26 -0
- package/skills/xpedition-pcb/reference/hand-routing.md +33 -0
- package/skills/xpedition-pcb/reference/pcb-conventions.md +162 -0
- package/skills/xpedition-pcb/reference/placement-tasks.md +28 -0
- package/skills/xpedition-pcb/test-prompts.json +62 -0
- package/skills/xpedition-schematic/SKILL.md +244 -0
- package/skills/xpedition-schematic/reference/pin-assignment.md +61 -0
- package/skills/xpedition-schematic/reference/schematic-conventions.md +306 -0
- package/skills/xpedition-schematic/reference/schematic-design-format.md +219 -0
- package/skills/xpedition-schematic/test-prompts.json +52 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
> 中文版 → [CODE_OF_CONDUCT_zh.md](CODE_OF_CONDUCT_zh.md)
|
|
4
|
+
|
|
5
|
+
This project follows the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.
|
|
6
|
+
|
|
7
|
+
## Our Pledge
|
|
8
|
+
|
|
9
|
+
We pledge to make participation in `xpedition-cli` a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
10
|
+
|
|
11
|
+
## Expected Behavior
|
|
12
|
+
|
|
13
|
+
- Use welcoming and inclusive language.
|
|
14
|
+
- Respect differing viewpoints and experiences.
|
|
15
|
+
- Accept constructive criticism with focus on the work.
|
|
16
|
+
- Show empathy toward other community members.
|
|
17
|
+
|
|
18
|
+
## Unacceptable Behavior
|
|
19
|
+
|
|
20
|
+
- Harassment, intimidation, or discriminatory language.
|
|
21
|
+
- Personal attacks, trolling, or insulting comments.
|
|
22
|
+
- Publishing others' private information without explicit permission.
|
|
23
|
+
- Other conduct that would reasonably be considered inappropriate in a professional setting.
|
|
24
|
+
|
|
25
|
+
## Enforcement
|
|
26
|
+
|
|
27
|
+
Project maintainers are responsible for clarifying and enforcing this Code of Conduct. They may remove, edit, or reject comments, commits, issues, pull requests, or other contributions that do not align with it, and may temporarily or permanently ban any contributor for behavior they deem inappropriate.
|
|
28
|
+
|
|
29
|
+
## Reporting
|
|
30
|
+
|
|
31
|
+
Report unacceptable behavior privately to the project maintainers at **guosong6886@gmail.com**. All complaints will be reviewed and investigated promptly and fairly. Maintainers must respect the privacy and security of the reporter.
|
|
32
|
+
|
|
33
|
+
## Attribution
|
|
34
|
+
|
|
35
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/), version 2.1.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# 行为准则
|
|
2
|
+
|
|
3
|
+
> English → [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
|
|
4
|
+
|
|
5
|
+
本项目遵循 [Contributor Covenant(贡献者公约)](https://www.contributor-covenant.org/zh-cn/) 2.1 版。
|
|
6
|
+
|
|
7
|
+
## 我们的承诺
|
|
8
|
+
|
|
9
|
+
我们承诺让每个人参与 `xpedition-cli` 的体验不受骚扰,无论其年龄、体型、是否残障、族裔、性别认同与表达、经验水平、国籍、个人外貌、种族、宗教信仰、性认同与性取向如何。
|
|
10
|
+
|
|
11
|
+
## 期望的行为
|
|
12
|
+
|
|
13
|
+
- 使用友善、包容的语言。
|
|
14
|
+
- 尊重不同的观点和经验。
|
|
15
|
+
- 以工作本身为重,接受建设性批评。
|
|
16
|
+
- 对其他社区成员抱有同理心。
|
|
17
|
+
|
|
18
|
+
## 不可接受的行为
|
|
19
|
+
|
|
20
|
+
- 骚扰、恐吓或带有歧视性的言论。
|
|
21
|
+
- 人身攻击、挑衅或侮辱性评论。
|
|
22
|
+
- 未经明确许可公开他人的私人信息。
|
|
23
|
+
- 其他在职业场景中会被合理认定为不当的行为。
|
|
24
|
+
|
|
25
|
+
## 执行
|
|
26
|
+
|
|
27
|
+
项目维护者负责阐释并执行本行为准则。维护者有权移除、编辑或拒绝任何不符合本准则的评论、提交、Issue、Pull Request 及其他贡献,并可对其认定为不当的行为暂时或永久封禁相关贡献者。
|
|
28
|
+
|
|
29
|
+
## 举报
|
|
30
|
+
|
|
31
|
+
如遇不可接受的行为,请私下向项目维护者举报:**guosong6886@gmail.com**。所有投诉都将被及时、公正地审查与处理。维护者必须尊重举报人的隐私与安全。
|
|
32
|
+
|
|
33
|
+
## 出处
|
|
34
|
+
|
|
35
|
+
本行为准则改编自 [Contributor Covenant(贡献者公约)](https://www.contributor-covenant.org/zh-cn/version/2/1/code_of_conduct/) 2.1 版。
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Contributing to xpedition-cli
|
|
2
|
+
|
|
3
|
+
*English | [中文](CONTRIBUTING_zh.md)*
|
|
4
|
+
|
|
5
|
+
Read [AGENTS.md](AGENTS.md) and the pinned `.agent/` specifications before
|
|
6
|
+
changing behavior. The CLI is agent-first: stdout is a single JSON envelope,
|
|
7
|
+
errors use the canonical code/exit/retryable mapping, and writes use
|
|
8
|
+
`--dry-run` followed by a single-use `--confirm` token.
|
|
9
|
+
|
|
10
|
+
## Development setup
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
python -m pip install -e ".[dev]"
|
|
14
|
+
pytest -q
|
|
15
|
+
ruff check xpedition_cli tests
|
|
16
|
+
ruff format --check xpedition_cli tests
|
|
17
|
+
node scripts/check-version.js
|
|
18
|
+
node scripts/check-spec.js --local-only
|
|
19
|
+
python -m xpedition_cli.main --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use `XPEDITION_CLI_CONFIG_DIR` for an isolated confirmation secret and audit
|
|
23
|
+
directory during tests. Do not use production design files; native E2E is
|
|
24
|
+
limited to the disposable sequence in [`docs/E2E.md`](docs/E2E.md).
|
|
25
|
+
|
|
26
|
+
## Adding a command or backend
|
|
27
|
+
|
|
28
|
+
1. Read the relevant sections of `.agent/CLI-SPEC.md` and `.agent/SEC-SPEC.md`.
|
|
29
|
+
2. Add the domain model/backend operation under `xpedition_cli/`.
|
|
30
|
+
3. Register the command, schema, examples, permission tier and blast radius in
|
|
31
|
+
`xpedition_cli/reference_data.py`.
|
|
32
|
+
4. Keep external values marked in `_untrusted` and gate every mutating action
|
|
33
|
+
behind `--dry-run` then a single-use `--confirm <token>`, with `--dangerous`
|
|
34
|
+
as well when it destroys work.
|
|
35
|
+
5. Add command-level tests for success, invalid input, errors, envelope shape,
|
|
36
|
+
exit code and stdout/stderr behavior. The FCC guard must remain green.
|
|
37
|
+
6. Update both READMEs, the affected Skills and `CHANGELOG.md`.
|
|
38
|
+
|
|
39
|
+
Do not claim NativeBackend or a new Xpedition version until a recorded licensed
|
|
40
|
+
smoke test proves it. Keep `.agent/*`, `contract/contract.json`, and generated
|
|
41
|
+
contract code synchronized through `scripts/sync-spec.js`; never hand-edit a
|
|
42
|
+
vendored spec or generated module.
|
|
43
|
+
|
|
44
|
+
## Pull requests
|
|
45
|
+
|
|
46
|
+
- Use a focused branch and a Conventional Commit message.
|
|
47
|
+
- Include tests and documentation for every observable behavior change.
|
|
48
|
+
- Run lint, format, tests, version and spec guards locally.
|
|
49
|
+
- Do not commit credentials, confidential design data, build artifacts or real tokens.
|
|
50
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 为 xpedition-cli 贡献代码
|
|
2
|
+
|
|
3
|
+
*[English](CONTRIBUTING.md) | 中文*
|
|
4
|
+
|
|
5
|
+
修改行为前先读 [AGENTS_zh.md](AGENTS_zh.md) 和固定版本的 `.agent/` 规范。本 CLI
|
|
6
|
+
优先面向 Agent:stdout 只输出一个 JSON envelope,错误遵守统一的 code/exit/retryable
|
|
7
|
+
映射,写操作使用 `--dry-run` 再配合单次 `--confirm` token。
|
|
8
|
+
|
|
9
|
+
## 开发环境
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
python -m pip install -e ".[dev]"
|
|
13
|
+
pytest -q
|
|
14
|
+
ruff check xpedition_cli tests
|
|
15
|
+
ruff format --check xpedition_cli tests
|
|
16
|
+
node scripts/check-version.js
|
|
17
|
+
node scripts/check-spec.js --local-only
|
|
18
|
+
python -m xpedition_cli.main --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
测试时使用 `XPEDITION_CLI_CONFIG_DIR` 隔离确认 secret 和审计目录。不要使用生产工程文件;
|
|
22
|
+
正版 E2E 只能执行 [`docs/E2E.md`](docs/E2E.md) 中的临时工程流程。
|
|
23
|
+
|
|
24
|
+
## 新增命令或后端
|
|
25
|
+
|
|
26
|
+
1. 先读 `.agent/CLI-SPEC.md` 和 `.agent/SEC-SPEC.md` 的相关章节。
|
|
27
|
+
2. 在 `xpedition_cli/` 下增加领域模型或后端操作。
|
|
28
|
+
3. 在 `xpedition_cli/reference_data.py` 注册命令、schema、examples、权限等级和爆炸半径。
|
|
29
|
+
4. 外部值必须在 `_untrusted` 中标记;所有写操作都先 `--dry-run`,再用单次 `--confirm <token>` 执行,会毁掉成果的还要加 `--dangerous`。
|
|
30
|
+
5. 为成功、非法输入、错误、envelope、退出码及 stdout/stderr 边界增加命令级测试,保持 FCC guard 通过。
|
|
31
|
+
6. 同步修改两个 README、受影响的 Skill 和 `CHANGELOG.md`。
|
|
32
|
+
|
|
33
|
+
没有经过授权环境的记录,不要宣称 NativeBackend 或新的 Xpedition 版本可用。`.agent/*`、
|
|
34
|
+
`contract/contract.json` 和生成代码只能通过 `scripts/sync-spec.js` 保持同步,不要手改规范副本或生成文件。
|
|
35
|
+
|
|
36
|
+
## Pull Request
|
|
37
|
+
|
|
38
|
+
- 使用聚焦分支和 Conventional Commit。
|
|
39
|
+
- 每个可观察行为变化都要有测试和文档。
|
|
40
|
+
- 本地执行 lint、格式检查、测试、版本和 spec guard。
|
|
41
|
+
- 不要提交凭据、机密工程数据、构建产物或真实 token。
|
|
42
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sean Guo <guosong6886@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
> 中文版 → [NOTICE_zh.md](NOTICE_zh.md)
|
|
4
|
+
|
|
5
|
+
`xpedition-cli` is an independent open-source project. It is **not** affiliated with, endorsed by, sponsored by, or supported by Siemens or any of its affiliates.
|
|
6
|
+
|
|
7
|
+
"Siemens Xpedition", related product and company names, logos, and brands are trademarks or registered trademarks of their respective owners. They are used here only to identify the API-compatibility target — that is, the software this tool talks to — and do not imply any association or endorsement.
|
|
8
|
+
|
|
9
|
+
This project does not redistribute Siemens Xpedition code or assets. The
|
|
10
|
+
NativeBackend works with Siemens Xpedition only inside the user's own licensed
|
|
11
|
+
installation: through the product's automation interfaces and its own
|
|
12
|
+
command-line tools, and on the project's files, as [SECURITY.md](SECURITY.md)
|
|
13
|
+
describes. Nothing in this repository ships, wraps or replaces any part of the
|
|
14
|
+
product itself.
|
|
15
|
+
|
|
16
|
+
The MIT license (see [LICENSE](LICENSE)) applies only to the `xpedition-cli` source code. It grants no rights to Siemens Xpedition's trademarks, services, data, API behavior, or upstream availability.
|
package/NOTICE_zh.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 声明
|
|
2
|
+
|
|
3
|
+
> English → [NOTICE.md](NOTICE.md)
|
|
4
|
+
|
|
5
|
+
`xpedition-cli` 是一个独立的开源项目,**与** Siemens 及其任何关联方**没有**从属、背书、赞助或支持关系。
|
|
6
|
+
|
|
7
|
+
“Siemens Xpedition” 及相关产品名、公司名、徽标和品牌,均为各自所有者的商标或注册商标。此处提及仅用于标识 API 兼容目标——即本工具所对接的软件——并不表示存在任何关联或获得其认可。
|
|
8
|
+
|
|
9
|
+
本项目不分发 Siemens Xpedition 的代码或资源。NativeBackend 只在用户自己的正版安装中工作:
|
|
10
|
+
通过该产品的自动化接口和产品自带的命令行工具,以及直接处理工程文件,详见
|
|
11
|
+
[SECURITY_zh.md](SECURITY_zh.md)。本仓库不包含、不封装、也不替代产品本身的任何部分。
|
|
12
|
+
|
|
13
|
+
MIT 许可证(见 [LICENSE](LICENSE))仅适用于 `xpedition-cli` 源代码,不授予 Siemens Xpedition 的商标、服务、数据、API 行为或上游可用性的任何权利。
|
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<h1 align="center">xpedition-cli</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center"><strong>Agent-native Xpedition design control with JSON-first reads and dry-run guarded ChangeSets</strong></p>
|
|
4
|
+
|
|
5
|
+
<p align="center"><a href="README.md">English</a> · <a href="README_zh.md">中文</a></p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/fatecannotbealtered/xpedition-cli/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/fatecannotbealtered/xpedition-cli/ci.yml?branch=main&style=for-the-badge&logo=githubactions&logoColor=white&label=CI"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@fateforge/xpedition-cli"><img alt="npm" src="https://img.shields.io/npm/v/@fateforge/xpedition-cli?style=for-the-badge&logo=npm&logoColor=white&label=npm&color=CB3837"></a>
|
|
10
|
+
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-7C3AED?style=for-the-badge"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
`xpedition-cli` is the command layer around Siemens Xpedition data. MockBackend
|
|
14
|
+
works offline; NativeBackend drives a licensed Xpedition installation through an
|
|
15
|
+
optional Windows COM adapter, and has taken a project from an empty schematic to a
|
|
16
|
+
routed board and a fabrication package (`docs/E2E.md`). That evidence comes from one
|
|
17
|
+
Windows installation, with converted open-source footprints and placeholder part
|
|
18
|
+
numbers. The CLI never edits Xpedition's private databases directly, and every
|
|
19
|
+
write command is gated by `--dry-run` then `--confirm <token>`.
|
|
20
|
+
|
|
21
|
+
## Agent Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python -m pip install "xpedition-cli[native] @ git+https://github.com/fatecannotbealtered/xpedition-cli"
|
|
25
|
+
npx skills add fatecannotbealtered/xpedition-cli -y -g
|
|
26
|
+
|
|
27
|
+
xpedition-cli context --compact
|
|
28
|
+
xpedition-cli doctor --compact
|
|
29
|
+
xpedition-cli reference --compact
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The first line installs the CLI and its Windows adapter (`[native]`) from this
|
|
33
|
+
repository's default branch; append a release tag to pin one, e.g.
|
|
34
|
+
`...xpedition-cli@v1.0.0`. From a checkout, `python -m pip install -e ".[native]"`
|
|
35
|
+
does the same. Each tagged release also publishes a standalone binary to npm as
|
|
36
|
+
`@fateforge/xpedition-cli`. It has no Windows adapter, so it serves MockBackend,
|
|
37
|
+
offline planning and file commands only; driving Xpedition needs the pip install
|
|
38
|
+
on Windows. No CLI login is required for MockBackend. Native Xpedition
|
|
39
|
+
credentials and licensing remain inside the verified Xpedition environment; see
|
|
40
|
+
[Native adapter protocol](docs/NATIVE_ADAPTER.md).
|
|
41
|
+
|
|
42
|
+
## What It Does
|
|
43
|
+
|
|
44
|
+
The CLI normalizes project snapshots, BOM rows, connectivity and deterministic
|
|
45
|
+
review findings. A ChangeSet describes controlled operations such as placing a
|
|
46
|
+
component, creating a net, connecting pins, moving or deleting a component, and
|
|
47
|
+
setting a property. Applying a ChangeSet requires a preview token, writes a
|
|
48
|
+
backup when replacing an existing file, saves atomically, and verifies the project after the write.
|
|
49
|
+
|
|
50
|
+
Risk tier: **T2**. Against MockBackend the blast radius is the explicitly named
|
|
51
|
+
local JSON file. Against NativeBackend it is the named Xpedition project: a
|
|
52
|
+
confirmed write can draw a schematic, place parts, and add or delete routing.
|
|
53
|
+
The writes that destroy work also need `--dangerous` next to the token:
|
|
54
|
+
`schematic draw`, `pcb unroute`, `pcb create --replace` (which first archives the
|
|
55
|
+
layout folder to a zip beside the project), `pcb arrange` on a routed board,
|
|
56
|
+
`pcb route --unroute`, `pcb annotate --unroute`, and `library kicad-import` into a
|
|
57
|
+
partition that exists. `pcb annotate`, `pcb export` when it changes the output
|
|
58
|
+
setups, and the first `pcb show --top-view` on a board close and reopen the board
|
|
59
|
+
without saving it, so save hand edits in Layout first. See [SECURITY.md](SECURITY.md).
|
|
60
|
+
|
|
61
|
+
## Capabilities
|
|
62
|
+
|
|
63
|
+
| Area | Commands | Backend |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| Project data | `project init`, `project info`, `project tree`, `project snapshot`, `project diff`, `design snapshot` | both; natively `project init --template` copies a template project, and `project diff` compares a MockBackend file with its backup |
|
|
66
|
+
| Schematic reads | `schematic sheets`, `components`, `pins`, `nets`, `connectivity`, `unconnected`, `power`, `interfaces`, `query` | both |
|
|
67
|
+
| Schematic drawing | `schematic draw`, `schematic show`, `schematic export`, `library build`, `library kicad-import` | NativeBackend (see below) |
|
|
68
|
+
| Pin planning | `schematic pin-plan`, `schematic pin-check` | offline, against a supplied snapshot |
|
|
69
|
+
| PCB reads | `pcb info`, `components`, `footprints`, `nets`, `tracks`, `vias`, `layers`, `stackup`, `zones`, `keepouts`, `query` | both; natively only components, footprints, nets, tracks and vias are read, and the rest come back empty |
|
|
70
|
+
| PCB design | `pcb create`, `annotate`, `outline`, `holes`, `arrange`, `placement`, `move`, `rules`, `pour`, `route`, `trace`, `via`, `unroute`, `labels`, `geometry`, `render`, `show`, `drc`, `export` | NativeBackend (see below) |
|
|
71
|
+
| PCB planning | `pcb stitch`, `pcb placement-plan` | offline, from files |
|
|
72
|
+
| Constraints/analysis | `constraints ...`, `analysis run|results|erc|drc|dfm` | MockBackend; natively `analysis run` is refused and the reads come back empty (use `review run` and `pcb drc`) |
|
|
73
|
+
| Manufacturing/library reads | `manufacturing ...`, `library search|parts|symbols|footprints|padstacks|models|validate` | MockBackend; natively they come back empty |
|
|
74
|
+
| Change control | `change validate`, `change preview`, `change apply`, `change history`, `change rollback`, `schematic apply` | MockBackend; natively `change apply` places and moves parts, and `schematic apply` also creates nets and connects pins |
|
|
75
|
+
| Review and BOM | `review run`, `bom export|normalize|group|variants|missing|duplicates|validate|compare` | both; natively `review run` adds Designer's own verification |
|
|
76
|
+
| Environment | `context`, `doctor`, `reference`, `changelog`, `system capabilities`, `system license`, `system api-inventory` | local probe; `api-inventory` reads COM type libraries on Windows |
|
|
77
|
+
| Knowledge base | `kb list`, `kb add`, `kb remove` | local links to company rules; the agent reads them |
|
|
78
|
+
| Session | `session status`, `session logs`, `session start`, `session attach`, `session open`, `session stop` | start/attach/open/stop drive Xpedition; `session logs` reads a log this version never writes |
|
|
79
|
+
| Exchange files | `exchange inspect`, `exchange import` | JSON/CSV/BOM/IPC-2581; PDF/EDN/ODB++ remain unavailable |
|
|
80
|
+
| Agent bridge | `agent snapshot`, `agent query`, `agent review`, `agent capabilities`, `agent serve` | MockBackend unless the native backend is selected; `serve` supports custom NDJSON and MCP transports |
|
|
81
|
+
| Planned | native constraints, analysis, manufacturing and library reads; PDF/EDN/ODB++ imports; the rest of the native ChangeSet operations | listed in `system capabilities` |
|
|
82
|
+
|
|
83
|
+
The live command and schema source is `xpedition-cli reference --compact`.
|
|
84
|
+
|
|
85
|
+
## Agent Workflow
|
|
86
|
+
|
|
87
|
+
1. Run `context`, `doctor`, and `reference`; check the backend and release readiness.
|
|
88
|
+
2. Keep `--backend mock` and `--project PATH` explicit for offline work.
|
|
89
|
+
3. Use `--compact` and `--fields` when passing JSON between agent steps.
|
|
90
|
+
4. To create a new MockBackend project, run `project init --dry-run`, inspect
|
|
91
|
+
the preview, then confirm with the same arguments.
|
|
92
|
+
5. Validate and preview a ChangeSet before applying it:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
xpedition-cli change validate --changeset ./changeset.json --compact
|
|
96
|
+
xpedition-cli change apply --backend mock --project ./demo-project.json --changeset ./changeset.json --dry-run --compact
|
|
97
|
+
xpedition-cli change apply --backend mock --project ./demo-project.json --changeset ./changeset.json --confirm <confirm_token> --backup --compact
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
6. After applying, inspect `verification`; re-read `project snapshot` before any next write.
|
|
101
|
+
7. Use `change history` to inspect local operations. Rollback also requires a
|
|
102
|
+
dry-run preview and a one-time confirmation token.
|
|
103
|
+
|
|
104
|
+
Agent integrations can use `xpedition-cli agent serve --transport stdio` for a
|
|
105
|
+
newline-delimited JSON request/response stream. It exposes snapshot, query,
|
|
106
|
+
review and capability methods, on MockBackend unless a request selects the
|
|
107
|
+
native backend.
|
|
108
|
+
|
|
109
|
+
## Native Xpedition: from the schematic to the fabrication package
|
|
110
|
+
|
|
111
|
+
The stages below have run on a licensed Xpedition (XPED2604) against the example
|
|
112
|
+
project -- apart from `pcb via` on its own and the guarded `library kicad-import`,
|
|
113
|
+
whose converter ran through an earlier entry point. The runs are recorded in
|
|
114
|
+
[docs/E2E.md](docs/E2E.md) and every fact learnt
|
|
115
|
+
about the automation in [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md). Write
|
|
116
|
+
commands are guarded: `--dry-run` returns a `confirm_token`, `--confirm <token>` acts.
|
|
117
|
+
|
|
118
|
+
| Stage | Commands |
|
|
119
|
+
|---|---|
|
|
120
|
+
| Project and schematic | `project init`, `schematic draw`, `schematic show`, `schematic export`, `review run` |
|
|
121
|
+
| Library | `library build` (parts from a design file), `library kicad-import` (cells from KiCad footprint libraries) |
|
|
122
|
+
| Board | `pcb create`, `pcb annotate`, `pcb outline`, `pcb holes`, `pcb arrange`, `pcb placement`, `pcb pour`, `pcb rules`, `pcb route`, `pcb drc` |
|
|
123
|
+
| By hand | `pcb geometry`, `pcb trace`, `pcb via`, `pcb unroute`, `pcb move`, `pcb labels`, `pcb stitch` (plans offline; the plan checks are in `xpedition_cli.routing_plan`) |
|
|
124
|
+
| Pictures and output | `pcb render`, `pcb show [--top-view]`, `pcb export` (ODB++, Gerber, NC drill, centroid, BOM, manifest) |
|
|
125
|
+
|
|
126
|
+
## Machine Contract
|
|
127
|
+
|
|
128
|
+
- JSON is the default and stdout contains exactly one envelope.
|
|
129
|
+
- Success and failure both include `ok`, `schema_version`, and `meta.duration_ms`.
|
|
130
|
+
- Errors use the canonical `E_*` to exit-code and `retryable` mapping in
|
|
131
|
+
[`contract/contract.json`](contract/contract.json).
|
|
132
|
+
- Logs and diagnostics go to stderr. `--json` is a compatibility alias for
|
|
133
|
+
`--format json`; `--format text` is for humans and `raw` returns the payload.
|
|
134
|
+
- Project and review values that can originate in files are marked in `_untrusted`.
|
|
135
|
+
- IDs are strings and timestamps are ISO 8601 UTC.
|
|
136
|
+
|
|
137
|
+
## Configuration
|
|
138
|
+
|
|
139
|
+
The CLI has no login flow in this phase. It keeps its local state under
|
|
140
|
+
`~/.xpedition-cli/`: the confirmation secret, the consumed-token ledger and its
|
|
141
|
+
lock, the audit JSONL, knowledge-base links, the native session record
|
|
142
|
+
(`session.json`) and placement locks. Set `XPEDITION_CLI_CONFIG_DIR` to isolate these files in
|
|
143
|
+
tests or CI. Set `XPEDITION_NATIVE_COMMAND` to select an adapter when needed;
|
|
144
|
+
setting it does not bypass COM registration or license checks.
|
|
145
|
+
|
|
146
|
+
Company rules -- layout rules, drawing conventions, review checklists -- stay in
|
|
147
|
+
the company's knowledge base. `kb add --name NAME --url URL --about TEXT` (a
|
|
148
|
+
write: dry run, then confirm) records which document applies, in
|
|
149
|
+
`knowledge-base.json`, and `context` lists them for the agent, which reads each
|
|
150
|
+
with its own tools (for a Feishu wiki, lark-cli). The CLI never fetches a
|
|
151
|
+
document.
|
|
152
|
+
|
|
153
|
+
## Project Structure
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
xpedition-cli/
|
|
157
|
+
├── xpedition_cli/ # CLI boundary, models, ChangeSet, backends, contract
|
|
158
|
+
├── tests/ # command-level contract and FCC tests
|
|
159
|
+
├── skills/xpedition-cli/ # entry Skill: install, sessions, projects, ChangeSets
|
|
160
|
+
├── skills/xpedition-schematic/ # schematic Skill: Designer drawing, review, pins
|
|
161
|
+
├── skills/xpedition-pcb/ # board Skill: Layout, routing, DRC, fabrication
|
|
162
|
+
├── contract/ # canonical vendored machine contract
|
|
163
|
+
├── scripts/ # spec, version, and npm wrapper tooling
|
|
164
|
+
├── docs/ # compatibility, E2E, and open-source checklist
|
|
165
|
+
└── .agent/ # pinned AI-native CLI specifications
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Development
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python -m pip install -e ".[dev]"
|
|
172
|
+
pytest -q
|
|
173
|
+
ruff check xpedition_cli tests
|
|
174
|
+
ruff format --check xpedition_cli tests
|
|
175
|
+
node scripts/check-version.js
|
|
176
|
+
node scripts/check-spec.js --local-only
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`reference.release_readiness.level` is `beta`: every public command has a
|
|
180
|
+
command-level test and the contract tests cover the failure and boundary behaviour
|
|
181
|
+
as well as the happy path, and live runs against a licensed Xpedition are recorded
|
|
182
|
+
in [`docs/E2E.md`](docs/E2E.md); `reference` names what still keeps it from
|
|
183
|
+
`stable`. The level is a statement about that evidence, not a promise that the
|
|
184
|
+
Xpedition automation behaves identically on another installation.
|
|
185
|
+
|
|
186
|
+
## Links
|
|
187
|
+
|
|
188
|
+
- [Agent entry](AGENTS.md)
|
|
189
|
+
- [Skills](skills/xpedition-cli/SKILL.md): the entry Skill, with [xpedition-schematic](skills/xpedition-schematic/SKILL.md) and [xpedition-pcb](skills/xpedition-pcb/SKILL.md)
|
|
190
|
+
- [CLI contract](.agent/CLI-SPEC.md)
|
|
191
|
+
- [Security policy](SECURITY.md)
|
|
192
|
+
- [Compatibility matrix](docs/COMPATIBILITY.md)
|
|
193
|
+
- [Native adapter protocol](docs/NATIVE_ADAPTER.md)
|
|
194
|
+
- [MCP transport](docs/MCP.md)
|
|
195
|
+
- [E2E notes](docs/E2E.md)
|
|
196
|
+
- [Skill evaluations across models](docs/EVALS.md)
|
|
197
|
+
- [Changelog](CHANGELOG.md)
|
|
198
|
+
- [Contributing](CONTRIBUTING.md)
|
|
199
|
+
- [Third-party notice](NOTICE.md)
|
|
200
|
+
- [MIT license](LICENSE)
|
package/README_zh.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<h1 align="center">xpedition-cli</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center"><strong>面向 AI Agent 的 Xpedition 设计控制层:JSON 优先,ChangeSet 写入受 dry-run 保护</strong></p>
|
|
4
|
+
|
|
5
|
+
<p align="center"><a href="README.md">English</a> · <a href="README_zh.md">中文</a></p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/fatecannotbealtered/xpedition-cli/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/fatecannotbealtered/xpedition-cli/ci.yml?branch=main&style=for-the-badge&logo=githubactions&logoColor=white&label=CI"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@fateforge/xpedition-cli"><img alt="npm" src="https://img.shields.io/npm/v/@fateforge/xpedition-cli?style=for-the-badge&logo=npm&logoColor=white&label=npm&color=CB3837"></a>
|
|
10
|
+
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-7C3AED?style=for-the-badge"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
`xpedition-cli` 是 Siemens Xpedition 数据的命令层。MockBackend 可离线使用;
|
|
14
|
+
NativeBackend 通过可选的 Windows COM 适配器驱动正版 Xpedition,已经把一个工程从空白原理图
|
|
15
|
+
一路做到布线完成的板子和整套打板资料(见 `docs/E2E.md`)。这些证据来自同一台 Windows 机器,
|
|
16
|
+
封装是转换来的开源库,料号是占位值。CLI 不直接修改 Xpedition 私有数据库,
|
|
17
|
+
所有写命令都要先 `--dry-run` 再 `--confirm <token>`。
|
|
18
|
+
|
|
19
|
+
## Agent 安装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python -m pip install "xpedition-cli[native] @ git+https://github.com/fatecannotbealtered/xpedition-cli"
|
|
23
|
+
npx skills add fatecannotbealtered/xpedition-cli -y -g
|
|
24
|
+
|
|
25
|
+
xpedition-cli context --compact
|
|
26
|
+
xpedition-cli doctor --compact
|
|
27
|
+
xpedition-cli reference --compact
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
第一行从本仓库的默认分支安装 CLI 和 Windows 适配器(`[native]`);要固定到某个发布版本,
|
|
31
|
+
在末尾加上 tag,例如 `...xpedition-cli@v1.0.0`。在代码检出目录中用
|
|
32
|
+
`python -m pip install -e ".[native]"` 效果相同。每次打 tag 发版还会把独立二进制发布到 npm,
|
|
33
|
+
包名 `@fateforge/xpedition-cli`。它不带 Windows 适配器,只能用于 MockBackend、离线规划和
|
|
34
|
+
文件类命令;要驱动 Xpedition,必须在 Windows 上用 pip 安装。MockBackend 不需要 CLI 登录;Native
|
|
35
|
+
Xpedition 的凭据和许可证留在经过验证的 Xpedition 环境内,详见
|
|
36
|
+
[NativeBackend 适配器协议](docs/NATIVE_ADAPTER.md)。
|
|
37
|
+
|
|
38
|
+
## 它做什么
|
|
39
|
+
|
|
40
|
+
CLI 负责标准化工程快照、BOM、连通性和确定性的审查结果。ChangeSet 描述放置器件、
|
|
41
|
+
创建网络、连接引脚、移动或删除器件、设置属性等受控操作。应用 ChangeSet 必须先拿到
|
|
42
|
+
预览 token,替换已有文件时自动生成备份,随后原子保存并回读验证。
|
|
43
|
+
|
|
44
|
+
风险等级:**T2**。对 MockBackend,爆炸半径是明确指定的那个本地 JSON 文件。对 NativeBackend,
|
|
45
|
+
爆炸半径是指定的那个 Xpedition 工程:一次确认过的写入可以画原理图、摆器件、增删布线。
|
|
46
|
+
会毁掉成果的写操作,除了 token 还要加 `--dangerous`:`schematic draw`、`pcb unroute`、
|
|
47
|
+
`pcb create --replace`(会先把已有布局目录打包成工程旁边的 zip,再删除它)、有布线时的
|
|
48
|
+
`pcb arrange`、`pcb route --unroute`、`pcb annotate --unroute`,以及导入到已存在分区的
|
|
49
|
+
`library kicad-import`。`pcb annotate`、改动了输出设置的 `pcb export`,以及对一块板第一次
|
|
50
|
+
运行的 `pcb show --top-view`,都会不存盘地关闭并重新打开板子,所以先在 Layout 里保存手工改动。
|
|
51
|
+
参见 [SECURITY_zh.md](SECURITY_zh.md)。
|
|
52
|
+
|
|
53
|
+
## 能力
|
|
54
|
+
|
|
55
|
+
| 领域 | 命令 | 后端 |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| 工程数据 | `project init`、`project info`、`project tree`、`project snapshot`、`project diff`、`design snapshot` | 两种后端;原生下 `project init --template` 复制模板工程,`project diff` 比对的是 MockBackend 文件和它的备份 |
|
|
58
|
+
| 原理图读取 | `schematic sheets`、`components`、`pins`、`nets`、`connectivity`、`unconnected`、`power`、`interfaces`、`query` | 两种后端 |
|
|
59
|
+
| 原理图绘制 | `schematic draw`、`schematic show`、`schematic export`、`library build`、`library kicad-import` | NativeBackend(见下节) |
|
|
60
|
+
| 引脚规划 | `schematic pin-plan`、`schematic pin-check` | 离线,基于提供的快照 |
|
|
61
|
+
| PCB 读取 | `pcb info`、`components`、`footprints`、`nets`、`tracks`、`vias`、`layers`、`stackup`、`zones`、`keepouts`、`query` | 两种后端;原生下只读元件、封装、网络、走线和过孔,其余返回空 |
|
|
62
|
+
| PCB 设计 | `pcb create`、`annotate`、`outline`、`holes`、`arrange`、`placement`、`move`、`rules`、`pour`、`route`、`trace`、`via`、`unroute`、`labels`、`geometry`、`render`、`show`、`drc`、`export` | NativeBackend(见下节) |
|
|
63
|
+
| PCB 规划 | `pcb stitch`、`pcb placement-plan` | 离线,基于文件 |
|
|
64
|
+
| 约束与分析 | `constraints ...`、`analysis run|results|erc|drc|dfm` | MockBackend;原生下 `analysis run` 会被拒绝,读取命令返回空(请用 `review run` 和 `pcb drc`) |
|
|
65
|
+
| 制造与库读取 | `manufacturing ...`、`library search|parts|symbols|footprints|padstacks|models|validate` | MockBackend;原生下返回空 |
|
|
66
|
+
| 变更控制 | `change validate`、`change preview`、`change apply`、`change history`、`change rollback`、`schematic apply` | MockBackend;原生下 `change apply` 能放置和移动器件,`schematic apply` 还能建网络、连引脚 |
|
|
67
|
+
| 审查与 BOM | `review run`、`bom export|normalize|group|variants|missing|duplicates|validate|compare` | 两种后端;原生下 `review run` 还会跑 Designer 自带的校验 |
|
|
68
|
+
| 环境 | `context`、`doctor`、`reference`、`changelog`、`system capabilities`、`system license`、`system api-inventory` | 本地探针;`api-inventory` 在 Windows 上读取 COM 类型库 |
|
|
69
|
+
| 知识库 | `kb list`、`kb add`、`kb remove` | 本地记录公司规则文档的链接,由 Agent 去读 |
|
|
70
|
+
| 会话 | `session status`、`session logs`、`session start`、`session attach`、`session open`、`session stop` | start/attach/open/stop 驱动 Xpedition;`session logs` 读取的日志本版本从不写入 |
|
|
71
|
+
| Exchange 文件 | `exchange inspect`、`exchange import` | JSON/CSV/BOM/IPC-2581;PDF/EDN/ODB++ 仍不可用 |
|
|
72
|
+
| Agent 桥接 | `agent snapshot`、`agent query`、`agent review`、`agent capabilities`、`agent serve` | 默认 MockBackend,选了原生后端时走原生;`serve` 支持自定义 NDJSON 和 MCP transport |
|
|
73
|
+
| 规划中 | 约束、分析、制造和库读取的原生实现;PDF/EDN/ODB++ 导入;其余原生 ChangeSet 操作 | 列在 `system capabilities` 里 |
|
|
74
|
+
|
|
75
|
+
实时命令和 schema 以 `xpedition-cli reference --compact` 为准。
|
|
76
|
+
|
|
77
|
+
## Agent 工作流
|
|
78
|
+
|
|
79
|
+
1. 运行 `context`、`doctor`、`reference`,确认后端和发布就绪等级。
|
|
80
|
+
2. 离线工作时显式使用 `--backend mock` 和 `--project PATH`。
|
|
81
|
+
3. 在 Agent 步骤之间传递 JSON 时使用 `--compact` 和 `--fields`。
|
|
82
|
+
4. 创建新的 MockBackend 工程时先运行 `project init --dry-run`,检查预览后使用相同参数确认。
|
|
83
|
+
5. 应用 ChangeSet 前先校验和预览:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
xpedition-cli change validate --changeset ./changeset.json --compact
|
|
87
|
+
xpedition-cli change apply --backend mock --project ./demo-project.json --changeset ./changeset.json --dry-run --compact
|
|
88
|
+
xpedition-cli change apply --backend mock --project ./demo-project.json --changeset ./changeset.json --confirm <confirm_token> --backup --compact
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
6. 应用后检查 `verification`,并在下一次写入前重新读取 `project snapshot`。
|
|
92
|
+
7. 使用 `change history` 查看本地操作记录。回滚同样必须先预览,再使用一次性确认 token。
|
|
93
|
+
|
|
94
|
+
Agent 集成可使用 `xpedition-cli agent serve --transport stdio`,通过 NDJSON
|
|
95
|
+
请求/响应流访问 snapshot、query、review 和 capability 方法;除非请求选了原生后端,否则走 MockBackend。
|
|
96
|
+
|
|
97
|
+
## 原生 Xpedition:从原理图到打板资料
|
|
98
|
+
|
|
99
|
+
下面各阶段都在有许可的 Xpedition(XPED2604)上对示例工程跑通过;例外是单独运行的
|
|
100
|
+
`pcb via`,以及带门禁的 `library kicad-import`(它背后的转换器是通过早先的入口跑的)。过程记录在
|
|
101
|
+
[docs/E2E.md](docs/E2E.md),自动化接口的每条事实在 [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md)。
|
|
102
|
+
写命令都有门禁:`--dry-run` 返回 `confirm_token`,`--confirm <token>` 才执行。
|
|
103
|
+
|
|
104
|
+
| 阶段 | 命令 |
|
|
105
|
+
|---|---|
|
|
106
|
+
| 工程与原理图 | `project init`、`schematic draw`、`schematic show`、`schematic export`、`review run` |
|
|
107
|
+
| 库 | `library build`(零件来自设计文件)、`library kicad-import`(封装由 KiCad 封装库转换) |
|
|
108
|
+
| 板子 | `pcb create`、`pcb annotate`、`pcb outline`、`pcb holes`、`pcb arrange`、`pcb placement`、`pcb pour`、`pcb rules`、`pcb route`、`pcb drc` |
|
|
109
|
+
| 手工布线 | `pcb geometry`、`pcb trace`、`pcb via`、`pcb unroute`、`pcb move`、`pcb labels`、`pcb stitch`(离线规划;计划检查在 `xpedition_cli.routing_plan`) |
|
|
110
|
+
| 出图与出资料 | `pcb render`、`pcb show [--top-view]`、`pcb export`(ODB++、Gerber、钻孔、坐标、BOM、清单) |
|
|
111
|
+
|
|
112
|
+
## 机器契约
|
|
113
|
+
|
|
114
|
+
- 默认输出 JSON,stdout 只包含一个 envelope。
|
|
115
|
+
- 成功和失败都包含 `ok`、`schema_version` 和 `meta.duration_ms`。
|
|
116
|
+
- 错误使用 [`contract/contract.json`](contract/contract.json) 中统一的 `E_*`、退出码和 `retryable` 映射。
|
|
117
|
+
- 日志和诊断走 stderr;`--json` 是 `--format json` 的兼容别名,`text` 面向人,`raw` 返回 payload。
|
|
118
|
+
- 来自工程文件的项目和审查字段通过 `_untrusted` 标记。
|
|
119
|
+
- ID 使用字符串,时间使用 ISO 8601 UTC。
|
|
120
|
+
|
|
121
|
+
## 配置
|
|
122
|
+
|
|
123
|
+
本阶段没有登录流程。CLI 的本地状态都在 `~/.xpedition-cli/` 下:确认 secret、已消费 token
|
|
124
|
+
记录及其锁文件、审计 JSONL、知识库链接、原生会话记录(`session.json`)和摆放任务的锁文件。
|
|
125
|
+
测试或 CI 可设置 `XPEDITION_CLI_CONFIG_DIR` 隔离这些文件。Native
|
|
126
|
+
适配器可通过 `XPEDITION_NATIVE_COMMAND` 指定;设置该变量不会绕过 COM 注册或许可证检查。
|
|
127
|
+
|
|
128
|
+
公司自己的规则(布局规则、绘图约定、评审清单)留在公司知识库里。
|
|
129
|
+
`kb add --name NAME --url URL --about TEXT`(写操作:先 dry-run 再 confirm)把适用的文档记到
|
|
130
|
+
`knowledge-base.json`,`context` 把它们列给 Agent,由 Agent 用自己的工具去读(飞书 wiki 用
|
|
131
|
+
lark-cli)。CLI 本身从不读取文档。
|
|
132
|
+
|
|
133
|
+
## 项目结构
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
xpedition-cli/
|
|
137
|
+
├── xpedition_cli/ # CLI 边界、模型、ChangeSet、后端、契约
|
|
138
|
+
├── tests/ # 命令级契约和 FCC 测试
|
|
139
|
+
├── skills/xpedition-cli/ # 入口 Skill:安装、会话、工程、ChangeSet
|
|
140
|
+
├── skills/xpedition-schematic/ # 原理图 Skill:Designer 绘图、评审、引脚
|
|
141
|
+
├── skills/xpedition-pcb/ # 板级 Skill:Layout、布线、DRC、制造输出
|
|
142
|
+
├── contract/ # vendored 机器契约真源
|
|
143
|
+
├── scripts/ # 规范、版本和 npm 壳工具
|
|
144
|
+
├── docs/ # 兼容性、E2E 和开源清单
|
|
145
|
+
└── .agent/ # 固定版本的 AI 原生 CLI 规范
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 开发
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python -m pip install -e ".[dev]"
|
|
152
|
+
pytest -q
|
|
153
|
+
ruff check xpedition_cli tests
|
|
154
|
+
ruff format --check xpedition_cli tests
|
|
155
|
+
node scripts/check-version.js
|
|
156
|
+
node scripts/check-spec.js --local-only
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
当前 `reference.release_readiness.level` 为 `beta`:每条公开命令都有命令级测试,
|
|
160
|
+
契约测试覆盖失败路径和边界行为而不只是正常路径,正版 Xpedition 上的真实运行记录在
|
|
161
|
+
[`docs/E2E.md`](docs/E2E.md);离 `stable` 还差什么,`reference` 里写着。这个等级说的是
|
|
162
|
+
这些证据,不等于承诺换一台机器上的 Xpedition 自动化行为完全一致。
|
|
163
|
+
|
|
164
|
+
## 链接
|
|
165
|
+
|
|
166
|
+
- [Agent 入口](AGENTS_zh.md)
|
|
167
|
+
- [Skill](skills/xpedition-cli/SKILL.md)(入口),以及 [xpedition-schematic](skills/xpedition-schematic/SKILL.md) 和 [xpedition-pcb](skills/xpedition-pcb/SKILL.md)
|
|
168
|
+
- [CLI 契约](.agent/CLI-SPEC.md)
|
|
169
|
+
- [安全策略](SECURITY_zh.md)
|
|
170
|
+
- [兼容性矩阵](docs/COMPATIBILITY.md)
|
|
171
|
+
- [NativeBackend 适配器协议](docs/NATIVE_ADAPTER.md)
|
|
172
|
+
- [MCP transport](docs/MCP.md)
|
|
173
|
+
- [E2E 说明](docs/E2E.md)
|
|
174
|
+
- [Skill 跨模型评测](docs/EVALS.md)
|
|
175
|
+
- [变更记录](CHANGELOG.md)
|
|
176
|
+
- [贡献说明](CONTRIBUTING_zh.md)
|
|
177
|
+
- [第三方声明](NOTICE_zh.md)
|
|
178
|
+
- [MIT 许可证](LICENSE)
|