@synopackageland/cli 0.14.1 → 0.15.1

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 (121) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/README.md +33 -18
  3. package/dist/build-spk/generator.d.ts +3 -2
  4. package/dist/build-spk/generator.js +6 -846
  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/unsupported-types.js +1 -1
  14. package/dist/contract/validate.js +2 -2
  15. package/dist/contract/web-launch.d.ts +1 -12
  16. package/dist/contract/web-launch.js +10 -74
  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/e2e/dsm.d.ts +2 -2
  46. package/dist/e2e/dsm.js +10 -6
  47. package/dist/error-registry.js +1020 -834
  48. package/dist/host/share-permission-lookup.d.ts +1 -1
  49. package/dist/host/share-permission.d.ts +1 -1
  50. package/dist/host/share-permission.js +1 -1
  51. package/dist/info.js +120 -28
  52. package/dist/init.js +188 -64
  53. package/dist/inspect.js +21 -6
  54. package/dist/runtime/executor-digests.json +5 -5
  55. package/dist/skill.js +51 -9
  56. package/dist/standalone/api-description-inspect.d.ts +4 -0
  57. package/dist/standalone/api-description-inspect.js +12 -0
  58. package/dist/standalone/api-description.d.ts +7 -0
  59. package/dist/standalone/api-description.js +73 -0
  60. package/dist/standalone/build.d.ts +3 -0
  61. package/dist/standalone/build.js +140 -33
  62. package/dist/standalone/compose-errors.d.ts +3 -0
  63. package/dist/standalone/compose-errors.js +243 -0
  64. package/dist/standalone/compose.d.ts +97 -10
  65. package/dist/standalone/compose.js +306 -75
  66. package/dist/standalone/daemon.js +111 -29
  67. package/dist/standalone/dsm-window.js +39 -8
  68. package/dist/standalone/identity-gateway.d.ts +9 -2
  69. package/dist/standalone/identity-gateway.js +282 -66
  70. package/dist/standalone/inspect-spk.d.ts +12 -0
  71. package/dist/standalone/inspect-spk.js +666 -136
  72. package/dist/standalone/lifecycle.js +124 -42
  73. package/dist/standalone/manifest.d.ts +8 -1
  74. package/dist/standalone/manifest.js +303 -86
  75. package/dist/standalone/resource.js +6 -2
  76. package/dist/standalone/spk.d.ts +4 -1
  77. package/dist/standalone/spk.js +138 -39
  78. package/dist/template-paths.d.ts +0 -2
  79. package/dist/template-paths.js +0 -5
  80. package/dist/test-command.d.ts +1 -1
  81. package/dist/test-command.js +1 -1
  82. package/dist/validate.d.ts +3 -3
  83. package/dist/validate.js +32 -140
  84. package/package.json +5 -3
  85. package/schema/synopkgland-api-v1.schema.json +423 -0
  86. package/skills/SKILL.md +4 -2
  87. package/skills/reference/compose.md +349 -0
  88. package/skills/reference/create.md +9 -18
  89. package/skills/reference/ctl.md +41 -0
  90. package/skills/reference/deploy.md +1 -1
  91. package/skills/reference/files.md +5 -1
  92. package/skills/reference/identity-gateway.md +8 -144
  93. package/skills/reference/wrap.md +10 -39
  94. package/assets/go/daemon/fixture_linux_test.go +0 -15
  95. package/assets/go/daemon/fixture_other_test.go +0 -7
  96. package/assets/go/daemon/go.mod +0 -5
  97. package/assets/go/daemon/main.go +0 -636
  98. package/assets/go/daemon/main_test.go +0 -315
  99. package/assets/go/daemon/network.go +0 -107
  100. package/assets/go/daemon/network_test.go +0 -86
  101. package/assets/go/daemon/process_linux.go +0 -55
  102. package/assets/go/daemon/process_linux_test.go +0 -161
  103. package/assets/go/daemon/process_other.go +0 -14
  104. package/assets/go/daemon/testdata/child.go +0 -44
  105. package/assets/go/gateway/auth.go +0 -101
  106. package/assets/go/gateway/auth_test.go +0 -216
  107. package/assets/go/gateway/cgi.go +0 -133
  108. package/assets/go/gateway/cgi_test.go +0 -156
  109. package/assets/go/gateway/csrf.go +0 -73
  110. package/assets/go/gateway/csrf_test.go +0 -155
  111. package/assets/go/gateway/directory.go +0 -108
  112. package/assets/go/gateway/directory_test.go +0 -202
  113. package/assets/go/gateway/gateway.go +0 -412
  114. package/assets/go/gateway/gateway_test.go +0 -676
  115. package/assets/go/gateway/go.mod +0 -5
  116. package/assets/go/gateway/groups.go +0 -66
  117. package/assets/go/gateway/main.go +0 -45
  118. package/dist/build-spk/gateway.d.ts +0 -31
  119. package/dist/build-spk/gateway.js +0 -60
  120. package/dist/compose/privilege.d.ts +0 -14
  121. package/dist/compose/privilege.js +0 -102
