spaider
Version:
Deterministic-first AI code assistant that crawls your codebase to implement changes using open source LLMs
50 lines • 2.16 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChangesSchema = exports.ChangeSchema = exports.IntentSchema = void 0;
const zod_1 = require("zod");
exports.IntentSchema = zod_1.z.object({
editMode: zod_1.z
.boolean()
.describe("Set to true if the user's request requires making changes to any files. Set to false if the request is only for information, explanation, or code review."),
description: zod_1.z
.string()
.min(10, "Description must be at least 10 characters")
.max(500, "Description too long")
.describe("Clear description of what the user wants to accomplish"),
needsMoreContext: zod_1.z
.boolean()
.describe("Whether additional context is needed to proceed"),
filePaths: zod_1.z
.array(zod_1.z.string())
.describe("List of file paths relevant to this intent"),
searchTerms: zod_1.z
.array(zod_1.z.string())
.describe("Code symbols that could help discover relevant code or files"),
});
exports.ChangeSchema = zod_1.z.object({
operation: zod_1.z
.enum(["new_file", "delete_file", "modify_file"])
.describe("Type of change operation"),
filePath: zod_1.z
.string()
.min(1, "File path cannot be empty")
.describe("Path to the file being modified"),
modificationType: zod_1.z
.enum(["replace_block", "add_block", "remove_block", "none"])
.describe("Type of change operation"),
modificationDescription: zod_1.z
.string()
.describe("The description of the modification relative to the code blocks. Leave empty for deleted files."),
oldCodeBlock: zod_1.z
.string()
.describe("Existing code block to replace. Leave empty for new or deleted files."),
newCodeBlock: zod_1.z
.string()
.describe("New code block to insert. Leave empty for deleted files."),
});
exports.ChangesSchema = zod_1.z.object({
changes: zod_1.z
.array(exports.ChangeSchema)
.describe("List of all file changes to be made using hybrid approach"),
});
//# sourceMappingURL=schemas.js.map