refactor(natives): migrated native bindings to NAPI-RS with auto-generated types
- Migrated native bindings from TypeScript wrappers to NAPI-RS generated modules with auto-generated type definitions and runtime enums. - Replaced chunk tree API with stateful ChunkState class supporting render, edit, and resolve operations with improved error handling. - Converted callback signatures to error-first pattern (error, result) for shell, PTY, glob, and grep operations. - Introduced type-safe enums for MacOSAppearance, GrepOutputMode, KeyEventType, ImageFormat, and AstMatchStrictness replacing string literals. - Refactored chunk tree implementation with dedicated modules for edit, indent, resolve, and state management with comprehensive validation. - Moved clipboard utilities from native bindings to coding-agent package with improved OSC 52 and Termux compatibility.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import * as path from "node:path";
|
||||
import chalk from "chalk";
|
||||
import { getLanguageFromPath } from "../modes/theme/theme";
|
||||
import { formatChunkedRead } from "../tools/chunk-tree";
|
||||
import { formatChunkedRead, resolveAnchorStyle } from "../tools/chunk-tree";
|
||||
|
||||
export interface ReadCommandArgs {
|
||||
path: string;
|
||||
@@ -27,7 +27,13 @@ export async function runReadCommand(cmd: ReadCommandArgs): Promise<void> {
|
||||
const cwd = process.cwd();
|
||||
|
||||
try {
|
||||
const result = await formatChunkedRead({ filePath, readPath, cwd, language });
|
||||
const result = await formatChunkedRead({
|
||||
filePath,
|
||||
readPath,
|
||||
cwd,
|
||||
language,
|
||||
anchorStyle: resolveAnchorStyle(),
|
||||
});
|
||||
console.log(result.text);
|
||||
} catch (err) {
|
||||
console.error(chalk.red(`Error: ${err instanceof Error ? err.message : String(err)}`));
|
||||
|
||||
Reference in New Issue
Block a user