@inluxc/propmaster 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +370 -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,1039 @@
1
+ #!/usr/bin/env node
2
+ import * as fs from 'node:fs';
3
+ import * as os from 'node:os';
4
+ import * as path from 'node:path';
5
+ import { pathToFileURL } from 'node:url';
6
+ import { KNOWN_CATEGORIES, collect, findProjectRoot, isCategory, nextIds, runCheck, runNextId } from './check-tests.js';
7
+ import { packageVersion, printBanner } from './banner.js';
8
+ import { NotInteractiveError, PromptCancelledError, isInteractive, select, text } from './prompts.js';
9
+ import { styleFor } from './style.js';
10
+ import { runFlaky } from './flaky.js';
11
+ import { runFailures } from './failures.js';
12
+ import { runCoverage } from './coverage.js';
13
+ import { ROOT_CONFIG_TEMPLATE, SUPPORT_DIRS, TEST_TYPES, configSnippet, projectsTemplate } from './layout.js';
14
+ import { planOrganize, runOrganize } from './organize.js';
15
+ import { adaptCommands, packageManagerForNewProject } from '../package-manager.js';
16
+ import { MCP_CLIENTS, applyChange, clientById, planSetup } from './mcp-setup.js';
17
+ import { FIXTURE_PACKAGES } from '../fixtures/optional-package.js';
18
+ export * from './check-tests.js';
19
+ export * from './layout.js';
20
+ export * from './organize.js';
21
+ export * from './prompts.js';
22
+ export { banner, logoLines, packageVersion, shouldShowBanner } from './banner.js';
23
+ // ─────────────────────────────────────────────────────────────────────────────
24
+ // Directory structure to scaffold
25
+ // ─────────────────────────────────────────────────────────────────────────────
26
+ const DIRECTORIES = [...TEST_TYPES.map((t) => t.dir), ...SUPPORT_DIRS];
27
+ // ─────────────────────────────────────────────────────────────────────────────
28
+ // File templates
29
+ // ─────────────────────────────────────────────────────────────────────────────
30
+ const FILES = {
31
+ '.gitignore': `node_modules/
32
+ dist/
33
+ playwright-report/
34
+ test-results/
35
+ .propmaster/
36
+ blob-report/
37
+ *.tgz
38
+ .env
39
+ .env.*
40
+ !.env.example
41
+ !.env.*.example
42
+ .auth/
43
+ `,
44
+ 'playwright.config.ts': ROOT_CONFIG_TEMPLATE,
45
+ 'environments.json': `{
46
+ "environments": {
47
+ "local": {
48
+ "openapi": {
49
+ "specPath": "./specs/api.yaml",
50
+ "baseUrl": "http://localhost:3000"
51
+ },
52
+ "database": {
53
+ "type": "postgresql",
54
+ "host": "localhost",
55
+ "port": 5432,
56
+ "database": "testdb",
57
+ "username": "testuser",
58
+ "password": "testpass"
59
+ },
60
+ "kafka": {
61
+ "brokers": ["localhost:9092"]
62
+ },
63
+ "redis": {
64
+ "host": "localhost",
65
+ "port": 6379
66
+ }
67
+ },
68
+ "dev": {
69
+ "openapi": {
70
+ "specPath": "https://api.dev.example.com/openapi.json",
71
+ "baseUrl": "https://api.dev.example.com"
72
+ },
73
+ "database": {
74
+ "type": "postgresql",
75
+ "host": "dev-db.example.com",
76
+ "port": 5432,
77
+ "database": "testdb",
78
+ "username": "dev_user",
79
+ "password": ""
80
+ },
81
+ "kafka": {
82
+ "brokers": ["kafka.dev.example.com:9092"]
83
+ },
84
+ "redis": {
85
+ "host": "redis.dev.example.com",
86
+ "port": 6379
87
+ }
88
+ }
89
+ }
90
+ }
91
+ `,
92
+ 'package.json': `{
93
+ "name": "my-propmaster-project",
94
+ "version": "1.0.0",
95
+ "description": "Playwright test project powered by @inluxc/propmaster",
96
+ "private": true,
97
+ "type": "module",
98
+ "scripts": {
99
+ "test": "npx playwright test",
100
+ "test:api": "npx playwright test --project=api",
101
+ "test:integration": "npx playwright test --project=integration",
102
+ "test:e2e": "npx playwright test --project='e2e-*'",
103
+ "test:mobile": "npx playwright test --project=mobile-android",
104
+ "test:tag": "npx playwright test --grep",
105
+ "typecheck": "tsc --noEmit",
106
+ "lint:tests": "propmaster check",
107
+ "next-id": "propmaster next-id",
108
+ "verify": "npm run typecheck && npm run lint:tests"
109
+ },
110
+ "propmaster": {
111
+ "testDirs": ["tests"],
112
+ "testFileSuffixes": [".spec.ts", ".test.ts"],
113
+ "exemptDirs": [],
114
+ "docFiles": ["AGENTS.md", "SKILLS.md"]
115
+ },
116
+ "dependencies": {
117
+ "@inluxc/propmaster": "^1.0.0",
118
+ "@playwright/test": "^1.65.1"
119
+ },
120
+ "devDependencies": {
121
+ "@types/node": "^22.20.5",
122
+ "typescript": "^7.0.2"
123
+ },
124
+ "engines": {
125
+ "node": ">=22.12.0"
126
+ }
127
+ }
128
+ `,
129
+ 'tsconfig.json': `{
130
+ "compilerOptions": {
131
+ "target": "ES2022",
132
+ "module": "ESNext",
133
+ "moduleResolution": "bundler",
134
+ "strict": true,
135
+ "esModuleInterop": true,
136
+ "skipLibCheck": true,
137
+ "forceConsistentCasingInFileNames": true,
138
+ "resolveJsonModule": true,
139
+ "declaration": true,
140
+ "sourceMap": true,
141
+ "outDir": "./dist",
142
+ "rootDir": ".",
143
+ "types": ["node"],
144
+ "paths": {
145
+ "@pages/*": ["./tests/support/pages/*"],
146
+ "@utils/*": ["./tests/support/utils/*"],
147
+ "@fixtures/*": ["./tests/support/fixtures/*"],
148
+ "@data/*": ["./tests/support/data/*"],
149
+ "@models/*": ["./tests/support/models/*"]
150
+ }
151
+ },
152
+ "include": [
153
+ "tests/**/*.ts",
154
+ "playwright.config.ts"
155
+ ],
156
+ "exclude": [
157
+ "node_modules",
158
+ "dist"
159
+ ]
160
+ }
161
+ `,
162
+ 'AGENTS.md': `# AI Agent Instructions
163
+
164
+ Playwright test project using the [@inluxc/propmaster](https://github.com/Inluxc/propmaster) fixture framework. Step-by-step recipes with copyable templates live in [SKILLS.md](SKILLS.md).
165
+
166
+ ## Agent Workflow — Required Checks
167
+
168
+ These commands give you fast, machine-checkable feedback. Use them instead of checking conventions by hand:
169
+
170
+ \`\`\`bash
171
+ npm run next-id -- API # next free TestCaseID in a category, e.g. TC-API-001
172
+ npm run next-id -- API 3 # three sequential IDs
173
+ npm run lint:tests # IDs, tags, uniqueness, test.step(), imports (specs + AGENTS.md/SKILLS.md samples)
174
+ npm run lint:tests -- --json # same, as JSON: { ok, violations: [{ file, line, rule, test, message }] }
175
+ npm run lint:tests -- --list-ids # every TestCaseID in use, with file:line
176
+ npm run verify # typecheck + lint:tests — run before finishing any task
177
+ npx propmaster generate openapi --dry-run # API test skeletons from the spec, one file per tag (drop --dry-run to write)
178
+ \`\`\`
179
+
180
+ \`lint:tests\` (\`propmaster check\`) exits non-zero on any violation. Each violation names the rule (\`tc-id\`, \`tc-tag\`, \`tc-unique\`, \`test-step\`, \`import\`) and the fix.
181
+
182
+ ## Propmaster MCP server
183
+
184
+ \`.mcp.json\` connects the \`propmaster\` MCP server (\`npx propmaster mcp\`, backends read-only); \`npx propmaster mcp setup\` connects it to other editors too (VS Code, Cursor, Windsurf, Zed). Use it to see the real backends instead of guessing: \`openapi_operations\` for operation IDs and parameters, \`db_query\` / \`mongo_find\` / \`redis_get\` / \`kafka_peek\` / \`neo4j_read\` for what's actually stored, \`next_test_id\` for new IDs and \`check_tests\` after changing tests. When a test needs a backend the project doesn't have yet, \`fixture_add\` sets it up (it returns the plan; call it again with \`apply: true\`). Tests still create their data through the fixtures, never through MCP write tools.
185
+
186
+ ## Structure
187
+
188
+ One folder per test type. Each folder's \`projects.ts\` defines its Playwright projects, and the root \`playwright.config.ts\` imports them all:
189
+
190
+ \`\`\`
191
+ tests/
192
+ ├── api/ # REST/GraphQL tests: no browser, device or backend service → --project=api
193
+ ├── integration/ # need a database, broker or cache → --project=integration
194
+ ├── e2e/ # browser user journeys → --project='e2e-*'
195
+ ├── mobile/ # Appium / GADS device tests → --project=mobile-android
196
+ └── support/
197
+ ├── pages/ # Page Object Model classes (*.page.ts)
198
+ ├── fixtures/ # Custom test fixtures (*.fixture.ts)
199
+ ├── data/ # Fixed test data (JSON/YAML)
200
+ ├── models/ # Database models and schemas
201
+ ├── utils/ # Test utilities and helpers
202
+ └── config/ # Test configuration helpers
203
+ \`\`\`
204
+
205
+ **Where a test goes** is decided by its fixtures: \`appiumDriver\` → \`mobile/\`; \`page\`/\`context\`/\`browser\` → \`e2e/\` (even if it also uses API fixtures to set up data); a database, Kafka, RabbitMQ, AWS (S3/SQS/DynamoDB), Elasticsearch/OpenSearch, Redis, MongoDB, Neo4j, Cassandra or ClickHouse client → \`integration/\`; only \`openApiClient\`/\`graphqlClient\`/\`grpcClient\`/\`realtimeClient\`/\`request\` → \`api/\`. Spec files end in \`.spec.ts\`. Run \`npx propmaster organize\` to check (it prints where each test belongs).
206
+
207
+ ## Writing Tests
208
+
209
+ ### Imports
210
+
211
+ Import \`test\` and \`expect\` from \`@inluxc/propmaster\` — its \`test\` object has every fixture registered:
212
+
213
+ \`\`\`typescript
214
+ import { test, expect } from '@inluxc/propmaster';
215
+ \`\`\`
216
+
217
+ **Never** value-import \`test\`/\`expect\` from \`@playwright/test\` in a test file. Type-only imports (\`import type { Page } from '@playwright/test'\`) are fine.
218
+
219
+ Each fixture's driver is an optional dependency. To use a new one, run \`npx propmaster fixture add <name>\` (e.g. \`kafka\`): it installs the driver and adds its config, variables, local service and a starter test. If a test fails with \`MissingPackageError\`, run the install command it prints (e.g. \`npm install --save-dev kafkajs\`); don't work around it.
220
+
221
+ ### Test Structure
222
+
223
+ Every test has a unique TestCaseID in its title **and** as a tag, and its body is broken into \`test.step()\` blocks:
224
+
225
+ \`\`\`typescript
226
+ import { test, expect } from '@inluxc/propmaster';
227
+
228
+ test.describe('API — Users', () => {
229
+ test('[TC-API-NNN] GET /users returns 200', { tag: ['@TC-API-NNN'] }, async ({ openApiClient }) => {
230
+ let response: any;
231
+
232
+ await test.step('Step 1: Send GET request to /users', async () => {
233
+ response = await (openApiClient.client as any).listUsers();
234
+ });
235
+
236
+ await test.step('Step 2: Verify the response', async () => {
237
+ expect(response.status).toBe(200);
238
+ expect(Array.isArray(response.data)).toBe(true);
239
+ });
240
+ });
241
+ });
242
+ \`\`\`
243
+
244
+ \`TC-API-NNN\` above is a placeholder. Replace it with a real ID from \`npm run next-id -- API\`; \`npm run lint:tests\` fails while a placeholder is left in a spec file.
245
+
246
+ ## Test Case ID Convention
247
+
248
+ - **Pattern:** \`TC-XXX-NNN\` — \`XXX\` is a category code, \`NNN\` a zero-padded sequential number.
249
+ - **Category codes:** \`API\`, \`DB\`, \`KFK\`, \`AMQ\`, \`AWS\`, \`DDB\`, \`SRCH\`, \`RDS\`, \`MDB\`, \`NEO\`, \`CAS\`, \`GQL\`, \`GRPC\`, \`RT\`, \`BRW\`, \`APM\`, \`GDS\`, \`OTP\`, \`INT\`, or a custom 2–6 character code.
250
+ - **Title:** starts with \`[TC-XXX-NNN]\`.
251
+ - **Tag:** \`{ tag: ['@TC-XXX-NNN'] }\` as the second argument to \`test()\`, with the same ID.
252
+ - **Unique:** no two tests share an ID. Always take IDs from \`npm run next-id -- <CATEGORY>\`; never guess.
253
+ - **Never reuse:** a deleted test's ID is retired. \`next-id\` only sees IDs still in the code, so never renumber.
254
+ - **Steps are mandatory:** every test body uses \`await test.step('Step N: <verb phrase>', async () => { ... })\`.
255
+
256
+ Parameterized tests (generated in a loop) put an ID in each data row and build the title and tag from it:
257
+
258
+ \`\`\`typescript
259
+ import { test, expect } from '@inluxc/propmaster';
260
+
261
+ const cases = [
262
+ { id: 'TC-BRW-NNN', width: 375 },
263
+ { id: 'TC-BRW-NNN', width: 1280 },
264
+ ];
265
+
266
+ for (const c of cases) {
267
+ test(\`[\${c.id}] home page renders at \${c.width}px\`, { tag: [\`@\${c.id}\`] }, async ({ page }) => {
268
+ await test.step('Step 1: Open the home page', async () => {
269
+ await page.setViewportSize({ width: c.width, height: 800 });
270
+ await page.goto('/');
271
+ });
272
+
273
+ await test.step('Step 2: Verify the heading is visible', async () => {
274
+ await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
275
+ });
276
+ });
277
+ }
278
+ \`\`\`
279
+
280
+ ## Checker Configuration
281
+
282
+ \`propmaster check\` reads the \`propmaster\` key in \`package.json\`:
283
+
284
+ \`\`\`json
285
+ "propmaster": {
286
+ "testDirs": ["tests"],
287
+ "testFileSuffixes": [".spec.ts", ".test.ts"],
288
+ "exemptDirs": [],
289
+ "docFiles": ["AGENTS.md", "SKILLS.md"]
290
+ }
291
+ \`\`\`
292
+
293
+ Files under \`exemptDirs\` are skipped (their IDs are still reserved for \`next-id\`). Code samples in \`docFiles\` are checked too, with placeholder IDs like \`TC-API-NNN\` allowed.
294
+
295
+ ## Conventions
296
+
297
+ - Each spec goes in the folder for its type (\`tests/api\`, \`tests/integration\`, \`tests/e2e\`, \`tests/mobile\`); keep one type per file
298
+ - Page objects go in \`tests/support/pages/\` with a \`.page.ts\` suffix
299
+ - Test data goes in \`tests/support/data/\` as JSON or YAML files
300
+ - Custom fixtures extend the base \`test\` in \`tests/support/fixtures/\`
301
+ - Use parameterized queries for all database operations — never string interpolation
302
+ - Use \`test.describe()\` to group related tests; keep each file focused on one feature
303
+ - **Every test has a unique TestCaseID in its title and tag**
304
+ - **Every test body uses \`test.step()\`**
305
+ - **Run \`npm run verify\` before finishing**
306
+ `,
307
+ 'SKILLS.md': `# AI Skills
308
+
309
+ **Every template below follows the conventions in Skill 0.** Templates use placeholder IDs such as \`TC-API-NNN\`. Replace each one with a real ID from \`npm run next-id\`; \`npm run lint:tests\` fails while any placeholder is left in a spec file.
310
+
311
+ ## Skill 0: Test Conventions (applies to every test)
312
+
313
+ 1. Get IDs before writing tests — one per test:
314
+ \`\`\`bash
315
+ npm run next-id -- API # prints e.g. TC-API-001
316
+ npm run next-id -- API 3 # prints TC-API-001, TC-API-002, TC-API-003
317
+ \`\`\`
318
+ 2. Put the ID at the start of the title **and** in the tag:
319
+ \`test('[TC-API-001] does something', { tag: ['@TC-API-001'] }, async ({ ... }) => { ... })\`
320
+ 3. Break every test body into \`await test.step('Step N: <verb phrase>', async () => { ... })\` blocks.
321
+ 4. Import \`test\` and \`expect\` from \`@inluxc/propmaster\`, never from \`@playwright/test\` (type-only imports are fine).
322
+ 5. Check your work:
323
+ \`\`\`bash
324
+ npm run lint:tests # IDs, tags, uniqueness, steps, imports
325
+ npm run lint:tests -- --json # same, machine-readable
326
+ npm run verify # typecheck + lint:tests
327
+ \`\`\`
328
+
329
+ Rules: IDs are unique across the project, never reused after a test is deleted, and always taken from \`npm run next-id\` — don't guess.
330
+
331
+ ## Skill 1: Create a Spec Test
332
+
333
+ Create a \`.spec.ts\` file in the folder for the test's type: \`tests/api/\` (HTTP/GraphQL/gRPC/WebSocket/SSE clients only), \`tests/integration/\` (database, Kafka, RabbitMQ, AWS (S3/SQS), Elasticsearch/OpenSearch, Redis, MongoDB or Neo4j clients), \`tests/e2e/\` (\`page\`) or \`tests/mobile/\` (\`appiumDriver\`, a WebdriverIO \`Browser\`; set \`appium.gads\` to run on a GADS device farm).
334
+
335
+ \`\`\`typescript
336
+ import { test, expect } from '@inluxc/propmaster';
337
+
338
+ test.describe('Feature Name', () => {
339
+ test('[TC-API-NNN] should do something', { tag: ['@TC-API-NNN'] }, async ({ openApiClient }) => {
340
+ let response: any;
341
+
342
+ await test.step('Step 1: Prepare test data', async () => {
343
+ // Arrange
344
+ });
345
+
346
+ await test.step('Step 2: Call the API', async () => {
347
+ response = await (openApiClient.client as any).someOperation();
348
+ });
349
+
350
+ await test.step('Step 3: Verify the response', async () => {
351
+ expect(response.status).toBe(200);
352
+ });
353
+ });
354
+ });
355
+ \`\`\`
356
+
357
+ Steps:
358
+ 1. Pick the category code (\`API\`, \`DB\`, \`KFK\`, \`AMQ\`, \`AWS\`, \`DDB\`, \`SRCH\`, \`RDS\`, \`MDB\`, \`NEO\`, \`CAS\`, \`GQL\`, \`GRPC\`, \`RT\`, \`BRW\`, \`APM\`, \`GDS\`, \`OTP\`, \`INT\`, or a custom one)
359
+ 2. Run \`npm run next-id -- <CATEGORY> <count>\` and replace every placeholder ID
360
+ 3. Run \`npm run lint:tests\`
361
+
362
+ ## Skill 2: Create a Browser Test with a Page Object
363
+
364
+ Create page objects in \`tests/support/pages/\` with a \`.page.ts\` extension, and browser specs in \`tests/e2e/\` with a \`.spec.ts\` extension.
365
+
366
+ \`\`\`typescript
367
+ import type { Locator, Page } from '@playwright/test';
368
+
369
+ export class LoginPage {
370
+ readonly emailInput: Locator;
371
+ readonly passwordInput: Locator;
372
+ readonly submitButton: Locator;
373
+
374
+ constructor(private readonly page: Page) {
375
+ this.emailInput = page.getByLabel('Email');
376
+ this.passwordInput = page.getByLabel('Password');
377
+ this.submitButton = page.getByRole('button', { name: 'Sign In' });
378
+ }
379
+
380
+ async goto() {
381
+ await this.page.goto('/login');
382
+ }
383
+
384
+ async login(email: string, password: string) {
385
+ await this.emailInput.fill(email);
386
+ await this.passwordInput.fill(password);
387
+ await this.submitButton.click();
388
+ }
389
+ }
390
+ \`\`\`
391
+
392
+ \`\`\`typescript
393
+ import { test, expect } from '@inluxc/propmaster';
394
+ import { LoginPage } from '../support/pages/login.page';
395
+
396
+ test.describe('Browser — Login', () => {
397
+ test('[TC-BRW-NNN] valid credentials reach the dashboard', { tag: ['@TC-BRW-NNN'] }, async ({ page }) => {
398
+ const login = new LoginPage(page);
399
+
400
+ await test.step('Step 1: Navigate to the login page', async () => {
401
+ await login.goto();
402
+ });
403
+
404
+ await test.step('Step 2: Submit valid credentials', async () => {
405
+ await login.login('user@example.com', 'secret123');
406
+ });
407
+
408
+ await test.step('Step 3: Verify redirect to the dashboard', async () => {
409
+ await expect(page).toHaveURL(/dashboard/);
410
+ });
411
+ });
412
+ });
413
+ \`\`\`
414
+
415
+ ## Skill 3: Create a Database Test
416
+
417
+ \`\`\`typescript
418
+ import { test, expect } from '@inluxc/propmaster';
419
+
420
+ test.describe('Database — Users', () => {
421
+ test('[TC-DB-NNN] inserted user can be read back', { tag: ['@TC-DB-NNN'] }, async ({ databaseClient }) => {
422
+ const email = \`user-\${Date.now()}@example.com\`;
423
+
424
+ await test.step('Step 1: Insert a user', async () => {
425
+ const result = await databaseClient.execute(
426
+ 'INSERT INTO users (name, email) VALUES ($1, $2)', ['Alice', email]
427
+ );
428
+ expect(result.affectedRows).toBe(1);
429
+ });
430
+
431
+ await test.step('Step 2: Verify the user is stored', async () => {
432
+ const rows = await databaseClient.query<{ name: string }>(
433
+ 'SELECT name FROM users WHERE email = $1', [email]
434
+ );
435
+ expect(rows[0]?.name).toBe('Alice');
436
+ });
437
+
438
+ await test.step('Step 3: Clean up the user', async () => {
439
+ await databaseClient.execute('DELETE FROM users WHERE email = $1', [email]);
440
+ });
441
+ });
442
+ });
443
+ \`\`\`
444
+
445
+ Always use parameterized queries (\`$1\`, \`?\`) — never string interpolation.
446
+
447
+ ## Skill 4: Create a Custom Fixture
448
+
449
+ Create files in \`tests/support/fixtures/\` with a \`.fixture.ts\` extension.
450
+
451
+ \`\`\`typescript
452
+ import { test as base } from '@inluxc/propmaster';
453
+
454
+ export const test = base.extend<{ myFixture: MyType }>({
455
+ myFixture: async ({}, use) => {
456
+ const instance = await setup();
457
+ await use(instance);
458
+ await teardown(instance);
459
+ },
460
+ });
461
+
462
+ export { expect } from '@inluxc/propmaster';
463
+ \`\`\`
464
+
465
+ Specs that need the custom fixture import \`test\`/\`expect\` from this file instead of \`@inluxc/propmaster\`; every other convention still applies.
466
+
467
+ ## Skill 5: Sort Existing Tests into the Layout
468
+
469
+ \`propmaster organize\` moves tests into \`tests/api\`, \`tests/integration\`, \`tests/e2e\` and \`tests/mobile\` by their fixtures. It places most files by rule and leaves the rest for you.
470
+
471
+ 1. Commit or stash your work, then see the plan:
472
+ \`\`\`bash
473
+ npx propmaster organize # dry run: what moves where, and why some files stay
474
+ npx propmaster organize --json # same, as JSON: { moves, inPlace, ambiguous, conflicts, warnings, edits }
475
+ \`\`\`
476
+ 2. Apply it. Tracked files move with \`git mv\`, and relative imports are updated in moved files and in files that import them:
477
+ \`\`\`bash
478
+ npx propmaster organize --apply
479
+ \`\`\`
480
+ 3. For each entry in \`ambiguous\`, decide by hand:
481
+ - **Mixes test types:** split the file, one file per type, then run \`organize\` again.
482
+ - **Custom fixtures:** open the fixture definition. If it wraps \`page\`, the test is \`e2e\`; if it wraps a database, broker or cache client, \`integration\`; if only HTTP clients, \`api\`. Move the file with \`git mv\` and fix its relative imports.
483
+ - **No fixtures (unit-style):** these usually belong next to the application code with its own unit-test runner, not in a Playwright folder. Ask before moving them.
484
+ 4. For each entry in \`warnings\`, check the paths the file reads relative to itself (\`__dirname\`, \`storageState\`, \`setInputFiles\`).
485
+ 5. Make sure \`playwright.config.ts\` registers every folder's \`projects.ts\`, then run \`npx playwright test --list\` and \`npm run verify\`.
486
+ `,
487
+ // ─── Directory starter files ─────────────────────────────────────────────
488
+ 'tests/support/pages/example.page.ts': `import type { Locator, Page } from '@playwright/test';
489
+
490
+ /**
491
+ * Example Page Object Model.
492
+ * Create one class per page/component for reusable interactions.
493
+ */
494
+ export class ExamplePage {
495
+ // Locators
496
+ readonly heading: Locator;
497
+ readonly navLinks: Locator;
498
+
499
+ constructor(private readonly page: Page) {
500
+ this.heading = page.getByRole('heading', { level: 1 });
501
+ this.navLinks = page.getByRole('navigation').getByRole('link');
502
+ }
503
+
504
+ // Actions
505
+ async navigate() {
506
+ await this.page.goto('/');
507
+ }
508
+
509
+ async getTitle(): Promise<string> {
510
+ return this.page.title();
511
+ }
512
+ }
513
+ `,
514
+ 'tests/support/utils/index.ts': `/**
515
+ * Test utilities and helpers.
516
+ * Add shared helper functions used across multiple test files.
517
+ */
518
+
519
+ /**
520
+ * Generate a unique test identifier to avoid collisions.
521
+ */
522
+ export function uniqueId(prefix = 'test'): string {
523
+ return \`\${prefix}-\${Date.now()}-\${Math.random().toString(36).slice(2, 8)}\`;
524
+ }
525
+
526
+ /**
527
+ * Wait for a condition with timeout.
528
+ */
529
+ export async function waitFor(
530
+ condition: () => Promise<boolean>,
531
+ options: { timeout?: number; interval?: number } = {},
532
+ ): Promise<void> {
533
+ const { timeout = 10_000, interval = 500 } = options;
534
+ const start = Date.now();
535
+
536
+ while (Date.now() - start < timeout) {
537
+ if (await condition()) return;
538
+ await new Promise((r) => setTimeout(r, interval));
539
+ }
540
+
541
+ throw new Error(\`waitFor timed out after \${timeout}ms\`);
542
+ }
543
+ `,
544
+ 'tests/support/fixtures/index.ts': `/**
545
+ * Custom fixtures for this project.
546
+ * Extend the base propmaster fixtures here.
547
+ *
548
+ * Example:
549
+ * import { test as base } from '@inluxc/propmaster';
550
+ * export const test = base.extend<{ myFixture: MyType }>({ ... });
551
+ */
552
+ export {};
553
+ `,
554
+ 'tests/support/data/users.json': `[
555
+ {
556
+ "id": 1,
557
+ "name": "Alice",
558
+ "email": "alice@example.com",
559
+ "role": "admin"
560
+ },
561
+ {
562
+ "id": 2,
563
+ "name": "Bob",
564
+ "email": "bob@example.com",
565
+ "role": "user"
566
+ }
567
+ ]
568
+ `,
569
+ 'tests/support/models/index.ts': `/**
570
+ * Database models and type definitions.
571
+ * Define interfaces that match your database schema.
572
+ */
573
+
574
+ export interface User {
575
+ id: number;
576
+ name: string;
577
+ email: string;
578
+ role: 'admin' | 'user' | 'viewer';
579
+ created_at?: string;
580
+ updated_at?: string;
581
+ }
582
+
583
+ export interface Order {
584
+ id: number;
585
+ user_id: number;
586
+ status: 'pending' | 'active' | 'completed' | 'cancelled';
587
+ amount: number;
588
+ created_at?: string;
589
+ }
590
+ `,
591
+ 'tests/support/config/index.ts': `/**
592
+ * Test-specific configuration helpers.
593
+ * Use this for test environment setup, feature flags, etc.
594
+ */
595
+
596
+ export const testConfig = {
597
+ /** Default timeout for async operations in tests */
598
+ defaultTimeout: 10_000,
599
+
600
+ /** Whether to run tests that require external services */
601
+ skipExternalServices: process.env.SKIP_EXTERNAL === 'true',
602
+
603
+ /** Base URL override for tests */
604
+ baseUrl: process.env.PW_OPENAPI_BASE_URL ?? 'http://localhost:3000',
605
+ };
606
+ `,
607
+ ...Object.fromEntries(TEST_TYPES.map((t) => [`${t.dir}/projects.ts`, projectsTemplate(t.type)])),
608
+ };
609
+ // ─────────────────────────────────────────────────────────────────────────────
610
+ // CLI Logic
611
+ // ─────────────────────────────────────────────────────────────────────────────
612
+ const HELP = `
613
+ @inluxc/propmaster CLI
614
+
615
+ Usage:
616
+ npx propmaster init [directory]
617
+ npx propmaster fixture [list|add|remove] [fixture[:variant]...] [--dry-run]
618
+ npx propmaster doctor [-e <env>] [--fix] [--offline] [--json]
619
+ npx propmaster env [list|add] [name] [--from <env>] [--prod] [--dry-run]
620
+ npx propmaster standards [list|init] [--json]
621
+ npx propmaster organize [--apply] [--force] [--json] [--root <dir>]
622
+ npx propmaster auth-setup [role...]
623
+ npx propmaster check [--json] [--list-ids] [--root <dir>]
624
+ npx propmaster next-id <CATEGORY> [count] [--root <dir>]
625
+ npx propmaster flaky [--history <file|dir>] [--runs <n>] [--limit <n>] [--json]
626
+ npx propmaster failures [--no-flaky] [--json]
627
+ npx propmaster coverage [--layer unit|integration|e2e] [--report <file>] [--json]
628
+ npx propmaster generate openapi [--tag <tag>] [--operation <id>] [--dry-run] [--prism]
629
+ npx propmaster mcp [--environment <name>] [--allow-writes] [--allow-prod]
630
+ npx propmaster mcp setup [--client <names>] [-e <env>] [--allow-writes] [--check] [--remove]
631
+
632
+ Commands:
633
+ init Scaffold the project layout: tests/api, tests/integration,
634
+ tests/e2e, tests/mobile (each with its projects.ts) and
635
+ tests/support. In a project that already has Playwright tests
636
+ it adds only what's missing, moves and overwrites nothing, and
637
+ reports where the existing tests belong.
638
+ fixture Add a fixture to the project, or remove one: installs its driver,
639
+ adds its config to every environment, its PW_* variables to
640
+ .env.example, a compose.test.yaml service and a starter test.
641
+ \`propmaster fixture --help\` for details.
642
+ doctor Check the setup and say how to fix each problem: config,
643
+ drivers, backends, browsers, CI image, .env files, the MCP
644
+ server, test conventions. --fix applies the safe fixes.
645
+ env Add an environment to environments.json, copied from another
646
+ (values become CHANGE_ME, credentials are left out), with a
647
+ .env.<name> to fill in; or list them. \`propmaster env --help\`.
648
+ standards The team's testing standards: pages in standards/ for agents,
649
+ rules in propmaster.standards.json that \`check\` enforces.
650
+ \`standards init\` writes a sample set.
651
+ organize Sort existing Playwright tests into those folders by the
652
+ fixtures they use. Dry run by default; --apply moves the files
653
+ (git mv when tracked) and updates relative imports. Files it
654
+ can't place stay where they are and are listed with the reason.
655
+ auth-setup Create tests/e2e/auth.setup.ts: logs each role in once and saves
656
+ its browser state, so tests start logged in (authRole option).
657
+ check Check test conventions: [TC-XXX-NNN] title prefix, matching
658
+ { tag: ['@TC-XXX-NNN'] }, unique IDs, test.step() bodies, and
659
+ no value imports of @playwright/test in test files.
660
+ Exits 1 on violations. --json for machine-readable output,
661
+ --list-ids to print every TestCaseID in use. Also checks
662
+ quarantine.json, and warns about entries older than its
663
+ maxAgeDays and IDs no test has.
664
+ next-id Print the next free TestCaseID(s) for a category, e.g.
665
+ \`propmaster next-id API 3\` → TC-API-005, TC-API-006, TC-API-007
666
+ flaky Rank tests by flake rate over the last runs in the test history
667
+ the Propmaster reporter writes (.propmaster/test-history.json).
668
+ \`propmaster flaky --help\` for details.
669
+ failures What failed in the last run and why: the step, the error, where
670
+ it was thrown and the trace, with each test's recent history.
671
+ coverage What the tests cover per layer (unit, integration, e2e): what
672
+ each touches, untested API operations and status codes,
673
+ configured backends no test uses, recent outcomes, and the
674
+ code-coverage reports already in the project.
675
+ \`propmaster coverage --help\` for details.
676
+ generate Scaffold API tests from the OpenAPI spec into tests/api: one file
677
+ per tag, a test per operation and documented status code, with
678
+ real TestCaseIDs and test.step() blocks. Never overwrites a file;
679
+ skips operations that already have a test.
680
+ \`propmaster generate --help\` for details.
681
+ mcp Start an MCP server (stdio) that gives coding agents read tools
682
+ for the configured backends (db_query, mongo_find, redis_get,
683
+ kafka_peek, neo4j_read, openapi_operations, ...) plus
684
+ next_test_id and check_tests. Read-only unless --allow-writes;
685
+ refuses production environments unless --allow-prod.
686
+ \`propmaster mcp --help\` for details.
687
+ mcp setup Connect that server to your editors: Claude Code (.mcp.json),
688
+ VS Code, Cursor, Windsurf, Zed. --check starts it as the editor
689
+ would and lists its tools; --remove takes it out again.
690
+ \`propmaster mcp setup --help\` for details.
691
+
692
+ Configuration (optional, "propmaster" key in package.json):
693
+ "propmaster": {
694
+ "testDirs": ["tests"],
695
+ "testFileSuffixes": [".spec.ts", ".prop.ts"],
696
+ "exemptDirs": ["tests/unit/", "tests/properties/"],
697
+ "docFiles": ["AGENTS.md", "SKILLS.md"]
698
+ }
699
+
700
+ Run \`npx propmaster\` with no command in a terminal to pick one from a menu.
701
+ Commands ask for what you leave out, with menus where the answers are a
702
+ fixed list; every answer can also be given as a flag. With no terminal
703
+ (CI, pipes) a command never waits: it says which flag to pass.
704
+
705
+ Options:
706
+ --help Show this help message
707
+ -v, --version Print the version
708
+ `;
709
+ const PLAYWRIGHT_CONFIG = /^playwright\.config\.(?:c|m)?[jt]s$/;
710
+ /** Playwright config files at the root of `dir` (any extension). */
711
+ export function existingPlaywrightConfigs(dir) {
712
+ if (!fs.existsSync(dir))
713
+ return [];
714
+ return fs.readdirSync(dir).filter((f) => PLAYWRIGHT_CONFIG.test(f)).sort();
715
+ }
716
+ /**
717
+ * Scaffolds the layout into `targetDir`. Never overwrites a file and never
718
+ * moves one: in a project that already has Playwright tests or a config, it
719
+ * adds only what's missing and reports where the existing tests belong.
720
+ */
721
+ export function initProject(targetDir, log = console.log, env = {}) {
722
+ const existingConfigs = existingPlaywrightConfigs(targetDir);
723
+ const before = fs.existsSync(targetDir) ? planOrganize(targetDir) : null;
724
+ const testCount = before ? before.moves.length + before.inPlace.length + before.ambiguous.length + before.conflicts.length : 0;
725
+ const plan = testCount > 0 ? before : null;
726
+ const result = { created: [], skipped: [], existingConfigs, plan };
727
+ // Commands in the files and the next steps, for the project's package manager (bunx propmaster init → bun).
728
+ const pm = packageManagerForNewProject(targetDir, env);
729
+ const say = (line) => log(line === undefined ? line : adaptCommands(line, pm));
730
+ // Before AGENTS.md and the rest are written: the editors the project already uses.
731
+ const mcpEditors = fs.existsSync(targetDir) ? MCP_CLIENTS.filter((c) => c.detect({ root: targetDir, home: os.homedir() })).map((c) => c.id) : [];
732
+ for (const dir of DIRECTORIES) {
733
+ const fullPath = path.join(targetDir, dir);
734
+ if (!fs.existsSync(fullPath)) {
735
+ fs.mkdirSync(fullPath, { recursive: true });
736
+ log(` ✓ Created ${dir}/`);
737
+ }
738
+ else {
739
+ log(` · Exists ${dir}/`);
740
+ }
741
+ }
742
+ log();
743
+ for (const [filePath, content] of Object.entries(FILES)) {
744
+ const fullPath = path.join(targetDir, filePath);
745
+ if (filePath === 'playwright.config.ts' && existingConfigs.length) {
746
+ log(` · Skipped ${filePath} (you have ${existingConfigs.join(', ')})`);
747
+ result.skipped.push(filePath);
748
+ continue;
749
+ }
750
+ if (fs.existsSync(fullPath)) {
751
+ log(` · Skipped ${filePath} (already exists)`);
752
+ result.skipped.push(filePath);
753
+ continue;
754
+ }
755
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true });
756
+ fs.writeFileSync(fullPath, /\.(md|json)$/.test(filePath) ? adaptCommands(content, pm) : content, 'utf-8');
757
+ log(` ✓ Created ${filePath}`);
758
+ result.created.push(filePath);
759
+ }
760
+ // The MCP server, for Claude Code and the other editors this project uses (not the ones configured in the home folder).
761
+ const mcpCtx = { root: targetDir, home: os.homedir() };
762
+ for (const id of new Set(['claude', ...mcpEditors])) {
763
+ const client = clientById(id);
764
+ if (client.global)
765
+ continue;
766
+ const change = planSetup(client, mcpCtx, { packageManager: pm });
767
+ applyChange(change);
768
+ if (change.kind === 'create') {
769
+ log(` ✓ Created ${change.file}`);
770
+ result.created.push(change.file);
771
+ }
772
+ else if (change.kind === 'add' || change.kind === 'update') {
773
+ log(` ✓ Added the propmaster MCP server to ${change.file}`);
774
+ }
775
+ else if (change.kind === 'unchanged') {
776
+ log(` · Skipped ${change.file} (already has the propmaster MCP server)`);
777
+ result.skipped.push(change.file);
778
+ }
779
+ else {
780
+ log(` ✖ ${change.message}`);
781
+ }
782
+ }
783
+ if (mcpEditors.includes('windsurf'))
784
+ log(' · Windsurf keeps one MCP config for every project: npx propmaster mcp setup --client windsurf');
785
+ log();
786
+ log(` Done! Created ${result.created.length} files, skipped ${result.skipped.length} existing.`);
787
+ log();
788
+ if (plan || existingConfigs.length) {
789
+ reportExisting(result, log);
790
+ }
791
+ else {
792
+ say(' Next steps:');
793
+ say(' 1. npm install');
794
+ say(' 2. Set up the fixtures you use: driver, config, local service, starter test');
795
+ say(' npx propmaster fixture add (pick from a menu)');
796
+ say(' npx propmaster fixture add openapi database redis');
797
+ say(' 3. npx playwright install');
798
+ say(' 4. Update environments.json with your service URLs; npx propmaster doctor checks the setup');
799
+ say(' 5. Get a TestCaseID: npm run next-id -- API');
800
+ say(' 6. Create your first spec in the folder for its type, e.g. tests/api/users.spec.ts');
801
+ say(' 7. Check conventions: npm run lint:tests');
802
+ say(" 8. Add the team's testing standards: npx propmaster standards init");
803
+ log();
804
+ }
805
+ return result;
806
+ }
807
+ /** One line per fixture: the packages it needs. */
808
+ export function driverTable() {
809
+ const width = Math.max(...Object.keys(FIXTURE_PACKAGES).map((k) => k.length));
810
+ return Object.entries(FIXTURE_PACKAGES).map(([fixture, pkgs]) => `${fixture.padEnd(width)} ${pkgs.join(' ')}`);
811
+ }
812
+ function reportExisting({ plan, existingConfigs }, log) {
813
+ const found = [
814
+ existingConfigs.length ? existingConfigs.join(', ') : '',
815
+ plan ? `${plan.moves.length + plan.inPlace.length + plan.ambiguous.length + plan.conflicts.length} test file(s)` : '',
816
+ ].filter(Boolean);
817
+ log(` Existing Playwright setup found: ${found.join(', ')}.`);
818
+ log(' Nothing was moved or overwritten.');
819
+ log();
820
+ if (plan) {
821
+ const counts = TEST_TYPES.map((t) => `${t.type} ${[...plan.moves, ...plan.inPlace].filter((m) => m.type === t.type).length}`);
822
+ log(' Where your tests belong, by the fixtures they use:');
823
+ log(` ${counts.join(' · ')} · to decide by hand ${plan.ambiguous.length + plan.conflicts.length}`);
824
+ log(` (${plan.inPlace.length} already in the right folder, ${plan.moves.length} to move)`);
825
+ log();
826
+ log(' Next steps:');
827
+ log(' 1. npx propmaster organize see what moves where, and why some files stay');
828
+ log(' 2. npx propmaster organize --apply move them and update imports (commit first)');
829
+ }
830
+ else {
831
+ log(' Next steps:');
832
+ }
833
+ if (existingConfigs.length) {
834
+ log(` ${plan ? 3 : 1}. Add the new folders' projects to ${existingConfigs[0]}:`);
835
+ log();
836
+ log(configSnippet()
837
+ .split('\n')
838
+ .map((l) => ` ${l}`)
839
+ .join('\n'));
840
+ }
841
+ log();
842
+ }
843
+ /** The setup file `propmaster auth-setup` writes: one login per role, saved for tests to reuse. */
844
+ export function authSetupTemplate(roles = []) {
845
+ const rolesLine = roles.length ? ` roles: [${roles.map((r) => `'${r}'`).join(', ')}],\n` : '';
846
+ return `import { expect, setupAuth } from '@inluxc/propmaster';
847
+
848
+ /**
849
+ * Logs each role in once and saves its browser state to .auth/<role>.json.
850
+ * The e2e-setup project runs this before the browser projects; tests then
851
+ * start logged in with test.use({ authRole: 'admin' }).
852
+ *
853
+ * Roles and credentials come from auth.roles in environments.json. Keep
854
+ * passwords in PW_* variables or a secrets provider, not in the file.
855
+ */
856
+ setupAuth({
857
+ ${rolesLine} maxAgeMinutes: 30, // reuse a saved login for 30 minutes between runs
858
+ login: async ({ page }, { username, password }) => {
859
+ // TODO: replace with your app's login steps.
860
+ await page.goto('/login');
861
+ await page.getByLabel('Email').fill(username!);
862
+ await page.getByLabel('Password').fill(password!);
863
+ await page.getByRole('button', { name: 'Sign in' }).click();
864
+ await expect(page).not.toHaveURL(/login/);
865
+ },
866
+ });
867
+ `;
868
+ }
869
+ /** `propmaster auth-setup [role...]`: writes tests/e2e/auth.setup.ts unless it exists. */
870
+ export function runAuthSetup(argv, cwd = process.cwd(), log = console.log) {
871
+ const roles = argv.filter((a) => !a.startsWith('-'));
872
+ const file = path.join(cwd, 'tests/e2e/auth.setup.ts');
873
+ if (fs.existsSync(file)) {
874
+ log(` · ${path.relative(cwd, file)} already exists; nothing written.`);
875
+ return 0;
876
+ }
877
+ fs.mkdirSync(path.dirname(file), { recursive: true });
878
+ fs.writeFileSync(file, authSetupTemplate(roles), 'utf-8');
879
+ log(` ✓ Created ${path.relative(cwd, file)}`);
880
+ log('');
881
+ log(' Next steps:');
882
+ log(' 1. Replace the TODO login steps with your app\'s.');
883
+ log(' 2. Add the roles to environments.json, e.g.');
884
+ log(' "auth": { "roles": { "admin": { "username": "admin@example.com" }, "viewer": { "username": "viewer@example.com" } } }');
885
+ log(' and their passwords via PW_* variables or a secrets provider.');
886
+ log(" 3. Make sure tests/e2e/projects.ts has the e2e-setup project (new projects from `propmaster init` do).");
887
+ log(" 4. In a test: test.use({ authRole: 'admin' });");
888
+ return 0;
889
+ }
890
+ /** The commands offered when `propmaster` runs in a terminal with no command. */
891
+ const COMMAND_MENU = [
892
+ { value: 'init', label: 'init', hint: 'scaffold the test layout here' },
893
+ { value: 'fixture', label: 'fixture', hint: 'add or remove a fixture (driver, config, service, starter test)' },
894
+ { value: 'doctor', label: 'doctor', hint: 'find and fix setup problems' },
895
+ { value: 'mcp-setup', label: 'mcp setup', hint: 'connect the MCP server to your editors', search: 'editor claude vscode cursor' },
896
+ { value: 'env', label: 'env', hint: 'add an environment, or list them' },
897
+ { value: 'standards', label: 'standards', hint: "the team's testing rules and pages" },
898
+ { value: 'organize', label: 'organize', hint: 'see where existing tests belong' },
899
+ { value: 'generate', label: 'generate openapi', hint: 'API tests from the OpenAPI spec', search: 'openapi' },
900
+ { value: 'auth-setup', label: 'auth-setup', hint: 'log roles in once for browser tests' },
901
+ { value: 'next-id', label: 'next-id', hint: 'the next free TestCaseID' },
902
+ { value: 'check', label: 'check', hint: 'check test conventions' },
903
+ { value: 'flaky', label: 'flaky', hint: 'rank tests by flake rate' },
904
+ { value: 'failures', label: 'failures', hint: 'what failed in the last run and why' },
905
+ { value: 'coverage', label: 'coverage', hint: 'what the tests cover, per layer' },
906
+ { value: 'help', label: 'help', hint: 'every command and option' },
907
+ ];
908
+ /** Commands that print the banner (when stdout is a terminal). */
909
+ const BANNER_COMMANDS = new Set(['init', 'mcp-setup', 'doctor', 'fixture', 'env', 'standards', 'organize', 'auth-setup', 'generate', 'flaky', 'failures', 'coverage', 'help', '--help']);
910
+ /** `next-id` with no category: a menu of the built-in categories and those in use, each with its next ID. */
911
+ export async function askCategory(root = findProjectRoot()) {
912
+ const { ids } = collect(root);
913
+ const inUse = [...new Set(ids.map((i) => i.id.split('-')[1]))];
914
+ const codes = [...KNOWN_CATEGORIES.map((c) => c.code), ...inUse.filter((c) => !KNOWN_CATEGORIES.some((k) => k.code === c)).sort()];
915
+ const describe = (code) => KNOWN_CATEGORIES.find((c) => c.code === code)?.description ?? 'in use here';
916
+ const choices = codes.map((code) => ({ value: code, label: code, hint: `${describe(code)} · next ${nextIds(code, ids)[0]}`, search: describe(code) }));
917
+ choices.push({ value: '', label: 'Other…', hint: 'a code of your own' });
918
+ const picked = await select({ message: 'Category', choices, flag: '<CATEGORY>, e.g. `propmaster next-id API`' });
919
+ if (picked)
920
+ return picked;
921
+ return text({
922
+ message: 'Category code',
923
+ placeholder: 'e.g. PAY',
924
+ flag: '<CATEGORY>',
925
+ validate: (v) => (isCategory(v.toUpperCase()) ? undefined : '2–6 capitals or digits, starting with a capital'),
926
+ }).then((v) => v.toUpperCase());
927
+ }
928
+ /** Runs the CLI with `argv` (without node and the script) and returns the exit code. */
929
+ export async function main(argv = process.argv.slice(2)) {
930
+ let [command, ...rest] = argv;
931
+ if (command === '-v' || command === '--version' || command === 'version') {
932
+ console.log(packageVersion());
933
+ return 0;
934
+ }
935
+ if (command === 'mcp' && rest[0] === 'setup') {
936
+ command = 'mcp-setup';
937
+ rest = rest.slice(1);
938
+ }
939
+ if (command === 'mcp') {
940
+ // Loaded on demand: the server pulls in every client factory. No banner: stdout is the protocol.
941
+ const { runMcp } = await import('../mcp/server.js');
942
+ return runMcp(rest);
943
+ }
944
+ if (command === undefined && isInteractive()) {
945
+ printBanner(argv);
946
+ command = await select({ message: 'What do you want to do?', choices: COMMAND_MENU, flag: 'a command (see --help)' });
947
+ if (command === 'generate')
948
+ rest = ['openapi'];
949
+ }
950
+ else if (BANNER_COMMANDS.has(command ?? 'help')) {
951
+ printBanner(argv);
952
+ }
953
+ if (command === 'check')
954
+ return runCheck(rest);
955
+ if (command === 'next-id') {
956
+ const positional = rest.filter((a) => !a.startsWith('--'));
957
+ if (!positional.length && isInteractive())
958
+ return runNextId([await askCategory(), ...rest]);
959
+ return runNextId(rest);
960
+ }
961
+ if (command === 'flaky')
962
+ return runFlaky(rest);
963
+ if (command === 'failures')
964
+ return runFailures(rest);
965
+ if (command === 'coverage')
966
+ return runCoverage(rest);
967
+ if (command === 'standards') {
968
+ const { runStandards } = await import('./standards.js');
969
+ return runStandards(rest, findProjectRoot());
970
+ }
971
+ if (command === 'mcp-setup') {
972
+ const { runMcpSetup } = await import('./mcp-setup.js');
973
+ return runMcpSetup(rest);
974
+ }
975
+ if (command === 'doctor') {
976
+ const { runDoctor } = await import('./doctor.js');
977
+ return runDoctor(rest);
978
+ }
979
+ if (command === 'env') {
980
+ const { runEnv } = await import('./env.js');
981
+ return runEnv(rest);
982
+ }
983
+ if (command === 'fixture') {
984
+ const { runFixture } = await import('./fixture.js');
985
+ return runFixture(rest);
986
+ }
987
+ if (command === 'organize')
988
+ return runOrganize(rest);
989
+ if (command === 'auth-setup')
990
+ return runAuthSetup(rest);
991
+ if (command === 'generate') {
992
+ const { runGenerate } = await import('./generate.js');
993
+ return runGenerate(rest);
994
+ }
995
+ if (command !== 'init') {
996
+ console.log(HELP);
997
+ return command === undefined || command === '--help' || command === 'help' ? 0 : 2;
998
+ }
999
+ const targetDir = path.resolve(rest[0] || '.');
1000
+ const isCurrentDir = targetDir === process.cwd();
1001
+ const s = styleFor();
1002
+ console.log(` ${s.bold('Initializing project')} in ${s.cyan(isCurrentDir ? '.' : path.relative(process.cwd(), targetDir))}`);
1003
+ console.log('');
1004
+ initProject(targetDir, console.log, process.env);
1005
+ return 0;
1006
+ }
1007
+ /** Runs `main` and turns prompt errors into exit codes: 2 with no terminal, 130 when cancelled. */
1008
+ export async function runCli(argv = process.argv.slice(2)) {
1009
+ try {
1010
+ return await main(argv);
1011
+ }
1012
+ catch (error) {
1013
+ if (error instanceof NotInteractiveError) {
1014
+ console.error(` ${styleFor(process.stderr).red('✖')} ${error.message}`);
1015
+ return 2;
1016
+ }
1017
+ if (error instanceof PromptCancelledError)
1018
+ return 130; // the prompt already says "cancelled"
1019
+ throw error;
1020
+ }
1021
+ }
1022
+ // Run only when executed as the `propmaster` bin (or via tsx), not when the
1023
+ // `@inluxc/propmaster/cli` export is imported for its checker API.
1024
+ function isEntryPoint() {
1025
+ if (!process.argv[1])
1026
+ return false;
1027
+ try {
1028
+ return import.meta.url === pathToFileURL(fs.realpathSync(process.argv[1])).href;
1029
+ }
1030
+ catch {
1031
+ return false;
1032
+ }
1033
+ }
1034
+ if (isEntryPoint()) {
1035
+ void runCli().then((code) => {
1036
+ process.exitCode = code;
1037
+ });
1038
+ }
1039
+ //# sourceMappingURL=init.js.map