mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-30 19:06:23 +02:00
added right click content menu to knowledge
This commit is contained in:
parent
7ab811f27f
commit
8834238768
8 changed files with 742 additions and 147 deletions
|
|
@ -10,6 +10,7 @@ function ensureDirs() {
|
|||
ensure(WorkDir);
|
||||
ensure(path.join(WorkDir, "agents"));
|
||||
ensure(path.join(WorkDir, "config"));
|
||||
ensure(path.join(WorkDir, "knowledge"));
|
||||
}
|
||||
|
||||
ensureDirs();
|
||||
|
|
@ -95,7 +95,7 @@ export async function ensureWorkspaceRoot(): Promise<void> {
|
|||
|
||||
export async function getRoot(): Promise<{ root: string }> {
|
||||
await ensureWorkspaceRoot();
|
||||
return { root: '' };
|
||||
return { root: WorkDir };
|
||||
}
|
||||
|
||||
export async function exists(relPath: string): Promise<{ exists: boolean }> {
|
||||
|
|
@ -284,10 +284,25 @@ export async function rename(
|
|||
const fromPath = resolveWorkspacePath(from);
|
||||
const toPath = resolveWorkspacePath(to);
|
||||
|
||||
// Check if destination exists
|
||||
// Check if source exists
|
||||
await fs.access(fromPath);
|
||||
|
||||
// Check if destination exists (only if overwrite is false)
|
||||
if (!overwrite) {
|
||||
await fs.access(toPath);
|
||||
throw new Error('Destination already exists');
|
||||
try {
|
||||
await fs.access(toPath);
|
||||
// If we get here, destination exists
|
||||
throw new Error('Destination already exists');
|
||||
} catch (err: unknown) {
|
||||
// ENOENT means destination doesn't exist, which is what we want
|
||||
if (err && typeof err === 'object' && 'code' in err && err.code !== 'ENOENT') {
|
||||
throw err;
|
||||
}
|
||||
// If it's "Destination already exists", re-throw it
|
||||
if (err instanceof Error && err.message === 'Destination already exists') {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create parent directory for destination
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue