@synopackageland/cli 0.53.18 → 0.54.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.
- package/CHANGELOG.md +12 -0
- package/README.md +18 -5
- package/dist/capability-overlays.js +10 -10
- package/dist/cli.js +6 -6
- package/dist/contract/app-launch.d.ts +1 -1
- package/dist/contract/app-launch.js +2 -1
- package/dist/e2e/app-open.js +5 -2
- package/dist/error-registry.js +1 -6
- package/dist/init-versions.d.ts +13 -0
- package/dist/init-versions.js +61 -0
- package/dist/init.d.ts +3 -0
- package/dist/init.js +24 -8
- package/dist/standalone/dsm-window.js +2 -1
- package/dist/standalone/gateway-ingress-only.d.ts +15 -0
- package/dist/standalone/gateway-ingress-only.js +13 -0
- package/dist/standalone/identity-gateway.d.ts +2 -2
- package/dist/standalone/identity-gateway.js +33 -6
- package/dist/standalone/manifest.js +11 -0
- package/docs/path-ingress.md +22 -0
- package/package.json +4 -2
- package/skills/SKILL.md +8 -4
- package/skills/reference/compose.md +1 -1
- package/skills/reference/ui-json.md +1 -1
- package/skills/reference/ui-vue.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.54.1 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
- `identity_gateway.upstream: unix:<name>.sock` points the gateway at the App's private SDK IPC socket (`/var/packages/<package>/var/run/<name>.sock`, dialed with the SDK's package-socket checks), so an App can expose one App-authenticated route, such as a WebSocket, under DSM's own origin with no TCP port and no TCP listener. It needs `ingress`, no `listen`, no Compose and an SDK whose `idgateway` has `UnixUpstreamVersion = 1` (checked at `check` and `build`). The gateway binary now also binds `ipc.packageID`.
|
|
6
|
+
- On an App with an SDK window, a unix-upstream gateway is ingress only (`mode: none`): the DSM window, launcher type, default launch mode, Package Center Open, portal and mobile entry stay as without the gateway, and the smoke entry stays the window. The gateway daemon, the native ingress web-config location (WebSocket headers, 3600 s read timeout), `ingress-check` and the mTLS socket are still generated. `console` and `mobile.entry: gateway` are refused with it.
|
|
7
|
+
|
|
8
|
+
## 0.54.0 (2026-11-14)
|
|
9
|
+
|
|
10
|
+
- `init` defaults to native-go with Vue. Explicit `-t` still selects any of the six templates.
|
|
11
|
+
- Resolve stable SDK/UI releases within the CLI's compatibility ranges at init; pin the CLI to its own version and keep npm/backend SDK versions identical. Registry failures fall back to shipped defaults with one hint and no short custom timeout.
|
|
12
|
+
- Use templates with Vue and capability layers under `templates/overlays/`. New projects create npm lockfiles on their first install; Go/Rust dependency initialization is included in the printed steps.
|
|
13
|
+
- Keep local SDK overrides and release checksums intact. Repeated builds replace the read-only generated SDK contract before copying it again.
|
|
14
|
+
|
|
3
15
|
## 0.53.18 (2026-11-14)
|
|
4
16
|
|
|
5
17
|
- `ui.stable_pages` gives pages in `ui.dir` a URL that survives package updates, such as a phone-browser page behind a QR code, a bookmark or a home-screen shortcut. A module UI lives in `app/<digest>/`, whose name changes with every build, so such links stopped working after an update. `stable_pages: {m: m/index.html}` serves `/webman/3rdparty/<package>/m/index.html` on DSM 7.1+ without sign-in, ingress or CGI. The build writes a forwarding page with the same bytes in every build, plus `target.json` naming the current file. DSM serves these files with `Last-Modified` at 1970, a size-only ETag and no `Cache-Control`, so only fixed bytes are safe to cache. The forwarding page reads `target.json` uncached and keeps the query and fragment. `check` validates names and paths (`STANDALONE_UI_STABLE_PAGES_INVALID`); `build` refuses a missing target or a name already used under `ui/` (`STANDALONE_UI_STABLE_PAGE_MISSING`, `STANDALONE_UI_STABLE_PAGE_CONFLICT`); `inspect` replays the forwarding page and pointer (`UI_STABLE_PAGE_INVALID`). The secret scan covers all of these files.
|
package/README.md
CHANGED
|
@@ -118,14 +118,27 @@ with the latest SDK; HTTP navigation then shows standard HTTPS guidance. See
|
|
|
118
118
|
`@synopackageland/templates`. The CLI's npm dependency range selects compatible
|
|
119
119
|
templates patches during installation or update. Templates
|
|
120
120
|
patches need only a templates release; update the CLI installation with pnpm to receive them.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
`init` defaults to `native-go` with Vue. The CLI writes its own `~` version,
|
|
122
|
+
selects the newest stable, non-deprecated SDK and UI releases in its declared
|
|
123
|
+
compatibility ranges, and writes the same exact SDK version to npm and the backend.
|
|
124
|
+
UI stays in the supported minor line. Registry errors or unavailable compatible
|
|
125
|
+
releases print one hint and use the shipped defaults; there is no short custom timeout.
|
|
126
|
+
Templates are still read from the installed package, never downloaded by `init`.
|
|
127
|
+
The CLI compatibility ranges live in `src/init-versions.ts`.
|
|
128
|
+
|
|
129
|
+
Templates do not ship npm lockfiles. Run `pnpm install` in the project root and
|
|
130
|
+
frontend (and the Node backend) to create them, then commit them and use
|
|
131
|
+
`pnpm install --frozen-lockfile` for subsequent installs. For Go, run
|
|
132
|
+
`(cd backend && go mod tidy)` before check/build. When init selects a newer Rust
|
|
133
|
+
SDK tag, run `(cd backend && cargo generate-lockfile)` before check/build;
|
|
134
|
+
the old release's Cargo.lock is removed rather than relabeling its commit.
|
|
135
|
+
`SYNOPKGLAND_SDK_DIR` still overrides the generated SDK dependency for local development.
|
|
136
|
+
|
|
137
|
+
Existing Apps may use SDK executor manifest format 1 across SDK minor versions. The
|
|
124
138
|
exact SDK Go module sum anchors the build manifest; npm integrity anchors the
|
|
125
139
|
identical manifest in `@synopackageland/sdk/executor-manifest.json`. No manifest
|
|
126
140
|
is fetched at NAS runtime. Missing, malformed or unsupported new manifests fail
|
|
127
|
-
closed. CLI runtime defaults use its pinned SDK independently of the templates.
|
|
128
|
-
release does not require a templates release; new CLI capabilities or a new manifest
|
|
141
|
+
closed. CLI runtime defaults use its pinned SDK independently of the templates. SDK releases inside the init compatibility range do not require a templates release; new CLI capabilities or a new manifest
|
|
129
142
|
format can still require one.
|
|
130
143
|
|
|
131
144
|
For development against local checkouts, set `SYNOPKGLAND_TEMPLATES_DIR` to a
|
|
@@ -3,11 +3,11 @@ import { join } from 'node:path';
|
|
|
3
3
|
const EXECUTOR_SHELL = ['backend/internal/app/executor.go', 'backend/internal/app/executor_test.go'];
|
|
4
4
|
export const BRIDGE_TEMPLATES = ['native-python', 'native-node', 'native-rust'];
|
|
5
5
|
export const CAPABILITY_OVERLAYS = { 'native-go': {
|
|
6
|
-
'root-ops': { overlays: ['native-go-root-ops'], borrowed: [], removed: ['backend/internal/app/root_none.go'], permissions: {} },
|
|
7
|
-
jobs: { overlays: ['native-go-jobs'], borrowed: [], removed: ['backend/internal/app/background_none.go'], permissions: {} },
|
|
6
|
+
'root-ops': { overlays: ['overlays/native-go-root-ops'], borrowed: [], removed: ['backend/internal/app/root_none.go'], permissions: {} },
|
|
7
|
+
jobs: { overlays: ['overlays/native-go-jobs'], borrowed: [], removed: ['backend/internal/app/background_none.go'], permissions: {} },
|
|
8
8
|
delegate: {
|
|
9
|
-
overlays: ['native-go-jobs', 'native-go-delegate'],
|
|
10
|
-
borrowed: EXECUTOR_SHELL.map(file => `native-go-root-ops/${file}`),
|
|
9
|
+
overlays: ['overlays/native-go-jobs', 'overlays/native-go-delegate'],
|
|
10
|
+
borrowed: EXECUTOR_SHELL.map(file => `overlays/native-go-root-ops/${file}`),
|
|
11
11
|
removed: ['backend/internal/app/background_none.go', 'backend/internal/app/root_none.go', 'backend/internal/app/delegate_none.go'],
|
|
12
12
|
// Every signed-in user opens a delegate App to pick where reports go.
|
|
13
13
|
permissions: { 'app.status': 'authenticated' },
|
|
@@ -21,10 +21,10 @@ export const CAPABILITY_OVERLAYS = { 'native-go': {
|
|
|
21
21
|
function bridgeOverlays(template) {
|
|
22
22
|
return {
|
|
23
23
|
// The example hashes a file the caller picks, which the runtime reads only for an App with files.
|
|
24
|
-
jobs: { overlays: [
|
|
25
|
-
'root-ops': { overlays: [
|
|
24
|
+
jobs: { overlays: [`overlays/${template}-jobs`], borrowed: ['overlays/native-go-jobs/frontend'], removed: [], permissions: {}, implied: ['files'], methods: ['hash.submit', 'hash.get', 'hash.cancel'] },
|
|
25
|
+
'root-ops': { overlays: [`overlays/${template}-root-ops`], borrowed: ['overlays/native-go-root-ops/root', 'overlays/native-go-root-ops/frontend'], removed: [], permissions: {}, methods: ['whoami.run'] },
|
|
26
26
|
delegate: {
|
|
27
|
-
overlays: [
|
|
27
|
+
overlays: [`overlays/${template}-delegate`], borrowed: ['overlays/native-go-jobs/frontend', 'overlays/native-go-delegate/frontend'], removed: [],
|
|
28
28
|
permissions: { 'app.status': 'authenticated', 'report.save': 'authenticated' }, methods: ['report.save'],
|
|
29
29
|
},
|
|
30
30
|
};
|
|
@@ -32,8 +32,8 @@ function bridgeOverlays(template) {
|
|
|
32
32
|
/** What a native template's base and Vue frontend add before the capabilities: a bridge App borrows the Go template's UI. */
|
|
33
33
|
export const BASE_BORROWED = { 'native-go': [],
|
|
34
34
|
...Object.fromEntries(BRIDGE_TEMPLATES.map(template => [template, ['native-go/ui', 'native-go/i18n']])) };
|
|
35
|
-
export const VUE_OVERLAYS = { 'native-go': { overlays: ['native-go-vue'], borrowed: [] },
|
|
36
|
-
...Object.fromEntries(BRIDGE_TEMPLATES.map(template => [template, { overlays: [
|
|
35
|
+
export const VUE_OVERLAYS = { 'native-go': { overlays: ['overlays/native-go-vue'], borrowed: [] },
|
|
36
|
+
...Object.fromEntries(BRIDGE_TEMPLATES.map(template => [template, { overlays: [`overlays/${template}-vue`], borrowed: ['overlays/native-go-vue/frontend'] }])) };
|
|
37
37
|
/** The overlays of these capabilities, in table order, each once; a capability without one adds nothing. */
|
|
38
38
|
export function capabilityOverlays(template, names) {
|
|
39
39
|
const chosen = Object.entries(CAPABILITY_OVERLAYS[template]).filter(([name]) => names.includes(name)).map(([, overlay]) => overlay);
|
|
@@ -51,4 +51,4 @@ export function borrowedFiles(templates, borrowed) {
|
|
|
51
51
|
return [...new Set(borrowed.flatMap(walk))];
|
|
52
52
|
}
|
|
53
53
|
/** A borrowed path names its overlay first; this is where it lands in a project. */
|
|
54
|
-
export const borrowedTarget = (path) => path.split('/').slice(1).join('/');
|
|
54
|
+
export const borrowedTarget = (path) => path.split('/').slice(path.startsWith('overlays/') ? 2 : 1).join('/');
|
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { installOutputGuards } from './terminal-output.js';
|
|
|
3
3
|
import { upstreamRepository, upstreamMaintainer } from './upstream-attribution.js';
|
|
4
4
|
import { Command, CommanderError } from "commander";
|
|
5
5
|
import { CLI_VERSION } from "./cli-version.js";
|
|
6
|
+
import { resolveInitVersions } from "./init-versions.js";
|
|
6
7
|
import { existsSync, readFileSync, renameSync, statSync } from "node:fs";
|
|
7
8
|
import { createHash } from "node:crypto";
|
|
8
9
|
import { basename, resolve, dirname, join } from "node:path";
|
|
@@ -16,7 +17,6 @@ import { gatewayAdmissionReport } from "./standalone/identity-gateway.js";
|
|
|
16
17
|
import { formatGatewayReview, gatewayReviewReport } from "./standalone/gateway-review.js";
|
|
17
18
|
import { formatPinReport, pinProjectImages } from "./images/pin.js";
|
|
18
19
|
import { initFromTemplate, initNextSteps, isTemplateName, listTemplates, } from "./init.js";
|
|
19
|
-
import { templatesRoot } from "./template-paths.js";
|
|
20
20
|
import { addCapabilities } from "./add.js";
|
|
21
21
|
import { CAPABILITY_NAMES } from "./capabilities.js";
|
|
22
22
|
import { validateProject } from "./validate.js";
|
|
@@ -607,7 +607,7 @@ async function runCliWithin(argv) {
|
|
|
607
607
|
program
|
|
608
608
|
.command("init")
|
|
609
609
|
.description("Create an App project from a template (never overwrites existing files)")
|
|
610
|
-
.option("-t, --template <name>", `Template: ${listTemplates().join(" | ")}
|
|
610
|
+
.option("-t, --template <name>", `Template: ${listTemplates().join(" | ")}`, "native-go")
|
|
611
611
|
.option("--package <id>", "INFO.package (defaults to the directory name)")
|
|
612
612
|
.option("--name <display>", "Display name")
|
|
613
613
|
.option("--upstream-image <repository>", "compose fork: official image repository; upgrade pins its matching tag and index digest")
|
|
@@ -618,7 +618,7 @@ async function runCliWithin(argv) {
|
|
|
618
618
|
.option("--upstream-fork", "Create only synology/ inside an upstream source fork (compose or native-go)")
|
|
619
619
|
.option("--health-path <path>", "compose: actual readiness endpoint; redirects are not followed")
|
|
620
620
|
.option("--health-status <status>", "compose: expected 2xx readiness status (no default)", Number)
|
|
621
|
-
.option("--ui <vue|plain>",
|
|
621
|
+
.option("--ui <vue|plain>", "Native UI (default: vue, latest compatible release); plain uses ui/app.js")
|
|
622
622
|
.option("--with <caps>", `Capabilities (comma-separated): ${CAPABILITY_NAMES.join(",")}`)
|
|
623
623
|
.option("--from <compose.yaml>", "compose: import an existing Compose; omit to create an example")
|
|
624
624
|
.option("--shared-folder <dedicated|select|create>", "Use a dedicated shared folder by default, or select an existing folder")
|
|
@@ -631,10 +631,8 @@ async function runCliWithin(argv) {
|
|
|
631
631
|
.action(async (dir, options, command) => {
|
|
632
632
|
if (command.parent?.opts().project)
|
|
633
633
|
throw failure("CLI_OPTION_INVALID", "--project does not apply to init.");
|
|
634
|
-
if (!options.template)
|
|
635
|
-
throw failure("INIT_TEMPLATE_REQUIRED", `Specify -t, --template <name>. Available templates: ${listTemplates().join(" | ")}`);
|
|
636
634
|
if (!isTemplateName(options.template))
|
|
637
|
-
throw failure("INIT_TEMPLATE_UNKNOWN", `Unknown template: ${options.template}
|
|
635
|
+
throw failure("INIT_TEMPLATE_UNKNOWN", `Unknown template: ${options.template}. Available templates: ${listTemplates().join(" | ")} (default: native-go).`);
|
|
638
636
|
const targetDir = resolve(dir);
|
|
639
637
|
const upstream = options.upstreamFork ? upstreamRepository(targetDir, options.upstream) : undefined;
|
|
640
638
|
if (options.upstream && !upstream)
|
|
@@ -642,6 +640,7 @@ async function runCliWithin(argv) {
|
|
|
642
640
|
if (!options.upstreamFork && (options.upstream || options.upstreamMaintainer || options.publisher || options.publisherUrl))
|
|
643
641
|
throw failure("INIT_OPTIONS_UNSUPPORTED", "Attribution options require --upstream-fork");
|
|
644
642
|
initFromTemplate(options.template, targetDir, {
|
|
643
|
+
versions: await resolveInitVersions(),
|
|
645
644
|
upstream,
|
|
646
645
|
upstreamMaintainer: options.upstreamMaintainer ?? (options.upstreamFork ? await upstreamMaintainer(upstream) : undefined),
|
|
647
646
|
publisher: options.publisher ?? process.env.SYNOPKGLAND_PUBLISHER,
|
|
@@ -668,6 +667,7 @@ async function runCliWithin(argv) {
|
|
|
668
667
|
},
|
|
669
668
|
});
|
|
670
669
|
stdout(`Created the ${options.template} project at ${options.upstreamFork ? join(targetDir, "synology") : targetDir}`);
|
|
670
|
+
stdout("Run pnpm install in the generated project root to create its lockfile; use --frozen-lockfile after committing it.");
|
|
671
671
|
if (options.template === "compose")
|
|
672
672
|
stdout("Select actual compose.web.health path/status before check/build. Redirects are not followed; check does not probe runtime health.");
|
|
673
673
|
if (options.upstreamFork) {
|
|
@@ -7,7 +7,7 @@ export declare function isAppLaunchMode(value: unknown): value is AppLaunchMode;
|
|
|
7
7
|
/** Both Compose routes use the same web default; a valid explicit choice wins. */
|
|
8
8
|
export declare function resolveAppLaunch(value: unknown, webService: boolean): AppLaunchMode | undefined;
|
|
9
9
|
/** A console always opens the SDK UI in a DSM window. */
|
|
10
|
-
export declare function resolvedSdkLaunch(manifest: Pick<StandaloneManifest, 'ui' | 'compose' | 'identityGateway'> & {
|
|
10
|
+
export declare function resolvedSdkLaunch(manifest: Pick<StandaloneManifest, 'ui' | 'compose' | 'identityGateway' | 'sdkWindow'> & {
|
|
11
11
|
console?: unknown;
|
|
12
12
|
}): AppLaunchMode;
|
|
13
13
|
/** DSM rewrites standalone URLs to launchApp; only SDK wrappers provide that class. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { gatewayIngressOnly } from '../standalone/gateway-ingress-only.js';
|
|
1
2
|
export const APP_LAUNCH_MODES = ['dsm-window', 'new-page'];
|
|
2
3
|
export const DEFAULT_NATIVE_LAUNCH = 'dsm-window';
|
|
3
4
|
export const DEFAULT_WEB_LAUNCH = 'new-page';
|
|
@@ -11,7 +12,7 @@ export function resolveAppLaunch(value, webService) {
|
|
|
11
12
|
}
|
|
12
13
|
/** A console always opens the SDK UI in a DSM window. */
|
|
13
14
|
export function resolvedSdkLaunch(manifest) {
|
|
14
|
-
return resolveAppLaunch(manifest.console ? 'dsm-window' : manifest.ui.launch, Boolean(manifest.compose || manifest.identityGateway));
|
|
15
|
+
return resolveAppLaunch(manifest.console ? 'dsm-window' : manifest.ui.launch, Boolean(manifest.compose || manifest.identityGateway && !gatewayIngressOnly(manifest)));
|
|
15
16
|
}
|
|
16
17
|
/** DSM rewrites standalone URLs to launchApp; only SDK wrappers provide that class. */
|
|
17
18
|
export function dsmLauncherType(launch, sdkWindow) {
|
package/dist/e2e/app-open.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { gatewayIngressPathProblem } from '../standalone/gateway-ingress.js';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { parse } from 'yaml';
|
|
4
|
+
import { unixUpstreamSocket } from '../standalone/gateway-ingress-only.js';
|
|
4
5
|
import { resolveAppLaunch } from '../contract/app-launch.js';
|
|
5
6
|
import { trustedAppEntryPath } from '../contract/web-launch.js';
|
|
6
7
|
import { readDaemonIngress } from '../standalone/daemon-ingress.js';
|
|
@@ -19,7 +20,9 @@ export function deriveSmokeEntry(raw, entry) {
|
|
|
19
20
|
}
|
|
20
21
|
const native = raw.schema === 2;
|
|
21
22
|
const gateway = raw.identity_gateway;
|
|
22
|
-
|
|
23
|
+
// A unix-upstream gateway on an SDK-window App is ingress only: the window stays the entry.
|
|
24
|
+
const ingressOnly = Boolean(unixUpstreamSocket(gateway?.upstream) && !raw.compose && raw.ui !== false);
|
|
25
|
+
const web = Boolean((gateway && !ingressOnly) || raw.compose || (!native && raw.adminport));
|
|
23
26
|
if ((!native && !raw.adminport) || (raw.ui === false && !gateway))
|
|
24
27
|
throw new Error('This package has no app entry to smoke test.');
|
|
25
28
|
const appId = native ? `SYNO.SDS.${raw.package}.Instance` : raw.package;
|
|
@@ -33,7 +36,7 @@ export function deriveSmokeEntry(raw, entry) {
|
|
|
33
36
|
const gatewayIngress = gateway?.ingress && !gatewayIngressPathProblem(raw.package, gateway.ingress.path) ? gateway.ingress : undefined;
|
|
34
37
|
if (gateway?.ingress !== undefined && !gatewayIngress)
|
|
35
38
|
throw new Error("Invalid gateway ingress namespace");
|
|
36
|
-
const derived = ingress?.path ?? gatewayIngress?.path ?? (gateway
|
|
39
|
+
const derived = ingress?.path ?? (ingressOnly ? undefined : gatewayIngress?.path) ?? (gateway && !ingressOnly
|
|
37
40
|
? `/webman/3rdparty/${raw.package}/sso/open.cgi`
|
|
38
41
|
: native ? `/?launchApp=${encodeURIComponent(appId)}`
|
|
39
42
|
: trustedAppEntryPath(raw));
|
package/dist/error-registry.js
CHANGED
|
@@ -946,15 +946,10 @@ export const ERROR_REGISTRY = {
|
|
|
946
946
|
description: "The image digest is not pinned.",
|
|
947
947
|
suggestion: "Run images pin.",
|
|
948
948
|
},
|
|
949
|
-
INIT_TEMPLATE_REQUIRED: {
|
|
950
|
-
code: "INIT_TEMPLATE_REQUIRED",
|
|
951
|
-
description: "No template was specified.",
|
|
952
|
-
suggestion: "Use -t native-go, native-python, native-node, native-rust, binary or compose.",
|
|
953
|
-
},
|
|
954
949
|
INIT_TEMPLATE_UNKNOWN: {
|
|
955
950
|
code: "INIT_TEMPLATE_UNKNOWN",
|
|
956
951
|
description: "Unknown template.",
|
|
957
|
-
suggestion: "
|
|
952
|
+
suggestion: "Omit -t for native-go, or specify native-python, native-node, native-rust, binary or compose.",
|
|
958
953
|
},
|
|
959
954
|
CLI_ARCH_INVALID: {
|
|
960
955
|
code: "CLI_ARCH_INVALID",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface InitVersions {
|
|
2
|
+
cli: string;
|
|
3
|
+
sdk: string;
|
|
4
|
+
ui: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const INIT_SDK_RANGE: string;
|
|
7
|
+
export declare const INIT_UI_RANGE = "~0.25.0";
|
|
8
|
+
/** Shipped manifests are usable defaults, including without registry access. */
|
|
9
|
+
export declare function templateVersions(root?: string): InitVersions;
|
|
10
|
+
/** No custom short timeout: ordinary fetch/network errors fall back per package. */
|
|
11
|
+
export declare function resolveInitVersions(defaults?: InitVersions, fetchRegistry?: typeof fetch, warn?: (message: string) => void, env?: NodeJS.ProcessEnv): Promise<InitVersions>;
|
|
12
|
+
/** Feed dependency replacements through init's existing substitute pass. */
|
|
13
|
+
export declare function versionSubstitutions(defaults: InitVersions, selected: InitVersions): Record<string, string>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { maxSatisfying, valid } from 'semver';
|
|
4
|
+
import { CLI_VERSION } from './cli-version.js';
|
|
5
|
+
import { DEFAULT_SDK_VERSION, SDK_FLOOR } from './runtime/sdk-source.js';
|
|
6
|
+
import { templatesRoot } from './template-paths.js';
|
|
7
|
+
// New SDK minor lines require an explicit compatibility decision in the CLI.
|
|
8
|
+
const [sdkMajor, sdkMinor] = DEFAULT_SDK_VERSION.split('.').map(Number);
|
|
9
|
+
export const INIT_SDK_RANGE = `>=${SDK_FLOOR} <${sdkMajor}.${sdkMinor + 1}.0`;
|
|
10
|
+
export const INIT_UI_RANGE = '~0.25.0';
|
|
11
|
+
/** Shipped manifests are usable defaults, including without registry access. */
|
|
12
|
+
export function templateVersions(root = templatesRoot()) {
|
|
13
|
+
const sdk = /syno-pkg-land-sdk v(\d+\.\d+\.\d+)/.exec(readFileSync(join(root, 'native-go/backend/go.mod'), 'utf8'))?.[1];
|
|
14
|
+
const frontend = JSON.parse(readFileSync(join(root, 'overlays/native-go-vue/frontend/package.json'), 'utf8'));
|
|
15
|
+
const shared = JSON.parse(readFileSync(join(root, '_shared/package.json'), 'utf8'));
|
|
16
|
+
const ui = frontend.dependencies['@synopackageland/ui']?.replace(/^~/, '');
|
|
17
|
+
const cli = shared.devDependencies['@synopackageland/cli']?.replace(/^~/, '');
|
|
18
|
+
if (![sdk, ui, cli].every(v => typeof v === 'string' && valid(v)))
|
|
19
|
+
throw new Error('[TEMPLATES_INVALID] Template dependency defaults must be stable versions.');
|
|
20
|
+
return { sdk: sdk, ui, cli };
|
|
21
|
+
}
|
|
22
|
+
/** No custom short timeout: ordinary fetch/network errors fall back per package. */
|
|
23
|
+
export async function resolveInitVersions(defaults = templateVersions(), fetchRegistry = fetch, warn = console.warn, env = process.env) {
|
|
24
|
+
const registry = env.npm_config_registry ?? env.NPM_CONFIG_REGISTRY ?? 'https://registry.npmjs.org';
|
|
25
|
+
const failed = [];
|
|
26
|
+
const latest = async (name, range) => {
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetchRegistry(`${registry.replace(/\/$/, '')}/@synopackageland%2f${name}`, {
|
|
29
|
+
headers: { accept: 'application/vnd.npm.install-v1+json' },
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok)
|
|
32
|
+
throw new Error('registry request failed');
|
|
33
|
+
const data = await response.json();
|
|
34
|
+
const version = maxSatisfying(Object.entries(data.versions ?? {})
|
|
35
|
+
.filter(([version, metadata]) => valid(version) && !metadata.deprecated)
|
|
36
|
+
.map(([version]) => version), range);
|
|
37
|
+
if (!version)
|
|
38
|
+
throw new Error('no compatible stable release');
|
|
39
|
+
return version;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
failed.push(name);
|
|
43
|
+
return defaults[name];
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const [sdk, ui] = await Promise.all([latest('sdk', INIT_SDK_RANGE), latest('ui', INIT_UI_RANGE)]);
|
|
47
|
+
if (failed.length)
|
|
48
|
+
warn(`[INIT_VERSIONS_FALLBACK] Registry unavailable or no compatible release for ${failed.sort().join(', ')}; using shipped template defaults.`);
|
|
49
|
+
return { cli: CLI_VERSION, sdk, ui };
|
|
50
|
+
}
|
|
51
|
+
/** Feed dependency replacements through init's existing substitute pass. */
|
|
52
|
+
export function versionSubstitutions(defaults, selected) {
|
|
53
|
+
return {
|
|
54
|
+
[`"@synopackageland/cli": "~${defaults.cli}"`]: `"@synopackageland/cli": "~${selected.cli}"`,
|
|
55
|
+
[`"@synopackageland/sdk": "~${defaults.sdk}"`]: `"@synopackageland/sdk": "${selected.sdk}"`,
|
|
56
|
+
[`"@synopackageland/ui": "~${defaults.ui}"`]: `"@synopackageland/ui": "~${selected.ui}"`,
|
|
57
|
+
[`syno-pkg-land-sdk v${defaults.sdk}`]: `syno-pkg-land-sdk v${selected.sdk}`,
|
|
58
|
+
[`sdk: ${defaults.sdk}`]: `sdk: ${selected.sdk}`,
|
|
59
|
+
[`tag = "v${defaults.sdk}"`]: `tag = "v${selected.sdk}"`,
|
|
60
|
+
};
|
|
61
|
+
}
|
package/dist/init.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CapabilityName } from "./capabilities.js";
|
|
2
2
|
import type { TemplateName } from "./types.js";
|
|
3
|
+
import { type InitVersions } from "./init-versions.js";
|
|
3
4
|
/** The container templates need DSM 7.2.1 or later; native-go and binary need 7.1. */
|
|
4
5
|
export declare function isContainerTemplate(template: TemplateName): boolean;
|
|
5
6
|
export declare function isTemplateName(value: string): value is TemplateName;
|
|
@@ -7,6 +8,8 @@ export declare function listTemplates(): TemplateName[];
|
|
|
7
8
|
/** New native scaffolds opt in explicitly; existing manifests are never migrated. */
|
|
8
9
|
export declare function nativeCapabilitySettings(names: readonly CapabilityName[]): Record<string, unknown>;
|
|
9
10
|
export interface InitOptions {
|
|
11
|
+
/** CLI resolves these once; synchronous library callers use shipped defaults. */
|
|
12
|
+
versions?: InitVersions;
|
|
10
13
|
/** os_min_ver of the new project: a release (7.2) or a full 7.x-build; default is the template's (DSM 7.1 for native-go/binary, DSM 7.2.1 for container templates). */
|
|
11
14
|
minDsm?: string;
|
|
12
15
|
/** Standalone templates: INFO.package (default: from the directory name). */
|
package/dist/init.js
CHANGED
|
@@ -17,6 +17,8 @@ import { API_PERMISSIONS_FILE } from "./standalone/api-permissions.js";
|
|
|
17
17
|
import { resolveMinDsm, assertContainerMinDsm, DEFAULT_MIN_DSM, isDsmAtLeast, } from "./build-spk/dsm-version.js";
|
|
18
18
|
import { composeInputs } from "./standalone/compose.js";
|
|
19
19
|
import { readSharedFolder } from "./standalone/shared-folder.js";
|
|
20
|
+
import { CLI_VERSION } from "./cli-version.js";
|
|
21
|
+
import { templateVersions, versionSubstitutions } from "./init-versions.js";
|
|
20
22
|
const TEMPLATE_NAMES = [
|
|
21
23
|
"compose",
|
|
22
24
|
"binary",
|
|
@@ -175,7 +177,9 @@ export function initFromTemplate(template, targetDir, options = {}) {
|
|
|
175
177
|
if (minDsm !== undefined && isContainerTemplate(template)) {
|
|
176
178
|
assertContainerMinDsm(minDsm);
|
|
177
179
|
}
|
|
178
|
-
const
|
|
180
|
+
const defaults = templateVersions();
|
|
181
|
+
const versions = options.versions ?? { ...defaults, cli: CLI_VERSION };
|
|
182
|
+
const substitutions = { ...substitutionsFor(template, targetDir, options), ...versionSubstitutions(defaults, versions) };
|
|
179
183
|
const ui = resolvedUi(template, options);
|
|
180
184
|
const rootExample = caps.includes("root-ops");
|
|
181
185
|
if (rootExample &&
|
|
@@ -208,7 +212,7 @@ export function initFromTemplate(template, targetDir, options = {}) {
|
|
|
208
212
|
"AGENTS.md",
|
|
209
213
|
"CLAUDE.md",
|
|
210
214
|
...sharedScripts,
|
|
211
|
-
...["package.json", "pnpm-
|
|
215
|
+
...["package.json", "pnpm-workspace.yaml", "e2e.config.ts", "e2e.ai.config.ts"].filter(file => existsSync(join(shared, file))),
|
|
212
216
|
...["tests", "scripts"].flatMap(dir => existsSync(join(shared, dir)) ? templateFiles(join(shared, dir)).map(file => `${dir}/${file}`) : []),
|
|
213
217
|
];
|
|
214
218
|
const files = [
|
|
@@ -303,8 +307,20 @@ export function initFromTemplate(template, targetDir, options = {}) {
|
|
|
303
307
|
// Applies inside synology/ for a fork; never change upstream ignore files.
|
|
304
308
|
const secretRules = [".env", ".env.*", ...ENV_TEMPLATE_NAMES.map(name => `!${name}`)];
|
|
305
309
|
writeFileSync(ignoreFile, `${ignore.trimEnd()}\n\n# Local secrets\n${secretRules.join("\n")}\n`);
|
|
306
|
-
for (const file of files.map(targetName))
|
|
310
|
+
for (const file of files.map(targetName)) {
|
|
311
|
+
// Checksums belong to their original release; never rewrite their version labels.
|
|
312
|
+
if (file.endsWith('go.sum') || file.endsWith('Cargo.lock'))
|
|
313
|
+
continue;
|
|
307
314
|
substitute(join(targetDir, file), substitutions);
|
|
315
|
+
}
|
|
316
|
+
if (versions.sdk !== defaults.sdk) {
|
|
317
|
+
// Cargo regenerates its tag/commit lock on the first dependency install.
|
|
318
|
+
rmSync(join(targetDir, 'backend/Cargo.lock'), { force: true });
|
|
319
|
+
const sum = join(targetDir, 'backend/go.sum');
|
|
320
|
+
if (existsSync(sum))
|
|
321
|
+
writeFileSync(sum, readFileSync(sum, 'utf8').split('\n')
|
|
322
|
+
.filter(line => !line.startsWith(`${SDK_MODULE} `)).join('\n'));
|
|
323
|
+
}
|
|
308
324
|
if (localSdk && isNativeTemplate(template))
|
|
309
325
|
useLocalSdk(targetDir, localSdk);
|
|
310
326
|
if (isBridgeTemplate(template))
|
|
@@ -385,18 +401,18 @@ export function initFromTemplate(template, targetDir, options = {}) {
|
|
|
385
401
|
}
|
|
386
402
|
/** Each native template's method tests, as its README runs them; Node.js also compiles the backend/app the SPK ships. */
|
|
387
403
|
const BACKEND_TESTS = {
|
|
388
|
-
"native-go": "go test ./...",
|
|
404
|
+
"native-go": "go mod tidy && go test ./...",
|
|
389
405
|
"native-python": "python3 -m unittest discover -s tests",
|
|
390
|
-
"native-node": "pnpm install
|
|
391
|
-
"native-rust": "cargo test --locked",
|
|
406
|
+
"native-node": "pnpm install && pnpm test && pnpm run build",
|
|
407
|
+
"native-rust": "cargo generate-lockfile && cargo test --locked",
|
|
392
408
|
};
|
|
393
409
|
/** What to run after init in `dir`, for a template built from source; undefined for the others. */
|
|
394
410
|
export function initNextSteps(template, dir, frontend, localSdk) {
|
|
395
411
|
if (!isNativeTemplate(template))
|
|
396
412
|
return undefined;
|
|
397
|
-
//
|
|
413
|
+
// The first install creates the project's lockfile, including local SDK overrides.
|
|
398
414
|
const install = frontend
|
|
399
|
-
? ` (cd frontend && pnpm install${localSdk ? " --no-frozen-lockfile" : "
|
|
415
|
+
? ` (cd frontend && pnpm install${localSdk ? " --no-frozen-lockfile" : ""})\n`
|
|
400
416
|
: "";
|
|
401
417
|
return `Next steps:\n cd ${dir}\n (cd backend && ${BACKEND_TESTS[template]})\n${install} synopkgland ctl generate\n synopkgland check\n synopkgland build\nSee README.md.`;
|
|
402
418
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { renderExecutorApproval } from './executor-approval.js';
|
|
2
2
|
import { CALL_RETRY_RUNTIME } from './call-retry.js';
|
|
3
3
|
import { oidcResumeRuntime } from "./oidc-resume.js";
|
|
4
|
+
import { gatewayIngressOnly } from './gateway-ingress-only.js';
|
|
4
5
|
import { gatewayEntryPath } from './native-gateway.js';
|
|
5
6
|
import { resolvedSdkLaunch, dsmLauncherType } from "../contract/app-launch.js";
|
|
6
7
|
import { REOPEN_EVENTS_RUNTIME } from "./reopen-events.js";
|
|
@@ -124,7 +125,7 @@ export function windowAppId(manifest) {
|
|
|
124
125
|
}
|
|
125
126
|
/** Whether the window itself resumes a cold DSM sign-in; with a console the url launcher does. */
|
|
126
127
|
function windowResumesOIDC(manifest) {
|
|
127
|
-
return Boolean(manifest.identityGateway && !manifest.console);
|
|
128
|
+
return Boolean(manifest.identityGateway && !manifest.console && !gatewayIngressOnly(manifest));
|
|
128
129
|
}
|
|
129
130
|
/**
|
|
130
131
|
* `ui/config`: registers the DSM main-menu app and its window class. With a
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const unixUpstreamSocket: (upstream: unknown) => string | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* An SDK-window App whose gateway only carries path ingress (a unix upstream
|
|
4
|
+
* for the App's own WebSocket route). The gateway is infrastructure there: it
|
|
5
|
+
* never launches a web UI, so the DSM window, menu, Package Center Open,
|
|
6
|
+
* portal and mobile entry stay exactly as without the gateway. A unix
|
|
7
|
+
* upstream is new, so no existing App is inferred ingress-only.
|
|
8
|
+
*/
|
|
9
|
+
export declare function gatewayIngressOnly(m: {
|
|
10
|
+
compose?: unknown;
|
|
11
|
+
sdkWindow?: false;
|
|
12
|
+
identityGateway?: {
|
|
13
|
+
upstream: number | string;
|
|
14
|
+
};
|
|
15
|
+
}): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** `unix:<name>.sock`: a direct socket name; the gateway dials /var/packages/<package>/var/run/<name>.sock. */
|
|
2
|
+
const UNIX_UPSTREAM = /^unix:([a-z0-9][a-z0-9-]{0,58}\.sock)$/;
|
|
3
|
+
export const unixUpstreamSocket = (upstream) => typeof upstream === "string" ? UNIX_UPSTREAM.exec(upstream)?.[1] : undefined;
|
|
4
|
+
/**
|
|
5
|
+
* An SDK-window App whose gateway only carries path ingress (a unix upstream
|
|
6
|
+
* for the App's own WebSocket route). The gateway is infrastructure there: it
|
|
7
|
+
* never launches a web UI, so the DSM window, menu, Package Center Open,
|
|
8
|
+
* portal and mobile entry stay exactly as without the gateway. A unix
|
|
9
|
+
* upstream is new, so no existing App is inferred ingress-only.
|
|
10
|
+
*/
|
|
11
|
+
export function gatewayIngressOnly(m) {
|
|
12
|
+
return Boolean(m.identityGateway && unixUpstreamSocket(m.identityGateway.upstream) && !m.compose && m.sdkWindow !== false);
|
|
13
|
+
}
|
|
@@ -63,8 +63,8 @@ export interface IdentityGateway {
|
|
|
63
63
|
groups?: string[];
|
|
64
64
|
max_upload_bytes?: number;
|
|
65
65
|
response_header_timeout_seconds?: number;
|
|
66
|
-
/** The App's loopback port. */
|
|
67
|
-
upstream: number;
|
|
66
|
+
/** The App's loopback port, or `unix:<name>.sock`: its private SDK IPC socket under var/run. */
|
|
67
|
+
upstream: number | string;
|
|
68
68
|
listen: {
|
|
69
69
|
http?: number;
|
|
70
70
|
https?: number;
|
|
@@ -6,7 +6,8 @@ import { existsSync, lstatSync, readFileSync } from "node:fs";
|
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { PINNED_GO_HINT, pinnedGoBuildEnv, pinnedGoProblem, } from "../build-spk/go-toolchain.js";
|
|
8
8
|
import { goChildEnv } from "../runtime/go-env.js";
|
|
9
|
-
import {
|
|
9
|
+
import { unixUpstreamSocket } from "./gateway-ingress-only.js";
|
|
10
|
+
import { SDK_MODULE, sdkSource } from "../runtime/sdk-source.js";
|
|
10
11
|
import { checkCgiBinary } from "./binary.js";
|
|
11
12
|
import { isWebAccessMode, DSM_GROUP_NAME, } from "../contract/web-launch.js";
|
|
12
13
|
import { relativeExec, runtimeBudgetSource, token } from "./daemon.js";
|
|
@@ -59,6 +60,10 @@ function secureContextSdkSupported(dir) {
|
|
|
59
60
|
const source = join(dir, "idgateway/secure_context.go");
|
|
60
61
|
return existsSync(source) && /const SecureContextVersion = 1\b/.test(readFileSync(source, "utf8"));
|
|
61
62
|
}
|
|
63
|
+
function unixUpstreamSdkSupported(dir) {
|
|
64
|
+
const source = join(dir, "idgateway/unix_upstream.go");
|
|
65
|
+
return existsSync(source) && /const UnixUpstreamVersion = 1\b/.test(readFileSync(source, "utf8"));
|
|
66
|
+
}
|
|
62
67
|
function upstreamAuthSdkSupported(dir) {
|
|
63
68
|
const source = join(dir, "idgateway/upstream_auth.go");
|
|
64
69
|
return existsSync(source) && /const UpstreamAuthPathsVersion = 1\b/.test(readFileSync(source, "utf8"));
|
|
@@ -264,8 +269,26 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
264
269
|
v.mode !== "header" &&
|
|
265
270
|
v.mode !== "token")
|
|
266
271
|
return invalid("mode must be none, oidc, header or token.");
|
|
267
|
-
|
|
268
|
-
|
|
272
|
+
const unixSocket = unixUpstreamSocket(v.upstream);
|
|
273
|
+
if (typeof v.upstream === "string") {
|
|
274
|
+
if (!unixSocket)
|
|
275
|
+
return invalid("upstream must be the App's loopback port or unix:<name>.sock (lowercase letters, digits and hyphens, at most 59 characters before .sock).");
|
|
276
|
+
if (composeBridge)
|
|
277
|
+
return invalid("a unix upstream cannot be combined with compose.");
|
|
278
|
+
if (v.ingress === undefined)
|
|
279
|
+
return invalid("a unix upstream requires ingress: the gateway has no TCP listener to serve it.");
|
|
280
|
+
if (record(v.listen) && Object.keys(v.listen).length)
|
|
281
|
+
return invalid("a unix upstream cannot combine with listen ports; use ingress only.");
|
|
282
|
+
try {
|
|
283
|
+
if (!unixUpstreamSdkSupported(sdkSource(v.sdk).goDir))
|
|
284
|
+
return invalid("The selected SDK lacks unix upstream support (UnixUpstreamVersion); use a matching SDK release or an explicit development source override.");
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
return invalid("The SDK unix upstream source is unavailable; use matching SDK sources.");
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else if (!port(v.upstream))
|
|
291
|
+
return invalid("upstream must be the App's loopback port or unix:<name>.sock.");
|
|
269
292
|
const ingress = v.ingress;
|
|
270
293
|
if (ingress !== undefined && (!record(ingress) || !only(ingress, ["path"]) || typeof ingress.path !== "string" || gatewayIngressPathProblem(undefined, ingress.path) !== undefined))
|
|
271
294
|
return invalid(gatewayIngressPathProblem(undefined, record(ingress) ? ingress.path : undefined) ?? "ingress accepts only {path: /my-app/}.");
|
|
@@ -281,7 +304,7 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
281
304
|
const ports = [
|
|
282
305
|
listen.http,
|
|
283
306
|
listen.https,
|
|
284
|
-
...(composeBridge ? [] : [v.upstream]),
|
|
307
|
+
...(composeBridge || unixSocket ? [] : [v.upstream]),
|
|
285
308
|
issuer,
|
|
286
309
|
].filter((p) => p !== undefined);
|
|
287
310
|
if (new Set(ports).size !== ports.length ||
|
|
@@ -527,7 +550,9 @@ export function identityGatewayConfig(m) {
|
|
|
527
550
|
: {}),
|
|
528
551
|
upstream: m.compose?.plan.ingress
|
|
529
552
|
? `http://${m.compose.plan.ingress.address}:${m.compose.plan.ingress.port}`
|
|
530
|
-
:
|
|
553
|
+
: unixUpstreamSocket(g.upstream)
|
|
554
|
+
? `unix:/var/packages/${m.package}/var/run/${unixUpstreamSocket(g.upstream)}`
|
|
555
|
+
: `http://127.0.0.1:${g.upstream}`,
|
|
531
556
|
...(m.compose?.plan.ingress
|
|
532
557
|
? { compose_ingress: { candidate: m.compose.plan.ingress.candidate } }
|
|
533
558
|
: {}),
|
|
@@ -598,6 +623,8 @@ export async function buildIdentityGateway(m, arch, work, run) {
|
|
|
598
623
|
runtimeBudgetSource(sdk.goDir, m);
|
|
599
624
|
if (m.identityGateway.secure_context && !secureContextSdkSupported(sdk.goDir))
|
|
600
625
|
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "secure_context requires an SDK with HTTPS guidance support; upgrade the selected SDK and use matching SDK sources.");
|
|
626
|
+
if (unixUpstreamSocket(m.identityGateway.upstream) && !unixUpstreamSdkSupported(sdk.goDir))
|
|
627
|
+
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks unix upstream support (UnixUpstreamVersion); use a matching SDK release or an explicit development source override.");
|
|
601
628
|
if (m.identityGateway.upstream_auth_paths && !upstreamAuthSdkSupported(sdk.goDir))
|
|
602
629
|
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks upstream_auth_paths and its build-bound entry policy; use matching SDK sources.");
|
|
603
630
|
if (gatewayExternalAccess(m.identityGateway)) {
|
|
@@ -637,7 +664,7 @@ export async function buildIdentityGateway(m, arch, work, run) {
|
|
|
637
664
|
const policyFlag = upstreamAuthSdkSupported(sdk.goDir)
|
|
638
665
|
? ` -X github.com/synopackageland/syno-pkg-land-sdk/idgateway.expectedEntryPolicyDigest=${gatewayEntryPolicyDigest(JSON.parse(identityGatewayConfig(m)))}`
|
|
639
666
|
: "";
|
|
640
|
-
const ldflags = `-s -w -buildid= -X main.configPath=${packageDest(m)}/${GATEWAY_CONFIG_PATH}${policyFlag}`;
|
|
667
|
+
const ldflags = `-s -w -buildid= -X main.configPath=${packageDest(m)}/${GATEWAY_CONFIG_PATH} -X ${SDK_MODULE}/ipc.packageID=${m.package}${policyFlag}`;
|
|
641
668
|
const result = await run("go", [
|
|
642
669
|
"build",
|
|
643
670
|
"-trimpath",
|
|
@@ -31,6 +31,7 @@ import { daemonSdkVersion, readDaemon, readLifecycleTimeouts } from "./daemon.js
|
|
|
31
31
|
import { daemonRestartSdkProblem } from "./daemon-restart.js";
|
|
32
32
|
import { daemonIngressMinDsmProblem } from "./daemon-ingress.js";
|
|
33
33
|
import { readIdentityGateway, } from "./identity-gateway.js";
|
|
34
|
+
import { gatewayIngressOnly, unixUpstreamSocket } from "./gateway-ingress-only.js";
|
|
34
35
|
import { readUninstall } from "./uninstall.js";
|
|
35
36
|
import { readHyperBackup } from "./hyper-backup.js";
|
|
36
37
|
import { readAppScripts } from "./app-scripts.js";
|
|
@@ -511,6 +512,14 @@ function readManifest(raw, c) {
|
|
|
511
512
|
const noWindow = raw.compose === undefined && raw.ui === false;
|
|
512
513
|
if (noWindow)
|
|
513
514
|
readNoWindow(raw, capabilities, c);
|
|
515
|
+
if (identityGateway && unixUpstreamSocket(identityGateway.upstream)) {
|
|
516
|
+
const why = raw.compose !== undefined ? "cannot be combined with compose"
|
|
517
|
+
: raw.console !== undefined ? "cannot be combined with console: the gateway serves no web UI"
|
|
518
|
+
: !noWindow && identityGateway.mode !== "none" ? "on an App with an SDK window requires mode: none: the window stays the App's entry"
|
|
519
|
+
: undefined;
|
|
520
|
+
if (why)
|
|
521
|
+
c.fail("STANDALONE_IDENTITY_GATEWAY_INVALID", `identity_gateway: a unix upstream ${why}.`);
|
|
522
|
+
}
|
|
514
523
|
const ui = raw.compose !== undefined || noWindow
|
|
515
524
|
? {
|
|
516
525
|
dir: c.root,
|
|
@@ -553,6 +562,8 @@ function readManifest(raw, c) {
|
|
|
553
562
|
c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: app needs a UI');
|
|
554
563
|
if (mobile.entry === 'gateway' && !identityGateway)
|
|
555
564
|
c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: gateway needs identity_gateway');
|
|
565
|
+
if (mobile.entry === 'gateway' && gatewayIngressOnly({ sdkWindow: noWindow ? false : undefined, identityGateway }))
|
|
566
|
+
c.fail('STANDALONE_MOBILE_INVALID', 'mobile.entry: gateway needs a gateway web UI; a unix-upstream gateway only carries ingress. Use mobile.entry: app.');
|
|
556
567
|
if (mobile.icon)
|
|
557
568
|
renderPackageIcons(mobileIconPath(c.root, mobile.icon));
|
|
558
569
|
}
|
package/docs/path-ingress.md
CHANGED
|
@@ -37,6 +37,28 @@ identity_gateway:
|
|
|
37
37
|
headers: {user: Remote-User}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### Ingress only, with no TCP port
|
|
41
|
+
|
|
42
|
+
An App with an SDK window that needs one App-authenticated route (for example a
|
|
43
|
+
WebSocket) on DSM's origin can point the gateway at its private SDK IPC socket:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
identity_gateway:
|
|
47
|
+
sdk: <sdk-with-UnixUpstreamVersion>
|
|
48
|
+
mode: none
|
|
49
|
+
upstream: unix:reverse-ingress.sock # /var/packages/<package>/var/run/<name>.sock
|
|
50
|
+
ingress: {path: /synopkgland/ExampleApp/}
|
|
51
|
+
upstream_auth_paths: [/reverse]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The name is `[a-z0-9][a-z0-9-]{0,58}\.sock`, a direct name. The App serves it with
|
|
55
|
+
the SDK's `ipc.ServeUnix`; no TCP listener is involved. The form needs `ingress`,
|
|
56
|
+
no `listen`, no Compose and an SDK whose `idgateway` declares
|
|
57
|
+
`UnixUpstreamVersion = 1`. With an SDK window the gateway is ingress only: the
|
|
58
|
+
DSM window, menu, Package Center Open, portal and mobile entry are unchanged
|
|
59
|
+
(`console` and `mobile.entry: gateway` are refused). Without a window the
|
|
60
|
+
gateway opens its web UI as usual.
|
|
61
|
+
|
|
40
62
|
Replace `listen` with `ingress`. The default is `/synopkgland/<exact-package-ID>/` (case sensitive).
|
|
41
63
|
The SDK and CLI also accept an explicit custom path:
|
|
42
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.1",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,13 +42,14 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@napi-rs/keyring": "^2.1.1",
|
|
45
|
-
"@synopackageland/templates": "~0.
|
|
45
|
+
"@synopackageland/templates": "~0.43.0",
|
|
46
46
|
"ajv": "^8.17.1",
|
|
47
47
|
"commander": "^13.1.0",
|
|
48
48
|
"esbuild": "^0.28.2",
|
|
49
49
|
"json-canonicalize": "^3.0.1",
|
|
50
50
|
"koffi": "3.3.7",
|
|
51
51
|
"re2js": "2.9.1",
|
|
52
|
+
"semver": "^7.8.6",
|
|
52
53
|
"tar": "^7.4.3",
|
|
53
54
|
"yaml": "^2.7.0"
|
|
54
55
|
},
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"@ai-sdk/openai": "^4.0.91",
|
|
57
58
|
"@e2e-dev/web": "^0.14.0",
|
|
58
59
|
"@types/node": "^22.13.10",
|
|
60
|
+
"@types/semver": "^7.8.0",
|
|
59
61
|
"ai": "^7.0.137",
|
|
60
62
|
"e2e": "^0.19.0",
|
|
61
63
|
"tsx": "^4.19.3",
|
package/skills/SKILL.md
CHANGED
|
@@ -28,10 +28,14 @@ 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
30
|
templates release; pnpm install/update selects a patch in that minor line. The CLI
|
|
31
|
-
uses the locally installed templates and
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
uses the locally installed templates and resolves compatible dependency versions at init.
|
|
32
|
+
Without `-t`, init creates a native-go Vue project. It pins its own CLI version,
|
|
33
|
+
selects stable compatible SDK/UI releases, and falls back to shipped defaults with a hint
|
|
34
|
+
when registry lookup fails. It never downloads templates at runtime. New projects have
|
|
35
|
+
no npm lockfiles: run `pnpm install` first, commit the generated lockfiles, then use
|
|
36
|
+
`pnpm install --frozen-lockfile`. Run `go mod tidy` in the Go backend; if init selected
|
|
37
|
+
a newer Rust SDK tag, run `cargo generate-lockfile` in its backend before check/build.
|
|
38
|
+
SDK releases in the init compatibility range are independent of templates releases: executor manifest format 1 in the resolved SDK pins the executor release,
|
|
35
39
|
Go toolchain and six payload digests. Preserve npm integrity and Go module sums.
|
|
36
40
|
The CLI verifies bytes before packaging and never fetches a manifest at NAS runtime.
|
|
37
41
|
Unsupported formats require a CLI update; invalid manifests fail closed.
|
|
@@ -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
|
|
279
|
+
The unified Compose contract resolves a compatible stable SDK at init and uses the installed templates' defaults if registry lookup fails. The generated identity gateway pins that SDK independently of the CLI version. Templates patches can ship independently; pnpm install/update resolves them. Existing Apps may use SDK minor upgrades with 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
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# JSON UI for DSM apps
|
|
2
2
|
|
|
3
3
|
Use the project's installed `@synopackageland/ui` from the frontend directory.
|
|
4
|
-
Run `pnpm install --frozen-lockfile` first if dependencies are missing. Run `pnpm exec syno-pkg-land-ui <command>`
|
|
4
|
+
Run `pnpm install` (or `pnpm install --frozen-lockfile` when its lockfile exists) first if dependencies are missing. Run `pnpm exec syno-pkg-land-ui <command>`
|
|
5
5
|
to use the package bin, or add `node_modules/.bin` to PATH and use `syno-pkg-land-ui <command>`
|
|
6
6
|
for the commands below. Discovery and validation must use the app's installed SDK
|
|
7
7
|
and lockfile. If the installed bin is missing, report the missing CLI and stop the
|
|
@@ -39,7 +39,7 @@ Do not convert the existing app merely to run the JSON checker.
|
|
|
39
39
|
|
|
40
40
|
## Discover the installed contract
|
|
41
41
|
|
|
42
|
-
Work from `frontend` after `pnpm install --frozen-lockfile
|
|
42
|
+
Work from `frontend` after `pnpm install` (or `pnpm install --frozen-lockfile` when its lockfile exists). See [ui-json.md](ui-json.md) for the shared
|
|
43
43
|
package-bin setup. Query the installed package before choosing components:
|
|
44
44
|
|
|
45
45
|
```sh
|