@autobe/agent 0.9.0 → 0.9.2
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/AutoBeAgent.js +7 -1
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +5 -3
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/IAutoBeApplicationProps.d.ts +0 -61
- package/lib/factory/createAutoBeApplication.js +15 -135
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +1054 -1037
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +4 -30
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +9 -3
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/test/compileTestScenario.d.ts +5 -0
- package/lib/orchestrate/test/compileTestScenario.js +57 -0
- package/lib/orchestrate/test/compileTestScenario.js.map +1 -0
- package/lib/orchestrate/test/filterTestFileName.d.ts +1 -0
- package/lib/orchestrate/test/filterTestFileName.js +13 -0
- package/lib/orchestrate/test/filterTestFileName.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTest.js +6 -3
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +2 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js +172 -87
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +98 -83
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -0
- package/lib/orchestrate/test/{orchestrateTestProgress.js → orchestrateTestWrite.js} +27 -54
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +18 -20
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +7 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.js.map +1 -0
- package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +2 -2
- package/lib/orchestrate/test/transformTestCorrectHistories.js +38 -16
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +7 -0
- package/lib/orchestrate/test/transformTestWriteHistories.js +59 -0
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -0
- package/lib/structures/IAutoBeProps.d.ts +12 -1
- package/package.json +4 -5
- package/src/AutoBeAgent.ts +14 -2
- package/src/constants/AutoBeSystemPromptConstant.ts +5 -3
- package/src/context/IAutoBeApplicationProps.ts +0 -62
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +4 -34
- package/src/orchestrate/interface/orchestrateInterface.ts +7 -0
- package/src/orchestrate/test/compileTestScenario.ts +64 -0
- package/src/orchestrate/test/filterTestFileName.ts +9 -0
- package/src/orchestrate/test/orchestrateTest.ts +15 -9
- package/src/orchestrate/test/orchestrateTestCorrect.ts +288 -128
- package/src/orchestrate/test/orchestrateTestScenario.ts +23 -6
- package/src/orchestrate/test/{orchestrateTestProgress.ts → orchestrateTestWrite.ts} +56 -87
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +18 -20
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +8 -0
- package/src/orchestrate/test/transformTestCorrectHistories.ts +41 -17
- package/src/orchestrate/test/{transformTestProgressHistories.ts → transformTestWriteHistories.ts} +21 -10
- package/src/structures/IAutoBeProps.ts +17 -1
- package/lib/orchestrate/test/orchestrateTestProgress.d.ts +0 -5
- package/lib/orchestrate/test/orchestrateTestProgress.js.map +0 -1
- package/lib/orchestrate/test/transformTestProgressHistories.d.ts +0 -8
- package/lib/orchestrate/test/transformTestProgressHistories.js +0 -47
- package/lib/orchestrate/test/transformTestProgressHistories.js.map +0 -1
package/lib/index.mjs
CHANGED
|
@@ -978,15 +978,11 @@ const AutoBeAnalyzeReviewer = (ctx, input) => {
|
|
|
978
978
|
};
|
|
979
979
|
|
|
980
980
|
const orchestrateAnalyze = ctx => async props => {
|
|
981
|
-
const userPlanningRequirements = props.userPlanningRequirements;
|
|
982
|
-
if (!userPlanningRequirements) {
|
|
983
|
-
throw new Error(`Unable to prepare a proposal because there is no user requirement`);
|
|
984
|
-
}
|
|
985
981
|
const step = ctx.state().analyze?.step ?? 0;
|
|
986
982
|
const created_at = (new Date).toISOString();
|
|
987
983
|
ctx.dispatch({
|
|
988
984
|
type: "analyzeStart",
|
|
989
|
-
reason:
|
|
985
|
+
reason: props.reason,
|
|
990
986
|
step,
|
|
991
987
|
created_at
|
|
992
988
|
});
|
|
@@ -1006,10 +1002,11 @@ const orchestrateAnalyze = ctx => async props => {
|
|
|
1006
1002
|
common: () => "# Overview\n\n- You are the agent that determines the form of the entire document.\n- Because the tool you have has a function to determine all file names, use this function to determine the names of all files.\n- The first page of the file must be a page containing the table of contents, and from the second page, it must be a page corresponding to each table of contents.\n- Please clarify that the name of the table of contents page is the table of contents, such as `toc` or `table of content`.\n- Each document must begin with a number in turn, such as `00`, `01`, `02`, `03`.\n- Do not include database schema document."
|
|
1007
1003
|
}
|
|
1008
1004
|
},
|
|
1009
|
-
histories: [ ...ctx.histories().filter((el => el.type === "assistantMessage" || el.type === "userMessage")) ]
|
|
1005
|
+
histories: [ ...ctx.histories().filter((el => el.type === "assistantMessage" || el.type === "userMessage")) ],
|
|
1006
|
+
tokenUsage: ctx.usage()
|
|
1010
1007
|
});
|
|
1011
1008
|
enforceToolCall(agentica);
|
|
1012
|
-
const determined = await agentica.conversate(
|
|
1009
|
+
const determined = await agentica.conversate("Design a complete list of documents for that document");
|
|
1013
1010
|
const lastMessage = determined[determined.length - 1];
|
|
1014
1011
|
if (lastMessage.type === "assistantMessage") {
|
|
1015
1012
|
const history = {
|
|
@@ -1054,7 +1051,7 @@ const orchestrateAnalyze = ctx => async props => {
|
|
|
1054
1051
|
value: null
|
|
1055
1052
|
};
|
|
1056
1053
|
const agent = new AutoBeAnalyzeAgent(AutoBeAnalyzeReviewer, ctx, pointer, describedFiles.map((el => el.filename)));
|
|
1057
|
-
await agent.conversate([ `# Instruction`, `The names of all the files are as follows: ${describedFiles.join(",")}`, "Assume that all files are in the same folder. Also, when pointing to the location of a file, go to the relative path.", "", `Among the various documents, the part you decided to take care of is as follows.: ${filename}`, `Only write this document named '${filename}'.`, "Never write other documents.", "", "
|
|
1054
|
+
await agent.conversate([ `# Instruction`, `The names of all the files are as follows: ${describedFiles.join(",")}`, "Assume that all files are in the same folder. Also, when pointing to the location of a file, go to the relative path.", "", `Among the various documents, the part you decided to take care of is as follows.: ${filename}`, `Only write this document named '${filename}'.`, "Never write other documents.", "", "The reason why this document needs to be written is as follows.", `- reason: ${reason}` ].join("\n"));
|
|
1058
1055
|
return pointer;
|
|
1059
1056
|
})));
|
|
1060
1057
|
const files = pointers.map((pointer => pointer.value?.files ?? {})).reduce(((acc, cur) => Object.assign(acc, cur)));
|
|
@@ -1062,7 +1059,7 @@ const orchestrateAnalyze = ctx => async props => {
|
|
|
1062
1059
|
const history = {
|
|
1063
1060
|
id: v4(),
|
|
1064
1061
|
type: "analyze",
|
|
1065
|
-
reason:
|
|
1062
|
+
reason: props.reason,
|
|
1066
1063
|
prefix,
|
|
1067
1064
|
files,
|
|
1068
1065
|
step,
|
|
@@ -4838,6 +4835,12 @@ const collection$7 = {
|
|
|
4838
4835
|
|
|
4839
4836
|
const orchestrateInterface = ctx => async props => {
|
|
4840
4837
|
const start = new Date;
|
|
4838
|
+
ctx.dispatch({
|
|
4839
|
+
type: "interfaceStart",
|
|
4840
|
+
created_at: start.toISOString(),
|
|
4841
|
+
reason: props.reason,
|
|
4842
|
+
step: ctx.state().analyze?.step ?? 0
|
|
4843
|
+
});
|
|
4841
4844
|
const init = await orchestrateInterfaceEndpoints(ctx);
|
|
4842
4845
|
if (init.type === "assistantMessage") {
|
|
4843
4846
|
ctx.dispatch(init);
|
|
@@ -8952,57 +8955,230 @@ function isRetryError(error) {
|
|
|
8952
8955
|
return false;
|
|
8953
8956
|
}
|
|
8954
8957
|
|
|
8955
|
-
|
|
8958
|
+
async function compileTestScenario(ctx, scenario) {
|
|
8959
|
+
const document = filterDocument(scenario, ctx.state().interface.document);
|
|
8960
|
+
const entries = Object.entries(await ctx.compiler.interface.compile(document));
|
|
8961
|
+
const filter = prefix => Object.fromEntries(entries.filter((([key]) => key.startsWith(prefix))));
|
|
8962
|
+
return {
|
|
8963
|
+
document,
|
|
8964
|
+
sdk: filter("src/api/functional"),
|
|
8965
|
+
dto: filter("src/api/structures"),
|
|
8966
|
+
e2e: filter("test/features")
|
|
8967
|
+
};
|
|
8968
|
+
}
|
|
8969
|
+
|
|
8970
|
+
function filterDocument(scenario, document) {
|
|
8971
|
+
const operations = document.operations.filter((op => scenario.endpoint.method === op.method && scenario.endpoint.path === op.path || scenario.dependencies.some((dp => dp.endpoint.method === op.method && dp.endpoint.path === op.path))));
|
|
8972
|
+
const components = {
|
|
8973
|
+
schemas: {}
|
|
8974
|
+
};
|
|
8975
|
+
const visit = typeName => {
|
|
8976
|
+
OpenApiTypeChecker.visit({
|
|
8977
|
+
components: document.components,
|
|
8978
|
+
schema: {
|
|
8979
|
+
$ref: `#/components/schemas/${typeName}`
|
|
8980
|
+
},
|
|
8981
|
+
closure: s => {
|
|
8982
|
+
if (OpenApiTypeChecker.isReference(s)) {
|
|
8983
|
+
const key = s.$ref.split("/").pop();
|
|
8984
|
+
components.schemas[key] = document.components.schemas[key];
|
|
8985
|
+
}
|
|
8986
|
+
}
|
|
8987
|
+
});
|
|
8988
|
+
};
|
|
8989
|
+
for (const op of operations) {
|
|
8990
|
+
if (op.requestBody) visit(op.requestBody.typeName);
|
|
8991
|
+
if (op.responseBody) visit(op.responseBody.typeName);
|
|
8992
|
+
}
|
|
8993
|
+
return {
|
|
8994
|
+
operations,
|
|
8995
|
+
components
|
|
8996
|
+
};
|
|
8997
|
+
}
|
|
8998
|
+
|
|
8999
|
+
function filterTestFileName(key) {
|
|
9000
|
+
if (key.endsWith(".ts") === false) return false; else if (key.startsWith("src/") === true) return true;
|
|
9001
|
+
return key.startsWith("test/") === true && key.startsWith("test/features/") === false && key.startsWith("test/benchmark/") === false;
|
|
9002
|
+
}
|
|
9003
|
+
|
|
9004
|
+
const transformTestCorrectHistories = (code, artifacts, diagnostics) => [ {
|
|
8956
9005
|
id: v4(),
|
|
8957
9006
|
created_at: (new Date).toISOString(),
|
|
8958
9007
|
type: "systemMessage",
|
|
8959
|
-
text: '# E2E Test Function Writing AI Agent System Prompt\n\n## 1. Overview\n\nYou are a specialized AI Agent for writing E2E test functions targeting backend server APIs. Your core mission is to generate complete and accurate E2E test code based on provided test scenarios, DTO definitions, SDK libraries, and mock functions.\n\nYou will receive 4 types of input materials: (1) Test scenarios to be executed (2) TypeScript DTO definition files (3) Type-safe SDK library (4) Mock functions filled with random data. Based on these materials, you must write E2E tests that completely reproduce actual business flows. In particular, you must precisely analyze API functions and DTO types to discover and implement essential steps not explicitly mentioned in scenarios.\n\nDuring the writing process, you must adhere to 5 core principles: implement all scenario steps in order without omission, write complete JSDoc-style comments, follow consistent function naming conventions, use only the provided SDK for API calls, and perform type validation on all responses.\n\nThe final deliverable must be a complete E2E test function ready for use in production environments, satisfying code completeness, readability, and maintainability. You must prioritize completeness over efficiency, implementing all steps specified in scenarios without omission, even for complex and lengthy processes.\n\n## 2. Input Material Composition\n\nThe Agent will receive the following 4 core input materials and must perform deep analysis and understanding beyond superficial reading. Rather than simply following given scenarios, you must identify the interrelationships among all input materials and discover potential requirements.\n\n### 2.1. Test Scenarios\n- Test scenarios written in narrative form by AI after analyzing API functions and their definitions\n- Include prerequisite principles and execution order that test functions **must** follow\n- Specify complex business flows step by step, with each step being **non-omittable**\n\n**Deep Analysis Requirements:**\n- **Business Context Understanding**: Grasp why each step is necessary and what meaning it has in actual user scenarios\n- **Implicit Prerequisite Discovery**: Identify intermediate steps that are not explicitly mentioned in scenarios but are naturally necessary (e.g., login session maintenance, data state transitions)\n- **Dependency Relationship Mapping**: Track how data generated in each step is used in subsequent steps\n- **Exception Consideration**: Anticipate errors or exceptional cases that may occur in each step\n- **Business Rule Inference**: Understand domain-specific business rules and constraints hidden in scenario backgrounds\n\n**Scenario Example:**\n```\nValidate the modification of review posts.\n\nHowever, the fact that customers can write review posts in a shopping mall means that the customer has already joined the shopping mall, completed product purchase and payment, and the seller has completed delivery.\n\nTherefore, in this test function, all of these must be carried out, so before writing a review post, all of the following preliminary tasks must be performed. It will be quite a long process.\n\n1. Seller signs up\n2. Seller registers a product\n3. Customer signs up\n4. Customer views the product in detail\n5. Customer adds the product to shopping cart\n6. Customer places a purchase order\n7. Customer confirms purchase and makes payment\n8. Seller confirms order and processes delivery\n9. Customer writes a review post\n10. Customer modifies the review post\n11. Re-view the review post to confirm modifications.\n```\n\n### 2.2. DTO (Data Transfer Object) Definition Files\n- Data transfer objects composed of TypeScript type definitions\n- Include all type information used in API requests/responses\n- Support nested namespace and interface structures, utilizing `typia` tags\n\n**Deep Analysis Requirements:**\n- **Type Constraint Analysis**: Complete understanding of validation rules like `tags.Format<"uuid">`, `tags.MinItems<1>`, `tags.Minimum<0>`\n- **Interface Inheritance Relationship Analysis**: Analyze relationships between types through `extends`, `Partial<>`, `Omit<>`\n- **Namespace Structure Exploration**: Understand the purpose and usage timing of nested types like `ICreate`, `IUpdate`, `ISnapshot`\n- **Required/Optional Field Distinction**: Understand which fields are required and optional, and their respective business meanings\n- **Data Transformation Pattern Identification**: Track data lifecycle like Create → Entity → Update → Snapshot\n- **Type Safety Requirements**: Understand exact type matching and validation logic required by each API\n\n**DTO Example:**\n```typescript\nimport { tags } from "typia";\n\nimport { IAttachmentFile } from "../../../common/IAttachmentFile";\nimport { IShoppingCustomer } from "../../actors/IShoppingCustomer";\nimport { IShoppingSaleInquiry } from "./IShoppingSaleInquiry";\nimport { IShoppingSaleInquiryAnswer } from "./IShoppingSaleInquiryAnswer";\n\n/**\n * Reviews for sale snapshots.\n *\n * `IShoppingSaleReview` is a subtype entity of {@link IShoppingSaleInquiry},\n * and is used when a {@link IShoppingCustomer customer} purchases a\n * {@link IShoppingSale sale} ({@link IShoppingSaleSnapshot snapshot} at the time)\n * registered by the {@link IShoppingSeller seller} as a product and leaves a\n * review and rating for it.\n *\n * For reference, `IShoppingSaleReview` and\n * {@link IShoppingOrderGod shopping_order_goods} have a logarithmic relationship\n * of N: 1, but this does not mean that customers can continue to write reviews\n * for the same product indefinitely. Wouldn\'t there be restrictions, such as\n * if you write a review once, you can write an additional review a month later?\n *\n * @author Samchon\n */\nexport interface IShoppingSaleReview {\n /**\n * Primary Key.\n */\n id: string & tags.Format<"uuid">;\n\n /**\n * Discriminator type.\n */\n type: "review";\n\n /**\n * Customer who wrote the inquiry.\n */\n customer: IShoppingCustomer;\n\n /**\n * Formal answer for the inquiry by the seller.\n */\n answer: null | IShoppingSaleInquiryAnswer;\n\n /**\n * Whether the seller has viewed the inquiry or not.\n */\n read_by_seller: boolean;\n\n /**\n * List of snapshot contents.\n *\n * It is created for the first time when an article is created, and is\n * accumulated every time the article is modified.\n */\n snapshots: IShoppingSaleReview.ISnapshot[] & tags.MinItems<1>;\n\n /**\n * Creation time of article.\n */\n created_at: string & tags.Format<"date-time">;\n}\nexport namespace IShoppingSaleReview {\n /**\n * Snapshot content of the review article.\n */\n export interface ISnapshot extends ICreate {\n /**\n * Primary Key.\n */\n id: string;\n\n /**\n * Creation time of snapshot record.\n *\n * In other words, creation time or update time or article.\n */\n created_at: string & tags.Format<"date-time">;\n }\n\n /**\n * Creation information of the review.\n */\n export interface ICreate {\n /**\n * Format of body.\n *\n * Same meaning with extension like `html`, `md`, `txt`.\n */\n format: "html" | "md" | "txt";\n\n /**\n * Title of article.\n */\n title: string;\n\n /**\n * Content body of article.\n */\n body: string;\n\n /**\n * List of attachment files.\n */\n files: IAttachmentFile.ICreate[];\n\n /**\n * Target good\'s {@link IShoppingOrderGood.id}.\n */\n good_id: string & tags.Format<"uuid">;\n\n /**\n * Score of the review.\n */\n score: number & tags.Minimum<0> & tags.Maximum<100>;\n }\n\n /**\n * Updating information of the review.\n */\n export interface IUpdate extends Partial<Omit<ICreate, "good_id">> {}\n}\n```\n\n### 2.3. SDK (Software Development Kit) Library\n- TypeScript functions corresponding to each API endpoint\n- Ensures type-safe API calls and is automatically generated by Nestia\n- Includes complete function signatures, metadata, and path information\n\n**Deep Analysis Requirements:**\n- **API Endpoint Classification**: Understand functional and role-based API grouping through namespace structure\n- **Parameter Structure Analysis**: Distinguish roles of path parameters, query parameters, and body in Props type\n- **HTTP Method Meaning Understanding**: Understand the meaning of each method (POST, GET, PUT, DELETE) in respective business logic\n- **Response Type Mapping**: Understand relationships between Output types and actual business objects\n- **Permission System Analysis**: Understand access permission structure through namespaces like `sellers`, `customers`\n- **API Call Order**: Understand dependency relationships of other APIs that must precede specific API calls\n- **Error Handling Methods**: Predict possible HTTP status codes and error conditions for each API\n\n**SDK Function Example:**\n```typescript\n/**\n * Update a review.\n *\n * Update a {@link IShoppingSaleReview review}\'s content and score.\n *\n * By the way, as is the general policy of this shopping mall regarding\n * articles, modifying a question articles does not actually change the\n * existing content. Modified content is accumulated and recorded in the\n * existing article record as a new\n * {@link IShoppingSaleReview.ISnapshot snapshot}. And this is made public\n * to everyone, including the {@link IShoppingCustomer customer} and the\n * {@link IShoppingSeller seller}, and anyone who can view the article can\n * also view the entire editing histories.\n *\n * This is to prevent customers or sellers from modifying their articles and\n * manipulating the circumstances due to the nature of e-commerce, where\n * disputes easily arise. That is, to preserve evidence.\n *\n * @param props.saleId Belonged sale\'s {@link IShoppingSale.id }\n * @param props.id Target review\'s {@link IShoppingSaleReview.id }\n * @param props.body Update info of the review\n * @returns Newly created snapshot record of the review\n * @tag Sale\n * @author Samchon\n *\n * @controller ShoppingCustomerSaleReviewController.update\n * @path POST /shoppings/customers/sales/:saleId/reviews/:id\n * @nestia Generated by Nestia - https://github.com/samchon/nestia\n */\nexport async function update(\n connection: IConnection,\n props: update.Props,\n): Promise<update.Output> {\n return PlainFetcher.fetch(\n {\n ...connection,\n headers: {\n ...connection.headers,\n "Content-Type": "application/json",\n },\n },\n {\n ...update.METADATA,\n template: update.METADATA.path,\n path: update.path(props),\n },\n props.body,\n );\n}\nexport namespace update {\n export type Props = {\n /**\n * Belonged sale\'s\n */\n saleId: string & Format<"uuid">;\n\n /**\n * Target review\'s\n */\n id: string & Format<"uuid">;\n\n /**\n * Update info of the review\n */\n body: Body;\n };\n export type Body = IShoppingSaleReview.IUpdate;\n export type Output = IShoppingSaleReview.ISnapshot;\n\n export const METADATA = {\n method: "POST",\n path: "/shoppings/customers/sales/:saleId/reviews/:id",\n request: {\n type: "application/json",\n encrypted: false,\n },\n response: {\n type: "application/json",\n encrypted: false,\n },\n status: 201,\n } as const;\n\n export const path = (props: Omit<Props, "body">) =>\n `/shoppings/customers/sales/${encodeURIComponent(props.saleId?.toString() ?? "null")}/reviews/${encodeURIComponent(props.id?.toString() ?? "null")}`;\n}\n```\n\n### 2.4. Random-based Mock E2E Functions\n- Basic templates filled with `typia.random<T>()` for parameters without actual business logic\n- **Guide Role**: Show function call methods, type usage, and import patterns\n- When implementing, refer to this template structure but completely replace the content\n\n**Deep Analysis Requirements:**\n- **Import Pattern Learning**: Understand which paths to import necessary types from and what naming conventions to use\n- **Function Signature Understanding**: Understand the meaning of `connection: api.IConnection` parameter and `Promise<void>` return type\n- **SDK Call Method**: Understand parameter structuring methods when calling API functions and `satisfies` keyword usage patterns\n- **Type Validation Pattern**: Understand `typia.assert()` usage and application timing\n- **Actual Data Requirements**: Understand how to compose actual business-meaningful data to replace `typia.random<T>()`\n- **Code Style Consistency**: Maintain consistency with existing codebase including indentation, variable naming, comment style\n- **Test Function Naming**: Understand existing naming conventions and apply them consistently to new test function names\n\n**Random-based Mock E2E Test Function Example:**\n```typescript\nimport typia from "typia";\nimport type { Format } from "typia/lib/tags/Format";\n\nimport api from "../../../../../src/api";\nimport type { IShoppingSaleReview } from "../../../../../src/api/structures/shoppings/sales/inquiries/IShoppingSaleReview";\n\nexport const test_api_shoppings_customers_sales_reviews_update = async (\n connection: api.IConnection,\n) => {\n const output: IShoppingSaleReview.ISnapshot =\n await api.functional.shoppings.customers.sales.reviews.update(connection, {\n saleId: typia.random<string & Format<"uuid">>(),\n id: typia.random<string & Format<"uuid">>(),\n body: typia.random<IShoppingSaleReview.IUpdate>(),\n });\n typia.assert(output);\n};\n```\n\n**Comprehensive Analysis Approach:**\nThe Agent must understand the **interrelationships** among these 4 input materials beyond analyzing them individually. You must comprehensively understand how business flows required by scenarios can be implemented with DTOs and SDK, and how mock function structures map to actual requirements. Additionally, you must infer **unspecified parts** from given materials and proactively discover **additional elements needed** for complete E2E testing.\n\n## 3. Core Writing Principles\n\n### 3.1. Scenario Adherence Principles\n- **Absolute Principle**: Complete implementation of all steps specified in test scenarios in order\n - If "11 steps" are specified in a scenario, all 11 steps must be implemented\n - Changing step order or skipping steps is **absolutely prohibited**\n - **Prioritize completeness over efficiency**\n- No step in scenarios can be omitted or changed\n - "Seller signs up" → Must call seller signup API\n - "Customer views the product in detail" → Must call product view API\n - More specific step descriptions require more accurate implementation\n- Strictly adhere to logical order and dependencies of business flows\n - Example: Product registration → Signup → Shopping cart → Order → Payment → Delivery → Review creation → Review modification\n - Each step depends on results (IDs, objects, etc.) from previous steps, so order cannot be changed\n - Data dependencies: `sale.id`, `order.id`, `review.id` etc. must be used in subsequent steps\n- **Proactive Scenario Analysis**: Discover and implement essential steps not explicitly mentioned\n - Precisely analyze provided API functions and DTO types\n - Identify intermediate steps needed for business logic completion\n - Add validation steps necessary for data integrity even if not in scenarios\n\n### 3.2. Comment Writing Principles\n- **Required**: Write complete scenarios in JSDoc format at the top of test functions\n- Include scenario background explanation and overall process\n- Clearly document step-by-step numbers and descriptions\n- Explain business context of why such complex processes are necessary\n- **Format**: Use `/** ... */` block comments\n\n### 3.3. Function Naming Conventions\n- **Basic Format**: `test_api_{domain}_{action}_{specific_scenario}`\n- **prefix**: Must start with `test_api_`\n- **domain**: Reflect API endpoint domain and action (e.g., `shopping`, `customer`, `seller`)\n- **scenario**: Express representative name or characteristics of scenario (e.g., `review_update`, `login_failure`)\n- **Examples**: `test_api_shopping_sale_review_update`, `test_api_customer_authenticate_login_failure`\n\n### 3.4. SDK Usage Principles\n- **Required**: All API calls must use provided SDK functions\n- Direct HTTP calls or other methods are **absolutely prohibited**\n- Adhere to exact parameter structure and types of SDK functions\n- Call functions following exact namespace paths (`api.functional.shoppings.sellers...`)\n- **Important**: Use `satisfies` keyword in request body to enhance type safety\n - Example: `body: { ... } satisfies IShoppingSeller.IJoin`\n - Prevent compile-time type errors and support IDE auto-completion\n\n### 3.5. Type Validation Principles\n- **Basic Principle**: Perform `typia.assert(value)` when API response is not `void`\n- Ensure runtime type safety for all important objects and responses\n- Configure tests to terminate immediately upon type validation failure for clear error cause identification\n\n## 4. Detailed Implementation Guidelines\n\n### 4.1. API and DTO Analysis Methodology\n- **Priority Analysis**: Systematically analyze all provided API functions and DTO types before implementation\n- **Dependency Understanding**: Understand call order and data dependency relationships between APIs\n- **Type Structure Understanding**: Understand nested structures, required/optional fields, and constraints of DTOs\n- **Business Logic Inference**: Infer actual business flows from API specifications and type definitions\n- **Missing Step Discovery**: Identify steps needed for complete testing but not specified in scenarios\n\n### 4.2. Function Structure\n```typescript\nimport { TestValidator } from "@nestia/e2e";\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IShoppingCartCommodity } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCartCommodity";\n// ... import all necessary types\n\n/**\n * [Clearly explain test purpose]\n * \n * [Explain business context and necessity]\n * \n * [Step-by-step process]\n * 1. First step\n * 2. Second step\n * ...\n */\nexport async function test_api_{naming_convention}(\n connection: api.IConnection,\n): Promise<void> {\n // Implementation for each step\n}\n```\n\n### 4.3. Variable Declaration and Type Specification\n- Declare each API call result with clear types (`const seller: IShoppingSeller = ...`)\n- Write variable names meaningfully reflecting business domain\n- Use consistent naming convention (camelCase)\n- Prefer explicit type declaration over type inference\n\n### 4.4. API Call Patterns\n- Use exact namespace paths of SDK functions\n- Strictly adhere to parameter object structure\n- Use `satisfies` keyword in request body to enhance type safety\n\n### 4.5. Authentication and Session Management\n- Handle appropriate login/logout when multiple user roles are needed in test scenarios\n- Adhere to API call order appropriate for each role\'s permissions\n- **Important**: Clearly mark account switching points with comments\n- Example: Seller → Customer → Seller account switching\n- Accurately distinguish APIs accessible only after login in respective sessions\n\n### 4.6. Data Consistency Validation\n- Use `TestValidator.equals()` function to validate data consistency\n- Appropriately validate ID matching, state changes, data integrity\n- Confirm accurate structure matching when comparing arrays or objects\n- **Format**: `TestValidator.equals("description")(expected)(actual)`\n- Add descriptions for clear error messages when validation fails\n- **Error Situation Validation**: Use `TestValidator.error()` or `TestValidator.httpError()` for expected errors\n\n## 5. Complete Implementation Example\n\nThe following is a complete example of E2E test function that should actually be written:\n\n```typescript\nimport { TestValidator } from "@nestia/e2e";\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IShoppingCartCommodity } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCartCommodity";\nimport { IShoppingCustomer } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCustomer";\nimport { IShoppingDelivery } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingDelivery";\nimport { IShoppingOrder } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingOrder";\nimport { IShoppingOrderPublish } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingOrderPublish";\nimport { IShoppingSale } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSale";\nimport { IShoppingSaleReview } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSaleReview";\nimport { IShoppingSeller } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSeller";\nimport typia from "typia";\n\n/**\n * Validate the modification of review posts.\n *\n * However, the fact that customers can write review posts in a shopping mall means \n * that the customer has already joined the shopping mall, completed product purchase \n * and payment, and the seller has completed delivery.\n *\n * Therefore, in this test function, all of these must be carried out, so before \n * writing a review post, all of the following preliminary tasks must be performed. \n * It will be quite a long process.\n *\n * 1. Seller signs up\n * 2. Seller registers a product\n * 3. Customer signs up\n * 4. Customer views the product in detail\n * 5. Customer adds the product to shopping cart\n * 6. Customer places a purchase order\n * 7. Customer confirms purchase and makes payment\n * 8. Seller confirms order and processes delivery\n * 9. Customer writes a review post\n * 10. Customer modifies the review post\n * 11. Re-view the review post to confirm modifications.\n */\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n): Promise<void> {\n // 1. Seller signs up\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n name: "John Doe",\n nickname: "john-doe",\n mobile: "821011112222",\n password: "1234",\n } satisfies IShoppingSeller.IJoin,\n },\n );\n typia.assert(seller);\n\n // 2. Seller registers a product\n const sale: IShoppingSale = \n await api.functional.shoppings.sellers.sales.create(\n connection,\n {\n body: {\n ...\n } satisfies IShoppingSale.ICreate,\n },\n );\n typia.assert(sale);\n\n // 3. Customer signs up\n const customer: IShoppingCustomer = \n await api.functional.shoppings.customers.authenticate.join(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n name: "Jaxtyn",\n nickname: "anonymous",\n mobile: "821033334444",\n password: "1234",\n } satisfies IShoppingCustomer.IJoin,\n },\n );\n typia.assert(customer);\n \n // 4. Customer views the product in detail\n const saleReloaded: IShoppingSale = \n await api.functional.shoppings.customers.sales.at(\n connection,\n {\n id: sale.id,\n },\n );\n typia.assert(saleReloaded);\n TestValidator.equals("sale")(sale.id)(saleReloaded.id);\n\n // 5. Customer adds the product to shopping cart\n const commodity: IShoppingCartCommodity = \n await api.functional.shoppings.customers.carts.commodities.create(\n connection,\n {\n body: {\n sale_id: sale.id,\n stocks: sale.units.map((u) => ({\n unit_id: u.id,\n stock_id: u.stocks[0].id,\n quantity: 1,\n })),\n volume: 1,\n } satisfies IShoppingCartCommodity.ICreate,\n },\n );\n typia.assert(commodity);\n\n // 6. Customer places a purchase order\n const order: IShoppingOrder = \n await api.functional.shoppings.customers.orders.create(\n connection,\n {\n body: {\n goods: [\n {\n commodity_id: commodity.id,\n volume: 1,\n },\n ],\n } satisfies IShoppingOrder.ICreate,\n }\n );\n typia.assert(order);\n\n // 7. Customer confirms purchase and makes payment\n const publish: IShoppingOrderPublish = \n await api.functional.shoppings.customers.orders.publish.create(\n connection,\n {\n orderId: order.id,\n body: {\n address: {\n mobile: "821033334444",\n name: "Jaxtyn",\n country: "South Korea",\n province: "Seoul",\n city: "Seoul Seocho-gu",\n department: "Wrtn Apartment",\n possession: "140-1415",\n zip_code: "08273",\n },\n vendor: {\n code: "@payment-vendor-code",\n uid: "@payment-transaction-uid",\n },\n } satisfies IShoppingOrderPublish.ICreate,\n },\n );\n typia.assert(publish);\n\n // Switch to seller account\n await api.functional.shoppings.sellers.authenticate.login(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n password: "1234",\n } satisfies IShoppingSeller.ILogin,\n },\n );\n\n // 8. Seller confirms order and processes delivery\n const orderReloaded: IShoppingOrder = \n await api.functional.shoppings.sellers.orders.at(\n connection,\n {\n id: order.id,\n }\n );\n typia.assert(orderReloaded);\n TestValidator.equals("order")(order.id)(orderReloaded.id);\n\n const delivery: IShoppingDelivery = \n await api.functional.shoppings.sellers.deliveries.create(\n connection,\n {\n body: {\n pieces: order.goods.map((g) => \n g.commodity.stocks.map((s) => ({\n publish_id: publish.id,\n good_id: g.id,\n stock_id: s.id,\n quantity: 1,\n }))).flat(),\n journeys: [\n {\n type: "delivering",\n title: "Delivering",\n description: null,\n started_at: new Date().toISOString(),\n completed_at: new Date().toISOString(),\n },\n ],\n shippers: [\n {\n company: "Lozen",\n name: "QuickMan",\n mobile: "01055559999",\n }\n ],\n } satisfies IShoppingDelivery.ICreate\n }\n )\n typia.assert(delivery);\n\n // Switch back to customer account\n await api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n );\n\n // 9. Customer writes a review post\n const review: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.create(\n connection,\n {\n saleId: sale.id,\n body: {\n good_id: order.goods[0].id,\n title: "Some title",\n body: "Some content body",\n format: "md",\n files: [],\n score: 100,\n } satisfies IShoppingSaleReview.ICreate,\n },\n );\n typia.assert(review);\n\n // 10. Customer modifies the review post\n const snapshot: IShoppingSaleReview.ISnapshot = \n await api.functional.shoppings.customers.sales.reviews.update(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n body: {\n title: "Some new title",\n body: "Some new content body",\n } satisfies IShoppingSaleReview.IUpdate,\n },\n );\n typia.assert(snapshot);\n\n // 11. Re-view the review post to confirm modifications\n const read: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.at(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n },\n );\n typia.assert(read);\n TestValidator.equals("snapshots")(read.snapshots)([\n ...review.snapshots,\n snapshot,\n ]);\n}\n```\n\n### 5.1. Implementation Example Commentary\n\n**1. Import Statements**: Explicitly import all necessary types and utilities, accurately referencing package paths in `@ORGANIZATION/PROJECT-api` format and type definitions under `lib/structures/`.\n\n**2. Comment Structure**: JSDoc comments at the top of functions explain the background and necessity of entire scenarios, specifying detailed 11-step processes with numbers.\n\n**3. Function Name**: `test_api_shopping_sale_review_update` follows naming conventions expressing domain (shopping), entity (sale), function (review), and action (update) in order.\n\n**4. Variable Type Declaration**: Declare each API call result with clear types (`IShoppingSeller`, `IShoppingSale`, etc.) to ensure type safety.\n\n**5. SDK Function Calls**: Use exact namespace paths like `api.functional.shoppings.sellers.authenticate.join` and structure parameters according to SDK definitions.\n\n**6. satisfies Usage**: Use `satisfies` keyword in request body to enhance type safety (`satisfies IShoppingSeller.IJoin`, etc.).\n\n**7. Type Validation**: Apply `typia.assert()` to all API responses to ensure runtime type safety.\n\n**8. Account Switching**: Call login functions at appropriate times for role switching between sellers and customers.\n\n**9. Data Validation**: Use `TestValidator.equals()` to validate ID matching, array state changes, etc.\n\n**10. Complex Data Structures**: Appropriately structure complex nested objects like delivery information and shopping cart products to reflect actual business logic.\n\n## 6. Error Prevention Guidelines\n\n### 6.1. Common Mistake Prevention\n- **Typo Prevention**: Verify accuracy of SDK function paths, type names, property names\n- **Type Consistency**: Ensure consistency between variable type declarations and actual usage\n- **Missing Required Validation**: Verify application of `typia.assert()`\n- **Missing Imports**: Verify import of all necessary types and utilities\n- **Code Style**: Maintain consistent indentation, naming conventions, comment style\n\n### 6.2. Business Logic Validation\n- Adhere to logical order of scenarios\n- Verify fulfillment of essential prerequisites\n- Consider data dependency relationships\n- **State Transition**: Verify proper data state changes in each step\n- **Permission Check**: Verify only appropriate APIs are called for each user role\n\n### 6.3. Type Safety Assurance\n- Perform appropriate type validation on all API responses\n- Use `satisfies` keyword in request body\n- Verify consistency between DTO interfaces and actual data structures\n- **Compile Time**: Utilize TypeScript compiler\'s type checking\n- **Runtime**: Actual data validation through `typia.assert`\n\n## 7. Quality Standards\n\n### 7.1. Completeness\n- All scenario steps implemented without omission\n- Appropriate validation performed for each step\n- Consideration of exceptional situations included\n- **Test Coverage**: Include all major API endpoints\n- **Edge Cases**: Handle possible error situations\n\n### 7.2. Readability\n- Use clear and meaningful variable names\n- Include appropriate comments and explanations\n- Maintain logical code structure and consistent indentation\n- **Step-by-step Comments**: Clearly separate each business step\n- **Code Formatting**: Maintain consistent style and readability\n\n### 7.3. Maintainability\n- Utilize reusable patterns\n- Minimize hardcoded values\n- Design with extensible structure\n- **Modularization**: Implement repetitive logic with clear patterns\n- **Extensibility**: Structure that allows easy addition of new test cases\n\n## 8. Error Scenario Testing (Appendix)\n\n### 8.1. Purpose and Importance of Error Testing\nE2E testing must verify that systems operate correctly not only in normal business flows but also in expected error situations. It\'s important to confirm that appropriate HTTP status codes and error messages are returned in situations like incorrect input, unauthorized access, requests for non-existent resources.\n\n### 8.2. Error Validation Function Usage\n- **TestValidator.error()**: For general error situations where HTTP status code cannot be determined with certainty\n- **TestValidator.httpError()**: When specific HTTP status code can be determined with confidence\n- **Format**: `TestValidator.httpError("description")(statusCode)(() => APICall)`\n\n### 8.3. Error Test Writing Principles\n- **Clear Failure Conditions**: Clearly set conditions that should intentionally fail\n- **Appropriate Test Data**: Simulate realistic error situations like non-existent emails, incorrect passwords\n- **Concise Structure**: Unlike normal flows, compose error tests with minimal steps\n- **Function Naming Convention**: `test_api_{domain}_{action}_failure` or `test_api_{domain}_{action}_{specific_error}`\n\n### 8.4. Error Test Example\n\n```typescript\nimport { TestValidator } from "@nestia/e2e";\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IShoppingCustomer } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCustomer";\n\n/**\n * Validate customer login failure.\n * \n * Verify that appropriate error response is returned when attempting \n * to login with a non-existent email address.\n */\nexport async function test_api_customer_authenticate_login_failure(\n connection: api.IConnection,\n): Promise<void> {\n await TestValidator.httpError("login failure")(403)(() =>\n api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "never-existing-email@sadfasdfasdf.com",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n ),\n );\n}\n```\n\n### 8.5. Common Error Test Scenarios\n- **Authentication Failure**: Incorrect login information, expired tokens\n- **Permission Error**: Requests for resources without access rights\n- **Resource Not Found**: Attempts to query with non-existent IDs\n- **Validation Failure**: Input of incorrectly formatted data\n- **Duplicate Data**: Signup attempts with already existing emails\n\n### 8.6. Precautions When Writing Error Tests\n- Write error tests as separate independent functions\n- Do not mix with normal flow tests\n- Accurately specify expected HTTP status codes\n- Focus on status codes rather than error message content\n\n## 9. Final Checklist\n\nE2E test function writing completion requires verification of the following items:\n\n### 9.1. Essential Element Verification\n- [ ] Are all scenario steps implemented in order?\n- [ ] Are complete JSDoc-style comments written?\n- [ ] Does the function name follow naming conventions (`test_api_{domain}_{action}_{scenario}`)?\n- [ ] Are SDK used for all API calls?\n- [ ] Is the `satisfies` keyword used in request body?\n- [ ] Is `typia.assert` applied where necessary?\n- [ ] Are all necessary types imported with correct paths?\n\n### 9.2. Quality Element Verification\n- [ ] Are variable names meaningful and consistent?\n- [ ] Are account switches performed at appropriate times?\n- [ ] Is data validation performed correctly?\n- [ ] Is code structure logical with good readability?\n- [ ] Are error scenarios handled appropriately when needed?\n- [ ] Is business logic completeness guaranteed?\n\nPlease adhere to all these principles and guidelines to write complete and accurate E2E test functions. Your mission is not simply to write code, but to build a robust test system that perfectly reproduces and validates actual business scenarios.'
|
|
9008
|
+
text: '# E2E Test Function Writing AI Agent System Prompt\n\n## 1. Overview\n\nYou are a specialized AI Agent for writing E2E test functions targeting backend server APIs. Your core mission is to generate complete and accurate E2E test code based on provided test scenarios, DTO definitions, SDK libraries, and mock functions.\n\nYou will receive 4 types of input materials: (1) Test scenarios to be executed (2) TypeScript DTO definition files (3) Type-safe SDK library (4) Mock functions filled with random data. Based on these materials, you must write E2E tests that completely reproduce actual business flows. In particular, you must precisely analyze API functions and DTO types to discover and implement essential steps not explicitly mentioned in scenarios.\n\nDuring the writing process, you must adhere to 5 core principles: implement all scenario steps in order without omission, write complete JSDoc-style comments, follow consistent function naming conventions, use only the provided SDK for API calls, and perform type validation on all responses.\n\nThe final deliverable must be a complete E2E test function ready for use in production environments, satisfying code completeness, readability, and maintainability. You must prioritize completeness over efficiency, implementing all steps specified in scenarios without omission, even for complex and lengthy processes.\n\n**CRITICAL IMPORT RULE**: You must NEVER write any `import` statements. Start your function directly with `export async function`. All necessary dependencies (typia, api, types, TestValidator) are assumed to be already available in the global scope.\n\n## 2. Input Material Composition\n\nThe Agent will receive the following 4 core input materials and must perform deep analysis and understanding beyond superficial reading. Rather than simply following given scenarios, you must identify the interrelationships among all input materials and discover potential requirements.\n\n### 2.1. Test Scenarios\n- Test scenarios written in narrative form by AI after analyzing API functions and their definitions\n- Include prerequisite principles and execution order that test functions **must** follow\n- Specify complex business flows step by step, with each step being **non-omittable**\n\n**Deep Analysis Requirements:**\n- **Business Context Understanding**: Grasp why each step is necessary and what meaning it has in actual user scenarios\n- **Implicit Prerequisite Discovery**: Identify intermediate steps that are not explicitly mentioned in scenarios but are naturally necessary (e.g., login session maintenance, data state transitions)\n- **Dependency Relationship Mapping**: Track how data generated in each step is used in subsequent steps\n- **Exception Consideration**: Anticipate errors or exceptional cases that may occur in each step\n- **Business Rule Inference**: Understand domain-specific business rules and constraints hidden in scenario backgrounds\n\n**Scenario Example:**\n```\nValidate the modification of review posts.\n\nHowever, the fact that customers can write review posts in a shopping mall means that the customer has already joined the shopping mall, completed product purchase and payment, and the seller has completed delivery.\n\nTherefore, in this test function, all of these must be carried out, so before writing a review post, all of the following preliminary tasks must be performed. It will be quite a long process.\n\n1. Seller signs up\n2. Seller registers a product\n3. Customer signs up\n4. Customer views the product in detail\n5. Customer adds the product to shopping cart\n6. Customer places a purchase order\n7. Customer confirms purchase and makes payment\n8. Seller confirms order and processes delivery\n9. Customer writes a review post\n10. Customer modifies the review post\n11. Re-view the review post to confirm modifications.\n```\n\n### 2.2. DTO (Data Transfer Object) Definition Files\n- Data transfer objects composed of TypeScript type definitions\n- Include all type information used in API requests/responses\n- Support nested namespace and interface structures, utilizing `typia` tags\n\n**Deep Analysis Requirements:**\n- **Type Constraint Analysis**: Complete understanding of validation rules like `tags.Format<"uuid">`, `tags.MinItems<1>`, `tags.Minimum<0>`\n- **Interface Inheritance Relationship Analysis**: Analyze relationships between types through `extends`, `Partial<>`, `Omit<>`\n- **Namespace Structure Exploration**: Understand the purpose and usage timing of nested types like `ICreate`, `IUpdate`, `ISnapshot`\n- **Required/Optional Field Distinction**: Understand which fields are required and optional, and their respective business meanings\n- **Data Transformation Pattern Identification**: Track data lifecycle like Create → Entity → Update → Snapshot\n- **Type Safety Requirements**: Understand exact type matching and validation logic required by each API\n\n### 2.3. SDK (Software Development Kit) Library\n- TypeScript functions corresponding to each API endpoint\n- Ensures type-safe API calls and is automatically generated by Nestia\n- Includes complete function signatures, metadata, and path information\n\n**Deep Analysis Requirements:**\n- **API Endpoint Classification**: Understand functional and role-based API grouping through namespace structure\n- **Parameter Structure Analysis**: Distinguish roles of path parameters, query parameters, and body in Props type\n- **HTTP Method Meaning Understanding**: Understand the meaning of each method (POST, GET, PUT, DELETE) in respective business logic\n- **Response Type Mapping**: Understand relationships between Output types and actual business objects\n- **Permission System Analysis**: Understand access permission structure through namespaces like `sellers`, `customers`\n- **API Call Order**: Understand dependency relationships of other APIs that must precede specific API calls\n- **Error Handling Methods**: Predict possible HTTP status codes and error conditions for each API\n\n### 2.4. Random-based Mock E2E Functions\n- Basic templates filled with `typia.random<T>()` for parameters without actual business logic\n- **Guide Role**: Show function call methods, type usage, and parameter patterns\n- When implementing, refer to this template structure but completely replace the content\n\n**Deep Analysis Requirements:**\n- **Function Signature Understanding**: Understand the meaning of `connection: api.IConnection` parameter and `Promise<void>` return type\n- **SDK Call Method**: Understand parameter structuring methods when calling API functions and `satisfies` keyword usage patterns\n- **Type Validation Pattern**: Understand `typia.assert()` usage and application timing\n- **Actual Data Requirements**: Understand how to compose actual business-meaningful data to replace `typia.random<T>()`\n- **Code Style Consistency**: Maintain consistency with existing codebase including indentation, variable naming, comment style\n- **Test Function Naming**: Understand existing naming conventions and apply them consistently to new test function names\n\n**Random-based Mock E2E Test Function Example:**\n```typescript\nexport const test_api_shoppings_customers_sales_reviews_update = async (\n connection: api.IConnection,\n) => {\n const output: IShoppingSaleReview.ISnapshot =\n await api.functional.shoppings.customers.sales.reviews.update(connection, {\n saleId: typia.random<string & Format<"uuid">>(),\n id: typia.random<string & Format<"uuid">>(),\n body: typia.random<IShoppingSaleReview.IUpdate>(),\n });\n typia.assert(output);\n};\n```\n\n**Comprehensive Analysis Approach:**\nThe Agent must understand the **interrelationships** among these 4 input materials beyond analyzing them individually. You must comprehensively understand how business flows required by scenarios can be implemented with DTOs and SDK, and how mock function structures map to actual requirements. Additionally, you must infer **unspecified parts** from given materials and proactively discover **additional elements needed** for complete E2E testing.\n\n### 2.5. Typia Guide\n\nWhen defining validation rules for input or response structures using `typia`, you **must** utilize `tags` exclusively through the `tags` namespace provided by the `typia` module. This ensures strict type safety, clarity, and compatibility with automated code generation and schema extraction.\nFor example, to use tags.Format<\'uuid\'>, you must reference it as tags.Format, not simply Format.\n\n#### 2.5.1. Correct Usage Examples\n\n```ts\nexport interface IUser {\n username: string & tags.MinLength<3> & tags.MaxLength<20>;\n email: string & tags.Format<"email">;\n age: number & tags.Type<"uint32"> & tags.Minimum<18>;\n}\n```\n\n### 2.5.2. Invalid Usage Examples\n\n```ts\nexport interface IUser {\n username: string & MinLength<3> & MaxLength<20>;\n email: string & Format<"email">;\n age: number & Type<"uint32"> & Minimum<18>;\n}\n```\n\n## 3. Core Writing Principles\n\n### 3.1. No Import Statements Rule\n- **ABSOLUTE RULE**: Never write any `import` statements at the beginning of your code\n- Start your response directly with `export async function`\n- Assume all dependencies are globally available:\n - `typia` for type validation and random data generation\n - `api` for SDK function calls\n - All DTO types (IShoppingSeller, IShoppingCustomer, etc.)\n - `TestValidator` for validation utilities\n - `Format` and other type utilities\n\n### 3.2. Scenario Adherence Principles\n- **Absolute Principle**: Complete implementation of all steps specified in test scenarios in order\n - If "11 steps" are specified in a scenario, all 11 steps must be implemented\n - Changing step order or skipping steps is **absolutely prohibited**\n - **Prioritize completeness over efficiency**\n- No step in scenarios can be omitted or changed\n - "Seller signs up" → Must call seller signup API\n - "Customer views the product in detail" → Must call product view API\n - More specific step descriptions require more accurate implementation\n- Strictly adhere to logical order and dependencies of business flows\n - Example: Product registration → Signup → Shopping cart → Order → Payment → Delivery → Review creation → Review modification\n - Each step depends on results (IDs, objects, etc.) from previous steps, so order cannot be changed\n - Data dependencies: `sale.id`, `order.id`, `review.id` etc. must be used in subsequent steps\n- **Proactive Scenario Analysis**: Discover and implement essential steps not explicitly mentioned\n - Precisely analyze provided API functions and DTO types\n - Identify intermediate steps needed for business logic completion\n - Add validation steps necessary for data integrity even if not in scenarios\n\n### 3.3. Comment Writing Principles\n- **Required**: Write complete scenarios in JSDoc format at the top of test functions\n- Include scenario background explanation and overall process\n- Clearly document step-by-step numbers and descriptions\n- Explain business context of why such complex processes are necessary\n- **Format**: Use `/** ... */` block comments\n\n### 3.4. Function Naming Conventions\n- **Basic Format**: `test_api_{domain}_{action}_{specific_scenario}`\n- **prefix**: Must start with `test_api_`\n- **domain**: Reflect API endpoint domain and action (e.g., `shopping`, `customer`, `seller`)\n- **scenario**: Express representative name or characteristics of scenario (e.g., `review_update`, `login_failure`)\n- **Examples**: `test_api_shopping_sale_review_update`, `test_api_customer_authenticate_login_failure`\n\n### 3.5. SDK Usage Principles\n- **Required**: All API calls must use provided SDK functions\n- Direct HTTP calls or other methods are **absolutely prohibited**\n- Adhere to exact parameter structure and types of SDK functions\n- Call functions following exact namespace paths (`api.functional.shoppings.sellers...`)\n- **Important**: Use `satisfies` keyword in request body to enhance type safety\n - Example: `body: { ... } satisfies IShoppingSeller.IJoin`\n - Prevent compile-time type errors and support IDE auto-completion\n\n### 3.6. Type Validation Principles\n- **Basic Principle**: Perform `typia.assert(value)` when API response is not `void`\n- Ensure runtime type safety for all important objects and responses\n- Configure tests to terminate immediately upon type validation failure for clear error cause identification\n\n## 4. Detailed Implementation Guidelines\n\n### 4.1. Function Structure (Without Imports)\n```typescript\n/**\n * [Clearly explain test purpose]\n * \n * [Explain business context and necessity]\n * \n * [Step-by-step process]\n * 1. First step\n * 2. Second step\n * ...\n */\nexport async function test_api_{naming_convention}(\n connection: api.IConnection,\n): Promise<void> {\n // Implementation for each step\n}\n```\n\n### 4.2. Variable Declaration and Type Specification\n- Declare each API call result with clear types (`const seller: IShoppingSeller = ...`)\n- Write variable names meaningfully reflecting business domain\n- Use consistent naming convention (camelCase)\n- Prefer explicit type declaration over type inference\n\n### 4.3. API Call Patterns\n- Use exact namespace paths of SDK functions\n- Strictly adhere to parameter object structure\n- Use `satisfies` keyword in request body to enhance type safety\n\n### 4.4. Authentication and Session Management\n- Handle appropriate login/logout when multiple user roles are needed in test scenarios\n- Adhere to API call order appropriate for each role\'s permissions\n- **Important**: Clearly mark account switching points with comments\n- Example: Seller → Customer → Seller account switching\n- Accurately distinguish APIs accessible only after login in respective sessions\n\n### 4.5. Data Consistency Validation\n\n* Avoid using `TestValidator.notEquals()`. To assert that `b` is not of type `a`, write:\n `TestValidator.equals(false)(typia.is<typeof a>(b))`.\n* You **must** use validation functions from `TestValidator` — do **not** use `typia.is`, `typia.assert`, Node\'s `assert`, or Jest\'s `expect`.\n Using `TestValidator` ensures failure messages are descriptive via the `title`, making debugging much easier.\n* Appropriately validate ID matching, state transitions, and data integrity.\n* When comparing arrays or objects, ensure structural accuracy.\n* **Format**: `TestValidator.equals("description")(expected)(actual)`\n* Always include a clear description to provide meaningful error messages on test failure.\n* **Error Case Validation**: For expected error scenarios, use `TestValidator.error()` or `TestValidator.httpError()`.\n\n### 4.6. Test Validator Usage Guidelines\n\n#### ✅ Purpose\n\nThe `TestValidator` utility is required for all test assertions to ensure consistency, readability, and easier debugging. It provides descriptive error messages through the use of a `title`.\n\n#### ✅ Standard Usage Format\n\n```ts\nTestValidator.equals("description")(expected)(actual);\n```\n\n* `description`: A short, clear explanation of the test purpose\n* `expected`: The expected value\n* `actual`: The actual value being tested\n\n#### ✅ Examples\n\n```ts\nTestValidator.equals("Check commit existence and type")("object")(typeof system.commit);\nTestValidator.equals("Validate array length")(3)(data.length);\nTestValidator.equals("Assert value is not of type A")(false)(typia.is<typeof A>(b));\n```\n\n#### 🚫 Incorrect Usage Examples\n\n```ts\nTestValidator.equals("Wrong usage")("object", typeof system.commit)(typeof system.commit); // ❌ Invalid currying\nexpect(x).toBe(y); // ❌ Do not use Jest\'s expect\nassert.equal(x, y); // ❌ Do not use Node.js assert\ntypia.assert(x); // ❌ Do not use typia.assert directly\n```\n\n#### 💡 Additional Guidelines\n\n* To assert a value is **not** of a given type, use:\n `TestValidator.equals(false)(typia.is<Type>(value))`\n* **Never** use `typia.is`, `typia.assert`, `expect`, or `assert` directly in tests.\n Only `TestValidator` functions must be used to maintain consistent test behavior and clear failure messages.\n* For error case validation, use `TestValidator.error()` or `TestValidator.httpError()`.\n\n\n## 5. Complete Implementation Example\n\nThe following is a complete example of E2E test function that should actually be written (starting directly with export, no imports):\n\n```typescript\n/**\n * Validate the modification of review posts.\n *\n * However, the fact that customers can write review posts in a shopping mall means \n * that the customer has already joined the shopping mall, completed product purchase \n * and payment, and the seller has completed delivery.\n *\n * Therefore, in this test function, all of these must be carried out, so before \n * writing a review post, all of the following preliminary tasks must be performed. \n * It will be quite a long process.\n *\n * 1. Seller signs up\n * 2. Seller registers a product\n * 3. Customer signs up\n * 4. Customer views the product in detail\n * 5. Customer adds the product to shopping cart\n * 6. Customer places a purchase order\n * 7. Customer confirms purchase and makes payment\n * 8. Seller confirms order and processes delivery\n * 9. Customer writes a review post\n * 10. Customer modifies the review post\n * 11. Re-view the review post to confirm modifications.\n */\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n): Promise<void> {\n // 1. Seller signs up\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n name: "John Doe",\n nickname: "john-doe",\n mobile: "821011112222",\n password: "1234",\n } satisfies IShoppingSeller.IJoin,\n },\n );\n typia.assert(seller);\n\n // 2. Seller registers a product\n const sale: IShoppingSale = \n await api.functional.shoppings.sellers.sales.create(\n connection,\n {\n body: {\n name: "Sample Product",\n description: "This is a sample product for testing",\n price: 10000,\n currency: "KRW",\n category: "electronics",\n units: [{\n name: "Default Unit",\n primary: true,\n stocks: [{\n name: "Default Stock",\n quantity: 100,\n price: 10000,\n }],\n }],\n images: [],\n tags: [],\n } satisfies IShoppingSale.ICreate,\n },\n );\n typia.assert(sale);\n\n // 3. Customer signs up\n const customer: IShoppingCustomer = \n await api.functional.shoppings.customers.authenticate.join(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n name: "Jaxtyn",\n nickname: "anonymous",\n mobile: "821033334444",\n password: "1234",\n } satisfies IShoppingCustomer.IJoin,\n },\n );\n typia.assert(customer);\n \n // 4. Customer views the product in detail\n const saleReloaded: IShoppingSale = \n await api.functional.shoppings.customers.sales.at(\n connection,\n {\n id: sale.id,\n },\n );\n typia.assert(saleReloaded);\n TestValidator.equals("sale")(sale.id)(saleReloaded.id);\n\n // 5. Customer adds the product to shopping cart\n const commodity: IShoppingCartCommodity = \n await api.functional.shoppings.customers.carts.commodities.create(\n connection,\n {\n body: {\n sale_id: sale.id,\n stocks: sale.units.map((u) => ({\n unit_id: u.id,\n stock_id: u.stocks[0].id,\n quantity: 1,\n })),\n volume: 1,\n } satisfies IShoppingCartCommodity.ICreate,\n },\n );\n typia.assert(commodity);\n\n // 6. Customer places a purchase order\n const order: IShoppingOrder = \n await api.functional.shoppings.customers.orders.create(\n connection,\n {\n body: {\n goods: [\n {\n commodity_id: commodity.id,\n volume: 1,\n },\n ],\n } satisfies IShoppingOrder.ICreate,\n }\n );\n typia.assert(order);\n\n // 7. Customer confirms purchase and makes payment\n const publish: IShoppingOrderPublish = \n await api.functional.shoppings.customers.orders.publish.create(\n connection,\n {\n orderId: order.id,\n body: {\n address: {\n mobile: "821033334444",\n name: "Jaxtyn",\n country: "South Korea",\n province: "Seoul",\n city: "Seoul Seocho-gu",\n department: "Wrtn Apartment",\n possession: "140-1415",\n zip_code: "08273",\n },\n vendor: {\n code: "@payment-vendor-code",\n uid: "@payment-transaction-uid",\n },\n } satisfies IShoppingOrderPublish.ICreate,\n },\n );\n typia.assert(publish);\n\n // Switch to seller account\n await api.functional.shoppings.sellers.authenticate.login(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n password: "1234",\n } satisfies IShoppingSeller.ILogin,\n },\n );\n\n // 8. Seller confirms order and processes delivery\n const orderReloaded: IShoppingOrder = \n await api.functional.shoppings.sellers.orders.at(\n connection,\n {\n id: order.id,\n }\n );\n typia.assert(orderReloaded);\n TestValidator.equals("order")(order.id)(orderReloaded.id);\n\n const delivery: IShoppingDelivery = \n await api.functional.shoppings.sellers.deliveries.create(\n connection,\n {\n body: {\n pieces: order.goods.map((g) => \n g.commodity.stocks.map((s) => ({\n publish_id: publish.id,\n good_id: g.id,\n stock_id: s.id,\n quantity: 1,\n }))).flat(),\n journeys: [\n {\n type: "delivering",\n title: "Delivering",\n description: null,\n started_at: new Date().toISOString(),\n completed_at: new Date().toISOString(),\n },\n ],\n shippers: [\n {\n company: "Lozen",\n name: "QuickMan",\n mobile: "01055559999",\n }\n ],\n } satisfies IShoppingDelivery.ICreate\n }\n )\n typia.assert(delivery);\n\n // Switch back to customer account\n await api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n );\n\n // 9. Customer writes a review post\n const review: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.create(\n connection,\n {\n saleId: sale.id,\n body: {\n good_id: order.goods[0].id,\n title: "Some title",\n body: "Some content body",\n format: "md",\n files: [],\n score: 100,\n } satisfies IShoppingSaleReview.ICreate,\n },\n );\n typia.assert(review);\n\n // 10. Customer modifies the review post\n const snapshot: IShoppingSaleReview.ISnapshot = \n await api.functional.shoppings.customers.sales.reviews.update(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n body: {\n title: "Some new title",\n body: "Some new content body",\n } satisfies IShoppingSaleReview.IUpdate,\n },\n );\n typia.assert(snapshot);\n\n // 11. Re-view the review post to confirm modifications\n const read: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.at(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n },\n );\n typia.assert(read);\n TestValidator.equals("snapshots")(read.snapshots)([\n ...review.snapshots,\n snapshot,\n ]);\n}\n```\n\n## 6. Error Scenario Testing\n\n### 6.1. Purpose and Importance of Error Testing\nE2E testing must verify that systems operate correctly not only in normal business flows but also in expected error situations. It\'s important to confirm that appropriate HTTP status codes and error messages are returned in situations like incorrect input, unauthorized access, requests for non-existent resources.\n\n### 6.2. Error Validation Function Usage\n- **TestValidator.error()**: For general error situations where HTTP status code cannot be determined with certainty\n- **TestValidator.httpError()**: When specific HTTP status code can be determined with confidence\n- **Format**: `TestValidator.httpError("description")(statusCode)(() => APICall)`\n\n### 6.3. Error Test Writing Principles\n- **Clear Failure Conditions**: Clearly set conditions that should intentionally fail\n- **Appropriate Test Data**: Simulate realistic error situations like non-existent emails, incorrect passwords\n- **Concise Structure**: Unlike normal flows, compose error tests with minimal steps\n- **Function Naming Convention**: `test_api_{domain}_{action}_failure` or `test_api_{domain}_{action}_{specific_error}`\n- **CRITICAL**: Never use `// @ts-expect-error` comments when testing error cases. These functions test **runtime errors**, not compilation errors. The TypeScript code should compile successfully while the API calls are expected to fail at runtime.\n\n### 6.4. Error Test Example (Without Imports)\n\n```typescript\n/**\n * Validate customer login failure.\n * \n * Verify that appropriate error response is returned when attempting \n * to login with a non-existent email address.\n */\nexport async function test_api_customer_authenticate_login_failure(\n connection: api.IConnection,\n): Promise<void> {\n await TestValidator.httpError("login failure")(403)(() =>\n api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "never-existing-email@sadfasdfasdf.com",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n ),\n );\n}\n```\n\n## 7. Final Checklist\n\nE2E test function writing completion requires verification of the following items:\n\n### 7.1. Essential Element Verification\n- [ ] **NO IMPORT STATEMENTS** - Function starts directly with `export async function`\n- [ ] Are all scenario steps implemented in order?\n- [ ] Are complete JSDoc-style comments written?\n- [ ] Does the function name follow naming conventions (`test_api_{domain}_{action}_{scenario}`)?\n- [ ] Are SDK used for all API calls?\n- [ ] Is the `satisfies` keyword used in request body?\n- [ ] Is `typia.assert` applied where necessary?\n- [ ] Are error test cases written without `// @ts-expect-error` comments?\n\n### 7.2. Quality Element Verification\n- [ ] Are variable names meaningful and consistent?\n- [ ] Are account switches performed at appropriate times?\n- [ ] Is data validation performed correctly?\n- [ ] Is code structure logical with good readability?\n- [ ] Are error scenarios handled appropriately when needed without TypeScript error suppression comments?\n- [ ] Is business logic completeness guaranteed?\n\n**REMEMBER**: Your code must start immediately with `export async function` - never include any import statements at the beginning. All dependencies are assumed to be globally available.\n\nPlease adhere to all these principles and guidelines to write complete and accurate E2E test functions. Your mission is not simply to write code, but to build a robust test system that perfectly reproduces and validates actual business scenarios.'
|
|
8960
9009
|
}, {
|
|
8961
9010
|
id: v4(),
|
|
8962
9011
|
created_at: (new Date).toISOString(),
|
|
8963
9012
|
type: "assistantMessage",
|
|
8964
|
-
text: [ "
|
|
9013
|
+
text: [ "# Original Code", "```typescript", code, "```", "", "# Compile Errors", "Fix the compilation error in the provided code.", ...diagnostics ].join("\n")
|
|
9014
|
+
}, {
|
|
9015
|
+
id: v4(),
|
|
9016
|
+
created_at: (new Date).toISOString(),
|
|
9017
|
+
type: "systemMessage",
|
|
9018
|
+
text: "# Compiler Error Fix System Prompt\n\nYou are an expert TypeScript compiler error fixing agent specializing in resolving compilation errors in E2E test code that follows the `@nestia/e2e` testing framework conventions. If the error content is a complicated type problem, it is better to erase everything and re-squeeze it.\n\n## Your Role\n\n- Analyze the provided TypeScript code with compilation errors and generate the corrected version.\n- Focus specifically on the error location, message, and problematic code segment.\n- Maintain all existing functionality while resolving only the compilation issues.\n- Follow the established code patterns and conventions from the original E2E test code.\n- Use provided API Files and DTO Files to resolve module and type declaration issues.\n\n## Default Working Language: English\n\n- Use the language specified by user in messages as the working language when explicitly provided\n- All thinking and responses must be in the working language\n- All model/field names must be in English regardless of working language\n\n## Input Format\n\nYou will receive:\n\n1. **Original Code**: TypeScript E2E test code with compilation errors\n2. **Error Information**:\n\n * Exact character position of the error\n * Detailed error message from TypeScript compiler\n * The specific problematic code segment\n3. **Instructions**: Specific guidance on what needs to be fixed\n4. **API Files**: Reference files containing available API functions and their paths\n5. **DTO Files**: Reference files containing available types and their import paths\n\n### 3. API Function Usage Corrections\n\n- Fix API function call patterns to follow:\n\n ```ts\n api.functional.[...].methodName(...)\n ```\n\n- Correct connection parameter usage (avoid adding extra properties):\n\n ```ts\n // Correct\n await api.functional.bbs.articles.post(connection, { body: articleBody });\n ```\n\n- **Cross-reference API Files** to ensure function paths and method names are accurate\n\n### 4. Test Function Structure Fixes\n\n- Ensure test functions follow the pattern:\n\n ```ts\n export async function test_api_xxx(...): Promise<void> { ... }\n ```\n\n- Fix async/await usage errors\n\n- Correct function parameter types (especially `connection: api.IConnection`)\n\n### 5. Typia Assert Corrections\n\n- Ensure proper `typia.assert<T>(value)` usage\n- Fix generic type parameters\n- Correct assertion patterns for response validation\n\n### 6. Array Type Corrections\n\n```\nerror: Argument of type 'IBbsArticleComment[]' is not assignable to parameter of type 'never[]'.\n```\n\n- To Resolve above Array parameter Error, If you declare empty array like `[]`, You must define the type of array together.\n\nExample:\n\n```typescript\nTestValidator.equals(\"message\")(\n [] as IBbsArticleComment[],\n )(data);\n```\n\n### 7. Common TypeScript Error Fixes\n\n- **Type mismatches**: Align variable types with expected interfaces from DTO Files\n- **Missing properties**: Add required properties to objects\n- **Async/Promise errors**: Fix Promise handling and async function signatures\n- **Generic type errors**: Correct generic type parameters\n- **Null/undefined handling**: Add proper null checks or optional chaining\n- **Interface compliance**: Ensure objects conform to their declared interfaces\n\n## Error Resolution Strategy\n\n1. **Full Code Analysis**: FIRST perform comprehensive analysis of ENTIRE codebase for ALL potential TypeScript issues\n2. **Error Chain Identification**: Identify cascading error patterns and relationships between different parts of code\n3. **Holistic Fix Planning**: Plan fixes for ALL related errors that could cause loops, not just the reported error\n4. **Batch Error Resolution**: Fix ALL identified issues simultaneously in logical groups:\n\n * All type declaration issues together\n * All function signature issues together\n * All usage/call site issues together\n * All test-related issues together\n5. **Context Preservation**: Maintain the original test logic and flow\n6. **Comprehensive Validation**: Ensure no new compilation errors or cascading issues are introduced\n7. **Pattern Consistency**: Keep existing code style and conventions throughout all fixes"
|
|
9019
|
+
}, {
|
|
9020
|
+
id: v4(),
|
|
9021
|
+
created_at: (new Date).toISOString(),
|
|
9022
|
+
type: "systemMessage",
|
|
9023
|
+
text: [ "You are the world's best TypeScript compiler error fixer.", "You will be given a **TypeScript code** with compilation errors, and your job is to fix the errors.", "", "# Rules", "- Follow the base E2E test style strictly. Never use other frameworks like Jest or Mocha.", "- Use `TestValidator.equals(...)` and `typia.assert(...)` to verify results.", "- Use `api.functional.XXX` for all API calls. These are defined in API Files.", "- Use helper functions like `generate_random_xxx(...)` **only if** they already exist in the base test imports.", "- Do not invent new helpers or use utilities that are not explicitly shown.", "- Keep all tests deterministic and reliable.", "", "# File References", `The import statements are automatically inserted based on the AST, which provides all necessary types and SDKs required.`, `Therefore, if an import is not automatically included,`, `it means that the corresponding type or SDK is not available for use in the current test code.`, `You must solve the issue using only the provided SDK and types.`, "", "## API Files", "```typescript", JSON.stringify(artifacts.sdk), "```", "", "## DTO Files", "```typescript", JSON.stringify(artifacts.dto), "```", "", "Now Fix the E2E test function based on the given error information.", "Only output a single `async function` named `test_api_{...}`. No explanation, no commentary." ].join("\n")
|
|
8965
9024
|
} ];
|
|
8966
9025
|
|
|
8967
|
-
async function
|
|
8968
|
-
const
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
9026
|
+
async function orchestrateTestCorrect(ctx, codes, scenarios, life = 4) {
|
|
9027
|
+
const files = codes.map((({filename, content}, index) => {
|
|
9028
|
+
const scenario = scenarios[index];
|
|
9029
|
+
return {
|
|
9030
|
+
location: filename,
|
|
9031
|
+
content,
|
|
9032
|
+
scenario
|
|
9033
|
+
};
|
|
9034
|
+
}));
|
|
9035
|
+
const testFiles = Object.fromEntries(codes.map((c => [ c.filename, c.content ])));
|
|
9036
|
+
const retainedFiles = Object.fromEntries(Object.entries(ctx.state().interface?.files ?? {}).filter((([key]) => filterTestFileName(key))));
|
|
9037
|
+
const external = async location => {
|
|
9038
|
+
const content = await ctx.compiler.typescript.getExternal(location);
|
|
9039
|
+
if (content === undefined) throw new Error(`File not found: ${location}`);
|
|
9040
|
+
return {
|
|
9041
|
+
[location]: content
|
|
9042
|
+
};
|
|
9043
|
+
};
|
|
9044
|
+
const mergedFiles = {
|
|
9045
|
+
...retainedFiles,
|
|
9046
|
+
...testFiles,
|
|
9047
|
+
...await external("node_modules/@nestia/e2e/lib/TestValidator.d.ts"),
|
|
9048
|
+
...await external("node_modules/@nestia/fetcher/lib/IConnection.d.ts")
|
|
9049
|
+
};
|
|
9050
|
+
const response = await step(ctx, mergedFiles, files, life);
|
|
9051
|
+
const event = {
|
|
9052
|
+
...response,
|
|
9053
|
+
type: "testValidate",
|
|
9054
|
+
files: [ ...Object.entries(mergedFiles).map((([filename, content]) => ({
|
|
9055
|
+
location: filename,
|
|
9056
|
+
content
|
|
9057
|
+
}))), ...response.files ]
|
|
9058
|
+
};
|
|
9059
|
+
return event;
|
|
9060
|
+
}
|
|
9061
|
+
|
|
9062
|
+
async function step(ctx, entireFiles, testFiles, life) {
|
|
9063
|
+
const result = await ctx.compiler.typescript.compile({
|
|
9064
|
+
files: {
|
|
9065
|
+
...entireFiles,
|
|
9066
|
+
...testFiles.map((el => ({
|
|
9067
|
+
[el.location]: el.content
|
|
9068
|
+
}))).reduce(((acc, cur) => Object.assign(acc, cur)), {})
|
|
9069
|
+
}
|
|
9070
|
+
});
|
|
9071
|
+
if (result.type === "success") {
|
|
9072
|
+
return {
|
|
9073
|
+
type: "testValidate",
|
|
9074
|
+
created_at: (new Date).toISOString(),
|
|
9075
|
+
files: testFiles,
|
|
9076
|
+
result,
|
|
8979
9077
|
step: ctx.state().interface?.step ?? 0
|
|
8980
9078
|
};
|
|
8981
|
-
|
|
8982
|
-
|
|
9079
|
+
}
|
|
9080
|
+
if (result.type === "exception") {
|
|
9081
|
+
ctx.dispatch({
|
|
9082
|
+
type: "testValidate",
|
|
9083
|
+
created_at: (new Date).toISOString(),
|
|
9084
|
+
files: testFiles,
|
|
9085
|
+
result,
|
|
9086
|
+
step: ctx.state().interface?.step ?? 0
|
|
9087
|
+
});
|
|
9088
|
+
throw new Error(JSON.stringify(result.error, null, 2));
|
|
9089
|
+
}
|
|
9090
|
+
const diagnostics = {};
|
|
9091
|
+
result.diagnostics.forEach((d => {
|
|
9092
|
+
if (d.file === null) return;
|
|
9093
|
+
diagnostics[d.file] = diagnostics[d.file] ?? [];
|
|
9094
|
+
diagnostics[d.file].push(d);
|
|
9095
|
+
}));
|
|
9096
|
+
if (Object.keys(diagnostics).length === 0) {
|
|
9097
|
+
return {
|
|
9098
|
+
type: "testValidate",
|
|
9099
|
+
created_at: (new Date).toISOString(),
|
|
9100
|
+
files: testFiles,
|
|
9101
|
+
result: {
|
|
9102
|
+
...result,
|
|
9103
|
+
type: "success"
|
|
9104
|
+
},
|
|
9105
|
+
step: ctx.state().interface?.step ?? 0
|
|
9106
|
+
};
|
|
9107
|
+
}
|
|
9108
|
+
ctx.dispatch({
|
|
9109
|
+
type: "testValidate",
|
|
9110
|
+
created_at: (new Date).toISOString(),
|
|
9111
|
+
files: testFiles,
|
|
9112
|
+
result,
|
|
9113
|
+
step: ctx.state().interface?.step ?? 0
|
|
9114
|
+
});
|
|
9115
|
+
if (life <= 0) return {
|
|
9116
|
+
type: "testValidate",
|
|
9117
|
+
created_at: (new Date).toISOString(),
|
|
9118
|
+
files: testFiles,
|
|
9119
|
+
result,
|
|
9120
|
+
step: ctx.state().interface?.step ?? 0
|
|
9121
|
+
};
|
|
9122
|
+
const validatedFiles = await Promise.all(Object.entries(diagnostics).map((async ([filename, d]) => {
|
|
9123
|
+
const file = testFiles.find((f => f.location === filename));
|
|
9124
|
+
const code = file?.content;
|
|
9125
|
+
const scenario = file?.scenario;
|
|
9126
|
+
const response = await process$1(ctx, d, code, scenario);
|
|
9127
|
+
ctx.dispatch({
|
|
9128
|
+
type: "testCorrect",
|
|
9129
|
+
created_at: (new Date).toISOString(),
|
|
9130
|
+
files: {
|
|
9131
|
+
...testFiles,
|
|
9132
|
+
[filename]: response.content
|
|
9133
|
+
},
|
|
9134
|
+
result,
|
|
9135
|
+
solution: response.solution,
|
|
9136
|
+
think_without_compile_error: response.think_without_compile_error,
|
|
9137
|
+
think_again_with_compile_error: response.think_again_with_compile_error,
|
|
9138
|
+
step: ctx.state().interface?.step ?? 0
|
|
9139
|
+
});
|
|
9140
|
+
return {
|
|
9141
|
+
location: filename,
|
|
9142
|
+
content: response.content,
|
|
9143
|
+
scenario
|
|
9144
|
+
};
|
|
8983
9145
|
})));
|
|
8984
|
-
return
|
|
9146
|
+
return step(ctx, Object.entries(entireFiles).map((([filename, content]) => {
|
|
9147
|
+
const overwritten = validatedFiles.find((el => el.location === filename));
|
|
9148
|
+
return overwritten ? {
|
|
9149
|
+
[overwritten.location]: overwritten.content
|
|
9150
|
+
} : {
|
|
9151
|
+
[filename]: content
|
|
9152
|
+
};
|
|
9153
|
+
})).reduce(((acc, cur) => Object.assign(acc, cur)), {}), testFiles.map((f => {
|
|
9154
|
+
const validated = validatedFiles.find((v => v.location === f.location));
|
|
9155
|
+
return validated ? validated : f;
|
|
9156
|
+
})), life - 1);
|
|
8985
9157
|
}
|
|
8986
9158
|
|
|
8987
|
-
async function process$1(ctx, scenario) {
|
|
9159
|
+
async function process$1(ctx, diagnostics, code, scenario) {
|
|
8988
9160
|
const pointer = {
|
|
8989
9161
|
value: null
|
|
8990
9162
|
};
|
|
8991
|
-
const
|
|
8992
|
-
const
|
|
8993
|
-
|
|
9163
|
+
const artifacts = await compileTestScenario(ctx, scenario);
|
|
9164
|
+
const lines = code.split("\n").map(((line, num, arr) => {
|
|
9165
|
+
const start = arr.slice(0, num).map((el => el.length + 1)).reduce(((acc, cur) => acc + cur), 0);
|
|
9166
|
+
return {
|
|
9167
|
+
line: num + 1,
|
|
9168
|
+
text: line,
|
|
9169
|
+
start,
|
|
9170
|
+
end: start + line.length + 1
|
|
9171
|
+
};
|
|
9172
|
+
}));
|
|
8994
9173
|
const agentica = new MicroAgentica({
|
|
8995
9174
|
model: ctx.model,
|
|
8996
|
-
vendor:
|
|
9175
|
+
vendor: {
|
|
9176
|
+
...ctx.vendor
|
|
9177
|
+
},
|
|
8997
9178
|
config: {
|
|
8998
9179
|
...ctx.config ?? {}
|
|
8999
9180
|
},
|
|
9000
|
-
histories:
|
|
9001
|
-
scenario,
|
|
9002
|
-
dto: filter("src/api/structures"),
|
|
9003
|
-
sdk: filter("src/api/functional"),
|
|
9004
|
-
e2e: filter("test/features")
|
|
9005
|
-
}),
|
|
9181
|
+
histories: transformTestCorrectHistories(code, artifacts, diagnostics.map((diagnostic => diagnostic.start === undefined || diagnostic.length === undefined ? "" : formatDiagnostic(code, lines, diagnostic)))),
|
|
9006
9182
|
controllers: [ createApplication$2({
|
|
9007
9183
|
model: ctx.model,
|
|
9008
9184
|
build: next => {
|
|
@@ -9012,44 +9188,80 @@ async function process$1(ctx, scenario) {
|
|
|
9012
9188
|
tokenUsage: ctx.usage()
|
|
9013
9189
|
});
|
|
9014
9190
|
enforceToolCall(agentica);
|
|
9015
|
-
await
|
|
9016
|
-
|
|
9191
|
+
await randomBackoffRetry((async () => {
|
|
9192
|
+
await agentica.conversate([ "# Instructions", "1. Focus on the specific error location and message", "2. Provide the corrected TypeScript code", "3. Ensure the fix resolves the compilation error", "", "Return only the fixed code without explanations." ].join("\n"));
|
|
9193
|
+
}));
|
|
9194
|
+
if (pointer.value === null) throw new Error("Failed to modify test code.");
|
|
9195
|
+
const typeReferences = Array.from(new Set(Object.keys(artifacts.document.components.schemas).map((key => key.split(".")[0]))));
|
|
9196
|
+
pointer.value.content = pointer.value.content.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
9197
|
+
pointer.value.content = [ `import { TestValidator } from "@nestia/e2e";`, `import typia, { tags } from "typia";`, "", `import api from "@ORGANIZATION/PROJECT-api";`, ...typeReferences.map((ref => `import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`)), "", pointer.value.content ].join("\n");
|
|
9198
|
+
pointer.value.content = pointer.value.content.replaceAll('string & Format<"uuid">', 'string & tags.Format<"uuid">');
|
|
9017
9199
|
return pointer.value;
|
|
9018
9200
|
}
|
|
9019
9201
|
|
|
9020
|
-
function
|
|
9021
|
-
const
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9202
|
+
function formatDiagnostic(code, lines, diagnostic) {
|
|
9203
|
+
const {start, length, messageText} = diagnostic;
|
|
9204
|
+
const message = messageText;
|
|
9205
|
+
if (typeof start === "number" && typeof length === "number") {
|
|
9206
|
+
const end = start + length;
|
|
9207
|
+
const problematicCode = code.substring(start, end);
|
|
9208
|
+
const errorLine = lines.find((line => line.end > start)) ?? null;
|
|
9209
|
+
const lineText = errorLine?.text ?? "";
|
|
9210
|
+
const hints = getHints(message, lineText);
|
|
9211
|
+
function createAdjustedArray(n) {
|
|
9212
|
+
let start = n - 2;
|
|
9213
|
+
if (start < 0) {
|
|
9214
|
+
start = 0;
|
|
9215
|
+
}
|
|
9216
|
+
return Array.from({
|
|
9217
|
+
length: 5
|
|
9218
|
+
}, ((_, i) => start + i));
|
|
9026
9219
|
}
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
OpenApiTypeChecker.visit({
|
|
9033
|
-
components: document.components,
|
|
9034
|
-
schema: {
|
|
9035
|
-
$ref: `#/components/schemas/${typeName}`
|
|
9036
|
-
},
|
|
9037
|
-
closure: s => {
|
|
9038
|
-
if (OpenApiTypeChecker.isReference(s)) {
|
|
9039
|
-
const key = s.$ref.split("/").pop();
|
|
9040
|
-
components.schemas[key] = document.components.schemas[key];
|
|
9220
|
+
const errorLines = createAdjustedArray(errorLine?.line ?? 0);
|
|
9221
|
+
const context = errorLines.map((num => {
|
|
9222
|
+
if (num === errorLine?.line) {
|
|
9223
|
+
if (lines[num - 1]) {
|
|
9224
|
+
return `${lines[num - 1]?.text} // <- ERROR LINE (line:${num})`;
|
|
9041
9225
|
}
|
|
9042
9226
|
}
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9227
|
+
if (lines[num - 1]) {
|
|
9228
|
+
return lines[num - 1]?.text;
|
|
9229
|
+
}
|
|
9230
|
+
return null;
|
|
9231
|
+
})).filter((el => el !== null));
|
|
9232
|
+
return [ "## Error Information", `- Position: Characters ${start} to ${end}`, `- Error Message: ${message}`, `- Error Lines: \n${context.length ? [ "\t```ts", ...context.map((el => `\t${el}`)), "\t```" ].join("\n") : "(none)"}`, `- Problematic Code: ${problematicCode.length > 0 ? `\`${problematicCode}\`` : "(none)"}`, ...hints.map((hint => `- Hint: ${hint}`)) ].join("\n");
|
|
9048
9233
|
}
|
|
9049
|
-
return {
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9234
|
+
return [ "## Error Information", `- Error Message: ${message}` ].join("\n");
|
|
9235
|
+
}
|
|
9236
|
+
|
|
9237
|
+
function getHints(message, lineText) {
|
|
9238
|
+
const isTestValidator = lineText.includes("TestValidator");
|
|
9239
|
+
const isTypia = message === "Cannot find name 'Format'. Did you mean 'FormData'?";
|
|
9240
|
+
const isJest = message === "Cannot find name 'expect'.";
|
|
9241
|
+
const isCurrying = isTestValidator && message === "Expected 1 arguments, but got 2";
|
|
9242
|
+
const isAssignability = /Argument of type '([^']+)' is not assignable to parameter of type '([^']+)'/.test(message);
|
|
9243
|
+
const hints = [];
|
|
9244
|
+
if (isTypia) {
|
|
9245
|
+
hints.push("If you want to use typia tags, use `tags.Format` instead of `Format`.");
|
|
9246
|
+
}
|
|
9247
|
+
if (isJest) {
|
|
9248
|
+
hints.push('Detected invalid `expect` usage. Use `TestValidator.equals("description")(expected)(actual)`.');
|
|
9249
|
+
}
|
|
9250
|
+
if (isCurrying) {
|
|
9251
|
+
hints.push("`TestValidator.equals` is a curried function and must be called in **three steps**: `title → expected → actual`.");
|
|
9252
|
+
} else if (isTestValidator) {
|
|
9253
|
+
hints.push("The second argument `expected` must be assignable from the type of `actual`. Consider swapping the order if you get a type error.");
|
|
9254
|
+
}
|
|
9255
|
+
if (isAssignability && isTestValidator) {
|
|
9256
|
+
const match = lineText.trim().match(/TestValidator\.equals\("([^"]+)"\)\(([^)]+)\)\(([^)]+)\)/);
|
|
9257
|
+
if (match) {
|
|
9258
|
+
const [, title, expected, actual] = match;
|
|
9259
|
+
if (actual.includes(expected)) {
|
|
9260
|
+
hints.push(`You can try rearranging the order like this: TestValidator.equals("${title}")(${actual})(${expected})`);
|
|
9261
|
+
}
|
|
9262
|
+
}
|
|
9263
|
+
}
|
|
9264
|
+
return hints;
|
|
9053
9265
|
}
|
|
9054
9266
|
|
|
9055
9267
|
function createApplication$2(props) {
|
|
@@ -9057,10 +9269,10 @@ function createApplication$2(props) {
|
|
|
9057
9269
|
const application = collection$3[props.model];
|
|
9058
9270
|
return {
|
|
9059
9271
|
protocol: "class",
|
|
9060
|
-
name: "
|
|
9272
|
+
name: "Modify Test Code",
|
|
9061
9273
|
application,
|
|
9062
9274
|
execute: {
|
|
9063
|
-
|
|
9275
|
+
correctTestCode: next => {
|
|
9064
9276
|
props.build(next);
|
|
9065
9277
|
}
|
|
9066
9278
|
}
|
|
@@ -9074,41 +9286,48 @@ const claude$3 = {
|
|
|
9074
9286
|
separate: null
|
|
9075
9287
|
},
|
|
9076
9288
|
functions: [ {
|
|
9077
|
-
name: "
|
|
9289
|
+
name: "correctTestCode",
|
|
9078
9290
|
parameters: {
|
|
9079
|
-
description: "Current Type: {@link
|
|
9291
|
+
description: "Current Type: {@link ICorrectTestFunctionProps}",
|
|
9080
9292
|
type: "object",
|
|
9081
9293
|
properties: {
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guildelines.",
|
|
9294
|
+
think_without_compile_error: {
|
|
9295
|
+
description: "Step 1: Initial self-reflection on the source code without compiler error\ncontext.\n\nThe AI agent analyzes the previously generated test code to identify\npotential issues, relying solely on its understanding of TypeScript syntax,\ntesting patterns, and best practices.\n\nThis encourages the agent to develop independent debugging skills before\nbeing influenced by external error messages.",
|
|
9085
9296
|
type: "string"
|
|
9086
9297
|
},
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9298
|
+
think_again_with_compile_error: {
|
|
9299
|
+
description: "Step 2: Re-evaluation of the code with compiler error messages as\nadditional context.\n\nAfter the initial analysis, the AI agent reviews the same code again, this\ntime incorporating the specific TypeScript compiler error messages.\n\nThis allows the agent to correlate its initial observations with concrete\ncompilation failures and refine its understanding of what went wrong.",
|
|
9300
|
+
type: "string"
|
|
9301
|
+
},
|
|
9302
|
+
solution: {
|
|
9303
|
+
title: "Step 3: Concrete action plan for fixing the identified issues",
|
|
9304
|
+
description: "Step 3: Concrete action plan for fixing the identified issues.\n\nBased on the analysis from steps 1 and 2, the AI agent formulates a\nspecific, step-by-step solution strategy.\n\nThis should include what changes need to be made, why those changes are\nnecessary, and how they will resolve the compilation errors while\nmaintaining the test's intended functionality.",
|
|
9090
9305
|
type: "string"
|
|
9091
9306
|
},
|
|
9092
9307
|
content: {
|
|
9093
|
-
title: "
|
|
9094
|
-
description: "
|
|
9308
|
+
title: "Step 4: The corrected TypeScript test code",
|
|
9309
|
+
description: "Step 4: The corrected TypeScript test code.\n\nThe final, properly fixed TypeScript code that should compile without\nerrors.\n\nThis represents the implementation of the solution plan from step 3,\ncontaining all necessary corrections to make the test code syntactically\nvalid and functionally correct.",
|
|
9095
9310
|
type: "string"
|
|
9096
9311
|
}
|
|
9097
9312
|
},
|
|
9098
|
-
required: [ "
|
|
9313
|
+
required: [ "think_without_compile_error", "think_again_with_compile_error", "solution", "content" ],
|
|
9099
9314
|
additionalProperties: false,
|
|
9100
9315
|
$defs: {}
|
|
9101
9316
|
},
|
|
9102
9317
|
validate: (() => {
|
|
9103
|
-
const _io0 = input => "string" === typeof input.
|
|
9104
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.
|
|
9105
|
-
path: _path + ".
|
|
9318
|
+
const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.solution && "string" === typeof input.content;
|
|
9319
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
9320
|
+
path: _path + ".think_without_compile_error",
|
|
9106
9321
|
expected: "string",
|
|
9107
|
-
value: input.
|
|
9108
|
-
}), "string" === typeof input.
|
|
9109
|
-
path: _path + ".
|
|
9322
|
+
value: input.think_without_compile_error
|
|
9323
|
+
}), "string" === typeof input.think_again_with_compile_error || _report(_exceptionable, {
|
|
9324
|
+
path: _path + ".think_again_with_compile_error",
|
|
9110
9325
|
expected: "string",
|
|
9111
|
-
value: input.
|
|
9326
|
+
value: input.think_again_with_compile_error
|
|
9327
|
+
}), "string" === typeof input.solution || _report(_exceptionable, {
|
|
9328
|
+
path: _path + ".solution",
|
|
9329
|
+
expected: "string",
|
|
9330
|
+
value: input.solution
|
|
9112
9331
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9113
9332
|
path: _path + ".content",
|
|
9114
9333
|
expected: "string",
|
|
@@ -9123,11 +9342,11 @@ const claude$3 = {
|
|
|
9123
9342
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9124
9343
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9125
9344
|
path: _path + "",
|
|
9126
|
-
expected: "
|
|
9345
|
+
expected: "ICorrectTestFunctionProps",
|
|
9127
9346
|
value: input
|
|
9128
9347
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9129
9348
|
path: _path + "",
|
|
9130
|
-
expected: "
|
|
9349
|
+
expected: "ICorrectTestFunctionProps",
|
|
9131
9350
|
value: input
|
|
9132
9351
|
}))(input, "$input", true);
|
|
9133
9352
|
const success = 0 === errors.length;
|
|
@@ -9158,41 +9377,48 @@ const collection$3 = {
|
|
|
9158
9377
|
separate: null
|
|
9159
9378
|
},
|
|
9160
9379
|
functions: [ {
|
|
9161
|
-
name: "
|
|
9380
|
+
name: "correctTestCode",
|
|
9162
9381
|
parameters: {
|
|
9163
|
-
description: "Current Type: {@link
|
|
9382
|
+
description: "Current Type: {@link ICorrectTestFunctionProps}",
|
|
9164
9383
|
type: "object",
|
|
9165
9384
|
properties: {
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guildelines.",
|
|
9385
|
+
think_without_compile_error: {
|
|
9386
|
+
description: "Step 1: Initial self-reflection on the source code without compiler error\ncontext.\n\nThe AI agent analyzes the previously generated test code to identify\npotential issues, relying solely on its understanding of TypeScript syntax,\ntesting patterns, and best practices.\n\nThis encourages the agent to develop independent debugging skills before\nbeing influenced by external error messages.",
|
|
9169
9387
|
type: "string"
|
|
9170
9388
|
},
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9389
|
+
think_again_with_compile_error: {
|
|
9390
|
+
description: "Step 2: Re-evaluation of the code with compiler error messages as\nadditional context.\n\nAfter the initial analysis, the AI agent reviews the same code again, this\ntime incorporating the specific TypeScript compiler error messages.\n\nThis allows the agent to correlate its initial observations with concrete\ncompilation failures and refine its understanding of what went wrong.",
|
|
9391
|
+
type: "string"
|
|
9392
|
+
},
|
|
9393
|
+
solution: {
|
|
9394
|
+
title: "Step 3: Concrete action plan for fixing the identified issues",
|
|
9395
|
+
description: "Step 3: Concrete action plan for fixing the identified issues.\n\nBased on the analysis from steps 1 and 2, the AI agent formulates a\nspecific, step-by-step solution strategy.\n\nThis should include what changes need to be made, why those changes are\nnecessary, and how they will resolve the compilation errors while\nmaintaining the test's intended functionality.",
|
|
9174
9396
|
type: "string"
|
|
9175
9397
|
},
|
|
9176
9398
|
content: {
|
|
9177
|
-
title: "
|
|
9178
|
-
description: "
|
|
9399
|
+
title: "Step 4: The corrected TypeScript test code",
|
|
9400
|
+
description: "Step 4: The corrected TypeScript test code.\n\nThe final, properly fixed TypeScript code that should compile without\nerrors.\n\nThis represents the implementation of the solution plan from step 3,\ncontaining all necessary corrections to make the test code syntactically\nvalid and functionally correct.",
|
|
9179
9401
|
type: "string"
|
|
9180
9402
|
}
|
|
9181
9403
|
},
|
|
9182
|
-
required: [ "
|
|
9404
|
+
required: [ "think_without_compile_error", "think_again_with_compile_error", "solution", "content" ],
|
|
9183
9405
|
additionalProperties: false,
|
|
9184
9406
|
$defs: {}
|
|
9185
9407
|
},
|
|
9186
9408
|
validate: (() => {
|
|
9187
|
-
const _io0 = input => "string" === typeof input.
|
|
9188
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.
|
|
9189
|
-
path: _path + ".
|
|
9409
|
+
const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.solution && "string" === typeof input.content;
|
|
9410
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
9411
|
+
path: _path + ".think_without_compile_error",
|
|
9190
9412
|
expected: "string",
|
|
9191
|
-
value: input.
|
|
9192
|
-
}), "string" === typeof input.
|
|
9193
|
-
path: _path + ".
|
|
9413
|
+
value: input.think_without_compile_error
|
|
9414
|
+
}), "string" === typeof input.think_again_with_compile_error || _report(_exceptionable, {
|
|
9415
|
+
path: _path + ".think_again_with_compile_error",
|
|
9194
9416
|
expected: "string",
|
|
9195
|
-
value: input.
|
|
9417
|
+
value: input.think_again_with_compile_error
|
|
9418
|
+
}), "string" === typeof input.solution || _report(_exceptionable, {
|
|
9419
|
+
path: _path + ".solution",
|
|
9420
|
+
expected: "string",
|
|
9421
|
+
value: input.solution
|
|
9196
9422
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9197
9423
|
path: _path + ".content",
|
|
9198
9424
|
expected: "string",
|
|
@@ -9207,11 +9433,11 @@ const collection$3 = {
|
|
|
9207
9433
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9208
9434
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9209
9435
|
path: _path + "",
|
|
9210
|
-
expected: "
|
|
9436
|
+
expected: "ICorrectTestFunctionProps",
|
|
9211
9437
|
value: input
|
|
9212
9438
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9213
9439
|
path: _path + "",
|
|
9214
|
-
expected: "
|
|
9440
|
+
expected: "ICorrectTestFunctionProps",
|
|
9215
9441
|
value: input
|
|
9216
9442
|
}))(input, "$input", true);
|
|
9217
9443
|
const success = 0 === errors.length;
|
|
@@ -9244,40 +9470,47 @@ const collection$3 = {
|
|
|
9244
9470
|
separate: null
|
|
9245
9471
|
},
|
|
9246
9472
|
functions: [ {
|
|
9247
|
-
name: "
|
|
9473
|
+
name: "correctTestCode",
|
|
9248
9474
|
parameters: {
|
|
9249
9475
|
type: "object",
|
|
9250
9476
|
properties: {
|
|
9251
|
-
|
|
9477
|
+
think_without_compile_error: {
|
|
9252
9478
|
type: "string",
|
|
9253
|
-
|
|
9254
|
-
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guildelines."
|
|
9479
|
+
description: "Step 1: Initial self-reflection on the source code without compiler error\ncontext.\n\nThe AI agent analyzes the previously generated test code to identify\npotential issues, relying solely on its understanding of TypeScript syntax,\ntesting patterns, and best practices.\n\nThis encourages the agent to develop independent debugging skills before\nbeing influenced by external error messages."
|
|
9255
9480
|
},
|
|
9256
|
-
|
|
9481
|
+
think_again_with_compile_error: {
|
|
9257
9482
|
type: "string",
|
|
9258
|
-
|
|
9259
|
-
|
|
9483
|
+
description: "Step 2: Re-evaluation of the code with compiler error messages as\nadditional context.\n\nAfter the initial analysis, the AI agent reviews the same code again, this\ntime incorporating the specific TypeScript compiler error messages.\n\nThis allows the agent to correlate its initial observations with concrete\ncompilation failures and refine its understanding of what went wrong."
|
|
9484
|
+
},
|
|
9485
|
+
solution: {
|
|
9486
|
+
type: "string",
|
|
9487
|
+
title: "Step 3: Concrete action plan for fixing the identified issues",
|
|
9488
|
+
description: "Step 3: Concrete action plan for fixing the identified issues.\n\nBased on the analysis from steps 1 and 2, the AI agent formulates a\nspecific, step-by-step solution strategy.\n\nThis should include what changes need to be made, why those changes are\nnecessary, and how they will resolve the compilation errors while\nmaintaining the test's intended functionality."
|
|
9260
9489
|
},
|
|
9261
9490
|
content: {
|
|
9262
9491
|
type: "string",
|
|
9263
|
-
title: "
|
|
9264
|
-
description: "
|
|
9492
|
+
title: "Step 4: The corrected TypeScript test code",
|
|
9493
|
+
description: "Step 4: The corrected TypeScript test code.\n\nThe final, properly fixed TypeScript code that should compile without\nerrors.\n\nThis represents the implementation of the solution plan from step 3,\ncontaining all necessary corrections to make the test code syntactically\nvalid and functionally correct."
|
|
9265
9494
|
}
|
|
9266
9495
|
},
|
|
9267
|
-
required: [ "
|
|
9268
|
-
description: "Current Type: {@link
|
|
9496
|
+
required: [ "think_without_compile_error", "think_again_with_compile_error", "solution", "content" ],
|
|
9497
|
+
description: "Current Type: {@link ICorrectTestFunctionProps}",
|
|
9269
9498
|
additionalProperties: false
|
|
9270
9499
|
},
|
|
9271
9500
|
validate: (() => {
|
|
9272
|
-
const _io0 = input => "string" === typeof input.
|
|
9273
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.
|
|
9274
|
-
path: _path + ".
|
|
9501
|
+
const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.solution && "string" === typeof input.content;
|
|
9502
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
9503
|
+
path: _path + ".think_without_compile_error",
|
|
9275
9504
|
expected: "string",
|
|
9276
|
-
value: input.
|
|
9277
|
-
}), "string" === typeof input.
|
|
9278
|
-
path: _path + ".
|
|
9505
|
+
value: input.think_without_compile_error
|
|
9506
|
+
}), "string" === typeof input.think_again_with_compile_error || _report(_exceptionable, {
|
|
9507
|
+
path: _path + ".think_again_with_compile_error",
|
|
9279
9508
|
expected: "string",
|
|
9280
|
-
value: input.
|
|
9509
|
+
value: input.think_again_with_compile_error
|
|
9510
|
+
}), "string" === typeof input.solution || _report(_exceptionable, {
|
|
9511
|
+
path: _path + ".solution",
|
|
9512
|
+
expected: "string",
|
|
9513
|
+
value: input.solution
|
|
9281
9514
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9282
9515
|
path: _path + ".content",
|
|
9283
9516
|
expected: "string",
|
|
@@ -9292,11 +9525,11 @@ const collection$3 = {
|
|
|
9292
9525
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9293
9526
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9294
9527
|
path: _path + "",
|
|
9295
|
-
expected: "
|
|
9528
|
+
expected: "ICorrectTestFunctionProps",
|
|
9296
9529
|
value: input
|
|
9297
9530
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9298
9531
|
path: _path + "",
|
|
9299
|
-
expected: "
|
|
9532
|
+
expected: "ICorrectTestFunctionProps",
|
|
9300
9533
|
value: input
|
|
9301
9534
|
}))(input, "$input", true);
|
|
9302
9535
|
const success = 0 === errors.length;
|
|
@@ -9319,550 +9552,106 @@ const collection$3 = {
|
|
|
9319
9552
|
}
|
|
9320
9553
|
};
|
|
9321
9554
|
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
text: '# Compiler Error Fix System Prompt\n\nYou are an expert TypeScript compiler error fixing agent specializing in resolving compilation errors in E2E test code that follows the `@nestia/e2e` testing framework conventions.\n\n## Your Role\n\n- Analyze the provided TypeScript code with compilation errors and generate the corrected version. \n- Focus specifically on the error location, message, and problematic code segment. \n- Maintain all existing functionality while resolving only the compilation issues. \n- Follow the established code patterns and conventions from the original E2E test code. \n- Use provided API Files and DTO Files to resolve module and type declaration issues. \n- **CRITICAL**: Apply comprehensive fixes to prevent circular error loops by addressing all related import issues in a single pass.\n\n## Default Working Language: English\n\n- Use the language specified by user in messages as the working language when explicitly provided \n- All thinking and responses must be in the working language \n- All model/field names must be in English regardless of working language \n\n## Input Format\n\nYou will receive: \n\n1. **Original Code**: TypeScript E2E test code with compilation errors \n2. **Error Information**: \n - Exact character position of the error \n - Detailed error message from TypeScript compiler \n - The specific problematic code segment \n3. **Instructions**: Specific guidance on what needs to be fixed \n4. **API Files**: Reference files containing available API functions and their paths \n5. **DTO Files**: Reference files containing available types and their import paths \n\n## Code Fixing Guidelines\n\n### 1. Module Resolution Errors (CRITICAL PRIORITY)\n\n#### Universal Module Import Pattern Recognition and Fix:\n\n**ALWAYS scan the ENTIRE code for ALL import statements that match these patterns and fix them ALL at once:**\n\n```typescript\n// WRONG PATTERNS - Fix ALL of these in one pass:\nimport api from "@nestia/PROJECT-api";\nimport api from "@wrtnlabs/PROJECT-api"; \nimport api from "@anyorganization/PROJECT-api";\nimport { Type } from "@nestia/PROJECT-api/lib/structures/Type";\nimport { Type } from "@wrtnlabs/PROJECT-api/lib/structures/Type";\nimport { Type } from "@anyorganization/PROJECT-api/lib/structures/Type";\n\n// CORRECT PATTERN - Replace with:\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { Type } from "@ORGANIZATION/PROJECT-api/lib/structures/Type";\n```\n\n#### Importing namespace rule\n\n```ts\n// ❌ Incorrect usage: importing inner types directly from a namespaced type\nimport {\n IShoppingSaleInquiryComment,\n IShoppingSaleInquiryComment_ICreate,\n IShoppingSaleInquiryComment_IRequest,\n} from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSaleInquiryComment";\n\n```\n\n```ts\n// ✅ Correct usage: import only the namespace and access inner types via dot notation\nimport {\n IShoppingSaleInquiryComment,\n} from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSaleInquiryComment";\n\ntype A = IShoppingSaleInquiryComment.ICreate // correct!\ntype B = IShoppingSaleInquiryComment.IRequest // correct!\n```\n\n- 💡 Rule: When working with types defined inside a namespace, import only the namespace and access inner types using dot notation (e.g., Namespace.InnerType).\nAvoid importing inner types directly, as it breaks encapsulation and may cause naming conflicts or improper typings.\n\n\n#### Comprehensive Module Fix Strategy:\n\n1. **Pattern Detection**: Look for ANY import that contains: \n - `@[anything]/[project-name]-api` → Replace `@[anything]` with `@ORGANIZATION` \n - `@[project-name]-api` (missing org prefix) → Add `@ORGANIZATION/` prefix \n\n2. **Common Error Patterns to Fix ALL AT ONCE**: \n\n```typescript\n// Error Pattern 1: Wrong organization name\nCannot find module \'@wrtnlabs/PROJECT-api\'\nCannot find module \'@nestia/PROJECT-api\'\nCannot find module \'@anyorg/PROJECT-api\'\n// Fix: Replace with @ORGANIZATION/PROJECT-api\n\n// Error Pattern 2: Missing organization prefix \nCannot find module \'@PROJECT-api\'\nCannot find module \'PROJECT-api\'\n// Fix: Add @ORGANIZATION/ prefix\n\n// Error Pattern 3: Structure imports with wrong org\nCannot find module \'@wrtnlabs/PROJECT-api/lib/structures/IType\'\nCannot find module \'@nestia/PROJECT-api/lib/structures/IType\'\n// Fix: Replace with @ORGANIZATION/PROJECT-api/lib/structures/IType\n``` \n\n3. **Comprehensive Import Scan and Fix**: \n - **BEFORE fixing the reported error**, scan ALL import statements in the code \n - Identify ALL imports that follow incorrect patterns \n - Fix ALL of them simultaneously to prevent error loops \n - Ensure consistent `@ORGANIZATION/PROJECT-api` pattern throughout \n\n#### Module Resolution Fix Examples:\n\n```typescript\n// BEFORE (Multiple wrong patterns in same file):\nimport api from "@nestia/PROJECT-api";\nimport { IBbsArticle } from "@wrtnlabs/PROJECT-api/lib/structures/IBbsArticle";\nimport { IAttachmentFile } from "@PROJECT-api/lib/structures/IAttachmentFile";\n\n// AFTER (All fixed consistently):\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IBbsArticle } from "@ORGANIZATION/PROJECT-api/lib/structures/IBbsArticle";\nimport { IAttachmentFile } from "@ORGANIZATION/PROJECT-api/lib/structures/IAttachmentFile";\n``` \n\n### 2. Error Loop Prevention Strategy\n\n**CRITICAL**: To prevent 1 → 2 → 3 → 1 error loops: \n\n1. **Holistic Code Analysis**: Before fixing the specific error, analyze ALL import statements in the entire code \n2. **Batch Import Fixes**: Fix ALL import-related issues in a single pass, not just the reported error \n3. **Pattern Consistency**: Ensure ALL imports follow the same `@ORGANIZATION/PROJECT-api` pattern \n4. **Preemptive Fixes**: Look for and fix potential related errors that might surface after the current fix \n\n**Implementation Approach**: \n\n```typescript\n// Step 1: Scan entire code for ALL these patterns\nconst problemPatterns = [\n /@[^/]+\\/[^-]+-api(?!\\/)/g, // Wrong org prefix\n /@[^-]+-api(?!\\/)/g, // Missing org prefix \n /from\\s+["\']@[^/]+\\/[^-]+-api/g, // Wrong org in imports\n /from\\s+["\']@[^-]+-api/g // Missing org in imports\n];\n\n// Step 2: Replace ALL matches with @ORGANIZATION/PROJECT-api pattern\n// Step 3: Then fix the specific reported error\n``` \n\n### 3. API Function Usage Corrections\n\n- Ensure proper `import api from "@ORGANIZATION/PROJECT-api";` format (verify against API Files) \n- Fix API function call patterns to follow: \n\n ```ts\n api.functional.[...].methodName(...)\n ``` \n\n- Correct connection parameter usage (avoid adding extra properties): \n\n ```ts\n // Correct\n await api.functional.bbs.articles.post(connection, { body: articleBody });\n ``` \n\n- **Cross-reference API Files** to ensure function paths and method names are accurate \n\n### 4. DTO Type Import Corrections\n\n- Fix import statements to use proper format based on **DTO Files**: \n\n ```ts\n import { ITypeName } from "@ORGANIZATION/PROJECT-api/lib/structures/[...].ts";\n ``` \n\n- Ensure `@ORGANIZATION` prefix is maintained in import paths \n- **Verify type names and paths** against provided DTO Files \n- Correct missing or incorrect type imports \n- Fix type annotation errors \n\n### 5. Test Function Structure Fixes\n\n- Ensure test functions follow the pattern: \n\n ```ts\n export async function test_api_xxx(...): Promise<void> { ... }\n ``` \n\n- Fix async/await usage errors \n- Correct function parameter types (especially `connection: api.IConnection`) \n\n### 6. Test Validator Usage Corrections\n\n- Fix `TestValidator` method calls: \n\n ```ts\n TestValidator.equals("title", exceptionFunction)(expected)(actual);\n TestValidator.predicate("title")(condition);\n TestValidator.error("title")(task);\n ``` \n\n- Correct currying function usage \n- Fix assertion patterns \n\n### 7. Typia Assert Corrections\n\n- Ensure proper `typia.assert<T>(value)` usage \n- Fix generic type parameters \n- Correct assertion patterns for response validation \n\n### 8. Array Type Corrections\n\n```\nerror: Argument of type \'IBbsArticleComment[]\' is not assignable to parameter of type \'never[]\'.\n``` \n\n- To Resolve above Array parameter Error, If you declare empty array like `[]`, You must define the type of array together. \n\nExample: \n\n ```typescript\n TestValidator.equals("message")(\n [] as IBbsArticleComment[],\n )(data);\n ``` \n\n### 9. Common TypeScript Error Fixes\n\n- **Import/Export errors**: Fix module resolution issues using API Files and DTO Files as reference \n- **Type mismatches**: Align variable types with expected interfaces from DTO Files \n- **Missing properties**: Add required properties to objects \n- **Async/Promise errors**: Fix Promise handling and async function signatures \n- **Generic type errors**: Correct generic type parameters \n- **Null/undefined handling**: Add proper null checks or optional chaining \n- **Interface compliance**: Ensure objects conform to their declared interfaces \n\n## Error Resolution Strategy\n\n1. **Full Code Analysis**: FIRST perform comprehensive analysis of ENTIRE codebase for ALL potential TypeScript issues \n2. **Error Chain Identification**: Identify cascading error patterns and relationships between different parts of code \n3. **Holistic Fix Planning**: Plan fixes for ALL related errors that could cause loops, not just the reported error \n4. **Reference File Consultation**: \n - For module errors: Consult API Files for correct import paths \n - For type errors: Consult DTO Files for correct type import paths \n - For function calls: Verify method signatures and parameters \n5. **Batch Error Resolution**: Fix ALL identified issues simultaneously in logical groups: \n - All import/module issues together \n - All type declaration issues together \n - All function signature issues together \n - All usage/call site issues together \n6. **Context Preservation**: Maintain the original test logic and flow \n7. **Comprehensive Validation**: Ensure no new compilation errors or cascading issues are introduced \n8. **Pattern Consistency**: Keep existing code style and conventions throughout all fixes \n\n## Output Requirements\n\n- Return **only** the corrected TypeScript code \n- Maintain all original functionality and test logic \n- Preserve code formatting and style \n- Ensure the fix addresses ALL related compilation errors (not just the reported one) \n- **CRITICAL**: Fix ALL import pattern issues in a single pass to prevent error loops \n- Do not add explanations, comments, or additional features \n\n## Priority Error Handling\n\n1. **Comprehensive Analysis** (HIGHEST priority): \n - Scan ENTIRE codebase for ALL potential TypeScript compilation issues \n - Identify cascading error patterns and relationships \n - Map error chains that commonly cause loops (import → type → usage → validation) \n\n2. **Batch Error Resolution** (CRITICAL): \n - Group related errors into logical fix batches: \n - **Module/Import Batch**: All import paths, module resolution, missing dependencies \n - **Type Batch**: All type declarations, interfaces, generic constraints \n - **Function Batch**: All function signatures, parameters, return types \n - **Usage Batch**: All variable assignments, method calls, property access \n - **Test Batch**: All TestValidator calls, assertion patterns, validation logic \n - Fix entire batches simultaneously to prevent cascading failures \n\n3. **Specific Error Resolution**: \n - After comprehensive fixes, verify the originally reported error is resolved \n - Use DTO Files for type corrections and API Files for function signatures \n - Ensure consistency with established patterns \n\n4. **General TypeScript Compilation**: \n - Apply standard TypeScript error resolution techniques \n - Maintain type safety throughout all fixes \n\n## Error Loop Prevention Protocol\n\n**MANDATORY STEPS to prevent error loops:** \n\n1. **Pre-Analysis**: Before fixing reported error, scan entire code for ALL import statements \n2. **Pattern Matching**: Identify ALL imports matching problematic patterns: \n - `@[anything-except-ORGANIZATION]/[project]-api` \n - Missing `@ORGANIZATION/` prefix \n - Inconsistent organization naming \n3. **Comprehensive Fix**: Replace ALL problematic imports with correct `@ORGANIZATION/PROJECT-api` pattern \n4. **Validation**: Ensure ALL imports in the file follow consistent pattern \n5. **Specific Fix**: Then address the specific reported compilation error \n\n**Example of Comprehensive Fix Approach:** \n\n```typescript\n// Input code with multiple potential issues:\nimport api from "@nestia/PROJECT-api"; // Issue 1\nimport { IBbsArticle } from "@wrtnlabs/PROJECT-api/lib/structures/IBbsArticle"; // Issue 2 \nimport { IUser } from "@PROJECT-api/lib/structures/IUser"; // Issue 3\n\n// Output: ALL issues fixed simultaneously:\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IBbsArticle } from "@ORGANIZATION/PROJECT-api/lib/structures/IBbsArticle";\nimport { IUser } from "@ORGANIZATION/PROJECT-api/lib/structures/IUser";\n```'
|
|
9327
|
-
}, {
|
|
9328
|
-
id: v4(),
|
|
9329
|
-
created_at: (new Date).toISOString(),
|
|
9330
|
-
type: "assistantMessage",
|
|
9331
|
-
text: [ "You are the world's best TypeScript compiler error fixer.", "You will be given a **TypeScript code** with compilation errors, and your job is to fix the errors.", "", "## Rules", "- Follow the base E2E test style strictly. Never use other frameworks like Jest or Mocha.", "- Use `TestValidator.equals(...)` and `typia.assert(...)` to verify results.", "- Use `api.functional.XXX` for all API calls. These are defined in API Files.", "- Use helper functions like `generate_random_xxx(...)` **only if** they already exist in the base test imports.", "- Do not invent new helpers or use utilities that are not explicitly shown.", "- Keep all tests deterministic and reliable.", "", "## File References", "### OpenAPI Like Document", "```json", JSON.stringify(document), "```", "", "Now Fix the E2E test function based on the given error information.", "Only output a single `async function` named `test_api_{...}`. No explanation, no commentary." ].join("\n")
|
|
9332
|
-
} ];
|
|
9333
|
-
|
|
9334
|
-
async function orchestrateTestCorrect(ctx, codes, scenarios, life = 4) {
|
|
9335
|
-
const scenarioMap = new Map;
|
|
9336
|
-
codes.forEach((({filename}, index) => {
|
|
9337
|
-
scenarioMap.set(filename, scenarios[index]);
|
|
9338
|
-
}));
|
|
9339
|
-
const testFiles = codes.map((({filename, content}) => ({
|
|
9340
|
-
[`test/features/api/${filename}`]: content
|
|
9341
|
-
}))).reduce(((acc, cur) => Object.assign(acc, cur)), {});
|
|
9342
|
-
const retainedFiles = Object.entries(ctx.state().interface?.files ?? {}).filter((([filename]) => !filename.startsWith("test/features/api"))).map((([filename, content]) => ({
|
|
9343
|
-
[filename]: content
|
|
9344
|
-
}))).reduce(((acc, cur) => Object.assign(acc, cur)), {});
|
|
9345
|
-
const mergedFiles = {
|
|
9346
|
-
...retainedFiles,
|
|
9347
|
-
...testFiles
|
|
9348
|
-
};
|
|
9349
|
-
const files = Object.fromEntries(Object.entries(mergedFiles).filter((([filename]) => filename.endsWith(".ts") && !filename.startsWith("test/benchmark/") || filename.endsWith(".json"))));
|
|
9350
|
-
const response = await step(ctx, files, scenarioMap, life);
|
|
9351
|
-
const event = {
|
|
9352
|
-
...response,
|
|
9353
|
-
type: "testValidate",
|
|
9354
|
-
files: {
|
|
9355
|
-
...mergedFiles,
|
|
9356
|
-
...response.files
|
|
9357
|
-
}
|
|
9358
|
-
};
|
|
9359
|
-
return event;
|
|
9360
|
-
}
|
|
9361
|
-
|
|
9362
|
-
async function step(ctx, files, scenarioMap, life) {
|
|
9363
|
-
const result = await ctx.compiler.typescript.compile({
|
|
9364
|
-
files
|
|
9365
|
-
});
|
|
9366
|
-
if (result.type === "success") {
|
|
9367
|
-
return {
|
|
9368
|
-
type: "testValidate",
|
|
9369
|
-
created_at: (new Date).toISOString(),
|
|
9370
|
-
files,
|
|
9371
|
-
result,
|
|
9372
|
-
step: ctx.state().interface?.step ?? 0
|
|
9373
|
-
};
|
|
9374
|
-
}
|
|
9375
|
-
if (result.type === "exception") {
|
|
9376
|
-
ctx.dispatch({
|
|
9377
|
-
type: "testValidate",
|
|
9378
|
-
created_at: (new Date).toISOString(),
|
|
9379
|
-
files,
|
|
9380
|
-
result,
|
|
9381
|
-
step: ctx.state().interface?.step ?? 0
|
|
9382
|
-
});
|
|
9383
|
-
throw new Error(JSON.stringify(result.error, null, 2));
|
|
9384
|
-
}
|
|
9385
|
-
const diagnostics = {};
|
|
9386
|
-
result.diagnostics.forEach((d => {
|
|
9387
|
-
if (d.file === null) return;
|
|
9388
|
-
diagnostics[d.file] = diagnostics[d.file] ?? [];
|
|
9389
|
-
diagnostics[d.file].push(d);
|
|
9390
|
-
}));
|
|
9391
|
-
if (Object.keys(diagnostics).length === 0) {
|
|
9392
|
-
return {
|
|
9393
|
-
type: "testValidate",
|
|
9394
|
-
created_at: (new Date).toISOString(),
|
|
9395
|
-
files,
|
|
9396
|
-
result: {
|
|
9397
|
-
...result,
|
|
9398
|
-
type: "success"
|
|
9399
|
-
},
|
|
9400
|
-
step: ctx.state().interface?.step ?? 0
|
|
9401
|
-
};
|
|
9555
|
+
async function orchestrateTestScenario(ctx) {
|
|
9556
|
+
const operations = ctx.state().interface?.document.operations ?? [];
|
|
9557
|
+
if (operations.length === 0) {
|
|
9558
|
+
throw new Error("Cannot write test scenarios because these are no operations.");
|
|
9402
9559
|
}
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
});
|
|
9410
|
-
if (life <= 0) return {
|
|
9411
|
-
type: "testValidate",
|
|
9412
|
-
created_at: (new Date).toISOString(),
|
|
9413
|
-
files,
|
|
9414
|
-
result,
|
|
9415
|
-
step: ctx.state().interface?.step ?? 0
|
|
9416
|
-
};
|
|
9417
|
-
const validate = await Promise.all(Object.entries(diagnostics).map((async ([filename, d]) => {
|
|
9418
|
-
const scenario = scenarioMap.get(filename);
|
|
9419
|
-
const code = files[filename];
|
|
9420
|
-
const response = await process(ctx, d, code, scenario);
|
|
9421
|
-
ctx.dispatch({
|
|
9422
|
-
type: "testCorrect",
|
|
9423
|
-
created_at: (new Date).toISOString(),
|
|
9424
|
-
files: {
|
|
9425
|
-
...files,
|
|
9426
|
-
[filename]: response.content
|
|
9427
|
-
},
|
|
9428
|
-
result,
|
|
9429
|
-
solution: response.solution,
|
|
9430
|
-
think_without_compile_error: response.think_without_compile_error,
|
|
9431
|
-
think_again_with_compile_error: response.think_again_with_compile_error,
|
|
9432
|
-
step: ctx.state().interface?.step ?? 0
|
|
9560
|
+
const exclude = [];
|
|
9561
|
+
let include = Array.from(operations);
|
|
9562
|
+
do {
|
|
9563
|
+
const matrix = divideArray({
|
|
9564
|
+
array: include,
|
|
9565
|
+
capacity: 5
|
|
9433
9566
|
});
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9567
|
+
await Promise.all(matrix.map((async _include => {
|
|
9568
|
+
exclude.push(...await execute(ctx, operations, _include, exclude.map((x => x.endpoint))));
|
|
9569
|
+
})));
|
|
9570
|
+
include = include.filter((op => {
|
|
9571
|
+
if (exclude.some((pg => pg.endpoint.method === op.method && pg.endpoint.path === op.path))) {
|
|
9572
|
+
return false;
|
|
9573
|
+
}
|
|
9574
|
+
return true;
|
|
9575
|
+
}));
|
|
9576
|
+
} while (include.length > 0);
|
|
9577
|
+
return {
|
|
9578
|
+
type: "testScenario",
|
|
9579
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
9580
|
+
scenarios: exclude.flatMap((pg => pg.scenarios.map((plan => ({
|
|
9581
|
+
endpoint: pg.endpoint,
|
|
9582
|
+
draft: plan.draft,
|
|
9583
|
+
functionName: plan.functionName,
|
|
9584
|
+
dependencies: plan.dependencies
|
|
9585
|
+
}))))),
|
|
9586
|
+
created_at: (new Date).toISOString()
|
|
9439
9587
|
};
|
|
9440
|
-
return step(ctx, newFiles, scenarioMap, life - 1);
|
|
9441
9588
|
}
|
|
9442
9589
|
|
|
9443
|
-
async
|
|
9590
|
+
const execute = async (ctx, ops, include, exclude) => {
|
|
9444
9591
|
const pointer = {
|
|
9445
|
-
value:
|
|
9592
|
+
value: []
|
|
9446
9593
|
};
|
|
9447
|
-
let document = null;
|
|
9448
|
-
if (scenario) {
|
|
9449
|
-
document = filterDocument(scenario, ctx.state().interface.document);
|
|
9450
|
-
}
|
|
9451
9594
|
const agentica = new MicroAgentica({
|
|
9452
9595
|
model: ctx.model,
|
|
9453
|
-
vendor:
|
|
9454
|
-
...ctx.vendor
|
|
9455
|
-
},
|
|
9596
|
+
vendor: ctx.vendor,
|
|
9456
9597
|
config: {
|
|
9457
|
-
...ctx.config ?? {}
|
|
9598
|
+
...ctx.config ?? {},
|
|
9599
|
+
executor: {
|
|
9600
|
+
describe: null
|
|
9601
|
+
}
|
|
9458
9602
|
},
|
|
9459
|
-
|
|
9603
|
+
tokenUsage: ctx.usage(),
|
|
9604
|
+
histories: createHistoryProperties(ops, include, exclude),
|
|
9460
9605
|
controllers: [ createApplication$1({
|
|
9461
9606
|
model: ctx.model,
|
|
9462
9607
|
build: next => {
|
|
9463
|
-
pointer.value =
|
|
9608
|
+
pointer.value ?? (pointer.value = []);
|
|
9609
|
+
pointer.value.push(...next.scenarioGroups);
|
|
9464
9610
|
}
|
|
9465
|
-
}) ]
|
|
9466
|
-
tokenUsage: ctx.usage()
|
|
9611
|
+
}) ]
|
|
9467
9612
|
});
|
|
9468
9613
|
enforceToolCall(agentica);
|
|
9469
|
-
await
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
const [group] = [ ...checkDtoRegexp.matchAll(/Cannot find module '(.*lib\/structures\/.*)'/g) ];
|
|
9474
|
-
const [_, filename] = group ?? [];
|
|
9475
|
-
return [ "## Error Information", `- Position: Characters ${diagnostic.start} to ${diagnostic.start + diagnostic.length}`, `- Error Message: ${diagnostic.messageText}`, `- Problematic Code: \`${code.substring(diagnostic.start, diagnostic.start + diagnostic.length)}\``, filename ? `The type files located under **/lib/structures are declared in '@ORGANIZATION/PROJECT-api/lib/structures'.\n` + `Note: '@ORGANIZATION/PROJECT-api' must be written exactly as is and should not be replaced.\n` : "" ].join("\n");
|
|
9476
|
-
})), "## Instructions", "1. Focus on the specific error location and message", "2. Provide the corrected TypeScript code", "3. Ensure the fix resolves the compilation error", "", "Return only the fixed code without explanations." ].join("\n"));
|
|
9477
|
-
}));
|
|
9478
|
-
if (pointer.value === null) throw new Error("Failed to modify test code.");
|
|
9614
|
+
await agentica.conversate(`create test scenarios.`);
|
|
9615
|
+
if (pointer.value.length === 0) {
|
|
9616
|
+
throw new Error("Failed to create test plans.");
|
|
9617
|
+
}
|
|
9479
9618
|
return pointer.value;
|
|
9480
|
-
}
|
|
9619
|
+
};
|
|
9620
|
+
|
|
9621
|
+
const createHistoryProperties = (operations, include, exclude) => [ {
|
|
9622
|
+
id: v4(),
|
|
9623
|
+
created_at: (new Date).toISOString(),
|
|
9624
|
+
type: "systemMessage",
|
|
9625
|
+
text: '# API Test Scenario Generator AI Agent System Prompt\n\n## 1. Overview\n\nYou are a specialized AI Agent for generating comprehensive API test scenarios based on provided API operation definitions. Your core mission is to analyze API endpoints and create realistic, business-logic-focused test scenario drafts that will later be used by developers to implement actual E2E test functions.\n\n\nYou will receive an array of API operation objects along with their specifications, descriptions, and parameters. Based on these materials, you must generate structured test scenario groups that encompass both success and failure cases, considering real-world business constraints and user workflows.\n\nYour role is **scenario planning**. You must think like a QA engineer who understands business logic and user journeys, creating comprehensive test plans that cover edge cases, validation rules, and complex multi-step processes.\n\nThe final deliverable must be a structured output containing scenario groups with detailed test drafts, dependency mappings, and clear function naming that reflects user-centric perspectives.\n\n## 2. Input Material Composition\n\n### 2.1. API Operations Array\n\n* Complete API operation definitions with summary, method and path\n* Business logic descriptions and constraints embedded in summary\n\n**Deep Analysis Requirements:**\n\n* **Business Domain Understanding**: Identify the business domain (e-commerce, content management, user authentication, etc.) and understand typical user workflows\n* **Entity Relationship Discovery**: Map relationships between different entities (users, products, orders, reviews, etc.) and understand their dependencies\n* **Workflow Pattern Recognition**: Identify common patterns like CRUD operations, authentication flows, approval processes, and multi-step transactions\n* **Constraint and Validation Rule Extraction**: Extract business rules, validation constraints, uniqueness requirements, and permission-based access controls\n* **User Journey Mapping**: Understand complete user journeys that span multiple API calls and identify realistic test scenarios\n\n### 2.2. Include/Exclude Lists\n\n* **Include List**: API endpoints that must be covered in the test scenarios being generated. These are the primary targets of the current test generation.\n* **Exclude List**: Endpoints that do not require new test scenarios in this iteration. However, these endpoints may still be referenced as **dependencies** in the scenario drafts if the current tests logically depend on their outcomes or data.\n\n**Deep Analysis Requirements:**\n\n* **Dependency Identification**: Understand which excluded endpoints can serve as prerequisites for included endpoints\n* **Coverage Gap Analysis**: Ensure all included endpoints have comprehensive test coverage without redundancy\n* **Cross-Reference Mapping**: Map relationships between included endpoints and available excluded endpoints for dependency planning\n\n## 3. Core Scenario Generation Principles\n\n### 3.1. Business Logic Focus Principle\n\n* **Real-World Scenarios**: Generate scenarios that reflect actual user workflows and business processes\n* **End-to-End Thinking**: Consider complete user journeys that may span multiple API calls\n* **Business Rule Validation**: Include scenarios that test business constraints, validation rules, and edge cases\n* **User Perspective**: Write scenarios from the user\'s perspective, focusing on what users are trying to accomplish\n\n### 3.2. Comprehensive Coverage Principle\n\n* **Success Path Coverage**: Ensure all primary business functions are covered with successful execution scenarios\n* **Failure Path Coverage**: Include validation failures, permission errors, resource not found cases, and business rule violations\n* **Edge Case Identification**: Consider boundary conditions, race conditions, and unusual but valid user behaviors\n* **State Transition Testing**: Test different states of entities and valid/invalid state transitions\n\n### 3.3. Dependency Management Principle\n\n* **Prerequisite Identification**: Clearly identify all API calls that must precede the target operation (only when explicitly required)\n* **Data Setup Requirements**: Understand what data must exist before testing specific scenarios\n* **Authentication Context**: Include necessary authentication and authorization setup steps\n* **Logical Ordering**: Ensure dependencies are listed in the correct execution order if step-by-step execution is required\n\n> ⚠️ **Note**: The `dependencies` field in a scenario is not a sequential execution plan. It is an indicative reference to other endpoints that this scenario relies on for logical or data setup context. If execution order is relevant, describe it explicitly in the `purpose` field of each dependency.\n\n### 3.4. Realistic Scenario Principle\n\n* **Authentic User Stories**: Create scenarios that represent real user needs and workflows\n* **Business Context Integration**: Embed scenarios within realistic business contexts (e.g., e-commerce purchase flows, content publication workflows)\n* **Multi-Step Process Modeling**: Model complex business processes that require multiple coordinated API calls\n* **Error Recovery Scenarios**: Include scenarios for how users recover from errors or complete alternative workflows\n\n### 3.5. Clear Communication Principle\n\n* **Descriptive Draft Writing**: Write clear, detailed scenario descriptions that developers can easily understand and implement\n* **Function Naming Clarity**: Create function names that immediately convey the user scenario being tested\n* **Dependency Purpose Explanation**: Clearly explain why each dependency is necessary for the test scenario\n* **Business Justification**: Explain the business value and importance of each test scenario\n\n## 4. Detailed Scenario Generation Guidelines\n\n### 4.1. API Analysis Methodology\n\n* **Domain Context Discovery**: Identify the business domain and understand typical user workflows within that domain\n* **Entity Relationship Mapping**: Map relationships between different entities and understand their lifecycle dependencies\n* **Permission Model Understanding**: Understand user roles, permissions, and access control patterns\n* **Business Process Identification**: Identify multi-step business processes that span multiple API endpoints\n* **Validation Rule Extraction**: Extract all validation rules, constraints, and business logic from API specifications\n\n### 4.2. Scenario Draft Structure\n\nEach scenario draft should include:\n\n* **Context Setting**: Brief explanation of the business context and user motivation\n* **Step-by-Step Process**: Detailed description of the testing process, including all necessary steps\n* **Expected Outcomes**: Clear description of what should happen in both success and failure cases\n* **Business Rule Validation**: Specific business rules or constraints being tested\n* **Data Requirements**: What data needs to be prepared or validated during testing\n\n### 4.3. Function Naming Guidelines\n\nFollow the user-centric naming convention:\n\n* **Prefix**: Must start with `test_`\n* **User Action**: Primary action the user is performing (create, get, update, delete, search, etc.)\n* **Target Resource**: What the user is interacting with (user, product, order, review, etc.)\n* **Scenario Context**: Specific situation or condition (valid\\_data, invalid\\_email, not\\_found, permission\\_denied, etc.)\n\n**Examples:**\n\n* `test_create_product_with_valid_data`\n* `test_update_product_price_without_permission`\n* `test_search_products_with_empty_results`\n* `test_delete_product_that_does_not_exist`\n\n### 4.4. Dependency Identification Process\n\n* **Prerequisite Data Creation**: Identify what entities must be created before testing the target endpoint\n* **Authentication Setup**: Determine necessary authentication and authorization steps\n* **State Preparation**: Understand what system state must be established before testing\n* **Resource Relationship**: Map relationships between resources and identify dependent resource creation\n\n### 4.5. Multi-Scenario Planning\n\nFor complex endpoints, generate multiple scenarios covering:\n\n* **Happy Path**: Successful execution with valid data\n* **Validation Errors**: Various types of input validation failures\n* **Permission Errors**: Unauthorized access attempts\n* **Resource State Errors**: Operations on resources in invalid states\n* **Business Rule Violations**: Attempts to violate domain-specific business rules\n\n## 5. Dependency Purpose Guidelines\n\n* **The `dependencies` array refers to relevant API calls this scenario logically depends on, whether or not they are in the include list.**\n* **The presence of a dependency does not imply that it must be executed immediately beforehand.**\n* **Execution order, if required, should be explained in the `purpose`.**\n\nExample:\n\n```yaml\n dependencies:\n - endpoint: { method: "post", path: "/posts" }\n functionName: "test_create_post_with_valid_data"\n purpose: "Create a post and extract postId for use in voting scenario"\n```\n\n## 6. Error Scenario Guidelines\n\n### 6.1. Purpose and Importance of Error Scenarios\n\nTest scenarios must cover not only successful business flows but also various error conditions to ensure robust system behavior. Error scenarios help verify that appropriate responses are returned for invalid inputs, unauthorized access, resource conflicts, and business rule violations.\n\n### 6.2. Error Scenario Categories\n\n* **Validation Errors**: Invalid input data, missing required fields, format violations\n* **Authentication/Authorization Errors**: Unauthorized access, insufficient permissions, expired sessions\n* **Resource State Errors**: Operations on non-existent resources, invalid state transitions\n* **Business Rule Violations**: Attempts to violate domain-specific constraints and rules\n* **System Constraint Violations**: Duplicate resource creation, referential integrity violations\n\n### 6.3. Error Scenario Writing Guidelines\n\n* **Specific Error Conditions**: Clearly define the error condition being tested\n* **Expected Error Response**: Specify what type of error response should be returned\n* **Realistic Error Situations**: Model error conditions that actually occur in real usage\n* **Recovery Scenarios**: Consider how users might recover from or handle error conditions\n\n\n### 6.4. Error Scenario Example\n\n```typescript\n{\n draft: "Test product creation failure caused by attempting to create a product with a duplicate SKU. First, create a seller account authorized to create products. Then, create an initial product with a specific SKU to set up the conflict condition. Finally, attempt to create another product with the same SKU and verify that the system returns a conflict error indicating SKU uniqueness violation. Note that these steps must be executed in order to properly simulate the scenario.",\n functionName: "test_create_product_with_duplicate_sku",\n dependencies: [\n {\n endpoint: { method: "post", path: "/shopping/sellers/auth/join" },\n purpose: "Create a seller account with permission to create products. This must be done first to ensure proper authorization."\n },\n {\n endpoint: { method: "post", path: "/shopping/sellers/sales" },\n purpose: "Create the first product with a specific SKU to establish the conflict condition. This must be done after seller creation."\n }\n ]\n}\n````\n\n---\n\n**Additional Notes:**\n\n* It is critical to explicitly declare *all* prerequisite API calls necessary to prepare the test context within the `dependencies` array.\n* Dependencies represent logical requirements for the scenario and may or may not require strict execution order.\n* When there *is* a required sequence, such as creating a user before creating a product tied to that user, you **must** clearly indicate this order either in the scenario’s `draft` description or in the `purpose` explanation of each dependency.\n* This explicit approach prevents using placeholder or fake data (like dummy UUIDs) and instead ensures that all data setup is conducted via real API calls, increasing test reliability and maintainability.\n* Providing clear and detailed `draft` text describing the full user workflow and error expectations helps downstream agents or developers generate complete and realistic test implementations.\n\nBy following these guidelines, generated test scenarios will be comprehensive, accurate, and fully grounded in the actual API ecosystem and business logic.\n\n\n\n\n## 7. Final Checklist\n\n### 7.1. Essential Element Verification\n\n* [ ] Are all included endpoints covered with appropriate scenarios?\n* [ ] Do scenarios reflect realistic business workflows and user journeys?\n* [ ] Are function names descriptive and follow the user-centric naming convention?\n* [ ] Are all necessary dependencies identified and properly ordered?\n* [ ] Do dependency purposes clearly explain why each prerequisite is needed?\n* [ ] Are both success and failure scenarios included for complex operations?\n* [ ] Do scenarios test relevant business rules and validation constraints?\n\n### 7.2. Quality Element Verification\n\n* [ ] Are scenario descriptions detailed enough for developers to implement?\n* [ ] Do scenarios represent authentic user needs and workflows?\n* [ ] Is the business context clearly explained for each scenario?\n* [ ] Are error scenarios realistic and cover important failure conditions?\n* [ ] Do multi-step scenarios include all necessary intermediate steps?\n* [ ] Are scenarios grouped logically by endpoint and functionality?\n\n### 7.3. Structural Verification\n\n* [ ] Does the output follow the correct IAutoBeTestScenarioApplication.IProps structure?\n* [ ] Are all endpoint objects properly formatted with method and path?\n* [ ] Do all scenarios include required fields (draft, functionName, dependencies)?\n* [ ] Are dependency objects complete with endpoint and purpose information?\n* [ ] Is each endpoint method/path combination unique in the scenario groups?\n\n## 7. Quality Standards\n\n### 7.1. Completeness\n- **Comprehensive Coverage**: All included endpoints have appropriate test scenarios\n- **Multi-Perspective Testing**: Include scenarios from different user roles and perspectives\n- **Edge Case Inclusion**: Cover boundary conditions, error cases, and unusual but valid scenarios\n- **Business Rule Coverage**: Test all relevant business rules and constraints\n\n### 7.2. Clarity and Usability\n- **Clear Scenario Descriptions**: Write scenarios that developers can easily understand and implement\n- **Logical Dependency Ordering**: List dependencies in the correct execution order\n- **Meaningful Function Names**: Create function names that clearly convey the test purpose\n- **Business Context**: Provide sufficient business context for understanding scenario importance\n\n### 7.3. Realistic Applicability\n- **Real-World Relevance**: Generate scenarios that reflect actual user workflows and business needs\n- **Implementation Feasibility**: Ensure scenarios can be realistically implemented using available APIs\n- **Business Value**: Focus on scenarios that test important business functionality\n- **User-Centric Design**: Write scenarios from the user\'s perspective and goals\n\n## 8. Error Scenario Generation (Appendix)\n\n### 8.1. Purpose and Importance of Error Scenarios\nTest scenarios must cover not only successful business flows but also various error conditions to ensure robust system behavior. Error scenarios help verify that appropriate responses are returned for invalid inputs, unauthorized access, resource conflicts, and business rule violations.\n\n### 8.2. Error Scenario Categories\n- **Validation Errors**: Invalid input data, missing required fields, format violations\n- **Authentication/Authorization Errors**: Unauthorized access, insufficient permissions, expired sessions\n- **Resource State Errors**: Operations on non-existent resources, invalid state transitions\n- **Business Rule Violations**: Attempts to violate domain-specific constraints and rules\n- **System Constraint Violations**: Duplicate resource creation, referential integrity violations\n\n### 8.3. Error Scenario Writing Guidelines\n- **Specific Error Conditions**: Clearly define the error condition being tested\n- **Expected Error Response**: Specify what type of error response should be returned\n- **Realistic Error Situations**: Model error conditions that actually occur in real usage\n- **Recovery Scenarios**: Consider how users might recover from or handle error conditions\n\n### 8.4. Error Scenario Example\n```typescript\n{\n draft: "Test product creation failure when attempting to create a product with a duplicate SKU. Create an initial product with a specific SKU, then attempt to create another product with the same SKU. Verify that the system returns a conflict error indicating SKU uniqueness violation.",\n functionName: "test_create_product_with_duplicate_sku",\n dependencies: [\n {\n endpoint: { method: "post", path: "/shopping/sellers/auth/join" },\n purpose: "Create a seller account with permission to create products"\n },\n {\n endpoint: { method: "post", path: "/shopping/sellers/sales" },\n purpose: "Create the first product with a specific SKU to establish the conflict condition"\n }\n ]\n}\n```\n\n## 9. Final Checklist\n\nTest scenario generation completion requires verification of the following items:\n\n### 9.1. Essential Element Verification\n- [ ] Are all included endpoints covered with appropriate scenarios?\n- [ ] Do scenarios reflect realistic business workflows and user journeys?\n- [ ] Are function names descriptive and follow the user-centric naming convention?\n- [ ] Are all necessary dependencies identified and properly ordered?\n- [ ] Do dependency purposes clearly explain why each prerequisite is needed?\n- [ ] Are both success and failure scenarios included for complex operations?\n- [ ] Do scenarios test relevant business rules and validation constraints?\n\n### 9.2. Quality Element Verification\n- [ ] Are scenario descriptions detailed enough for developers to implement?\n- [ ] Do scenarios represent authentic user needs and workflows?\n- [ ] Is the business context clearly explained for each scenario?\n- [ ] Are error scenarios realistic and cover important failure conditions?\n- [ ] Do multi-step scenarios include all necessary intermediate steps?\n- [ ] Are scenarios grouped logically by endpoint and functionality?\n\n### 9.3. Structural Verification\n- [ ] Does the output follow the correct IAutoBeTestScenarioApplication.IProps structure?\n- [ ] Are all endpoint objects properly formatted with method and path?\n- [ ] Do all scenarios include required fields (draft, functionName, dependencies)?\n- [ ] Are dependency objects complete with endpoint and purpose information?\n- [ ] Is each endpoint method/path combination unique in the scenario groups?\n\nPlease adhere to all these principles and guidelines to generate comprehensive and accurate API test scenarios. Your mission is to create scenario blueprints that enable developers to build robust, business-focused E2E test suites that thoroughly validate API functionality and business logic.'
|
|
9626
|
+
}, {
|
|
9627
|
+
id: v4(),
|
|
9628
|
+
created_at: (new Date).toISOString(),
|
|
9629
|
+
type: "systemMessage",
|
|
9630
|
+
text: [ "# Operations", "Below are the full operations. Please refer to this.", "Your role is to draft all test cases for each given Operation.", "It is also permissible to write multiple test codes on a single endpoint.", "However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.", "", "Please carefully analyze each operation to identify all dependencies required for testing.", "For example, if you want to test liking and then deleting a post,", "you might think to test post creation, liking, and unlike operations.", "However, even if not explicitly mentioned, user registration and login are essential prerequisites.", "Pay close attention to IDs and related values in the API,", "and ensure you identify all dependencies between endpoints.", "", "```json", JSON.stringify(operations.map((el => ({
|
|
9631
|
+
path: el.path,
|
|
9632
|
+
method: el.method,
|
|
9633
|
+
summary: el.summary,
|
|
9634
|
+
description: el.description,
|
|
9635
|
+
parameters: el.parameters,
|
|
9636
|
+
requestBody: el.requestBody,
|
|
9637
|
+
responseBody: el.responseBody
|
|
9638
|
+
})))), "```" ].join("\n")
|
|
9639
|
+
}, {
|
|
9640
|
+
id: v4(),
|
|
9641
|
+
created_at: (new Date).toISOString(),
|
|
9642
|
+
type: "systemMessage",
|
|
9643
|
+
text: [ "# Included in Test Plan", include.map((el => `- ${el.method.toUpperCase()}: ${el.path}`)).join("\n"), "", "# Excluded from Test Plan", "These are the endpoints that have already been used in test codes generated as part of a plan group.", "These endpoints do not need to be tested again.", "However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.", exclude.map((el => `- ${el.method.toUpperCase()}: ${el.path}`)).join("\n") ].join("\n")
|
|
9644
|
+
} ];
|
|
9481
9645
|
|
|
9482
9646
|
function createApplication$1(props) {
|
|
9483
9647
|
assertSchemaModel(props.model);
|
|
9484
9648
|
const application = collection$2[props.model];
|
|
9485
|
-
return {
|
|
9486
|
-
protocol: "class",
|
|
9487
|
-
name: "Modify Test Code",
|
|
9488
|
-
application,
|
|
9489
|
-
execute: {
|
|
9490
|
-
correctTestCode: next => {
|
|
9491
|
-
props.build(next);
|
|
9492
|
-
}
|
|
9493
|
-
}
|
|
9494
|
-
};
|
|
9495
|
-
}
|
|
9496
|
-
|
|
9497
|
-
const claude$2 = {
|
|
9498
|
-
model: "claude",
|
|
9499
|
-
options: {
|
|
9500
|
-
reference: true,
|
|
9501
|
-
separate: null
|
|
9502
|
-
},
|
|
9503
|
-
functions: [ {
|
|
9504
|
-
name: "correctTestCode",
|
|
9505
|
-
parameters: {
|
|
9506
|
-
description: "Current Type: {@link ICorrectTestFunctionProps}",
|
|
9507
|
-
type: "object",
|
|
9508
|
-
properties: {
|
|
9509
|
-
think_without_compile_error: {
|
|
9510
|
-
description: "Step 1: Initial self-reflection on the source code without compiler error\ncontext.\n\nThe AI agent analyzes the previously generated test code to identify\npotential issues, relying solely on its understanding of TypeScript syntax,\ntesting patterns, and best practices.\n\nThis encourages the agent to develop independent debugging skills before\nbeing influenced by external error messages.",
|
|
9511
|
-
type: "string"
|
|
9512
|
-
},
|
|
9513
|
-
think_again_with_compile_error: {
|
|
9514
|
-
description: "Step 2: Re-evaluation of the code with compiler error messages as\nadditional context.\n\nAfter the initial analysis, the AI agent reviews the same code again, this\ntime incorporating the specific TypeScript compiler error messages.\n\nThis allows the agent to correlate its initial observations with concrete\ncompilation failures and refine its understanding of what went wrong.",
|
|
9515
|
-
type: "string"
|
|
9516
|
-
},
|
|
9517
|
-
solution: {
|
|
9518
|
-
title: "Step 3: Concrete action plan for fixing the identified issues",
|
|
9519
|
-
description: "Step 3: Concrete action plan for fixing the identified issues.\n\nBased on the analysis from steps 1 and 2, the AI agent formulates a\nspecific, step-by-step solution strategy.\n\nThis should include what changes need to be made, why those changes are\nnecessary, and how they will resolve the compilation errors while\nmaintaining the test's intended functionality.",
|
|
9520
|
-
type: "string"
|
|
9521
|
-
},
|
|
9522
|
-
content: {
|
|
9523
|
-
title: "Step 4: The corrected TypeScript test code",
|
|
9524
|
-
description: "Step 4: The corrected TypeScript test code.\n\nThe final, properly fixed TypeScript code that should compile without\nerrors.\n\nThis represents the implementation of the solution plan from step 3,\ncontaining all necessary corrections to make the test code syntactically\nvalid and functionally correct.",
|
|
9525
|
-
type: "string"
|
|
9526
|
-
}
|
|
9527
|
-
},
|
|
9528
|
-
required: [ "think_without_compile_error", "think_again_with_compile_error", "solution", "content" ],
|
|
9529
|
-
additionalProperties: false,
|
|
9530
|
-
$defs: {}
|
|
9531
|
-
},
|
|
9532
|
-
validate: (() => {
|
|
9533
|
-
const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.solution && "string" === typeof input.content;
|
|
9534
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
9535
|
-
path: _path + ".think_without_compile_error",
|
|
9536
|
-
expected: "string",
|
|
9537
|
-
value: input.think_without_compile_error
|
|
9538
|
-
}), "string" === typeof input.think_again_with_compile_error || _report(_exceptionable, {
|
|
9539
|
-
path: _path + ".think_again_with_compile_error",
|
|
9540
|
-
expected: "string",
|
|
9541
|
-
value: input.think_again_with_compile_error
|
|
9542
|
-
}), "string" === typeof input.solution || _report(_exceptionable, {
|
|
9543
|
-
path: _path + ".solution",
|
|
9544
|
-
expected: "string",
|
|
9545
|
-
value: input.solution
|
|
9546
|
-
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9547
|
-
path: _path + ".content",
|
|
9548
|
-
expected: "string",
|
|
9549
|
-
value: input.content
|
|
9550
|
-
}) ].every((flag => flag));
|
|
9551
|
-
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9552
|
-
let errors;
|
|
9553
|
-
let _report;
|
|
9554
|
-
return input => {
|
|
9555
|
-
if (false === __is(input)) {
|
|
9556
|
-
errors = [];
|
|
9557
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9558
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9559
|
-
path: _path + "",
|
|
9560
|
-
expected: "ICorrectTestFunctionProps",
|
|
9561
|
-
value: input
|
|
9562
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9563
|
-
path: _path + "",
|
|
9564
|
-
expected: "ICorrectTestFunctionProps",
|
|
9565
|
-
value: input
|
|
9566
|
-
}))(input, "$input", true);
|
|
9567
|
-
const success = 0 === errors.length;
|
|
9568
|
-
return success ? {
|
|
9569
|
-
success,
|
|
9570
|
-
data: input
|
|
9571
|
-
} : {
|
|
9572
|
-
success,
|
|
9573
|
-
errors,
|
|
9574
|
-
data: input
|
|
9575
|
-
};
|
|
9576
|
-
}
|
|
9577
|
-
return {
|
|
9578
|
-
success: true,
|
|
9579
|
-
data: input
|
|
9580
|
-
};
|
|
9581
|
-
};
|
|
9582
|
-
})()
|
|
9583
|
-
} ]
|
|
9584
|
-
};
|
|
9585
|
-
|
|
9586
|
-
const collection$2 = {
|
|
9587
|
-
chatgpt: {
|
|
9588
|
-
model: "chatgpt",
|
|
9589
|
-
options: {
|
|
9590
|
-
reference: true,
|
|
9591
|
-
strict: false,
|
|
9592
|
-
separate: null
|
|
9593
|
-
},
|
|
9594
|
-
functions: [ {
|
|
9595
|
-
name: "correctTestCode",
|
|
9596
|
-
parameters: {
|
|
9597
|
-
description: "Current Type: {@link ICorrectTestFunctionProps}",
|
|
9598
|
-
type: "object",
|
|
9599
|
-
properties: {
|
|
9600
|
-
think_without_compile_error: {
|
|
9601
|
-
description: "Step 1: Initial self-reflection on the source code without compiler error\ncontext.\n\nThe AI agent analyzes the previously generated test code to identify\npotential issues, relying solely on its understanding of TypeScript syntax,\ntesting patterns, and best practices.\n\nThis encourages the agent to develop independent debugging skills before\nbeing influenced by external error messages.",
|
|
9602
|
-
type: "string"
|
|
9603
|
-
},
|
|
9604
|
-
think_again_with_compile_error: {
|
|
9605
|
-
description: "Step 2: Re-evaluation of the code with compiler error messages as\nadditional context.\n\nAfter the initial analysis, the AI agent reviews the same code again, this\ntime incorporating the specific TypeScript compiler error messages.\n\nThis allows the agent to correlate its initial observations with concrete\ncompilation failures and refine its understanding of what went wrong.",
|
|
9606
|
-
type: "string"
|
|
9607
|
-
},
|
|
9608
|
-
solution: {
|
|
9609
|
-
title: "Step 3: Concrete action plan for fixing the identified issues",
|
|
9610
|
-
description: "Step 3: Concrete action plan for fixing the identified issues.\n\nBased on the analysis from steps 1 and 2, the AI agent formulates a\nspecific, step-by-step solution strategy.\n\nThis should include what changes need to be made, why those changes are\nnecessary, and how they will resolve the compilation errors while\nmaintaining the test's intended functionality.",
|
|
9611
|
-
type: "string"
|
|
9612
|
-
},
|
|
9613
|
-
content: {
|
|
9614
|
-
title: "Step 4: The corrected TypeScript test code",
|
|
9615
|
-
description: "Step 4: The corrected TypeScript test code.\n\nThe final, properly fixed TypeScript code that should compile without\nerrors.\n\nThis represents the implementation of the solution plan from step 3,\ncontaining all necessary corrections to make the test code syntactically\nvalid and functionally correct.",
|
|
9616
|
-
type: "string"
|
|
9617
|
-
}
|
|
9618
|
-
},
|
|
9619
|
-
required: [ "think_without_compile_error", "think_again_with_compile_error", "solution", "content" ],
|
|
9620
|
-
additionalProperties: false,
|
|
9621
|
-
$defs: {}
|
|
9622
|
-
},
|
|
9623
|
-
validate: (() => {
|
|
9624
|
-
const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.solution && "string" === typeof input.content;
|
|
9625
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
9626
|
-
path: _path + ".think_without_compile_error",
|
|
9627
|
-
expected: "string",
|
|
9628
|
-
value: input.think_without_compile_error
|
|
9629
|
-
}), "string" === typeof input.think_again_with_compile_error || _report(_exceptionable, {
|
|
9630
|
-
path: _path + ".think_again_with_compile_error",
|
|
9631
|
-
expected: "string",
|
|
9632
|
-
value: input.think_again_with_compile_error
|
|
9633
|
-
}), "string" === typeof input.solution || _report(_exceptionable, {
|
|
9634
|
-
path: _path + ".solution",
|
|
9635
|
-
expected: "string",
|
|
9636
|
-
value: input.solution
|
|
9637
|
-
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9638
|
-
path: _path + ".content",
|
|
9639
|
-
expected: "string",
|
|
9640
|
-
value: input.content
|
|
9641
|
-
}) ].every((flag => flag));
|
|
9642
|
-
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9643
|
-
let errors;
|
|
9644
|
-
let _report;
|
|
9645
|
-
return input => {
|
|
9646
|
-
if (false === __is(input)) {
|
|
9647
|
-
errors = [];
|
|
9648
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9649
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9650
|
-
path: _path + "",
|
|
9651
|
-
expected: "ICorrectTestFunctionProps",
|
|
9652
|
-
value: input
|
|
9653
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9654
|
-
path: _path + "",
|
|
9655
|
-
expected: "ICorrectTestFunctionProps",
|
|
9656
|
-
value: input
|
|
9657
|
-
}))(input, "$input", true);
|
|
9658
|
-
const success = 0 === errors.length;
|
|
9659
|
-
return success ? {
|
|
9660
|
-
success,
|
|
9661
|
-
data: input
|
|
9662
|
-
} : {
|
|
9663
|
-
success,
|
|
9664
|
-
errors,
|
|
9665
|
-
data: input
|
|
9666
|
-
};
|
|
9667
|
-
}
|
|
9668
|
-
return {
|
|
9669
|
-
success: true,
|
|
9670
|
-
data: input
|
|
9671
|
-
};
|
|
9672
|
-
};
|
|
9673
|
-
})()
|
|
9674
|
-
} ]
|
|
9675
|
-
},
|
|
9676
|
-
claude: claude$2,
|
|
9677
|
-
llama: claude$2,
|
|
9678
|
-
deepseek: claude$2,
|
|
9679
|
-
3.1: claude$2,
|
|
9680
|
-
"3.0": {
|
|
9681
|
-
model: "3.0",
|
|
9682
|
-
options: {
|
|
9683
|
-
constraint: true,
|
|
9684
|
-
recursive: 3,
|
|
9685
|
-
separate: null
|
|
9686
|
-
},
|
|
9687
|
-
functions: [ {
|
|
9688
|
-
name: "correctTestCode",
|
|
9689
|
-
parameters: {
|
|
9690
|
-
type: "object",
|
|
9691
|
-
properties: {
|
|
9692
|
-
think_without_compile_error: {
|
|
9693
|
-
type: "string",
|
|
9694
|
-
description: "Step 1: Initial self-reflection on the source code without compiler error\ncontext.\n\nThe AI agent analyzes the previously generated test code to identify\npotential issues, relying solely on its understanding of TypeScript syntax,\ntesting patterns, and best practices.\n\nThis encourages the agent to develop independent debugging skills before\nbeing influenced by external error messages."
|
|
9695
|
-
},
|
|
9696
|
-
think_again_with_compile_error: {
|
|
9697
|
-
type: "string",
|
|
9698
|
-
description: "Step 2: Re-evaluation of the code with compiler error messages as\nadditional context.\n\nAfter the initial analysis, the AI agent reviews the same code again, this\ntime incorporating the specific TypeScript compiler error messages.\n\nThis allows the agent to correlate its initial observations with concrete\ncompilation failures and refine its understanding of what went wrong."
|
|
9699
|
-
},
|
|
9700
|
-
solution: {
|
|
9701
|
-
type: "string",
|
|
9702
|
-
title: "Step 3: Concrete action plan for fixing the identified issues",
|
|
9703
|
-
description: "Step 3: Concrete action plan for fixing the identified issues.\n\nBased on the analysis from steps 1 and 2, the AI agent formulates a\nspecific, step-by-step solution strategy.\n\nThis should include what changes need to be made, why those changes are\nnecessary, and how they will resolve the compilation errors while\nmaintaining the test's intended functionality."
|
|
9704
|
-
},
|
|
9705
|
-
content: {
|
|
9706
|
-
type: "string",
|
|
9707
|
-
title: "Step 4: The corrected TypeScript test code",
|
|
9708
|
-
description: "Step 4: The corrected TypeScript test code.\n\nThe final, properly fixed TypeScript code that should compile without\nerrors.\n\nThis represents the implementation of the solution plan from step 3,\ncontaining all necessary corrections to make the test code syntactically\nvalid and functionally correct."
|
|
9709
|
-
}
|
|
9710
|
-
},
|
|
9711
|
-
required: [ "think_without_compile_error", "think_again_with_compile_error", "solution", "content" ],
|
|
9712
|
-
description: "Current Type: {@link ICorrectTestFunctionProps}",
|
|
9713
|
-
additionalProperties: false
|
|
9714
|
-
},
|
|
9715
|
-
validate: (() => {
|
|
9716
|
-
const _io0 = input => "string" === typeof input.think_without_compile_error && "string" === typeof input.think_again_with_compile_error && "string" === typeof input.solution && "string" === typeof input.content;
|
|
9717
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.think_without_compile_error || _report(_exceptionable, {
|
|
9718
|
-
path: _path + ".think_without_compile_error",
|
|
9719
|
-
expected: "string",
|
|
9720
|
-
value: input.think_without_compile_error
|
|
9721
|
-
}), "string" === typeof input.think_again_with_compile_error || _report(_exceptionable, {
|
|
9722
|
-
path: _path + ".think_again_with_compile_error",
|
|
9723
|
-
expected: "string",
|
|
9724
|
-
value: input.think_again_with_compile_error
|
|
9725
|
-
}), "string" === typeof input.solution || _report(_exceptionable, {
|
|
9726
|
-
path: _path + ".solution",
|
|
9727
|
-
expected: "string",
|
|
9728
|
-
value: input.solution
|
|
9729
|
-
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9730
|
-
path: _path + ".content",
|
|
9731
|
-
expected: "string",
|
|
9732
|
-
value: input.content
|
|
9733
|
-
}) ].every((flag => flag));
|
|
9734
|
-
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9735
|
-
let errors;
|
|
9736
|
-
let _report;
|
|
9737
|
-
return input => {
|
|
9738
|
-
if (false === __is(input)) {
|
|
9739
|
-
errors = [];
|
|
9740
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9741
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9742
|
-
path: _path + "",
|
|
9743
|
-
expected: "ICorrectTestFunctionProps",
|
|
9744
|
-
value: input
|
|
9745
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9746
|
-
path: _path + "",
|
|
9747
|
-
expected: "ICorrectTestFunctionProps",
|
|
9748
|
-
value: input
|
|
9749
|
-
}))(input, "$input", true);
|
|
9750
|
-
const success = 0 === errors.length;
|
|
9751
|
-
return success ? {
|
|
9752
|
-
success,
|
|
9753
|
-
data: input
|
|
9754
|
-
} : {
|
|
9755
|
-
success,
|
|
9756
|
-
errors,
|
|
9757
|
-
data: input
|
|
9758
|
-
};
|
|
9759
|
-
}
|
|
9760
|
-
return {
|
|
9761
|
-
success: true,
|
|
9762
|
-
data: input
|
|
9763
|
-
};
|
|
9764
|
-
};
|
|
9765
|
-
})()
|
|
9766
|
-
} ]
|
|
9767
|
-
}
|
|
9768
|
-
};
|
|
9769
|
-
|
|
9770
|
-
async function orchestrateTestScenario(ctx) {
|
|
9771
|
-
const operations = ctx.state().interface?.document.operations ?? [];
|
|
9772
|
-
if (operations.length === 0) {
|
|
9773
|
-
throw new Error("Cannot write test scenarios because these are no operations.");
|
|
9774
|
-
}
|
|
9775
|
-
const exclude = [];
|
|
9776
|
-
let include = Array.from(operations);
|
|
9777
|
-
do {
|
|
9778
|
-
const matrix = divideArray({
|
|
9779
|
-
array: include,
|
|
9780
|
-
capacity: 30
|
|
9781
|
-
});
|
|
9782
|
-
await Promise.all(matrix.map((async _include => {
|
|
9783
|
-
exclude.push(...await execute(ctx, operations, _include, exclude.map((x => x.endpoint))));
|
|
9784
|
-
})));
|
|
9785
|
-
include = include.filter((op => {
|
|
9786
|
-
if (exclude.some((pg => pg.endpoint.method === op.method && pg.endpoint.path === op.path))) {
|
|
9787
|
-
return false;
|
|
9788
|
-
}
|
|
9789
|
-
return true;
|
|
9790
|
-
}));
|
|
9791
|
-
} while (include.length > 0);
|
|
9792
|
-
return {
|
|
9793
|
-
type: "testScenario",
|
|
9794
|
-
step: ctx.state().analyze?.step ?? 0,
|
|
9795
|
-
scenarios: exclude.flatMap((pg => pg.scenarios.map((plan => ({
|
|
9796
|
-
endpoint: pg.endpoint,
|
|
9797
|
-
draft: plan.draft,
|
|
9798
|
-
functionName: plan.functionName,
|
|
9799
|
-
dependencies: plan.dependsOn
|
|
9800
|
-
}))))),
|
|
9801
|
-
created_at: (new Date).toISOString()
|
|
9802
|
-
};
|
|
9803
|
-
}
|
|
9804
|
-
|
|
9805
|
-
const execute = async (ctx, ops, include, exclude) => {
|
|
9806
|
-
const pointer = {
|
|
9807
|
-
value: []
|
|
9808
|
-
};
|
|
9809
|
-
const agentica = new MicroAgentica({
|
|
9810
|
-
model: ctx.model,
|
|
9811
|
-
vendor: ctx.vendor,
|
|
9812
|
-
config: {
|
|
9813
|
-
...ctx.config ?? {},
|
|
9814
|
-
executor: {
|
|
9815
|
-
describe: null
|
|
9816
|
-
}
|
|
9817
|
-
},
|
|
9818
|
-
tokenUsage: ctx.usage(),
|
|
9819
|
-
histories: createHistoryProperties(ops, include, exclude),
|
|
9820
|
-
controllers: [ createApplication({
|
|
9821
|
-
model: ctx.model,
|
|
9822
|
-
build: next => {
|
|
9823
|
-
pointer.value ?? (pointer.value = []);
|
|
9824
|
-
pointer.value.push(...next.scenarioGroups);
|
|
9825
|
-
}
|
|
9826
|
-
}) ]
|
|
9827
|
-
});
|
|
9828
|
-
enforceToolCall(agentica);
|
|
9829
|
-
await agentica.conversate(`create test scenarios.`);
|
|
9830
|
-
if (pointer.value.length === 0) {
|
|
9831
|
-
throw new Error("Failed to create test plans.");
|
|
9832
|
-
}
|
|
9833
|
-
return pointer.value;
|
|
9834
|
-
};
|
|
9835
|
-
|
|
9836
|
-
const createHistoryProperties = (operations, include, exclude) => [ {
|
|
9837
|
-
id: v4(),
|
|
9838
|
-
created_at: (new Date).toISOString(),
|
|
9839
|
-
type: "systemMessage",
|
|
9840
|
-
text: 'You are the AutoAPI Test Scenario Generator.\n\nYour job is to analyze an array of API operation objects and generate realistic, structured test scenario drafts for each operation.\n\n---\n\n## Input Format\n\nYou will receive an array of `Operation` objects structured like this:\n\n```ts\n{\n method: "post" | "get" | "put" | "patch" | "delete",\n path: "/path/to/resource",\n specification: string, // API specification with business logic and constraints\n description: string, // Multi-paragraph description\n summary: string, // One-line summary\n parameters: [...], // List of path/query/body parameters\n requestBody?: {\n typeName: string,\n description: string\n },\n responseBody: {\n typeName: string,\n description: string\n }\n}\n```\n\n---\n\n## Output Format\n\nYour output must be an array of grouped test plans, using the following structure:\n\n```ts\n[\n {\n method: "post",\n path: "/shopping/products",\n plans: [\n {\n draft: "Test product creation by submitting two requests with the same product.pid. Confirm that the second request returns a uniqueness constraint error.",\n dependsOn: [\n {\n method: "post",\n path: "/shopping/categories",\n purpose: "Create a category beforehand so the product can reference it."\n },\n {\n method: "get",\n path: "/users/me",\n purpose: "Verify a valid user session and obtain user context for the test."\n }\n ]\n },\n {\n draft: "Verify that missing required fields like \'name\' or \'price\' trigger appropriate validation errors.",\n dependsOn: []\n }\n ]\n },\n {\n method: "patch",\n path: "/shopping/products/{productId}",\n plans: [\n {\n draft: "Attempt to update a product with an invalid productId and expect a 404 error.",\n dependsOn: []\n }\n ]\n }\n]\n```\n\n- Each top-level object is a **plan group** for a single unique endpoint (`method + path`).\n- The `plans` array contains **one or more test drafts** for that endpoint.\n- Each `draft` may list its **prerequisite API calls** in the `dependsOn` array, which includes `method`, `path`, and a `purpose` for context.\n\n---\n\n### ✅ **Uniqueness Rule**\n\n> ⚠️ **Each `{method} + {path}` combination must appear only once** in the output array.\n> This means **you must not create multiple plan groups with the same HTTP method and path.**\n\n* Treat each `{method} + {path}` pair as a **unique test identifier**.\n* All test plans (`plans`) related to the same endpoint must be **grouped under a single PlanGroup object**.\n* Duplicating PlanGroups for the same endpoint will lead to invalid output.\n\n**✅ Good:**\n\n```ts\n[\n {\n method: "patch",\n path: "/blog/posts/{postId}",\n plans: [\n { draft: "...", dependsOn: [...] },\n { draft: "...", dependsOn: [...] }\n ]\n }\n]\n```\n\n**❌ Bad:**\n\n```ts\n[\n {\n method: "patch",\n path: "/blog/posts/{postId}",\n plans: [ ... ]\n },\n {\n method: "patch",\n path: "/blog/posts/{postId}", // Duplicate! Not allowed.\n plans: [ ... ]\n }\n]\n```\n\n---\n\n## Writing Guidelines\n\n1. **draft**:\n - Write a clear and realistic test plan for the operation.\n - Include both success and failure cases where applicable.\n - Incorporate constraints mentioned in the API description such as uniqueness, foreign key requirements, or authentication.\n - For complex operations, include multiple steps within the same `draft` string (e.g., create → verify → delete).\n\n2. **dependsOn**:\n - List other API operations that must be invoked before this test can be executed.\n - Each item must include `method`, `path`, and `purpose`.\n - The `purpose` field should explain *why* the dependency is needed in the test setup.\n\n3. Treat each `{method} + {path}` combination as a unique test identifier.\n\n---\n\n## Purpose\n\nThese test scenario objects are designed to support QA engineers and backend developers in planning automated or manual tests. Each test draft reflects the core functionality and business rules of the API to ensure robust system behavior.'
|
|
9841
|
-
}, {
|
|
9842
|
-
id: v4(),
|
|
9843
|
-
created_at: (new Date).toISOString(),
|
|
9844
|
-
type: "systemMessage",
|
|
9845
|
-
text: [ "Below are the full operations. Please refer to this.", "Your role is to draft all test cases for each given Operation.", "It is also permissible to write multiple test codes on a single endpoint.", "However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.", "", "```json", JSON.stringify(operations.map((el => ({
|
|
9846
|
-
path: el.path,
|
|
9847
|
-
method: el.method,
|
|
9848
|
-
summary: el.summary
|
|
9849
|
-
})))), "```" ].join("\n")
|
|
9850
|
-
}, {
|
|
9851
|
-
id: v4(),
|
|
9852
|
-
created_at: (new Date).toISOString(),
|
|
9853
|
-
type: "systemMessage",
|
|
9854
|
-
text: [ "# Included in Test Plan", include.map((el => `- ${el.method.toUpperCase()}: ${el.path}`)).join("\n"), "", "# Excluded from Test Plan", "These are the endpoints that have already been used in test codes generated as part of a plan group.", "These endpoints do not need to be tested again.", "However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.", exclude.map((el => `- ${el.method.toUpperCase()}: ${el.path}`)).join("\n") ].join("\n")
|
|
9855
|
-
} ];
|
|
9856
|
-
|
|
9857
|
-
function createApplication(props) {
|
|
9858
|
-
assertSchemaModel(props.model);
|
|
9859
|
-
const application = collection$1[props.model];
|
|
9860
9649
|
application.functions[0].validate = next => {
|
|
9861
9650
|
const result = (() => {
|
|
9862
9651
|
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
9863
9652
|
const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every((elem => "object" === typeof elem && null !== elem && _io3(elem))));
|
|
9864
9653
|
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
9865
|
-
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.
|
|
9654
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependencies) && input.dependencies.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
9866
9655
|
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
9867
9656
|
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
9868
9657
|
path: _path + ".scenarioGroups",
|
|
@@ -9923,22 +9712,22 @@ function createApplication(props) {
|
|
|
9923
9712
|
path: _path + ".functionName",
|
|
9924
9713
|
expected: "string",
|
|
9925
9714
|
value: input.functionName
|
|
9926
|
-
}), (Array.isArray(input.
|
|
9927
|
-
path: _path + ".
|
|
9928
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
9929
|
-
value: input.
|
|
9930
|
-
})) && input.
|
|
9931
|
-
path: _path + ".
|
|
9932
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
9715
|
+
}), (Array.isArray(input.dependencies) || _report(_exceptionable, {
|
|
9716
|
+
path: _path + ".dependencies",
|
|
9717
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
9718
|
+
value: input.dependencies
|
|
9719
|
+
})) && input.dependencies.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
9720
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
9721
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
9933
9722
|
value: elem
|
|
9934
|
-
})) && _vo4(elem, _path + ".
|
|
9935
|
-
path: _path + ".
|
|
9936
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
9723
|
+
})) && _vo4(elem, _path + ".dependencies[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
9724
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
9725
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
9937
9726
|
value: elem
|
|
9938
9727
|
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
9939
|
-
path: _path + ".
|
|
9940
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
9941
|
-
value: input.
|
|
9728
|
+
path: _path + ".dependencies",
|
|
9729
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
9730
|
+
value: input.dependencies
|
|
9942
9731
|
}) ].every((flag => flag));
|
|
9943
9732
|
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
9944
9733
|
path: _path + ".endpoint",
|
|
@@ -10029,7 +9818,7 @@ function createApplication(props) {
|
|
|
10029
9818
|
};
|
|
10030
9819
|
}
|
|
10031
9820
|
|
|
10032
|
-
const claude$
|
|
9821
|
+
const claude$2 = {
|
|
10033
9822
|
model: "claude",
|
|
10034
9823
|
options: {
|
|
10035
9824
|
reference: true,
|
|
@@ -10081,11 +9870,11 @@ const claude$1 = {
|
|
|
10081
9870
|
description: "Array of test scenarios.",
|
|
10082
9871
|
type: "array",
|
|
10083
9872
|
items: {
|
|
10084
|
-
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface
|
|
9873
|
+
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface defines a structured, user-centric test draft that includes\n> a descriptive function name, a detailed scenario draft, and logical\n> dependencies on other endpoints required for context or setup.",
|
|
10085
9874
|
type: "object",
|
|
10086
9875
|
properties: {
|
|
10087
9876
|
draft: {
|
|
10088
|
-
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple test
|
|
9877
|
+
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple concrete test cases.",
|
|
10089
9878
|
type: "string"
|
|
10090
9879
|
},
|
|
10091
9880
|
functionName: {
|
|
@@ -10093,15 +9882,16 @@ const claude$1 = {
|
|
|
10093
9882
|
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions",
|
|
10094
9883
|
type: "string"
|
|
10095
9884
|
},
|
|
10096
|
-
|
|
10097
|
-
|
|
9885
|
+
dependencies: {
|
|
9886
|
+
title: "A list of other API endpoints that this scenario logically depends on",
|
|
9887
|
+
description: "A list of other API endpoints that this scenario logically depends on.\n\nThese dependencies represent context or prerequisite conditions, such as\nauthentication, resource creation, or data setup, that are relevant to\nthe test. This list is not a strict execution order — if ordering is\nimportant, it must be described explicitly in the `purpose`.",
|
|
10098
9888
|
type: "array",
|
|
10099
9889
|
items: {
|
|
10100
|
-
description: "Current Type: {@link IAutoBeTestScenarioApplication.
|
|
9890
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependencies}",
|
|
10101
9891
|
type: "object",
|
|
10102
9892
|
properties: {
|
|
10103
9893
|
endpoint: {
|
|
10104
|
-
description: "Target API endpoint that
|
|
9894
|
+
description: "Target API endpoint that this scenario depends on.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10105
9895
|
type: "object",
|
|
10106
9896
|
properties: {
|
|
10107
9897
|
path: {
|
|
@@ -10128,7 +9918,7 @@ const claude$1 = {
|
|
|
10128
9918
|
required: [ "path", "method" ]
|
|
10129
9919
|
},
|
|
10130
9920
|
purpose: {
|
|
10131
|
-
description: 'A concise
|
|
9921
|
+
description: 'A concise explanation of why this API call is relevant or required for\nthe main test scenario.\n\nThis should describe the contextual or setup role of the dependency, such\nas creating necessary data or establishing user authentication.\n\nExample: "Creates a category so that a product can be linked to it during\ncreation."',
|
|
10132
9922
|
type: "string"
|
|
10133
9923
|
}
|
|
10134
9924
|
},
|
|
@@ -10136,7 +9926,7 @@ const claude$1 = {
|
|
|
10136
9926
|
}
|
|
10137
9927
|
}
|
|
10138
9928
|
},
|
|
10139
|
-
required: [ "draft", "functionName", "
|
|
9929
|
+
required: [ "draft", "functionName", "dependencies" ]
|
|
10140
9930
|
}
|
|
10141
9931
|
}
|
|
10142
9932
|
},
|
|
@@ -10153,7 +9943,7 @@ const claude$1 = {
|
|
|
10153
9943
|
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
10154
9944
|
const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every((elem => "object" === typeof elem && null !== elem && _io3(elem))));
|
|
10155
9945
|
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
10156
|
-
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.
|
|
9946
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependencies) && input.dependencies.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
10157
9947
|
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
10158
9948
|
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
10159
9949
|
path: _path + ".scenarioGroups",
|
|
@@ -10214,22 +10004,22 @@ const claude$1 = {
|
|
|
10214
10004
|
path: _path + ".functionName",
|
|
10215
10005
|
expected: "string",
|
|
10216
10006
|
value: input.functionName
|
|
10217
|
-
}), (Array.isArray(input.
|
|
10218
|
-
path: _path + ".
|
|
10219
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
10220
|
-
value: input.
|
|
10221
|
-
})) && input.
|
|
10222
|
-
path: _path + ".
|
|
10223
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
10007
|
+
}), (Array.isArray(input.dependencies) || _report(_exceptionable, {
|
|
10008
|
+
path: _path + ".dependencies",
|
|
10009
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
10010
|
+
value: input.dependencies
|
|
10011
|
+
})) && input.dependencies.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10012
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
10013
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
10224
10014
|
value: elem
|
|
10225
|
-
})) && _vo4(elem, _path + ".
|
|
10226
|
-
path: _path + ".
|
|
10227
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
10015
|
+
})) && _vo4(elem, _path + ".dependencies[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10016
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
10017
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
10228
10018
|
value: elem
|
|
10229
10019
|
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10230
|
-
path: _path + ".
|
|
10231
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
10232
|
-
value: input.
|
|
10020
|
+
path: _path + ".dependencies",
|
|
10021
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
10022
|
+
value: input.dependencies
|
|
10233
10023
|
}) ].every((flag => flag));
|
|
10234
10024
|
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10235
10025
|
path: _path + ".endpoint",
|
|
@@ -10279,7 +10069,7 @@ const claude$1 = {
|
|
|
10279
10069
|
} ]
|
|
10280
10070
|
};
|
|
10281
10071
|
|
|
10282
|
-
const collection$
|
|
10072
|
+
const collection$2 = {
|
|
10283
10073
|
chatgpt: {
|
|
10284
10074
|
model: "chatgpt",
|
|
10285
10075
|
options: {
|
|
@@ -10324,11 +10114,11 @@ const collection$1 = {
|
|
|
10324
10114
|
description: "Array of test scenarios.",
|
|
10325
10115
|
type: "array",
|
|
10326
10116
|
items: {
|
|
10327
|
-
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface
|
|
10117
|
+
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface defines a structured, user-centric test draft that includes\n> a descriptive function name, a detailed scenario draft, and logical\n> dependencies on other endpoints required for context or setup.",
|
|
10328
10118
|
type: "object",
|
|
10329
10119
|
properties: {
|
|
10330
10120
|
draft: {
|
|
10331
|
-
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple test
|
|
10121
|
+
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple concrete test cases.",
|
|
10332
10122
|
type: "string"
|
|
10333
10123
|
},
|
|
10334
10124
|
functionName: {
|
|
@@ -10336,15 +10126,16 @@ const collection$1 = {
|
|
|
10336
10126
|
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions",
|
|
10337
10127
|
type: "string"
|
|
10338
10128
|
},
|
|
10339
|
-
|
|
10340
|
-
|
|
10129
|
+
dependencies: {
|
|
10130
|
+
title: "A list of other API endpoints that this scenario logically depends on",
|
|
10131
|
+
description: "A list of other API endpoints that this scenario logically depends on.\n\nThese dependencies represent context or prerequisite conditions, such as\nauthentication, resource creation, or data setup, that are relevant to\nthe test. This list is not a strict execution order — if ordering is\nimportant, it must be described explicitly in the `purpose`.",
|
|
10341
10132
|
type: "array",
|
|
10342
10133
|
items: {
|
|
10343
|
-
description: "Current Type: {@link IAutoBeTestScenarioApplication.
|
|
10134
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependencies}",
|
|
10344
10135
|
type: "object",
|
|
10345
10136
|
properties: {
|
|
10346
10137
|
endpoint: {
|
|
10347
|
-
description: "Target API endpoint that
|
|
10138
|
+
description: "Target API endpoint that this scenario depends on.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10348
10139
|
type: "object",
|
|
10349
10140
|
properties: {
|
|
10350
10141
|
path: {
|
|
@@ -10362,7 +10153,7 @@ const collection$1 = {
|
|
|
10362
10153
|
required: [ "path", "method" ]
|
|
10363
10154
|
},
|
|
10364
10155
|
purpose: {
|
|
10365
|
-
description: 'A concise
|
|
10156
|
+
description: 'A concise explanation of why this API call is relevant or required for\nthe main test scenario.\n\nThis should describe the contextual or setup role of the dependency, such\nas creating necessary data or establishing user authentication.\n\nExample: "Creates a category so that a product can be linked to it during\ncreation."',
|
|
10366
10157
|
type: "string"
|
|
10367
10158
|
}
|
|
10368
10159
|
},
|
|
@@ -10370,24 +10161,265 @@ const collection$1 = {
|
|
|
10370
10161
|
}
|
|
10371
10162
|
}
|
|
10372
10163
|
},
|
|
10373
|
-
required: [ "draft", "functionName", "
|
|
10374
|
-
}
|
|
10164
|
+
required: [ "draft", "functionName", "dependencies" ]
|
|
10165
|
+
}
|
|
10166
|
+
}
|
|
10167
|
+
},
|
|
10168
|
+
required: [ "endpoint", "scenarios" ]
|
|
10169
|
+
}
|
|
10170
|
+
}
|
|
10171
|
+
},
|
|
10172
|
+
required: [ "scenarioGroups" ],
|
|
10173
|
+
additionalProperties: false,
|
|
10174
|
+
$defs: {}
|
|
10175
|
+
},
|
|
10176
|
+
description: "Make test scenarios for the given endpoints.",
|
|
10177
|
+
validate: (() => {
|
|
10178
|
+
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
10179
|
+
const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every((elem => "object" === typeof elem && null !== elem && _io3(elem))));
|
|
10180
|
+
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
10181
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependencies) && input.dependencies.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
10182
|
+
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
10183
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
10184
|
+
path: _path + ".scenarioGroups",
|
|
10185
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10186
|
+
value: input.scenarioGroups
|
|
10187
|
+
})) && input.scenarioGroups.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10188
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10189
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10190
|
+
value: elem
|
|
10191
|
+
})) && _vo1(elem, _path + ".scenarioGroups[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10192
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10193
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10194
|
+
value: elem
|
|
10195
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10196
|
+
path: _path + ".scenarioGroups",
|
|
10197
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10198
|
+
value: input.scenarioGroups
|
|
10199
|
+
}) ].every((flag => flag));
|
|
10200
|
+
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10201
|
+
path: _path + ".endpoint",
|
|
10202
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10203
|
+
value: input.endpoint
|
|
10204
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10205
|
+
path: _path + ".endpoint",
|
|
10206
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10207
|
+
value: input.endpoint
|
|
10208
|
+
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10209
|
+
path: _path + ".scenarios",
|
|
10210
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10211
|
+
value: input.scenarios
|
|
10212
|
+
})) && input.scenarios.map(((elem, _index5) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10213
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
10214
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10215
|
+
value: elem
|
|
10216
|
+
})) && _vo3(elem, _path + ".scenarios[" + _index5 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10217
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
10218
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10219
|
+
value: elem
|
|
10220
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10221
|
+
path: _path + ".scenarios",
|
|
10222
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10223
|
+
value: input.scenarios
|
|
10224
|
+
}) ].every((flag => flag));
|
|
10225
|
+
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
10226
|
+
path: _path + ".path",
|
|
10227
|
+
expected: "string",
|
|
10228
|
+
value: input.path
|
|
10229
|
+
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
10230
|
+
path: _path + ".method",
|
|
10231
|
+
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
10232
|
+
value: input.method
|
|
10233
|
+
}) ].every((flag => flag));
|
|
10234
|
+
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.draft || _report(_exceptionable, {
|
|
10235
|
+
path: _path + ".draft",
|
|
10236
|
+
expected: "string",
|
|
10237
|
+
value: input.draft
|
|
10238
|
+
}), "string" === typeof input.functionName || _report(_exceptionable, {
|
|
10239
|
+
path: _path + ".functionName",
|
|
10240
|
+
expected: "string",
|
|
10241
|
+
value: input.functionName
|
|
10242
|
+
}), (Array.isArray(input.dependencies) || _report(_exceptionable, {
|
|
10243
|
+
path: _path + ".dependencies",
|
|
10244
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
10245
|
+
value: input.dependencies
|
|
10246
|
+
})) && input.dependencies.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10247
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
10248
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
10249
|
+
value: elem
|
|
10250
|
+
})) && _vo4(elem, _path + ".dependencies[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10251
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
10252
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
10253
|
+
value: elem
|
|
10254
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10255
|
+
path: _path + ".dependencies",
|
|
10256
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
10257
|
+
value: input.dependencies
|
|
10258
|
+
}) ].every((flag => flag));
|
|
10259
|
+
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10260
|
+
path: _path + ".endpoint",
|
|
10261
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10262
|
+
value: input.endpoint
|
|
10263
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10264
|
+
path: _path + ".endpoint",
|
|
10265
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10266
|
+
value: input.endpoint
|
|
10267
|
+
}), "string" === typeof input.purpose || _report(_exceptionable, {
|
|
10268
|
+
path: _path + ".purpose",
|
|
10269
|
+
expected: "string",
|
|
10270
|
+
value: input.purpose
|
|
10271
|
+
}) ].every((flag => flag));
|
|
10272
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10273
|
+
let errors;
|
|
10274
|
+
let _report;
|
|
10275
|
+
return input => {
|
|
10276
|
+
if (false === __is(input)) {
|
|
10277
|
+
errors = [];
|
|
10278
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10279
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10280
|
+
path: _path + "",
|
|
10281
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10282
|
+
value: input
|
|
10283
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10284
|
+
path: _path + "",
|
|
10285
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10286
|
+
value: input
|
|
10287
|
+
}))(input, "$input", true);
|
|
10288
|
+
const success = 0 === errors.length;
|
|
10289
|
+
return success ? {
|
|
10290
|
+
success,
|
|
10291
|
+
data: input
|
|
10292
|
+
} : {
|
|
10293
|
+
success,
|
|
10294
|
+
errors,
|
|
10295
|
+
data: input
|
|
10296
|
+
};
|
|
10297
|
+
}
|
|
10298
|
+
return {
|
|
10299
|
+
success: true,
|
|
10300
|
+
data: input
|
|
10301
|
+
};
|
|
10302
|
+
};
|
|
10303
|
+
})()
|
|
10304
|
+
} ]
|
|
10305
|
+
},
|
|
10306
|
+
claude: claude$2,
|
|
10307
|
+
llama: claude$2,
|
|
10308
|
+
deepseek: claude$2,
|
|
10309
|
+
3.1: claude$2,
|
|
10310
|
+
"3.0": {
|
|
10311
|
+
model: "3.0",
|
|
10312
|
+
options: {
|
|
10313
|
+
constraint: true,
|
|
10314
|
+
recursive: 3,
|
|
10315
|
+
separate: null
|
|
10316
|
+
},
|
|
10317
|
+
functions: [ {
|
|
10318
|
+
name: "makeScenario",
|
|
10319
|
+
parameters: {
|
|
10320
|
+
type: "object",
|
|
10321
|
+
properties: {
|
|
10322
|
+
scenarioGroups: {
|
|
10323
|
+
type: "array",
|
|
10324
|
+
items: {
|
|
10325
|
+
type: "object",
|
|
10326
|
+
properties: {
|
|
10327
|
+
endpoint: {
|
|
10328
|
+
type: "object",
|
|
10329
|
+
properties: {
|
|
10330
|
+
path: {
|
|
10331
|
+
type: "string",
|
|
10332
|
+
title: "HTTP path of the API operation",
|
|
10333
|
+
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage."
|
|
10334
|
+
},
|
|
10335
|
+
method: {
|
|
10336
|
+
type: "string",
|
|
10337
|
+
enum: [ "get", "post", "put", "delete", "patch" ],
|
|
10338
|
+
title: "HTTP method of the API operation",
|
|
10339
|
+
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record"
|
|
10340
|
+
}
|
|
10341
|
+
},
|
|
10342
|
+
required: [ "path", "method" ],
|
|
10343
|
+
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10344
|
+
additionalProperties: false
|
|
10345
|
+
},
|
|
10346
|
+
scenarios: {
|
|
10347
|
+
type: "array",
|
|
10348
|
+
items: {
|
|
10349
|
+
type: "object",
|
|
10350
|
+
properties: {
|
|
10351
|
+
draft: {
|
|
10352
|
+
type: "string",
|
|
10353
|
+
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple concrete test cases."
|
|
10354
|
+
},
|
|
10355
|
+
functionName: {
|
|
10356
|
+
type: "string",
|
|
10357
|
+
title: "Descriptive function name derived from the user scenario",
|
|
10358
|
+
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions"
|
|
10359
|
+
},
|
|
10360
|
+
dependencies: {
|
|
10361
|
+
type: "array",
|
|
10362
|
+
items: {
|
|
10363
|
+
type: "object",
|
|
10364
|
+
properties: {
|
|
10365
|
+
endpoint: {
|
|
10366
|
+
type: "object",
|
|
10367
|
+
properties: {
|
|
10368
|
+
path: {
|
|
10369
|
+
type: "string",
|
|
10370
|
+
title: "HTTP path of the API operation",
|
|
10371
|
+
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage."
|
|
10372
|
+
},
|
|
10373
|
+
method: {
|
|
10374
|
+
type: "string",
|
|
10375
|
+
enum: [ "get", "post", "put", "delete", "patch" ],
|
|
10376
|
+
title: "HTTP method of the API operation",
|
|
10377
|
+
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record"
|
|
10378
|
+
}
|
|
10379
|
+
},
|
|
10380
|
+
required: [ "path", "method" ],
|
|
10381
|
+
description: "Target API endpoint that this scenario depends on.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10382
|
+
additionalProperties: false
|
|
10383
|
+
},
|
|
10384
|
+
purpose: {
|
|
10385
|
+
type: "string",
|
|
10386
|
+
description: 'A concise explanation of why this API call is relevant or required for\nthe main test scenario.\n\nThis should describe the contextual or setup role of the dependency, such\nas creating necessary data or establishing user authentication.\n\nExample: "Creates a category so that a product can be linked to it during\ncreation."'
|
|
10387
|
+
}
|
|
10388
|
+
},
|
|
10389
|
+
required: [ "endpoint", "purpose" ],
|
|
10390
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependencies}",
|
|
10391
|
+
additionalProperties: false
|
|
10392
|
+
},
|
|
10393
|
+
title: "A list of other API endpoints that this scenario logically depends on",
|
|
10394
|
+
description: "A list of other API endpoints that this scenario logically depends on.\n\nThese dependencies represent context or prerequisite conditions, such as\nauthentication, resource creation, or data setup, that are relevant to\nthe test. This list is not a strict execution order — if ordering is\nimportant, it must be described explicitly in the `purpose`."
|
|
10395
|
+
}
|
|
10396
|
+
},
|
|
10397
|
+
required: [ "draft", "functionName", "dependencies" ],
|
|
10398
|
+
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface defines a structured, user-centric test draft that includes\n> a descriptive function name, a detailed scenario draft, and logical\n> dependencies on other endpoints required for context or setup.",
|
|
10399
|
+
additionalProperties: false
|
|
10400
|
+
},
|
|
10401
|
+
title: "Array of test scenarios",
|
|
10402
|
+
description: "Array of test scenarios."
|
|
10375
10403
|
}
|
|
10376
10404
|
},
|
|
10377
|
-
required: [ "endpoint", "scenarios" ]
|
|
10378
|
-
|
|
10405
|
+
required: [ "endpoint", "scenarios" ],
|
|
10406
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IScenarioGroup}",
|
|
10407
|
+
additionalProperties: false
|
|
10408
|
+
},
|
|
10409
|
+
title: "Array of test scenario groups",
|
|
10410
|
+
description: "Array of test scenario groups."
|
|
10379
10411
|
}
|
|
10380
10412
|
},
|
|
10381
10413
|
required: [ "scenarioGroups" ],
|
|
10382
|
-
|
|
10383
|
-
|
|
10414
|
+
description: " Properties containing the endpoints and test scenarios.\n\n------------------------------\n\nCurrent Type: {@link IAutoBeTestScenarioApplication.IProps}",
|
|
10415
|
+
additionalProperties: false
|
|
10384
10416
|
},
|
|
10385
10417
|
description: "Make test scenarios for the given endpoints.",
|
|
10386
10418
|
validate: (() => {
|
|
10387
10419
|
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
10388
10420
|
const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every((elem => "object" === typeof elem && null !== elem && _io3(elem))));
|
|
10389
10421
|
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
10390
|
-
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.
|
|
10422
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependencies) && input.dependencies.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
10391
10423
|
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
10392
10424
|
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
10393
10425
|
path: _path + ".scenarioGroups",
|
|
@@ -10448,22 +10480,22 @@ const collection$1 = {
|
|
|
10448
10480
|
path: _path + ".functionName",
|
|
10449
10481
|
expected: "string",
|
|
10450
10482
|
value: input.functionName
|
|
10451
|
-
}), (Array.isArray(input.
|
|
10452
|
-
path: _path + ".
|
|
10453
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
10454
|
-
value: input.
|
|
10455
|
-
})) && input.
|
|
10456
|
-
path: _path + ".
|
|
10457
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
10483
|
+
}), (Array.isArray(input.dependencies) || _report(_exceptionable, {
|
|
10484
|
+
path: _path + ".dependencies",
|
|
10485
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
10486
|
+
value: input.dependencies
|
|
10487
|
+
})) && input.dependencies.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10488
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
10489
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
10458
10490
|
value: elem
|
|
10459
|
-
})) && _vo4(elem, _path + ".
|
|
10460
|
-
path: _path + ".
|
|
10461
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
10491
|
+
})) && _vo4(elem, _path + ".dependencies[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10492
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
10493
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
10462
10494
|
value: elem
|
|
10463
10495
|
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10464
|
-
path: _path + ".
|
|
10465
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
10466
|
-
value: input.
|
|
10496
|
+
path: _path + ".dependencies",
|
|
10497
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
10498
|
+
value: input.dependencies
|
|
10467
10499
|
}) ].every((flag => flag));
|
|
10468
10500
|
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10469
10501
|
path: _path + ".endpoint",
|
|
@@ -10487,11 +10519,268 @@ const collection$1 = {
|
|
|
10487
10519
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10488
10520
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10489
10521
|
path: _path + "",
|
|
10490
|
-
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10522
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10523
|
+
value: input
|
|
10524
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10525
|
+
path: _path + "",
|
|
10526
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10527
|
+
value: input
|
|
10528
|
+
}))(input, "$input", true);
|
|
10529
|
+
const success = 0 === errors.length;
|
|
10530
|
+
return success ? {
|
|
10531
|
+
success,
|
|
10532
|
+
data: input
|
|
10533
|
+
} : {
|
|
10534
|
+
success,
|
|
10535
|
+
errors,
|
|
10536
|
+
data: input
|
|
10537
|
+
};
|
|
10538
|
+
}
|
|
10539
|
+
return {
|
|
10540
|
+
success: true,
|
|
10541
|
+
data: input
|
|
10542
|
+
};
|
|
10543
|
+
};
|
|
10544
|
+
})()
|
|
10545
|
+
} ]
|
|
10546
|
+
}
|
|
10547
|
+
};
|
|
10548
|
+
|
|
10549
|
+
const transformTestWriteHistories = props => [ {
|
|
10550
|
+
id: v4(),
|
|
10551
|
+
created_at: (new Date).toISOString(),
|
|
10552
|
+
type: "systemMessage",
|
|
10553
|
+
text: '# E2E Test Function Writing AI Agent System Prompt\n\n## 1. Overview\n\nYou are a specialized AI Agent for writing E2E test functions targeting backend server APIs. Your core mission is to generate complete and accurate E2E test code based on provided test scenarios, DTO definitions, SDK libraries, and mock functions.\n\nYou will receive 4 types of input materials: (1) Test scenarios to be executed (2) TypeScript DTO definition files (3) Type-safe SDK library (4) Mock functions filled with random data. Based on these materials, you must write E2E tests that completely reproduce actual business flows. In particular, you must precisely analyze API functions and DTO types to discover and implement essential steps not explicitly mentioned in scenarios.\n\nDuring the writing process, you must adhere to 5 core principles: implement all scenario steps in order without omission, write complete JSDoc-style comments, follow consistent function naming conventions, use only the provided SDK for API calls, and perform type validation on all responses.\n\nThe final deliverable must be a complete E2E test function ready for use in production environments, satisfying code completeness, readability, and maintainability. You must prioritize completeness over efficiency, implementing all steps specified in scenarios without omission, even for complex and lengthy processes.\n\n**CRITICAL IMPORT RULE**: You must NEVER write any `import` statements. Start your function directly with `export async function`. All necessary dependencies (typia, api, types, TestValidator) are assumed to be already available in the global scope.\n\n## 2. Input Material Composition\n\nThe Agent will receive the following 4 core input materials and must perform deep analysis and understanding beyond superficial reading. Rather than simply following given scenarios, you must identify the interrelationships among all input materials and discover potential requirements.\n\n### 2.1. Test Scenarios\n- Test scenarios written in narrative form by AI after analyzing API functions and their definitions\n- Include prerequisite principles and execution order that test functions **must** follow\n- Specify complex business flows step by step, with each step being **non-omittable**\n\n**Deep Analysis Requirements:**\n- **Business Context Understanding**: Grasp why each step is necessary and what meaning it has in actual user scenarios\n- **Implicit Prerequisite Discovery**: Identify intermediate steps that are not explicitly mentioned in scenarios but are naturally necessary (e.g., login session maintenance, data state transitions)\n- **Dependency Relationship Mapping**: Track how data generated in each step is used in subsequent steps\n- **Exception Consideration**: Anticipate errors or exceptional cases that may occur in each step\n- **Business Rule Inference**: Understand domain-specific business rules and constraints hidden in scenario backgrounds\n\n**Scenario Example:**\n```\nValidate the modification of review posts.\n\nHowever, the fact that customers can write review posts in a shopping mall means that the customer has already joined the shopping mall, completed product purchase and payment, and the seller has completed delivery.\n\nTherefore, in this test function, all of these must be carried out, so before writing a review post, all of the following preliminary tasks must be performed. It will be quite a long process.\n\n1. Seller signs up\n2. Seller registers a product\n3. Customer signs up\n4. Customer views the product in detail\n5. Customer adds the product to shopping cart\n6. Customer places a purchase order\n7. Customer confirms purchase and makes payment\n8. Seller confirms order and processes delivery\n9. Customer writes a review post\n10. Customer modifies the review post\n11. Re-view the review post to confirm modifications.\n```\n\n### 2.2. DTO (Data Transfer Object) Definition Files\n- Data transfer objects composed of TypeScript type definitions\n- Include all type information used in API requests/responses\n- Support nested namespace and interface structures, utilizing `typia` tags\n\n**Deep Analysis Requirements:**\n- **Type Constraint Analysis**: Complete understanding of validation rules like `tags.Format<"uuid">`, `tags.MinItems<1>`, `tags.Minimum<0>`\n- **Interface Inheritance Relationship Analysis**: Analyze relationships between types through `extends`, `Partial<>`, `Omit<>`\n- **Namespace Structure Exploration**: Understand the purpose and usage timing of nested types like `ICreate`, `IUpdate`, `ISnapshot`\n- **Required/Optional Field Distinction**: Understand which fields are required and optional, and their respective business meanings\n- **Data Transformation Pattern Identification**: Track data lifecycle like Create → Entity → Update → Snapshot\n- **Type Safety Requirements**: Understand exact type matching and validation logic required by each API\n\n### 2.3. SDK (Software Development Kit) Library\n- TypeScript functions corresponding to each API endpoint\n- Ensures type-safe API calls and is automatically generated by Nestia\n- Includes complete function signatures, metadata, and path information\n\n**Deep Analysis Requirements:**\n- **API Endpoint Classification**: Understand functional and role-based API grouping through namespace structure\n- **Parameter Structure Analysis**: Distinguish roles of path parameters, query parameters, and body in Props type\n- **HTTP Method Meaning Understanding**: Understand the meaning of each method (POST, GET, PUT, DELETE) in respective business logic\n- **Response Type Mapping**: Understand relationships between Output types and actual business objects\n- **Permission System Analysis**: Understand access permission structure through namespaces like `sellers`, `customers`\n- **API Call Order**: Understand dependency relationships of other APIs that must precede specific API calls\n- **Error Handling Methods**: Predict possible HTTP status codes and error conditions for each API\n\n### 2.4. Random-based Mock E2E Functions\n- Basic templates filled with `typia.random<T>()` for parameters without actual business logic\n- **Guide Role**: Show function call methods, type usage, and parameter patterns\n- When implementing, refer to this template structure but completely replace the content\n\n**Deep Analysis Requirements:**\n- **Function Signature Understanding**: Understand the meaning of `connection: api.IConnection` parameter and `Promise<void>` return type\n- **SDK Call Method**: Understand parameter structuring methods when calling API functions and `satisfies` keyword usage patterns\n- **Type Validation Pattern**: Understand `typia.assert()` usage and application timing\n- **Actual Data Requirements**: Understand how to compose actual business-meaningful data to replace `typia.random<T>()`\n- **Code Style Consistency**: Maintain consistency with existing codebase including indentation, variable naming, comment style\n- **Test Function Naming**: Understand existing naming conventions and apply them consistently to new test function names\n\n**Random-based Mock E2E Test Function Example:**\n```typescript\nexport const test_api_shoppings_customers_sales_reviews_update = async (\n connection: api.IConnection,\n) => {\n const output: IShoppingSaleReview.ISnapshot =\n await api.functional.shoppings.customers.sales.reviews.update(connection, {\n saleId: typia.random<string & Format<"uuid">>(),\n id: typia.random<string & Format<"uuid">>(),\n body: typia.random<IShoppingSaleReview.IUpdate>(),\n });\n typia.assert(output);\n};\n```\n\n**Comprehensive Analysis Approach:**\nThe Agent must understand the **interrelationships** among these 4 input materials beyond analyzing them individually. You must comprehensively understand how business flows required by scenarios can be implemented with DTOs and SDK, and how mock function structures map to actual requirements. Additionally, you must infer **unspecified parts** from given materials and proactively discover **additional elements needed** for complete E2E testing.\n\n### 2.5. Typia Guide\n\nWhen defining validation rules for input or response structures using `typia`, you **must** utilize `tags` exclusively through the `tags` namespace provided by the `typia` module. This ensures strict type safety, clarity, and compatibility with automated code generation and schema extraction.\nFor example, to use tags.Format<\'uuid\'>, you must reference it as tags.Format, not simply Format.\n\n#### 2.5.1. Correct Usage Examples\n\n```ts\nexport interface IUser {\n username: string & tags.MinLength<3> & tags.MaxLength<20>;\n email: string & tags.Format<"email">;\n age: number & tags.Type<"uint32"> & tags.Minimum<18>;\n}\n```\n\n### 2.5.2. Invalid Usage Examples\n\n```ts\nexport interface IUser {\n username: string & MinLength<3> & MaxLength<20>;\n email: string & Format<"email">;\n age: number & Type<"uint32"> & Minimum<18>;\n}\n```\n\n## 3. Core Writing Principles\n\n### 3.1. No Import Statements Rule\n- **ABSOLUTE RULE**: Never write any `import` statements at the beginning of your code\n- Start your response directly with `export async function`\n- Assume all dependencies are globally available:\n - `typia` for type validation and random data generation\n - `api` for SDK function calls\n - All DTO types (IShoppingSeller, IShoppingCustomer, etc.)\n - `TestValidator` for validation utilities\n - `Format` and other type utilities\n\n### 3.2. Scenario Adherence Principles\n- **Absolute Principle**: Complete implementation of all steps specified in test scenarios in order\n - If "11 steps" are specified in a scenario, all 11 steps must be implemented\n - Changing step order or skipping steps is **absolutely prohibited**\n - **Prioritize completeness over efficiency**\n- No step in scenarios can be omitted or changed\n - "Seller signs up" → Must call seller signup API\n - "Customer views the product in detail" → Must call product view API\n - More specific step descriptions require more accurate implementation\n- Strictly adhere to logical order and dependencies of business flows\n - Example: Product registration → Signup → Shopping cart → Order → Payment → Delivery → Review creation → Review modification\n - Each step depends on results (IDs, objects, etc.) from previous steps, so order cannot be changed\n - Data dependencies: `sale.id`, `order.id`, `review.id` etc. must be used in subsequent steps\n- **Proactive Scenario Analysis**: Discover and implement essential steps not explicitly mentioned\n - Precisely analyze provided API functions and DTO types\n - Identify intermediate steps needed for business logic completion\n - Add validation steps necessary for data integrity even if not in scenarios\n\n### 3.3. Comment Writing Principles\n- **Required**: Write complete scenarios in JSDoc format at the top of test functions\n- Include scenario background explanation and overall process\n- Clearly document step-by-step numbers and descriptions\n- Explain business context of why such complex processes are necessary\n- **Format**: Use `/** ... */` block comments\n\n### 3.4. Function Naming Conventions\n- **Basic Format**: `test_api_{domain}_{action}_{specific_scenario}`\n- **prefix**: Must start with `test_api_`\n- **domain**: Reflect API endpoint domain and action (e.g., `shopping`, `customer`, `seller`)\n- **scenario**: Express representative name or characteristics of scenario (e.g., `review_update`, `login_failure`)\n- **Examples**: `test_api_shopping_sale_review_update`, `test_api_customer_authenticate_login_failure`\n\n### 3.5. SDK Usage Principles\n- **Required**: All API calls must use provided SDK functions\n- Direct HTTP calls or other methods are **absolutely prohibited**\n- Adhere to exact parameter structure and types of SDK functions\n- Call functions following exact namespace paths (`api.functional.shoppings.sellers...`)\n- **Important**: Use `satisfies` keyword in request body to enhance type safety\n - Example: `body: { ... } satisfies IShoppingSeller.IJoin`\n - Prevent compile-time type errors and support IDE auto-completion\n\n### 3.6. Type Validation Principles\n- **Basic Principle**: Perform `typia.assert(value)` when API response is not `void`\n- Ensure runtime type safety for all important objects and responses\n- Configure tests to terminate immediately upon type validation failure for clear error cause identification\n\n## 4. Detailed Implementation Guidelines\n\n### 4.1. Function Structure (Without Imports)\n```typescript\n/**\n * [Clearly explain test purpose]\n * \n * [Explain business context and necessity]\n * \n * [Step-by-step process]\n * 1. First step\n * 2. Second step\n * ...\n */\nexport async function test_api_{naming_convention}(\n connection: api.IConnection,\n): Promise<void> {\n // Implementation for each step\n}\n```\n\n### 4.2. Variable Declaration and Type Specification\n- Declare each API call result with clear types (`const seller: IShoppingSeller = ...`)\n- Write variable names meaningfully reflecting business domain\n- Use consistent naming convention (camelCase)\n- Prefer explicit type declaration over type inference\n\n### 4.3. API Call Patterns\n- Use exact namespace paths of SDK functions\n- Strictly adhere to parameter object structure\n- Use `satisfies` keyword in request body to enhance type safety\n\n### 4.4. Authentication and Session Management\n- Handle appropriate login/logout when multiple user roles are needed in test scenarios\n- Adhere to API call order appropriate for each role\'s permissions\n- **Important**: Clearly mark account switching points with comments\n- Example: Seller → Customer → Seller account switching\n- Accurately distinguish APIs accessible only after login in respective sessions\n\n### 4.5. Data Consistency Validation\n\n* Avoid using `TestValidator.notEquals()`. To assert that `b` is not of type `a`, write:\n `TestValidator.equals(false)(typia.is<typeof a>(b))`.\n* You **must** use validation functions from `TestValidator` — do **not** use `typia.is`, `typia.assert`, Node\'s `assert`, or Jest\'s `expect`.\n Using `TestValidator` ensures failure messages are descriptive via the `title`, making debugging much easier.\n* Appropriately validate ID matching, state transitions, and data integrity.\n* When comparing arrays or objects, ensure structural accuracy.\n* **Format**: `TestValidator.equals("description")(expected)(actual)`\n* Always include a clear description to provide meaningful error messages on test failure.\n* **Error Case Validation**: For expected error scenarios, use `TestValidator.error()` or `TestValidator.httpError()`.\n\n### 4.6. Test Validator Usage Guidelines\n\n#### ✅ Purpose\n\nThe `TestValidator` utility is required for all test assertions to ensure consistency, readability, and easier debugging. It provides descriptive error messages through the use of a `title`.\n\n#### ✅ Standard Usage Format\n\n```ts\nTestValidator.equals("description")(expected)(actual);\n```\n\n* `description`: A short, clear explanation of the test purpose\n* `expected`: The expected value\n* `actual`: The actual value being tested\n\n#### ✅ Examples\n\n```ts\nTestValidator.equals("Check commit existence and type")("object")(typeof system.commit);\nTestValidator.equals("Validate array length")(3)(data.length);\nTestValidator.equals("Assert value is not of type A")(false)(typia.is<typeof A>(b));\n```\n\n#### 🚫 Incorrect Usage Examples\n\n```ts\nTestValidator.equals("Wrong usage")("object", typeof system.commit)(typeof system.commit); // ❌ Invalid currying\nexpect(x).toBe(y); // ❌ Do not use Jest\'s expect\nassert.equal(x, y); // ❌ Do not use Node.js assert\ntypia.assert(x); // ❌ Do not use typia.assert directly\n```\n\n#### 💡 Additional Guidelines\n\n* To assert a value is **not** of a given type, use:\n `TestValidator.equals(false)(typia.is<Type>(value))`\n* **Never** use `typia.is`, `typia.assert`, `expect`, or `assert` directly in tests.\n Only `TestValidator` functions must be used to maintain consistent test behavior and clear failure messages.\n* For error case validation, use `TestValidator.error()` or `TestValidator.httpError()`.\n\n\n## 5. Complete Implementation Example\n\nThe following is a complete example of E2E test function that should actually be written (starting directly with export, no imports):\n\n```typescript\n/**\n * Validate the modification of review posts.\n *\n * However, the fact that customers can write review posts in a shopping mall means \n * that the customer has already joined the shopping mall, completed product purchase \n * and payment, and the seller has completed delivery.\n *\n * Therefore, in this test function, all of these must be carried out, so before \n * writing a review post, all of the following preliminary tasks must be performed. \n * It will be quite a long process.\n *\n * 1. Seller signs up\n * 2. Seller registers a product\n * 3. Customer signs up\n * 4. Customer views the product in detail\n * 5. Customer adds the product to shopping cart\n * 6. Customer places a purchase order\n * 7. Customer confirms purchase and makes payment\n * 8. Seller confirms order and processes delivery\n * 9. Customer writes a review post\n * 10. Customer modifies the review post\n * 11. Re-view the review post to confirm modifications.\n */\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n): Promise<void> {\n // 1. Seller signs up\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n name: "John Doe",\n nickname: "john-doe",\n mobile: "821011112222",\n password: "1234",\n } satisfies IShoppingSeller.IJoin,\n },\n );\n typia.assert(seller);\n\n // 2. Seller registers a product\n const sale: IShoppingSale = \n await api.functional.shoppings.sellers.sales.create(\n connection,\n {\n body: {\n name: "Sample Product",\n description: "This is a sample product for testing",\n price: 10000,\n currency: "KRW",\n category: "electronics",\n units: [{\n name: "Default Unit",\n primary: true,\n stocks: [{\n name: "Default Stock",\n quantity: 100,\n price: 10000,\n }],\n }],\n images: [],\n tags: [],\n } satisfies IShoppingSale.ICreate,\n },\n );\n typia.assert(sale);\n\n // 3. Customer signs up\n const customer: IShoppingCustomer = \n await api.functional.shoppings.customers.authenticate.join(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n name: "Jaxtyn",\n nickname: "anonymous",\n mobile: "821033334444",\n password: "1234",\n } satisfies IShoppingCustomer.IJoin,\n },\n );\n typia.assert(customer);\n \n // 4. Customer views the product in detail\n const saleReloaded: IShoppingSale = \n await api.functional.shoppings.customers.sales.at(\n connection,\n {\n id: sale.id,\n },\n );\n typia.assert(saleReloaded);\n TestValidator.equals("sale")(sale.id)(saleReloaded.id);\n\n // 5. Customer adds the product to shopping cart\n const commodity: IShoppingCartCommodity = \n await api.functional.shoppings.customers.carts.commodities.create(\n connection,\n {\n body: {\n sale_id: sale.id,\n stocks: sale.units.map((u) => ({\n unit_id: u.id,\n stock_id: u.stocks[0].id,\n quantity: 1,\n })),\n volume: 1,\n } satisfies IShoppingCartCommodity.ICreate,\n },\n );\n typia.assert(commodity);\n\n // 6. Customer places a purchase order\n const order: IShoppingOrder = \n await api.functional.shoppings.customers.orders.create(\n connection,\n {\n body: {\n goods: [\n {\n commodity_id: commodity.id,\n volume: 1,\n },\n ],\n } satisfies IShoppingOrder.ICreate,\n }\n );\n typia.assert(order);\n\n // 7. Customer confirms purchase and makes payment\n const publish: IShoppingOrderPublish = \n await api.functional.shoppings.customers.orders.publish.create(\n connection,\n {\n orderId: order.id,\n body: {\n address: {\n mobile: "821033334444",\n name: "Jaxtyn",\n country: "South Korea",\n province: "Seoul",\n city: "Seoul Seocho-gu",\n department: "Wrtn Apartment",\n possession: "140-1415",\n zip_code: "08273",\n },\n vendor: {\n code: "@payment-vendor-code",\n uid: "@payment-transaction-uid",\n },\n } satisfies IShoppingOrderPublish.ICreate,\n },\n );\n typia.assert(publish);\n\n // Switch to seller account\n await api.functional.shoppings.sellers.authenticate.login(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n password: "1234",\n } satisfies IShoppingSeller.ILogin,\n },\n );\n\n // 8. Seller confirms order and processes delivery\n const orderReloaded: IShoppingOrder = \n await api.functional.shoppings.sellers.orders.at(\n connection,\n {\n id: order.id,\n }\n );\n typia.assert(orderReloaded);\n TestValidator.equals("order")(order.id)(orderReloaded.id);\n\n const delivery: IShoppingDelivery = \n await api.functional.shoppings.sellers.deliveries.create(\n connection,\n {\n body: {\n pieces: order.goods.map((g) => \n g.commodity.stocks.map((s) => ({\n publish_id: publish.id,\n good_id: g.id,\n stock_id: s.id,\n quantity: 1,\n }))).flat(),\n journeys: [\n {\n type: "delivering",\n title: "Delivering",\n description: null,\n started_at: new Date().toISOString(),\n completed_at: new Date().toISOString(),\n },\n ],\n shippers: [\n {\n company: "Lozen",\n name: "QuickMan",\n mobile: "01055559999",\n }\n ],\n } satisfies IShoppingDelivery.ICreate\n }\n )\n typia.assert(delivery);\n\n // Switch back to customer account\n await api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n );\n\n // 9. Customer writes a review post\n const review: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.create(\n connection,\n {\n saleId: sale.id,\n body: {\n good_id: order.goods[0].id,\n title: "Some title",\n body: "Some content body",\n format: "md",\n files: [],\n score: 100,\n } satisfies IShoppingSaleReview.ICreate,\n },\n );\n typia.assert(review);\n\n // 10. Customer modifies the review post\n const snapshot: IShoppingSaleReview.ISnapshot = \n await api.functional.shoppings.customers.sales.reviews.update(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n body: {\n title: "Some new title",\n body: "Some new content body",\n } satisfies IShoppingSaleReview.IUpdate,\n },\n );\n typia.assert(snapshot);\n\n // 11. Re-view the review post to confirm modifications\n const read: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.at(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n },\n );\n typia.assert(read);\n TestValidator.equals("snapshots")(read.snapshots)([\n ...review.snapshots,\n snapshot,\n ]);\n}\n```\n\n## 6. Error Scenario Testing\n\n### 6.1. Purpose and Importance of Error Testing\nE2E testing must verify that systems operate correctly not only in normal business flows but also in expected error situations. It\'s important to confirm that appropriate HTTP status codes and error messages are returned in situations like incorrect input, unauthorized access, requests for non-existent resources.\n\n### 6.2. Error Validation Function Usage\n- **TestValidator.error()**: For general error situations where HTTP status code cannot be determined with certainty\n- **TestValidator.httpError()**: When specific HTTP status code can be determined with confidence\n- **Format**: `TestValidator.httpError("description")(statusCode)(() => APICall)`\n\n### 6.3. Error Test Writing Principles\n- **Clear Failure Conditions**: Clearly set conditions that should intentionally fail\n- **Appropriate Test Data**: Simulate realistic error situations like non-existent emails, incorrect passwords\n- **Concise Structure**: Unlike normal flows, compose error tests with minimal steps\n- **Function Naming Convention**: `test_api_{domain}_{action}_failure` or `test_api_{domain}_{action}_{specific_error}`\n- **CRITICAL**: Never use `// @ts-expect-error` comments when testing error cases. These functions test **runtime errors**, not compilation errors. The TypeScript code should compile successfully while the API calls are expected to fail at runtime.\n\n### 6.4. Error Test Example (Without Imports)\n\n```typescript\n/**\n * Validate customer login failure.\n * \n * Verify that appropriate error response is returned when attempting \n * to login with a non-existent email address.\n */\nexport async function test_api_customer_authenticate_login_failure(\n connection: api.IConnection,\n): Promise<void> {\n await TestValidator.httpError("login failure")(403)(() =>\n api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "never-existing-email@sadfasdfasdf.com",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n ),\n );\n}\n```\n\n## 7. Final Checklist\n\nE2E test function writing completion requires verification of the following items:\n\n### 7.1. Essential Element Verification\n- [ ] **NO IMPORT STATEMENTS** - Function starts directly with `export async function`\n- [ ] Are all scenario steps implemented in order?\n- [ ] Are complete JSDoc-style comments written?\n- [ ] Does the function name follow naming conventions (`test_api_{domain}_{action}_{scenario}`)?\n- [ ] Are SDK used for all API calls?\n- [ ] Is the `satisfies` keyword used in request body?\n- [ ] Is `typia.assert` applied where necessary?\n- [ ] Are error test cases written without `// @ts-expect-error` comments?\n\n### 7.2. Quality Element Verification\n- [ ] Are variable names meaningful and consistent?\n- [ ] Are account switches performed at appropriate times?\n- [ ] Is data validation performed correctly?\n- [ ] Is code structure logical with good readability?\n- [ ] Are error scenarios handled appropriately when needed without TypeScript error suppression comments?\n- [ ] Is business logic completeness guaranteed?\n\n**REMEMBER**: Your code must start immediately with `export async function` - never include any import statements at the beginning. All dependencies are assumed to be globally available.\n\nPlease adhere to all these principles and guidelines to write complete and accurate E2E test functions. Your mission is not simply to write code, but to build a robust test system that perfectly reproduces and validates actual business scenarios.'
|
|
10554
|
+
}, {
|
|
10555
|
+
id: v4(),
|
|
10556
|
+
created_at: (new Date).toISOString(),
|
|
10557
|
+
type: "systemMessage",
|
|
10558
|
+
text: '# ✅ `TestValidator`\n\nYou are given access to the `TestValidator` utility, which provides functional testing helpers. It includes assertion helpers (`equals`, `predicate`) and error expectation helpers (`error`, `httpError`). All methods use **currying**, meaning you must call them **step-by-step** in sequence.\n\nThe following are the core functions you may use, along with exact signatures and usage rules:\n\n---\n\n## 🔹 `TestValidator.equals(title)(expected)(actual)`\n\n* **Purpose**: Validates that `expected` and `actual` values are deeply equal.\n* **Currying steps**:\n\n 1. `title: string` — description shown when the comparison fails.\n 2. `expected: T` — the baseline value. Must be the same type or **wider** than `actual`.\n 3. `actual: T` — the value to compare with.\n* **Returns**: `void`\n* **Exception**: Throws an error if `expected` and `actual` differ.\n* **Optional**: You can provide a second argument to `equals(title, exception)` to skip certain keys during comparison.\n\n```ts\nTestValidator.equals("Article must match")(expectedArticle)(receivedArticle);\n```\n\n❗ **Important: Expected value must be wider or equal in type.**\n\n```ts\n// ✅ Correct: actual ("md") is assignable to expected ("md" | "html")\nTestValidator.equals("Format check")(updatedSnapshot.format as "md" | "html")("md" as "md");\n\n// ❌ Incorrect: "md" is not assignable to "md" | "html" → compile-time error\nTestValidator.equals("Format check")("md" as "md")(updatedSnapshot.format as "md" | "html");\n```\n\nThis type direction ensures TypeScript can validate structural compatibility statically.\n\n❗ **Important: Please do not use it to check for the void type.**\n\n```ts\nTestValidator.equals("health check API는 void 반환")(undefined)(output) // Invalid!\n```\n\nYou cannot validate the `void` type directly. If you want to compare a function\'s return type that is `void`, use the following pattern:\n\n```ts\nTestValidator.equals("This type should be void")(typia.is<void>(target))(true); // Good!\n```\n\n\n---\n\n## 🔹 `TestValidator.predicate(title)(condition)`\n\n* **Purpose**: Validates that a boolean condition is true.\n* **Currying steps**:\n\n 1. `title: string` — message used when the condition fails.\n 2. `condition: boolean | () => boolean | () => Promise<boolean>` — condition to evaluate.\n* **Returns**:\n\n * `void` if the condition is synchronous\n * `Promise<void>` if the condition is asynchronous\n* **Exception**: Throws an error with the `title` if the condition is false.\n\n```ts\nTestValidator.predicate("User must be active")(() => user.status === "active");\n```\n\nTo resolve errors like:\n\n```error\nType \'{ page: number; limit: number; sort: string[]; }\' is not assignable to type \'IRequest\'.\n```\n\nit is recommended to use `TestValidator.predicate`.\n\nYou can provide a function that returns a boolean value, such as:\n\n```ts\nTestValidator.predicate("description of what you\'re testing")(() => {\n return typia.is<Type>(targetObj);\n});\n```\n\nThis approach allows you to validate whether the object conforms to the expected type without causing assignment errors.\n\n\n---\n\n## 🔹 `TestValidator.error(title)(task)`\n\n* **Purpose**: Validates that the given task throws an error.\n* **Currying steps**:\n\n 1. `title: string` — message shown when no error is thrown.\n 2. `task: () => any | Promise<any>` — function that is expected to throw.\n* **Returns**:\n\n * `void` or `Promise<void>`\n* **Exception**: Throws an error if the task completes **without** throwing.\n\n```ts\nTestValidator.error("Expected login to fail")(() => login(invalidCredentials));\n```\n\n---\n\n## 🔹 `TestValidator.httpError(title)(...statuses)(task)`\n\n* **Purpose**: Validates that the given task throws an HTTP error with one of the specified status codes.\n* **Currying steps**:\n\n 1. `title: string` — message shown when no HTTP error or unexpected status occurs.\n 2. `...statuses: number[]` — acceptable HTTP error codes.\n 3. `task: () => any | Promise<any>` — function that is expected to fail.\n* **Returns**:\n\n * `void` or `Promise<void>`\n* **Exception**: Throws if no error is thrown, or if the status code does not match any in `statuses`.\n\n```ts\nTestValidator.httpError("Should return 403")(403)(() => accessAdminPage(user));\n```\n\n---\n\n# ⚠️ Currying is Required\n\nEach method uses **currying** — do **not** invoke with all parameters at once. You **must** call each method step by step (e.g., `f(x)(y)(z)`), not as `f(x, y, z)`.\n\n---\n\n# ⚠️ Type Direction Matters in `equals`\n\nThe type of `expected` must be **wider or equal** to the type of `actual`. This allows TypeScript to validate that the actual result conforms to what is expected. Reversing this order may cause a compile-time type error.\n\n```ts\n// ✅ Correct: expected is wider ("md" | "html"), actual is narrower ("md")\nTestValidator.equals("Format check")(updatedSnapshot.format as "md" | "html")("md" as "md");\n\n// ✅ Correct: expected is wider or equal type when comparing snapshots\nconst latest = reloaded.snapshots.at(-1);\nif (!latest) throw new Error("No snapshots found");\nTestValidator.equals("Latest snapshot match")(latest)(updatedSnapshot);\n\n// ❌ Incorrect: expected is narrower ("md"), actual is wider ("md" | "html") → type error\nTestValidator.equals("Format check")("md" as "md")(updatedSnapshot.format as "md" | "html");\n\n// ❌ Incorrect: swapped snapshot order may cause type error\nTestValidator.equals("Latest snapshot match")(updatedSnapshot)(reloaded.snapshots.at(-1));\n```\n\n---\n\n# 🧠 Purpose\n\nUse `TestValidator` in automated tests to assert:\n\n* equality (`equals`)\n* correctness of booleans (`predicate`)\n* expected failure cases (`error`, `httpError`)\n\n---\n\n# 🧪 Example\n\n```ts\nTestValidator.equals("Returned user must match")(expectedUser)(receivedUser);\nTestValidator.predicate("User must be admin")(() => user.role === "admin");\nawait TestValidator.error("Creating with invalid data should fail")(() => createUser(invalidData));\nawait TestValidator.httpError("Forbidden access")(403, 401)(() => accessSecret(user));\n```\n\n# ⚠️ Be Careful with Empty Array Literals and Type Inference in `equals`\n\nWhen using `TestValidator.equals`, be cautious with implicit type inference — especially with empty literals like `[]` or `null`.\n\n## 🔸 Problem: `[]` becomes `never[]`\n\nIf you pass an empty array literal (`[]`) directly as the `expected` value, TypeScript will infer its type as `never[]`, which is unlikely to match the actual data type.\n\n```ts\n// ❌ Incorrect: `[]` is inferred as `never[]`, causing a type mismatch\nTestValidator.equals("Result data should be empty")([])(result.data); // type error\n```\n\n## ✅ Recommended: Declare types explicitly with variables\n\nInstead of passing literals directly, declare variables with explicit types to guide TypeScript\'s inference:\n\n```ts\n// ✅ Correct: declare expected with the proper type\nconst expected: ISummary[] = [];\nconst actual: ISummary[] = result.data;\nTestValidator.equals("Result data should be empty")(expected)(actual);\n```\n\nThis helps ensure type compatibility and avoids hidden inference issues like `never[]`.\n\n---\n\n## 🔸 Problem: Union types like `Type | null`\n\nAnother common mistake is passing a value with a union type (e.g., `Type | null`) as `expected`, while `actual` has a narrower type (e.g., just `Type`). This can lead to errors like:\n\n```\nArgument of type \'(string & Format<"uuid">) | null\' is not assignable to parameter of type \'null\'.\n```\n\n## ✅ Recommended: Align types exactly\n\nUse explicit variable declarations with exact types to prevent such mismatches:\n\n```ts\n// ✅ Correct: Align both types exactly\nconst expected: string & Format<"uuid"> | null = generatedUuid;\nconst actual: string & Format<"uuid"> = response.id;\nTestValidator.equals("UUIDs must match")(expected)(actual);\n```\n\nThis practice helps catch type errors early and ensures that the validator works as intended with strict type checking.\n\n\n# ⚠️ Prefer Property-Level Comparison for Complex Objects\n\nWhen using `TestValidator.equals` to compare objects (especially arrays of objects), it\'s easy to run into subtle type mismatches or unintentional structural differences — such as missing optional fields, different property orders, or union type overlaps.\n\n```ts\n// ❌ Risky: Full object comparison may fail due to minor type differences\nTestValidator.equals("File list updated")([\n { name: "doc", extension: "pdf", url: "https://files.example.com/doc.pdf" },\n])(updatedSnapshot.files);\n```\n\nEven if the runtime values look the same, TypeScript may infer slightly different types for literals vs. actual data, which can lead to confusing type errors.\n\n---\n\n## ✅ Recommended: Compare individual properties explicitly\n\nTo avoid fragile deep comparisons, prefer comparing each property separately:\n\n```ts\nconst file = updatedSnapshot.files[0];\nTestValidator.equals("File name should be \'doc\'")("doc")(file.name);\nTestValidator.equals("File extension should be \'pdf\'")("pdf")(file.extension);\nTestValidator.equals("File URL should match")("https://files.example.com/doc.pdf")(file.url);\n```\n\nThis approach gives:\n\n* Clearer failure messages\n* More precise type checking\n* Easier debugging when only part of the object is incorrect\n\nUse full-object comparison only when the types are tightly controlled and guaranteed to match exactly.'
|
|
10559
|
+
}, {
|
|
10560
|
+
id: v4(),
|
|
10561
|
+
created_at: (new Date).toISOString(),
|
|
10562
|
+
type: "systemMessage",
|
|
10563
|
+
text: "### ❌ Line terminator not permitted before arrow.\n\nWhen you get a syntax error saying \"`Line terminator not permitted before arrow.`\", it means the arrow `=>` is placed at the start of a new line, which is invalid.\n\n**Fix this by placing `=>` at the end of the previous line**, for example:\n\n```ts\n() => api.doSomething()\n```\n\ninstead of\n\n```ts\n()\n=> api.doSomething()\n```\n\nAlternatively, use a block body with braces:\n\n```ts\n() => {\n return api.doSomething();\n}\n```\n\n### ❌ The operand of a 'delete' operator must be optional\n\nWhen you get a TypeScript error like:\n\n```\nThe operand of a 'delete' operator must be optional.\n```\n\nIt means you're trying to use the `delete` operator on a **non-optional property**, which is not allowed in strict mode.\n\nFor example:\n\n```ts\ntype User = { name: string };\nconst user: User = { name: \"Alice\" };\n\ndelete user.name; // ❌ Error: 'name' is not optional\n```\n\n#### ✅ Fix this by making the property optional:\n\n```ts\ntype User = { name?: string }; // name is now optional\nconst user: User = { name: \"Alice\" };\n\ndelete user.name; // ✅ OK\n```\n\n#### ✅ Or avoid using `delete` altogether:\n\nIn most cases, **you should avoid using `delete`** in TypeScript.\nInstead, explicitly set the value to `undefined`:\n\n```ts\nuser.name = undefined; // ✅ Preferred in most cases\n```\n\n> 🔎 In TypeScript, `delete` is primarily intended for dynamic objects like `Record<string, any>`.\n> When working with structured types (interfaces, classes), prefer marking fields as optional and assigning `undefined` instead of deleting them."
|
|
10564
|
+
}, {
|
|
10565
|
+
id: v4(),
|
|
10566
|
+
created_at: (new Date).toISOString(),
|
|
10567
|
+
type: "assistantMessage",
|
|
10568
|
+
text: [ "Here is the list of input material composition.", "", "Make e2e test functions based on the following information.", "", "## Secnario Plan", "```json", JSON.stringify(props.scenario), "```", "", "## DTO Definitions", "```json", JSON.stringify(props.artifacts.dto), "```", "", "## API (SDK) Functions", "```json", JSON.stringify(props.artifacts.sdk), "```", "", "## E2E Mockup Functions", "```json", JSON.stringify(props.artifacts.e2e), "```", "" ].join("\n")
|
|
10569
|
+
} ];
|
|
10570
|
+
|
|
10571
|
+
async function orchestrateTestWrite(ctx, scenarios) {
|
|
10572
|
+
const start = new Date;
|
|
10573
|
+
let complete = 0;
|
|
10574
|
+
const events = await Promise.all(scenarios.map((async scenario => {
|
|
10575
|
+
const code = await process(ctx, scenario);
|
|
10576
|
+
const event = {
|
|
10577
|
+
type: "testWrite",
|
|
10578
|
+
created_at: start.toISOString(),
|
|
10579
|
+
filename: `test/features/api/${code.domain}/${scenario.functionName}.ts`,
|
|
10580
|
+
content: code.content,
|
|
10581
|
+
completed: ++complete,
|
|
10582
|
+
total: scenarios.length,
|
|
10583
|
+
step: ctx.state().interface?.step ?? 0
|
|
10584
|
+
};
|
|
10585
|
+
ctx.dispatch(event);
|
|
10586
|
+
return event;
|
|
10587
|
+
})));
|
|
10588
|
+
return events;
|
|
10589
|
+
}
|
|
10590
|
+
|
|
10591
|
+
async function process(ctx, scenario) {
|
|
10592
|
+
const pointer = {
|
|
10593
|
+
value: null
|
|
10594
|
+
};
|
|
10595
|
+
const artifacts = await compileTestScenario(ctx, scenario);
|
|
10596
|
+
const agentica = new MicroAgentica({
|
|
10597
|
+
model: ctx.model,
|
|
10598
|
+
vendor: ctx.vendor,
|
|
10599
|
+
config: {
|
|
10600
|
+
...ctx.config ?? {}
|
|
10601
|
+
},
|
|
10602
|
+
histories: transformTestWriteHistories({
|
|
10603
|
+
scenario,
|
|
10604
|
+
artifacts
|
|
10605
|
+
}),
|
|
10606
|
+
controllers: [ createApplication({
|
|
10607
|
+
model: ctx.model,
|
|
10608
|
+
build: next => {
|
|
10609
|
+
pointer.value = next;
|
|
10610
|
+
}
|
|
10611
|
+
}) ],
|
|
10612
|
+
tokenUsage: ctx.usage()
|
|
10613
|
+
});
|
|
10614
|
+
enforceToolCall(agentica);
|
|
10615
|
+
await agentica.conversate("Create e2e test functions.");
|
|
10616
|
+
if (pointer.value === null) throw new Error("Failed to create test code.");
|
|
10617
|
+
const typeReferences = Array.from(new Set(Object.keys(artifacts.document.components.schemas).map((key => key.split(".")[0]))));
|
|
10618
|
+
pointer.value.content = pointer.value.content.replace(/^[ \t]*import\b[\s\S]*?;[ \t]*$/gm, "").trim();
|
|
10619
|
+
pointer.value.content = [ `import { TestValidator } from "@nestia/e2e";`, `import typia, { tags } from "typia";`, "", `import api from "@ORGANIZATION/PROJECT-api";`, ...typeReferences.map((ref => `import type { ${ref} } from "@ORGANIZATION/PROJECT-api/lib/structures/${ref}";`)), "", pointer.value.content ].join("\n");
|
|
10620
|
+
pointer.value.content = pointer.value.content.replaceAll('string & Format<"uuid">', 'string & tags.Format<"uuid">');
|
|
10621
|
+
return pointer.value;
|
|
10622
|
+
}
|
|
10623
|
+
|
|
10624
|
+
function createApplication(props) {
|
|
10625
|
+
assertSchemaModel(props.model);
|
|
10626
|
+
const application = collection$1[props.model];
|
|
10627
|
+
return {
|
|
10628
|
+
protocol: "class",
|
|
10629
|
+
name: "Create Test Code",
|
|
10630
|
+
application,
|
|
10631
|
+
execute: {
|
|
10632
|
+
createTestCode: next => {
|
|
10633
|
+
props.build(next);
|
|
10634
|
+
}
|
|
10635
|
+
}
|
|
10636
|
+
};
|
|
10637
|
+
}
|
|
10638
|
+
|
|
10639
|
+
const claude$1 = {
|
|
10640
|
+
model: "claude",
|
|
10641
|
+
options: {
|
|
10642
|
+
reference: true,
|
|
10643
|
+
separate: null
|
|
10644
|
+
},
|
|
10645
|
+
functions: [ {
|
|
10646
|
+
name: "createTestCode",
|
|
10647
|
+
parameters: {
|
|
10648
|
+
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
10649
|
+
type: "object",
|
|
10650
|
+
properties: {
|
|
10651
|
+
scenario: {
|
|
10652
|
+
title: "Strategic approach for test implementation",
|
|
10653
|
+
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guidelines.\n- Must Planning the test code Never occur the TypeScript compile error.\n- NEVER include import statements in planning or implementation.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guidelines.",
|
|
10654
|
+
type: "string"
|
|
10655
|
+
},
|
|
10656
|
+
domain: {
|
|
10657
|
+
title: "Functional domain classification for test organization",
|
|
10658
|
+
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system',
|
|
10659
|
+
type: "string"
|
|
10660
|
+
},
|
|
10661
|
+
content: {
|
|
10662
|
+
title: "Complete TypeScript E2E test implementation",
|
|
10663
|
+
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following",
|
|
10664
|
+
type: "string"
|
|
10665
|
+
}
|
|
10666
|
+
},
|
|
10667
|
+
required: [ "scenario", "domain", "content" ],
|
|
10668
|
+
additionalProperties: false,
|
|
10669
|
+
$defs: {}
|
|
10670
|
+
},
|
|
10671
|
+
validate: (() => {
|
|
10672
|
+
const _io0 = input => "string" === typeof input.scenario && "string" === typeof input.domain && "string" === typeof input.content;
|
|
10673
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.scenario || _report(_exceptionable, {
|
|
10674
|
+
path: _path + ".scenario",
|
|
10675
|
+
expected: "string",
|
|
10676
|
+
value: input.scenario
|
|
10677
|
+
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
10678
|
+
path: _path + ".domain",
|
|
10679
|
+
expected: "string",
|
|
10680
|
+
value: input.domain
|
|
10681
|
+
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
10682
|
+
path: _path + ".content",
|
|
10683
|
+
expected: "string",
|
|
10684
|
+
value: input.content
|
|
10685
|
+
}) ].every((flag => flag));
|
|
10686
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10687
|
+
let errors;
|
|
10688
|
+
let _report;
|
|
10689
|
+
return input => {
|
|
10690
|
+
if (false === __is(input)) {
|
|
10691
|
+
errors = [];
|
|
10692
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10693
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10694
|
+
path: _path + "",
|
|
10695
|
+
expected: "ICreateTestCodeProps",
|
|
10696
|
+
value: input
|
|
10697
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10698
|
+
path: _path + "",
|
|
10699
|
+
expected: "ICreateTestCodeProps",
|
|
10700
|
+
value: input
|
|
10701
|
+
}))(input, "$input", true);
|
|
10702
|
+
const success = 0 === errors.length;
|
|
10703
|
+
return success ? {
|
|
10704
|
+
success,
|
|
10705
|
+
data: input
|
|
10706
|
+
} : {
|
|
10707
|
+
success,
|
|
10708
|
+
errors,
|
|
10709
|
+
data: input
|
|
10710
|
+
};
|
|
10711
|
+
}
|
|
10712
|
+
return {
|
|
10713
|
+
success: true,
|
|
10714
|
+
data: input
|
|
10715
|
+
};
|
|
10716
|
+
};
|
|
10717
|
+
})()
|
|
10718
|
+
} ]
|
|
10719
|
+
};
|
|
10720
|
+
|
|
10721
|
+
const collection$1 = {
|
|
10722
|
+
chatgpt: {
|
|
10723
|
+
model: "chatgpt",
|
|
10724
|
+
options: {
|
|
10725
|
+
reference: true,
|
|
10726
|
+
strict: false,
|
|
10727
|
+
separate: null
|
|
10728
|
+
},
|
|
10729
|
+
functions: [ {
|
|
10730
|
+
name: "createTestCode",
|
|
10731
|
+
parameters: {
|
|
10732
|
+
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
10733
|
+
type: "object",
|
|
10734
|
+
properties: {
|
|
10735
|
+
scenario: {
|
|
10736
|
+
title: "Strategic approach for test implementation",
|
|
10737
|
+
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guidelines.\n- Must Planning the test code Never occur the TypeScript compile error.\n- NEVER include import statements in planning or implementation.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guidelines.",
|
|
10738
|
+
type: "string"
|
|
10739
|
+
},
|
|
10740
|
+
domain: {
|
|
10741
|
+
title: "Functional domain classification for test organization",
|
|
10742
|
+
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system',
|
|
10743
|
+
type: "string"
|
|
10744
|
+
},
|
|
10745
|
+
content: {
|
|
10746
|
+
title: "Complete TypeScript E2E test implementation",
|
|
10747
|
+
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following",
|
|
10748
|
+
type: "string"
|
|
10749
|
+
}
|
|
10750
|
+
},
|
|
10751
|
+
required: [ "scenario", "domain", "content" ],
|
|
10752
|
+
additionalProperties: false,
|
|
10753
|
+
$defs: {}
|
|
10754
|
+
},
|
|
10755
|
+
validate: (() => {
|
|
10756
|
+
const _io0 = input => "string" === typeof input.scenario && "string" === typeof input.domain && "string" === typeof input.content;
|
|
10757
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.scenario || _report(_exceptionable, {
|
|
10758
|
+
path: _path + ".scenario",
|
|
10759
|
+
expected: "string",
|
|
10760
|
+
value: input.scenario
|
|
10761
|
+
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
10762
|
+
path: _path + ".domain",
|
|
10763
|
+
expected: "string",
|
|
10764
|
+
value: input.domain
|
|
10765
|
+
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
10766
|
+
path: _path + ".content",
|
|
10767
|
+
expected: "string",
|
|
10768
|
+
value: input.content
|
|
10769
|
+
}) ].every((flag => flag));
|
|
10770
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10771
|
+
let errors;
|
|
10772
|
+
let _report;
|
|
10773
|
+
return input => {
|
|
10774
|
+
if (false === __is(input)) {
|
|
10775
|
+
errors = [];
|
|
10776
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10777
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10778
|
+
path: _path + "",
|
|
10779
|
+
expected: "ICreateTestCodeProps",
|
|
10491
10780
|
value: input
|
|
10492
10781
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10493
10782
|
path: _path + "",
|
|
10494
|
-
expected: "
|
|
10783
|
+
expected: "ICreateTestCodeProps",
|
|
10495
10784
|
value: input
|
|
10496
10785
|
}))(input, "$input", true);
|
|
10497
10786
|
const success = 0 === errors.length;
|
|
@@ -10524,199 +10813,44 @@ const collection$1 = {
|
|
|
10524
10813
|
separate: null
|
|
10525
10814
|
},
|
|
10526
10815
|
functions: [ {
|
|
10527
|
-
name: "
|
|
10816
|
+
name: "createTestCode",
|
|
10528
10817
|
parameters: {
|
|
10529
10818
|
type: "object",
|
|
10530
10819
|
properties: {
|
|
10531
|
-
|
|
10532
|
-
type: "
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
type: "string",
|
|
10546
|
-
enum: [ "get", "post", "put", "delete", "patch" ],
|
|
10547
|
-
title: "HTTP method of the API operation",
|
|
10548
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record"
|
|
10549
|
-
}
|
|
10550
|
-
},
|
|
10551
|
-
required: [ "path", "method" ],
|
|
10552
|
-
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10553
|
-
additionalProperties: false
|
|
10554
|
-
},
|
|
10555
|
-
scenarios: {
|
|
10556
|
-
type: "array",
|
|
10557
|
-
items: {
|
|
10558
|
-
type: "object",
|
|
10559
|
-
properties: {
|
|
10560
|
-
draft: {
|
|
10561
|
-
type: "string",
|
|
10562
|
-
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple test scenarios."
|
|
10563
|
-
},
|
|
10564
|
-
functionName: {
|
|
10565
|
-
type: "string",
|
|
10566
|
-
title: "Descriptive function name derived from the user scenario",
|
|
10567
|
-
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions"
|
|
10568
|
-
},
|
|
10569
|
-
dependsOn: {
|
|
10570
|
-
type: "array",
|
|
10571
|
-
items: {
|
|
10572
|
-
type: "object",
|
|
10573
|
-
properties: {
|
|
10574
|
-
endpoint: {
|
|
10575
|
-
type: "object",
|
|
10576
|
-
properties: {
|
|
10577
|
-
path: {
|
|
10578
|
-
type: "string",
|
|
10579
|
-
title: "HTTP path of the API operation",
|
|
10580
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage."
|
|
10581
|
-
},
|
|
10582
|
-
method: {
|
|
10583
|
-
type: "string",
|
|
10584
|
-
enum: [ "get", "post", "put", "delete", "patch" ],
|
|
10585
|
-
title: "HTTP method of the API operation",
|
|
10586
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record"
|
|
10587
|
-
}
|
|
10588
|
-
},
|
|
10589
|
-
required: [ "path", "method" ],
|
|
10590
|
-
description: "Target API endpoint that must be executed before the main operation.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10591
|
-
additionalProperties: false
|
|
10592
|
-
},
|
|
10593
|
-
purpose: {
|
|
10594
|
-
type: "string",
|
|
10595
|
-
description: 'A concise exscenarioation of why this API call is required before\nexecuting the test for the main operation.\n\nExample: "Creates a category so that a product can be linked to it during\ncreation."'
|
|
10596
|
-
}
|
|
10597
|
-
},
|
|
10598
|
-
required: [ "endpoint", "purpose" ],
|
|
10599
|
-
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependsOn}",
|
|
10600
|
-
additionalProperties: false
|
|
10601
|
-
},
|
|
10602
|
-
description: "A list of other API endpoints that must be executed before this test\nscenario. This helps express dependencies such as data creation or\nauthentication steps required to reach the intended test state."
|
|
10603
|
-
}
|
|
10604
|
-
},
|
|
10605
|
-
required: [ "draft", "functionName", "dependsOn" ],
|
|
10606
|
-
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface extends `AutoBeOpenApi.IEndpoint`, inheriting its HTTP\n> method and path information, and adds two key properties:\n> \n> - `draft`: A free-form, human-readable test scenario description for the API\n> endpoint.\n> - `dependsOn`: A list of other API endpoints that must be invoked beforehand\n> in order to prepare the context for this test. Each dependency includes\n> the purpose of the dependency.\n> \n> This structure is intended to help organize test specifications for complex\n> workflows and ensure that all prerequisites are explicitly declared.",
|
|
10607
|
-
additionalProperties: false
|
|
10608
|
-
},
|
|
10609
|
-
title: "Array of test scenarios",
|
|
10610
|
-
description: "Array of test scenarios."
|
|
10611
|
-
}
|
|
10612
|
-
},
|
|
10613
|
-
required: [ "endpoint", "scenarios" ],
|
|
10614
|
-
description: "Current Type: {@link IAutoBeTestScenarioApplication.IScenarioGroup}",
|
|
10615
|
-
additionalProperties: false
|
|
10616
|
-
},
|
|
10617
|
-
title: "Array of test scenario groups",
|
|
10618
|
-
description: "Array of test scenario groups."
|
|
10820
|
+
scenario: {
|
|
10821
|
+
type: "string",
|
|
10822
|
+
title: "Strategic approach for test implementation",
|
|
10823
|
+
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guidelines.\n- Must Planning the test code Never occur the TypeScript compile error.\n- NEVER include import statements in planning or implementation.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guidelines."
|
|
10824
|
+
},
|
|
10825
|
+
domain: {
|
|
10826
|
+
type: "string",
|
|
10827
|
+
title: "Functional domain classification for test organization",
|
|
10828
|
+
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system'
|
|
10829
|
+
},
|
|
10830
|
+
content: {
|
|
10831
|
+
type: "string",
|
|
10832
|
+
title: "Complete TypeScript E2E test implementation",
|
|
10833
|
+
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following"
|
|
10619
10834
|
}
|
|
10620
10835
|
},
|
|
10621
|
-
required: [ "
|
|
10622
|
-
description: "
|
|
10836
|
+
required: [ "scenario", "domain", "content" ],
|
|
10837
|
+
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
10623
10838
|
additionalProperties: false
|
|
10624
10839
|
},
|
|
10625
|
-
description: "Make test scenarios for the given endpoints.",
|
|
10626
10840
|
validate: (() => {
|
|
10627
|
-
const _io0 = input =>
|
|
10628
|
-
const
|
|
10629
|
-
|
|
10630
|
-
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependsOn) && input.dependsOn.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
10631
|
-
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
10632
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
10633
|
-
path: _path + ".scenarioGroups",
|
|
10634
|
-
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10635
|
-
value: input.scenarioGroups
|
|
10636
|
-
})) && input.scenarioGroups.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10637
|
-
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10638
|
-
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10639
|
-
value: elem
|
|
10640
|
-
})) && _vo1(elem, _path + ".scenarioGroups[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10641
|
-
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10642
|
-
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10643
|
-
value: elem
|
|
10644
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10645
|
-
path: _path + ".scenarioGroups",
|
|
10646
|
-
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10647
|
-
value: input.scenarioGroups
|
|
10648
|
-
}) ].every((flag => flag));
|
|
10649
|
-
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10650
|
-
path: _path + ".endpoint",
|
|
10651
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10652
|
-
value: input.endpoint
|
|
10653
|
-
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10654
|
-
path: _path + ".endpoint",
|
|
10655
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10656
|
-
value: input.endpoint
|
|
10657
|
-
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10658
|
-
path: _path + ".scenarios",
|
|
10659
|
-
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10660
|
-
value: input.scenarios
|
|
10661
|
-
})) && input.scenarios.map(((elem, _index5) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10662
|
-
path: _path + ".scenarios[" + _index5 + "]",
|
|
10663
|
-
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10664
|
-
value: elem
|
|
10665
|
-
})) && _vo3(elem, _path + ".scenarios[" + _index5 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10666
|
-
path: _path + ".scenarios[" + _index5 + "]",
|
|
10667
|
-
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10668
|
-
value: elem
|
|
10669
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10670
|
-
path: _path + ".scenarios",
|
|
10671
|
-
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10672
|
-
value: input.scenarios
|
|
10673
|
-
}) ].every((flag => flag));
|
|
10674
|
-
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
10675
|
-
path: _path + ".path",
|
|
10676
|
-
expected: "string",
|
|
10677
|
-
value: input.path
|
|
10678
|
-
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
10679
|
-
path: _path + ".method",
|
|
10680
|
-
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
10681
|
-
value: input.method
|
|
10682
|
-
}) ].every((flag => flag));
|
|
10683
|
-
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.draft || _report(_exceptionable, {
|
|
10684
|
-
path: _path + ".draft",
|
|
10841
|
+
const _io0 = input => "string" === typeof input.scenario && "string" === typeof input.domain && "string" === typeof input.content;
|
|
10842
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.scenario || _report(_exceptionable, {
|
|
10843
|
+
path: _path + ".scenario",
|
|
10685
10844
|
expected: "string",
|
|
10686
|
-
value: input.
|
|
10687
|
-
}), "string" === typeof input.
|
|
10688
|
-
path: _path + ".
|
|
10845
|
+
value: input.scenario
|
|
10846
|
+
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
10847
|
+
path: _path + ".domain",
|
|
10689
10848
|
expected: "string",
|
|
10690
|
-
value: input.
|
|
10691
|
-
}),
|
|
10692
|
-
path: _path + ".
|
|
10693
|
-
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
10694
|
-
value: input.dependsOn
|
|
10695
|
-
})) && input.dependsOn.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10696
|
-
path: _path + ".dependsOn[" + _index6 + "]",
|
|
10697
|
-
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
10698
|
-
value: elem
|
|
10699
|
-
})) && _vo4(elem, _path + ".dependsOn[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10700
|
-
path: _path + ".dependsOn[" + _index6 + "]",
|
|
10701
|
-
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
10702
|
-
value: elem
|
|
10703
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10704
|
-
path: _path + ".dependsOn",
|
|
10705
|
-
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
10706
|
-
value: input.dependsOn
|
|
10707
|
-
}) ].every((flag => flag));
|
|
10708
|
-
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10709
|
-
path: _path + ".endpoint",
|
|
10710
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10711
|
-
value: input.endpoint
|
|
10712
|
-
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10713
|
-
path: _path + ".endpoint",
|
|
10714
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10715
|
-
value: input.endpoint
|
|
10716
|
-
}), "string" === typeof input.purpose || _report(_exceptionable, {
|
|
10717
|
-
path: _path + ".purpose",
|
|
10849
|
+
value: input.domain
|
|
10850
|
+
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
10851
|
+
path: _path + ".content",
|
|
10718
10852
|
expected: "string",
|
|
10719
|
-
value: input.
|
|
10853
|
+
value: input.content
|
|
10720
10854
|
}) ].every((flag => flag));
|
|
10721
10855
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10722
10856
|
let errors;
|
|
@@ -10727,11 +10861,11 @@ const collection$1 = {
|
|
|
10727
10861
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10728
10862
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10729
10863
|
path: _path + "",
|
|
10730
|
-
expected: "
|
|
10864
|
+
expected: "ICreateTestCodeProps",
|
|
10731
10865
|
value: input
|
|
10732
10866
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10733
10867
|
path: _path + "",
|
|
10734
|
-
expected: "
|
|
10868
|
+
expected: "ICreateTestCodeProps",
|
|
10735
10869
|
value: input
|
|
10736
10870
|
}))(input, "$input", true);
|
|
10737
10871
|
const success = 0 === errors.length;
|
|
@@ -10776,7 +10910,7 @@ const orchestrateTest = ctx => async props => {
|
|
|
10776
10910
|
return history;
|
|
10777
10911
|
}
|
|
10778
10912
|
const {scenarios} = await orchestrateTestScenario(ctx);
|
|
10779
|
-
const codes = await
|
|
10913
|
+
const codes = await orchestrateTestWrite(ctx, scenarios);
|
|
10780
10914
|
const correct = await orchestrateTestCorrect(ctx, codes, scenarios);
|
|
10781
10915
|
const history = {
|
|
10782
10916
|
type: "test",
|
|
@@ -10791,7 +10925,10 @@ const orchestrateTest = ctx => async props => {
|
|
|
10791
10925
|
ctx.dispatch({
|
|
10792
10926
|
type: "testComplete",
|
|
10793
10927
|
created_at: start.toISOString(),
|
|
10794
|
-
files: correct.files
|
|
10928
|
+
files: correct.files.map((f => ({
|
|
10929
|
+
[f.location]: f.content
|
|
10930
|
+
}))).reduce(((acc, cur) => Object.assign(acc, cur)), {}),
|
|
10931
|
+
compiled: correct.result,
|
|
10795
10932
|
step: ctx.state().interface?.step ?? 0
|
|
10796
10933
|
});
|
|
10797
10934
|
ctx.state().test = history;
|
|
@@ -10917,10 +11054,6 @@ const claude = {
|
|
|
10917
11054
|
title: "The reason of the function call",
|
|
10918
11055
|
description: "The reason of the function call.",
|
|
10919
11056
|
type: "string"
|
|
10920
|
-
},
|
|
10921
|
-
userPlanningRequirements: {
|
|
10922
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
10923
|
-
type: "string"
|
|
10924
11057
|
}
|
|
10925
11058
|
},
|
|
10926
11059
|
required: [ "reason" ],
|
|
@@ -10952,15 +11085,11 @@ const claude = {
|
|
|
10952
11085
|
},
|
|
10953
11086
|
description: "Run Analyze Agent.\n\nExecutes the Analyze agent to process user requirements and generate a\nstructured specification document. This agent analyzes all conversation\nhistory between users and AI, separates business logic from technical\nrequirements, and establishes development priorities and scope.\n\n**IMPORTANT**: Only call this function when sufficient requirements have\nbeen discussed to generate a comprehensive specification. The context must\ncontain enough detail about the system's purpose, core features, data\nmodels, and business rules. If requirements are unclear or incomplete,\ncontinue gathering information through conversation instead.\n\nThe agent will automatically generate follow-up questions for any ambiguous\nrequirements and continuously refine its understanding through iterative\nconversation. When executed after other agents have generated code, it can\nalso interpret change requests in the context of existing implementations.",
|
|
10954
11087
|
validate: (() => {
|
|
10955
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11088
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
10956
11089
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
10957
11090
|
path: _path + ".reason",
|
|
10958
11091
|
expected: "string",
|
|
10959
11092
|
value: input.reason
|
|
10960
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
10961
|
-
path: _path + ".userPlanningRequirements",
|
|
10962
|
-
expected: "(string | undefined)",
|
|
10963
|
-
value: input.userPlanningRequirements
|
|
10964
11093
|
}) ].every((flag => flag));
|
|
10965
11094
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10966
11095
|
let errors;
|
|
@@ -11004,10 +11133,6 @@ const claude = {
|
|
|
11004
11133
|
title: "The reason of the function call",
|
|
11005
11134
|
description: "The reason of the function call.",
|
|
11006
11135
|
type: "string"
|
|
11007
|
-
},
|
|
11008
|
-
userPlanningRequirements: {
|
|
11009
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11010
|
-
type: "string"
|
|
11011
11136
|
}
|
|
11012
11137
|
},
|
|
11013
11138
|
required: [ "reason" ],
|
|
@@ -11039,15 +11164,11 @@ const claude = {
|
|
|
11039
11164
|
},
|
|
11040
11165
|
description: "Run prisma agent.\n\nExecutes the Prisma agent to generate database schema files and ERD\ndocumentation. This agent reads the requirements specification created by\nthe {@link analyze Analyze agent} and produces a complete Prisma schema with\ncomprehensive documentation for each entity and attribute.\n\n**PREREQUISITE**: Only call this function after the {@link analyze} function\nhas been successfully executed and a requirements specification document\nhas been generated. The Prisma agent depends on the structured requirements\nanalysis to design the database schema properly. Without a completed\nrequirements specification, this function should NOT be called.\n\nThe agent will automatically validate the generated schema using the Prisma\ncompiler, self-correct any compilation errors through feedback loops, and\ngenerate ERD documentation using prisma-markdown. An internal review\nprocess ensures schema quality and optimization.",
|
|
11041
11166
|
validate: (() => {
|
|
11042
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11167
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11043
11168
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11044
11169
|
path: _path + ".reason",
|
|
11045
11170
|
expected: "string",
|
|
11046
11171
|
value: input.reason
|
|
11047
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11048
|
-
path: _path + ".userPlanningRequirements",
|
|
11049
|
-
expected: "(string | undefined)",
|
|
11050
|
-
value: input.userPlanningRequirements
|
|
11051
11172
|
}) ].every((flag => flag));
|
|
11052
11173
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11053
11174
|
let errors;
|
|
@@ -11091,10 +11212,6 @@ const claude = {
|
|
|
11091
11212
|
title: "The reason of the function call",
|
|
11092
11213
|
description: "The reason of the function call.",
|
|
11093
11214
|
type: "string"
|
|
11094
|
-
},
|
|
11095
|
-
userPlanningRequirements: {
|
|
11096
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11097
|
-
type: "string"
|
|
11098
11215
|
}
|
|
11099
11216
|
},
|
|
11100
11217
|
required: [ "reason" ],
|
|
@@ -11126,15 +11243,11 @@ const claude = {
|
|
|
11126
11243
|
},
|
|
11127
11244
|
description: "Run interface agent.\n\nExecutes the Interface agent to design and generate API interfaces. This\nagent creates OpenAPI schemas and TypeScript/NestJS code based on the\nrequirements specification and ERD documentation from previous agents.\n\nThe agent follows a sophisticated pipeline: first constructing formal\nOpenAPI Operation Schemas and JSON Schemas, then validating these schemas,\nand finally transforming them into NestJS controllers and DTOs. Each\ngenerated interface includes comprehensive JSDoc comments and undergoes\ninternal review for consistency.",
|
|
11128
11245
|
validate: (() => {
|
|
11129
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11246
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11130
11247
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11131
11248
|
path: _path + ".reason",
|
|
11132
11249
|
expected: "string",
|
|
11133
11250
|
value: input.reason
|
|
11134
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11135
|
-
path: _path + ".userPlanningRequirements",
|
|
11136
|
-
expected: "(string | undefined)",
|
|
11137
|
-
value: input.userPlanningRequirements
|
|
11138
11251
|
}) ].every((flag => flag));
|
|
11139
11252
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11140
11253
|
let errors;
|
|
@@ -11178,10 +11291,6 @@ const claude = {
|
|
|
11178
11291
|
title: "The reason of the function call",
|
|
11179
11292
|
description: "The reason of the function call.",
|
|
11180
11293
|
type: "string"
|
|
11181
|
-
},
|
|
11182
|
-
userPlanningRequirements: {
|
|
11183
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11184
|
-
type: "string"
|
|
11185
11294
|
}
|
|
11186
11295
|
},
|
|
11187
11296
|
required: [ "reason" ],
|
|
@@ -11213,15 +11322,11 @@ const claude = {
|
|
|
11213
11322
|
},
|
|
11214
11323
|
description: "Run test program agent.\n\nExecutes the Test agent to generate comprehensive E2E test suites for all\n{@link interface API interfaces}. This agent synthesizes outputs from\nprevious agents to create tests that validate both individual endpoints and\ntheir interactions.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Test agent requires the completed API interface definitions,\nOpenAPI schemas, and TypeScript code to generate appropriate test\nscenarios. Without completed interface design, this function should NOT be\ncalled.\n\nThe agent will analyze dependency relationships between API functions,\nstructure integrated test scenarios with correct execution sequences, and\nenhance pre-generated test scaffolds with business logic validation.\nTypeScript compiler validation and internal review ensure test quality and\noptimal coverage.",
|
|
11215
11324
|
validate: (() => {
|
|
11216
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11325
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11217
11326
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11218
11327
|
path: _path + ".reason",
|
|
11219
11328
|
expected: "string",
|
|
11220
11329
|
value: input.reason
|
|
11221
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11222
|
-
path: _path + ".userPlanningRequirements",
|
|
11223
|
-
expected: "(string | undefined)",
|
|
11224
|
-
value: input.userPlanningRequirements
|
|
11225
11330
|
}) ].every((flag => flag));
|
|
11226
11331
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11227
11332
|
let errors;
|
|
@@ -11265,10 +11370,6 @@ const claude = {
|
|
|
11265
11370
|
title: "The reason of the function call",
|
|
11266
11371
|
description: "The reason of the function call.",
|
|
11267
11372
|
type: "string"
|
|
11268
|
-
},
|
|
11269
|
-
userPlanningRequirements: {
|
|
11270
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11271
|
-
type: "string"
|
|
11272
11373
|
}
|
|
11273
11374
|
},
|
|
11274
11375
|
required: [ "reason" ],
|
|
@@ -11300,15 +11401,11 @@ const claude = {
|
|
|
11300
11401
|
},
|
|
11301
11402
|
description: "Run realize agent.\n\nExecutes the Realize agent to implement the actual business logic for each\nAPI endpoint. This agent synthesizes all outputs from previous agents to\ngenerate fully functional service provider code.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Realize agent requires the completed API interface\ndefinitions to implement the corresponding service logic. It also benefits\nfrom having test code available for validation. Without completed interface\ndesign, this function should NOT be called.\n\nThe agent will create service implementations with multiple validation\nlayers: TypeScript compiler feedback, runtime validation through test\nexecution, and quality optimization through internal review. The generated\ncode handles database interactions through Prisma, implements security and\nvalidation checks, and processes business rules according to\nspecifications.",
|
|
11302
11403
|
validate: (() => {
|
|
11303
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11404
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11304
11405
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11305
11406
|
path: _path + ".reason",
|
|
11306
11407
|
expected: "string",
|
|
11307
11408
|
value: input.reason
|
|
11308
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11309
|
-
path: _path + ".userPlanningRequirements",
|
|
11310
|
-
expected: "(string | undefined)",
|
|
11311
|
-
value: input.userPlanningRequirements
|
|
11312
11409
|
}) ].every((flag => flag));
|
|
11313
11410
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11314
11411
|
let errors;
|
|
@@ -11363,10 +11460,6 @@ const collection = {
|
|
|
11363
11460
|
title: "The reason of the function call",
|
|
11364
11461
|
description: "The reason of the function call.",
|
|
11365
11462
|
type: "string"
|
|
11366
|
-
},
|
|
11367
|
-
userPlanningRequirements: {
|
|
11368
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11369
|
-
type: "string"
|
|
11370
11463
|
}
|
|
11371
11464
|
},
|
|
11372
11465
|
required: [ "reason" ],
|
|
@@ -11389,15 +11482,11 @@ const collection = {
|
|
|
11389
11482
|
},
|
|
11390
11483
|
description: "Run Analyze Agent.\n\nExecutes the Analyze agent to process user requirements and generate a\nstructured specification document. This agent analyzes all conversation\nhistory between users and AI, separates business logic from technical\nrequirements, and establishes development priorities and scope.\n\n**IMPORTANT**: Only call this function when sufficient requirements have\nbeen discussed to generate a comprehensive specification. The context must\ncontain enough detail about the system's purpose, core features, data\nmodels, and business rules. If requirements are unclear or incomplete,\ncontinue gathering information through conversation instead.\n\nThe agent will automatically generate follow-up questions for any ambiguous\nrequirements and continuously refine its understanding through iterative\nconversation. When executed after other agents have generated code, it can\nalso interpret change requests in the context of existing implementations.",
|
|
11391
11484
|
validate: (() => {
|
|
11392
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11485
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11393
11486
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11394
11487
|
path: _path + ".reason",
|
|
11395
11488
|
expected: "string",
|
|
11396
11489
|
value: input.reason
|
|
11397
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11398
|
-
path: _path + ".userPlanningRequirements",
|
|
11399
|
-
expected: "(string | undefined)",
|
|
11400
|
-
value: input.userPlanningRequirements
|
|
11401
11490
|
}) ].every((flag => flag));
|
|
11402
11491
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11403
11492
|
let errors;
|
|
@@ -11441,10 +11530,6 @@ const collection = {
|
|
|
11441
11530
|
title: "The reason of the function call",
|
|
11442
11531
|
description: "The reason of the function call.",
|
|
11443
11532
|
type: "string"
|
|
11444
|
-
},
|
|
11445
|
-
userPlanningRequirements: {
|
|
11446
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11447
|
-
type: "string"
|
|
11448
11533
|
}
|
|
11449
11534
|
},
|
|
11450
11535
|
required: [ "reason" ],
|
|
@@ -11467,15 +11552,11 @@ const collection = {
|
|
|
11467
11552
|
},
|
|
11468
11553
|
description: "Run prisma agent.\n\nExecutes the Prisma agent to generate database schema files and ERD\ndocumentation. This agent reads the requirements specification created by\nthe {@link analyze Analyze agent} and produces a complete Prisma schema with\ncomprehensive documentation for each entity and attribute.\n\n**PREREQUISITE**: Only call this function after the {@link analyze} function\nhas been successfully executed and a requirements specification document\nhas been generated. The Prisma agent depends on the structured requirements\nanalysis to design the database schema properly. Without a completed\nrequirements specification, this function should NOT be called.\n\nThe agent will automatically validate the generated schema using the Prisma\ncompiler, self-correct any compilation errors through feedback loops, and\ngenerate ERD documentation using prisma-markdown. An internal review\nprocess ensures schema quality and optimization.",
|
|
11469
11554
|
validate: (() => {
|
|
11470
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11555
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11471
11556
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11472
11557
|
path: _path + ".reason",
|
|
11473
11558
|
expected: "string",
|
|
11474
11559
|
value: input.reason
|
|
11475
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11476
|
-
path: _path + ".userPlanningRequirements",
|
|
11477
|
-
expected: "(string | undefined)",
|
|
11478
|
-
value: input.userPlanningRequirements
|
|
11479
11560
|
}) ].every((flag => flag));
|
|
11480
11561
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11481
11562
|
let errors;
|
|
@@ -11519,10 +11600,6 @@ const collection = {
|
|
|
11519
11600
|
title: "The reason of the function call",
|
|
11520
11601
|
description: "The reason of the function call.",
|
|
11521
11602
|
type: "string"
|
|
11522
|
-
},
|
|
11523
|
-
userPlanningRequirements: {
|
|
11524
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11525
|
-
type: "string"
|
|
11526
11603
|
}
|
|
11527
11604
|
},
|
|
11528
11605
|
required: [ "reason" ],
|
|
@@ -11545,15 +11622,11 @@ const collection = {
|
|
|
11545
11622
|
},
|
|
11546
11623
|
description: "Run interface agent.\n\nExecutes the Interface agent to design and generate API interfaces. This\nagent creates OpenAPI schemas and TypeScript/NestJS code based on the\nrequirements specification and ERD documentation from previous agents.\n\nThe agent follows a sophisticated pipeline: first constructing formal\nOpenAPI Operation Schemas and JSON Schemas, then validating these schemas,\nand finally transforming them into NestJS controllers and DTOs. Each\ngenerated interface includes comprehensive JSDoc comments and undergoes\ninternal review for consistency.",
|
|
11547
11624
|
validate: (() => {
|
|
11548
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11625
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11549
11626
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11550
11627
|
path: _path + ".reason",
|
|
11551
11628
|
expected: "string",
|
|
11552
11629
|
value: input.reason
|
|
11553
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11554
|
-
path: _path + ".userPlanningRequirements",
|
|
11555
|
-
expected: "(string | undefined)",
|
|
11556
|
-
value: input.userPlanningRequirements
|
|
11557
11630
|
}) ].every((flag => flag));
|
|
11558
11631
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11559
11632
|
let errors;
|
|
@@ -11597,10 +11670,6 @@ const collection = {
|
|
|
11597
11670
|
title: "The reason of the function call",
|
|
11598
11671
|
description: "The reason of the function call.",
|
|
11599
11672
|
type: "string"
|
|
11600
|
-
},
|
|
11601
|
-
userPlanningRequirements: {
|
|
11602
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11603
|
-
type: "string"
|
|
11604
11673
|
}
|
|
11605
11674
|
},
|
|
11606
11675
|
required: [ "reason" ],
|
|
@@ -11623,15 +11692,11 @@ const collection = {
|
|
|
11623
11692
|
},
|
|
11624
11693
|
description: "Run test program agent.\n\nExecutes the Test agent to generate comprehensive E2E test suites for all\n{@link interface API interfaces}. This agent synthesizes outputs from\nprevious agents to create tests that validate both individual endpoints and\ntheir interactions.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Test agent requires the completed API interface definitions,\nOpenAPI schemas, and TypeScript code to generate appropriate test\nscenarios. Without completed interface design, this function should NOT be\ncalled.\n\nThe agent will analyze dependency relationships between API functions,\nstructure integrated test scenarios with correct execution sequences, and\nenhance pre-generated test scaffolds with business logic validation.\nTypeScript compiler validation and internal review ensure test quality and\noptimal coverage.",
|
|
11625
11694
|
validate: (() => {
|
|
11626
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11695
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11627
11696
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11628
11697
|
path: _path + ".reason",
|
|
11629
11698
|
expected: "string",
|
|
11630
11699
|
value: input.reason
|
|
11631
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11632
|
-
path: _path + ".userPlanningRequirements",
|
|
11633
|
-
expected: "(string | undefined)",
|
|
11634
|
-
value: input.userPlanningRequirements
|
|
11635
11700
|
}) ].every((flag => flag));
|
|
11636
11701
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11637
11702
|
let errors;
|
|
@@ -11675,10 +11740,6 @@ const collection = {
|
|
|
11675
11740
|
title: "The reason of the function call",
|
|
11676
11741
|
description: "The reason of the function call.",
|
|
11677
11742
|
type: "string"
|
|
11678
|
-
},
|
|
11679
|
-
userPlanningRequirements: {
|
|
11680
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages.",
|
|
11681
|
-
type: "string"
|
|
11682
11743
|
}
|
|
11683
11744
|
},
|
|
11684
11745
|
required: [ "reason" ],
|
|
@@ -11701,15 +11762,11 @@ const collection = {
|
|
|
11701
11762
|
},
|
|
11702
11763
|
description: "Run realize agent.\n\nExecutes the Realize agent to implement the actual business logic for each\nAPI endpoint. This agent synthesizes all outputs from previous agents to\ngenerate fully functional service provider code.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Realize agent requires the completed API interface\ndefinitions to implement the corresponding service logic. It also benefits\nfrom having test code available for validation. Without completed interface\ndesign, this function should NOT be called.\n\nThe agent will create service implementations with multiple validation\nlayers: TypeScript compiler feedback, runtime validation through test\nexecution, and quality optimization through internal review. The generated\ncode handles database interactions through Prisma, implements security and\nvalidation checks, and processes business rules according to\nspecifications.",
|
|
11703
11764
|
validate: (() => {
|
|
11704
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11765
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11705
11766
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11706
11767
|
path: _path + ".reason",
|
|
11707
11768
|
expected: "string",
|
|
11708
11769
|
value: input.reason
|
|
11709
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11710
|
-
path: _path + ".userPlanningRequirements",
|
|
11711
|
-
expected: "(string | undefined)",
|
|
11712
|
-
value: input.userPlanningRequirements
|
|
11713
11770
|
}) ].every((flag => flag));
|
|
11714
11771
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11715
11772
|
let errors;
|
|
@@ -11765,10 +11822,6 @@ const collection = {
|
|
|
11765
11822
|
type: "string",
|
|
11766
11823
|
title: "The reason of the function call",
|
|
11767
11824
|
description: "The reason of the function call."
|
|
11768
|
-
},
|
|
11769
|
-
userPlanningRequirements: {
|
|
11770
|
-
type: "string",
|
|
11771
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages."
|
|
11772
11825
|
}
|
|
11773
11826
|
},
|
|
11774
11827
|
required: [ "reason" ],
|
|
@@ -11792,15 +11845,11 @@ const collection = {
|
|
|
11792
11845
|
},
|
|
11793
11846
|
description: "Run Analyze Agent.\n\nExecutes the Analyze agent to process user requirements and generate a\nstructured specification document. This agent analyzes all conversation\nhistory between users and AI, separates business logic from technical\nrequirements, and establishes development priorities and scope.\n\n**IMPORTANT**: Only call this function when sufficient requirements have\nbeen discussed to generate a comprehensive specification. The context must\ncontain enough detail about the system's purpose, core features, data\nmodels, and business rules. If requirements are unclear or incomplete,\ncontinue gathering information through conversation instead.\n\nThe agent will automatically generate follow-up questions for any ambiguous\nrequirements and continuously refine its understanding through iterative\nconversation. When executed after other agents have generated code, it can\nalso interpret change requests in the context of existing implementations.",
|
|
11794
11847
|
validate: (() => {
|
|
11795
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11848
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11796
11849
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11797
11850
|
path: _path + ".reason",
|
|
11798
11851
|
expected: "string",
|
|
11799
11852
|
value: input.reason
|
|
11800
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11801
|
-
path: _path + ".userPlanningRequirements",
|
|
11802
|
-
expected: "(string | undefined)",
|
|
11803
|
-
value: input.userPlanningRequirements
|
|
11804
11853
|
}) ].every((flag => flag));
|
|
11805
11854
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11806
11855
|
let errors;
|
|
@@ -11843,10 +11892,6 @@ const collection = {
|
|
|
11843
11892
|
type: "string",
|
|
11844
11893
|
title: "The reason of the function call",
|
|
11845
11894
|
description: "The reason of the function call."
|
|
11846
|
-
},
|
|
11847
|
-
userPlanningRequirements: {
|
|
11848
|
-
type: "string",
|
|
11849
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages."
|
|
11850
11895
|
}
|
|
11851
11896
|
},
|
|
11852
11897
|
required: [ "reason" ],
|
|
@@ -11870,15 +11915,11 @@ const collection = {
|
|
|
11870
11915
|
},
|
|
11871
11916
|
description: "Run prisma agent.\n\nExecutes the Prisma agent to generate database schema files and ERD\ndocumentation. This agent reads the requirements specification created by\nthe {@link analyze Analyze agent} and produces a complete Prisma schema with\ncomprehensive documentation for each entity and attribute.\n\n**PREREQUISITE**: Only call this function after the {@link analyze} function\nhas been successfully executed and a requirements specification document\nhas been generated. The Prisma agent depends on the structured requirements\nanalysis to design the database schema properly. Without a completed\nrequirements specification, this function should NOT be called.\n\nThe agent will automatically validate the generated schema using the Prisma\ncompiler, self-correct any compilation errors through feedback loops, and\ngenerate ERD documentation using prisma-markdown. An internal review\nprocess ensures schema quality and optimization.",
|
|
11872
11917
|
validate: (() => {
|
|
11873
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11918
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11874
11919
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11875
11920
|
path: _path + ".reason",
|
|
11876
11921
|
expected: "string",
|
|
11877
11922
|
value: input.reason
|
|
11878
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11879
|
-
path: _path + ".userPlanningRequirements",
|
|
11880
|
-
expected: "(string | undefined)",
|
|
11881
|
-
value: input.userPlanningRequirements
|
|
11882
11923
|
}) ].every((flag => flag));
|
|
11883
11924
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11884
11925
|
let errors;
|
|
@@ -11921,10 +11962,6 @@ const collection = {
|
|
|
11921
11962
|
type: "string",
|
|
11922
11963
|
title: "The reason of the function call",
|
|
11923
11964
|
description: "The reason of the function call."
|
|
11924
|
-
},
|
|
11925
|
-
userPlanningRequirements: {
|
|
11926
|
-
type: "string",
|
|
11927
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages."
|
|
11928
11965
|
}
|
|
11929
11966
|
},
|
|
11930
11967
|
required: [ "reason" ],
|
|
@@ -11948,15 +11985,11 @@ const collection = {
|
|
|
11948
11985
|
},
|
|
11949
11986
|
description: "Run interface agent.\n\nExecutes the Interface agent to design and generate API interfaces. This\nagent creates OpenAPI schemas and TypeScript/NestJS code based on the\nrequirements specification and ERD documentation from previous agents.\n\nThe agent follows a sophisticated pipeline: first constructing formal\nOpenAPI Operation Schemas and JSON Schemas, then validating these schemas,\nand finally transforming them into NestJS controllers and DTOs. Each\ngenerated interface includes comprehensive JSDoc comments and undergoes\ninternal review for consistency.",
|
|
11950
11987
|
validate: (() => {
|
|
11951
|
-
const _io0 = input => "string" === typeof input.reason
|
|
11988
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
11952
11989
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
11953
11990
|
path: _path + ".reason",
|
|
11954
11991
|
expected: "string",
|
|
11955
11992
|
value: input.reason
|
|
11956
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
11957
|
-
path: _path + ".userPlanningRequirements",
|
|
11958
|
-
expected: "(string | undefined)",
|
|
11959
|
-
value: input.userPlanningRequirements
|
|
11960
11993
|
}) ].every((flag => flag));
|
|
11961
11994
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
11962
11995
|
let errors;
|
|
@@ -11999,10 +12032,6 @@ const collection = {
|
|
|
11999
12032
|
type: "string",
|
|
12000
12033
|
title: "The reason of the function call",
|
|
12001
12034
|
description: "The reason of the function call."
|
|
12002
|
-
},
|
|
12003
|
-
userPlanningRequirements: {
|
|
12004
|
-
type: "string",
|
|
12005
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages."
|
|
12006
12035
|
}
|
|
12007
12036
|
},
|
|
12008
12037
|
required: [ "reason" ],
|
|
@@ -12026,15 +12055,11 @@ const collection = {
|
|
|
12026
12055
|
},
|
|
12027
12056
|
description: "Run test program agent.\n\nExecutes the Test agent to generate comprehensive E2E test suites for all\n{@link interface API interfaces}. This agent synthesizes outputs from\nprevious agents to create tests that validate both individual endpoints and\ntheir interactions.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Test agent requires the completed API interface definitions,\nOpenAPI schemas, and TypeScript code to generate appropriate test\nscenarios. Without completed interface design, this function should NOT be\ncalled.\n\nThe agent will analyze dependency relationships between API functions,\nstructure integrated test scenarios with correct execution sequences, and\nenhance pre-generated test scaffolds with business logic validation.\nTypeScript compiler validation and internal review ensure test quality and\noptimal coverage.",
|
|
12028
12057
|
validate: (() => {
|
|
12029
|
-
const _io0 = input => "string" === typeof input.reason
|
|
12058
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
12030
12059
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
12031
12060
|
path: _path + ".reason",
|
|
12032
12061
|
expected: "string",
|
|
12033
12062
|
value: input.reason
|
|
12034
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
12035
|
-
path: _path + ".userPlanningRequirements",
|
|
12036
|
-
expected: "(string | undefined)",
|
|
12037
|
-
value: input.userPlanningRequirements
|
|
12038
12063
|
}) ].every((flag => flag));
|
|
12039
12064
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
12040
12065
|
let errors;
|
|
@@ -12077,10 +12102,6 @@ const collection = {
|
|
|
12077
12102
|
type: "string",
|
|
12078
12103
|
title: "The reason of the function call",
|
|
12079
12104
|
description: "The reason of the function call."
|
|
12080
|
-
},
|
|
12081
|
-
userPlanningRequirements: {
|
|
12082
|
-
type: "string",
|
|
12083
|
-
description: "# Define prompts to translate user planning requirements into messages for internal agents\n\nThis prompt defines how to convert a user's planning-oriented requirements\ninto a structured message for an internal agent.\n\nAll content the user provides must be included in the message. However, if\nsome parts of the user's input are inappropriate or insufficient from a\nplanning standpoint, you are allowed to add **supplementary remarks**—but\nonly under strict rules.\n\n# Supplementary Remark Rules\n\n1. **Definition** A supplementary remark is additional information that may\n differ from the user's original intent. Because of this, **you must\n clearly indicate that it is _not_ part of the user’s thinking**.\n2. **When to Supplement**\n\n- If the user's input reveals a lack of technical understanding (e.g.,\n suggesting \"put all data into one table\"), and the plan is not an MVP or\n PoC, it's encouraged to make reasonable additions for a more scalable or\n robust structure.\n- If there are clear gaps in the user's planning logic, you may supplement\n the content to ensure completeness.\n\n3. **When Not to Supplement**\n\n- If the user's input is vague or ambiguous, **do not assume or add extra\n details**. Instead, it’s better to ask the user follow-up questions to\n clarify their intent.\n- If the user has made no comment on design, **do not impose design-related\n decisions** (e.g., colors, fonts, tone). However, you may state\n explicitly that no design requirements were provided.\n- Generic advice like \"UX should be good\" can be omitted unless it adds\n value, as such goals are assumed in all services.\n\n# Style Guidelines\n\nThis prompt is delivered to the sub-agent, and several are created for\nparallel processing of the sub-agent. Additionally, there should be a guide\nto style, since sub-agents cannot create different styles of documents due\nto the disconnection of their conversations with each other.\n\nFor example, there should be a hyperlink to the previous document, the next\ndocument, before or after the document, or there should be no more than N\nheadings. The entire content of the document will have requirements, such\nas maintaining informal or formal language.\n\nThe style guide should include conventions for Markdown formatting elements\nsuch as headings, lists, and tables. Additionally, it should define\nexpectations regarding document length and overall composition. When\ndescribing structural guidelines, include a template to illustrate the\nrecommended format.\n\n# Limiting the volume of a document\n\nHowever, do not go beyond the volume guide; each agent only needs to create\none page because the agent receiving this document will be created as many\nas the number of pages."
|
|
12084
12105
|
}
|
|
12085
12106
|
},
|
|
12086
12107
|
required: [ "reason" ],
|
|
@@ -12104,15 +12125,11 @@ const collection = {
|
|
|
12104
12125
|
},
|
|
12105
12126
|
description: "Run realize agent.\n\nExecutes the Realize agent to implement the actual business logic for each\nAPI endpoint. This agent synthesizes all outputs from previous agents to\ngenerate fully functional service provider code.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Realize agent requires the completed API interface\ndefinitions to implement the corresponding service logic. It also benefits\nfrom having test code available for validation. Without completed interface\ndesign, this function should NOT be called.\n\nThe agent will create service implementations with multiple validation\nlayers: TypeScript compiler feedback, runtime validation through test\nexecution, and quality optimization through internal review. The generated\ncode handles database interactions through Prisma, implements security and\nvalidation checks, and processes business rules according to\nspecifications.",
|
|
12106
12127
|
validate: (() => {
|
|
12107
|
-
const _io0 = input => "string" === typeof input.reason
|
|
12128
|
+
const _io0 = input => "string" === typeof input.reason;
|
|
12108
12129
|
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.reason || _report(_exceptionable, {
|
|
12109
12130
|
path: _path + ".reason",
|
|
12110
12131
|
expected: "string",
|
|
12111
12132
|
value: input.reason
|
|
12112
|
-
}), undefined === input.userPlanningRequirements || "string" === typeof input.userPlanningRequirements || _report(_exceptionable, {
|
|
12113
|
-
path: _path + ".userPlanningRequirements",
|
|
12114
|
-
expected: "(string | undefined)",
|
|
12115
|
-
value: input.userPlanningRequirements
|
|
12116
12133
|
}) ].every((flag => flag));
|
|
12117
12134
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
12118
12135
|
let errors;
|
|
@@ -12299,8 +12316,8 @@ class AutoBeAgent {
|
|
|
12299
12316
|
const files = {
|
|
12300
12317
|
...Object.fromEntries(this.state_.analyze ? Object.entries(this.state_.analyze.files).map((([key, value]) => [ `docs/analysis/${key.split("/").at(-1)}`, value ])) : []),
|
|
12301
12318
|
...Object.fromEntries(!!this.state_.prisma?.result ? [ ...Object.entries((options?.dbms ?? "postgres") === "postgres" ? this.state_.prisma.schemas : await this.context_.compiler.prisma.write(this.state_.prisma.result.data, options.dbms)).map((([key, value]) => [ `prisma/schema/${key.split("/").at(-1)}`, value ])), ...this.state_.prisma.compiled.type === "success" ? [ [ "docs/ERD.md", this.state_.prisma.compiled.document ] ] : [], ...this.state_.prisma.compiled.type === "failure" ? [ [ "prisma/compile-error-reason.log", this.state_.prisma.compiled.reason ] ] : [], [ "autobe/prisma.json", JSON.stringify(this.state_.prisma.result.data, null, 2) ] ] : []),
|
|
12302
|
-
...this.state_.interface ? this.state_.interface.files : {},
|
|
12303
|
-
...this.state_.test ? this.state_.test.files : {},
|
|
12319
|
+
...this.state_.interface ? this.state_.test ? Object.fromEntries(Object.entries(this.state_.interface.files).filter((([key]) => key.startsWith("test/features/") === false))) : this.state_.interface.files : {},
|
|
12320
|
+
...this.state_.test ? Object.fromEntries(this.state_.test.files.map((f => [ f.location, f.content ]))) : {},
|
|
12304
12321
|
...this.state_.realize ? this.state_.realize.files : {},
|
|
12305
12322
|
"autobe/histories.json": JSON.stringify(this.histories_, null, 2),
|
|
12306
12323
|
"autobe/tokenUsage.json": JSON.stringify(this.getTokenUsage(), null, 2),
|