buncargo 1.0.26 → 3.0.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.
Files changed (222) hide show
  1. package/dist/bin.d.ts +1 -12
  2. package/dist/bin.js +261 -252
  3. package/dist/cli/bin.d.ts +13 -0
  4. package/dist/cli/bin.js +315 -0
  5. package/dist/cli/commands/help.d.ts +1 -0
  6. package/dist/cli/commands/runtime.d.ts +5 -0
  7. package/dist/cli/commands/version.d.ts +1 -0
  8. package/dist/cli/index.d.ts +1 -0
  9. package/dist/cli/index.js +14 -0
  10. package/dist/cli/run-cli.d.ts +22 -0
  11. package/dist/cli.d.ts +1 -22
  12. package/dist/cli.js +5 -13
  13. package/dist/config/config.d.ts +1 -0
  14. package/dist/config/define-config.d.ts +13 -0
  15. package/dist/config/index.d.ts +3 -0
  16. package/dist/config/index.js +15 -0
  17. package/dist/config/merge-configs.d.ts +3 -0
  18. package/dist/config/validate-config.d.ts +3 -0
  19. package/dist/config.d.ts +1 -72
  20. package/dist/config.js +12 -12
  21. package/dist/core/docker.d.ts +1 -74
  22. package/dist/core/docker.js +35 -26
  23. package/dist/core/index.d.ts +1 -1
  24. package/dist/core/index.js +123 -108
  25. package/dist/core/network.js +2 -2
  26. package/dist/core/ports.d.ts +22 -0
  27. package/dist/core/ports.js +5 -1
  28. package/dist/core/process.js +1 -1
  29. package/dist/core/tunnel.d.ts +33 -0
  30. package/dist/core/utils.js +2 -2
  31. package/dist/core/watchdog-runner.js +45 -42
  32. package/dist/core/watchdog.d.ts +1 -0
  33. package/dist/core/watchdog.js +4 -2
  34. package/dist/docker/index.d.ts +1 -0
  35. package/dist/docker/index.js +38 -0
  36. package/dist/docker/runtime.d.ts +87 -0
  37. package/dist/docker/runtime.js +37 -0
  38. package/dist/docker-compose/compose.d.ts +1 -0
  39. package/dist/docker-compose/generated-file.d.ts +7 -0
  40. package/dist/docker-compose/index.d.ts +3 -0
  41. package/dist/docker-compose/index.js +15 -0
  42. package/dist/docker-compose/model.d.ts +6 -0
  43. package/dist/docker-compose/services/clickhouse.d.ts +16 -0
  44. package/dist/docker-compose/services/define-docker-service.d.ts +41 -0
  45. package/dist/docker-compose/services/index.d.ts +23 -0
  46. package/dist/docker-compose/services/index.js +17 -0
  47. package/dist/docker-compose/services/postgres.d.ts +12 -0
  48. package/dist/docker-compose/services/redis.d.ts +12 -0
  49. package/dist/docker-compose/services/shared.d.ts +7 -0
  50. package/dist/docker-compose/yaml.d.ts +2 -0
  51. package/dist/environment/create-dev-environment.d.ts +23 -0
  52. package/dist/environment/index.d.ts +1 -0
  53. package/dist/environment/index.js +15 -0
  54. package/dist/environment/logging.d.ts +17 -0
  55. package/dist/environment/seeding.d.ts +9 -0
  56. package/dist/environment.d.ts +1 -23
  57. package/dist/environment.js +12 -14
  58. package/dist/index-045jksh5.js +147 -0
  59. package/dist/index-08wa79cs.js +125 -117
  60. package/dist/index-0kxnae3z.js +335 -0
  61. package/dist/index-1mdrf7nz.js +66 -0
  62. package/dist/index-1yvbwj4k.js +262 -242
  63. package/dist/index-23ev345g.js +475 -0
  64. package/dist/index-2ckr49sf.js +228 -0
  65. package/dist/index-2f47khe5.js +376 -369
  66. package/dist/index-2fr3g85b.js +220 -183
  67. package/dist/index-38xnzpa6.js +450 -0
  68. package/dist/index-3h3dhtf2.js +51 -43
  69. package/dist/index-42x95209.js +51 -43
  70. package/dist/index-4gp0az1g.js +145 -0
  71. package/dist/index-4xrxh8yv.js +72 -0
  72. package/dist/index-5gmws6ah.js +181 -0
  73. package/dist/index-5hka0tff.js +78 -76
  74. package/dist/index-5rfqps4b.js +3 -0
  75. package/dist/index-5t9jxqm0.js +428 -0
  76. package/dist/index-6c1w1xk5.js +101 -0
  77. package/dist/index-6fm7mvwj.js +118 -97
  78. package/dist/index-6srpc523.js +127 -128
  79. package/dist/index-731rzzfp.js +187 -0
  80. package/dist/index-75y4cg2z.js +51 -43
  81. package/dist/index-7ja4ywyj.js +126 -127
  82. package/dist/index-8bw1cmz4.js +531 -0
  83. package/dist/index-8hbbj1mp.js +120 -121
  84. package/dist/index-8xj2p5n5.js +145 -0
  85. package/dist/index-bj79tw5w.js +0 -0
  86. package/dist/index-bnk6nr0g.js +73 -0
  87. package/dist/index-brbbzyks.js +72 -0
  88. package/dist/index-c0dr6mcv.js +123 -0
  89. package/dist/index-cty0bcry.js +235 -218
  90. package/dist/index-d8tyv5se.js +228 -0
  91. package/dist/index-d9efy0n4.js +176 -150
  92. package/dist/index-etfmqjjf.js +427 -0
  93. package/dist/index-fb29934k.js +172 -0
  94. package/dist/index-g50jw1yf.js +72 -0
  95. package/dist/index-g6eb5wdw.js +118 -117
  96. package/dist/index-ggq3yryx.js +99 -95
  97. package/dist/index-h70tce00.js +177 -0
  98. package/dist/index-hkxtfqtc.js +333 -0
  99. package/dist/index-kf3dhser.js +146 -143
  100. package/dist/index-ma6tgdb2.js +500 -0
  101. package/dist/index-mam0bcyz.js +123 -0
  102. package/dist/index-mm412dkp.js +274 -0
  103. package/dist/index-n8v18aeb.js +0 -0
  104. package/dist/index-ndnmnsej.js +378 -371
  105. package/dist/index-p8wty0e2.js +389 -379
  106. package/dist/index-qfphr2fd.js +100 -0
  107. package/dist/index-qqmms8rs.js +51 -43
  108. package/dist/index-qw4093g2.js +51 -43
  109. package/dist/index-qzwpzjbx.js +121 -122
  110. package/dist/index-segbnm0h.js +146 -143
  111. package/dist/index-t0fj6gg1.js +112 -0
  112. package/dist/index-thdkwnv7.js +122 -0
  113. package/dist/index-tjbx2r2t.js +270 -0
  114. package/dist/index-tjqw9vtj.js +62 -54
  115. package/dist/index-vbpb89jy.js +248 -0
  116. package/dist/index-vhs88xhe.js +99 -95
  117. package/dist/index-w8zxnjka.js +249 -0
  118. package/dist/index-wk2na3t9.js +404 -0
  119. package/dist/index-wz9x8g7z.js +383 -373
  120. package/dist/index-x249gyde.js +388 -378
  121. package/dist/index-xkvd0nsd.js +187 -0
  122. package/dist/index-yedqxm1z.js +80 -0
  123. package/dist/index-zfjzzjkf.js +266 -0
  124. package/dist/index.d.ts +12 -8
  125. package/dist/index.js +66 -35
  126. package/dist/lint.d.ts +1 -46
  127. package/dist/lint.js +3 -7
  128. package/dist/loader/cache.d.ts +4 -0
  129. package/dist/loader/find-config-file.d.ts +2 -0
  130. package/dist/loader/index.d.ts +5 -0
  131. package/dist/loader/index.js +24 -0
  132. package/dist/loader/load-dev-env.d.ts +5 -0
  133. package/dist/loader/loader.d.ts +1 -0
  134. package/dist/loader.d.ts +1 -45
  135. package/dist/loader.js +22 -20
  136. package/dist/prisma/index.d.ts +1 -0
  137. package/dist/prisma/prisma.d.ts +29 -0
  138. package/dist/prisma.d.ts +1 -29
  139. package/dist/prisma.js +6 -10
  140. package/dist/src/bin.js +309 -0
  141. package/dist/src/cli.js +5 -0
  142. package/dist/src/config.js +15 -0
  143. package/dist/src/core/docker.js +38 -0
  144. package/dist/src/core/index.js +130 -0
  145. package/dist/src/core/network.js +9 -0
  146. package/dist/src/core/ports.js +23 -0
  147. package/dist/src/core/process.js +31 -0
  148. package/dist/src/core/utils.js +11 -0
  149. package/dist/src/core/watchdog-runner.js +69 -0
  150. package/dist/src/core/watchdog.js +28 -0
  151. package/dist/src/docker/runtime.js +37 -0
  152. package/dist/src/docker-compose/index.js +16 -0
  153. package/dist/src/docker-compose/services/index.js +17 -0
  154. package/dist/src/environment.js +12 -0
  155. package/dist/src/index.js +122 -0
  156. package/dist/src/lint.js +3 -0
  157. package/dist/src/loader.js +25 -0
  158. package/dist/src/prisma.js +6 -0
  159. package/dist/src/types.js +0 -0
  160. package/dist/typecheck/index.d.ts +1 -0
  161. package/dist/typecheck/index.js +7 -0
  162. package/dist/typecheck/typecheck.d.ts +46 -0
  163. package/dist/types/all-types.d.ts +501 -0
  164. package/dist/types/cli.d.ts +1 -0
  165. package/dist/types/config.d.ts +6 -0
  166. package/dist/types/docker.d.ts +15 -0
  167. package/dist/types/environment.d.ts +8 -0
  168. package/dist/types/hooks.d.ts +9 -0
  169. package/dist/types/index.d.ts +1 -0
  170. package/dist/types/index.js +0 -0
  171. package/dist/types/prisma.d.ts +1 -0
  172. package/dist/types.d.ts +1 -393
  173. package/package.json +145 -140
  174. package/readme.md +358 -105
  175. package/src/cli/bin.ts +77 -0
  176. package/src/cli/commands/help.ts +39 -0
  177. package/src/cli/commands/runtime.ts +72 -0
  178. package/src/cli/commands/version.ts +4 -0
  179. package/src/cli/index.ts +1 -0
  180. package/{cli.ts → src/cli/run-cli.ts} +95 -6
  181. package/src/config/define-config.ts +30 -0
  182. package/src/config/index.ts +3 -0
  183. package/src/config/merge-configs.ts +33 -0
  184. package/src/config/validate-config.ts +136 -0
  185. package/{core → src/core}/index.ts +2 -2
  186. package/{core → src/core}/ports.ts +68 -1
  187. package/{core → src/core}/process.ts +6 -2
  188. package/src/core/tunnel.ts +151 -0
  189. package/{core → src/core}/utils.ts +1 -0
  190. package/{core → src/core}/watchdog.ts +5 -1
  191. package/src/docker/index.ts +1 -0
  192. package/{core/docker.ts → src/docker/runtime.ts} +40 -4
  193. package/src/docker-compose/generated-file.ts +45 -0
  194. package/src/docker-compose/index.ts +7 -0
  195. package/src/docker-compose/model.ts +197 -0
  196. package/src/docker-compose/services/clickhouse.ts +79 -0
  197. package/src/docker-compose/services/define-docker-service.ts +109 -0
  198. package/src/docker-compose/services/index.ts +67 -0
  199. package/src/docker-compose/services/postgres.ts +60 -0
  200. package/src/docker-compose/services/redis.ts +48 -0
  201. package/src/docker-compose/services/shared.ts +79 -0
  202. package/src/docker-compose/yaml.ts +88 -0
  203. package/{environment.ts → src/environment/create-dev-environment.ts} +101 -146
  204. package/src/environment/index.ts +1 -0
  205. package/src/environment/logging.ts +101 -0
  206. package/src/environment/seeding.ts +57 -0
  207. package/{index.ts → src/index.ts} +49 -15
  208. package/src/loader/cache.ts +23 -0
  209. package/src/loader/find-config-file.ts +29 -0
  210. package/src/loader/index.ts +17 -0
  211. package/src/loader/load-dev-env.ts +38 -0
  212. package/src/prisma/index.ts +1 -0
  213. package/{prisma.ts → src/prisma/prisma.ts} +4 -2
  214. package/src/typecheck/index.ts +1 -0
  215. package/{types.ts → src/types/all-types.ts} +137 -6
  216. package/src/types/index.ts +1 -0
  217. package/bin.ts +0 -191
  218. package/config.ts +0 -194
  219. package/loader.ts +0 -126
  220. /package/{core → src/core}/network.ts +0 -0
  221. /package/{core → src/core}/watchdog-runner.ts +0 -0
  222. /package/{lint.ts → src/typecheck/typecheck.ts} +0 -0
