Skip to content

Commit 1312f5a

Browse files
committed
refactor: drop redundant GuardAnchors type alias in file_edit_insert
In `src/node/services/tools/file_edit_insert.ts`, `GuardAnchors` was defined as `Pick<InsertContentOptions, "insert_before" | "insert_after">`, but `InsertContentOptions` itself is already `Pick<FileEditInsertToolArgs, "insert_before" | "insert_after">` after the `.nullish()` strict-mode refactor in #2250 stripped the `InsertContentOptions` interface down to those same two fields. The two aliases are now structurally identical, so `GuardAnchors` is dead. Drop the alias and use `InsertContentOptions` for the two callers (`insertWithGuards`, `resolveGuardAnchor`). Both names were file-local; no exports change. The function names (`insertWithGuards`, `resolveGuardAnchor`) already convey "guard" context, so the parameter type doesn't need to repeat it. Pure type-level cleanup — emitted JS, runtime behavior, and the public tool surface are all unchanged.
1 parent b3134cf commit 1312f5a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/node/services/tools/file_edit_insert.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ function guardFailure(error: string): InsertOperationFailure {
4444
};
4545
}
4646

47-
type GuardAnchors = Pick<InsertContentOptions, "insert_before" | "insert_after">;
48-
4947
export const createFileEditInsertTool: ToolFactory = (config: ToolConfiguration) => {
5048
return tool({
5149
description: TOOL_DEFINITIONS.file_edit_insert.description,
@@ -175,7 +173,7 @@ function insertContent(
175173
function insertWithGuards(
176174
originalContent: string,
177175
contentToInsert: string,
178-
anchors: GuardAnchors
176+
anchors: InsertContentOptions
179177
): InsertOperationSuccess | InsertOperationFailure {
180178
const anchorResult = resolveGuardAnchor(originalContent, anchors);
181179
if (!anchorResult.success) {
@@ -216,7 +214,7 @@ function findUniqueSubstringIndex(
216214

217215
function resolveGuardAnchor(
218216
originalContent: string,
219-
{ insert_before, insert_after }: GuardAnchors
217+
{ insert_before, insert_after }: InsertContentOptions
220218
): GuardResolutionSuccess | InsertOperationFailure {
221219
const fileEol = detectFileEol(originalContent);
222220

0 commit comments

Comments
 (0)