Initial Dever 0.0.1

This commit is contained in:
Codex committed 2026-11-03 03:32:07 +00:00
commit 81233d098c
1479 files changed
+163782

No files matched your search

@@ -0,0 +1 @@
{}
@@ -0,0 +1,9 @@
# 外部命令
通过 Port 调用工具并读取版本。
- [工具适配器](doc/adapter.md)
- [工具版本命令](doc/api.md)
- [业务操作](doc/app.md)
- [外部接口](doc/port.md)
- [调用流程](link.md)
@@ -0,0 +1 @@
external command "bin/tool" {}
@@ -0,0 +1 @@
cmd version = app.version
@@ -0,0 +1,14 @@
type Version {
code: Int
stdout: Text
stderr: Text
}
version() (version: Version) {
output = port.execute(["--version"], null)
version = Version {
code = output.code
stdout = dever.bytes.toText(output.stdout)
stderr = dever.bytes.toText(output.stderr)
}
}
@@ -0,0 +1,3 @@
# 工具适配器
调用受管资源中的 `bin/tool`。程序参数由 Port 传入,不通过 shell 执行。
@@ -0,0 +1,5 @@
# 工具版本命令
## document.tool.api.version
运行工具的 --version 并返回退出码和输出。
@@ -0,0 +1,9 @@
# 业务操作
## document.tool.Version
外部命令的退出码及解码后的标准输出、错误输出。
## document.tool.version
执行工具的 --version,将输出按 UTF-8 解码;命令非零退出码仍作为结果返回。
@@ -0,0 +1,5 @@
# 外部接口
## document.tool.port.execute
执行指定工具并返回退出码和原始输出,stdin 可为空。
@@ -0,0 +1,127 @@
<!-- Generated by dever inspect --links. Do not edit. -->
<!-- source-sha256: c3d45ae2a42beb7d0a9cdab16d131b25e36234ae4dce85b2b66c0086454ba10a -->
# document.tool
按求值顺序展示调用、分支和任务调度,包含 API 与自动 REST 入口。点击节点打开源码;双框为调用,虚线为调度或错误路径。外部库和驱动不展开。
图不是某次运行的日志,分句和 Adapter 按输入或配置选择。修改源码后运行 `dever inspect . --links`。
## 入口
- CMD [document.tool.api.version](api.dever#L1) → [document.tool.version](app.dever#L7)
## 外部调用方
当前加载的源码中没有已收录的外部调用。
## 能力与内部调用
### document.tool.Version
定义:[app.dever:1:1](app.dever#L1,1)
没有已收录的下游调用。
### document.tool.adapter.execute
定义:[adapter.dever:1:1](adapter.dever#L1,1)
<a id="flow-82fa6bebec059055-1"></a>
```mermaid
flowchart TD
n0(["execute"])
click n0 href "adapter.dever#L1,1" "打开源码"
n1(["返回"])
n3[["外部命令边界:execute(受检参数、退出状态与输出)"]]
click n3 href "adapter.dever#L1,1" "打开源码"
n4(["声明的业务错误或 Worker 故障向调用方传播"])
n0 --> n3
n3 -->|"成功"| n1
n3 -->|"失败"| n4
```
没有已收录的下游调用。
### document.tool.api.version
定义:[api.dever:1:1](api.dever#L1,1)
<a id="flow-437acd584ec674f9-1"></a>
```mermaid
flowchart TD
n0(["document.tool.api.version"])
click n0 href "api.dever#L1,15" "打开源码"
n1[["document.tool.version"]]
click n1 href "api.dever#L1,15" "打开源码"
n2(["返回命令结果;未捕获错误终止命令"])
n0 --> n1
n1 --> n2
```
<details>
<summary>源码与子流程</summary>
| 节点 | 源码 | 子流程 |
| --- | --- | --- |
| document.tool.version | [api.dever:1:15](api.dever#L1,15) | [document.tool.version](link.md#flow-d23463cc55069c99-1) |
</details>
| 目标 | 归属 | 方式 | 调用位置 |
| --- | --- | --- | --- |
| [document.tool.version](app.dever#L7) | 领域内 | CMD 绑定 | [api.dever:1:15](api.dever#L1,15) |
### document.tool.port.execute
定义:[port.dever:1:1](port.dever#L1,1)
没有已收录的下游调用。
### document.tool.version
定义:[app.dever:7:1](app.dever#L7,1)
<a id="flow-d23463cc55069c99-1"></a>
```mermaid
flowchart TD
n0(["version"])
click n0 href "app.dever#L7,1" "打开源码"
n1(["返回"])
n3[["document.tool.adapter.execute"]]
click n3 href "app.dever#L8,12" "打开源码"
n4["赋值 output"]
click n4 href "app.dever#L8,12" "打开源码"
n5[["dever.bytes.toText"]]
click n5 href "app.dever#L11,14" "打开源码"
n6[["dever.bytes.toText"]]
click n6 href "app.dever#L12,14" "打开源码"
n7["赋值 version"]
click n7 href "app.dever#L9,13" "打开源码"
n0 --> n3
n3 --> n4
n4 --> n5
n5 --> n6
n6 --> n7
n7 --> n1
```
<details>
<summary>源码与子流程</summary>
| 节点 | 源码 | 子流程 |
| --- | --- | --- |
| document.tool.adapter.execute | [app.dever:8:12](app.dever#L8,12) | [document.tool.adapter.execute](link.md#flow-82fa6bebec059055-1) |
| dever.bytes.toText | [app.dever:11:14](app.dever#L11,14) | 依赖或生成的分派(本页不展开) |
| dever.bytes.toText | [app.dever:12:14](app.dever#L12,14) | 依赖或生成的分派(本页不展开) |
</details>
| 目标 | 归属 | 方式 | 调用位置 |
| --- | --- | --- | --- |
| [document.tool.adapter.execute](adapter.dever#L1) | 领域内 | 调用 | [app.dever:8:12](app.dever#L8,12) |
| `dever.bytes.toText` | 依赖 | 调用 | [app.dever:11:14](app.dever#L11,14) |
| `dever.bytes.toText` | 依赖 | 调用 | [app.dever:12:14](app.dever#L12,14) |
@@ -0,0 +1 @@
execute(args: List<Text>, stdin: Bytes?) (output: dever.process.Output) fails dever.process.Error
@@ -0,0 +1,16 @@
version() () {
output = app.version()
assertEq(output.code, 0)
assertEq(output.stdout, "tool 1.0\n")
assertEq(output.stderr, "")
}
port.execute(args: List<Text>, stdin: Bytes?) (output: dever.process.Output) {
assertEq(args, ["--version"])
assertEq(stdin, null)
output = dever.process.Output {
code = 0
stdout = dever.bytes.fromText("tool 1.0\n")
stderr = dever.bytes.fromText("")
}
}