@@ -1,29 +1,38 @@
1
+ import "../index-n8v18aeb.js";
1
2
  import {
2
- MAX_ATTEMPTS,
3
- POLL_INTERVAL,
4
- areContainersRunning,
5
- createBuiltInHealthCheck,
6
- isContainerRunning,
7
- startContainers,
8
- startService,
9
- stopContainers,
10
- waitForAllServices,
11
- waitForService,
12
- waitForServiceByType
13
- } from "../index-2fr3g85b.js";
14
- import"../index-6fm7mvwj.js";
15
- import"../index-08wa79cs.js";
16
- import"../index-qnx9j3qa.js";
3
+ areContainersRunning,
4
+ assertDockerRunning,
5
+ createBuiltInHealthCheck,
6
+ DOCKER_NOT_RUNNING_MESSAGE,
7
+ getComposeArg,
8
+ isContainerRunning,
9
+ isDockerRunning,
10
+ MAX_ATTEMPTS,
11
+ POLL_INTERVAL,
12
+ startContainers,
13
+ startService,
14
+ stopContainers,
15
+ waitForAllServices,
16
+ waitForService,
17
+ waitForServiceByType,
18
+ } from "../index-tjbx2r2t.js";
19
+ import "../index-4gp0az1g.js";
20
+ import "../index-xkvd0nsd.js";
21
+ import "../index-qnx9j3qa.js";
17
22
  export {
18
- waitForServiceByType,
19
- waitForService,
20
- waitForAllServices,
21
- stopContainers,
22
- startService,
23
- startContainers,
24
- isContainerRunning,
25
- createBuiltInHealthCheck,
26
- areContainersRunning,
27
- POLL_INTERVAL,
28
- MAX_ATTEMPTS
23
+ waitForServiceByType,
24
+ waitForService,
25
+ waitForAllServices,
26
+ stopContainers,
27
+ startService,
28
+ startContainers,
29
+ isDockerRunning,
30
+ isContainerRunning,
31
+ getComposeArg,
32
+ createBuiltInHealthCheck,
33
+ assertDockerRunning,
34
+ areContainersRunning,
35
+ POLL_INTERVAL,
36
+ MAX_ATTEMPTS,
37
+ DOCKER_NOT_RUNNING_MESSAGE,
29
38
  };
