CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-external-editor

tessl install tessl/npm-external-editor@3.1.0

Edit a string with the users preferred text editor using $VISUAL or $ENVIRONMENT

Agent Success

Agent success rate when using this tile

79%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.05x

Baseline

Agent success rate without this tile

75%

task.mdevals/scenario-10/

Temp Draft Editor

Utility that opens the user's editor on a temporary draft file whose name, location, and permissions can be customized, then returns the saved text.

Capabilities

Configurable temp naming

  • When called with prefix "draft-" and postfix ".txt", the temporary file name begins with "draft-" and ends with ".txt" before the editor opens. @test
  • When provided dir "/tmp/custom" and template "note-XXXX.log", the created file lives inside "/tmp/custom" and its basename matches the template pattern with characters replacing each X. @test

File permissions and cleanup

  • When a mode of 0o600 is supplied, the temporary file is created with that permission mask and is removed after the editor closes. @test

Edited content surfaced

  • Returns whatever text is saved by the user in the editor, starting from the provided initial content. @test

Implementation

@generates

API

export function openDraft(initialText?: string, options?: {
  prefix?: string;
  postfix?: string;
  dir?: string;
  template?: string;
  mode?: number;
}): { content: string; filePath: string; lastExitStatus: number | null; };

export function openDraftAsync(
  initialText?: string,
  options?: {
    prefix?: string;
    postfix?: string;
    dir?: string;
    template?: string;
    mode?: number;
  },
  callback: (err: Error | null, result?: { content: string; filePath: string; lastExitStatus: number | null; }) => void
): void;

Dependencies { .dependencies }

external-editor { .dependency }

Provides editor-driven workflows backed by configurable temporary files. @satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/external-editor@3.1.x
tile.json