buncargo 1.0.29 → 3.2.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 (246) hide show
  1. package/dist/bin.d.ts +1 -12
  2. package/dist/bin.js +261 -253
  3. package/dist/cli/bin.d.ts +13 -0
  4. package/dist/cli/bin.js +317 -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 +30 -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 -83
  22. package/dist/core/docker.js +35 -32
  23. package/dist/core/index.d.ts +1 -1
  24. package/dist/core/index.js +123 -118
  25. package/dist/core/network.js +2 -2
  26. package/dist/core/ports.js +1 -1
  27. package/dist/core/process.js +1 -1
  28. package/dist/core/quick-tunnel/cloudflared-process.d.ts +10 -0
  29. package/dist/core/quick-tunnel/constants.d.ts +9 -0
  30. package/dist/core/quick-tunnel/index.d.ts +17 -0
  31. package/dist/core/quick-tunnel/install.d.ts +1 -0
  32. package/dist/core/tunnel.d.ts +34 -0
  33. package/dist/core/utils.js +2 -2
  34. package/dist/core/watchdog-runner.js +45 -42
  35. package/dist/core/watchdog.d.ts +1 -0
  36. package/dist/core/watchdog.js +4 -2
  37. package/dist/docker/index.d.ts +1 -0
  38. package/dist/docker/index.js +38 -0
  39. package/dist/docker/runtime.d.ts +87 -0
  40. package/dist/docker/runtime.js +37 -0
  41. package/dist/docker-compose/compose.d.ts +1 -0
  42. package/dist/docker-compose/generated-file.d.ts +7 -0
  43. package/dist/docker-compose/index.d.ts +3 -0
  44. package/dist/docker-compose/index.js +15 -0
  45. package/dist/docker-compose/model.d.ts +6 -0
  46. package/dist/docker-compose/services/clickhouse.d.ts +16 -0
  47. package/dist/docker-compose/services/define-docker-service.d.ts +41 -0
  48. package/dist/docker-compose/services/index.d.ts +23 -0
  49. package/dist/docker-compose/services/index.js +17 -0
  50. package/dist/docker-compose/services/postgres.d.ts +12 -0
  51. package/dist/docker-compose/services/redis.d.ts +12 -0
  52. package/dist/docker-compose/services/shared.d.ts +7 -0
  53. package/dist/docker-compose/yaml.d.ts +2 -0
  54. package/dist/environment/create-dev-environment.d.ts +23 -0
  55. package/dist/environment/index.d.ts +1 -0
  56. package/dist/environment/index.js +15 -0
  57. package/dist/environment/logging.d.ts +17 -0
  58. package/dist/environment/only-apps.d.ts +10 -0
  59. package/dist/environment/seeding.d.ts +9 -0
  60. package/dist/environment.d.ts +1 -23
  61. package/dist/environment.js +12 -14
  62. package/dist/index-045jksh5.js +147 -0
  63. package/dist/index-08wa79cs.js +125 -117
  64. package/dist/index-0kxnae3z.js +335 -0
  65. package/dist/index-1mdrf7nz.js +51 -43
  66. package/dist/index-1yvbwj4k.js +262 -242
  67. package/dist/index-23ev345g.js +475 -0
  68. package/dist/index-2ckr49sf.js +228 -0
  69. package/dist/index-2f47khe5.js +376 -369
  70. package/dist/index-2fr3g85b.js +220 -183
  71. package/dist/index-38xnzpa6.js +450 -0
  72. package/dist/index-3eyrdxw9.js +577 -0
  73. package/dist/index-3h3dhtf2.js +51 -43
  74. package/dist/index-42x95209.js +51 -43
  75. package/dist/index-4gp0az1g.js +145 -0
  76. package/dist/index-4xrxh8yv.js +72 -0
  77. package/dist/index-5aq985p4.js +250 -0
  78. package/dist/index-5gmws6ah.js +181 -0
  79. package/dist/index-5hka0tff.js +78 -76
  80. package/dist/index-5rfqps4b.js +3 -0
  81. package/dist/index-5t9jxqm0.js +428 -0
  82. package/dist/index-6c1w1xk5.js +101 -0
  83. package/dist/index-6cmex7m5.js +72 -0
  84. package/dist/index-6d6x175r.js +572 -0
  85. package/dist/index-6fm7mvwj.js +118 -97
  86. package/dist/index-6srpc523.js +127 -128
  87. package/dist/index-731rzzfp.js +157 -142
  88. package/dist/index-75y4cg2z.js +51 -43
  89. package/dist/index-7ja4ywyj.js +126 -127
  90. package/dist/index-7v19es2e.js +666 -0
  91. package/dist/index-8bw1cmz4.js +531 -0
  92. package/dist/index-8hbbj1mp.js +120 -121
  93. package/dist/index-8xj2p5n5.js +118 -97
  94. package/dist/index-9wyhzw0h.js +574 -0
  95. package/dist/index-ag90ry8t.js +576 -0
  96. package/dist/index-bj79tw5w.js +0 -0
  97. package/dist/index-bnk6nr0g.js +73 -0
  98. package/dist/index-brbbzyks.js +72 -0
  99. package/dist/index-byeqyjrz.js +72 -0
  100. package/dist/index-c0dr6mcv.js +123 -0
  101. package/dist/index-cty0bcry.js +235 -218
  102. package/dist/index-d8tyv5se.js +228 -0
  103. package/dist/index-d9efy0n4.js +176 -150
  104. package/dist/index-enj4zdma.js +574 -0
  105. package/dist/index-etfmqjjf.js +427 -0
  106. package/dist/index-fb29934k.js +172 -0
  107. package/dist/index-g50jw1yf.js +72 -0
  108. package/dist/index-g6eb5wdw.js +118 -117
  109. package/dist/index-ggq3yryx.js +99 -95
  110. package/dist/index-h70tce00.js +177 -0
  111. package/dist/index-hkxtfqtc.js +333 -0
  112. package/dist/index-k370bech.js +72 -0
  113. package/dist/index-kf3dhser.js +146 -143
  114. package/dist/index-ma6tgdb2.js +500 -0
  115. package/dist/index-mam0bcyz.js +123 -0
  116. package/dist/index-mm412dkp.js +274 -0
  117. package/dist/index-n8v18aeb.js +0 -0
  118. package/dist/index-ndnmnsej.js +378 -371
  119. package/dist/index-p8wty0e2.js +389 -379
  120. package/dist/index-qa8akv6y.js +666 -0
  121. package/dist/index-qfphr2fd.js +78 -76
  122. package/dist/index-qqmms8rs.js +51 -43
  123. package/dist/index-qw4093g2.js +51 -43
  124. package/dist/index-qzwpzjbx.js +121 -122
  125. package/dist/index-segbnm0h.js +146 -143
  126. package/dist/index-t0fj6gg1.js +112 -0
  127. package/dist/index-thdkwnv7.js +122 -0
  128. package/dist/index-tjbx2r2t.js +270 -0
  129. package/dist/index-tjqw9vtj.js +62 -54
  130. package/dist/index-vbpb89jy.js +248 -0
  131. package/dist/index-vg55rq0y.js +250 -0
  132. package/dist/index-vhs88xhe.js +99 -95
  133. package/dist/index-vs81yaks.js +244 -0
  134. package/dist/index-w8zxnjka.js +249 -0
  135. package/dist/index-wk2na3t9.js +385 -375
  136. package/dist/index-wz9x8g7z.js +383 -373
  137. package/dist/index-x249gyde.js +388 -378
  138. package/dist/index-x54nbgs7.js +355 -0
  139. package/dist/index-xkvd0nsd.js +187 -0
  140. package/dist/index-yedqxm1z.js +80 -0
  141. package/dist/index-yz4jfz7z.js +338 -0
  142. package/dist/index-zfjzzjkf.js +240 -199
  143. package/dist/index.d.ts +12 -8
  144. package/dist/index.js +56 -34
  145. package/dist/lint.d.ts +1 -46
  146. package/dist/lint.js +3 -7
  147. package/dist/loader/cache.d.ts +4 -0
  148. package/dist/loader/find-config-file.d.ts +2 -0
  149. package/dist/loader/index.d.ts +5 -0
  150. package/dist/loader/index.js +24 -0
  151. package/dist/loader/load-dev-env.d.ts +5 -0
  152. package/dist/loader/loader.d.ts +1 -0
  153. package/dist/loader.d.ts +1 -45
  154. package/dist/loader.js +22 -20
  155. package/dist/prisma/index.d.ts +1 -0
  156. package/dist/prisma/prisma.d.ts +29 -0
  157. package/dist/prisma.d.ts +1 -29
  158. package/dist/prisma.js +6 -10
  159. package/dist/src/bin.js +309 -0
  160. package/dist/src/cli.js +5 -0
  161. package/dist/src/config.js +15 -0
  162. package/dist/src/core/docker.js +38 -0
  163. package/dist/src/core/index.js +130 -0
  164. package/dist/src/core/network.js +9 -0
  165. package/dist/src/core/ports.js +23 -0
  166. package/dist/src/core/process.js +31 -0
  167. package/dist/src/core/utils.js +11 -0
  168. package/dist/src/core/watchdog-runner.js +69 -0
  169. package/dist/src/core/watchdog.js +28 -0
  170. package/dist/src/docker/runtime.js +37 -0
  171. package/dist/src/docker-compose/index.js +16 -0
  172. package/dist/src/docker-compose/services/index.js +17 -0
  173. package/dist/src/environment.js +12 -0
  174. package/dist/src/index.js +122 -0
  175. package/dist/src/lint.js +3 -0
  176. package/dist/src/loader.js +25 -0
  177. package/dist/src/prisma.js +6 -0
  178. package/dist/src/types.js +0 -0
  179. package/dist/typecheck/index.d.ts +1 -0
  180. package/dist/typecheck/index.js +7 -0
  181. package/dist/typecheck/typecheck.d.ts +46 -0
  182. package/dist/types/all-types.d.ts +544 -0
  183. package/dist/types/cli.d.ts +1 -0
  184. package/dist/types/config.d.ts +6 -0
  185. package/dist/types/docker.d.ts +15 -0
  186. package/dist/types/environment.d.ts +8 -0
  187. package/dist/types/hooks.d.ts +9 -0
  188. package/dist/types/index.d.ts +1 -0
  189. package/dist/types/index.js +0 -0
  190. package/dist/types/prisma.d.ts +1 -0
  191. package/dist/types.d.ts +1 -399
  192. package/package.json +55 -48
  193. package/readme.md +365 -109
  194. package/src/cli/bin.ts +77 -0
  195. package/src/cli/commands/help.ts +39 -0
  196. package/src/cli/commands/runtime.ts +72 -0
  197. package/src/cli/commands/version.ts +4 -0
  198. package/src/cli/index.ts +1 -0
  199. package/{cli.ts → src/cli/run-cli.ts} +114 -10
  200. package/src/config/define-config.ts +30 -0
  201. package/src/config/index.ts +3 -0
  202. package/src/config/merge-configs.ts +33 -0
  203. package/src/config/validate-config.ts +136 -0
  204. package/{core → src/core}/index.ts +2 -2
  205. package/{core → src/core}/ports.ts +5 -2
  206. package/{core → src/core}/process.ts +6 -2
  207. package/src/core/quick-tunnel/cloudflared-process.ts +83 -0
  208. package/src/core/quick-tunnel/constants.ts +31 -0
  209. package/src/core/quick-tunnel/index.ts +96 -0
  210. package/src/core/quick-tunnel/install.ts +160 -0
  211. package/src/core/tunnel.ts +165 -0
  212. package/{core → src/core}/utils.ts +1 -0
  213. package/{core → src/core}/watchdog.ts +5 -1
  214. package/src/docker/index.ts +1 -0
  215. package/{core/docker.ts → src/docker/runtime.ts} +11 -4
  216. package/src/docker-compose/generated-file.ts +45 -0
  217. package/src/docker-compose/index.ts +7 -0
  218. package/src/docker-compose/model.ts +197 -0
  219. package/src/docker-compose/services/clickhouse.ts +79 -0
  220. package/src/docker-compose/services/define-docker-service.ts +109 -0
  221. package/src/docker-compose/services/index.ts +67 -0
  222. package/src/docker-compose/services/postgres.ts +60 -0
  223. package/src/docker-compose/services/redis.ts +48 -0
  224. package/src/docker-compose/services/shared.ts +79 -0
  225. package/src/docker-compose/yaml.ts +88 -0
  226. package/{environment.ts → src/environment/create-dev-environment.ts} +214 -141
  227. package/src/environment/index.ts +1 -0
  228. package/src/environment/logging.ts +115 -0
  229. package/src/environment/only-apps.ts +34 -0
  230. package/src/environment/seeding.ts +57 -0
  231. package/{index.ts → src/index.ts} +52 -20
  232. package/src/loader/cache.ts +23 -0
  233. package/src/loader/find-config-file.ts +29 -0
  234. package/src/loader/index.ts +17 -0
  235. package/src/loader/load-dev-env.ts +38 -0
  236. package/src/prisma/index.ts +1 -0
  237. package/{prisma.ts → src/prisma/prisma.ts} +4 -2
  238. package/src/typecheck/index.ts +1 -0
  239. package/{types.ts → src/types/all-types.ts} +186 -8
  240. package/src/types/index.ts +1 -0
  241. package/bin.ts +0 -192
  242. package/config.ts +0 -194
  243. package/loader.ts +0 -126
  244. /package/{core → src/core}/network.ts +0 -0
  245. /package/{core → src/core}/watchdog-runner.ts +0 -0
  246. /package/{lint.ts → src/typecheck/typecheck.ts} +0 -0