@@ -1,6 +1,6 @@
1
- export * from "./docker";
2
1
  export * from "./network";
3
2
  export * from "./ports";
4
3
  export * from "./process";
4
+ export * from "./tunnel";
5
5
  export * from "./utils";
6
6
  export * from "./watchdog";
@@ -1,115 +1,130 @@
1
+ import "../index-n8v18aeb.js";
1
2
  import {
2
- getHeartbeatFile,
3
- getWatchdogPid,
4
- getWatchdogPidFile,
5
- isWatchdogRunning,
6
- readHeartbeat,
7
- removeHeartbeatFile,
8
- spawnWatchdog,
9
- startHeartbeat,
10
- stopHeartbeat,
11
- stopWatchdog
12
- } from "../index-ggq3yryx.js";
3
+ getEnvVar,
4
+ getLocalIp,
5
+ isCI,
6
+ isPortAvailable,
7
+ logApiUrl,
8
+ logExpoApiUrl,
9
+ logFrontendPort,
10
+ sleep,
11
+ waitForDevServers,
12
+ waitForServer,
13
+ } from "../index-4gp0az1g.js";
13
14
  import {
14
- buildApps,
15
- exec,
16
- execAsync,
17
- getProcessOnPort,
18
- isPortInUse,
19
- isProcessAlive,
20
- killProcessOnPort,
21
- killProcessOnPortAndWait,
22
- killProcessesOnAppPorts,
23
- spawnDevServer,
24
- startDevServers,
25
- stopAllProcesses,
26
- stopProcess
27
- } from "../index-1yvbwj4k.js";
15
+ getHeartbeatFile,
16
+ getWatchdogComposeArg,
17
+ getWatchdogPid,
18
+ getWatchdogPidFile,
19
+ isWatchdogRunning,
20
+ readHeartbeat,
21
+ removeHeartbeatFile,
22
+ spawnWatchdog,
23
+ startHeartbeat,
24
+ stopHeartbeat,
25
+ stopWatchdog,
26
+ } from "../index-mam0bcyz.js";
28
27
  import {
29
- MAX_ATTEMPTS,
30
- POLL_INTERVAL,
31
- areContainersRunning,
32
- createBuiltInHealthCheck,
33
- isContainerRunning,
34
- startContainers,
35
- startService,
36
- stopContainers,
37
- waitForAllServices,
38
- waitForService,
39
- waitForServiceByType
40
- } from "../index-2fr3g85b.js";
28
+ buildApps,
29
+ exec,
30
+ execAsync,
31
+ getProcessOnPort,
32
+ isPortInUse,
33
+ isProcessAlive,
34
+ killProcessesOnAppPorts,
35
+ killProcessOnPort,
36
+ killProcessOnPortAndWait,
37
+ spawnDevServer,
38
+ startDevServers,
39
+ stopAllProcesses,
40
+ stopProcess,
41
+ } from "../index-mm412dkp.js";
41
42
  import {
42
- getEnvVar,
43
- getLocalIp,
44
- isCI,
45
- isPortAvailable,
46
- logApiUrl,
47
- logExpoApiUrl,
48
- logFrontendPort,
49
- sleep,
50
- waitForDevServers,
51
- waitForServer
52
- } from "../index-6fm7mvwj.js";
43
+ areContainersRunning,
44
+ assertDockerRunning,
45
+ createBuiltInHealthCheck,
46
+ DOCKER_NOT_RUNNING_MESSAGE,
47
+ getComposeArg,
48
+ isContainerRunning,
49
+ isDockerRunning,
50
+ MAX_ATTEMPTS,
51
+ POLL_INTERVAL,
52
+ startContainers,
53
+ startService,
54
+ stopContainers,
55
+ waitForAllServices,
56
+ waitForService,
57
+ waitForServiceByType,
58
+ } from "../index-tjbx2r2t.js";
53
59
  import {
54
- calculatePortOffset,
55
- computePorts,
56
- computeUrls,
57
- findMonorepoRoot,
58
- getProjectName,
59
- getWorktreeName,
60
- isWorktree
61
- } from "../index-08wa79cs.js";
62
- import"../index-qnx9j3qa.js";
60
+ calculatePortOffset,
61
+ computeDevIdentity,
62
+ computePorts,
63
+ computeUrls,
64
+ findMonorepoRoot,
65
+ getProjectName,
66
+ getWorktreeName,
67
+ getWorktreeProjectSuffix,
68
+ isWorktree,
69
+ } from "../index-xkvd0nsd.js";
70
+ import "../index-qnx9j3qa.js";
63
71
  export {
64
- waitForServiceByType,
65
- waitForService,
66
- waitForServer,
67
- waitForDevServers,
68
- waitForAllServices,
69
- stopWatchdog,
70
- stopProcess,
71
- stopHeartbeat,
72
- stopContainers,
73
- stopAllProcesses,
74
- startService,
75
- startHeartbeat,
76
- startDevServers,
77
- startContainers,
78
- spawnWatchdog,
79
- spawnDevServer,
80
- sleep,
81
- removeHeartbeatFile,
82
- readHeartbeat,
83
- logFrontendPort,
84
- logExpoApiUrl,
85
- logApiUrl,
86
- killProcessesOnAppPorts,
87
- killProcessOnPortAndWait,
88
- killProcessOnPort,
89
- isWorktree,
90
- isWatchdogRunning,
91
- isProcessAlive,
92
- isPortInUse,
93
- isPortAvailable,
94
- isContainerRunning,
95
- isCI,
96
- getWorktreeName,
97
- getWatchdogPidFile,
98
- getWatchdogPid,
99
- getProjectName,
100
- getProcessOnPort,
101
- getLocalIp,
102
- getHeartbeatFile,
103
- getEnvVar,
104
- findMonorepoRoot,
105
- execAsync,
106
- exec,
107
- createBuiltInHealthCheck,
108
- computeUrls,
109
- computePorts,
110
- calculatePortOffset,
111
- buildApps,
112
- areContainersRunning,
113
- POLL_INTERVAL,
114
- MAX_ATTEMPTS
72
+ waitForServiceByType,
73
+ waitForService,
74
+ waitForServer,
75
+ waitForDevServers,
76
+ waitForAllServices,
77
+ stopWatchdog,
78
+ stopProcess,
79
+ stopHeartbeat,
80
+ stopContainers,
81
+ stopAllProcesses,
82
+ startService,
83
+ startHeartbeat,
84
+ startDevServers,
85
+ startContainers,
86
+ spawnWatchdog,
87
+ spawnDevServer,
88
+ sleep,
89
+ removeHeartbeatFile,
90
+ readHeartbeat,
91
+ logFrontendPort,
92
+ logExpoApiUrl,
93
+ logApiUrl,
94
+ killProcessesOnAppPorts,
95
+ killProcessOnPortAndWait,
96
+ killProcessOnPort,
97
+ isWorktree,
98
+ isWatchdogRunning,
99
+ isProcessAlive,
100
+ isPortInUse,
101
+ isPortAvailable,
102
+ isDockerRunning,
103
+ isContainerRunning,
104
+ isCI,
105
+ getWorktreeProjectSuffix,
106
+ getWorktreeName,
107
+ getWatchdogPidFile,
108
+ getWatchdogPid,
109
+ getWatchdogComposeArg,
110
+ getProjectName,
111
+ getProcessOnPort,
112
+ getLocalIp,
113
+ getHeartbeatFile,
114
+ getEnvVar,
115
+ getComposeArg,
116
+ findMonorepoRoot,
117
+ execAsync,
118
+ exec,
119
+ createBuiltInHealthCheck,
120
+ computeUrls,
121
+ computePorts,
122
+ computeDevIdentity,
123
+ calculatePortOffset,
124
+ buildApps,
125
+ assertDockerRunning,
126
+ areContainersRunning,
127
+ POLL_INTERVAL,
128
+ MAX_ATTEMPTS,
129
+ DOCKER_NOT_RUNNING_MESSAGE,
115
130
  };
