buckyos 0.7.114 → 0.7.116
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.md +8 -0
- package/cli/core/app.ts +1 -0
- package/cli/core/argv.ts +14 -3
- package/cli/core/registry.ts +7 -0
- package/cli/dist/cli.mjs +22 -4
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/runtime/host.ts +2 -0
- package/cli/version.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,14 @@ npx buckyos app status example
|
|
|
17
17
|
npx buckyos log tail --app example
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
当命令需要读取项目目录和 Tool 包目录之外的源码时,通过可重复的全局参数显式授权:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx buckyos --allow-read ../shared-assets --allow-read /opt/app-source pikg build ./dapp_meta
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`--allow-read` 只增加读权限,不会增加写权限。
|
|
27
|
+
|
|
20
28
|
`npx buckyos` 和 npm scripts 中的 `buckyos` 固定使用项目 lockfile 对应的 Tool。PATH 中裸 `buckyos`
|
|
21
29
|
由 BuckyOS 系统安装器管理并指向 `$BUCKYOS_ROOT/bin/buckyos`;文档不推荐全局
|
|
22
30
|
`npm install -g buckyos`。两种分发运行同一套命令实现,互不覆盖、互不调用、也不会自更新。
|
package/cli/core/app.ts
CHANGED
|
@@ -487,6 +487,7 @@ function topLevelHelp(registry: CommandRegistry): string {
|
|
|
487
487
|
'',
|
|
488
488
|
'Global options:',
|
|
489
489
|
' --config-dir <path> --profile <name> --zone <host-or-did>',
|
|
490
|
+
' --allow-read <path> Add a readable filesystem root (repeatable)',
|
|
490
491
|
' --endpoint <url> --identity <did-or-name>',
|
|
491
492
|
' --session-token <token> | --session-token-file <path>',
|
|
492
493
|
' Prefer --session-token-file for automation; argv tokens may appear in process listings.',
|
package/cli/core/argv.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type OutputFormat = typeof OUTPUT_FORMATS[number]
|
|
|
7
7
|
|
|
8
8
|
export interface GlobalOptions {
|
|
9
9
|
configDir?: string
|
|
10
|
+
allowRead?: string[]
|
|
10
11
|
profile?: string
|
|
11
12
|
zone?: string
|
|
12
13
|
endpoint?: string
|
|
@@ -60,6 +61,10 @@ const STRING_GLOBALS = new Map<string, keyof GlobalOptions>([
|
|
|
60
61
|
['idempotency-key', 'idempotencyKey'],
|
|
61
62
|
])
|
|
62
63
|
|
|
64
|
+
const REPEATABLE_STRING_GLOBALS = new Map<string, keyof GlobalOptions>([
|
|
65
|
+
['allow-read', 'allowRead'],
|
|
66
|
+
])
|
|
67
|
+
|
|
63
68
|
const BOOLEAN_GLOBALS = new Map<string, keyof GlobalOptions>([
|
|
64
69
|
['cli', 'cli'],
|
|
65
70
|
['wait', 'wait'],
|
|
@@ -106,11 +111,16 @@ export function parseInvocation(argv: string[]): Invocation {
|
|
|
106
111
|
continue
|
|
107
112
|
}
|
|
108
113
|
const stringProperty = STRING_GLOBALS.get(parsed.name)
|
|
109
|
-
|
|
114
|
+
const repeatableStringProperty = REPEATABLE_STRING_GLOBALS.get(parsed.name)
|
|
115
|
+
if (!stringProperty && !repeatableStringProperty) {
|
|
110
116
|
throw new UsageError('UNKNOWN_OPTION', `unknown global option: --${parsed.name}`)
|
|
111
117
|
}
|
|
112
118
|
const { value, consumed } = readOptionValue(argv, index, parsed)
|
|
113
|
-
|
|
119
|
+
if (repeatableStringProperty === 'allowRead') {
|
|
120
|
+
global.allowRead = [...(global.allowRead ?? []), value]
|
|
121
|
+
} else {
|
|
122
|
+
setGlobal(global, stringProperty!, normalizeGlobalValue(parsed.name, value))
|
|
123
|
+
}
|
|
114
124
|
index += consumed
|
|
115
125
|
}
|
|
116
126
|
|
|
@@ -183,7 +193,8 @@ export function parseCommandArgs(
|
|
|
183
193
|
}
|
|
184
194
|
if (
|
|
185
195
|
allowReplScopedGlobals &&
|
|
186
|
-
(STRING_GLOBALS.has(parsed.name) ||
|
|
196
|
+
(STRING_GLOBALS.has(parsed.name) || REPEATABLE_STRING_GLOBALS.has(parsed.name) ||
|
|
197
|
+
BOOLEAN_GLOBALS.has(parsed.name))
|
|
187
198
|
) {
|
|
188
199
|
throw new UsageError(
|
|
189
200
|
'SESSION_OPTION_FROZEN',
|
package/cli/core/registry.ts
CHANGED
|
@@ -6,6 +6,13 @@ const KEBAB_CASE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/
|
|
|
6
6
|
|
|
7
7
|
const GLOBAL_OPTIONS = [
|
|
8
8
|
{ name: 'config-dir', property: 'configDir', type: 'string', scope: 'process' },
|
|
9
|
+
{
|
|
10
|
+
name: 'allow-read',
|
|
11
|
+
property: 'allowRead',
|
|
12
|
+
type: 'string',
|
|
13
|
+
scope: 'process',
|
|
14
|
+
repeatable: true,
|
|
15
|
+
},
|
|
9
16
|
{ name: 'profile', property: 'profile', type: 'string', scope: 'session' },
|
|
10
17
|
{ name: 'zone', property: 'zone', type: 'string', scope: 'session' },
|
|
11
18
|
{ name: 'endpoint', property: 'endpoint', type: 'string', scope: 'session' },
|
package/cli/dist/cli.mjs
CHANGED
|
@@ -104,6 +104,9 @@ const STRING_GLOBALS = /* @__PURE__ */ new Map([
|
|
|
104
104
|
["trace-id", "traceId"],
|
|
105
105
|
["idempotency-key", "idempotencyKey"]
|
|
106
106
|
]);
|
|
107
|
+
const REPEATABLE_STRING_GLOBALS = /* @__PURE__ */ new Map([
|
|
108
|
+
["allow-read", "allowRead"]
|
|
109
|
+
]);
|
|
107
110
|
const BOOLEAN_GLOBALS = /* @__PURE__ */ new Map([
|
|
108
111
|
["cli", "cli"],
|
|
109
112
|
["wait", "wait"],
|
|
@@ -149,11 +152,16 @@ function parseInvocation(argv) {
|
|
|
149
152
|
continue;
|
|
150
153
|
}
|
|
151
154
|
const stringProperty = STRING_GLOBALS.get(parsed.name);
|
|
152
|
-
|
|
155
|
+
const repeatableStringProperty = REPEATABLE_STRING_GLOBALS.get(parsed.name);
|
|
156
|
+
if (!stringProperty && !repeatableStringProperty) {
|
|
153
157
|
throw new UsageError("UNKNOWN_OPTION", `unknown global option: --${parsed.name}`);
|
|
154
158
|
}
|
|
155
159
|
const { value, consumed } = readOptionValue(argv, index, parsed);
|
|
156
|
-
|
|
160
|
+
if (repeatableStringProperty === "allowRead") {
|
|
161
|
+
global.allowRead = [...global.allowRead ?? [], value];
|
|
162
|
+
} else {
|
|
163
|
+
setGlobal(global, stringProperty, normalizeGlobalValue(parsed.name, value));
|
|
164
|
+
}
|
|
157
165
|
index += consumed;
|
|
158
166
|
}
|
|
159
167
|
const module = argv[index];
|
|
@@ -214,7 +222,7 @@ function parseCommandArgs(command, argv, inputObject, allowReplScopedGlobals = f
|
|
|
214
222
|
index += consumed2;
|
|
215
223
|
continue;
|
|
216
224
|
}
|
|
217
|
-
if (allowReplScopedGlobals && (STRING_GLOBALS.has(parsed.name) || BOOLEAN_GLOBALS.has(parsed.name))) {
|
|
225
|
+
if (allowReplScopedGlobals && (STRING_GLOBALS.has(parsed.name) || REPEATABLE_STRING_GLOBALS.has(parsed.name) || BOOLEAN_GLOBALS.has(parsed.name))) {
|
|
218
226
|
throw new UsageError(
|
|
219
227
|
"SESSION_OPTION_FROZEN",
|
|
220
228
|
`--${parsed.name} is frozen for the interactive session`
|
|
@@ -593,6 +601,8 @@ function collectArgumentPaths(argv) {
|
|
|
593
601
|
if (name === "config-dir") {
|
|
594
602
|
read.push(value);
|
|
595
603
|
write.push(value);
|
|
604
|
+
} else if (name === "allow-read") {
|
|
605
|
+
read.push(value);
|
|
596
606
|
} else if (["input", "session-token-file", "identity-root", "security-root", "pikg"].includes(name)) {
|
|
597
607
|
if (value !== "-")
|
|
598
608
|
read.push(value);
|
|
@@ -1984,6 +1994,13 @@ function displayValue(value) {
|
|
|
1984
1994
|
const KEBAB_CASE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
1985
1995
|
const GLOBAL_OPTIONS = [
|
|
1986
1996
|
{ name: "config-dir", property: "configDir", type: "string", scope: "process" },
|
|
1997
|
+
{
|
|
1998
|
+
name: "allow-read",
|
|
1999
|
+
property: "allowRead",
|
|
2000
|
+
type: "string",
|
|
2001
|
+
scope: "process",
|
|
2002
|
+
repeatable: true
|
|
2003
|
+
},
|
|
1987
2004
|
{ name: "profile", property: "profile", type: "string", scope: "session" },
|
|
1988
2005
|
{ name: "zone", property: "zone", type: "string", scope: "session" },
|
|
1989
2006
|
{ name: "endpoint", property: "endpoint", type: "string", scope: "session" },
|
|
@@ -4741,7 +4758,7 @@ function invalid(stage, message, entry) {
|
|
|
4741
4758
|
function stableJsonDigest(value) {
|
|
4742
4759
|
return sha256Bytes(new TextEncoder().encode(ndn.toCanonicalJsonString(value)));
|
|
4743
4760
|
}
|
|
4744
|
-
const PACKAGE_VERSION = "0.7.
|
|
4761
|
+
const PACKAGE_VERSION = "0.7.116";
|
|
4745
4762
|
const TOOL_VERSION = PACKAGE_VERSION;
|
|
4746
4763
|
const SDK_VERSION = PACKAGE_VERSION;
|
|
4747
4764
|
const PROTOCOL_VERSION = "1";
|
|
@@ -8795,6 +8812,7 @@ function topLevelHelp(registry) {
|
|
|
8795
8812
|
"",
|
|
8796
8813
|
"Global options:",
|
|
8797
8814
|
" --config-dir <path> --profile <name> --zone <host-or-did>",
|
|
8815
|
+
" --allow-read <path> Add a readable filesystem root (repeatable)",
|
|
8798
8816
|
" --endpoint <url> --identity <did-or-name>",
|
|
8799
8817
|
" --session-token <token> | --session-token-file <path>",
|
|
8800
8818
|
" Prefer --session-token-file for automation; argv tokens may appear in process listings.",
|