@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,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildDeterministicSdkMap = buildDeterministicSdkMap;
4
+ const classifyEndpoints_1 = require("../../utils/classifyEndpoints");
5
+ const toEndpoints_1 = require("../../utils/toEndpoints");
6
+ /**
7
+ * Deterministic SDK domain map — the LLM-free replacement for the Phase-1 SDK
8
+ * Study, and the fix for "a large swagger overflows the model's context".
9
+ *
10
+ * The original SDK Study compiled the WHOLE SDK source and asked the model to
11
+ * infer resources / actors / journeys. On a 200-type swagger that prompt is
12
+ * 300k+ tokens — a hard context overflow. But the downstream phases barely use
13
+ * the map's prose: the Product Plan is already deterministic and reads only
14
+ * `actors[0].name`; Scaffold/Review embed the map as a wiki document; Render
15
+ * reads an actor's journeys only on the LLM rerender fallback. So the map can be
16
+ * derived structurally — same swagger, same map, zero tokens — without changing
17
+ * what reaches the user.
18
+ *
19
+ * - resources: the top-level CRUD groups from {@link classifyEndpoints}.
20
+ * - actors: role segments found in the accessors (`customers`, `sellers`,
21
+ * `admins`), normalized; falls back to a single `user`.
22
+ * - journeys: a short structural summary per actor (never empty — the SDK-map
23
+ * invariant requires ≥1 per actor).
24
+ */
25
+ function buildDeterministicSdkMap(document) {
26
+ const endpoints = (0, toEndpoints_1.toEndpoints)(document);
27
+ const groups = (0, classifyEndpoints_1.classifyEndpoints)(endpoints, document);
28
+ const actors = deriveActors(endpoints);
29
+ const actorNames = actors.map((a) => a.name);
30
+ // Top-level resources only (depth 1). Nested groups (`sales/questions`) fold
31
+ // into their parent for the domain map; the Product Plan still renders their
32
+ // screens from the full classification.
33
+ const resources = groups
34
+ .filter((g) => g.depth === 1 && g.resource !== "root")
35
+ .map((g) => {
36
+ var _a;
37
+ const sample = (_a = g.endpoints[0]) === null || _a === void 0 ? void 0 : _a.endpoint;
38
+ const namespace = sample !== undefined && sample.accessor.length > 1
39
+ ? sample.accessor.slice(0, -1).join(".")
40
+ : g.resource;
41
+ return {
42
+ name: g.resource,
43
+ namespace,
44
+ purpose: purposeOf(g.resource, g.roles),
45
+ actorsInvolved: actorNames,
46
+ notes: notesOf(g.roles),
47
+ };
48
+ });
49
+ return {
50
+ resources,
51
+ actors,
52
+ notableConstraints: deriveConstraints(endpoints),
53
+ };
54
+ }
55
+ /* -------------------------------------------------------------------------- */
56
+ /* actors */
57
+ /* -------------------------------------------------------------------------- */
58
+ /**
59
+ * Accessor segments that name an actor role, mapped to their canonical
60
+ * singular display name. Real swaggers expose an actor as a namespace segment
61
+ * (`shoppings.customers.sales`, `shoppings.sellers.sales`); we read the role
62
+ * straight off the accessor instead of guessing from the domain.
63
+ */
64
+ const ROLE_SEGMENTS = {
65
+ customer: "customer",
66
+ customers: "customer",
67
+ seller: "seller",
68
+ sellers: "seller",
69
+ admin: "administrator",
70
+ admins: "administrator",
71
+ administrator: "administrator",
72
+ administrators: "administrator",
73
+ member: "member",
74
+ members: "member",
75
+ buyer: "buyer",
76
+ buyers: "buyer",
77
+ manager: "manager",
78
+ managers: "manager",
79
+ guest: "guest",
80
+ guests: "guest",
81
+ };
82
+ function deriveActors(endpoints) {
83
+ const names = [];
84
+ const seen = new Set();
85
+ for (const e of endpoints) {
86
+ for (const seg of e.accessor) {
87
+ const canon = ROLE_SEGMENTS[seg.toLowerCase()];
88
+ if (canon !== undefined && !seen.has(canon)) {
89
+ seen.add(canon);
90
+ names.push(canon);
91
+ }
92
+ }
93
+ }
94
+ const finalNames = names.length > 0 ? names : ["user"];
95
+ // Lead with the end-user actor: the Product Plan assigns every screen to
96
+ // `actors[0]`, so a customer-facing label reads more naturally on the nav than
97
+ // an admin one. Purely cosmetic — the screen set is identical either way.
98
+ const ordered = [...finalNames].sort((a, b) => actorRank(a) - actorRank(b));
99
+ return ordered.map((name) => ({
100
+ name,
101
+ journeys: [`Sign in as ${name} → navigate the resources they can access.`],
102
+ }));
103
+ }
104
+ /** End-users first, privileged roles last; unknowns keep their found order. */
105
+ const ACTOR_PRIORITY = [
106
+ "customer",
107
+ "buyer",
108
+ "member",
109
+ "user",
110
+ "guest",
111
+ "seller",
112
+ "manager",
113
+ "administrator",
114
+ ];
115
+ function actorRank(name) {
116
+ const i = ACTOR_PRIORITY.indexOf(name);
117
+ return i === -1 ? ACTOR_PRIORITY.length : i;
118
+ }
119
+ /* -------------------------------------------------------------------------- */
120
+ /* resource prose (deterministic) */
121
+ /* -------------------------------------------------------------------------- */
122
+ function purposeOf(resource, roles) {
123
+ const verbs = [];
124
+ if (roles.has("list") || roles.has("search"))
125
+ verbs.push("browse");
126
+ if (roles.has("detail"))
127
+ verbs.push("view");
128
+ if (roles.has("create"))
129
+ verbs.push("create");
130
+ if (roles.has("update"))
131
+ verbs.push("update");
132
+ if (roles.has("delete"))
133
+ verbs.push("remove");
134
+ if (roles.has("action"))
135
+ verbs.push("act on");
136
+ const verb = verbs.length > 0 ? verbs.join(", ") : "work with";
137
+ return `Lets a user ${verb} ${resource}.`;
138
+ }
139
+ function notesOf(roles) {
140
+ return roles.has("search")
141
+ ? "Supports search/filter/pagination via query parameters."
142
+ : "";
143
+ }
144
+ function deriveConstraints(endpoints) {
145
+ const constraints = [];
146
+ if (endpoints.some((e) => e.query !== null)) {
147
+ constraints.push("Some list endpoints accept query parameters for search/filter/pagination.");
148
+ }
149
+ if (endpoints.some((e) => e.method.toLowerCase() === "delete")) {
150
+ constraints.push("Delete endpoints are present — confirm before destructive actions.");
151
+ }
152
+ return constraints;
153
+ }
154
+ //# sourceMappingURL=buildDeterministicSdkMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildDeterministicSdkMap.js","sourceRoot":"","sources":["../../../src/orchestrate/utils/buildDeterministicSdkMap.ts"],"names":[],"mappings":";;AAyBA,4DAkCC;AAzDD,qEAAgF;AAChF,yDAAsD;AAGtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,wBAAwB,CACtC,QAA2B;IAE3B,MAAM,SAAS,GAAG,IAAA,yBAAW,EAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAA,qCAAiB,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE7C,6EAA6E;IAC7E,6EAA6E;I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AO,eAAe,IAAI,IAAI,QAAQ,GAAG,CAAC;AAC5C,CAAC;AAED,SAAS,OAAO,CAAC,KAAwB;IACvC,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;QACxB,CAAC,CAAC,yDAAyD;QAC3D,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,iBAAiB,CACxB,SAAyC;IAEzC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,EAAE,CAAC;QAC5C,WAAW,CAAC,IAAI,CACd,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC/D,WAAW,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Per-package.json cache directory holding an installed `node_modules`. Sits
3
+ * under `$XDG_CACHE_HOME` when set, else `~/.cache`, partitioned by
4
+ * `(cacheNamespace, hash)` so callers with different dependency sets — and
5
+ * different downstream consumers (typecheck vs runtime audit) — never collide
6
+ * on the same cache key.
7
+ *
8
+ * Returns the absolute path to the populated `node_modules` directory on
9
+ * success, or `null` when the cache could not be set up (no writable cache
10
+ * root, the install crashed, etc.). Callers fall back to a plain in-place
11
+ * install in that case so the behavior degrades gracefully.
12
+ *
13
+ * `extraDeps` lets a caller add packages on top of the bare frontend dependency
14
+ * set without renaming the cache namespace: the runtime-audit cache uses
15
+ * `["playwright@^1.50.0"]` so the cached `node_modules` already contains
16
+ * Playwright the next time the agent runs an audit, on top of the same
17
+ * React/Next/shadcn tree as the typecheck cache.
18
+ */
19
+ export declare function ensureCachedNodeModules(args: {
20
+ cacheNamespace: string;
21
+ hash: string;
22
+ packageJson: string;
23
+ extraDeps?: readonly string[];
24
+ }): Promise<string | null>;
25
+ /**
26
+ * Create a symlink from `<workingDir>/node_modules` → `<cachedNodeModules>`.
27
+ * Returns `false` when the symlink could not be created (Windows without admin,
28
+ * filesystem refuses links, etc.) so the caller falls back to a plain in-place
29
+ * install.
30
+ */
31
+ export declare function tryLinkNodeModules(workingDir: string, cachedNodeModules: string): Promise<boolean>;
@@ -0,0 +1,134 @@
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.ensureCachedNodeModules = ensureCachedNodeModules;
16
+ exports.tryLinkNodeModules = tryLinkNodeModules;
17
+ const child_process_1 = require("child_process");
18
+ const promises_1 = __importDefault(require("fs/promises"));
19
+ const os_1 = __importDefault(require("os"));
20
+ const path_1 = __importDefault(require("path"));
21
+ /**
22
+ * Per-package.json cache directory holding an installed `node_modules`. Sits
23
+ * under `$XDG_CACHE_HOME` when set, else `~/.cache`, partitioned by
24
+ * `(cacheNamespace, hash)` so callers with different dependency sets — and
25
+ * different downstream consumers (typecheck vs runtime audit) — never collide
26
+ * on the same cache key.
27
+ *
28
+ * Returns the absolute path to the populated `node_modules` directory on
29
+ * success, or `null` when the cache could not be set up (no writable cache
30
+ * root, the install crashed, etc.). Callers fall back to a plain in-place
31
+ * install in that case so the behavior degrades gracefully.
32
+ *
33
+ * `extraDeps` lets a caller add packages on top of the bare frontend dependency
34
+ * set without renaming the cache namespace: the runtime-audit cache uses
35
+ * `["playwright@^1.50.0"]` so the cached `node_modules` already contains
36
+ * Playwright the next time the agent runs an audit, on top of the same
37
+ * React/Next/shadcn tree as the typecheck cache.
38
+ */
39
+ function ensureCachedNodeModules(args) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ var _a;
42
+ if (args.hash === "no-package-json")
43
+ return null;
44
+ const cacheRoot = path_1.default.join((_a = process.env.XDG_CACHE_HOME) !== null && _a !== void 0 ? _a : path_1.default.join(os_1.default.homedir(), ".cache"), `autoview-${args.cacheNamespace}`, args.hash);
45
+ const nodeModules = path_1.default.join(cacheRoot, "node_modules");
46
+ try {
47
+ // `node_modules/.package-lock.json` is the canonical "install completed"
48
+ // sentinel npm writes at the end of `npm install`. Its presence means
49
+ // the previous run finished cleanly and the cache is reusable.
50
+ yield promises_1.default.access(path_1.default.join(nodeModules, ".package-lock.json"));
51
+ return nodeModules;
52
+ }
53
+ catch (_b) {
54
+ // Cache miss: populate it. Use a sibling temp dir + rename so a
55
+ // concurrent agent run cannot observe a half-written node_modules.
56
+ const installer = yield promises_1.default.mkdtemp(path_1.default.join(os_1.default.tmpdir(), `autoview-${args.cacheNamespace}-cache-${args.hash}-`));
57
+ try {
58
+ yield promises_1.default.writeFile(path_1.default.join(installer, "package.json"), args.packageJson, "utf-8");
59
+ yield runNpm(installer, [
60
+ "install",
61
+ "--silent",
62
+ "--no-audit",
63
+ "--no-fund",
64
+ ]);
65
+ if (args.extraDeps !== undefined && args.extraDeps.length > 0) {
66
+ yield runNpm(installer, [
67
+ "install",
68
+ "--silent",
69
+ "--no-audit",
70
+ "--no-fund",
71
+ "--no-save",
72
+ ...args.extraDeps,
73
+ ]);
74
+ }
75
+ yield promises_1.default.mkdir(cacheRoot, { recursive: true });
76
+ // Atomically move node_modules into place. If something is already
77
+ // there (concurrent run won the race), rm-then-rename overwrites it
78
+ // — both are valid installs of the same package.json.
79
+ yield promises_1.default.rm(nodeModules, { recursive: true, force: true });
80
+ yield promises_1.default.rename(path_1.default.join(installer, "node_modules"), nodeModules);
81
+ }
82
+ catch (_c) {
83
+ yield promises_1.default.rm(installer, { recursive: true, force: true }).catch(() => { });
84
+ return null;
85
+ }
86
+ yield promises_1.default.rm(installer, { recursive: true, force: true }).catch(() => { });
87
+ try {
88
+ yield promises_1.default.access(path_1.default.join(nodeModules, ".package-lock.json"));
89
+ return nodeModules;
90
+ }
91
+ catch (_d) {
92
+ return null;
93
+ }
94
+ }
95
+ });
96
+ }
97
+ /**
98
+ * Create a symlink from `<workingDir>/node_modules` → `<cachedNodeModules>`.
99
+ * Returns `false` when the symlink could not be created (Windows without admin,
100
+ * filesystem refuses links, etc.) so the caller falls back to a plain in-place
101
+ * install.
102
+ */
103
+ function tryLinkNodeModules(workingDir, cachedNodeModules) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ const target = path_1.default.join(workingDir, "node_modules");
106
+ try {
107
+ yield promises_1.default.symlink(cachedNodeModules, target, "dir");
108
+ return true;
109
+ }
110
+ catch (_a) {
111
+ return false;
112
+ }
113
+ });
114
+ }
115
+ function runNpm(cwd, args) {
116
+ return new Promise((resolve, reject) => {
117
+ const child = (0, child_process_1.spawn)("npm", args, { cwd, stdio: "pipe" });
118
+ let stderr = "";
119
+ child.stderr.on("data", (chunk) => {
120
+ stderr += chunk.toString("utf-8");
121
+ });
122
+ child.on("error", (err) => {
123
+ reject(new Error(`Failed to spawn \`npm ${args.join(" ")}\`: ${err.message}`));
124
+ });
125
+ child.on("close", (code) => {
126
+ if (code === 0)
127
+ resolve();
128
+ else
129
+ reject(new Error(`\`npm ${args.slice(0, 3).join(" ")}...\` exited with code ${code}` +
130
+ (stderr.length > 0 ? `:\n${stderr.slice(-1500)}` : "")));
131
+ });
132
+ });
133
+ }
134
+ //# sourceMappingURL=cacheNodeModules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cacheNodeModules.js","sourceRoot":"","sources":["../../../src/orchestrate/utils/cacheNodeModules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAuBA,0DAoEC;AAQD,gDAWC;AA9GD,iDAAsC;AACtC,2DAA6B;AAC7B,4CAAoB;AACpB,gDAAwB;AAExB;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAsB,uBAAuB,CAAC,IAK7C;;;QACC,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB;YAAE,OAAO,IAAI,CAAC;QACjD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CACzB,MAAA,OAAO,CAAC,GAAG,CAAC,cAAc,mCAAI,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,EAC/D,YAAY,IAAI,CAAC,cAAc,EAAE,EACjC,IAAI,CAAC,IAAI,CACV,CAAC;QACF,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACzD,IAAI,CAAC;YACH,yEAAyE;YACzE,sEAAsE;YACtE,+DAA+D;YAC/D,MAAM,kBAAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAC9D,OAAO,WAAW,CAAC;QACrB,CAAC;QAAC,WAAM,CAAC;YACP,gEAAgE;YAChE,mEAAmE;YACnE,MAAM,SAAS,GAAG,MAAM,kBAAE,CAAC,OAAO,CAChC,cAAI,CAAC,IAAI,CACP,YAAE,CAAC,MAAM,EAAE,EACX,YAAY,IAAI,CAAC,cAAc,UAAU,IAAI,CAAC,IAAI,GAAG,CACtD,CACF,CAAC;YACF,IAAI,CAAC;gBACH,MAAM,kBAAE,CAAC,SAAS,CAChB,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EACpC,IAAI,CAAC,WAAW,EAChB,OA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CAAC;gBAAE,OAAO,EAAE,CAAC;;gBAExB,MAAM,CACJ,IAAI,KAAK,CACP,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,IAAI,EAAE;oBACjE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACzD,CACF,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ import { IAutoViewEndpoint } from "../../utils";
3
+ /**
4
+ * Derive the Nestia `(connection, props)` call shape for a single AutoBE
5
+ * operation as a one-line TypeScript signature string. Used by the Render phase
6
+ * to spoon-feed the LLM the exact `props` object shape it has to pass —
7
+ * otherwise the model routinely flattens body fields into the top level of
8
+ * `props`, which makes the simulator return a masked 400 and the page renders
9
+ * the empty state.
10
+ *
11
+ * Examples (matching the live shopping SDK):
12
+ *
13
+ * - `at` on `/sales/:id` → `{ id: string }`
14
+ * - `index` on `/sales` (PATCH) → `{ body: IShoppingSale.IRequest }`
15
+ * - `create` on `/sales/:saleId/reviews` → `{ saleId: string; body:
16
+ * IShoppingSaleReview.ICreate }`
17
+ *
18
+ * Pure. Does not mutate the operation.
19
+ */
20
+ export declare function describeEndpointPropsShape(op: IAutoViewEndpoint): string;
21
+ /**
22
+ * Inspect the document's component schemas and return a brief, machine-friendly
23
+ * line describing the operation's request body — what type it is, which fields
24
+ * are required, and a sample literal the LLM can copy verbatim into the page
25
+ * when no domain-specific filter applies.
26
+ *
27
+ * Returns an empty string when the operation has no request body, or when the
28
+ * referenced schema cannot be resolved (the prompt is then unchanged for that
29
+ * endpoint, no harm done).
30
+ *
31
+ * Format:
32
+ *
33
+ * body: IShoppingSale.IRequest — required: [page, limit]; example: { "page": 1, "limit": 24 }
34
+ *
35
+ * Pure. Does not mutate the document.
36
+ */
37
+ export declare function describeRequestBodyHint(op: IAutoViewEndpoint, doc: OpenApi.IDocument): string;
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.describeEndpointPropsShape = describeEndpointPropsShape;
4
+ exports.describeRequestBodyHint = describeRequestBodyHint;
5
+ /**
6
+ * Derive the Nestia `(connection, props)` call shape for a single AutoBE
7
+ * operation as a one-line TypeScript signature string. Used by the Render phase
8
+ * to spoon-feed the LLM the exact `props` object shape it has to pass —
9
+ * otherwise the model routinely flattens body fields into the top level of
10
+ * `props`, which makes the simulator return a masked 400 and the page renders
11
+ * the empty state.
12
+ *
13
+ * Examples (matching the live shopping SDK):
14
+ *
15
+ * - `at` on `/sales/:id` → `{ id: string }`
16
+ * - `index` on `/sales` (PATCH) → `{ body: IShoppingSale.IRequest }`
17
+ * - `create` on `/sales/:saleId/reviews` → `{ saleId: string; body:
18
+ * IShoppingSaleReview.ICreate }`
19
+ *
20
+ * Pure. Does not mutate the operation.
21
+ */
22
+ function describeEndpointPropsShape(op) {
23
+ const fields = [];
24
+ for (const param of op.parameters) {
25
+ fields.push(`${param.name}: ${renderParamType(param.schema)}`);
26
+ }
27
+ // Query endpoints carry their query object under `props.query`. Omitting it
28
+ // here is exactly why the Render LLM passed `undefined` as props for
29
+ // findByStatus / login and broke typecheck — the props shape never told it a
30
+ // query existed.
31
+ if (op.query != null) {
32
+ fields.push(`query: ${renderQueryShape(op.query)}`);
33
+ }
34
+ if (op.requestBody !== null) {
35
+ fields.push(`body: ${op.requestBody.typeName}`);
36
+ }
37
+ if (fields.length === 0)
38
+ return "{}";
39
+ return `{ ${fields.join("; ")} }`;
40
+ }
41
+ /** Render a query schema: a named component (nestia emits `*.GetQuery`) or an
42
+ * inline object. The Render phase imports the named SDK type either way. */
43
+ function renderQueryShape(query) {
44
+ var _a;
45
+ if ("$ref" in query && typeof query.$ref === "string") {
46
+ return query.$ref.split("/").pop();
47
+ }
48
+ if ("properties" in query && query.properties) {
49
+ const required = new Set((_a = query.required) !== null && _a !== void 0 ? _a : []);
50
+ const fields = Object.entries(query.properties).map(([name, prop]) => {
51
+ const optional = required.has(name) ? "" : "?";
52
+ const type = "type" in prop ? String(prop.type) : "unknown";
53
+ return `${name}${optional}: ${type}`;
54
+ });
55
+ return fields.length > 0 ? `{ ${fields.join("; ")} }` : "{}";
56
+ }
57
+ return "Record<string, unknown>";
58
+ }
59
+ /**
60
+ * Inspect the document's component schemas and return a brief, machine-friendly
61
+ * line describing the operation's request body — what type it is, which fields
62
+ * are required, and a sample literal the LLM can copy verbatim into the page
63
+ * when no domain-specific filter applies.
64
+ *
65
+ * Returns an empty string when the operation has no request body, or when the
66
+ * referenced schema cannot be resolved (the prompt is then unchanged for that
67
+ * endpoint, no harm done).
68
+ *
69
+ * Format:
70
+ *
71
+ * body: IShoppingSale.IRequest — required: [page, limit]; example: { "page": 1, "limit": 24 }
72
+ *
73
+ * Pure. Does not mutate the document.
74
+ */
75
+ function describeRequestBodyHint(op, doc) {
76
+ var _a, _b;
77
+ if (op.requestBody === null)
78
+ return "";
79
+ const schema = ((_b = (_a = doc.components) === null || _a === void 0 ? void 0 : _a.schemas) !== null && _b !== void 0 ? _b : {})[op.requestBody.typeName];
80
+ if (schema === undefined)
81
+ return `body: ${op.requestBody.typeName}`;
82
+ const required = collectRequired(schema, doc);
83
+ const example = sampleLiteral(schema, doc, required);
84
+ const requiredPart = required.length > 0
85
+ ? ` — required: [${required.join(", ")}]`
86
+ : " — (no required fields)";
87
+ const examplePart = example !== null ? `; example: ${example}` : "";
88
+ return `body: ${op.requestBody.typeName}${requiredPart}${examplePart}`;
89
+ }
90
+ function renderParamType(schema) {
91
+ if (!("type" in schema))
92
+ return "string";
93
+ switch (schema.type) {
94
+ case "integer":
95
+ case "number":
96
+ return "number";
97
+ case "boolean":
98
+ return "boolean";
99
+ default:
100
+ return "string";
101
+ }
102
+ }
103
+ /**
104
+ * Pull the `required[]` list out of an object schema, resolving a single level
105
+ * of `$ref` indirection when the type name points at a nested component.
106
+ * Returns an empty array for non-object schemas so callers can uniformly print
107
+ * "(no required fields)".
108
+ */
109
+ function collectRequired(schema, doc) {
110
+ var _a;
111
+ const resolved = resolveSchema(schema, doc);
112
+ if (resolved === null)
113
+ return [];
114
+ if (!("type" in resolved) || resolved.type !== "object")
115
+ return [];
116
+ return (_a = resolved.required) !== null && _a !== void 0 ? _a : [];
117
+ }
118
+ /**
119
+ * Best-effort literal that satisfies the schema's required fields. Used to give
120
+ * the LLM a concrete `{ "body": ... }` starting point instead of a bare type
121
+ * name. We do not try to be exhaustive — just enough to clear the typia
122
+ * validation gate (page/limit numbers, empty arrays for collections, null for
123
+ * nullable refs, etc.).
124
+ */
125
+ function sampleLiteral(schema, doc, required) {
126
+ var _a;
127
+ const resolved = resolveSchema(schema, doc);
128
+ if (resolved === null)
129
+ return null;
130
+ if (!("type" in resolved) || resolved.type !== "object")
131
+ return null;
132
+ const obj = resolved;
133
+ const entries = [];
134
+ for (const field of required) {
135
+ const childSchema = ((_a = obj.properties) !== null && _a !== void 0 ? _a : {})[field];
136
+ if (childSchema === undefined)
137
+ continue;
138
+ entries.push(`${JSON.stringify(field)}: ${sampleValue(childSchema, doc, field)}`);
139
+ }
140
+ return `{ ${entries.join(", ")} }`;
141
+ }
142
+ function sampleValue(schema, doc, fieldHint) {
143
+ var _a;
144
+ const resolved = (_a = resolveSchema(schema, doc)) !== null && _a !== void 0 ? _a : schema;
145
+ if ("const" in resolved) {
146
+ return JSON.stringify(resolved.const);
147
+ }
148
+ if ("oneOf" in resolved) {
149
+ const branches = resolved.oneOf;
150
+ if (branches.length > 0)
151
+ return sampleValue(branches[0], doc, fieldHint);
152
+ return "null";
153
+ }
154
+ if (!("type" in resolved))
155
+ return "null";
156
+ switch (resolved.type) {
157
+ case "boolean":
158
+ return "false";
159
+ case "integer":
160
+ case "number":
161
+ if (fieldHint === "page" || fieldHint === "current")
162
+ return "1";
163
+ if (fieldHint === "limit")
164
+ return "24";
165
+ return "0";
166
+ case "string":
167
+ return '""';
168
+ case "array":
169
+ return "[]";
170
+ case "object":
171
+ return "{}";
172
+ case "null":
173
+ return "null";
174
+ }
175
+ return "null";
176
+ }
177
+ /**
178
+ * Follow a single layer of `$ref` indirection so callers can ask for an object
179
+ * schema by type name (the request-body `typeName`) and receive the resolved
180
+ * component back. Returns `null` when the ref does not point at a known
181
+ * component.
182
+ */
183
+ function resolveSchema(schema, doc) {
184
+ var _a, _b;
185
+ if ("$ref" in schema && typeof schema.$ref === "string") {
186
+ const name = schema.$ref.replace(/^#\/components\/schemas\//, "");
187
+ const target = ((_b = (_a = doc.components) === null || _a === void 0 ? void 0 : _a.schemas) !== null && _b !== void 0 ? _b : {})[name];
188
+ return (target !== null && target !== void 0 ? target : null);
189
+ }
190
+ return schema;
191
+ }
192
+ //# sourceMappingURL=describeEndpointPropsShape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describeEndpointPropsShape.js","sourceRoot":"","sources":["../../../src/orchestrate/utils/describeEndpointPropsShape.ts"],"names":[],"mappings":";;AAoBA,gEAmBC;AAoCD,0DAeC;AAvFD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,0BAA0B,CACxC,EAAqB;IAErB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,4EAA4E;IAC5E,qEAAqE;IACrE,6EAA6E;IAC7E,iBAAiB;IACjB,IAAI,EAAE,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,UAAU,gBAAgB,CAAC,EAAE,CAAC,KAAK,CAAC,EA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AM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACxD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,CAAC,MAAA,MAAA,GAAG,CAAC,UAAU,0CAAE,OAAO,mCAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,CAA+B,CAAC;IACxD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ import { IAutoViewEndpoint } from "../../utils";
3
+ /**
4
+ * Render the request body type of a single AutoBE operation as a readable,
5
+ * multi-line TypeScript-shaped string — mirror of
6
+ * {@link describeEndpointResponseShape} for the input side.
7
+ *
8
+ * The existing one-line {@link describeRequestBodyHint} surfaces the typeName,
9
+ * required keys, and a sample literal, but stops short of expanding nested
10
+ * arrays-of-union-literals (sort grammars) or other deeply-typed request DTOs —
11
+ * which is enough for the LLM to fall back on its priors and emit `sort: {
12
+ * field: ..., direction: ... }[]` against an `ITrashRequest.sort` whose real
13
+ * shape is `("created_at.asc" | "created_at.desc" | ...)[]`. Pre-rendering the
14
+ * full shape on the way in kills that whole class of defect at zero LLM cost,
15
+ * just like the response path does.
16
+ *
17
+ * Returns `null` when the operation has no request body so callers can skip the
18
+ * line entirely rather than emitting `body: void`.
19
+ *
20
+ * Pure. Does not mutate the document.
21
+ */
22
+ export declare function describeEndpointRequestBodyShape(op: IAutoViewEndpoint, doc: OpenApi.IDocument): string | null;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.describeEndpointRequestBodyShape = describeEndpointRequestBodyShape;
4
+ const renderJsonSchema_1 = require("./renderJsonSchema");
5
+ /**
6
+ * Render the request body type of a single AutoBE operation as a readable,
7
+ * multi-line TypeScript-shaped string — mirror of
8
+ * {@link describeEndpointResponseShape} for the input side.
9
+ *
10
+ * The existing one-line {@link describeRequestBodyHint} surfaces the typeName,
11
+ * required keys, and a sample literal, but stops short of expanding nested
12
+ * arrays-of-union-literals (sort grammars) or other deeply-typed request DTOs —
13
+ * which is enough for the LLM to fall back on its priors and emit `sort: {
14
+ * field: ..., direction: ... }[]` against an `ITrashRequest.sort` whose real
15
+ * shape is `("created_at.asc" | "created_at.desc" | ...)[]`. Pre-rendering the
16
+ * full shape on the way in kills that whole class of defect at zero LLM cost,
17
+ * just like the response path does.
18
+ *
19
+ * Returns `null` when the operation has no request body so callers can skip the
20
+ * line entirely rather than emitting `body: void`.
21
+ *
22
+ * Pure. Does not mutate the document.
23
+ */
24
+ function describeEndpointRequestBodyShape(op, doc) {
25
+ if (op.requestBody === null)
26
+ return null;
27
+ return (0, renderJsonSchema_1.renderNamedSchema)(op.requestBody.typeName, doc);
28
+ }
29
+ //# sourceMappingURL=describeEndpointRequestBodyShape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describeEndpointRequestBodyShape.js","sourceRoot":"","sources":["../../../src/orchestrate/utils/describeEndpointRequestBodyShape.ts"],"names":[],"mappings":";;AAwBA,4EAMC;AA3BD,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,gCAAgC,CAC9C,EAAqB,EACrB,GAAsB;IAEtB,IAAI,EAAE,CAAC,WAAW,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACzC,OAAO,IAAA,oCAAiB,EAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ import { IAutoViewEndpoint } from "../../utils";
3
+ /**
4
+ * Render the response body type of a single AutoBE operation as a readable,
5
+ * multi-line TypeScript-shaped string. Used by the Render phase to spoon-feed
6
+ * the LLM the exact field names + nesting of every endpoint's return value —
7
+ * otherwise the model invents plausible-sounding properties (e.g. `auth.member`
8
+ * on `IAuthorized` when the real shape is `{ id, created_at, token }`), which
9
+ * then fails TypeScript when the user runs `npm run typecheck` against the
10
+ * generated frontend.
11
+ *
12
+ * Returns `void` when the operation has no response body, so callers can
13
+ * pass-through to `Promise<void>` in the rendered signature. Delegates the
14
+ * actual schema walk to {@link renderJsonSchema} so request and response
15
+ * descriptions stay shape-compatible.
16
+ *
17
+ * Pure. Does not mutate the document.
18
+ */
19
+ export declare function describeEndpointResponseShape(op: IAutoViewEndpoint, doc: OpenApi.IDocument): string;