@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,362 @@
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.auditFrontendRuntime = auditFrontendRuntime;
16
+ const child_process_1 = require("child_process");
17
+ const crypto_1 = require("crypto");
18
+ const promises_1 = __importDefault(require("fs/promises"));
19
+ const net_1 = require("net");
20
+ const os_1 = __importDefault(require("os"));
21
+ const path_1 = __importDefault(require("path"));
22
+ const cacheNodeModules_1 = require("./cacheNodeModules");
23
+ const PLAYWRIGHT_DEP = "playwright@^1.50.0";
24
+ const NEXT_DEV_BOOT_TIMEOUT_MS = 90000;
25
+ const PAGE_VISIT_TIMEOUT_MS = 20000;
26
+ const PAGE_SETTLE_MS = 2500;
27
+ /**
28
+ * Boot the assembled frontend under `next dev`, launch a headless Chromium via
29
+ * Playwright, visit every screen the product plan declared, and return the
30
+ * per-page console / pageerror / navigation diagnostics. Used by the
31
+ * orchestrator as Phase 6 (runtime audit) — the layer above `tsc --noEmit` that
32
+ * catches errors typecheck cannot see (`obj?.array.method(...)`
33
+ * undefined-access patterns, missing client-only guards, react render
34
+ * crashes).
35
+ *
36
+ * Operates in `NEXT_PUBLIC_API_SIMULATE=true` so the audit does not require a
37
+ * live backend — the SDK serves typia-random fixture data and pages exercise
38
+ * their real render paths. Live-backend variants can be added later by
39
+ * threading the host through.
40
+ *
41
+ * Throws on infrastructure failure (`npm install` crashed, port allocation
42
+ * failed, Chromium download blocked). Runtime errors on the pages themselves
43
+ * are returned as data; the whole point of this gate is to surface them.
44
+ */
45
+ function auditFrontendRuntime(files, pages) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const startedAt = Date.now();
48
+ const tempDir = yield promises_1.default.mkdtemp(path_1.default.join(os_1.default.tmpdir(), "autoview-runtime-audit-"));
49
+ let nextDev = null;
50
+ try {
51
+ yield writeFiles(tempDir, files);
52
+ const packageJson = files["package.json"];
53
+ const hash = packageJson !== undefined
54
+ ? (0, crypto_1.createHash)("sha256").update(packageJson).digest("hex").slice(0, 16)
55
+ : "no-package-json";
56
+ const cachedNodeModules = packageJson !== undefined
57
+ ? yield (0, cacheNodeModules_1.ensureCachedNodeModules)({
58
+ cacheNamespace: "runtime-audit",
59
+ hash,
60
+ packageJson,
61
+ extraDeps: [PLAYWRIGHT_DEP],
62
+ })
63
+ : null;
64
+ if (cachedNodeModules !== null) {
65
+ const linked = yield (0, cacheNodeModules_1.tryLinkNodeModules)(tempDir, cachedNodeModules);
66
+ if (!linked) {
67
+ yield installDependencies(tempDir);
68
+ yield installPlaywright(tempDir);
69
+ }
70
+ }
71
+ else {
72
+ yield installDependencies(tempDir);
73
+ yield installPlaywright(tempDir);
74
+ }
75
+ yield installChromium(tempDir);
76
+ const port = yield getFreePort();
77
+ nextDev = yield startNextDev(tempDir, port);
78
+ const baseUrl = `http://127.0.0.1:${port}`;
79
+ yield writeFile(tempDir, "scripts/.audit-runner.cjs", buildRunnerScript());
80
+ const stdout = yield spawnCommand("node", [
81
+ path_1.default.join(tempDir, "scripts", ".audit-runner.cjs"),
82
+ JSON.stringify(pages),
83
+ baseUrl,
84
+ String(PAGE_VISIT_TIMEOUT_MS),
85
+ String(PAGE_SETTLE_MS),
86
+ ], { cwd: tempDir });
87
+ const diagnostics = parseRunnerOutput(stdout);
88
+ const byPage = groupByPage(diagnostics);
89
+ return {
90
+ diagnostics,
91
+ byPage,
92
+ visited: [...pages],
93
+ markdown: renderMarkdownReport(diagnostics, byPage, pages),
94
+ elapsedMs: Date.now() - startedAt,
95
+ };
96
+ }
97
+ finally {
98
+ if (nextDev !== null)
99
+ yield killNextDev(nextDev);
100
+ yield promises_1.default.rm(tempDir, { recursive: true, force: true }).catch(() => { });
101
+ }
102
+ });
103
+ }
104
+ /* -------------------------------------------------------------------------- */
105
+ /* fs */
106
+ /* -------------------------------------------------------------------------- */
107
+ function writeFiles(root, files) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ for (const [relative, content] of Object.entries(files)) {
110
+ yield writeFile(root, relative, content);
111
+ }
112
+ });
113
+ }
114
+ function writeFile(root, relative, content) {
115
+ return __awaiter(this, void 0, void 0, function* () {
116
+ const full = path_1.default.join(root, relative);
117
+ yield promises_1.default.mkdir(path_1.default.dirname(full), { recursive: true });
118
+ yield promises_1.default.writeFile(full, content, "utf-8");
119
+ });
120
+ }
121
+ /* -------------------------------------------------------------------------- */
122
+ /* install */
123
+ /* -------------------------------------------------------------------------- */
124
+ function installDependencies(root) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ yield spawnCommand("npm", ["install", "--silent", "--no-audit", "--no-fund"], { cwd: root });
127
+ });
128
+ }
129
+ function installPlaywright(root) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ yield spawnCommand("npm", [
132
+ "install",
133
+ "--silent",
134
+ "--no-audit",
135
+ "--no-fund",
136
+ "--no-save",
137
+ "playwright@^1.50.0",
138
+ ], { cwd: root });
139
+ });
140
+ }
141
+ function installChromium(root) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ yield spawnCommand(path_1.default.join(root, "node_modules", ".bin", "playwright"), ["install", "chromium"], { cwd: root });
144
+ });
145
+ }
146
+ /* -------------------------------------------------------------------------- */
147
+ /* next dev */
148
+ /* -------------------------------------------------------------------------- */
149
+ function getFreePort() {
150
+ return new Promise((resolve, reject) => {
151
+ const server = (0, net_1.createServer)();
152
+ server.listen(0, "127.0.0.1", () => {
153
+ const addr = server.address();
154
+ if (addr === null || typeof addr === "string") {
155
+ server.close();
156
+ reject(new Error("Failed to allocate a free port"));
157
+ return;
158
+ }
159
+ const port = addr.port;
160
+ server.close(() => resolve(port));
161
+ });
162
+ server.on("error", reject);
163
+ });
164
+ }
165
+ function startNextDev(root, port) {
166
+ return new Promise((resolve, reject) => {
167
+ var _a, _b;
168
+ const child = (0, child_process_1.spawn)("node", [path_1.default.join(root, "node_modules", "next", "dist", "bin", "next"), "dev"], {
169
+ cwd: root,
170
+ env: Object.assign(Object.assign({}, process.env), { PORT: String(port), NEXT_PUBLIC_API_SIMULATE: "true",
171
+ // Force literal Authorization header so the SDK does not crash
172
+ // when bootstrapAuth is a no-op in simulator mode.
173
+ NEXT_PUBLIC_API_TOKEN: "Bearer preview" }),
174
+ stdio: ["ignore", "pipe", "pipe"],
175
+ });
176
+ let buffer = "";
177
+ let settled = false;
178
+ const onData = (chunk) => {
179
+ var _a, _b;
180
+ buffer += chunk.toString("utf-8");
181
+ if (!settled && buffer.includes("Ready in")) {
182
+ settled = true;
183
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.off("data", onData);
184
+ (_b = child.stderr) === null || _b === void 0 ? void 0 : _b.off("data", onData);
185
+ resolve(child);
186
+ }
187
+ };
188
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on("data", onData);
189
+ (_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on("data", onData);
190
+ const timer = setTimeout(() => {
191
+ if (settled)
192
+ return;
193
+ settled = true;
194
+ child.kill("SIGTERM");
195
+ reject(new Error(`next dev did not become ready within ${NEXT_DEV_BOOT_TIMEOUT_MS}ms:\n${buffer.slice(-1000)}`));
196
+ }, NEXT_DEV_BOOT_TIMEOUT_MS);
197
+ child.on("exit", (code) => {
198
+ clearTimeout(timer);
199
+ if (settled)
200
+ return;
201
+ settled = true;
202
+ reject(new Error(`next dev exited with code ${code} before becoming ready:\n${buffer.slice(-1000)}`));
203
+ });
204
+ });
205
+ }
206
+ function killNextDev(child) {
207
+ return __awaiter(this, void 0, void 0, function* () {
208
+ if (child.exitCode !== null)
209
+ return;
210
+ child.kill("SIGTERM");
211
+ yield new Promise((r) => setTimeout(r, 1500));
212
+ if (child.exitCode === null)
213
+ child.kill("SIGKILL");
214
+ });
215
+ }
216
+ /* -------------------------------------------------------------------------- */
217
+ /* runner script (executed inside the temp dir, requires installed playwright) */
218
+ /* -------------------------------------------------------------------------- */
219
+ function buildRunnerScript() {
220
+ // CommonJS so the temp dir does not need to be ESM-aware. Reads pages +
221
+ // baseUrl + timeouts from argv, emits a JSON array of `{ pagePath, type,
222
+ // message }` to stdout. Failures during navigation become `navigation`
223
+ // diagnostics so the caller never silently misses a broken page.
224
+ return `"use strict";
225
+ const { chromium } = require("playwright");
226
+
227
+ (async () => {
228
+ const pages = JSON.parse(process.argv[2]);
229
+ const baseUrl = process.argv[3];
230
+ const visitTimeout = parseInt(process.argv[4], 10);
231
+ const settleMs = parseInt(process.argv[5], 10);
232
+ const browser = await chromium.launch();
233
+ const context = await browser.newContext({
234
+ viewport: { width: 1280, height: 800 },
235
+ });
236
+ const diagnostics = [];
237
+ for (const pagePath of pages) {
238
+ const resolved = pagePath.replace(/\\[[^\\]]+\\]/g, "demo");
239
+ const url = baseUrl + (resolved.startsWith("/") ? resolved : "/" + resolved);
240
+ const page = await context.newPage();
241
+ const pageErrors = [];
242
+ page.on("console", (msg) => {
243
+ if (msg.type() === "error") {
244
+ pageErrors.push({ pagePath, type: "console", message: msg.text() });
245
+ }
246
+ });
247
+ page.on("pageerror", (err) => {
248
+ pageErrors.push({ pagePath, type: "pageerror", message: err.message });
249
+ });
250
+ try {
251
+ // \`domcontentloaded\` instead of \`networkidle\` because typia random
252
+ // simulator data keeps the SDK firing background requests indefinitely
253
+ // on data-heavy pages — \`networkidle\` then times out at 20s on a
254
+ // page that already rendered cleanly. DOMContentLoaded plus the
255
+ // explicit settle window catches the same render errors without
256
+ // mistaking simulator chatter for a broken page.
257
+ await page.goto(url, {
258
+ waitUntil: "domcontentloaded",
259
+ timeout: visitTimeout,
260
+ });
261
+ await page.waitForTimeout(settleMs);
262
+ } catch (err) {
263
+ const message = err && err.message ? err.message : String(err);
264
+ pageErrors.push({ pagePath, type: "navigation", message });
265
+ }
266
+ for (const d of pageErrors) diagnostics.push(d);
267
+ await page.close().catch(() => {});
268
+ }
269
+ await browser.close().catch(() => {});
270
+ process.stdout.write(JSON.stringify(diagnostics));
271
+ })().catch((err) => {
272
+ process.stderr.write(err && err.stack ? err.stack : String(err));
273
+ process.exit(1);
274
+ });
275
+ `;
276
+ }
277
+ function parseRunnerOutput(stdout) {
278
+ const trimmed = stdout.trim();
279
+ if (trimmed.length === 0)
280
+ return [];
281
+ try {
282
+ const parsed = JSON.parse(trimmed);
283
+ if (!Array.isArray(parsed))
284
+ return [];
285
+ return parsed.filter((entry) => entry !== null &&
286
+ typeof entry === "object" &&
287
+ typeof entry.pagePath === "string" &&
288
+ typeof entry.message === "string" &&
289
+ entry.type !== undefined);
290
+ }
291
+ catch (_a) {
292
+ return [];
293
+ }
294
+ }
295
+ function groupByPage(diagnostics) {
296
+ const map = new Map();
297
+ for (const d of diagnostics) {
298
+ const bucket = map.get(d.pagePath);
299
+ if (bucket === undefined)
300
+ map.set(d.pagePath, [d]);
301
+ else
302
+ bucket.push(d);
303
+ }
304
+ return map;
305
+ }
306
+ function renderMarkdownReport(diagnostics, byPage, pages) {
307
+ if (diagnostics.length === 0) {
308
+ return [
309
+ "# Runtime audit",
310
+ "",
311
+ `Visited **${pages.length}** page(s) under \`next dev\` (simulator mode).`,
312
+ "No console errors, page errors, or navigation failures detected.",
313
+ "",
314
+ ].join("\n");
315
+ }
316
+ const head = [
317
+ "# Runtime audit",
318
+ "",
319
+ `Visited **${pages.length}** page(s) under \`next dev\` (simulator mode).`,
320
+ `Detected **${diagnostics.length}** diagnostic(s) across **${byPage.size}** page(s).`,
321
+ "",
322
+ ];
323
+ const sections = [...byPage.entries()]
324
+ .sort(([a], [b]) => a.localeCompare(b))
325
+ .map(([pagePath, items]) => {
326
+ const lines = items.map((d) => `- \`${d.type}\` — ${escape(d.message)}`);
327
+ return [`## \`${pagePath}\` (${items.length})`, "", ...lines, ""].join("\n");
328
+ });
329
+ return [...head, ...sections].join("\n");
330
+ }
331
+ function escape(message) {
332
+ return message.replace(/`/g, "\\`").replace(/\n+/g, " ").slice(0, 500);
333
+ }
334
+ /* -------------------------------------------------------------------------- */
335
+ /* spawn */
336
+ /* -------------------------------------------------------------------------- */
337
+ function spawnCommand(cmd, args, options) {
338
+ return new Promise((resolve, reject) => {
339
+ const child = (0, child_process_1.spawn)(cmd, args, { cwd: options.cwd, stdio: "pipe" });
340
+ let stdout = "";
341
+ let stderr = "";
342
+ child.stdout.on("data", (chunk) => {
343
+ stdout += chunk.toString("utf-8");
344
+ });
345
+ child.stderr.on("data", (chunk) => {
346
+ stderr += chunk.toString("utf-8");
347
+ });
348
+ child.on("error", (err) => {
349
+ reject(new Error(`Failed to spawn \`${cmd} ${args.join(" ")}\`: ${err.message}`));
350
+ });
351
+ child.on("close", (code) => {
352
+ if (code === 0) {
353
+ resolve(stdout);
354
+ }
355
+ else {
356
+ reject(new Error(`\`${cmd} ${args.slice(0, 3).join(" ")}...\` exited with code ${code}` +
357
+ (stderr.length > 0 ? `:\n${stderr.slice(-1500)}` : "")));
358
+ }
359
+ });
360
+ });
361
+ }
362
+ //# sourceMappingURL=auditFrontendRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auditFrontendRuntime.js","sourceRoot":"","sources":["../../../src/orchestrate/utils/auditFrontendRuntime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAwEA,oDAmEC;AA3ID,iDAAyD;AACzD,mCAAoC;AACpC,2DAA6B;AAC7B,6BAAmC;AACnC,4CAAoB;AACpB,gDAAwB;AAExB,yDAG4B;AAE5B,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAsC5C,MAAM,wBAAwB,GAAG,KAAM,CAAC;AACxC,MAAM,qBAAqB,GAAG,KAAM,CAAC;AACrC,MAAM,cAAc,GAAG,IAAK,CAAC;AAE7B;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAsB,oBAAoB,CACxC,KAA6B,EAC7B,KAAe;;QAEf,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,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AC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACxB,MAAM,CACJ,IAAI,KAAK,CACP,qBAAqB,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,OAAO,EAAE,CAC/D,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,MAAM,CACJ,IAAI,KAAK,CACP,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,IAAI,EAAE;oBACpE,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;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { OpenApi } from "@typia/interface";
2
+ import { IEndpointFilter } from "../../utils";
3
+ import { IAutoViewProductPlan } from "../structures/IAutoViewProductPlan";
4
+ export declare function buildDeterministicPlan(document: OpenApi.IDocument, actor: string, filter?: IEndpointFilter): IAutoViewProductPlan;
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildDeterministicPlan = buildDeterministicPlan;
4
+ const utils_1 = require("../../utils");
5
+ const renderResourcePage_1 = require("./renderResourcePage");
6
+ /**
7
+ * Deterministic Product Plan — the LLM ProductPlan's replacement.
8
+ *
9
+ * The old Phase 2 asked an LLM to invent an information architecture from a
10
+ * commerce-baked prompt: non-reproducible, domain-locked, no CRUD completeness.
11
+ * This builds the exact same {@link IAutoViewProductPlan} shape the Scaffold /
12
+ * Render phases consume, but structurally — from {@link resourcePlan}. Same
13
+ * swagger always yields the same screens; every resource that exposes a
14
+ * capability gets its screen; nothing is invented.
15
+ *
16
+ * Actors are not modeled yet (the READ layer dropped `authorizationActor` when
17
+ * it went swagger-native), so every screen is assigned the single `actor`
18
+ * passed in. Multi-actor navigation is a follow-up that restores per-endpoint
19
+ * actor tagging.
20
+ */
21
+ const UI_PATTERN = {
22
+ list: "table",
23
+ detail: "detail",
24
+ create: "form",
25
+ edit: "form",
26
+ };
27
+ /**
28
+ * A "top-level" screen earns a spot in the landing hub + primary nav: a list
29
+ * table, a catalog, or a singleton read (a bracket-less detail page like
30
+ * `/system`). Entity-detail / create / edit pages — which carry a `[param]` and
31
+ * are reached from a list — do not.
32
+ */
33
+ function isTopLevel(screen) {
34
+ // A landing card is a TOP-LEVEL resource (chain depth 1). Depth ≥ 2 — a nested
35
+ // resource (`/sales/[saleId]/questions`) OR a param-less sub-view
36
+ // (`/sales/details`, `/channels/hierarchical`) — is reached from its parent,
37
+ // never the home hub. Using the structural depth, not a `[` heuristic, keeps
38
+ // bracket-less nested paths off the hub.
39
+ if (screen.depth !== undefined && screen.depth !== 1)
40
+ return false;
41
+ if (screen.path.includes("["))
42
+ return false;
43
+ return (screen.uiPattern === "table" ||
44
+ screen.uiPattern === "catalog" ||
45
+ screen.uiPattern === "detail");
46
+ }
47
+ /** Humanize a snake_case resource name for prose: `file_version_legal_holds`
48
+ * → `file version legal holds`. Keeps it lower-case for mid-sentence use. */
49
+ function humanizeResource(resource) {
50
+ return resource.replace(/_/g, " ").trim();
51
+ }
52
+ function purposeOf(screen) {
53
+ const name = humanizeResource(screen.resource);
54
+ switch (screen.kind) {
55
+ case "list":
56
+ return `Browse and search ${name}.`;
57
+ case "detail":
58
+ return `View one ${name} and act on it.`;
59
+ case "create":
60
+ return `Create a new ${name}.`;
61
+ case "edit":
62
+ return `Edit an existing ${name}.`;
63
+ }
64
+ }
65
+ function notesOf(screen) {
66
+ switch (screen.kind) {
67
+ case "list":
68
+ return screen.secondary.some((c) => c.role === "search")
69
+ ? "Includes search/filter; rows link to the detail screen."
70
+ : "Rows link to the detail screen.";
71
+ case "detail":
72
+ return "Surfaces update / delete / action endpoints as buttons.";
73
+ case "create":
74
+ return "Render a form from the request-body schema; submit creates.";
75
+ case "edit":
76
+ return "Render a form from the request-body schema, prefilled from detail.";
77
+ }
78
+ }
79
+ function accessorsOf(screen) {
80
+ return [
81
+ screen.primary.accessor.join("."),
82
+ ...screen.secondary.map((c) => c.endpoint.accessor.join(".")),
83
+ ].filter((a, i, arr) => a.length > 0 && arr.indexOf(a) === i);
84
+ }
85
+ function classifyListResponse(op, document) {
86
+ if (op === undefined || (op.responseBody === null && op.responseSchema === null))
87
+ return "void";
88
+ // Use the SAME collection detection the table renderer uses, so a response is
89
+ // classed browsable iff a real row collection (incl. resource-named / inline
90
+ // wrappers, DigitalOcean) can actually be rendered as a table.
91
+ if ((0, renderResourcePage_1.responseCollection)(op, document) !== null)
92
+ return "browsable";
93
+ return op.method.toLowerCase() === "get" ? "singleton-read" : "action";
94
+ }
95
+ function buildDeterministicPlan(document, actor, filter = {}) {
96
+ var _a, _b, _c;
97
+ const endpoints = (0, utils_1.filterEndpoints)((0, utils_1.toEndpoints)(document), filter);
98
+ const planned = (0, utils_1.resourcePlan)(endpoints, document);
99
+ const byAccessor = new Map(endpoints.map((e) => [e.accessor.join("."), e]));
100
+ const noiseOmissions = [];
101
+ const resourceScreens = [];
102
+ for (const s of planned) {
103
+ const screen = {
104
+ path: s.path,
105
+ title: s.title,
106
+ purpose: purposeOf(s),
107
+ actor,
108
+ endpoints: accessorsOf(s),
109
+ uiPattern: UI_PATTERN[s.kind],
110
+ notes: notesOf(s),
111
+ depth: s.depth,
112
+ };
113
+ // A table screen must have a browsable response, or it is noise. Downgrade
114
+ // singleton reads to detail views; omit voids and action verbs.
115
+ if (screen.uiPattern === "table") {
116
+ const op = byAccessor.get(s.primary.accessor.join("."));
117
+ const cls = classifyListResponse(op, document);
118
+ if (cls === "void" || cls === "action") {
119
+ noiseOmissions.push({
120
+ target: `${(_a = op === null || op === void 0 ? void 0 : op.method.toUpperCase()) !== null && _a !== void 0 ? _a : "?"} ${(_b = op === null || op === void 0 ? void 0 : op.path) !== null && _b !== void 0 ? _b : s.path}`,
121
+ reason: cls === "void"
122
+ ? "No response body to display."
123
+ : "Action endpoint (single object from a mutating verb) — not a browsable list.",
124
+ });
125
+ continue;
126
+ }
127
+ if (cls === "singleton-read") {
128
+ resourceScreens.push(Object.assign(Object.assign({}, screen), { uiPattern: "detail", purpose: `View ${humanizeResource(s.resource)}.`, notes: "Singleton read — one record, not a list." }));
129
+ continue;
130
+ }
131
+ // Browsable: a collection whose rows carry an image + a title reads far
132
+ // better as a catalog of cards than a dense table. Purely structural —
133
+ // the element schema decides, no domain keywords.
134
+ const collection = op ? (0, renderResourcePage_1.responseCollection)(op, document) : null;
135
+ if (collection !== null && (0, utils_1.isCatalogCollection)(collection.columns)) {
136
+ resourceScreens.push(Object.assign(Object.assign({}, screen), { uiPattern: "catalog", notes: "Image + title rows — rendered as a card catalog." }));
137
+ continue;
138
+ }
139
+ }
140
+ resourceScreens.push(screen);
141
+ }
142
+ // Drop write-only resources. A browse app shows data, so a resource that has
143
+ // no list / detail / search screen at all — only a create/update form or an
144
+ // RPC verb (OAuth2 `token`/`revoke`, a `metadata_query/execute_read`) — is
145
+ // pure nav noise: a lone form seated next to real resources in the primary
146
+ // nav. Omit it (auditably) so a large swagger's sidebar shows browsable
147
+ // resources, not every endpoint.
148
+ const resourceKeyOf = (p) => { var _a; return (_a = p.split("/").filter((s) => s.length > 0 && !s.startsWith("[")).at(0)) !== null && _a !== void 0 ? _a : p; };
149
+ const resourceHasRead = new Map();
150
+ for (const s of resourceScreens) {
151
+ const key = resourceKeyOf(s.path);
152
+ const isRead = s.uiPattern === "table" || s.uiPattern === "detail";
153
+ resourceHasRead.set(key, ((_c = resourceHasRead.get(key)) !== null && _c !== void 0 ? _c : false) || isRead);
154
+ }
155
+ const browsableScreens = resourceScreens
156
+ .filter((s) => resourceHasRead.get(resourceKeyOf(s.path)) === true)
157
+ // Alphabetical by path so a large swagger's sidebar is scannable (same
158
+ // resource's pages stay grouped: /x, /x/[id], /x/[id]/edit, /x/new).
159
+ .sort((a, b) => a.path.localeCompare(b.path));
160
+ for (const s of resourceScreens) {
161
+ if (resourceHasRead.get(resourceKeyOf(s.path)) === true)
162
+ continue;
163
+ for (const accessor of s.endpoints) {
164
+ const op = byAccessor.get(accessor);
165
+ noiseOmissions.push({
166
+ target: op ? `${op.method.toUpperCase()} ${op.path}` : s.path,
167
+ reason: "Write-only resource (no list/detail/search to browse) — omitted from the UI as nav noise.",
168
+ });
169
+ }
170
+ }
171
+ // Root landing hub. Without an explicit `/` screen the dev server shows the
172
+ // template's "not customized yet" placeholder; this links to each resource's
173
+ // list and fetches nothing of its own.
174
+ const home = {
175
+ path: "/",
176
+ title: "Home",
177
+ purpose: "Landing hub linking to each resource.",
178
+ actor,
179
+ endpoints: [],
180
+ uiPattern: "landing",
181
+ notes: "Links to each resource's list screen; no data fetch of its own.",
182
+ };
183
+ const screens = [home, ...browsableScreens];
184
+ // Single-actor navigation: home + every top-level screen leads the primary
185
+ // nav. "Top-level" = a list table or a singleton read (a bracket-less detail
186
+ // page like `/system`); entity-detail / create / edit pages (which carry a
187
+ // `[param]` or are reached from a list) go to secondary.
188
+ const topLevelPaths = browsableScreens
189
+ .filter((s) => isTopLevel(s))
190
+ .map((s) => s.path);
191
+ const secondary = browsableScreens
192
+ .filter((s) => !isTopLevel(s))
193
+ .map((s) => s.path);
194
+ const navigation = [
195
+ { actor, primary: ["/", ...topLevelPaths], secondary },
196
+ ];
197
+ // Operations the READ layer could not turn into a screen — surfaced as
198
+ // honest omissions instead of vanishing. Noise screens (auth/monitoring verbs)
199
+ // removed above are reported here too, so "omitted, not broken" stays auditable.
200
+ const intentionalOmissions = [
201
+ ...noiseOmissions,
202
+ ...(0, utils_1.unsupportedOperations)(document).map((u) => ({
203
+ target: `${u.method} ${u.path}`,
204
+ reason: `Unsupported content type — ${u.reason}`,
205
+ })),
206
+ ];
207
+ // Integrity backstop — "정확하게 읽는다" rule #1: nothing the READ layer parsed
208
+ // may silently vanish. Every operation must be referenced by some screen
209
+ // (primary or secondary) or appear in an omission. Anything left over (a
210
+ // second create on a resource that already had one, a deeply nested
211
+ // delete with no detail to host it, an auth verb that did not classify) is
212
+ // recorded here so coverage is total and auditable rather than lossy.
213
+ const referenced = new Set();
214
+ for (const s of browsableScreens)
215
+ for (const a of s.endpoints)
216
+ referenced.add(a);
217
+ const omittedPaths = new Set(intentionalOmissions.map((o) => o.target));
218
+ for (const e of endpoints) {
219
+ const accessor = e.accessor.join(".");
220
+ if (referenced.has(accessor))
221
+ continue;
222
+ const target = `${e.method.toUpperCase()} ${e.path}`;
223
+ if (omittedPaths.has(target))
224
+ continue;
225
+ intentionalOmissions.push({
226
+ target,
227
+ reason: `Not yet mapped to a screen (accessor ${accessor}) — a duplicate-role or deeply nested endpoint the deterministic plan does not surface yet.`,
228
+ });
229
+ omittedPaths.add(target);
230
+ }
231
+ return { screens, navigation, intentionalOmissions };
232
+ }
233
+ //# sourceMappingURL=buildDeterministicPlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildDeterministicPlan.js","sourceRoot":"","sources":["../../../src/orchestrate/utils/buildDeterministicPlan.ts"],"names":[],"mappings":";;AAoIA,wDA4JC;AA9RD,uCAUqB;AAErB,6DAA0D;AAE1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,GAAuD;IACrE,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,QAAQ;IAChB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ViewSdkMap";
3
+ /**
4
+ * Deterministic SDK domain map — the LLM-free replacement for the Phase-1 SDK
5
+ * Study, and the fix for "a large swagger overflows the model's context".
6
+ *
7
+ * The original SDK Study compiled the WHOLE SDK source and asked the model to
8
+ * infer resources / actors / journeys. On a 200-type swagger that prompt is
9
+ * 300k+ tokens — a hard context overflow. But the downstream phases barely use
10
+ * the map's prose: the Product Plan is already deterministic and reads only
11
+ * `actors[0].name`; Scaffold/Review embed the map as a wiki document; Render
12
+ * reads an actor's journeys only on the LLM rerender fallback. So the map can be
13
+ * derived structurally — same swagger, same map, zero tokens — without changing
14
+ * what reaches the user.
15
+ *
16
+ * - resources: the top-level CRUD groups from {@link classifyEndpoints}.
17
+ * - actors: role segments found in the accessors (`customers`, `sellers`,
18
+ * `admins`), normalized; falls back to a single `user`.
19
+ * - journeys: a short structural summary per actor (never empty — the SDK-map
20
+ * invariant requires ≥1 per actor).
21
+ */
22
+ export declare function buildDeterministicSdkMap(document: OpenApi.IDocument): IAutoViewSdkMap;