feat(sync-ui): sync window renderer, snapshots in /tmp/subminer-db-snapshots, docs + changelog

This commit is contained in:
2026-07-11 18:28:21 -07:00
parent 97aaf44b3c
commit 187437b681
22 changed files with 1657 additions and 88 deletions
+2 -6
View File
@@ -293,12 +293,8 @@ test('runSyncCommand --json emits NDJSON progress events for a two-way host sync
const events = lines.map((line) => JSON.parse(line));
const types = events.map((event) => event.type);
assert.ok(types.includes('stage'));
assert.ok(
events.some((event) => event.type === 'stage' && event.stage === 'snapshot-local'),
);
assert.ok(
events.some((event) => event.type === 'merge-summary' && event.target === 'local'),
);
assert.ok(events.some((event) => event.type === 'stage' && event.stage === 'snapshot-local'));
assert.ok(events.some((event) => event.type === 'merge-summary' && event.target === 'local'));
assert.ok(
events.some(
(event) => event.type === 'remote-output' && event.text.includes('remote summary text'),
+1 -4
View File
@@ -74,10 +74,7 @@ test('parseCliPrograms captures sync --json and --check flags', () => {
});
test('parseCliPrograms rejects invalid sync --check combinations', () => {
assert.throws(
() => parseCliPrograms(['sync', '--check'], 'subminer'),
/--check requires a host/,
);
assert.throws(() => parseCliPrograms(['sync', '--check'], 'subminer'), /--check requires a host/);
assert.throws(
() => parseCliPrograms(['sync', 'media-box', '--check', '--push'], 'subminer'),
/--check cannot be combined/,
+3 -1
View File
@@ -356,7 +356,9 @@ export function parseCliPrograms(
throw new Error('Sync --check requires a host.');
}
if (check && (push || pull || snapshot || merge)) {
throw new Error('Sync --check cannot be combined with --push, --pull, --snapshot, or --merge.');
throw new Error(
'Sync --check cannot be combined with --push, --pull, --snapshot, or --merge.',
);
}
const modes = [Boolean(host), Boolean(snapshot), Boolean(merge)].filter(Boolean).length;
if (modes === 0) {
+6 -4
View File
@@ -43,9 +43,9 @@ export function tableExists(db: Database, tableName: string): boolean {
export function readSchemaVersion(db: Database): number | null {
if (!tableExists(db, 'imm_schema_version')) return null;
const row = db
.query<{ schema_version: number }>(
'SELECT MAX(schema_version) AS schema_version FROM imm_schema_version',
)
.query<{
schema_version: number;
}>('SELECT MAX(schema_version) AS schema_version FROM imm_schema_version')
.get();
return typeof row?.schema_version === 'number' ? row.schema_version : null;
}
@@ -126,7 +126,9 @@ function statsDaemonStateCandidates(dbPath: string): string[] {
});
candidates.add(path.join(configDir, 'stats-daemon.json'));
if (process.platform === 'darwin') {
candidates.add(path.join(homeDir, 'Library', 'Application Support', 'SubMiner', 'stats-daemon.json'));
candidates.add(
path.join(homeDir, 'Library', 'Application Support', 'SubMiner', 'stats-daemon.json'),
);
}
return [...candidates];
}