typescript-virtual-container 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/builds/self-standalone.js +321 -272
- package/builds/self-standalone.js.map +4 -4
- package/builds/standalone-wo-sftp.js +262 -212
- package/builds/standalone-wo-sftp.js.map +4 -4
- package/builds/standalone.cjs +491 -0
- package/builds/standalone.cjs.map +7 -0
- package/builds/standalone.js +266 -216
- package/builds/standalone.js.map +4 -4
- package/builds/web-full-api.min.js +5 -5
- package/builds/web-full-api.min.js.map +3 -3
- package/builds/web.min.js +5 -5
- package/builds/web.min.js.map +3 -3
- package/bun.lock +97 -0
- package/dist/Honeypot/index.d.ts.map +1 -0
- package/dist/Honeypot/index.js +299 -0
- package/dist/Honeypot/index.js.map +1 -0
- package/dist/SSHClient/index.d.ts.map +1 -0
- package/dist/SSHClient/index.js +238 -0
- package/dist/SSHClient/index.js.map +1 -0
- package/dist/SSHMimic/exec.d.ts.map +1 -0
- package/dist/SSHMimic/exec.js +28 -0
- package/dist/SSHMimic/exec.js.map +1 -0
- package/dist/SSHMimic/executor.d.ts.map +1 -0
- package/dist/SSHMimic/executor.js +161 -0
- package/dist/SSHMimic/executor.js.map +1 -0
- package/dist/SSHMimic/hostKey.d.ts.map +1 -0
- package/dist/SSHMimic/hostKey.js +18 -0
- package/dist/SSHMimic/hostKey.js.map +1 -0
- package/dist/SSHMimic/index.d.ts.map +1 -0
- package/dist/SSHMimic/index.js +250 -0
- package/dist/SSHMimic/index.js.map +1 -0
- package/dist/SSHMimic/loginBanner.d.ts.map +1 -0
- package/dist/SSHMimic/loginBanner.js +23 -0
- package/dist/SSHMimic/loginBanner.js.map +1 -0
- package/dist/SSHMimic/loginFormat.d.ts.map +1 -0
- package/dist/SSHMimic/loginFormat.js +11 -0
- package/dist/SSHMimic/loginFormat.js.map +1 -0
- package/dist/SSHMimic/prompt.d.ts.map +1 -0
- package/dist/SSHMimic/prompt.js +10 -0
- package/dist/SSHMimic/prompt.js.map +1 -0
- package/dist/SSHMimic/sftp.d.ts.map +1 -0
- package/dist/SSHMimic/sftp.js +620 -0
- package/dist/SSHMimic/sftp.js.map +1 -0
- package/dist/VirtualFileSystem/binaryPack.d.ts.map +1 -0
- package/dist/VirtualFileSystem/binaryPack.js +217 -0
- package/dist/VirtualFileSystem/binaryPack.js.map +1 -0
- package/dist/VirtualFileSystem/index.d.ts.map +1 -0
- package/dist/VirtualFileSystem/index.js +690 -0
- package/dist/VirtualFileSystem/index.js.map +1 -0
- package/dist/VirtualFileSystem/internalTypes.d.ts.map +1 -0
- package/dist/VirtualFileSystem/internalTypes.js +1 -0
- package/dist/VirtualFileSystem/internalTypes.js.map +1 -0
- package/dist/VirtualFileSystem/path.d.ts.map +1 -0
- package/dist/VirtualFileSystem/path.js +50 -0
- package/dist/VirtualFileSystem/path.js.map +1 -0
- package/dist/VirtualPackageManager/index.d.ts.map +1 -0
- package/dist/VirtualPackageManager/index.js +854 -0
- package/dist/VirtualPackageManager/index.js.map +1 -0
- package/dist/VirtualShell/index.d.ts.map +1 -0
- package/dist/VirtualShell/index.js +285 -0
- package/dist/VirtualShell/index.js.map +1 -0
- package/dist/VirtualShell/shell.d.ts.map +1 -0
- package/dist/VirtualShell/shell.js +503 -0
- package/dist/VirtualShell/shell.js.map +1 -0
- package/dist/VirtualShell/shellParser.d.ts.map +1 -0
- package/dist/VirtualShell/shellParser.js +266 -0
- package/dist/VirtualShell/shellParser.js.map +1 -0
- package/dist/VirtualUserManager/index.d.ts.map +1 -0
- package/dist/VirtualUserManager/index.js +608 -0
- package/dist/VirtualUserManager/index.js.map +1 -0
- package/dist/commands/adduser.d.ts.map +1 -0
- package/dist/commands/adduser.js +90 -0
- package/dist/commands/adduser.js.map +1 -0
- package/dist/commands/alias.d.ts.map +1 -0
- package/dist/commands/alias.js +69 -0
- package/dist/commands/alias.js.map +1 -0
- package/dist/commands/apt.d.ts.map +1 -0
- package/dist/commands/apt.js +211 -0
- package/dist/commands/apt.js.map +1 -0
- package/dist/commands/awk.d.ts.map +1 -0
- package/dist/commands/awk.js +170 -0
- package/dist/commands/awk.js.map +1 -0
- package/dist/commands/base64.d.ts.map +1 -0
- package/dist/commands/base64.js +29 -0
- package/dist/commands/base64.js.map +1 -0
- package/dist/commands/cat.d.ts.map +1 -0
- package/dist/commands/cat.js +45 -0
- package/dist/commands/cat.js.map +1 -0
- package/dist/commands/cd.d.ts.map +1 -0
- package/dist/commands/cd.js +22 -0
- package/dist/commands/cd.js.map +1 -0
- package/dist/commands/chmod.d.ts.map +1 -0
- package/dist/commands/chmod.js +88 -0
- package/dist/commands/chmod.js.map +1 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +14 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/command-helpers.d.ts.map +1 -0
- package/dist/commands/command-helpers.js +222 -0
- package/dist/commands/command-helpers.js.map +1 -0
- package/dist/commands/cp.d.ts.map +1 -0
- package/dist/commands/cp.js +76 -0
- package/dist/commands/cp.js.map +1 -0
- package/dist/commands/curl.d.ts.map +1 -0
- package/dist/commands/curl.js +128 -0
- package/dist/commands/curl.js.map +1 -0
- package/dist/commands/cut.d.ts.map +1 -0
- package/dist/commands/cut.js +35 -0
- package/dist/commands/cut.js.map +1 -0
- package/dist/commands/date.d.ts.map +1 -0
- package/dist/commands/date.js +29 -0
- package/dist/commands/date.js.map +1 -0
- package/dist/commands/declare.d.ts.map +1 -0
- package/dist/commands/declare.js +45 -0
- package/dist/commands/declare.js.map +1 -0
- package/dist/commands/deluser.d.ts.map +1 -0
- package/dist/commands/deluser.js +84 -0
- package/dist/commands/deluser.js.map +1 -0
- package/dist/commands/df.d.ts.map +1 -0
- package/dist/commands/df.js +22 -0
- package/dist/commands/df.js.map +1 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +46 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/dpkg.d.ts.map +1 -0
- package/dist/commands/dpkg.js +162 -0
- package/dist/commands/dpkg.js.map +1 -0
- package/dist/commands/du.d.ts.map +1 -0
- package/dist/commands/du.js +51 -0
- package/dist/commands/du.js.map +1 -0
- package/dist/commands/echo.d.ts.map +1 -0
- package/dist/commands/echo.js +46 -0
- package/dist/commands/echo.js.map +1 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +21 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/exit.d.ts.map +1 -0
- package/dist/commands/exit.js +17 -0
- package/dist/commands/exit.js.map +1 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +34 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/find.d.ts.map +1 -0
- package/dist/commands/find.js +56 -0
- package/dist/commands/find.js.map +1 -0
- package/dist/commands/free.d.ts.map +1 -0
- package/dist/commands/free.js +44 -0
- package/dist/commands/free.js.map +1 -0
- package/dist/commands/grep.d.ts.map +1 -0
- package/dist/commands/grep.js +121 -0
- package/dist/commands/grep.js.map +1 -0
- package/dist/commands/groups.d.ts.map +1 -0
- package/dist/commands/groups.js +18 -0
- package/dist/commands/groups.js.map +1 -0
- package/dist/commands/gzip.d.ts.map +1 -0
- package/dist/commands/gzip.js +83 -0
- package/dist/commands/gzip.js.map +1 -0
- package/dist/commands/head.d.ts.map +1 -0
- package/dist/commands/head.js +47 -0
- package/dist/commands/head.js.map +1 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +124 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/helpers.d.ts.map +1 -0
- package/dist/commands/helpers.js +167 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +27 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/hostname.d.ts.map +1 -0
- package/dist/commands/hostname.js +13 -0
- package/dist/commands/hostname.js.map +1 -0
- package/dist/commands/htop.d.ts.map +1 -0
- package/dist/commands/htop.js +18 -0
- package/dist/commands/htop.js.map +1 -0
- package/dist/commands/id.d.ts.map +1 -0
- package/dist/commands/id.js +18 -0
- package/dist/commands/id.js.map +1 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +3 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/kill.d.ts.map +1 -0
- package/dist/commands/kill.js +19 -0
- package/dist/commands/kill.js.map +1 -0
- package/dist/commands/ln.d.ts.map +1 -0
- package/dist/commands/ln.js +67 -0
- package/dist/commands/ln.js.map +1 -0
- package/dist/commands/ls.d.ts.map +1 -0
- package/dist/commands/ls.js +201 -0
- package/dist/commands/ls.js.map +1 -0
- package/dist/commands/lsb-release.d.ts.map +1 -0
- package/dist/commands/lsb-release.js +62 -0
- package/dist/commands/lsb-release.js.map +1 -0
- package/dist/commands/man.d.ts.map +1 -0
- package/dist/commands/man.js +50 -0
- package/dist/commands/man.js.map +1 -0
- package/dist/commands/mkdir.d.ts.map +1 -0
- package/dist/commands/mkdir.js +29 -0
- package/dist/commands/mkdir.js.map +1 -0
- package/dist/commands/mv.d.ts.map +1 -0
- package/dist/commands/mv.js +43 -0
- package/dist/commands/mv.js.map +1 -0
- package/dist/commands/nano.d.ts.map +1 -0
- package/dist/commands/nano.js +35 -0
- package/dist/commands/nano.js.map +1 -0
- package/dist/commands/neofetch.d.ts.map +1 -0
- package/dist/commands/neofetch.js +49 -0
- package/dist/commands/neofetch.js.map +1 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +317 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/npm.d.ts.map +1 -0
- package/dist/commands/npm.js +110 -0
- package/dist/commands/npm.js.map +1 -0
- package/dist/commands/passwd.d.ts.map +1 -0
- package/dist/commands/passwd.js +45 -0
- package/dist/commands/passwd.js.map +1 -0
- package/dist/commands/ping.d.ts.map +1 -0
- package/dist/commands/ping.js +29 -0
- package/dist/commands/ping.js.map +1 -0
- package/dist/commands/printf.d.ts.map +1 -0
- package/dist/commands/printf.js +145 -0
- package/dist/commands/printf.js.map +1 -0
- package/dist/commands/ps.d.ts.map +1 -0
- package/dist/commands/ps.js +47 -0
- package/dist/commands/ps.js.map +1 -0
- package/dist/commands/pwd.d.ts.map +1 -0
- package/dist/commands/pwd.js +8 -0
- package/dist/commands/pwd.js.map +1 -0
- package/dist/commands/python.d.ts.map +1 -0
- package/dist/commands/python.js +2059 -0
- package/dist/commands/python.js.map +1 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +40 -0
- package/dist/commands/read.js.map +1 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +235 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/rm.d.ts.map +1 -0
- package/dist/commands/rm.js +37 -0
- package/dist/commands/rm.js.map +1 -0
- package/dist/commands/runtime.d.ts.map +1 -0
- package/dist/commands/runtime.js +286 -0
- package/dist/commands/runtime.js.map +1 -0
- package/dist/commands/sed.d.ts.map +1 -0
- package/dist/commands/sed.js +61 -0
- package/dist/commands/sed.js.map +1 -0
- package/dist/commands/seq.d.ts.map +1 -0
- package/dist/commands/seq.js +51 -0
- package/dist/commands/seq.js.map +1 -0
- package/dist/commands/set.d.ts.map +1 -0
- package/dist/commands/set.js +27 -0
- package/dist/commands/set.js.map +1 -0
- package/dist/commands/sh.d.ts.map +1 -0
- package/dist/commands/sh.js +432 -0
- package/dist/commands/sh.js.map +1 -0
- package/dist/commands/shift.d.ts.map +1 -0
- package/dist/commands/shift.js +63 -0
- package/dist/commands/shift.js.map +1 -0
- package/dist/commands/sleep.d.ts.map +1 -0
- package/dist/commands/sleep.js +19 -0
- package/dist/commands/sleep.js.map +1 -0
- package/dist/commands/sort.d.ts.map +1 -0
- package/dist/commands/sort.js +45 -0
- package/dist/commands/sort.js.map +1 -0
- package/dist/commands/source.d.ts.map +1 -0
- package/dist/commands/source.js +40 -0
- package/dist/commands/source.js.map +1 -0
- package/dist/commands/stat.d.ts.map +1 -0
- package/dist/commands/stat.js +57 -0
- package/dist/commands/stat.js.map +1 -0
- package/dist/commands/su.d.ts.map +1 -0
- package/dist/commands/su.js +58 -0
- package/dist/commands/su.js.map +1 -0
- package/dist/commands/sudo.d.ts.map +1 -0
- package/dist/commands/sudo.js +55 -0
- package/dist/commands/sudo.js.map +1 -0
- package/dist/commands/tail.d.ts.map +1 -0
- package/dist/commands/tail.js +48 -0
- package/dist/commands/tail.js.map +1 -0
- package/dist/commands/tar.d.ts.map +1 -0
- package/dist/commands/tar.js +103 -0
- package/dist/commands/tar.js.map +1 -0
- package/dist/commands/tee.d.ts.map +1 -0
- package/dist/commands/tee.js +37 -0
- package/dist/commands/tee.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +115 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/touch.d.ts.map +1 -0
- package/dist/commands/touch.js +26 -0
- package/dist/commands/touch.js.map +1 -0
- package/dist/commands/tr.d.ts.map +1 -0
- package/dist/commands/tr.js +62 -0
- package/dist/commands/tr.js.map +1 -0
- package/dist/commands/tree.d.ts.map +1 -0
- package/dist/commands/tree.js +19 -0
- package/dist/commands/tree.js.map +1 -0
- package/dist/commands/true.d.ts.map +1 -0
- package/dist/commands/true.js +25 -0
- package/dist/commands/true.js.map +1 -0
- package/dist/commands/type.d.ts.map +1 -0
- package/dist/commands/type.js +40 -0
- package/dist/commands/type.js.map +1 -0
- package/dist/commands/uname.d.ts.map +1 -0
- package/dist/commands/uname.js +30 -0
- package/dist/commands/uname.js.map +1 -0
- package/dist/commands/uniq.d.ts.map +1 -0
- package/dist/commands/uniq.js +39 -0
- package/dist/commands/uniq.js.map +1 -0
- package/dist/commands/unset.d.ts.map +1 -0
- package/dist/commands/unset.js +17 -0
- package/dist/commands/unset.js.map +1 -0
- package/dist/commands/uptime.d.ts.map +1 -0
- package/dist/commands/uptime.js +49 -0
- package/dist/commands/uptime.js.map +1 -0
- package/dist/commands/wc.d.ts.map +1 -0
- package/dist/commands/wc.js +56 -0
- package/dist/commands/wc.js.map +1 -0
- package/dist/commands/wget.d.ts.map +1 -0
- package/dist/commands/wget.js +127 -0
- package/dist/commands/wget.js.map +1 -0
- package/dist/commands/which.d.ts.map +1 -0
- package/dist/commands/which.js +33 -0
- package/dist/commands/which.js.map +1 -0
- package/dist/commands/who.d.ts.map +1 -0
- package/dist/commands/who.js +23 -0
- package/dist/commands/who.js.map +1 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +13 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/commands/xargs.d.ts.map +1 -0
- package/dist/commands/xargs.js +22 -0
- package/dist/commands/xargs.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/linuxRootfs.d.ts.map +1 -0
- package/dist/modules/linuxRootfs.js +620 -0
- package/dist/modules/linuxRootfs.js.map +1 -0
- package/dist/modules/neofetch.d.ts.map +1 -0
- package/dist/modules/neofetch.js +285 -0
- package/dist/modules/neofetch.js.map +1 -0
- package/dist/modules/shellInteractive.d.ts.map +1 -0
- package/dist/modules/shellInteractive.js +27 -0
- package/dist/modules/shellInteractive.js.map +1 -0
- package/dist/modules/shellRuntime.d.ts.map +1 -0
- package/dist/modules/shellRuntime.js +53 -0
- package/dist/modules/shellRuntime.js.map +1 -0
- package/dist/self-standalone.d.ts.map +1 -0
- package/dist/self-standalone.js +420 -0
- package/dist/self-standalone.js.map +1 -0
- package/dist/standalone-wo-sftp.d.ts.map +1 -0
- package/dist/standalone-wo-sftp.js +31 -0
- package/dist/standalone-wo-sftp.js.map +1 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +40 -0
- package/dist/standalone.js.map +1 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +1 -0
- package/dist/types/commands.js.map +1 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +1 -0
- package/dist/types/pipeline.js.map +1 -0
- package/dist/types/streams.d.ts.map +1 -0
- package/dist/types/streams.js +1 -0
- package/dist/types/streams.js.map +1 -0
- package/dist/types/vfs.d.ts.map +1 -0
- package/dist/types/vfs.js +1 -0
- package/dist/types/vfs.js.map +1 -0
- package/dist/utils/expand.d.ts.map +1 -0
- package/dist/utils/expand.js +477 -0
- package/dist/utils/expand.js.map +1 -0
- package/dist/utils/perfLogger.d.ts.map +1 -0
- package/dist/utils/perfLogger.js +50 -0
- package/dist/utils/perfLogger.js.map +1 -0
- package/dist/utils/tokenize.d.ts.map +1 -0
- package/dist/utils/tokenize.js +115 -0
- package/dist/utils/tokenize.js.map +1 -0
- package/dist/utils/vfsDiff.d.ts.map +1 -0
- package/dist/utils/vfsDiff.js +178 -0
- package/dist/utils/vfsDiff.js.map +1 -0
- package/dist/web-api.d.ts.map +1 -0
- package/dist/web-api.js +47 -0
- package/dist/web-api.js.map +1 -0
- package/dist/web-full.d.ts.map +1 -0
- package/dist/web-full.js +9 -0
- package/dist/web-full.js.map +1 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +774 -0
- package/dist/web.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +162 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/HoneyPot.html +31 -0
- package/docs/classes/SshClient.html +66 -0
- package/docs/classes/VirtualFileSystem.html +262 -0
- package/docs/classes/VirtualPackageManager.html +63 -0
- package/docs/classes/VirtualSftpServer.html +169 -0
- package/docs/classes/VirtualShell.html +265 -0
- package/docs/classes/VirtualSshServer.html +177 -0
- package/docs/classes/VirtualUserManager.html +276 -0
- package/docs/functions/assertDiff.html +6 -0
- package/docs/functions/diffSnapshots.html +7 -0
- package/docs/functions/formatDiff.html +6 -0
- package/docs/functions/getArg.html +13 -0
- package/docs/functions/getFlag.html +15 -0
- package/docs/functions/ifFlag.html +11 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1842 -0
- package/docs/interfaces/AuditLogEntry.html +6 -0
- package/docs/interfaces/CommandContext.html +22 -0
- package/docs/interfaces/CommandResult.html +26 -0
- package/docs/interfaces/ExecStream.html +11 -0
- package/docs/interfaces/HoneyPotStats.html +14 -0
- package/docs/interfaces/InstalledPackage.html +20 -0
- package/docs/interfaces/NanoEditorSession.html +8 -0
- package/docs/interfaces/PackageDefinition.html +30 -0
- package/docs/interfaces/PackageFile.html +8 -0
- package/docs/interfaces/RemoveOptions.html +4 -0
- package/docs/interfaces/ShellEnv.html +6 -0
- package/docs/interfaces/ShellModule.html +14 -0
- package/docs/interfaces/ShellProperties.html +14 -0
- package/docs/interfaces/ShellStream.html +11 -0
- package/docs/interfaces/SudoChallenge.html +24 -0
- package/docs/interfaces/VfsBaseNode.html +12 -0
- package/docs/interfaces/VfsDiff.html +10 -0
- package/docs/interfaces/VfsDiffEntry.html +6 -0
- package/docs/interfaces/VfsDiffModified.html +10 -0
- package/docs/interfaces/VfsDirectoryNode.html +15 -0
- package/docs/interfaces/VfsFileNode.html +17 -0
- package/docs/interfaces/VfsOptions.html +12 -0
- package/docs/interfaces/VfsSnapshot.html +3 -0
- package/docs/interfaces/VfsSnapshotBaseNode.html +8 -0
- package/docs/interfaces/VfsSnapshotDirectoryNode.html +10 -0
- package/docs/interfaces/VfsSnapshotFileNode.html +12 -0
- package/docs/interfaces/WriteFileOptions.html +6 -0
- package/docs/media/LICENSE +21 -0
- package/docs/modules.html +1 -0
- package/docs/types/CommandMode.html +2 -0
- package/docs/types/CommandOutcome.html +2 -0
- package/docs/types/VfsNodeStats.html +2 -0
- package/docs/types/VfsNodeType.html +2 -0
- package/docs/types/VfsPersistenceMode.html +5 -0
- package/docs/types/VfsSnapshotNode.html +2 -0
- package/examples/web.min.js +5 -5
- package/package.json +6 -4
- package/src/commands/man.ts +1 -1
- package/src/self-standalone.ts +1 -1
- package/src/standalone.ts +8 -3
- package/tsconfig.json +7 -2
- package/src/Honeypot/index.d.ts.map +0 -1
- package/src/Honeypot/index.js +0 -298
- package/src/SSHClient/index.d.ts.map +0 -1
- package/src/SSHClient/index.js +0 -237
- package/src/SSHMimic/exec.d.ts.map +0 -1
- package/src/SSHMimic/exec.js +0 -27
- package/src/SSHMimic/executor.d.ts.map +0 -1
- package/src/SSHMimic/executor.js +0 -160
- package/src/SSHMimic/hostKey.d.ts.map +0 -1
- package/src/SSHMimic/hostKey.js +0 -17
- package/src/SSHMimic/index.d.ts.map +0 -1
- package/src/SSHMimic/index.js +0 -249
- package/src/SSHMimic/loginBanner.d.ts.map +0 -1
- package/src/SSHMimic/loginBanner.js +0 -22
- package/src/SSHMimic/loginFormat.d.ts.map +0 -1
- package/src/SSHMimic/loginFormat.js +0 -10
- package/src/SSHMimic/prompt.d.ts.map +0 -1
- package/src/SSHMimic/prompt.js +0 -9
- package/src/SSHMimic/sftp.d.ts.map +0 -1
- package/src/SSHMimic/sftp.js +0 -619
- package/src/VirtualFileSystem/binaryPack.d.ts.map +0 -1
- package/src/VirtualFileSystem/binaryPack.js +0 -216
- package/src/VirtualFileSystem/index.d.ts.map +0 -1
- package/src/VirtualFileSystem/index.js +0 -689
- package/src/VirtualFileSystem/internalTypes.d.ts.map +0 -1
- package/src/VirtualFileSystem/internalTypes.js +0 -0
- package/src/VirtualFileSystem/path.d.ts.map +0 -1
- package/src/VirtualFileSystem/path.js +0 -49
- package/src/VirtualPackageManager/index.d.ts.map +0 -1
- package/src/VirtualPackageManager/index.js +0 -853
- package/src/VirtualShell/index.d.ts.map +0 -1
- package/src/VirtualShell/index.js +0 -284
- package/src/VirtualShell/shell.d.ts.map +0 -1
- package/src/VirtualShell/shell.js +0 -502
- package/src/VirtualShell/shellParser.d.ts.map +0 -1
- package/src/VirtualShell/shellParser.js +0 -265
- package/src/VirtualUserManager/index.d.ts.map +0 -1
- package/src/VirtualUserManager/index.js +0 -607
- package/src/commands/adduser.d.ts.map +0 -1
- package/src/commands/adduser.js +0 -89
- package/src/commands/alias.d.ts.map +0 -1
- package/src/commands/alias.js +0 -68
- package/src/commands/apt.d.ts.map +0 -1
- package/src/commands/apt.js +0 -210
- package/src/commands/awk.d.ts.map +0 -1
- package/src/commands/awk.js +0 -169
- package/src/commands/base64.d.ts.map +0 -1
- package/src/commands/base64.js +0 -28
- package/src/commands/cat.d.ts.map +0 -1
- package/src/commands/cat.js +0 -44
- package/src/commands/cd.d.ts.map +0 -1
- package/src/commands/cd.js +0 -21
- package/src/commands/chmod.d.ts.map +0 -1
- package/src/commands/chmod.js +0 -87
- package/src/commands/clear.d.ts.map +0 -1
- package/src/commands/clear.js +0 -13
- package/src/commands/command-helpers.d.ts.map +0 -1
- package/src/commands/command-helpers.js +0 -221
- package/src/commands/cp.d.ts.map +0 -1
- package/src/commands/cp.js +0 -75
- package/src/commands/curl.d.ts.map +0 -1
- package/src/commands/curl.js +0 -127
- package/src/commands/cut.d.ts.map +0 -1
- package/src/commands/cut.js +0 -34
- package/src/commands/date.d.ts.map +0 -1
- package/src/commands/date.js +0 -28
- package/src/commands/declare.d.ts.map +0 -1
- package/src/commands/declare.js +0 -44
- package/src/commands/deluser.d.ts.map +0 -1
- package/src/commands/deluser.js +0 -83
- package/src/commands/df.d.ts.map +0 -1
- package/src/commands/df.js +0 -21
- package/src/commands/diff.d.ts.map +0 -1
- package/src/commands/diff.js +0 -45
- package/src/commands/dpkg.d.ts.map +0 -1
- package/src/commands/dpkg.js +0 -161
- package/src/commands/du.d.ts.map +0 -1
- package/src/commands/du.js +0 -50
- package/src/commands/echo.d.ts.map +0 -1
- package/src/commands/echo.js +0 -45
- package/src/commands/env.d.ts.map +0 -1
- package/src/commands/env.js +0 -20
- package/src/commands/exit.d.ts.map +0 -1
- package/src/commands/exit.js +0 -16
- package/src/commands/export.d.ts.map +0 -1
- package/src/commands/export.js +0 -33
- package/src/commands/find.d.ts.map +0 -1
- package/src/commands/find.js +0 -55
- package/src/commands/free.d.ts.map +0 -1
- package/src/commands/free.js +0 -43
- package/src/commands/grep.d.ts.map +0 -1
- package/src/commands/grep.js +0 -120
- package/src/commands/groups.d.ts.map +0 -1
- package/src/commands/groups.js +0 -17
- package/src/commands/gzip.d.ts.map +0 -1
- package/src/commands/gzip.js +0 -82
- package/src/commands/head.d.ts.map +0 -1
- package/src/commands/head.js +0 -46
- package/src/commands/help.d.ts.map +0 -1
- package/src/commands/help.js +0 -123
- package/src/commands/helpers.d.ts.map +0 -1
- package/src/commands/helpers.js +0 -166
- package/src/commands/history.d.ts.map +0 -1
- package/src/commands/history.js +0 -26
- package/src/commands/hostname.d.ts.map +0 -1
- package/src/commands/hostname.js +0 -12
- package/src/commands/htop.d.ts.map +0 -1
- package/src/commands/htop.js +0 -17
- package/src/commands/id.d.ts.map +0 -1
- package/src/commands/id.js +0 -17
- package/src/commands/index.d.ts.map +0 -1
- package/src/commands/index.js +0 -2
- package/src/commands/kill.d.ts.map +0 -1
- package/src/commands/kill.js +0 -18
- package/src/commands/ln.d.ts.map +0 -1
- package/src/commands/ln.js +0 -66
- package/src/commands/ls.d.ts.map +0 -1
- package/src/commands/ls.js +0 -200
- package/src/commands/lsb-release.d.ts.map +0 -1
- package/src/commands/lsb-release.js +0 -61
- package/src/commands/man.d.ts.map +0 -1
- package/src/commands/man.js +0 -49
- package/src/commands/mkdir.d.ts.map +0 -1
- package/src/commands/mkdir.js +0 -28
- package/src/commands/mv.d.ts.map +0 -1
- package/src/commands/mv.js +0 -42
- package/src/commands/nano.d.ts.map +0 -1
- package/src/commands/nano.js +0 -34
- package/src/commands/neofetch.d.ts.map +0 -1
- package/src/commands/neofetch.js +0 -48
- package/src/commands/node.d.ts.map +0 -1
- package/src/commands/node.js +0 -316
- package/src/commands/npm.d.ts.map +0 -1
- package/src/commands/npm.js +0 -109
- package/src/commands/passwd.d.ts.map +0 -1
- package/src/commands/passwd.js +0 -44
- package/src/commands/ping.d.ts.map +0 -1
- package/src/commands/ping.js +0 -28
- package/src/commands/printf.d.ts.map +0 -1
- package/src/commands/printf.js +0 -144
- package/src/commands/ps.d.ts.map +0 -1
- package/src/commands/ps.js +0 -46
- package/src/commands/pwd.d.ts.map +0 -1
- package/src/commands/pwd.js +0 -7
- package/src/commands/python.d.ts.map +0 -1
- package/src/commands/python.js +0 -2058
- package/src/commands/read.d.ts.map +0 -1
- package/src/commands/read.js +0 -39
- package/src/commands/registry.d.ts.map +0 -1
- package/src/commands/registry.js +0 -234
- package/src/commands/rm.d.ts.map +0 -1
- package/src/commands/rm.js +0 -36
- package/src/commands/runtime.d.ts.map +0 -1
- package/src/commands/runtime.js +0 -285
- package/src/commands/sed.d.ts.map +0 -1
- package/src/commands/sed.js +0 -60
- package/src/commands/seq.d.ts.map +0 -1
- package/src/commands/seq.js +0 -50
- package/src/commands/set.d.ts.map +0 -1
- package/src/commands/set.js +0 -26
- package/src/commands/sh.d.ts.map +0 -1
- package/src/commands/sh.js +0 -431
- package/src/commands/shift.d.ts.map +0 -1
- package/src/commands/shift.js +0 -62
- package/src/commands/sleep.d.ts.map +0 -1
- package/src/commands/sleep.js +0 -18
- package/src/commands/sort.d.ts.map +0 -1
- package/src/commands/sort.js +0 -44
- package/src/commands/source.d.ts.map +0 -1
- package/src/commands/source.js +0 -39
- package/src/commands/stat.d.ts.map +0 -1
- package/src/commands/stat.js +0 -56
- package/src/commands/su.d.ts.map +0 -1
- package/src/commands/su.js +0 -57
- package/src/commands/sudo.d.ts.map +0 -1
- package/src/commands/sudo.js +0 -54
- package/src/commands/tail.d.ts.map +0 -1
- package/src/commands/tail.js +0 -47
- package/src/commands/tar.d.ts.map +0 -1
- package/src/commands/tar.js +0 -102
- package/src/commands/tee.d.ts.map +0 -1
- package/src/commands/tee.js +0 -36
- package/src/commands/test.d.ts.map +0 -1
- package/src/commands/test.js +0 -114
- package/src/commands/touch.d.ts.map +0 -1
- package/src/commands/touch.js +0 -25
- package/src/commands/tr.d.ts.map +0 -1
- package/src/commands/tr.js +0 -61
- package/src/commands/tree.d.ts.map +0 -1
- package/src/commands/tree.js +0 -18
- package/src/commands/true.d.ts.map +0 -1
- package/src/commands/true.js +0 -24
- package/src/commands/type.d.ts.map +0 -1
- package/src/commands/type.js +0 -39
- package/src/commands/uname.d.ts.map +0 -1
- package/src/commands/uname.js +0 -29
- package/src/commands/uniq.d.ts.map +0 -1
- package/src/commands/uniq.js +0 -38
- package/src/commands/unset.d.ts.map +0 -1
- package/src/commands/unset.js +0 -16
- package/src/commands/uptime.d.ts.map +0 -1
- package/src/commands/uptime.js +0 -48
- package/src/commands/wc.d.ts.map +0 -1
- package/src/commands/wc.js +0 -55
- package/src/commands/wget.d.ts.map +0 -1
- package/src/commands/wget.js +0 -126
- package/src/commands/which.d.ts.map +0 -1
- package/src/commands/which.js +0 -32
- package/src/commands/who.d.ts.map +0 -1
- package/src/commands/who.js +0 -22
- package/src/commands/whoami.d.ts.map +0 -1
- package/src/commands/whoami.js +0 -12
- package/src/commands/xargs.d.ts.map +0 -1
- package/src/commands/xargs.js +0 -21
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -9
- package/src/modules/linuxRootfs.d.ts.map +0 -1
- package/src/modules/linuxRootfs.js +0 -619
- package/src/modules/neofetch.d.ts.map +0 -1
- package/src/modules/neofetch.js +0 -284
- package/src/modules/shellInteractive.d.ts.map +0 -1
- package/src/modules/shellInteractive.js +0 -26
- package/src/modules/shellRuntime.d.ts.map +0 -1
- package/src/modules/shellRuntime.js +0 -52
- package/src/self-standalone.d.ts.map +0 -1
- package/src/self-standalone.js +0 -418
- package/src/standalone-wo-sftp.d.ts.map +0 -1
- package/src/standalone-wo-sftp.js +0 -30
- package/src/standalone.d.ts.map +0 -1
- package/src/standalone.js +0 -35
- package/src/types/commands.d.ts.map +0 -1
- package/src/types/commands.js +0 -0
- package/src/types/pipeline.d.ts.map +0 -1
- package/src/types/pipeline.js +0 -0
- package/src/types/streams.d.ts.map +0 -1
- package/src/types/streams.js +0 -0
- package/src/types/vfs.d.ts.map +0 -1
- package/src/types/vfs.js +0 -0
- package/src/utils/expand.d.ts.map +0 -1
- package/src/utils/expand.js +0 -476
- package/src/utils/perfLogger.d.ts.map +0 -1
- package/src/utils/perfLogger.js +0 -49
- package/src/utils/tokenize.d.ts.map +0 -1
- package/src/utils/tokenize.js +0 -114
- package/src/utils/vfsDiff.d.ts.map +0 -1
- package/src/utils/vfsDiff.js +0 -177
- package/src/web-api.d.ts.map +0 -1
- package/src/web-api.js +0 -46
- package/src/web-full.d.ts.map +0 -1
- package/src/web-full.js +0 -8
- package/src/web.d.ts.map +0 -1
- package/src/web.js +0 -773
- package/tests/command-helpers.test.d.ts +0 -2
- package/tests/command-helpers.test.d.ts.map +0 -1
- package/tests/command-helpers.test.js +0 -92
- package/tests/commands-admin-net.test.d.ts +0 -2
- package/tests/commands-admin-net.test.d.ts.map +0 -1
- package/tests/commands-admin-net.test.js +0 -353
- package/tests/commands-advanced.test.d.ts +0 -2
- package/tests/commands-advanced.test.d.ts.map +0 -1
- package/tests/commands-advanced.test.js +0 -378
- package/tests/commands-core.test.d.ts +0 -2
- package/tests/commands-core.test.d.ts.map +0 -1
- package/tests/commands-core.test.js +0 -477
- package/tests/commands-missing.test.d.ts +0 -2
- package/tests/commands-missing.test.d.ts.map +0 -1
- package/tests/commands-missing.test.js +0 -470
- package/tests/commands-specific-units.test.d.ts +0 -2
- package/tests/commands-specific-units.test.d.ts.map +0 -1
- package/tests/commands-specific-units.test.js +0 -264
- package/tests/commands-text-sys.test.d.ts +0 -2
- package/tests/commands-text-sys.test.d.ts.map +0 -1
- package/tests/commands-text-sys.test.js +0 -366
- package/tests/expand.test.d.ts +0 -2
- package/tests/expand.test.d.ts.map +0 -1
- package/tests/expand.test.js +0 -138
- package/tests/helpers.test.d.ts +0 -2
- package/tests/helpers.test.d.ts.map +0 -1
- package/tests/helpers.test.js +0 -52
- package/tests/new-features.test.d.ts +0 -2
- package/tests/new-features.test.d.ts.map +0 -1
- package/tests/new-features.test.js +0 -850
- package/tests/parser-executor.test.d.ts +0 -2
- package/tests/parser-executor.test.d.ts.map +0 -1
- package/tests/parser-executor.test.js +0 -25
- package/tests/sftp.test.d.ts +0 -2
- package/tests/sftp.test.d.ts.map +0 -1
- package/tests/sftp.test.js +0 -246
- package/tests/ssh-exec.test.d.ts +0 -2
- package/tests/ssh-exec.test.d.ts.map +0 -1
- package/tests/ssh-exec.test.js +0 -39
- package/tests/test-helper.d.ts +0 -56
- package/tests/test-helper.d.ts.map +0 -1
- package/tests/test-helper.js +0 -71
- package/tests/users.test.d.ts +0 -2
- package/tests/users.test.d.ts.map +0 -1
- package/tests/users.test.js +0 -71
- package/tests/web.test.d.ts +0 -2
- package/tests/web.test.d.ts.map +0 -1
- package/tests/web.test.js +0 -149
- /package/{src → dist}/Honeypot/index.d.ts +0 -0
- /package/{src → dist}/SSHClient/index.d.ts +0 -0
- /package/{src → dist}/SSHMimic/exec.d.ts +0 -0
- /package/{src → dist}/SSHMimic/executor.d.ts +0 -0
- /package/{src → dist}/SSHMimic/hostKey.d.ts +0 -0
- /package/{src → dist}/SSHMimic/index.d.ts +0 -0
- /package/{src → dist}/SSHMimic/loginBanner.d.ts +0 -0
- /package/{src → dist}/SSHMimic/loginFormat.d.ts +0 -0
- /package/{src → dist}/SSHMimic/prompt.d.ts +0 -0
- /package/{src → dist}/SSHMimic/sftp.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/binaryPack.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/index.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/internalTypes.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/path.d.ts +0 -0
- /package/{src → dist}/VirtualPackageManager/index.d.ts +0 -0
- /package/{src → dist}/VirtualShell/index.d.ts +0 -0
- /package/{src → dist}/VirtualShell/shell.d.ts +0 -0
- /package/{src → dist}/VirtualShell/shellParser.d.ts +0 -0
- /package/{src → dist}/VirtualUserManager/index.d.ts +0 -0
- /package/{src → dist}/commands/adduser.d.ts +0 -0
- /package/{src → dist}/commands/alias.d.ts +0 -0
- /package/{src → dist}/commands/apt.d.ts +0 -0
- /package/{src → dist}/commands/awk.d.ts +0 -0
- /package/{src → dist}/commands/base64.d.ts +0 -0
- /package/{src → dist}/commands/cat.d.ts +0 -0
- /package/{src → dist}/commands/cd.d.ts +0 -0
- /package/{src → dist}/commands/chmod.d.ts +0 -0
- /package/{src → dist}/commands/clear.d.ts +0 -0
- /package/{src → dist}/commands/command-helpers.d.ts +0 -0
- /package/{src → dist}/commands/cp.d.ts +0 -0
- /package/{src → dist}/commands/curl.d.ts +0 -0
- /package/{src → dist}/commands/cut.d.ts +0 -0
- /package/{src → dist}/commands/date.d.ts +0 -0
- /package/{src → dist}/commands/declare.d.ts +0 -0
- /package/{src → dist}/commands/deluser.d.ts +0 -0
- /package/{src → dist}/commands/df.d.ts +0 -0
- /package/{src → dist}/commands/diff.d.ts +0 -0
- /package/{src → dist}/commands/dpkg.d.ts +0 -0
- /package/{src → dist}/commands/du.d.ts +0 -0
- /package/{src → dist}/commands/echo.d.ts +0 -0
- /package/{src → dist}/commands/env.d.ts +0 -0
- /package/{src → dist}/commands/exit.d.ts +0 -0
- /package/{src → dist}/commands/export.d.ts +0 -0
- /package/{src → dist}/commands/find.d.ts +0 -0
- /package/{src → dist}/commands/free.d.ts +0 -0
- /package/{src → dist}/commands/grep.d.ts +0 -0
- /package/{src → dist}/commands/groups.d.ts +0 -0
- /package/{src → dist}/commands/gzip.d.ts +0 -0
- /package/{src → dist}/commands/head.d.ts +0 -0
- /package/{src → dist}/commands/help.d.ts +0 -0
- /package/{src → dist}/commands/helpers.d.ts +0 -0
- /package/{src → dist}/commands/history.d.ts +0 -0
- /package/{src → dist}/commands/hostname.d.ts +0 -0
- /package/{src → dist}/commands/htop.d.ts +0 -0
- /package/{src → dist}/commands/id.d.ts +0 -0
- /package/{src → dist}/commands/index.d.ts +0 -0
- /package/{src → dist}/commands/kill.d.ts +0 -0
- /package/{src → dist}/commands/ln.d.ts +0 -0
- /package/{src → dist}/commands/ls.d.ts +0 -0
- /package/{src → dist}/commands/lsb-release.d.ts +0 -0
- /package/{src → dist}/commands/man.d.ts +0 -0
- /package/{src → dist}/commands/mkdir.d.ts +0 -0
- /package/{src → dist}/commands/mv.d.ts +0 -0
- /package/{src → dist}/commands/nano.d.ts +0 -0
- /package/{src → dist}/commands/neofetch.d.ts +0 -0
- /package/{src → dist}/commands/node.d.ts +0 -0
- /package/{src → dist}/commands/npm.d.ts +0 -0
- /package/{src → dist}/commands/passwd.d.ts +0 -0
- /package/{src → dist}/commands/ping.d.ts +0 -0
- /package/{src → dist}/commands/printf.d.ts +0 -0
- /package/{src → dist}/commands/ps.d.ts +0 -0
- /package/{src → dist}/commands/pwd.d.ts +0 -0
- /package/{src → dist}/commands/python.d.ts +0 -0
- /package/{src → dist}/commands/read.d.ts +0 -0
- /package/{src → dist}/commands/registry.d.ts +0 -0
- /package/{src → dist}/commands/rm.d.ts +0 -0
- /package/{src → dist}/commands/runtime.d.ts +0 -0
- /package/{src → dist}/commands/sed.d.ts +0 -0
- /package/{src → dist}/commands/seq.d.ts +0 -0
- /package/{src → dist}/commands/set.d.ts +0 -0
- /package/{src → dist}/commands/sh.d.ts +0 -0
- /package/{src → dist}/commands/shift.d.ts +0 -0
- /package/{src → dist}/commands/sleep.d.ts +0 -0
- /package/{src → dist}/commands/sort.d.ts +0 -0
- /package/{src → dist}/commands/source.d.ts +0 -0
- /package/{src → dist}/commands/stat.d.ts +0 -0
- /package/{src → dist}/commands/su.d.ts +0 -0
- /package/{src → dist}/commands/sudo.d.ts +0 -0
- /package/{src → dist}/commands/tail.d.ts +0 -0
- /package/{src → dist}/commands/tar.d.ts +0 -0
- /package/{src → dist}/commands/tee.d.ts +0 -0
- /package/{src → dist}/commands/test.d.ts +0 -0
- /package/{src → dist}/commands/touch.d.ts +0 -0
- /package/{src → dist}/commands/tr.d.ts +0 -0
- /package/{src → dist}/commands/tree.d.ts +0 -0
- /package/{src → dist}/commands/true.d.ts +0 -0
- /package/{src → dist}/commands/type.d.ts +0 -0
- /package/{src → dist}/commands/uname.d.ts +0 -0
- /package/{src → dist}/commands/uniq.d.ts +0 -0
- /package/{src → dist}/commands/unset.d.ts +0 -0
- /package/{src → dist}/commands/uptime.d.ts +0 -0
- /package/{src → dist}/commands/wc.d.ts +0 -0
- /package/{src → dist}/commands/wget.d.ts +0 -0
- /package/{src → dist}/commands/which.d.ts +0 -0
- /package/{src → dist}/commands/who.d.ts +0 -0
- /package/{src → dist}/commands/whoami.d.ts +0 -0
- /package/{src → dist}/commands/xargs.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/modules/linuxRootfs.d.ts +0 -0
- /package/{src → dist}/modules/neofetch.d.ts +0 -0
- /package/{src → dist}/modules/shellInteractive.d.ts +0 -0
- /package/{src → dist}/modules/shellRuntime.d.ts +0 -0
- /package/{src → dist}/self-standalone.d.ts +0 -0
- /package/{src → dist}/standalone-wo-sftp.d.ts +0 -0
- /package/{src → dist}/standalone.d.ts +0 -0
- /package/{src → dist}/types/commands.d.ts +0 -0
- /package/{src → dist}/types/pipeline.d.ts +0 -0
- /package/{src → dist}/types/streams.d.ts +0 -0
- /package/{src → dist}/types/vfs.d.ts +0 -0
- /package/{src → dist}/utils/expand.d.ts +0 -0
- /package/{src → dist}/utils/perfLogger.d.ts +0 -0
- /package/{src → dist}/utils/tokenize.d.ts +0 -0
- /package/{src → dist}/utils/vfsDiff.d.ts +0 -0
- /package/{src → dist}/web-api.d.ts +0 -0
- /package/{src → dist}/web-full.d.ts +0 -0
- /package/{src → dist}/web.d.ts +0 -0
package/src/commands/source.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { resolvePath } from "./helpers";
|
|
2
|
-
import { runCommand } from "./runtime";
|
|
3
|
-
/**
|
|
4
|
-
* Execute commands from a file in the current shell environment.
|
|
5
|
-
* @category shell
|
|
6
|
-
* @params ["<file> [args...]"]
|
|
7
|
-
*/
|
|
8
|
-
export const sourceCommand = {
|
|
9
|
-
name: "source",
|
|
10
|
-
aliases: ["."],
|
|
11
|
-
description: "Execute commands from a file in the current shell environment",
|
|
12
|
-
category: "shell",
|
|
13
|
-
params: ["<file> [args...]"],
|
|
14
|
-
run: async ({ args, authUser, hostname, cwd, shell, env }) => {
|
|
15
|
-
const fileArg = args[0];
|
|
16
|
-
if (!fileArg) {
|
|
17
|
-
return { stderr: "source: missing filename", exitCode: 1 };
|
|
18
|
-
}
|
|
19
|
-
const filePath = resolvePath(cwd, fileArg);
|
|
20
|
-
if (!shell.vfs.exists(filePath)) {
|
|
21
|
-
return {
|
|
22
|
-
stderr: `source: ${fileArg}: No such file or directory`,
|
|
23
|
-
exitCode: 1,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const content = shell.vfs.readFile(filePath);
|
|
27
|
-
let lastExitCode = 0;
|
|
28
|
-
for (const line of content.split("\n")) {
|
|
29
|
-
const l = line.trim();
|
|
30
|
-
if (!l || l.startsWith("#"))
|
|
31
|
-
continue;
|
|
32
|
-
const result = await runCommand(l, authUser, hostname, "shell", cwd, shell, undefined, env);
|
|
33
|
-
lastExitCode = result.exitCode ?? 0;
|
|
34
|
-
if (result.closeSession || result.switchUser)
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
return { exitCode: lastExitCode };
|
|
38
|
-
},
|
|
39
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stat.d.ts","sourceRoot":"","sources":["stat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,WAqDzB,CAAC"}
|
package/src/commands/stat.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { resolvePath } from "./helpers";
|
|
2
|
-
/**
|
|
3
|
-
* Display file or filesystem status.
|
|
4
|
-
* Outputs: path, size, mode, type, timestamps — similar to `stat` on Linux.
|
|
5
|
-
*/
|
|
6
|
-
export const statCommand = {
|
|
7
|
-
name: "stat",
|
|
8
|
-
description: "Display file status",
|
|
9
|
-
category: "files",
|
|
10
|
-
params: ["[-c <format>] <file>"],
|
|
11
|
-
run: ({ shell, cwd, args }) => {
|
|
12
|
-
const fmtIdx = args.findIndex((a) => a === "-c" || a === "--format");
|
|
13
|
-
const fmt = fmtIdx !== -1 ? args[fmtIdx + 1] : undefined;
|
|
14
|
-
const file = args.find((a) => !a.startsWith("-") && a !== fmt);
|
|
15
|
-
if (!file)
|
|
16
|
-
return { stderr: "stat: missing operand\n", exitCode: 1 };
|
|
17
|
-
const p = resolvePath(cwd, file);
|
|
18
|
-
if (!shell.vfs.exists(p)) {
|
|
19
|
-
return { stderr: `stat: cannot stat '${file}': No such file or directory\n`, exitCode: 1 };
|
|
20
|
-
}
|
|
21
|
-
const st = shell.vfs.stat(p);
|
|
22
|
-
const isDir = st.type === "directory";
|
|
23
|
-
const _isLink = shell.vfs.isSymlink(p);
|
|
24
|
-
const isSymlink = shell.vfs.isSymlink(p);
|
|
25
|
-
const modePerm = (mode) => {
|
|
26
|
-
const bits = [0o400, 0o200, 0o100, 0o040, 0o020, 0o010, 0o004, 0o002, 0o001];
|
|
27
|
-
const syms = ["r", "w", "x", "r", "w", "x", "r", "w", "x"];
|
|
28
|
-
return (isDir ? "d" : isSymlink ? "l" : "-") +
|
|
29
|
-
bits.map((b, i) => mode & b ? syms[i] : "-").join("");
|
|
30
|
-
};
|
|
31
|
-
const octal = (st.mode).toString(8).padStart(4, "0");
|
|
32
|
-
const modeStr = modePerm(st.mode);
|
|
33
|
-
const size = "size" in st ? st.size : 0;
|
|
34
|
-
const ts = (d) => d.toISOString().replace("T", " ").replace(/\.\d+Z$/, " +0000");
|
|
35
|
-
// -c format string support
|
|
36
|
-
if (fmt) {
|
|
37
|
-
const out = fmt
|
|
38
|
-
.replace("%n", file)
|
|
39
|
-
.replace("%s", String(size))
|
|
40
|
-
.replace("%a", octal.slice(1)) // access in octal (no leading 0)
|
|
41
|
-
.replace("%A", modeStr)
|
|
42
|
-
.replace("%F", isSymlink ? "symbolic link" : isDir ? "directory" : "regular file")
|
|
43
|
-
.replace("%y", ts(st.updatedAt))
|
|
44
|
-
.replace("%z", ts(st.updatedAt));
|
|
45
|
-
return { stdout: `${out}\n`, exitCode: 0 };
|
|
46
|
-
}
|
|
47
|
-
const out = [
|
|
48
|
-
` File: ${file}${isSymlink ? ` -> ${shell.vfs.resolveSymlink(p)}` : ""}`,
|
|
49
|
-
` Size: ${size}${"\t".repeat(3)}${isSymlink ? "symbolic link" : isDir ? "directory" : "regular file"}`,
|
|
50
|
-
`Access: (${octal}/${modeStr}) Uid: ( 0/ root) Gid: ( 0/ root)`,
|
|
51
|
-
`Modify: ${ts(st.updatedAt)}`,
|
|
52
|
-
`Change: ${ts(st.updatedAt)}`,
|
|
53
|
-
].join("\n");
|
|
54
|
-
return { stdout: `${out}\n`, exitCode: 0 };
|
|
55
|
-
},
|
|
56
|
-
};
|
package/src/commands/su.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"su.d.ts","sourceRoot":"","sources":["su.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,WAuDvB,CAAC"}
|
package/src/commands/su.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { runCommand } from "./runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Switch to another user account.
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* su [username] — switch to username (defaults to root)
|
|
7
|
-
* su - [username] — login shell (changes cwd to target home)
|
|
8
|
-
* su -c 'cmd' [user] — run command as user
|
|
9
|
-
*
|
|
10
|
-
* - Root can switch to any user without a password.
|
|
11
|
-
* - Non-root sudoers must enter the target user's password.
|
|
12
|
-
* - Non-sudoers are denied.
|
|
13
|
-
* - Switching to a non-existent user returns an error immediately.
|
|
14
|
-
*/
|
|
15
|
-
export const suCommand = {
|
|
16
|
-
name: "su",
|
|
17
|
-
description: "Switch user",
|
|
18
|
-
category: "users",
|
|
19
|
-
params: ["[-] [-c <cmd>] [username]"],
|
|
20
|
-
run: async ({ authUser, shell, args, hostname, mode, cwd }) => {
|
|
21
|
-
const loginShellFlag = args.includes("-") || args.includes("-l") || args.includes("--login");
|
|
22
|
-
const cIdx = args.indexOf("-c");
|
|
23
|
-
const cmdLine = cIdx !== -1 ? args[cIdx + 1] : undefined;
|
|
24
|
-
const filteredArgs = args.filter((_, i) => i !== cIdx && i !== cIdx + 1).filter((a) => a !== "-" && a !== "-l" && a !== "--login");
|
|
25
|
-
const targetUser = filteredArgs.find((a) => !a.startsWith("-")) ?? "root";
|
|
26
|
-
// Verify target user exists
|
|
27
|
-
if (!shell.users.listUsers().includes(targetUser)) {
|
|
28
|
-
return { stderr: `su: user '${targetUser}' does not exist\n`, exitCode: 1 };
|
|
29
|
-
}
|
|
30
|
-
// Root switches freely without any password
|
|
31
|
-
if (authUser === "root") {
|
|
32
|
-
if (cmdLine) {
|
|
33
|
-
return runCommand(cmdLine, targetUser, hostname, mode, loginShellFlag ? `/home/${targetUser}` : cwd, shell);
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
switchUser: targetUser,
|
|
37
|
-
nextCwd: loginShellFlag ? `/home/${targetUser}` : undefined,
|
|
38
|
-
exitCode: 0,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
// Non-sudoers denied
|
|
42
|
-
if (!shell.users.isSudoer(authUser)) {
|
|
43
|
-
return { stderr: "su: permission denied\n", exitCode: 1 };
|
|
44
|
-
}
|
|
45
|
-
// Sudoers must enter target user's password via challenge
|
|
46
|
-
return {
|
|
47
|
-
sudoChallenge: {
|
|
48
|
-
username: targetUser,
|
|
49
|
-
targetUser,
|
|
50
|
-
commandLine: cmdLine ?? null,
|
|
51
|
-
loginShell: loginShellFlag,
|
|
52
|
-
prompt: "Password: ",
|
|
53
|
-
},
|
|
54
|
-
exitCode: 0,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sudo.d.ts","sourceRoot":"","sources":["sudo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0BrD,eAAO,MAAM,WAAW,EAAE,WAiDzB,CAAC"}
|
package/src/commands/sudo.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { parseArgs } from "./command-helpers";
|
|
2
|
-
import { runCommand } from "./runtime";
|
|
3
|
-
/**
|
|
4
|
-
* Execute a command as another user (superuser by default).
|
|
5
|
-
* @category users
|
|
6
|
-
* @params ["[-u user] [-c cmd] [command]"]
|
|
7
|
-
*/
|
|
8
|
-
function parseSudoArgs(args) {
|
|
9
|
-
const { flags, flagsWithValues, positionals } = parseArgs(args, {
|
|
10
|
-
flags: ["-i", "-S"],
|
|
11
|
-
flagsWithValue: ["-u", "--user"],
|
|
12
|
-
});
|
|
13
|
-
const loginShell = flags.has("-i");
|
|
14
|
-
const targetUser = flagsWithValues.get("-u") || flagsWithValues.get("--user") || "root";
|
|
15
|
-
const commandLine = positionals.length > 0 ? positionals.join(" ") : null;
|
|
16
|
-
return { targetUser, loginShell, commandLine };
|
|
17
|
-
}
|
|
18
|
-
export const sudoCommand = {
|
|
19
|
-
name: "sudo",
|
|
20
|
-
description: "Execute as superuser",
|
|
21
|
-
category: "users",
|
|
22
|
-
params: ["<command...>"],
|
|
23
|
-
run: async ({ authUser, hostname, mode, cwd, shell, args }) => {
|
|
24
|
-
const { targetUser, loginShell, commandLine } = parseSudoArgs(args);
|
|
25
|
-
if (authUser !== "root" && !shell.users.isSudoer(authUser)) {
|
|
26
|
-
return { stderr: "sudo: permission denied", exitCode: 1 };
|
|
27
|
-
}
|
|
28
|
-
const effectiveUser = targetUser || "root";
|
|
29
|
-
const prompt = `[sudo] password for ${authUser}: `;
|
|
30
|
-
if (authUser === "root") {
|
|
31
|
-
if (!commandLine && loginShell) {
|
|
32
|
-
return {
|
|
33
|
-
switchUser: effectiveUser,
|
|
34
|
-
nextCwd: `/home/${effectiveUser}`,
|
|
35
|
-
exitCode: 0,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
if (!commandLine) {
|
|
39
|
-
return { stderr: "sudo: missing command", exitCode: 1 };
|
|
40
|
-
}
|
|
41
|
-
return runCommand(commandLine, effectiveUser, hostname, mode, loginShell ? `/home/${effectiveUser}` : cwd, shell);
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
sudoChallenge: {
|
|
45
|
-
username: authUser,
|
|
46
|
-
targetUser: effectiveUser,
|
|
47
|
-
commandLine,
|
|
48
|
-
loginShell,
|
|
49
|
-
prompt,
|
|
50
|
-
},
|
|
51
|
-
exitCode: 0,
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["tail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA2CzB,CAAC"}
|
package/src/commands/tail.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { getFlag } from "./command-helpers";
|
|
2
|
-
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
-
/**
|
|
4
|
-
* Output the last part of files or stdin.
|
|
5
|
-
* @category text
|
|
6
|
-
* @params ["[-n <lines>] [file...]"]
|
|
7
|
-
*/
|
|
8
|
-
export const tailCommand = {
|
|
9
|
-
name: "tail",
|
|
10
|
-
description: "Output last lines",
|
|
11
|
-
category: "text",
|
|
12
|
-
params: ["[-n <lines>] [file...]"],
|
|
13
|
-
run: ({ authUser, shell, cwd, args, stdin }) => {
|
|
14
|
-
const nArg = getFlag(args, ["-n"]);
|
|
15
|
-
const shortN = args.find((a) => /^-\d+$/.test(a));
|
|
16
|
-
const n = typeof nArg === "string"
|
|
17
|
-
? parseInt(nArg, 10)
|
|
18
|
-
: shortN ? parseInt(shortN.slice(1), 10) : 10;
|
|
19
|
-
const positionals = args.filter((a) => !a.startsWith("-") && a !== nArg && a !== String(n));
|
|
20
|
-
const take = (content) => {
|
|
21
|
-
const lines = content.split("\n");
|
|
22
|
-
// If content ends with \n, last element is ""; exclude from count
|
|
23
|
-
const hasTrailingNewline = content.endsWith("\n");
|
|
24
|
-
const meaningful = hasTrailingNewline ? lines.slice(0, -1) : lines;
|
|
25
|
-
const sliced = meaningful.slice(Math.max(0, meaningful.length - n));
|
|
26
|
-
return sliced.join("\n") + (hasTrailingNewline ? "\n" : "");
|
|
27
|
-
};
|
|
28
|
-
if (positionals.length === 0) {
|
|
29
|
-
return { stdout: take(stdin ?? ""), exitCode: 0 };
|
|
30
|
-
}
|
|
31
|
-
const results = [];
|
|
32
|
-
for (const file of positionals) {
|
|
33
|
-
const filePath = resolvePath(cwd, file);
|
|
34
|
-
try {
|
|
35
|
-
assertPathAccess(authUser, filePath, "tail");
|
|
36
|
-
results.push(take(shell.vfs.readFile(filePath)));
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return {
|
|
40
|
-
stderr: `tail: ${file}: No such file or directory`,
|
|
41
|
-
exitCode: 1,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return { stdout: results.join("\n"), exitCode: 0 };
|
|
46
|
-
},
|
|
47
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["tar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WA6FxB,CAAC"}
|
package/src/commands/tar.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { resolvePath } from "./helpers";
|
|
2
|
-
/**
|
|
3
|
-
* Archive or extract files with tar and optional gzip compression.
|
|
4
|
-
* @category archive
|
|
5
|
-
* @params ["[-czf|-xzf|-tf] <archive> [files...]"]
|
|
6
|
-
*/
|
|
7
|
-
export const tarCommand = {
|
|
8
|
-
name: "tar",
|
|
9
|
-
description: "Archive utility",
|
|
10
|
-
category: "archive",
|
|
11
|
-
params: ["[-czf|-xzf|-tf] <archive> [files...]"],
|
|
12
|
-
run: ({ authUser, shell, cwd, args }) => {
|
|
13
|
-
// Expand combined flags: -czf or czf (bare mode string) → ["-c", "-z", "-f"]
|
|
14
|
-
const expanded = [];
|
|
15
|
-
let foundModeStr = false;
|
|
16
|
-
for (const a of args) {
|
|
17
|
-
if (/^-[a-zA-Z]{2,}$/.test(a)) {
|
|
18
|
-
// -czf style
|
|
19
|
-
for (const ch of a.slice(1))
|
|
20
|
-
expanded.push(`-${ch}`);
|
|
21
|
-
}
|
|
22
|
-
else if (!foundModeStr && /^[cxtdru]{1,}[a-zA-Z]*$/.test(a) && !a.includes("/") && !a.startsWith("-")) {
|
|
23
|
-
// czf bare style (first non-path arg)
|
|
24
|
-
foundModeStr = true;
|
|
25
|
-
for (const ch of a)
|
|
26
|
-
expanded.push(`-${ch}`);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
expanded.push(a);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const create = expanded.includes("-c");
|
|
33
|
-
const extract = expanded.includes("-x");
|
|
34
|
-
const list = expanded.includes("-t");
|
|
35
|
-
const fIdx = expanded.indexOf("-f");
|
|
36
|
-
const archiveName = fIdx !== -1
|
|
37
|
-
? expanded[fIdx + 1]
|
|
38
|
-
: expanded.find((a) => a.endsWith(".tar") || a.endsWith(".tar.gz") || a.endsWith(".tgz"));
|
|
39
|
-
if (!create && !extract && !list) {
|
|
40
|
-
return { stderr: "tar: must specify -c, -x, or -t\n", exitCode: 1 };
|
|
41
|
-
}
|
|
42
|
-
if (!archiveName)
|
|
43
|
-
return { stderr: "tar: no archive specified\n", exitCode: 1 };
|
|
44
|
-
const archivePath = resolvePath(cwd, archiveName);
|
|
45
|
-
if (create) {
|
|
46
|
-
// Skip flags and archive name from file list
|
|
47
|
-
const skipNext2 = new Set();
|
|
48
|
-
if (fIdx !== -1)
|
|
49
|
-
skipNext2.add(fIdx + 1);
|
|
50
|
-
const fileArgs = expanded.filter((a, i) => !a.startsWith("-") && a !== archiveName && !skipNext2.has(i));
|
|
51
|
-
const entries = {};
|
|
52
|
-
for (const f of fileArgs) {
|
|
53
|
-
const p = resolvePath(cwd, f);
|
|
54
|
-
try {
|
|
55
|
-
const stat = shell.vfs.stat(p);
|
|
56
|
-
if (stat.type === "file")
|
|
57
|
-
entries[f] = shell.vfs.readFile(p);
|
|
58
|
-
else {
|
|
59
|
-
const walk = (dir, prefix) => {
|
|
60
|
-
for (const e of shell.vfs.list(dir)) {
|
|
61
|
-
const full = `${dir}/${e}`, rel = `${prefix}/${e}`;
|
|
62
|
-
const s = shell.vfs.stat(full);
|
|
63
|
-
if (s.type === "file")
|
|
64
|
-
entries[rel] = shell.vfs.readFile(full);
|
|
65
|
-
else
|
|
66
|
-
walk(full, rel);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
walk(p, f);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
return {
|
|
74
|
-
stderr: `tar: ${f}: No such file or directory`,
|
|
75
|
-
exitCode: 1,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
shell.writeFileAsUser(authUser, archivePath, JSON.stringify(entries));
|
|
80
|
-
return { exitCode: 0 };
|
|
81
|
-
}
|
|
82
|
-
if (list || extract) {
|
|
83
|
-
let entries;
|
|
84
|
-
try {
|
|
85
|
-
entries = JSON.parse(shell.vfs.readFile(archivePath));
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
return {
|
|
89
|
-
stderr: `tar: ${archiveName}: cannot open archive`,
|
|
90
|
-
exitCode: 1,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
if (list)
|
|
94
|
-
return { stdout: Object.keys(entries).join("\n"), exitCode: 0 };
|
|
95
|
-
for (const [name, content] of Object.entries(entries)) {
|
|
96
|
-
shell.writeFileAsUser(authUser, resolvePath(cwd, name), content);
|
|
97
|
-
}
|
|
98
|
-
return { exitCode: 0 };
|
|
99
|
-
}
|
|
100
|
-
return { stderr: "tar: must specify -c, -x, or -t", exitCode: 1 };
|
|
101
|
-
},
|
|
102
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tee.d.ts","sourceRoot":"","sources":["tee.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WA0BxB,CAAC"}
|
package/src/commands/tee.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ifFlag } from "./command-helpers";
|
|
2
|
-
import { resolvePath } from "./helpers";
|
|
3
|
-
/**
|
|
4
|
-
* Read stdin and write to stdout and files simultaneously.
|
|
5
|
-
* @category text
|
|
6
|
-
* @params ["[-a] <file...>"]
|
|
7
|
-
*/
|
|
8
|
-
export const teeCommand = {
|
|
9
|
-
name: "tee",
|
|
10
|
-
description: "Read stdin, write to stdout and files",
|
|
11
|
-
category: "text",
|
|
12
|
-
params: ["[-a] <file...>"],
|
|
13
|
-
run: ({ authUser, shell, cwd, args, stdin }) => {
|
|
14
|
-
const append = ifFlag(args, ["-a"]);
|
|
15
|
-
const files = args.filter((a) => !a.startsWith("-"));
|
|
16
|
-
const input = stdin ?? "";
|
|
17
|
-
for (const f of files) {
|
|
18
|
-
const p = resolvePath(cwd, f);
|
|
19
|
-
if (append) {
|
|
20
|
-
const existing = (() => {
|
|
21
|
-
try {
|
|
22
|
-
return shell.vfs.readFile(p);
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return "";
|
|
26
|
-
}
|
|
27
|
-
})();
|
|
28
|
-
shell.writeFileAsUser(authUser, p, existing + input);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
shell.writeFileAsUser(authUser, p, input);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return { stdout: input, exitCode: 0 };
|
|
35
|
-
},
|
|
36
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0HrD,eAAO,MAAM,WAAW,EAAE,WAczB,CAAC"}
|
package/src/commands/test.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Evaluate a POSIX test expression.
|
|
3
|
-
* Supports: -f, -d, -e, -r, -w, -x, -s, -z, -n,
|
|
4
|
-
* string =, !=, numeric -eq -ne -lt -le -gt -ge,
|
|
5
|
-
* ! (negate), -a (and), -o (or).
|
|
6
|
-
*/
|
|
7
|
-
function evalTest(tokens, shell, cwd) {
|
|
8
|
-
// When called via [ command, ] is the last arg — strip it
|
|
9
|
-
// When called via test command, no brackets present
|
|
10
|
-
if (tokens[tokens.length - 1] === "]") {
|
|
11
|
-
tokens = tokens.slice(0, -1);
|
|
12
|
-
}
|
|
13
|
-
// Also strip leading [ if present (shouldn't normally happen but be safe)
|
|
14
|
-
if (tokens[0] === "[") {
|
|
15
|
-
tokens = tokens.slice(1);
|
|
16
|
-
}
|
|
17
|
-
if (tokens.length === 0)
|
|
18
|
-
return false;
|
|
19
|
-
// Negation
|
|
20
|
-
if (tokens[0] === "!")
|
|
21
|
-
return !evalTest(tokens.slice(1), shell, cwd);
|
|
22
|
-
// Boolean -a / -o (simple left-right, no precedence)
|
|
23
|
-
const andIdx = tokens.indexOf("-a");
|
|
24
|
-
if (andIdx !== -1) {
|
|
25
|
-
return (evalTest(tokens.slice(0, andIdx), shell, cwd) &&
|
|
26
|
-
evalTest(tokens.slice(andIdx + 1), shell, cwd));
|
|
27
|
-
}
|
|
28
|
-
const orIdx = tokens.indexOf("-o");
|
|
29
|
-
if (orIdx !== -1) {
|
|
30
|
-
return (evalTest(tokens.slice(0, orIdx), shell, cwd) ||
|
|
31
|
-
evalTest(tokens.slice(orIdx + 1), shell, cwd));
|
|
32
|
-
}
|
|
33
|
-
// Unary file tests
|
|
34
|
-
if (tokens.length === 2) {
|
|
35
|
-
const [flag, operand = ""] = tokens;
|
|
36
|
-
const resolvePath = (p) => p.startsWith("/") ? p : `${cwd}/${p}`.replace(/\/+/g, "/");
|
|
37
|
-
const path = resolvePath(operand);
|
|
38
|
-
switch (flag) {
|
|
39
|
-
case "-e":
|
|
40
|
-
return shell.vfs.exists(path);
|
|
41
|
-
case "-f":
|
|
42
|
-
return shell.vfs.exists(path) && shell.vfs.stat(path).type === "file";
|
|
43
|
-
case "-d":
|
|
44
|
-
return (shell.vfs.exists(path) && shell.vfs.stat(path).type === "directory");
|
|
45
|
-
case "-r":
|
|
46
|
-
return shell.vfs.exists(path); // all readable in virtual env
|
|
47
|
-
case "-w":
|
|
48
|
-
return shell.vfs.exists(path);
|
|
49
|
-
case "-x":
|
|
50
|
-
return shell.vfs.exists(path) && !!(shell.vfs.stat(path).mode & 0o111);
|
|
51
|
-
case "-s":
|
|
52
|
-
return (shell.vfs.exists(path) &&
|
|
53
|
-
shell.vfs.stat(path).type === "file" &&
|
|
54
|
-
shell.vfs.stat(path).size > 0);
|
|
55
|
-
case "-z":
|
|
56
|
-
return operand.length === 0;
|
|
57
|
-
case "-n":
|
|
58
|
-
return operand.length > 0;
|
|
59
|
-
case "-L":
|
|
60
|
-
return shell.vfs.isSymlink(path);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// Binary comparisons
|
|
64
|
-
if (tokens.length === 3) {
|
|
65
|
-
const [left = "", op, right = ""] = tokens;
|
|
66
|
-
const leftN = Number(left);
|
|
67
|
-
const rightN = Number(right);
|
|
68
|
-
switch (op) {
|
|
69
|
-
// String
|
|
70
|
-
case "=":
|
|
71
|
-
case "==":
|
|
72
|
-
return left === right;
|
|
73
|
-
case "!=":
|
|
74
|
-
return left !== right;
|
|
75
|
-
case "<":
|
|
76
|
-
return left < right;
|
|
77
|
-
case ">":
|
|
78
|
-
return left > right;
|
|
79
|
-
// Numeric
|
|
80
|
-
case "-eq":
|
|
81
|
-
return leftN === rightN;
|
|
82
|
-
case "-ne":
|
|
83
|
-
return leftN !== rightN;
|
|
84
|
-
case "-lt":
|
|
85
|
-
return leftN < rightN;
|
|
86
|
-
case "-le":
|
|
87
|
-
return leftN <= rightN;
|
|
88
|
-
case "-gt":
|
|
89
|
-
return leftN > rightN;
|
|
90
|
-
case "-ge":
|
|
91
|
-
return leftN >= rightN;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Single string (truthy if non-empty)
|
|
95
|
-
if (tokens.length === 1)
|
|
96
|
-
return (tokens[0] ?? "").length > 0;
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
export const testCommand = {
|
|
100
|
-
name: "test",
|
|
101
|
-
aliases: ["["],
|
|
102
|
-
description: "Evaluate conditional expression",
|
|
103
|
-
category: "shell",
|
|
104
|
-
params: ["<expression>"],
|
|
105
|
-
run: ({ args, shell, cwd }) => {
|
|
106
|
-
try {
|
|
107
|
-
const result = evalTest([...args], shell, cwd);
|
|
108
|
-
return { exitCode: result ? 0 : 1 };
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
return { stderr: "test: malformed expression", exitCode: 2 };
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"touch.d.ts","sourceRoot":"","sources":["touch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAmB1B,CAAC"}
|
package/src/commands/touch.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { assertPathAccess, resolvePath } from "./helpers";
|
|
2
|
-
/**
|
|
3
|
-
* Create empty files or update file timestamps.
|
|
4
|
-
* @category files
|
|
5
|
-
* @params ["<file>"]
|
|
6
|
-
*/
|
|
7
|
-
export const touchCommand = {
|
|
8
|
-
name: "touch",
|
|
9
|
-
description: "Create or update files",
|
|
10
|
-
category: "files",
|
|
11
|
-
params: ["<file>"],
|
|
12
|
-
run: ({ authUser, shell, cwd, args }) => {
|
|
13
|
-
if (args.length === 0) {
|
|
14
|
-
return { stderr: "touch: missing file operand", exitCode: 1 };
|
|
15
|
-
}
|
|
16
|
-
for (const file of args) {
|
|
17
|
-
const target = resolvePath(cwd, file);
|
|
18
|
-
assertPathAccess(authUser, target, "touch");
|
|
19
|
-
if (!shell.vfs.exists(target)) {
|
|
20
|
-
shell.writeFileAsUser(authUser, target, "");
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return { exitCode: 0 };
|
|
24
|
-
},
|
|
25
|
-
};
|
package/src/commands/tr.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tr.d.ts","sourceRoot":"","sources":["tr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgCrD,eAAO,MAAM,SAAS,EAAE,WAqCvB,CAAC"}
|
package/src/commands/tr.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ifFlag } from "./command-helpers";
|
|
2
|
-
function unescapeTrSet(s) {
|
|
3
|
-
return s
|
|
4
|
-
.replace(/\\n/g, "\n")
|
|
5
|
-
.replace(/\\t/g, "\t")
|
|
6
|
-
.replace(/\\r/g, "\r")
|
|
7
|
-
.replace(/\\\\/g, "\\");
|
|
8
|
-
}
|
|
9
|
-
function expandTrSet(s) {
|
|
10
|
-
const chars = [];
|
|
11
|
-
const unescaped = unescapeTrSet(s);
|
|
12
|
-
let i = 0;
|
|
13
|
-
while (i < unescaped.length) {
|
|
14
|
-
// Range: a-z, A-Z, 0-9
|
|
15
|
-
if (i + 2 < unescaped.length && unescaped[i + 1] === "-") {
|
|
16
|
-
const from = unescaped.charCodeAt(i);
|
|
17
|
-
const to = unescaped.charCodeAt(i + 2);
|
|
18
|
-
if (from <= to) {
|
|
19
|
-
for (let c = from; c <= to; c++)
|
|
20
|
-
chars.push(String.fromCharCode(c));
|
|
21
|
-
i += 3;
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
chars.push(unescaped[i]);
|
|
26
|
-
i++;
|
|
27
|
-
}
|
|
28
|
-
return chars;
|
|
29
|
-
}
|
|
30
|
-
export const trCommand = {
|
|
31
|
-
name: "tr",
|
|
32
|
-
description: "Translate or delete characters",
|
|
33
|
-
category: "text",
|
|
34
|
-
params: ["[-d] [-s] <set1> [set2]"],
|
|
35
|
-
run: ({ args, stdin }) => {
|
|
36
|
-
const del = ifFlag(args, ["-d"]);
|
|
37
|
-
const squeeze = ifFlag(args, ["-s"]);
|
|
38
|
-
const positionals = args.filter((a) => !a.startsWith("-"));
|
|
39
|
-
const set1chars = expandTrSet(positionals[0] ?? "");
|
|
40
|
-
const set2chars = expandTrSet(positionals[1] ?? "");
|
|
41
|
-
let input = stdin ?? "";
|
|
42
|
-
if (del) {
|
|
43
|
-
const deleteSet = new Set(set1chars);
|
|
44
|
-
input = [...input].filter((c) => !deleteSet.has(c)).join("");
|
|
45
|
-
}
|
|
46
|
-
else if (set2chars.length > 0) {
|
|
47
|
-
// Build translation map
|
|
48
|
-
const map = new Map();
|
|
49
|
-
for (let i = 0; i < set1chars.length; i++) {
|
|
50
|
-
map.set(set1chars[i], set2chars[i] ?? set2chars[set2chars.length - 1] ?? "");
|
|
51
|
-
}
|
|
52
|
-
input = [...input].map((c) => map.get(c) ?? c).join("");
|
|
53
|
-
}
|
|
54
|
-
if (squeeze && set2chars.length > 0) {
|
|
55
|
-
// Squeeze repeated characters in set2
|
|
56
|
-
const squeezeSet = new Set(set2chars);
|
|
57
|
-
input = input.replace(/(.)\1+/g, (_, c) => squeezeSet.has(c) ? c : _);
|
|
58
|
-
}
|
|
59
|
-
return { stdout: input, exitCode: 0 };
|
|
60
|
-
},
|
|
61
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAUzB,CAAC"}
|
package/src/commands/tree.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getArg } from "./command-helpers";
|
|
2
|
-
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
-
/**
|
|
4
|
-
* Display directory structure in a tree format.
|
|
5
|
-
* @category navigation
|
|
6
|
-
* @params ["[path]"]
|
|
7
|
-
*/
|
|
8
|
-
export const treeCommand = {
|
|
9
|
-
name: "tree",
|
|
10
|
-
description: "Display directory tree",
|
|
11
|
-
category: "navigation",
|
|
12
|
-
params: ["[path]"],
|
|
13
|
-
run: ({ authUser, shell, cwd, args }) => {
|
|
14
|
-
const target = resolvePath(cwd, getArg(args, 0) ?? cwd);
|
|
15
|
-
assertPathAccess(authUser, target, "tree");
|
|
16
|
-
return { stdout: shell.vfs.tree(target), exitCode: 0 };
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"true.d.ts","sourceRoot":"","sources":["true.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAMzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAM1B,CAAC"}
|