@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.
- package/LICENSE +661 -0
- package/README.md +407 -0
- package/lib/AutoViewAgent.d.ts +109 -0
- package/lib/AutoViewAgent.js +123 -0
- package/lib/AutoViewAgent.js.map +1 -0
- package/lib/agent/emitMcpServer.d.ts +15 -0
- package/lib/agent/emitMcpServer.js +157 -0
- package/lib/agent/emitMcpServer.js.map +1 -0
- package/lib/agent/emitReport.d.ts +14 -0
- package/lib/agent/emitReport.js +85 -0
- package/lib/agent/emitReport.js.map +1 -0
- package/lib/agent/toolSurface.d.ts +130 -0
- package/lib/agent/toolSurface.js +342 -0
- package/lib/agent/toolSurface.js.map +1 -0
- package/lib/agent/verifyAgentTasks.d.ts +87 -0
- package/lib/agent/verifyAgentTasks.js +126 -0
- package/lib/agent/verifyAgentTasks.js.map +1 -0
- package/lib/cli/main.d.ts +2 -0
- package/lib/cli/main.js +295 -0
- package/lib/cli/main.js.map +1 -0
- package/lib/compiler/AutoViewInterfaceCompiler.d.ts +27 -0
- package/lib/compiler/AutoViewInterfaceCompiler.js +68 -0
- package/lib/compiler/AutoViewInterfaceCompiler.js.map +1 -0
- package/lib/constants/AutoViewFrontendTemplate.d.ts +1 -0
- package/lib/constants/AutoViewFrontendTemplate.js +46 -0
- package/lib/constants/AutoViewFrontendTemplate.js.map +1 -0
- package/lib/constants/AutoViewSystemPromptConstant.d.ts +5 -0
- package/lib/constants/AutoViewSystemPromptConstant.js +4 -0
- package/lib/constants/AutoViewSystemPromptConstant.js.map +1 -0
- package/lib/context/IAutoViewAgentContext.d.ts +60 -0
- package/lib/context/IAutoViewAgentContext.js +3 -0
- package/lib/context/IAutoViewAgentContext.js.map +1 -0
- package/lib/fromSwagger.d.ts +53 -0
- package/lib/fromSwagger.js +513 -0
- package/lib/fromSwagger.js.map +1 -0
- package/lib/generateDeterministic.d.ts +26 -0
- package/lib/generateDeterministic.js +75 -0
- package/lib/generateDeterministic.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.js +41 -0
- package/lib/index.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoView.d.ts +17 -0
- package/lib/orchestrate/orchestrateAutoView.js +491 -0
- package/lib/orchestrate/orchestrateAutoView.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewProductPlan.d.ts +37 -0
- package/lib/orchestrate/orchestrateAutoViewProductPlan.js +109 -0
- package/lib/orchestrate/orchestrateAutoViewProductPlan.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewRender.d.ts +133 -0
- package/lib/orchestrate/orchestrateAutoViewRender.js +943 -0
- package/lib/orchestrate/orchestrateAutoViewRender.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.d.ts +24 -0
- package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js +92 -0
- package/lib/orchestrate/orchestrateAutoViewRenderDeterministic.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewReview.d.ts +48 -0
- package/lib/orchestrate/orchestrateAutoViewReview.js +328 -0
- package/lib/orchestrate/orchestrateAutoViewReview.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewScaffold.d.ts +45 -0
- package/lib/orchestrate/orchestrateAutoViewScaffold.js +586 -0
- package/lib/orchestrate/orchestrateAutoViewScaffold.js.map +1 -0
- package/lib/orchestrate/orchestrateAutoViewSdkStudy.d.ts +26 -0
- package/lib/orchestrate/orchestrateAutoViewSdkStudy.js +85 -0
- package/lib/orchestrate/orchestrateAutoViewSdkStudy.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewProductPlan.d.ts +96 -0
- package/lib/orchestrate/structures/IAutoViewProductPlan.js +3 -0
- package/lib/orchestrate/structures/IAutoViewProductPlan.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewProductPlanApplication.d.ts +38 -0
- package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewProductPlanApplication.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewRenderApplication.d.ts +38 -0
- package/lib/orchestrate/structures/IAutoViewRenderApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewRenderApplication.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewReviewApplication.d.ts +40 -0
- package/lib/orchestrate/structures/IAutoViewReviewApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewReviewApplication.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewSdkMap.d.ts +63 -0
- package/lib/orchestrate/structures/IAutoViewSdkMap.js +3 -0
- package/lib/orchestrate/structures/IAutoViewSdkMap.js.map +1 -0
- package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.d.ts +37 -0
- package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js +3 -0
- package/lib/orchestrate/structures/IAutoViewSdkStudyApplication.js.map +1 -0
- package/lib/orchestrate/utils/HistoryMessage.d.ts +10 -0
- package/lib/orchestrate/utils/HistoryMessage.js +25 -0
- package/lib/orchestrate/utils/HistoryMessage.js.map +1 -0
- package/lib/orchestrate/utils/auditFrontendRuntime.d.ts +53 -0
- package/lib/orchestrate/utils/auditFrontendRuntime.js +362 -0
- package/lib/orchestrate/utils/auditFrontendRuntime.js.map +1 -0
- package/lib/orchestrate/utils/buildDeterministicPlan.d.ts +4 -0
- package/lib/orchestrate/utils/buildDeterministicPlan.js +233 -0
- package/lib/orchestrate/utils/buildDeterministicPlan.js.map +1 -0
- package/lib/orchestrate/utils/buildDeterministicSdkMap.d.ts +22 -0
- package/lib/orchestrate/utils/buildDeterministicSdkMap.js +154 -0
- package/lib/orchestrate/utils/buildDeterministicSdkMap.js.map +1 -0
- package/lib/orchestrate/utils/cacheNodeModules.d.ts +31 -0
- package/lib/orchestrate/utils/cacheNodeModules.js +134 -0
- package/lib/orchestrate/utils/cacheNodeModules.js.map +1 -0
- package/lib/orchestrate/utils/describeEndpointPropsShape.d.ts +37 -0
- package/lib/orchestrate/utils/describeEndpointPropsShape.js +192 -0
- package/lib/orchestrate/utils/describeEndpointPropsShape.js.map +1 -0
- package/lib/orchestrate/utils/describeEndpointRequestBodyShape.d.ts +22 -0
- package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js +29 -0
- package/lib/orchestrate/utils/describeEndpointRequestBodyShape.js.map +1 -0
- package/lib/orchestrate/utils/describeEndpointResponseShape.d.ts +19 -0
- package/lib/orchestrate/utils/describeEndpointResponseShape.js +30 -0
- package/lib/orchestrate/utils/describeEndpointResponseShape.js.map +1 -0
- package/lib/orchestrate/utils/executeCachedBatch.d.ts +22 -0
- package/lib/orchestrate/utils/executeCachedBatch.js +64 -0
- package/lib/orchestrate/utils/executeCachedBatch.js.map +1 -0
- package/lib/orchestrate/utils/loadShoppingFixture.d.ts +33 -0
- package/lib/orchestrate/utils/loadShoppingFixture.js +17 -0
- package/lib/orchestrate/utils/loadShoppingFixture.js.map +1 -0
- package/lib/orchestrate/utils/normalizeProductPlanPaths.d.ts +24 -0
- package/lib/orchestrate/utils/normalizeProductPlanPaths.js +77 -0
- package/lib/orchestrate/utils/normalizeProductPlanPaths.js.map +1 -0
- package/lib/orchestrate/utils/renderJsonSchema.d.ts +23 -0
- package/lib/orchestrate/utils/renderJsonSchema.js +122 -0
- package/lib/orchestrate/utils/renderJsonSchema.js.map +1 -0
- package/lib/orchestrate/utils/renderResourcePage.d.ts +36 -0
- package/lib/orchestrate/utils/renderResourcePage.js +1415 -0
- package/lib/orchestrate/utils/renderResourcePage.js.map +1 -0
- package/lib/orchestrate/utils/validateFrontendTypecheck.d.ts +109 -0
- package/lib/orchestrate/utils/validateFrontendTypecheck.js +274 -0
- package/lib/orchestrate/utils/validateFrontendTypecheck.js.map +1 -0
- package/lib/preview/renderPreview.d.ts +22 -0
- package/lib/preview/renderPreview.js +198 -0
- package/lib/preview/renderPreview.js.map +1 -0
- package/lib/typings/compiler.d.ts +39 -0
- package/lib/typings/compiler.js +3 -0
- package/lib/typings/compiler.js.map +1 -0
- package/lib/typings/events.d.ts +106 -0
- package/lib/typings/events.js +3 -0
- package/lib/typings/events.js.map +1 -0
- package/lib/typings/index.d.ts +10 -0
- package/lib/typings/index.js +27 -0
- package/lib/typings/index.js.map +1 -0
- package/lib/typings/misc.d.ts +78 -0
- package/lib/typings/misc.js +3 -0
- package/lib/typings/misc.js.map +1 -0
- package/lib/utils/ArrayUtil.d.ts +8 -0
- package/lib/utils/ArrayUtil.js +30 -0
- package/lib/utils/ArrayUtil.js.map +1 -0
- package/lib/utils/StringUtil.d.ts +11 -0
- package/lib/utils/StringUtil.js +28 -0
- package/lib/utils/StringUtil.js.map +1 -0
- package/lib/utils/classifyEndpoints.d.ts +62 -0
- package/lib/utils/classifyEndpoints.js +216 -0
- package/lib/utils/classifyEndpoints.js.map +1 -0
- package/lib/utils/endpointFilter.d.ts +26 -0
- package/lib/utils/endpointFilter.js +0 -0
- package/lib/utils/endpointFilter.js.map +1 -0
- package/lib/utils/extractFields.d.ts +85 -0
- package/lib/utils/extractFields.js +231 -0
- package/lib/utils/extractFields.js.map +1 -0
- package/lib/utils/index.d.ts +13 -0
- package/lib/utils/index.js +30 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/normalizeForNestia.d.ts +34 -0
- package/lib/utils/normalizeForNestia.js +133 -0
- package/lib/utils/normalizeForNestia.js.map +1 -0
- package/lib/utils/resourcePlan.d.ts +39 -0
- package/lib/utils/resourcePlan.js +95 -0
- package/lib/utils/resourcePlan.js.map +1 -0
- package/lib/utils/sliceDocument.d.ts +17 -0
- package/lib/utils/sliceDocument.js +114 -0
- package/lib/utils/sliceDocument.js.map +1 -0
- package/lib/utils/toEndpoints.d.ts +90 -0
- package/lib/utils/toEndpoints.js +227 -0
- package/lib/utils/toEndpoints.js.map +1 -0
- package/lib/verify/runWorkflows.d.ts +25 -0
- package/lib/verify/runWorkflows.js +366 -0
- package/lib/verify/runWorkflows.js.map +1 -0
- package/lib/verify/workflows.d.ts +53 -0
- package/lib/verify/workflows.js +107 -0
- package/lib/verify/workflows.js.map +1 -0
- package/package.json +82 -0
- package/prompts/AUTOVIEW_RENDER.md +398 -0
- package/prompts/AUTOVIEW_REVIEW.md +60 -0
- package/prompts/AUTOVIEW_SDK_STUDY.md +89 -0
- package/src/AutoViewAgent.ts +222 -0
- package/src/agent/emitMcpServer.integration.test.ts +168 -0
- package/src/agent/emitMcpServer.test.ts +51 -0
- package/src/agent/emitMcpServer.ts +178 -0
- package/src/agent/emitReport.ts +117 -0
- package/src/agent/toolSurface.test.ts +243 -0
- package/src/agent/toolSurface.ts +501 -0
- package/src/agent/verifyAgentTasks.test.ts +106 -0
- package/src/agent/verifyAgentTasks.ts +171 -0
- package/src/cli/main.ts +363 -0
- package/src/compiler/AutoViewInterfaceCompiler.ts +69 -0
- package/src/constants/AutoViewFrontendTemplate.ts +42 -0
- package/src/constants/AutoViewSystemPromptConstant.ts +6 -0
- package/src/context/IAutoViewAgentContext.ts +84 -0
- package/src/fromSwagger.test.ts +269 -0
- package/src/fromSwagger.ts +500 -0
- package/src/generateDeterministic.test.ts +39 -0
- package/src/generateDeterministic.ts +77 -0
- package/src/index.ts +30 -0
- package/src/orchestrate/orchestrateAutoView.ts +590 -0
- package/src/orchestrate/orchestrateAutoViewProductPlan.ts +121 -0
- package/src/orchestrate/orchestrateAutoViewRender.ts +1117 -0
- package/src/orchestrate/orchestrateAutoViewRenderDeterministic.ts +101 -0
- package/src/orchestrate/orchestrateAutoViewReview.ts +272 -0
- package/src/orchestrate/orchestrateAutoViewScaffold.ts +627 -0
- package/src/orchestrate/orchestrateAutoViewSdkStudy.ts +90 -0
- package/src/orchestrate/renderNavTs.test.ts +74 -0
- package/src/orchestrate/structures/IAutoViewProductPlan.ts +119 -0
- package/src/orchestrate/structures/IAutoViewProductPlanApplication.ts +41 -0
- package/src/orchestrate/structures/IAutoViewRenderApplication.ts +40 -0
- package/src/orchestrate/structures/IAutoViewReviewApplication.ts +42 -0
- package/src/orchestrate/structures/IAutoViewSdkMap.ts +72 -0
- package/src/orchestrate/structures/IAutoViewSdkStudyApplication.ts +40 -0
- package/src/orchestrate/utils/HistoryMessage.ts +41 -0
- package/src/orchestrate/utils/auditFrontendRuntime.test.ts +18 -0
- package/src/orchestrate/utils/auditFrontendRuntime.ts +454 -0
- package/src/orchestrate/utils/buildDeterministicPlan.test.ts +170 -0
- package/src/orchestrate/utils/buildDeterministicPlan.ts +289 -0
- package/src/orchestrate/utils/buildDeterministicSdkMap.test.ts +90 -0
- package/src/orchestrate/utils/buildDeterministicSdkMap.ts +169 -0
- package/src/orchestrate/utils/cacheNodeModules.ts +136 -0
- package/src/orchestrate/utils/describeEndpointPropsShape.test.ts +86 -0
- package/src/orchestrate/utils/describeEndpointPropsShape.ts +202 -0
- package/src/orchestrate/utils/describeEndpointRequestBodyShape.test.ts +87 -0
- package/src/orchestrate/utils/describeEndpointRequestBodyShape.ts +31 -0
- package/src/orchestrate/utils/describeEndpointResponseShape.test.ts +70 -0
- package/src/orchestrate/utils/describeEndpointResponseShape.ts +32 -0
- package/src/orchestrate/utils/executeCachedBatch.ts +59 -0
- package/src/orchestrate/utils/loadShoppingFixture.ts +52 -0
- package/src/orchestrate/utils/normalizeProductPlanPaths.ts +92 -0
- package/src/orchestrate/utils/renderJsonSchema.test.ts +162 -0
- package/src/orchestrate/utils/renderJsonSchema.ts +133 -0
- package/src/orchestrate/utils/renderResourcePage.test.ts +468 -0
- package/src/orchestrate/utils/renderResourcePage.ts +1624 -0
- package/src/orchestrate/utils/validateFrontendTypecheck.test.ts +32 -0
- package/src/orchestrate/utils/validateFrontendTypecheck.ts +335 -0
- package/src/preview/renderPreview.ts +273 -0
- package/src/typings/compiler.ts +47 -0
- package/src/typings/events.ts +155 -0
- package/src/typings/index.ts +10 -0
- package/src/typings/misc.ts +93 -0
- package/src/utils/ArrayUtil.ts +16 -0
- package/src/utils/StringUtil.ts +29 -0
- package/src/utils/classifyEndpoints.test.ts +86 -0
- package/src/utils/classifyEndpoints.ts +291 -0
- package/src/utils/endpointFilter.test.ts +50 -0
- package/src/utils/endpointFilter.ts +0 -0
- package/src/utils/extractFields.test.ts +82 -0
- package/src/utils/extractFields.ts +306 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/normalizeForNestia.test.ts +93 -0
- package/src/utils/normalizeForNestia.ts +139 -0
- package/src/utils/resourcePlan.test.ts +104 -0
- package/src/utils/resourcePlan.ts +180 -0
- package/src/utils/sliceDocument.test.ts +85 -0
- package/src/utils/sliceDocument.ts +119 -0
- package/src/utils/toEndpoints.test.ts +251 -0
- package/src/utils/toEndpoints.ts +343 -0
- package/src/verify/runWorkflows.ts +403 -0
- package/src/verify/workflows.test.ts +117 -0
- package/src/verify/workflows.ts +154 -0
- package/template/CLAUDE.md +140 -0
- package/template/Dockerfile +31 -0
- package/template/PROMPT.md +80 -0
- package/template/SANDBOX.md +70 -0
- package/template/app/api/health/route.ts +10 -0
- package/template/app/globals.css +97 -0
- package/template/app/layout.tsx +30 -0
- package/template/app/page.tsx +19 -0
- package/template/components/AppShell.tsx +114 -0
- package/template/components/auto/CatalogGrid.tsx +159 -0
- package/template/components/auto/ConfirmButton.tsx +67 -0
- package/template/components/auto/EmbeddedCollection.tsx +144 -0
- package/template/components/auto/ResourceDashboard.tsx +104 -0
- package/template/components/auto/ResourceDetail.tsx +93 -0
- package/template/components/auto/ResourceForm.tsx +235 -0
- package/template/components/auto/ResourceIcon.tsx +88 -0
- package/template/components/auto/ResourceLanding.tsx +155 -0
- package/template/components/auto/ResourceTable.tsx +223 -0
- package/template/components/auto/formatValue.tsx +186 -0
- package/template/components/auto/types.ts +42 -0
- package/template/components/ui/badge.tsx +40 -0
- package/template/components/ui/button.tsx +57 -0
- package/template/components/ui/card.tsx +86 -0
- package/template/components/ui/dialog.tsx +119 -0
- package/template/components/ui/input.tsx +23 -0
- package/template/components/ui/label.tsx +24 -0
- package/template/components/ui/pagination.tsx +117 -0
- package/template/components/ui/select.tsx +92 -0
- package/template/components/ui/sheet.tsx +135 -0
- package/template/components/ui/skeleton.tsx +15 -0
- package/template/components/ui/table.tsx +120 -0
- package/template/components/ui/tabs.tsx +55 -0
- package/template/lib/utils.ts +35 -0
- package/template/next.config.mjs +52 -0
- package/template/package.json +46 -0
- package/template/postcss.config.js +6 -0
- package/template/scripts/start-shopping-backend.sh +56 -0
- package/template/tailwind.config.ts +96 -0
- package/template/tsconfig.json +29 -0
package/lib/cli/main.js
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
17
|
+
const openai_1 = __importDefault(require("openai"));
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const AutoViewAgent_1 = require("../AutoViewAgent");
|
|
20
|
+
const generateDeterministic_1 = require("../generateDeterministic");
|
|
21
|
+
const emitMcpServer_1 = require("../agent/emitMcpServer");
|
|
22
|
+
const emitReport_1 = require("../agent/emitReport");
|
|
23
|
+
const fromSwagger_1 = require("../fromSwagger");
|
|
24
|
+
const renderPreview_1 = require("../preview/renderPreview");
|
|
25
|
+
/**
|
|
26
|
+
* Tiny argv parser — supports `--key value` and `--key=value`. Avoids pulling a
|
|
27
|
+
* CLI parsing library so the package install stays lean.
|
|
28
|
+
*/
|
|
29
|
+
function parseArgs(argv) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
31
|
+
const positional = [];
|
|
32
|
+
const flags = new Map();
|
|
33
|
+
for (let i = 0; i < argv.length; i++) {
|
|
34
|
+
const arg = argv[i];
|
|
35
|
+
if (arg.startsWith("--")) {
|
|
36
|
+
const eq = arg.indexOf("=");
|
|
37
|
+
if (eq !== -1) {
|
|
38
|
+
flags.set(arg.slice(2, eq), arg.slice(eq + 1));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const key = arg.slice(2);
|
|
42
|
+
const next = argv[i + 1];
|
|
43
|
+
if (next !== undefined && !next.startsWith("--")) {
|
|
44
|
+
flags.set(key, next);
|
|
45
|
+
i++;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
flags.set(key, "true");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
positional.push(arg);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const swaggerPath = positional[0];
|
|
57
|
+
const outDir = (_a = flags.get("out")) !== null && _a !== void 0 ? _a : "./frontend";
|
|
58
|
+
const model = (_c = (_b = flags.get("model")) !== null && _b !== void 0 ? _b : process.env.AUTOVIEW_MODEL) !== null && _c !== void 0 ? _c : "";
|
|
59
|
+
const apiKey = (_f = (_e = (_d = flags.get("api-key")) !== null && _d !== void 0 ? _d : process.env.AUTOVIEW_API_KEY) !== null && _e !== void 0 ? _e : process.env.OPENAI_API_KEY) !== null && _f !== void 0 ? _f : "";
|
|
60
|
+
const baseURL = (_g = flags.get("base-url")) !== null && _g !== void 0 ? _g : process.env.AUTOVIEW_BASE_URL;
|
|
61
|
+
const emit = flags.get("emit");
|
|
62
|
+
const designTheme = flags.get("design-theme");
|
|
63
|
+
const semaphoreRaw = flags.get("semaphore");
|
|
64
|
+
const semaphore = semaphoreRaw !== undefined ? parseInt(semaphoreRaw, 10) : undefined;
|
|
65
|
+
const backendOverride = (_h = flags.get("backend")) !== null && _h !== void 0 ? _h : process.env.AUTOVIEW_BACKEND;
|
|
66
|
+
const preview = flags.get("preview") === "true";
|
|
67
|
+
const noLlm = flags.get("no-llm") === "true";
|
|
68
|
+
const splitGlobs = (raw) => {
|
|
69
|
+
if (raw === undefined)
|
|
70
|
+
return undefined;
|
|
71
|
+
const parts = raw
|
|
72
|
+
.split(",")
|
|
73
|
+
.map((s) => s.trim())
|
|
74
|
+
.filter((s) => s.length > 0);
|
|
75
|
+
return parts.length > 0 ? parts : undefined;
|
|
76
|
+
};
|
|
77
|
+
const include = splitGlobs(flags.get("include"));
|
|
78
|
+
const exclude = splitGlobs(flags.get("exclude"));
|
|
79
|
+
if (swaggerPath === undefined) {
|
|
80
|
+
throw new Error(usage("Missing positional argument: <swagger.json>"));
|
|
81
|
+
}
|
|
82
|
+
// --preview, --emit, and --no-llm are LLM-free, so model / api-key are optional.
|
|
83
|
+
const llmFree = preview || emit !== undefined || noLlm;
|
|
84
|
+
if (!llmFree && model === "") {
|
|
85
|
+
throw new Error(usage("Missing --model (or AUTOVIEW_MODEL env). Example: --model openai/gpt-5.4"));
|
|
86
|
+
}
|
|
87
|
+
if (!llmFree && apiKey === "") {
|
|
88
|
+
throw new Error(usage("Missing --api-key (or AUTOVIEW_API_KEY / OPENAI_API_KEY env)."));
|
|
89
|
+
}
|
|
90
|
+
const runtimeAuditRaw = (_k = (_j = flags.get("runtime-audit")) !== null && _j !== void 0 ? _j : process.env.AUTOVIEW_RUNTIME_AUDIT) !== null && _k !== void 0 ? _k : "";
|
|
91
|
+
const runtimeAudit = runtimeAuditRaw === "true" ||
|
|
92
|
+
runtimeAuditRaw === "1" ||
|
|
93
|
+
runtimeAuditRaw === "yes";
|
|
94
|
+
const verify = flags.get("verify") === "true";
|
|
95
|
+
return {
|
|
96
|
+
swaggerPath,
|
|
97
|
+
outDir,
|
|
98
|
+
model,
|
|
99
|
+
apiKey,
|
|
100
|
+
baseURL,
|
|
101
|
+
designTheme,
|
|
102
|
+
semaphore: Number.isFinite(semaphore) ? semaphore : undefined,
|
|
103
|
+
backendOverride,
|
|
104
|
+
runtimeAudit,
|
|
105
|
+
verify,
|
|
106
|
+
preview,
|
|
107
|
+
emit,
|
|
108
|
+
noLlm,
|
|
109
|
+
include,
|
|
110
|
+
exclude,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function usage(extra) {
|
|
114
|
+
const head = extra !== undefined ? `${extra}\n\n` : "";
|
|
115
|
+
return (head +
|
|
116
|
+
[
|
|
117
|
+
"Usage: autoview <swagger.json> --model <name> --api-key <key> [options]",
|
|
118
|
+
"",
|
|
119
|
+
"Options:",
|
|
120
|
+
" --out <dir> Output directory (default: ./frontend)",
|
|
121
|
+
" --model <name> LLM model identifier, e.g. openai/gpt-5.4",
|
|
122
|
+
" --api-key <key> Vendor API key (or AUTOVIEW_API_KEY / OPENAI_API_KEY env)",
|
|
123
|
+
" --base-url <url> OpenAI-compatible endpoint (default: OpenAI)",
|
|
124
|
+
" --design-theme <txt> Optional design direction",
|
|
125
|
+
" --semaphore <n> Render concurrency cap (default: 8)",
|
|
126
|
+
" --backend <url> Live backend host for connection.ts (simulate:false).",
|
|
127
|
+
" Auto-extracted from swagger servers[] when omitted.",
|
|
128
|
+
' Pass --backend="" to force simulator mode.',
|
|
129
|
+
" --runtime-audit Opt into Phase 6 Playwright runtime audit (adds",
|
|
130
|
+
" ~10-20min; installs Playwright + Chromium).",
|
|
131
|
+
" --verify Verify the generated app in a real headless browser:",
|
|
132
|
+
" walk the user workflows (list → detail, forms) and",
|
|
133
|
+
" write wiki/verification.md. Installs Chromium.",
|
|
134
|
+
" --no-llm Generate the frontend deterministically — NO model",
|
|
135
|
+
" / api-key. The render is deterministic; this skips",
|
|
136
|
+
" the optional LLM typecheck-recovery / audit / review.",
|
|
137
|
+
" --preview LLM-free: parse the swagger and write preview.html",
|
|
138
|
+
" (endpoint tree + schemas + READ report). No --model",
|
|
139
|
+
" / --api-key needed. Inspect before a full run.",
|
|
140
|
+
" --emit mcp LLM-free: generate a runnable MCP server (agent tool",
|
|
141
|
+
" surface — read/write annotated, producer hints) instead",
|
|
142
|
+
" of the frontend. Set API_HOST to run it.",
|
|
143
|
+
" --emit report LLM-free: write consumability-report.md — can this API",
|
|
144
|
+
" be driven as a product? (navigable graph + orphan ids).",
|
|
145
|
+
" --include <globs> Comma-separated path globs to KEEP — slice a large",
|
|
146
|
+
' swagger, e.g. --include "shoppings/customers/**".',
|
|
147
|
+
" --exclude <globs> Comma-separated path globs to DROP after include,",
|
|
148
|
+
' e.g. --exclude "**/monitors/**".',
|
|
149
|
+
"",
|
|
150
|
+
"Environment fallbacks:",
|
|
151
|
+
" AUTOVIEW_MODEL, AUTOVIEW_API_KEY (or OPENAI_API_KEY),",
|
|
152
|
+
" AUTOVIEW_BASE_URL, AUTOVIEW_BACKEND, AUTOVIEW_RUNTIME_AUDIT",
|
|
153
|
+
].join("\n"));
|
|
154
|
+
}
|
|
155
|
+
function writeAll(outDir, files) {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
yield promises_1.default.mkdir(outDir, { recursive: true });
|
|
158
|
+
for (const [relative, content] of Object.entries(files)) {
|
|
159
|
+
const full = path_1.default.join(outDir, relative);
|
|
160
|
+
yield promises_1.default.mkdir(path_1.default.dirname(full), { recursive: true });
|
|
161
|
+
yield promises_1.default.writeFile(full, content, "utf-8");
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function main() {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
168
|
+
const options = parseArgs(process.argv.slice(2));
|
|
169
|
+
const document = yield (0, fromSwagger_1.fromSwaggerFile)(options.swaggerPath);
|
|
170
|
+
// --preview: LLM-free READ-layer explorer. Parse, render a self-contained
|
|
171
|
+
// HTML, and stop — no model call, no generation.
|
|
172
|
+
if (options.preview) {
|
|
173
|
+
const serverUrl = (_b = (_a = (yield (0, fromSwagger_1.extractBackendFromSwaggerFile)(options.swaggerPath))) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : null;
|
|
174
|
+
const html = (0, renderPreview_1.renderPreviewHtml)(document, {
|
|
175
|
+
title: (_d = (_c = document.info) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : "API",
|
|
176
|
+
version: (_f = (_e = document.info) === null || _e === void 0 ? void 0 : _e.version) !== null && _f !== void 0 ? _f : "—",
|
|
177
|
+
serverUrl,
|
|
178
|
+
}, { include: options.include, exclude: options.exclude });
|
|
179
|
+
yield promises_1.default.mkdir(options.outDir, { recursive: true });
|
|
180
|
+
const out = path_1.default.join(options.outDir, "preview.html");
|
|
181
|
+
yield promises_1.default.writeFile(out, html, "utf-8");
|
|
182
|
+
// eslint-disable-next-line no-console
|
|
183
|
+
console.log(`[autoview] preview written to ${out} (LLM-free). Open it in a browser.`);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// --emit mcp: LLM-free. Generate a runnable MCP server (agent tool surface)
|
|
187
|
+
// from the swagger and stop. No frontend, no model call.
|
|
188
|
+
if (options.emit === "mcp") {
|
|
189
|
+
const host = (_j = (_g = options.backendOverride) !== null && _g !== void 0 ? _g : (_h = (yield (0, fromSwagger_1.extractBackendFromSwaggerFile)(options.swaggerPath))) === null || _h === void 0 ? void 0 : _h.host) !== null && _j !== void 0 ? _j : null;
|
|
190
|
+
const files = (0, emitMcpServer_1.emitMcpServer)(document, {
|
|
191
|
+
backend: host,
|
|
192
|
+
title: (_k = document.info) === null || _k === void 0 ? void 0 : _k.title,
|
|
193
|
+
});
|
|
194
|
+
yield writeAll(options.outDir, files);
|
|
195
|
+
// eslint-disable-next-line no-console
|
|
196
|
+
console.log(`[autoview] MCP server written to ${options.outDir} (LLM-free). cd in, npm install, set API_HOST, npm start.`);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
// --emit report: LLM-free. Write a consumability report (can this API be
|
|
200
|
+
// driven as a product? navigable graph + orphan inputs) and stop.
|
|
201
|
+
if (options.emit === "report") {
|
|
202
|
+
const md = (0, emitReport_1.emitConsumabilityReport)(document);
|
|
203
|
+
yield promises_1.default.mkdir(options.outDir, { recursive: true });
|
|
204
|
+
const out = path_1.default.join(options.outDir, "consumability-report.md");
|
|
205
|
+
yield promises_1.default.writeFile(out, md, "utf-8");
|
|
206
|
+
// eslint-disable-next-line no-console
|
|
207
|
+
console.log(`[autoview] consumability report written to ${out} (LLM-free).`);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (options.emit !== undefined) {
|
|
211
|
+
throw new Error(usage(`Unknown --emit target "${options.emit}". Supported: mcp, report.`));
|
|
212
|
+
}
|
|
213
|
+
// Resolve backend host: explicit --backend flag wins; otherwise read the
|
|
214
|
+
// swagger's `servers[0].url` so the generated frontend defaults to
|
|
215
|
+
// `simulate:false` against the real backend. `--backend=""` is treated as
|
|
216
|
+
// "force simulator mode" — the operator can opt out without editing files.
|
|
217
|
+
const backend = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
218
|
+
if (options.backendOverride !== undefined) {
|
|
219
|
+
return options.backendOverride.length > 0
|
|
220
|
+
? { host: options.backendOverride }
|
|
221
|
+
: null;
|
|
222
|
+
}
|
|
223
|
+
return (0, fromSwagger_1.extractBackendFromSwaggerFile)(options.swaggerPath);
|
|
224
|
+
}))();
|
|
225
|
+
// eslint-disable-next-line no-console
|
|
226
|
+
console.log(backend === null
|
|
227
|
+
? `[autoview] backend: (none) — frontend will boot in simulator mode (typia-random data)`
|
|
228
|
+
: `[autoview] backend: ${backend.host} — frontend will boot in live mode (simulate:false)`);
|
|
229
|
+
// --no-llm: deterministic frontend, no model/key. Skips the agent's optional
|
|
230
|
+
// LLM polish (typecheck-recovery / runtime-audit / review).
|
|
231
|
+
if (options.noLlm) {
|
|
232
|
+
const files = yield (0, generateDeterministic_1.generateDeterministic)(document, {
|
|
233
|
+
backend: backend !== null && backend !== void 0 ? backend : { host: null },
|
|
234
|
+
filter: { include: options.include, exclude: options.exclude },
|
|
235
|
+
semaphore: options.semaphore,
|
|
236
|
+
});
|
|
237
|
+
yield writeAll(options.outDir, files);
|
|
238
|
+
// eslint-disable-next-line no-console
|
|
239
|
+
console.log(`[autoview] wrote ${Object.keys(files).length} files to ${options.outDir} (deterministic, LLM-free).`);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const openai = new openai_1.default({
|
|
243
|
+
apiKey: options.apiKey,
|
|
244
|
+
baseURL: options.baseURL,
|
|
245
|
+
});
|
|
246
|
+
const vendor = {
|
|
247
|
+
model: options.model,
|
|
248
|
+
api: openai,
|
|
249
|
+
};
|
|
250
|
+
const agent = new AutoViewAgent_1.AutoViewAgent({
|
|
251
|
+
document,
|
|
252
|
+
vendor,
|
|
253
|
+
designTheme: options.designTheme,
|
|
254
|
+
semaphore: options.semaphore,
|
|
255
|
+
backend,
|
|
256
|
+
runtimeAudit: options.runtimeAudit,
|
|
257
|
+
verify: options.verify,
|
|
258
|
+
include: options.include,
|
|
259
|
+
exclude: options.exclude,
|
|
260
|
+
onEvent: (event) => {
|
|
261
|
+
const summary = (() => {
|
|
262
|
+
switch (event.type) {
|
|
263
|
+
case "autoViewStart":
|
|
264
|
+
return `start (source=${event.source})`;
|
|
265
|
+
case "autoViewSdkStudy":
|
|
266
|
+
return `sdk-study (${event.resources} resources, ${event.actors} actors)`;
|
|
267
|
+
case "autoViewProductPlan":
|
|
268
|
+
return `product-plan (${event.pages} pages)`;
|
|
269
|
+
case "autoViewScaffold":
|
|
270
|
+
return `scaffold (${event.files} files)`;
|
|
271
|
+
case "autoViewRenderPage":
|
|
272
|
+
return `render ${event.completed}/${event.total} → ${event.pagePath} (${event.ok ? "ok" : "failed"})`;
|
|
273
|
+
case "autoViewReview":
|
|
274
|
+
return `review (${event.broken} broken, ${event.recovered} recovered)`;
|
|
275
|
+
case "autoViewComplete":
|
|
276
|
+
return `complete (${event.pages} pages, ${Object.keys(event.files).length} files, ${(event.elapsed / 1000).toFixed(1)}s)`;
|
|
277
|
+
}
|
|
278
|
+
})();
|
|
279
|
+
// eslint-disable-next-line no-console
|
|
280
|
+
console.log(`[autoview] ${summary}`);
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
const { files } = yield agent.run();
|
|
284
|
+
yield writeAll(options.outDir, files);
|
|
285
|
+
// eslint-disable-next-line no-console
|
|
286
|
+
console.log(`[autoview] wrote ${Object.keys(files).length} files to ${options.outDir}`);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
main().catch((err) => {
|
|
290
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
291
|
+
// eslint-disable-next-line no-console
|
|
292
|
+
console.error(`\n[autoview] ${message}`);
|
|
293
|
+
process.exit(1);
|
|
294
|
+
});
|
|
295
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,2DAA6B;AAC7B,oDAA4B;AAC5B,gDAAwB;AAExB,oDAAiD;AACjD,oEAAiE;AACjE,0DAAuD;AACvD,oDAA8D;AAC9D,gDAAgF;AAChF,4DAA6D;AA6C7D;;;GAGG;AACH,SAAS,SAAS,CAAC,IAAc;;IAC/B,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QAC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OAAO,aAAa,KAAK,CAAC,KAAK,WAAW,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;oBAC9H,CAAC;gBACH,CAAC,CAAC,EAAE,CAAC;gBACL,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;YACvC,CAAC;SACF,CAAC,CAAC;QAEH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC;QACpC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,sCAAsC;QACtC,OAAO,CAAC,GAAG,CACT,oBAAoB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,aAAa,OAAO,CAAC,MAAM,EAAE,CAC3E,CAAC;IACJ,CAAC;CAAA;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OpenApi } from "@typia/interface";
|
|
2
|
+
import { IAutoBeInterfaceCompiler } from "../typings";
|
|
3
|
+
/**
|
|
4
|
+
* Self-defined interface compiler — Step 3 of the AutoBE-independence track.
|
|
5
|
+
*
|
|
6
|
+
* Replaces `@autobe/compiler`'s `AutoBeCompiler`. AutoView only ever calls
|
|
7
|
+
* `compiler.interface.write(document, exclude)` to materialize the typed SDK it
|
|
8
|
+
* shows the LLM (SDK Study) and bundles into the scaffold, so only that surface
|
|
9
|
+
* is reproduced here. TypeScript only — the Java path and the realize/test
|
|
10
|
+
* listener plumbing AutoBE carries are dropped.
|
|
11
|
+
*
|
|
12
|
+
* Under the hood this is the same `@nestia/migrate` call the AutoBE compiler
|
|
13
|
+
* makes; `@nestia/migrate` is a samchon-ecosystem package, not an AutoBE one,
|
|
14
|
+
* so depending on it directly keeps the package free of `@autobe/*`. Swapping
|
|
15
|
+
* NestiaMigrate for a standard-OpenAPI SDK generator (the "Nestia tphase-out"
|
|
16
|
+
* from the design meeting) is a later iteration that happens behind this seam.
|
|
17
|
+
*
|
|
18
|
+
* Prettier beautification (AutoBE's `FilePrinter.beautify`) is intentionally
|
|
19
|
+
* skipped: it pulled in prettier + sort-imports + jsdoc plugins purely for
|
|
20
|
+
* cosmetics, and the render phase reads SDK *types*, not formatting.
|
|
21
|
+
*/
|
|
22
|
+
export declare class AutoViewInterfaceCompiler implements IAutoBeInterfaceCompiler {
|
|
23
|
+
write(document: OpenApi.IDocument, options: string[] | {
|
|
24
|
+
language: "typescript" | "java";
|
|
25
|
+
exclude: string[];
|
|
26
|
+
}): Promise<Record<string, string>>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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.AutoViewInterfaceCompiler = void 0;
|
|
13
|
+
const migrate_1 = require("@nestia/migrate");
|
|
14
|
+
const utils_1 = require("../utils");
|
|
15
|
+
const normalizeForNestia_1 = require("../utils/normalizeForNestia");
|
|
16
|
+
/**
|
|
17
|
+
* Self-defined interface compiler — Step 3 of the AutoBE-independence track.
|
|
18
|
+
*
|
|
19
|
+
* Replaces `@autobe/compiler`'s `AutoBeCompiler`. AutoView only ever calls
|
|
20
|
+
* `compiler.interface.write(document, exclude)` to materialize the typed SDK it
|
|
21
|
+
* shows the LLM (SDK Study) and bundles into the scaffold, so only that surface
|
|
22
|
+
* is reproduced here. TypeScript only — the Java path and the realize/test
|
|
23
|
+
* listener plumbing AutoBE carries are dropped.
|
|
24
|
+
*
|
|
25
|
+
* Under the hood this is the same `@nestia/migrate` call the AutoBE compiler
|
|
26
|
+
* makes; `@nestia/migrate` is a samchon-ecosystem package, not an AutoBE one,
|
|
27
|
+
* so depending on it directly keeps the package free of `@autobe/*`. Swapping
|
|
28
|
+
* NestiaMigrate for a standard-OpenAPI SDK generator (the "Nestia tphase-out"
|
|
29
|
+
* from the design meeting) is a later iteration that happens behind this seam.
|
|
30
|
+
*
|
|
31
|
+
* Prettier beautification (AutoBE's `FilePrinter.beautify`) is intentionally
|
|
32
|
+
* skipped: it pulled in prettier + sort-imports + jsdoc plugins purely for
|
|
33
|
+
* cosmetics, and the render phase reads SDK *types*, not formatting.
|
|
34
|
+
*/
|
|
35
|
+
class AutoViewInterfaceCompiler {
|
|
36
|
+
write(document, options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const exclude = Array.isArray(options)
|
|
39
|
+
? options
|
|
40
|
+
: options.exclude;
|
|
41
|
+
// swagger 직접 nestia — invert/transform AST 왕복 없음, query 보존.
|
|
42
|
+
// normalizeForNestia: nestia mis-handles two real-world shapes — a route
|
|
43
|
+
// whose query has >1 object param (Apideck list endpoints) is dropped, and a
|
|
44
|
+
// GET/HEAD carrying a requestBody (Notion's comments/users) yields an SDK
|
|
45
|
+
// function its own fetcher rejects. Normalizing both keeps the SDK in lockstep
|
|
46
|
+
// with the screen plan, which applies the same pass via toEndpoints.
|
|
47
|
+
const migrate = new migrate_1.NestiaMigrateApplication((0, normalizeForNestia_1.normalizeForNestia)(document));
|
|
48
|
+
const files = migrate.nest({
|
|
49
|
+
keyword: true,
|
|
50
|
+
simulate: true,
|
|
51
|
+
e2e: true,
|
|
52
|
+
author: {
|
|
53
|
+
tag: "autoview",
|
|
54
|
+
value: "Generated by AutoView - https://github.com/wrtnlabs/AutoView-Legacy",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return Object.fromEntries([
|
|
58
|
+
...(yield utils_1.ArrayUtil.asyncMap(Object.entries(files).filter(([key]) => exclude.includes(key) === false), (_a) => __awaiter(this, [_a], void 0, function* ([key, value]) { return [key, value]; }))),
|
|
59
|
+
[
|
|
60
|
+
"packages/api/swagger.json",
|
|
61
|
+
JSON.stringify(migrate.getData().document(), null, 2),
|
|
62
|
+
],
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.AutoViewInterfaceCompiler = AutoViewInterfaceCompiler;
|
|
68
|
+
//# sourceMappingURL=AutoViewInterfaceCompiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoViewInterfaceCompiler.js","sourceRoot":"","sources":["../../src/compiler/AutoViewInterfaceCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2D;AAI3D,oCAAqC;AACrC,oEAAiE;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,yBAAyB;IACvB,KAAK,CAChB,QAA2B,EAC3B,OAKK;;YAEL,MAAM,OAAO,GAAa,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;gBAC9C,CAAC,CAA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