@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.
Files changed (119) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +44 -1
  3. package/dist/build-spk/generator.d.ts +3 -2
  4. package/dist/build-spk/generator.js +6 -850
  5. package/dist/build-spk/resource-worker.d.ts +2 -14
  6. package/dist/build-spk/resource-worker.js +3 -166
  7. package/dist/cli.js +208 -56
  8. package/dist/compose/analyze.d.ts +3 -61
  9. package/dist/compose/analyze.js +35 -776
  10. package/dist/compose/env.d.ts +5 -3
  11. package/dist/compose/env.js +17 -25
  12. package/dist/compose/runner.js +23 -6
  13. package/dist/contract/app-launch.d.ts +11 -0
  14. package/dist/contract/app-launch.js +18 -0
  15. package/dist/contract/web-launch.d.ts +3 -13
  16. package/dist/contract/web-launch.js +14 -81
  17. package/dist/ctl/cli.d.ts +36 -0
  18. package/dist/ctl/cli.js +218 -0
  19. package/dist/ctl/descriptor.d.ts +81 -0
  20. package/dist/ctl/descriptor.js +93 -0
  21. package/dist/ctl/dsm-auth.d.ts +10 -0
  22. package/dist/ctl/dsm-auth.js +30 -0
  23. package/dist/ctl/errors.d.ts +17 -0
  24. package/dist/ctl/errors.js +32 -0
  25. package/dist/ctl/flows.d.ts +11 -0
  26. package/dist/ctl/flows.js +52 -0
  27. package/dist/ctl/input.d.ts +20 -0
  28. package/dist/ctl/input.js +128 -0
  29. package/dist/ctl/json.d.ts +2 -0
  30. package/dist/ctl/json.js +38 -0
  31. package/dist/ctl/redaction.d.ts +15 -0
  32. package/dist/ctl/redaction.js +198 -0
  33. package/dist/ctl/service.d.ts +38 -0
  34. package/dist/ctl/service.js +156 -0
  35. package/dist/ctl/store.d.ts +51 -0
  36. package/dist/ctl/store.js +93 -0
  37. package/dist/ctl/transfers.d.ts +14 -0
  38. package/dist/ctl/transfers.js +74 -0
  39. package/dist/ctl/transport.d.ts +11 -0
  40. package/dist/ctl/transport.js +79 -0
  41. package/dist/deploy/deploy.d.ts +4 -3
  42. package/dist/deploy/deploy.js +5 -210
  43. package/dist/deploy/plan.js +26 -7
  44. package/dist/dev.js +5 -4
  45. package/dist/error-registry.js +1020 -831
  46. package/dist/info.js +120 -28
  47. package/dist/init.js +188 -64
  48. package/dist/inspect.js +21 -6
  49. package/dist/runtime/executor-digests.json +1 -12
  50. package/dist/skill.js +51 -9
  51. package/dist/standalone/api-description-inspect.d.ts +4 -0
  52. package/dist/standalone/api-description-inspect.js +12 -0
  53. package/dist/standalone/api-description.d.ts +7 -0
  54. package/dist/standalone/api-description.js +73 -0
  55. package/dist/standalone/build.d.ts +3 -0
  56. package/dist/standalone/build.js +140 -33
  57. package/dist/standalone/compose-errors.d.ts +3 -0
  58. package/dist/standalone/compose-errors.js +243 -0
  59. package/dist/standalone/compose.d.ts +97 -10
  60. package/dist/standalone/compose.js +306 -75
  61. package/dist/standalone/daemon.js +111 -29
  62. package/dist/standalone/dsm-window.js +55 -9
  63. package/dist/standalone/identity-gateway.d.ts +9 -2
  64. package/dist/standalone/identity-gateway.js +282 -66
  65. package/dist/standalone/inspect-spk.d.ts +15 -0
  66. package/dist/standalone/inspect-spk.js +714 -128
  67. package/dist/standalone/lifecycle.js +124 -42
  68. package/dist/standalone/manifest.d.ts +10 -1
  69. package/dist/standalone/manifest.js +308 -87
  70. package/dist/standalone/resource.js +6 -2
  71. package/dist/standalone/spk.d.ts +4 -1
  72. package/dist/standalone/spk.js +139 -39
  73. package/dist/template-paths.d.ts +0 -2
  74. package/dist/template-paths.js +0 -5
  75. package/dist/test-command.d.ts +1 -1
  76. package/dist/test-command.js +1 -1
  77. package/dist/validate.d.ts +3 -3
  78. package/dist/validate.js +32 -140
  79. package/package.json +5 -3
  80. package/schema/synology-app.schema.json +1 -1
  81. package/schema/synopkgland-api-v1.schema.json +423 -0
  82. package/skills/SKILL.md +34 -1
  83. package/skills/reference/compose.md +349 -0
  84. package/skills/reference/create.md +26 -4
  85. package/skills/reference/ctl.md +41 -0
  86. package/skills/reference/deploy.md +1 -1
  87. package/skills/reference/files.md +4 -0
  88. package/skills/reference/identity-gateway.md +8 -138
  89. package/skills/reference/portal.md +31 -0
  90. package/skills/reference/ui-vue.md +31 -0
  91. package/skills/reference/wrap.md +10 -30
  92. package/assets/go/daemon/fixture_linux_test.go +0 -15
  93. package/assets/go/daemon/fixture_other_test.go +0 -7
  94. package/assets/go/daemon/go.mod +0 -5
  95. package/assets/go/daemon/main.go +0 -636
  96. package/assets/go/daemon/main_test.go +0 -315
  97. package/assets/go/daemon/network.go +0 -107
  98. package/assets/go/daemon/network_test.go +0 -86
  99. package/assets/go/daemon/process_linux.go +0 -55
  100. package/assets/go/daemon/process_linux_test.go +0 -161
  101. package/assets/go/daemon/process_other.go +0 -14
  102. package/assets/go/daemon/testdata/child.go +0 -44
  103. package/assets/go/gateway/auth.go +0 -101
  104. package/assets/go/gateway/auth_test.go +0 -216
  105. package/assets/go/gateway/cgi.go +0 -133
  106. package/assets/go/gateway/cgi_test.go +0 -156
  107. package/assets/go/gateway/csrf.go +0 -73
  108. package/assets/go/gateway/csrf_test.go +0 -155
  109. package/assets/go/gateway/directory.go +0 -108
  110. package/assets/go/gateway/directory_test.go +0 -202
  111. package/assets/go/gateway/gateway.go +0 -412
  112. package/assets/go/gateway/gateway_test.go +0 -676
  113. package/assets/go/gateway/go.mod +0 -5
  114. package/assets/go/gateway/groups.go +0 -66
  115. package/assets/go/gateway/main.go +0 -45
  116. package/dist/build-spk/gateway.d.ts +0 -31
  117. package/dist/build-spk/gateway.js +0 -60
  118. package/dist/compose/privilege.d.ts +0 -14
  119. package/dist/compose/privilege.js +0 -102
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.0 (2026-10-18)
4
+
5
+ - Add `synopkgland ctl` host/session management, authenticated API v1 discovery, explicit command trust, typed invocation and fixed job/pagination/NDJSON/upload flows. Commands keep App backend authorization; writes require confirmation.
6
+ - Document resource/verb naming recommendations without a verb allowlist or effect inference; explicit effects remain mandatory and binding checks remain unchanged.
7
+ - Redact standard JSON Schema writeOnly values in dry-run/confirmation plans, schema errors, results, list/help and caches, including nested arrays/objects and multi-host output; keep outgoing requests unchanged.
8
+ - Pin templates and released executor digests to 0.15.0, retaining the same-minor digest selection rule.
9
+ - Breaking: remove the legacy Compose route and bridge publish mode. Migrate to schema 2 `dsm-package.yaml` with ordered `compose.files`, `compose.web` container port/health and `identity_gateway.sdk: 0.15.0`; remove old `integration.compose`/`integration.identity_gateway`. `web.host_port` is accepted but ignored. Build/check/inspect share the SDK planner. Rebuild with templates/SDK 0.15.0 and verify install/upgrade; historical `.sc` cleanup requires separate authorization. Changing subnet candidate requires a clean installation, not an automatic network migration.
10
+
11
+ 繁中摘要:新增 writeOnly 敏感值遮罩(巢狀、陣列、多主機、計畫、錯誤及快取),實際請求保持原值。新增 `synopkgland ctl`,從已安裝 App 的 authenticated「Syno Package Land API 描述」v1 發現並執行明確 commands,支援多主機與固定任務流程。**不相容變更**:移除舊 Compose 打包路線及 publish 模式;改用 schema 2 `compose`/`identity_gateway`,固定 SDK/templates 0.15.0 並重建驗證。gateway 直接連固定 bridge IP 的 container port;`web.host_port` 僅解析相容、會忽略,歷史 `.sc` 與既有子網不自動清除或遷移。
12
+
13
+ ## 0.14.1
14
+
15
+ - DSM 會改寫 standalone URL,因此沒有 SDK class 的 schema 1 web launcher 使用 url;schema 2 identity_gateway + compose 與原生 new-page 使用 standalone。兩條 Compose 路線共用預設解析。
16
+
17
+ ## 0.14.0
18
+
19
+ - 原生 App 支援 ui.launch: dsm-window | new-page;new-page 使用 DSM standalone launcher。SDK 原生 App 的內建預設維持 dsm-window;Docker/Web App(含 schema 2 identity_gateway + compose)共用解析邏輯,內建預設改為 new-page,主選單與套件中心皆可開啟既有 gateway/public alias。inspect 驗證 launcher 與 Portal 宣告,完整頁統一設定標題、favicon 與手機 viewport。Web App 省略開啟方式的行為變更,因此採用 0.14.0。
20
+
3
21
  ## 0.13.1 (2026-10-17)
