用户手册

Autarx 命令手册

CLI 是 Autarx 的全功能入口,本手册就是它的命令手册:五分钟上手、每个子命令的真实示例(全部在仓库 fixture 上跑通)、GUI 简节与常见问题。

五分钟上手

下载,解压, 第一条 inspect。

01

下载并解压 CLI

到 releases 页下载你平台的自包含 zip,解压得到 autarx 可执行文件——无需安装运行时,Racket 引擎已打包在内。

terminal
$ unzip autarx-<version>-macos-arm64.zip -d autarx $ ./autarx/autarx --version

macOS / Linux:如需全局使用,把解压目录放进 PATH,或把 autarx 移到 /usr/local/bin。

02

第一条命令:inspect

把 OEM 交付包(一个目录或单个 ARXML)交给 inspect,它回答「这次交付里有什么」。以下输出在仓库自带 fixture 上真实跑通,本书所有示例同样如此。

terminal
$ autarx inspect shared/fixtures/OemDelivery workspace shared/fixtures/OemDelivery files 2 (5,218 B) elements 86 identifiables 11 packages 11 references 8 (1 unresolved) duplicate paths 0 file errors 0 autosar release 4.3.0 namespaces 1 distinct semantic inventory: system 1 ecu 3 communication-cluster 1 frame 1 pdu 1 signal 1 …
03

读懂输出

files 是交付包里的 ARXML 数量;identifiables 是带 SHORT-NAME 的可索引对象数;references 统计跨对象引用,括号里是断链(unresolved)数量——交付接手第一眼先看它;autosar release 从 XSD schema location 推出(如 AUTOSAR_4-3-0.xsd → 4.3.0);semantic inventory 是按语义类别的清单。

04

机器可读:--json

所有命令都接受 --json,输出确定性 camelCase JSON——供 CI 与 AI agent 消费。上面同一条命令的 JSON 输出(节选):

terminal
$ autarx inspect shared/fixtures/OemDelivery --json { "workspace": "shared/fixtures/OemDelivery", "fileCount": 2, "totalElementCount": 86, "identifiableCount": 11, "referenceCount": 8, "unresolvedReferenceCount": 1, "autosar": { "release": "4.3.0", "mixedSchema": false, … }, "semanticCounts": { "system": 1, "ecu": 3, … } }

工作区命令

接受一个目录(多文件交付包)或单个 ARXML 作为工作区。

inspect

一句话:总结工作区——文件、语义清单、引用与断链计数。上手命令,见上文五分钟上手。

autarx inspect <workspace> [--json]

find

一句话:按 SHORT-NAME 子串检索对象,定位 signal、PDU、SWC、ECU 等任意元素。

autarx find <pattern> <workspace> [--json]
terminal
$ autarx find Radar shared/fixtures/OemDelivery ecu /Vehicle/Ecus/RadarFL system.arxml ecu /Vehicle/Ecus/RadarFR system.arxml

--json 机器可读输出;未命中时以退出码 1 结束(便于 CI 断言)。

refs

一句话:看一个对象的出边与入边——它引用了谁、谁引用了它。

autarx refs <name-or-path> <workspace> [--incoming] [--outgoing] [--json]
terminal
$ autarx refs /Vehicle/Ecus/RadarFL shared/fixtures/OemDelivery object /Vehicle/Ecus/RadarFL (ecu) outgoing (1): -> CHANNEL-REF /Vehicle/Clusters/VehicleCan via /Con_RadarFL incoming (0):

对象名可写全路径(如上)或精确 SHORT-NAME;--incoming / --outgoing 只看单向。

trace

一句话:从对象出发沿引用图 BFS 追踪(深度受限),跨文件看清关联闭包。

autarx trace <name-or-path> <workspace> [--depth N] [--incoming|--outgoing|--both] [--json]
terminal
$ autarx trace /Vehicle/Ecus/RadarFL shared/fixtures/OemDelivery --depth 2 trace from /Vehicle/Ecus/RadarFL (depth 2, both): [1] CHANNEL-REF /Vehicle/Ecus/RadarFL -> /Vehicle/Clusters/VehicleCan [2] CHANNEL-REF /Vehicle/Ecus/Gateway -> /Vehicle/Clusters/VehicleCan [2] CHANNEL-REF /Vehicle/Ecus/RadarFL -> /Vehicle/Clusters/VehicleCan [2] CHANNEL-REF /Vehicle/Ecus/RadarFR -> /Vehicle/Clusters/VehicleCan 4 object(s) reachable, 4 edge(s)

--depth 限制 BFS 层数;--incoming/--outgoing/--both 选方向(默认双向)。

ecus

一句话:列出工作区里所有 ECU 实例。

autarx ecus <workspace> [--json]
terminal
$ autarx ecus shared/fixtures/OemDelivery Gateway /Vehicle/Ecus/Gateway system.arxml RadarFL /Vehicle/Ecus/RadarFL system.arxml RadarFR /Vehicle/Ecus/RadarFR system.arxml

ecu

一句话:看单个 ECU 实例及其直接关系(注意参数顺序:工作区在前,ECU 名在后)。

