feat(coding-agent): implemented read-to-open tool aliasing in runtime
- Canonicalized file and CLI defaults from `read` to `open` across tool registration and prompts. - Added `resolveToolAlias()` and applied alias-normalized tool selection so legacy `read` maps to `open`. - Updated runtime, UI, and export layers to treat `open` as first-class while preserving `read` compatibility. - Renamed read prompt docs to `open.md`/`open-chunk.md` and refreshed system guidance to recommend `open`. - Updated tool-related tests and expectations from `read` to `open` (including test fixtures and aliases).
This commit is contained in:
@@ -11,7 +11,7 @@ import { formatChunkedRead, resolveAnchorStyle } from "../edit/modes/chunk";
|
||||
import { getLanguageFromPath } from "../modes/theme/theme";
|
||||
import type { ToolSession } from "../tools";
|
||||
import { parseReadUrlTarget } from "../tools/fetch";
|
||||
import { ReadTool } from "../tools/read";
|
||||
import { OpenTool } from "../tools/open";
|
||||
|
||||
export interface ReadCommandArgs {
|
||||
path: string;
|
||||
@@ -34,7 +34,7 @@ export async function runReadCommand(cmd: ReadCommandArgs): Promise<void> {
|
||||
const parsedUrlTarget = parseReadUrlTarget(cmd.path, cmd.sel);
|
||||
if (parsedUrlTarget) {
|
||||
const settings = await Settings.init({ cwd });
|
||||
const tool = new ReadTool(createCliReadSession(cwd, settings));
|
||||
const tool = new OpenTool(createCliReadSession(cwd, settings));
|
||||
const result = await tool.execute("cli-read", { path: cmd.path, sel: cmd.sel });
|
||||
const text = result.content.find((content): content is { type: "text"; text: string } => content.type === "text");
|
||||
console.log(text?.text ?? "");
|
||||
|
||||
Reference in New Issue
Block a user