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-2/

Async Editor Prompt

A helper that collects text asynchronously by launching the user's external editor and returning the saved contents.

Capabilities

Capture edited text

  • Opens the user's editor with the provided draft content and resolves with whatever text is saved when the editor closes. @test

Propagate editor errors

  • If the editor reports an error via its callback, the promise rejects with that error and no partial content is returned. @test

Forward temporary file options

  • Any provided temporary file options (prefix, postfix, template, dir, mode) are forwarded to the editor helper so the created file matches the requested settings. @test

Optional newline trimming

  • When trimTrailingNewline is true, a single trailing newline at the end of the saved content is removed; otherwise the text is returned unchanged. @test

Implementation

@generates

API

export interface AsyncEditOptions {
  fileOptions?: {
    prefix?: string;
    postfix?: string;
    template?: string;
    dir?: string;
    mode?: number;
  };
  trimTrailingNewline?: boolean;
}

/**
 * Launch the user's editor asynchronously with optional initial text.
 * Resolves with the final text or rejects if editing fails.
 */
export function openDraft(
  initialText?: string,
  options?: AsyncEditOptions
): Promise<string>;

Dependencies { .dependencies }

external-editor { .dependency }

Provides asynchronous editing via the user's configured external editor.

Version

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