UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

37 lines • 1.83 kB
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= import { transferLinksOf } from "../../generic/crossmount/utils.js"; import { facts, mvGeneric, parseFlags } from "../../generic/mv.js"; import { commandFiles, refuseReveal } from "../files.js"; import { FlagView } from "../../../spec/flag_view.js"; import { specOf } from "../../../spec/builtins.js"; import { linksOf, mountsOf } from "../../utils/links.js"; const mv = async (_accessor, paths, _texts, ctx) => { const files = commandFiles(ctx, paths); const parsed = parseFlags(new FlagView(ctx.flags, specOf('mv'))); const mounts = mountsOf(ctx); const links = linksOf(ctx); return mvGeneric(await files.resolveGlob(paths), files.stat, { rename: files.rename }, parsed, undefined, files.readdir, (src, dst) => { refuseReveal(src, dst, ctx.session?.access()); }, links === undefined || ctx.vfs === undefined ? undefined : transferLinksOf(links, ctx.vfs.dispatch, ctx.cwd.virtual), ctx.stdin, mounts === undefined ? undefined : (p) => mounts.isRoot(p)); }; export const BUILDER = { name: 'mv', facts: facts, write: true, fn: mv, }; //# sourceMappingURL=mv.js.map