@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
|
@@ -0,0 +1,109 @@
|
|
|
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.orchestrateAutoViewProductPlan = orchestrateAutoViewProductPlan;
|
|
13
|
+
exports.renderProductPlanMarkdown = renderProductPlanMarkdown;
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
15
|
+
const buildDeterministicPlan_1 = require("./utils/buildDeterministicPlan");
|
|
16
|
+
/**
|
|
17
|
+
* Phase 2 of the AutoView agent — Product Plan.
|
|
18
|
+
*
|
|
19
|
+
* Receives the SDK domain map from Phase 1 plus the optional design theme, asks
|
|
20
|
+
* the LLM to turn it into a frontend product (screens, navigation per actor,
|
|
21
|
+
* intentional omissions), and validates the plan against the real SDK before
|
|
22
|
+
* letting the run proceed.
|
|
23
|
+
*
|
|
24
|
+
* Validation invariants (deterministic, no LLM judgment):
|
|
25
|
+
*
|
|
26
|
+
* - At least one screen.
|
|
27
|
+
* - Every screen's `actor` is declared in the SDK map.
|
|
28
|
+
* - Every screen's `endpoints[]` entries match a real accessor path in the
|
|
29
|
+
* OpenAPI document (no inventions).
|
|
30
|
+
* - Every actor with at least one resource in the SDK map has at least one screen
|
|
31
|
+
* (no actors silently dropped).
|
|
32
|
+
* - Navigation entries reference actors that exist in the plan and only point at
|
|
33
|
+
* screen paths the plan declared.
|
|
34
|
+
*/
|
|
35
|
+
function orchestrateAutoViewProductPlan(ctx, props) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _a, _b, _c, _d;
|
|
38
|
+
// Deterministic plan — no LLM. The screen set is derived structurally from
|
|
39
|
+
// the swagger's CRUD shape (see buildDeterministicPlan). Same swagger →
|
|
40
|
+
// same screens, every run. The sdkMap is still produced by Phase 1 for the
|
|
41
|
+
// Render phase's domain context, but the IA no longer depends on LLM whim.
|
|
42
|
+
const actor = (_b = (_a = props.sdkMap.actors[0]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "user";
|
|
43
|
+
const plan = (0, buildDeterministicPlan_1.buildDeterministicPlan)(props.document, actor, props.filter);
|
|
44
|
+
if (plan.screens.length === 0) {
|
|
45
|
+
throw new Error("AutoView Product Plan: the swagger produced no list/detail/create/update screens to render.");
|
|
46
|
+
}
|
|
47
|
+
const markdown = renderProductPlanMarkdown(`Deterministic CRUD plan — ${plan.screens.length} screens, ${(_d = (_c = plan.navigation[0]) === null || _c === void 0 ? void 0 : _c.primary.length) !== null && _d !== void 0 ? _d : 0} on primary nav.`, plan);
|
|
48
|
+
ctx.dispatch({
|
|
49
|
+
type: "autoViewProductPlan",
|
|
50
|
+
id: (0, uuid_1.v7)(),
|
|
51
|
+
created_at: new Date().toISOString(),
|
|
52
|
+
step: props.step,
|
|
53
|
+
pages: plan.screens.length,
|
|
54
|
+
intentionalOmissions: plan.intentionalOmissions.length,
|
|
55
|
+
productPlan: markdown,
|
|
56
|
+
});
|
|
57
|
+
return { plan, markdown };
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/* -------------------------------------------------------------------------- */
|
|
61
|
+
/* markdown rendering for the event payload */
|
|
62
|
+
/* -------------------------------------------------------------------------- */
|
|
63
|
+
function renderProductPlanMarkdown(summary, plan) {
|
|
64
|
+
const lines = [
|
|
65
|
+
"# Product Plan",
|
|
66
|
+
"",
|
|
67
|
+
summary.trim(),
|
|
68
|
+
"",
|
|
69
|
+
`**Screens**: ${plan.screens.length} · **Intentional omissions**: ${plan.intentionalOmissions.length}`,
|
|
70
|
+
"",
|
|
71
|
+
"## Navigation",
|
|
72
|
+
"",
|
|
73
|
+
];
|
|
74
|
+
for (const nav of plan.navigation) {
|
|
75
|
+
lines.push(`### ${nav.actor}`, "");
|
|
76
|
+
if (nav.primary.length > 0) {
|
|
77
|
+
lines.push("**Primary**");
|
|
78
|
+
for (const p of nav.primary)
|
|
79
|
+
lines.push(`- ${p}`);
|
|
80
|
+
lines.push("");
|
|
81
|
+
}
|
|
82
|
+
if (nav.secondary.length > 0) {
|
|
83
|
+
lines.push("**Secondary**");
|
|
84
|
+
for (const p of nav.secondary)
|
|
85
|
+
lines.push(`- ${p}`);
|
|
86
|
+
lines.push("");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
lines.push("## Screens", "");
|
|
90
|
+
for (const screen of plan.screens) {
|
|
91
|
+
lines.push(`### \`${screen.path}\` — ${screen.title}`, "");
|
|
92
|
+
lines.push(`- **Actor**: ${screen.actor}`);
|
|
93
|
+
lines.push(`- **Pattern**: ${screen.uiPattern}`);
|
|
94
|
+
lines.push(`- **Purpose**: ${screen.purpose}`);
|
|
95
|
+
lines.push(`- **Endpoints**: ${screen.endpoints.join(", ")}`);
|
|
96
|
+
if (screen.notes.trim().length > 0) {
|
|
97
|
+
lines.push(`- **Notes**: ${screen.notes}`);
|
|
98
|
+
}
|
|
99
|
+
lines.push("");
|
|
100
|
+
}
|
|
101
|
+
if (plan.intentionalOmissions.length > 0) {
|
|
102
|
+
lines.push("## Intentional omissions", "");
|
|
103
|
+
for (const o of plan.intentionalOmissions) {
|
|
104
|
+
lines.push(`- **${o.target}** — ${o.reason}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return lines.join("\n");
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=orchestrateAutoViewProductPlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrateAutoViewProductPlan.js","sourceRoot":"","sources":["../../src/orchestrate/orchestrateAutoViewProductPlan.ts"],"names":[],"mappings":";;;;;;;;;;;AA8BA,wEAqCC;AAMD,8DA8CC;AAnHD,+BAA0B;AAK1B,2EAAwE;AAExE;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAsB,8BAA8B,CAClD,GAA0B,EAC1B,KAMC;;;QAED,2EAA2E;QAC3E,wEAAwE;QACxE,2EAA2E;QAC3E,2EAA2E;QAC3E,MAAM,KAAK,GAAG,MAAA,MAAA,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,0CAAE,IAAI,mCAAI,MAAM,CAAC;QACrD,MAAM,IAAI,GAAG,IAAA,+CAAsB,EAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;QACJ,CAAC;QACD,MAAM,QAAQ,GAAG,yBAAyB,CACxC,6BAA6B,IAAI,CAAC,OAAO,CAAC,MAAM,aAAa,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,0CAAE,OAAO,CAAC,MAAM,mCAAI,CAAC,kBAAkB,EACtH,IAAI,CACL,CAAC;QAEF,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,qBAAqB;YAC3B,EAAE,EAAE,IAAA,SAAE,GAAE;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,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { OpenApi } from "@typia/interface";
|
|
2
|
+
import { IAutoViewAgentContext } from "../context/IAutoViewAgentContext";
|
|
3
|
+
import { IAutoViewProductPlan } from "./structures/IAutoViewProductPlan";
|
|
4
|
+
import { IAutoViewSdkMap } from "./structures/IAutoViewSdkMap";
|
|
5
|
+
/**
|
|
6
|
+
* Phase 4 of the AutoView agent — Render.
|
|
7
|
+
*
|
|
8
|
+
* Generates one TSX page per screen in {@link IAutoViewProductPlan} via parallel
|
|
9
|
+
* LLM calls. Each call returns the complete page source; the orchestrator runs
|
|
10
|
+
* it through TypeScript's parser and, on syntax failure, re-invokes the model
|
|
11
|
+
* with the diagnostic. Pages that still fail after {@link MAX_PARSE_RETRIES}
|
|
12
|
+
* retries are replaced with an inline error placeholder so the wider project
|
|
13
|
+
* keeps compiling.
|
|
14
|
+
*
|
|
15
|
+
* Returns a `path → content` patch keyed by the screen file path
|
|
16
|
+
* (`app/.../page.tsx`) that the orchestrator merges into the scaffold output
|
|
17
|
+
* before the `autoViewComplete` event.
|
|
18
|
+
*/
|
|
19
|
+
export interface IAutoViewRenderOutput {
|
|
20
|
+
/** `app/.../page.tsx` → TSX source for every rendered screen. */
|
|
21
|
+
files: Record<string, string>;
|
|
22
|
+
/** Per-screen render metadata, consumed by the Review phase. */
|
|
23
|
+
screens: IAutoViewRenderOutput.IScreenReport[];
|
|
24
|
+
}
|
|
25
|
+
export declare namespace IAutoViewRenderOutput {
|
|
26
|
+
interface IScreenReport {
|
|
27
|
+
pagePath: string;
|
|
28
|
+
uiPattern: string;
|
|
29
|
+
actor: string;
|
|
30
|
+
rationale: string;
|
|
31
|
+
attempts: number;
|
|
32
|
+
ok: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Parser diagnostic when `ok === false`. Empty string when the page
|
|
35
|
+
* rendered cleanly.
|
|
36
|
+
*/
|
|
37
|
+
diagnostic: string;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export declare function orchestrateAutoViewRender(ctx: IAutoViewAgentContext, props: {
|
|
41
|
+
document: OpenApi.IDocument;
|
|
42
|
+
sdkMap: IAutoViewSdkMap;
|
|
43
|
+
productPlan: IAutoViewProductPlan;
|
|
44
|
+
designTheme: string;
|
|
45
|
+
step: number;
|
|
46
|
+
}): Promise<IAutoViewRenderOutput>;
|
|
47
|
+
/**
|
|
48
|
+
* Re-render a single screen after the typecheck phase reported diagnostics on
|
|
49
|
+
* its file. Reuses the parser-driven retry loop inside the per-screen render —
|
|
50
|
+
* the first attempt uses {@link buildTypecheckRetryHistories} (which surfaces
|
|
51
|
+
* the diagnostics + previous TSX), and any subsequent retries fall back to
|
|
52
|
+
* {@link buildRetryHistories} so the model still benefits from the deterministic
|
|
53
|
+
* `??`/`||` auto-fix and the syntax retry budget.
|
|
54
|
+
*
|
|
55
|
+
* Returns `null` when the model could not produce parser-valid TSX after the
|
|
56
|
+
* full retry budget; the caller should leave the existing (broken) file in
|
|
57
|
+
* place and report the failure so the operator still gets some output.
|
|
58
|
+
*/
|
|
59
|
+
export declare function rerenderScreenForTypecheck(ctx: IAutoViewAgentContext, args: {
|
|
60
|
+
screen: IAutoViewProductPlan.IScreen;
|
|
61
|
+
document: OpenApi.IDocument;
|
|
62
|
+
sdkMap: IAutoViewSdkMap;
|
|
63
|
+
designTheme: string;
|
|
64
|
+
promptCacheKey: string;
|
|
65
|
+
allScreenPaths: readonly string[];
|
|
66
|
+
previousTsx: string;
|
|
67
|
+
typecheckErrors: ITypecheckErrorLine[];
|
|
68
|
+
}): Promise<{
|
|
69
|
+
tsx: string;
|
|
70
|
+
ok: boolean;
|
|
71
|
+
diagnostic: string;
|
|
72
|
+
} | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Tsc diagnostic line carried into the typecheck retry prompt. Mirrors the
|
|
75
|
+
* shape {@link FrontendTypecheckSession} produces but only the fields the prompt
|
|
76
|
+
* actually needs, so the orchestrator can adapt other compilers in the future
|
|
77
|
+
* without touching this history builder.
|
|
78
|
+
*/
|
|
79
|
+
export interface ITypecheckErrorLine {
|
|
80
|
+
line: number;
|
|
81
|
+
column: number;
|
|
82
|
+
code: string;
|
|
83
|
+
message: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Runtime diagnostic carried into the audit retry prompt. Subset of
|
|
87
|
+
* `IRuntimeAuditDiagnostic` from `auditFrontendRuntime` — the prompt only needs
|
|
88
|
+
* the type label and the message.
|
|
89
|
+
*/
|
|
90
|
+
export interface IRuntimeErrorLine {
|
|
91
|
+
type: "console" | "pageerror" | "navigation";
|
|
92
|
+
message: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Re-render a single screen after the Phase 6 runtime audit reported broken
|
|
96
|
+
* navigation / console / pageerror diagnostics on its page. Identical
|
|
97
|
+
* retry-loop shape to {@link rerenderScreenForTypecheck}: the first attempt uses
|
|
98
|
+
* {@link buildRuntimeRetryHistories} (which surfaces the live runtime errors +
|
|
99
|
+
* previous TSX) and any subsequent retries fall back to
|
|
100
|
+
* {@link buildRetryHistories} so the parser-driven safety net still applies.
|
|
101
|
+
*
|
|
102
|
+
* Returns `null` when the model could not produce parser-valid TSX after the
|
|
103
|
+
* full retry budget; the caller should leave the existing (broken) file in
|
|
104
|
+
* place.
|
|
105
|
+
*/
|
|
106
|
+
export declare function rerenderScreenForRuntime(ctx: IAutoViewAgentContext, args: {
|
|
107
|
+
screen: IAutoViewProductPlan.IScreen;
|
|
108
|
+
document: OpenApi.IDocument;
|
|
109
|
+
sdkMap: IAutoViewSdkMap;
|
|
110
|
+
designTheme: string;
|
|
111
|
+
promptCacheKey: string;
|
|
112
|
+
allScreenPaths: readonly string[];
|
|
113
|
+
previousTsx: string;
|
|
114
|
+
runtimeErrors: IRuntimeErrorLine[];
|
|
115
|
+
}): Promise<{
|
|
116
|
+
tsx: string;
|
|
117
|
+
ok: boolean;
|
|
118
|
+
diagnostic: string;
|
|
119
|
+
} | null>;
|
|
120
|
+
/**
|
|
121
|
+
* Map a planner-emitted screen path (`/`, `/cart`, `/todos/[id]/edit`) to the
|
|
122
|
+
* Next.js app-router file the scaffold writes for it. Exposed so the
|
|
123
|
+
* typecheck-driven retry loop can look up which screen owns a given broken file
|
|
124
|
+
* and re-render it directly.
|
|
125
|
+
*/
|
|
126
|
+
export declare function screenPathToFile(routePath: string): string;
|
|
127
|
+
/**
|
|
128
|
+
* Inverse of {@link screenPathToFile}. Returns `null` when the path does not
|
|
129
|
+
* match the `app/.../page.tsx` shape the scaffold writes — e.g. for shared
|
|
130
|
+
* components or wiki files, which are not screen-owned and therefore cannot be
|
|
131
|
+
* fixed by re-rendering a single screen.
|
|
132
|
+
*/
|
|
133
|
+
export declare function fileToScreenPath(filePath: string): string | null;
|