@x1a0f3n9/dsh-cmdline 0.1.2-alpha.6 → 0.1.5-rc.2
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/README.i18n.yaml +2 -2
- package/README.md +2 -4
- package/README.zh.md +10 -12
- package/package.json +3 -3
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/boot/cmdline/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: f0c6636b342d856b44c9d5eaffbbd4657f3e88ae
|
|
6
|
+
README.zh.md: b852c59ee42824c17af2cb429c71e7ca7cd0055b
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
`dsh-cmdline` lets
|
|
12
|
+
`dsh-cmdline` lets an app parse its own flags, `--help`, and errors from the arguments left unchanged after launcher flags. Parsed values can override configuration defaults without rewriting configuration. The app can also request process exit through the launcher's shutdown path. Use this package for app bins with their own command-line interface. It adds no prompt, schema, or model-visible content.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -106,10 +106,8 @@ The parse path is one small family with two owners: `provideCmdline` freezes the
|
|
|
106
106
|
<a id="further-exploration"></a>
|
|
107
107
|
## Further Exploration
|
|
108
108
|
|
|
109
|
-
Read these pages when the package-level contract is not enough. They move from the handoff mechanism to the apps that consume it
|
|
109
|
+
Read these pages when the package-level contract is not enough. They move from the handoff mechanism to the apps that consume it.
|
|
110
110
|
|
|
111
|
-
- [App-owned command-line decision](../../../.agents/notes/implemented/architecture/2026-08-06-app-owned-command-line.md) — why apps own their flag family and how the handoff works.
|
|
112
|
-
- [Command-line seam trim](../../../.agents/notes/implemented/architecture/2026-08-11-cmdline-seam-trim.md) — the seams reduced to existing interfaces.
|
|
113
111
|
- [dsh-app-boot](../app-boot/README.md) — the boot sequence that provides these launcher values.
|
|
114
112
|
- [dsh-web-app bundle](../../bundle/web-app/README.md) — an app that owns the Web flag family through this package.
|
|
115
113
|
- [dsh-headless bundle](../../bundle/headless/README.md) — the one-shot runner that reads its task from the command line.
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-library"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
`dsh-cmdline`
|
|
12
|
+
`dsh-cmdline` 让应用从启动器 flag 之后原样留下的参数中解析自己的 flag、`--help` 与错误。解析值可以覆盖配置默认值,而无需改写配置。应用还可以通过启动器的关停路径请求进程退出。适用于拥有自有命令行界面的应用 bin。它不增加提示词、schema 或模型可见内容。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -33,11 +33,11 @@ kind: "package-library"
|
|
|
33
33
|
|
|
34
34
|
- `ctx.cmdlineArgs`——本次调用的内层参数。读取它返回一份不可变快照,且绝不会消费或修改它们:`dsh --profile tui --resume abc` 给你的应用 `['--resume', 'abc']`。
|
|
35
35
|
- `ctx.appExit`——在整棵树关闭后请求进程退出的方式,接到启动器的关停控制器上。
|
|
36
|
-
- `ctx.appReady`——成功启动信号,只在 Loader
|
|
36
|
+
- `ctx.appReady`——成功启动信号,只在 Loader 树与启动器自有设置成功后提交。
|
|
37
37
|
|
|
38
38
|
没有参数的启动会看到空列表——这是诚实的答案,而不是缺失的值。
|
|
39
39
|
|
|
40
|
-
`exitOnStdinEnd(ctx, label)` 把已成功启动的 stdio 应用 EOF 绑定到 `ctx.appExit(0)`。它绝不读取或恢复 stdin,因此协议传输会收到挂载前已缓冲的字节;启动拒绝优先于竞态 EOF
|
|
40
|
+
`exitOnStdinEnd(ctx, label)` 把已成功启动的 stdio 应用 EOF 绑定到 `ctx.appExit(0)`。它绝不读取或恢复 stdin,因此协议传输会收到挂载前已缓冲的字节;启动拒绝优先于竞态 EOF,所属 fiber 会移除两个待处理的监听器。
|
|
41
41
|
|
|
42
42
|
### 解析你的 flag
|
|
43
43
|
|
|
@@ -63,7 +63,7 @@ kind: "package-library"
|
|
|
63
63
|
|
|
64
64
|
### flag 如何胜过配置值
|
|
65
65
|
|
|
66
|
-
写在 `!!js` 表达式旁的值是后备:flag 存在时 flag
|
|
66
|
+
写在 `!!js` 表达式旁的值是后备:flag 存在时 flag 优先,否则使用写下的值。配置求值在启动时、你的解析器运行之后执行一次,因此 flag 绝不会被之后的配置重载悄悄重置。
|
|
67
67
|
|
|
68
68
|
### 多个插件读取同一份参数
|
|
69
69
|
|
|
@@ -90,14 +90,14 @@ kind: "package-library"
|
|
|
90
90
|
|
|
91
91
|
### 解析约定
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
解析流程由两部分负责:`provideCmdline` 冻结宿主参数,并在任何配置树条目挂载前提供 `cmdlineArgs` 与 `appExit`;`parseCmdline` 针对不可变参数运行你的 commander program,把每个命令的 help、version 与错误输出都接到启动器上。被拒绝的值、`--help` 或 `--version` 会打印 commander 文本并请求 `ctx.appExit`,且不发布任何内容,因此依赖行绝不会激活;Loader 会把每行的 `!!js` 插值推迟到该行声明的注入全部激活之后。各导出的约定在代码中,不在本 README——见 [`src/index.ts`](src/index.ts)。
|
|
94
94
|
|
|
95
95
|
### 源码地图
|
|
96
96
|
|
|
97
97
|
| 文件 | 职责 |
|
|
98
98
|
|---|---|
|
|
99
99
|
| [`src/index.ts`](src/index.ts) | `CmdlineArgs`/`AppExit` 类型、`provideCmdline`、`parseCmdline`、commander 退出/输出路由 |
|
|
100
|
-
| — |
|
|
100
|
+
| — | 不发布运行时不变式配套条目;`cmdlineArgs` 是不可变的启动器事实,任意数量的普通插件都可以读取它。应用自有提供方与消费方使用普通 Cordis 服务注入;Loader 结算已会报告缺失的依赖。 |
|
|
101
101
|
|
|
102
102
|
</details>
|
|
103
103
|
|
|
@@ -106,10 +106,8 @@ kind: "package-library"
|
|
|
106
106
|
<a id="further-exploration"></a>
|
|
107
107
|
## 进一步探索
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
当包级约定不够用时阅读以下页面。它们从交接机制逐步进入消费它的应用。
|
|
110
110
|
|
|
111
|
-
- [应用持有命令行决策](../../../.agents/notes/implemented/architecture/2026-08-06-app-owned-command-line.zh.md)——为什么 flag 家族由应用持有,以及交接如何运作。
|
|
112
|
-
- [命令行 seam 精简](../../../.agents/notes/implemented/architecture/2026-08-11-cmdline-seam-trim.zh.md)——缩减到既有接口的各 seam。
|
|
113
111
|
- [dsh-app-boot](../app-boot/README.zh.md)——提供这些启动器值的启动序列。
|
|
114
112
|
- [dsh-web-app 组合包](../../bundle/web-app/README.zh.md)——通过此包持有 Web flag 家族的应用。
|
|
115
113
|
- [dsh-headless 组合包](../../bundle/headless/README.zh.md)——从命令行读取任务的一次性 runner。
|
|
@@ -119,7 +117,7 @@ kind: "package-library"
|
|
|
119
117
|
<a id="model-experience"></a>
|
|
120
118
|
## 模型体验
|
|
121
119
|
|
|
122
|
-
|
|
120
|
+
无。本包在任何会话存在之前解析进程自身的命令行;所有模型可见的影响都由配置行产生。
|
|
123
121
|
|
|
124
122
|
#### KV Cache 影响
|
|
125
123
|
|
|
@@ -132,8 +130,8 @@ kind: "package-library"
|
|
|
132
130
|
|
|
133
131
|
这些限制说明应用自有命令行在何时不合适,或何时需要特别注意。它们是当前包约束,不是任务积压。
|
|
134
132
|
|
|
135
|
-
- **启动器的 flag 必须写在应用参数之前**——切分按位置进行:启动器不认识的第一个 token 就是内层参数的起点,因此写在某个应用 flag 之后的 `--patch` 属于应用。启动器的解析器会消耗掉一个
|
|
136
|
-
-
|
|
133
|
+
- **启动器的 flag 必须写在应用参数之前**——切分按位置进行:启动器不认识的第一个 token 就是内层参数的起点,因此写在某个应用 flag 之后的 `--patch` 属于应用。启动器的解析器会消耗掉一个 `--`,因此需要以字面量 `--` 传给应用的参数必须写成 `-- --`。
|
|
134
|
+
- **应用自有服务没有静态声明的提供方**——消费方行通过普通注入点名它;缺少提供方的组合包会在结算时失败,由待处理条目点名该服务,而不是在加载时失败。
|
|
137
135
|
- **用户 patch 若整体替换某行的 `config`,会连同其中的表达式一起丢掉**——flag 胜过的是表达式旁写着的那个值,而不是用户用字面量替换掉表达式之后的结果;保留表达式才能保留 flag 的优先级。
|
|
138
136
|
|
|
139
137
|
<a id="dev-note"></a>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x1a0f3n9/dsh-cmdline",
|
|
3
3
|
"description": "Immutable command-line handoff from a dsh launcher to any app plugin that injects cmdlineArgs",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"commander": "^15.0.0",
|
|
35
|
-
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
36
35
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
37
|
-
"@deepseek-ai/cordis-plugin-loader": "^1.0.3"
|
|
36
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
37
|
+
"@deepseek-ai/cordis-plugin-include": "^1.0.7"
|
|
38
38
|
}
|
|
39
39
|
}
|