autarx ecu <workspace> <ecu-name> [--json]
terminal
$ autarx ecu shared/fixtures/OemDelivery RadarFL RadarFL (ecu) path /Vehicle/Ecus/RadarFL file system.arxml outgoing references (1): -> CHANNEL-REF /Vehicle/Clusters/VehicleCan incoming references (0):

名字歧义时以退出码 2 结束,用路径消歧。

unresolved

一句话:列出目标不在工作区内的断链引用——交付完整性的第一道检查。

autarx unresolved <workspace> [--json]
terminal
$ autarx unresolved shared/fixtures/OemDelivery /Vehicle/SwCs/SpeedSensor/CalibrationIn -[REQUIRED-INTERFACE-TREF]-> /Vehicle/Interfaces/IF_Calibration (communication.arxml) 1 unresolved reference(s)

有发现时退出码为 1——直接放进 CI 作为门禁。

diff

一句话:按路径身份语义对比两版交付——报参数值与类型变化,绝不报行号。

autarx diff <before> <after> [--detail] [--json]
terminal
$ autarx diff shared/fixtures/DiffBefore shared/fixtures/DiffAfter --detail before: 2 files, 10 objects, 4 references — shared/fixtures/DiffBefore after: 2 files, 9 objects, 4 references — shared/fixtures/DiffAfter added (1): + ECU-INSTANCE /Vehicle/Ecus/Display removed (2): - CAN-CLUSTER /Vehicle/Clusters/SpareCan - ECU-INSTANCE /Vehicle/Ecus/Legacy modified (3): ~ ECUC-MODULE-CONFIGURATION-VALUES /Config/Diag CONTAINERS/DiagGeneral/PARAMETER-VALUES/DiagParamA/VALUE: 1 → 2 …

--detail 展开到容器内参数级;有差异时退出码为 1。

impact

一句话:站在你的 ECU 视角做影响分析——把每个变化归类为相关/无关,并标出 breaking。

autarx impact <before> <after> --ecu <name> [--detail] [--json]
terminal
$ autarx impact shared/fixtures/DiffBefore shared/fixtures/DiffAfter --ecu Gateway impact for Gateway (/Vehicle/Ecus/Gateway) — ECU present in after delivery closure: 7 objects in scope, relevant changes: 4, unrelated: 2, breaking: 2 findings: [breaking] ARX-IMP-REMOVED-REFERENCED /Vehicle/Clusters/SpareCan [breaking] ARX-IMP-REMOVED-REFERENCED /Vehicle/Ecus/Legacy [info] ARX-IMP-OBJECT-MODIFIED /Config/Diag/DiagGeneral …

--ecu 必填,指定你负责的 ECU;--detail 展开每条 finding 的细节;有 breaking 时退出码为 1。

comm

一句话:通信投影——Cluster → Frame → PDU → Signal 链路,并报告孤儿对象。

autarx comm <workspace> [--cluster <name>] [--json]
terminal
$ autarx comm shared/fixtures/CommDelivery VehicleCan (/Vehicle/Clusters/VehicleCan) ecus: Gateway, RadarFL frames: frame Frame_VehicleSpeed pdu Pdu_VehicleSpeed signals: VehicleSpeed frame Frame_VehicleSpeedFa pdu Pdu_VehicleSpeedFa signals: BrakePressure, VehicleSpeed orphan signals (1) — not attached to any parent: /Vehicle/Signals/DiagCounter

--cluster 只投影指定集群。投影只陈述结构,不虚构收发方向。

单文件命令

接受单个 ARXML 文件。

info

一句话:单个 ARXML 的摘要——大小、元素数、ECUC 模块、解析耗时。

autarx info <file.arxml> [--json]
terminal
$ autarx info shared/fixtures/minimal.arxml file shared/fixtures/minimal.arxml size 3,857 B elements 48 ecuc modules 2 (Mcu, Can) parsed in 1 ms

modules

一句话:列出文件里的 ECUC 模块配置及容器/参数计数。

autarx modules <file.arxml> [--json]
terminal
$ autarx modules shared/fixtures/minimal.arxml Mcu /AURIX2G/Mcu containers=2 parameters=3 Can /AURIX2G/Can containers=1 parameters=1

validate

一句话:结构检查——XML 正确性、工作区完整性、断链、重复路径。这不是 vendor 级校验:生产级校验请用 DaVinci / tresos / ISOLAR。

autarx validate <file.arxml> [--json]
terminal
$ autarx validate shared/fixtures/minimal.arxml 0 error(s), 0 warning(s)

有 error/warning 时退出码为 1,可直接作 CI 门禁。

厂商工具(只做交接,不重新实现生成)

探测本机的 DaVinci / EB tresos / ISOLAR 并中继它们的校验运行——autarx 从不评判工程结论。

vendor

autarx vendor list [--json] autarx vendor validate <tool> <project>

探测顺序:先查工具的 HOME 环境变量(DAVINCI_HOME、TRESOS_HOME、ISOLAR_HOME),再查 PATH。可用工具:davinci · tresos · isolar。

