* Add formatting conventions * Add a fmt lint check * rely on defaults --------- Co-authored-by: Julius Marminge <[email protected]>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { Schema } from "effect";
|
|
import { PositiveInt, TrimmedNonEmptyString } from "./baseSchemas";
|
|
|
|
const PROJECT_SEARCH_ENTRIES_MAX_LIMIT = 200;
|
|
const PROJECT_WRITE_FILE_PATH_MAX_LENGTH = 512;
|
|
|
|
export const ProjectSearchEntriesInput = Schema.Struct({
|
|
cwd: TrimmedNonEmptyString,
|
|
query: TrimmedNonEmptyString.check(Schema.isMaxLength(256)),
|
|
limit: PositiveInt.check(Schema.isLessThanOrEqualTo(PROJECT_SEARCH_ENTRIES_MAX_LIMIT)),
|
|
});
|
|
export type ProjectSearchEntriesInput = typeof ProjectSearchEntriesInput.Type;
|
|
|
|
const ProjectEntryKind = Schema.Literals(["file", "directory"]);
|
|
|
|
export const ProjectEntry = Schema.Struct({
|
|
path: TrimmedNonEmptyString,
|
|
kind: ProjectEntryKind,
|
|
parentPath: Schema.optional(TrimmedNonEmptyString),
|
|
});
|
|
export type ProjectEntry = typeof ProjectEntry.Type;
|
|
|
|
export const ProjectSearchEntriesResult = Schema.Struct({
|
|
entries: Schema.Array(ProjectEntry),
|
|
truncated: Schema.Boolean,
|
|
});
|
|
export type ProjectSearchEntriesResult = typeof ProjectSearchEntriesResult.Type;
|
|
|
|
export const ProjectWriteFileInput = Schema.Struct({
|
|
cwd: TrimmedNonEmptyString,
|
|
relativePath: TrimmedNonEmptyString.check(Schema.isMaxLength(PROJECT_WRITE_FILE_PATH_MAX_LENGTH)),
|
|
contents: Schema.String,
|
|
});
|
|
export type ProjectWriteFileInput = typeof ProjectWriteFileInput.Type;
|
|
|
|
export const ProjectWriteFileResult = Schema.Struct({
|
|
relativePath: TrimmedNonEmptyString,
|
|
});
|
|
export type ProjectWriteFileResult = typeof ProjectWriteFileResult.Type;
|