@inluxc/propmaster 0.0.0-stage → 1.0.1

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 (444) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +696 -2
  3. package/dist/src/annotations/index.d.ts +11 -0
  4. package/dist/src/annotations/index.d.ts.map +1 -0
  5. package/dist/src/annotations/index.js +11 -0
  6. package/dist/src/annotations/index.js.map +1 -0
  7. package/dist/src/annotations/recorder.d.ts +57 -0
  8. package/dist/src/annotations/recorder.d.ts.map +1 -0
  9. package/dist/src/annotations/recorder.js +100 -0
  10. package/dist/src/annotations/recorder.js.map +1 -0
  11. package/dist/src/annotations/truncation.d.ts +34 -0
  12. package/dist/src/annotations/truncation.d.ts.map +1 -0
  13. package/dist/src/annotations/truncation.js +54 -0
  14. package/dist/src/annotations/truncation.js.map +1 -0
  15. package/dist/src/auth/apply.d.ts +15 -0
  16. package/dist/src/auth/apply.d.ts.map +1 -0
  17. package/dist/src/auth/apply.js +21 -0
  18. package/dist/src/auth/apply.js.map +1 -0
  19. package/dist/src/auth/setup.d.ts +56 -0
  20. package/dist/src/auth/setup.d.ts.map +1 -0
  21. package/dist/src/auth/setup.js +79 -0
  22. package/dist/src/auth/setup.js.map +1 -0
  23. package/dist/src/auth/state-file.d.ts +8 -0
  24. package/dist/src/auth/state-file.d.ts.map +1 -0
  25. package/dist/src/auth/state-file.js +13 -0
  26. package/dist/src/auth/state-file.js.map +1 -0
  27. package/dist/src/auth/token-manager.d.ts +61 -0
  28. package/dist/src/auth/token-manager.d.ts.map +1 -0
  29. package/dist/src/auth/token-manager.js +200 -0
  30. package/dist/src/auth/token-manager.js.map +1 -0
  31. package/dist/src/cli/banner.d.ts +23 -0
  32. package/dist/src/cli/banner.d.ts.map +1 -0
  33. package/dist/src/cli/banner.js +67 -0
  34. package/dist/src/cli/banner.js.map +1 -0
  35. package/dist/src/cli/check-tests.d.ts +143 -0
  36. package/dist/src/cli/check-tests.d.ts.map +1 -0
  37. package/dist/src/cli/check-tests.js +541 -0
  38. package/dist/src/cli/check-tests.js.map +1 -0
  39. package/dist/src/cli/coverage.d.ts +14 -0
  40. package/dist/src/cli/coverage.d.ts.map +1 -0
  41. package/dist/src/cli/coverage.js +97 -0
  42. package/dist/src/cli/coverage.js.map +1 -0
  43. package/dist/src/cli/doctor.d.ts +82 -0
  44. package/dist/src/cli/doctor.d.ts.map +1 -0
  45. package/dist/src/cli/doctor.js +656 -0
  46. package/dist/src/cli/doctor.js.map +1 -0
  47. package/dist/src/cli/env.d.ts +76 -0
  48. package/dist/src/cli/env.d.ts.map +1 -0
  49. package/dist/src/cli/env.js +344 -0
  50. package/dist/src/cli/env.js.map +1 -0
  51. package/dist/src/cli/failures.d.ts +29 -0
  52. package/dist/src/cli/failures.d.ts.map +1 -0
  53. package/dist/src/cli/failures.js +114 -0
  54. package/dist/src/cli/failures.js.map +1 -0
  55. package/dist/src/cli/fixture-catalog.d.ts +83 -0
  56. package/dist/src/cli/fixture-catalog.d.ts.map +1 -0
  57. package/dist/src/cli/fixture-catalog.js +773 -0
  58. package/dist/src/cli/fixture-catalog.js.map +1 -0
  59. package/dist/src/cli/fixture.d.ts +149 -0
  60. package/dist/src/cli/fixture.d.ts.map +1 -0
  61. package/dist/src/cli/fixture.js +742 -0
  62. package/dist/src/cli/fixture.js.map +1 -0
  63. package/dist/src/cli/flaky.d.ts +25 -0
  64. package/dist/src/cli/flaky.d.ts.map +1 -0
  65. package/dist/src/cli/flaky.js +96 -0
  66. package/dist/src/cli/flaky.js.map +1 -0
  67. package/dist/src/cli/generate.d.ts +37 -0
  68. package/dist/src/cli/generate.d.ts.map +1 -0
  69. package/dist/src/cli/generate.js +230 -0
  70. package/dist/src/cli/generate.js.map +1 -0
  71. package/dist/src/cli/init.d.ts +36 -0
  72. package/dist/src/cli/init.d.ts.map +1 -0
  73. package/dist/src/cli/init.js +1039 -0
  74. package/dist/src/cli/init.js.map +1 -0
  75. package/dist/src/cli/json-edit.d.ts +58 -0
  76. package/dist/src/cli/json-edit.d.ts.map +1 -0
  77. package/dist/src/cli/json-edit.js +250 -0
  78. package/dist/src/cli/json-edit.js.map +1 -0
  79. package/dist/src/cli/layout.d.ts +31 -0
  80. package/dist/src/cli/layout.d.ts.map +1 -0
  81. package/dist/src/cli/layout.js +175 -0
  82. package/dist/src/cli/layout.js.map +1 -0
  83. package/dist/src/cli/mcp-setup.d.ts +141 -0
  84. package/dist/src/cli/mcp-setup.d.ts.map +1 -0
  85. package/dist/src/cli/mcp-setup.js +548 -0
  86. package/dist/src/cli/mcp-setup.js.map +1 -0
  87. package/dist/src/cli/organize.d.ts +136 -0
  88. package/dist/src/cli/organize.d.ts.map +1 -0
  89. package/dist/src/cli/organize.js +467 -0
  90. package/dist/src/cli/organize.js.map +1 -0
  91. package/dist/src/cli/prompts.d.ts +102 -0
  92. package/dist/src/cli/prompts.d.ts.map +1 -0
  93. package/dist/src/cli/prompts.js +346 -0
  94. package/dist/src/cli/prompts.js.map +1 -0
  95. package/dist/src/cli/standards.d.ts +160 -0
  96. package/dist/src/cli/standards.d.ts.map +1 -0
  97. package/dist/src/cli/standards.js +389 -0
  98. package/dist/src/cli/standards.js.map +1 -0
  99. package/dist/src/cli/style.d.ts +28 -0
  100. package/dist/src/cli/style.d.ts.map +1 -0
  101. package/dist/src/cli/style.js +57 -0
  102. package/dist/src/cli/style.js.map +1 -0
  103. package/dist/src/config/env-loader.d.ts +33 -0
  104. package/dist/src/config/env-loader.d.ts.map +1 -0
  105. package/dist/src/config/env-loader.js +72 -0
  106. package/dist/src/config/env-loader.js.map +1 -0
  107. package/dist/src/config/index.d.ts +10 -0
  108. package/dist/src/config/index.d.ts.map +1 -0
  109. package/dist/src/config/index.js +10 -0
  110. package/dist/src/config/index.js.map +1 -0
  111. package/dist/src/config/loader.d.ts +66 -0
  112. package/dist/src/config/loader.d.ts.map +1 -0
  113. package/dist/src/config/loader.js +810 -0
  114. package/dist/src/config/loader.js.map +1 -0
  115. package/dist/src/config/schema.d.ts +596 -0
  116. package/dist/src/config/schema.d.ts.map +1 -0
  117. package/dist/src/config/schema.js +9 -0
  118. package/dist/src/config/schema.js.map +1 -0
  119. package/dist/src/containers/container-manager.d.ts +157 -0
  120. package/dist/src/containers/container-manager.d.ts.map +1 -0
  121. package/dist/src/containers/container-manager.js +627 -0
  122. package/dist/src/containers/container-manager.js.map +1 -0
  123. package/dist/src/coverage/code-coverage.d.ts +89 -0
  124. package/dist/src/coverage/code-coverage.d.ts.map +1 -0
  125. package/dist/src/coverage/code-coverage.js +395 -0
  126. package/dist/src/coverage/code-coverage.js.map +1 -0
  127. package/dist/src/coverage/inventory.d.ts +80 -0
  128. package/dist/src/coverage/inventory.d.ts.map +1 -0
  129. package/dist/src/coverage/inventory.js +417 -0
  130. package/dist/src/coverage/inventory.js.map +1 -0
  131. package/dist/src/coverage/languages.d.ts +34 -0
  132. package/dist/src/coverage/languages.d.ts.map +1 -0
  133. package/dist/src/coverage/languages.js +156 -0
  134. package/dist/src/coverage/languages.js.map +1 -0
  135. package/dist/src/coverage/report.d.ts +128 -0
  136. package/dist/src/coverage/report.d.ts.map +1 -0
  137. package/dist/src/coverage/report.js +472 -0
  138. package/dist/src/coverage/report.js.map +1 -0
  139. package/dist/src/errors.d.ts +164 -0
  140. package/dist/src/errors.d.ts.map +1 -0
  141. package/dist/src/errors.js +267 -0
  142. package/dist/src/errors.js.map +1 -0
  143. package/dist/src/fixtures/amqp.fixture.d.ts +163 -0
  144. package/dist/src/fixtures/amqp.fixture.d.ts.map +1 -0
  145. package/dist/src/fixtures/amqp.fixture.js +494 -0
  146. package/dist/src/fixtures/amqp.fixture.js.map +1 -0
  147. package/dist/src/fixtures/appium.fixture.d.ts +112 -0
  148. package/dist/src/fixtures/appium.fixture.d.ts.map +1 -0
  149. package/dist/src/fixtures/appium.fixture.js +309 -0
  150. package/dist/src/fixtures/appium.fixture.js.map +1 -0
  151. package/dist/src/fixtures/aws.d.ts +44 -0
  152. package/dist/src/fixtures/aws.d.ts.map +1 -0
  153. package/dist/src/fixtures/aws.js +93 -0
  154. package/dist/src/fixtures/aws.js.map +1 -0
  155. package/dist/src/fixtures/cassandra.fixture.d.ts +179 -0
  156. package/dist/src/fixtures/cassandra.fixture.d.ts.map +1 -0
  157. package/dist/src/fixtures/cassandra.fixture.js +489 -0
  158. package/dist/src/fixtures/cassandra.fixture.js.map +1 -0
  159. package/dist/src/fixtures/clickhouse.fixture.d.ts +171 -0
  160. package/dist/src/fixtures/clickhouse.fixture.d.ts.map +1 -0
  161. package/dist/src/fixtures/clickhouse.fixture.js +514 -0
  162. package/dist/src/fixtures/clickhouse.fixture.js.map +1 -0
  163. package/dist/src/fixtures/database.fixture.d.ts +63 -0
  164. package/dist/src/fixtures/database.fixture.d.ts.map +1 -0
  165. package/dist/src/fixtures/database.fixture.js +407 -0
  166. package/dist/src/fixtures/database.fixture.js.map +1 -0
  167. package/dist/src/fixtures/dynamodb.fixture.d.ts +243 -0
  168. package/dist/src/fixtures/dynamodb.fixture.d.ts.map +1 -0
  169. package/dist/src/fixtures/dynamodb.fixture.js +580 -0
  170. package/dist/src/fixtures/dynamodb.fixture.js.map +1 -0
  171. package/dist/src/fixtures/graphql.fixture.d.ts +107 -0
  172. package/dist/src/fixtures/graphql.fixture.d.ts.map +1 -0
  173. package/dist/src/fixtures/graphql.fixture.js +158 -0
  174. package/dist/src/fixtures/graphql.fixture.js.map +1 -0
  175. package/dist/src/fixtures/grpc.fixture.d.ts +167 -0
  176. package/dist/src/fixtures/grpc.fixture.d.ts.map +1 -0
  177. package/dist/src/fixtures/grpc.fixture.js +635 -0
  178. package/dist/src/fixtures/grpc.fixture.js.map +1 -0
  179. package/dist/src/fixtures/inbox.fixture.d.ts +136 -0
  180. package/dist/src/fixtures/inbox.fixture.d.ts.map +1 -0
  181. package/dist/src/fixtures/inbox.fixture.js +239 -0
  182. package/dist/src/fixtures/inbox.fixture.js.map +1 -0
  183. package/dist/src/fixtures/index.d.ts +174 -0
  184. package/dist/src/fixtures/index.d.ts.map +1 -0
  185. package/dist/src/fixtures/index.js +379 -0
  186. package/dist/src/fixtures/index.js.map +1 -0
  187. package/dist/src/fixtures/kafka-driver.d.ts +108 -0
  188. package/dist/src/fixtures/kafka-driver.d.ts.map +1 -0
  189. package/dist/src/fixtures/kafka-driver.js +113 -0
  190. package/dist/src/fixtures/kafka-driver.js.map +1 -0
  191. package/dist/src/fixtures/kafka.fixture.d.ts +75 -0
  192. package/dist/src/fixtures/kafka.fixture.d.ts.map +1 -0
  193. package/dist/src/fixtures/kafka.fixture.js +188 -0
  194. package/dist/src/fixtures/kafka.fixture.js.map +1 -0
  195. package/dist/src/fixtures/mock-server.fixture.d.ts +142 -0
  196. package/dist/src/fixtures/mock-server.fixture.d.ts.map +1 -0
  197. package/dist/src/fixtures/mock-server.fixture.js +271 -0
  198. package/dist/src/fixtures/mock-server.fixture.js.map +1 -0
  199. package/dist/src/fixtures/mongodb.fixture.d.ts +121 -0
  200. package/dist/src/fixtures/mongodb.fixture.d.ts.map +1 -0
  201. package/dist/src/fixtures/mongodb.fixture.js +258 -0
  202. package/dist/src/fixtures/mongodb.fixture.js.map +1 -0
  203. package/dist/src/fixtures/neo4j.fixture.d.ts +72 -0
  204. package/dist/src/fixtures/neo4j.fixture.d.ts.map +1 -0
  205. package/dist/src/fixtures/neo4j.fixture.js +202 -0
  206. package/dist/src/fixtures/neo4j.fixture.js.map +1 -0
  207. package/dist/src/fixtures/openapi.fixture.d.ts +101 -0
  208. package/dist/src/fixtures/openapi.fixture.d.ts.map +1 -0
  209. package/dist/src/fixtures/openapi.fixture.js +266 -0
  210. package/dist/src/fixtures/openapi.fixture.js.map +1 -0
  211. package/dist/src/fixtures/optional-package.d.ts +54 -0
  212. package/dist/src/fixtures/optional-package.d.ts.map +1 -0
  213. package/dist/src/fixtures/optional-package.js +79 -0
  214. package/dist/src/fixtures/optional-package.js.map +1 -0
  215. package/dist/src/fixtures/otp.fixture.d.ts +60 -0
  216. package/dist/src/fixtures/otp.fixture.d.ts.map +1 -0
  217. package/dist/src/fixtures/otp.fixture.js +101 -0
  218. package/dist/src/fixtures/otp.fixture.js.map +1 -0
  219. package/dist/src/fixtures/realtime.fixture.d.ts +205 -0
  220. package/dist/src/fixtures/realtime.fixture.d.ts.map +1 -0
  221. package/dist/src/fixtures/realtime.fixture.js +606 -0
  222. package/dist/src/fixtures/realtime.fixture.js.map +1 -0
  223. package/dist/src/fixtures/redis.fixture.d.ts +55 -0
  224. package/dist/src/fixtures/redis.fixture.d.ts.map +1 -0
  225. package/dist/src/fixtures/redis.fixture.js +209 -0
  226. package/dist/src/fixtures/redis.fixture.js.map +1 -0
  227. package/dist/src/fixtures/s3.fixture.d.ts +126 -0
  228. package/dist/src/fixtures/s3.fixture.d.ts.map +1 -0
  229. package/dist/src/fixtures/s3.fixture.js +296 -0
  230. package/dist/src/fixtures/s3.fixture.js.map +1 -0
  231. package/dist/src/fixtures/search.fixture.d.ts +178 -0
  232. package/dist/src/fixtures/search.fixture.d.ts.map +1 -0
  233. package/dist/src/fixtures/search.fixture.js +472 -0
  234. package/dist/src/fixtures/search.fixture.js.map +1 -0
  235. package/dist/src/fixtures/sqs.fixture.d.ts +172 -0
  236. package/dist/src/fixtures/sqs.fixture.d.ts.map +1 -0
  237. package/dist/src/fixtures/sqs.fixture.js +428 -0
  238. package/dist/src/fixtures/sqs.fixture.js.map +1 -0
  239. package/dist/src/index.d.ts +43 -0
  240. package/dist/src/index.d.ts.map +1 -0
  241. package/dist/src/index.js +48 -0
  242. package/dist/src/index.js.map +1 -0
  243. package/dist/src/mcp/guards.d.ts +21 -0
  244. package/dist/src/mcp/guards.d.ts.map +1 -0
  245. package/dist/src/mcp/guards.js +118 -0
  246. package/dist/src/mcp/guards.js.map +1 -0
  247. package/dist/src/mcp/project-tools.d.ts +14 -0
  248. package/dist/src/mcp/project-tools.d.ts.map +1 -0
  249. package/dist/src/mcp/project-tools.js +252 -0
  250. package/dist/src/mcp/project-tools.js.map +1 -0
  251. package/dist/src/mcp/protocol.d.ts +116 -0
  252. package/dist/src/mcp/protocol.d.ts.map +1 -0
  253. package/dist/src/mcp/protocol.js +199 -0
  254. package/dist/src/mcp/protocol.js.map +1 -0
  255. package/dist/src/mcp/server.d.ts +43 -0
  256. package/dist/src/mcp/server.d.ts.map +1 -0
  257. package/dist/src/mcp/server.js +244 -0
  258. package/dist/src/mcp/server.js.map +1 -0
  259. package/dist/src/mcp/test-tools.d.ts +65 -0
  260. package/dist/src/mcp/test-tools.d.ts.map +1 -0
  261. package/dist/src/mcp/test-tools.js +380 -0
  262. package/dist/src/mcp/test-tools.js.map +1 -0
  263. package/dist/src/mcp/tools.d.ts +49 -0
  264. package/dist/src/mcp/tools.d.ts.map +1 -0
  265. package/dist/src/mcp/tools.js +726 -0
  266. package/dist/src/mcp/tools.js.map +1 -0
  267. package/dist/src/network-error.d.ts +11 -0
  268. package/dist/src/network-error.d.ts.map +1 -0
  269. package/dist/src/network-error.js +34 -0
  270. package/dist/src/network-error.js.map +1 -0
  271. package/dist/src/openapi/contract.d.ts +98 -0
  272. package/dist/src/openapi/contract.d.ts.map +1 -0
  273. package/dist/src/openapi/contract.js +407 -0
  274. package/dist/src/openapi/contract.js.map +1 -0
  275. package/dist/src/openapi/generate.d.ts +89 -0
  276. package/dist/src/openapi/generate.d.ts.map +1 -0
  277. package/dist/src/openapi/generate.js +607 -0
  278. package/dist/src/openapi/generate.js.map +1 -0
  279. package/dist/src/openapi/load.d.ts +8 -0
  280. package/dist/src/openapi/load.d.ts.map +1 -0
  281. package/dist/src/openapi/load.js +26 -0
  282. package/dist/src/openapi/load.js.map +1 -0
  283. package/dist/src/package-manager.d.ts +58 -0
  284. package/dist/src/package-manager.d.ts.map +1 -0
  285. package/dist/src/package-manager.js +137 -0
  286. package/dist/src/package-manager.js.map +1 -0
  287. package/dist/src/reporter/history.d.ts +85 -0
  288. package/dist/src/reporter/history.d.ts.map +1 -0
  289. package/dist/src/reporter/history.js +147 -0
  290. package/dist/src/reporter/history.js.map +1 -0
  291. package/dist/src/reporter/index.d.ts +59 -0
  292. package/dist/src/reporter/index.d.ts.map +1 -0
  293. package/dist/src/reporter/index.js +201 -0
  294. package/dist/src/reporter/index.js.map +1 -0
  295. package/dist/src/reporter/last-run.d.ts +88 -0
  296. package/dist/src/reporter/last-run.d.ts.map +1 -0
  297. package/dist/src/reporter/last-run.js +133 -0
  298. package/dist/src/reporter/last-run.js.map +1 -0
  299. package/dist/src/reporter/quarantine.d.ts +62 -0
  300. package/dist/src/reporter/quarantine.d.ts.map +1 -0
  301. package/dist/src/reporter/quarantine.js +148 -0
  302. package/dist/src/reporter/quarantine.js.map +1 -0
  303. package/dist/src/secrets/index.d.ts +4 -0
  304. package/dist/src/secrets/index.d.ts.map +1 -0
  305. package/dist/src/secrets/index.js +3 -0
  306. package/dist/src/secrets/index.js.map +1 -0
  307. package/dist/src/secrets/provider.interface.d.ts +30 -0
  308. package/dist/src/secrets/provider.interface.d.ts.map +1 -0
  309. package/dist/src/secrets/provider.interface.js +2 -0
  310. package/dist/src/secrets/provider.interface.js.map +1 -0
  311. package/dist/src/secrets/providers/aws.provider.d.ts +33 -0
  312. package/dist/src/secrets/providers/aws.provider.d.ts.map +1 -0
  313. package/dist/src/secrets/providers/aws.provider.js +88 -0
  314. package/dist/src/secrets/providers/aws.provider.js.map +1 -0
  315. package/dist/src/secrets/providers/azure.provider.d.ts +26 -0
  316. package/dist/src/secrets/providers/azure.provider.d.ts.map +1 -0
  317. package/dist/src/secrets/providers/azure.provider.js +71 -0
  318. package/dist/src/secrets/providers/azure.provider.js.map +1 -0
  319. package/dist/src/secrets/providers/env-file.provider.d.ts +29 -0
  320. package/dist/src/secrets/providers/env-file.provider.d.ts.map +1 -0
  321. package/dist/src/secrets/providers/env-file.provider.js +56 -0
  322. package/dist/src/secrets/providers/env-file.provider.js.map +1 -0
  323. package/dist/src/secrets/providers/gitlab.provider.d.ts +26 -0
  324. package/dist/src/secrets/providers/gitlab.provider.d.ts.map +1 -0
  325. package/dist/src/secrets/providers/gitlab.provider.js +67 -0
  326. package/dist/src/secrets/providers/gitlab.provider.js.map +1 -0
  327. package/dist/src/secrets/providers/index.d.ts +52 -0
  328. package/dist/src/secrets/providers/index.d.ts.map +1 -0
  329. package/dist/src/secrets/providers/index.js +81 -0
  330. package/dist/src/secrets/providers/index.js.map +1 -0
  331. package/dist/src/secrets/providers/openbao.provider.d.ts +28 -0
  332. package/dist/src/secrets/providers/openbao.provider.d.ts.map +1 -0
  333. package/dist/src/secrets/providers/openbao.provider.js +29 -0
  334. package/dist/src/secrets/providers/openbao.provider.js.map +1 -0
  335. package/dist/src/secrets/providers/vault-compatible.d.ts +140 -0
  336. package/dist/src/secrets/providers/vault-compatible.d.ts.map +1 -0
  337. package/dist/src/secrets/providers/vault-compatible.js +405 -0
  338. package/dist/src/secrets/providers/vault-compatible.js.map +1 -0
  339. package/dist/src/secrets/providers/vault.provider.d.ts +27 -0
  340. package/dist/src/secrets/providers/vault.provider.d.ts.map +1 -0
  341. package/dist/src/secrets/providers/vault.provider.js +23 -0
  342. package/dist/src/secrets/providers/vault.provider.js.map +1 -0
  343. package/dist/src/secrets/secrets-manager.d.ts +67 -0
  344. package/dist/src/secrets/secrets-manager.d.ts.map +1 -0
  345. package/dist/src/secrets/secrets-manager.js +255 -0
  346. package/dist/src/secrets/secrets-manager.js.map +1 -0
  347. package/dist/src/steps/amqp.steps.d.ts +37 -0
  348. package/dist/src/steps/amqp.steps.d.ts.map +1 -0
  349. package/dist/src/steps/amqp.steps.js +86 -0
  350. package/dist/src/steps/amqp.steps.js.map +1 -0
  351. package/dist/src/steps/appium.steps.d.ts +53 -0
  352. package/dist/src/steps/appium.steps.d.ts.map +1 -0
  353. package/dist/src/steps/appium.steps.js +109 -0
  354. package/dist/src/steps/appium.steps.js.map +1 -0
  355. package/dist/src/steps/aws.steps.d.ts +47 -0
  356. package/dist/src/steps/aws.steps.d.ts.map +1 -0
  357. package/dist/src/steps/aws.steps.js +116 -0
  358. package/dist/src/steps/aws.steps.js.map +1 -0
  359. package/dist/src/steps/browser.steps.d.ts +54 -0
  360. package/dist/src/steps/browser.steps.d.ts.map +1 -0
  361. package/dist/src/steps/browser.steps.js +102 -0
  362. package/dist/src/steps/browser.steps.js.map +1 -0
  363. package/dist/src/steps/cassandra.steps.d.ts +32 -0
  364. package/dist/src/steps/cassandra.steps.d.ts.map +1 -0
  365. package/dist/src/steps/cassandra.steps.js +81 -0
  366. package/dist/src/steps/cassandra.steps.js.map +1 -0
  367. package/dist/src/steps/clickhouse.steps.d.ts +30 -0
  368. package/dist/src/steps/clickhouse.steps.d.ts.map +1 -0
  369. package/dist/src/steps/clickhouse.steps.js +73 -0
  370. package/dist/src/steps/clickhouse.steps.js.map +1 -0
  371. package/dist/src/steps/database.steps.d.ts +43 -0
  372. package/dist/src/steps/database.steps.d.ts.map +1 -0
  373. package/dist/src/steps/database.steps.js +79 -0
  374. package/dist/src/steps/database.steps.js.map +1 -0
  375. package/dist/src/steps/dynamodb.steps.d.ts +32 -0
  376. package/dist/src/steps/dynamodb.steps.d.ts.map +1 -0
  377. package/dist/src/steps/dynamodb.steps.js +89 -0
  378. package/dist/src/steps/dynamodb.steps.js.map +1 -0
  379. package/dist/src/steps/graphql.steps.d.ts +60 -0
  380. package/dist/src/steps/graphql.steps.d.ts.map +1 -0
  381. package/dist/src/steps/graphql.steps.js +76 -0
  382. package/dist/src/steps/graphql.steps.js.map +1 -0
  383. package/dist/src/steps/grpc.steps.d.ts +29 -0
  384. package/dist/src/steps/grpc.steps.d.ts.map +1 -0
  385. package/dist/src/steps/grpc.steps.js +68 -0
  386. package/dist/src/steps/grpc.steps.js.map +1 -0
  387. package/dist/src/steps/inbox.steps.d.ts +30 -0
  388. package/dist/src/steps/inbox.steps.d.ts.map +1 -0
  389. package/dist/src/steps/inbox.steps.js +72 -0
  390. package/dist/src/steps/inbox.steps.js.map +1 -0
  391. package/dist/src/steps/index.d.ts +43 -0
  392. package/dist/src/steps/index.d.ts.map +1 -0
  393. package/dist/src/steps/index.js +26 -0
  394. package/dist/src/steps/index.js.map +1 -0
  395. package/dist/src/steps/kafka.steps.d.ts +56 -0
  396. package/dist/src/steps/kafka.steps.d.ts.map +1 -0
  397. package/dist/src/steps/kafka.steps.js +61 -0
  398. package/dist/src/steps/kafka.steps.js.map +1 -0
  399. package/dist/src/steps/mock-server.steps.d.ts +21 -0
  400. package/dist/src/steps/mock-server.steps.d.ts.map +1 -0
  401. package/dist/src/steps/mock-server.steps.js +45 -0
  402. package/dist/src/steps/mock-server.steps.js.map +1 -0
  403. package/dist/src/steps/mongodb.steps.d.ts +107 -0
  404. package/dist/src/steps/mongodb.steps.d.ts.map +1 -0
  405. package/dist/src/steps/mongodb.steps.js +117 -0
  406. package/dist/src/steps/mongodb.steps.js.map +1 -0
  407. package/dist/src/steps/openapi.steps.d.ts +49 -0
  408. package/dist/src/steps/openapi.steps.d.ts.map +1 -0
  409. package/dist/src/steps/openapi.steps.js +113 -0
  410. package/dist/src/steps/openapi.steps.js.map +1 -0
  411. package/dist/src/steps/otp.steps.d.ts +43 -0
  412. package/dist/src/steps/otp.steps.d.ts.map +1 -0
  413. package/dist/src/steps/otp.steps.js +83 -0
  414. package/dist/src/steps/otp.steps.js.map +1 -0
  415. package/dist/src/steps/realtime.steps.d.ts +40 -0
  416. package/dist/src/steps/realtime.steps.d.ts.map +1 -0
  417. package/dist/src/steps/realtime.steps.js +116 -0
  418. package/dist/src/steps/realtime.steps.js.map +1 -0
  419. package/dist/src/steps/redis.steps.d.ts +54 -0
  420. package/dist/src/steps/redis.steps.d.ts.map +1 -0
  421. package/dist/src/steps/redis.steps.js +89 -0
  422. package/dist/src/steps/redis.steps.js.map +1 -0
  423. package/dist/src/steps/search.steps.d.ts +23 -0
  424. package/dist/src/steps/search.steps.d.ts.map +1 -0
  425. package/dist/src/steps/search.steps.js +54 -0
  426. package/dist/src/steps/search.steps.js.map +1 -0
  427. package/dist/src/test-data/factory.d.ts +82 -0
  428. package/dist/src/test-data/factory.d.ts.map +1 -0
  429. package/dist/src/test-data/factory.js +116 -0
  430. package/dist/src/test-data/factory.js.map +1 -0
  431. package/dist/src/test-data/index.d.ts +4 -0
  432. package/dist/src/test-data/index.d.ts.map +1 -0
  433. package/dist/src/test-data/index.js +4 -0
  434. package/dist/src/test-data/index.js.map +1 -0
  435. package/dist/src/test-data/registry.d.ts +37 -0
  436. package/dist/src/test-data/registry.d.ts.map +1 -0
  437. package/dist/src/test-data/registry.js +51 -0
  438. package/dist/src/test-data/registry.js.map +1 -0
  439. package/dist/src/test-data/tracking.d.ts +47 -0
  440. package/dist/src/test-data/tracking.d.ts.map +1 -0
  441. package/dist/src/test-data/tracking.js +166 -0
  442. package/dist/src/test-data/tracking.js.map +1 -0
  443. package/environments.json +263 -0
  444. package/package.json +299 -5
@@ -0,0 +1,742 @@
1
+ /**
2
+ * `propmaster fixture list | add | remove`: sets a fixture up in a project, or
3
+ * takes it out again, from the catalog in fixture-catalog.ts.
4
+ *
5
+ * A plan is worked out in memory first (every file's new text, the packages
6
+ * to install or remove), so a dry run shows exactly what would change and the
7
+ * MCP tools can show it before applying. Adding then removing a fixture gives
8
+ * back the files as they were. Remove takes out only what add would have
9
+ * written: config blocks and compose services holding your own values stay,
10
+ * and the plan says so.
11
+ *
12
+ * package.json the driver, through the project's package manager
13
+ * environments.json the fixture's block in every environment (local values in
14
+ * `local`, CHANGE_ME elsewhere); only the keys it touches change
15
+ * .env.example its PW_* variables, in a marked section
16
+ * compose.test.yaml a service to run the backend locally (optional)
17
+ * tests/<type>/ a starter test with a fresh TestCaseID (optional)
18
+ */
19
+ import { packageCommand, packageManager } from '../package-manager.js';
20
+ import { spawnSync } from 'node:child_process';
21
+ import * as fs from 'node:fs';
22
+ import * as path from 'node:path';
23
+ import { collect, findProjectRoot, loadConfig, nextIds, walk } from './check-tests.js';
24
+ import { FIXTURE_CATALOG, PLACEHOLDER, allPackages, catalogEntry, starterSource } from './fixture-catalog.js';
25
+ import { addMember, objectAt, parseJsonSpans, removeMember, valueAt } from './json-edit.js';
26
+ import { TEST_TYPES } from './layout.js';
27
+ import { analyzeSource } from './organize.js';
28
+ import { confirm, isInteractive, multiselect, select } from './prompts.js';
29
+ import { styleFor } from './style.js';
30
+ export const ENVIRONMENTS_FILE = 'environments.json';
31
+ export const ENV_EXAMPLE_FILE = '.env.example';
32
+ export const COMPOSE_FILE = 'compose.test.yaml';
33
+ const NEW_ENVIRONMENTS = '{\n "environments": {\n "local": {}\n }\n}\n';
34
+ const NEW_COMPOSE = '# Services for the tests: docker compose -f compose.test.yaml up -d --wait\nservices:\n';
35
+ /** Keys whose values are the same in every environment, so they aren't replaced by CHANGE_ME. */
36
+ const SAME_EVERYWHERE = new Set(['type', 'driver', 'platform', 'region', 'createKeyspace', 'trustServerCertificate', 'digits', 'period']);
37
+ // ─── Project state ──────────────────────────────────────────────────────────
38
+ /** The project's files as a plan sees them: what's on disk, plus the plan's own edits. */
39
+ export class Files {
40
+ root;
41
+ changed = new Map();
42
+ constructor(root) {
43
+ this.root = root;
44
+ }
45
+ read(rel) {
46
+ if (this.changed.has(rel))
47
+ return this.changed.get(rel);
48
+ const full = path.join(this.root, rel);
49
+ return fs.existsSync(full) ? fs.readFileSync(full, 'utf-8') : null;
50
+ }
51
+ write(rel, content) {
52
+ const onDisk = fs.existsSync(path.join(this.root, rel)) ? fs.readFileSync(path.join(this.root, rel), 'utf-8') : null;
53
+ if (content === onDisk)
54
+ this.changed.delete(rel);
55
+ else
56
+ this.changed.set(rel, content);
57
+ }
58
+ /** Files whose content changes, with their new content (null: deleted). */
59
+ changes() {
60
+ return new Map(this.changed);
61
+ }
62
+ }
63
+ /** Packages in the project's package.json (dependencies, devDependencies, optionalDependencies). */
64
+ export function installedPackages(root) {
65
+ const file = path.join(root, 'package.json');
66
+ if (!fs.existsSync(file))
67
+ return new Set();
68
+ const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
69
+ return new Set([...Object.keys(pkg.dependencies ?? {}), ...Object.keys(pkg.devDependencies ?? {}), ...Object.keys(pkg.optionalDependencies ?? {})]);
70
+ }
71
+ /** The environment names in environments.json text. */
72
+ export function environmentNames(text) {
73
+ if (!text)
74
+ return [];
75
+ const envs = valueAt(text, ['environments']);
76
+ return envs && typeof envs === 'object' && !Array.isArray(envs) ? Object.keys(envs) : [];
77
+ }
78
+ function hasConfig(text, key) {
79
+ return environmentNames(text).some((env) => valueAt(text, ['environments', env, key]) !== undefined);
80
+ }
81
+ /** Which catalog fixtures the project has: by their packages, or (for those without one) by their config. */
82
+ export function fixtureStates(root, files = new Files(root)) {
83
+ const installed = installedPackages(root);
84
+ const environments = files.read(ENVIRONMENTS_FILE);
85
+ const compose = files.read(COMPOSE_FILE) ?? '';
86
+ const used = new Set(testFixtures(root));
87
+ return FIXTURE_CATALOG.map((entry) => {
88
+ const packages = allPackages(entry);
89
+ const present = entry.fixtures.some((f) => used.has(f)) || (packages.length ? packages.some((p) => installed.has(p)) : hasConfig(environments, entry.variants[0].config[0].path[0]));
90
+ if (!present)
91
+ return { entry, present };
92
+ const variant = packages.length
93
+ ? entry.variants.find((v) => v.packages.length && v.packages.every((p) => installed.has(p)))
94
+ : entry.variants.find((v) => v.services.some((s) => hasService(compose, s.name)));
95
+ return { entry, present, variant: variant ?? entry.variants[0] };
96
+ });
97
+ }
98
+ // ─── environments.json ──────────────────────────────────────────────────────
99
+ /** The environment that gets local values: `local`, else the first. */
100
+ export function localEnvironment(names) {
101
+ return names.includes('local') ? 'local' : names[0];
102
+ }
103
+ /** `value` for an environment other than local: strings become CHANGE_ME, except settings that are the same everywhere. */
104
+ export function placeholderValue(value, key) {
105
+ if (key && SAME_EVERYWHERE.has(key))
106
+ return value;
107
+ if (typeof value === 'string')
108
+ return PLACEHOLDER;
109
+ if (Array.isArray(value))
110
+ return value.map((v) => placeholderValue(v));
111
+ if (value && typeof value === 'object')
112
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, placeholderValue(v, k)]));
113
+ return value;
114
+ }
115
+ function nest(keys, value) {
116
+ return keys.reduceRight((inner, key) => ({ [key]: inner }), value);
117
+ }
118
+ /** Adds `item` to environment `env`; returns the new text and whether it was added. */
119
+ function addConfigItem(text, env, item, value) {
120
+ const root = parseJsonSpans(text);
121
+ const base = ['environments', env];
122
+ let depth = 0;
123
+ while (depth < item.path.length - 1 && objectAt(root, [...base, ...item.path.slice(0, depth + 1)]))
124
+ depth++;
125
+ const parent = [...base, ...item.path.slice(0, depth)];
126
+ if (!objectAt(root, parent))
127
+ return { text, added: false }; // something that isn't an object is in the way: leave it
128
+ if (valueAt(text, [...base, ...item.path]) !== undefined)
129
+ return { text, added: false };
130
+ const [key, ...rest] = item.path.slice(depth);
131
+ return { text: addMember(text, parent, key, nest(rest, value)), added: true };
132
+ }
133
+ /** Removes `item` from environment `env`, and the objects above it that it leaves empty. */
134
+ function removeConfigItem(text, env, item) {
135
+ const base = ['environments', env];
136
+ if (valueAt(text, [...base, ...item.path]) === undefined)
137
+ return { text, removed: false };
138
+ let next = removeMember(text, [...base, ...item.path.slice(0, -1)], item.path[item.path.length - 1]);
139
+ for (let depth = item.path.length - 1; depth >= 1; depth--) {
140
+ const parentPath = [...base, ...item.path.slice(0, depth)];
141
+ const parent = objectAt(parseJsonSpans(next), parentPath);
142
+ if (!parent || parent.members.length)
143
+ break;
144
+ next = removeMember(next, parentPath.slice(0, -1), parentPath[parentPath.length - 1]);
145
+ }
146
+ return { text: next, removed: true };
147
+ }
148
+ const configKey = (item) => item.path.join('.');
149
+ /** Deep equality of JSON values, ignoring key order. */
150
+ function sameJson(a, b) {
151
+ if (a === b)
152
+ return true;
153
+ if (Array.isArray(a) || Array.isArray(b))
154
+ return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((v, i) => sameJson(v, b[i]));
155
+ if (!a || !b || typeof a !== 'object' || typeof b !== 'object')
156
+ return false;
157
+ const ka = Object.keys(a);
158
+ const kb = Object.keys(b);
159
+ return ka.length === kb.length && ka.every((k) => sameJson(a[k], b[k]));
160
+ }
161
+ /**
162
+ * Where an existing block disagrees with the variant on a setting that's the
163
+ * same everywhere (`type`, `driver`, ...), e.g. `type is "postgresql", not "mysql"`.
164
+ */
165
+ function conflicts(existing, wanted) {
166
+ if (!existing || typeof existing !== 'object' || !wanted || typeof wanted !== 'object')
167
+ return [];
168
+ const have = existing;
169
+ return Object.entries(wanted)
170
+ .filter(([key, value]) => (key === 'type' || key === 'driver') && JSON.stringify(have[key]) !== JSON.stringify(value))
171
+ .map(([key, value]) => `${key} is ${have[key] === undefined ? 'not set' : JSON.stringify(have[key])}, not ${JSON.stringify(value)}: change it`);
172
+ }
173
+ // ─── .env.example ───────────────────────────────────────────────────────────
174
+ const sectionMarker = (s) => `# ─── ${s.title} ── propmaster fixture: ${s.group}`;
175
+ const markerRe = (group) => new RegExp(`^# ─── .* ── propmaster fixture: ${group.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`, 'm');
176
+ /** Whether `name` is in the env file, set or commented out. */
177
+ function mentionsVar(text, name) {
178
+ return new RegExp(`^\\s*#?\\s*${name}=`, 'm').test(text);
179
+ }
180
+ /** Adds `section` unless its marker, or every one of its variables, is already there. */
181
+ export function addEnvSection(text, section) {
182
+ const current = text ?? '';
183
+ if (markerRe(section.group).test(current))
184
+ return text;
185
+ const vars = section.vars.filter((v) => !mentionsVar(current, v.name));
186
+ if (!vars.length)
187
+ return text;
188
+ const lines = [sectionMarker(section), ...vars.map((v) => `${v.optional ? '# ' : ''}${v.name}=${v.value}`)];
189
+ if (!current)
190
+ return `${lines.join('\n')}\n`;
191
+ return `${current.endsWith('\n') ? current : `${current}\n`}\n${lines.join('\n')}\n`;
192
+ }
193
+ /** Removes the marked section for `group` (and the blank line before it). Returns null when nothing is left. */
194
+ export function removeEnvSection(text, group) {
195
+ if (!text)
196
+ return text;
197
+ const lines = text.split('\n');
198
+ const start = lines.findIndex((l) => markerRe(group).test(l));
199
+ if (start === -1)
200
+ return text;
201
+ let end = start + 1;
202
+ while (end < lines.length && lines[end] !== '')
203
+ end++;
204
+ const from = start > 0 && lines[start - 1] === '' ? start - 1 : start;
205
+ const result = [...lines.slice(0, from), ...lines.slice(from === start ? end + 1 : end)].join('\n');
206
+ return result.trim() === '' ? null : result;
207
+ }
208
+ // ─── compose.test.yaml ──────────────────────────────────────────────────────
209
+ /** The `services:` section as line numbers: [first line after `services:`, line after the last one). */
210
+ function servicesSection(lines) {
211
+ const start = lines.findIndex((l) => /^services:\s*(#.*)?$/.test(l));
212
+ if (start === -1)
213
+ return null;
214
+ let end = start + 1;
215
+ while (end < lines.length && !/^\S/.test(lines[end]))
216
+ end++;
217
+ while (end > start + 1 && lines[end - 1].trim() === '')
218
+ end--;
219
+ return [start + 1, end];
220
+ }
221
+ /** The service `name`'s lines: [its name line, line after its last line). */
222
+ function serviceBlock(lines, name) {
223
+ const section = servicesSection(lines);
224
+ if (!section)
225
+ return null;
226
+ const start = lines.findIndex((l, i) => i >= section[0] && i < section[1] && new RegExp(`^ ${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}:\\s*$`).test(l));
227
+ if (start === -1)
228
+ return null;
229
+ let end = start + 1;
230
+ while (end < section[1] && (lines[end].trim() === '' || /^ {3,}\S/.test(lines[end])))
231
+ end++;
232
+ while (end > start + 1 && lines[end - 1].trim() === '')
233
+ end--;
234
+ return [start, end];
235
+ }
236
+ export function hasService(text, name) {
237
+ return text ? serviceBlock(text.split('\n'), name) !== null : false;
238
+ }
239
+ /** Adds `svc` at the end of `services:`, after a blank line. */
240
+ export function addService(text, svc) {
241
+ const current = text ?? NEW_COMPOSE;
242
+ if (hasService(current, svc.name))
243
+ return current;
244
+ const lines = current.split('\n');
245
+ let section = servicesSection(lines);
246
+ if (!section) {
247
+ const body = current.endsWith('\n') ? current : `${current}\n`;
248
+ return `${body}${body.trim() ? '\n' : ''}services:\n${svc.yaml}\n`;
249
+ }
250
+ const [first, end] = section;
251
+ const block = (end > first ? [''] : []).concat(svc.yaml.split('\n'));
252
+ lines.splice(end, 0, ...block);
253
+ const result = lines.join('\n');
254
+ return result.endsWith('\n') ? result : `${result}\n`;
255
+ }
256
+ /**
257
+ * Removes the service `name` when it's still as the catalog wrote it (one you
258
+ * changed stays). Returns the new text, null when only the new-file header is
259
+ * left, and `changed: false` when it was kept or missing.
260
+ */
261
+ export function removeService(text, svc) {
262
+ if (!text)
263
+ return { text, removed: false, edited: false };
264
+ const lines = text.split('\n');
265
+ const block = serviceBlock(lines, svc.name);
266
+ if (!block)
267
+ return { text, removed: false, edited: false };
268
+ if (lines.slice(block[0], block[1]).join('\n') !== svc.yaml)
269
+ return { text, removed: false, edited: true };
270
+ const from = block[0] > 0 && lines[block[0] - 1].trim() === '' && block[0] - 1 > servicesSection(lines)[0] - 1 ? block[0] - 1 : block[0];
271
+ // A first service has no blank line before it; drop the one after it instead, if any.
272
+ let to = block[1];
273
+ if (from === block[0] && lines[to] === '' && to + 1 < lines.length && /^ \S/.test(lines[to + 1]))
274
+ to++;
275
+ const result = [...lines.slice(0, from), ...lines.slice(to)].join('\n');
276
+ return { text: result === NEW_COMPOSE ? null : result, removed: true, edited: false };
277
+ }
278
+ /** Parses `database:mysql` into `{ id: 'database', variant: 'mysql' }`. */
279
+ export function parseRequest(arg) {
280
+ const [id, variant] = arg.split(':');
281
+ return { id, variant: variant || undefined };
282
+ }
283
+ /** The entry and variant for `request`; throws with the choices when either is unknown. */
284
+ export function resolveRequest(request) {
285
+ const entry = catalogEntry(request.id);
286
+ if (!entry)
287
+ throw new Error(`unknown fixture "${request.id}". Choose from: ${FIXTURE_CATALOG.map((e) => e.id).join(', ')}`);
288
+ if (!request.variant)
289
+ return { entry, variant: entry.variants[0] };
290
+ const variant = entry.variants.find((v) => v.id === request.variant.toLowerCase());
291
+ if (!variant)
292
+ throw new Error(`${entry.id} has no variant "${request.variant}". Choose from: ${entry.variants.map((v) => v.id).join(', ')}`);
293
+ return { entry, variant };
294
+ }
295
+ function testDir(root, entry) {
296
+ const dir = TEST_TYPES.find((t) => t.type === entry.testType).dir;
297
+ return fs.existsSync(path.join(root, dir)) ? dir : 'tests';
298
+ }
299
+ /** Works out what adding `requests` would change. Writes nothing. */
300
+ export function planAdd(root, requests, options = {}) {
301
+ const files = new Files(root);
302
+ const installed = installedPackages(root);
303
+ const plan = { command: 'add', fixtures: requests.map(resolveRequest), lines: [], files: new Map(), install: [], uninstall: [], blockers: [], notes: [] };
304
+ const { ids } = collect(root);
305
+ const allocated = [...ids];
306
+ let environments = files.read(ENVIRONMENTS_FILE);
307
+ if (environments === null) {
308
+ environments = NEW_ENVIRONMENTS;
309
+ plan.lines.push({ sign: '+', kind: 'config', text: `${ENVIRONMENTS_FILE} (new, with a local environment)` });
310
+ }
311
+ const envs = environmentNames(environments);
312
+ if (!envs.length)
313
+ throw new Error(`${ENVIRONMENTS_FILE} has no "environments" object to add to.`);
314
+ const local = localEnvironment(envs);
315
+ for (const { entry, variant } of plan.fixtures) {
316
+ for (const pkg of variant.packages) {
317
+ if (installed.has(pkg) || plan.install.includes(pkg))
318
+ plan.lines.push({ sign: '·', kind: 'package', text: `${pkg} already installed` });
319
+ else {
320
+ plan.install.push(pkg);
321
+ plan.lines.push({ sign: '+', kind: 'package', text: pkg });
322
+ }
323
+ }
324
+ const added = new Map();
325
+ const kept = new Map();
326
+ const push = (map, key, env) => map.set(key, [...(map.get(key) ?? []), env]);
327
+ for (const item of variant.config) {
328
+ for (const env of envs) {
329
+ const value = env === local ? item.value : placeholderValue(item.value, item.path[item.path.length - 1]);
330
+ const result = addConfigItem(environments, env, item, value);
331
+ environments = result.text;
332
+ push(result.added ? added : kept, configKey(item), env);
333
+ if (!result.added) {
334
+ for (const problem of conflicts(valueAt(environments, ['environments', env, ...item.path]), item.value)) {
335
+ plan.lines.push({ sign: '!', kind: 'config', text: `${ENVIRONMENTS_FILE}: ${env}.${configKey(item)}.${problem}` });
336
+ }
337
+ }
338
+ }
339
+ }
340
+ const where = (map) => [...map].map(([key, list]) => `${key} in ${list.join(', ')}`).join('; ');
341
+ if (added.size)
342
+ plan.lines.push({ sign: '+', kind: 'config', text: `${ENVIRONMENTS_FILE}: ${where(added)}${envs.length > 1 ? ` (${PLACEHOLDER} outside ${local})` : ''}` });
343
+ if (kept.size)
344
+ plan.lines.push({ sign: '·', kind: 'config', text: `${ENVIRONMENTS_FILE}: ${where(kept)} already set` });
345
+ for (const s of variant.env) {
346
+ const before = files.read(ENV_EXAMPLE_FILE);
347
+ const after = addEnvSection(before, s);
348
+ if (after === before)
349
+ plan.lines.push({ sign: '·', kind: 'variables', text: `${ENV_EXAMPLE_FILE}: ${s.title} already there` });
350
+ else {
351
+ files.write(ENV_EXAMPLE_FILE, after);
352
+ plan.lines.push({ sign: '+', kind: 'variables', text: `${ENV_EXAMPLE_FILE}: ${s.vars.map((v) => v.name).join(', ')}` });
353
+ }
354
+ }
355
+ if (options.service !== false) {
356
+ for (const svc of variant.services) {
357
+ const before = files.read(COMPOSE_FILE);
358
+ if (hasService(before, svc.name))
359
+ plan.lines.push({ sign: '·', kind: 'service', text: `${COMPOSE_FILE}: ${svc.name} already there` });
360
+ else {
361
+ files.write(COMPOSE_FILE, addService(before, svc));
362
+ plan.lines.push({ sign: '+', kind: 'service', text: `${COMPOSE_FILE}: ${svc.name}${before === null ? ' (new file)' : ''}` });
363
+ }
364
+ }
365
+ }
366
+ if (options.test !== false) {
367
+ const file = `${testDir(root, entry)}/${entry.starter.file}.spec.ts`;
368
+ if (files.read(file) !== null)
369
+ plan.lines.push({ sign: '·', kind: 'test', text: `${file} already exists` });
370
+ else {
371
+ const [id] = nextIds(entry.category, allocated);
372
+ allocated.push({ id, category: entry.category, num: Number(id.split('-')[2]), file, line: 1 });
373
+ files.write(file, starterSource(entry, id));
374
+ plan.lines.push({ sign: '+', kind: 'test', text: `${file} [${id}]` });
375
+ }
376
+ }
377
+ if (entry.next)
378
+ plan.notes.push(`${entry.label}: ${entry.next}`);
379
+ }
380
+ files.write(ENVIRONMENTS_FILE, environments);
381
+ plan.files = files.changes();
382
+ if (plan.fixtures.some(({ variant }) => variant.services.length) && options.service !== false) {
383
+ plan.notes.unshift(`Start the services: docker compose -f ${COMPOSE_FILE} up -d --wait`);
384
+ }
385
+ return plan;
386
+ }
387
+ /** Each test file (relative path) with the fixtures its tests request. */
388
+ function scanTests(root) {
389
+ const config = loadConfig(root);
390
+ const out = new Map();
391
+ for (const dir of config.testDirs) {
392
+ for (const full of walk(path.join(root, dir))) {
393
+ const rel = path.relative(root, full).split(path.sep).join('/');
394
+ if (!config.testFileSuffixes.some((s) => rel.endsWith(s)) || out.has(rel))
395
+ continue;
396
+ out.set(rel, [...new Set(analyzeSource(fs.readFileSync(full, 'utf-8')).tests.flatMap((t) => t.fixtures))]);
397
+ }
398
+ }
399
+ return [...out].map(([file, fixtures]) => ({ file, fixtures })).sort((a, b) => a.file.localeCompare(b.file));
400
+ }
401
+ /** Every fixture name the project's tests request. */
402
+ export function testFixtures(root) {
403
+ return [...new Set(scanTests(root).flatMap((t) => t.fixtures))];
404
+ }
405
+ /** Test files (relative paths) whose tests request any of `fixtures`. */
406
+ export function testsUsing(root, fixtures) {
407
+ return scanTests(root)
408
+ .filter((t) => t.fixtures.some((f) => fixtures.includes(f)))
409
+ .map((t) => t.file);
410
+ }
411
+ /** Works out what removing `id` would change. Writes nothing; `blockers` lists tests that still use it. */
412
+ export function planRemove(root, id) {
413
+ const entry = catalogEntry(id);
414
+ if (!entry)
415
+ throw new Error(`unknown fixture "${id}". Choose from: ${FIXTURE_CATALOG.map((e) => e.id).join(', ')}`);
416
+ const files = new Files(root);
417
+ const states = fixtureStates(root, files);
418
+ const state = states.find((s) => s.entry === entry);
419
+ const others = states.filter((s) => s.present && s.entry !== entry);
420
+ const otherVariants = others.map((s) => s.variant);
421
+ const plan = { command: 'remove', fixtures: [{ entry, variant: state.variant ?? entry.variants[0] }], lines: [], files: new Map(), install: [], uninstall: [], blockers: [], notes: [] };
422
+ // Tests: unchanged starter tests go with the fixture; any other test using it blocks the removal.
423
+ for (const file of testsUsing(root, entry.fixtures)) {
424
+ const content = files.read(file);
425
+ const starterId = /\[(TC-[A-Z][A-Z0-9]*-\d+)\]/.exec(content)?.[1];
426
+ if (path.basename(file) === `${entry.starter.file}.spec.ts` && starterId && content === starterSource(entry, starterId)) {
427
+ files.write(file, null);
428
+ plan.lines.push({ sign: '-', kind: 'test', text: `${file} (the starter test, unchanged)` });
429
+ }
430
+ else
431
+ plan.blockers.push(file);
432
+ }
433
+ const installed = installedPackages(root);
434
+ const neededElsewhere = new Set(otherVariants.flatMap((v) => v.packages));
435
+ for (const pkg of allPackages(entry)) {
436
+ if (installed.has(pkg) && !neededElsewhere.has(pkg)) {
437
+ plan.uninstall.push(pkg);
438
+ plan.lines.push({ sign: '-', kind: 'package', text: pkg });
439
+ }
440
+ }
441
+ let environments = files.read(ENVIRONMENTS_FILE);
442
+ if (environments !== null) {
443
+ const shared = new Set(otherVariants.flatMap((v) => v.config.map(configKey)));
444
+ // Every value add could have written at each path (one per variant).
445
+ const items = new Map();
446
+ for (const item of entry.variants.flatMap((v) => v.config))
447
+ items.set(configKey(item), [...(items.get(configKey(item)) ?? []), item]);
448
+ const names = environmentNames(environments);
449
+ const local = localEnvironment(names);
450
+ const removed = [];
451
+ const kept = [];
452
+ for (const env of names) {
453
+ for (const [key, variants] of items) {
454
+ if (shared.has(key))
455
+ continue;
456
+ const current = valueAt(environments, ['environments', env, ...variants[0].path]);
457
+ if (current === undefined)
458
+ continue;
459
+ const written = variants.map((item) => (env === local ? item.value : placeholderValue(item.value, item.path[item.path.length - 1])));
460
+ if (!written.some((w) => sameJson(w, current))) {
461
+ kept.push(`${env}.${key}`);
462
+ continue;
463
+ }
464
+ environments = removeConfigItem(environments, env, variants[0]).text;
465
+ removed.push(`${env}.${key}`);
466
+ }
467
+ }
468
+ if (removed.length)
469
+ plan.lines.push({ sign: '-', kind: 'config', text: `${ENVIRONMENTS_FILE}: ${removed.join(', ')}` });
470
+ if (kept.length)
471
+ plan.lines.push({ sign: '!', kind: 'config', text: `${ENVIRONMENTS_FILE}: ${kept.join(', ')} kept (your own values; delete them yourself if nothing needs them)` });
472
+ files.write(ENVIRONMENTS_FILE, environments === NEW_ENVIRONMENTS ? null : environments);
473
+ }
474
+ const sharedGroups = new Set(otherVariants.flatMap((v) => v.env.map((s) => s.group)));
475
+ for (const group of new Set(entry.variants.flatMap((v) => v.env.map((s) => s.group)))) {
476
+ if (sharedGroups.has(group))
477
+ continue;
478
+ const before = files.read(ENV_EXAMPLE_FILE);
479
+ const after = removeEnvSection(before, group);
480
+ if (after !== before) {
481
+ files.write(ENV_EXAMPLE_FILE, after);
482
+ plan.lines.push({ sign: '-', kind: 'variables', text: `${ENV_EXAMPLE_FILE}: the ${entry.variants.flatMap((v) => v.env).find((s) => s.group === group).title} section` });
483
+ }
484
+ }
485
+ const sharedServices = new Set(otherVariants.flatMap((v) => v.services.map((s) => s.name)));
486
+ const services = new Map(entry.variants.flatMap((v) => v.services).map((s) => [s.name, s]));
487
+ for (const svc of services.values()) {
488
+ if (sharedServices.has(svc.name))
489
+ continue;
490
+ const result = removeService(files.read(COMPOSE_FILE), svc);
491
+ if (result.removed) {
492
+ files.write(COMPOSE_FILE, result.text);
493
+ plan.lines.push({ sign: '-', kind: 'service', text: `${COMPOSE_FILE}: ${svc.name}` });
494
+ }
495
+ else if (result.edited)
496
+ plan.lines.push({ sign: '!', kind: 'service', text: `${COMPOSE_FILE}: ${svc.name} kept (changed since it was added; remove it yourself if nothing else needs it)` });
497
+ }
498
+ if (!plan.lines.length && !plan.blockers.length)
499
+ plan.notes.push(`${entry.id} isn't set up in this project: nothing to remove.`);
500
+ plan.files = files.changes();
501
+ return plan;
502
+ }
503
+ // ─── Applying ───────────────────────────────────────────────────────────────
504
+ export { packageCommand, packageManager };
505
+ /** Runs a command with its output on this terminal. */
506
+ export const inheritRunner = ([cmd, ...args], cwd) => {
507
+ const result = spawnSync(cmd, args, { cwd, stdio: 'inherit', shell: process.platform === 'win32' });
508
+ return { ok: result.status === 0, output: '' };
509
+ };
510
+ /** Runs a command and keeps its output (the MCP tools). */
511
+ export const captureRunner = ([cmd, ...args], cwd) => {
512
+ const result = spawnSync(cmd, args, { cwd, encoding: 'utf-8', shell: process.platform === 'win32', timeout: 10 * 60_000 });
513
+ return { ok: result.status === 0, output: `${result.stdout ?? ''}${result.stderr ?? ''}`.trim() };
514
+ };
515
+ /** Writes the plan's files, then installs or removes its packages. Throws when the plan has blockers. */
516
+ export function applyPlan(root, plan, options = {}) {
517
+ if (plan.blockers.length)
518
+ throw new Error(`can't remove ${plan.fixtures[0].entry.id}: tests still use it (${plan.blockers.join(', ')})`);
519
+ const result = { ok: true, written: [], deleted: [], output: '' };
520
+ for (const [rel, content] of plan.files) {
521
+ const full = path.join(root, rel);
522
+ if (content === null) {
523
+ if (fs.existsSync(full))
524
+ fs.rmSync(full);
525
+ result.deleted.push(rel);
526
+ }
527
+ else {
528
+ fs.mkdirSync(path.dirname(full), { recursive: true });
529
+ fs.writeFileSync(full, content, 'utf-8');
530
+ result.written.push(rel);
531
+ }
532
+ }
533
+ const packages = plan.command === 'add' ? plan.install : plan.uninstall;
534
+ if (packages.length) {
535
+ const command = packageCommand(packageManager(root), plan.command === 'add' ? 'install' : 'uninstall', packages);
536
+ result.command = command.join(' ');
537
+ if (options.install !== false) {
538
+ const run = (options.runner ?? inheritRunner)(command, root);
539
+ result.ok = run.ok;
540
+ result.output = run.output;
541
+ }
542
+ }
543
+ return result;
544
+ }
545
+ /** A title and plan lines as text: `+ config environments.json: ...`. */
546
+ export function formatPlanLines(title, lines, color = false) {
547
+ const s = styleFor({ isTTY: color }, color ? { FORCE_COLOR: '1' } : { NO_COLOR: '1' });
548
+ const paint = { '+': s.green, '-': s.red, '·': s.dim, '!': s.yellow };
549
+ return [s.bold(title), ...lines.map((line) => ` ${paint[line.sign](line.sign)} ${line.kind.padEnd(9)} ${line.sign === '·' ? s.dim(line.text) : line.text}`)];
550
+ }
551
+ /** The plan as lines of text, for the terminal and the MCP tools. */
552
+ export function formatFixturePlan(plan, color = false) {
553
+ const s = styleFor({ isTTY: color }, color ? { FORCE_COLOR: '1' } : { NO_COLOR: '1' });
554
+ const names = plan.fixtures.map(({ entry, variant }) => `${entry.id}${entry.variants.length > 1 ? ` (${variant.label})` : ''}`).join(', ');
555
+ const out = formatPlanLines(`${plan.command === 'add' ? 'Add' : 'Remove'} ${names}`, plan.lines, color);
556
+ if (plan.blockers.length) {
557
+ out.push('', s.red(`Can't remove ${plan.fixtures[0].entry.id}: these tests still use ${plan.fixtures[0].entry.fixtures.join(', ')}:`));
558
+ for (const file of plan.blockers)
559
+ out.push(` ${file}`);
560
+ out.push('Change or delete them first.');
561
+ }
562
+ return out;
563
+ }
564
+ // ─── CLI ────────────────────────────────────────────────────────────────────
565
+ const HELP = `
566
+ Usage:
567
+ npx propmaster fixture list [--json]
568
+ npx propmaster fixture add [fixture[:variant]...] [--no-service] [--no-test] [--no-install] [--dry-run]
569
+ npx propmaster fixture remove [fixture] [--no-install] [--dry-run]
570
+
571
+ add Install a fixture's driver and add its block to every environment in
572
+ environments.json, its PW_* variables to .env.example, a service to
573
+ compose.test.yaml and a starter test. Adds only what's missing.
574
+ With no fixture, pick from a menu.
575
+ Variants: database:postgresql|mysql|mssql|sqlite, kafka:kafkajs|confluent,
576
+ search:elasticsearch|opensearch (the first is the default).
577
+ remove Undo add. Refuses while tests still use the fixture, and names them.
578
+ list The fixtures and which ones this project has.
579
+
580
+ Options:
581
+ --no-service don't add a compose.test.yaml service
582
+ --no-test don't add a starter test
583
+ --no-install change the files only; print the package command to run
584
+ --dry-run show the plan and change nothing
585
+ --root <dir> the project (default: the nearest package.json)
586
+ `;
587
+ function option(argv, name) {
588
+ const i = argv.indexOf(name);
589
+ return i !== -1 ? argv[i + 1] : undefined;
590
+ }
591
+ function positionals(argv) {
592
+ const out = [];
593
+ for (let i = 0; i < argv.length; i++) {
594
+ if (argv[i] === '--root')
595
+ i++;
596
+ else if (!argv[i].startsWith('-'))
597
+ out.push(argv[i]);
598
+ }
599
+ return out;
600
+ }
601
+ function printList(root, json, log) {
602
+ const states = fixtureStates(root);
603
+ if (json) {
604
+ log(JSON.stringify(states.map(({ entry, present, variant }) => ({
605
+ id: entry.id,
606
+ label: entry.label,
607
+ fixtures: entry.fixtures,
608
+ present,
609
+ variant: present && entry.variants.length > 1 ? variant.id : undefined,
610
+ variants: entry.variants.length > 1 ? entry.variants.map((v) => v.id) : undefined,
611
+ })), null, 2));
612
+ return 0;
613
+ }
614
+ const s = styleFor();
615
+ const width = Math.max(...states.map((x) => x.entry.id.length));
616
+ for (const { entry, present, variant } of states) {
617
+ const status = present ? s.green(`✓ added${entry.variants.length > 1 ? ` (${variant.label})` : ''}`) : s.dim('· not added');
618
+ log(` ${entry.id.padEnd(width)} ${entry.label.padEnd(34)} ${s.dim(entry.fixtures.join(', ').padEnd(16))} ${status}`);
619
+ }
620
+ return 0;
621
+ }
622
+ async function chooseAdd(root) {
623
+ const states = fixtureStates(root);
624
+ const choices = states.map(({ entry, present }) => ({
625
+ value: entry.id,
626
+ label: entry.id,
627
+ hint: `${entry.label} · ${entry.fixtures.join(', ')}`,
628
+ search: entry.label,
629
+ disabled: present ? 'already added' : false,
630
+ }));
631
+ const ids = await multiselect({ message: 'Fixtures to add', choices, flag: '<fixture>, e.g. `propmaster fixture add redis`' });
632
+ const requests = [];
633
+ for (const id of ids) {
634
+ const entry = catalogEntry(id);
635
+ const variant = entry.variants.length > 1
636
+ ? await select({ message: `${entry.label}: which one?`, choices: entry.variants.map((v) => ({ value: v.id, label: v.label })), flag: `${id}:<variant>` })
637
+ : undefined;
638
+ requests.push({ id, variant });
639
+ }
640
+ const resolved = requests.map(resolveRequest);
641
+ const options = {};
642
+ if (resolved.some((r) => r.variant.services.length)) {
643
+ options.service = await confirm({ message: `Add services to ${COMPOSE_FILE}, to run the backends locally?`, default: true, flag: '--no-service' });
644
+ }
645
+ options.test = await confirm({ message: 'Add a starter test for each?', default: true, flag: '--no-test' });
646
+ return { requests, options };
647
+ }
648
+ /** `propmaster fixture ...` */
649
+ export async function runFixture(argv, log = console.log, runner = inheritRunner) {
650
+ const root = option(argv, '--root') ? path.resolve(option(argv, '--root')) : findProjectRoot();
651
+ let [sub, ...args] = positionals(argv);
652
+ const flags = new Set(argv.filter((a) => a.startsWith('--')));
653
+ if (flags.has('--help') || sub === 'help') {
654
+ log(HELP);
655
+ return 0;
656
+ }
657
+ if (!sub && isInteractive()) {
658
+ sub = await select({
659
+ message: 'Fixtures',
660
+ choices: [
661
+ { value: 'add', label: 'add', hint: 'set a fixture up in this project' },
662
+ { value: 'remove', label: 'remove', hint: 'take one out again' },
663
+ { value: 'list', label: 'list', hint: 'which ones this project has' },
664
+ ],
665
+ flag: 'add, remove or list',
666
+ });
667
+ }
668
+ if (sub === 'list')
669
+ return printList(root, flags.has('--json'), log);
670
+ if (sub !== 'add' && sub !== 'remove') {
671
+ log(HELP);
672
+ return sub ? 2 : 0;
673
+ }
674
+ const asked = args.length === 0;
675
+ let plan;
676
+ try {
677
+ if (sub === 'add') {
678
+ const chosen = asked ? await chooseAdd(root) : { requests: args.map(parseRequest), options: {} };
679
+ if (flags.has('--no-service'))
680
+ chosen.options.service = false;
681
+ if (flags.has('--no-test'))
682
+ chosen.options.test = false;
683
+ plan = planAdd(root, chosen.requests, chosen.options);
684
+ }
685
+ else {
686
+ const present = fixtureStates(root).filter((x) => x.present);
687
+ let id = args[0];
688
+ if (!id) {
689
+ if (!present.length) {
690
+ log(' No fixtures from the catalog are set up in this project.');
691
+ return 0;
692
+ }
693
+ id = await select({
694
+ message: 'Fixture to remove',
695
+ choices: present.map(({ entry }) => ({ value: entry.id, label: entry.id, hint: entry.label })),
696
+ flag: '<fixture>, e.g. `propmaster fixture remove redis`',
697
+ });
698
+ }
699
+ plan = planRemove(root, id);
700
+ }
701
+ }
702
+ catch (error) {
703
+ if (error instanceof Error && error.name !== 'NotInteractiveError' && error.name !== 'PromptCancelledError') {
704
+ log(` ${styleFor().red('✖')} ${error.message}`);
705
+ return 2;
706
+ }
707
+ throw error;
708
+ }
709
+ const color = styleFor().enabled;
710
+ log('');
711
+ for (const line of formatFixturePlan(plan, color))
712
+ log(` ${line}`);
713
+ log('');
714
+ if (plan.blockers.length)
715
+ return 1;
716
+ const changes = plan.files.size + plan.install.length + plan.uninstall.length;
717
+ if (!changes) {
718
+ log(` Nothing to change.${plan.notes.length ? '' : ''}`);
719
+ for (const note of plan.notes)
720
+ log(` ${note}`);
721
+ return 0;
722
+ }
723
+ if (flags.has('--dry-run')) {
724
+ log(' Dry run: nothing changed.');
725
+ return 0;
726
+ }
727
+ if (asked && !(await confirm({ message: 'Apply these changes?', default: true, flag: '--yes' })))
728
+ return 0;
729
+ const result = applyPlan(root, plan, { install: !flags.has('--no-install'), runner });
730
+ const s = styleFor();
731
+ if (!result.ok) {
732
+ log(` ${s.red('✖')} ${result.command} failed. The files were changed; run it again once the problem is fixed.`);
733
+ return 1;
734
+ }
735
+ log(` ${s.green('✔')} ${plan.command === 'add' ? 'Added' : 'Removed'} ${plan.fixtures.map((f) => f.entry.id).join(', ')}.`);
736
+ if (result.command && flags.has('--no-install'))
737
+ log(` Run: ${result.command}`);
738
+ for (const note of plan.notes)
739
+ log(` ${s.dim('→')} ${note}`);
740
+ return 0;
741
+ }
742
+ //# sourceMappingURL=fixture.js.map