4
22
 
5
23
  - Use templates 0.13.1, SDK 0.13.1 fixtures and the unchanged executor/lifecycle digests on the 0.13 minor line.
package/README.md CHANGED
@@ -36,7 +36,7 @@ the SPK with Package Center's Manual Install.
36
36
  | `native-go` | A Go backend with a Vue UI (or `--ui plain`) | `dsm-package.yaml` |
37
37
  | `native-python`, `native-node`, `native-rust` | The `native-go` App with a Python, Node.js (TypeScript) or Rust backend | `dsm-package.yaml` |
38
38
  | `binary` | A static Linux program you build yourself | `dsm-package.yaml` |
39
- | `compose` | An existing Docker Compose app (`--from compose.yaml`) | `synology-app.yaml` |
39
+ | `compose` | Unchanged upstream Compose, generated override and SDK planner | `dsm-package.yaml` |
40
40
 
41
41
  Existing native products with their own payload layout use `backend: {kind: native}` in
42
42
  `dsm-package.yaml`.
@@ -216,3 +216,46 @@ Call `webapi.call` with `response_type: "raw"`; Go Apps use
216
216
  package's private executor-staging folder with size/SHA-256 and immediate cleanup.
217
217
  Do not use Attachment.download or follow X-Accel-Redirect. See the SDK raw response
