diff --git a/package.json b/package.json index d8dc478c8..65b13bde0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "build-protos": "cd packages/scripts && bun run build-protos", "record-performance": "cd packages/scripts && bun run record-performance", "download-client": "cd packages/scripts && bun run download-client", - "clean-astro": "rm -rf packages/website/.astro packages/website/node_modules/.astro packages/website/node_modules/.vite" + "clean-astro": "rm -rf packages/website/.astro packages/website/node_modules/.astro packages/website/node_modules/.vite", + "vfs": "cd packages/scripts && bun run vfs" }, "type": "module", "workspaces": [ diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 70765e5f0..55077bcb2 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -5,7 +5,8 @@ "discover-ids": "bun src/discoverIds/index.ts", "build-protos": "bun src/protos.ts", "record-performance": "bun src/recordPerformance/index.ts", - "download-client": "bun src/downloadClient/index.ts" + "download-client": "bun src/downloadClient/index.ts", + "vfs": "bun src/vfs/index.ts" }, "dependencies": { "@blitzkit/closed": "workspace:*", diff --git a/packages/scripts/src/vfs/index.ts b/packages/scripts/src/vfs/index.ts new file mode 100644 index 000000000..dd0358c0d --- /dev/null +++ b/packages/scripts/src/vfs/index.ts @@ -0,0 +1,23 @@ +import { assertSecret } from "@blitzkit/core"; +import { LocalVFS } from "@blitzkit/core/src/blitzkit/vfs/local"; + +export const vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR)); + +const command = Bun.argv[2]; +const path = Bun.argv[3]; + +if (!path) { + console.error("Gimme a path to assess dumb ass"); + process.exit(1); +} + +if (command === "cat") { + const content = await vfs.file(path); + await Bun.write(Bun.stdout, content); +} else if (command === "ls") { + const files = await vfs.dir(path); + + for (const file of files) { + console.log(file); + } +}