@@ -0,0 +1,317 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ runCli
4
+ } from "../index-5aq985p4.js";
5
+ import {
6
+ loadDevEnv
7
+ } from "../index-byeqyjrz.js";
8
+ import"../index-7v19es2e.js";
9
+ import"../index-d8tyv5se.js";
10
+ import"../index-c0dr6mcv.js";
11
+ import"../index-fb29934k.js";
12
+ import"../index-5t9jxqm0.js";
13
+ import"../index-x54nbgs7.js";
14
+ import"../index-mam0bcyz.js";
15
+ import"../index-mm412dkp.js";
16
+ import"../index-t0fj6gg1.js";
17
+ import {
18
+ __commonJS,
19
+ __require
20
+ } from "../index-qnx9j3qa.js";
21
+
22
+ // package.json
23
+ var require_package = __commonJS((exports, module) => {
24
+ module.exports = {
25
+ name: "buncargo",
26
+ version: "3.2.0",
27
+ description: "A Bun-powered development environment CLI for managing Docker Compose services, dev servers, and environment variables",
28
+ type: "module",
29
+ module: "./dist/index.js",
30
+ main: "./dist/index.js",
31
+ types: "./dist/index.d.ts",
32
+ license: "MIT",
33
+ repository: {
34
+ type: "git",
35
+ url: "git+https://github.com/HansKristoffer/buncargo.git"
36
+ },
37
+ author: "Kristoffer Hansen",
38
+ keywords: [
39
+ "bun",
40
+ "dev-tools",
41
+ "docker",
42
+ "docker-compose",
43
+ "development",
44
+ "cli",
45
+ "monorepo",
46
+ "dev-server",
47
+ "environment"
48
+ ],
49
+ engines: {
50
+ bun: ">=1.0.0"
51
+ },
52
+ files: [
53
+ "src/**/*.ts",
54
+ "dist",
55
+ "!src/**/*.test.ts"
56
+ ],
57
+ bin: {
58
+ "dev-tools": "./dist/cli/bin.js",
59
+ buncargo: "./dist/cli/bin.js"
60
+ },
61
+ exports: {
62
+ ".": {
63
+ types: "./dist/index.d.ts",
64
+ bun: "./src/index.ts",
65
+ import: "./dist/index.js",
66
+ default: "./dist/index.js"
67
+ },
68
+ "./types": {
69
+ types: "./dist/types/index.d.ts",
70
+ bun: "./src/types/index.ts",
71
+ import: "./dist/types/index.js",
72
+ default: "./dist/types/index.js"
73
+ },
74
+ "./config": {
75
+ types: "./dist/config/index.d.ts",
76
+ bun: "./src/config/index.ts",
77
+ import: "./dist/config/index.js",
78
+ default: "./dist/config/index.js"
79
+ },
80
+ "./environment": {
81
+ types: "./dist/environment/index.d.ts",
82
+ bun: "./src/environment/index.ts",
83
+ import: "./dist/environment/index.js",
84
+ default: "./dist/environment/index.js"
85
+ },
86
+ "./core/ports": {
87
+ types: "./dist/core/ports.d.ts",
88
+ bun: "./src/core/ports.ts",
89
+ import: "./dist/core/ports.js",
90
+ default: "./dist/core/ports.js"
91
+ },
92
+ "./core/network": {
93
+ types: "./dist/core/network.d.ts",
94
+ bun: "./src/core/network.ts",
95
+ import: "./dist/core/network.js",
96
+ default: "./dist/core/network.js"
97
+ },
98
+ "./core/process": {
99
+ types: "./dist/core/process.d.ts",
100
+ bun: "./src/core/process.ts",
101
+ import: "./dist/core/process.js",
102
+ default: "./dist/core/process.js"
103
+ },
104
+ "./core/watchdog": {
105
+ types: "./dist/core/watchdog.d.ts",
106
+ bun: "./src/core/watchdog.ts",
107
+ import: "./dist/core/watchdog.js",
108
+ default: "./dist/core/watchdog.js"
109
+ },
110
+ "./core/utils": {
111
+ types: "./dist/core/utils.d.ts",
112
+ bun: "./src/core/utils.ts",
113
+ import: "./dist/core/utils.js",
114
+ default: "./dist/core/utils.js"
115
+ },
116
+ "./cli": {
117
+ types: "./dist/cli/index.d.ts",
118
+ bun: "./src/cli/index.ts",
119
+ import: "./dist/cli/index.js",
120
+ default: "./dist/cli/index.js"
121
+ },
122
+ "./typecheck": {
123
+ types: "./dist/typecheck/index.d.ts",
124
+ bun: "./src/typecheck/index.ts",
125
+ import: "./dist/typecheck/index.js",
126
+ default: "./dist/typecheck/index.js"
127
+ },
128
+ "./loader": {
129
+ types: "./dist/loader/index.d.ts",
130
+ bun: "./src/loader/index.ts",
131
+ import: "./dist/loader/index.js",
132
+ default: "./dist/loader/index.js"
133
+ },
134
+ "./docker": {
135
+ types: "./dist/docker/index.d.ts",
136
+ bun: "./src/docker/index.ts",
137
+ import: "./dist/docker/index.js",
138
+ default: "./dist/docker/index.js"
139
+ },
140
+ "./docker-compose": {
141
+ types: "./dist/docker-compose/index.d.ts",
142
+ bun: "./src/docker-compose/index.ts",
143
+ import: "./dist/docker-compose/index.js",
144
+ default: "./dist/docker-compose/index.js"
145
+ }
146
+ },
147
+ scripts: {
148
+ build: "bun run build:js && bun run build:types",
149
+ "build:js": "bun build ./src/index.ts ./src/cli/bin.ts ./src/cli/index.ts ./src/config/index.ts ./src/environment/index.ts ./src/loader/index.ts ./src/typecheck/index.ts ./src/types/index.ts ./src/core/network.ts ./src/core/ports.ts ./src/core/process.ts ./src/core/utils.ts ./src/core/watchdog.ts ./src/docker/index.ts ./src/docker-compose/index.ts --outdir ./dist --root ./src --target node --packages external --splitting",
150
+ "build:types": "tsc -p tsconfig.build.json",
151
+ prepublishOnly: "bun run build",
152
+ "publish:patch": "npm version patch && npm publish",
153
+ "publish:minor": "npm version minor && npm publish",
154
+ "publish:major": "npm version major && npm publish",
155
+ lint: "bun run typecheck && biome check src example",
156
+ "lint:write": "bun run typecheck && biome check --fix src example && biome format src example",
157
+ typecheck: "tsgo --incremental",
158
+ test: "bun test",
159
+ "test:integration-cloudflared": "bun test src/core/quick-tunnel/quick-tunnel.test.ts",
160
+ "test:integration-cloudflared-e2e": "BUNCARGO_TEST_CLOUDFLARED_E2E=1 bun test src/core/quick-tunnel/quick-tunnel.test.ts"
161
+ },
162
+ devDependencies: {
163
+ "@types/bun": "1.3.2",
164
+ "@biomejs/biome": "2.3.4",
165
+ "@typescript/native-preview": "7.0.0-dev.20260127.1",
166
+ typescript: "^5.7.0"
167
+ },
168
+ dependencies: {
169
+ "fast-glob": "^3.3.3",
170
+ picocolors: "^1.1.1"
171
+ }
172
+ };
173
+ });
174
+
175
+ // src/cli/commands/help.ts
176
+ function showHelp() {
177
+ console.log(`
178
+ buncargo - Development environment CLI
179
+
180
+ USAGE:
181
+ bunx buncargo <command> [options]
182
+
183
+ COMMANDS:
184
+ dev Start the development environment
185
+ typecheck Run TypeScript typecheck across workspaces
186
+ prisma <args> Run Prisma CLI with correct DATABASE_URL
187
+ env Print environment info as JSON
188
+ help Show this help message
189
+ version Show version
190
+
191
+ EXAMPLES:
192
+ bunx buncargo dev # Start everything
193
+ bunx buncargo dev --expose # Public quick tunnel for expose:true targets
194
+ bunx buncargo dev --expose=api # Public quick tunnel for selected target
195
+ bunx buncargo dev --help # Show dev command options
196
+ bunx buncargo dev --down # Stop containers
197
+ bunx buncargo typecheck # Run typecheck
198
+ bunx buncargo prisma studio # Open Prisma Studio
199
+ bunx buncargo env # Get ports/urls as JSON
200
+
201
+ CONFIG:
202
+ Create a dev.config.ts with a default export:
203
+
204
+ import { defineDevConfig } from 'buncargo'
205
+
206
+ export default defineDevConfig({
207
+ projectPrefix: 'myapp',
208
+ services: { ... },
209
+ apps: { ... }
210
+ })
211
+
212
+ Run "bunx buncargo dev --help" for dev command options.
213
+ `);
214
+ }
215
+
216
+ // src/cli/commands/runtime.ts
217
+ async function loadEnv() {
218
+ try {
219
+ return await loadDevEnv();
220
+ } catch (error) {
221
+ console.error(`❌ ${error instanceof Error ? error.message : error}`);
222
+ process.exit(1);
223
+ }
224
+ }
225
+ async function handleDev(args) {
226
+ const env = await loadEnv();
227
+ await runCli(env, { args });
228
+ }
229
+ async function handlePrisma(args) {
230
+ const env = await loadEnv();
231
+ if (!env.prisma) {
232
+ console.error("❌ Prisma is not configured in your dev config.");
233
+ console.error("");
234
+ console.error(" Add prisma to your config:");
235
+ console.error("");
236
+ console.error(" export default defineDevConfig({");
237
+ console.error(" ...");
238
+ console.error(" prisma: {");
239
+ console.error(" cwd: 'packages/prisma'");
240
+ console.error(" }");
241
+ console.error(" })");
242
+ process.exit(1);
243
+ }
244
+ const running = await env.isRunning();
245
+ if (!running) {
246
+ console.log("\uD83D\uDC33 Starting database container...");
247
+ await env.start({ startServers: false, wait: true });
248
+ }
249
+ const exitCode = await env.prisma.run(args);
250
+ process.exit(exitCode);
251
+ }
252
+ async function handleEnv() {
253
+ const env = await loadEnv();
254
+ console.log(JSON.stringify({
255
+ projectName: env.projectName,
256
+ ports: env.ports,
257
+ urls: env.urls,
258
+ portOffset: env.portOffset,
259
+ isWorktree: env.isWorktree,
260
+ localIp: env.localIp,
261
+ root: env.root
262
+ }, null, 2));
263
+ }
264
+ async function handleTypecheck() {
265
+ const env = await loadEnv();
266
+ const { runWorkspaceTypecheck } = await import("../typecheck/index.js");
267
+ const result = await runWorkspaceTypecheck({
268
+ root: env.root,
269
+ verbose: true
270
+ });
271
+ process.exit(result.success ? 0 : 1);
272
+ }
273
+
274
+ // src/cli/commands/version.ts
275
+ function showVersion() {
276
+ const pkg = require_package();
277
+ console.log(`buncargo v${pkg.version}`);
278
+ }
279
+
280
+ // src/cli/bin.ts
281
+ async function main() {
282
+ const args = process.argv.slice(2);
283
+ const command = args[0];
284
+ const commandArgs = args.slice(1);
285
+ if (!command || command === "help" || command === "--help" || command === "-h") {
286
+ showHelp();
287
+ process.exit(0);
288
+ }
289
+ if (command === "version" || command === "--version" || command === "-v") {
290
+ showVersion();
291
+ process.exit(0);
292
+ }
293
+ switch (command) {
294
+ case "dev":
295
+ await handleDev(commandArgs);
296
+ break;
297
+ case "typecheck":
298
+ await handleTypecheck();
299
+ break;
300
+ case "prisma":
301
+ await handlePrisma(commandArgs);
302
+ break;
303
+ case "env":
304
+ await handleEnv();
305
+ break;
306
+ default:
307
+ console.error(`❌ Unknown command: ${command}`);
308
+ console.error("");
309
+ console.error(' Run "bunx buncargo help" for available commands.');
310
+ process.exit(1);
311
+ }
312
+ }
313
+ main().catch((error) => {
314
+ const message = error instanceof Error ? error.message : String(error);
315
+ console.error(`❌ ${message}`);
316
+ process.exit(1);
317
+ });
@@ -0,0 +1 @@
1
+ export declare function showHelp(): void;
@@ -0,0 +1,5 @@
1
+ export declare function loadEnv(): Promise<import("../..").DevEnvironment<Record<string, import("../..").ServiceConfig>, Record<string, import("../..").AppConfig>>>;
2
+ export declare function handleDev(args: string[]): Promise<void>;
3
+ export declare function handlePrisma(args: string[]): Promise<void>;
4
+ export declare function handleEnv(): Promise<void>;
5
+ export declare function handleTypecheck(): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function showVersion(): void;
@@ -0,0 +1 @@
1
+ export * from "./run-cli";
@@ -0,0 +1,14 @@
1
+ import {
2
+ getFlagValue,
3
+ hasFlag,
4
+ runCli
5
+ } from "../index-5aq985p4.js";
6
+ import"../index-x54nbgs7.js";
7
+ import"../index-mam0bcyz.js";
8
+ import"../index-mm412dkp.js";
9
+ import"../index-qnx9j3qa.js";
10
+ export {
11
+ runCli,
12
+ hasFlag,
13
+ getFlagValue
14
+ };
@@ -0,0 +1,30 @@
1
+ import { resolveExposeTargets, startPublicTunnels, stopPublicTunnels } from "../core/tunnel";
2
+ import type { AppConfig, CliOptions, DevEnvironment, ServiceConfig } from "../types";
3
+ /**
4
+ * Run the CLI for a dev environment.
5
+ * Handles common flags like --down, --reset, --up-only, --migrate, --seed.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { dev } from './dev.config'
10
+ * import { runCli } from 'buncargo'
11
+ *
12
+ * await runCli(dev)
13
+ * ```
14
+ */
15
+ export declare function runCli<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(env: DevEnvironment<TServices, TApps>, options?: CliOptions & {
16
+ /** Substitute tunnel helpers (used by CLI integration tests). */
17
+ cliTestTunnel?: {
18
+ resolveExposeTargets: typeof resolveExposeTargets;
19
+ startPublicTunnels: typeof startPublicTunnels;
20
+ stopPublicTunnels: typeof stopPublicTunnels;
21
+ };
22
+ }): Promise<void>;
23
+ /**
24
+ * Check if a CLI flag is present (including `--flag=value` form).
25
+ */
26
+ export declare function hasFlag(args: string[], flag: string): boolean;
27
+ /**
28
+ * Get a flag value (e.g., --timeout=10 or --timeout 10).
29
+ */
30
+ export declare function getFlagValue(args: string[], flag: string): string | undefined;
package/dist/cli.d.ts CHANGED
@@ -1,22 +1 @@
1
- import type { AppConfig, CliOptions, DevEnvironment, ServiceConfig } from "./types";
2
- /**
3
- * Run the CLI for a dev environment.
4
- * Handles common flags like --down, --reset, --up-only, --migrate, --seed.
5
- *
6
- * @example
7
- * ```typescript
8
- * import { dev } from './dev.config'
9
- * import { runCli } from 'buncargo'
10
- *
11
- * await runCli(dev)
12
- * ```
13
- */
14
- export declare function runCli<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(env: DevEnvironment<TServices, TApps>, options?: CliOptions): Promise<void>;
15
- /**
16
- * Check if a CLI flag is present.
17
- */
18
- export declare function hasFlag(args: string[], flag: string): boolean;
19
- /**
20
- * Get a flag value (e.g., --timeout=10 or --timeout 10).
21
- */
22
- export declare function getFlagValue(args: string[], flag: string): string | undefined;
1
+ export * from "./cli/run-cli";
package/dist/cli.js CHANGED
@@ -1,13 +1,5 @@
1
- import {
2
- getFlagValue,
3
- hasFlag,
4
- runCli
5
- } from "./index-segbnm0h.js";
6
- import"./index-ggq3yryx.js";
7
- import"./index-1yvbwj4k.js";
8
- import"./index-qnx9j3qa.js";
9
- export {
10
- runCli,
11
- hasFlag,
12
- getFlagValue
13
- };
1
+ import { getFlagValue, hasFlag, runCli } from "./index-5gmws6ah.js";
2
+ import "./index-mam0bcyz.js";
3
+ import "./index-mm412dkp.js";
4
+ import "./index-qnx9j3qa.js";
5
+ export { runCli, hasFlag, getFlagValue };
@@ -0,0 +1 @@
1
+ export * from "./index";
@@ -0,0 +1,13 @@
1
+ import type { AppConfig, DevConfig, DevHooks, DevOptions, DockerComposeGenerationOptions, EnvVarsBuilder, MigrationConfig, PrismaConfig, SeedConfig, ServiceConfig } from "../types";
2
+ export declare function defineDevConfig<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig> = Record<string, never>>(config: {
3
+ projectPrefix: string;
4
+ services: TServices;
5
+ apps?: TApps;
6
+ envVars?: EnvVarsBuilder<TServices, TApps>;
7
+ hooks?: DevHooks<TServices, TApps>;
8
+ migrations?: MigrationConfig[];
9
+ seed?: SeedConfig<TServices, TApps>;
10
+ prisma?: PrismaConfig;
11
+ options?: DevOptions;
12
+ docker?: DockerComposeGenerationOptions;
13
+ }): DevConfig<TServices, TApps>;
@@ -0,0 +1,3 @@
1
+ export { defineDevConfig } from "./define-config";
2
+ export { definePartialConfig, mergeConfigs } from "./merge-configs";
3
+ export { assertValidConfig, validateConfig } from "./validate-config";
@@ -0,0 +1,15 @@
1
+ import {
2
+ assertValidConfig,
3
+ defineDevConfig,
4
+ definePartialConfig,
5
+ mergeConfigs,
6
+ validateConfig
7
+ } from "../index-t0fj6gg1.js";
8
+ import"../index-qnx9j3qa.js";
9
+ export {
10
+ validateConfig,
11
+ mergeConfigs,
12
+ definePartialConfig,
13
+ defineDevConfig,
14
+ assertValidConfig
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { AppConfig, DevConfig, ServiceConfig } from "../types";
2
+ export declare function mergeConfigs<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(base: DevConfig<TServices, TApps>, overrides: Partial<DevConfig<TServices, TApps>>): DevConfig<TServices, TApps>;
3
+ export declare function definePartialConfig<TServices extends Record<string, ServiceConfig> = Record<string, ServiceConfig>, TApps extends Record<string, AppConfig> = Record<string, AppConfig>>(config: Partial<DevConfig<TServices, TApps>>): Partial<DevConfig<TServices, TApps>>;
@@ -0,0 +1,3 @@
1
+ import type { AppConfig, DevConfig, ServiceConfig } from "../types";
2
+ export declare function validateConfig<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(config: DevConfig<TServices, TApps>): string[];
3
+ export declare function assertValidConfig<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(config: DevConfig<TServices, TApps>): void;
package/dist/config.d.ts CHANGED
@@ -1,72 +1 @@
1
- import type { AppConfig, DevConfig, DevHooks, DevOptions, EnvVarsBuilder, MigrationConfig, PrismaConfig, SeedConfig, ServiceConfig } from "./types";
2
- /**
3
- * Define a dev environment configuration with full TypeScript inference.
4
- *
5
- * @example
6
- * ```typescript
7
- * const config = defineDevConfig({
8
- * projectPrefix: 'myapp',
9
- * services: {
10
- * postgres: { port: 5432, healthCheck: 'pg_isready' },
11
- * redis: { port: 6379 },
12
- * },
13
- * apps: {
14
- * api: { port: 3000, devCommand: 'bun run dev', cwd: 'apps/backend' },
15
- * web: { port: 5173, devCommand: 'bun run dev', cwd: 'apps/frontend' },
16
- * },
17
- * envVars: (ports, urls) => ({
18
- * DATABASE_URL: urls.postgres,
19
- * REDIS_URL: urls.redis,
20
- * API_PORT: String(ports.api),
21
- * }),
22
- * })
23
- * ```
24
- */
25
- export declare function defineDevConfig<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig> = Record<string, never>>(config: {
26
- /** Prefix for Docker project name (e.g., 'myapp' -> 'myapp-main') */
27
- projectPrefix: string;
28
- /** Docker Compose services to manage */
29
- services: TServices;
30
- /** Applications to start (optional) */
31
- apps?: TApps;
32
- /**
33
- * Environment variables builder. Define all env vars here.
34
- *
35
- * @example
36
- * ```typescript
37
- * envVars: (ports, urls, { localIp }) => ({
38
- * DATABASE_URL: urls.postgres,
39
- * BASE_URL: urls.api,
40
- * VITE_PORT: ports.platform,
41
- * EXPO_API_URL: `http://${localIp}:${ports.api}`
42
- * })
43
- * ```
44
- */
45
- envVars?: EnvVarsBuilder<TServices, TApps>;
46
- /** Lifecycle hooks (optional) */
47
- hooks?: DevHooks<TServices, TApps>;
48
- /** Migrations to run after containers are ready (optional). Runs in parallel. */
49
- migrations?: MigrationConfig[];
50
- /** Seed configuration (optional). Runs after migrations, before servers. */
51
- seed?: SeedConfig<TServices, TApps>;
52
- /** Prisma configuration (optional). When set, dev.prisma is available. */
53
- prisma?: PrismaConfig;
54
- /** Additional options (optional) */
55
- options?: DevOptions;
56
- }): DevConfig<TServices, TApps>;
57
- /**
58
- * Validate a dev config and return any errors.
59
- */
60
- export declare function validateConfig<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(config: DevConfig<TServices, TApps>): string[];
61
- /**
62
- * Validate config and throw if invalid.
63
- */
64
- export declare function assertValidConfig<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(config: DevConfig<TServices, TApps>): void;
65
- /**
66
- * Merge two configs, with the second taking precedence.
67
- */
68
- export declare function mergeConfigs<TServices extends Record<string, ServiceConfig>, TApps extends Record<string, AppConfig>>(base: DevConfig<TServices, TApps>, overrides: Partial<DevConfig<TServices, TApps>>): DevConfig<TServices, TApps>;
69
- /**
70
- * Create a partial config that can be merged later.
71
- */
72
- export declare function definePartialConfig<TServices extends Record<string, ServiceConfig> = Record<string, ServiceConfig>, TApps extends Record<string, AppConfig> = Record<string, AppConfig>>(config: Partial<DevConfig<TServices, TApps>>): Partial<DevConfig<TServices, TApps>>;
1
+ export * from "./config/index";
package/dist/config.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
- assertValidConfig,
3
- defineDevConfig,
4
- definePartialConfig,
5
- mergeConfigs,
6
- validateConfig
7
- } from "./index-tjqw9vtj.js";
8
- import"./index-qnx9j3qa.js";
2
+ assertValidConfig,
3
+ defineDevConfig,
4
+ definePartialConfig,
5
+ mergeConfigs,
6
+ validateConfig,
7
+ } from "./index-045jksh5.js";
8
+ import "./index-qnx9j3qa.js";
9
9
  export {
10
- validateConfig,
11
- mergeConfigs,
12
- definePartialConfig,
13
- defineDevConfig,
14
- assertValidConfig
10
+ validateConfig,
11
+ mergeConfigs,
12
+ definePartialConfig,
13
+ defineDevConfig,
14
+ assertValidConfig,
15
15
  };