@@ -0,0 +1,423 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Syno Package Land API 描述 v1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "format": {
8
+ "const": "synopkgland.api"
9
+ },
10
+ "version": {
11
+ "const": 1
12
+ },
13
+ "payload": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "properties": {
17
+ "package": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "id": {
22
+ "type": "string",
23
+ "pattern": "^[A-Za-z][A-Za-z0-9_.+-]{0,127}$"
24
+ },
25
+ "version": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "maxLength": 128
29
+ },
30
+ "displayName": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "maxLength": 1024
34
+ }
35
+ },
36
+ "required": [
37
+ "id",
38
+ "version",
39
+ "displayName"
40
+ ]
41
+ },
42
+ "aliases": {
43
+ "type": "array",
44
+ "uniqueItems": true,
45
+ "maxItems": 8,
46
+ "items": {
47
+ "type": "string",
48
+ "pattern": "^[a-zA-Z][a-zA-Z0-9-]{0,63}$"
49
+ }
50
+ },
51
+ "provenance": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "properties": {
55
+ "developedBy": {
56
+ "enum": [
57
+ "synopkgland",
58
+ "third-party",
59
+ "unknown"
60
+ ]
61
+ },
62
+ "generator": {
63
+ "type": "string",
64
+ "minLength": 1,
65
+ "maxLength": 1024
66
+ }
67
+ },
68
+ "required": [
69
+ "developedBy",
70
+ "generator"
71
+ ]
72
+ },
73
+ "entry": {
74
+ "enum": [
75
+ "policy",
76
+ "admin-only",
77
+ "app-privilege"
78
+ ]
79
+ },
80
+ "transport": {
81
+ "type": "object",
82
+ "additionalProperties": false,
83
+ "properties": {
84
+ "path": {
85
+ "type": "string",
86
+ "pattern": "^/webman/3rdparty/[A-Za-z][A-Za-z0-9_.+-]{0,127}/cgi/api\\.cgi$"
87
+ },
88
+ "auth": {
89
+ "enum": [
90
+ "dsm-session",
91
+ "dsm-app-session"
92
+ ]
93
+ }
94
+ },
95
+ "required": [
96
+ "path",
97
+ "auth"
98
+ ]
99
+ },
100
+ "bindings": {
101
+ "type": "object",
102
+ "minProperties": 1,
103
+ "maxProperties": 1024,
104
+ "propertyNames": {
105
+ "type": "string",
106
+ "maxLength": 128,
107
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
108
+ },
109
+ "additionalProperties": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "properties": {
113
+ "effect": {
114
+ "enum": [
115
+ "read",
116
+ "write",
117
+ "destructive"
118
+ ]
119
+ },
120
+ "permission": {
121
+ "enum": [
122
+ "public",
123
+ "authenticated",
124
+ "administrators"
125
+ ]
126
+ }
127
+ },
128
+ "required": [
129
+ "effect",
130
+ "permission"
131
+ ]
132
+ }
133
+ },
134
+ "commands": {
135
+ "type": "object",
136
+ "minProperties": 1,
137
+ "maxProperties": 1024,
138
+ "propertyNames": {
139
+ "type": "string",
140
+ "maxLength": 128,
141
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
142
+ },
143
+ "additionalProperties": {
144
+ "type": "object",
145
+ "additionalProperties": false,
146
+ "properties": {
147
+ "summary": {
148
+ "type": "string",
149
+ "minLength": 1,
150
+ "maxLength": 1024
151
+ },
152
+ "cli": {
153
+ "type": "array",
154
+ "minItems": 1,
155
+ "maxItems": 8,
156
+ "items": {
157
+ "type": "string",
158
+ "maxLength": 64,
159
+ "pattern": "^[a-z][a-z0-9-]*$"
160
+ }
161
+ },
162
+ "effect": {
163
+ "enum": [
164
+ "read",
165
+ "write",
166
+ "destructive"
167
+ ]
168
+ },
169
+ "permission": {
170
+ "enum": [
171
+ "public",
172
+ "authenticated",
173
+ "administrators"
174
+ ]
175
+ },
176
+ "paramsSchema": {
177
+ "type": "object"
178
+ },
179
+ "resultSchema": {
180
+ "type": "object"
181
+ },
182
+ "examples": {
183
+ "type": "array",
184
+ "maxItems": 16,
185
+ "items": {
186
+ "type": "object"
187
+ }
188
+ },
189
+ "flow": {
190
+ "oneOf": [
191
+ {
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "properties": {
195
+ "type": {
196
+ "const": "invoke"
197
+ },
198
+ "method": {
199
+ "type": "string",
200
+ "maxLength": 128,
201
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
202
+ }
203
+ },
204
+ "required": [
205
+ "type",
206
+ "method"
207
+ ]
208
+ },
209
+ {
210
+ "type": "object",
211
+ "additionalProperties": false,
212
+ "properties": {
213
+ "type": {
214
+ "const": "ndjson"
215
+ },
216
+ "method": {
217
+ "type": "string",
218
+ "maxLength": 128,
219
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
220
+ }
221
+ },
222
+ "required": [
223
+ "type",
224
+ "method"
225
+ ]
226
+ },
227
+ {
228
+ "type": "object",
229
+ "additionalProperties": false,
230
+ "properties": {
231
+ "type": {
232
+ "const": "upload"
233
+ },
234
+ "method": {
235
+ "type": "string",
236
+ "maxLength": 128,
237
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
238
+ },
239
+ "fileParam": {
240
+ "type": "string",
241
+ "minLength": 1,
242
+ "maxLength": 1024
243
+ },
244
+ "parentParam": {
245
+ "type": "string",
246
+ "minLength": 1,
247
+ "maxLength": 1024
248
+ },
249
+ "nameParam": {
250
+ "type": "string",
251
+ "minLength": 1,
252
+ "maxLength": 1024
253
+ }
254
+ },
255
+ "required": [
256
+ "type",
257
+ "method",
258
+ "fileParam",
259
+ "parentParam",
260
+ "nameParam"
261
+ ]
262
+ },
263
+ {
264
+ "type": "object",
265
+ "additionalProperties": false,
266
+ "properties": {
267
+ "type": {
268
+ "const": "paginate"
269
+ },
270
+ "method": {
271
+ "type": "string",
272
+ "maxLength": 128,
273
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
274
+ },
275
+ "items": {
276
+ "type": "string",
277
+ "minLength": 1,
278
+ "maxLength": 1024
279
+ },
280
+ "offsetParam": {
281
+ "type": "string",
282
+ "minLength": 1,
283
+ "maxLength": 1024
284
+ },
285
+ "limitParam": {
286
+ "type": "string",
287
+ "minLength": 1,
288
+ "maxLength": 1024
289
+ },
290
+ "pageSize": {
291
+ "type": "integer",
292
+ "minimum": 1,
293
+ "maximum": 1000
294
+ },
295
+ "maxPages": {
296
+ "type": "integer",
297
+ "minimum": 1,
298
+ "maximum": 1000
299
+ }
300
+ },
301
+ "required": [
302
+ "type",
303
+ "method",
304
+ "items",
305
+ "offsetParam",
306
+ "limitParam",
307
+ "pageSize",
308
+ "maxPages"
309
+ ]
310
+ },
311
+ {
312
+ "type": "object",
313
+ "additionalProperties": false,
314
+ "properties": {
315
+ "type": {
316
+ "const": "job"
317
+ },
318
+ "start": {
319
+ "type": "string",
320
+ "maxLength": 128,
321
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
322
+ },
323
+ "poll": {
324
+ "type": "string",
325
+ "maxLength": 128,
326
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
327
+ },
328
+ "result": {
329
+ "type": "string",
330
+ "maxLength": 128,
331
+ "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
332
+ },
333
+ "jobId": {
334
+ "type": "string",
335
+ "minLength": 1,
336
+ "maxLength": 1024
337
+ },
338
+ "idParam": {
339
+ "type": "string",
340
+ "minLength": 1,
341
+ "maxLength": 1024
342
+ },
343
+ "state": {
344
+ "type": "string",
345
+ "minLength": 1,
346
+ "maxLength": 1024
347
+ },
348
+ "done": {
349
+ "type": "array",
350
+ "minItems": 1,
351
+ "items": {
352
+ "type": "string",
353
+ "minLength": 1,
354
+ "maxLength": 1024
355
+ }
356
+ },
357
+ "failed": {
358
+ "type": "array",
359
+ "items": {
360
+ "type": "string",
361
+ "minLength": 1,
362
+ "maxLength": 1024
363
+ }
364
+ },
365
+ "intervalMs": {
366
+ "type": "integer",
367
+ "minimum": 10,
368
+ "maximum": 60000
369
+ },
370
+ "timeoutMs": {
371
+ "type": "integer",
372
+ "minimum": 10,
373
+ "maximum": 3600000
374
+ }
375
+ },
376
+ "required": [
377
+ "type",
378
+ "start",
379
+ "poll",
380
+ "jobId",
381
+ "idParam",
382
+ "state",
383
+ "done",
384
+ "failed",
385
+ "intervalMs",
386
+ "timeoutMs"
387
+ ]
388
+ }
389
+ ]
390
+ }
391
+ },
392
+ "required": [
393
+ "summary",
394
+ "cli",
395
+ "effect",
396
+ "permission",
397
+ "flow"
398
+ ]
399
+ }
400
+ }
401
+ },
402
+ "required": [
403
+ "package",
404
+ "aliases",
405
+ "provenance",
406
+ "entry",
407
+ "transport",
408
+ "bindings",
409
+ "commands"
410
+ ]
411
+ },
412
+ "sha256": {
413
+ "type": "string",
414
+ "pattern": "^[0-9a-f]{64}$"
415
+ }
416
+ },
417
+ "required": [
418
+ "format",
419
+ "version",
420
+ "payload",
421
+ "sha256"
422
+ ]
423
+ }
package/skills/SKILL.md CHANGED
@@ -7,7 +7,7 @@ description: Initialize, extend, check, build, inspect, and deploy Synology appl
7
7
 
