refact: ink based terminal view (#17)

This commit is contained in:
Morten Olsen
2025-05-19 16:22:59 +02:00
committed by GitHub
parent 4514972880
commit 11f76a7378
17 changed files with 772 additions and 116 deletions

View File

@@ -1,6 +1,8 @@
import { dirname, resolve } from 'path';
import { toString } from 'mdast-util-to-string'
import { execute, type ExecutionHandler } from '../execution.js';
import { FileNotFoundError } from '../../utils/errors.js';
import { existsSync } from 'fs';
const fileHandler: ExecutionHandler = ({
addStep,
@@ -18,8 +20,8 @@ const fileHandler: ExecutionHandler = ({
dirname(file),
toString(node)
);
if (!filePath) {
throw new Error('File path is required');
if (!existsSync(filePath)) {
throw new FileNotFoundError(filePath);
}
const { root: newRoot } = await execute(filePath, {
context,