@synopackageland/cli 0.53.11 → 0.53.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.53.13 (2026-11-11)
4
+
5
+ - `backup.exclude` lists up to 64 globs of data-folder paths (letters, digits, `.`, `_`, `-`, `*`, `?`, `/` between folders) that Hyper Backup application backup leaves out, such as scratch folders and SQLite files still being written. The CLI validates it, writes it into `backup/config.json` and records it in `sdk-package.json`. It takes effect with SDK 0.53.35 or later; an older SDK control ignores it.
6
+ - Backup descriptions (the `check` summary, the `backup` skill and the README) say online backup reads SQLite in place under a read transaction instead of snapshotting it.
7
+ - Generated Apps take templates 0.42.1, whose commented `backup` example shows `exclude`.
8
+
9
+ ## 0.53.12 (2026-11-11)
10
+
11
+ - Root and executor approval reads back a scheduler write that DSM refused before failing. A browser resends a POST whose connection closed before the reply, and DSM runs both copies: the second delete finds no task (`dsm_4802`) and the approval failed although the change had landed. A refused delete whose task is gone counts as deleted, and a refused create that reads back exactly as the requested task counts as created; anything else still fails and rolls back as before.
12
+
3
13
  ## 0.53.11 (2026-11-11)
4
14
 
5
15
  - `check`, `build` and `inspect` accept `--catalog <catalog.yaml>` (or `SYNOPKGLAND_CATALOG`, also from `.env`): a schema 4 catalog entry, selected by its `pins` package name and the exact SPK version, supplies the store text. Before packaging, the build projects it in memory: INFO `description` and the eight `description_<language>` from the long description (paragraph breaks as spaces, not shortened), INFO `changelog` from that version's English notes joined with ` · `, and nine-language `description`, `long_description` and that version's notes in `spk_land_metadata`. The DSM main menu tooltip keeps the short description. `build` writes `release-notes.md` next to the SPKs and reports the catalog SHA-256 as `catalogText`.
