tabctl 0.5.0 → 0.5.2
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.
|
@@ -78,7 +78,7 @@ function resolveNodePath(options) {
|
|
|
78
78
|
function resolveHostPath(dataDir) {
|
|
79
79
|
// Sync host bundle to stable path so wrapper survives npm upgrades
|
|
80
80
|
try {
|
|
81
|
-
const result = (0, extension_sync_1.syncHost)(dataDir);
|
|
81
|
+
const result = (0, extension_sync_1.syncHost)(dataDir, { force: true });
|
|
82
82
|
return result.hostPath;
|
|
83
83
|
}
|
|
84
84
|
catch (err) {
|
|
@@ -181,7 +181,7 @@ function runSetup(options, prettyOutput) {
|
|
|
181
181
|
const hostPath = resolveHostPath(config.baseDataDir);
|
|
182
182
|
let extensionSync;
|
|
183
183
|
try {
|
|
184
|
-
extensionSync = (0, extension_sync_1.syncExtension)(config.baseDataDir);
|
|
184
|
+
extensionSync = (0, extension_sync_1.syncExtension)(config.baseDataDir, { force: true });
|
|
185
185
|
}
|
|
186
186
|
catch {
|
|
187
187
|
extensionSync = null;
|
package/dist/cli/lib/output.js
CHANGED
|
@@ -65,34 +65,42 @@ function setupStdoutErrorHandling() {
|
|
|
65
65
|
}
|
|
66
66
|
function emitVersionWarnings(response, fallbackAction) {
|
|
67
67
|
const hostVersion = typeof response.version === "string" ? response.version : null;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
process.stderr.write(`[tabctl] host is stale (${hostVersion}), reloading extension...\n`);
|
|
81
|
-
}
|
|
82
|
-
(0, client_1.sendFireAndForget)({ id: (0, client_2.createRequestId)(), action: "reload", params: {} });
|
|
83
|
-
// Check and fix wrapper Node path for the active profile
|
|
68
|
+
const data = response.data;
|
|
69
|
+
const hostBaseVersion = data && typeof data.hostBaseVersion === "string" ? data.hostBaseVersion : null;
|
|
70
|
+
const isDevCli = version_1.DEV_BUILD;
|
|
71
|
+
// CLI ↔ host BASE_VERSION mismatch: auto-upgrade (sync files + trigger reload).
|
|
72
|
+
// Dev builds never sync — they use whatever host is already installed.
|
|
73
|
+
const effectiveHostBase = hostBaseVersion ?? hostVersion;
|
|
74
|
+
if (effectiveHostBase && effectiveHostBase !== version_1.BASE_VERSION && !isDevCli) {
|
|
75
|
+
// Downgrade: host is newer than CLI — warn but don't sync/reload
|
|
76
|
+
if ((0, extension_sync_1.compareBaseVersions)(version_1.BASE_VERSION, effectiveHostBase) < 0) {
|
|
77
|
+
process.stderr.write(`[tabctl] cli (${version_1.BASE_VERSION}) is older than host (${effectiveHostBase}). Consider upgrading: npm install -g tabctl\n`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
84
80
|
try {
|
|
85
|
-
|
|
81
|
+
const config = (0, config_1.resolveConfig)();
|
|
82
|
+
const hostResult = (0, extension_sync_1.syncHost)(config.baseDataDir);
|
|
83
|
+
const extResult = (0, extension_sync_1.syncExtension)(config.baseDataDir);
|
|
84
|
+
const anySynced = hostResult.synced || extResult.synced;
|
|
85
|
+
if (anySynced) {
|
|
86
|
+
process.stderr.write(`[tabctl] upgraded: ${effectiveHostBase} → ${version_1.BASE_VERSION}. Reloading extension...\n`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
process.stderr.write(`[tabctl] host is stale (${effectiveHostBase}), reloading extension...\n`);
|
|
90
|
+
}
|
|
91
|
+
(0, client_1.sendFireAndForget)({ id: (0, client_2.createRequestId)(), action: "reload", params: {} });
|
|
92
|
+
try {
|
|
93
|
+
repairActiveWrapper(config.baseDataDir);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// Wrapper repair is best-effort
|
|
97
|
+
}
|
|
86
98
|
}
|
|
87
99
|
catch {
|
|
88
|
-
|
|
100
|
+
process.stderr.write(`[tabctl] version mismatch: cli ${version_1.BASE_VERSION}, host ${effectiveHostBase}. Run: tabctl setup\n`);
|
|
89
101
|
}
|
|
90
102
|
}
|
|
91
|
-
catch {
|
|
92
|
-
process.stderr.write(`[tabctl] version mismatch: cli ${version_1.VERSION}, host ${hostVersion}. Run: tabctl setup\n`);
|
|
93
|
-
}
|
|
94
103
|
}
|
|
95
|
-
const data = response.data;
|
|
96
104
|
const extensionVersion = data && typeof data.extensionVersion === "string" ? data.extensionVersion : null;
|
|
97
105
|
const extensionComponent = data && typeof data.extensionComponent === "string" ? data.extensionComponent : null;
|
|
98
106
|
if (extensionVersion && hostVersion && extensionVersion !== hostVersion) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Tab Control",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"description": "Archive and manage browser tabs with CLI support",
|
|
6
6
|
"permissions": [
|
|
7
7
|
"tabs",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"background": {
|
|
20
20
|
"service_worker": "background.js"
|
|
21
21
|
},
|
|
22
|
-
"version_name": "0.5.
|
|
22
|
+
"version_name": "0.5.2"
|
|
23
23
|
}
|
package/dist/host/host.bundle.js
CHANGED
|
@@ -128,11 +128,12 @@ var require_version = __commonJS({
|
|
|
128
128
|
"dist/shared/version.js"(exports2) {
|
|
129
129
|
"use strict";
|
|
130
130
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
131
|
-
exports2.DIRTY = exports2.GIT_SHA = exports2.VERSION = exports2.BASE_VERSION = void 0;
|
|
132
|
-
exports2.BASE_VERSION = "0.5.
|
|
133
|
-
exports2.VERSION = "0.5.
|
|
134
|
-
exports2.GIT_SHA =
|
|
131
|
+
exports2.DEV_BUILD = exports2.DIRTY = exports2.GIT_SHA = exports2.VERSION = exports2.BASE_VERSION = void 0;
|
|
132
|
+
exports2.BASE_VERSION = "0.5.2";
|
|
133
|
+
exports2.VERSION = "0.5.2";
|
|
134
|
+
exports2.GIT_SHA = "c90b26ba";
|
|
135
135
|
exports2.DIRTY = false;
|
|
136
|
+
exports2.DEV_BUILD = false;
|
|
136
137
|
}
|
|
137
138
|
});
|
|
138
139
|
|
|
@@ -11,6 +11,8 @@ exports.resolveInstalledExtensionDir = resolveInstalledExtensionDir;
|
|
|
11
11
|
exports.resolveInstalledHostPath = resolveInstalledHostPath;
|
|
12
12
|
exports.readExtensionVersion = readExtensionVersion;
|
|
13
13
|
exports.readHostVersion = readHostVersion;
|
|
14
|
+
exports.compareBaseVersions = compareBaseVersions;
|
|
15
|
+
exports.isDevBuild = isDevBuild;
|
|
14
16
|
exports.syncExtension = syncExtension;
|
|
15
17
|
exports.syncHost = syncHost;
|
|
16
18
|
exports.checkExtensionSync = checkExtensionSync;
|
|
@@ -18,6 +20,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
18
20
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
19
21
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
20
22
|
const config_1 = require("./config");
|
|
23
|
+
const version_1 = require("./version");
|
|
21
24
|
exports.EXTENSION_DIR_NAME = "extension";
|
|
22
25
|
exports.HOST_BUNDLE_NAME = "host.bundle.js";
|
|
23
26
|
/**
|
|
@@ -72,11 +75,44 @@ function readHostVersion(hostPath) {
|
|
|
72
75
|
return null;
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Compare two semver versions by their base (major.minor.patch) components.
|
|
80
|
+
* Strips any prerelease/build metadata before comparing.
|
|
81
|
+
* Returns -1 if a < b, 0 if equal, 1 if a > b.
|
|
82
|
+
*/
|
|
83
|
+
function compareBaseVersions(a, b) {
|
|
84
|
+
const strip = (v) => v.replace(/[-+].*$/, "");
|
|
85
|
+
const pa = strip(a).split(".").map(Number);
|
|
86
|
+
const pb = strip(b).split(".").map(Number);
|
|
87
|
+
for (let i = 0; i < 3; i++) {
|
|
88
|
+
const va = pa[i] ?? 0;
|
|
89
|
+
const vb = pb[i] ?? 0;
|
|
90
|
+
if (va < vb)
|
|
91
|
+
return -1;
|
|
92
|
+
if (va > vb)
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
/** Returns true when the current CLI is a dev build. */
|
|
98
|
+
function isDevBuild() {
|
|
99
|
+
return version_1.DEV_BUILD;
|
|
100
|
+
}
|
|
101
|
+
function syncExtension(dataDir, options) {
|
|
76
102
|
const bundledDir = resolveBundledExtensionDir();
|
|
77
103
|
const installedDir = resolveInstalledExtensionDir(dataDir);
|
|
78
104
|
const bundledVersion = readExtensionVersion(bundledDir);
|
|
79
105
|
const installedVersion = readExtensionVersion(installedDir);
|
|
106
|
+
if (!options?.force) {
|
|
107
|
+
// Dev builds never overwrite installed files
|
|
108
|
+
if (isDevBuild()) {
|
|
109
|
+
return { synced: false, bundledVersion, installedVersion, extensionDir: installedDir };
|
|
110
|
+
}
|
|
111
|
+
// Downgrade protection: don't replace a newer installed version
|
|
112
|
+
if (bundledVersion && installedVersion && compareBaseVersions(bundledVersion, installedVersion) < 0) {
|
|
113
|
+
return { synced: false, bundledVersion, installedVersion, extensionDir: installedDir };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
80
116
|
const needsCopy = !node_fs_1.default.existsSync(installedDir) || bundledVersion !== installedVersion;
|
|
81
117
|
if (needsCopy) {
|
|
82
118
|
node_fs_1.default.mkdirSync(installedDir, { recursive: true });
|
|
@@ -89,11 +125,21 @@ function syncExtension(dataDir) {
|
|
|
89
125
|
extensionDir: installedDir,
|
|
90
126
|
};
|
|
91
127
|
}
|
|
92
|
-
function syncHost(dataDir) {
|
|
128
|
+
function syncHost(dataDir, options) {
|
|
93
129
|
const bundledPath = resolveBundledHostPath();
|
|
94
130
|
const installedPath = resolveInstalledHostPath(dataDir);
|
|
95
131
|
const bundledVersion = readHostVersion(bundledPath);
|
|
96
132
|
const installedVersion = readHostVersion(installedPath);
|
|
133
|
+
if (!options?.force) {
|
|
134
|
+
// Dev builds never overwrite installed files
|
|
135
|
+
if (isDevBuild()) {
|
|
136
|
+
return { synced: false, bundledVersion, installedVersion, hostPath: installedPath };
|
|
137
|
+
}
|
|
138
|
+
// Downgrade protection: don't replace a newer installed version
|
|
139
|
+
if (bundledVersion && installedVersion && compareBaseVersions(bundledVersion, installedVersion) < 0) {
|
|
140
|
+
return { synced: false, bundledVersion, installedVersion, hostPath: installedPath };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
97
143
|
const needsCopy = !node_fs_1.default.existsSync(installedPath) || bundledVersion !== installedVersion;
|
|
98
144
|
if (needsCopy) {
|
|
99
145
|
node_fs_1.default.mkdirSync(node_path_1.default.dirname(installedPath), { recursive: true });
|
package/dist/shared/version.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DIRTY = exports.GIT_SHA = exports.VERSION = exports.BASE_VERSION = void 0;
|
|
4
|
-
exports.BASE_VERSION = "0.5.
|
|
5
|
-
exports.VERSION = "0.5.
|
|
6
|
-
exports.GIT_SHA =
|
|
3
|
+
exports.DEV_BUILD = exports.DIRTY = exports.GIT_SHA = exports.VERSION = exports.BASE_VERSION = void 0;
|
|
4
|
+
exports.BASE_VERSION = "0.5.2";
|
|
5
|
+
exports.VERSION = "0.5.2";
|
|
6
|
+
exports.GIT_SHA = "c90b26ba";
|
|
7
7
|
exports.DIRTY = false;
|
|
8
|
+
exports.DEV_BUILD = false;
|