@cimplify/cli 0.11.0 → 0.11.1
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/dist/{chunk-WF5HX2WB.mjs → chunk-3NDTR4GA.mjs} +1 -1
- package/dist/{chunk-PQUWRUVT.mjs → chunk-OMAF2H6T.mjs} +1 -1
- package/dist/{dev-OF335HZZ.mjs → dev-B4YUYQ4I.mjs} +30 -10
- package/dist/dispatcher.mjs +7 -7
- package/dist/{doctor-O2XLOCBB.mjs → doctor-LAKJKBFU.mjs} +2 -2
- package/dist/{explain-327PXAY6.mjs → explain-EZ7DC4KE.mjs} +1 -1
- package/dist/{introspect-P3BJ7WQL.mjs → introspect-HVT3TMAM.mjs} +2 -2
- package/dist/{update-TEHVCICJ.mjs → update-74UVN3R7.mjs} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { gitDetectRoot, gitCurrentBranch, gitCurrentSha, gitStatusPorcelain } from './chunk-K5464A3L.mjs';
|
|
3
3
|
import { parseEnvFile } from './chunk-DBZ3UOQ2.mjs';
|
|
4
|
-
import { package_default } from './chunk-
|
|
4
|
+
import { package_default } from './chunk-OMAF2H6T.mjs';
|
|
5
5
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
6
6
|
import { readAuthOrNull, readProjectLinkOrNull, readProjectState } from './chunk-UBAI443T.mjs';
|
|
7
7
|
import { bold, dim, yellow, green, info, result, red } from './chunk-E2T2SBP5.mjs';
|
|
@@ -128,7 +128,7 @@ var TunnelClient = class {
|
|
|
128
128
|
socket.addEventListener("message", (event) => this.handleMessage(event.data));
|
|
129
129
|
socket.addEventListener(
|
|
130
130
|
"close",
|
|
131
|
-
(event) => this.teardown(`connection closed (${event.code ?? "unknown"})
|
|
131
|
+
(event) => this.teardown(`connection closed (${event.code ?? "unknown"})`, event.code)
|
|
132
132
|
);
|
|
133
133
|
socket.addEventListener("error", () => this.teardown("connection error"));
|
|
134
134
|
}
|
|
@@ -140,7 +140,7 @@ var TunnelClient = class {
|
|
|
140
140
|
}
|
|
141
141
|
this.teardown("stopped");
|
|
142
142
|
}
|
|
143
|
-
teardown(reason) {
|
|
143
|
+
teardown(reason, closeCode) {
|
|
144
144
|
if (this.closed) return;
|
|
145
145
|
this.closed = true;
|
|
146
146
|
for (const handler of this.streams.values()) {
|
|
@@ -148,7 +148,7 @@ var TunnelClient = class {
|
|
|
148
148
|
}
|
|
149
149
|
this.streams.clear();
|
|
150
150
|
this.socket = null;
|
|
151
|
-
this.options.events?.onClosed?.(reason);
|
|
151
|
+
this.options.events?.onClosed?.(reason, closeCode);
|
|
152
152
|
}
|
|
153
153
|
handleMessage(data) {
|
|
154
154
|
if (this.closed) return;
|
|
@@ -512,11 +512,15 @@ function sameTunnelConfig(a, b) {
|
|
|
512
512
|
if (a === null || b === null) return a === b;
|
|
513
513
|
return a.url === b.url && a.token === b.token && a.localPort === b.localPort;
|
|
514
514
|
}
|
|
515
|
+
function sameTunnelEndpoint(a, b) {
|
|
516
|
+
return a.url === b.url && a.localPort === b.localPort;
|
|
517
|
+
}
|
|
515
518
|
|
|
516
519
|
// src/tunnel/manager.ts
|
|
517
520
|
var CONFIG_POLL_MS = 2e3;
|
|
518
521
|
var RECONNECT_MIN_MS = 1e3;
|
|
519
522
|
var RECONNECT_MAX_MS = 3e4;
|
|
523
|
+
var CLOSE_CODE_REPLACED = 4e3;
|
|
520
524
|
function defaultCreateClient(config, events) {
|
|
521
525
|
return new TunnelClient({
|
|
522
526
|
url: config.url,
|
|
@@ -536,6 +540,8 @@ function startTunnelRuntime(cwd, options = {}) {
|
|
|
536
540
|
let reconnectDelay = RECONNECT_MIN_MS;
|
|
537
541
|
let reconnectTimer = null;
|
|
538
542
|
let polling = false;
|
|
543
|
+
let connected = false;
|
|
544
|
+
let standDown = false;
|
|
539
545
|
const clearReconnect = () => {
|
|
540
546
|
if (reconnectTimer !== null) {
|
|
541
547
|
clearTimeout(reconnectTimer);
|
|
@@ -544,15 +550,23 @@ function startTunnelRuntime(cwd, options = {}) {
|
|
|
544
550
|
};
|
|
545
551
|
const startClient = (config) => {
|
|
546
552
|
generation += 1;
|
|
553
|
+
standDown = false;
|
|
547
554
|
const myGeneration = generation;
|
|
548
555
|
const client = createClient(config, {
|
|
549
556
|
onConnected: () => {
|
|
550
557
|
if (stopped || myGeneration !== generation) return;
|
|
558
|
+
connected = true;
|
|
551
559
|
reconnectDelay = RECONNECT_MIN_MS;
|
|
552
560
|
onStatus("(preview tunnel: connected)");
|
|
553
561
|
},
|
|
554
|
-
onClosed: (reason) => {
|
|
562
|
+
onClosed: (reason, closeCode) => {
|
|
555
563
|
if (stopped || myGeneration !== generation) return;
|
|
564
|
+
connected = false;
|
|
565
|
+
if (closeCode === CLOSE_CODE_REPLACED) {
|
|
566
|
+
standDown = true;
|
|
567
|
+
onStatus("(preview tunnel: replaced by a newer agent; standing down)");
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
556
570
|
onStatus(`(preview tunnel: disconnected \u2014 ${reason})`);
|
|
557
571
|
scheduleReconnect();
|
|
558
572
|
}
|
|
@@ -581,6 +595,7 @@ function startTunnelRuntime(cwd, options = {}) {
|
|
|
581
595
|
clearReconnect();
|
|
582
596
|
retireClient();
|
|
583
597
|
activeConfig = null;
|
|
598
|
+
connected = false;
|
|
584
599
|
};
|
|
585
600
|
const poll = async () => {
|
|
586
601
|
if (polling || stopped) return;
|
|
@@ -588,14 +603,19 @@ function startTunnelRuntime(cwd, options = {}) {
|
|
|
588
603
|
try {
|
|
589
604
|
const config = await readTunnelConfig(cwd, options.env);
|
|
590
605
|
if (stopped || sameTunnelConfig(config, activeConfig)) return;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
onStatus("(preview tunnel: credentials found, connecting)");
|
|
594
|
-
reconnectDelay = RECONNECT_MIN_MS;
|
|
595
|
-
startClient(config);
|
|
596
|
-
} else {
|
|
606
|
+
if (config === null) {
|
|
607
|
+
stopClient();
|
|
597
608
|
onStatus("(preview tunnel: credentials removed, stopped)");
|
|
609
|
+
return;
|
|
598
610
|
}
|
|
611
|
+
if (activeConfig && sameTunnelEndpoint(config, activeConfig) && connected && !standDown) {
|
|
612
|
+
activeConfig = config;
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
stopClient();
|
|
616
|
+
onStatus("(preview tunnel: credentials found, connecting)");
|
|
617
|
+
reconnectDelay = RECONNECT_MIN_MS;
|
|
618
|
+
startClient(config);
|
|
599
619
|
} finally {
|
|
600
620
|
polling = false;
|
|
601
621
|
}
|
package/dist/dispatcher.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-OMAF2H6T.mjs';
|
|
3
3
|
import { TEMPLATES } from './chunk-W3WLADJP.mjs';
|
|
4
4
|
|
|
5
5
|
// src/dispatcher.ts
|
|
@@ -142,18 +142,18 @@ var COMMANDS = {
|
|
|
142
142
|
domains: () => import('./domains-H3K2WW55.mjs'),
|
|
143
143
|
logs: () => import('./logs-2ECJQ3MU.mjs'),
|
|
144
144
|
status: () => import('./status-IA7PJ4TV.mjs'),
|
|
145
|
-
dev: () => import('./dev-
|
|
145
|
+
dev: () => import('./dev-B4YUYQ4I.mjs'),
|
|
146
146
|
mock: () => import('./mock-TSUKCLWU.mjs'),
|
|
147
|
-
introspect: () => import('./introspect-
|
|
147
|
+
introspect: () => import('./introspect-HVT3TMAM.mjs'),
|
|
148
148
|
inspect: () => import('./inspect-CGYX4DDF.mjs'),
|
|
149
|
-
doctor: () => import('./doctor-
|
|
150
|
-
explain: () => import('./explain-
|
|
149
|
+
doctor: () => import('./doctor-LAKJKBFU.mjs'),
|
|
150
|
+
explain: () => import('./explain-EZ7DC4KE.mjs'),
|
|
151
151
|
assets: () => import('./assets-4D7VXRUE.mjs'),
|
|
152
152
|
repo: () => import('./repo-WSUAHXWO.mjs'),
|
|
153
153
|
list: () => import('./list-27TS2L47.mjs'),
|
|
154
154
|
add: () => import('./add-5ODVFWVR.mjs'),
|
|
155
|
-
update: () => import('./update-
|
|
156
|
-
upgrade: () => import('./update-
|
|
155
|
+
update: () => import('./update-74UVN3R7.mjs'),
|
|
156
|
+
upgrade: () => import('./update-74UVN3R7.mjs'),
|
|
157
157
|
"auth-step-up": () => import('./auth-step-up-NOSM4PUR.mjs')
|
|
158
158
|
};
|
|
159
159
|
var COMMAND_PREFIXES = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { gatherIntrospection } from './chunk-
|
|
2
|
+
import { gatherIntrospection } from './chunk-3NDTR4GA.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-OMAF2H6T.mjs';
|
|
6
6
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import { SDK_ENV_API_URL, DEFAULT_API_BASE_URL, ApiClient, ENV_API_BASE_URL } from './chunk-F4S5KETY.mjs';
|
|
8
8
|
import { readAuthOrNull } from './chunk-UBAI443T.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-OMAF2H6T.mjs';
|
|
3
3
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { bold, dim, info, result, CliError, CLI_ERROR_CODE } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-
|
|
2
|
+
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-3NDTR4GA.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-OMAF2H6T.mjs';
|
|
6
6
|
import './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import './chunk-UBAI443T.mjs';
|
|
8
8
|
import './chunk-E2T2SBP5.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-OMAF2H6T.mjs';
|
|
3
3
|
import { promptYesNo } from './chunk-ITAFAORS.mjs';
|
|
4
4
|
import { parseArgs, flagBool, flagString } from './chunk-C4M3DXKC.mjs';
|
|
5
5
|
import { success, bold, info, dim, result, failure, CliError, CLI_ERROR_CODE, step, isJsonMode } from './chunk-E2T2SBP5.mjs';
|