@synopackageland/cli 0.13.1 → 0.15.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/CHANGELOG.md +18 -0
- package/README.md +44 -1
- package/dist/build-spk/generator.d.ts +3 -2
- package/dist/build-spk/generator.js +6 -850
- package/dist/build-spk/resource-worker.d.ts +2 -14
- package/dist/build-spk/resource-worker.js +3 -166
- package/dist/cli.js +208 -56
- package/dist/compose/analyze.d.ts +3 -61
- package/dist/compose/analyze.js +35 -776
- package/dist/compose/env.d.ts +5 -3
- package/dist/compose/env.js +17 -25
- package/dist/compose/runner.js +23 -6
- package/dist/contract/app-launch.d.ts +11 -0
- package/dist/contract/app-launch.js +18 -0
- package/dist/contract/web-launch.d.ts +3 -13
- package/dist/contract/web-launch.js +14 -81
- package/dist/ctl/cli.d.ts +36 -0
- package/dist/ctl/cli.js +218 -0
- package/dist/ctl/descriptor.d.ts +81 -0
- package/dist/ctl/descriptor.js +93 -0
- package/dist/ctl/dsm-auth.d.ts +10 -0
- package/dist/ctl/dsm-auth.js +30 -0
- package/dist/ctl/errors.d.ts +17 -0
- package/dist/ctl/errors.js +32 -0
- package/dist/ctl/flows.d.ts +11 -0
- package/dist/ctl/flows.js +52 -0
- package/dist/ctl/input.d.ts +20 -0
- package/dist/ctl/input.js +128 -0
- package/dist/ctl/json.d.ts +2 -0
- package/dist/ctl/json.js +38 -0
- package/dist/ctl/redaction.d.ts +15 -0
- package/dist/ctl/redaction.js +198 -0
- package/dist/ctl/service.d.ts +38 -0
- package/dist/ctl/service.js +156 -0
- package/dist/ctl/store.d.ts +51 -0
- package/dist/ctl/store.js +93 -0
- package/dist/ctl/transfers.d.ts +14 -0
- package/dist/ctl/transfers.js +74 -0
- package/dist/ctl/transport.d.ts +11 -0
- package/dist/ctl/transport.js +79 -0
- package/dist/deploy/deploy.d.ts +4 -3
- package/dist/deploy/deploy.js +5 -210
- package/dist/deploy/plan.js +26 -7
- package/dist/dev.js +5 -4
- package/dist/error-registry.js +1020 -831
- package/dist/info.js +120 -28
- package/dist/init.js +188 -64
- package/dist/inspect.js +21 -6
- package/dist/runtime/executor-digests.json +1 -12
- package/dist/skill.js +51 -9
- package/dist/standalone/api-description-inspect.d.ts +4 -0
- package/dist/standalone/api-description-inspect.js +12 -0
- package/dist/standalone/api-description.d.ts +7 -0
- package/dist/standalone/api-description.js +73 -0
- package/dist/standalone/build.d.ts +3 -0
- package/dist/standalone/build.js +140 -33
- package/dist/standalone/compose-errors.d.ts +3 -0
- package/dist/standalone/compose-errors.js +243 -0
- package/dist/standalone/compose.d.ts +97 -10
- package/dist/standalone/compose.js +306 -75
- package/dist/standalone/daemon.js +111 -29
- package/dist/standalone/dsm-window.js +55 -9
- package/dist/standalone/identity-gateway.d.ts +9 -2
- package/dist/standalone/identity-gateway.js +282 -66
- package/dist/standalone/inspect-spk.d.ts +15 -0
- package/dist/standalone/inspect-spk.js +714 -128
- package/dist/standalone/lifecycle.js +124 -42
- package/dist/standalone/manifest.d.ts +10 -1
- package/dist/standalone/manifest.js +308 -87
- package/dist/standalone/resource.js +6 -2
- package/dist/standalone/spk.d.ts +4 -1
- package/dist/standalone/spk.js +139 -39
- package/dist/template-paths.d.ts +0 -2
- package/dist/template-paths.js +0 -5
- package/dist/test-command.d.ts +1 -1
- package/dist/test-command.js +1 -1
- package/dist/validate.d.ts +3 -3
- package/dist/validate.js +32 -140
- package/package.json +5 -3
- package/schema/synology-app.schema.json +1 -1
- package/schema/synopkgland-api-v1.schema.json +423 -0
- package/skills/SKILL.md +34 -1
- package/skills/reference/compose.md +349 -0
- package/skills/reference/create.md +26 -4
- package/skills/reference/ctl.md +41 -0
- package/skills/reference/deploy.md +1 -1
- package/skills/reference/files.md +4 -0
- package/skills/reference/identity-gateway.md +8 -138
- package/skills/reference/portal.md +31 -0
- package/skills/reference/ui-vue.md +31 -0
- package/skills/reference/wrap.md +10 -30
- package/assets/go/daemon/fixture_linux_test.go +0 -15
- package/assets/go/daemon/fixture_other_test.go +0 -7
- package/assets/go/daemon/go.mod +0 -5
- package/assets/go/daemon/main.go +0 -636
- package/assets/go/daemon/main_test.go +0 -315
- package/assets/go/daemon/network.go +0 -107
- package/assets/go/daemon/network_test.go +0 -86
- package/assets/go/daemon/process_linux.go +0 -55
- package/assets/go/daemon/process_linux_test.go +0 -161
- package/assets/go/daemon/process_other.go +0 -14
- package/assets/go/daemon/testdata/child.go +0 -44
- package/assets/go/gateway/auth.go +0 -101
- package/assets/go/gateway/auth_test.go +0 -216
- package/assets/go/gateway/cgi.go +0 -133
- package/assets/go/gateway/cgi_test.go +0 -156
- package/assets/go/gateway/csrf.go +0 -73
- package/assets/go/gateway/csrf_test.go +0 -155
- package/assets/go/gateway/directory.go +0 -108
- package/assets/go/gateway/directory_test.go +0 -202
- package/assets/go/gateway/gateway.go +0 -412
- package/assets/go/gateway/gateway_test.go +0 -676
- package/assets/go/gateway/go.mod +0 -5
- package/assets/go/gateway/groups.go +0 -66
- package/assets/go/gateway/main.go +0 -45
- package/dist/build-spk/gateway.d.ts +0 -31
- package/dist/build-spk/gateway.js +0 -60
- package/dist/compose/privilege.d.ts +0 -14
- package/dist/compose/privilege.js +0 -102
|
@@ -35,3 +35,34 @@ Never: write `AppPortal.json`, `@appconf/<package>` or `/usr/syno/etc/www/app.d`
|
|
|
35
35
|
Uninstall: the root executor's purge deletes the rules of `SYNO.SDS.<package>.Instance` through the Application Privileges API and, once DSM has removed the alias files, reloads nginx (`synosystemctl reload nginx`), so the alias stops at once. Failures are only logged to the system log entry `synopkgland-executor`; then an administrator saves an alias in Control Panel > Login Portal > Applications (which reloads nginx) or restarts the NAS, and removes the rules in Control Panel > Application Privileges. The uninstall wizard and the `status`/`inspect` cleanup list say this in that order: automatic first, manual only as the fallback.
|
|
36
36
|
|
|
37
37
|
Executor mode uninstall: the purge reads the retained policy and unregisters the entry. If the executor is not running or was never approved, uninstall does not remove the entry; the wizard and cleanup list say so and give the root commands (`rm -f /usr/syno/etc/www/app.d/<package>.json /usr/syno/etc/www/app.d/<package>.mustache /usr/syno/etc/packages/<package>/AppPortal.json`, `synow3tool --disable-nginx-confd/--unreg-nginx-confd` for `dsm www alias .alias`, `--disable-nginx-sites/--unreg-nginx-sites` for `server .server` on `<c>.syno-app-portal.<package>.conf`, then `nginx -t && synow3tool --nginx=reload`).
|
|
38
|
+
|
|
39
|
+
## 開啟方式
|
|
40
|
+
|
|
41
|
+
原生 App 在 `dsm-package.yaml` 設定 `ui.launch: dsm-window | new-page`。
|
|
42
|
+
SDK 原生內建預設為 `dsm-window`;使用 `@synopackageland/ui` 維持視窗,
|
|
43
|
+
其他原生前端必須明確寫 `ui.launch: new-page`。
|
|
44
|
+
Scaffold 明確寫入此選擇,plain/binary 使用 `new-page`,Vue UI SDK 使用
|
|
45
|
+
預設的 `dsm-window`(省略 `ui.launch`)。原生 manifest 省略 `ui.launch` 時解析為 `dsm-window`,CLI 不猜測前端依賴。
|
|
46
|
+
|
|
47
|
+
`new-page` 產生 DSM `type: "standalone"` launcher,主選單及套件中心皆在 DSM
|
|
48
|
+
本身的 origin 開啟全頁。`ctx.fullPage`、`ctx.appIcon`、SynoToken/session、
|
|
49
|
+
`ctx.launchParams`/`onLaunch`、`entry` 權限沿用共用 wrapper;全頁的標題、
|
|
50
|
+
favicon 與手機 viewport 由 wrapper 設定。不需要 `pureEnv` 或 `allowAltPort`。
|
|
51
|
+
|
|
52
|
+
Application Portal 是獨立 opt-in:不想要別名就省略 `portal`,不生成
|
|
53
|
+
`defaultAlias`、Portal 面板/capability 或 Web Station alias;沒有 Portal
|
|
54
|
+
不是 inspect/info/doctor 問題。明確啟用 `portal` 時才將其 alias 作為 `defaultAlias`。
|
|
55
|
+
|
|
56
|
+
Docker/web service App 設定 `integration.web.launch`,內建預設是 `new-page`;
|
|
57
|
+
省略開啟方式時直接開新分頁,不宣告 Application Portal。SDK 原生 App
|
|
58
|
+
省略時使用 `dsm-window`;非 UI SDK 原生 App 必須明確寫 `ui.launch: new-page`。
|
|
59
|
+
Web service 主選單使用
|
|
60
|
+
`type: "url"` 與明確的 `url` 指向既有 DSM gateway。明確 `access: public` 才保留 Web Station
|
|
61
|
+
alias;這是服務入口,不是 SDK Application Portal。DSM 會將 standalone URL 改寫成 launchApp 頁面,
|
|
62
|
+
需要 AppInstance/AppWindow JS class;schema 1 web service 沒有該 class,因此使用 url。需要 DSM 視窗時明寫 `dsm-window`。
|
|
63
|
+
|
|
64
|
+
Schema 2 的 `dsm-package.yaml` + `identity_gateway` + `compose` 同樣視為
|
|
65
|
+
web service:省略 `ui.launch` 時預設 `new-page`,使用 standalone launcher,
|
|
66
|
+
不帶 Application Portal。兩條 Compose 路線共用 `contract/app-launch.ts`
|
|
67
|
+
解析開啟方式與選擇 launcher 型別;明確的 `ui.launch` 可覆寫預設。
|
|
68
|
+
只有沒有 web service 的 SDK 原生 App 省略時才預設 `dsm-window`。
|
|
@@ -94,3 +94,34 @@ with the same PasswordConfirm form and no extra dialog. Mismatch must be explici
|
|
|
94
94
|
Restrict the existing NasPicker to `selection.root`; do not grant via cached paths.
|
|
95
95
|
The default facade includes typed `destination(key)` and `exportExample({key,job_id})`;
|
|
96
96
|
use original operation references and display Saved only for protected receipts.
|
|
97
|
+
|
|
98
|
+
## 開啟方式
|
|
99
|
+
|
|
100
|
+
原生 App 在 `dsm-package.yaml` 設定 `ui.launch: dsm-window | new-page`。
|
|
101
|
+
SDK 原生內建預設為 `dsm-window`;使用 `@synopackageland/ui` 維持視窗,
|
|
102
|
+
其他原生前端必須明確寫 `ui.launch: new-page`。
|
|
103
|
+
Scaffold 明確寫入此選擇,plain/binary 使用 `new-page`,Vue UI SDK 使用
|
|
104
|
+
預設的 `dsm-window`(省略 `ui.launch`)。原生 manifest 省略 `ui.launch` 時解析為 `dsm-window`,CLI 不猜測前端依賴。
|
|
105
|
+
|
|
106
|
+
`new-page` 產生 DSM `type: "standalone"` launcher,主選單及套件中心皆在 DSM
|
|
107
|
+
本身的 origin 開啟全頁。`ctx.fullPage`、`ctx.appIcon`、SynoToken/session、
|
|
108
|
+
`ctx.launchParams`/`onLaunch`、`entry` 權限沿用共用 wrapper;全頁的標題、
|
|
109
|
+
favicon 與手機 viewport 由 wrapper 設定。不需要 `pureEnv` 或 `allowAltPort`。
|
|
110
|
+
|
|
111
|
+
Application Portal 是獨立 opt-in:不想要別名就省略 `portal`,不生成
|
|
112
|
+
`defaultAlias`、Portal 面板/capability 或 Web Station alias;沒有 Portal
|
|
113
|
+
不是 inspect/info/doctor 問題。明確啟用 `portal` 時才將其 alias 作為 `defaultAlias`。
|
|
114
|
+
|
|
115
|
+
Docker/web service App 設定 `integration.web.launch`,內建預設是 `new-page`;
|
|
116
|
+
省略開啟方式時直接開新分頁,不宣告 Application Portal。SDK 原生 App
|
|
117
|
+
省略時使用 `dsm-window`;非 UI SDK 原生 App 必須明確寫 `ui.launch: new-page`。
|
|
118
|
+
Web service 主選單使用
|
|
119
|
+
`type: "url"` 與明確的 `url` 指向既有 DSM gateway。明確 `access: public` 才保留 Web Station
|
|
120
|
+
alias;這是服務入口,不是 SDK Application Portal。DSM 會將 standalone URL 改寫成 launchApp 頁面,
|
|
121
|
+
需要 AppInstance/AppWindow JS class;schema 1 web service 沒有該 class,因此使用 url。需要 DSM 視窗時明寫 `dsm-window`。
|
|
122
|
+
|
|
123
|
+
Schema 2 的 `dsm-package.yaml` + `identity_gateway` + `compose` 同樣視為
|
|
124
|
+
web service:省略 `ui.launch` 時預設 `new-page`,使用 standalone launcher,
|
|
125
|
+
不帶 Application Portal。兩條 Compose 路線共用 `contract/app-launch.ts`
|
|
126
|
+
解析開啟方式與選擇 launcher 型別;明確的 `ui.launch` 可覆寫預設。
|
|
127
|
+
只有沒有 web service 的 SDK 原生 App 省略時才預設 `dsm-window`。
|
package/skills/reference/wrap.md
CHANGED
|
@@ -1,36 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 封裝上游 Compose
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
只使用 schema-2 `dsm-package.yaml`。先讀 [compose.md](compose.md) 的宣告、支援表及 DSM 阻擋條件,再讀 [identity-gateway.md](identity-gateway.md) 決定 none/header/token/OIDC。不架 SSO Server,也不需要假 backend 或 wrapper container。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
synopkgland
|
|
5
|
+
```sh
|
|
6
|
+
synopkgland init -t compose --from ./compose.yaml my-app
|
|
7
|
+
synopkgland check --json
|
|
8
|
+
synopkgland build --arch x86_64
|
|
9
|
+
synopkgland inspect dist/MyApp-x86_64.spk --json
|
|
9
10
|
```
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
必填:`schema`、`package`、`version`、`displayname`、`description`、`maintainer`、`os_min_ver`。
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
For DSM-account SSO around OSS, first read [identity-gateway.md](identity-gateway.md).
|
|
18
|
-
It defines the separate schema-2 `compose` + `identity_gateway` host-network policy;
|
|
19
|
-
the legacy Compose route below retains its restrictions.
|
|
20
|
-
|
|
21
|
-
## Compose 規則(analyzer 會擋)
|
|
22
|
-
|
|
23
|
-
- 禁止:`privileged`、`network_mode: host`、裝置節點、`cap_add`、掛載 Docker socket。
|
|
24
|
-
- `adminport` 必須對應到某 service 的 published TCP port。
|
|
25
|
-
- `install` 參數須在 `compose.yaml` 以 `${NAME}` 引用。
|
|
26
|
-
|
|
27
|
-
## 包現成 Compose 的掛載
|
|
28
|
-
|
|
29
|
-
容器路徑跟映像/upstream 的 container target 走,原樣保留;只把 host source 換成 `${NAME}` 這類 install parameter。原有的 upstream named volume mount 與頂層 `volumes:` 宣告也保留,不要為了套模板改成 `/data`。需要既有 Share 時,管理員在安裝時選這台 NAS 的 Share。
|
|
30
|
-
|
|
31
|
-
修復方式:看 `check` 輸出的 `[錯誤碼]` 與 `Suggestion:` 行,對照 `diagnose.md`。**不要**為了過驗證而亂改 runtime 語意。
|
|
12
|
+
上游 bytes 不改;CLI 只做工具,SDK reference planner 產生 override 與 worker 單檔。修正錯誤時看 code/原因/建議,不為通過驗證改掉上游語義。共用 launch resolver 解析 ui.launch,預設 new-page;classless gateway 使用 type url。
|
|
32
13
|
|
|
33
|
-
|
|
14
|
+
容器使用固定套件身分,不繼承登入者 File Station ACL。Shared Folder 需 composeMounts 明確 opt-in,安裝後由 admin 確認;官方 protected ACL/project control 未驗證前只啟動 SDK 設定頁,不 acquire 上游,不用 host root 繞過。每使用者檔案權限需 session/Broker Adapter,本次不做。
|
|
34
15
|
|
|
35
|
-
-
|
|
36
|
-
- 要上 NAS → `deploy.md`
|
|
16
|
+
交付 inspect 的 upstream/effective hashes、image digests、run-as、mount、egress 與 acceptance blockers。Linux 通過不代表 DSM 已驗收。部署請讀 [deploy.md](deploy.md),保留資料並由專用 thread 驗 final SPK digest。
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//go:build linux
|
|
2
|
-
|
|
3
|
-
package main
|
|
4
|
-
|
|
5
|
-
import (
|
|
6
|
-
"os"
|
|
7
|
-
"os/exec"
|
|
8
|
-
"syscall"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
func dropFixtureUser(cmd *exec.Cmd) {
|
|
12
|
-
if os.Geteuid() == 0 {
|
|
13
|
-
cmd.SysProcAttr = &syscall.SysProcAttr{Credential: &syscall.Credential{Uid: 65534, Gid: 65534, Groups: []uint32{65534}}}
|
|
14
|
-
}
|
|
15
|
-
}
|