@autobe/agent
Version:
AI backend server code generator
597 lines • 86.8 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.orchestrateAnalyzeScenario = void 0;
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
const typia_1 = __importDefault(require("typia"));
const uuid_1 = require("uuid");
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
const transformAnalyzeScenarioHistories_1 = require("./histories/transformAnalyzeScenarioHistories");
const orchestrateAnalyzeScenario = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c;
const start = new Date();
const pointer = {
value: null,
};
const { histories, tokenUsage, metric } = yield ctx.conversate(Object.assign({ source: "analyzeScenario", controller: createController({
model: ctx.model,
build: (value) => (pointer.value = value),
}), enforceFunctionCall: false }, (0, transformAnalyzeScenarioHistories_1.transformAnalyzeSceHistories)(ctx)));
if (((_a = histories.at(-1)) === null || _a === void 0 ? void 0 : _a.type) === "assistantMessage")
return Object.assign(Object.assign({}, histories.at(-1)), { created_at: start.toISOString(), completed_at: new Date().toISOString(), id: (0, uuid_1.v7)() });
else if (pointer.value === null) {
// unreachable
throw new Error("Failed to extract files and tables.");
}
return {
type: "analyzeScenario",
id: (0, uuid_1.v7)(),
prefix: pointer.value.prefix,
language: pointer.value.language,
actors: pointer.value.actors,
files: pointer.value.files,
metric,
tokenUsage,
step: ((_c = (_b = ctx.state().analyze) === null || _b === void 0 ? void 0 : _b.step) !== null && _c !== void 0 ? _c : -1) + 1,
created_at: start.toISOString(),
};
});
exports.orchestrateAnalyzeScenario = orchestrateAnalyzeScenario;
function createController(props) {
(0, assertSchemaModel_1.assertSchemaModel)(props.model);
const application = collection[props.model === "chatgpt"
? "chatgpt"
: props.model === "gemini"
? "gemini"
: "claude"];
return {
protocol: "class",
name: "Compose",
application,
execute: {
compose: (input) => {
props.build(input);
},
},
};
}
const collection = {
chatgpt: {
model: "chatgpt",
options: {
reference: true,
strict: false,
separate: null
},
functions: [
{
name: "compose",
parameters: {
description: " - Project prefix, actors, and file list\n\n------------------------------\n\nCurrent Type: {@link IAutoBeAnalyzeScenarioApplication.IProps}",
type: "object",
properties: {
reason: {
description: "Reason for the analysis and composition of the project structure.",
type: "string"
},
prefix: {
description: "Prefix for file names and variable names. This will be used for\norganizing documentation files.\n\nDO: Use camelCase naming convention.\n\n\n@pattern ^[a-z][a-zA-Z0-9]*$",
type: "string"
},
actors: {
description: "Actors to be assigned for the project.\n\nEach actor has:\n\n- `name`: Actor identifier (camelCase)\n- `kind`: \"guest\" | \"member\" | \"admin\"\n- `description`: Actor's permissions and capabilities",
type: "array",
items: {
$ref: "#/$defs/AutoBeAnalyzeActor"
}
},
language: {
description: "Language for document content. When specified by the user, this takes\nprecedence over the locale setting for determining document language.",
type: "string"
},
page: {
description: "If the user has requested a specific number of pages, enter that number.\nOtherwise, provide an appropriate number of documents needed to meet the\nuser's requirements. This number must always match the length of the\nfiles property, must be greater than 1, and must include the table of\ncontents. For example, if the user requests 3 pages, the total should be\n4, including the table of contents.",
type: "number"
},
files: {
description: "Array of document metadata objects defining files to be generated.\n\nEach array element is an AutoBeAnalyzeFile.Scenario object containing:\n- filename: The output file name (e.g., \"01-service-overview.md\")\n- reason: Why this document is being created\n- documentType, outline, constraints, etc.: Metadata guiding content generation\n\nThese documents represent business-focused planning documentation:\n- Business requirements and functional specifications in natural language\n- User journey mapping and use case scenarios\n- Business rules and workflow definitions\n- Service overview and business model description\n- User actors and permission requirements (described in natural language)\n- Business logic and validation rules\n- DO NOT: Include database schemas, ERD, or API specifications\n- DO: Write all requirements in natural language for clarity\n\nGenerate metadata objects based on actual requirements gathered from conversation.\nDo not create unnecessary documentation - only generate what is needed to\nproperly define the business requirements and system specifications.\n\n# Array Length Rules\n\nThe array length must match the user's requested page count plus one for ToC.\nFor example: user requests 3 pages \u2192 generate 4 objects (1 ToC + 3 content).\nIf user does not specify a number, generate sufficient objects to adequately\ndocument the service (typically 11+ objects including ToC).\n\n\n@minItems 1",
type: "array",
items: {
$ref: "#/$defs/AutoBeAnalyzeFile.Scenario"
}
}
},
required: [
"reason",
"prefix",
"actors",
"page",
"files"
],
additionalProperties: false,
$defs: {
AutoBeAnalyzeActor: {
description: "Interface representing a user actor definition in the requirements analysis\nphase.\n\nThis interface defines authenticated user actors that will be used throughout\nthe application's authentication and authorization system. Each actor\nrepresents a distinct type of user who can register, authenticate, and\ninteract with the system based on their specific permissions and\ncapabilities.\n\nThe actors defined here serve as the foundation for generating:\n\n- Prisma schema models for user authentication tables\n- API endpoint access control decorators\n- Actor-based authorization logic in the business layer\n- Test scenarios for different user permission levels",
type: "object",
properties: {
name: {
description: "Unique identifier for the user actor.\n\nThis name will be used as a reference throughout the generated codebase,\nincluding Prisma schema model names, authorization decorator parameters,\nand API documentation.\n\nMUST use camelCase naming convention.\n\n\n@minLength 1\n@pattern ^[a-z][a-zA-Z0-9]*$",
type: "string"
},
kind: {
description: "Actor category classification for system-wide permission hierarchy.\n\nThis property categorizes actors into three fundamental permission levels,\nestablishing a clear hierarchy for authorization decisions throughout the\napplication. The kind determines baseline access patterns and security\nboundaries:\n\n- \"guest\": Unauthenticated users or those with minimal permissions. Typically\n limited to public resources and registration/login endpoints.\n- \"member\": Authenticated users with standard access permissions. Can access\n personal resources and participate in core application features.\n- \"admin\": System administrators with elevated permissions. Can manage other\n users, access administrative functions, and modify system-wide settings.",
type: "string",
"enum": [
"guest",
"member",
"admin"
]
},
description: {
description: "Human-readable description of the actor's permissions and capabilities.\n\nThis description helps the AI agents understand the business context and\naccess requirements for each actor, guiding the generation of appropriate\nauthorization rules and API endpoint restrictions.",
type: "string"
}
},
required: [
"name",
"kind",
"description"
]
},
"AutoBeAnalyzeFile.Scenario": {
type: "object",
properties: {
reason: {
description: "Describe briefly why you made this document, and if you have any plans\nfor the next one. This helps maintain context between documents and\nensures a logical flow in documentation creation. Example: \"To define the\ncore features and user needs for the e-commerce platform before moving on\nto detailed user flow documentation.\"",
type: "string"
},
filename: {
description: "Filename to generate or overwrite. Should be descriptive and follow a\nconsistent naming convention. Examples: \"01-service-overview.md\",\n\"02-user-requirements.md\", \"03-business-model.md\"\n\n\n@pattern ((.*)\\.md)$",
type: "string"
},
documentType: {
description: "Document type that determines the structure and content guidelines. This\nhelps the AI understand what kind of document to create and what sections\nor information should be included. Examples:\n\n- \"requirement\": Functional/non-functional requirements, acceptance\n criteria\n- \"user-story\": User personas, scenarios, and journey descriptions\n- \"user-flow\": Step-by-step user interactions and decision points\n- \"business-model\": Revenue streams, cost structure, value propositions\n- \"service-overview\": High-level service description, goals, and scope",
type: "string"
},
outline: {
description: "Outline or table of contents that guides the document structure. Each\nitem represents a main section to be covered in the document. The AI will\nexpand each section with appropriate content while maintaining the\nspecified structure. Example: [\"Executive Summary\", \"Problem Statement\",\n\"Target Users\", \"Core Features\", \"Success Metrics\", \"Implementation\nTimeline\"]",
type: "array",
items: {
type: "string"
}
},
audience: {
description: "Target audience for this document. Determines the language, technical\ndepth, and focus areas of the content. If not specified, the document\nwill be written for a general audience with balanced technical and\nbusiness perspectives. Examples:\n\n- \"development team\": More technical details, implementation considerations\n- \"business stakeholders\": Focus on ROI, business value, market opportunity\n- \"end users\": User-friendly language, benefits, and use cases\n- \"product managers\": Balance of user needs, business goals, and\n feasibility\n- \"general\": Accessible to all stakeholders (default if not specified)",
type: "string"
},
keyQuestions: {
description: "Key questions or concerns this document should address. Helps ensure the\ndocument covers all important aspects and doesn't miss critical\ninformation. The AI will make sure to answer these questions within the\ndocument content. Examples:\n\n- \"What problem does this service solve?\"\n- \"Who are the primary and secondary users?\"\n- \"What are the main competitive advantages?\"\n- \"How will we measure success?\"\n- \"What are the potential risks and mitigation strategies?\"",
type: "array",
items: {
type: "string"
}
},
detailLevel: {
description: "Level of detail expected in the document. Guides how deeply the AI should\nexplore each topic and how much information to include. Examples:\n\n- \"high-level overview\": Brief, conceptual, focusing on the big picture\n- \"detailed specification\": Comprehensive, with specific examples and edge\n cases\n- \"executive summary\": Concise, focusing on key points and decisions\n- \"moderate detail\": Balanced approach with essential details (default)",
type: "string"
},
relatedDocuments: {
description: "Related documents that this document references or builds upon. Helps\nmaintain consistency across documentation and allows the AI to understand\nthe broader context. These documents should already exist or be planned\nin the documentation roadmap. Examples: [\"00-project-charter.md\",\n\"01-market-analysis.md\", \"02-competitor-research.md\"]",
type: "array",
items: {
type: "string"
}
},
constraints: {
description: "Specific constraints or requirements for the document. These are\nmust-have elements or considerations that should be included regardless\nof other factors. The AI will ensure these constraints are met.\nExamples:\n\n- \"Must include cost-benefit analysis\"\n- \"Focus on mobile-first user experience\"\n- \"Include measurable KPIs and success metrics\"\n- \"Address data privacy and security concerns\"\n- \"Consider scalability for 1M+ users\"\n- \"Include timeline and milestone recommendations\"",
type: "array",
items: {
type: "string"
}
}
},
required: [
"reason",
"filename"
]
}
}
},
description: "Composes project structure with actors and documentation files.\n\nDetermines the list of user actors and documents to generate based on\nrequirements. If requirements are incomplete, returns empty arrays.",
validate: (() => { const _io0 = input => "string" === typeof input.reason && ("string" === typeof input.prefix && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.prefix)) && (Array.isArray(input.actors) && input.actors.every(elem => "object" === typeof elem && null !== elem && _io1(elem))) && (undefined === input.language || "string" === typeof input.language) && "number" === typeof input.page && (Array.isArray(input.files) && (1 <= input.files.length && input.files.every(elem => "object" === typeof elem && null !== elem && _io2(elem)))); const _io1 = input => "string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && 1 <= input.name.length) && ("guest" === input.kind || "member" === input.kind || "admin" === input.kind) && "string" === typeof input.description; const _io2 = input => "string" === typeof input.reason && ("string" === typeof input.filename && RegExp(/(.*)\.md$/).test(input.filename)) && (undefined === input.documentType || "string" === typeof input.documentType) && (undefined === input.outline || Array.isArray(input.outline) && input.outline.every(elem => "string" === typeof elem)) && (undefined === input.audience || "string" === typeof input.audience) && (undefined === input.keyQuestions || Array.isArray(input.keyQuestions) && input.keyQuestions.every(elem => "string" === typeof elem)) && (undefined === input.detailLevel || "string" === typeof input.detailLevel) && (undefined === input.relatedDocuments || Array.isArray(input.relatedDocuments) && input.relatedDocuments.every(elem => "string" === typeof elem)) && (undefined === input.constraints || Array.isArray(input.constraints) && input.constraints.every(elem => "string" === typeof elem)); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.reason || _report(_exceptionable, {
path: _path + ".reason",
expected: "string",
value: input.reason
}), "string" === typeof input.prefix && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.prefix) || _report(_exceptionable, {
path: _path + ".prefix",
expected: "string & CamelCasePattern",
value: input.prefix
})) || _report(_exceptionable, {
path: _path + ".prefix",
expected: "(string & CamelCasePattern)",
value: input.prefix
}), (Array.isArray(input.actors) || _report(_exceptionable, {
path: _path + ".actors",
expected: "Array<AutoBeAnalyzeActor>",
value: input.actors
})) && input.actors.map((elem, _index7) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".actors[" + _index7 + "]",
expected: "AutoBeAnalyzeActor",
value: elem
})) && _vo1(elem, _path + ".actors[" + _index7 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".actors[" + _index7 + "]",
expected: "AutoBeAnalyzeActor",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".actors",
expected: "Array<AutoBeAnalyzeActor>",
value: input.actors
}), undefined === input.language || "string" === typeof input.language || _report(_exceptionable, {
path: _path + ".language",
expected: "(string | undefined)",
value: input.language
}), "number" === typeof input.page || _report(_exceptionable, {
path: _path + ".page",
expected: "number",
value: input.page
}), (Array.isArray(input.files) || _report(_exceptionable, {
path: _path + ".files",
expected: "(Array<AutoBeAnalyzeFile.Scenario> & MinItems<1>)",
value: input.files
})) && ((1 <= input.files.length || _report(_exceptionable, {
path: _path + ".files",
expected: "Array<> & MinItems<1>",
value: input.files
})) && input.files.map((elem, _index8) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".files[" + _index8 + "]",
expected: "AutoBeAnalyzeFile.Scenario",
value: elem
})) && _vo2(elem, _path + ".files[" + _index8 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".files[" + _index8 + "]",
expected: "AutoBeAnalyzeFile.Scenario",
value: elem
})).every(flag => flag)) || _report(_exceptionable, {
path: _path + ".files",
expected: "(Array<AutoBeAnalyzeFile.Scenario> & MinItems<1>)",
value: input.files
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
path: _path + ".name",
expected: "string & CamelCasePattern",
value: input.name
})) && (1 <= input.name.length || _report(_exceptionable, {
path: _path + ".name",
expected: "string & MinLength<1>",
value: input.name
})) || _report(_exceptionable, {
path: _path + ".name",
expected: "(string & CamelCasePattern & MinLength<1>)",
value: input.name
}), "guest" === input.kind || "member" === input.kind || "admin" === input.kind || _report(_exceptionable, {
path: _path + ".kind",
expected: "(\"admin\" | \"guest\" | \"member\")",
value: input.kind
}), "string" === typeof input.description || _report(_exceptionable, {
path: _path + ".description",
expected: "string",
value: input.description
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.reason || _report(_exceptionable, {
path: _path + ".reason",
expected: "string",
value: input.reason
}), "string" === typeof input.filename && RegExp(/(.*)\.md$/).test(input.filename) || _report(_exceptionable, {
path: _path + ".filename",
expected: "`${string}.md`",
value: input.filename
}), undefined === input.documentType || "string" === typeof input.documentType || _report(_exceptionable, {
path: _path + ".documentType",
expected: "(string | undefined)",
value: input.documentType
}), undefined === input.outline || (Array.isArray(input.outline) || _report(_exceptionable, {
path: _path + ".outline",
expected: "(Array<string> | undefined)",
value: input.outline
})) && input.outline.map((elem, _index9) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".outline[" + _index9 + "]",
expected: "string",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".outline",
expected: "(Array<string> | undefined)",
value: input.outline
}), undefined === input.audience || "string" === typeof input.audience || _report(_exceptionable, {
path: _path + ".audience",
expected: "(string | undefined)",
value: input.audience
}), undefined === input.keyQuestions || (Array.isArray(input.keyQuestions) || _report(_exceptionable, {
path: _path + ".keyQuestions",
expected: "(Array<string> | undefined)",
value: input.keyQuestions
})) && input.keyQuestions.map((elem, _index10) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".keyQuestions[" + _index10 + "]",
expected: "string",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".keyQuestions",
expected: "(Array<string> | undefined)",
value: input.keyQuestions
}), undefined === input.detailLevel || "string" === typeof input.detailLevel || _report(_exceptionable, {
path: _path + ".detailLevel",
expected: "(string | undefined)",
value: input.detailLevel
}), undefined === input.relatedDocuments || (Array.isArray(input.relatedDocuments) || _report(_exceptionable, {
path: _path + ".relatedDocuments",
expected: "(Array<string> | undefined)",
value: input.relatedDocuments
})) && input.relatedDocuments.map((elem, _index11) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".relatedDocuments[" + _index11 + "]",
expected: "string",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".relatedDocuments",
expected: "(Array<string> | undefined)",
value: input.relatedDocuments
}), undefined === input.constraints || (Array.isArray(input.constraints) || _report(_exceptionable, {
path: _path + ".constraints",
expected: "(Array<string> | undefined)",
value: input.constraints
})) && input.constraints.map((elem, _index12) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".constraints[" + _index12 + "]",
expected: "string",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".constraints",
expected: "(Array<string> | undefined)",
value: input.constraints
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
if (false === __is(input)) {
errors = [];
_report = __typia_transform__validateReport._validateReport(errors);
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
path: _path + "",
expected: "IAutoBeAnalyzeScenarioApplication.IProps",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IAutoBeAnalyzeScenarioApplication.IProps",
value: input
}))(input, "$input", true);
const success = 0 === errors.length;
return success ? {
success,
data: input
} : {
success,
errors,
data: input
};
}
return {
success: true,
data: input
};
}; })()
}
]
},
claude: {
model: "claude",
options: {
reference: true,
separate: null
},
functions: [
{
name: "compose",
parameters: {
description: " - Project prefix, actors, and file list\n\n------------------------------\n\nCurrent Type: {@link IAutoBeAnalyzeScenarioApplication.IProps}",
type: "object",
properties: {
reason: {
description: "Reason for the analysis and composition of the project structure.",
type: "string"
},
prefix: {
description: "Prefix for file names and variable names. This will be used for\norganizing documentation files.\n\nDO: Use camelCase naming convention.",
type: "string",
pattern: "^[a-z][a-zA-Z0-9]*$"
},
actors: {
description: "Actors to be assigned for the project.\n\nEach actor has:\n\n- `name`: Actor identifier (camelCase)\n- `kind`: \"guest\" | \"member\" | \"admin\"\n- `description`: Actor's permissions and capabilities",
type: "array",
items: {
$ref: "#/$defs/AutoBeAnalyzeActor"
}
},
language: {
description: "Language for document content. When specified by the user, this takes\nprecedence over the locale setting for determining document language.",
type: "string"
},
page: {
description: "If the user has requested a specific number of pages, enter that number.\nOtherwise, provide an appropriate number of documents needed to meet the\nuser's requirements. This number must always match the length of the\nfiles property, must be greater than 1, and must include the table of\ncontents. For example, if the user requests 3 pages, the total should be\n4, including the table of contents.",
type: "number"
},
files: {
description: "Array of document metadata objects defining files to be generated.\n\nEach array element is an AutoBeAnalyzeFile.Scenario object containing:\n- filename: The output file name (e.g., \"01-service-overview.md\")\n- reason: Why this document is being created\n- documentType, outline, constraints, etc.: Metadata guiding content generation\n\nThese documents represent business-focused planning documentation:\n- Business requirements and functional specifications in natural language\n- User journey mapping and use case scenarios\n- Business rules and workflow definitions\n- Service overview and business model description\n- User actors and permission requirements (described in natural language)\n- Business logic and validation rules\n- DO NOT: Include database schemas, ERD, or API specifications\n- DO: Write all requirements in natural language for clarity\n\nGenerate metadata objects based on actual requirements gathered from conversation.\nDo not create unnecessary documentation - only generate what is needed to\nproperly define the business requirements and system specifications.\n\n# Array Length Rules\n\nThe array length must match the user's requested page count plus one for ToC.\nFor example: user requests 3 pages \u2192 generate 4 objects (1 ToC + 3 content).\nIf user does not specify a number, generate sufficient objects to adequately\ndocument the service (typically 11+ objects including ToC).",
type: "array",
items: {
$ref: "#/$defs/AutoBeAnalyzeFile.Scenario"
},
minItems: 1
}
},
required: [
"reason",
"prefix",
"actors",
"page",
"files"
],
additionalProperties: false,
$defs: {
AutoBeAnalyzeActor: {
description: "Interface representing a user actor definition in the requirements analysis\nphase.\n\nThis interface defines authenticated user actors that will be used throughout\nthe application's authentication and authorization system. Each actor\nrepresents a distinct type of user who can register, authenticate, and\ninteract with the system based on their specific permissions and\ncapabilities.\n\nThe actors defined here serve as the foundation for generating:\n\n- Prisma schema models for user authentication tables\n- API endpoint access control decorators\n- Actor-based authorization logic in the business layer\n- Test scenarios for different user permission levels",
type: "object",
properties: {
name: {
description: "Unique identifier for the user actor.\n\nThis name will be used as a reference throughout the generated codebase,\nincluding Prisma schema model names, authorization decorator parameters,\nand API documentation.\n\nMUST use camelCase naming convention.",
type: "string",
pattern: "^[a-z][a-zA-Z0-9]*$",
minLength: 1
},
kind: {
description: "Actor category classification for system-wide permission hierarchy.\n\nThis property categorizes actors into three fundamental permission levels,\nestablishing a clear hierarchy for authorization decisions throughout the\napplication. The kind determines baseline access patterns and security\nboundaries:\n\n- \"guest\": Unauthenticated users or those with minimal permissions. Typically\n limited to public resources and registration/login endpoints.\n- \"member\": Authenticated users with standard access permissions. Can access\n personal resources and participate in core application features.\n- \"admin\": System administrators with elevated permissions. Can manage other\n users, access administrative functions, and modify system-wide settings.",
oneOf: [
{
"const": "guest"
},
{
"const": "member"
},
{
"const": "admin"
}
]
},
description: {
description: "Human-readable description of the actor's permissions and capabilities.\n\nThis description helps the AI agents understand the business context and\naccess requirements for each actor, guiding the generation of appropriate\nauthorization rules and API endpoint restrictions.",
type: "string"
}
},
required: [
"name",
"kind",
"description"
]
},
"AutoBeAnalyzeFile.Scenario": {
type: "object",
properties: {
reason: {
description: "Describe briefly why you made this document, and if you have any plans\nfor the next one. This helps maintain context between documents and\nensures a logical flow in documentation creation. Example: \"To define the\ncore features and user needs for the e-commerce platform before moving on\nto detailed user flow documentation.\"",
type: "string"
},
filename: {
description: "Filename to generate or overwrite. Should be descriptive and follow a\nconsistent naming convention. Examples: \"01-service-overview.md\",\n\"02-user-requirements.md\", \"03-business-model.md\"",
type: "string",
pattern: "((.*)\\.md)$"
},
documentType: {
description: "Document type that determines the structure and content guidelines. This\nhelps the AI understand what kind of document to create and what sections\nor information should be included. Examples:\n\n- \"requirement\": Functional/non-functional requirements, acceptance\n criteria\n- \"user-story\": User personas, scenarios, and journey descriptions\n- \"user-flow\": Step-by-step user interactions and decision points\n- \"business-model\": Revenue streams, cost structure, value propositions\n- \"service-overview\": High-level service description, goals, and scope",
type: "string"
},
outline: {
description: "Outline or table of contents that guides the document structure. Each\nitem represents a main section to be covered in the document. The AI will\nexpand each section with appropriate content while maintaining the\nspecified structure. Example: [\"Executive Summary\", \"Problem Statement\",\n\"Target Users\", \"Core Features\", \"Success Metrics\", \"Implementation\nTimeline\"]",
type: "array",
items: {
type: "string"
}
},
audience: {
description: "Target audience for this document. Determines the language, technical\ndepth, and focus areas of the content. If not specified, the document\nwill be written for a general audience with balanced technical and\nbusiness perspectives. Examples:\n\n- \"development team\": More technical details, implementation considerations\n- \"business stakeholders\": Focus on ROI, business value, market opportunity\n- \"end users\": User-friendly language, benefits, and use cases\n- \"product managers\": Balance of user needs, business goals, and\n feasibility\n- \"general\": Accessible to all stakeholders (default if not specified)",
type: "string"
},
keyQuestions: {
description: "Key questions or concerns this document should address. Helps ensure the\ndocument covers all important aspects and doesn't miss critical\ninformation. The AI will make sure to answer these questions within the\ndocument content. Examples:\n\n- \"What problem does this service solve?\"\n- \"Who are the primary and secondary users?\"\n- \"What are the main competitive advantages?\"\n- \"How will we measure success?\"\n- \"What are the potential risks and mitigation strategies?\"",
type: "array",
items: {
type: "string"
}
},
detailLevel: {
description: "Level of detail expected in the document. Guides how deeply the AI should\nexplore each topic and how much information to include. Examples:\n\n- \"high-level overview\": Brief, conceptual, focusing on the big picture\n- \"detailed specification\": Comprehensive, with specific examples and edge\n cases\n- \"executive summary\": Concise, focusing on key points and decisions\n- \"moderate detail\": Balanced approach with essential details (default)",
type: "string"
},
relatedDocuments: {
description: "Related documents that this document references or builds upon. Helps\nmaintain consistency across documentation and allows the AI to understand\nthe broader context. These documents should already exist or be planned\nin the documentation roadmap. Examples: [\"00-project-charter.md\",\n\"01-market-analysis.md\", \"02-competitor-research.md\"]",
type: "array",
items: {
type: "string"
}
},
constraints: {
description: "Specific constraints or requirements for the document. These are\nmust-have elements or considerations that should be included regardless\nof other factors. The AI will ensure these constraints are met.\nExamples:\n\n- \"Must include cost-benefit analysis\"\n- \"Focus on mobile-first user experience\"\n- \"Include measurable KPIs and success metrics\"\n- \"Address data privacy and security concerns\"\n- \"Consider scalability for 1M+ users\"\n- \"Include timeline and milestone recommendations\"",
type: "array",
items: {
type: "string"
}
}
},
required: [
"reason",
"filename"
]
}
}
},
description: "Composes project structure with actors and documentation files.\n\nDetermines the list of user actors and documents to generate based on\nrequirements. If requirements are incomplete, returns empty arrays.",
validate: (() => { const _io0 = input => "string" === typeof input.reason && ("string" === typeof input.prefix && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.prefix)) && (Array.isArray(input.actors) && input.actors.every(elem => "object" === typeof elem && null !== elem && _io1(elem))) && (undefined === input.language || "string" === typeof input.language) && "number" === typeof input.page && (Array.isArray(input.files) && (1 <= input.files.length && input.files.every(elem => "object" === typeof elem && null !== elem && _io2(elem)))); const _io1 = input => "string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && 1 <= input.name.length) && ("guest" === input.kind || "member" === input.kind || "admin" === input.kind) && "string" === typeof input.description; const _io2 = input => "string" === typeof input.reason && ("string" === typeof input.filename && RegExp(/(.*)\.md$/).test(input.filename)) && (undefined === input.documentType || "string" === typeof input.documentType) && (undefined === input.outline || Array.isArray(input.outline) && input.outline.every(elem => "string" === typeof elem)) && (undefined === input.audience || "string" === typeof input.audience) && (undefined === input.keyQuestions || Array.isArray(input.keyQuestions) && input.keyQuestions.every(elem => "string" === typeof elem)) && (undefined === input.detailLevel || "string" === typeof input.detailLevel) && (undefined === input.relatedDocuments || Array.isArray(input.relatedDocuments) && input.relatedDocuments.every(elem => "string" === typeof elem)) && (undefined === input.constraints || Array.isArray(input.constraints) && input.constraints.every(elem => "string" === typeof elem)); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.reason || _report(_exceptionable, {
path: _path + ".reason",
expected: "string",
value: input.reason
}), "string" === typeof input.prefix && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.prefix) || _report(_exceptionable, {
path: _path + ".prefix",
expected: "string & CamelCasePattern",
value: input.prefix
})) || _report(_exceptionable, {
path: _path + ".prefix",
expected: "(string & CamelCasePattern)",
value: input.prefix
}), (Array.isArray(input.actors) || _report(_exceptionable, {
path: _path + ".actors",
expected: "Array<AutoBeAnalyzeActor>",
value: input.actors
})) && input.actors.map((elem, _index7) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".actors[" + _index7 + "]",
expected: "AutoBeAnalyzeActor",
value: elem
})) && _vo1(elem, _path + ".actors[" + _index7 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".actors[" + _index7 + "]",
expected: "AutoBeAnalyzeActor",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".actors",
expected: "Arra