218
218
  contract for the complete transport and CGI validation rules.
219
+
220
+ ## App launch mode
221
+
222
+ Native Apps declare `ui.launch: dsm-window | new-page` in `dsm-package.yaml`.
223
+ Use `dsm-window` for frontends built with `@synopackageland/ui`; use `new-page`
224
+ for every other frontend. Plain/binary scaffolds explicitly choose new-page; Vue uses the native default. An omitted
225
+ native `ui.launch` resolves to `dsm-window`; the CLI does not guess a frontend's
226
+ framework from its build command. `new-page` registers DSM `type: "standalone"`,
227
+ so the main menu and Package Center open a full page on the DSM origin.
228
+ `ctx.fullPage`, `ctx.appIcon`, session/SynoToken, launch parameters and entry
229
+ permissions use the same wrapper in both modes. The wrapper sets the standalone
230
+ page title, favicon and device-width viewport. It retains ExtJS; `pureEnv` is
231
+ not appropriate, and alternate Portal ports are not needed (`allowAltPort` is omitted).
232
+
233
+ A full page does not need Application Portal. Omit `portal` unless an alias is
234
+ explicitly wanted; only that opt-in adds `defaultAlias`, login styling, Portal
235
+ panels and capabilities. No Portal is a healthy default for inspect/info/doctor.
236
+
237
+ Compose uses schema-2 `dsm-package.yaml` and `ui.launch`; the default is new-page.
238
+ Classless gateways use type url via the shared contract/app-launch resolver;
239
+ AppWindow wrappers use standalone. Headless projects have no launcher.
240
+
241
+ See [Compose](skills/reference/compose.md) for multiple upstream files,
242
+ generated override/worker artifacts, image proofs and the support matrix.
243
+ Containers use a fixed package identity and do not inherit a signed-in user's
244
+ File Station ACL. Shared Folder intent requires admin confirmation after
245
+ installation; official protected ACL/project control and bridge readback remain
246
+ blocked. No SSO Server or wrapper container is added. Linux tests do not prove
247
+ DSM readiness; inspect lists explicit acceptance blockers.
248
+
249
+ ## Control installed Apps
250
+
251
+ Use `synopkgland ctl host add nas --url https://nas.example:5001 --username alice`
252
+ to register and authenticate a NAS in OS secure storage. `ctl host list --json`
253
+ checks sessions; `ctl list --host nas --json` discovers all approved task-level
254
+ commands and their schemas. Run the listed alias/command with typed flags,
255
+ `--help` and `--dry-run`; writes require `--yes`. There is no mutable current
256
+ context. Use `--host a,b` or `--all-hosts` for bounded parallel operations.
257
+
258
+ Read `synopkgland skill show ctl` for the AI workflow, batch discovery approval,
259
+ cache refresh, host removal/revocation and explicit `ctl.commands` authoring.
260
+ API descriptions are private SPK files named `synopkgland-api.json`, served
261
+ only by the authenticated fixed `synopkgland.describe` CGI operation.
@@ -1,6 +1,6 @@
1
1
  import type { ProjectRoot } from "../discovery.js";
2
+ import type { NativeArchFamily } from "./dsm-arch.js";
2
3
  import type { CommandRunner } from "../standalone/build.js";
3
- import { type NativeArchFamily } from "./dsm-arch.js";
4
4
  export interface BuildSpkOptions {
5
5
  project: ProjectRoot;
6
6
  outputPath?: string;
@@ -19,7 +19,8 @@ export interface BuildSpkResult {
19
19
  outputPath?: string;
20
20
  errors: string[];
21
21
  }
22
- export declare function buildSpk(options: BuildSpkOptions): Promise<BuildSpkResult>;
22
+ /** Legacy project detection supplies a migration error, never a second builder. */
23
+ export declare function buildSpk(_options: BuildSpkOptions): Promise<BuildSpkResult>;
23
24
  export declare function walkFiles(root: string, prefix?: string): string[];
24
25
  export declare function digestSpkPayload(spkPath: string): Promise<string>;
25
26
  export declare function extractSpk(spkPath: string, targetDir: string): Promise<void>;