@synopackageland/cli 0.3.10 → 0.4.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/LICENSE +21 -0
- package/README.md +57 -9
- package/dist/bin.js +1 -2
- package/dist/build-spk/generator.d.ts +0 -3
- package/dist/build-spk/generator.js +138 -287
- package/dist/build-spk/native-lifecycle.js +0 -3
- package/dist/build-spk/native-payload.js +0 -1
- package/dist/build-spk/notices.d.ts +5 -0
- package/dist/build-spk/notices.js +60 -0
- package/dist/cli.js +178 -151
- package/dist/compose/analyze.d.ts +1 -2
- package/dist/compose/analyze.js +5 -48
- package/dist/contract/unsupported-types.d.ts +10 -0
- package/dist/contract/unsupported-types.js +49 -0
- package/dist/contract/validate.js +25 -2
- package/dist/contract/web-launch.js +0 -2
- package/dist/deploy/deploy.d.ts +1 -4
- package/dist/deploy/deploy.js +45 -156
- package/dist/deploy/homes-values.js +1 -1
- package/dist/deploy/plan.d.ts +18 -0
- package/dist/deploy/plan.js +54 -0
- package/dist/deploy/spk-version.d.ts +2 -14
- package/dist/deploy/spk-version.js +25 -111
- package/dist/dev.d.ts +1 -3
- package/dist/dev.js +14 -28
- package/dist/error-registry.js +830 -862
- package/dist/host/dsm-client.js +12 -272
- package/dist/host/dsm-port-profile.d.ts +0 -1
- package/dist/host/dsm-port-profile.js +0 -2
- package/dist/host/types.d.ts +1 -83
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -6
- package/dist/info.d.ts +0 -1
- package/dist/info.js +3 -10
- package/dist/init.d.ts +15 -1
- package/dist/init.js +128 -12
- package/dist/log.js +2 -3
- package/dist/native/validate.js +0 -1
- package/dist/standalone/binary.d.ts +9 -0
- package/dist/standalone/binary.js +67 -0
- package/dist/standalone/build.d.ts +25 -0
- package/dist/standalone/build.js +110 -0
- package/dist/standalone/daemon.d.ts +23 -0
- package/dist/standalone/daemon.js +114 -0
- package/dist/standalone/dsm-window.d.ts +26 -0
- package/dist/standalone/dsm-window.js +291 -0
- package/dist/standalone/helper-inventory.d.ts +16 -0
- package/dist/standalone/helper-inventory.js +2 -0
- package/dist/standalone/helper.d.ts +21 -0
- package/dist/standalone/helper.js +105 -0
- package/dist/standalone/host-adapter.d.ts +5 -0
- package/dist/standalone/host-adapter.js +148 -0
- package/dist/standalone/host-platform.d.ts +13 -0
- package/dist/standalone/host-platform.js +42 -0
- package/dist/standalone/host-types.d.ts +49 -0
- package/dist/standalone/host-types.js +1 -0
- package/dist/standalone/i18n.d.ts +28 -0
- package/dist/standalone/i18n.js +161 -0
- package/dist/standalone/inspect-helper.d.ts +6 -0
- package/dist/standalone/inspect-helper.js +88 -0
- package/dist/standalone/inspect-spk.d.ts +23 -0
- package/dist/standalone/inspect-spk.js +209 -0
- package/dist/standalone/lifecycle-helper.d.ts +2 -0
- package/dist/standalone/lifecycle-helper.js +12 -0
- package/dist/standalone/lifecycle.d.ts +3 -0
- package/dist/standalone/lifecycle.js +53 -0
- package/dist/standalone/manifest.d.ts +73 -0
- package/dist/standalone/manifest.js +279 -0
- package/dist/standalone/reopen-events.d.ts +2 -0
- package/dist/standalone/reopen-events.js +28 -0
- package/dist/standalone/root-messages.d.ts +7 -0
- package/dist/standalone/root-messages.js +259 -0
- package/dist/standalone/root-ops.d.ts +42 -0
- package/dist/standalone/root-ops.js +101 -0
- package/dist/standalone/root-window.d.ts +36 -0
- package/dist/standalone/root-window.js +302 -0
- package/dist/standalone/spk.d.ts +23 -0
- package/dist/standalone/spk.js +192 -0
- package/dist/template-paths.d.ts +2 -0
- package/dist/template-paths.js +9 -0
- package/dist/templates/_daemon/fixture_linux_test.go +15 -0
- package/dist/templates/_daemon/fixture_other_test.go +7 -0
- package/dist/templates/_daemon/go.mod +3 -0
- package/dist/templates/_daemon/main.go +608 -0
- package/dist/templates/_daemon/main_test.go +242 -0
- package/dist/templates/_daemon/process_linux.go +55 -0
- package/dist/templates/_daemon/process_linux_test.go +161 -0
- package/dist/templates/_daemon/process_other.go +14 -0
- package/dist/templates/_daemon/testdata/child.go +41 -0
- package/dist/templates/_shared/GO-LICENSE +27 -0
- package/dist/templates/_shared/GO-PATENTS +22 -0
- package/dist/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
- package/dist/templates/_shared/notice-overrides/index.json +14 -0
- package/dist/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
- package/dist/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
- package/dist/templates/_shared/third-party-notices.mjs +51 -0
- package/dist/templates/binary/synology-app.yaml +7 -0
- package/dist/templates/hello-files/compose.yaml +0 -1
- package/dist/templates/hello-web/compose.yaml +13 -10
- package/dist/templates/hello-web/html/app.js +1 -23
- package/dist/templates/hello-web/html/index.html +1 -3
- package/dist/templates/hello-web-page/compose.yaml +13 -10
- package/dist/templates/hello-web-page/html/app.js +1 -23
- package/dist/templates/hello-web-page/html/index.html +1 -3
- package/dist/templates/native-go/README.md +324 -0
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
- package/dist/templates/native-go/backend/cmd/app/main.go +49 -0
- package/dist/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
- package/dist/templates/native-go/backend/cmd/helper/main.go +38 -0
- package/dist/templates/native-go/backend/go.mod +7 -0
- package/dist/templates/native-go/backend/go.sum +4 -0
- package/dist/templates/native-go/backend/internal/api/binary.go +154 -0
- package/dist/templates/native-go/backend/internal/api/binary_test.go +165 -0
- package/dist/templates/native-go/backend/internal/api/errors.go +33 -0
- package/dist/templates/native-go/backend/internal/api/registry.go +104 -0
- package/dist/templates/native-go/backend/internal/api/registry_test.go +329 -0
- package/dist/templates/native-go/backend/internal/api/server.go +159 -0
- package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
- package/dist/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
- package/dist/templates/native-go/backend/internal/app/root_none.go +9 -0
- package/dist/templates/native-go/backend/internal/app/routes.go +138 -0
- package/dist/templates/native-go/backend/internal/app/routes_test.go +172 -0
- package/dist/templates/native-go/backend/internal/dsm/auth.go +118 -0
- package/dist/templates/native-go/backend/internal/dsm/auth_test.go +139 -0
- package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
- package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
- package/dist/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
- package/dist/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
- package/dist/templates/native-go/backend/internal/helper/cohort.go +393 -0
- package/dist/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
- package/dist/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
- package/dist/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
- package/dist/templates/native-go/backend/internal/helper/control.go +424 -0
- package/dist/templates/native-go/backend/internal/helper/control_test.go +250 -0
- package/dist/templates/native-go/backend/internal/helper/data_contract.go +242 -0
- package/dist/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/data_decode.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
- package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
- package/dist/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
- package/dist/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
- package/dist/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
- package/dist/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
- package/dist/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
- package/dist/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
- package/dist/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
- package/dist/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
- package/dist/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
- package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
- package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
- package/dist/templates/native-go/backend/internal/helper/lease.go +112 -0
- package/dist/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
- package/dist/templates/native-go/backend/internal/helper/lease_other.go +8 -0
- package/dist/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
- package/dist/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
- package/dist/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
- package/dist/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
- package/dist/templates/native-go/backend/internal/helper/native_identity.go +89 -0
- package/dist/templates/native-go/backend/internal/helper/native_provider.go +159 -0
- package/dist/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
- package/dist/templates/native-go/backend/internal/helper/observation.go +204 -0
- package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
- package/dist/templates/native-go/backend/internal/helper/observation_test.go +196 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
- package/dist/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
- package/dist/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
- package/dist/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
- package/dist/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
- package/dist/templates/native-go/backend/internal/helper/peer_linux.go +44 -0
- package/dist/templates/native-go/backend/internal/helper/peer_other.go +7 -0
- package/dist/templates/native-go/backend/internal/helper/process_linux.go +177 -0
- package/dist/templates/native-go/backend/internal/helper/process_other.go +5 -0
- package/dist/templates/native-go/backend/internal/helper/publication_test.go +178 -0
- package/dist/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
- package/dist/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
- package/dist/templates/native-go/backend/internal/helper/readonly.go +105 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
- package/dist/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
- package/dist/templates/native-go/backend/internal/helper/repair.go +132 -0
- package/dist/templates/native-go/backend/internal/helper/repair_test.go +271 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
- package/dist/templates/native-go/backend/internal/helper/server_linux.go +124 -0
- package/dist/templates/native-go/backend/internal/helper/status.go +334 -0
- package/dist/templates/native-go/backend/internal/helper/status_test.go +288 -0
- package/dist/templates/native-go/backend/internal/helper/supervision.go +107 -0
- package/dist/templates/native-go/backend/internal/helper/supervision_test.go +124 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +363 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux_test.go +913 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
- package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
- package/dist/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
- package/dist/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
- package/dist/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
- package/dist/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
- package/dist/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
- package/dist/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
- package/dist/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
- package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
- package/dist/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
- package/dist/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
- package/dist/templates/native-go/backend/internal/helper/write.go +77 -0
- package/dist/templates/native-go/backend/internal/helper/write_admission.go +260 -0
- package/dist/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
- package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
- package/dist/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
- package/dist/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
- package/dist/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
- package/dist/templates/native-go/backend/internal/helper/write_test.go +53 -0
- package/dist/templates/native-go/dsm-package.yaml +58 -0
- package/dist/templates/native-go/gitignore +1 -0
- package/dist/templates/native-go/i18n/glossary.json +662 -0
- package/dist/templates/native-go/i18n/messages/de.json +28 -0
- package/dist/templates/native-go/i18n/messages/en.json +28 -0
- package/dist/templates/native-go/i18n/messages/es.json +28 -0
- package/dist/templates/native-go/i18n/messages/fr.json +28 -0
- package/dist/templates/native-go/i18n/messages/it.json +28 -0
- package/dist/templates/native-go/i18n/messages/ja.json +28 -0
- package/dist/templates/native-go/i18n/messages/ko.json +28 -0
- package/dist/templates/native-go/i18n/messages/zh-CN.json +28 -0
- package/dist/templates/native-go/i18n/messages/zh-TW.json +28 -0
- package/dist/templates/native-go/ui/app.css +35 -0
- package/dist/templates/native-go/ui/app.js +101 -0
- package/dist/templates/native-go-better-auth/backend/internal/app/identity.go +208 -0
- package/dist/templates/native-go-better-auth/backend/internal/app/identity_test.go +113 -0
- package/dist/templates/native-go-better-auth/node/app.mjs +72 -0
- package/dist/templates/native-go-better-auth/node/build.mjs +4 -0
- package/dist/templates/native-go-better-auth/node/package-lock.json +862 -0
- package/dist/templates/native-go-better-auth/node/package.json +1 -0
- package/dist/templates/native-go-better-auth/node/test/auth.test.mjs +31 -0
- package/dist/templates/native-go-integration/backend/internal/app/identity_none.go +6 -0
- package/dist/templates/native-go-integration/backend/internal/app/personal.go +203 -0
- package/dist/templates/native-go-integration/backend/internal/app/personal_test.go +119 -0
- package/dist/templates/native-go-root/backend/internal/app/root.go +107 -0
- package/dist/templates/native-go-root/backend/internal/app/root_test.go +124 -0
- package/dist/templates/native-go-root/root/whoami.sh +6 -0
- package/dist/templates/native-go-vue/README.md +224 -0
- package/dist/templates/native-go-vue/frontend/DESIGN.md +78 -0
- package/dist/templates/native-go-vue/frontend/package-lock.json +2410 -0
- package/dist/templates/native-go-vue/frontend/package.json +6 -0
- package/dist/templates/native-go-vue/frontend/src/App.vue +159 -0
- package/dist/templates/native-go-vue/frontend/src/context.ts +56 -0
- package/dist/templates/native-go-vue/frontend/src/main.ts +29 -0
- package/dist/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
- package/dist/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
- package/dist/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
- package/dist/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
- package/dist/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
- package/dist/templates/native-go-vue/frontend/src/style.css +31 -0
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +190 -0
- package/dist/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
- package/dist/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
- package/dist/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
- package/dist/templates/native-go-vue/frontend/tsconfig.json +1 -0
- package/dist/templates/native-go-vue/frontend/vite.config.ts +10 -0
- package/dist/templates/native-go-vue/gitignore +2 -0
- package/dist/types.d.ts +1 -1
- package/dist/validate.js +11 -7
- package/package.json +5 -8
- package/schema/synology-app.schema.json +36 -37
- package/skills/SKILL.md +4 -48
- package/skills/reference/create.md +11 -83
- package/skills/reference/deploy.md +7 -78
- package/skills/reference/diagnose.md +4 -101
- package/skills/reference/files.md +5 -41
- package/skills/reference/identity.md +3 -29
- package/skills/reference/wrap.md +0 -2
- package/templates/_daemon/fixture_linux_test.go +15 -0
- package/templates/_daemon/fixture_other_test.go +7 -0
- package/templates/_daemon/go.mod +3 -0
- package/templates/_daemon/main.go +608 -0
- package/templates/_daemon/main_test.go +242 -0
- package/templates/_daemon/process_linux.go +55 -0
- package/templates/_daemon/process_linux_test.go +161 -0
- package/templates/_daemon/process_other.go +14 -0
- package/templates/_daemon/testdata/child.go +41 -0
- package/templates/_shared/GO-LICENSE +27 -0
- package/templates/_shared/GO-PATENTS +22 -0
- package/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
- package/templates/_shared/notice-overrides/index.json +14 -0
- package/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
- package/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
- package/templates/_shared/third-party-notices.mjs +51 -0
- package/templates/binary/synology-app.yaml +7 -0
- package/templates/hello-files/compose.yaml +0 -1
- package/templates/hello-web/compose.yaml +13 -10
- package/templates/hello-web/html/app.js +1 -23
- package/templates/hello-web/html/index.html +1 -3
- package/templates/hello-web-page/compose.yaml +13 -10
- package/templates/hello-web-page/html/app.js +1 -23
- package/templates/hello-web-page/html/index.html +1 -3
- package/templates/native-go/README.md +324 -0
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
- package/templates/native-go/backend/cmd/app/main.go +49 -0
- package/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
- package/templates/native-go/backend/cmd/helper/main.go +38 -0
- package/templates/native-go/backend/go.mod +7 -0
- package/templates/native-go/backend/go.sum +4 -0
- package/templates/native-go/backend/internal/api/binary.go +154 -0
- package/templates/native-go/backend/internal/api/binary_test.go +165 -0
- package/templates/native-go/backend/internal/api/errors.go +33 -0
- package/templates/native-go/backend/internal/api/registry.go +104 -0
- package/templates/native-go/backend/internal/api/registry_test.go +329 -0
- package/templates/native-go/backend/internal/api/server.go +159 -0
- package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
- package/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
- package/templates/native-go/backend/internal/app/root_none.go +9 -0
- package/templates/native-go/backend/internal/app/routes.go +138 -0
- package/templates/native-go/backend/internal/app/routes_test.go +172 -0
- package/templates/native-go/backend/internal/dsm/auth.go +118 -0
- package/templates/native-go/backend/internal/dsm/auth_test.go +139 -0
- package/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
- package/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
- package/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
- package/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
- package/templates/native-go/backend/internal/helper/cohort.go +393 -0
- package/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
- package/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
- package/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
- package/templates/native-go/backend/internal/helper/control.go +424 -0
- package/templates/native-go/backend/internal/helper/control_test.go +250 -0
- package/templates/native-go/backend/internal/helper/data_contract.go +242 -0
- package/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
- package/templates/native-go/backend/internal/helper/data_decode.go +184 -0
- package/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
- package/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
- package/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
- package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
- package/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
- package/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
- package/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
- package/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
- package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
- package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
- package/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
- package/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
- package/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
- package/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
- package/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
- package/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
- package/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
- package/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
- package/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
- package/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
- package/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
- package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
- package/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
- package/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
- package/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
- package/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
- package/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
- package/templates/native-go/backend/internal/helper/lease.go +112 -0
- package/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
- package/templates/native-go/backend/internal/helper/lease_other.go +8 -0
- package/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
- package/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
- package/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
- package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
- package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
- package/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
- package/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
- package/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
- package/templates/native-go/backend/internal/helper/native_identity.go +89 -0
- package/templates/native-go/backend/internal/helper/native_provider.go +159 -0
- package/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
- package/templates/native-go/backend/internal/helper/observation.go +204 -0
- package/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
- package/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
- package/templates/native-go/backend/internal/helper/observation_test.go +196 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
- package/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
- package/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
- package/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
- package/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
- package/templates/native-go/backend/internal/helper/peer_linux.go +44 -0
- package/templates/native-go/backend/internal/helper/peer_other.go +7 -0
- package/templates/native-go/backend/internal/helper/process_linux.go +177 -0
- package/templates/native-go/backend/internal/helper/process_other.go +5 -0
- package/templates/native-go/backend/internal/helper/publication_test.go +178 -0
- package/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
- package/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
- package/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
- package/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
- package/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
- package/templates/native-go/backend/internal/helper/readonly.go +105 -0
- package/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
- package/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
- package/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
- package/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
- package/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
- package/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
- package/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
- package/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
- package/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
- package/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
- package/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
- package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
- package/templates/native-go/backend/internal/helper/repair.go +132 -0
- package/templates/native-go/backend/internal/helper/repair_test.go +271 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
- package/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
- package/templates/native-go/backend/internal/helper/server_linux.go +124 -0
- package/templates/native-go/backend/internal/helper/status.go +334 -0
- package/templates/native-go/backend/internal/helper/status_test.go +288 -0
- package/templates/native-go/backend/internal/helper/supervision.go +107 -0
- package/templates/native-go/backend/internal/helper/supervision_test.go +124 -0
- package/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
- package/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
- package/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
- package/templates/native-go/backend/internal/helper/supervisor_linux.go +363 -0
- package/templates/native-go/backend/internal/helper/supervisor_linux_test.go +913 -0
- package/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
- package/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
- package/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
- package/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
- package/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
- package/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
- package/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
- package/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
- package/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
- package/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
- package/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
- package/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
- package/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
- package/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
- package/templates/native-go/backend/internal/helper/write.go +77 -0
- package/templates/native-go/backend/internal/helper/write_admission.go +260 -0
- package/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
- package/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
- package/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
- package/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
- package/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
- package/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
- package/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
- package/templates/native-go/backend/internal/helper/write_test.go +53 -0
- package/templates/native-go/dsm-package.yaml +58 -0
- package/templates/native-go/gitignore +1 -0
- package/templates/native-go/i18n/glossary.json +662 -0
- package/templates/native-go/i18n/messages/de.json +28 -0
- package/templates/native-go/i18n/messages/en.json +28 -0
- package/templates/native-go/i18n/messages/es.json +28 -0
- package/templates/native-go/i18n/messages/fr.json +28 -0
- package/templates/native-go/i18n/messages/it.json +28 -0
- package/templates/native-go/i18n/messages/ja.json +28 -0
- package/templates/native-go/i18n/messages/ko.json +28 -0
- package/templates/native-go/i18n/messages/zh-CN.json +28 -0
- package/templates/native-go/i18n/messages/zh-TW.json +28 -0
- package/templates/native-go/ui/app.css +35 -0
- package/templates/native-go/ui/app.js +101 -0
- package/templates/native-go-better-auth/backend/internal/app/identity.go +208 -0
- package/templates/native-go-better-auth/backend/internal/app/identity_test.go +113 -0
- package/templates/native-go-better-auth/node/app.mjs +72 -0
- package/templates/native-go-better-auth/node/build.mjs +4 -0
- package/templates/native-go-better-auth/node/package-lock.json +862 -0
- package/templates/native-go-better-auth/node/package.json +1 -0
- package/templates/native-go-better-auth/node/test/auth.test.mjs +31 -0
- package/templates/native-go-integration/backend/internal/app/identity_none.go +6 -0
- package/templates/native-go-integration/backend/internal/app/personal.go +203 -0
- package/templates/native-go-integration/backend/internal/app/personal_test.go +119 -0
- package/templates/native-go-root/backend/internal/app/root.go +107 -0
- package/templates/native-go-root/backend/internal/app/root_test.go +124 -0
- package/templates/native-go-root/root/whoami.sh +6 -0
- package/templates/native-go-vue/README.md +224 -0
- package/templates/native-go-vue/frontend/DESIGN.md +78 -0
- package/templates/native-go-vue/frontend/package-lock.json +2410 -0
- package/templates/native-go-vue/frontend/package.json +6 -0
- package/templates/native-go-vue/frontend/src/App.vue +159 -0
- package/templates/native-go-vue/frontend/src/context.ts +56 -0
- package/templates/native-go-vue/frontend/src/main.ts +29 -0
- package/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
- package/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
- package/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
- package/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
- package/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
- package/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
- package/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
- package/templates/native-go-vue/frontend/src/style.css +31 -0
- package/templates/native-go-vue/frontend/test/apps.test.ts +190 -0
- package/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
- package/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
- package/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
- package/templates/native-go-vue/frontend/tsconfig.json +1 -0
- package/templates/native-go-vue/frontend/vite.config.ts +10 -0
- package/templates/native-go-vue/gitignore +2 -0
- package/dist/attestation/app-package.d.ts +0 -86
- package/dist/attestation/app-package.js +0 -206
- package/dist/attestation/install-on-host.d.ts +0 -14
- package/dist/attestation/install-on-host.js +0 -52
- package/dist/attestation/keyring.d.ts +0 -21
- package/dist/attestation/keyring.js +0 -168
- package/dist/attestation/platform-service.d.ts +0 -70
- package/dist/attestation/platform-service.js +0 -250
- package/dist/build-spk/broker-glue.d.ts +0 -16
- package/dist/build-spk/broker-glue.js +0 -40
- package/dist/deploy/catalog-publish.d.ts +0 -3
- package/dist/deploy/catalog-publish.js +0 -7
- package/dist/doctor.d.ts +0 -22
- package/dist/doctor.js +0 -822
- package/dist/error-collector.d.ts +0 -2
- package/dist/error-collector.js +0 -46
- package/dist/host/broker-paths.d.ts +0 -1
- package/dist/host/broker-paths.js +0 -1
- package/dist/host/broker-upgrade-preflight.d.ts +0 -61
- package/dist/host/broker-upgrade-preflight.js +0 -156
- package/dist/host/digests.d.ts +0 -5
- package/dist/host/digests.js +0 -63
- package/dist/host/fake-nas.d.ts +0 -49
- package/dist/host/fake-nas.js +0 -193
- package/dist/mock-broker/bootstrap.d.ts +0 -2
- package/dist/mock-broker/bootstrap.js +0 -8
- package/dist/mock-broker/files.d.ts +0 -60
- package/dist/mock-broker/files.js +0 -408
- package/dist/mock-broker/oidc.d.ts +0 -31
- package/dist/mock-broker/oidc.js +0 -161
- package/dist/mock-broker/path.d.ts +0 -9
- package/dist/mock-broker/path.js +0 -50
- package/dist/mock-broker/server.d.ts +0 -19
- package/dist/mock-broker/server.js +0 -350
- package/dist/publish/build-ledger.d.ts +0 -22
- package/dist/publish/build-ledger.js +0 -26
- package/dist/publish/community-path.d.ts +0 -6
- package/dist/publish/community-path.js +0 -41
- package/dist/publish/curated-release.d.ts +0 -78
- package/dist/publish/curated-release.js +0 -883
- package/dist/publish/file-build-ledger.d.ts +0 -18
- package/dist/publish/file-build-ledger.js +0 -268
- package/dist/publish/github-pr.d.ts +0 -25
- package/dist/publish/github-pr.js +0 -85
- package/dist/publish/github-repo.d.ts +0 -8
- package/dist/publish/github-repo.js +0 -21
- package/dist/publish/platform-service-release.d.ts +0 -60
- package/dist/publish/platform-service-release.js +0 -333
- package/dist/publish/preflight.d.ts +0 -24
- package/dist/publish/preflight.js +0 -138
- package/dist/publish/publish.d.ts +0 -27
- package/dist/publish/publish.js +0 -136
- package/dist/publish/sync-definition.d.ts +0 -4
- package/dist/publish/sync-definition.js +0 -48
- package/dist/release-bin.d.ts +0 -2
- package/dist/release-bin.js +0 -23
- package/dist/templates/hello-web/html/sdk.js +0 -68
- package/dist/templates/hello-web-page/html/sdk.js +0 -68
- package/dist/templates/native/synology-app.yaml +0 -7
- package/dist/test-host.d.ts +0 -15
- package/dist/test-host.js +0 -37
- package/templates/hello-web/html/sdk.js +0 -68
- package/templates/hello-web-page/html/sdk.js +0 -68
- package/templates/native/synology-app.yaml +0 -7
- /package/dist/templates/{native → binary}/native.yaml +0 -0
- /package/templates/{native → binary}/native.yaml +0 -0
package/dist/doctor.js
DELETED
|
@@ -1,822 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { validateProject } from "./validate.js";
|
|
4
|
-
import { resolveDeployIdentity } from "./deploy/identity.js";
|
|
5
|
-
import { loadContract } from "./contract/load.js";
|
|
6
|
-
import { getErrorCode } from "./error-registry.js";
|
|
7
|
-
import { dsmFetch } from "./host/dsm-http.js";
|
|
8
|
-
import { appOriginFromContract } from "./host/open-url.js";
|
|
9
|
-
import { DSM_PORT_PROFILE_PRECISION_WARNING, } from "./host/dsm-port-profile.js";
|
|
10
|
-
function packageRouteFromDiagnostics(diagnostics) {
|
|
11
|
-
switch (diagnostics?.packageRoute) {
|
|
12
|
-
case "package-only":
|
|
13
|
-
case "broker-installer":
|
|
14
|
-
case "unknown":
|
|
15
|
-
return diagnostics.packageRoute;
|
|
16
|
-
default:
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
// Keep compatibility with the boolean-only response emitted by older
|
|
20
|
-
// Brokers, but never infer broker-installer from missing evidence.
|
|
21
|
-
return diagnostics?.isPackageOnly === true ? "package-only" : "unknown";
|
|
22
|
-
}
|
|
23
|
-
const PROJECT_FOUR_FILES = ["synology-app.yaml", "README.md", "icon.png"];
|
|
24
|
-
function packageFailureSummary(state) {
|
|
25
|
-
const fields = [];
|
|
26
|
-
if (state.error?.code !== undefined) {
|
|
27
|
-
fields.push(`error.code=${state.error.code}`);
|
|
28
|
-
}
|
|
29
|
-
if (state.error?.description) {
|
|
30
|
-
fields.push(`description=${state.error.description}`);
|
|
31
|
-
}
|
|
32
|
-
if (state.brokenBy) {
|
|
33
|
-
fields.push(`broken_by=${state.brokenBy}`);
|
|
34
|
-
}
|
|
35
|
-
if (state.stage) {
|
|
36
|
-
fields.push(`stage=${state.stage}`);
|
|
37
|
-
}
|
|
38
|
-
if (state.lastStage) {
|
|
39
|
-
fields.push(`last_stage=${state.lastStage}`);
|
|
40
|
-
}
|
|
41
|
-
if (state.statusCode !== undefined) {
|
|
42
|
-
fields.push(`statusCode=${state.statusCode}`);
|
|
43
|
-
}
|
|
44
|
-
if (state.statusDescription) {
|
|
45
|
-
fields.push(`statusDescription=${state.statusDescription}`);
|
|
46
|
-
}
|
|
47
|
-
if (state.statusOrigin) {
|
|
48
|
-
fields.push(`statusOrigin=${state.statusOrigin}`);
|
|
49
|
-
}
|
|
50
|
-
if (state.error?.code === undefined && !state.error?.description && !state.stage) {
|
|
51
|
-
fields.push("event.error/stage 未由 Package API 回傳");
|
|
52
|
-
}
|
|
53
|
-
if (fields.length === 0) {
|
|
54
|
-
return "DSM API 未回傳可用的失敗欄位";
|
|
55
|
-
}
|
|
56
|
-
return `DSM 回報:${fields.join(";")}`;
|
|
57
|
-
}
|
|
58
|
-
function packageFailureSuggestion(state) {
|
|
59
|
-
const diagnosis = state.error?.code === 276
|
|
60
|
-
? "DSM error 276(postinst worker acquire 失敗)常見原因是 Compose command 含純數字元素,或發布的 port 已被占用;請把數字參數併入 flag/用 sh -c 包成單一字串,並確認 host port 未被其他服務使用。"
|
|
61
|
-
: state.error?.code === undefined &&
|
|
62
|
-
state.statusCode === 150 &&
|
|
63
|
-
state.brokenBy === "install_corruption"
|
|
64
|
-
? "DSM Package API 未回傳 event error.code;同類 install_corruption/status 150 的實機 event 曾對應 error 276。常見原因是 Compose command 含純數字元素,或發布的 port 已被占用;請把數字參數併入 flag/用 sh -c 包成單一字串,並確認 host port 未被其他服務使用。"
|
|
65
|
-
: "請依 DSM 回報的欄位檢查 Package Center 安裝流程與 Compose 設定,必要時重新安裝套件。";
|
|
66
|
-
const workerMessage = state.error?.workerMsg && state.error.workerMsg.length > 0
|
|
67
|
-
? `DSM API 已提供 ${state.error.workerMsg.length} 筆 worker_msg;`
|
|
68
|
-
: "DSM API 的 worker_msg 實測為空或未提供;";
|
|
69
|
-
return `${diagnosis} ${workerMessage}worker 內部完整訊息只存在 NAS 的 /var/log/synoplugin.log(需 root),doctor 不會假裝取得。`;
|
|
70
|
-
}
|
|
71
|
-
function formatDsmPortProfile(profile) {
|
|
72
|
-
const ports = profile.dstPorts
|
|
73
|
-
.map((range) => range.start === range.end ? String(range.start) : `${range.start}-${range.end}`)
|
|
74
|
-
.join(",");
|
|
75
|
-
return `${profile.containerName} (project ${profile.projectName}, port ${ports})`;
|
|
76
|
-
}
|
|
77
|
-
function formatDsmPortProfiles(profiles) {
|
|
78
|
-
return profiles.map(formatDsmPortProfile).join(";");
|
|
79
|
-
}
|
|
80
|
-
function brokerPortProfileNames(residue) {
|
|
81
|
-
return new Set((residue?.items ?? [])
|
|
82
|
-
.filter((item) => item.kind === "port_profile_sc")
|
|
83
|
-
.map((item) => item.name));
|
|
84
|
-
}
|
|
85
|
-
async function appendDsmPortProfileCheck(checks, host, options) {
|
|
86
|
-
// The API fallback is authoritative only when the Broker is absent. An
|
|
87
|
-
// installed-but-unready Broker has no trustworthy residue conclusion, so do
|
|
88
|
-
// not silently substitute a lower-precision result for it.
|
|
89
|
-
if (!options.brokerReady && options.brokerInstalled !== false) {
|
|
90
|
-
checks.push({
|
|
91
|
-
id: "host.dsm_port_profile",
|
|
92
|
-
status: "skip",
|
|
93
|
-
message: "Broker 未就緒,略過 DSM PortInfo port profile 盤點",
|
|
94
|
-
});
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (!host.getDsmPortProfileInventory) {
|
|
98
|
-
checks.push({
|
|
99
|
-
id: "host.dsm_port_profile",
|
|
100
|
-
status: "skip",
|
|
101
|
-
message: "DSM PortInfo API 能力不可用,略過 port profile 盤點",
|
|
102
|
-
});
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
let inventory;
|
|
106
|
-
try {
|
|
107
|
-
inventory = await host.getDsmPortProfileInventory();
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
inventory = undefined;
|
|
111
|
-
}
|
|
112
|
-
if (!inventory) {
|
|
113
|
-
checks.push({
|
|
114
|
-
id: "host.dsm_port_profile",
|
|
115
|
-
status: "skip",
|
|
116
|
-
message: "DSM PortInfo API 或已安裝套件清單無法取得,略過 port profile 盤點",
|
|
117
|
-
});
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (options.brokerReady) {
|
|
121
|
-
const apiNames = new Set(inventory.orphaned.map((profile) => profile.containerName));
|
|
122
|
-
const brokerNames = brokerPortProfileNames(options.brokerResidue);
|
|
123
|
-
const agrees = options.brokerResidue !== undefined &&
|
|
124
|
-
apiNames.size === brokerNames.size &&
|
|
125
|
-
[...apiNames].every((name) => brokerNames.has(name));
|
|
126
|
-
if (agrees) {
|
|
127
|
-
checks.push({
|
|
128
|
-
id: "host.dsm_port_profile",
|
|
129
|
-
status: "pass",
|
|
130
|
-
message: `DSM PortInfo API 交叉檢查與 Broker 的 port profile 結果一致(${apiNames.size} 筆;Broker 判定優先)`,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
const apiDetail = inventory.orphaned.length > 0
|
|
135
|
-
? `API 候選 ${inventory.orphaned.length} 筆:${formatDsmPortProfiles(inventory.orphaned)}`
|
|
136
|
-
: "API 未發現候選";
|
|
137
|
-
checks.push({
|
|
138
|
-
id: "host.dsm_port_profile",
|
|
139
|
-
status: "skip",
|
|
140
|
-
message: `DSM PortInfo API 交叉檢查${apiDetail};Broker 判定優先,未覆蓋 host.dsm_residue(${DSM_PORT_PROFILE_PRECISION_WARNING})`,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
// No Broker: this is the primary result, but explicitly expose the one
|
|
146
|
-
// precision gap that the administrator session cannot close.
|
|
147
|
-
if (inventory.orphaned.length > 0) {
|
|
148
|
-
checks.push({
|
|
149
|
-
id: "host.dsm_port_profile",
|
|
150
|
-
status: "warn",
|
|
151
|
-
message: `發現 ${inventory.orphaned.length} 筆 DSM port profile 疑似孤兒(${DSM_PORT_PROFILE_PRECISION_WARNING}):${formatDsmPortProfiles(inventory.orphaned)}`,
|
|
152
|
-
suggestion: "這是未經 conf/resource 交叉比對的 API 候選;請先人工確認 Compose project 名,再由管理員清理。",
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
checks.push({
|
|
157
|
-
id: "host.dsm_port_profile",
|
|
158
|
-
status: "pass",
|
|
159
|
-
message: `無 DSM port profile 孤兒候選(${DSM_PORT_PROFILE_PRECISION_WARNING})`,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
export async function runDoctor(options) {
|
|
164
|
-
const checks = [];
|
|
165
|
-
// --- 1. Local checks (Always run) ---
|
|
166
|
-
if (!options.project) {
|
|
167
|
-
const errorEntry = getErrorCode("PROJECT_FILES_MISSING");
|
|
168
|
-
checks.push({
|
|
169
|
-
id: "project.files",
|
|
170
|
-
status: "fail",
|
|
171
|
-
code: "PROJECT_FILES_MISSING",
|
|
172
|
-
message: "找不到 synology-app.yaml。請在專案根目錄執行,或使用 --project 指定。",
|
|
173
|
-
suggestion: errorEntry?.suggestion ?? "請在 App 專案根目錄執行 doctor,或使用 synopkgland init 建立專案。",
|
|
174
|
-
});
|
|
175
|
-
checks.push({
|
|
176
|
-
id: "project.validate",
|
|
177
|
-
status: "skip",
|
|
178
|
-
message: "專案不存在,略過合約與 Compose 靜態驗證",
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
const project = options.project;
|
|
183
|
-
// Check 1.1: Project four files
|
|
184
|
-
// In a Compose project: synology-app.yaml, compose.yaml
|
|
185
|
-
// In a Native project: synology-app.yaml, native.yaml
|
|
186
|
-
// Additional packaging files (README.md, icon.png) are checked as well.
|
|
187
|
-
const missingFiles = [];
|
|
188
|
-
if (!existsSync(project.contractPath)) {
|
|
189
|
-
missingFiles.push("synology-app.yaml");
|
|
190
|
-
}
|
|
191
|
-
const hasCompose = existsSync(project.composePath);
|
|
192
|
-
const hasNative = existsSync(project.nativePath ?? join(project.root, "native.yaml"));
|
|
193
|
-
if (!hasCompose && !hasNative) {
|
|
194
|
-
missingFiles.push("compose.yaml 或 native.yaml");
|
|
195
|
-
}
|
|
196
|
-
if (missingFiles.length > 0) {
|
|
197
|
-
const errorEntry = getErrorCode("PROJECT_FILES_MISSING");
|
|
198
|
-
checks.push({
|
|
199
|
-
id: "project.files",
|
|
200
|
-
status: "fail",
|
|
201
|
-
code: "PROJECT_FILES_MISSING",
|
|
202
|
-
message: `專案缺少核心定義檔案:${missingFiles.join(", ")}`,
|
|
203
|
-
suggestion: errorEntry?.suggestion ?? "請補齊缺失的專案核心檔案。",
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
const packagingNotice = ["README.md", "icon.png"].filter((f) => !existsSync(join(project.root, f)));
|
|
208
|
-
const detail = packagingNotice.length > 0 ? `(公開發布建議補齊 ${packagingNotice.join(", ")})` : "";
|
|
209
|
-
checks.push({
|
|
210
|
-
id: "project.files",
|
|
211
|
-
status: "pass",
|
|
212
|
-
message: `專案核心定義檔案皆存在${detail}`,
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
// Check 1.2: Contract / Compose / Native validation (reuses analyzer)
|
|
216
|
-
const validation = validateProject(project, { profile: "personal" });
|
|
217
|
-
if (!validation.ok) {
|
|
218
|
-
const firstError = validation.errors[0];
|
|
219
|
-
const code = firstError?.code ?? "VALIDATION_FAILED";
|
|
220
|
-
const errorEntry = getErrorCode(code);
|
|
221
|
-
checks.push({
|
|
222
|
-
id: "project.validate",
|
|
223
|
-
status: "fail",
|
|
224
|
-
code,
|
|
225
|
-
message: firstError ? `${firstError.message}` : "專案合約或 Compose 驗證失敗",
|
|
226
|
-
suggestion: firstError?.suggestion ?? errorEntry?.suggestion ?? "請執行 synopkgland validate 修正錯誤。",
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
checks.push({
|
|
231
|
-
id: "project.validate",
|
|
232
|
-
status: "pass",
|
|
233
|
-
message: "合約與 Compose / Native 靜態驗證通過",
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
// Check 1.3: CLI toolchain version drift
|
|
238
|
-
let cliVersion = "unknown";
|
|
239
|
-
try {
|
|
240
|
-
const pkgJsonPath = new URL("../package.json", import.meta.url);
|
|
241
|
-
const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf8"));
|
|
242
|
-
cliVersion = pkg.version ?? "unknown";
|
|
243
|
-
}
|
|
244
|
-
catch {
|
|
245
|
-
// ignore
|
|
246
|
-
}
|
|
247
|
-
let toolchainVersion;
|
|
248
|
-
const projectRoot = options.project ? options.project.root : process.cwd();
|
|
249
|
-
const toolchainScriptPath = join(projectRoot, "..", "ci", "standalone-toolchain.sh");
|
|
250
|
-
if (existsSync(toolchainScriptPath)) {
|
|
251
|
-
try {
|
|
252
|
-
const script = readFileSync(toolchainScriptPath, "utf8");
|
|
253
|
-
const match = /TOOLCHAIN_VERSION="([^"]+)"/.exec(script);
|
|
254
|
-
if (match?.[1]) {
|
|
255
|
-
toolchainVersion = match[1];
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
catch {
|
|
259
|
-
// ignore
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
if (toolchainVersion && cliVersion !== "unknown" && cliVersion !== toolchainVersion) {
|
|
263
|
-
const errorEntry = getErrorCode("CLI_VERSION_DRIFT");
|
|
264
|
-
checks.push({
|
|
265
|
-
id: "cli.version",
|
|
266
|
-
status: "fail",
|
|
267
|
-
code: "CLI_VERSION_DRIFT",
|
|
268
|
-
message: `CLI 版本 (${cliVersion}) 與 CI TOOLCHAIN_VERSION (${toolchainVersion}) 不一致`,
|
|
269
|
-
suggestion: errorEntry?.suggestion ?? "請更新 CLI 或 CI 設定使版本一致。",
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
checks.push({
|
|
274
|
-
id: "cli.version",
|
|
275
|
-
status: "pass",
|
|
276
|
-
message: `CLI 版本 (${cliVersion}) 正常`,
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
// --- 2. Host checks ---
|
|
280
|
-
if (!options.host) {
|
|
281
|
-
checks.push({
|
|
282
|
-
id: "host.reachability",
|
|
283
|
-
status: "skip",
|
|
284
|
-
message: "未指定 --host,略過 NAS 檢查",
|
|
285
|
-
});
|
|
286
|
-
checks.push({
|
|
287
|
-
id: "host.broker",
|
|
288
|
-
status: "skip",
|
|
289
|
-
message: "未指定 --host,略過 Broker 檢查",
|
|
290
|
-
});
|
|
291
|
-
checks.push({
|
|
292
|
-
id: "host.attestation_trust_root",
|
|
293
|
-
status: "skip",
|
|
294
|
-
message: "未指定 --host,略過 Attestation Trust Root 檢查",
|
|
295
|
-
});
|
|
296
|
-
if (options.packageId) {
|
|
297
|
-
checks.push({
|
|
298
|
-
id: "host.package_binding",
|
|
299
|
-
status: "skip",
|
|
300
|
-
message: "未指定 --host,略過 Package Binding 檢查",
|
|
301
|
-
});
|
|
302
|
-
checks.push({
|
|
303
|
-
id: "host.trusted_app_entry",
|
|
304
|
-
status: "skip",
|
|
305
|
-
message: "未指定 --host,略過 Trusted App Entry 檢查",
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
checks.push({
|
|
309
|
-
id: "host.oidc_origin",
|
|
310
|
-
status: "skip",
|
|
311
|
-
message: "未指定 --host,略過 OIDC origin 檢查",
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
const host = options.host;
|
|
316
|
-
// Check 2.1: NAS Reachability
|
|
317
|
-
let isReachable = false;
|
|
318
|
-
try {
|
|
319
|
-
// Use getInstalledPackageVersion probe or fetch
|
|
320
|
-
await host.isPackageInstalled("SynoPkgLandService");
|
|
321
|
-
isReachable = true;
|
|
322
|
-
checks.push({
|
|
323
|
-
id: "host.reachability",
|
|
324
|
-
status: "pass",
|
|
325
|
-
message: `成功連線至 NAS (${host.dsmOrigin})`,
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
catch (error) {
|
|
329
|
-
const errorEntry = getErrorCode("HOST_UNREACHABLE");
|
|
330
|
-
const errStr = error instanceof Error ? error.message : String(error);
|
|
331
|
-
const isNodeUnreach = errStr.includes("EHOSTUNREACH") || errStr.includes("ENETUNREACH");
|
|
332
|
-
const suggestion = isNodeUnreach
|
|
333
|
-
? "連線失敗 (EHOSTUNREACH)。已內建 curl fallback,請確認 NAS IP/網址可達且防火牆允許連線。"
|
|
334
|
-
: (errorEntry?.suggestion ?? "請檢查 NAS 位址與憑證。");
|
|
335
|
-
checks.push({
|
|
336
|
-
id: "host.reachability",
|
|
337
|
-
status: "fail",
|
|
338
|
-
code: "HOST_UNREACHABLE",
|
|
339
|
-
message: `無法連線至 NAS (${host.dsmOrigin}):${errStr}`,
|
|
340
|
-
suggestion,
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
if (!isReachable) {
|
|
344
|
-
checks.push({
|
|
345
|
-
id: "host.broker",
|
|
346
|
-
status: "skip",
|
|
347
|
-
message: "NAS 無法連線,略過 Broker 檢查",
|
|
348
|
-
});
|
|
349
|
-
checks.push({
|
|
350
|
-
id: "host.attestation_trust_root",
|
|
351
|
-
status: "skip",
|
|
352
|
-
message: "NAS 無法連線,略過 Attestation Trust Root 檢查",
|
|
353
|
-
});
|
|
354
|
-
checks.push({
|
|
355
|
-
id: "host.oidc_origin",
|
|
356
|
-
status: "skip",
|
|
357
|
-
message: "NAS 無法連線,略過 OIDC origin 檢查",
|
|
358
|
-
});
|
|
359
|
-
if (options.packageId) {
|
|
360
|
-
checks.push({
|
|
361
|
-
id: "host.package_binding",
|
|
362
|
-
status: "skip",
|
|
363
|
-
message: "NAS 無法連線,略過 Package Binding 檢查",
|
|
364
|
-
});
|
|
365
|
-
checks.push({
|
|
366
|
-
id: "host.trusted_app_entry",
|
|
367
|
-
status: "skip",
|
|
368
|
-
message: "NAS 無法連線,略過 Trusted App Entry 檢查",
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
// Check 2.2: Broker installed / running
|
|
374
|
-
let isBrokerReady = false;
|
|
375
|
-
let brokerInstalled;
|
|
376
|
-
try {
|
|
377
|
-
brokerInstalled = await host.isPackageInstalled("SynoPkgLandService");
|
|
378
|
-
if (!brokerInstalled) {
|
|
379
|
-
const errorEntry = getErrorCode("BROKER_NOT_INSTALLED");
|
|
380
|
-
checks.push({
|
|
381
|
-
id: "host.broker",
|
|
382
|
-
status: "fail",
|
|
383
|
-
code: "BROKER_NOT_INSTALLED",
|
|
384
|
-
message: "目標 NAS 尚未安裝 SynoPkgLandService (Broker)",
|
|
385
|
-
suggestion: errorEntry?.suggestion ?? "請至 DSM Package Center 安裝 SynoPkgLandService 套件。",
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
// Probe inner-loop API
|
|
390
|
-
try {
|
|
391
|
-
await host.getAttestationInfo("probe");
|
|
392
|
-
isBrokerReady = true;
|
|
393
|
-
checks.push({
|
|
394
|
-
id: "host.broker",
|
|
395
|
-
status: "pass",
|
|
396
|
-
message: "SynoPkgLandService (Broker) 已安裝且運作中",
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
catch (innerErr) {
|
|
400
|
-
const errCode = innerErr?.code;
|
|
401
|
-
if (errCode === "INNER_LOOP_API_MISSING") {
|
|
402
|
-
const errorEntry = getErrorCode("INNER_LOOP_API_MISSING");
|
|
403
|
-
checks.push({
|
|
404
|
-
id: "host.broker",
|
|
405
|
-
status: "fail",
|
|
406
|
-
code: "INNER_LOOP_API_MISSING",
|
|
407
|
-
message: "Broker inner-loop API 不可用,版本可能過舊",
|
|
408
|
-
suggestion: errorEntry?.suggestion ?? "請升級 SynoPkgLandService 套件至最新版本。",
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
isBrokerReady = true;
|
|
413
|
-
checks.push({
|
|
414
|
-
id: "host.broker",
|
|
415
|
-
status: "pass",
|
|
416
|
-
message: "SynoPkgLandService (Broker) 運作中",
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
catch (err) {
|
|
423
|
-
const errorEntry = getErrorCode("BROKER_NOT_INSTALLED");
|
|
424
|
-
checks.push({
|
|
425
|
-
id: "host.broker",
|
|
426
|
-
status: "fail",
|
|
427
|
-
code: "BROKER_NOT_INSTALLED",
|
|
428
|
-
message: `Broker 狀態檢查失敗:${err instanceof Error ? err.message : String(err)}`,
|
|
429
|
-
suggestion: errorEntry?.suggestion ?? "請確認 SynoPkgLandService 已安裝並正常啟動。",
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
// Check 2.3: Attestation Trust Root
|
|
433
|
-
if (!isBrokerReady) {
|
|
434
|
-
checks.push({
|
|
435
|
-
id: "host.attestation_trust_root",
|
|
436
|
-
status: "skip",
|
|
437
|
-
message: "Broker 未就緒,略過 Trust Root 檢查",
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
else {
|
|
441
|
-
// Probe trust root availability
|
|
442
|
-
try {
|
|
443
|
-
const info = await host.getAttestationInfo("probe");
|
|
444
|
-
if (info.attestationKind === "none") {
|
|
445
|
-
// Not broken, trust root is fine or absent
|
|
446
|
-
checks.push({
|
|
447
|
-
id: "host.attestation_trust_root",
|
|
448
|
-
status: "pass",
|
|
449
|
-
message: "Broker Attestation API 已連通",
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
checks.push({
|
|
454
|
-
id: "host.attestation_trust_root",
|
|
455
|
-
status: "pass",
|
|
456
|
-
message: "Broker Attestation API 已連通",
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
catch (attErr) {
|
|
461
|
-
const errCode = attErr?.code;
|
|
462
|
-
if (errCode === "ATTESTATION_TRUST_ROOT_MISSING") {
|
|
463
|
-
const errorEntry = getErrorCode("ATTESTATION_TRUST_ROOT_MISSING");
|
|
464
|
-
checks.push({
|
|
465
|
-
id: "host.attestation_trust_root",
|
|
466
|
-
status: "fail",
|
|
467
|
-
code: "ATTESTATION_TRUST_ROOT_MISSING",
|
|
468
|
-
message: "Broker 缺少生產環境 Attestation Trust Root 信任根憑證",
|
|
469
|
-
suggestion: errorEntry?.suggestion ?? "請確認 SynoPkgLandService 套件完整安裝且 trust root keyring 未被移除。",
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
else if (errCode === "ATTESTATION_MISSING") {
|
|
473
|
-
const errorEntry = getErrorCode("ATTESTATION_MISSING");
|
|
474
|
-
checks.push({
|
|
475
|
-
id: "host.attestation_trust_root",
|
|
476
|
-
status: "fail",
|
|
477
|
-
code: "ATTESTATION_MISSING",
|
|
478
|
-
message: "App Bundle 缺少必要的 Attestation 簽章憑證",
|
|
479
|
-
suggestion: errorEntry?.suggestion ?? "請先透過 synopkgland deploy 簽發 Local Attestation。",
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
else if (errCode === "ATTESTATION_INVALID") {
|
|
483
|
-
const errorEntry = getErrorCode("ATTESTATION_INVALID");
|
|
484
|
-
checks.push({
|
|
485
|
-
id: "host.attestation_trust_root",
|
|
486
|
-
status: "fail",
|
|
487
|
-
code: "ATTESTATION_INVALID",
|
|
488
|
-
message: "Attestation Token 驗證失敗",
|
|
489
|
-
suggestion: errorEntry?.suggestion ?? "請重新執行 synopkgland deploy 產生新 Attestation。",
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
checks.push({
|
|
494
|
-
id: "host.attestation_trust_root",
|
|
495
|
-
status: "pass",
|
|
496
|
-
message: "Broker Attestation API 已連通",
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
// Check 2.3a: OIDC-compatible public origin. This is deliberately
|
|
502
|
-
// optional so a pre-A39 Broker remains a usable doctor target.
|
|
503
|
-
if (!isBrokerReady || !host.getOidcCompatSettings) {
|
|
504
|
-
checks.push({
|
|
505
|
-
id: "host.oidc_origin",
|
|
506
|
-
status: "skip",
|
|
507
|
-
message: !isBrokerReady
|
|
508
|
-
? "Broker 未就緒,略過 OIDC origin 檢查"
|
|
509
|
-
: "舊版 Broker 沒有 OIDC origin endpoint,略過",
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
else {
|
|
513
|
-
try {
|
|
514
|
-
const oidc = await host.getOidcCompatSettings();
|
|
515
|
-
if (!oidc) {
|
|
516
|
-
checks.push({
|
|
517
|
-
id: "host.oidc_origin",
|
|
518
|
-
status: "skip",
|
|
519
|
-
message: "舊版 Broker 沒有 OIDC origin endpoint,略過",
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
else if (oidc.origin.ready && oidc.origin.hostname) {
|
|
523
|
-
checks.push({
|
|
524
|
-
id: "host.oidc_origin",
|
|
525
|
-
status: "pass",
|
|
526
|
-
message: `${oidc.origin.kind} ${oidc.origin.hostname}`,
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
checks.push({
|
|
531
|
-
id: "host.oidc_origin",
|
|
532
|
-
status: "skip",
|
|
533
|
-
message: `未就緒(${oidc.origin.kind}):${oidc.origin.setupHint}`,
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
catch {
|
|
538
|
-
checks.push({
|
|
539
|
-
id: "host.oidc_origin",
|
|
540
|
-
status: "skip",
|
|
541
|
-
message: "OIDC origin endpoint 無法取得,略過",
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
// Check 2.3b: DSM Residue check (A29)
|
|
546
|
-
let brokerResidue;
|
|
547
|
-
if (isBrokerReady && host.getDsmDiagnostics) {
|
|
548
|
-
try {
|
|
549
|
-
const diag = await host.getDsmDiagnostics("probe");
|
|
550
|
-
if (diag && diag.dsmResidue) {
|
|
551
|
-
const residue = diag.dsmResidue;
|
|
552
|
-
brokerResidue = residue;
|
|
553
|
-
if (residue.items && residue.items.length > 0) {
|
|
554
|
-
const details = residue.items
|
|
555
|
-
.map((item) => `[${item.kind}] ${item.name} (${item.path}):${item.reason}`)
|
|
556
|
-
.join(";");
|
|
557
|
-
checks.push({
|
|
558
|
-
id: "host.dsm_residue",
|
|
559
|
-
status: "warn",
|
|
560
|
-
message: `發現 ${residue.items.length} 筆 DSM 殘留孤兒:${details}`,
|
|
561
|
-
suggestion: "這會讓同 port/同名安裝失敗;需管理員以 root 清理,見 docs/impl/STATUS.md 教訓 17",
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
else {
|
|
565
|
-
checks.push({
|
|
566
|
-
id: "host.dsm_residue",
|
|
567
|
-
status: "pass",
|
|
568
|
-
message: "無 DSM 殘留孤兒(.sc port profile 與 Container Manager 專案乾淨)",
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
catch {
|
|
574
|
-
// If query fails or Broker is old, omit / skip silently to be compatible
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
// Check 2.3c: administrator-only DSM PortInfo fallback / cross-check.
|
|
578
|
-
await appendDsmPortProfileCheck(checks, host, {
|
|
579
|
-
brokerInstalled,
|
|
580
|
-
brokerReady: isBrokerReady,
|
|
581
|
-
brokerResidue,
|
|
582
|
-
});
|
|
583
|
-
// Check 2.4: If packageId is provided (or derived)
|
|
584
|
-
const targetPackageId = options.packageId ?? (options.project ? resolveDeployIdentity(options.project, { dev: options.dev }).packageId : undefined);
|
|
585
|
-
if (targetPackageId) {
|
|
586
|
-
if (brokerInstalled === false) {
|
|
587
|
-
checks.push({
|
|
588
|
-
id: "host.package_binding",
|
|
589
|
-
status: "skip",
|
|
590
|
-
message: `Broker 未安裝,無法查詢套件 ${targetPackageId} 的 Project Binding`,
|
|
591
|
-
});
|
|
592
|
-
checks.push({
|
|
593
|
-
id: "host.trusted_app_entry",
|
|
594
|
-
status: "skip",
|
|
595
|
-
message: `Broker 未安裝,略過套件 ${targetPackageId} 的 Trusted App Entry 探測`,
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
try {
|
|
600
|
-
const isInstalled = await host.isPackageInstalled(targetPackageId);
|
|
601
|
-
if (!isInstalled) {
|
|
602
|
-
checks.push({
|
|
603
|
-
id: "host.package_binding",
|
|
604
|
-
status: "skip",
|
|
605
|
-
message: `套件 ${targetPackageId} 尚未部署至此 NAS`,
|
|
606
|
-
});
|
|
607
|
-
checks.push({
|
|
608
|
-
id: "host.trusted_app_entry",
|
|
609
|
-
status: "skip",
|
|
610
|
-
message: `套件 ${targetPackageId} 未安裝,略過 Web Entry 探測`,
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
else {
|
|
614
|
-
// Check DSM package status first
|
|
615
|
-
let dsmPackageState;
|
|
616
|
-
if (host.getInstalledPackageState) {
|
|
617
|
-
try {
|
|
618
|
-
dsmPackageState = await host.getInstalledPackageState(targetPackageId);
|
|
619
|
-
}
|
|
620
|
-
catch {
|
|
621
|
-
// ignore
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
const isBroken = dsmPackageState?.status !== undefined &&
|
|
625
|
-
/(broken|error|fail|installing|150)/i.test(dsmPackageState.status);
|
|
626
|
-
if (isBroken && dsmPackageState) {
|
|
627
|
-
checks.push({
|
|
628
|
-
id: "host.package_binding",
|
|
629
|
-
status: "fail",
|
|
630
|
-
code: "PACKAGE_BROKEN",
|
|
631
|
-
message: `套件 ${targetPackageId} 在 DSM 處於異常狀態(status: ${dsmPackageState.status})。${packageFailureSummary(dsmPackageState)}`,
|
|
632
|
-
suggestion: packageFailureSuggestion(dsmPackageState),
|
|
633
|
-
});
|
|
634
|
-
checks.push({
|
|
635
|
-
id: "host.trusted_app_entry",
|
|
636
|
-
status: "skip",
|
|
637
|
-
message: `套件 ${targetPackageId} 安裝異常,略過 Web Entry 探測`,
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
else {
|
|
641
|
-
const info = await host.getAttestationInfo(targetPackageId);
|
|
642
|
-
if (info.readiness === "NOT_INSTALLED") {
|
|
643
|
-
// Check the diagnosed route before treating a missing binding
|
|
644
|
-
// as a Broker-installer failure. Unknown is deliberately
|
|
645
|
-
// non-failing because the Broker may not be able to read the
|
|
646
|
-
// DSM package resource.
|
|
647
|
-
let packageRoute = "unknown";
|
|
648
|
-
if (host.getDsmDiagnostics) {
|
|
649
|
-
try {
|
|
650
|
-
const diag = await host.getDsmDiagnostics(targetPackageId);
|
|
651
|
-
packageRoute = packageRouteFromDiagnostics(diag);
|
|
652
|
-
}
|
|
653
|
-
catch {
|
|
654
|
-
// ignore
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
if (packageRoute === "package-only") {
|
|
658
|
-
checks.push({
|
|
659
|
-
id: "host.package_binding",
|
|
660
|
-
status: "skip",
|
|
661
|
-
message: "package-only 路線,無 Broker binding(略過)",
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
else if (packageRoute === "unknown") {
|
|
665
|
-
checks.push({
|
|
666
|
-
id: "host.package_binding",
|
|
667
|
-
status: "skip",
|
|
668
|
-
message: "Broker 無法判定套件路線,略過 Package Binding 檢查",
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
else {
|
|
672
|
-
const errorEntry = getErrorCode("PROJECT_BINDING_NOT_FOUND");
|
|
673
|
-
checks.push({
|
|
674
|
-
id: "host.package_binding",
|
|
675
|
-
status: "fail",
|
|
676
|
-
code: "PROJECT_BINDING_NOT_FOUND",
|
|
677
|
-
message: `套件 ${targetPackageId} 在 Broker 中無有效 Project Binding`,
|
|
678
|
-
suggestion: errorEntry?.suggestion ?? "請執行 synopkgland deploy 重新部署套件。",
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
else if (info.readiness === "PROJECT_BINDING_DRIFTED") {
|
|
683
|
-
const errorEntry = getErrorCode("PROJECT_BINDING_DRIFTED");
|
|
684
|
-
checks.push({
|
|
685
|
-
id: "host.package_binding",
|
|
686
|
-
status: "fail",
|
|
687
|
-
code: "PROJECT_BINDING_DRIFTED",
|
|
688
|
-
message: `套件 ${targetPackageId} Project Binding 發生狀態漂移`,
|
|
689
|
-
suggestion: errorEntry?.suggestion ?? "請執行 synopkgland deploy 重新同步部署。",
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
else if (info.readiness === "PROJECT_BINDING_REMOVED") {
|
|
693
|
-
const errorEntry = getErrorCode("PROJECT_BINDING_REMOVED");
|
|
694
|
-
checks.push({
|
|
695
|
-
id: "host.package_binding",
|
|
696
|
-
status: "fail",
|
|
697
|
-
code: "PROJECT_BINDING_REMOVED",
|
|
698
|
-
message: `套件 ${targetPackageId} Project Binding 已被標記為移除`,
|
|
699
|
-
suggestion: errorEntry?.suggestion ?? "請重新安裝套件。",
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
else if (info.readiness === "PROJECT_BINDING_UNKNOWN") {
|
|
703
|
-
const errorEntry = getErrorCode("PROJECT_BINDING_UNKNOWN");
|
|
704
|
-
checks.push({
|
|
705
|
-
id: "host.package_binding",
|
|
706
|
-
status: "fail",
|
|
707
|
-
code: "PROJECT_BINDING_UNKNOWN",
|
|
708
|
-
message: `套件 ${targetPackageId} Project 狀態暫時無法取得`,
|
|
709
|
-
suggestion: errorEntry?.suggestion ?? "請至 DSM 確認 Container Manager 服務正常運作。",
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
else if (info.readiness === "READINESS_TIMEOUT") {
|
|
713
|
-
const errorEntry = getErrorCode("READINESS_TIMEOUT");
|
|
714
|
-
checks.push({
|
|
715
|
-
id: "host.package_binding",
|
|
716
|
-
status: "fail",
|
|
717
|
-
code: "READINESS_TIMEOUT",
|
|
718
|
-
message: `套件 ${targetPackageId} 啟動逾時`,
|
|
719
|
-
suggestion: errorEntry?.suggestion ?? "請使用 synopkgland log --host <nas> 檢查容器啟動日誌。",
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
else {
|
|
723
|
-
const attNotice = info.attestationKind === "none" ? "未綁定 Attestation" : `Attestation:${info.attestationKind}`;
|
|
724
|
-
checks.push({
|
|
725
|
-
id: "host.package_binding",
|
|
726
|
-
status: "pass",
|
|
727
|
-
message: `Project Binding 正常(狀態:${info.readiness ?? "RUNNING"},${attNotice})`,
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
// Resource-worker SPKs do not register with Broker, so their
|
|
731
|
-
// Broker info has no openUrl even though the generated package
|
|
732
|
-
// still declares a Web entry. Keep the same contract fallback
|
|
733
|
-
// used by `info` and bind it to the explicitly diagnosed ID.
|
|
734
|
-
const contract = options.project
|
|
735
|
-
? loadContract(options.project.contractPath).contract
|
|
736
|
-
: undefined;
|
|
737
|
-
const contractOpenUrl = contract
|
|
738
|
-
? appOriginFromContract(host.dsmOrigin, {
|
|
739
|
-
package: targetPackageId,
|
|
740
|
-
adminprotocol: contract.adminprotocol,
|
|
741
|
-
adminport: contract.adminport,
|
|
742
|
-
})
|
|
743
|
-
: undefined;
|
|
744
|
-
const openUrl = info.openUrl ?? contractOpenUrl;
|
|
745
|
-
const hasDeclaredWebEntry = contract?.adminport !== undefined &&
|
|
746
|
-
contract.adminport !== null &&
|
|
747
|
-
contract.adminport !== "";
|
|
748
|
-
// HTTP probe on Trusted App Entry if an Open URL exists.
|
|
749
|
-
if (openUrl) {
|
|
750
|
-
try {
|
|
751
|
-
const response = await dsmFetch(openUrl);
|
|
752
|
-
if (response.ok) {
|
|
753
|
-
checks.push({
|
|
754
|
-
id: "host.trusted_app_entry",
|
|
755
|
-
status: "pass",
|
|
756
|
-
message: `Trusted App Entry 存取正常 (HTTP ${response.status}):${openUrl}`,
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
else {
|
|
760
|
-
const errorEntry = getErrorCode("TRUSTED_APP_ENTRY_FAILED");
|
|
761
|
-
checks.push({
|
|
762
|
-
id: "host.trusted_app_entry",
|
|
763
|
-
status: "fail",
|
|
764
|
-
code: "TRUSTED_APP_ENTRY_FAILED",
|
|
765
|
-
message: `Trusted App Entry HTTP 探測回傳 ${response.status}(可能為 WEBSTATION_ENTRY_FAILED):${openUrl}`,
|
|
766
|
-
suggestion: errorEntry?.suggestion ?? "請至 DSM Web Station 檢查反向代理與容器連接埠。",
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
catch (httpErr) {
|
|
771
|
-
const errorEntry = getErrorCode("TRUSTED_APP_ENTRY_FAILED");
|
|
772
|
-
checks.push({
|
|
773
|
-
id: "host.trusted_app_entry",
|
|
774
|
-
status: "fail",
|
|
775
|
-
code: "TRUSTED_APP_ENTRY_FAILED",
|
|
776
|
-
message: `無法連線至 Trusted App Entry (${openUrl}):${httpErr instanceof Error ? httpErr.message : String(httpErr)}`,
|
|
777
|
-
suggestion: errorEntry?.suggestion ?? "請檢查容器內部 Web 服務是否正常監聽並啟動。",
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
else {
|
|
782
|
-
checks.push({
|
|
783
|
-
id: "host.trusted_app_entry",
|
|
784
|
-
status: "skip",
|
|
785
|
-
message: hasDeclaredWebEntry
|
|
786
|
-
? "此套件已宣告 Web 入口,但無法取得 Trusted App Entry Open URL,略過探測"
|
|
787
|
-
: options.project
|
|
788
|
-
? "此套件沒有 Web 入口(Headless App),略過 Trusted App Entry 探測"
|
|
789
|
-
: "無法取得此套件的 Trusted App Entry Open URL,略過探測",
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
catch (pkgErr) {
|
|
796
|
-
checks.push({
|
|
797
|
-
id: "host.package_binding",
|
|
798
|
-
status: "skip",
|
|
799
|
-
message: `查詢套件 ${targetPackageId} 狀態失敗:${pkgErr instanceof Error ? pkgErr.message : String(pkgErr)}`,
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
const ok = checks.every((c) => c.status !== "fail");
|
|
807
|
-
return { ok, checks };
|
|
808
|
-
}
|
|
809
|
-
export function formatDoctorReport(report) {
|
|
810
|
-
const lines = [];
|
|
811
|
-
for (const check of report.checks) {
|
|
812
|
-
const symbol = check.status === "pass" ? "[✓]" : check.status === "fail" ? "[✗]" : check.status === "warn" ? "[!]" : "[-]";
|
|
813
|
-
const codeTag = check.code ? ` [${check.code}]` : "";
|
|
814
|
-
lines.push(`${symbol} ${check.id}${codeTag}: ${check.message}`);
|
|
815
|
-
if ((check.status === "fail" || check.status === "warn") && check.suggestion) {
|
|
816
|
-
lines.push(` 建議:${check.suggestion}`);
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
lines.push("");
|
|
820
|
-
lines.push(report.ok ? "診斷全部通過。" : "診斷發現問題,請依照上述建議修正。");
|
|
821
|
-
return lines.join("\n");
|
|
822
|
-
}
|