@autobe/agent 0.30.4 → 0.30.5
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/lib/constants/AutoBeSystemPromptConstant.d.ts +5 -4
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/describe/image/orchestrateImageDescribeDraft.js +6 -6
- package/lib/describe/image/structures/IAutoBeImageDescribeDraftApplication.d.ts +12 -63
- package/lib/index.mjs +2918 -2842
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.js +8 -8
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +36 -37
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenarioReview.js +7 -7
- package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js +55 -42
- package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeSectionReview.js +67 -54
- package/lib/orchestrate/analyze/orchestrateAnalyzeSectionReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSection.js +24 -25
- package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSection.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSectionPatch.js +24 -25
- package/lib/orchestrate/analyze/orchestrateAnalyzeWriteSectionPatch.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWriteUnit.js +30 -31
- package/lib/orchestrate/analyze/orchestrateAnalyzeWriteUnit.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.d.ts +14 -52
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +23 -96
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioReviewApplication.d.ts +12 -40
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeSectionCrossFileReviewApplication.d.ts +30 -88
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeSectionReviewApplication.d.ts +35 -94
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteSectionApplication.d.ts +23 -93
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteUnitApplication.d.ts +15 -88
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js +76 -31
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +7 -7
- package/lib/orchestrate/common/structures/IAnalysisSectionEntry.d.ts +2 -8
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +8 -50
- package/lib/orchestrate/common/structures/IAutoBePreliminaryCollection.d.ts +1 -9
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisSections.d.ts +4 -23
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetDatabaseSchemas.d.ts +3 -21
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.d.ts +4 -22
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.d.ts +4 -22
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousAnalysisSections.d.ts +5 -17
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousDatabaseSchemas.d.ts +7 -76
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceOperations.d.ts +6 -89
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceSchemas.d.ts +7 -93
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetRealizeCollectors.d.ts +3 -22
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetRealizeTransformers.d.ts +3 -22
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js +114 -139
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js +90 -91
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointWrite.js +58 -59
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointWrite.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroup.js +58 -59
- package/lib/orchestrate/interface/orchestrateInterfaceGroup.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperation.js +108 -132
- package/lib/orchestrate/interface/orchestrateInterfaceOperation.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationReview.js +72 -72
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js +76 -77
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaCasting.js +130 -159
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaCasting.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaComplement.js +126 -155
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js +114 -142
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +5 -5
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +100 -129
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaWrite.js +120 -149
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaWrite.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationApplication.d.ts +10 -97
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.d.ts +14 -83
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointWriteApplication.d.ts +12 -90
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +12 -80
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +21 -116
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.d.ts +24 -112
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.d.ts +11 -83
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +11 -76
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaCastingApplication.d.ts +18 -96
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaComplementApplication.d.ts +11 -76
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRefineApplication.d.ts +25 -107
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +5 -31
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaReviewApplication.d.ts +6 -42
- package/lib/orchestrate/prisma/orchestratePrismaAuthorization.js +41 -41
- package/lib/orchestrate/prisma/orchestratePrismaAuthorizationReview.js +62 -63
- package/lib/orchestrate/prisma/orchestratePrismaAuthorizationReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +40 -41
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponentReview.js +60 -61
- package/lib/orchestrate/prisma/orchestratePrismaComponentReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +112 -116
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaGroup.js +48 -49
- package/lib/orchestrate/prisma/orchestratePrismaGroup.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaGroupReview.js +70 -71
- package/lib/orchestrate/prisma/orchestratePrismaGroupReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +118 -122
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemaReview.js +126 -131
- package/lib/orchestrate/prisma/orchestratePrismaSchemaReview.js.map +1 -1
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationApplication.d.ts +22 -99
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationReviewApplication.d.ts +12 -109
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseComponentApplication.d.ts +14 -100
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseComponentReviewApplication.d.ts +15 -108
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseCorrectApplication.d.ts +24 -106
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseGroupApplication.d.ts +13 -76
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseGroupReviewApplication.d.ts +13 -111
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseSchemaApplication.d.ts +26 -97
- package/lib/orchestrate/prisma/structures/IAutoBeDatabaseSchemaReviewApplication.d.ts +16 -93
- package/lib/orchestrate/realize/histories/transformRealizeOperationCorrectHistory.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeOperationCorrectHistory.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeOperationWriteHistory.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeOperationWriteHistory.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.js +20 -2
- package/lib/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.js +22 -2
- package/lib/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.js.map +1 -1
- package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectCasting.js +7 -7
- package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.js +86 -6
- package/lib/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +38 -38
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js +34 -34
- package/lib/orchestrate/realize/orchestrateRealizeCollectorCorrectOverall.js +38 -38
- package/lib/orchestrate/realize/orchestrateRealizeCollectorPlan.js +54 -54
- package/lib/orchestrate/realize/orchestrateRealizeCollectorWrite.js +36 -36
- package/lib/orchestrate/realize/orchestrateRealizeOperationCorrectOverall.js +44 -44
- package/lib/orchestrate/realize/orchestrateRealizeOperationWrite.js +42 -42
- package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.js +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeTransformerCorrectOverall.js +46 -46
- package/lib/orchestrate/realize/orchestrateRealizeTransformerPlan.js +36 -36
- package/lib/orchestrate/realize/orchestrateRealizeTransformerWrite.js +44 -44
- package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.d.ts +18 -0
- package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.js +167 -8
- package/lib/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +17 -71
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.d.ts +32 -92
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorCorrectApplication.d.ts +32 -114
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorPlanApplication.d.ts +29 -106
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCollectorWriteApplication.d.ts +38 -131
- package/lib/orchestrate/realize/structures/IAutoBeRealizeOperationCorrectApplication.d.ts +16 -71
- package/lib/orchestrate/realize/structures/IAutoBeRealizeOperationWriteApplication.d.ts +16 -73
- package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerCorrectApplication.d.ts +37 -155
- package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerPlanApplication.d.ts +25 -88
- package/lib/orchestrate/realize/structures/IAutoBeRealizeTransformerWriteApplication.d.ts +48 -181
- package/lib/orchestrate/realize/utils/generateTS2339Hints.d.ts +5 -3
- package/lib/orchestrate/realize/utils/generateTS2339Hints.js +37 -19
- package/lib/orchestrate/realize/utils/generateTS2339Hints.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestOperationWriteHistory.js +2 -2
- package/lib/orchestrate/test/orchestrateTestScenario.js +22 -22
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +22 -22
- package/package.json +5 -5
- package/src/constants/AutoBeSystemPromptConstant.ts +5 -4
- package/src/describe/image/structures/IAutoBeImageDescribeDraftApplication.ts +12 -63
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.ts +14 -52
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +23 -96
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioReviewApplication.ts +12 -40
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeSectionCrossFileReviewApplication.ts +30 -88
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeSectionReviewApplication.ts +35 -94
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteSectionApplication.ts +23 -93
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteUnitApplication.ts +15 -88
- package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.ts +92 -31
- package/src/orchestrate/common/structures/IAnalysisSectionEntry.ts +2 -8
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +8 -50
- package/src/orchestrate/common/structures/IAutoBePreliminaryCollection.ts +1 -9
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisSections.ts +4 -23
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetDatabaseSchemas.ts +3 -21
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.ts +4 -22
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.ts +4 -22
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousAnalysisSections.ts +5 -17
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousDatabaseSchemas.ts +7 -76
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceOperations.ts +6 -89
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetPreviousInterfaceSchemas.ts +7 -93
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetRealizeCollectors.ts +3 -22
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetRealizeTransformers.ts +3 -22
- package/src/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationApplication.ts +10 -97
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.ts +14 -83
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointWriteApplication.ts +12 -90
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +12 -80
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +21 -116
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.ts +24 -112
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.ts +11 -83
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +11 -76
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaCastingApplication.ts +18 -96
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaComplementApplication.ts +11 -76
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRefineApplication.ts +25 -107
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +5 -31
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaReviewApplication.ts +6 -42
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationApplication.ts +22 -99
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseAuthorizationReviewApplication.ts +12 -109
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseComponentApplication.ts +14 -100
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseComponentReviewApplication.ts +15 -108
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseCorrectApplication.ts +24 -106
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseGroupApplication.ts +13 -76
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseGroupReviewApplication.ts +13 -111
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseSchemaApplication.ts +26 -97
- package/src/orchestrate/prisma/structures/IAutoBeDatabaseSchemaReviewApplication.ts +16 -93
- package/src/orchestrate/realize/histories/transformRealizeTransformerCorrectHistory.ts +21 -1
- package/src/orchestrate/realize/histories/transformRealizeTransformerWriteHistory.ts +26 -4
- package/src/orchestrate/realize/internal/orchestrateRealizeCorrectOverall.ts +125 -9
- package/src/orchestrate/realize/orchestrateRealizeTransformerCorrectCasting.ts +1 -0
- package/src/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.ts +210 -7
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +17 -71
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.ts +32 -92
- package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorCorrectApplication.ts +32 -114
- package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorPlanApplication.ts +29 -106
- package/src/orchestrate/realize/structures/IAutoBeRealizeCollectorWriteApplication.ts +38 -131
- package/src/orchestrate/realize/structures/IAutoBeRealizeOperationCorrectApplication.ts +16 -71
- package/src/orchestrate/realize/structures/IAutoBeRealizeOperationWriteApplication.ts +16 -73
- package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerCorrectApplication.ts +37 -155
- package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerPlanApplication.ts +25 -88
- package/src/orchestrate/realize/structures/IAutoBeRealizeTransformerWriteApplication.ts +48 -181
- package/src/orchestrate/realize/utils/generateTS2339Hints.ts +39 -19
|
@@ -2,26 +2,18 @@ import { IAutoBePreliminaryGetAnalysisSections } from "../../common/structures/I
|
|
|
2
2
|
import { IAutoBePreliminaryGetDatabaseSchemas } from "../../common/structures/IAutoBePreliminaryGetDatabaseSchemas";
|
|
3
3
|
import { IAutoBePreliminaryGetInterfaceSchemas } from "../../common/structures/IAutoBePreliminaryGetInterfaceSchemas";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Plans whether a single DTO needs a transformer. Sets databaseSchemaName to
|
|
6
|
+
* null for non-transformable DTOs.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* parallel processing across all DTOs.
|
|
10
|
-
*
|
|
11
|
-
* The planning follows a structured RAG workflow: preliminary context gathering
|
|
12
|
-
* (database schemas, DTO schemas) → eligibility analysis → plan generation.
|
|
13
|
-
*
|
|
14
|
-
* **Key Decisions**: Not all DTOs require transformers. The agent must
|
|
15
|
-
* distinguish transformable DTOs (Read DTO + DB-backed + Direct mapping) from
|
|
8
|
+
* **Key Decisions**: Not all DTOs require transformers. Distinguish
|
|
9
|
+
* transformable DTOs (Read DTO + DB-backed + direct mapping) from
|
|
16
10
|
* non-transformable DTOs (request params, pagination wrappers, business logic
|
|
17
|
-
* types)
|
|
11
|
+
* types).
|
|
18
12
|
*/
|
|
19
13
|
export interface IAutoBeRealizeTransformerPlanApplication {
|
|
20
14
|
/**
|
|
21
|
-
* Process transformer planning task or preliminary data requests.
|
|
22
|
-
*
|
|
23
15
|
* Analyzes the given DTO type and generates a plan entry determining whether
|
|
24
|
-
* a transformer is needed. Returns exactly ONE plan entry
|
|
16
|
+
* a transformer is needed. Returns exactly ONE plan entry.
|
|
25
17
|
*
|
|
26
18
|
* @param props Request containing either preliminary data request or complete
|
|
27
19
|
* plan
|
|
@@ -33,106 +25,51 @@ export declare namespace IAutoBeRealizeTransformerPlanApplication {
|
|
|
33
25
|
/**
|
|
34
26
|
* Think before you act.
|
|
35
27
|
*
|
|
36
|
-
*
|
|
37
|
-
* your current state and explain your reasoning:
|
|
38
|
-
*
|
|
39
|
-
* For preliminary requests:
|
|
40
|
-
*
|
|
41
|
-
* - What schemas (database or DTO) are missing that you need?
|
|
42
|
-
* - Why do you need them for planning?
|
|
43
|
-
* - Be brief - state the gap, don't list everything you have.
|
|
44
|
-
*
|
|
45
|
-
* For completion:
|
|
28
|
+
* For preliminary requests: what schemas (database or DTO) are missing?
|
|
46
29
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* - Why is it non-transformable (if applicable)?
|
|
50
|
-
*
|
|
51
|
-
* This reflection helps you avoid duplicate requests and premature
|
|
52
|
-
* completion.
|
|
30
|
+
* For completion: is this DTO transformable or non-transformable? What
|
|
31
|
+
* database table does it map to (if transformable)?
|
|
53
32
|
*/
|
|
54
33
|
thinking: string;
|
|
55
34
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* Determines which action to perform:
|
|
59
|
-
*
|
|
60
|
-
* - "getDatabaseSchemas": Retrieve database table schemas for DB structure
|
|
61
|
-
* - "getInterfaceSchemas": Retrieve DTO type definitions for API contracts
|
|
62
|
-
* - "complete": Generate final transformer plan
|
|
63
|
-
*
|
|
64
|
-
* The preliminary types are removed from the union after their respective
|
|
65
|
-
* data has been provided, physically preventing repeated calls.
|
|
35
|
+
* Action to perform. Exhausted preliminary types are removed from the
|
|
36
|
+
* union, physically preventing repeated calls.
|
|
66
37
|
*/
|
|
67
38
|
request: IComplete | IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetDatabaseSchemas | IAutoBePreliminaryGetInterfaceSchemas;
|
|
68
39
|
}
|
|
69
40
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* Generates a plan with exactly ONE entry for the given DTO, indicating
|
|
73
|
-
* whether it is transformable (has database schema name) or non-transformable
|
|
74
|
-
* (null).
|
|
41
|
+
* Generates exactly ONE plan entry indicating transformable (has DB schema
|
|
42
|
+
* name) or not (null).
|
|
75
43
|
*/
|
|
76
44
|
interface IComplete {
|
|
77
45
|
/** Type discriminator for completion request. */
|
|
78
46
|
type: "complete";
|
|
79
47
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* Must contain exactly ONE entry with:
|
|
83
|
-
*
|
|
84
|
-
* - DTO type name matching the given DTO
|
|
85
|
-
* - Chain of thought explaining the analysis
|
|
86
|
-
* - Database schema name if transformable, or null if not
|
|
87
|
-
*
|
|
88
|
-
* Use databaseSchemaName to distinguish:
|
|
89
|
-
*
|
|
90
|
-
* - Non-null: Transformable DTO, transformer will be generated
|
|
91
|
-
* - Null: Non-transformable DTO, no transformer needed
|
|
48
|
+
* Exactly ONE entry. databaseSchemaName non-null = transformable, null = no
|
|
49
|
+
* transformer needed.
|
|
92
50
|
*/
|
|
93
51
|
plans: IPlan[];
|
|
94
52
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Plan for a single DTO analysis result.
|
|
97
|
-
*
|
|
98
|
-
* Records the planning decision for one DTO from the operation response.
|
|
99
|
-
*/
|
|
53
|
+
/** Planning decision for one DTO. */
|
|
100
54
|
interface IPlan {
|
|
101
55
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* The TypeScript interface type from the operation response.
|
|
105
|
-
*
|
|
106
|
-
* Example: "IShoppingSaleUnitStock", "IShoppingCategory", "IPage.IRequest"
|
|
56
|
+
* TypeScript interface type from the operation response (e.g.,
|
|
57
|
+
* "IShoppingSaleUnitStock").
|
|
107
58
|
*/
|
|
108
59
|
dtoTypeName: string;
|
|
109
60
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* Explains the agent's reasoning:
|
|
61
|
+
* Reasoning for this DTO's planning decision.
|
|
113
62
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* - For non-transformable DTOs: Why no transformer is needed (request param,
|
|
117
|
-
* pagination wrapper, business logic, etc.)
|
|
63
|
+
* Transformable: "Transforms shopping_sales to IShoppingSale with nested
|
|
64
|
+
* category and tags".
|
|
118
65
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* Example (non-transformable): "IPage.IRequest is pagination parameter, not
|
|
123
|
-
* database-backed"
|
|
66
|
+
* Non-transformable: "IPage.IRequest is pagination parameter, not
|
|
67
|
+
* DB-backed".
|
|
124
68
|
*/
|
|
125
69
|
thinking: string;
|
|
126
70
|
/**
|
|
127
|
-
* Database
|
|
128
|
-
*
|
|
129
|
-
* - **Non-null**: The database table name this DTO maps to. A transformer
|
|
130
|
-
* will be generated for this DTO.
|
|
131
|
-
* - **Null**: This DTO is non-transformable (request param, pagination
|
|
132
|
-
* wrapper, business logic type). No transformer will be generated.
|
|
133
|
-
*
|
|
134
|
-
* Example (transformable): "shopping_sales", "shopping_categories" Example
|
|
135
|
-
* (non-transformable): null
|
|
71
|
+
* Database table name if transformable (e.g., "shopping_sales"), null if
|
|
72
|
+
* non-transformable (request param, pagination wrapper, business logic).
|
|
136
73
|
*/
|
|
137
74
|
databaseSchemaName: string | null;
|
|
138
75
|
}
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
import { AutoBeRealizeTransformerSelectMapping, AutoBeRealizeTransformerTransformMapping } from "@autobe/interface";
|
|
2
2
|
import { IAutoBePreliminaryGetDatabaseSchemas } from "../../common/structures/IAutoBePreliminaryGetDatabaseSchemas";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Guides the AI agent through creating reusable transformer modules that
|
|
7
|
-
* convert database query results to API response DTOs (DB → API). Each
|
|
8
|
-
* transformer includes type-safe conversion logic and Prisma select
|
|
9
|
-
* specifications for efficient data loading.
|
|
10
|
-
*
|
|
11
|
-
* The generation follows a structured RAG workflow: preliminary context
|
|
12
|
-
* gathering (database schemas only) → implementation planning → code generation
|
|
13
|
-
* → review and refinement. All necessary DTO type information is obtained
|
|
14
|
-
* transitively from the DTO type names provided in the plan
|
|
15
|
-
* (AutoBeRealizeTransformerPlan).
|
|
16
|
-
*
|
|
17
|
-
* The planning phase has already filtered out incompatible DTO types (e.g.,
|
|
18
|
-
* IPage*, *.IRequest, *.ICreate, *.IUpdate), so the write phase only receives
|
|
19
|
-
* DTOs that require transformers.
|
|
4
|
+
* Generates transformer functions that convert Prisma query results to API
|
|
5
|
+
* response DTOs (DB → API) via plan/draft/revise workflow.
|
|
20
6
|
*/
|
|
21
7
|
export interface IAutoBeRealizeTransformerWriteApplication {
|
|
22
8
|
/**
|
|
23
9
|
* Process transformer generation task or preliminary data requests.
|
|
24
10
|
*
|
|
25
|
-
* Generates complete transformer module through three-phase workflow (plan →
|
|
26
|
-
* draft → revise). Ensures type safety, proper Prisma payload types, and
|
|
27
|
-
* correct DTO mapping.
|
|
28
|
-
*
|
|
29
11
|
* @param props Request containing either preliminary data request or complete
|
|
30
12
|
* task
|
|
31
13
|
*/
|
|
@@ -36,77 +18,37 @@ export declare namespace IAutoBeRealizeTransformerWriteApplication {
|
|
|
36
18
|
/**
|
|
37
19
|
* Think before you act.
|
|
38
20
|
*
|
|
39
|
-
*
|
|
40
|
-
* your current state and explain your reasoning:
|
|
41
|
-
*
|
|
42
|
-
* For preliminary requests:
|
|
43
|
-
*
|
|
44
|
-
* - What database schemas are missing that you need?
|
|
45
|
-
* - Why do you need them for transformer generation?
|
|
46
|
-
* - Be brief - state the gap, don't list everything you have.
|
|
47
|
-
*
|
|
48
|
-
* For completion:
|
|
49
|
-
*
|
|
50
|
-
* - What schemas did you acquire?
|
|
51
|
-
* - What transformer patterns did you implement?
|
|
52
|
-
* - Why is it sufficient to complete?
|
|
53
|
-
* - Summarize - don't enumerate every field mapping.
|
|
21
|
+
* For preliminary requests: what database schemas are missing and why?
|
|
54
22
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
23
|
+
* For completion: what schemas did you acquire, what patterns did you
|
|
24
|
+
* implement, and why is it sufficient? Summarize — don't enumerate every
|
|
25
|
+
* field.
|
|
58
26
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
27
|
+
* Note: All DTO type information is available transitively from the plan's
|
|
28
|
+
* DTO type names. You only need to request database schemas.
|
|
61
29
|
*/
|
|
62
30
|
thinking: string;
|
|
63
31
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* Determines which action to perform:
|
|
67
|
-
*
|
|
68
|
-
* - "getDatabaseSchemas": Retrieve database table schemas for DB structure
|
|
69
|
-
* - "complete": Generate final transformer implementation
|
|
70
|
-
*
|
|
71
|
-
* All necessary DTO type information is obtained transitively from the DTO
|
|
72
|
-
* type names provided in the plan (AutoBeRealizeTransformerPlan). Each DTO
|
|
73
|
-
* type name allows the system to recursively fetch all referenced types,
|
|
74
|
-
* providing complete type information without requiring explicit schema
|
|
75
|
-
* requests.
|
|
76
|
-
*
|
|
77
|
-
* The preliminary types are removed from the union after their respective
|
|
78
|
-
* data has been provided, physically preventing repeated calls.
|
|
32
|
+
* Action to perform. Exhausted preliminary types are removed from the
|
|
33
|
+
* union, physically preventing repeated calls.
|
|
79
34
|
*/
|
|
80
35
|
request: IComplete | IAutoBePreliminaryGetDatabaseSchemas;
|
|
81
36
|
}
|
|
82
37
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* Executes three-phase generation to create complete transformer with:
|
|
86
|
-
*
|
|
87
|
-
* - `select()` function: Returns Prisma include/select specification
|
|
88
|
-
* - `transform()` function: Converts Prisma payload to DTO
|
|
89
|
-
*
|
|
90
|
-
* Follows plan → draft → revise pattern to ensure type safety and correct
|
|
91
|
-
* field mappings.
|
|
92
|
-
*
|
|
93
|
-
* Note: The database schema name is provided as input from the planning
|
|
94
|
-
* phase, so it doesn't need to be returned in the response.
|
|
38
|
+
* Generate transformer module (select + transform functions) via
|
|
39
|
+
* plan/draft/revise.
|
|
95
40
|
*/
|
|
96
41
|
interface IComplete {
|
|
97
42
|
/** Type discriminator for completion request. */
|
|
98
43
|
type: "complete";
|
|
99
44
|
/**
|
|
100
|
-
* Transformer implementation plan
|
|
45
|
+
* Transformer implementation plan. MUST contain four sections:
|
|
101
46
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* schema
|
|
106
|
-
* 2. DTO Property Inventory - List ALL properties with types
|
|
107
|
-
* 3. Field-by-Field Mapping Strategy - Explicit table for BOTH select() and
|
|
47
|
+
* 1. Database Schema Field Inventory — ALL fields with exact names from schema
|
|
48
|
+
* 2. DTO Property Inventory — ALL properties with types
|
|
49
|
+
* 3. Field-by-Field Mapping Strategy — explicit table for BOTH select() and
|
|
108
50
|
* transform()
|
|
109
|
-
* 4. Edge Cases and Special Handling
|
|
51
|
+
* 4. Edge Cases and Special Handling — type casts (Decimal, DateTime),
|
|
110
52
|
* nullables
|
|
111
53
|
*
|
|
112
54
|
* This forces you to READ the actual schema (not imagine it) and creates an
|
|
@@ -114,105 +56,47 @@ export declare namespace IAutoBeRealizeTransformerWriteApplication {
|
|
|
114
56
|
*/
|
|
115
57
|
plan: string;
|
|
116
58
|
/**
|
|
117
|
-
* Database field-by-field selection mapping for
|
|
118
|
-
*
|
|
119
|
-
* Documents which database fields/relations must be selected from the
|
|
120
|
-
* database to enable the transform() function. This ensures no required
|
|
121
|
-
* data is missing from the query.
|
|
59
|
+
* Database field-by-field selection mapping for select().
|
|
122
60
|
*
|
|
123
|
-
* MUST include EVERY database field needed by transform()
|
|
61
|
+
* MUST include EVERY database field needed by transform() — no exceptions.
|
|
124
62
|
* Each mapping specifies:
|
|
125
63
|
*
|
|
126
|
-
* - `member`: Exact
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* - `nullable`:
|
|
130
|
-
*
|
|
131
|
-
* - `how`: Why this field is being selected (which DTO property needs it)
|
|
64
|
+
* - `member`: Exact Prisma field/relation name (snake_case) — read from the
|
|
65
|
+
* Relation Mapping Table and member list, NOT from DTO property names
|
|
66
|
+
* - `kind`: scalar, belongsTo, hasOne, or hasMany
|
|
67
|
+
* - `nullable`: true/false for scalar/belongsTo, null for hasMany/hasOne
|
|
68
|
+
* - `how`: Which DTO property needs it
|
|
132
69
|
*
|
|
133
70
|
* The `kind` property forces explicit classification of each member BEFORE
|
|
134
|
-
* deciding
|
|
135
|
-
* relations
|
|
136
|
-
*
|
|
137
|
-
* The `nullable` property documents schema constraints that affect how
|
|
138
|
-
* transform() will handle the data, enabling proper null handling in
|
|
139
|
-
* transformations.
|
|
140
|
-
*
|
|
141
|
-
* Missing even a single required field will cause validation failure and
|
|
142
|
-
* trigger regeneration.
|
|
71
|
+
* deciding select syntax, preventing confusion between scalars and
|
|
72
|
+
* relations.
|
|
143
73
|
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* - Prevents missing field selections through systematic coverage
|
|
147
|
-
* - Forces explicit decision-making for each database field (kind + nullable
|
|
148
|
-
*
|
|
149
|
-
* - How)
|
|
150
|
-
* - Ensures select() and transform() are perfectly aligned
|
|
151
|
-
* - Documents what data to load from database
|
|
152
|
-
* - Prevents confusion between scalar fields and relations
|
|
153
|
-
* - Documents nullability constraints for transform() planning
|
|
154
|
-
* - Enables validation before code generation
|
|
155
|
-
*
|
|
156
|
-
* **Common selection patterns by kind**:
|
|
157
|
-
*
|
|
158
|
-
* - **Scalar fields (nullable: true/false)**: For direct mapping or type
|
|
159
|
-
* conversion
|
|
160
|
-
* - **Computation sources (nullable: true/false)**: Fields needed for
|
|
161
|
-
* computed DTO properties
|
|
162
|
-
* - **Aggregations (nullable: false)**: _count, _sum, _avg for DTO statistics
|
|
163
|
-
* - **BelongsTo relations (nullable: true/false)**: For nested object
|
|
164
|
-
* transformers
|
|
165
|
-
* - **HasMany relations (nullable: null)**: For array transformers
|
|
166
|
-
*
|
|
167
|
-
* The validator will cross-check this list against the database schema and
|
|
168
|
-
* DTO requirements to ensure complete coverage.
|
|
74
|
+
* Missing even a single required field will cause validation failure.
|
|
169
75
|
*/
|
|
170
76
|
selectMappings: AutoBeRealizeTransformerSelectMapping[];
|
|
171
77
|
/**
|
|
172
|
-
* DTO property-by-property transformation mapping for
|
|
173
|
-
* function.
|
|
174
|
-
*
|
|
175
|
-
* Documents how to transform database payload data into each DTO property.
|
|
176
|
-
* This ensures complete DTO coverage and correct transformation logic.
|
|
78
|
+
* DTO property-by-property transformation mapping for transform().
|
|
177
79
|
*
|
|
178
|
-
* MUST include EVERY property from the DTO type definition
|
|
80
|
+
* MUST include EVERY property from the DTO type definition — no exceptions.
|
|
179
81
|
* Each mapping specifies:
|
|
180
82
|
*
|
|
181
83
|
* - `property`: Exact DTO property name (camelCase)
|
|
182
|
-
* - `how`: How to obtain
|
|
183
|
-
*
|
|
184
|
-
* Missing even a single property will cause validation failure and trigger
|
|
185
|
-
* regeneration.
|
|
186
|
-
*
|
|
187
|
-
* This structured approach:
|
|
188
|
-
*
|
|
189
|
-
* - Prevents property omissions through systematic coverage
|
|
190
|
-
* - Forces explicit decision-making for each property transformation
|
|
191
|
-
* - Documents transformation logic (direct mapping, type conversion,
|
|
192
|
-
* computation, nested transformation)
|
|
193
|
-
* - Ensures select() and transform() are aligned
|
|
194
|
-
* - Enables validation before code generation
|
|
84
|
+
* - `how`: How to obtain from Prisma payload
|
|
195
85
|
*
|
|
196
86
|
* **Common transformation patterns**:
|
|
197
87
|
*
|
|
198
|
-
* -
|
|
199
|
-
* -
|
|
200
|
-
* -
|
|
201
|
-
* -
|
|
202
|
-
* -
|
|
203
|
-
* - **Nested objects**: Reuse neighbor transformers
|
|
204
|
-
* - **Arrays**: Map with ArrayUtil.asyncMap + neighbor transformer
|
|
88
|
+
* - Direct mapping: snake_case → camelCase
|
|
89
|
+
* - Type conversion: Decimal → Number, DateTime → ISO string
|
|
90
|
+
* - Nullable: DateTime? → string | null
|
|
91
|
+
* - Nested objects: Reuse neighbor transformers
|
|
92
|
+
* - Arrays: ArrayUtil.asyncMap + neighbor transformer
|
|
205
93
|
*
|
|
206
|
-
*
|
|
207
|
-
* definition and reject incomplete mappings.
|
|
94
|
+
* Missing even a single property will cause validation failure.
|
|
208
95
|
*/
|
|
209
96
|
transformMappings: AutoBeRealizeTransformerTransformMapping[];
|
|
210
97
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* Complete implementation that strictly follows the plan's mapping table.
|
|
214
|
-
* EVERY field in the plan's Section 3 MUST appear in BOTH select() and
|
|
215
|
-
* transform(). Implement:
|
|
98
|
+
* Complete implementation following plan's mapping table. EVERY field from
|
|
99
|
+
* plan Section 3 MUST appear in BOTH select() and transform(). Implement:
|
|
216
100
|
*
|
|
217
101
|
* - Transform() first, select() second, Payload last (correct order)
|
|
218
102
|
* - All field mappings from plan with correct transformations
|
|
@@ -220,43 +104,26 @@ export declare namespace IAutoBeRealizeTransformerWriteApplication {
|
|
|
220
104
|
* - ALWAYS use `select`, NEVER use `include`
|
|
221
105
|
*/
|
|
222
106
|
draft: string;
|
|
223
|
-
/**
|
|
224
|
-
* Revision and finalization phase.
|
|
225
|
-
*
|
|
226
|
-
* Reviews the draft implementation and produces the final code with all
|
|
227
|
-
* improvements and corrections applied.
|
|
228
|
-
*/
|
|
107
|
+
/** Reviews draft and produces final code. */
|
|
229
108
|
revise: IReviseProps;
|
|
230
109
|
}
|
|
231
110
|
interface IReviseProps {
|
|
232
111
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* MUST systematically verify using four checklists:
|
|
112
|
+
* MUST systematically verify four checklists:
|
|
236
113
|
*
|
|
237
|
-
* 1. Schema Fidelity
|
|
238
|
-
*
|
|
239
|
-
* 2. Plan Adherence - Verify EVERY mapping from Section 3 in BOTH select() and
|
|
114
|
+
* 1. Schema Fidelity — cross-check EVERY field name against plan Section 1
|
|
115
|
+
* 2. Plan Adherence — verify EVERY mapping from Section 3 in BOTH select() and
|
|
240
116
|
* transform()
|
|
241
|
-
* 3. System Rules
|
|
242
|
-
*
|
|
243
|
-
* 4. Type Safety - Type casts (Decimal→Number, DateTime→ISO), nullable
|
|
244
|
-
* handling
|
|
117
|
+
* 3. System Rules — neighbor reuse, function order, select (not include)
|
|
118
|
+
* 4. Type Safety — Decimal→Number, DateTime→ISO, nullable handling
|
|
245
119
|
*
|
|
246
|
-
* Identify
|
|
247
|
-
*
|
|
248
|
-
* violations.
|
|
120
|
+
* Identify issues with line numbers. This catches hallucinated fields,
|
|
121
|
+
* missing transformations, and rule violations.
|
|
249
122
|
*/
|
|
250
123
|
review: string;
|
|
251
124
|
/**
|
|
252
|
-
* Final transformer code with all review improvements applied
|
|
253
|
-
*
|
|
254
|
-
* Apply ALL fixes identified in the review to produce production-ready
|
|
255
|
-
* code. If review found issues, this MUST contain the corrected
|
|
256
|
-
* implementation.
|
|
257
|
-
*
|
|
258
|
-
* Return `null` ONLY if the draft is already perfect and review found zero
|
|
259
|
-
* issues.
|
|
125
|
+
* Final transformer code with all review improvements applied, or null if
|
|
126
|
+
* draft needs no changes.
|
|
260
127
|
*/
|
|
261
128
|
final: string | null;
|
|
262
129
|
}
|
|
@@ -4,9 +4,11 @@ import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
|
|
|
4
4
|
* errors.
|
|
5
5
|
*
|
|
6
6
|
* Parses TS2339 "Property 'X' does not exist on type 'Y'" diagnostics,
|
|
7
|
-
* deduplicates by
|
|
8
|
-
* appears to be a Prisma model type (snake_case naming).
|
|
7
|
+
* deduplicates by property name, and returns a short explanation.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* Handles both simple type names (e.g., `shopping_sales`) and inline Prisma
|
|
10
|
+
* GetPayload types (e.g., `{ id: string; body: string; ... }`).
|
|
11
|
+
*
|
|
12
|
+
* Returns empty string if no TS2339 diagnostics are found.
|
|
11
13
|
*/
|
|
12
14
|
export declare function generateTS2339Hints(diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[]): string;
|
|
@@ -6,30 +6,43 @@ exports.generateTS2339Hints = generateTS2339Hints;
|
|
|
6
6
|
* errors.
|
|
7
7
|
*
|
|
8
8
|
* Parses TS2339 "Property 'X' does not exist on type 'Y'" diagnostics,
|
|
9
|
-
* deduplicates by
|
|
10
|
-
* appears to be a Prisma model type (snake_case naming).
|
|
9
|
+
* deduplicates by property name, and returns a short explanation.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
11
|
+
* Handles both simple type names (e.g., `shopping_sales`) and inline Prisma
|
|
12
|
+
* GetPayload types (e.g., `{ id: string; body: string; ... }`).
|
|
13
|
+
*
|
|
14
|
+
* Returns empty string if no TS2339 diagnostics are found.
|
|
13
15
|
*/
|
|
14
16
|
function generateTS2339Hints(diagnostics) {
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
+
// Match both simple types and inline object types
|
|
18
|
+
const TS2339_SIMPLE = /^Property '(\w+)' does not exist on type '(\w+)'\.?$/;
|
|
19
|
+
const TS2339_INLINE = /^Property '(\w+)' does not exist on type '\{[^}]*\}'\.?$/;
|
|
17
20
|
const seen = new Set();
|
|
18
21
|
const hints = [];
|
|
19
22
|
for (const diag of diagnostics) {
|
|
20
23
|
if (Number(diag.code) !== 2339)
|
|
21
24
|
continue;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// Try simple type match first
|
|
26
|
+
const simpleMatch = diag.messageText.match(TS2339_SIMPLE);
|
|
27
|
+
if (simpleMatch !== null) {
|
|
28
|
+
const [, property, typeName] = simpleMatch;
|
|
29
|
+
const key = `${property}`;
|
|
30
|
+
if (!seen.has(key)) {
|
|
31
|
+
seen.add(key);
|
|
32
|
+
hints.push({ property: property, modelType: typeName });
|
|
33
|
+
}
|
|
27
34
|
continue;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
}
|
|
36
|
+
// Try inline object type match (Prisma GetPayload output)
|
|
37
|
+
const inlineMatch = diag.messageText.match(TS2339_INLINE);
|
|
38
|
+
if (inlineMatch !== null) {
|
|
39
|
+
const [, property] = inlineMatch;
|
|
40
|
+
const key = `${property}`;
|
|
41
|
+
if (!seen.has(key)) {
|
|
42
|
+
seen.add(key);
|
|
43
|
+
hints.push({ property: property, modelType: "(Prisma Payload)" });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
33
46
|
}
|
|
34
47
|
if (hints.length === 0)
|
|
35
48
|
return "";
|
|
@@ -39,11 +52,16 @@ function generateTS2339Hints(diagnostics) {
|
|
|
39
52
|
return [
|
|
40
53
|
"## TS2339 Relation Field Hints",
|
|
41
54
|
"",
|
|
42
|
-
"These TS2339 errors are caused by accessing
|
|
43
|
-
"
|
|
44
|
-
"
|
|
55
|
+
"These TS2339 errors are caused by accessing fields not available on the Prisma Payload type.",
|
|
56
|
+
"This usually means the field is MISSING from your `select()` object.",
|
|
57
|
+
"",
|
|
58
|
+
"**Fix**: For each property below, add it to `select()`:",
|
|
59
|
+
"- Scalar field → `fieldName: true`",
|
|
60
|
+
"- Relation (has neighbor transformer) → `relation: NeighborTransformer.select()`",
|
|
61
|
+
"- Relation (no transformer) → `relation: { select: { ... } }`",
|
|
62
|
+
"- Aggregate count → `_count: { select: { relation: true } }`",
|
|
45
63
|
"",
|
|
46
|
-
"Affected:",
|
|
64
|
+
"Affected properties:",
|
|
47
65
|
lines,
|
|
48
66
|
].join("\n");
|
|
49
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateTS2339Hints.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/utils/generateTS2339Hints.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generateTS2339Hints.js","sourceRoot":"","sources":["../../../../src/orchestrate/realize/utils/generateTS2339Hints.ts"],"names":[],"mappings":";;AAcA,kDA2DC;AAvED;;;;;;;;;;;GAWG;AACH,SAAgB,mBAAmB,CACjC,WAAyD;IAEzD,kDAAkD;IAClD,MAAM,aAAa,GAAG,sDAAsD,CAAC;IAC7E,MAAM,aAAa,GACjB,0DAA0D,CAAC;IAE7D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,KAAK,GAAmD,EAAE,CAAC;IAEjE,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI;YAAE,SAAS;QAEzC,8BAA8B;QAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC1D,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACzB,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAC;YAC3C,MAAM,GAAG,GAAG,GAAG,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACd,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAS,EAAE,SAAS,EAAE,QAAS,EAAE,CAAC,CAAC;YAC5D,CAAC;YACD,SAAS;QACX,CAAC;QAED,0DAA0D;QAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC1D,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACzB,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAC;YACjC,MAAM,GAAG,GAAG,GAAG,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACd,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAElC,MAAM,KAAK,GAAG,KAAK;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,QAAQ,WAAW,CAAC,CAAC,SAAS,IAAI,CAAC;SACvD,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;QACL,gCAAgC;QAChC,EAAE;QACF,8FAA8F;QAC9F,sEAAsE;QACtE,EAAE;QACF,yDAAyD;QACzD,oCAAoC;QACpC,kFAAkF;QAClF,+DAA+D;QAC/D,8DAA8D;QAC9D,EAAE;QACF,sBAAsB;QACtB,KAAK;KACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -273,12 +273,12 @@ const systemPrompt = new tstl_1.Singleton(() => "<!--\nfilename: TEST_OPERATION_
|
|
|
273
273
|
type: "object",
|
|
274
274
|
properties: {
|
|
275
275
|
path: {
|
|
276
|
-
description: "HTTP path of the API operation.\n\
|
|
276
|
+
description: "HTTP path of the API operation.\n\nMust start with `/`. Parameters use curly braces: `{paramName}`. Resource\nnames in camelCase. No quotes, spaces, role prefixes (`/admin/`), or API\nversion prefixes (`/api/v1/`).\n\nAllowed characters: letters, digits, `/`, `{`, `}`, `-`, `_`, `.`",
|
|
277
277
|
type: "string",
|
|
278
278
|
pattern: "^\\/[a-zA-Z0-9\\/_{}.-]*$"
|
|
279
279
|
},
|
|
280
280
|
method: {
|
|
281
|
-
description: "HTTP method
|
|
281
|
+
description: "HTTP method (lowercase only).\n\nUse `patch` (not `get`) when a read operation needs a complex\n{@link requestBody}. `get` cannot have a request body.",
|
|
282
282
|
type: "string",
|
|
283
283
|
"enum": [
|
|
284
284
|
"get",
|