@synopackageland/cli 0.52.17 → 0.53.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 +13 -0
- package/README.md +19 -16
- package/dist/build-spk/install-wizard.d.ts +8 -3
- package/dist/build-spk/install-wizard.js +38 -10
- package/dist/build-spk/wizard-messages.d.ts +22 -0
- package/dist/build-spk/wizard-messages.js +22 -0
- package/dist/e2e/dsm.d.ts +1 -1
- package/dist/e2e/dsm.js +1 -1
- package/dist/error-registry.js +6 -5
- package/dist/init.js +10 -8
- package/dist/native-http-schema/source.json +1 -1
- package/dist/package-manager.d.ts +4 -0
- package/dist/package-manager.js +48 -0
- package/dist/standalone/bridge-app.js +4 -2
- package/dist/standalone/build.js +6 -5
- package/dist/standalone/inspect-spk.d.ts +2 -0
- package/dist/standalone/inspect-spk.js +14 -10
- package/dist/standalone/install-memory.d.ts +25 -2
- package/dist/standalone/install-memory.js +90 -6
- package/dist/standalone/manifest.d.ts +3 -0
- package/dist/standalone/manifest.js +4 -2
- package/dist/standalone/sdk-check.js +2 -4
- package/dist/standalone/shared-folder.js +3 -3
- package/dist/standalone/spk.js +2 -1
- package/docs/install-memory.md +29 -1
- package/package.json +6 -5
- package/schema/dsm-api-contract.json +1 -1
- package/schema/dsm-package.schema.json +6 -0
- package/skills/SKILL.md +9 -9
- package/skills/reference/compose.md +1 -1
- package/skills/reference/create.md +1 -1
- package/skills/reference/ctl.md +1 -1
- package/skills/reference/install.md +2 -1
- package/skills/reference/testing.md +7 -7
- package/skills/reference/ui-json.md +8 -8
- package/skills/reference/ui-vue.md +6 -6
- package/skills/reference/upstream-fork.md +1 -1
|
@@ -6,7 +6,7 @@ import { DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM, readNoFile
|
|
|
6
6
|
import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
7
7
|
import { renderGatewayIngressCheck } from './native-gateway.js';
|
|
8
8
|
import { portDefaults, portInstallSteps } from "./install-ports.js";
|
|
9
|
-
import { readMinMemoryMb, renderMemoryHook } from "./install-memory.js";
|
|
9
|
+
import { readMemoryAdviceRecord, readMinMemoryMb, renderMemoryHook } from "./install-memory.js";
|
|
10
10
|
import { inspectPackageDependencies, dependencyInfo } from "./package-dependencies.js";
|
|
11
11
|
import { readInstallSettings, settingsInstallSteps, settingsConfig, renderSettingsHook, renderNativeFolderHook, nativeFolderConfig } from './install-settings.js';
|
|
12
12
|
import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
|
|
@@ -189,6 +189,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
189
189
|
const { identityGateway, gateway } = await inspectGatewayAdmission(dir, paths, metadata.provider_only_oidc, findings);
|
|
190
190
|
await inspectExternalGateway(dir, paths, payload, metadata.gateway_external, findings);
|
|
191
191
|
const minMemoryMb = inspectMemoryRequirement(dir, metadata.minMemoryMb, findings);
|
|
192
|
+
const memoryAdvice = readMemoryAdviceRecord(metadata.recommendedMemory, minMemoryMb, e => findings.push(`${e.code} ${e.message}`));
|
|
192
193
|
const installSettings = await inspectInstallSettings(dir, payload, metadata, findings);
|
|
193
194
|
const hyperBackup = metadataText === undefined ? undefined : await inspectHyperBackup(dir, async () => {
|
|
194
195
|
const root = join(dir, "backup-inspection");
|
|
@@ -202,7 +203,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
202
203
|
const integrations = metadata.integrations ?? [];
|
|
203
204
|
await inspectCtlArtifacts(dir, paths, metadata.ctl, metadata.entry, findings);
|
|
204
205
|
if (metadata.compose !== undefined) {
|
|
205
|
-
const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb }, findings, options.baseline);
|
|
206
|
+
const result = await inspectUnifiedCompose(dir, payload, { ...metadata, installSettings, minMemoryMb, memoryAdvice }, findings, options.baseline);
|
|
206
207
|
if (dependencies) {
|
|
207
208
|
result.dependencies = dependencies;
|
|
208
209
|
}
|
|
@@ -210,6 +211,8 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
210
211
|
result.installSettings = installSettings;
|
|
211
212
|
if (minMemoryMb !== undefined)
|
|
212
213
|
result.minMemoryMb = minMemoryMb;
|
|
214
|
+
if (memoryAdvice)
|
|
215
|
+
result.recommendedMemoryMb = memoryAdvice.mb;
|
|
213
216
|
if (hyperBackup)
|
|
214
217
|
result.hyperBackup = hyperBackup;
|
|
215
218
|
if (identityGateway)
|
|
@@ -351,7 +354,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
351
354
|
? await inspectLoginStyle(dir, info.package, Boolean(portal || executor?.policy.portal), findings)
|
|
352
355
|
: undefined;
|
|
353
356
|
if (standalone)
|
|
354
|
-
checkSharedFolder(dir, findings, info.package, sharedFolder, executor?.policy.scope === "install-selected", portal, hasExecutor, nativeGateway, info.os_min_ver, installSettings, integrations, metadata.installPorts, minMemoryMb, options.baseline);
|
|
357
|
+
checkSharedFolder(dir, findings, info.package, sharedFolder, executor?.policy.scope === "install-selected", portal, hasExecutor, nativeGateway, info.os_min_ver, installSettings, integrations, metadata.installPorts, minMemoryMb, memoryAdvice, options.baseline);
|
|
355
358
|
const icon = inspectPackageIcons(dir, findings);
|
|
356
359
|
const cgiEntry = payload.find((entry) => entry.path === CGI_PAYLOAD_PATH);
|
|
357
360
|
if (standalone && !cgiEntry) {
|
|
@@ -369,6 +372,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
369
372
|
...(gateway ? { gateway } : {}),
|
|
370
373
|
...(installSettings ? { installSettings } : {}),
|
|
371
374
|
...(minMemoryMb !== undefined ? { minMemoryMb } : {}),
|
|
375
|
+
...(memoryAdvice ? { recommendedMemoryMb: memoryAdvice.mb } : {}),
|
|
372
376
|
...(hyperBackup ? { hyperBackup } : {}),
|
|
373
377
|
...(launch ? { launch } : {}),
|
|
374
378
|
icon,
|
|
@@ -860,8 +864,8 @@ async function inspectUnifiedCompose(dir, payload, metadata, findings, baseline
|
|
|
860
864
|
throw new Error("gateway configuration differs from the declared package contract");
|
|
861
865
|
if (readOptional(join(dir, "conf/privilege")) !== renderNativePrivilege())
|
|
862
866
|
throw new Error("Compose hooks must run as the package account");
|
|
863
|
-
if (!baseline && (manifest.sharedFolder || metadata.installSettings || metadata.installPorts || metadata.minMemoryMb !== undefined)) {
|
|
864
|
-
for (const [name, text] of Object.entries(expectedWizardFiles(info.package, manifest.sharedFolder, false, undefined, metadata.installSettings, [], manifest.identityGateway?.listen.https, metadata.installPorts, metadata.minMemoryMb)))
|
|
867
|
+
if (!baseline && (manifest.sharedFolder || metadata.installSettings || metadata.installPorts || metadata.minMemoryMb !== undefined || metadata.memoryAdvice)) {
|
|
868
|
+
for (const [name, text] of Object.entries(expectedWizardFiles(info.package, manifest.sharedFolder, false, undefined, metadata.installSettings, [], manifest.identityGateway?.listen.https, metadata.installPorts, metadata.minMemoryMb, metadata.memoryAdvice)))
|
|
865
869
|
if (readOptional(join(dir, "WIZARD_UIFILES", name)) !== text)
|
|
866
870
|
throw new Error(`unexpected WIZARD_UIFILES/${name}; native share selection must match the declaration`);
|
|
867
871
|
}
|
|
@@ -1522,7 +1526,7 @@ function checkBackground(dir, info, payload, findings, executor, daemon, bridge
|
|
|
1522
1526
|
* declaration (without one, any present file must be the default native
|
|
1523
1527
|
* install wizard), and no other install/upgrade wizard file may exist.
|
|
1524
1528
|
*/
|
|
1525
|
-
function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal, executor = false, nativeGateway, osMinVer, installSettings, integrations = [], installPortDefinitions = {}, minMemoryMb, baseline = false) {
|
|
1529
|
+
function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal, executor = false, nativeGateway, osMinVer, installSettings, integrations = [], installPortDefinitions = {}, minMemoryMb, memoryAdvice, baseline = false) {
|
|
1526
1530
|
const wizardDir = join(dir, "WIZARD_UIFILES");
|
|
1527
1531
|
const present = (existsSync(wizardDir) ? readdirSync(wizardDir) : [])
|
|
1528
1532
|
.filter((name) => /^(install|upgrade)_uifile(_|\.|$)/.test(name))
|
|
@@ -1549,7 +1553,7 @@ function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal,
|
|
|
1549
1553
|
: {}),
|
|
1550
1554
|
...portalManifest(portal),
|
|
1551
1555
|
};
|
|
1552
|
-
const wizards = expectedWizardFiles(pkg, folder, selected, portal, installSettings, integrations, nativeGateway?.listen.https, installPortDefinitions, minMemoryMb);
|
|
1556
|
+
const wizards = expectedWizardFiles(pkg, folder, selected, portal, installSettings, integrations, nativeGateway?.listen.https, installPortDefinitions, minMemoryMb, memoryAdvice);
|
|
1553
1557
|
const source = selected
|
|
1554
1558
|
? "the install-selected policy"
|
|
1555
1559
|
: folder
|
|
@@ -1560,7 +1564,7 @@ function checkSharedFolder(dir, findings, pkg, folder, selected = false, portal,
|
|
|
1560
1564
|
? "the integrations declaration"
|
|
1561
1565
|
: "the native-go default install wizard";
|
|
1562
1566
|
// The default native wizard is optional; a declared shared folder or portal needs all of its files.
|
|
1563
|
-
for (const name of baseline ? [] : folder || selected || portal || installSettings || Object.keys(installPortDefinitions).length || integrations.length || minMemoryMb !== undefined
|
|
1567
|
+
for (const name of baseline ? [] : folder || selected || portal || installSettings || Object.keys(installPortDefinitions).length || integrations.length || minMemoryMb !== undefined || memoryAdvice
|
|
1564
1568
|
? Object.keys(wizards)
|
|
1565
1569
|
: present.filter((n) => n in wizards)) {
|
|
1566
1570
|
if (readOptional(join(wizardDir, name)) !== wizards[name])
|
|
@@ -1668,7 +1672,7 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
|
|
|
1668
1672
|
}
|
|
1669
1673
|
return settings;
|
|
1670
1674
|
}
|
|
1671
|
-
function expectedWizardFiles(pkg, folder, selected = false, portal, installSettings, integrations = [], settingsPort = 0, installPortDefinitions = {}, minMemoryMb) {
|
|
1675
|
+
function expectedWizardFiles(pkg, folder, selected = false, portal, installSettings, integrations = [], settingsPort = 0, installPortDefinitions = {}, minMemoryMb, memoryAdvice) {
|
|
1672
1676
|
const steps = selected
|
|
1673
1677
|
? (t) => [
|
|
1674
1678
|
...renderDelegateScopeSteps(t),
|
|
@@ -1677,7 +1681,7 @@ function expectedWizardFiles(pkg, folder, selected = false, portal, installSetti
|
|
|
1677
1681
|
: folder
|
|
1678
1682
|
? sharedFolderInstallSteps(pkg, folder)
|
|
1679
1683
|
: renderNativeInstallWizard;
|
|
1680
|
-
const install = renderInstallWizardFiles(pkg, t => [...steps(t), ...portInstallSteps({ package: pkg, ...(Object.keys(installPortDefinitions).length ? { installPorts: true } : {}) }, installPortDefinitions)(t), ...settingsInstallSteps(installSettings, settingsPort, Object.keys(installPortDefinitions).length ? pkg : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, integrations)], minMemoryMb);
|
|
1684
|
+
const install = renderInstallWizardFiles(pkg, t => [...steps(t), ...portInstallSteps({ package: pkg, ...(Object.keys(installPortDefinitions).length ? { installPorts: true } : {}) }, installPortDefinitions)(t), ...settingsInstallSteps(installSettings, settingsPort, Object.keys(installPortDefinitions).length ? pkg : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, integrations)], minMemoryMb, memoryAdvice);
|
|
1681
1685
|
return folderPickerWizardFiles(pkg, folder, {
|
|
1682
1686
|
...install.static,
|
|
1683
1687
|
...install.dynamic,
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import type { StandaloneError } from "./manifest.js";
|
|
2
|
-
import { type Locale } from "./i18n.js";
|
|
2
|
+
import { type Catalogs, type Locale } from "./i18n.js";
|
|
3
3
|
/** MiB of physical MemTotal, not free/available memory or a model allowlist. */
|
|
4
4
|
export declare function readMinMemoryMb(value: unknown, fail: (error: StandaloneError) => void): number | undefined;
|
|
5
|
+
/** The App's optional catalog text shown under the recommended-memory warning. */
|
|
6
|
+
export declare const RECOMMENDED_MEMORY_MESSAGE_KEY = "install.recommended_memory_message";
|
|
7
|
+
/**
|
|
8
|
+
* `install.recommended_memory_mb`: below it the install wizard shows a
|
|
9
|
+
* warning page the administrator can continue past; nothing is enforced.
|
|
10
|
+
* `messages` are the App's own localized text, English as the fallback.
|
|
11
|
+
*/
|
|
12
|
+
export interface MemoryAdvice {
|
|
13
|
+
mb: number;
|
|
14
|
+
messages?: {
|
|
15
|
+
en: string;
|
|
16
|
+
} & Partial<Record<Locale, string>>;
|
|
17
|
+
}
|
|
18
|
+
/** MiB of physical MemTotal, above `install.min_memory_mb` when both are declared. */
|
|
19
|
+
export declare function readRecommendedMemoryMb(value: unknown, minMemoryMb: number | undefined, fail: (error: StandaloneError) => void): number | undefined;
|
|
20
|
+
/** The App message from its catalogs (or a packaged record); undefined when absent, null after reporting. */
|
|
21
|
+
export declare function readMemoryAdviceMessages(catalogs: Partial<Record<string, Record<string, unknown>>> | undefined, fail: (error: StandaloneError) => void): MemoryAdvice["messages"] | undefined | null;
|
|
22
|
+
/** Reads `install.recommended_memory_mb` with the App message from its catalogs. */
|
|
23
|
+
export declare function readMemoryAdvice(value: unknown, minMemoryMb: number | undefined, catalogs: Catalogs | undefined, fail: (error: StandaloneError) => void): MemoryAdvice | undefined;
|
|
24
|
+
/** The `sdk-package.json` record read back for inspect; undefined after reporting. */
|
|
25
|
+
export declare function readMemoryAdviceRecord(value: unknown, minMemoryMb: number | undefined, fail: (error: StandaloneError) => void): MemoryAdvice | undefined;
|
|
5
26
|
/** Shared by wizard and preinst. A missing, malformed or unreadable read allows installation. */
|
|
6
|
-
export declare function renderMemoryProbe(minMemoryMb: number): string;
|
|
27
|
+
export declare function renderMemoryProbe(minMemoryMb: number | undefined, recommendedMemoryMb?: number): string;
|
|
28
|
+
/** The SDK warning, then the App's own text in the same language when it has one. */
|
|
29
|
+
export declare function memoryAdviceTexts(advice: MemoryAdvice, locale: Locale, actual: string): string[];
|
|
7
30
|
export declare function memoryReason(minMemoryMb: number, locale: Locale, actual: string): string;
|
|
8
31
|
/** Runs in preinst for both install and upgrade, before other SDK or App work, as the package account. */
|
|
9
32
|
export declare function renderMemoryHook(minMemoryMb?: number): string;
|
|
@@ -11,23 +11,107 @@ export function readMinMemoryMb(value, fail) {
|
|
|
11
11
|
}
|
|
12
12
|
return value;
|
|
13
13
|
}
|
|
14
|
+
/** The App's optional catalog text shown under the recommended-memory warning. */
|
|
15
|
+
export const RECOMMENDED_MEMORY_MESSAGE_KEY = "install.recommended_memory_message";
|
|
16
|
+
const invalidRecommendation = (message) => ({ code: "INSTALL_RECOMMENDED_MEMORY_INVALID", message });
|
|
17
|
+
/** MiB of physical MemTotal, above `install.min_memory_mb` when both are declared. */
|
|
18
|
+
export function readRecommendedMemoryMb(value, minMemoryMb, fail) {
|
|
19
|
+
if (value === undefined)
|
|
20
|
+
return undefined;
|
|
21
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1 || value > 2147483647) {
|
|
22
|
+
fail(invalidRecommendation("install.recommended_memory_mb must be a positive integer in MiB, at most 2147483647"));
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
if (minMemoryMb !== undefined && value <= minMemoryMb) {
|
|
26
|
+
fail(invalidRecommendation("install.recommended_memory_mb must be greater than install.min_memory_mb"));
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
/** Plain single-line wizard text: DSM renders `desc` as markup, so no tags or entities. */
|
|
32
|
+
function adviceText(text) {
|
|
33
|
+
return typeof text === "string" && text.trim() !== "" && text.length <= 300 && !/[\x00-\x1f\x7f<>&]/.test(text);
|
|
34
|
+
}
|
|
35
|
+
/** The App message from its catalogs (or a packaged record); undefined when absent, null after reporting. */
|
|
36
|
+
export function readMemoryAdviceMessages(catalogs, fail) {
|
|
37
|
+
const found = LOCALES.flatMap(locale => catalogs?.[locale]?.[RECOMMENDED_MEMORY_MESSAGE_KEY] === undefined ? [] : [[locale, catalogs[locale][RECOMMENDED_MEMORY_MESSAGE_KEY]]]);
|
|
38
|
+
if (!found.length)
|
|
39
|
+
return undefined;
|
|
40
|
+
const bad = found.filter(([, text]) => !adviceText(text)).map(([locale]) => locale);
|
|
41
|
+
if (bad.length || !found.some(([locale]) => locale === "en")) {
|
|
42
|
+
fail(invalidRecommendation(`${RECOMMENDED_MEMORY_MESSAGE_KEY} must be plain single-line text (1-300 characters, without <, > or &) with an English text${bad.length ? `; invalid in ${bad.join(", ")}` : ""}`));
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return Object.fromEntries(found);
|
|
46
|
+
}
|
|
47
|
+
/** Reads `install.recommended_memory_mb` with the App message from its catalogs. */
|
|
48
|
+
export function readMemoryAdvice(value, minMemoryMb, catalogs, fail) {
|
|
49
|
+
const mb = readRecommendedMemoryMb(value, minMemoryMb, fail);
|
|
50
|
+
if (mb === undefined)
|
|
51
|
+
return undefined;
|
|
52
|
+
const messages = readMemoryAdviceMessages(catalogs, fail);
|
|
53
|
+
if (messages === null)
|
|
54
|
+
return undefined;
|
|
55
|
+
return { mb, ...(messages ? { messages } : {}) };
|
|
56
|
+
}
|
|
57
|
+
/** The `sdk-package.json` record read back for inspect; undefined after reporting. */
|
|
58
|
+
export function readMemoryAdviceRecord(value, minMemoryMb, fail) {
|
|
59
|
+
if (value === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
if (typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).some(key => key !== "mb" && key !== "messages")) {
|
|
62
|
+
fail(invalidRecommendation("the recommended memory record is malformed"));
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
const record = value;
|
|
66
|
+
const mb = readRecommendedMemoryMb(record.mb, minMemoryMb, fail);
|
|
67
|
+
if (mb === undefined) {
|
|
68
|
+
if (record.mb === undefined)
|
|
69
|
+
fail(invalidRecommendation("the recommended memory record has no threshold"));
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
if (record.messages === undefined)
|
|
73
|
+
return { mb };
|
|
74
|
+
const messages = record.messages;
|
|
75
|
+
if (typeof messages !== "object" || messages === null || Array.isArray(messages) || Object.keys(messages).some(locale => !LOCALES.includes(locale))) {
|
|
76
|
+
fail(invalidRecommendation("the recommended memory messages are malformed"));
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const read = readMemoryAdviceMessages(Object.fromEntries(Object.entries(messages).map(([locale, text]) => [locale, { [RECOMMENDED_MEMORY_MESSAGE_KEY]: text }])), fail);
|
|
80
|
+
if (read === null)
|
|
81
|
+
return undefined;
|
|
82
|
+
if (read === undefined) {
|
|
83
|
+
fail(invalidRecommendation("the recommended memory messages are empty"));
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return { mb, messages: read };
|
|
87
|
+
}
|
|
14
88
|
/** Shared by wizard and preinst. A missing, malformed or unreadable read allows installation. */
|
|
15
|
-
export function renderMemoryProbe(minMemoryMb) {
|
|
89
|
+
export function renderMemoryProbe(minMemoryMb, recommendedMemoryMb) {
|
|
90
|
+
const low = minMemoryMb === undefined ? "" : ` if LC_ALL=C awk -v kb="$synopkgland_memory_kb" 'BEGIN { exit !(kb < ${minMemoryMb * 1024}) }'; then
|
|
91
|
+
synopkgland_memory_low=1
|
|
92
|
+
fi
|
|
93
|
+
`;
|
|
94
|
+
const advice = recommendedMemoryMb === undefined ? "" : ` if [ -z "$synopkgland_memory_low" ] && LC_ALL=C awk -v kb="$synopkgland_memory_kb" 'BEGIN { exit !(kb < ${recommendedMemoryMb * 1024}) }'; then
|
|
95
|
+
synopkgland_memory_advice=1
|
|
96
|
+
fi
|
|
97
|
+
`;
|
|
16
98
|
return `synopkgland_memory_kb=$(LC_ALL=C awk '
|
|
17
99
|
$1 == "MemTotal:" { count++; if (NF == 3 && $2 ~ /^[0-9]+$/ && $2 > 0 && $3 == "kB") total = $2 }
|
|
18
100
|
END { if (count == 1 && total > 0) printf "%.0f", total; else exit 1 }
|
|
19
101
|
' /proc/meminfo 2>/dev/null) || synopkgland_memory_kb=
|
|
20
102
|
synopkgland_memory_low=
|
|
21
|
-
if [ -n "$synopkgland_memory_kb" ]; then
|
|
103
|
+
${recommendedMemoryMb === undefined ? "" : "synopkgland_memory_advice=\n"}if [ -n "$synopkgland_memory_kb" ]; then
|
|
22
104
|
synopkgland_memory_gb=$(LC_ALL=C awk -v kb="$synopkgland_memory_kb" 'BEGIN { printf "%.2f", kb / 1048576 }')
|
|
23
|
-
|
|
24
|
-
synopkgland_memory_low=1
|
|
25
|
-
fi
|
|
26
|
-
else
|
|
105
|
+
${low}${advice}else
|
|
27
106
|
printf '%s\\n' '[INSTALL_MEMORY_READ_WARNING] Cannot read physical MemTotal; continuing installation' >&2
|
|
28
107
|
fi
|
|
29
108
|
`;
|
|
30
109
|
}
|
|
110
|
+
/** The SDK warning, then the App's own text in the same language when it has one. */
|
|
111
|
+
export function memoryAdviceTexts(advice, locale, actual) {
|
|
112
|
+
const app = advice.messages?.[locale] ?? advice.messages?.en;
|
|
113
|
+
return [translator(locale)("memory.recommended", { recommended: String(Math.ceil(advice.mb / 1024)), actual }), ...(app ? [app] : [])];
|
|
114
|
+
}
|
|
31
115
|
export function memoryReason(minMemoryMb, locale, actual) {
|
|
32
116
|
return translator(locale)("memory.required", { required: String(Math.ceil(minMemoryMb / 1024)), actual });
|
|
33
117
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type NativeTexts } from "./dsm-texts.js";
|
|
2
2
|
import { type TCPListeners } from "./tcp-listeners.js";
|
|
3
3
|
import { type MobileDeclaration } from './mobile.js';
|
|
4
|
+
import { type MemoryAdvice } from "./install-memory.js";
|
|
4
5
|
import { type PackageDependencies } from "./package-dependencies.js";
|
|
5
6
|
import { type InstallSettings } from './install-settings.js';
|
|
6
7
|
import { type WebLaunchMode } from "../contract/web-launch.js";
|
|
@@ -118,6 +119,8 @@ export interface StandaloneManifest {
|
|
|
118
119
|
installPorts?: true;
|
|
119
120
|
/** `install.min_memory_mb`: minimum physical MemTotal in MiB at install and upgrade. */
|
|
120
121
|
minMemoryMb?: number;
|
|
122
|
+
/** `install.recommended_memory_mb` and the App message: a non-blocking install wizard warning. */
|
|
123
|
+
memoryAdvice?: MemoryAdvice;
|
|
121
124
|
/** `backup`: Hyper Backup application backup; on by default for native Apps, absent when opted out. */
|
|
122
125
|
hyperBackup?: HyperBackup;
|
|
123
126
|
/** Who may use the app at all; absent keeps the route policy alone. */
|
|
@@ -9,7 +9,7 @@ import { readRegistry, registryFile } from '../ctl/registry.js';
|
|
|
9
9
|
import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
10
10
|
import { nativeGatewaySdk } from "./native-gateway.js";
|
|
11
11
|
import { portDefaults } from "./install-ports.js";
|
|
12
|
-
import { readMinMemoryMb } from "./install-memory.js";
|
|
12
|
+
import { readMemoryAdvice, readMinMemoryMb } from "./install-memory.js";
|
|
13
13
|
import { readPackageDependencies, packageDependencies, dependencyError } from "./package-dependencies.js";
|
|
14
14
|
import { readInstallSettings } from './install-settings.js';
|
|
15
15
|
import { auditGoRoutes } from './route-audit.js';
|
|
@@ -537,6 +537,7 @@ function readManifest(raw, c) {
|
|
|
537
537
|
c.fail(problem.code, problem.message);
|
|
538
538
|
}
|
|
539
539
|
const i18n = raw.i18n === undefined ? undefined : readI18n(raw.i18n, c);
|
|
540
|
+
const memoryAdvice = readMemoryAdvice(isRecord(raw.install) ? raw.install.recommended_memory_mb : undefined, minMemoryMb, i18n?.catalogs, e => c.fail(e.code, e.message));
|
|
540
541
|
const icon = raw.icon === undefined ? undefined : readIcon(raw.icon, c);
|
|
541
542
|
let mobile;
|
|
542
543
|
if (raw.mobile !== undefined) {
|
|
@@ -691,6 +692,7 @@ function readManifest(raw, c) {
|
|
|
691
692
|
...(installSettings ? { installSettings } : {}),
|
|
692
693
|
...(installPorts ? { installPorts } : {}),
|
|
693
694
|
...(minMemoryMb !== undefined ? { minMemoryMb } : {}),
|
|
695
|
+
...(memoryAdvice ? { memoryAdvice } : {}),
|
|
694
696
|
...(hyperBackup ? { hyperBackup } : {}),
|
|
695
697
|
...(entry ? { entry } : {}),
|
|
696
698
|
...(integrations?.length ? { integrations } : {}),
|
|
@@ -1054,7 +1056,7 @@ function readUi(value, c) {
|
|
|
1054
1056
|
if (!Array.isArray(command) ||
|
|
1055
1057
|
command.length === 0 ||
|
|
1056
1058
|
!command.every((arg) => typeof arg === "string" && arg !== "")) {
|
|
1057
|
-
return c.fail("STANDALONE_UI_BUILD_INVALID", "ui.build.command must be an argv string array (not going through a shell), for example [
|
|
1059
|
+
return c.fail("STANDALONE_UI_BUILD_INVALID", "ui.build.command must be an argv string array (not going through a shell), for example [pnpm, run, build]");
|
|
1058
1060
|
}
|
|
1059
1061
|
const cwd = c.path(build.cwd, "ui.build.cwd");
|
|
1060
1062
|
return dir && cwd
|
|
@@ -4,6 +4,7 @@ import { CLI_VERSION } from "../cli-version.js";
|
|
|
4
4
|
import { appSdkVersion, SDK_DEPENDENCY, SDK_FLOOR, SDK_PACKAGE, sdkBelowFloor, sdkSource, goModDownload } from "../runtime/sdk-source.js";
|
|
5
5
|
import { predatesExecutorManifest } from '../runtime/sdk-executor-manifest.js';
|
|
6
6
|
import { SHIPPED_EXECUTOR_DIGESTS } from '../runtime/executor-source.js';
|
|
7
|
+
import { lockedDependencyVersion } from "../package-manager.js";
|
|
7
8
|
/** The file that names each backend kind's SDK version. */
|
|
8
9
|
const SDK_VERSION_FILE = { go: "backend/go.mod", rust: "Cargo.lock", python: "backend.sdk", node: "backend.sdk" };
|
|
9
10
|
/**
|
|
@@ -61,10 +62,7 @@ function frontendSdkVersion(frontendDir) {
|
|
|
61
62
|
const tilde = /^~(\d+)\.(\d+)\.(\d+)$/.exec(spec);
|
|
62
63
|
if (tilde) {
|
|
63
64
|
const installed = readJson(join(frontendDir, "node_modules", SDK_PACKAGE, "package.json"));
|
|
64
|
-
const
|
|
65
|
-
const declared = lock?.packages?.[""];
|
|
66
|
-
const lockedSpec = declared?.dependencies?.[SDK_PACKAGE] ?? declared?.devDependencies?.[SDK_PACKAGE];
|
|
67
|
-
const version = installed?.version ?? (lockedSpec === spec ? lock?.packages?.[`node_modules/${SDK_PACKAGE}`]?.version : undefined);
|
|
65
|
+
const version = installed?.version ?? lockedDependencyVersion(frontendDir, SDK_PACKAGE, spec);
|
|
68
66
|
const resolved = typeof version === "string" ? /^(\d+)\.(\d+)\.(\d+)$/.exec(version) : null;
|
|
69
67
|
return { spec, version: resolved && resolved[1] === tilde[1] && resolved[2] === tilde[2] &&
|
|
70
68
|
Number(resolved[3]) >= Number(tilde[3]) ? version : undefined };
|
|
@@ -17,10 +17,10 @@ export function readSharedFolder(value, fail) {
|
|
|
17
17
|
fail({ code: "STANDALONE_SHARED_FOLDER_INVALID", message: `install.sharedFolder ${why}` });
|
|
18
18
|
return undefined;
|
|
19
19
|
};
|
|
20
|
-
if (!isRecord(value) || Object.keys(value).some((key) => !["sharedFolder", "settings", "ports", "min_memory_mb"].includes(key))) {
|
|
21
|
-
return refuse(": only sharedFolder, settings, ports and
|
|
20
|
+
if (!isRecord(value) || Object.keys(value).some((key) => !["sharedFolder", "settings", "ports", "min_memory_mb", "recommended_memory_mb"].includes(key))) {
|
|
21
|
+
return refuse(": only sharedFolder, settings, ports, min_memory_mb and recommended_memory_mb are allowed.");
|
|
22
22
|
}
|
|
23
|
-
if (value.sharedFolder === undefined && (value.settings !== undefined || value.ports !== undefined || value.min_memory_mb !== undefined))
|
|
23
|
+
if (value.sharedFolder === undefined && (value.settings !== undefined || value.ports !== undefined || value.min_memory_mb !== undefined || value.recommended_memory_mb !== undefined))
|
|
24
24
|
return undefined;
|
|
25
25
|
const folder = value.sharedFolder;
|
|
26
26
|
if (!isRecord(folder) || Object.keys(folder).some((key) => !FIELDS.has(key))) {
|
package/dist/standalone/spk.js
CHANGED
|
@@ -307,6 +307,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
307
307
|
...(manifest.installSettings ? { installSettings: manifest.installSettings } : {}),
|
|
308
308
|
...(manifest.installPorts ? { installPorts: portDefaults(manifest) } : {}),
|
|
309
309
|
...(manifest.minMemoryMb !== undefined ? { minMemoryMb: manifest.minMemoryMb } : {}),
|
|
310
|
+
...(manifest.memoryAdvice ? { recommendedMemory: manifest.memoryAdvice } : {}),
|
|
310
311
|
...(backup ? { hyperBackup: backupRecord(backup) } : {}),
|
|
311
312
|
...(manifest.integrations ? { integrations: manifest.integrations } : {}),
|
|
312
313
|
...(manifest.lifecycleTimeouts ? { lifecycleTimeouts: manifest.lifecycleTimeouts } : {}),
|
|
@@ -378,7 +379,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
378
379
|
: folder
|
|
379
380
|
? sharedFolderInstallSteps(manifest.package, folder)
|
|
380
381
|
: renderNativeInstallWizard;
|
|
381
|
-
const install = renderInstallWizardFiles(manifest.package, (t) => [...steps(t), ...portInstallSteps(manifest)(t), ...settingsInstallSteps(manifest.installSettings, manifest.identityGateway?.listen.https, manifest.installPorts ? manifest.package : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, manifest.integrations)], manifest.minMemoryMb);
|
|
382
|
+
const install = renderInstallWizardFiles(manifest.package, (t) => [...steps(t), ...portInstallSteps(manifest)(t), ...settingsInstallSteps(manifest.installSettings, manifest.identityGateway?.listen.https, manifest.installPorts ? manifest.package : undefined)(t), ...(portal ? [renderPortalWizardStep(t, portal.alias)] : []), ...integrationWizardSteps(t, manifest.integrations)], manifest.minMemoryMb, manifest.memoryAdvice);
|
|
382
383
|
writeWizardUiFiles(staging, {
|
|
383
384
|
...folderPickerWizardFiles(manifest.package, folder, {
|
|
384
385
|
...install.static,
|
package/docs/install-memory.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Minimum physical memory
|
|
1
|
+
# Minimum and recommended physical memory
|
|
2
2
|
|
|
3
3
|
Declare a physical RAM requirement in `dsm-package.yaml`:
|
|
4
4
|
|
|
@@ -18,3 +18,31 @@ The generated **package-account preinst** checks the same threshold before other
|
|
|
18
18
|
An unreadable, missing or malformed MemTotal emits `INSTALL_MEMORY_READ_WARNING` to stderr and **allows installation**. This requirement stops clearly undersized machines; it does not reject an unfamiliar memory-reporting environment. Omitting the field preserves the existing installation behavior. `synopkgland inspect <spk> --json` reports `minMemoryMb` and verifies the generated memory check and wizard files against the packaged declaration.
|
|
19
19
|
|
|
20
20
|
See Synology's [wizard contract](https://help.synology.com/developer-guide/synology_package/wizard/WIZARD_UIFILES_v2.html) for dynamic wizard scripts and the `SYNOPKG_TEMP_LOGFILE` output channel.
|
|
21
|
+
|
|
22
|
+
## Recommended memory
|
|
23
|
+
|
|
24
|
+
Declare a softer threshold with `recommended_memory_mb`, either alone or above `min_memory_mb`:
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
install:
|
|
28
|
+
min_memory_mb: 1700
|
|
29
|
+
recommended_memory_mb: 3400
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`recommended_memory_mb` is also a positive integer in **MiB** of MemTotal (1–2147483647), and it must be greater than `min_memory_mb` when both are declared. It never blocks anything: below it the dynamic **install** wizard adds a warning page before its usual pages, without a validator, so the administrator can continue. The page states the recommendation (rounded up to a whole GB, as for the minimum) and the NAS's detected capacity with two decimals, both in DSM's 1024-based GB. Below `min_memory_mb` the blocking memory page is shown instead; at or above the recommendation, or when MemTotal is unreadable, the wizard is unchanged.
|
|
33
|
+
|
|
34
|
+
Upgrade wizards, preinst, CLI installations and silent upgrades do not check the recommendation and cannot fail on it. Static fallback wizards cannot know the NAS memory and show no warning.
|
|
35
|
+
|
|
36
|
+
Pick the value with the same allowance for firmware and kernel reservations as the minimum: MemTotal is below the nominal size (a 2 GB model reports about 1.75 GB, a 4 GB model about 3.7–3.8 GB). Use about **85% of the nominal capacity** that should not see the warning: **3400 MiB means 4 GB machines and larger install without a warning**, while 2 GB and 3 GB machines see it. 4096 MiB would warn on every real 4 GB NAS.
|
|
37
|
+
|
|
38
|
+
### App message
|
|
39
|
+
|
|
40
|
+
The warning page can show the App's own text under the SDK's sentence, for example where to run heavy work instead. Put it in the App's message catalogs (`i18n.messages`) under the key `install.recommended_memory_message`:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{ "install.recommended_memory_message": "Run heavy jobs on another computer instead" }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Each language uses its catalog's text, and languages without one use English. The text is plain single-line text of 1–300 characters, without `<`, `>` or `&` (the DSM wizard renders markup); like other wizard strings, it has no trailing period. Invalid values and messages are reported as `INSTALL_RECOMMENDED_MEMORY_INVALID`. Without the key, only the SDK's sentence is shown.
|
|
47
|
+
|
|
48
|
+
`synopkgland inspect <spk> --json` reports `recommendedMemoryMb` and verifies the install wizard files, including the App message, against the declaration recorded in the package.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"check:docs": "node --test scripts/check-doc-versions.test.mjs && node scripts/check-doc-versions.mjs",
|
|
30
30
|
"build": "rm -rf dist && node scripts/prepare-native-http.mjs && tsc",
|
|
31
|
-
"test": "
|
|
31
|
+
"test": "pnpm run build && node --import tsx --import ./test/helpers/strict-dsm-setup.ts --test --test-concurrency=${SYNOPKGLAND_GATE_JOBS:-3} test/*.test.ts test/ctl/*.test.ts",
|
|
32
32
|
"test:glossary": "node --test scripts/test/glossary-drift.test.mjs",
|
|
33
33
|
"test:scripts": "node --test scripts/test/gate.test.mjs scripts/test/release.test.mjs scripts/test/pack-docker.test.mjs scripts/test/npm-pack.test.mjs scripts/test/executor-bump.test.mjs scripts/test/smoke-exports.test.mjs scripts/test/parallel.test.mjs scripts/test/scaffold-matrix.test.mjs scripts/test/frontend-deps.test.mjs scripts/test/docker-gate.test.mjs scripts/test/gate-plan.test.mjs scripts/test/gates.test.mjs && python3 scripts/test/npm-publish.py",
|
|
34
34
|
"gates": "bash scripts/ci/gates.sh",
|
|
35
35
|
"gates:fast": "bash scripts/ci/gates.sh",
|
|
36
|
-
"prepublishOnly": "
|
|
36
|
+
"prepublishOnly": "pnpm run build && node --input-type=module -e 'import {enforceRepositorySecrets} from \"./dist/secret-files.js\"; enforceRepositorySecrets(process.cwd())'",
|
|
37
37
|
"gates:full": "bash scripts/ci/gates.sh --full",
|
|
38
38
|
"test:basic": "node --import tsx --test test/schema.test.ts test/standalone-manifest.test.ts test/native-arch.test.ts test/archive-inventory.test.ts test/secret-files.test.ts",
|
|
39
39
|
"check:dsm-contract": "node scripts/check-dsm-api-contract.mjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@napi-rs/keyring": "^2.1.1",
|
|
44
|
-
"@synopackageland/templates": "~0.
|
|
44
|
+
"@synopackageland/templates": "~0.42.0",
|
|
45
45
|
"ajv": "^8.17.1",
|
|
46
46
|
"commander": "^13.1.0",
|
|
47
47
|
"esbuild": "^0.28.2",
|
|
@@ -98,5 +98,6 @@
|
|
|
98
98
|
"./package.json": "./package.json",
|
|
99
99
|
"./native-layout": "./dist/standalone/native-layout.js",
|
|
100
100
|
"./e2e": "./dist/e2e/dsm.js"
|
|
101
|
-
}
|
|
101
|
+
},
|
|
102
|
+
"packageManager": "pnpm@12.18.0"
|
|
102
103
|
}
|
|
@@ -1144,7 +1144,7 @@
|
|
|
1144
1144
|
"deploy/plan.ts": "1f772811ca963bdf863462a256d8e810c151e096a55a91a753bd5bf855921536",
|
|
1145
1145
|
"deploy/spk-version.ts": "407a79491ffac8d00ecb9b056ab0b352e08bf6142871fa46f302fd217f98fc24",
|
|
1146
1146
|
"e2e/certificates.ts": "e9801e5f4d326d31c3c281e5106f34138493e26cd7f0ad2b1dd3f6a566832389",
|
|
1147
|
-
"e2e/dsm.ts": "
|
|
1147
|
+
"e2e/dsm.ts": "f1a21dcfa3bfae23051b845a0265569fcbb5aa82660e701c0cc4e71da2dba428",
|
|
1148
1148
|
"error-registry.ts": "91f2de89bf98750a09fce54420e3a25e3527980be175ed704890a520181f1dc9",
|
|
1149
1149
|
"host/catalog-install.ts": "13908fd47d75f8a2f4ed412c9310b80b2d0a1d190ce46db34f15850c2ed45578",
|
|
1150
1150
|
"host/compose-project-recovery.ts": "51f93197898677b5daebd745ef848e07b7d6454fc86b5d4e1fa210fe089ac414",
|
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
"maximum": 2147483647,
|
|
17
17
|
"description": "Minimum physical /proc/meminfo MemTotal in MiB, checked dynamically on install and upgrade as the package account. Allow for firmware reservations: use about 85% of nominal RAM (1700 for a 2 GB NAS). Read failures warn and allow installation. No runtime check."
|
|
18
18
|
},
|
|
19
|
+
"recommended_memory_mb": {
|
|
20
|
+
"type": "integer",
|
|
21
|
+
"minimum": 1,
|
|
22
|
+
"maximum": 2147483647,
|
|
23
|
+
"description": "Recommended physical /proc/meminfo MemTotal in MiB, above min_memory_mb. Below it the install wizard shows a warning the administrator can continue past, with the App's optional install.recommended_memory_message catalog text. Never blocks installation, upgrade or preinst. Use about 85% of nominal RAM (3400 for a 4 GB NAS)."
|
|
24
|
+
},
|
|
19
25
|
"sharedFolder": {"type": "object"},
|
|
20
26
|
"settings": {"type": "object"},
|
|
21
27
|
"ports": {"const": true}
|
package/skills/SKILL.md
CHANGED
|
@@ -27,9 +27,9 @@ SPK packing rejects local environment files, npm tokens and private-key PEM bloc
|
|
|
27
27
|
See [reference/create.md](reference/create.md).
|
|
28
28
|
|
|
29
29
|
The CLI installs templates through its declared npm dependency range. A templates patch needs only a
|
|
30
|
-
templates release;
|
|
30
|
+
templates release; pnpm install/update selects a patch in that minor line. The CLI
|
|
31
31
|
uses the locally installed templates and reads their SDK pin for defaults; it
|
|
32
|
-
never downloads templates at runtime. Preserve the lockfile and use `
|
|
32
|
+
never downloads templates at runtime. Preserve the lockfile and use `pnpm install --frozen-lockfile` for
|
|
33
33
|
reproducible offline-ready installations. SDK minor releases are independent of
|
|
34
34
|
the CLI: executor manifest format 1 in the resolved SDK pins the executor release,
|
|
35
35
|
Go toolchain and six payload digests. Preserve npm integrity and Go module sums.
|
|
@@ -40,7 +40,7 @@ Query published releases with `npm view @synopackageland/cli version`,
|
|
|
40
40
|
`npm view @synopackageland/templates version` and `npm view @synopackageland/sdk version`;
|
|
41
41
|
keep the installed dependency tree and generated pins consistent.
|
|
42
42
|
|
|
43
|
-
For Apps with a physical RAM requirement, set `install.min_memory_mb` (MemTotal in MiB; use 1700 for 2 GB machines). The generated install/upgrade wizards and package-account preinst check it dynamically; read failures warn and allow installation, with no runtime check. See [minimum physical memory](../docs/install-memory.md).
|
|
43
|
+
For Apps with a physical RAM requirement, set `install.min_memory_mb` (MemTotal in MiB; use 1700 for 2 GB machines). The generated install/upgrade wizards and package-account preinst check it dynamically; read failures warn and allow installation, with no runtime check. For a softer threshold, set `install.recommended_memory_mb` (3400 for 4 GB machines): the install wizard warns but never blocks, with the App's optional `install.recommended_memory_message` catalog text. See [minimum and recommended physical memory](../docs/install-memory.md).
|
|
44
44
|
|
|
45
45
|
For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Native Go/Node/Python Apps may use `picker: folder` (matching current CLI/SDK releases (see the changelog)) and must obtain the selected path through the SDK shared-folder API. 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.
|
|
46
46
|
|
|
@@ -208,10 +208,10 @@ UI/locale strings and release notes unchanged. See
|
|
|
208
208
|
[Vue copy and i18n](reference/ui-vue.md#ui-copy-and-i18n) and
|
|
209
209
|
[JSON copy and i18n](reference/ui-json.md#ui-copy-and-i18n) for examples.
|
|
210
210
|
|
|
211
|
-
For UI discovery, run `
|
|
212
|
-
`
|
|
211
|
+
For UI discovery, run `pnpm exec syno-pkg-land-ui catalog --json` and
|
|
212
|
+
`pnpm exec syno-pkg-land-ui describe Button --json` from the installed frontend.
|
|
213
213
|
Read its prompt and exported Vue docs/types before choosing component APIs.
|
|
214
|
-
Use `syno-pkg-land-ui` directly in
|
|
214
|
+
Use `syno-pkg-land-ui` directly in package scripts; keep AI guidance version-independent.
|
|
215
215
|
|
|
216
216
|
For existing native products, schema 2 `backend: {kind: native}` preserves project-owned payload/metadata, prepare/compile argv hooks and pinned toolkits. See the native-layout guide; run `check`, `build`, then `inspect <spk>` locally. Keep lifecycle/systemd as the package account and preserve product-owned digest approval/revocation. Native layouts do not opt into generated Go capabilities.
|
|
217
217
|
|
|
@@ -391,7 +391,7 @@ adequate model with low effort, never an expensive default.
|
|
|
391
391
|
|
|
392
392
|
## App-open smoke
|
|
393
393
|
|
|
394
|
-
Every generated project has `tests/e2e/smoke.e2e.ts` and `
|
|
394
|
+
Every generated project has `tests/e2e/smoke.e2e.ts` and `pnpm run e2e:smoke`.
|
|
395
395
|
Use `appOpenSmoke` from `@synopackageland/cli/e2e`; keep one content-specific
|
|
396
396
|
`ready` selector or text marker. It derives the manifest entry and launcher,
|
|
397
397
|
reuses the existing DSM credentials/profiles/tunnel, and registers administrator,
|
|
@@ -467,8 +467,8 @@ HTTPS 要求,不能陷入重登入循環。另驗跨分頁重新登入後的
|
|
|
467
467
|
|
|
468
468
|
## Maintaining this CLI
|
|
469
469
|
|
|
470
|
-
For CLI releases, `
|
|
471
|
-
npm pack and tarball content checks. Run `
|
|
470
|
+
For CLI releases, `pnpm run gates` runs basic build/typecheck, core unit checks,
|
|
471
|
+
npm pack and tarball content checks. Run `pnpm run gates:full` only when the user
|
|
472
472
|
explicitly requests extended matrices and integration checks. Publishing does
|
|
473
473
|
not require a full-gate result. Application fixture acceptance remains scoped
|
|
474
474
|
to the application task's authorization.
|
|
@@ -276,7 +276,7 @@ declared availability readiness, LAN isolation/egress, protected grant lifecycle
|
|
|
276
276
|
ACLs, two-user visibility and clean install/upgrade/reboot/stop/uninstall before
|
|
277
277
|
calling the package supported on a NAS. No NAS is accessed by the build gate.
|
|
278
278
|
|
|
279
|
-
The unified Compose contract uses SDK defaults from locally installed templates and a matching CLI. Templates patches can ship independently;
|
|
279
|
+
The unified Compose contract uses SDK defaults from locally installed templates and a matching CLI. Templates patches can ship independently; pnpm install/update resolves them, and SDK defaults come from the installed templates. SDK minor upgrades do not require a CLI release when they declare supported executor manifest format 1; the resolved SDK owns the release mapping and verified payload digests. The CLI does not fetch templates at runtime. The legacy packaging route and bridge publish mode are removed.
|
|
280
280
|
|
|
281
281
|
Primary override files, and each included override set, must share a directory. Cross-directory override bases are rejected before loader I/O. Included implicit .env files are confined, inventoried and preserved; symlinks are rejected.
|
|
282
282
|
|
|
@@ -76,7 +76,7 @@ backend: {runtime: rust, dir: app, entry: hello, methods: [hello.greet]}
|
|
|
76
76
|
`init -t native-python|native-node|native-rust` 沿用 native-go 的 UI(`ui/`、`i18n/`,Vue 時是 `frontend/`)、jobs/delegate 的前端與 root-ops 的 `root/whoami.sh`;能力 overlay 換掉 backend 的 stub 模組。`--with jobs` 的範例讀取呼叫者選的檔案,所以同時宣告 `files: session`;delegate 讓登入使用者開啟 App 並存報告(`app.status`、`report.save` 為 `authenticated`);Rust 的 `backend.methods` 會加上能力的 methods。init 把測試要 import 的 App SDK 放進 `backend/vendor/`(`backend.sdk` 的 release,或 SYNOPKGLAND_SDK_DIR);build 另外打包它。`--shared-folder` 只適用於 native-go;`add` 仍只支援 Go backend。
|
|
77
77
|
|
|
78
78
|
- Python:DSM 的 `/usr/bin/python3`;SDK 放進 `app/vendor/synopkgland_app/`,`PYTHONPATH=vendor`。
|
|
79
|
-
- Node:Package Center 的 Node.js_v18/v20/v22 成為 INFO `install_dep_packages`;SDK 的 `package.json` 與 `dist/` 放進 `node_modules/@synopackageland/app`,其他 dependencies 先在 App 目錄 `
|
|
79
|
+
- Node:Package Center 的 Node.js_v18/v20/v22 成為 INFO `install_dep_packages`;SDK 的 `package.json` 與 `dist/` 放進 `node_modules/@synopackageland/app`,其他 dependencies 先在 App 目錄 `pnpm install --frozen-lockfile --prod`。
|
|
80
80
|
- Rust:Cargo.toml 以 git+tag 相依 `syno-pkg-land-app`;`cargo zigbuild` 交叉編譯(x86_64/aarch64 musl、armv7 glibc),`panic = "unwind"`;binary 在 `app/bin/<entry>`。需要 rustup 的 cargo、三個 target、cargo-zigbuild 與 zig。
|
|
81
81
|
- methods:沒寫時 build 在建置機執行 `<entry> --describe`;Rust 必須寫。每個 App method 都必須明列於 `operations.json` 並指定 AI class;`ctl generate` 產生 `permissions.json` 與 runtime bindings,且表內只能設定 methods 內的 method。動態名稱與自訂 HTTP dispatcher 會被拒絕;請使用固定 SDK routes。
|
|
82
82
|
- capabilities:`files`、`identity`、`jobs`、`rootOps`、`delegate`(僅 `until-revoked`+`files.moveFromStaging`+destinations)與 `portal`;daemon 需要 Go。jobs 或 delegate 時,同一個 runtime 另裝為 `target/background/worker`,DSM 以套件帳號執行 `worker --worker`;rootOps、delegate 附 executor,`bridge.json` 的 delegate digest 必須等於 SPK 的 executor。
|
package/skills/reference/ctl.md
CHANGED
|
@@ -429,7 +429,7 @@ handler and SPK inspect. Business effects are explicitly authored: POST can be a
|
|
|
429
429
|
read and a confirmed GET can be an action. Never infer effect from the HTTP verb.
|
|
430
430
|
|
|
431
431
|
For CLI development, set `SYNOPKGLAND_SDK_DIR` to an authorized matching SDK
|
|
432
|
-
checkout before `
|
|
432
|
+
checkout before `pnpm run build` and focused native tests. The build generates
|
|
433
433
|
contract types and packaged schema assets directly from that checkout. Release
|
|
434
434
|
builds must use a published matching SDK selected by
|
|
435
435
|
`SYNOPKGLAND_NATIVE_HTTP_SDK_VERSION`; development checkouts are test inputs,
|
|
@@ -7,6 +7,7 @@ Use matching CLI, SDK/App and templates releases, preserving the pins generated
|
|
|
7
7
|
```yaml
|
|
8
8
|
install:
|
|
9
9
|
min_memory_mb: 1700
|
|
10
|
+
recommended_memory_mb: 3400
|
|
10
11
|
ports: true
|
|
11
12
|
sharedFolder:
|
|
12
13
|
mode: dedicated
|
|
@@ -18,7 +19,7 @@ identity_gateway:
|
|
|
18
19
|
listen: {https: 28443}
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
Use `install.min_memory_mb` for a physical RAM requirement checked dynamically on the NAS during install and upgrade. The value is MemTotal in MiB, so allow for firmware reservations: 1700 MiB admits 2 GB machines. All wizard locales show a low-memory page; package-account preinst enforces the same threshold through Package Center. Unreadable MemTotal warns and allows installation; no runtime check is added. See [minimum physical memory](../../docs/install-memory.md).
|
|
22
|
+
Use `install.min_memory_mb` for a physical RAM requirement checked dynamically on the NAS during install and upgrade. The value is MemTotal in MiB, so allow for firmware reservations: 1700 MiB admits 2 GB machines. All wizard locales show a low-memory page; package-account preinst enforces the same threshold through Package Center. Unreadable MemTotal warns and allows installation; no runtime check is added. Add `install.recommended_memory_mb` (above the minimum, or alone) for a non-blocking install wizard warning: 3400 MiB warns 2–3 GB machines but not 4 GB ones. The App's `install.recommended_memory_message` catalog key adds its own localized advice under the warning; preinst, upgrades and CLI installs never check the recommendation. See [minimum and recommended physical memory](../../docs/install-memory.md).
|
|
22
23
|
|
|
23
24
|
For every App needing shared data, name the dedicated share after the package. The wizard defaults to that name, keeps it when the share list loads, and reuses the matching share if it exists. It also accepts a supported existing share. `mode: select` starts empty and requires an explicit choice; `mode: create` has no picker. Selecting a folder authorizes DSM's `data-share` worker to grant the declared RO/RW to the package account on install, upgrade/repair and starts. No pre-existing account or permission grant is required. Validation checks the name, existence and supported local mounted folder type, never package-account access. Local tiered/S2S shares are accepted; remote/C2, tiering buckets, WORM, unmounted, unavailable, moving, external and forced-read-only shares are refused. Runtime kernel checks still report the share, required access and recovery action when permission is revoked. No App root or ACL writer is generated.
|
|
24
25
|
|
|
@@ -10,20 +10,20 @@ after every change. Nothing runs on a NAS automatically.
|
|
|
10
10
|
|
|
11
11
|
| Tier | Explicit command | Minimal useful assertion |
|
|
12
12
|
| --- | --- | --- |
|
|
13
|
-
| Local unit / ctl registry | `
|
|
14
|
-
| Local package | `
|
|
15
|
-
| Real-NAS ctl | `
|
|
16
|
-
| Real-NAS UI, no AI | `
|
|
17
|
-
| Optional AI UI step | `
|
|
13
|
+
| Local unit / ctl registry | `pnpm test` or `pnpm run test:unit` | Pin an operation's CLI path, read/write effect and handler; unit-test business results |
|
|
14
|
+
| Local package | `pnpm run test:local` | Check, build one architecture, inspect each emitted SPK |
|
|
15
|
+
| Real-NAS ctl | `pnpm run test:nas:ctl` | Use actual `synopkgland ctl` commands and assert package ID, caller role and nonroot UID |
|
|
16
|
+
| Real-NAS UI, no AI | `pnpm run e2e:ui` | Use selectors, perform the primary action and assert its changed saved/read-back result |
|
|
17
|
+
| Optional AI UI step | `pnpm run e2e:ai` | One bounded `agent.act` followed by the same deterministic result assertion |
|
|
18
18
|
|
|
19
19
|
After the user opts into tests, the default development loop runs only the first
|
|
20
20
|
tier relevant to the change. The local package tier is a separate, explicit
|
|
21
|
-
check. Every NAS tier, including `
|
|
21
|
+
check. Every NAS tier, including `pnpm run e2e:smoke`, needs an explicit user
|
|
22
22
|
request and authorized fixtures. Keep build/release and lifecycle hooks independent
|
|
23
23
|
of tests. Test failures are evidence to report, not an automatic release veto.
|
|
24
24
|
|
|
25
25
|
`init` includes examples under `tests/unit`, `tests/local`, `tests/ctl` and
|
|
26
|
-
`tests/e2e`, plus independent
|
|
26
|
+
`tests/e2e`, plus independent package scripts. Adapt examples when replacing the
|
|
27
27
|
starter status operation; an empty upstream registry has no starter contract to
|
|
28
28
|
test. Do not add ctl to a wrapper merely to enable the example. Existing
|
|
29
29
|
backend-language unit tests remain useful when the user chooses them.
|