8
8
  Use this guide to initialize, build and inspect own applications or upstream OSS as independent packages. 依已實作能力區分 DSM session 檔案、私有 jobs 與 App 登入;delegate 已實作並隨 CLI 提供固定操作的離線委託(預設 `files.moveFromStaging`);共用 delegate/rootOps executor 的完整裝置生命週期驗收仍待完成,不得宣稱已通過;支援邊界依 delegate guide/support matrix,禁止發明新的身分平台。
9
9
 
10
- Start with `synopkgland init -t native-go`, `synopkgland init -t binary`, or `synopkgland init -t compose`. Read reference/create.md or reference/wrap.md, then reference/deploy.md. Native CGI session checks belong to the package. For wrapping upstream OSS with DSM accounts, read [reference/identity-gateway.md](reference/identity-gateway.md) first. It covers native and host-network Compose upstreams, mode selection, isolation, account deletion and verification. Fixed package credentials govern container data access.
10
+ Start with `synopkgland init -t native-go`, `synopkgland init -t binary`, or `synopkgland init -t compose`. Read reference/create.md or reference/wrap.md, then reference/deploy.md. Native CGI session checks belong to the package. For wrapping upstream OSS with DSM accounts, read [reference/identity-gateway.md](reference/identity-gateway.md) first. For all Compose work, read [reference/compose.md](reference/compose.md): schema-2 upstream files, generated override, SDK planner, fixed package identity and current DSM blockers. Containers do not inherit a signed-in user's File Station ACL. Existing Shared Folder mounts are blocked until official protected ACL/project control is verified.
11
11
 