@@ -3,8 +3,8 @@ import {
3
3
  isPortAvailable,
4
4
  waitForDevServers,
5
5
  waitForServer
6
- } from "../index-6fm7mvwj.js";
7
- import"../index-08wa79cs.js";
6
+ } from "../index-c0dr6mcv.js";
7
+ import"../index-fb29934k.js";
8
8
  import"../index-qnx9j3qa.js";
9
9
  export {
10
10
  waitForServer,
@@ -11,6 +11,11 @@ export declare function getWorktreeName(root?: string): string | null;
11
11
  * Check if the current directory is a git worktree.
12
12
  */
13
13
  export declare function isWorktree(root?: string): boolean;
14
+ /**
15
+ * Get a sanitized worktree-derived suffix for Docker project isolation.
16
+ * Returns null when not running in a worktree.
17
+ */
18
+ export declare function getWorktreeProjectSuffix(root?: string): string | null;
14
19
  /**
15
20
  * Calculate port offset based on worktree name and optional suffix.
16
21
  * Returns 0 for main branch, 10-99 for worktrees.
@@ -20,6 +25,23 @@ export declare function calculatePortOffset(suffix?: string, root?: string): num
20
25
  * Generate Docker project name from prefix and directory.
21
26
  */
22
27
  export declare function getProjectName(prefix: string, suffix?: string, root?: string): string;
28
+ export interface DevIdentityOptions {
29
+ projectPrefix: string;
30
+ suffix?: string;
31
+ root?: string;
32
+ worktreeIsolation?: boolean;
33
+ }
34
+ export interface DevIdentity {
35
+ worktree: boolean;
36
+ worktreeSuffix: string | null;
37
+ projectSuffix?: string;
38
+ projectName: string;
39
+ portOffset: number;
40
+ }
41
+ /**
42
+ * Compute all identity values used by the dev environment in one place.
43
+ */
44
+ export declare function computeDevIdentity(options: DevIdentityOptions): DevIdentity;
23
45
  /**
24
46
  * Compute all ports for services and apps with offset applied.
25
47
  */
@@ -1,19 +1,23 @@
1
1
  import {
2
2
  calculatePortOffset,
3
+ computeDevIdentity,
3
4
  computePorts,
4
5
  computeUrls,
5
6
  findMonorepoRoot,
6
7
  getProjectName,
7
8
  getWorktreeName,
9
+ getWorktreeProjectSuffix,
8
10
  isWorktree
9
- } from "../index-08wa79cs.js";
11
+ } from "../index-fb29934k.js";
10
12
  import"../index-qnx9j3qa.js";
