import { Schema } from "effect";import { TrimmedNonEmptyString } from "./baseSchemas.ts"; export const EditorLaunchStyle = Schema.Literals(["direct-path", "goto", "line-column"]);export type EditorLaunchStyle = typeof EditorLaunchStyle.Type; type EditorDefinition = { readonly id: string; readonly label: string; readonly commands: readonly [string, ...string[]] | null; readonly baseArgs?: readonly string[]; readonly launchStyle: EditorLaunchStyle;}; export const EDITORS = [ { id: "cursor", label: "Cursor", commands: ["cursor"], launchStyle: "goto" }, { id: "trae", label: "Trae", commands: ["trae"], launchStyle: "goto" }, { id: "kiro", label: "Kiro", commands: ["kiro"], baseArgs: ["ide"], launchStyle: "goto" }, { id: "vscode", label: "VS Code", commands: ["code"], launchStyle: "goto" }, { id: "vscode-insiders", label: "VS Code Insiders", commands: ["code-insiders"], launchStyle: "goto", }, { id: "vscodium", label: "VSCodium", commands: ["codium"], launchStyle: "goto" }, { id: "zed", label: "Zed", commands: ["zed", "zeditor"], launchStyle: "direct-path" }, { id: "antigravity", label: "Antigravity", commands: ["agy"], launchStyle: "goto" }, { id: "idea", label: "IntelliJ IDEA", commands: ["idea"], launchStyle: "line-column" }, { id: "file-manager", label: "File Manager", commands: null, launchStyle: "direct-path" },] as const satisfies ReadonlyArray<EditorDefinition>; export const EditorId = Schema.Literals(EDITORS.map((e) => e.id));export type EditorId = typeof EditorId.Type; export const OpenInEditorInput = Schema.Struct({ cwd: TrimmedNonEmptyString, editor: EditorId,});export type OpenInEditorInput = typeof OpenInEditorInput.Type; export class OpenError extends Schema.TaggedErrorClass<OpenError>()("OpenError", { message: Schema.String, cause: Schema.optional(Schema.Defect),}) {}
import { Schema } from "effect";
import { TrimmedNonEmptyString } from "./baseSchemas.ts";
export const EditorLaunchStyle = Schema.Literals(["direct-path", "goto", "line-column"]);
export type EditorLaunchStyle = typeof EditorLaunchStyle.Type;
type EditorDefinition = {
readonly id: string;
readonly label: string;
readonly commands: readonly [string, ...string[]] | null;
readonly baseArgs?: readonly string[];
readonly launchStyle: EditorLaunchStyle;
};
export const EDITORS = [
{ id: "cursor", label: "Cursor", commands: ["cursor"], launchStyle: "goto" },
{ id: "trae", label: "Trae", commands: ["trae"], launchStyle: "goto" },
{ id: "kiro", label: "Kiro", commands: ["kiro"], baseArgs: ["ide"], launchStyle: "goto" },
{ id: "vscode", label: "VS Code", commands: ["code"], launchStyle: "goto" },
{
id: "vscode-insiders",
label: "VS Code Insiders",
commands: ["code-insiders"],
launchStyle: "goto",
},
{ id: "vscodium", label: "VSCodium", commands: ["codium"], launchStyle: "goto" },
{ id: "zed", label: "Zed", commands: ["zed", "zeditor"], launchStyle: "direct-path" },
{ id: "antigravity", label: "Antigravity", commands: ["agy"], launchStyle: "goto" },
{ id: "idea", label: "IntelliJ IDEA", commands: ["idea"], launchStyle: "line-column" },
{ id: "file-manager", label: "File Manager", commands: null, launchStyle: "direct-path" },
] as const satisfies ReadonlyArray<EditorDefinition>;
export const EditorId = Schema.Literals(EDITORS.map((e) => e.id));
export type EditorId = typeof EditorId.Type;
export const OpenInEditorInput = Schema.Struct({
cwd: TrimmedNonEmptyString,
editor: EditorId,
});
export type OpenInEditorInput = typeof OpenInEditorInput.Type;
export class OpenError extends Schema.TaggedErrorClass<OpenError>()("OpenError", {
message: Schema.String,
cause: Schema.optional(Schema.Defect),
}) {}