@speedkit/cli 4.34.0 → 4.35.0
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 +7 -0
- package/README.md +22 -1
- package/dist/commands/extension/devtools.d.ts +9 -0
- package/dist/commands/extension/devtools.js +46 -0
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +30 -2
- package/dist/services/onboarding/browser/extension/extension-downloader.js +106 -30
- package/oclif.manifest.json +33 -1
- package/package.json +1 -1
- package/dist/services/onboarding/error/validate-extension-error.d.ts +0 -5
- package/dist/services/onboarding/error/validate-extension-error.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [4.35.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.34.0...v4.35.0) (2026-09-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **devtools:** download and check before switching ([c722d91](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/c722d914ba4c8bc8eb488ccf1cf80ff6e65eeb11))
|
|
7
|
+
|
|
1
8
|
# [4.34.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.33.0...v4.34.0) (2026-09-23)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
|
|
|
21
21
|
$ sk COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ sk (--version)
|
|
24
|
-
@speedkit/cli/4.
|
|
24
|
+
@speedkit/cli/4.35.0 linux-x64 node-v22.23.2
|
|
25
25
|
$ sk --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ sk COMMAND
|
|
@@ -80,6 +80,7 @@ By either...
|
|
|
80
80
|
* [`sk diff-url-parameters PAGEURL`](#sk-diff-url-parameters-pageurl)
|
|
81
81
|
* [`sk document-handler CUSTOMERPATH`](#sk-document-handler-customerpath)
|
|
82
82
|
* [`sk extension add [REF]`](#sk-extension-add-ref)
|
|
83
|
+
* [`sk extension devtools`](#sk-extension-devtools)
|
|
83
84
|
* [`sk extension list`](#sk-extension-list)
|
|
84
85
|
* [`sk extension remove [REF]`](#sk-extension-remove-ref)
|
|
85
86
|
* [`sk extension update`](#sk-extension-update)
|
|
@@ -502,6 +503,26 @@ EXAMPLES
|
|
|
502
503
|
$ sk extension add
|
|
503
504
|
```
|
|
504
505
|
|
|
506
|
+
## `sk extension devtools`
|
|
507
|
+
|
|
508
|
+
Install the integration-devtools extension for the onboarding browser, or update it to the latest release
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
USAGE
|
|
512
|
+
$ sk extension devtools [--force]
|
|
513
|
+
|
|
514
|
+
FLAGS
|
|
515
|
+
--force reinstall the latest release even when it is up to date
|
|
516
|
+
|
|
517
|
+
DESCRIPTION
|
|
518
|
+
Install the integration-devtools extension for the onboarding browser, or update it to the latest release
|
|
519
|
+
|
|
520
|
+
EXAMPLES
|
|
521
|
+
$ sk extension devtools
|
|
522
|
+
|
|
523
|
+
$ sk extension devtools --force
|
|
524
|
+
```
|
|
525
|
+
|
|
505
526
|
## `sk extension list`
|
|
506
527
|
|
|
507
528
|
List Chrome extensions managed by the setup wizard
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class ExtensionDevtools extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { CliServiceFactory } from "../../services/cli/index.js";
|
|
3
|
+
import { CliConfig } from "../../helpers/cli-config.js";
|
|
4
|
+
import { ExtensionDownloader } from "../../services/onboarding/browser/extension/extension-downloader.js";
|
|
5
|
+
export default class ExtensionDevtools extends Command {
|
|
6
|
+
static description = "Install the integration-devtools extension for the onboarding browser, or update it to the latest release";
|
|
7
|
+
static examples = [
|
|
8
|
+
"$ sk extension devtools",
|
|
9
|
+
"$ sk extension devtools --force",
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
force: Flags.boolean({
|
|
13
|
+
description: "reinstall the latest release even when it is up to date",
|
|
14
|
+
default: false,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
async run() {
|
|
18
|
+
const { flags } = await this.parse(ExtensionDevtools);
|
|
19
|
+
const cli = new CliServiceFactory().getService();
|
|
20
|
+
const userConfig = new CliConfig(this.config).load();
|
|
21
|
+
const downloader = new ExtensionDownloader(userConfig, cli);
|
|
22
|
+
// running the command is the confirmation
|
|
23
|
+
const result = await downloader.installOrUpdate({
|
|
24
|
+
confirm: false,
|
|
25
|
+
force: flags.force,
|
|
26
|
+
});
|
|
27
|
+
switch (result.status) {
|
|
28
|
+
case "installed": {
|
|
29
|
+
cli.writeSuccess(`Installed integration-devtools ${result.version}`);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case "updated": {
|
|
33
|
+
cli.writeSuccess(`Updated integration-devtools to ${result.version}`);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case "up-to-date": {
|
|
37
|
+
cli.writeSuccess(`integration-devtools ${result.version} is up to date`);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
default: {
|
|
41
|
+
// the downloader reported why
|
|
42
|
+
this.exit(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import { UserCliConfig } from "../../../../helpers/cli-config.js";
|
|
2
2
|
import { CliServiceInterface } from "../../../cli/index.js";
|
|
3
|
+
interface DevtoolsInstallOptions {
|
|
4
|
+
/** ask before installing or updating, off for an explicit install command */
|
|
5
|
+
confirm?: boolean;
|
|
6
|
+
/** install the latest version even when the installed one is up to date */
|
|
7
|
+
force?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface DevtoolsInstallResult {
|
|
10
|
+
/** path of the extension to load, missing when none is installed */
|
|
11
|
+
path?: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
status: "installed" | "updated" | "up-to-date" | "kept" | "declined" | "failed";
|
|
14
|
+
}
|
|
3
15
|
export declare class ExtensionDownloader {
|
|
4
16
|
private userConfig;
|
|
5
17
|
private cli;
|
|
6
18
|
constructor(userConfig: UserCliConfig, cli: CliServiceInterface);
|
|
7
|
-
|
|
19
|
+
/**
|
|
20
|
+
* path of the devtools extension to load, or undefined when there is none
|
|
21
|
+
*/
|
|
22
|
+
downloadExtension(): Promise<string | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* install the devtools extension or update it to the latest version. An
|
|
25
|
+
* installed version is only replaced by a newer one that downloaded and
|
|
26
|
+
* extracted completely — it stays in use when the update check fails, the
|
|
27
|
+
* update is declined or its download breaks.
|
|
28
|
+
*/
|
|
29
|
+
installOrUpdate({ confirm, force, }?: DevtoolsInstallOptions): Promise<DevtoolsInstallResult>;
|
|
30
|
+
private get installedPath();
|
|
31
|
+
private installLatest;
|
|
8
32
|
private updateLocalDevtools;
|
|
9
33
|
/**
|
|
10
34
|
* version of the cached devtools extension, or null when it is missing or
|
|
@@ -12,5 +36,9 @@ export declare class ExtensionDownloader {
|
|
|
12
36
|
* write) — both count as not installed, so it gets installed again
|
|
13
37
|
*/
|
|
14
38
|
private getInstalledVersion;
|
|
15
|
-
|
|
39
|
+
/**
|
|
40
|
+
* the latest version when it is newer than `localVersion`, otherwise null
|
|
41
|
+
*/
|
|
42
|
+
private getAvailableUpdate;
|
|
16
43
|
}
|
|
44
|
+
export {};
|
|
@@ -3,7 +3,6 @@ import path from "node:path";
|
|
|
3
3
|
import semver from "semver";
|
|
4
4
|
import extract from "extract-zip";
|
|
5
5
|
import { safe } from "../../../../helpers/safe.js";
|
|
6
|
-
import { ValidateExtensionError } from "../../error/validate-extension-error.js";
|
|
7
6
|
const devtools = "integration-devtools";
|
|
8
7
|
export class ExtensionDownloader {
|
|
9
8
|
userConfig;
|
|
@@ -12,34 +11,73 @@ export class ExtensionDownloader {
|
|
|
12
11
|
this.userConfig = userConfig;
|
|
13
12
|
this.cli = cli;
|
|
14
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* path of the devtools extension to load, or undefined when there is none
|
|
16
|
+
*/
|
|
15
17
|
async downloadExtension() {
|
|
18
|
+
return (await this.installOrUpdate()).path;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* install the devtools extension or update it to the latest version. An
|
|
22
|
+
* installed version is only replaced by a newer one that downloaded and
|
|
23
|
+
* extracted completely — it stays in use when the update check fails, the
|
|
24
|
+
* update is declined or its download breaks.
|
|
25
|
+
*/
|
|
26
|
+
async installOrUpdate({ confirm = true, force = false, } = {}) {
|
|
16
27
|
// check for already installed devExtension
|
|
17
28
|
const localVersion = this.getInstalledVersion();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!response) {
|
|
24
|
-
throw new ValidateExtensionError(localVersion, remoteVersion);
|
|
25
|
-
}
|
|
29
|
+
const installed = { path: this.installedPath, version: localVersion };
|
|
30
|
+
if (!localVersion) {
|
|
31
|
+
if (confirm &&
|
|
32
|
+
!(await this.cli.confirm("Do you want to install devtools-extension?", true))) {
|
|
33
|
+
return { status: "declined" };
|
|
26
34
|
}
|
|
35
|
+
return this.installLatest("installed");
|
|
27
36
|
}
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
if (force) {
|
|
38
|
+
const result = await this.installLatest("updated");
|
|
39
|
+
return result.status === "failed"
|
|
40
|
+
? { ...installed, status: "kept" }
|
|
41
|
+
: result;
|
|
42
|
+
}
|
|
43
|
+
// check for updates
|
|
44
|
+
const update = await safe(this.getAvailableUpdate(localVersion));
|
|
45
|
+
if (update.success !== true) {
|
|
46
|
+
this.cli.writeWarning(`Could not check for ${devtools} updates, using installed ${localVersion}: ${update.error}`);
|
|
47
|
+
return { ...installed, status: "kept" };
|
|
48
|
+
}
|
|
49
|
+
if (!update.data) {
|
|
50
|
+
return { ...installed, status: "up-to-date" };
|
|
51
|
+
}
|
|
52
|
+
if (confirm &&
|
|
53
|
+
!(await this.cli.confirm(`${devtools} update available from ${localVersion} to ${update.data}. Install?`, true))) {
|
|
54
|
+
this.cli.writeWarning(`using installed ${devtools} ${localVersion}`);
|
|
55
|
+
return { ...installed, status: "declined" };
|
|
33
56
|
}
|
|
57
|
+
const result = await this.installLatest("updated");
|
|
58
|
+
if (result.status === "failed") {
|
|
59
|
+
this.cli.writeWarning(`keeping installed ${devtools} ${localVersion}`);
|
|
60
|
+
return { ...installed, status: "kept" };
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
get installedPath() {
|
|
65
|
+
return path.resolve(this.userConfig.tempFolder, devtools);
|
|
66
|
+
}
|
|
67
|
+
async installLatest(status) {
|
|
34
68
|
this.cli.startAction("ONBOARDING:UPDATE:DEVTOOLS", "update integration-devtools");
|
|
35
69
|
const response = await safe(this.updateLocalDevtools());
|
|
36
70
|
if (response.success === false) {
|
|
37
71
|
this.cli.failAction("ONBOARDING:UPDATE:DEVTOOLS");
|
|
38
72
|
this.cli.writeError(response.error);
|
|
39
|
-
return;
|
|
73
|
+
return { status: "failed" };
|
|
40
74
|
}
|
|
41
75
|
this.cli.successAction("ONBOARDING:UPDATE:DEVTOOLS");
|
|
42
|
-
return
|
|
76
|
+
return {
|
|
77
|
+
path: response.data,
|
|
78
|
+
version: this.getInstalledVersion(),
|
|
79
|
+
status,
|
|
80
|
+
};
|
|
43
81
|
}
|
|
44
82
|
async updateLocalDevtools() {
|
|
45
83
|
// downloadExtension
|
|
@@ -47,23 +85,31 @@ export class ExtensionDownloader {
|
|
|
47
85
|
if (!extensionResponse.ok) {
|
|
48
86
|
throw new Error(`Could not download ${devtools}: ${extensionResponse.status} ${extensionResponse.statusText}`);
|
|
49
87
|
}
|
|
50
|
-
// resolve path for unpacked extension
|
|
51
|
-
const extensionUnpacked = path.resolve(this.userConfig.tempFolder, devtools);
|
|
52
88
|
// resolve path for zipFile, it is removed after extraction, so its name
|
|
53
89
|
// does not depend on the response
|
|
54
90
|
const archivePath = path.resolve(this.userConfig.tempFolder, `${devtools}.zip`);
|
|
91
|
+
// extract next to the installed version, which is only replaced once
|
|
92
|
+
// extraction is complete
|
|
93
|
+
const stagingPath = `${this.installedPath}.download`;
|
|
55
94
|
// getFileBlob
|
|
56
95
|
const extensionBlob = await extensionResponse.bytes();
|
|
96
|
+
assertZipArchive(extensionBlob, extensionResponse);
|
|
57
97
|
fs.mkdirSync(this.userConfig.tempFolder, { recursive: true });
|
|
58
98
|
// write zipFile
|
|
59
99
|
fs.writeFileSync(archivePath, extensionBlob);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
100
|
+
try {
|
|
101
|
+
fs.rmSync(stagingPath, { recursive: true, force: true });
|
|
102
|
+
// extract zipArchive
|
|
103
|
+
await extract(archivePath, { dir: stagingPath });
|
|
104
|
+
// replace older version
|
|
105
|
+
fs.rmSync(this.installedPath, { recursive: true, force: true });
|
|
106
|
+
fs.renameSync(stagingPath, this.installedPath);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
fs.rmSync(stagingPath, { recursive: true, force: true });
|
|
110
|
+
fs.rmSync(archivePath, { force: true });
|
|
111
|
+
}
|
|
112
|
+
return this.installedPath;
|
|
67
113
|
}
|
|
68
114
|
/**
|
|
69
115
|
* version of the cached devtools extension, or null when it is missing or
|
|
@@ -71,7 +117,7 @@ export class ExtensionDownloader {
|
|
|
71
117
|
* write) — both count as not installed, so it gets installed again
|
|
72
118
|
*/
|
|
73
119
|
getInstalledVersion() {
|
|
74
|
-
const manifestPath = path.resolve(this.
|
|
120
|
+
const manifestPath = path.resolve(this.installedPath, "manifest.json");
|
|
75
121
|
if (!fs.existsSync(manifestPath)) {
|
|
76
122
|
return null;
|
|
77
123
|
}
|
|
@@ -83,12 +129,42 @@ export class ExtensionDownloader {
|
|
|
83
129
|
}
|
|
84
130
|
return manifest.data.version;
|
|
85
131
|
}
|
|
86
|
-
|
|
132
|
+
/**
|
|
133
|
+
* the latest version when it is newer than `localVersion`, otherwise null
|
|
134
|
+
*/
|
|
135
|
+
async getAvailableUpdate(localVersion) {
|
|
87
136
|
const versionResponse = await fetch("https://threepointonefour.app.baqend.com/v1/code/webhook_devtools_release");
|
|
88
137
|
if (!versionResponse.ok) {
|
|
89
|
-
throw new Error(
|
|
138
|
+
throw new Error(`Could not find version for ${devtools}: ${versionResponse.status} ${versionResponse.statusText}`);
|
|
90
139
|
}
|
|
91
|
-
const
|
|
92
|
-
return
|
|
140
|
+
const { version } = await versionResponse.json();
|
|
141
|
+
return semver.gt(version, localVersion) ? version : null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const ZIP_LOCAL_FILE_HEADER = Buffer.from([0x50, 0x4b, 0x03, 0x04]);
|
|
145
|
+
const ZIP_END_OF_CENTRAL_DIRECTORY = Buffer.from([0x50, 0x4b, 0x05, 0x06]);
|
|
146
|
+
// end-of-central-directory record (22 bytes) plus the longest zip comment
|
|
147
|
+
const ZIP_END_OF_CENTRAL_DIRECTORY_MAX_OFFSET = 22 + 0xff_ff;
|
|
148
|
+
/**
|
|
149
|
+
* a zip starts with a local file header and ends with the
|
|
150
|
+
* end-of-central-directory record. Anything else, e.g. an html page from a
|
|
151
|
+
* proxy or a cut-off download, is reported with what actually arrived.
|
|
152
|
+
*/
|
|
153
|
+
function assertZipArchive(archive, response) {
|
|
154
|
+
const buffer = Buffer.from(archive);
|
|
155
|
+
const tail = buffer.subarray(Math.max(0, buffer.length - ZIP_END_OF_CENTRAL_DIRECTORY_MAX_OFFSET));
|
|
156
|
+
if (buffer.subarray(0, 4).equals(ZIP_LOCAL_FILE_HEADER) &&
|
|
157
|
+
tail.includes(ZIP_END_OF_CENTRAL_DIRECTORY)) {
|
|
158
|
+
return;
|
|
93
159
|
}
|
|
160
|
+
const received = [
|
|
161
|
+
`${buffer.length} bytes`,
|
|
162
|
+
`content-type: ${response.headers.get("content-type")}`,
|
|
163
|
+
`content-encoding: ${response.headers.get("content-encoding")}`,
|
|
164
|
+
`content-length: ${response.headers.get("content-length")}`,
|
|
165
|
+
].join(", ");
|
|
166
|
+
const kind = buffer.subarray(0, 4).equals(ZIP_LOCAL_FILE_HEADER)
|
|
167
|
+
? "is cut off"
|
|
168
|
+
: `is not a zip, it starts with ${JSON.stringify(buffer.subarray(0, 80).toString("utf8"))}`;
|
|
169
|
+
throw new Error(`Download of ${devtools} ${kind} (${received})`);
|
|
94
170
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1260,6 +1260,38 @@
|
|
|
1260
1260
|
"add.js"
|
|
1261
1261
|
]
|
|
1262
1262
|
},
|
|
1263
|
+
"extension:devtools": {
|
|
1264
|
+
"aliases": [],
|
|
1265
|
+
"args": {},
|
|
1266
|
+
"description": "Install the integration-devtools extension for the onboarding browser, or update it to the latest release",
|
|
1267
|
+
"examples": [
|
|
1268
|
+
"$ sk extension devtools",
|
|
1269
|
+
"$ sk extension devtools --force"
|
|
1270
|
+
],
|
|
1271
|
+
"flags": {
|
|
1272
|
+
"force": {
|
|
1273
|
+
"description": "reinstall the latest release even when it is up to date",
|
|
1274
|
+
"name": "force",
|
|
1275
|
+
"allowNo": false,
|
|
1276
|
+
"type": "boolean"
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1279
|
+
"hasDynamicHelp": false,
|
|
1280
|
+
"hiddenAliases": [],
|
|
1281
|
+
"id": "extension:devtools",
|
|
1282
|
+
"pluginAlias": "@speedkit/cli",
|
|
1283
|
+
"pluginName": "@speedkit/cli",
|
|
1284
|
+
"pluginType": "core",
|
|
1285
|
+
"strict": true,
|
|
1286
|
+
"enableJsonFlag": false,
|
|
1287
|
+
"isESM": true,
|
|
1288
|
+
"relativePath": [
|
|
1289
|
+
"dist",
|
|
1290
|
+
"commands",
|
|
1291
|
+
"extension",
|
|
1292
|
+
"devtools.js"
|
|
1293
|
+
]
|
|
1294
|
+
},
|
|
1263
1295
|
"extension:list": {
|
|
1264
1296
|
"aliases": [],
|
|
1265
1297
|
"args": {},
|
|
@@ -1651,5 +1683,5 @@
|
|
|
1651
1683
|
]
|
|
1652
1684
|
}
|
|
1653
1685
|
},
|
|
1654
|
-
"version": "4.
|
|
1686
|
+
"version": "4.35.0"
|
|
1655
1687
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import ApplicationError from "../../error-handling/error/application-error.js";
|
|
2
|
-
export class ValidateExtensionError extends ApplicationError {
|
|
3
|
-
code = "VALIDATE_EXTENSION_ERROR";
|
|
4
|
-
constructor(localVersion, remoteVersion) {
|
|
5
|
-
super(`Unable to validate Versions: "${localVersion}" - "${remoteVersion}"`);
|
|
6
|
-
}
|
|
7
|
-
}
|