@@ -1,83 +1 @@
1
- import type { BuiltInHealthCheck, HealthCheckFn, ServiceConfig } from "../types";
2
- export declare const POLL_INTERVAL = 250;
3
- export declare const MAX_ATTEMPTS = 120;
4
- export declare const DOCKER_NOT_RUNNING_MESSAGE = "Docker is not running. Please start Docker and try again.";
5
- /**
6
- * Check if a specific container service is running using docker ps.
7
- */
8
- export declare function isContainerRunning(project: string, service: string): Promise<boolean>;
9
- /**
10
- * Check if Docker daemon is running and reachable.
11
- */
12
- export declare function isDockerRunning(): boolean;
13
- /**
14
- * Ensure Docker is running before attempting compose operations.
15
- */
16
- export declare function assertDockerRunning(): void;
17
- /**
18
- * Check if all expected containers are running.
19
- */
20
- export declare function areContainersRunning(project: string, minCount?: number): Promise<boolean>;
21
- export interface StartContainersOptions {
22
- verbose?: boolean;
23
- wait?: boolean;
24
- composeFile?: string;
25
- }
26
- /**
27
- * Start Docker Compose containers.
28
- */
29
- export declare function startContainers(root: string, projectName: string, envVars: Record<string, string>, options?: StartContainersOptions): void;
30
- export interface StopContainersOptions {
31
- verbose?: boolean;
32
- removeVolumes?: boolean;
33
- composeFile?: string;
34
- }
35
- /**
36
- * Stop Docker Compose containers.
37
- */
38
- export declare function stopContainers(root: string, projectName: string, options?: StopContainersOptions): void;
39
- /**
40
- * Start a specific service only.
41
- */
42
- export declare function startService(root: string, projectName: string, serviceName: string, envVars: Record<string, string>, options?: {
43
- verbose?: boolean;
44
- composeFile?: string;
45
- }): void;
46
- export interface HealthCheckContext {
47
- projectName?: string;
48
- root?: string;
49
- }
50
- /**
51
- * Create a health check function from a built-in type.
52
- */
53
- export declare function createBuiltInHealthCheck(type: BuiltInHealthCheck, serviceName: string, context?: HealthCheckContext): HealthCheckFn;
54
- /**
55
- * Wait for a service to be healthy.
56
- */
57
- export declare function waitForService(serviceName: string, config: ServiceConfig, port: number, options?: {
58
- maxAttempts?: number;
59
- pollInterval?: number;
60
- projectName?: string;
61
- root?: string;
62
- }): Promise<void>;
63
- /**
64
- * Wait for all services to be healthy.
65
- */
66
- export declare function waitForAllServices(services: Record<string, ServiceConfig>, ports: Record<string, number>, options?: {
67
- maxAttempts?: number;
68
- pollInterval?: number;
69
- verbose?: boolean;
70
- projectName?: string;
71
- root?: string;
72
- }): Promise<void>;
73
- /**
74
- * Wait for a service to be healthy using a built-in health check type.
75
- * Simpler API when you don't have a ServiceConfig object.
76
- */
77
- export declare function waitForServiceByType(serviceName: string, healthCheckType: BuiltInHealthCheck, port: number, options?: {
78
- maxAttempts?: number;
79
- pollInterval?: number;
80
- verbose?: boolean;
81
- projectName?: string;
82
- root?: string;
83
- }): Promise<void>;
1
+ export * from "../docker/runtime";