@synopackageland/cli 0.3.5 → 0.3.6

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.
@@ -192,6 +192,11 @@ export async function buildSpk(options) {
192
192
  copyFileSync(options.project.composePath, join(resourceProjectDir, "docker-compose.yml"));
193
193
  }
194
194
  chmodSync(join(resourceProjectDir, "docker-compose.yml"), FILE_MODE);
195
+ const routeMarkerDir = join(staging, "package", ".synopkgland");
196
+ mkdirSync(routeMarkerDir, { recursive: true });
197
+ const routeMarker = join(routeMarkerDir, "route");
198
+ writeFileSync(routeMarker, "package-only", "utf8");
199
+ chmodSync(routeMarker, FILE_MODE);
195
200
  }
196
201
  const htmlDir = join(options.project.root, "html");
197
202
  if (existsSync(htmlDir)) {
package/dist/doctor.js CHANGED
@@ -6,6 +6,19 @@ import { loadContract } from "./contract/load.js";
6
6
  import { getErrorCode } from "./error-registry.js";
7
7
  import { dsmFetch } from "./host/dsm-http.js";
8
8
  import { appOriginFromContract } from "./host/open-url.js";
9
+ function packageRouteFromDiagnostics(diagnostics) {
10
+ switch (diagnostics?.packageRoute) {
11
+ case "package-only":
12
+ case "broker-installer":
13
+ case "unknown":
14
+ return diagnostics.packageRoute;
15
+ default:
16
+ break;
17
+ }
18
+ // Keep compatibility with the boolean-only response emitted by older
19
+ // Brokers, but never infer broker-installer from missing evidence.
20
+ return diagnostics?.isPackageOnly === true ? "package-only" : "unknown";
21
+ }
9
22
  const PROJECT_FOUR_FILES = ["synology-app.yaml", "README.md", "icon.png"];
10
23
  function packageFailureSummary(state) {
11
24
  const fields = [];
@@ -472,26 +485,34 @@ export async function runDoctor(options) {
472
485
  else {
473
486
  const info = await host.getAttestationInfo(targetPackageId);
474
487
  if (info.readiness === "NOT_INSTALLED") {
475
- // Check if package is package-only route via Broker diagnostics
476
- let isPackageOnly = false;
488
+ // Check the diagnosed route before treating a missing binding
489
+ // as a Broker-installer failure. Unknown is deliberately
490
+ // non-failing because the Broker may not be able to read the
491
+ // DSM package resource.
492
+ let packageRoute = "unknown";
477
493
  if (host.getDsmDiagnostics) {
478
494
  try {
479
495
  const diag = await host.getDsmDiagnostics(targetPackageId);
480
- if (diag?.isPackageOnly === true || diag?.packageRoute === "package-only") {
481
- isPackageOnly = true;
482
- }
496
+ packageRoute = packageRouteFromDiagnostics(diag);
483
497
  }
484
498
  catch {
485
499
  // ignore
486
500
  }
487
501
  }
488
- if (isPackageOnly) {
502
+ if (packageRoute === "package-only") {
489
503
  checks.push({
490
504
  id: "host.package_binding",
491
505
  status: "skip",
492
506
  message: "package-only 路線,無 Broker binding(略過)",
493
507
  });
494
508
  }
509
+ else if (packageRoute === "unknown") {
510
+ checks.push({
511
+ id: "host.package_binding",
512
+ status: "skip",
513
+ message: "Broker 無法判定套件路線,略過 Package Binding 檢查",
514
+ });
515
+ }
495
516
  else {
496
517
  const errorEntry = getErrorCode("PROJECT_BINDING_NOT_FOUND");
497
518
  checks.push({
@@ -1,4 +1,4 @@
1
- import type { AttestationKind, HostInstallRecord, NasHost } from "./types.js";
1
+ import type { AttestationKind, HostInstallRecord, NasHost, PackageRoute } from "./types.js";
2
2
  export interface FakeNasHostOptions {
3
3
  curated?: string[];
4
4
  dsmOrigin?: string;
@@ -8,7 +8,7 @@ export interface FakeNasHostOptions {
8
8
  installedEnv?: Record<string, Record<string, string>>;
9
9
  diagnostics?: {
10
10
  dsmResidue?: import("./types.js").DsmResidueInventory;
11
- packageRoute?: string;
11
+ packageRoute?: PackageRoute;
12
12
  isPackageOnly?: boolean;
13
13
  [key: string]: unknown;
14
14
  };
@@ -1,5 +1,6 @@
1
1
  import type { InstalledPackageState } from "./catalog-install.js";
2
2
  export type AttestationKind = "local" | "app-package" | "none";
3
+ export type PackageRoute = "package-only" | "broker-installer" | "unknown";
3
4
  export interface DeployIdentity {
4
5
  packageId: string;
5
6
  displayname: string;
@@ -74,7 +75,7 @@ export interface NasHost {
74
75
  fetchContainerLogs(packageIdentity: string): Promise<string[]>;
75
76
  getDsmDiagnostics?(packageIdentity?: string): Promise<{
76
77
  dsmResidue?: DsmResidueInventory;
77
- packageRoute?: "package-only" | "broker-installer" | string;
78
+ packageRoute?: PackageRoute;
78
79
  isPackageOnly?: boolean;
79
80
  [key: string]: unknown;
80
81
  } | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {