@autoview/cli 0.1.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 (297) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +407 -0
  3. package/lib/AutoViewAgent.d.ts +109 -0
  4. package/lib/AutoViewAgent.js +123 -0
  5. package/lib/AutoViewAgent.js.map +1 -0
  6. package/lib/agent/emitMcpServer.d.ts +15 -0
  7. package/lib/agent/emitMcpServer.js +157 -0
  8. package/lib/agent/emitMcpServer.js.map +1 -0
  9. package/lib/agent/emitReport.d.ts +14 -0
  10. package/lib/agent/emitReport.js +85 -0
  11. package/lib/agent/emitReport.js.map +1 -0
  12. package/lib/agent/toolSurface.d.ts +130 -0
  13. package/lib/agent/toolSurface.js +342 -0
  14. package/lib/agent/toolSurface.js.map +1 -0
  15. package/lib/agent/verifyAgentTasks.d.ts +87 -0
  16. package/lib/agent/verifyAgentTasks.js +126 -0
  17. package/lib/agent/verifyAgentTasks.js.map +1 -0
  18. package/lib/cli/main.d.ts +2 -0
  19. package/lib/cli/main.js +295 -0
  20. package/lib/cli/main.js.map +1 -0
  21. package/lib/compiler/AutoViewInterfaceCompiler.d.ts +27 -0
  22. package/lib/compiler/AutoViewInterfaceCompiler.js +68 -0
  23. package/lib/compiler/AutoViewInterfaceCompiler.js.map +1 -0
  24. package/lib/constants/AutoViewFrontendTemplate.d.ts +1 -0
  25. package/lib/constants/AutoViewFrontendTemplate.js +46 -0
  26. package/lib/constants/AutoViewFrontendTemplate.js.map +1 -0
  27. package/lib/constants/AutoViewSystemPromptConstant.d.ts +5 -0
  28. package/lib/constants/AutoViewSystemPromptConstant.js +4 -0
  29. package/lib/constants/AutoViewSystemPromptConstant.js.map +1 -0
  30. package/lib/context/IAutoViewAgentContext.d.ts +60 -0
  31. package/lib/context/IAutoViewAgentContext.js +3 -0
  32. package/lib/context/IAutoViewAgentContext.js.map +1 -0
  33. package/lib/fromSwagger.d.ts +53 -0
  34. package/lib/fromSwagger.js +513 -0
  35. package/lib/fromSwagger.js.map +1 -0
  36. package/lib/generateDeterministic.d.ts +26 -0
  37. package/lib/generateDeterministic.js +75 -0
  38. package/lib/generateDeterministic.js.map +1 -0
  39. package/lib/index.d.ts +15 -0
  40. package/lib/index.js +41 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/orchestrate/orchestrateAutoView.d.ts +17 -0
  43. package/lib/orchestrate/orchestrateAutoView.js +491 -0
  44. package/lib/orchestrate/orchestrateAutoView.js.map +1 -0
  45. package/lib/orchestrate/orchestrateAutoViewProductPlan.d.ts +37 -0
  46. package/lib/orchestrate/orchestrateAutoViewProductPlan.js +109 -0
  47. package/lib/orchestrate/orchestrateAutoViewProductPlan.js.map +1 -0
  48. package/lib/orchestrate/orchestrateAutoViewRender.d.ts +133 -0
  49. package/lib/orchestrate/orchestrateAutoViewRender.js +943 -0
  50. package/lib/orchestrate/orchestrateAutoViewRender.js.map +1 -0
  51. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.d.ts +24 -0
  52. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js +92 -0
  53. package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js.map +1 -0
  54. package/lib/orchestrate/orchestrateAutoViewReview.d.ts +48 -0
  55. package/lib/orchestrate/orchestrateAutoViewReview.js +328 -0
  56. package/lib/orchestrate/orchestrateAutoViewReview.js.map +1 -0
  57. package/lib/orchestrate/orchestrateAutoViewScaffold.d.ts +45 -0
  58. package/lib/orchestrate/orchestrateAutoViewScaffold.js +586 -0
  59. package/lib/orchestrate/orchestrateAutoViewScaffold.js.map +1 -0
  60. package/lib/orchestrate/orchestrateAutoViewSdkStudy.d.ts +26 -0
  61. package/lib/orchestrate/orchestrateAutoViewSdkStudy.js +85 -0
  62. package/lib/orchestrate/orchestrateAutoViewSdkStudy.js.map +1 -0
  63. package/lib/orchestrate/structures/IAutoViewProductPlan.d.ts +96 -0
  64. package/lib/orchestrate/structures/IAutoViewProductPlan.js +3 -0
  65. package/lib/orchestrate/structures/IAutoViewProductPlan.js.map +1 -0
  66. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.d.ts +38 -0
  67. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js +3 -0
  68. package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js.map +1 -0
  69. package/lib/orchestrate/structures/IAutoViewRenderApplication.d.ts +38 -0
  70. package/lib/orchestrate/structures/IAutoViewRenderApplication.js +3 -0
  71. package/lib/orchestrate/structures/IAutoViewRenderApplication.js.map +1 -0
  72. package/lib/orchestrate/structures/IAutoViewReviewApplication.d.ts +40 -0
  73. package/lib/orchestrate/structures/IAutoViewReviewApplication.js +3 -0
  74. package/lib/orchestrate/structures/IAutoViewReviewApplication.js.map +1 -0
  75. package/lib/orchestrate/structures/IAutoViewSdkMap.d.ts +63 -0
  76. package/lib/orchestrate/structures/IAutoViewSdkMap.js +3 -0
  77. package/lib/orchestrate/structures/IAutoViewSdkMap.js.map +1 -0
  78. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.d.ts +37 -0
  79. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js +3 -0
  80. package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js.map +1 -0
  81. package/lib/orchestrate/utils/HistoryMessage.d.ts +10 -0
  82. package/lib/orchestrate/utils/HistoryMessage.js +25 -0
  83. package/lib/orchestrate/utils/HistoryMessage.js.map +1 -0
  84. package/lib/orchestrate/utils/auditFrontendRuntime.d.ts +53 -0
  85. package/lib/orchestrate/utils/auditFrontendRuntime.js +362 -0
  86. package/lib/orchestrate/utils/auditFrontendRuntime.js.map +1 -0
  87. package/lib/orchestrate/utils/buildDeterministicPlan.d.ts +4 -0
  88. package/lib/orchestrate/utils/buildDeterministicPlan.js +233 -0
  89. package/lib/orchestrate/utils/buildDeterministicPlan.js.map +1 -0
  90. package/lib/orchestrate/utils/buildDeterministicSdkMap.d.ts +22 -0
  91. package/lib/orchestrate/utils/buildDeterministicSdkMap.js +154 -0
  92. package/lib/orchestrate/utils/buildDeterministicSdkMap.js.map +1 -0
  93. package/lib/orchestrate/utils/cacheNodeModules.d.ts +31 -0
  94. package/lib/orchestrate/utils/cacheNodeModules.js +134 -0
  95. package/lib/orchestrate/utils/cacheNodeModules.js.map +1 -0
  96. package/lib/orchestrate/utils/describeEndpointPropsShape.d.ts +37 -0
  97. package/lib/orchestrate/utils/describeEndpointPropsShape.js +192 -0
  98. package/lib/orchestrate/utils/describeEndpointPropsShape.js.map +1 -0
  99. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.d.ts +22 -0
  100. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js +29 -0
  101. package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js.map +1 -0
  102. package/lib/orchestrate/utils/describeEndpointResponseShape.d.ts +19 -0
  103. package/lib/orchestrate/utils/describeEndpointResponseShape.js +30 -0
  104. package/lib/orchestrate/utils/describeEndpointResponseShape.js.map +1 -0
  105. package/lib/orchestrate/utils/executeCachedBatch.d.ts +22 -0
  106. package/lib/orchestrate/utils/executeCachedBatch.js +64 -0
  107. package/lib/orchestrate/utils/executeCachedBatch.js.map +1 -0
  108. package/lib/orchestrate/utils/loadShoppingFixture.d.ts +33 -0
  109. package/lib/orchestrate/utils/loadShoppingFixture.js +17 -0
  110. package/lib/orchestrate/utils/loadShoppingFixture.js.map +1 -0
  111. package/lib/orchestrate/utils/normalizeProductPlanPaths.d.ts +24 -0
  112. package/lib/orchestrate/utils/normalizeProductPlanPaths.js +77 -0
  113. package/lib/orchestrate/utils/normalizeProductPlanPaths.js.map +1 -0
  114. package/lib/orchestrate/utils/renderJsonSchema.d.ts +23 -0
  115. package/lib/orchestrate/utils/renderJsonSchema.js +122 -0
  116. package/lib/orchestrate/utils/renderJsonSchema.js.map +1 -0
  117. package/lib/orchestrate/utils/renderResourcePage.d.ts +36 -0
  118. package/lib/orchestrate/utils/renderResourcePage.js +1415 -0
  119. package/lib/orchestrate/utils/renderResourcePage.js.map +1 -0
  120. package/lib/orchestrate/utils/validateFrontendTypecheck.d.ts +109 -0
  121. package/lib/orchestrate/utils/validateFrontendTypecheck.js +274 -0
  122. package/lib/orchestrate/utils/validateFrontendTypecheck.js.map +1 -0
  123. package/lib/preview/renderPreview.d.ts +22 -0
  124. package/lib/preview/renderPreview.js +198 -0
  125. package/lib/preview/renderPreview.js.map +1 -0
  126. package/lib/typings/compiler.d.ts +39 -0
  127. package/lib/typings/compiler.js +3 -0
  128. package/lib/typings/compiler.js.map +1 -0
  129. package/lib/typings/events.d.ts +106 -0
  130. package/lib/typings/events.js +3 -0
  131. package/lib/typings/events.js.map +1 -0
  132. package/lib/typings/index.d.ts +10 -0
  133. package/lib/typings/index.js +27 -0
  134. package/lib/typings/index.js.map +1 -0
  135. package/lib/typings/misc.d.ts +78 -0
  136. package/lib/typings/misc.js +3 -0
  137. package/lib/typings/misc.js.map +1 -0
  138. package/lib/utils/ArrayUtil.d.ts +8 -0
  139. package/lib/utils/ArrayUtil.js +30 -0
  140. package/lib/utils/ArrayUtil.js.map +1 -0
  141. package/lib/utils/StringUtil.d.ts +11 -0
  142. package/lib/utils/StringUtil.js +28 -0
  143. package/lib/utils/StringUtil.js.map +1 -0
  144. package/lib/utils/classifyEndpoints.d.ts +62 -0
  145. package/lib/utils/classifyEndpoints.js +216 -0
  146. package/lib/utils/classifyEndpoints.js.map +1 -0
  147. package/lib/utils/endpointFilter.d.ts +26 -0
  148. package/lib/utils/endpointFilter.js +0 -0
  149. package/lib/utils/endpointFilter.js.map +1 -0
  150. package/lib/utils/extractFields.d.ts +85 -0
  151. package/lib/utils/extractFields.js +231 -0
  152. package/lib/utils/extractFields.js.map +1 -0
  153. package/lib/utils/index.d.ts +13 -0
  154. package/lib/utils/index.js +30 -0
  155. package/lib/utils/index.js.map +1 -0
  156. package/lib/utils/normalizeForNestia.d.ts +34 -0
  157. package/lib/utils/normalizeForNestia.js +133 -0
  158. package/lib/utils/normalizeForNestia.js.map +1 -0
  159. package/lib/utils/resourcePlan.d.ts +39 -0
  160. package/lib/utils/resourcePlan.js +95 -0
  161. package/lib/utils/resourcePlan.js.map +1 -0
  162. package/lib/utils/sliceDocument.d.ts +17 -0
  163. package/lib/utils/sliceDocument.js +114 -0
  164. package/lib/utils/sliceDocument.js.map +1 -0
  165. package/lib/utils/toEndpoints.d.ts +90 -0
  166. package/lib/utils/toEndpoints.js +227 -0
  167. package/lib/utils/toEndpoints.js.map +1 -0
  168. package/lib/verify/runWorkflows.d.ts +25 -0
  169. package/lib/verify/runWorkflows.js +366 -0
  170. package/lib/verify/runWorkflows.js.map +1 -0
  171. package/lib/verify/workflows.d.ts +53 -0
  172. package/lib/verify/workflows.js +107 -0
  173. package/lib/verify/workflows.js.map +1 -0
  174. package/package.json +82 -0
  175. package/prompts/AUTOVIEW_RENDER.md +398 -0
  176. package/prompts/AUTOVIEW_REVIEW.md +60 -0
  177. package/prompts/AUTOVIEW_SDK_STUDY.md +89 -0
  178. package/src/AutoViewAgent.ts +222 -0
  179. package/src/agent/emitMcpServer.integration.test.ts +168 -0
  180. package/src/agent/emitMcpServer.test.ts +51 -0
  181. package/src/agent/emitMcpServer.ts +178 -0
  182. package/src/agent/emitReport.ts +117 -0
  183. package/src/agent/toolSurface.test.ts +243 -0
  184. package/src/agent/toolSurface.ts +501 -0
  185. package/src/agent/verifyAgentTasks.test.ts +106 -0
  186. package/src/agent/verifyAgentTasks.ts +171 -0
  187. package/src/cli/main.ts +363 -0
  188. package/src/compiler/AutoViewInterfaceCompiler.ts +69 -0
  189. package/src/constants/AutoViewFrontendTemplate.ts +42 -0
  190. package/src/constants/AutoViewSystemPromptConstant.ts +6 -0
  191. package/src/context/IAutoViewAgentContext.ts +84 -0
  192. package/src/fromSwagger.test.ts +269 -0
  193. package/src/fromSwagger.ts +500 -0
  194. package/src/generateDeterministic.test.ts +39 -0
  195. package/src/generateDeterministic.ts +77 -0
  196. package/src/index.ts +30 -0
  197. package/src/orchestrate/orchestrateAutoView.ts +590 -0
  198. package/src/orchestrate/orchestrateAutoViewProductPlan.ts +121 -0
  199. package/src/orchestrate/orchestrateAutoViewRender.ts +1117 -0
  200. package/src/orchestrate/orchestrateAutoViewRenderDeterministic.ts +101 -0
  201. package/src/orchestrate/orchestrateAutoViewReview.ts +272 -0
  202. package/src/orchestrate/orchestrateAutoViewScaffold.ts +627 -0
  203. package/src/orchestrate/orchestrateAutoViewSdkStudy.ts +90 -0
  204. package/src/orchestrate/renderNavTs.test.ts +74 -0
  205. package/src/orchestrate/structures/IAutoViewProductPlan.ts +119 -0
  206. package/src/orchestrate/structures/IAutoViewProductPlanApplication.ts +41 -0
  207. package/src/orchestrate/structures/IAutoViewRenderApplication.ts +40 -0
  208. package/src/orchestrate/structures/IAutoViewReviewApplication.ts +42 -0
  209. package/src/orchestrate/structures/IAutoViewSdkMap.ts +72 -0
  210. package/src/orchestrate/structures/IAutoViewSdkStudyApplication.ts +40 -0
  211. package/src/orchestrate/utils/HistoryMessage.ts +41 -0
  212. package/src/orchestrate/utils/auditFrontendRuntime.test.ts +18 -0
  213. package/src/orchestrate/utils/auditFrontendRuntime.ts +454 -0
  214. package/src/orchestrate/utils/buildDeterministicPlan.test.ts +170 -0
  215. package/src/orchestrate/utils/buildDeterministicPlan.ts +289 -0
  216. package/src/orchestrate/utils/buildDeterministicSdkMap.test.ts +90 -0
  217. package/src/orchestrate/utils/buildDeterministicSdkMap.ts +169 -0
  218. package/src/orchestrate/utils/cacheNodeModules.ts +136 -0
  219. package/src/orchestrate/utils/describeEndpointPropsShape.test.ts +86 -0
  220. package/src/orchestrate/utils/describeEndpointPropsShape.ts +202 -0
  221. package/src/orchestrate/utils/describeEndpointRequestBodyShape.test.ts +87 -0
  222. package/src/orchestrate/utils/describeEndpointRequestBodyShape.ts +31 -0
  223. package/src/orchestrate/utils/describeEndpointResponseShape.test.ts +70 -0
  224. package/src/orchestrate/utils/describeEndpointResponseShape.ts +32 -0
  225. package/src/orchestrate/utils/executeCachedBatch.ts +59 -0
  226. package/src/orchestrate/utils/loadShoppingFixture.ts +52 -0
  227. package/src/orchestrate/utils/normalizeProductPlanPaths.ts +92 -0
  228. package/src/orchestrate/utils/renderJsonSchema.test.ts +162 -0
  229. package/src/orchestrate/utils/renderJsonSchema.ts +133 -0
  230. package/src/orchestrate/utils/renderResourcePage.test.ts +468 -0
  231. package/src/orchestrate/utils/renderResourcePage.ts +1624 -0
  232. package/src/orchestrate/utils/validateFrontendTypecheck.test.ts +32 -0
  233. package/src/orchestrate/utils/validateFrontendTypecheck.ts +335 -0
  234. package/src/preview/renderPreview.ts +273 -0
  235. package/src/typings/compiler.ts +47 -0
  236. package/src/typings/events.ts +155 -0
  237. package/src/typings/index.ts +10 -0
  238. package/src/typings/misc.ts +93 -0
  239. package/src/utils/ArrayUtil.ts +16 -0
  240. package/src/utils/StringUtil.ts +29 -0
  241. package/src/utils/classifyEndpoints.test.ts +86 -0
  242. package/src/utils/classifyEndpoints.ts +291 -0
  243. package/src/utils/endpointFilter.test.ts +50 -0
  244. package/src/utils/endpointFilter.ts +0 -0
  245. package/src/utils/extractFields.test.ts +82 -0
  246. package/src/utils/extractFields.ts +306 -0
  247. package/src/utils/index.ts +13 -0
  248. package/src/utils/normalizeForNestia.test.ts +93 -0
  249. package/src/utils/normalizeForNestia.ts +139 -0
  250. package/src/utils/resourcePlan.test.ts +104 -0
  251. package/src/utils/resourcePlan.ts +180 -0
  252. package/src/utils/sliceDocument.test.ts +85 -0
  253. package/src/utils/sliceDocument.ts +119 -0
  254. package/src/utils/toEndpoints.test.ts +251 -0
  255. package/src/utils/toEndpoints.ts +343 -0
  256. package/src/verify/runWorkflows.ts +403 -0
  257. package/src/verify/workflows.test.ts +117 -0
  258. package/src/verify/workflows.ts +154 -0
  259. package/template/CLAUDE.md +140 -0
  260. package/template/Dockerfile +31 -0
  261. package/template/PROMPT.md +80 -0
  262. package/template/SANDBOX.md +70 -0
  263. package/template/app/api/health/route.ts +10 -0
  264. package/template/app/globals.css +97 -0
  265. package/template/app/layout.tsx +30 -0
  266. package/template/app/page.tsx +19 -0
  267. package/template/components/AppShell.tsx +114 -0
  268. package/template/components/auto/CatalogGrid.tsx +159 -0
  269. package/template/components/auto/ConfirmButton.tsx +67 -0
  270. package/template/components/auto/EmbeddedCollection.tsx +144 -0
  271. package/template/components/auto/ResourceDashboard.tsx +104 -0
  272. package/template/components/auto/ResourceDetail.tsx +93 -0
  273. package/template/components/auto/ResourceForm.tsx +235 -0
  274. package/template/components/auto/ResourceIcon.tsx +88 -0
  275. package/template/components/auto/ResourceLanding.tsx +155 -0
  276. package/template/components/auto/ResourceTable.tsx +223 -0
  277. package/template/components/auto/formatValue.tsx +186 -0
  278. package/template/components/auto/types.ts +42 -0
  279. package/template/components/ui/badge.tsx +40 -0
  280. package/template/components/ui/button.tsx +57 -0
  281. package/template/components/ui/card.tsx +86 -0
  282. package/template/components/ui/dialog.tsx +119 -0
  283. package/template/components/ui/input.tsx +23 -0
  284. package/template/components/ui/label.tsx +24 -0
  285. package/template/components/ui/pagination.tsx +117 -0
  286. package/template/components/ui/select.tsx +92 -0
  287. package/template/components/ui/sheet.tsx +135 -0
  288. package/template/components/ui/skeleton.tsx +15 -0
  289. package/template/components/ui/table.tsx +120 -0
  290. package/template/components/ui/tabs.tsx +55 -0
  291. package/template/lib/utils.ts +35 -0
  292. package/template/next.config.mjs +52 -0
  293. package/template/package.json +46 -0
  294. package/template/postcss.config.js +6 -0
  295. package/template/scripts/start-shopping-backend.sh +56 -0
  296. package/template/tailwind.config.ts +96 -0
  297. package/template/tsconfig.json +29 -0
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRenderableAccessor = isRenderableAccessor;
4
+ exports.toEndpoints = toEndpoints;
5
+ exports.unsupportedOperations = unsupportedOperations;
6
+ const utils_1 = require("@typia/utils");
7
+ const normalizeForNestia_1 = require("./normalizeForNestia");
8
+ /**
9
+ * Convert a standard OpenAPI document into AutoView's endpoint list — every
10
+ * operation, query endpoints included.
11
+ */
12
+ /** A segment usable as a JS property in `api.functional.<seg>`. */
13
+ const JS_IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
14
+ /**
15
+ * True when every accessor segment is a valid JS identifier, so the generator
16
+ * can emit `api.functional.<a>.<b>(…)`. Some real swaggers (Box) use `#`
17
+ * fragments in their paths (`/shared_items#folders`, `/schema#add`), which
18
+ * nestia turns into accessor segments containing `#` — unusable as a dotted
19
+ * property and a hard syntax error in the generated TSX. Such operations are
20
+ * dropped from {@link toEndpoints} and surfaced by {@link unsupportedOperations}.
21
+ */
22
+ function isRenderableAccessor(accessor) {
23
+ return accessor.length > 0 && accessor.every((s) => JS_IDENT.test(s));
24
+ }
25
+ function toEndpoints(document) {
26
+ const app = utils_1.HttpMigration.application((0, normalizeForNestia_1.normalizeForNestia)(document));
27
+ return app.routes
28
+ .filter((r) => isRenderableAccessor(r.accessor))
29
+ .map((r) => {
30
+ var _a, _b, _c;
31
+ const body = resolveBody(r.body);
32
+ const successPart = pickSuccess(r);
33
+ const success = resolveBody(successPart);
34
+ // Read description and query from the UNTOUCHED original operation, not the
35
+ // relaxed one HttpMigration saw — the relaxed copy may have shed some object
36
+ // query params just to let the route compose (see normalizeForNestia).
37
+ const operation = (_a = originalOperation(document, r.method, r.path)) !== null && _a !== void 0 ? _a : r.operation();
38
+ return {
39
+ method: r.method,
40
+ path: r.path,
41
+ accessor: r.accessor,
42
+ name: (_b = r.accessor.at(-1)) !== null && _b !== void 0 ? _b : r.path,
43
+ description: (_c = writeDescription(operation)) !== null && _c !== void 0 ? _c : "",
44
+ parameters: r.parameters.map((p) => {
45
+ var _a;
46
+ return ({
47
+ name: p.key,
48
+ description: (_a = p.parameter().description) !== null && _a !== void 0 ? _a : "",
49
+ // biome-ignore lint: structurally an OpenAPI schema, reused as-is
50
+ schema: p.schema,
51
+ });
52
+ }),
53
+ query: buildQuerySchema(operation, document),
54
+ requestBody: body,
55
+ responseBody: success,
56
+ responseSchema: successPart
57
+ ? // biome-ignore lint: structurally an OpenAPI schema, reused as-is
58
+ successPart.schema
59
+ : null,
60
+ };
61
+ });
62
+ }
63
+ /** Look up the source operation in the original document by method + path. */
64
+ function originalOperation(document, method, path) {
65
+ var _a;
66
+ const item = ((_a = document.paths) !== null && _a !== void 0 ? _a : {})[path];
67
+ return item === null || item === void 0 ? void 0 : item[method];
68
+ }
69
+ /**
70
+ * Build the query-object schema from the raw operation's `in: query`
71
+ * parameters, as an INLINE object (`{ type, properties, required }`).
72
+ *
73
+ * nestia's `route.query.schema` is a `$ref` to a synthetic `*.GetQuery` type
74
+ * that is registered in NEITHER the original document NOR the migration's own
75
+ * document — a dead reference. Resolving it yields nothing, so a list call's
76
+ * defaults came out empty (`query: {}`) and the server 400'd on a required
77
+ * param (petstore's `status`). Reconstructing the schema from the source
78
+ * parameters keeps it inline and resolvable by every consumer, and preserves
79
+ * each param's `required` flag, `enum`, and `default`.
80
+ */
81
+ function buildQuerySchema(operation, document) {
82
+ var _a, _b;
83
+ const raw = (_a = operation === null || operation === void 0 ? void 0 : operation.parameters) !== null && _a !== void 0 ? _a : [];
84
+ const properties = {};
85
+ const required = [];
86
+ for (const entry of raw) {
87
+ const p = derefParameter(entry, document);
88
+ if (p === undefined || p.in !== "query")
89
+ continue;
90
+ properties[p.name] = (_b = p.schema) !== null && _b !== void 0 ? _b : {};
91
+ if (p.required === true)
92
+ required.push(p.name);
93
+ }
94
+ if (Object.keys(properties).length === 0)
95
+ return null;
96
+ // biome-ignore lint: structurally an OpenAPI object schema
97
+ return { type: "object", properties, required };
98
+ }
99
+ /** Resolve a `$ref` parameter against `components.parameters`; pass others through. */
100
+ function derefParameter(entry, document) {
101
+ var _a;
102
+ if (entry !== null && typeof entry === "object" && "$ref" in entry) {
103
+ const ref = entry.$ref;
104
+ if (typeof ref !== "string")
105
+ return undefined;
106
+ const name = ref.split("/").pop();
107
+ const params = (_a = document.components) === null || _a === void 0 ? void 0 : _a.parameters;
108
+ const target = name !== undefined ? params === null || params === void 0 ? void 0 : params[name] : undefined;
109
+ return target;
110
+ }
111
+ return entry;
112
+ }
113
+ /** 2xx status codes whose JSON body is the success payload, in preference order. */
114
+ const SUCCESS_CODES = ["200", "201", "202", "203", "206"];
115
+ /**
116
+ * Pick the real success-response body for a route.
117
+ *
118
+ * nestia's `HttpMigration` only recognizes `200`/`201` as success; when an
119
+ * operation's only 2xx is `202 Accepted` (a body that exists — e.g. Box's
120
+ * `POST /zip_downloads` → `ZipDownload`) or `204 No Content`, it falls back to
121
+ * the `default` response, which is almost always the ERROR schema
122
+ * (`ClientError`). Trusting that makes a screen render error fields (`code`,
123
+ * `message`, `request_id`) as columns and breaks producer tracing.
124
+ *
125
+ * So we trust `route.success` only when its status is genuinely 2xx; otherwise
126
+ * we re-pick from the raw operation's 2xx responses ourselves. A `204` (or any
127
+ * 2xx with no JSON body) correctly yields `null` — no body, not an error body.
128
+ *
129
+ * Trusting nestia when it IS 2xx matters: nestia promotes an inline success body
130
+ * into a named component (`IApiItems.PostResponse`), which the re-pick path (raw
131
+ * inline object, no `$ref`) cannot reproduce. The status it reports is a STRING
132
+ * (`"201"`, `"default"`), so we parse it numerically.
133
+ */
134
+ function pickSuccess(route) {
135
+ var _a, _b, _c, _d, _e, _f;
136
+ const status = Number((_a = route.success) === null || _a === void 0 ? void 0 : _a.status);
137
+ if (Number.isInteger(status) && status >= 200 && status < 300) {
138
+ return (_b = route.success) !== null && _b !== void 0 ? _b : null;
139
+ }
140
+ const responses = (_d = (_c = route.operation()) === null || _c === void 0 ? void 0 : _c.responses) !== null && _d !== void 0 ? _d : {};
141
+ for (const code of SUCCESS_CODES) {
142
+ const response = responses[code];
143
+ const schema = (_f = (_e = response === null || response === void 0 ? void 0 : response.content) === null || _e === void 0 ? void 0 : _e["application/json"]) === null || _f === void 0 ? void 0 : _f.schema;
144
+ if (schema !== undefined) {
145
+ return {
146
+ type: "application/json",
147
+ schema: schema,
148
+ description: () => response === null || response === void 0 ? void 0 : response.description,
149
+ };
150
+ }
151
+ }
152
+ return null; // 204 / no JSON body — a genuine empty response, not an error
153
+ }
154
+ function unsupportedOperations(document) {
155
+ var _a;
156
+ // Same relaxation as toEndpoints, so multi-object-query routes that now
157
+ // compose are not double-counted here as "dropped".
158
+ const app = utils_1.HttpMigration.application((0, normalizeForNestia_1.normalizeForNestia)(document));
159
+ const fromErrors = ((_a = app.errors) !== null && _a !== void 0 ? _a : []).map((e) => {
160
+ var _a, _b;
161
+ const messages = Array.isArray(e.messages) ? e.messages : [];
162
+ return {
163
+ method: ((_a = e.method) !== null && _a !== void 0 ? _a : "?").toString().toUpperCase(),
164
+ path: (_b = e.path) !== null && _b !== void 0 ? _b : "?",
165
+ reason: messages.join("; ") || "unsupported operation",
166
+ };
167
+ });
168
+ // Routes whose accessor is not a valid JS identifier chain (path fragments
169
+ // like `/shared_items#folders`) are dropped by `toEndpoints` — report them so
170
+ // nothing vanishes silently.
171
+ const fromAccessors = app.routes
172
+ .filter((r) => !isRenderableAccessor(r.accessor))
173
+ .map((r) => ({
174
+ method: r.method.toUpperCase(),
175
+ path: r.path,
176
+ reason: `Accessor contains a non-identifier segment (${r.accessor.join(".")}) — cannot generate a typed SDK call.`,
177
+ }));
178
+ return [...fromErrors, ...fromAccessors];
179
+ }
180
+ /**
181
+ * Resolve a request/response body part into the element type + array flag.
182
+ * Handles both a named reference (`{ $ref: Pet }` → `Pet`, single) and an
183
+ * array of references (`{ type: array, items: { $ref: Pet } }` → `Pet`,
184
+ * isArray) — the latter is the list-response shape the old code dropped,
185
+ * leaving table screens with no deterministic column source.
186
+ */
187
+ function resolveBody(part) {
188
+ var _a, _b;
189
+ if (!part || part.type !== "application/json")
190
+ return null;
191
+ const schema = part.schema;
192
+ if (utils_1.OpenApiTypeChecker.isReference(schema)) {
193
+ return {
194
+ description: (_a = part.description()) !== null && _a !== void 0 ? _a : "",
195
+ typeName: refName(schema.$ref),
196
+ isArray: false,
197
+ };
198
+ }
199
+ if (utils_1.OpenApiTypeChecker.isArray(schema)) {
200
+ const items = schema.items;
201
+ if (utils_1.OpenApiTypeChecker.isReference(items)) {
202
+ return {
203
+ description: (_b = part.description()) !== null && _b !== void 0 ? _b : "",
204
+ typeName: refName(items.$ref),
205
+ isArray: true,
206
+ };
207
+ }
208
+ }
209
+ return null;
210
+ }
211
+ function refName($ref) {
212
+ return $ref.split("/").pop();
213
+ }
214
+ function writeDescription(operation) {
215
+ if (operation === undefined)
216
+ return undefined;
217
+ if (operation.summary === undefined && operation.description === undefined)
218
+ return undefined;
219
+ if (operation.summary === undefined)
220
+ return operation.description;
221
+ if (operation.description === undefined)
222
+ return operation.summary;
223
+ if (operation.description.startsWith(operation.summary))
224
+ return operation.description;
225
+ return `${operation.summary}${operation.summary.endsWith(".") ? "" : "."}\n\n${operation.description}`;
226
+ }
227
+ //# sourceMappingURL=toEndpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toEndpoints.js","sourceRoot":"","sources":["../../src/utils/toEndpoints.ts"],"names":[],"mappings":";;AA+FA,oDAEC;AAED,kCAiCC;AAkID,sDAyBC;AA9RD,wCAAiE;AAEjE,6DAA0D;AA6E1D;;;GAGG;AACH,mEAAmE;AACnE,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAE9C;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAAC,QAAkB;IACrD,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAgB,WAAW,CAAC,QAA2B;IACrD,MAAM,GAAG,GAAG,qBAAa,CAAC,WAAW,CAAC,IAAA,uCAAkB,EAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO,GAAG,CAAC,MAAM;SACd,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,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G,CAAC;AAChC,CAAC;AAED,SAAS,gBAAgB,CACvB,SAAyC;IAEzC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,SAAS,CAAC,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS;QACxE,OAAO,SAAS,CAAC;IACnB,IAAI,SAAS,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC,WAAW,CAAC;IAClE,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC,OAAO,CAAC;IAClE,IAAI,SAAS,CAAC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC;QACrD,OAAO,SAAS,CAAC,WAAW,CAAC;IAC/B,OAAO,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC;AACzG,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { IWorkflow } from "./workflows";
2
+ export interface IWorkflowStepResult {
3
+ label: string;
4
+ expect: string;
5
+ ok: boolean;
6
+ /** What was found — evidence for the report (row count, error text, …). */
7
+ detail: string;
8
+ }
9
+ export interface IWorkflowResult {
10
+ id: string;
11
+ title: string;
12
+ resource: string;
13
+ ok: boolean;
14
+ steps: IWorkflowStepResult[];
15
+ }
16
+ export interface IRunWorkflowsResult {
17
+ workflows: IWorkflowResult[];
18
+ /** workflows that passed every step. */
19
+ passed: number;
20
+ /** workflows with at least one failing step. */
21
+ failed: number;
22
+ markdown: string;
23
+ elapsedMs: number;
24
+ }
25
+ export declare function runWorkflows(files: Record<string, string>, workflows: IWorkflow[]): Promise<IRunWorkflowsResult>;
@@ -0,0 +1,366 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.runWorkflows = runWorkflows;
16
+ const child_process_1 = require("child_process");
17
+ const crypto_1 = require("crypto");
18
+ const promises_1 = __importDefault(require("fs/promises"));
19
+ const net_1 = require("net");
20
+ const os_1 = __importDefault(require("os"));
21
+ const path_1 = __importDefault(require("path"));
22
+ const cacheNodeModules_1 = require("../orchestrate/utils/cacheNodeModules");
23
+ /**
24
+ * Verification execution layer — drive the derived user workflows in a real
25
+ * headless browser and report, per step, whether the expected outcome actually
26
+ * happened (data rendered, navigation moved), not merely that nothing errored.
27
+ *
28
+ * Boots the assembled frontend under `next dev` in simulator mode (no live
29
+ * backend needed — the SDK serves typia-random data so every render path runs),
30
+ * launches Chromium via Playwright, and walks each workflow's steps with
31
+ * positive DOM assertions. Returns a structured report the operator (or a fix
32
+ * loop) reads to know exactly which journey/step failed and why.
33
+ */
34
+ const PLAYWRIGHT_DEP = "playwright@^1.50.0";
35
+ const NEXT_DEV_BOOT_TIMEOUT_MS = 120000;
36
+ function runWorkflows(files, workflows) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const startedAt = Date.now();
39
+ const tempDir = yield promises_1.default.mkdtemp(path_1.default.join(os_1.default.tmpdir(), "autoview-verify-"));
40
+ let nextDev = null;
41
+ try {
42
+ yield writeFiles(tempDir, files);
43
+ yield installEverything(tempDir, files["package.json"]);
44
+ const port = yield getFreePort();
45
+ nextDev = yield startNextDev(tempDir, port);
46
+ const baseUrl = `http://127.0.0.1:${port}`;
47
+ yield writeFile(tempDir, "scripts/.verify-runner.cjs", buildRunnerScript());
48
+ const stdout = yield spawnCommand("node", [
49
+ path_1.default.join(tempDir, "scripts", ".verify-runner.cjs"),
50
+ JSON.stringify(workflows),
51
+ baseUrl,
52
+ ], { cwd: tempDir });
53
+ const results = parseResults(stdout, workflows);
54
+ const passed = results.filter((w) => w.ok).length;
55
+ return {
56
+ workflows: results,
57
+ passed,
58
+ failed: results.length - passed,
59
+ markdown: renderMarkdown(results),
60
+ elapsedMs: Date.now() - startedAt,
61
+ };
62
+ }
63
+ finally {
64
+ if (nextDev !== null)
65
+ yield killNextDev(nextDev);
66
+ yield promises_1.default.rm(tempDir, { recursive: true, force: true }).catch(() => { });
67
+ }
68
+ });
69
+ }
70
+ /* -------------------------------------------------------------------------- */
71
+ /* runner script (runs inside the temp dir against the installed playwright) */
72
+ /* -------------------------------------------------------------------------- */
73
+ function buildRunnerScript() {
74
+ // CJS, executed in the temp dir. For each workflow step it performs the
75
+ // action, lets the client fetch settle, then asserts the POSITIVE outcome for
76
+ // the expected page kind. A `console.error` / uncaught exception during a
77
+ // step fails it too. Emits a JSON array of workflow results to stdout.
78
+ return String.raw `"use strict";
79
+ const { chromium } = require("playwright");
80
+
81
+ const SETTLE_MS = 4500;
82
+ const VISIT_TIMEOUT = 120000;
83
+
84
+ async function assertExpect(page, expect) {
85
+ // returns { ok, detail }
86
+ const errorCard = await page.locator('text=/Couldn.t load/i').count();
87
+ if (expect === "landing") {
88
+ const links = await page.locator('main a[href]').count();
89
+ return { ok: links > 0, detail: links + " links" };
90
+ }
91
+ if (expect === "table") {
92
+ const rows = await page.locator('table tbody tr').count();
93
+ const empty = await page.locator('text=/came back empty|no .* yet|nested collection/i').count();
94
+ if (errorCard > 0) return { ok: false, detail: "error card shown" };
95
+ if (rows > 0) return { ok: true, detail: rows + " rows" };
96
+ if (empty > 0) return { ok: true, detail: "empty state" };
97
+ return { ok: false, detail: "no rows, no empty state, no error (stuck?)" };
98
+ }
99
+ if (expect === "detail") {
100
+ const fields = await page.locator('dt').count();
101
+ if (errorCard > 0) return { ok: false, detail: "error card shown" };
102
+ if (fields > 0) return { ok: true, detail: fields + " fields" };
103
+ return { ok: false, detail: "no fields rendered" };
104
+ }
105
+ if (expect === "form") {
106
+ const inputs = await page.locator('input, select, textarea, button[type=submit]').count();
107
+ return { ok: inputs > 0, detail: inputs + " inputs" };
108
+ }
109
+ return { ok: false, detail: "unknown expect" };
110
+ }
111
+
112
+ (async () => {
113
+ const workflows = JSON.parse(process.argv[2]);
114
+ const baseUrl = process.argv[3];
115
+ const browser = await chromium.launch();
116
+ const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } });
117
+
118
+ // Pre-warm: the first SDK-backed page triggers a one-time on-demand compile of
119
+ // the generated SDK module graph, which on a large API can exceed a normal
120
+ // navigation timeout (~100s+). That is a dev-server cost, not an app defect —
121
+ // warm it once up front (generous budget) so per-workflow navigations are
122
+ // fast and never false-fail on a cold compile.
123
+ let warmPath = null;
124
+ for (const wf of workflows) {
125
+ for (const s of wf.steps) {
126
+ if (s.action.type === "visit" && s.action.path !== "/") { warmPath = s.action.path; break; }
127
+ }
128
+ if (warmPath) break;
129
+ }
130
+ if (warmPath) {
131
+ const wp = await ctx.newPage();
132
+ try { await wp.goto(baseUrl + warmPath, { waitUntil: "domcontentloaded", timeout: 300000 }); } catch (e) {}
133
+ await wp.waitForTimeout(2000).catch(() => {});
134
+ await wp.close().catch(() => {});
135
+ }
136
+
137
+ const out = [];
138
+ for (const wf of workflows) {
139
+ const page = await ctx.newPage();
140
+ let pageError = null;
141
+ page.on("pageerror", (e) => { pageError = e.message; });
142
+ page.on("console", (m) => { if (m.type() === "error" && !pageError) pageError = "console: " + m.text(); });
143
+ const steps = [];
144
+ let wfOk = true;
145
+ for (const step of wf.steps) {
146
+ let res = { ok: false, detail: "" };
147
+ try {
148
+ const a = step.action;
149
+ if (a.type === "visit") {
150
+ await page.goto(baseUrl + a.path, { waitUntil: "domcontentloaded", timeout: VISIT_TIMEOUT });
151
+ } else if (a.type === "clickFirstRow") {
152
+ const view = page.locator('table tbody tr a:has-text("View")').first();
153
+ if (await view.count() === 0) {
154
+ // No row to open. An empty list is the app behaving correctly (the
155
+ // simulator simply returned zero rows), not a failure — skip the
156
+ // detail step. A real failure (error card / stuck page) is caught by
157
+ // the preceding list step.
158
+ const empty = await page.locator('text=/came back empty|no .* yet|nested collection/i').count();
159
+ const detail = empty > 0 ? "skipped — list is empty" : "no row to open (list did not render)";
160
+ steps.push({ label: step.label, expect: step.expect, ok: empty > 0, detail });
161
+ if (empty === 0) wfOk = false;
162
+ pageError = null;
163
+ continue;
164
+ }
165
+ await view.click();
166
+ } else if (a.type === "clickLink") {
167
+ await page.locator('a:has-text("' + a.text + '")').first().click();
168
+ }
169
+ await page.waitForTimeout(SETTLE_MS);
170
+ res = await assertExpect(page, step.expect);
171
+ if (pageError) { res = { ok: false, detail: "runtime error: " + String(pageError).slice(0, 120) }; }
172
+ } catch (e) {
173
+ res = { ok: false, detail: "step threw: " + String(e && e.message ? e.message : e).slice(0, 120) };
174
+ }
175
+ steps.push({ label: step.label, expect: step.expect, ok: res.ok, detail: res.detail });
176
+ if (!res.ok) wfOk = false;
177
+ pageError = null;
178
+ }
179
+ out.push({ id: wf.id, title: wf.title, resource: wf.resource, ok: wfOk, steps });
180
+ await page.close().catch(() => {});
181
+ }
182
+ await browser.close().catch(() => {});
183
+ process.stdout.write(JSON.stringify(out));
184
+ })().catch((err) => {
185
+ process.stderr.write(err && err.stack ? err.stack : String(err));
186
+ process.exit(1);
187
+ });
188
+ `;
189
+ }
190
+ function parseResults(stdout, workflows) {
191
+ const trimmed = stdout.trim();
192
+ if (trimmed.length === 0) {
193
+ return workflows.map((w) => ({
194
+ id: w.id,
195
+ title: w.title,
196
+ resource: w.resource,
197
+ ok: false,
198
+ steps: w.steps.map((s) => ({
199
+ label: s.label,
200
+ expect: s.expect,
201
+ ok: false,
202
+ detail: "no runner output",
203
+ })),
204
+ }));
205
+ }
206
+ try {
207
+ const parsed = JSON.parse(trimmed);
208
+ if (!Array.isArray(parsed))
209
+ throw new Error("not an array");
210
+ return parsed;
211
+ }
212
+ catch (_a) {
213
+ return workflows.map((w) => ({
214
+ id: w.id,
215
+ title: w.title,
216
+ resource: w.resource,
217
+ ok: false,
218
+ steps: [{ label: "runner", expect: "-", ok: false, detail: "unparseable runner output" }],
219
+ }));
220
+ }
221
+ }
222
+ function renderMarkdown(results) {
223
+ const passed = results.filter((w) => w.ok).length;
224
+ const lines = [
225
+ "# Workflow verification",
226
+ "",
227
+ `Ran **${results.length}** user workflow(s) in a real headless browser (simulator mode).`,
228
+ `**${passed} passed**, **${results.length - passed} failed**.`,
229
+ "",
230
+ ];
231
+ for (const wf of results) {
232
+ lines.push(`## ${wf.ok ? "✅" : "❌"} ${wf.title}`, "");
233
+ for (const step of wf.steps) {
234
+ lines.push(`- ${step.ok ? "✓" : "✗"} ${step.label} → expect \`${step.expect}\` — ${step.detail}`);
235
+ }
236
+ lines.push("");
237
+ }
238
+ return lines.join("\n");
239
+ }
240
+ /* -------------------------------------------------------------------------- */
241
+ /* dev-server lifecycle (mirrors auditFrontendRuntime's proven boot) */
242
+ /* -------------------------------------------------------------------------- */
243
+ function installEverything(root, packageJson) {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ const hash = packageJson !== undefined
246
+ ? (0, crypto_1.createHash)("sha256").update(packageJson).digest("hex").slice(0, 16)
247
+ : "no-package-json";
248
+ const cached = packageJson !== undefined
249
+ ? yield (0, cacheNodeModules_1.ensureCachedNodeModules)({
250
+ cacheNamespace: "runtime-audit",
251
+ hash,
252
+ packageJson,
253
+ extraDeps: [PLAYWRIGHT_DEP],
254
+ })
255
+ : null;
256
+ if (cached !== null && (yield (0, cacheNodeModules_1.tryLinkNodeModules)(root, cached))) {
257
+ yield installChromium(root);
258
+ return;
259
+ }
260
+ yield spawnCommand("npm", ["install", "--silent", "--no-audit", "--no-fund"], { cwd: root });
261
+ yield spawnCommand("npm", ["install", "--silent", "--no-audit", "--no-fund", "--no-save", PLAYWRIGHT_DEP], { cwd: root });
262
+ yield installChromium(root);
263
+ });
264
+ }
265
+ function installChromium(root) {
266
+ return __awaiter(this, void 0, void 0, function* () {
267
+ yield spawnCommand(path_1.default.join(root, "node_modules", ".bin", "playwright"), ["install", "chromium"], {
268
+ cwd: root,
269
+ });
270
+ });
271
+ }
272
+ function writeFiles(root, files) {
273
+ return __awaiter(this, void 0, void 0, function* () {
274
+ for (const [relative, content] of Object.entries(files)) {
275
+ yield writeFile(root, relative, content);
276
+ }
277
+ });
278
+ }
279
+ function writeFile(root, relative, content) {
280
+ return __awaiter(this, void 0, void 0, function* () {
281
+ const full = path_1.default.join(root, relative);
282
+ yield promises_1.default.mkdir(path_1.default.dirname(full), { recursive: true });
283
+ yield promises_1.default.writeFile(full, content, "utf-8");
284
+ });
285
+ }
286
+ function getFreePort() {
287
+ return new Promise((resolve, reject) => {
288
+ const server = (0, net_1.createServer)();
289
+ server.listen(0, "127.0.0.1", () => {
290
+ const addr = server.address();
291
+ if (addr === null || typeof addr === "string") {
292
+ server.close();
293
+ reject(new Error("Failed to allocate a free port"));
294
+ return;
295
+ }
296
+ const port = addr.port;
297
+ server.close(() => resolve(port));
298
+ });
299
+ server.on("error", reject);
300
+ });
301
+ }
302
+ function startNextDev(root, port) {
303
+ return new Promise((resolve, reject) => {
304
+ var _a, _b;
305
+ const child = (0, child_process_1.spawn)("node", [path_1.default.join(root, "node_modules", "next", "dist", "bin", "next"), "dev"], {
306
+ cwd: root,
307
+ env: Object.assign(Object.assign({}, process.env), { PORT: String(port), NEXT_PUBLIC_API_SIMULATE: "true", NEXT_PUBLIC_API_TOKEN: "Bearer preview" }),
308
+ stdio: ["ignore", "pipe", "pipe"],
309
+ });
310
+ let buffer = "";
311
+ let settled = false;
312
+ const onData = (chunk) => {
313
+ var _a, _b;
314
+ buffer += chunk.toString("utf-8");
315
+ if (!settled && buffer.includes("Ready in")) {
316
+ settled = true;
317
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.off("data", onData);
318
+ (_b = child.stderr) === null || _b === void 0 ? void 0 : _b.off("data", onData);
319
+ resolve(child);
320
+ }
321
+ };
322
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on("data", onData);
323
+ (_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on("data", onData);
324
+ const timer = setTimeout(() => {
325
+ if (settled)
326
+ return;
327
+ settled = true;
328
+ child.kill("SIGTERM");
329
+ reject(new Error(`next dev did not become ready within ${NEXT_DEV_BOOT_TIMEOUT_MS}ms:\n${buffer.slice(-800)}`));
330
+ }, NEXT_DEV_BOOT_TIMEOUT_MS);
331
+ child.on("exit", (code) => {
332
+ clearTimeout(timer);
333
+ if (settled)
334
+ return;
335
+ settled = true;
336
+ reject(new Error(`next dev exited with code ${code} before ready:\n${buffer.slice(-800)}`));
337
+ });
338
+ });
339
+ }
340
+ function killNextDev(child) {
341
+ return __awaiter(this, void 0, void 0, function* () {
342
+ if (child.exitCode !== null)
343
+ return;
344
+ child.kill("SIGTERM");
345
+ yield new Promise((r) => setTimeout(r, 1500));
346
+ if (child.exitCode === null)
347
+ child.kill("SIGKILL");
348
+ });
349
+ }
350
+ function spawnCommand(cmd, args, options) {
351
+ return new Promise((resolve, reject) => {
352
+ const child = (0, child_process_1.spawn)(cmd, args, { cwd: options.cwd, stdio: "pipe" });
353
+ let stdout = "";
354
+ let stderr = "";
355
+ child.stdout.on("data", (c) => (stdout += c.toString("utf-8")));
356
+ child.stderr.on("data", (c) => (stderr += c.toString("utf-8")));
357
+ child.on("error", (err) => reject(new Error(`Failed to spawn \`${cmd}\`: ${err.message}`)));
358
+ child.on("close", (code) => {
359
+ if (code === 0)
360
+ resolve(stdout);
361
+ else
362
+ reject(new Error(`\`${cmd} ${args.slice(0, 2).join(" ")}…\` exited ${code}${stderr ? `:\n${stderr.slice(-1200)}` : ""}`));
363
+ });
364
+ });
365
+ }
366
+ //# sourceMappingURL=runWorkflows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runWorkflows.js","sourceRoot":"","sources":["../../src/verify/runWorkflows.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAqDA,oCAuCC;AA5FD,iDAAyD;AACzD,mCAAoC;AACpC,2DAA6B;AAC7B,6BAAmC;AACnC,4CAAoB;AACpB,gDAAwB;AAExB,4EAG+C;AAG/C;;;;;;;;;;GAUG;AACH,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAC5C,MAAM,wBAAwB,GAAG,MAAO,CAAC;AA4BzC,SAAsB,YAAY,CAChC,KAA6B,EAC7B,SAAsB;;QAEtB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAC7E,IAAI,OAAO,GAAwB,IAAI,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACjC,MAAM,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;YAExD,MAAM,IAAI,GAAG,MAAM,WAAW,EAAE,CAAC;YACjC,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAG,oBAAoB,IAAI,EAAE,CAAC;YAE3C,MAAM,SAAS,CAAC,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAC5E,MAAM,MAAM,GAAG,MAAM,YAAY,CAC/B,MAAM,EACN;gBACE,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,oBAAoB,CAAC;gBACnD,IAAI,CAAC,SAAS,CAAC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