feat: add space functions to center, remove space remote template

This commit is contained in:
Shivering Ocelot committed 2026-09-08 15:52:39 -05:00
1 parent e9956bd34f
commit 953976cfc1
9 files changed
+79 -21

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import fs from 'node:fs';
import path from 'node:path';
export const spec = {
name: 'list-files',
description: 'List every file in the space, as paths relative to the space directory.',
parameters: { type: 'object', properties: {} },
};
export default async function (args, ctx) {
const files = [];
const walk = (dir, prefix) => {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
if (entry.isDirectory()) walk(path.join(dir, entry.name), rel);
else files.push(rel);
}
};
walk(ctx.dir, '');
return { files };
}