package/README.md CHANGED
@@ -206,8 +206,8 @@ runtime and exact DSM task readback. See [the approval guide](skills/reference/a
206
206
 
207
207
  Native Apps appear in Hyper Backup's backup wizard as applications. By default Hyper Backup stops
208
208
  the App, the SDK archives its data folder (the package's `var`) and Hyper Backup starts it again;
209
- a restore replaces that folder. `backup: {online: true}` keeps the App running and snapshots
210
- SQLite databases; `data_version` guards restores of newer data; `hook` runs a packaged
209
+ a restore replaces that folder. `backup: {online: true}` keeps the App running and reads
210
+ SQLite databases in place under a read transaction; `exclude` leaves scratch paths out; `data_version` guards restores of newer data; `hook` runs a packaged
211
211
  `freeze`/`thaw` executable; `backup: {hyper_backup: false}` opts out. Compose Apps are not
212
212
  covered. The build compiles the SDK backup control with Go, also for a prebuilt backend; without
213
213
  Go it skips the default backup with a warning. Hyper Backup runs the generated `scripts/backup/` as root: a fixed script that only
package/dist/cli.js CHANGED
@@ -132,7 +132,7 @@ function formatInstallSettings(settings) {
132
132
  return settings ? Object.entries(settings).map(([key, s]) => `Installation setting ${key}: ${s.type}, ${s.required ? 'required' : 'optional'} (${s.label}); values are private`) : [];
133
133
  }
134
134
  function formatHyperBackup(b) {
135
- return [b ? `Hyper Backup: application backup on, ${b.online ? 'online (App keeps running; SQLite snapshots)' : 'offline (App stopped during export)'}, data version ${b.dataVersion}${b.hook ? `, hook ${b.hook}` : ''}. Hyper Backup runs the fixed backup scripts as root; they only switch to the package account.` : 'Hyper Backup: application backup off'];
135
+ return [b ? `Hyper Backup: application backup on, ${b.online ? 'online (App keeps running; SQLite read in place under a read transaction)' : 'offline (App stopped during export)'}, data version ${b.dataVersion}${b.hook ? `, hook ${b.hook}` : ''}${b.exclude ? `, excluding ${b.exclude.join(', ')}` : ''}. Hyper Backup runs the fixed backup scripts as root; they only switch to the package account.` : 'Hyper Backup: application backup off'];
136
136
  }
137
137
  function formatSpkReport(spk, report) {
138
138
  const hasEntryExceptions = Boolean(report.gateway || report.integrations?.length);
@@ -56,7 +56,7 @@ export const ERROR_REGISTRY = {
56
56
  SDK_PORT_SETTINGS_UNSUPPORTED: { code: "SDK_PORT_SETTINGS_UNSUPPORTED", description: "The selected SDK does not provide installer-selected ports", suggestion: "Pin SDK 0.38.2 or a matching supported release and rebuild with the matching CLI" },
57
57
  SDK_INSTALL_SETTINGS_UNSUPPORTED: { "code": "SDK_INSTALL_SETTINGS_UNSUPPORTED", "description": "The selected SDK does not provide native installation settings.", "suggestion": "Pin SDK 0.24.0 or a matching supported release with installsettings/cmd/control, then rebuild with the matching CLI." },
58
58
  SDK_INSTALL_SETTINGS_BUILD_FAILED: { "code": "SDK_INSTALL_SETTINGS_BUILD_FAILED", "description": "The SDK installation settings controller could not be built.", "suggestion": "Install the pinned Go toolchain, inspect the compiler diagnostics and rebuild with a complete matching SDK release." },
59
- BACKUP_INVALID: { code: "BACKUP_INVALID", description: "The Hyper Backup application backup declaration or its packaged scripts are invalid.", suggestion: "Use backup.hyper_backup: false to opt out, or only online, data_version (\"major.minor\") and hook; rebuild so scripts/backup holds exactly the fixed export, import, info and version files." },
59
+ BACKUP_INVALID: { code: "BACKUP_INVALID", description: "The Hyper Backup application backup declaration or its packaged scripts are invalid.", suggestion: "Use backup.hyper_backup: false to opt out, or only online, data_version (\"major.minor\"), hook and exclude; rebuild so scripts/backup holds exactly the fixed export, import, info and version files." },
60
60
  BACKUP_COMPOSE_UNSUPPORTED: { code: "BACKUP_COMPOSE_UNSUPPORTED", description: "Compose Apps keep their data in container volumes, which application backup does not cover.", suggestion: "Remove backup from a Compose App or set backup.hyper_backup: false." },
61
61
  BACKUP_HOOK_MISSING: { code: "BACKUP_HOOK_MISSING", description: "backup.hook does not name an executable file in the package.", suggestion: "Package the hook (for example in the daemon payload or the App folder) and give its path relative to the package target." },
62
62
  SDK_APP_BACKUP_UNSUPPORTED: { code: "SDK_APP_BACKUP_UNSUPPORTED", description: "The selected SDK does not provide Hyper Backup application backup.", suggestion: "Pin an SDK release with appbackup/cmd/control, or remove the backup declaration; without one the build skips application backup." },
@@ -8,12 +8,14 @@ import type { CommandRunner } from './build.js';
8
8
  * archive; the SDK control does the rest as the package account.
9
9
  */
10
10
  export interface HyperBackup {
11
- /** Export while the App runs; SQLite databases are then snapshotted. */
11
+ /** Export while the App runs; SQLite databases are then read in place under a read transaction. */
12
12
  online: boolean;
13
13
  /** "major.minor"; a backup restores into the same major and an equal or newer minor. */
14
14
  dataVersion: string;
15
15
  /** A package-relative executable run as `<hook> freeze` and `<hook> thaw` around an export. */
16
16
  hook?: string;
17
+ /** Globs of data-folder paths left out of the archive, such as scratch folders. */
18
+ exclude?: string[];
17
19
  /** The App declared `backup`; an SDK without the control is then an error, not a skip. */
18
20
  explicit?: true;
19
21
  }
@@ -11,9 +11,12 @@ export const DEFAULT_HYPER_BACKUP = Object.freeze({ online: false, dataVersion:
11
11
  export const BACKUP_SCRIPTS_DIR = 'scripts/backup';
12
12
  /** The SDK control and its config inside the package payload. */
13
13
  export const BACKUP_PAYLOAD_DIR = 'backup';
14
- const FIELDS = new Set(['hyper_backup', 'online', 'data_version', 'hook']);
14
+ const FIELDS = new Set(['hyper_backup', 'online', 'data_version', 'hook', 'exclude']);
15
+ // The SDK's appbackup.Config.Exclude rule: path.Match globs without sets or escapes.
16
+ const EXCLUDE = /^[A-Za-z0-9._*?-]+(\/[A-Za-z0-9._*?-]+)*$/;
17
+ const excludeList = (v) => Array.isArray(v) && v.length <= 64 && v.every(e => typeof e === 'string' && e.length <= 255 && EXCLUDE.test(e) && e.split('/').every(s => s !== '.' && s !== '..'));
15
18
  const DATA_VERSION = /^(0|[1-9][0-9]{0,3})\.(0|[1-9][0-9]{0,3})$/;
16
- const INVALID = 'backup accepts hyper_backup: false (opt out) or online (boolean), data_version ("major.minor", default "1.0") and hook (a fixed executable inside the package).';
19
+ const INVALID = 'backup accepts hyper_backup: false (opt out) or online (boolean), data_version ("major.minor", default "1.0"), hook (a fixed executable inside the package) and exclude (up to 64 data-folder globs of letters, digits, ".", "_", "-", "*", "?" and "/").';
17
20
  const record = (v) => Boolean(v) && typeof v === 'object' && !Array.isArray(v);
18
21
  export function readHyperBackup(value, context, fail) {
19
22
  const bad = () => { fail({ code: 'BACKUP_INVALID', message: INVALID }); return undefined; };
@@ -27,13 +30,14 @@ export function readHyperBackup(value, context, fail) {
27
30
  return Object.keys(value).length === 1 ? undefined : bad();
28
31
  if ((value.online !== undefined && typeof value.online !== 'boolean') ||
29
32
  (value.data_version !== undefined && (typeof value.data_version !== 'string' || !DATA_VERSION.test(value.data_version))) ||
30
- (value.hook !== undefined && !relativeExec(value.hook)))
33
+ (value.hook !== undefined && !relativeExec(value.hook)) ||
34
+ (value.exclude !== undefined && !excludeList(value.exclude)))
31
35
  return bad();
32
36
  if (context.compose) {
33
37
  fail({ code: 'BACKUP_COMPOSE_UNSUPPORTED', message: 'Hyper Backup application backup covers the package data folder; Compose App data lives in container volumes, so remove backup or set hyper_backup: false.' });
34
38
  return undefined;
35
39
  }
36
- return { online: value.online === true, dataVersion: value.data_version ?? '1.0', ...(value.hook ? { hook: value.hook } : {}), explicit: true };
40
+ return { online: value.online === true, dataVersion: value.data_version ?? '1.0', ...(value.hook ? { hook: value.hook } : {}), ...(value.exclude && value.exclude.length ? { exclude: value.exclude } : {}), explicit: true };
37
41
  }
38
42
  /**
39
43
  * The root-run part. It reads Hyper Backup's temporary folder, refuses a
@@ -61,15 +65,16 @@ export function renderBackupScripts(b) {
61
65
  }
62
66
  export const BACKUP_SCRIPT_MODES = { version: 0o644, info: 0o644, export: 0o755, import: 0o755 };
63
67
  export function backupConfig(pkg, b) {
64
- return JSON.stringify({ schema: 1, package: pkg, dataVersion: b.dataVersion, ...(b.online ? { online: true } : {}), ...(b.hook ? { hook: b.hook } : {}) }, null, 2) + '\n';
68
+ return JSON.stringify({ schema: 1, package: pkg, dataVersion: b.dataVersion, ...(b.online ? { online: true } : {}), ...(b.hook ? { hook: b.hook } : {}), ...(b.exclude ? { exclude: b.exclude } : {}) }, null, 2) + '\n';
65
69
  }
66
70
  /** What sdk-package.json records, without the build-only `explicit`. */
67
71
  export function backupRecord(b) {
68
- return { online: b.online, dataVersion: b.dataVersion, ...(b.hook ? { hook: b.hook } : {}) };
72
+ return { online: b.online, dataVersion: b.dataVersion, ...(b.hook ? { hook: b.hook } : {}), ...(b.exclude ? { exclude: b.exclude } : {}) };
69
73
  }
70
74
  export function readBackupRecord(value) {
71
- if (!record(value) || Object.keys(value).some(k => !['online', 'dataVersion', 'hook'].includes(k)) || typeof value.online !== 'boolean' ||
72
- typeof value.dataVersion !== 'string' || !DATA_VERSION.test(value.dataVersion) || (value.hook !== undefined && !relativeExec(value.hook)))
75
+ if (!record(value) || Object.keys(value).some(k => !['online', 'dataVersion', 'hook', 'exclude'].includes(k)) || typeof value.online !== 'boolean' ||
76
+ typeof value.dataVersion !== 'string' || !DATA_VERSION.test(value.dataVersion) || (value.hook !== undefined && !relativeExec(value.hook)) ||
77
+ (value.exclude !== undefined && (!excludeList(value.exclude) || !value.exclude.length)))
73
78
  return undefined;
74
79
  return backupRecord(value);
75
80
  }
@@ -70,9 +70,20 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
70
70
  params.SynoConfirmPWToken = confirmation.token;
71
71
  return send(boot ? eventAPI + ".Root" : taskAPI + ".Root", "create", boot ? 1 : 4, params);
72
72
  }
73
+ // A browser sends a POST again when its connection closes before the reply,
74
+ // and DSM runs both: the second delete finds no task (4802) and a second
75
+ // Root create is a Noise replay. A refused write is read back: a task that
76
+ // is gone was deleted, and one that reads as exactly the task was created.
73
77
  function remove(task, ref) {
74
78
  var boot = task.kind === "boot";
75
- return send(boot ? eventAPI : taskAPI, "delete", boot ? 1 : 2, boot ? ref : {tasks: [ref]});
79
+ return send(boot ? eventAPI : taskAPI, "delete", boot ? 1 : 2, boot ? ref : {tasks: [ref]}).catch(function (e) {
80
+ return find(task).then(function (current) { if (current.code !== "task_missing") throw e; });
81
+ });
82
+ }
83
+ function place(task, confirmation) {
84
+ return create(task.kind === "boot", definition(task), confirmation).catch(function (e) {
85
+ return find(task).then(function (current) { if (current.state !== "ready") throw e; });
86
+ });
76
87
  }
77
88
  function isAdmin() { return !!options.user() && options.user().admin === true; }
78
89
  function admin() { if (!isAdmin()) throw fail("admin_required"); }
@@ -160,7 +171,7 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
160
171
  if (current.state === "blocked") throw refused(current);
161
172
  if (current.state === "ready") return;
162
173
  if (current.ref) throw refused(current);
163
- return create(earlier.kind === "boot", definition(earlier), confirmation).then(function () { return find(earlier); }).then(function (restored) {
174
+ return place(earlier, confirmation).then(function () { return find(earlier); }).then(function (restored) {
164
175
  if (restored.state !== "ready") throw refused(restored);
165
176
  });
166
177
  }).catch(function (e) { failed = reason(e); });
@@ -199,7 +210,7 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
199
210
  if (current.state === "ready") return;
200
211
  if (current.state === "blocked") throw refused(current);
201
212
  var deleted = current.ref ? remove(task, current.ref).then(function () { removed.push({kind: task.kind, name: task.name, header: task.header, script: current.script}); }) : Promise.resolve();
202
- return deleted.then(function () { return create(task.kind === "boot", definition(task), confirmation); }).then(function () { created.push(task); });
213
+ return deleted.then(function () { return place(task, confirmation); }).then(function () { created.push(task); });
203
214
  }).catch(function (e) { errors[task.kind] = e; });
204
215
  });
205
216
  });
@@ -281,7 +292,7 @@ export const ROOT_RUNTIME = `function createRootAccess(options) {
281
292
  return find(task).then(function (current) {
282
293
  if (current.state === "blocked" || current.state === "unsupported") throw fail("executor_selection_conflict");
283
294
  var removed = current.ref ? remove(task, current.ref) : Promise.resolve();
284
- return removed.then(function () { return create(false, definition(task), confirmation); });
295
+ return removed.then(function () { return place(task, confirmation); });
285
296
  }).then(function () { return find(task); }).then(function (current) {
286
297
  if (current.state !== "ready") throw fail("executor_selection_readback_mismatch");
287
298
  return runAndRead(current.ref, 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.53.11",
3
+ "version": "0.53.13",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@napi-rs/keyring": "^2.1.1",
45
- "@synopackageland/templates": "~0.42.0",
45
+ "@synopackageland/templates": "~0.42.1",
46
46
  "ajv": "^8.17.1",
47
47
  "commander": "^13.1.0",
48
48
  "esbuild": "^0.28.2",
@@ -16,6 +16,7 @@ backup:
16
16
  online: false # default; true keeps the App running during a backup
17
17
  data_version: "1.0" # "major.minor", see below
18
18
  hook: bin/backup-hook # optional, relative to the package target
19
+ exclude: [exports, ".restore-*"] # optional data-folder globs left out
19
20
  ```
20
21
 
21
22
  Opt out with exactly:
@@ -27,10 +28,20 @@ backup:
27
28
 
28
29
  - **Offline** (default): Hyper Backup stops the App, the SDK archives the data
29
30
  folder, and Hyper Backup starts the App again.
30
- - **Online**: the App keeps running; SQLite databases are copied through
31
- SQLite's backup API, their journals are left out, other files are copied as
32
- they are. Use it only when other files stay consistent while the App runs,
33
- or add a hook.
31
+ - **Online**: the App keeps running. Each SQLite database is read in place
32
+ under a read transaction, without a copy; a WAL database's writers keep
33
+ committing, a rollback-journal database's writers wait until it has been
34
+ read. `-shm` and `-journal` files are left out. Other files are read as they
35
+ are, so a file being written meanwhile may be inconsistent: exclude scratch
36
+ folders, or use offline mode or a hook.
37
+ - **Exclude**: up to 64 `path.Match` globs relative to the data folder (`/`
38
+ between folders; letters, digits, `.`, `_`, `-`, `*`, `?`). A matching
39
+ folder is left out whole; `*` does not cross `/`. Exclude scratch data the
40
+ App rebuilds or discards, especially SQLite files still being written (for
41
+ example by `VACUUM INTO`): online backup would otherwise wait for their lock
42
+ or archive them half written. A restore removes excluded paths with the rest
43
+ of the data folder. It needs an SDK whose `appbackup.Config` has `Exclude`; an
44
+ older SDK control ignores it.
34
45
  - **Hook**: a packaged executable run as the package account as `<hook> freeze`
35
46
  before the export and `<hook> thaw` after it. It writes only to standard
36
47
  error. The build fails with `BACKUP_HOOK_MISSING` when the file is not an