受控编辑(plan → diff → apply → undo)

语义改名、ECUC 参数与引用编辑。每次写盘都被语义 diff 把关:plan 生成变更预览,apply 前必须经过 diff 审阅,undo 可回退。

patch

autarx patch plan <workspace> --file ops.json [--json] autarx patch apply <workspace> --file ops.json [--json] autarx patch undo <workspace> [--json]

ops.json 声明操作列表,例如:

ops.json
{ "operations": [ { "op": "rename", "target": "/Pkg/Obj", "newName": "NewName" }, { "op": "set-parameter", "target": "/Pkg/Module", "definition": "/Vendor/Module/Ctr/Param", "value": "2" }, { "op": "add-parameter", "target": "/Pkg/Module", "definition": "/Vendor/Module/Ctr/NewParam", "value": "5" } ] }

AI agent 接口

mcp

一句话:启动 MCP stdio 服务器(JSON-RPC 2.0),把完整工具 API 暴露给 AI agent。不存在裸写工具——agent 无法绕过审阅边界,每次调用都进工作区审计日志。

autarx mcp

自更新

update

一句话:检查 GitHub Releases 上的 Ed25519 签名 update feed,验证签名与 SHA-256 后自更新。

autarx update [--check] [--json] [--feed <https-url>]

--check 只检查不安装(有新版时退出码 1,便于脚本探测);--feed 覆盖 feed 地址。两条网络腿都有看门狗:manifest 60 秒、下载 120 秒停滞 / 30 分钟硬顶。

参考

全局选项 与退出码。

选项含义
--json所有命令可用;确定性 camelCase JSON 输出(CI / AI agent 友好)
-h / --help显示总帮助(含全部子命令)
--version显示版本号
退出码含义
0成功
1无命中(find/refs/trace/ecu),或发现了问题(validate/unresolved/diff/impact);update --check 表示有新版
2用法、文件或解析错误;对象名歧义
3未处理崩溃(日志写在 <TEMP>/autarx/crashes)
GUI

三平台工作台, 同一个引擎。

GUI 与 CLI 跑同一个 Racket 语义引擎,只是各自换成原生窗口:macOS(SwiftUI)、Windows(WinUI)、Linux(GTK4)。macOS 下载 autarx-<version>-macos-<arch>.dmg 拖入 Applications——ad-hoc 签名,首次启动请右键 App 选「打开」,且只有装在 /Applications(或 ~/Applications)的副本才能自更新。Windows 用 autarx-<version>-windows-x64.msi 安装。Linux 提供 deb / rpm / AppImage,或解压 -app.tar.gz 便携运行。三端都内置「检查更新」,走同一条 Ed25519 签名 feed:macOS 原子换包自动重启;Windows 便携版就地换目录、MSI 安装走被动升级;Linux 便携副本下载后引导手动解压覆盖,deb / rpm / AppImage 按安装形态引导。

FAQ

常见问题。

支持哪些平台?

CLI:macOS(Apple silicon / Intel)、Linux(x64 / arm64)、Windows(x64)自包含 zip。GUI:macOS 14+(Apple silicon / Intel)dmg、Windows 10+(x64)MSI、Linux(x64 / arm64)deb / rpm / AppImage——三端同一引擎、同一交互面。

能读什么数据?需要什么格式的输入?

ARXML——System Description、System Extract、ECU Extract、ECUC 与通信 ARXML,支持多文件交付包(把目录交给命令即可)。AUTOSAR 版本从 XSD schema location 自动识别(如 AUTOSAR_4-3-0.xsd → 4.3.0),已知 revision 映射到经典版本号,未知 revision 原样保留。许可方式为 source-available(源码可见、专有许可),详见仓库 LICENSE。

与 DaVinci / tresos / ISOLAR 是什么关系?

共存,不替代。Autarx 不是配置器,不重做 vendor 的校验与代码生成;它补的是「收到 OEM 交付」到「打开 vendor 工具链」之间的工程缺口。vendor 侧的校验仍是权威路径——autarx 通过 vendor 命令中继 DaVinci/tresos/ISOLAR 的校验运行并归一化诊断,编辑过的文件最终仍交回 vendor 工具链验证。

更新机制是怎样的?

CLI 用 autarx update、三平台 GUI 用内置「检查更新」,都消费 Ed25519 签名的 update feed:先验证 wrapper 签名,再校验工件 SHA-256,然后按平台就位——macOS 换包重启,Windows 便携版换目录、MSI 安装走被动升级,Linux 下载后引导手动解压(AppImage 原地替换后重启)。任何一步验证失败都会 fail-closed 拒绝更新——这是有意为之的安全行为,不是故障。

怎么卸载?

CLI:删除解压出来的目录(以及你复制到 PATH 里的 autarx 二进制);运行期状态在系统临时目录的 autarx 子目录(崩溃日志 <TEMP>/autarx/crashes、更新器状态),可一并删除。GUI:macOS 把 Autarx.app 拖进废纸篓;Windows 在「设置 › 应用」卸载 MSI;Linux 用包管理器移除(deb / rpm),AppImage 直接删文件。