@superblocksteam/cli 2.0.110-next.14 → 2.0.110-next.15
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/README.md +1 -1
- package/bin/run.js +3 -1
- package/dist/{acorn-QRHEJZ4Y.js → acorn-S4TO6SU6.js} +3 -3
- package/dist/{angular-E7FCGLEO.js → angular-A7AS7PTN.js} +3 -3
- package/dist/{api-F7VFMVH5.js → api-DHAE7O3B.js} +4 -4
- package/dist/{babel-XU2VNNSQ.js → babel-I6TPYGDQ.js} +3 -3
- package/dist/{chunk-7XGJ2DPJ.js → chunk-2A3K3NFD.js} +3 -3
- package/dist/{chunk-E33HPBUC.js → chunk-4ICSOTLX.js} +2 -2
- package/dist/{chunk-42MJC4KH.js → chunk-5AGQJGKG.js} +4 -4
- package/dist/{chunk-Y5UCK4QB.js → chunk-AK4KVVMQ.js} +3 -3
- package/dist/{chunk-Z64OZ4VQ.js → chunk-B7VXRFNX.js} +4 -4
- package/dist/{chunk-H427LM2L.js → chunk-C3LE2B2C.js} +3 -3
- package/dist/{chunk-X2O46BBJ.js → chunk-D23FTYGA.js} +6 -6
- package/dist/{chunk-VUXGBCHS.js → chunk-HFKWO5WW.js} +4 -4
- package/dist/{chunk-UQQWHXCE.js → chunk-JRQK7JHL.js} +4 -4
- package/dist/{chunk-SOVZ4MKE.js → chunk-LZVIP2I7.js} +3 -3
- package/dist/{chunk-FAJ3NJRT.js → chunk-MJADJD5I.js} +3 -3
- package/dist/{chunk-QQTIZ3JW.js → chunk-O3ZP25TF.js} +3 -3
- package/dist/{chunk-6L5GMSF2.js → chunk-PUJRK3HU.js} +1673 -484
- package/dist/{chunk-6L5GMSF2.js.map → chunk-PUJRK3HU.js.map} +1 -1
- package/dist/{chunk-5M7JSMKP.js → chunk-RLZRYENH.js} +3 -3
- package/dist/{chunk-6SIVP4XD.js → chunk-TEKNNFQQ.js} +6 -6
- package/dist/{chunk-CHRYSMMG.js → chunk-UCISV77R.js} +3 -3
- package/dist/{chunk-4N2GPPW5.js → chunk-ZM5JKT44.js} +3 -3
- package/dist/{cli-truncate-R7BZHTWM.js → cli-truncate-OPCPEVAK.js} +5 -5
- package/dist/commands/dev-parent.js +2 -2
- package/dist/{dd-trace-TMWNM5TU.js → dd-trace-BDSOEEBK.js} +7 -7
- package/dist/{dist-LAIEBQ3V.js → dist-PUVCR3ZI.js} +13 -13
- package/dist/{embedded-playwright-mcp-server-6GY37WOF.js → embedded-playwright-mcp-server-2WKLVYST.js} +3 -3
- package/dist/{enquirer-QSA4Q3KI.js → enquirer-UFVUWHG7.js} +4 -4
- package/dist/{estree-M5XOW65K.js → estree-XFPALNYT.js} +3 -3
- package/dist/{flow-L3D4WX3Z.js → flow-NHVTQOHK.js} +3 -3
- package/dist/{getMachineId-bsd-I2VASQDS.js → getMachineId-bsd-3DLWUYWS.js} +5 -5
- package/dist/{getMachineId-darwin-VTQRCEUS.js → getMachineId-darwin-7HEZDYDC.js} +5 -5
- package/dist/{getMachineId-linux-4IXPONMU.js → getMachineId-linux-AT643D2X.js} +4 -4
- package/dist/{getMachineId-unsupported-UAR7YCNX.js → getMachineId-unsupported-2SDOQK7K.js} +4 -4
- package/dist/{getMachineId-win-C7XX6XLO.js → getMachineId-win-5MFNNUBL.js} +5 -5
- package/dist/{glimmer-LUDC5QNV.js → glimmer-WDQJ7SVT.js} +3 -3
- package/dist/{graphql-VIZ3REIC.js → graphql-46CNKLOE.js} +3 -3
- package/dist/{html-I6EAKISS.js → html-PMTAWH46.js} +3 -3
- package/dist/{http-TOEXWWMX.js → http-IOIOPQJJ.js} +12 -12
- package/dist/index.js +298 -26
- package/dist/index.js.map +1 -1
- package/dist/{jiti-EJ36EOMK.js → jiti-ZSV3YQHH.js} +3 -3
- package/dist/{log-update-53HBE7QZ.js → log-update-7HNOGI6A.js} +6 -6
- package/dist/{markdown-STBGDZM6.js → markdown-MFIX2CIO.js} +3 -3
- package/dist/{meriyah-65T7PG5O.js → meriyah-VOMA5KA6.js} +3 -3
- package/dist/{postcss-ASIVSSN2.js → postcss-HKXAB44U.js} +3 -3
- package/dist/{read-pkg-MWZA3RU5.js → read-pkg-RX4KMBL6.js} +5 -5
- package/dist/{spans-3EJDY2PZ.js → spans-T6JQOPKG.js} +4 -4
- package/dist/{src-DWCFAABS.js → src-MOY5D4GJ.js} +3 -3
- package/dist/{token-YF6QEPIT.js → token-NJXCSG6L.js} +5 -5
- package/dist/{token-util-TV464TI4.js → token-util-OOFTEADM.js} +5 -5
- package/dist/{typescript-ZZIEC5OF.js → typescript-NGBFT52X.js} +3 -3
- package/dist/{wrap-ansi-7RMGVNIF.js → wrap-ansi-OULD3OUB.js} +5 -5
- package/dist/{yaml-P2AMYUL3.js → yaml-CNAXERK5.js} +3 -3
- package/oclif.manifest.json +8 -1
- package/package.json +5 -5
- /package/dist/{acorn-QRHEJZ4Y.js.map → acorn-S4TO6SU6.js.map} +0 -0
- /package/dist/{angular-E7FCGLEO.js.map → angular-A7AS7PTN.js.map} +0 -0
- /package/dist/{api-F7VFMVH5.js.map → api-DHAE7O3B.js.map} +0 -0
- /package/dist/{babel-XU2VNNSQ.js.map → babel-I6TPYGDQ.js.map} +0 -0
- /package/dist/{chunk-7XGJ2DPJ.js.map → chunk-2A3K3NFD.js.map} +0 -0
- /package/dist/{chunk-E33HPBUC.js.map → chunk-4ICSOTLX.js.map} +0 -0
- /package/dist/{chunk-42MJC4KH.js.map → chunk-5AGQJGKG.js.map} +0 -0
- /package/dist/{chunk-Y5UCK4QB.js.map → chunk-AK4KVVMQ.js.map} +0 -0
- /package/dist/{chunk-Z64OZ4VQ.js.map → chunk-B7VXRFNX.js.map} +0 -0
- /package/dist/{chunk-H427LM2L.js.map → chunk-C3LE2B2C.js.map} +0 -0
- /package/dist/{chunk-X2O46BBJ.js.map → chunk-D23FTYGA.js.map} +0 -0
- /package/dist/{chunk-VUXGBCHS.js.map → chunk-HFKWO5WW.js.map} +0 -0
- /package/dist/{chunk-UQQWHXCE.js.map → chunk-JRQK7JHL.js.map} +0 -0
- /package/dist/{chunk-SOVZ4MKE.js.map → chunk-LZVIP2I7.js.map} +0 -0
- /package/dist/{chunk-FAJ3NJRT.js.map → chunk-MJADJD5I.js.map} +0 -0
- /package/dist/{chunk-QQTIZ3JW.js.map → chunk-O3ZP25TF.js.map} +0 -0
- /package/dist/{chunk-5M7JSMKP.js.map → chunk-RLZRYENH.js.map} +0 -0
- /package/dist/{chunk-6SIVP4XD.js.map → chunk-TEKNNFQQ.js.map} +0 -0
- /package/dist/{chunk-CHRYSMMG.js.map → chunk-UCISV77R.js.map} +0 -0
- /package/dist/{chunk-4N2GPPW5.js.map → chunk-ZM5JKT44.js.map} +0 -0
- /package/dist/{cli-truncate-R7BZHTWM.js.map → cli-truncate-OPCPEVAK.js.map} +0 -0
- /package/dist/{dd-trace-TMWNM5TU.js.map → dd-trace-BDSOEEBK.js.map} +0 -0
- /package/dist/{dist-LAIEBQ3V.js.map → dist-PUVCR3ZI.js.map} +0 -0
- /package/dist/{embedded-playwright-mcp-server-6GY37WOF.js.map → embedded-playwright-mcp-server-2WKLVYST.js.map} +0 -0
- /package/dist/{enquirer-QSA4Q3KI.js.map → enquirer-UFVUWHG7.js.map} +0 -0
- /package/dist/{estree-M5XOW65K.js.map → estree-XFPALNYT.js.map} +0 -0
- /package/dist/{flow-L3D4WX3Z.js.map → flow-NHVTQOHK.js.map} +0 -0
- /package/dist/{getMachineId-bsd-I2VASQDS.js.map → getMachineId-bsd-3DLWUYWS.js.map} +0 -0
- /package/dist/{getMachineId-darwin-VTQRCEUS.js.map → getMachineId-darwin-7HEZDYDC.js.map} +0 -0
- /package/dist/{getMachineId-linux-4IXPONMU.js.map → getMachineId-linux-AT643D2X.js.map} +0 -0
- /package/dist/{getMachineId-unsupported-UAR7YCNX.js.map → getMachineId-unsupported-2SDOQK7K.js.map} +0 -0
- /package/dist/{getMachineId-win-C7XX6XLO.js.map → getMachineId-win-5MFNNUBL.js.map} +0 -0
- /package/dist/{glimmer-LUDC5QNV.js.map → glimmer-WDQJ7SVT.js.map} +0 -0
- /package/dist/{graphql-VIZ3REIC.js.map → graphql-46CNKLOE.js.map} +0 -0
- /package/dist/{html-I6EAKISS.js.map → html-PMTAWH46.js.map} +0 -0
- /package/dist/{http-TOEXWWMX.js.map → http-IOIOPQJJ.js.map} +0 -0
- /package/dist/{jiti-EJ36EOMK.js.map → jiti-ZSV3YQHH.js.map} +0 -0
- /package/dist/{log-update-53HBE7QZ.js.map → log-update-7HNOGI6A.js.map} +0 -0
- /package/dist/{markdown-STBGDZM6.js.map → markdown-MFIX2CIO.js.map} +0 -0
- /package/dist/{meriyah-65T7PG5O.js.map → meriyah-VOMA5KA6.js.map} +0 -0
- /package/dist/{postcss-ASIVSSN2.js.map → postcss-HKXAB44U.js.map} +0 -0
- /package/dist/{read-pkg-MWZA3RU5.js.map → read-pkg-RX4KMBL6.js.map} +0 -0
- /package/dist/{spans-3EJDY2PZ.js.map → spans-T6JQOPKG.js.map} +0 -0
- /package/dist/{src-DWCFAABS.js.map → src-MOY5D4GJ.js.map} +0 -0
- /package/dist/{token-YF6QEPIT.js.map → token-NJXCSG6L.js.map} +0 -0
- /package/dist/{token-util-TV464TI4.js.map → token-util-OOFTEADM.js.map} +0 -0
- /package/dist/{typescript-ZZIEC5OF.js.map → typescript-NGBFT52X.js.map} +0 -0
- /package/dist/{wrap-ansi-7RMGVNIF.js.map → wrap-ansi-OULD3OUB.js.map} +0 -0
- /package/dist/{yaml-P2AMYUL3.js.map → yaml-CNAXERK5.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
if (typeof process === 'object' && process !== null &&
|
|
2
2
|
process.env !== null && typeof process.env === 'object') {
|
|
3
3
|
process.env.DD_GIT_REPOSITORY_URL = 'https://token@github.com/superblocksteam/superblocks.git';
|
|
4
|
-
process.env.DD_GIT_COMMIT_SHA = '
|
|
4
|
+
process.env.DD_GIT_COMMIT_SHA = '17d24669ad0b2ea8b205ca9196a4c77939b28866';
|
|
5
5
|
}
|
|
6
6
|
import { createRequire as $dd_createRequire } from 'module';
|
|
7
7
|
import { fileURLToPath as $dd_fileURLToPath } from 'url';
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
configPathForClient,
|
|
16
16
|
labelForClient,
|
|
17
17
|
mergeMcpConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HFKWO5WW.js";
|
|
19
19
|
import {
|
|
20
20
|
AUTO_UPGRADE_EXIT_CODE,
|
|
21
21
|
AuthHotReloadServer,
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
isSocketAlive,
|
|
63
63
|
magenta,
|
|
64
64
|
modeFlagValuesMap,
|
|
65
|
+
preWarmViteCache,
|
|
65
66
|
readApiFromDisk,
|
|
66
67
|
readApplicationFromDisk,
|
|
67
68
|
readMultiPageApplicationFromDisk,
|
|
@@ -78,28 +79,28 @@ import {
|
|
|
78
79
|
writeApplicationToDisk,
|
|
79
80
|
writeResourceToDisk,
|
|
80
81
|
yellow
|
|
81
|
-
} from "./chunk-
|
|
82
|
-
import "./chunk-
|
|
82
|
+
} from "./chunk-PUJRK3HU.js";
|
|
83
|
+
import "./chunk-O3ZP25TF.js";
|
|
83
84
|
import {
|
|
84
85
|
require_enquirer
|
|
85
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-LZVIP2I7.js";
|
|
86
87
|
import {
|
|
87
88
|
init_lodash,
|
|
88
89
|
isEmpty_default,
|
|
89
90
|
require_lib
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-2A3K3NFD.js";
|
|
91
92
|
import {
|
|
92
93
|
require_rfdc
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
95
|
-
import "./chunk-
|
|
96
|
-
import "./chunk-
|
|
97
|
-
import "./chunk-
|
|
94
|
+
} from "./chunk-D23FTYGA.js";
|
|
95
|
+
import "./chunk-C3LE2B2C.js";
|
|
96
|
+
import "./chunk-AK4KVVMQ.js";
|
|
97
|
+
import "./chunk-ZM5JKT44.js";
|
|
98
|
+
import "./chunk-MJADJD5I.js";
|
|
98
99
|
import {
|
|
99
100
|
__commonJS,
|
|
100
101
|
__toESM,
|
|
101
102
|
init_cjs_shims
|
|
102
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-4ICSOTLX.js";
|
|
103
104
|
|
|
104
105
|
// ../../../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
|
|
105
106
|
var require_eventemitter3 = __commonJS({
|
|
@@ -1011,7 +1012,7 @@ async function createPrompt(options, settings) {
|
|
|
1011
1012
|
enquirer3 = settings.enquirer;
|
|
1012
1013
|
} else {
|
|
1013
1014
|
try {
|
|
1014
|
-
enquirer3 = await import("./enquirer-
|
|
1015
|
+
enquirer3 = await import("./enquirer-UFVUWHG7.js").then((imported) => imported.default ? new imported.default() : new imported());
|
|
1015
1016
|
} catch (e) {
|
|
1016
1017
|
if (this instanceof TaskWrapper) {
|
|
1017
1018
|
this.task.prompt = new PromptError("Enquirer is a peer dependency that must be installed separately.");
|
|
@@ -1219,9 +1220,9 @@ var _DefaultRenderer = class {
|
|
|
1219
1220
|
return typeof bottomBar === "number" && bottomBar !== 0 || typeof bottomBar === "boolean" && bottomBar !== false || !task.hasTitle();
|
|
1220
1221
|
}
|
|
1221
1222
|
async render() {
|
|
1222
|
-
const { createLogUpdate } = await import("./log-update-
|
|
1223
|
-
const { default: truncate } = await import("./cli-truncate-
|
|
1224
|
-
const { default: wrap } = await import("./wrap-ansi-
|
|
1223
|
+
const { createLogUpdate } = await import("./log-update-7HNOGI6A.js");
|
|
1224
|
+
const { default: truncate } = await import("./cli-truncate-OPCPEVAK.js");
|
|
1225
|
+
const { default: wrap } = await import("./wrap-ansi-OULD3OUB.js");
|
|
1225
1226
|
this.updater = createLogUpdate(this.logger.process.stdout);
|
|
1226
1227
|
this.truncate = truncate;
|
|
1227
1228
|
this.wrap = wrap;
|
|
@@ -4786,7 +4787,9 @@ var Deploy = class _Deploy extends AuthenticatedCommand {
|
|
|
4786
4787
|
// src/commands/dev.mts
|
|
4787
4788
|
init_cjs_shims();
|
|
4788
4789
|
import * as child_process from "node:child_process";
|
|
4789
|
-
import
|
|
4790
|
+
import * as fs6 from "node:fs";
|
|
4791
|
+
import * as http from "node:http";
|
|
4792
|
+
import { basename, dirname, join as join3, resolve } from "node:path";
|
|
4790
4793
|
import { Flags as Flags6, ux as ux4 } from "@oclif/core";
|
|
4791
4794
|
var import_util13 = __toESM(require_dist2(), 1);
|
|
4792
4795
|
var Dev = class _Dev extends AuthenticatedCommand {
|
|
@@ -4795,6 +4798,12 @@ var Dev = class _Dev extends AuthenticatedCommand {
|
|
|
4795
4798
|
flags;
|
|
4796
4799
|
applicationConfig;
|
|
4797
4800
|
superblocksBaseUrl;
|
|
4801
|
+
warmServer;
|
|
4802
|
+
// When true, the CLI was started in warm pool standby mode and subsequently
|
|
4803
|
+
// activated by SABS. Used to route auto-upgrade to SKIP_CLI_ONLY — the warm
|
|
4804
|
+
// pod already ships with the latest CLI, but the user's package.json still
|
|
4805
|
+
// needs to be synced to the target @superblocksteam/library version.
|
|
4806
|
+
warmStandbyActivated = false;
|
|
4798
4807
|
authHotReloadServer;
|
|
4799
4808
|
getAuthTokenTimeoutMs() {
|
|
4800
4809
|
return 5 * 60 * 1e3;
|
|
@@ -4809,6 +4818,9 @@ var Dev = class _Dev extends AuthenticatedCommand {
|
|
|
4809
4818
|
async init() {
|
|
4810
4819
|
const { flags } = await this.parse(_Dev);
|
|
4811
4820
|
this.flags = flags;
|
|
4821
|
+
if (this.flags.warm) {
|
|
4822
|
+
return;
|
|
4823
|
+
}
|
|
4812
4824
|
let token;
|
|
4813
4825
|
let superblocksBaseUrl;
|
|
4814
4826
|
const branch = await getCurrentBranchInfo();
|
|
@@ -4979,7 +4991,7 @@ var Dev = class _Dev extends AuthenticatedCommand {
|
|
|
4979
4991
|
if (!this.flags) {
|
|
4980
4992
|
throw new Error("Flags are not initialized");
|
|
4981
4993
|
}
|
|
4982
|
-
const autoUpgradeMode = this.flags["skip-auto-upgrade"] ? DevServerAutoUpgradeMode.SKIP : this.flags["force-auto-upgrade"] ? DevServerAutoUpgradeMode.FORCE : void 0;
|
|
4994
|
+
const autoUpgradeMode = this.warmStandbyActivated ? DevServerAutoUpgradeMode.SKIP_CLI_ONLY : this.flags["skip-auto-upgrade"] ? DevServerAutoUpgradeMode.SKIP : this.flags["force-auto-upgrade"] ? DevServerAutoUpgradeMode.FORCE : void 0;
|
|
4983
4995
|
await this.startDevServer({
|
|
4984
4996
|
applicationConfig: this.applicationConfig,
|
|
4985
4997
|
tokenConfig: {
|
|
@@ -4994,7 +5006,9 @@ var Dev = class _Dev extends AuthenticatedCommand {
|
|
|
4994
5006
|
superblocksPath: resolve(process.argv[1]),
|
|
4995
5007
|
autoUpgradeMode,
|
|
4996
5008
|
sdk,
|
|
4997
|
-
prefetchedApplication
|
|
5009
|
+
prefetchedApplication,
|
|
5010
|
+
skipSync: false
|
|
5011
|
+
// DBFS runs alongside S3 during migration (D-25)
|
|
4998
5012
|
});
|
|
4999
5013
|
}
|
|
5000
5014
|
async onTokenReceived(token) {
|
|
@@ -5025,6 +5039,12 @@ var Dev = class _Dev extends AuthenticatedCommand {
|
|
|
5025
5039
|
description: "The port that the dev server will run on",
|
|
5026
5040
|
hidden: true
|
|
5027
5041
|
}),
|
|
5042
|
+
warm: Flags6.boolean({
|
|
5043
|
+
name: "warm",
|
|
5044
|
+
description: "Start in warm standby mode: pre-loads the server process without auth, then activates on /_sb_activate POST",
|
|
5045
|
+
default: false,
|
|
5046
|
+
hidden: true
|
|
5047
|
+
}),
|
|
5028
5048
|
"upload-first": Flags6.boolean({
|
|
5029
5049
|
name: "upload-first",
|
|
5030
5050
|
description: "Upload to Superblocks before starting",
|
|
@@ -5073,6 +5093,10 @@ var Dev = class _Dev extends AuthenticatedCommand {
|
|
|
5073
5093
|
if (!this.flags) {
|
|
5074
5094
|
throw new Error("Flags are not initialized");
|
|
5075
5095
|
}
|
|
5096
|
+
if (this.flags.warm) {
|
|
5097
|
+
await this.runWarmStandby();
|
|
5098
|
+
return;
|
|
5099
|
+
}
|
|
5076
5100
|
if (!this.flags["upload-first"] && !this.flags["download-first"]) {
|
|
5077
5101
|
throw new Error(
|
|
5078
5102
|
"This command requires either the --upload-first or --download-first flag"
|
|
@@ -5158,9 +5182,257 @@ var Dev = class _Dev extends AuthenticatedCommand {
|
|
|
5158
5182
|
tokenManager: this.tokenManager,
|
|
5159
5183
|
getCurrentToken: () => this.getCurrentToken(),
|
|
5160
5184
|
authHotReloadServer: this.authHotReloadServer,
|
|
5161
|
-
autoUpgradeMode: options.autoUpgradeMode
|
|
5185
|
+
autoUpgradeMode: options.autoUpgradeMode,
|
|
5186
|
+
existingServer: this.warmServer
|
|
5162
5187
|
});
|
|
5163
5188
|
}
|
|
5189
|
+
/**
|
|
5190
|
+
* Warm standby mode: starts a minimal HTTP server that responds to health
|
|
5191
|
+
* checks while the Node.js runtime is fully loaded in memory. When SABS
|
|
5192
|
+
* activates the pod via POST /_sb_activate with session credentials, this
|
|
5193
|
+
* method writes the config files, closes the standby server, and hands off
|
|
5194
|
+
* to the normal `executeWithToken` flow.
|
|
5195
|
+
*
|
|
5196
|
+
* This eliminates the ~1.9s CLI cold-start from the claim-time critical path.
|
|
5197
|
+
*/
|
|
5198
|
+
async runWarmStandby() {
|
|
5199
|
+
const port = this.flags?.port ?? 5173;
|
|
5200
|
+
const logger = this.logger();
|
|
5201
|
+
logger.info(`Starting warm standby server on port ${port}`);
|
|
5202
|
+
const activationConfig = await new Promise((resolveActivation, rejectActivation) => {
|
|
5203
|
+
const server = http.createServer((req, res) => {
|
|
5204
|
+
res.setHeader("Cache-Control", "no-store, max-age=0");
|
|
5205
|
+
res.setHeader("x-csb-no-sw-proxy", "1");
|
|
5206
|
+
if (req.url === "/_sb_health" && req.method === "GET") {
|
|
5207
|
+
res.writeHead(503, { "Content-Type": "application/json" });
|
|
5208
|
+
res.end(JSON.stringify({ status: "warming" }));
|
|
5209
|
+
return;
|
|
5210
|
+
}
|
|
5211
|
+
if (req.url === "/_sb_activate" && req.method === "POST") {
|
|
5212
|
+
const MAX_BODY = 64 * 1024;
|
|
5213
|
+
let body = "";
|
|
5214
|
+
let destroyed = false;
|
|
5215
|
+
req.on("data", (chunk) => {
|
|
5216
|
+
if (destroyed) return;
|
|
5217
|
+
body += chunk.toString();
|
|
5218
|
+
if (body.length > MAX_BODY) {
|
|
5219
|
+
destroyed = true;
|
|
5220
|
+
res.writeHead(413, { "Content-Type": "application/json" });
|
|
5221
|
+
res.end(JSON.stringify({ error: "Request body too large" }));
|
|
5222
|
+
req.destroy();
|
|
5223
|
+
}
|
|
5224
|
+
});
|
|
5225
|
+
req.on("end", () => {
|
|
5226
|
+
if (destroyed) return;
|
|
5227
|
+
try {
|
|
5228
|
+
const config = JSON.parse(body);
|
|
5229
|
+
const missing = ["token", "baseUrl", "applicationId", "branch"].filter((k) => typeof config[k] !== "string" || !config[k]);
|
|
5230
|
+
if (missing.length) {
|
|
5231
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
5232
|
+
res.end(
|
|
5233
|
+
JSON.stringify({
|
|
5234
|
+
error: `Missing required fields: ${missing.join(", ")}`
|
|
5235
|
+
})
|
|
5236
|
+
);
|
|
5237
|
+
return;
|
|
5238
|
+
}
|
|
5239
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
5240
|
+
res.end(JSON.stringify({ status: "activating" }));
|
|
5241
|
+
logger.info(
|
|
5242
|
+
"Activation received, transitioning to full dev server"
|
|
5243
|
+
);
|
|
5244
|
+
this.warmServer = server;
|
|
5245
|
+
resolveActivation(config);
|
|
5246
|
+
} catch {
|
|
5247
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
5248
|
+
res.end(JSON.stringify({ error: "invalid JSON body" }));
|
|
5249
|
+
}
|
|
5250
|
+
});
|
|
5251
|
+
return;
|
|
5252
|
+
}
|
|
5253
|
+
res.writeHead(503);
|
|
5254
|
+
res.end();
|
|
5255
|
+
});
|
|
5256
|
+
server.on("error", (err) => {
|
|
5257
|
+
logger.error(`Warm standby server failed to start: ${err.message}`);
|
|
5258
|
+
rejectActivation(err);
|
|
5259
|
+
});
|
|
5260
|
+
server.listen(port, () => {
|
|
5261
|
+
logger.info(`Warm standby ready on port ${port}`);
|
|
5262
|
+
preWarmViteCache(process.cwd()).catch((err) => {
|
|
5263
|
+
logger.warn(`preWarmViteCache background task rejected: ${err}`);
|
|
5264
|
+
});
|
|
5265
|
+
});
|
|
5266
|
+
});
|
|
5267
|
+
process.env.SUPERBLOCKS_TOKEN = activationConfig.token;
|
|
5268
|
+
process.env.SUPERBLOCKS_BASE_URL = activationConfig.baseUrl;
|
|
5269
|
+
process.env.APPLICATION_ID = activationConfig.applicationId;
|
|
5270
|
+
process.env.BRANCH = activationConfig.branch;
|
|
5271
|
+
if (activationConfig.hostname) {
|
|
5272
|
+
process.env.SABS_LIVE_EDIT_HOSTNAME = activationConfig.hostname;
|
|
5273
|
+
}
|
|
5274
|
+
if (activationConfig.templateName) {
|
|
5275
|
+
process.env.SUPERBLOCKS_APP_TEMPLATE_NAME = activationConfig.templateName;
|
|
5276
|
+
const currentDir = basename(process.cwd());
|
|
5277
|
+
if (currentDir !== activationConfig.templateName) {
|
|
5278
|
+
const targetDir = join3(
|
|
5279
|
+
process.cwd(),
|
|
5280
|
+
"..",
|
|
5281
|
+
activationConfig.templateName
|
|
5282
|
+
);
|
|
5283
|
+
if (fs6.existsSync(targetDir)) {
|
|
5284
|
+
logger.info(
|
|
5285
|
+
`Switching template directory: ${currentDir} -> ${activationConfig.templateName}`
|
|
5286
|
+
);
|
|
5287
|
+
process.chdir(targetDir);
|
|
5288
|
+
} else {
|
|
5289
|
+
logger.warn(
|
|
5290
|
+
`Template directory not found: ${targetDir}, staying in ${currentDir}`
|
|
5291
|
+
);
|
|
5292
|
+
}
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
const authFilePath = (0, import_util13.resolveAuthFilePath)();
|
|
5296
|
+
fs6.mkdirSync(dirname(authFilePath), { recursive: true });
|
|
5297
|
+
fs6.writeFileSync(
|
|
5298
|
+
authFilePath,
|
|
5299
|
+
JSON.stringify({
|
|
5300
|
+
superblocksBaseUrl: activationConfig.baseUrl,
|
|
5301
|
+
token: activationConfig.token
|
|
5302
|
+
})
|
|
5303
|
+
);
|
|
5304
|
+
const appConfigPath = join3(
|
|
5305
|
+
process.cwd(),
|
|
5306
|
+
".superblocks",
|
|
5307
|
+
"superblocks.json"
|
|
5308
|
+
);
|
|
5309
|
+
fs6.mkdirSync(dirname(appConfigPath), { recursive: true });
|
|
5310
|
+
fs6.writeFileSync(
|
|
5311
|
+
appConfigPath,
|
|
5312
|
+
JSON.stringify({
|
|
5313
|
+
configType: "APPLICATION_V2",
|
|
5314
|
+
id: activationConfig.applicationId
|
|
5315
|
+
})
|
|
5316
|
+
);
|
|
5317
|
+
const devEnvPath = join3(
|
|
5318
|
+
process.cwd(),
|
|
5319
|
+
"..",
|
|
5320
|
+
"..",
|
|
5321
|
+
".superblocks",
|
|
5322
|
+
"dev-environment.json"
|
|
5323
|
+
);
|
|
5324
|
+
fs6.mkdirSync(dirname(devEnvPath), { recursive: true });
|
|
5325
|
+
fs6.writeFileSync(
|
|
5326
|
+
devEnvPath,
|
|
5327
|
+
JSON.stringify({
|
|
5328
|
+
configType: "DEV_ENVIRONMENT",
|
|
5329
|
+
branch: activationConfig.branch
|
|
5330
|
+
})
|
|
5331
|
+
);
|
|
5332
|
+
if (activationConfig.downloadURL) {
|
|
5333
|
+
try {
|
|
5334
|
+
logger.info("Downloading workspace archive...");
|
|
5335
|
+
const downloadStart = Date.now();
|
|
5336
|
+
const downloadResp = await fetch(activationConfig.downloadURL, {
|
|
5337
|
+
signal: AbortSignal.timeout(3e4)
|
|
5338
|
+
});
|
|
5339
|
+
if (!downloadResp.ok || !downloadResp.body) {
|
|
5340
|
+
throw new Error(
|
|
5341
|
+
`Workspace download failed: ${downloadResp.status} ${downloadResp.statusText}`
|
|
5342
|
+
);
|
|
5343
|
+
}
|
|
5344
|
+
logger.info(
|
|
5345
|
+
`Workspace download completed in ${Date.now() - downloadStart}ms, extracting...`
|
|
5346
|
+
);
|
|
5347
|
+
const extractStart = Date.now();
|
|
5348
|
+
await new Promise((resolveExtract, rejectExtract) => {
|
|
5349
|
+
const zstdProc = child_process.spawn("zstd", ["-d"], {
|
|
5350
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
5351
|
+
});
|
|
5352
|
+
const tarProc = child_process.spawn(
|
|
5353
|
+
"tar",
|
|
5354
|
+
["xf", "-", "-C", process.cwd()],
|
|
5355
|
+
{
|
|
5356
|
+
stdio: ["pipe", "inherit", "pipe"]
|
|
5357
|
+
}
|
|
5358
|
+
);
|
|
5359
|
+
zstdProc.stdout.pipe(tarProc.stdin);
|
|
5360
|
+
zstdProc.stdin.on("error", (err) => {
|
|
5361
|
+
rejectExtract(new Error(`zstd stdin stream error: ${err.message}`));
|
|
5362
|
+
});
|
|
5363
|
+
tarProc.stdin.on("error", (err) => {
|
|
5364
|
+
rejectExtract(new Error(`tar stdin stream error: ${err.message}`));
|
|
5365
|
+
});
|
|
5366
|
+
const reader = downloadResp.body.getReader();
|
|
5367
|
+
const pump = async () => {
|
|
5368
|
+
while (true) {
|
|
5369
|
+
const { done, value } = await reader.read();
|
|
5370
|
+
if (done) {
|
|
5371
|
+
zstdProc.stdin.end();
|
|
5372
|
+
break;
|
|
5373
|
+
}
|
|
5374
|
+
if (!zstdProc.stdin.write(value)) {
|
|
5375
|
+
await new Promise((r) => zstdProc.stdin.once("drain", r));
|
|
5376
|
+
}
|
|
5377
|
+
}
|
|
5378
|
+
};
|
|
5379
|
+
pump().catch((e) => {
|
|
5380
|
+
zstdProc.kill();
|
|
5381
|
+
tarProc.kill();
|
|
5382
|
+
rejectExtract(e);
|
|
5383
|
+
});
|
|
5384
|
+
let stderr = "";
|
|
5385
|
+
zstdProc.stderr.on("data", (chunk) => {
|
|
5386
|
+
stderr += chunk.toString();
|
|
5387
|
+
});
|
|
5388
|
+
tarProc.stderr?.on("data", (chunk) => {
|
|
5389
|
+
stderr += chunk.toString();
|
|
5390
|
+
});
|
|
5391
|
+
let zstdExitCode = null;
|
|
5392
|
+
zstdProc.on("close", (code) => {
|
|
5393
|
+
zstdExitCode = code;
|
|
5394
|
+
});
|
|
5395
|
+
tarProc.on("close", (code) => {
|
|
5396
|
+
if (zstdExitCode !== null && zstdExitCode !== 0) {
|
|
5397
|
+
rejectExtract(
|
|
5398
|
+
new Error(
|
|
5399
|
+
`zstd decompression failed (code ${zstdExitCode}): ${stderr}`
|
|
5400
|
+
)
|
|
5401
|
+
);
|
|
5402
|
+
} else if (code === 0) {
|
|
5403
|
+
resolveExtract();
|
|
5404
|
+
} else {
|
|
5405
|
+
rejectExtract(
|
|
5406
|
+
new Error(`tar extract failed (code ${code}): ${stderr}`)
|
|
5407
|
+
);
|
|
5408
|
+
}
|
|
5409
|
+
});
|
|
5410
|
+
tarProc.on("error", rejectExtract);
|
|
5411
|
+
zstdProc.on("error", rejectExtract);
|
|
5412
|
+
});
|
|
5413
|
+
logger.info(
|
|
5414
|
+
`Workspace extracted in ${Date.now() - extractStart}ms (total ${Date.now() - downloadStart}ms)`
|
|
5415
|
+
);
|
|
5416
|
+
} catch (error) {
|
|
5417
|
+
logger.warn(
|
|
5418
|
+
`Workspace download/extract failed, DBFS will fill the gap: ${error}`
|
|
5419
|
+
);
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
this.currentToken = activationConfig.token;
|
|
5423
|
+
this.superblocksBaseUrl = activationConfig.baseUrl;
|
|
5424
|
+
this.applicationConfig = {
|
|
5425
|
+
id: activationConfig.applicationId,
|
|
5426
|
+
branchName: activationConfig.branch
|
|
5427
|
+
};
|
|
5428
|
+
this.warmStandbyActivated = true;
|
|
5429
|
+
this.flags = {
|
|
5430
|
+
...this.flags,
|
|
5431
|
+
"download-first": true
|
|
5432
|
+
};
|
|
5433
|
+
await this.initializeTelemetry(activationConfig.token);
|
|
5434
|
+
await this.executeWithToken(activationConfig.token);
|
|
5435
|
+
}
|
|
5164
5436
|
async spawnAndWaitForChild(previousRunResult, flags) {
|
|
5165
5437
|
let _resolve;
|
|
5166
5438
|
const promise = new Promise((resolve2) => {
|
|
@@ -5978,12 +6250,12 @@ var McpServe = class _McpServe extends Command9 {
|
|
|
5978
6250
|
"HTTP transport requires auth token. Pass --http-token <token> or set SUPERBLOCKS_MCP_HTTP_TOKEN."
|
|
5979
6251
|
);
|
|
5980
6252
|
}
|
|
5981
|
-
const { startHttpServer } = await import("./http-
|
|
6253
|
+
const { startHttpServer } = await import("./http-IOIOPQJJ.js");
|
|
5982
6254
|
await startHttpServer({ port: flags.port, authToken: httpToken });
|
|
5983
6255
|
await new Promise(() => {
|
|
5984
6256
|
});
|
|
5985
6257
|
} else {
|
|
5986
|
-
const { startServer } = await import("./dist-
|
|
6258
|
+
const { startServer } = await import("./dist-PUVCR3ZI.js");
|
|
5987
6259
|
await startServer();
|
|
5988
6260
|
await new Promise((resolve2) => {
|
|
5989
6261
|
process.stdin.once("end", () => resolve2());
|
|
@@ -7466,7 +7738,7 @@ function getResourceIdFromLocation(ctx, resourceLocation) {
|
|
|
7466
7738
|
// src/commands/sync.mts
|
|
7467
7739
|
init_cjs_shims();
|
|
7468
7740
|
import { execFile } from "node:child_process";
|
|
7469
|
-
import * as
|
|
7741
|
+
import * as fs12 from "node:fs/promises";
|
|
7470
7742
|
import * as os from "node:os";
|
|
7471
7743
|
import path17 from "node:path";
|
|
7472
7744
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -7560,7 +7832,7 @@ var Sync = class _Sync extends Command11 {
|
|
|
7560
7832
|
appRelativePath,
|
|
7561
7833
|
requestedSha
|
|
7562
7834
|
}) {
|
|
7563
|
-
const worktreeBase = await
|
|
7835
|
+
const worktreeBase = await fs12.mkdtemp(
|
|
7564
7836
|
path17.join(os.tmpdir(), "superblocks-sync-main-")
|
|
7565
7837
|
);
|
|
7566
7838
|
const worktreePath = path17.join(worktreeBase, "worktree");
|
|
@@ -7620,7 +7892,7 @@ var Sync = class _Sync extends Command11 {
|
|
|
7620
7892
|
);
|
|
7621
7893
|
} catch {
|
|
7622
7894
|
}
|
|
7623
|
-
await
|
|
7895
|
+
await fs12.rm(worktreeBase, { recursive: true, force: true });
|
|
7624
7896
|
}
|
|
7625
7897
|
}
|
|
7626
7898
|
async resolveRepoRoot(localDirectoryPath) {
|
|
@@ -7657,7 +7929,7 @@ var Sync = class _Sync extends Command11 {
|
|
|
7657
7929
|
return snapshotAppPath;
|
|
7658
7930
|
}
|
|
7659
7931
|
const uploadPath = path17.join(worktreeBase, "upload");
|
|
7660
|
-
await
|
|
7932
|
+
await fs12.cp(snapshotAppPath, uploadPath, {
|
|
7661
7933
|
recursive: true,
|
|
7662
7934
|
force: true,
|
|
7663
7935
|
filter: (sourcePath) => path17.basename(sourcePath) !== ".git"
|