stim 1.20.2 → 1.21.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 +88 -8
- package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
- package/dist/act-DHAw2A2S.mjs +2667 -0
- package/dist/activity-BzVfHSrY.mjs +1376 -0
- package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
- package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
- package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
- package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
- package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
- package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/android-project-BCAAmMwz.mjs +12 -0
- package/dist/api.d.mts +740 -8
- package/dist/api.mjs +585 -1
- package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
- package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
- package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
- package/dist/budget-Bs6SxxzO.mjs +9154 -0
- package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
- package/dist/build-cache-DmyR9Zzc.mjs +602 -0
- package/dist/build-plan-CaFskB7_.mjs +188 -0
- package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
- package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
- package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
- package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/client-B7QVOlCr.d.mts +253 -0
- package/dist/client-UXD70ZbM.mjs +1406 -0
- package/dist/collector-run.d.mts +4 -40
- package/dist/collector-run.mjs +9 -8
- package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
- package/dist/config-CYcBF478.mjs +949 -0
- package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
- package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
- package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
- package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
- package/dist/device-DCxH7_By.mjs +1068 -0
- package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
- package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
- package/dist/device-host-worker.mjs +65 -61
- package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
- package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
- package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
- package/dist/doctor-BLHCYxzi.mjs +2 -0
- package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
- package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
- package/dist/doctor-fingerprint.mjs +19 -0
- package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
- package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
- package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
- package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
- package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
- package/dist/exec-H20xSg2T.d.mts +65 -0
- package/dist/exec-_UbtCQcG.mjs +750 -0
- package/dist/gc-C-WwL0yi.mjs +3 -0
- package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
- package/dist/git-C3iTsJaZ.mjs +73 -0
- package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
- package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
- package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
- package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
- package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
- package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
- package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
- package/dist/idle-BVeRGroT.d.mts +24 -0
- package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
- package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
- package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
- package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
- package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
- package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
- package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
- package/dist/ios-signing-DTTIChGs.mjs +489 -0
- package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
- package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
- package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
- package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
- package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
- package/dist/logs-BS00Anxf.mjs +352 -0
- package/dist/logs-CMm05HxN.mjs +255 -0
- package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
- package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +122 -247
- package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
- package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
- package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
- package/dist/native-android-JACyjTZs.mjs +844 -0
- package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
- package/dist/native-inputs-TRTTTRxt.mjs +91 -0
- package/dist/native-run-DY_RLx3C.mjs +277 -0
- package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
- package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
- package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
- package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
- package/dist/offload-worker.d.mts +1 -46
- package/dist/offload-worker.mjs +197 -66
- package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
- package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
- package/dist/paths-BsJMoPP2.mjs +12 -0
- package/dist/paths-DQtTgsBf.mjs +42 -0
- package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
- package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
- package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
- package/dist/prebuild-uD_ipCxF.mjs +449 -0
- package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
- package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
- package/dist/pull-request-zjCSAryH.d.mts +120 -0
- package/dist/pull-requests.d.mts +1 -119
- package/dist/pull-requests.mjs +1 -1
- package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
- package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
- package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
- package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
- package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
- package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
- package/dist/reload-DzjSl5P_.mjs +2 -0
- package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
- package/dist/result-DNiS-tTP.mjs +434 -0
- package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
- package/dist/selection-CSl9i5qU.mjs +619 -0
- package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
- package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
- package/dist/server-expo-C-90EhcG.mjs +2 -0
- package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
- package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
- package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
- package/dist/settings-T1gtc3bf.mjs +114 -0
- package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
- package/dist/settings.schema.json +163 -16
- package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
- package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
- package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
- package/dist/stage-BIS0ydsV.mjs +183 -0
- package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
- package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
- package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
- package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
- package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
- package/dist/stats-report-BFfMpWWF.mjs +16 -0
- package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
- package/dist/status-CSi6tlRq.mjs +2 -0
- package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
- package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
- package/dist/status-worker.d.mts +1 -0
- package/dist/status-worker.mjs +19 -0
- package/dist/stim-desktop-C12we7lz.mjs +112 -0
- package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
- package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
- package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
- package/dist/supervisor-run.d.mts +8 -17
- package/dist/supervisor-run.mjs +63 -27
- package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
- package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
- package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
- package/dist/toolchain-DhKwp9iI.mjs +2 -0
- package/dist/toolchain-Hp9sCpK4.mjs +873 -0
- package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
- package/dist/trigger-Bf3uDcpv.mjs +2 -0
- package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
- package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
- package/dist/web-DknQETPs.mjs +2 -0
- package/dist/web-run.mjs +11 -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-process-lock-1_1OoVW5.mjs +57 -0
- package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
- package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
- package/dist/worktree-CK2MpJW5.mjs +2 -0
- package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
- package/dist/xcode-Zlx3qjEs.mjs +896 -0
- package/package.json +7 -5
- 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/miss-reason-mKzZ4VvN.mjs +0 -238
- package/dist/native-android-D5qc3-_v.mjs +0 -226
- 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/spawn-claims-DVS5RkMS.mjs +0 -72
- package/dist/stage-KNTQopqv.mjs +0 -157
- package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
- 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
package/dist/result-CaJg5Iat.mjs
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { y as workspaceAgentDeviceDir } from "./workspace-state-DJt_MMvf.mjs";
|
|
2
|
-
import { i as formatDuration, l as phaseLine } from "./command-output-BTy8hZ0F.mjs";
|
|
3
|
-
import { i as workspaceLinkLine } from "./stim-desktop-BzBN2Em2.mjs";
|
|
4
|
-
import { Dt as recordFinishedBuild } from "./budget-f7516Zk0.mjs";
|
|
5
|
-
import { a as easAuthNote, n as UPLOAD_TIMEOUT_MS, r as cacheLevel, s as isEasAuthFailureText } from "./remote-cache-OyOyVIS3.mjs";
|
|
6
|
-
import "./launch-verify-B6Q8hZP-.mjs";
|
|
7
|
-
import { n as CCACHE_UNAVAILABLE, r as ccacheActivityLine } from "./ccache-zdKiYQ3E.mjs";
|
|
8
|
-
import { a as PLATFORM } from "./support-DMTqj3Hm.mjs";
|
|
9
|
-
import { buildDiagnostics } from "@stim-cli/core/state";
|
|
10
|
-
import chalk from "chalk";
|
|
11
|
-
//#region src/commands/android/result.ts
|
|
12
|
-
function androidFacts({ root, slot, serial, avdName = null, deviceName = null, systemImage = null, deviceProfile = null, fingerprint, cacheKey = null, variant = null, metroPort = null, cacheHit, cacheSkipped = false, waitedForBuild = null, appPath, bundleId, installSkipped = false, launched, ccache = CCACHE_UNAVAILABLE, logs, debugHttpHost = null, debugHttpHostNote = null, devClientUrl = null, durationMs, lease, devServer = null, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null, host }) {
|
|
13
|
-
return {
|
|
14
|
-
platform: PLATFORM,
|
|
15
|
-
...host ? { host } : {},
|
|
16
|
-
...slot && slot !== "default" ? { slot } : {},
|
|
17
|
-
serial: serial ?? null,
|
|
18
|
-
avdName: avdName ?? null,
|
|
19
|
-
deviceName: deviceName ?? avdName ?? null,
|
|
20
|
-
systemImage: systemImage ?? null,
|
|
21
|
-
deviceProfile: deviceProfile ?? null,
|
|
22
|
-
fingerprint: fingerprint ?? null,
|
|
23
|
-
cacheKey: cacheKey ?? null,
|
|
24
|
-
variant: variant ?? null,
|
|
25
|
-
metroPort: metroPort ?? null,
|
|
26
|
-
cacheHit: cacheLevel(cacheHit),
|
|
27
|
-
cacheSkipped: Boolean(cacheSkipped),
|
|
28
|
-
buildMachine,
|
|
29
|
-
...builtOn ? { builtOn } : {},
|
|
30
|
-
...offloadedTo ? { offloadedTo } : {},
|
|
31
|
-
...offloadFallback ? { offloadFallback } : {},
|
|
32
|
-
waitedForBuild: waitedForBuild ? {
|
|
33
|
-
pid: waitedForBuild.pid ?? null,
|
|
34
|
-
ms: waitedForBuild.ms ?? 0
|
|
35
|
-
} : null,
|
|
36
|
-
appPath: appPath ?? null,
|
|
37
|
-
bundleId: bundleId ?? null,
|
|
38
|
-
installSkipped: Boolean(installSkipped),
|
|
39
|
-
launched: launched === "unverified" || launched === "bundling" ? launched : Boolean(launched),
|
|
40
|
-
ccache,
|
|
41
|
-
debugHttpHost: debugHttpHost ?? null,
|
|
42
|
-
debugHttpHostNote: debugHttpHostNote ?? null,
|
|
43
|
-
devClientUrl: devClientUrl ?? null,
|
|
44
|
-
logs: logs ?? null,
|
|
45
|
-
...root && !host ? { agentDevice: { stateDir: workspaceAgentDeviceDir(root) } } : {},
|
|
46
|
-
durationMs: typeof durationMs === "number" && Number.isFinite(durationMs) ? durationMs : null,
|
|
47
|
-
...lease === void 0 ? {} : { lease },
|
|
48
|
-
...devServer ? { devServer } : {}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function lastBuildRecord({ devicePlacement, fingerprint, cacheKey, cacheHit, cacheSkipped = false, durationMs, appPath, bundleId, startedAt, status, errorCode = null, avdName = null, deviceName = null, missReason = null, diagnostics = null, configuration = null, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null }) {
|
|
52
|
-
const record = {
|
|
53
|
-
platform: PLATFORM,
|
|
54
|
-
avdName: avdName ?? null,
|
|
55
|
-
deviceName: deviceName ?? avdName ?? null,
|
|
56
|
-
fingerprint: fingerprint ?? null,
|
|
57
|
-
cacheKey: cacheKey ?? null,
|
|
58
|
-
cacheHit: cacheLevel(cacheHit),
|
|
59
|
-
cacheSkipped: Boolean(cacheSkipped),
|
|
60
|
-
durationMs: Number.isFinite(durationMs) ? durationMs : null,
|
|
61
|
-
appPath: appPath ?? null,
|
|
62
|
-
bundleId: bundleId ?? null,
|
|
63
|
-
startedAt,
|
|
64
|
-
status,
|
|
65
|
-
configuration: configuration ?? null
|
|
66
|
-
};
|
|
67
|
-
if (errorCode) record.errorCode = errorCode;
|
|
68
|
-
if (devicePlacement) record.devicePlacement = devicePlacement;
|
|
69
|
-
record.buildMachine = buildMachine;
|
|
70
|
-
if (builtOn) record.builtOn = builtOn;
|
|
71
|
-
if (offloadedTo) record.offloadedTo = offloadedTo;
|
|
72
|
-
if (offloadFallback) record.offloadFallback = offloadFallback;
|
|
73
|
-
if (missReason && !cacheLevel(cacheHit)) record.missReason = missReason;
|
|
74
|
-
const recorded = status === "failed" ? buildDiagnostics(diagnostics) : [];
|
|
75
|
-
if (recorded.length) record.diagnostics = recorded;
|
|
76
|
-
return record;
|
|
77
|
-
}
|
|
78
|
-
async function finishAndroidUpload(uploadPending, remote, phase) {
|
|
79
|
-
if (!uploadPending) return false;
|
|
80
|
-
const upload = await uploadPending;
|
|
81
|
-
if (upload?.uploaded) phase("cache", `uploaded (${remote?.name})`);
|
|
82
|
-
else if (upload?.timedOut) {
|
|
83
|
-
phase("cache", chalk.yellow(`${remote?.name} upload still running after ${formatDuration(UPLOAD_TIMEOUT_MS)}; not waiting`));
|
|
84
|
-
return true;
|
|
85
|
-
} else if (upload?.failed) {
|
|
86
|
-
const authNote = remote?.name === "eas" && isEasAuthFailureText(upload.failed) ? easAuthNote({
|
|
87
|
-
code: "logged-out",
|
|
88
|
-
reason: upload.failed,
|
|
89
|
-
phase: "upload"
|
|
90
|
-
}) : null;
|
|
91
|
-
phase("cache", chalk.yellow(authNote || `${remote?.name} upload failed: ${upload.failed}`));
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
function reportAndroidResult({ host, root, slot, json, useBuildCache, variant, release, runtimeKind = release ? "embedded-js" : "metro", metroCheck, metroPort, logsDir, serial, apkPath, androidPackage, installSkipped, record, waitedForBuild, remote, providerName, launchState, launchWarning, launched, ccache, durationMs, writer, emit, lease, recordRun, reclaimed = [], devServer = null, links }) {
|
|
96
|
-
const offloadedTo = record.offloadedTo ?? null;
|
|
97
|
-
recordRun({
|
|
98
|
-
failed: false,
|
|
99
|
-
cacheHit: cacheLevel(record.cacheHit),
|
|
100
|
-
waited: waitedForBuild,
|
|
101
|
-
durationMs,
|
|
102
|
-
offloadedTo
|
|
103
|
-
});
|
|
104
|
-
const facts = androidFacts({
|
|
105
|
-
host,
|
|
106
|
-
root,
|
|
107
|
-
slot,
|
|
108
|
-
serial,
|
|
109
|
-
avdName: record.avdName,
|
|
110
|
-
deviceName: record.deviceName,
|
|
111
|
-
systemImage: record.systemImage,
|
|
112
|
-
deviceProfile: record.deviceProfile,
|
|
113
|
-
debugHttpHost: launched.debugHttpHost ?? null,
|
|
114
|
-
debugHttpHostNote: launched.debugHttpHostNote ?? null,
|
|
115
|
-
devClientUrl: launched.devClientUrl ?? null,
|
|
116
|
-
fingerprint: record.fingerprint,
|
|
117
|
-
cacheKey: record.cacheKey,
|
|
118
|
-
variant,
|
|
119
|
-
metroPort,
|
|
120
|
-
cacheHit: record.cacheHit,
|
|
121
|
-
cacheSkipped: record.cacheSkipped || !useBuildCache,
|
|
122
|
-
waitedForBuild,
|
|
123
|
-
appPath: apkPath,
|
|
124
|
-
bundleId: androidPackage,
|
|
125
|
-
installSkipped,
|
|
126
|
-
launched: launchState,
|
|
127
|
-
ccache,
|
|
128
|
-
logs: logsDir,
|
|
129
|
-
durationMs,
|
|
130
|
-
lease,
|
|
131
|
-
devServer,
|
|
132
|
-
buildMachine: record.buildMachine,
|
|
133
|
-
builtOn: record.builtOn ?? void 0,
|
|
134
|
-
offloadedTo,
|
|
135
|
-
offloadFallback: record.offloadFallback ?? null
|
|
136
|
-
});
|
|
137
|
-
writer.close();
|
|
138
|
-
if (record.devicePlacement) facts.devicePlacement = record.devicePlacement;
|
|
139
|
-
if (json) emit(JSON.stringify({
|
|
140
|
-
...facts,
|
|
141
|
-
...links ? { links } : {},
|
|
142
|
-
...reclaimed.length ? { reclaimed } : {}
|
|
143
|
-
}));
|
|
144
|
-
else {
|
|
145
|
-
const summary = `${launchWarning ? "WARNING" : "OK"}: ${androidPackage} launched on ${host ? `${host.device?.name ?? "Android emulator"} on ${host.machine}` : serial}, ${runtimeKind === "process" ? `${variant ?? "debug"} (native process, no Metro)` : runtimeKind === "embedded-js" ? `${variant} (embedded JS, no Metro)` : `Metro port ${metroPort}`} (${cacheOutcome(record.cacheHit, remote?.name ?? providerName, offloadedTo)})`;
|
|
146
|
-
const outcome = launchWarning ? chalk.yellow(`${summary} -- ${launchWarning}`) : launchState === "unverified" ? chalk.yellow(`${summary} -- launch UNVERIFIED`) : launchState === "bundling" ? chalk.green(`${summary} -- bundle requested, still building`) : chalk.green(summary);
|
|
147
|
-
const deviceName = record.avdName || record.deviceName || serial;
|
|
148
|
-
const cacheResult = useBuildCache ? cacheOutcome(record.cacheHit, remote?.name ?? providerName, offloadedTo) : `bypassed; ${cacheOutcome(false, null, offloadedTo)}`;
|
|
149
|
-
const metroResult = runtimeKind === "process" ? "native process (no Metro)" : runtimeKind === "embedded-js" ? `embedded (${variant})` : !metroCheck ? `check skipped on port ${metroPort}` : launchState === "unverified" ? `state unverified on port ${metroPort}` : `running on port ${metroPort}${devServer ? ` (started: ${devServer.reason})` : ""}`;
|
|
150
|
-
emit([
|
|
151
|
-
outcome,
|
|
152
|
-
phaseLine("device", host ? `${deviceName} on ${host.machine}` : `${deviceName} (${serial})`),
|
|
153
|
-
phaseLine("app", androidPackage),
|
|
154
|
-
phaseLine(runtimeKind === "process" ? "runtime" : "metro", metroResult),
|
|
155
|
-
phaseLine("cache", cacheResult),
|
|
156
|
-
...ccache.status === "not-run" ? [phaseLine("compilation cache", ccacheActivityLine(ccache))] : [],
|
|
157
|
-
phaseLine("logs", logsDir || "unavailable (remote device)"),
|
|
158
|
-
...!host ? [phaseLine("agent-device", `AGENT_DEVICE_STATE_DIR=${workspaceAgentDeviceDir(root)}`)] : []
|
|
159
|
-
].join("\n"));
|
|
160
|
-
if (links) console.error(chalk.dim(workspaceLinkLine(links)));
|
|
161
|
-
}
|
|
162
|
-
return facts;
|
|
163
|
-
}
|
|
164
|
-
function cacheOutcome(cacheHit, providerName = null, offloadedTo = null) {
|
|
165
|
-
if (cacheHit === "remote") return `cache hit from ${providerName || "the remote cache"}`;
|
|
166
|
-
if (cacheHit === "local") return "cache hit";
|
|
167
|
-
return offloadedTo ? `built on ${offloadedTo}` : "built";
|
|
168
|
-
}
|
|
169
|
-
function persistLastBuild({ recordBuild = recordFinishedBuild, root, record, startedAt, durationMs, status, errorCode = null, diagnostics = null, out }) {
|
|
170
|
-
const lastBuild = lastBuildRecord({
|
|
171
|
-
...record,
|
|
172
|
-
startedAt,
|
|
173
|
-
durationMs,
|
|
174
|
-
status,
|
|
175
|
-
errorCode,
|
|
176
|
-
diagnostics
|
|
177
|
-
});
|
|
178
|
-
try {
|
|
179
|
-
recordBuild(root, lastBuild);
|
|
180
|
-
} catch (err) {
|
|
181
|
-
out(phaseLine("state", chalk.yellow(`could not record lastBuild: ${err?.message || err}`)));
|
|
182
|
-
}
|
|
183
|
-
return lastBuild;
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
export { reportAndroidResult as a, persistLastBuild as i, finishAndroidUpload as n, lastBuildRecord as r, androidFacts as t };
|
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
import { D as withConfigLock$1, O as writeConfigSetting, _ as loadConfig$1, f as getConfigPath$1, h as getRepoSettings, m as getProjectSettings } from "./config-BYDxlMY3.mjs";
|
|
2
|
-
import { Dt as repoRoot, R as readCommittedSettings, ht as gitCommonDir, nt as unknownSettingKeys } from "./settings-B717odTD.mjs";
|
|
3
|
-
import { n as findCommandWorkspace, t as NO_PROJECT_REFUSAL } from "./project-_phNIJfs.mjs";
|
|
4
|
-
import { n as settingDefault, r as stimDesktopInstalled } from "./stim-desktop-BzBN2Em2.mjs";
|
|
5
|
-
import { n as recordingLayers, t as deleteTurnedOffRecordings } from "./recordings-D0d5aQt0.mjs";
|
|
6
|
-
import { existsSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import { SETTINGS, SETTING_SCOPES, coerceSettingText, isJsonObject, isSensitiveReference, settingDefinition, settingValueError } from "@stim-cli/core/state";
|
|
9
|
-
import chalk from "chalk";
|
|
10
|
-
//#region src/commands/settings.ts
|
|
11
|
-
const MASK = "********";
|
|
12
|
-
const PRECEDENCE = [
|
|
13
|
-
"workspace",
|
|
14
|
-
"repo",
|
|
15
|
-
"committed",
|
|
16
|
-
"machine"
|
|
17
|
-
];
|
|
18
|
-
var Refusal = class extends Error {
|
|
19
|
-
code;
|
|
20
|
-
remedy;
|
|
21
|
-
constructor(code, message, remedy) {
|
|
22
|
-
super(message);
|
|
23
|
-
this.code = code;
|
|
24
|
-
this.remedy = remedy;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
function readContext(env, note = () => {}) {
|
|
28
|
-
const projectPath = findCommandWorkspace(process.cwd(), note);
|
|
29
|
-
const start = projectPath ?? process.cwd();
|
|
30
|
-
const common = gitCommonDir(start);
|
|
31
|
-
let installed;
|
|
32
|
-
return {
|
|
33
|
-
projectPath,
|
|
34
|
-
gitCommonDir: common,
|
|
35
|
-
repoRoot: common ? repoRoot(start) ?? projectPath : null,
|
|
36
|
-
machine: loadConfig$1(),
|
|
37
|
-
env,
|
|
38
|
-
desktopInstalled: () => installed ??= stimDesktopInstalled(process.platform, env)
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function valueAt(settings, key) {
|
|
42
|
-
let node = settings;
|
|
43
|
-
for (const segment of key.split(".")) {
|
|
44
|
-
if (!isJsonObject(node)) return void 0;
|
|
45
|
-
node = node[segment];
|
|
46
|
-
}
|
|
47
|
-
return node;
|
|
48
|
-
}
|
|
49
|
-
function committedDirectory(context, setting) {
|
|
50
|
-
return setting?.committedAt === "repository" ? repositoryDirectory(context) : appDirectory(context);
|
|
51
|
-
}
|
|
52
|
-
function repositoryDirectory(context) {
|
|
53
|
-
return context.repoRoot ?? context.projectPath;
|
|
54
|
-
}
|
|
55
|
-
function appDirectory(context) {
|
|
56
|
-
return context.projectPath ?? context.repoRoot;
|
|
57
|
-
}
|
|
58
|
-
function layerFile(context, scope, setting) {
|
|
59
|
-
const machineFile = getConfigPath$1();
|
|
60
|
-
if (scope === "machine") return machineFile;
|
|
61
|
-
if (scope === "workspace") return context.projectPath ? `${machineFile} (projects["${context.projectPath}"].settings)` : null;
|
|
62
|
-
if (scope === "repo") return context.gitCommonDir ? `${machineFile} (repos["${context.gitCommonDir}"].settings)` : null;
|
|
63
|
-
const directory = committedDirectory(context, setting);
|
|
64
|
-
return directory ? join(directory, ".stim.json") : null;
|
|
65
|
-
}
|
|
66
|
-
function layerSettings(context, scope, setting) {
|
|
67
|
-
if (scope === "machine") return context.machine ?? {};
|
|
68
|
-
if (scope === "workspace") return context.projectPath ? getProjectSettings(context.projectPath) : {};
|
|
69
|
-
if (scope === "repo") return context.gitCommonDir ? getRepoSettings(context.gitCommonDir) : {};
|
|
70
|
-
return readCommittedSettings(committedDirectory(context, setting));
|
|
71
|
-
}
|
|
72
|
-
function masked(setting, value) {
|
|
73
|
-
return setting.sensitive && value !== void 0 && value !== null ? MASK : value;
|
|
74
|
-
}
|
|
75
|
-
function settingEntry(context, setting) {
|
|
76
|
-
const layers = {};
|
|
77
|
-
for (const scope of PRECEDENCE) {
|
|
78
|
-
if (!setting.scopes.includes(scope) || layerFile(context, scope, setting) === null) continue;
|
|
79
|
-
const value = valueAt(layerSettings(context, scope, setting), setting.key);
|
|
80
|
-
if (value !== void 0) layers[scope] = masked(setting, value);
|
|
81
|
-
}
|
|
82
|
-
const envValue = setting.env ? context.env[setting.env] : void 0;
|
|
83
|
-
const env = setting.env && envValue ? {
|
|
84
|
-
name: setting.env,
|
|
85
|
-
value: String(masked(setting, envValue))
|
|
86
|
-
} : void 0;
|
|
87
|
-
const scopedHome = !env && setting.scopedHomeValue !== void 0 && context.env.STIM_HOME;
|
|
88
|
-
const ci = !env && setting.ciValue !== void 0 && context.env.CI;
|
|
89
|
-
const winner = PRECEDENCE.find((scope) => scope in layers);
|
|
90
|
-
let value = null;
|
|
91
|
-
let origin = null;
|
|
92
|
-
let defaultReason = null;
|
|
93
|
-
if (env) {
|
|
94
|
-
value = masked(setting, envSettingValue(setting, envValue));
|
|
95
|
-
origin = "env";
|
|
96
|
-
} else if (scopedHome) {
|
|
97
|
-
value = setting.scopedHomeValue;
|
|
98
|
-
origin = "env";
|
|
99
|
-
} else if (ci) {
|
|
100
|
-
value = setting.ciValue;
|
|
101
|
-
origin = "env";
|
|
102
|
-
} else if (winner) {
|
|
103
|
-
value = layers[winner];
|
|
104
|
-
origin = winner;
|
|
105
|
-
} else if (setting.default !== void 0) {
|
|
106
|
-
const fallback = settingDefault(setting, context.desktopInstalled);
|
|
107
|
-
value = fallback.value;
|
|
108
|
-
origin = "default";
|
|
109
|
-
defaultReason = fallback.reason;
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
key: setting.key,
|
|
113
|
-
value,
|
|
114
|
-
origin,
|
|
115
|
-
layers,
|
|
116
|
-
...env ? { env } : scopedHome ? { env: {
|
|
117
|
-
name: "STIM_HOME",
|
|
118
|
-
value: context.env.STIM_HOME
|
|
119
|
-
} } : ci ? { env: {
|
|
120
|
-
name: "CI",
|
|
121
|
-
value: context.env.CI
|
|
122
|
-
} } : {},
|
|
123
|
-
...setting.sensitive ? { sensitive: true } : {},
|
|
124
|
-
...defaultReason ? { defaultReason } : {}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function unknownEntries(context) {
|
|
128
|
-
const sources = [
|
|
129
|
-
{
|
|
130
|
-
scope: "machine",
|
|
131
|
-
file: layerFile(context, "machine", null),
|
|
132
|
-
settings: { optimizations: context.machine?.optimizations }
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
scope: "workspace",
|
|
136
|
-
file: layerFile(context, "workspace", null),
|
|
137
|
-
settings: layerSettings(context, "workspace", null)
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
scope: "repo",
|
|
141
|
-
file: layerFile(context, "repo", null),
|
|
142
|
-
settings: layerSettings(context, "repo", null)
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
scope: "committed",
|
|
146
|
-
file: layerFile(context, "committed", null),
|
|
147
|
-
settings: layerSettings(context, "committed", null)
|
|
148
|
-
}
|
|
149
|
-
];
|
|
150
|
-
const repository = repositoryDirectory(context);
|
|
151
|
-
if (repository && repository !== appDirectory(context)) sources.push({
|
|
152
|
-
scope: "committed",
|
|
153
|
-
file: join(repository, ".stim.json"),
|
|
154
|
-
settings: readCommittedSettings(repository)
|
|
155
|
-
});
|
|
156
|
-
return sources.flatMap(({ scope, file, settings }) => file === null ? [] : unknownSettingKeys(settings).map((key) => ({
|
|
157
|
-
key,
|
|
158
|
-
scope,
|
|
159
|
-
file,
|
|
160
|
-
value: valueAt(settings, key)
|
|
161
|
-
})));
|
|
162
|
-
}
|
|
163
|
-
function settingsPayload(context) {
|
|
164
|
-
const files = {};
|
|
165
|
-
for (const scope of SETTING_SCOPES) {
|
|
166
|
-
const file = layerFile(context, scope, null);
|
|
167
|
-
if (file) files[scope] = file;
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
project: context.projectPath,
|
|
171
|
-
files,
|
|
172
|
-
settings: SETTINGS.map((setting) => settingEntry(context, setting)),
|
|
173
|
-
unknown: unknownEntries(context)
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
function requireSetting(key) {
|
|
177
|
-
const setting = settingDefinition(key);
|
|
178
|
-
if (setting) return setting;
|
|
179
|
-
throw new Refusal("STIM_BAD_ARG", `${JSON.stringify(key)} is not a Stim setting.`, "Run `stim settings` to list every setting, or `stim guide settings` for what each one does.");
|
|
180
|
-
}
|
|
181
|
-
function readScope(raw, setting) {
|
|
182
|
-
if (raw === void 0) {
|
|
183
|
-
if (setting.scopes.length === 1) return setting.scopes[0];
|
|
184
|
-
throw new Refusal("STIM_BAD_ARG", `${setting.key} can live in more than one layer, so the command needs --scope.`, `Pass --scope ${setting.scopes.join("|")}.`);
|
|
185
|
-
}
|
|
186
|
-
if (!SETTING_SCOPES.includes(raw)) throw new Refusal("STIM_BAD_ARG", `--scope takes ${SETTING_SCOPES.join(", ")}, not ${JSON.stringify(raw)}.`, null);
|
|
187
|
-
const scope = raw;
|
|
188
|
-
if (!setting.scopes.includes(scope)) throw new Refusal("STIM_BAD_ARG", `${setting.key} is not read from the ${scope} layer.`, `Pass --scope ${setting.scopes.join("|")}.`);
|
|
189
|
-
return scope;
|
|
190
|
-
}
|
|
191
|
-
function requireLayer(context, scope, setting) {
|
|
192
|
-
const file = layerFile(context, scope, setting);
|
|
193
|
-
if (file) return file;
|
|
194
|
-
if (scope === "repo") throw new Refusal("STIM_BAD_ARG", "The repo layer is keyed by a Git repository, and this directory is not inside one.", "Run this from inside the repository, or pick another --scope.");
|
|
195
|
-
throw new Refusal(NO_PROJECT_REFUSAL.code, NO_PROJECT_REFUSAL.message, NO_PROJECT_REFUSAL.remedy);
|
|
196
|
-
}
|
|
197
|
-
function example(setting) {
|
|
198
|
-
switch (setting.type.kind) {
|
|
199
|
-
case "boolean": return "false";
|
|
200
|
-
case "number": return String(setting.default ?? setting.type.minimum ?? 1);
|
|
201
|
-
case "strings": return `'["node_modules"]'`;
|
|
202
|
-
case "object": return `'{"key": "value"}'`;
|
|
203
|
-
case "choice": return setting.type.choices[0];
|
|
204
|
-
default: return "<value>";
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function parseSettingValue(setting, raw) {
|
|
208
|
-
const invalid = (expected) => new Refusal("STIM_BAD_ARG", `Invalid ${setting.key} value ${JSON.stringify(raw)}. Expected ${expected}.`, `For example: stim settings set ${setting.key} ${example(setting)}${setting.scopes.length > 1 ? ` --scope ${setting.scopes[0]}` : ""}`);
|
|
209
|
-
const kind = setting.type.kind;
|
|
210
|
-
const value = coerceSettingText(setting, raw);
|
|
211
|
-
const error = settingValueError(setting, value);
|
|
212
|
-
if (error) throw invalid(kind === "strings" || kind === "object" ? `${error}, written as JSON` : error);
|
|
213
|
-
return value;
|
|
214
|
-
}
|
|
215
|
-
function envSettingValue(setting, raw) {
|
|
216
|
-
const value = coerceSettingText(setting, raw);
|
|
217
|
-
const error = settingValueError(setting, value);
|
|
218
|
-
if (error) throw new Refusal("STIM_BAD_ARG", `Invalid ${setting.env} value ${JSON.stringify(raw)}. Expected ${error}.`, `Fix the environment variable, or unset it and run \`stim settings set ${setting.key} ${example(setting)}\`.`);
|
|
219
|
-
return value;
|
|
220
|
-
}
|
|
221
|
-
function committedTarget(context, setting) {
|
|
222
|
-
const directory = committedDirectory(context, setting);
|
|
223
|
-
if (!directory) throw new Refusal(NO_PROJECT_REFUSAL.code, NO_PROJECT_REFUSAL.message, NO_PROJECT_REFUSAL.remedy);
|
|
224
|
-
return join(directory, ".stim.json");
|
|
225
|
-
}
|
|
226
|
-
function writeCommitted(file, key, value) {
|
|
227
|
-
return withConfigLock$1(() => {
|
|
228
|
-
const exists = existsSync(file);
|
|
229
|
-
const text = exists ? readFileSync(file, "utf-8") : "";
|
|
230
|
-
let parsed = {};
|
|
231
|
-
if (exists && text.trim() !== "") try {
|
|
232
|
-
parsed = JSON.parse(text);
|
|
233
|
-
} catch (error) {
|
|
234
|
-
throw new Refusal("STIM_BAD_ARG", `${file} is not valid JSON: ${error.message}`, `Repair ${file}, then run the command again.`);
|
|
235
|
-
}
|
|
236
|
-
if (!isJsonObject(parsed)) throw new Refusal("STIM_BAD_ARG", `${file} is not a JSON object.`, `Repair ${file}, then run the command again.`);
|
|
237
|
-
const parts = key.split(".");
|
|
238
|
-
const chain = [parsed];
|
|
239
|
-
for (const part of parts.slice(0, -1)) {
|
|
240
|
-
const node = chain.at(-1);
|
|
241
|
-
if (!isJsonObject(node[part])) {
|
|
242
|
-
if (value === void 0) return false;
|
|
243
|
-
node[part] = {};
|
|
244
|
-
}
|
|
245
|
-
chain.push(node[part]);
|
|
246
|
-
}
|
|
247
|
-
const leaf = parts.at(-1);
|
|
248
|
-
const parent = chain.at(-1);
|
|
249
|
-
if (value === void 0) {
|
|
250
|
-
if (!(leaf in parent)) return false;
|
|
251
|
-
delete parent[leaf];
|
|
252
|
-
for (let index = chain.length - 1; index > 0; index--) {
|
|
253
|
-
if (Object.keys(chain[index]).length > 0) break;
|
|
254
|
-
delete chain[index - 1][parts[index - 1]];
|
|
255
|
-
}
|
|
256
|
-
} else parent[leaf] = value;
|
|
257
|
-
const indent = /\n([ \t]+)"/.exec(text)?.[1] ?? 2;
|
|
258
|
-
const tmp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
259
|
-
writeFileSync(tmp, `${JSON.stringify(parsed, null, indent)}\n`);
|
|
260
|
-
try {
|
|
261
|
-
renameSync(tmp, file);
|
|
262
|
-
} catch (error) {
|
|
263
|
-
try {
|
|
264
|
-
unlinkSync(tmp);
|
|
265
|
-
} catch {}
|
|
266
|
-
throw error;
|
|
267
|
-
}
|
|
268
|
-
return true;
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
function writeSetting(context, setting, scope, value) {
|
|
272
|
-
if (scope === "committed") return writeCommitted(committedTarget(context, setting), setting.key, value);
|
|
273
|
-
if (scope === "machine") return writeConfigSetting({ scope }, setting.key, value);
|
|
274
|
-
if (scope === "workspace") return writeConfigSetting({
|
|
275
|
-
scope,
|
|
276
|
-
projectPath: context.projectPath
|
|
277
|
-
}, setting.key, value);
|
|
278
|
-
return writeConfigSetting({
|
|
279
|
-
scope,
|
|
280
|
-
gitCommonDir: context.gitCommonDir
|
|
281
|
-
}, setting.key, value);
|
|
282
|
-
}
|
|
283
|
-
function formatValue(value) {
|
|
284
|
-
return typeof value === "string" ? value : JSON.stringify(value);
|
|
285
|
-
}
|
|
286
|
-
function formatOrigin(entry) {
|
|
287
|
-
if (entry.origin === null) return "unset";
|
|
288
|
-
return entry.defaultReason ? `${entry.origin}: ${entry.defaultReason}` : entry.origin;
|
|
289
|
-
}
|
|
290
|
-
const CONSOLE = {
|
|
291
|
-
out: (line) => console.log(line),
|
|
292
|
-
note: (line) => console.error(line)
|
|
293
|
-
};
|
|
294
|
-
function run(json, io, action) {
|
|
295
|
-
try {
|
|
296
|
-
action();
|
|
297
|
-
} catch (error) {
|
|
298
|
-
const code = error.code;
|
|
299
|
-
if (!(error instanceof Refusal) && !(typeof code === "string" && code.startsWith("STIM_"))) throw error;
|
|
300
|
-
const failure = {
|
|
301
|
-
code,
|
|
302
|
-
message: error.message,
|
|
303
|
-
remedy: error instanceof Refusal ? error.remedy : null
|
|
304
|
-
};
|
|
305
|
-
io.note(chalk.red(`${failure.code}: ${failure.message}`));
|
|
306
|
-
if (failure.remedy) io.note(chalk.dim(failure.remedy));
|
|
307
|
-
if (json) io.out(JSON.stringify(failure));
|
|
308
|
-
process.exitCode = 1;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
function wantsJson(opts, command) {
|
|
312
|
-
return Boolean(opts.json ?? command.parent?.opts().json);
|
|
313
|
-
}
|
|
314
|
-
function registerSettings(program, io = CONSOLE, env = process.env) {
|
|
315
|
-
const settings = program.command("settings").description("Show every Stim setting with its effective value and layer, or change one").option("--json", "print every setting, its origin, and each layer value as JSON").action((opts) => run(Boolean(opts.json), io, () => {
|
|
316
|
-
const payload = settingsPayload(readContext(env, io.note));
|
|
317
|
-
if (opts.json) {
|
|
318
|
-
io.out(JSON.stringify(payload));
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
const width = Math.max(...payload.settings.map((entry) => entry.key.length));
|
|
322
|
-
for (const entry of payload.settings) {
|
|
323
|
-
const shown = entry.origin === null ? "" : formatValue(entry.value);
|
|
324
|
-
io.out(`${entry.key.padEnd(width)} ${shown}${shown ? " " : ""}${chalk.dim(`(${formatOrigin(entry)})`)}`);
|
|
325
|
-
}
|
|
326
|
-
for (const entry of payload.unknown) io.note(chalk.yellow(`Warning: ${entry.key} in ${entry.file} is not read by Stim.`));
|
|
327
|
-
}));
|
|
328
|
-
settings.command("get <key>").description("Print the effective value of a setting, or its value in one layer").option("--scope <scope>", `read one layer: ${SETTING_SCOPES.join(", ")}`).option("--json", "print the setting entry as JSON").action((key, opts, command) => run(wantsJson(opts, command), io, () => {
|
|
329
|
-
const setting = requireSetting(key);
|
|
330
|
-
const scope = opts.scope === void 0 ? null : readScope(opts.scope, setting);
|
|
331
|
-
const context = readContext(env, io.note);
|
|
332
|
-
const entry = settingEntry(context, setting);
|
|
333
|
-
const value = scope ? entry.layers[scope] ?? null : entry.value;
|
|
334
|
-
if (wantsJson(opts, command)) {
|
|
335
|
-
io.out(JSON.stringify(scope ? {
|
|
336
|
-
key,
|
|
337
|
-
scope,
|
|
338
|
-
file: layerFile(context, scope, setting),
|
|
339
|
-
value
|
|
340
|
-
} : entry));
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
if (value === null) return;
|
|
344
|
-
io.out(formatValue(value));
|
|
345
|
-
if (!scope && entry.defaultReason) io.note(chalk.dim(`(${formatOrigin(entry)})`));
|
|
346
|
-
}));
|
|
347
|
-
settings.command("set <key> <value>").description("Write a setting to one layer").option("--scope <scope>", `the layer to write: ${SETTING_SCOPES.join(", ")}`).option("--json", "print the written setting as JSON").action((key, raw, opts, command) => run(wantsJson(opts, command), io, () => {
|
|
348
|
-
const setting = requireSetting(key);
|
|
349
|
-
const scope = readScope(opts.scope, setting);
|
|
350
|
-
const value = parseSettingValue(setting, raw);
|
|
351
|
-
if (setting.sensitive && scope === "committed" && !isSensitiveReference(value)) throw new Refusal("STIM_BAD_ARG", `${key} is sensitive, so a committed .stim.json takes only an env: or file: reference, never the secret.`, `Set the secret with --scope workspace or --scope repo, which store it in ${getConfigPath$1()}, readable only by you, or commit a reference such as env:MY_KEYSTORE_PASSWORD.`);
|
|
352
|
-
const context = readContext(env, io.note);
|
|
353
|
-
const file = requireLayer(context, scope, setting);
|
|
354
|
-
const recording = setting.key === "recording.enabled" ? recordingLayers() : null;
|
|
355
|
-
const changed = writeSetting(context, setting, scope, value);
|
|
356
|
-
report(io, wantsJson(opts, command), {
|
|
357
|
-
key,
|
|
358
|
-
scope,
|
|
359
|
-
file,
|
|
360
|
-
changed
|
|
361
|
-
}, setting, readContext(env), "set", recording);
|
|
362
|
-
}));
|
|
363
|
-
settings.command("unset <key>").description("Remove a setting from one layer").option("--scope <scope>", `the layer to clear: ${SETTING_SCOPES.join(", ")}`).option("--json", "print the setting after removal as JSON").action((key, opts, command) => run(wantsJson(opts, command), io, () => {
|
|
364
|
-
const setting = requireSetting(key);
|
|
365
|
-
const scope = readScope(opts.scope, setting);
|
|
366
|
-
const context = readContext(env, io.note);
|
|
367
|
-
const file = requireLayer(context, scope, setting);
|
|
368
|
-
const recording = setting.key === "recording.enabled" ? recordingLayers() : null;
|
|
369
|
-
const changed = writeSetting(context, setting, scope, void 0);
|
|
370
|
-
report(io, wantsJson(opts, command), {
|
|
371
|
-
key,
|
|
372
|
-
scope,
|
|
373
|
-
file,
|
|
374
|
-
changed
|
|
375
|
-
}, setting, readContext(env), "unset", recording);
|
|
376
|
-
}));
|
|
377
|
-
}
|
|
378
|
-
function report(io, json, write, setting, context, verb, recordingBefore) {
|
|
379
|
-
const entry = settingEntry(context, setting);
|
|
380
|
-
const recordingsDeleted = recordingBefore ? deleteTurnedOffRecordings(recordingBefore) : null;
|
|
381
|
-
if (json) {
|
|
382
|
-
io.out(JSON.stringify({
|
|
383
|
-
...write,
|
|
384
|
-
setting: entry,
|
|
385
|
-
...recordingsDeleted ? { recordingsDeleted } : {}
|
|
386
|
-
}));
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
for (const workspace of recordingsDeleted ?? []) io.note(`Deleted the device recordings of ${workspace}.`);
|
|
390
|
-
const effective = entry.origin === null ? "unset" : `${formatValue(entry.value)} (${formatOrigin(entry)})`;
|
|
391
|
-
if (!write.changed) {
|
|
392
|
-
io.out(`${write.key} was not set in ${write.file}; effective value: ${effective}`);
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
const shown = verb === "set" ? ` = ${formatValue(entry.layers[write.scope])}` : "";
|
|
396
|
-
io.out(`${verb} ${write.key}${shown} in ${write.file}; effective value: ${effective}`);
|
|
397
|
-
}
|
|
398
|
-
function settingsCommand(program) {
|
|
399
|
-
registerSettings(program);
|
|
400
|
-
}
|
|
401
|
-
//#endregion
|
|
402
|
-
export { settingsCommand as default, registerSettings };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { j as ownership_claim_exports, k as process_identity_exports } from "./config-BYDxlMY3.mjs";
|
|
2
|
-
//#region src/engine/spawn-claims.ts
|
|
3
|
-
const declaring = /* @__PURE__ */ new Set();
|
|
4
|
-
const running = /* @__PURE__ */ new Set();
|
|
5
|
-
let refusal = null;
|
|
6
|
-
/** Record every child later started through `spawnDeclared` on `claim` until `stopDeclaringSpawnsOn(claim)`. */
|
|
7
|
-
function declareSpawnsOn(claim) {
|
|
8
|
-
if (claim) declaring.add(claim);
|
|
9
|
-
}
|
|
10
|
-
function stopDeclaringSpawnsOn(claim) {
|
|
11
|
-
if (claim) declaring.delete(claim);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Start a child that every claim passed to `declareSpawnsOn` records until it exits. The child keeps
|
|
15
|
-
* the caller's process group, so a terminal interrupt still reaches it; the claim follows the child
|
|
16
|
-
* itself. A claim that cannot be marked stops the spawn rather than letting it run unprotected. A claim
|
|
17
|
-
* records one child, so declared spawns must not overlap.
|
|
18
|
-
*/
|
|
19
|
-
function spawnDeclared(spawn) {
|
|
20
|
-
if (refusal !== null) throw new Error(refusal);
|
|
21
|
-
const claims = [...declaring];
|
|
22
|
-
if (claims.length === 0) return spawn();
|
|
23
|
-
const forget = () => {
|
|
24
|
-
for (const claim of claims) try {
|
|
25
|
-
(0, ownership_claim_exports.clearClaimChild)(claim);
|
|
26
|
-
} catch {}
|
|
27
|
-
};
|
|
28
|
-
let child;
|
|
29
|
-
try {
|
|
30
|
-
for (const claim of claims) (0, ownership_claim_exports.markClaimChildPending)(claim);
|
|
31
|
-
child = spawn();
|
|
32
|
-
} catch (error) {
|
|
33
|
-
forget();
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
36
|
-
const pid = child.pid;
|
|
37
|
-
if (pid === void 0) {
|
|
38
|
-
forget();
|
|
39
|
-
return child;
|
|
40
|
-
}
|
|
41
|
-
running.add(child);
|
|
42
|
-
child.once("exit", () => running.delete(child));
|
|
43
|
-
const captured = (0, process_identity_exports.captureProcessIdentity)(pid);
|
|
44
|
-
if (captured.ok) for (const claim of claims) try {
|
|
45
|
-
(0, ownership_claim_exports.setClaimChild)(claim, {
|
|
46
|
-
pid,
|
|
47
|
-
processToken: captured.token
|
|
48
|
-
});
|
|
49
|
-
} catch {}
|
|
50
|
-
child.once("exit", forget);
|
|
51
|
-
return child;
|
|
52
|
-
}
|
|
53
|
-
/** Refuse every later `spawnDeclared` with `reason` until `allowDeclaredSpawns()`. */
|
|
54
|
-
function refuseDeclaredSpawns(reason) {
|
|
55
|
-
refusal = reason;
|
|
56
|
-
}
|
|
57
|
-
function allowDeclaredSpawns() {
|
|
58
|
-
refusal = null;
|
|
59
|
-
}
|
|
60
|
-
/** Send `signal` to every child started through `spawnDeclared` that has not exited; returns how many were signalled. */
|
|
61
|
-
function signalDeclaredSpawns(signal) {
|
|
62
|
-
let signalled = 0;
|
|
63
|
-
for (const child of running) {
|
|
64
|
-
if (child.exitCode !== null || child.signalCode !== null) continue;
|
|
65
|
-
try {
|
|
66
|
-
if (child.kill(signal)) signalled += 1;
|
|
67
|
-
} catch {}
|
|
68
|
-
}
|
|
69
|
-
return signalled;
|
|
70
|
-
}
|
|
71
|
-
//#endregion
|
|
72
|
-
export { spawnDeclared as a, signalDeclaredSpawns as i, declareSpawnsOn as n, stopDeclaringSpawnsOn as o, refuseDeclaredSpawns as r, allowDeclaredSpawns as t };
|