stim 1.20.2 → 1.22.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/README.md +141 -8
- package/dist/acquire-artifact-Co2k4f7O.mjs +171 -0
- package/dist/act-DsuqEkiM.mjs +2801 -0
- package/dist/activity-CMLmzp7o.mjs +1397 -0
- package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-DUFaTMdd.mjs} +23 -67
- package/dist/{android-DCKZrNvV.mjs → android-ByRMUoiJ.mjs} +157 -93
- package/dist/{android-Mz_Inn3w.mjs → android-C7sVmyI9.mjs} +299 -116
- package/dist/{android-Dlzxshgp.mjs → android-DGkNqa_c.mjs} +5 -5
- package/dist/{android-HqP1_vB_.mjs → android-DR5lZ2Az.mjs} +2 -2
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-ngferVq2.mjs} +7 -6
- package/dist/android-project-BCAAmMwz.mjs +12 -0
- package/dist/android-project-DVWyCbWU.d.mts +391 -0
- package/dist/api.d.mts +810 -64
- package/dist/api.mjs +782 -1
- package/dist/{artifact-HSwkIWEQ.mjs → artifact-8EY8SAPw.mjs} +240 -213
- package/dist/{artifact-D3czlUvT.mjs → artifact-DJPy518Y.mjs} +203 -164
- package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
- package/dist/{browser-web-CA-F1GQo.mjs → browser-web-Bcv99PBM.mjs} +194 -64
- package/dist/budget-Cvwn54qV.mjs +9285 -0
- package/dist/{build-DYDbfkk5.mjs → build-CabC3G23.mjs} +153 -98
- package/dist/build-cache-Dv7RN200.mjs +602 -0
- package/dist/build-plan-DUC8Ka9y.mjs +248 -0
- package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DSeQjt-Q.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-zdKiYQ3E.mjs → ccache-Btwc36-I.mjs} +10 -9
- package/dist/{cdp-Dq_ypAlJ.mjs → cdp-3fwICjzi.mjs} +18 -5
- package/dist/{chrome-BnzZMqsR.mjs → chrome-Bbw689-6.mjs} +7 -4
- package/dist/{cli-CLP3diBm.mjs → cli-CHZa9Lvk.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/client-OyRoEuSr.mjs +1577 -0
- package/dist/collector-run.d.mts +4 -40
- package/dist/collector-run.mjs +9 -8
- package/dist/{command-output-BTy8hZ0F.mjs → command-output-gwpm28fu.mjs} +1 -1
- package/dist/config-DlrsduwG.mjs +955 -0
- package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-x9rN6bhs.mjs} +14 -4
- package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-1I9KZT1Y.mjs} +20 -5
- package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
- package/dist/{dev-client-DAWVIGBu.mjs → dev-client-BSDR5h3F.mjs} +2 -2
- package/dist/{device-BECOiufl.mjs → device-B-L3Fbxy.mjs} +91 -34
- package/dist/device-DklWZLqb.mjs +1068 -0
- package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-DK5_EwRS.mjs} +42 -13
- package/dist/device-host-worker.mjs +76 -79
- package/dist/{device-ios-COSi6oS1.mjs → device-ios-DoB6KFCO.mjs} +77 -51
- package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-xJPQ_QQG.mjs} +14 -26
- package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-BMkdsefq.mjs} +5 -5
- package/dist/{doctor-kfMBnUw6.mjs → doctor-Bo7BXLux.mjs} +271 -320
- package/dist/{doctor-CB8oZKCk.mjs → doctor-D5_EzwfA.mjs} +186 -91
- package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
- package/dist/doctor-fingerprint.mjs +19 -0
- package/dist/doctor-thjWAV0z.mjs +2 -0
- package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-N2wDotwQ.mjs} +40 -21
- package/dist/{eas-build-JyfqyHfC.mjs → eas-build-CwknaQYj.mjs} +53 -20
- package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-CSgAulr5.mjs} +41 -214
- package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-DlY_serQ.mjs} +230 -11
- package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-DBWO2rxE.mjs} +172 -82
- package/dist/exec-DEoAhcze.mjs +858 -0
- package/dist/exec-DnYc4HGH.d.mts +78 -0
- package/dist/{gc-qWOMdnER.mjs → gc-CXxN-4SE.mjs} +1091 -1029
- package/dist/gc-DnNDQyaP.mjs +3 -0
- package/dist/{guide-G9cAbVAc.mjs → guide-Br0LEfKy.mjs} +1165 -297
- package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-B-9f-jkd.mjs} +10 -8
- package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DZAPrcro.mjs} +34 -19
- package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CsCS21hn.mjs} +1 -1
- package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-FIRx9X2f.mjs} +77 -43
- package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-_awYSpfv.mjs} +35 -22
- package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-BdzE668-.mjs} +49 -27
- package/dist/idle-C4cZ757K.d.mts +24 -0
- package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DDg3SdvY.mjs} +11 -10
- package/dist/ios-CDvlmUs7.d.mts +24 -0
- package/dist/{ios-BwVCF7oA.mjs → ios-Ds1clbIt.mjs} +8 -8
- package/dist/{ios-device-D7pi2Sca.mjs → ios-device--h_-8ENa.mjs} +51 -26
- package/dist/{ios-device-B5veSDDQ.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
- package/dist/{ios-RkW4pnQf.mjs → ios-hcBpnEGk.mjs} +200 -93
- package/dist/{ios-Ce7bc7br.mjs → ios-pm4nL6By.mjs} +160 -108
- package/dist/{ios-project-K9hY_Jab.mjs → ios-project-CZhKODF3.mjs} +13 -13
- package/dist/ios-signing-BtAffm0A.mjs +489 -0
- package/dist/{ios-state-CBLe1xYw.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
- package/dist/{ios-nOLJGVdy.mjs → ios-xtlRHaeB.mjs} +1 -1
- package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Bwhh4S7V.mjs} +30 -25
- package/dist/{launch-C3qJ6Agb.mjs → launch-BjxemNpK.mjs} +85 -543
- package/dist/{launch-F4sOqAhB.mjs → launch-CCzXlc8r.mjs} +91 -90
- package/dist/logs-BfwwadsZ.mjs +479 -0
- package/dist/logs-jTS_lHSo.mjs +248 -0
- package/dist/{macos-D7uDvO-z.mjs → macos-DVlSSyUg.mjs} +1 -1
- package/dist/macos-NfV2D7dO.mjs +694 -0
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +123 -248
- package/dist/{metro-DnCEjCxs.mjs → metro-DiXtA3Ty.mjs} +107 -30
- package/dist/metro-gateway-CKZqKqx7.mjs +209 -0
- package/dist/{named-ports-4WopRPg-.mjs → named-ports-DkEzOfzO.mjs} +42 -90
- package/dist/native-android-CqgnOgsT.mjs +645 -0
- package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
- package/dist/native-gradle-inputs-Dnh84Zbd.mjs +211 -0
- package/dist/native-inputs-TRTTTRxt.mjs +91 -0
- package/dist/native-run-NwUuxbkg.mjs +276 -0
- package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-B7KIafpM.mjs} +11 -9
- package/dist/native-source-Y0yLhFyQ.mjs +133 -0
- package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-D_VOfFL7.mjs} +26 -18
- package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-BYDOHWLN.mjs} +104 -60
- package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
- package/dist/offload-worker.d.mts +59 -41
- package/dist/offload-worker.mjs +478 -115
- package/dist/operation-exec-BW0em61G.mjs +171 -0
- package/dist/{ownership-DCtw_2IA.mjs → ownership-C5fo5Edb.mjs} +3 -3
- package/dist/{page-DRHy329N.mjs → page-DBL2PiUU.mjs} +12 -5
- package/dist/paths-BsJMoPP2.mjs +12 -0
- package/dist/paths-DQtTgsBf.mjs +42 -0
- package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BnGgJRRZ.mjs} +5 -5
- package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-DIsMtN-d.mjs} +15 -11
- package/dist/{ports-DdSUicVo.mjs → ports-Cy1RkmuQ.mjs} +3 -3
- package/dist/prebuild-D4JoEAEs.mjs +484 -0
- package/dist/{project-_phNIJfs.mjs → project-wM_XFTvE.mjs} +65 -37
- package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-W1IuLXDt.mjs} +102 -20
- package/dist/pull-request-eODyIqZF.d.mts +124 -0
- package/dist/pull-requests.d.mts +2 -120
- package/dist/pull-requests.mjs +2 -2
- package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-6OZ7MSM7.mjs} +121 -72
- package/dist/{gradle-DSrXb6lG.mjs → react-native-build-Dvd8hC21.mjs} +292 -15
- package/dist/react-native-doctor-DsoSF1Y9.mjs +234 -0
- package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-4u1Rn-GR.mjs} +71 -39
- package/dist/{recordings-D0d5aQt0.mjs → recordings-CQmfzAh7.mjs} +12 -9
- package/dist/registration-BcRgF6Ox.mjs +51 -0
- package/dist/{reload-C8JhxjSh.mjs → reload-BzkYabB-.mjs} +94 -47
- package/dist/reload-D7AVlb8N.mjs +2 -0
- package/dist/{remote-BiR6aYjy.mjs → remote-DjGDmlTZ.mjs} +26 -18
- package/dist/result-D2Ykz_iD.mjs +435 -0
- package/dist/{run-BtPgpKks.mjs → run-DidHghD1.mjs} +5 -5
- package/dist/selection-DSMbWEX2.mjs +620 -0
- package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CafzuyFB.mjs} +3 -4
- package/dist/{server-command-CTtCkmcQ.mjs → server-command-C6QjeupS.mjs} +14 -7
- package/dist/{server-expo-DsguMGUF.mjs → server-expo-CrjB29pq.mjs} +54 -11
- package/dist/server-expo-D58c9L0M.mjs +2 -0
- package/dist/{settings-B717odTD.mjs → settings-C7O8A6ZI.mjs} +309 -119
- package/dist/settings-DpR-1Wnn.mjs +114 -0
- package/dist/settings-write-CzD60rOD.mjs +360 -0
- package/dist/settings.schema.json +176 -16
- package/dist/{simslim-CCr3rE-A.mjs → simslim-BNckWpXi.mjs} +14 -12
- package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-CbfmNgM6.mjs} +15 -20
- package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
- package/dist/stage-Bps5oius.mjs +200 -0
- package/dist/{start-TXeMmmO2.mjs → start-Br-oxqMD.mjs} +1 -1
- package/dist/start-EojN4WFz.mjs +1364 -0
- package/dist/{state-D1Icyjlu.mjs → state--smjFSTL.mjs} +55 -13
- package/dist/{state-CG_OFoaA.mjs → state-08I3hw3_.mjs} +3 -2
- package/dist/{stats-BoY5sEPU.mjs → stats-D3GerlFW.mjs} +7 -13
- package/dist/stats-report-BzaPrRm6.mjs +16 -0
- package/dist/{status-BTA7kKiQ.mjs → status-BRROykC8.mjs} +7 -5
- package/dist/status-EvrK72L2.mjs +2 -0
- package/dist/{status-WgFbkRzj.mjs → status-WBDajew2.mjs} +554 -452
- package/dist/{status-watch-C23ILtf9.mjs → status-watch-Bg_u-pwR.mjs} +222 -25
- package/dist/status-worker.d.mts +1 -0
- package/dist/status-worker.mjs +19 -0
- package/dist/stim-desktop-D5OGpYZM.mjs +112 -0
- package/dist/{stop-DR6VoDIk.mjs → stop-DTZ9uTw3.mjs} +2 -2
- package/dist/{stop-DPEhunlw.mjs → stop-Dky10AEJ.mjs} +33 -23
- package/dist/{stop-BNmBMi1F.mjs → stop-Mv6W9FAk.mjs} +137 -98
- package/dist/supervisor-run.d.mts +8 -17
- package/dist/supervisor-run.mjs +56 -28
- package/dist/{support-CwjbFs9H.mjs → support-CNioewsd.mjs} +14 -14
- package/dist/{support-DMTqj3Hm.mjs → support-yUiOjnVY.mjs} +20 -13
- package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
- package/dist/swiftpm-macos-BIak-Rxv.mjs +532 -0
- package/dist/toolchain-BY8X8HXx.mjs +2 -0
- package/dist/toolchain-DpJMHq0n.mjs +876 -0
- package/dist/{trigger-CigAYjeL.mjs → trigger-Cbyc41d_.mjs} +21 -6
- package/dist/trigger-yb_nFzPF.mjs +2 -0
- package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-CA3TgT3-.mjs} +263 -156
- package/dist/web-CZ07gd77.mjs +2 -0
- package/dist/{web-BDBMxDpx.mjs → web-DKx6yoFA.mjs} +20 -14
- package/dist/web-run.mjs +13 -12
- package/dist/windows-report.d.mts +1 -0
- package/dist/windows-report.mjs +18 -0
- package/dist/windows-report.ps1 +43 -0
- package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-U08dEzhG.mjs} +62 -58
- package/dist/{workspaces-C36s2jb9.mjs → workspaces-CpANmBlq.mjs} +1723 -1286
- package/dist/{worktree-CgvJYJ-Q.mjs → worktree-CHecZ4Oq.mjs} +1097 -547
- package/dist/worktree-ZqZVjD9K.mjs +2 -0
- package/dist/xcode-BXn9-xYx.mjs +896 -0
- package/package.json +7 -5
- package/shim/android-audio/Main.java +24 -0
- package/shim/android-audio/README.md +17 -0
- package/shim/android-audio.jar +0 -0
- package/shim/android-optimizations.gradle +7 -5
- package/dist/activity-BSV745Kz.mjs +0 -629
- package/dist/api-qvOzWyfO.mjs +0 -154
- package/dist/api-run.mjs +0 -294
- package/dist/app-install-BIKtMfPq.mjs +0 -896
- package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
- package/dist/budget-f7516Zk0.mjs +0 -4106
- package/dist/build-facts-DcLv2HSd.d.mts +0 -111
- package/dist/cancellation-C_22VQTH.mjs +0 -24
- package/dist/client-qQAaXSUs.mjs +0 -1771
- package/dist/config-BYDxlMY3.mjs +0 -562
- package/dist/device-DuiPJQSn.mjs +0 -290
- package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
- package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
- package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
- package/dist/exec-DqKo9GKJ.mjs +0 -268
- package/dist/git-DDfFzkMm.mjs +0 -45
- package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
- package/dist/logs-BGrEUaEs.mjs +0 -383
- package/dist/macos-Ch5VJmcS.mjs +0 -584
- package/dist/metro-gateway-CX9Xlkq2.mjs +0 -103
- package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
- package/dist/native-android-D5qc3-_v.mjs +0 -226
- package/dist/native-gradle-inputs-BsLRrl7u.mjs +0 -349
- package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
- package/dist/plan-C4TjdPsR.mjs +0 -260
- package/dist/prebuild-DYbucPXy.mjs +0 -212
- package/dist/preview-78a9kR_-.mjs +0 -1011
- package/dist/react-native-build-CtCccJtb.mjs +0 -239
- package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
- package/dist/remote-cache-OyOyVIS3.mjs +0 -526
- package/dist/result-CaJg5Iat.mjs +0 -186
- package/dist/server-expo-Bigriskl.mjs +0 -2
- package/dist/settings-BORNaaCO.mjs +0 -402
- package/dist/settings-vk3mJGSm.d.mts +0 -13
- package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
- package/dist/stage-KNTQopqv.mjs +0 -157
- package/dist/start-BWqzODpb.mjs +0 -1116
- package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
- package/dist/swiftpm-macos-DRNVJWlb.mjs +0 -119
- package/dist/tailnet-Dh-qiYzG.mjs +0 -265
- package/dist/toolchain-BFkAcstd.mjs +0 -2
- package/dist/toolchain-DxSsNssu.mjs +0 -1657
- package/dist/trigger-9_USgmxz.mjs +0 -2
- package/dist/web-Dq-i3wzJ.mjs +0 -2
- package/dist/worktree-DpLdCHga.mjs +0 -2
- package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
- package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { m as workspaceLogsDir$1 } from "./paths-DQtTgsBf.mjs";
|
|
2
|
+
import { W as parseDeviceSlotOption, _ as loadConfig$1, g as isPathPrefix } from "./config-DlrsduwG.mjs";
|
|
3
|
+
import { f as refuseNoProject, v as launchErrorPreview } from "./command-output-gwpm28fu.mjs";
|
|
4
|
+
import { r as readWorkspaceState$1 } from "./workspace-state-U08dEzhG.mjs";
|
|
5
|
+
import { n as findCommandWorkspace } from "./project-wM_XFTvE.mjs";
|
|
6
|
+
import { n as SOURCES$1, t as LEVELS$1 } from "./ndjson-CgE_o3Dl.mjs";
|
|
7
|
+
import { a as followAgentActions, i as followHostedLogs, n as openWorkspaceLogs } from "./logs-BfwwadsZ.mjs";
|
|
8
|
+
import { t as errorDiagnostics } from "./error-diagnostics-DBWO2rxE.mjs";
|
|
9
|
+
import { t as watchStdoutReader } from "./stdout-reader-C8yjre1x.mjs";
|
|
10
|
+
import { realpathSync } from "node:fs";
|
|
11
|
+
import { relative, sep } from "node:path";
|
|
12
|
+
import { configDir } from "@stim-cli/core";
|
|
13
|
+
import { buildCriteria, compileGrep, followLogs, logFiles, parseSince, queryLogs, recordMatches, runId, sortByTs } from "@stim-cli/core/state";
|
|
14
|
+
import chalk from "chalk";
|
|
15
|
+
//#region src/commands/logs.ts
|
|
16
|
+
const LEVEL_WIDTH = 5;
|
|
17
|
+
const SRC_WIDTH = 6;
|
|
18
|
+
const INDENT = " ";
|
|
19
|
+
function padTimePart(value, width = 2) {
|
|
20
|
+
return String(value).padStart(width, "0");
|
|
21
|
+
}
|
|
22
|
+
function formatTime(ts) {
|
|
23
|
+
if (typeof ts !== "number" || !Number.isFinite(ts)) return "--:--:--.---";
|
|
24
|
+
const d = new Date(ts);
|
|
25
|
+
return `${padTimePart(d.getHours())}:${padTimePart(d.getMinutes())}:${padTimePart(d.getSeconds())}.${padTimePart(d.getMilliseconds(), 3)}`;
|
|
26
|
+
}
|
|
27
|
+
function formatStackFrame(frame) {
|
|
28
|
+
if (!frame || typeof frame !== "object") return null;
|
|
29
|
+
const where = [
|
|
30
|
+
frame.file,
|
|
31
|
+
frame.line,
|
|
32
|
+
frame.column
|
|
33
|
+
].filter((p) => p !== void 0 && p !== null && p !== "").join(":");
|
|
34
|
+
if (frame.fn && where) return `at ${frame.fn} (${where})`;
|
|
35
|
+
if (frame.fn) return `at ${frame.fn}`;
|
|
36
|
+
if (where) return `at ${where}`;
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function formatRecord(record, { paint } = {}) {
|
|
40
|
+
const colour = paint || ((t) => t);
|
|
41
|
+
const level = String(record?.level ?? "").padEnd(LEVEL_WIDTH);
|
|
42
|
+
const src = String(record?.src ?? "").padEnd(SRC_WIDTH);
|
|
43
|
+
const [first, ...rest] = (record?.msg === void 0 || record?.msg === null ? "" : String(record.msg)).split("\n");
|
|
44
|
+
const lines = [`${formatTime(record?.ts)} ${colour(level)} ${src} ${first}`];
|
|
45
|
+
for (const line of rest) lines.push(`${INDENT}${line}`);
|
|
46
|
+
for (const frame of Array.isArray(record?.stack) ? record.stack : []) {
|
|
47
|
+
const rendered = formatStackFrame(frame);
|
|
48
|
+
if (rendered) lines.push(`${INDENT}${rendered}`);
|
|
49
|
+
}
|
|
50
|
+
return lines.join("\n");
|
|
51
|
+
}
|
|
52
|
+
function parseTail(value) {
|
|
53
|
+
if (typeof value === "number" && Number.isInteger(value) && value >= 0) return { n: value };
|
|
54
|
+
if (typeof value !== "string" || !/^\d+$/.test(value.trim())) return { error: `Invalid --tail value ${JSON.stringify(value)}. Use a non-negative whole number, e.g. --tail 50.` };
|
|
55
|
+
return { n: parseInt(value.trim(), 10) };
|
|
56
|
+
}
|
|
57
|
+
function validateSources(sources) {
|
|
58
|
+
if (sources === void 0 || sources === null) return { sources: void 0 };
|
|
59
|
+
const list = Array.isArray(sources) ? sources : [sources];
|
|
60
|
+
if (list.includes("all")) return { sources: [...SOURCES$1] };
|
|
61
|
+
const unknown = list.filter((s) => !SOURCES$1.includes(s));
|
|
62
|
+
if (unknown.length > 0) return { error: `Unknown --source value(s): ${unknown.join(", ")}. Use one or more of: ${SOURCES$1.join(", ")}, or all.` };
|
|
63
|
+
return { sources: list };
|
|
64
|
+
}
|
|
65
|
+
function validateLevel(level) {
|
|
66
|
+
if (LEVELS$1.includes(level)) return { level };
|
|
67
|
+
return { error: `Invalid --level value ${JSON.stringify(level)}. Use one of: ${LEVELS$1.join(", ")}.` };
|
|
68
|
+
}
|
|
69
|
+
const ERRORS_PRINT_CAP = 20;
|
|
70
|
+
function nearestRegisteredLogsProject(root, candidates) {
|
|
71
|
+
return candidates.filter((candidate) => candidate !== root && isPathPrefix(root, candidate)).toSorted((a, b) => {
|
|
72
|
+
const depth = (path) => relative(root, path).split(sep).length;
|
|
73
|
+
return depth(a) - depth(b) || a.length - b.length || a.localeCompare(b);
|
|
74
|
+
})[0] ?? null;
|
|
75
|
+
}
|
|
76
|
+
function registeredDescendantWithLogs(root) {
|
|
77
|
+
const candidates = Object.keys(loadConfig$1()?.projects ?? {}).flatMap((path) => {
|
|
78
|
+
try {
|
|
79
|
+
const canonical = realpathSync(path);
|
|
80
|
+
return logFiles(workspaceLogsDir$1(canonical)).length > 0 ? [canonical] : [];
|
|
81
|
+
} catch {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return nearestRegisteredLogsProject(root, [...new Set(candidates)]);
|
|
86
|
+
}
|
|
87
|
+
function requireLogsWorkspace(root, dir) {
|
|
88
|
+
if (logFiles(dir).length > 0) return;
|
|
89
|
+
const descendant = registeredDescendantWithLogs(root);
|
|
90
|
+
fail(`STIM_NO_PROJECT: No Stim workspace has run in ${root}.${descendant ? ` The nearest registered app with logs is ${descendant}; run this command from there.` : " Run `stim start`, `stim ios`, or `stim android` in the app first."}`);
|
|
91
|
+
}
|
|
92
|
+
const LEVEL_COLOURS = {
|
|
93
|
+
debug: chalk.dim,
|
|
94
|
+
info: chalk.reset,
|
|
95
|
+
warn: chalk.yellow,
|
|
96
|
+
error: chalk.red,
|
|
97
|
+
fatal: chalk.bgRed
|
|
98
|
+
};
|
|
99
|
+
function logsCommand(program) {
|
|
100
|
+
program.command("logs").description("Query this workspace's merged NDJSON log timeline (bundler, client, device, build, agent actions, maintenance). Prints and exits; an existing timeline with nothing matching is a successful, empty result. Use --follow to stream.").option("--slot <name>", "Only this device slot's records, plus the shared Metro and app client records once it has launched", parseDeviceSlotOption).option("--source <s...>", "Only these sources: metro, client, device, build, agent, maintenance, placement, or all").option("--level <l>", `Minimum level: ${LEVELS$1.join(", ")}`).option("--since <d>", "Only records newer than this, e.g. 30s, 5m, 2h").option("--grep <re>", "Only records whose message matches this regular expression").option("--tail <n>", "Only the last n matching records").option("--errors", "Errors and fatals since the last marker, from metro, client and build, plus confirmed native app-crash reports and stim web browser errors. Add --source maintenance for maintenance failures, or --source device or --source all for general device errors.").option("--follow", "Keep streaming new records until interrupted").option("--json", "Emit the raw records, one per line (valid NDJSON; zero matches is zero bytes, exit 0)").action(async (opts) => {
|
|
101
|
+
const root = findCommandWorkspace(process.cwd());
|
|
102
|
+
if (!root) {
|
|
103
|
+
refuseNoProject({ json: false });
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const dir = workspaceLogsDir$1(root);
|
|
107
|
+
let sources;
|
|
108
|
+
if (opts.source !== void 0) {
|
|
109
|
+
const checked = validateSources(opts.source);
|
|
110
|
+
if (checked.error) fail(checked.error);
|
|
111
|
+
sources = checked.sources;
|
|
112
|
+
}
|
|
113
|
+
let minLevel;
|
|
114
|
+
if (opts.level !== void 0) {
|
|
115
|
+
const checked = validateLevel(opts.level);
|
|
116
|
+
if (checked.error) fail(checked.error);
|
|
117
|
+
minLevel = checked.level;
|
|
118
|
+
}
|
|
119
|
+
if (opts.since !== void 0) {
|
|
120
|
+
const parsed = parseSince(opts.since);
|
|
121
|
+
if (parsed.error) fail(parsed.error);
|
|
122
|
+
}
|
|
123
|
+
let tail;
|
|
124
|
+
if (opts.tail !== void 0) {
|
|
125
|
+
const parsed = parseTail(opts.tail);
|
|
126
|
+
if (parsed.error) fail(parsed.error);
|
|
127
|
+
tail = parsed.n;
|
|
128
|
+
}
|
|
129
|
+
if (opts.grep !== void 0) {
|
|
130
|
+
const compiled = compileGrep(opts.grep);
|
|
131
|
+
if (compiled.error) fail(compiled.error);
|
|
132
|
+
}
|
|
133
|
+
requireLogsWorkspace(root, dir);
|
|
134
|
+
const query = {
|
|
135
|
+
slot: opts.slot,
|
|
136
|
+
dir,
|
|
137
|
+
sources,
|
|
138
|
+
minLevel,
|
|
139
|
+
since: opts.since,
|
|
140
|
+
grep: opts.grep,
|
|
141
|
+
tail,
|
|
142
|
+
errorsOnly: Boolean(opts.errors),
|
|
143
|
+
errorContext: Boolean(opts.errors && !opts.json && !opts.follow)
|
|
144
|
+
};
|
|
145
|
+
const emit = (record) => {
|
|
146
|
+
if (opts.json) {
|
|
147
|
+
console.log(JSON.stringify(record));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const rendered = {
|
|
151
|
+
...record,
|
|
152
|
+
msg: launchErrorPreview([record], root, { full: true }).join("\n"),
|
|
153
|
+
stack: void 0
|
|
154
|
+
};
|
|
155
|
+
console.log(formatRecord(rendered, { paint: record?.level ? LEVEL_COLOURS[record.level] : void 0 }));
|
|
156
|
+
};
|
|
157
|
+
const context = {
|
|
158
|
+
home: configDir(),
|
|
159
|
+
buildCache: null,
|
|
160
|
+
projectRoot: root,
|
|
161
|
+
cwd: root,
|
|
162
|
+
runId: runId(),
|
|
163
|
+
env: process.env,
|
|
164
|
+
signal: new AbortController().signal,
|
|
165
|
+
output: (stream, text) => process[stream].write(text)
|
|
166
|
+
};
|
|
167
|
+
const { view, readAgent, hostedReachable } = await openWorkspaceLogs(context, query, Boolean(opts.follow));
|
|
168
|
+
const offsets = opts.follow ? view.sizes : null;
|
|
169
|
+
let timeline = [];
|
|
170
|
+
let rawRecords;
|
|
171
|
+
try {
|
|
172
|
+
const extra = await readAgent?.(opts.json ? {
|
|
173
|
+
tail: query.tail,
|
|
174
|
+
matches: view.filter(query)
|
|
175
|
+
} : void 0) ?? [];
|
|
176
|
+
if (opts.json) rawRecords = await view.query({
|
|
177
|
+
...query,
|
|
178
|
+
extra
|
|
179
|
+
});
|
|
180
|
+
else {
|
|
181
|
+
timeline = sortByTs([...await view.query(), ...extra]);
|
|
182
|
+
rawRecords = queryLogs({
|
|
183
|
+
...query,
|
|
184
|
+
records: timeline
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
} finally {
|
|
188
|
+
await view.close();
|
|
189
|
+
}
|
|
190
|
+
const supervisorPort = readWorkspaceState$1(root)?.supervisor?.port;
|
|
191
|
+
const records = opts.json ? rawRecords : await errorDiagnostics(rawRecords, {
|
|
192
|
+
root,
|
|
193
|
+
logsDir: dir,
|
|
194
|
+
port: typeof supervisorPort === "number" ? supervisorPort : null,
|
|
195
|
+
allowRequest: true,
|
|
196
|
+
timeline
|
|
197
|
+
});
|
|
198
|
+
const errorCount = records.filter((record) => record.errorContext !== true).length;
|
|
199
|
+
let seenErrors = 0;
|
|
200
|
+
const capped = opts.errors && !opts.json && tail === void 0 && errorCount > 20 ? records.filter((record) => {
|
|
201
|
+
if (record.errorContext === true) return seenErrors <= 20;
|
|
202
|
+
seenErrors += 1;
|
|
203
|
+
return seenErrors <= 20;
|
|
204
|
+
}) : records;
|
|
205
|
+
for (const record of capped) emit(record);
|
|
206
|
+
const hidden = errorCount - capped.filter((record) => record.errorContext !== true).length;
|
|
207
|
+
if (hidden > 0) console.log(chalk.dim(`Showing 20 of ${errorCount} matching error records; ${hidden} not shown. Add --tail ${rawRecords.length} to include all captured records before grouping, or --json for raw records. Stacks are shown in full.`));
|
|
208
|
+
if (!opts.follow) {
|
|
209
|
+
if (records.length === 0 && !opts.json) console.error(chalk.dim(`No matching log records in ${dir}`));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const criteria = buildCriteria({
|
|
213
|
+
slot: opts.slot,
|
|
214
|
+
sources,
|
|
215
|
+
minLevel,
|
|
216
|
+
since: opts.since,
|
|
217
|
+
grep: opts.grep,
|
|
218
|
+
errorsOnly: Boolean(opts.errors)
|
|
219
|
+
});
|
|
220
|
+
const stop = followLogs({
|
|
221
|
+
dir,
|
|
222
|
+
offsets,
|
|
223
|
+
criteria,
|
|
224
|
+
onRecord: emit,
|
|
225
|
+
errorContext: opts.errors ? opts.json ? "field" : "msg" : void 0
|
|
226
|
+
});
|
|
227
|
+
const stopAgent = readAgent ? followAgentActions(context, readAgent, (record) => {
|
|
228
|
+
if (recordMatches(record, criteria)) emit(record);
|
|
229
|
+
}) : null;
|
|
230
|
+
const stopHosted = followHostedLogs(root, !hostedReachable);
|
|
231
|
+
const finish = () => {
|
|
232
|
+
stop();
|
|
233
|
+
stopHosted?.();
|
|
234
|
+
stopReader();
|
|
235
|
+
stopAgent?.();
|
|
236
|
+
process.exit(0);
|
|
237
|
+
};
|
|
238
|
+
const stopReader = watchStdoutReader(finish);
|
|
239
|
+
process.on("SIGINT", finish);
|
|
240
|
+
process.on("SIGTERM", finish);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function fail(message) {
|
|
244
|
+
console.error(chalk.red(message));
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
export { ERRORS_PRINT_CAP, logsCommand as default, formatRecord, formatStackFrame, formatTime, parseTail, validateLevel, validateSources };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as runMacos, r as waitForLaunchServices, t as macosCommand } from "./macos-
|
|
1
|
+
import { n as runMacos, r as waitForLaunchServices, t as macosCommand } from "./macos-NfV2D7dO.mjs";
|
|
2
2
|
export { macosCommand as default, runMacos, waitForLaunchServices };
|