@hs-x/cli 0.4.13 → 0.4.14
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/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +20 -58
- package/dist/commands/dev.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/dev/component-selection.d.ts +1 -0
- package/dist/dev/component-selection.d.ts.map +1 -1
- package/dist/dev/component-selection.js +6 -0
- package/dist/dev/component-selection.js.map +1 -1
- package/dist/dev/hubspot-log-lane.d.ts +27 -0
- package/dist/dev/hubspot-log-lane.d.ts.map +1 -0
- package/dist/dev/hubspot-log-lane.js +73 -0
- package/dist/dev/hubspot-log-lane.js.map +1 -0
- package/dist/dev/keyboard.d.ts.map +1 -1
- package/dist/dev/keyboard.js +10 -2
- package/dist/dev/keyboard.js.map +1 -1
- package/dist/dev/session-manager.d.ts +2 -0
- package/dist/dev/session-manager.d.ts.map +1 -1
- package/dist/dev/session-manager.js +3 -0
- package/dist/dev/session-manager.js.map +1 -1
- package/dist/dev/startup-progress.d.ts +7 -0
- package/dist/dev/startup-progress.d.ts.map +1 -0
- package/dist/dev/startup-progress.js +27 -0
- package/dist/dev/startup-progress.js.map +1 -0
- package/dist/prompt.d.ts +9 -0
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +46 -15
- package/dist/prompt.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAI/C,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAI/C,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,iBAAiB,CAAC;AA8D1D,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AA09BzC,wBAAsB,UAAU,CAAC,EAC/B,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CAC9B,GAAG,OAAO,CAAC,SAAS,CAAC,CA0ErB;AA2vFD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqJlB,CAAC"}
|
package/dist/commands/dev.js
CHANGED
|
@@ -17,9 +17,11 @@ import { CLI_VERSION } from '../constants.js';
|
|
|
17
17
|
import { controlPlaneAuthHeaders } from '../control-plane-fetch.js';
|
|
18
18
|
import { describeHubSpotDevTestingChoice, describeHubSpotDevTestingPlanReason, planHubSpotDevTestingAccount, selectHubSpotDirectDevAccounts, } from '../dev/account-selection.js';
|
|
19
19
|
import { findHubSpotDevApplication, isHubSpotMarketplaceApp, listHubSpotDevComponentCandidates, resolveHubSpotDevComponentSelectors, resolveHubSpotDevSessionApp, } from '../dev/component-selection.js';
|
|
20
|
+
import { HUBSPOT_LOGS_POLL_INTERVAL_MS, startHubSpotLogLane, } from '../dev/hubspot-log-lane.js';
|
|
20
21
|
import { resolveHubSpotLocalProxyMode } from '../dev/local-proxy.js';
|
|
21
22
|
import { createManagedDevEventWriter, createManagedDevSession, markManagedDevSessionReady, markManagedDevSessionState, prepareManagedDevSessionRestart, publicManagedDevSession, readManagedDevEvents, readManagedDevSession, reconcileManagedDevSession, setManagedDevSessionPid, stopManagedDevSessionProcess, waitForManagedDevSessionOwner, } from '../dev/managed-session.js';
|
|
22
23
|
import { findListeningProcess, isHubSpotDevPortConflict, stopProcessCommand, terminateProcessGracefully, } from '../dev/port-process.js';
|
|
24
|
+
import { createDevStartupProgress } from '../dev/startup-progress.js';
|
|
23
25
|
import { executeCliHttp } from '../effect-http.js';
|
|
24
26
|
import { discoverHubSpotAccounts, exchangePak } from '../hubspot-auth.js';
|
|
25
27
|
import { detectLocalProjectMode, findContainingProjectRoot, validateHubSpotProject, } from '../hubspot-project.js';
|
|
@@ -502,10 +504,12 @@ async function hubSpotDirectDevCommand({ argv, root, json, }) {
|
|
|
502
504
|
const check = resolveHubSpotDevSessionApp(pickerCandidates, selection);
|
|
503
505
|
return check.ok ? undefined : check.message;
|
|
504
506
|
},
|
|
507
|
+
columns: ['Name', 'Type', 'Objects', 'Location', 'UID'],
|
|
505
508
|
options: pickerCandidates.map((candidate) => ({
|
|
506
509
|
value: candidate.uid,
|
|
507
510
|
label: candidate.label,
|
|
508
511
|
description: candidate.description,
|
|
512
|
+
...(candidate.cells ? { cells: candidate.cells } : {}),
|
|
509
513
|
})),
|
|
510
514
|
});
|
|
511
515
|
if (picked === undefined)
|
|
@@ -554,6 +558,7 @@ async function hubSpotDirectDevCommand({ argv, root, json, }) {
|
|
|
554
558
|
}
|
|
555
559
|
}
|
|
556
560
|
}
|
|
561
|
+
const startupProgress = json ? undefined : createDevStartupProgress(reporter);
|
|
557
562
|
let directDevLogStream;
|
|
558
563
|
if (!json) {
|
|
559
564
|
const hsxLogPortValue = resolveFlag(argv, '--hsx-log-port') ?? '9099';
|
|
@@ -579,6 +584,7 @@ async function hubSpotDirectDevCommand({ argv, root, json, }) {
|
|
|
579
584
|
return { exitCode: 2 };
|
|
580
585
|
}
|
|
581
586
|
const managedSessionId = resolveFlag(argv, '--managed-session');
|
|
587
|
+
startupProgress?.phase('Starting local log relay');
|
|
582
588
|
directDevLogStream = await startHsxDevLogStream({
|
|
583
589
|
port: hsxLogPort,
|
|
584
590
|
root,
|
|
@@ -592,6 +598,7 @@ async function hubSpotDirectDevCommand({ argv, root, json, }) {
|
|
|
592
598
|
const startDirectSession = () => startDevSession({
|
|
593
599
|
projectAccountId: projectAccount.portalId,
|
|
594
600
|
testingAccountId: testingAccount.portalId,
|
|
601
|
+
...(startupProgress ? { onStartupProgress: startupProgress.phase } : {}),
|
|
595
602
|
projectDir: root,
|
|
596
603
|
...(selectedNodeUids ? { selectedNodeUids } : {}),
|
|
597
604
|
...(profile ? { profile } : {}),
|
|
@@ -657,6 +664,7 @@ async function hubSpotDirectDevCommand({ argv, root, json, }) {
|
|
|
657
664
|
if (isHubSpotDevPortConflict(initialCause)) {
|
|
658
665
|
const recovery = await recoverHubSpotDevPort({ argv, json, reporter });
|
|
659
666
|
if (recovery.kind === 'exit') {
|
|
667
|
+
startupProgress?.finish(true);
|
|
660
668
|
try {
|
|
661
669
|
await directDevLogStream?.cleanup();
|
|
662
670
|
}
|
|
@@ -676,6 +684,7 @@ async function hubSpotDirectDevCommand({ argv, root, json, }) {
|
|
|
676
684
|
}
|
|
677
685
|
}
|
|
678
686
|
}
|
|
687
|
+
startupProgress?.finish(!session);
|
|
679
688
|
if (!session) {
|
|
680
689
|
if (directDevLogStream) {
|
|
681
690
|
try {
|
|
@@ -2282,9 +2291,6 @@ function managedDevFollowReadFilter(filter) {
|
|
|
2282
2291
|
function delayMs(ms) {
|
|
2283
2292
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2284
2293
|
}
|
|
2285
|
-
const HUBSPOT_LOGS_POLL_INTERVAL_MS = 30_000;
|
|
2286
|
-
/** First poll reaches this far back so the lane shows recent activity at once. */
|
|
2287
|
-
const HUBSPOT_LOGS_CATCH_UP_MS = 2 * 60_000;
|
|
2288
2294
|
async function startHsxDevLogStream(input) {
|
|
2289
2295
|
try {
|
|
2290
2296
|
const [{ createDevEventBus }, { startDevLogServer }, { startDevStreamRenderer }] = await Promise.all([
|
|
@@ -2307,68 +2313,22 @@ async function startHsxDevLogStream(input) {
|
|
|
2307
2313
|
const unsubscribeManagedEvents = managedEventWriter
|
|
2308
2314
|
? bus.subscribe((event) => managedEventWriter.log(event))
|
|
2309
2315
|
: undefined;
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
let hubspotLane = {
|
|
2316
|
-
active: false,
|
|
2317
|
-
reason: 'HubSpot app logs could not be set up.',
|
|
2318
|
-
};
|
|
2319
|
-
try {
|
|
2320
|
-
const [{ resolveHubSpotLogsSource }, { startHubSpotLogsPoller }] = await Promise.all([
|
|
2321
|
-
import('../hubspot-app-logs.js'),
|
|
2322
|
-
import('../dev/hubspot-logs-poller.js'),
|
|
2323
|
-
]);
|
|
2324
|
-
const account = input.hubspotAccount;
|
|
2325
|
-
const resolution = await resolveHubSpotLogsSource({
|
|
2326
|
-
cwd: input.root,
|
|
2327
|
-
...(account?.personalAccessKey
|
|
2328
|
-
? {
|
|
2329
|
-
credentials: {
|
|
2330
|
-
developerAccountId: account.portalId,
|
|
2331
|
-
personalAccessKey: account.personalAccessKey,
|
|
2332
|
-
},
|
|
2333
|
-
}
|
|
2334
|
-
: {}),
|
|
2335
|
-
});
|
|
2336
|
-
if (resolution.ok) {
|
|
2337
|
-
hubspotPoller = startHubSpotLogsPoller({
|
|
2338
|
-
bus,
|
|
2339
|
-
source: resolution.source,
|
|
2340
|
-
intervalMs: HUBSPOT_LOGS_POLL_INTERVAL_MS,
|
|
2341
|
-
catchUpMs: HUBSPOT_LOGS_CATCH_UP_MS,
|
|
2342
|
-
});
|
|
2343
|
-
// Poll once now so the lane proves itself (or its first error) within
|
|
2344
|
-
// seconds of startup instead of one interval later.
|
|
2345
|
-
void hubspotPoller.poll();
|
|
2346
|
-
hubspotLane = {
|
|
2347
|
-
active: true,
|
|
2348
|
-
appId: resolution.source.appId,
|
|
2349
|
-
developerAccountId: resolution.source.developerAccountId,
|
|
2350
|
-
};
|
|
2351
|
-
}
|
|
2352
|
-
else {
|
|
2353
|
-
hubspotLane = { active: false, reason: resolution.reason };
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
catch (cause) {
|
|
2357
|
-
// The HubSpot lane is additive; never fail the dev stream over it.
|
|
2358
|
-
hubspotLane = {
|
|
2359
|
-
active: false,
|
|
2360
|
-
reason: cause instanceof Error ? cause.message : String(cause),
|
|
2361
|
-
};
|
|
2362
|
-
}
|
|
2316
|
+
const hubspotLane = startHubSpotLogLane({
|
|
2317
|
+
root: input.root,
|
|
2318
|
+
bus,
|
|
2319
|
+
account: input.hubspotAccount,
|
|
2320
|
+
});
|
|
2363
2321
|
return {
|
|
2364
2322
|
url: server.url,
|
|
2365
2323
|
authToken,
|
|
2366
2324
|
renderer,
|
|
2367
2325
|
bus,
|
|
2368
|
-
hubspotLane
|
|
2326
|
+
get hubspotLane() {
|
|
2327
|
+
return hubspotLane.state;
|
|
2328
|
+
},
|
|
2369
2329
|
relay,
|
|
2370
2330
|
async cleanup() {
|
|
2371
|
-
|
|
2331
|
+
hubspotLane.stop();
|
|
2372
2332
|
unsubscribeManagedEvents?.();
|
|
2373
2333
|
renderer.stop();
|
|
2374
2334
|
await Promise.all([server.close(), managedEventWriter?.close()]);
|
|
@@ -3218,6 +3178,8 @@ function hubspotLogsLaneRow(lane) {
|
|
|
3218
3178
|
status: 'ok',
|
|
3219
3179
|
};
|
|
3220
3180
|
}
|
|
3181
|
+
if (lane.pending)
|
|
3182
|
+
return { key: 'HubSpot app logs', value: 'connecting', detail: lane.reason };
|
|
3221
3183
|
return { key: 'HubSpot app logs', value: 'off', detail: lane.reason, status: 'warn' };
|
|
3222
3184
|
}
|
|
3223
3185
|
function describeTestingChoiceForRow(choice) {
|