11
13
  export {
12
14
  isWorktree,
15
+ getWorktreeProjectSuffix,
13
16
  getWorktreeName,
14
17
  getProjectName,
15
18
  findMonorepoRoot,
16
19
  computeUrls,
17
20
  computePorts,
21
+ computeDevIdentity,
18
22
  calculatePortOffset
19
23
  };
@@ -12,7 +12,7 @@ import {
12
12
  startDevServers,
13
13
  stopAllProcesses,
14
14
  stopProcess
15
- } from "../index-1yvbwj4k.js";
15
+ } from "../index-mm412dkp.js";
16
16
  import"../index-qnx9j3qa.js";
17
17
  export {
18
18
  stopProcess,
@@ -0,0 +1,33 @@
1
+ import type { AppConfig, DevEnvironment, ServiceConfig } from "../types";
2
+ export interface PublicExposeTarget {
3
+ kind: "service" | "app";
4
+ name: string;
5
+ port: number;
6
+ }
7
+ export interface PublicTunnel {
8
+ kind: "service" | "app";
9
+ name: string;
10
+ localUrl: string;
11
+ publicUrl: string;
12
+ close: () => Promise<void>;
13
+ }
14
+ interface UntunTunnelLike {
15
+ url?: string;
16
+ publicUrl?: string;
17
+ tunnelUrl?: string;
18
+ close?: () => void | Promise<void>;
19
+ stop?: () => void | Promise<void>;
20
+ destroy?: () => void | Promise<void>;
21
+ }
22
+ export declare function resolveExposeTargets<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(env: DevEnvironment<TServices, TApps>, exposeValue?: string): {
23
+ targets: PublicExposeTarget[];
24
+ unknownNames: string[];
25
+ notEnabledNames: string[];
26
+ };
27
+ export declare function startPublicTunnels(targets: PublicExposeTarget[], options?: {
28
+ start?: (input: {
29
+ url: string;
30
+ }) => Promise<UntunTunnelLike>;
31
+ }): Promise<PublicTunnel[]>;
32
+ export declare function stopPublicTunnels(tunnels: PublicTunnel[]): Promise<void>;
33
+ export {};
@@ -5,8 +5,8 @@ import {
5
5
  logExpoApiUrl,
6
6
  logFrontendPort,
7
7
  sleep
8
- } from "../index-6fm7mvwj.js";
9
- import"../index-08wa79cs.js";
8
+ } from "../index-c0dr6mcv.js";
9
+ import"../index-fb29934k.js";
10
10
  import"../index-qnx9j3qa.js";
