@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,586 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.orchestrateAutoViewScaffold = orchestrateAutoViewScaffold;
13
+ exports.renderNavTs = renderNavTs;
14
+ const uuid_1 = require("uuid");
15
+ const AutoViewFrontendTemplate_1 = require("../constants/AutoViewFrontendTemplate");
16
+ /**
17
+ * Phase 3 of the AutoView agent — Scaffold.
18
+ *
19
+ * Deterministic. No LLM calls. Produces the file layout of a runnable Next.js +
20
+ * shadcn/ui project shaped for the in-house Sandbox platform:
21
+ *
22
+ * - Copies the bundled frontend pack (`internals/template/frontend/`) verbatim —
23
+ * Dockerfile, configs, shadcn/ui primitives, base app shell, health route.
24
+ * - Adds the AutoBE-generated SDK under `src/api/**`.
25
+ * - Adds an SDK adapter and a mock `IConnection` so generated pages can import a
26
+ * single helper instead of touching the SDK directly.
27
+ * - Materializes one placeholder TSX page per screen in
28
+ * {@link IAutoViewProductPlan} so the project compiles without Phase 4 having
29
+ * run yet; Phase 4 (Render) overwrites these in place.
30
+ * - Drops the Phase 1 and Phase 2 markdown into `wiki/` so the operator can audit
31
+ * the agent's intent alongside the code.
32
+ */
33
+ function orchestrateAutoViewScaffold(ctx, props) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const files = {};
36
+ // 1. Bundled frontend pack — Dockerfile, configs, shadcn/ui base, app
37
+ // shell, health route, CLAUDE.md / PROMPT.md / SANDBOX.md.
38
+ for (const [key, value] of Object.entries(AutoViewFrontendTemplate_1.AutoViewFrontendTemplate)) {
39
+ files[key] = value;
40
+ }
41
+ // 2. SDK under `src/api/**` from the AutoBE interface compiler.
42
+ const compiler = yield ctx.compiler();
43
+ const written = yield compiler.interface.write(props.document, []);
44
+ for (const [key, value] of Object.entries(written)) {
45
+ if (key.startsWith("src/api/")) {
46
+ files[key] = value;
47
+ }
48
+ }
49
+ // 3. SDK adapter + mock connection. Generated pages import from
50
+ // `@/lib/api` and `@/lib/connection` instead of touching the raw SDK,
51
+ // so the Render phase has one stable shape to talk to.
52
+ files["src/lib/connection.ts"] = renderConnectionTs(props.backend);
53
+ files["src/lib/api.ts"] = SDK_ADAPTER_TS;
54
+ // BootstrapGate + root layout override. The gate runs `bootstrapAuth()`
55
+ // once on mount before any page-level SDK call fires, so individual
56
+ // pages do not need to know about auth. When the bootstrap is a
57
+ // no-op (simulate / no-backend variant) children render immediately.
58
+ // The template ships a layout.tsx that does not wire the gate;
59
+ // overriding it here keeps the gate change in one place.
60
+ files["src/components/BootstrapGate.tsx"] = BOOTSTRAP_GATE_TSX;
61
+ files["app/layout.tsx"] = ROOT_LAYOUT_TSX;
62
+ // Navigation config consumed by the AppShell sidebar — generated from the
63
+ // top-level resources so the chrome reflects this swagger's domain.
64
+ files["src/lib/nav.ts"] = renderNavTs(props.document, props.productPlan);
65
+ // 4. Placeholder TSX per planned screen. Keeps `tsc --noEmit` happy
66
+ // and Next.js routable even before Phase 4 has filled the pages in.
67
+ // Phase 4 (Render) overwrites these by path.
68
+ for (const screen of props.productPlan.screens) {
69
+ const filePath = screenPathToFile(screen.path);
70
+ if (filePath === null)
71
+ continue;
72
+ files[filePath] = renderPlaceholderPage(screen);
73
+ }
74
+ // 5. Wiki — Phase 1 + Phase 2 evidence next to the code.
75
+ files["wiki/sdk-map.md"] = props.sdkMapMarkdown;
76
+ files["wiki/product-plan.md"] = props.productPlanMarkdown;
77
+ ctx.dispatch({
78
+ type: "autoViewScaffold",
79
+ id: (0, uuid_1.v7)(),
80
+ created_at: new Date().toISOString(),
81
+ step: props.step,
82
+ files: Object.keys(files).length,
83
+ });
84
+ return files;
85
+ });
86
+ }
87
+ /* -------------------------------------------------------------------------- */
88
+ /* path → file mapping */
89
+ /* -------------------------------------------------------------------------- */
90
+ /**
91
+ * Map a Next.js route path (`/catalog`, `/orders/[id]`) to the corresponding
92
+ * `app/.../page.tsx` location.
93
+ *
94
+ * Returns `null` for the bare `/` route — the bundled frontend pack already
95
+ * ships `app/page.tsx`, and Phase 4 overwrites it directly.
96
+ */
97
+ function screenPathToFile(routePath) {
98
+ const trimmed = routePath.replace(/^\/+/, "").replace(/\/+$/, "");
99
+ if (trimmed.length === 0)
100
+ return "app/page.tsx";
101
+ return `app/${trimmed}/page.tsx`;
102
+ }
103
+ function renderPlaceholderPage(screen) {
104
+ const title = jsonString(screen.title);
105
+ const purpose = jsonString(screen.purpose);
106
+ const pattern = jsonString(screen.uiPattern);
107
+ const actor = jsonString(screen.actor);
108
+ const endpointsArrayLit = JSON.stringify(screen.endpoints);
109
+ return `// Placeholder generated by AutoView Phase 3 (Scaffold).
110
+ // Phase 4 (Render) replaces this file with a real Next.js page composed of the
111
+ // SDK endpoints listed in the product plan. Until then the page renders a
112
+ // short summary so \`next build\` succeeds and the operator can navigate.
113
+
114
+ export default function Page() {
115
+ const endpoints: readonly string[] = ${endpointsArrayLit};
116
+ return (
117
+ <main className="container mx-auto py-10">
118
+ <p className="text-xs uppercase tracking-wide text-muted-foreground">
119
+ AutoView placeholder · {${pattern}}
120
+ </p>
121
+ <h1 className="mt-2 text-3xl font-bold tracking-tight">{${title}}</h1>
122
+ <p className="mt-3 text-muted-foreground">{${purpose}}</p>
123
+ <p className="mt-2 text-xs text-muted-foreground">
124
+ Actor: <span className="font-mono">{${actor}}</span>
125
+ </p>
126
+ {endpoints.length > 0 ? (
127
+ <div className="mt-4 rounded-md border bg-muted/30 p-3">
128
+ <p className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
129
+ Planned SDK endpoints
130
+ </p>
131
+ <ul className="mt-2 space-y-1 text-xs font-mono">
132
+ {endpoints.map((accessor) => (
133
+ <li key={accessor}>{accessor}</li>
134
+ ))}
135
+ </ul>
136
+ </div>
137
+ ) : null}
138
+ </main>
139
+ );
140
+ }
141
+ `;
142
+ }
143
+ function jsonString(text) {
144
+ return JSON.stringify(text);
145
+ }
146
+ /* -------------------------------------------------------------------------- */
147
+ /* static helpers */
148
+ /* -------------------------------------------------------------------------- */
149
+ /**
150
+ * Render the connection module.
151
+ *
152
+ * Two shapes:
153
+ *
154
+ * - When `backend.host` is non-null (shopping fixture or any SDK whose swagger
155
+ * declares `servers[]`), default to that host + `simulate: false` so pages
156
+ * render real product data on first boot. The operator can flip back to mocks
157
+ * via `NEXT_PUBLIC_API_SIMULATE=true`.
158
+ * - When `backend.host` is null (AutoBE interface phase — no live backend exists
159
+ * yet), default to `simulate: true` so the dev server boots without a real
160
+ * server behind it.
161
+ */
162
+ function renderConnectionTs(backend) {
163
+ if (backend.host !== null) {
164
+ return `import type { IConnection } from "@nestia/fetcher";
165
+
166
+ /**
167
+ * Connection used by every generated page.
168
+ *
169
+ * Routed through Next.js's same-origin rewrite so the browser does not
170
+ * have to deal with the upstream backend's CORS policy — the samchon
171
+ * shopping backend, for instance, only advertises \`GET,HEAD,POST\` in
172
+ * its \`Access-Control-Allow-Methods\` response, which blocks every
173
+ * PATCH / PUT / DELETE preflight a typical catalog page issues. The
174
+ * rewrite lives in \`next.config.mjs\` and forwards \`/_backend/*\` to
175
+ * the real upstream (\`http://127.0.0.1:37001\` by default, see
176
+ * \`scripts/start-shopping-backend.sh\`). Override the upstream via
177
+ * \`NEXT_PUBLIC_API_HOST\` if you want to point elsewhere.
178
+ *
179
+ * Set \`NEXT_PUBLIC_API_SIMULATE=true\` to swap to typia-random mocks
180
+ * (the SDK then never hits the network).
181
+ *
182
+ * The \`Authorization\` header starts empty — \`bootstrapAuth()\` populates
183
+ * it on first call with a guest customer token issued by the shopping
184
+ * backend. \`BootstrapGate\` in the root layout invokes the bootstrap
185
+ * once on mount, before any page-level SDK call fires, so individual
186
+ * page components do not need to think about auth.
187
+ */
188
+ /* -------------------------------------------------------------------------- */
189
+ /* connection scope */
190
+ /* -------------------------------------------------------------------------- */
191
+
192
+ /**
193
+ * Which actor's token the SDK is currently authenticated as. The browser
194
+ * pathname picks the scope on every navigation — see \`BootstrapGate\`. A
195
+ * \`null\` scope means the bootstrap has not run yet.
196
+ */
197
+ export type AuthScope = null | "customer" | "citizen" | "administrator" | "seller";
198
+
199
+ let activeScope: AuthScope = null;
200
+ const scopePromises: Partial<Record<Exclude<AuthScope, null>, Promise<void>>> = {};
201
+
202
+ /**
203
+ * Seed credentials for the samchon shopping backend. The bundled
204
+ * \`scripts/start-shopping-backend.sh\` always seeds the same single account,
205
+ * so these values are constants. \`SHOPPING_SYSTEM_PASSWORD\` defaults to
206
+ * \`samchon\` in the upstream \`.env\` (see seeders).
207
+ */
208
+ const SEED_EMAIL = "robot@nestia.io";
209
+ const SEED_PASSWORD = "samchon";
210
+ const SEED_NICKNAME = "Robot";
211
+ const SEED_CITIZEN_MOBILE = "01012345678";
212
+ const SEED_CITIZEN_NAME = "Robot";
213
+ const CHANNEL_CODE = "samchon";
214
+
215
+ export const connection: IConnection = {
216
+ host:
217
+ typeof window !== "undefined"
218
+ ? \`\${window.location.origin}/_backend\`
219
+ : (process?.env?.NEXT_PUBLIC_API_HOST ?? ${JSON.stringify(backend.host)}),
220
+ headers: {
221
+ Authorization: process?.env?.NEXT_PUBLIC_API_TOKEN ?? "",
222
+ },
223
+ simulate:
224
+ typeof process !== "undefined" &&
225
+ process.env.NEXT_PUBLIC_API_SIMULATE === "true",
226
+ };
227
+
228
+ /**
229
+ * Choose which actor's session the current page needs based on the URL.
230
+ * Defaults to plain customer (read-only catalog browsing). Admin and seller
231
+ * surfaces sign in with the seed account; coupons / orders / wallet /
232
+ * checkout / account need a citizen (the customer plus mobile/name).
233
+ */
234
+ function scopeForPathname(pathname: string | null | undefined): Exclude<AuthScope, null> {
235
+ if (typeof pathname !== "string") return "customer";
236
+ if (pathname.startsWith("/admin")) return "administrator";
237
+ if (pathname.startsWith("/seller")) return "seller";
238
+ if (
239
+ pathname.startsWith("/cart") ||
240
+ pathname.startsWith("/orders") ||
241
+ pathname.startsWith("/checkout") ||
242
+ pathname.startsWith("/wallet") ||
243
+ pathname.startsWith("/coupons") ||
244
+ pathname.startsWith("/account")
245
+ ) {
246
+ return "citizen";
247
+ }
248
+ return "customer";
249
+ }
250
+
251
+ async function requestJson<T>(
252
+ method: "POST" | "PUT",
253
+ path: string,
254
+ body: unknown,
255
+ ): Promise<T> {
256
+ const res = await fetch(\`/_backend\${path}\`, {
257
+ method,
258
+ headers: { "Content-Type": "application/json", ...auth() },
259
+ body: JSON.stringify(body),
260
+ });
261
+ if (!res.ok) {
262
+ const text = await res.text().catch(() => "");
263
+ throw new Error(\`\${method} \${path} → \${res.status}: \${text.slice(0, 200)}\`);
264
+ }
265
+ return (await res.json()) as T;
266
+ }
267
+
268
+ function auth(): Record<string, string> {
269
+ const a = connection.headers?.Authorization;
270
+ return typeof a === "string" && a.length > 0 ? { Authorization: a } : {};
271
+ }
272
+
273
+ function applyToken(payload: unknown): void {
274
+ const raw = payload as {
275
+ setHeaders?: { Authorization?: unknown } | null;
276
+ token?: { access?: unknown } | null;
277
+ } | null;
278
+ const fromSetHeaders =
279
+ typeof raw?.setHeaders?.Authorization === "string"
280
+ ? (raw.setHeaders.Authorization as string)
281
+ : null;
282
+ const fromTokenAccess =
283
+ typeof raw?.token?.access === "string"
284
+ ? \`Bearer \${raw.token.access as string}\`
285
+ : null;
286
+ const token = fromSetHeaders ?? fromTokenAccess;
287
+ if (token === null) {
288
+ throw new Error("Auth bootstrap returned 2xx but no token in the body.");
289
+ }
290
+ if (connection.headers !== undefined) {
291
+ connection.headers.Authorization = token;
292
+ }
293
+ }
294
+
295
+ async function ensureCustomer(): Promise<void> {
296
+ // The customer \`POST /authenticate\` is the only call that issues a
297
+ // new JWT — every subsequent activate/login attaches role grants to
298
+ // the same customer server-side and returns the updated customer
299
+ // object with NO \`setHeaders\` / \`token\` field. Reusing the bearer
300
+ // header from this call works for citizen / member / admin / seller
301
+ // requests after the corresponding activate or login has succeeded.
302
+ await requestJson("POST", "/shoppings/customers/authenticate", {
303
+ channel_code: CHANNEL_CODE,
304
+ external_user: null,
305
+ href: typeof window !== "undefined" ? window.location.href : "http://localhost:3000",
306
+ referrer: typeof document !== "undefined" ? document.referrer || null : null,
307
+ }).then(applyToken);
308
+ }
309
+
310
+ async function ensureCitizen(): Promise<void> {
311
+ await ensureCustomer();
312
+ // \`activate\` upgrades the current customer to a citizen by attaching
313
+ // mobile/name. Returns the updated customer (no \`setHeaders\` / no
314
+ // \`token\` field) so the customer JWT from \`ensureCustomer\` stays the
315
+ // auth header for citizen-scoped routes. Idempotent for the seeded
316
+ // account; backend rejects re-activation with 409/422 which we
317
+ // swallow as success.
318
+ try {
319
+ await requestJson("POST", "/shoppings/customers/authenticate/activate", {
320
+ mobile: SEED_CITIZEN_MOBILE,
321
+ name: SEED_CITIZEN_NAME,
322
+ });
323
+ } catch (e: unknown) {
324
+ if (e instanceof Error && /already|conflict|409|422/i.test(e.message)) {
325
+ return;
326
+ }
327
+ throw e;
328
+ }
329
+ }
330
+
331
+ async function ensureMemberLogin(): Promise<void> {
332
+ await ensureCustomer();
333
+ // \`login\` is registered as PUT on the samchon/shopping backend
334
+ // (\`@TypedRoute.Put("login")\`), not POST. The response has no
335
+ // \`setHeaders\` / no \`token\` field — the existing customer JWT now
336
+ // carries member privileges server-side, so no header rewrite is
337
+ // needed.
338
+ await requestJson("PUT", "/shoppings/customers/authenticate/login", {
339
+ email: SEED_EMAIL,
340
+ password: SEED_PASSWORD,
341
+ });
342
+ }
343
+
344
+ async function ensureAdministrator(): Promise<void> {
345
+ await ensureMemberLogin();
346
+ await requestJson("PUT", "/shoppings/admins/authenticate/login", {
347
+ email: SEED_EMAIL,
348
+ password: SEED_PASSWORD,
349
+ });
350
+ }
351
+
352
+ async function ensureSeller(): Promise<void> {
353
+ await ensureMemberLogin();
354
+ await requestJson("PUT", "/shoppings/sellers/authenticate/login", {
355
+ email: SEED_EMAIL,
356
+ password: SEED_PASSWORD,
357
+ });
358
+ }
359
+
360
+ /**
361
+ * Bootstrap (or rotate) the connection's auth token to the scope demanded
362
+ * by the current pathname.
363
+ *
364
+ * Memoized per scope: the first call per scope drives the fetch chain,
365
+ * concurrent callers reuse the same promise, and successful runs are
366
+ * cached so navigations within the same scope are instant. Failures clear
367
+ * the cache so the next attempt retries cleanly.
368
+ *
369
+ * When \`simulate: true\` is on, this is a no-op because the SDK never
370
+ * touches the network in mock mode.
371
+ */
372
+ export function bootstrapAuth(pathname?: string): Promise<void> {
373
+ if (connection.simulate === true) {
374
+ activeScope = "customer";
375
+ return Promise.resolve();
376
+ }
377
+ const scope = scopeForPathname(pathname);
378
+ if (scope === activeScope && scopePromises[scope] !== undefined) {
379
+ return scopePromises[scope]!;
380
+ }
381
+ const promise = (async () => {
382
+ if (scope === "administrator") await ensureAdministrator();
383
+ else if (scope === "seller") await ensureSeller();
384
+ else if (scope === "citizen") await ensureCitizen();
385
+ else await ensureCustomer();
386
+ })()
387
+ .then(() => {
388
+ activeScope = scope;
389
+ })
390
+ .catch((err: unknown) => {
391
+ scopePromises[scope] = undefined;
392
+ throw err;
393
+ });
394
+ scopePromises[scope] = promise;
395
+ return promise;
396
+ }
397
+ `;
398
+ }
399
+ return `import type { IConnection } from "@nestia/fetcher";
400
+
401
+ /**
402
+ * Mock connection used by every generated page.
403
+ *
404
+ * Defaults to \`simulate: true\` so the project boots usefully without a
405
+ * live backend — the SDK returns typia-generated mock responses for every
406
+ * endpoint. Set \`NEXT_PUBLIC_API_SIMULATE=false\` (and point
407
+ * \`NEXT_PUBLIC_API_HOST\` at the real server) to switch to live mode.
408
+ */
409
+ export const connection: IConnection = {
410
+ host:
411
+ typeof process !== "undefined"
412
+ ? process.env.NEXT_PUBLIC_API_HOST ?? "http://127.0.0.1:37001"
413
+ : "http://127.0.0.1:37001",
414
+ headers: {
415
+ Authorization: process?.env?.NEXT_PUBLIC_API_TOKEN ?? "Bearer preview",
416
+ },
417
+ simulate:
418
+ typeof process === "undefined" ||
419
+ process.env.NEXT_PUBLIC_API_SIMULATE !== "false",
420
+ };
421
+
422
+ /**
423
+ * No-op auth bootstrap for the interface (no-backend) variant. Accepts
424
+ * (and ignores) the pathname so the root layout can call
425
+ * \`bootstrapAuth(pathname)\` unconditionally, no matter which AutoView
426
+ * source generated the project.
427
+ */
428
+ export function bootstrapAuth(_pathname?: string): Promise<void> {
429
+ return Promise.resolve();
430
+ }
431
+ `;
432
+ }
433
+ const BOOTSTRAP_GATE_TSX = `"use client";
434
+
435
+ import { usePathname } from "next/navigation";
436
+ import { useEffect } from "react";
437
+
438
+ import { bootstrapAuth } from "@/src/lib/connection";
439
+
440
+ /**
441
+ * Best-effort auth bootstrap. Attempts to issue the backend's token for the
442
+ * current actor scope on navigation, but NEVER blocks rendering.
443
+ *
444
+ * Auth must not gate the whole app: public screens (catalogs, lists) work
445
+ * without a token, and protected screens surface their own 401 through their
446
+ * normal load/error state. An auth-required backend (shopping / ERP) or a
447
+ * backend that is simply down used to take the ENTIRE app down behind a
448
+ * "Backend not ready" wall — even the public screens. It no longer does:
449
+ * the bootstrap runs in the background and children render immediately.
450
+ */
451
+ export default function BootstrapGate({
452
+ children,
453
+ }: {
454
+ children: React.ReactNode;
455
+ }) {
456
+ const pathname = usePathname();
457
+
458
+ useEffect(() => {
459
+ bootstrapAuth(pathname).catch(() => {
460
+ // Bootstrap failed (no seeded account, auth-required backend, or backend
461
+ // down). Render anyway — each page handles its own loading / error state.
462
+ });
463
+ }, [pathname]);
464
+
465
+ return <>{children}</>;
466
+ }
467
+ `;
468
+ const ROOT_LAYOUT_TSX = `import type { Metadata } from "next";
469
+ import { Archivo } from "next/font/google";
470
+ import "./globals.css";
471
+
472
+ import { AppShell } from "@/components/AppShell";
473
+ import BootstrapGate from "@/src/components/BootstrapGate";
474
+ import { APP_NAME } from "@/src/lib/nav";
475
+
476
+ // Industrial grotesque carrying the whole UI. Wires the \`--font-sans\` variable
477
+ // the theme reads; the gate override must keep it or headings fall back to the
478
+ // browser's default serif.
479
+ const archivo = Archivo({
480
+ subsets: ["latin"],
481
+ variable: "--font-sans",
482
+ display: "swap",
483
+ });
484
+
485
+ export const metadata: Metadata = {
486
+ title: APP_NAME,
487
+ description: "Generated by AutoView from the API's OpenAPI document.",
488
+ };
489
+
490
+ export default function RootLayout({
491
+ children,
492
+ }: {
493
+ children: React.ReactNode;
494
+ }) {
495
+ return (
496
+ <html lang="en" className={\`dark \${archivo.variable}\`} suppressHydrationWarning>
497
+ <body className="min-h-screen bg-background font-sans antialiased">
498
+ <BootstrapGate>
499
+ <AppShell>{children}</AppShell>
500
+ </BootstrapGate>
501
+ </body>
502
+ </html>
503
+ );
504
+ }
505
+ `;
506
+ /**
507
+ * Generate `src/lib/nav.ts` — the sidebar navigation config the AppShell reads.
508
+ * Top-level resources (chain depth 1) become nav items, grouped into data
509
+ * "Resources" (list tables) and "System" (singleton reads). The app name comes
510
+ * from the OpenAPI document title.
511
+ */
512
+ function renderNavTs(document, plan) {
513
+ var _a, _b, _c, _d, _e;
514
+ const appName = ((_b = (_a = document.info) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : "API").trim() || "API";
515
+ const navScreens = plan.screens.filter((s) => (s.depth === undefined || s.depth === 1) &&
516
+ !s.path.includes("[") &&
517
+ (s.uiPattern === "table" ||
518
+ s.uiPattern === "catalog" ||
519
+ s.uiPattern === "detail"));
520
+ // Singleton reads go under "System"; browsable resources go under "Resources",
521
+ // but on a large swagger that one section is 36 flat items. Group them by the
522
+ // resource name's leading token so related resources collapse into a section
523
+ // (shield_information_barrier* → "Shield", legal_hold_* → "Legal"). A token
524
+ // shared by ≥2 resources becomes its own section; lone resources stay under
525
+ // the generic "Resources" heading. Purely cosmetic — no screen is removed.
526
+ const groupKey = new Map(); // href → leading token (singularized)
527
+ const tokenCount = new Map();
528
+ for (const s of navScreens) {
529
+ if (s.uiPattern === "detail")
530
+ continue;
531
+ const resource = (_c = s.path.replace(/^\//, "").split("/")[0]) !== null && _c !== void 0 ? _c : "";
532
+ const token = singularizeToken((_d = resource.split("_")[0]) !== null && _d !== void 0 ? _d : resource);
533
+ groupKey.set(s.path, token);
534
+ tokenCount.set(token, ((_e = tokenCount.get(token)) !== null && _e !== void 0 ? _e : 0) + 1);
535
+ }
536
+ const items = navScreens.map((s) => {
537
+ var _a, _b;
538
+ if (s.uiPattern === "detail") {
539
+ return { href: s.path, title: s.title, group: "System" };
540
+ }
541
+ const token = (_a = groupKey.get(s.path)) !== null && _a !== void 0 ? _a : "";
542
+ const group = ((_b = tokenCount.get(token)) !== null && _b !== void 0 ? _b : 0) >= 2 ? titleCaseToken(token) : "Resources";
543
+ return { href: s.path, title: s.title, group };
544
+ });
545
+ // "Resources" first, named prefix groups alphabetically, "System" last.
546
+ const rank = (g) => g === "Resources" ? 0 : g === "System" ? 2 : 1;
547
+ items.sort((a, b) => rank(a.group) - rank(b.group) ||
548
+ a.group.localeCompare(b.group) ||
549
+ a.title.localeCompare(b.title));
550
+ return [
551
+ `// Generated by AutoView — sidebar navigation derived from the top-level`,
552
+ `// resources of the OpenAPI document.`,
553
+ `export const APP_NAME = ${JSON.stringify(appName)};`,
554
+ ``,
555
+ `export interface NavItem {`,
556
+ ` href: string;`,
557
+ ` title: string;`,
558
+ ` group: string;`,
559
+ `}`,
560
+ ``,
561
+ `export const NAV: NavItem[] = ${JSON.stringify(items, null, 2)};`,
562
+ ``,
563
+ ].join("\n");
564
+ }
565
+ /** Crude singularization of a leading nav token (`folders` → `folder`), used
566
+ * only to bucket related resources; `status`-style 2-letter stems are left
567
+ * alone to avoid over-trimming. */
568
+ function singularizeToken(token) {
569
+ return token.length > 3 && token.endsWith("s") ? token.slice(0, -1) : token;
570
+ }
571
+ /** Title-case a single token for a nav section heading (`shield` → `Shield`). */
572
+ function titleCaseToken(token) {
573
+ return token.length === 0
574
+ ? token
575
+ : token.charAt(0).toUpperCase() + token.slice(1);
576
+ }
577
+ const SDK_ADAPTER_TS = `// AutoView SDK adapter. Pages import \`api\` from this module instead of
578
+ // touching \`@/src/api/\` directly so the SDK surface can be replaced
579
+ // without rewriting every page.
580
+
581
+ import api from "@/src/api";
582
+
583
+ export default api;
584
+ export * from "@/src/api";
585
+ `;
586
+ //# sourceMappingURL=orchestrateAutoViewScaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrateAutoViewScaffold.js","sourceRoot":"","sources":["../../src/orchestrate/orchestrateAutoViewScaffold.ts"],"names":[],"mappings":";;;;;;;;;;;AA6BA,kEA+EC;AAkbD,kCA4DC;AArlBD,+BAA0B;AAE1B,oFAAiF;AAKjF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAsB,2BAA2B,CAC/C,GAA0B,EAC1B,KAcC;;QAED,MAAM,KAAK,GAA2B,EAAE,CAAC;QAEzC,sEAAsE;QACtE,2DAA2D;QAC3D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,mDAAwB,CAAC,EAAE,CAAC;YACpE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACrB,CAAC;QAED,gEAAgE;QAChE,MAAM,QAAQ,GAAoB,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACvD,MAAM,OAAO,GAA2B,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,CACpE,KAAK,CAAC,QAAQ,EACd,EAAE,CACH,CAAC;QACF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACnD,IAAI,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC/B,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACrB,CAAC;QACH,CAAC;QAED,gEAAgE;QAChE,sEAAsE;QACtE,uDAAuD;QACvD,KAAK,CAAC,uBAAuB,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnE,KAAK,CAAC,gBAAgB,CAAC,GAAG,cAAc,CAAC;QAEzC,wEAAwE;QACxE,oEAAoE;QACpE,gEAAgE;QAChE,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B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ import { IAutoViewAgentContext } from "../context/IAutoViewAgentContext";
3
+ import { IAutoViewSdkMap } from "./structures/IAutoViewSdkMap";
4
+ /**
5
+ * Phase 1 of the AutoView agent — SDK Study (deterministic).
6
+ *
7
+ * Derives the SDK domain map (resources / actors / journeys) structurally from
8
+ * the OpenAPI document instead of asking an LLM to read the compiled SDK. This
9
+ * is what lets a large swagger run at all: the former LLM study put the WHOLE
10
+ * SDK source in one prompt (300k+ tokens on a ~200-type spec) and hit a hard
11
+ * context overflow before Product Plan even began. The downstream phases use
12
+ * only the map's structure (Product Plan reads `actors[0].name`; Render reads an
13
+ * actor's journeys on its rerender fallback; Scaffold/Review embed it as a wiki
14
+ * document), so deriving it deterministically changes nothing the user sees —
15
+ * except that it always works, costs no tokens, and is reproducible.
16
+ *
17
+ * Kept `async` to preserve the orchestrator's call shape.
18
+ */
19
+ export declare function orchestrateAutoViewSdkStudy(ctx: IAutoViewAgentContext, props: {
20
+ document: OpenApi.IDocument;
21
+ step: number;
22
+ }): Promise<{
23
+ map: IAutoViewSdkMap;
24
+ markdown: string;
25
+ }>;
26
+ export declare function renderSdkMapMarkdown(summary: string, map: IAutoViewSdkMap): string;