12
12
  Never install, uninstall, publish or modify NAS data without task authorization. Prefer check, inspect and deploy --dry-run for reviewable artifacts.
13
13
 
@@ -129,7 +129,7 @@ sweep forward the cancel instead of admitting it.
129
129
  `ExportExample` creates a private JSON file, calls `MoveFromStaging` once, and
130
130
  repeats the original request on repeated IDs. Review `example.go` to
131
131
  adapt a real producer; show Saved only from a protected committed receipt.
132
- - Wizard support is measured on vt-nas DSM 7.4 via a session-only SSH local
132
+ - Wizard support is measured on the test NAS DSM 7.4 via a session-only SSH local
133
133
  forward. This is not proof of other DSM releases or full writer/reboot behavior.
134
134
 
135
135
  ## 開啟方式
@@ -162,3 +162,5 @@ web service:省略 `ui.launch` 時預設 `new-page`,使用 standalone launch
162
162
  不帶 Application Portal。兩條 Compose 路線共用 `contract/app-launch.ts`
163
163
  解析開啟方式與選擇 launcher 型別;明確的 `ui.launch` 可覆寫預設。
164
164
  只有沒有 web service 的 SDK 原生 App 省略時才預設 `dsm-window`。
165
+
166
+ For controlling installed Apps or designing task-level AI commands, read [reference/ctl.md](reference/ctl.md). Use ctl host list, register/renew explicitly, discover all commands, and always name the host when agents may operate multiple NAS machines.