11
11
  export {
12
12
  sleep,
@@ -1,6 +1,7 @@
1
- // core/watchdog-runner.ts
1
+ // src/core/watchdog-runner.ts
2
2
  import { execSync } from "node:child_process";
3
3
  import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
4
+
4
5
  var PROJECT_NAME = process.env.WATCHDOG_PROJECT_NAME ?? "";
5
6
  var HEARTBEAT_FILE = process.env.WATCHDOG_HEARTBEAT_FILE ?? "";
6
7
  var PID_FILE = process.env.WATCHDOG_PID_FILE ?? "";
@@ -8,59 +9,61 @@ var IDLE_TIMEOUT = parseInt(process.env.WATCHDOG_TIMEOUT_MS ?? "600000", 10);
8
9
  var COMPOSE_ARG = process.env.WATCHDOG_COMPOSE_ARG ?? "";
9
10
  var CHECK_INTERVAL = 60000;
10
11
  if (!PROJECT_NAME || !HEARTBEAT_FILE || !PID_FILE) {
11
- console.error("[watchdog] Missing required environment variables");
12
- process.exit(1);
12
+ console.error("[watchdog] Missing required environment variables");
13
+ process.exit(1);
13
14
  }
14
15
  var heartbeatFile = HEARTBEAT_FILE;
15
16
  var pidFile = PID_FILE;
16
17
  writeFileSync(pidFile, process.pid.toString());
17
18
  function cleanup() {
18
- try {
19
- unlinkSync(pidFile);
20
- } catch {}
21
- try {
22
- unlinkSync(heartbeatFile);
23
- } catch {}
19
+ try {
20
+ unlinkSync(pidFile);
21
+ } catch {}
22
+ try {
23
+ unlinkSync(heartbeatFile);
24
+ } catch {}
24
25
  }
25
26
  process.on("SIGTERM", () => {
26
- cleanup();
27
- process.exit(0);
27
+ cleanup();
28
+ process.exit(0);
28
29
  });
29
30
  process.on("SIGINT", () => {
30
- cleanup();
31
- process.exit(0);
31
+ cleanup();
32
+ process.exit(0);
32
33
  });
33
34
  console.log(`[watchdog] Started for ${PROJECT_NAME} (PID: ${process.pid})`);
34
35
  console.log(`[watchdog] Idle timeout: ${IDLE_TIMEOUT / 60000} minutes`);
35
36
  async function watchdog() {
36
- while (true) {
37
- await new Promise((r) => setTimeout(r, CHECK_INTERVAL));
38
- if (!existsSync(heartbeatFile)) {
39
- continue;
40
- }
41
- let lastBeat;
42
- try {
43
- const content = readFileSync(heartbeatFile, "utf-8");
44
- lastBeat = parseInt(content, 10);
45
- } catch {
46
- continue;
47
- }
48
- if (Number.isNaN(lastBeat)) {
49
- continue;
50
- }
51
- const elapsed = Date.now() - lastBeat;
52
- if (elapsed > IDLE_TIMEOUT) {
53
- console.log(`[watchdog] No heartbeat for ${Math.ceil(elapsed / 60000)} minutes, shutting down...`);
54
- try {
55
- execSync(`docker compose ${COMPOSE_ARG} down`.trim(), {
56
- env: { ...process.env, COMPOSE_PROJECT_NAME: PROJECT_NAME },
57
- stdio: "ignore"
58
- });
59
- } catch {}
60
- console.log("[watchdog] Containers stopped");
61
- cleanup();
62
- process.exit(0);
63
- }
64
- }
37
+ while (true) {
38
+ await new Promise((r) => setTimeout(r, CHECK_INTERVAL));
39
+ if (!existsSync(heartbeatFile)) {
40
+ continue;
41
+ }
42
+ let lastBeat;
43
+ try {
44
+ const content = readFileSync(heartbeatFile, "utf-8");
45
+ lastBeat = parseInt(content, 10);
46
+ } catch {
47
+ continue;
48
+ }
49
+ if (Number.isNaN(lastBeat)) {
50
+ continue;
51
+ }
52
+ const elapsed = Date.now() - lastBeat;
53
+ if (elapsed > IDLE_TIMEOUT) {
54
+ console.log(
55
+ `[watchdog] No heartbeat for ${Math.ceil(elapsed / 60000)} minutes, shutting down...`,
56
+ );
57
+ try {
58
+ execSync(`docker compose ${COMPOSE_ARG} down`.trim(), {
59
+ env: { ...process.env, COMPOSE_PROJECT_NAME: PROJECT_NAME },
60
+ stdio: "ignore",
61
+ });
62
+ } catch {}
63
+ console.log("[watchdog] Containers stopped");
64
+ cleanup();
65
+ process.exit(0);
66
+ }
67
+ }
65
68
  }
66
69
  watchdog();
@@ -35,6 +35,7 @@ export declare function getWatchdogPid(projectName: string): number | null;
35
35
  * Spawn watchdog as a detached process.
36
36
  * The watchdog monitors the heartbeat file and shuts down containers after idle timeout.
37
37
  */
38
+ export declare function getWatchdogComposeArg(composeFile?: string): string;
38
39
  export declare function spawnWatchdog(projectName: string, root: string, options?: {
39
40
  timeoutMinutes?: number;
40
41
  verbose?: boolean;
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  getHeartbeatFile,
3
+ getWatchdogComposeArg,
3
4
  getWatchdogPid,
4
5
  getWatchdogPidFile,
5
6
  isWatchdogRunning,
@@ -9,8 +10,8 @@ import {
9
10
  startHeartbeat,
10
11
  stopHeartbeat,
11
12
  stopWatchdog
12
- } from "../index-ggq3yryx.js";
13
- import"../index-1yvbwj4k.js";
13
+ } from "../index-mam0bcyz.js";
14
+ import"../index-mm412dkp.js";
14
15
  import"../index-qnx9j3qa.js";
15
16
  export {
16
17
  stopWatchdog,
@@ -22,5 +23,6 @@ export {
22
23
  isWatchdogRunning,
23
24
  getWatchdogPidFile,
24
25
  getWatchdogPid,
26
+ getWatchdogComposeArg,
25
27
  getHeartbeatFile
26
28
  };
@@ -0,0 +1 @@
1
+ export * from "./runtime";
@@ -0,0 +1,38 @@
1
+ import"../index-bj79tw5w.js";
2
+ import {
3
+ DOCKER_NOT_RUNNING_MESSAGE,
4
+ MAX_ATTEMPTS,
5
+ POLL_INTERVAL,
6
+ areContainersRunning,
7
+ assertDockerRunning,
8
+ createBuiltInHealthCheck,
9
+ getComposeArg,
10
+ isContainerRunning,
11
+ isDockerRunning,
12
+ startContainers,
13
+ startService,
14
+ stopContainers,
15
+ waitForAllServices,
16
+ waitForService,
17
+ waitForServiceByType
18
+ } from "../index-d8tyv5se.js";
19
+ import"../index-c0dr6mcv.js";
20
+ import"../index-fb29934k.js";
21
+ import"../index-qnx9j3qa.js";
22
+ export {
23
+ waitForServiceByType,
24
+ waitForService,
25
+ waitForAllServices,
26
+ stopContainers,
27
+ startService,
28
+ startContainers,
29
+ isDockerRunning,
30
+ isContainerRunning,
31
+ getComposeArg,
32
+ createBuiltInHealthCheck,
33
+ assertDockerRunning,
34
+ areContainersRunning,
35
+ POLL_INTERVAL,
36
+ MAX_ATTEMPTS,
37
+ DOCKER_NOT_RUNNING_MESSAGE
38
+ };