@synopackageland/cli 0.47.1 → 0.47.3

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.47.3
4
+
5
+ - Accept DSM service port entries using the all-protocol value, numeric single ports and string ranges
6
+ - Keep installation moving when DSM cannot verify a port; show inline warnings for known service conflicts, reserved ports and duplicate selections
7
+ - Retain number-format and range validation, and name detected conflicts in all nine wizard languages
8
+
9
+ ## 0.47.2
10
+
11
+ - Pin CLI-owned Compose planning and daemon controllers to SDK 0.46.1, which includes the gateway command-dispatch fix for inherited CGI environments.
12
+ - Preserve explicit App and gateway SDK declarations, and retain the clean npm publication flow from 0.47.1.
13
+
3
14
  ## 0.47.1 (2026-11-02)
4
15
 
5
16
  - Publish from a validated clean package directory so npm does not expose tarball source paths in registry installation metadata
@@ -54,6 +54,50 @@ export declare const WIZARD_MESSAGES: {
54
54
  es: string;
55
55
  it: string;
56
56
  };
57
+ "ports.reserved": {
58
+ en: string;
59
+ "zh-TW": string;
60
+ "zh-CN": string;
61
+ ja: string;
62
+ ko: string;
63
+ de: string;
64
+ fr: string;
65
+ es: string;
66
+ it: string;
67
+ };
68
+ "ports.conflict": {
69
+ en: string;
70
+ "zh-TW": string;
71
+ "zh-CN": string;
72
+ ja: string;
73
+ ko: string;
74
+ de: string;
75
+ fr: string;
76
+ es: string;
77
+ it: string;
78
+ };
79
+ "ports.duplicate": {
80
+ en: string;
81
+ "zh-TW": string;
82
+ "zh-CN": string;
83
+ ja: string;
84
+ ko: string;
85
+ de: string;
86
+ fr: string;
87
+ es: string;
88
+ it: string;
89
+ };
90
+ "ports.notice": {
91
+ en: string;
92
+ "zh-TW": string;
93
+ "zh-CN": string;
94
+ ja: string;
95
+ ko: string;
96
+ de: string;
97
+ fr: string;
98
+ es: string;
99
+ it: string;
100
+ };
57
101
  "ports.originInvalid": {
58
102
  en: string;
59
103
  "zh-TW": string;
@@ -44,15 +44,59 @@ export const WIZARD_MESSAGES = {
44
44
  "it": "Porte dell’app"
45
45
  },
46
46
  "ports.invalid": {
47
- "en": "Choose a port from 1024 to 65535 that is not reserved or used by another service; DSM must be able to verify it",
48
- "zh-TW": "請選擇 1024 至 65535 間未保留、未被其他服務使用的連接埠;DSM 必須能確認其狀態",
49
- "zh-CN": "请选择 1024 至 65535 之间未保留、未被其他服务使用的端口;DSM 必须能确认其状态",
50
- "ja": "1024~65535 の予約済みでも他サービスが使用中でもないポートを選択してください(DSM による確認が必要)",
51
- "ko": "1024~65535 사이에서 예약되지 않고 다른 서비스가 사용하지 않는 포트를 선택하십시오 (DSM 확인 필요)",
52
- "de": "Wählen Sie einen nicht reservierten, unbenutzten Port von 1024 bis 65535, den DSM prüfen kann",
53
- "fr": "Choisissez un port de 1024 à 65535 non réservé et non utilisé par un autre service, vérifiable par DSM",
54
- "es": "Seleccionar un puerto entre 1024 y 65535 que no esté reservado ni en uso y que DSM pueda verificar",
55
- "it": "Selezionare una porta da 1024 a 65535 non riservata né usata da altri servizi e verificabile da DSM"
47
+ "en": "Enter a port number from 1024 to 65535",
48
+ "zh-TW": "請輸入 1024 至 65535 間的連接埠號碼",
49
+ "zh-CN": "请输入 1024 至 65535 之间的端口号",
50
+ "ja": "1024~65535 のポート番号を入力してください",
51
+ "ko": "1024~65535 사이의 포트 번호를 입력하십시오",
52
+ "de": "Geben Sie eine Portnummer von 1024 bis 65535 ein",
53
+ "fr": "Saisissez un numéro de port de 1024 à 65535",
54
+ "es": "Introducir un número de puerto entre 1024 y 65535",
55
+ "it": "Inserire un numero di porta da 1024 a 65535"
56
+ },
57
+ "ports.reserved": {
58
+ "en": "Port {port} is reserved by DSM",
59
+ "zh-TW": "連接埠 {port} 為 DSM 保留",
60
+ "zh-CN": "端口 {port} 为 DSM 保留",
61
+ "ja": "ポート {port} は DSM が予約しています",
62
+ "ko": "포트 {port}는 DSM에서 예약되어 있습니다",
63
+ "de": "Port {port} ist für DSM reserviert",
64
+ "fr": "Le port {port} est réservé par DSM",
65
+ "es": "El puerto {port} está reservado por DSM",
66
+ "it": "La porta {port} è riservata da DSM"
67
+ },
68
+ "ports.conflict": {
69
+ "en": "Port {port} is used or reserved by {service}",
70
+ "zh-TW": "連接埠 {port} 已由 {service} 使用或保留",
71
+ "zh-CN": "端口 {port} 已由 {service} 使用或保留",
72
+ "ja": "ポート {port} は {service} が使用または予約しています",
73
+ "ko": "포트 {port}는 {service}에서 사용 중이거나 예약되어 있습니다",
74
+ "de": "Port {port} wird von {service} verwendet oder reserviert",
75
+ "fr": "Le port {port} est utilisé ou réservé par {service}",
76
+ "es": "El puerto {port} está en uso o reservado por {service}",
77
+ "it": "La porta {port} è utilizzata o riservata da {service}"
78
+ },
79
+ "ports.duplicate": {
80
+ "en": "Port {port} is already selected in another field",
81
+ "zh-TW": "其他欄位已選用連接埠 {port}",
82
+ "zh-CN": "其他字段已选用端口 {port}",
83
+ "ja": "ポート {port} は別の項目で選択されています",
84
+ "ko": "포트 {port}는 다른 필드에서 이미 선택되었습니다",
85
+ "de": "Port {port} ist bereits in einem anderen Feld ausgewählt",
86
+ "fr": "Le port {port} est déjà sélectionné dans un autre champ",
87
+ "es": "El puerto {port} ya está seleccionado en otro campo",
88
+ "it": "La porta {port} è già selezionata in un altro campo"
89
+ },
90
+ "ports.notice": {
91
+ "en": "Port conflicts are warnings only; installation can continue, but the app may fail to start",
92
+ "zh-TW": "連接埠衝突僅顯示警告,仍可繼續安裝,但應用程式可能無法啟動",
93
+ "zh-CN": "端口冲突仅显示警告,仍可继续安装,但应用程序可能无法启动",
94
+ "ja": "ポートの競合は警告のみで、インストールは続行できますが、アプリが起動できない場合があります",
95
+ "ko": "포트 충돌은 경고만 표시하며 설치를 계속할 수 있지만 앱이 시작되지 않을 수 있습니다",
96
+ "de": "Portkonflikte werden nur als Warnung angezeigt; die Installation kann fortgesetzt werden, aber die App startet möglicherweise nicht",
97
+ "fr": "Les conflits de port sont de simples avertissements ; l’installation peut continuer, mais l’application risque de ne pas démarrer",
98
+ "es": "Los conflictos de puerto solo muestran una advertencia; la instalación puede continuar, pero la aplicación podría no iniciarse",
99
+ "it": "I conflitti di porta sono solo avvisi; l’installazione può continuare, ma l’app potrebbe non avviarsi"
56
100
  },
57
101
  "ports.originInvalid": {
58
102
  "en": "Enter a root HTTPS origin using the HTTPS port selected in this wizard",
@@ -1,7 +1,7 @@
1
1
  export { goPrivateCovers } from './go-env.js';
2
2
  import { type ExecutorManifest } from './sdk-executor-manifest.js';
3
3
  /** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
4
- export declare const DEFAULT_SDK_VERSION = "0.44.0";
4
+ export declare const DEFAULT_SDK_VERSION = "0.46.1";
5
5
  export declare const SDK_PACKAGE = "@synopackageland/sdk";
6
6
  export declare const SDK_MODULE = "github.com/synopackageland/syno-pkg-land-sdk";
7
7
  export declare const EXECUTOR_MODULE = "github.com/synopackageland/syno-pkg-land-sdk/executor";
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
5
5
  import { join } from 'node:path';
6
6
  import { readExecutorManifest, predatesExecutorManifest } from './sdk-executor-manifest.js';
7
7
  /** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
8
- export const DEFAULT_SDK_VERSION = '0.44.0';
8
+ export const DEFAULT_SDK_VERSION = '0.46.1';
9
9
  export const SDK_PACKAGE = '@synopackageland/sdk';
10
10
  export const SDK_MODULE = 'github.com/synopackageland/syno-pkg-land-sdk';
11
11
  export const EXECUTOR_MODULE = `${SDK_MODULE}/executor`;
@@ -5,13 +5,18 @@ export declare function portDefaults(m: Pick<StandaloneManifest, 'identityGatewa
5
5
  protocol: 'tcp';
6
6
  }>;
7
7
  export declare function withPort(m: StandaloneManifest, key: string, value: number): StandaloneManifest;
8
- export declare function portFieldValidator(pkg: string, key: string, reason: string): string;
8
+ interface PortMessages {
9
+ reserved: string;
10
+ conflict: string;
11
+ duplicate: string;
12
+ }
13
+ export declare function portFieldValidator(pkg: string, key: string, reason: string, messages?: PortMessages): string;
9
14
  export declare function portInstallSteps(m: Pick<StandaloneManifest, 'package' | 'installPorts' | 'identityGateway'>, definitions?: Record<string, {
10
15
  default: number;
11
16
  protocol: "tcp";
12
17
  }>): (t: Translate) => {
13
18
  step_title: string;
14
- items: {
19
+ items: ({
15
20
  type: string;
16
21
  desc: string;
17
22
  subitems: {
@@ -23,9 +28,12 @@ export declare function portInstallSteps(m: Pick<StandaloneManifest, 'package' |
23
28
  fn: string;
24
29
  };
25
30
  }[];
26
- }[];
31
+ } | {
32
+ desc: string;
33
+ })[];
27
34
  }[];
28
35
  /** Render each artifact with out-of-range marker ports. Only values derived
29
36
  * from the selected listener change; an unrelated timer or numeric setting
30
37
  * equal to a default port is preserved. Originals remain inspectable in SPK. */
31
38
  export declare function writePortPayload(m: StandaloneManifest, root: string, render: (variant: StandaloneManifest) => Record<string, string>): void;
39
+ export {};
@@ -13,16 +13,37 @@ export function withPort(m, key, value) {
13
13
  const g = m.identityGateway;
14
14
  return { ...m, identityGateway: { ...g, listen: { ...g.listen, ...(key.startsWith('gateway_') ? { [key.slice(8)]: value } : {}) }, ...(g.oidc ? { oidc: { ...g.oidc, ...(key === 'oidc_issuer' ? { issuer_port: value } : {}) } } : {}) } };
15
15
  }
16
- function validatePortField(value, pkg, key, reason) {
16
+ /** Validate port syntax; service conflicts are advisory and never block Next. */
17
+ function validatePortField(value, pkg, key, reason, messages) {
17
18
  const raw = String(value), n = Number(raw);
18
- if (!/^[1-9][0-9]{3,4}$/.test(raw) || n < 1024 || n > 65535 || [1900, 5000, 5001, 5005, 5006, 5353, 6690].includes(n))
19
+ const globals = globalThis;
20
+ const state = globals['synopkglandPorts_' + pkg] || (globals['synopkglandPorts_' + pkg] = {});
21
+ const display = {
22
+ message(text, service = '') { return text.replace(/\{(port|service)\}/g, (_match, name) => name === 'port' ? raw : service); },
23
+ warning(text) {
24
+ const element = typeof document === 'undefined' ? null : document.getElementById('synopkgland-port-warning-' + pkg + '-' + key);
25
+ if (element) {
26
+ element.textContent = text ? '⚠ ' + text : '';
27
+ element.style.visibility = text ? 'visible' : 'hidden';
28
+ }
29
+ },
30
+ accept(warning = '') { state[key] = n; display.warning(warning); return true; },
31
+ };
32
+ display.warning('');
33
+ delete state[key];
34
+ if (!/^[1-9][0-9]{3,4}$/.test(raw) || n < 1024 || n > 65535)
19
35
  return reason;
36
+ if ([1900, 5000, 5001, 5005, 5006, 5353, 6690].includes(n))
37
+ return display.accept(display.message(messages.reserved));
38
+ for (const other in state)
39
+ if (other !== key && state[other] === n)
40
+ return display.accept(display.message(messages.duplicate));
20
41
  try {
21
42
  let request = new XMLHttpRequest();
22
43
  request.open('GET', '/webman/login.cgi?enable_syno_token=yes', false);
23
44
  request.send();
24
45
  const token = JSON.parse(request.responseText).SynoToken;
25
- if (!token)
46
+ if (request.status !== 200 || !token)
26
47
  throw new Error();
27
48
  request = new XMLHttpRequest();
28
49
  request.open('POST', '/webapi/entry.cgi', false);
@@ -30,43 +51,47 @@ function validatePortField(value, pkg, key, reason) {
30
51
  request.setRequestHeader('X-SYNO-TOKEN', token);
31
52
  request.send('api=SYNO.Core.Service.PortInfo&version=1&method=load');
32
53
  const result = JSON.parse(request.responseText), rows = result.data?.port_info;
33
- if (request.status !== 200 || result.success !== true || !Array.isArray(rows) || !rows.length)
54
+ if (request.status !== 200 || result.success !== true || !Array.isArray(rows))
34
55
  throw new Error();
35
56
  for (const row of rows) {
36
- if (typeof row.protocol !== 'string' || typeof row.port_id !== 'string' || !Array.isArray(row.dst_port) || !row.dst_port.length)
37
- throw new Error();
57
+ if (!row || typeof row.protocol !== 'string' || typeof row.port_id !== 'string' || !Array.isArray(row.dst_port))
58
+ continue;
38
59
  const protocol = row.protocol.toLowerCase().replace(/\s/g, '');
39
- if (!/^(?:tcp|udp)(?:,(?:tcp|udp))*$/.test(protocol))
40
- throw new Error();
41
- if (!protocol.split(',').includes('tcp'))
60
+ if (protocol !== 'all' && !protocol.split(',').includes('tcp'))
61
+ continue;
62
+ if (row.port_id === 'synopkgland.' + pkg.replaceAll('_', '-') + '.' + key.replaceAll('_', '-'))
42
63
  continue;
43
64
  for (const item of row.dst_port) {
44
- if (typeof item !== 'string')
45
- throw new Error();
46
- const range = /^([0-9]+)(?:[-:]([0-9]+))?$/.exec(item);
65
+ // DSM returns numeric single ports as well as strings and ranges.
66
+ if (typeof item !== 'string' && !(typeof item === 'number' && Number.isInteger(item)))
67
+ continue;
68
+ const range = /^([0-9]+)(?:[-:]([0-9]+))?$/.exec(String(item).trim());
47
69
  if (!range || Number(range[1]) < 1 || Number(range[2] || range[1]) > 65535 || Number(range[1]) > Number(range[2] || range[1]))
48
- throw new Error();
49
- if (n >= Number(range[1]) && n <= Number(range[2] || range[1]) && row.port_id !== 'synopkgland.' + pkg.replaceAll('_', '-') + '.' + key.replaceAll('_', '-'))
50
- return reason;
70
+ continue;
71
+ if (n >= Number(range[1]) && n <= Number(range[2] || range[1]))
72
+ return display.accept(display.message(messages.conflict, typeof row.name === 'string' && row.name ? row.name : row.port_id));
51
73
  }
52
74
  }
53
- const globals = globalThis;
54
- const state = globals['synopkglandPorts_' + pkg] || (globals['synopkglandPorts_' + pkg] = {});
55
- for (const other in state)
56
- if (other !== key && state[other] === n)
57
- return reason;
58
- state[key] = n;
59
- return true;
60
75
  }
61
76
  catch {
62
- return reason;
77
+ // An unavailable API cannot establish a conflict; runtime binding is final.
63
78
  }
79
+ return display.accept();
64
80
  }
65
- export function portFieldValidator(pkg, key, reason) {
66
- return `{return (${validatePortField.toString()})(arguments[0],${JSON.stringify(pkg)},${JSON.stringify(key)},${JSON.stringify(reason)})}`;
81
+ export function portFieldValidator(pkg, key, reason, messages = { reserved: reason, conflict: reason, duplicate: reason }) {
82
+ return `{return (${validatePortField.toString()})(arguments[0],${JSON.stringify(pkg)},${JSON.stringify(key)},${JSON.stringify(reason)},${JSON.stringify(messages)})}`;
67
83
  }
68
84
  export function portInstallSteps(m, definitions = portDefaults(m)) {
69
- return (t) => m.installPorts ? [{ step_title: t('ports.title'), items: Object.entries(definitions).map(([key, p]) => ({ type: 'textfield', desc: t(key === 'gateway_http' ? 'ports.http' : key === 'gateway_https' ? 'ports.https' : 'ports.signin'), subitems: [{ key: 'pkgwizard_port_' + key, desc: t(key === 'gateway_http' ? 'ports.http' : key === 'gateway_https' ? 'ports.https' : 'ports.signin'), defaultValue: String(p.default), validator: { allowBlank: false, fn: portFieldValidator(m.package, key, t('ports.invalid')) } }] })) }] : [];
85
+ return (t) => m.installPorts ? [{
86
+ step_title: t('ports.title'),
87
+ items: [{ desc: t('ports.notice') }, ...Object.entries(definitions).flatMap(([key, p]) => {
88
+ const label = t(key === 'gateway_http' ? 'ports.http' : key === 'gateway_https' ? 'ports.https' : 'ports.signin');
89
+ return [
90
+ { type: 'textfield', desc: label, subitems: [{ key: 'pkgwizard_port_' + key, desc: label, defaultValue: String(p.default), validator: { allowBlank: false, fn: portFieldValidator(m.package, key, t('ports.invalid'), { reserved: t('ports.reserved', { port: '{port}' }), conflict: t('ports.conflict', { port: '{port}', service: '{service}' }), duplicate: t('ports.duplicate', { port: '{port}' }) }) } }] },
91
+ { desc: `<div id="synopkgland-port-warning-${m.package}-${key}" role="status" aria-live="polite" style="min-height:44px;visibility:hidden"></div>` },
92
+ ];
93
+ })],
94
+ }] : [];
70
95
  }
71
96
  /** Render each artifact with out-of-range marker ports. Only values derived
72
97
  * from the selected listener change; an unrelated timer or numeric setting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.47.1",
3
+ "version": "0.47.3",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
package/skills/SKILL.md CHANGED
@@ -16,7 +16,7 @@ The CLI verifies bytes before packaging and never fetches a manifest at NAS runt
16
16
  Unsupported formats require a CLI update; invalid manifests fail closed. Existing
17
17
  SDK 0.26.0/0.27.0 use the frozen legacy inventory.
18
18
 
19
- For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Default to an App-named dedicated DSM data share and installer-selected ports. Existing-folder access, port availability and required HTTPS origins must pass localized wizard validation before Next; upgrades retain port selections.
19
+ For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Default to an App-named dedicated DSM data share and installer-selected ports. Existing-folder access, port number format/range and required HTTPS origins use localized wizard validation before Next; detected port conflicts are nonblocking inline warnings, and an unavailable DSM port inventory does not block installation; upgrades retain port selections.
20
20
 
21
21
  All CLI NAS requests share one connection path. NAS certificates are accepted by default, including self-signed, wrong-name and expired certificates. A changed certificate warns once, updates its displayed SHA-256 and continues. `host add --strict-tls` stores strict verification; `--strict-tls` or `--ca <file>` on a command opts in for that command. Read [reference/host-install.md](reference/host-install.md) for host trust and error codes.
22
22
 
@@ -1,6 +1,6 @@
1
1
  # Native installation settings
2
2
 
3
- Use CLI 0.47.1 with the existing supported SDK/App and templates pins. Configure installation through the manifest and generated wizard; do not add App ACL writers, root hooks or independent port state.
3
+ Use CLI 0.47.3 with the existing supported SDK/App and templates pins. Configure installation through the manifest and generated wizard; do not add App ACL writers, root hooks or independent port state.
4
4
 
5
5
  ```yaml
6
6
  install:
@@ -21,7 +21,7 @@ The upgrade wizard prefills and submits the recorded folder without a separate c
21
21
 
22
22
  Uninstall retains the share, files and package account's ACL because DSM data-share Release does nothing. Old selected shares can retain that ACL too. To revoke it, an administrator opens Control Panel > Shared Folder > the folder > Edit > Permissions > System internal user, clears the package account's Read only/Read/Write permission and saves, preserving other rows and data. See [shared-folder behavior](../../docs/shared-folders.md).
23
23
 
24
- Port fields default to declared gateway HTTP/HTTPS and local OIDC listener ports. Validation refuses noncanonical numbers, values outside 1024–65535, reserved DSM/discovery ports, duplicates and conflicts from DSM's `SYNO.Core.Service.PortInfo` inventory. Missing or malformed inventory blocks Next. The package-account controller repeats the native service conflict check and materializes gateway, nginx, launcher, daemon and `.sc` port-config data from the selected values.
24
+ Port fields default to declared gateway HTTP/HTTPS and local OIDC listener ports. Validation refuses noncanonical numbers and values outside 1024–65535. Reserved DSM/discovery ports, duplicate selections and conflicts from DSM's `SYNO.Core.Service.PortInfo` inventory produce inline warnings; Next remains available. The inventory is advisory: API, permission or parsing failures do not block Next, and an unsupported row does not hide a later confirmed conflict. DSM's all-protocol entries cover TCP too; numeric ports and string ranges are accepted. The package-account controller repeats the native service conflict check and materializes gateway, nginx, launcher, daemon and `.sc` port-config data from the selected values. A real conflict can still prevent the App from starting.
25
25
 
26
26
  Native subprocesses and Compose `.env` receive `SYNOPKGLAND_PORT_GATEWAY_HTTP`, `SYNOPKGLAND_PORT_GATEWAY_HTTPS` and, when declared, `SYNOPKGLAND_PORT_OIDC_ISSUER`. Go Apps can read `installsettings.PortValues(payloadRoot)`. Bind upstream public-port configuration declaratively:
27
27