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/gzip.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { resolvePath } from "./helpers";
|
|
2
|
-
/**
|
|
3
|
-
* Compress files using gzip — renames file to `<file>.gz`, removes original.
|
|
4
|
-
* @category archive
|
|
5
|
-
*/
|
|
6
|
-
export const gzipCommand = {
|
|
7
|
-
name: "gzip",
|
|
8
|
-
description: "Compress files",
|
|
9
|
-
category: "archive",
|
|
10
|
-
params: ["[-k] [-d] <file>"],
|
|
11
|
-
run: ({ shell, cwd, args }) => {
|
|
12
|
-
if (!shell.packageManager.isInstalled("gzip")) {
|
|
13
|
-
return {
|
|
14
|
-
stderr: "bash: gzip: command not found\nHint: install it with: apt install gzip\n",
|
|
15
|
-
exitCode: 127,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
const keepOrig = args.includes("-k") || args.includes("--keep");
|
|
19
|
-
const decompress = args.includes("-d");
|
|
20
|
-
const file = args.find((a) => !a.startsWith("-"));
|
|
21
|
-
if (!file)
|
|
22
|
-
return { stderr: "gzip: no file specified\n", exitCode: 1 };
|
|
23
|
-
const p = resolvePath(cwd, file);
|
|
24
|
-
if (decompress) {
|
|
25
|
-
// gzip -d = gunzip
|
|
26
|
-
if (!file.endsWith(".gz")) {
|
|
27
|
-
return { stderr: `gzip: ${file}: unknown suffix -- ignored\n`, exitCode: 1 };
|
|
28
|
-
}
|
|
29
|
-
if (!shell.vfs.exists(p)) {
|
|
30
|
-
return { stderr: `gzip: ${file}: No such file or directory\n`, exitCode: 1 };
|
|
31
|
-
}
|
|
32
|
-
const content = shell.vfs.readFile(p);
|
|
33
|
-
const dest = p.slice(0, -3);
|
|
34
|
-
shell.vfs.writeFile(dest, content);
|
|
35
|
-
if (!keepOrig)
|
|
36
|
-
shell.vfs.remove(p);
|
|
37
|
-
return { exitCode: 0 };
|
|
38
|
-
}
|
|
39
|
-
if (!shell.vfs.exists(p)) {
|
|
40
|
-
return { stderr: `gzip: ${file}: No such file or directory\n`, exitCode: 1 };
|
|
41
|
-
}
|
|
42
|
-
if (file.endsWith(".gz")) {
|
|
43
|
-
return { stderr: `gzip: ${file}: already has .gz suffix -- unchanged\n`, exitCode: 1 };
|
|
44
|
-
}
|
|
45
|
-
const rawContent = shell.vfs.readFileRaw(p);
|
|
46
|
-
const gzPath = `${p}.gz`;
|
|
47
|
-
shell.vfs.writeFile(gzPath, rawContent, { compress: true });
|
|
48
|
-
if (!keepOrig)
|
|
49
|
-
shell.vfs.remove(p);
|
|
50
|
-
return { exitCode: 0 };
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Decompress gzip files — renames `<file>.gz` to `<file>`, removes original.
|
|
55
|
-
* @category archive
|
|
56
|
-
*/
|
|
57
|
-
export const gunzipCommand = {
|
|
58
|
-
name: "gunzip",
|
|
59
|
-
description: "Decompress files",
|
|
60
|
-
category: "archive",
|
|
61
|
-
aliases: ["zcat"],
|
|
62
|
-
params: ["[-k] <file>"],
|
|
63
|
-
run: ({ shell, cwd, args }) => {
|
|
64
|
-
const keepOrig = args.includes("-k") || args.includes("--keep");
|
|
65
|
-
const file = args.find((a) => !a.startsWith("-"));
|
|
66
|
-
if (!file)
|
|
67
|
-
return { stderr: "gunzip: no file specified\n", exitCode: 1 };
|
|
68
|
-
const p = resolvePath(cwd, file);
|
|
69
|
-
if (!shell.vfs.exists(p)) {
|
|
70
|
-
return { stderr: `gunzip: ${file}: No such file or directory\n`, exitCode: 1 };
|
|
71
|
-
}
|
|
72
|
-
if (!file.endsWith(".gz")) {
|
|
73
|
-
return { stderr: `gunzip: ${file}: unknown suffix -- ignored\n`, exitCode: 1 };
|
|
74
|
-
}
|
|
75
|
-
const content = shell.vfs.readFile(p);
|
|
76
|
-
const dest = p.slice(0, -3);
|
|
77
|
-
shell.vfs.writeFile(dest, content);
|
|
78
|
-
if (!keepOrig)
|
|
79
|
-
shell.vfs.remove(p);
|
|
80
|
-
return { exitCode: 0 };
|
|
81
|
-
},
|
|
82
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA0CzB,CAAC"}
|
package/src/commands/head.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { getFlag } from "./command-helpers";
|
|
2
|
-
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
-
/**
|
|
4
|
-
* Output the first part of files or stdin (head).
|
|
5
|
-
* @category text
|
|
6
|
-
* @params ["[-n <lines>] [file...]"]
|
|
7
|
-
*/
|
|
8
|
-
export const headCommand = {
|
|
9
|
-
name: "head",
|
|
10
|
-
description: "Output first lines",
|
|
11
|
-
category: "text",
|
|
12
|
-
params: ["[-n <lines>] [file...]"],
|
|
13
|
-
run: ({ authUser, shell, cwd, args, stdin }) => {
|
|
14
|
-
const nArg = getFlag(args, ["-n"]);
|
|
15
|
-
// Support both -n N and -N shorthand (head -2, head -10)
|
|
16
|
-
const shortN = args.find((a) => /^-\d+$/.test(a));
|
|
17
|
-
const n = typeof nArg === "string"
|
|
18
|
-
? parseInt(nArg, 10)
|
|
19
|
-
: shortN ? parseInt(shortN.slice(1), 10) : 10;
|
|
20
|
-
const positionals = args.filter((a) => !a.startsWith("-") && a !== nArg && a !== String(n));
|
|
21
|
-
const take = (content) => {
|
|
22
|
-
const lines = content.split("\n");
|
|
23
|
-
// Preserve trailing newline
|
|
24
|
-
const sliced = lines.slice(0, n);
|
|
25
|
-
return sliced.join("\n") + (content.endsWith("\n") && sliced.length === lines.slice(0, n).length ? "\n" : "");
|
|
26
|
-
};
|
|
27
|
-
if (positionals.length === 0) {
|
|
28
|
-
return { stdout: take(stdin ?? ""), exitCode: 0 };
|
|
29
|
-
}
|
|
30
|
-
const results = [];
|
|
31
|
-
for (const file of positionals) {
|
|
32
|
-
const filePath = resolvePath(cwd, file);
|
|
33
|
-
try {
|
|
34
|
-
assertPathAccess(authUser, filePath, "head");
|
|
35
|
-
results.push(take(shell.vfs.readFile(filePath)));
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return {
|
|
39
|
-
stderr: `head: ${file}: No such file or directory`,
|
|
40
|
-
exitCode: 1,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return { stdout: results.join("\n"), exitCode: 0 };
|
|
45
|
-
},
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6HrD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,MAAM,EAAE,GAAG,WAAW,CA0BxE"}
|
package/src/commands/help.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { getCommandModulesPublic } from "./registry";
|
|
2
|
-
// ─── category config ──────────────────────────────────────────────────────────
|
|
3
|
-
const CATEGORY_ORDER = [
|
|
4
|
-
"navigation",
|
|
5
|
-
"files",
|
|
6
|
-
"text",
|
|
7
|
-
"archive",
|
|
8
|
-
"system",
|
|
9
|
-
"package",
|
|
10
|
-
"network",
|
|
11
|
-
"shell",
|
|
12
|
-
"users",
|
|
13
|
-
"misc",
|
|
14
|
-
];
|
|
15
|
-
const CATEGORY_LABELS = {
|
|
16
|
-
navigation: "Navigation",
|
|
17
|
-
files: "Files & Filesystem",
|
|
18
|
-
text: "Text Processing",
|
|
19
|
-
archive: "Archive & Compression",
|
|
20
|
-
system: "System",
|
|
21
|
-
package: "Package Management",
|
|
22
|
-
network: "Network",
|
|
23
|
-
shell: "Shell & Scripting",
|
|
24
|
-
users: "Users & Permissions",
|
|
25
|
-
misc: "Miscellaneous",
|
|
26
|
-
};
|
|
27
|
-
// ─── formatting helpers ───────────────────────────────────────────────────────
|
|
28
|
-
const BOLD = "\x1b[1m";
|
|
29
|
-
const RESET = "\x1b[0m";
|
|
30
|
-
const CYAN = "\x1b[36m";
|
|
31
|
-
const YLW = "\x1b[33m";
|
|
32
|
-
const DIM = "\x1b[2m";
|
|
33
|
-
const GREEN = "\x1b[32m";
|
|
34
|
-
function pad(s, n) {
|
|
35
|
-
return s.length >= n ? s : s + " ".repeat(n - s.length);
|
|
36
|
-
}
|
|
37
|
-
function formatCmdLine(mod) {
|
|
38
|
-
const aliases = mod.aliases?.length
|
|
39
|
-
? ` ${DIM}(${mod.aliases.join(", ")})${RESET}`
|
|
40
|
-
: "";
|
|
41
|
-
return ` ${CYAN}${pad(mod.name, 16)}${RESET}${aliases}${pad("", mod.aliases?.length ? 0 : 0)} ${mod.description ?? ""}`;
|
|
42
|
-
}
|
|
43
|
-
// ─── full grouped listing ─────────────────────────────────────────────────────
|
|
44
|
-
function renderFull(modules) {
|
|
45
|
-
const grouped = {};
|
|
46
|
-
for (const mod of modules) {
|
|
47
|
-
const cat = mod.category ?? "misc";
|
|
48
|
-
if (!grouped[cat])
|
|
49
|
-
grouped[cat] = [];
|
|
50
|
-
grouped[cat].push(mod);
|
|
51
|
-
}
|
|
52
|
-
const lines = [
|
|
53
|
-
`${BOLD}Available commands${RESET}`,
|
|
54
|
-
`${DIM}Type 'help <command>' for detailed usage.${RESET}`,
|
|
55
|
-
"",
|
|
56
|
-
];
|
|
57
|
-
const cats = [
|
|
58
|
-
...CATEGORY_ORDER.filter((c) => grouped[c]),
|
|
59
|
-
...Object.keys(grouped)
|
|
60
|
-
.filter((c) => !CATEGORY_ORDER.includes(c))
|
|
61
|
-
.sort(),
|
|
62
|
-
];
|
|
63
|
-
for (const cat of cats) {
|
|
64
|
-
const mods = grouped[cat];
|
|
65
|
-
if (!mods?.length)
|
|
66
|
-
continue;
|
|
67
|
-
lines.push(`${YLW}${CATEGORY_LABELS[cat] ?? cat}${RESET}`);
|
|
68
|
-
const sorted = [...mods].sort((a, b) => a.name.localeCompare(b.name));
|
|
69
|
-
for (const mod of sorted) {
|
|
70
|
-
lines.push(formatCmdLine(mod));
|
|
71
|
-
}
|
|
72
|
-
lines.push("");
|
|
73
|
-
}
|
|
74
|
-
const total = modules.length;
|
|
75
|
-
lines.push(`${DIM}${total} commands available.${RESET}`);
|
|
76
|
-
return lines.join("\n");
|
|
77
|
-
}
|
|
78
|
-
// ─── single-command detail ────────────────────────────────────────────────────
|
|
79
|
-
function renderDetail(mod) {
|
|
80
|
-
const lines = [];
|
|
81
|
-
lines.push(`${BOLD}${mod.name}${RESET} — ${mod.description ?? "no description"}`);
|
|
82
|
-
if (mod.aliases?.length) {
|
|
83
|
-
lines.push(`${DIM}Aliases: ${mod.aliases.join(", ")}${RESET}`);
|
|
84
|
-
}
|
|
85
|
-
lines.push("");
|
|
86
|
-
lines.push(`${GREEN}Usage:${RESET}`);
|
|
87
|
-
if (mod.params.length) {
|
|
88
|
-
for (const p of mod.params) {
|
|
89
|
-
lines.push(` ${mod.name} ${p}`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
lines.push(` ${mod.name}`);
|
|
94
|
-
}
|
|
95
|
-
const catLabel = CATEGORY_LABELS[mod.category ?? "misc"] ?? mod.category ?? "misc";
|
|
96
|
-
lines.push("");
|
|
97
|
-
lines.push(`${DIM}Category: ${catLabel}${RESET}`);
|
|
98
|
-
return lines.join("\n");
|
|
99
|
-
}
|
|
100
|
-
// ─── export ───────────────────────────────────────────────────────────────────
|
|
101
|
-
export function createHelpCommand(_getNames) {
|
|
102
|
-
return {
|
|
103
|
-
name: "help",
|
|
104
|
-
description: "List all commands, or show usage for a specific command",
|
|
105
|
-
category: "shell",
|
|
106
|
-
params: ["[command]"],
|
|
107
|
-
run: ({ args }) => {
|
|
108
|
-
const modules = getCommandModulesPublic();
|
|
109
|
-
if (args[0]) {
|
|
110
|
-
const target = args[0].toLowerCase();
|
|
111
|
-
const mod = modules.find((m) => m.name === target || m.aliases?.includes(target));
|
|
112
|
-
if (!mod) {
|
|
113
|
-
return {
|
|
114
|
-
stderr: `help: no help entry for '${args[0]}'`,
|
|
115
|
-
exitCode: 1,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return { stdout: renderDetail(mod), exitCode: 0 };
|
|
119
|
-
}
|
|
120
|
-
return { stdout: renderFull(modules), exitCode: 0 };
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAYpD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY5D;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAUlE;AAYD,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GACf,IAAI,CAQN;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED,wBAAsB,aAAa,CAClC,GAAG,EAAE,MAAM,GACT,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAQvE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,GACZ,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA8D/D;AA4BD,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,iBAAiB,EACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GACf,MAAM,CAyBR;AAED,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK;IAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,GACnD,MAAM,CAQR;AAED,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,YAAY,GACjB,qBAAqB,GAAG,SAAS,CAEnC"}
|
package/src/commands/helpers.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
const PROTECTED_PREFIXES = ["/.virtual-env-js/.auth", "/etc/htpasswd"];
|
|
4
|
-
function normalizeFetchUrl(input) {
|
|
5
|
-
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(input)) {
|
|
6
|
-
return input;
|
|
7
|
-
}
|
|
8
|
-
return `http://${input}`;
|
|
9
|
-
}
|
|
10
|
-
export function normalizeTerminalOutput(text) {
|
|
11
|
-
return text
|
|
12
|
-
.replace(/\r\n/g, "\n")
|
|
13
|
-
.replace(/\r/g, "\n")
|
|
14
|
-
.replace(/\t/g, " ")
|
|
15
|
-
.split("\n")
|
|
16
|
-
.map((line) => line.replace(/^[ \u00A0]{8,}/, " ").replace(/[ \u00A0]{3,}/g, " "))
|
|
17
|
-
.join("\n")
|
|
18
|
-
.replace(/\n{3,}/g, "\n\n")
|
|
19
|
-
.trimEnd();
|
|
20
|
-
}
|
|
21
|
-
export function resolvePath(cwd, inputPath) {
|
|
22
|
-
if (!inputPath || inputPath.trim() === "") {
|
|
23
|
-
return cwd;
|
|
24
|
-
}
|
|
25
|
-
if (inputPath.startsWith("~")) {
|
|
26
|
-
return path.posix.normalize(`/home/${inputPath.slice(1)}`);
|
|
27
|
-
}
|
|
28
|
-
return inputPath.startsWith("/")
|
|
29
|
-
? path.posix.normalize(inputPath)
|
|
30
|
-
: path.posix.normalize(path.posix.join(cwd, inputPath));
|
|
31
|
-
}
|
|
32
|
-
function isProtectedPath(targetPath) {
|
|
33
|
-
const normalized = targetPath.startsWith("/")
|
|
34
|
-
? path.posix.normalize(targetPath)
|
|
35
|
-
: path.posix.normalize(`/${targetPath}`);
|
|
36
|
-
return PROTECTED_PREFIXES.some((prefix) => normalized === prefix || normalized.startsWith(`${prefix}/`));
|
|
37
|
-
}
|
|
38
|
-
export function assertPathAccess(authUser, targetPath, operation) {
|
|
39
|
-
if (authUser === "root") {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (isProtectedPath(targetPath)) {
|
|
43
|
-
throw new Error(`${operation}: permission denied: ${targetPath}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function stripUrlFilename(url) {
|
|
47
|
-
const cleaned = url.split("?")[0]?.split("#")[0] ?? url;
|
|
48
|
-
const lastPart = cleaned.split("/").filter(Boolean).pop();
|
|
49
|
-
return lastPart && lastPart.length > 0 ? lastPart : "index.html";
|
|
50
|
-
}
|
|
51
|
-
export async function fetchResource(url) {
|
|
52
|
-
const response = await fetch(normalizeFetchUrl(url));
|
|
53
|
-
const contentType = response.headers.get("content-type");
|
|
54
|
-
return {
|
|
55
|
-
text: await response.text(),
|
|
56
|
-
status: response.status,
|
|
57
|
-
contentType,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Run a host command like curl or wget and capture its output.
|
|
62
|
-
* @param binary - The binary to execute (e.g., "curl", "wget").
|
|
63
|
-
* @param args - Arguments to pass to the binary.
|
|
64
|
-
* @returns Promise resolving with stdout, stderr, and exit code.
|
|
65
|
-
*/
|
|
66
|
-
export function runHostCommand(binary, args) {
|
|
67
|
-
return new Promise((resolve) => {
|
|
68
|
-
let childProcess;
|
|
69
|
-
try {
|
|
70
|
-
childProcess = spawn(binary, args, {
|
|
71
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
resolve({
|
|
76
|
-
stdout: "",
|
|
77
|
-
stderr: `${binary}: ${error instanceof Error ? error.message : String(error)}`,
|
|
78
|
-
exitCode: 1,
|
|
79
|
-
});
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
let stdout = "";
|
|
83
|
-
let stderr = "";
|
|
84
|
-
const stdoutStream = childProcess.stdout;
|
|
85
|
-
const stderrStream = childProcess.stderr;
|
|
86
|
-
if (!stdoutStream || !stderrStream) {
|
|
87
|
-
resolve({
|
|
88
|
-
stdout: "",
|
|
89
|
-
stderr: `${binary}: failed to capture process output`,
|
|
90
|
-
exitCode: 1,
|
|
91
|
-
});
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
stdoutStream.setEncoding("utf8");
|
|
95
|
-
stderrStream.setEncoding("utf8");
|
|
96
|
-
stdoutStream.on("data", (chunk) => {
|
|
97
|
-
stdout += chunk;
|
|
98
|
-
});
|
|
99
|
-
stderrStream.on("data", (chunk) => {
|
|
100
|
-
stderr += chunk;
|
|
101
|
-
});
|
|
102
|
-
childProcess.on("error", (error) => {
|
|
103
|
-
const errorCode = error instanceof Error && "code" in error
|
|
104
|
-
? String(error.code ?? "")
|
|
105
|
-
: "";
|
|
106
|
-
resolve({
|
|
107
|
-
stdout: "",
|
|
108
|
-
stderr: `${binary}: ${error.message}`,
|
|
109
|
-
exitCode: errorCode === "ENOENT" ? 127 : 1,
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
childProcess.on("close", (code) => {
|
|
113
|
-
resolve({
|
|
114
|
-
stdout,
|
|
115
|
-
stderr,
|
|
116
|
-
exitCode: code ?? 1,
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
function levenshtein(a, b) {
|
|
122
|
-
const dp = Array.from({ length: a.length + 1 }, () => Array(b.length + 1).fill(0));
|
|
123
|
-
for (let i = 0; i <= a.length; i += 1) {
|
|
124
|
-
dp[i][0] = i;
|
|
125
|
-
}
|
|
126
|
-
for (let j = 0; j <= b.length; j += 1) {
|
|
127
|
-
dp[0][j] = j;
|
|
128
|
-
}
|
|
129
|
-
for (let i = 1; i <= a.length; i += 1) {
|
|
130
|
-
for (let j = 1; j <= b.length; j += 1) {
|
|
131
|
-
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
132
|
-
dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return dp[a.length][b.length];
|
|
136
|
-
}
|
|
137
|
-
export function resolveReadablePath(vfs, cwd, inputPath) {
|
|
138
|
-
const exactPath = resolvePath(cwd, inputPath);
|
|
139
|
-
if (vfs.exists(exactPath)) {
|
|
140
|
-
return exactPath;
|
|
141
|
-
}
|
|
142
|
-
const parent = path.posix.dirname(exactPath);
|
|
143
|
-
const fileName = path.posix.basename(exactPath);
|
|
144
|
-
const siblings = vfs.list(parent);
|
|
145
|
-
const caseInsensitive = siblings.filter((name) => name.toLowerCase() === fileName.toLowerCase());
|
|
146
|
-
if (caseInsensitive.length === 1) {
|
|
147
|
-
return path.posix.join(parent, caseInsensitive[0]);
|
|
148
|
-
}
|
|
149
|
-
const near = siblings.filter((name) => levenshtein(name.toLowerCase(), fileName.toLowerCase()) <= 1);
|
|
150
|
-
if (near.length === 1) {
|
|
151
|
-
return path.posix.join(parent, near[0]);
|
|
152
|
-
}
|
|
153
|
-
return exactPath;
|
|
154
|
-
}
|
|
155
|
-
export function joinListWithType(cwd, items, statAt) {
|
|
156
|
-
return items
|
|
157
|
-
.map((name) => {
|
|
158
|
-
const childPath = resolvePath(cwd, name);
|
|
159
|
-
const stats = statAt(childPath);
|
|
160
|
-
return stats.type === "directory" ? `${name}/` : name;
|
|
161
|
-
})
|
|
162
|
-
.join(" ");
|
|
163
|
-
}
|
|
164
|
-
export function getPackageManager(shell) {
|
|
165
|
-
return shell.packageManager;
|
|
166
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,WA0B5B,CAAC"}
|
package/src/commands/history.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Display persisted command history for the session (from VFS).
|
|
3
|
-
* @category shell
|
|
4
|
-
* @params ["[n]"]
|
|
5
|
-
*/
|
|
6
|
-
export const historyCommand = {
|
|
7
|
-
name: "history",
|
|
8
|
-
description: "Display command history",
|
|
9
|
-
category: "shell",
|
|
10
|
-
params: ["[n]"],
|
|
11
|
-
run: ({ args, shell, authUser }) => {
|
|
12
|
-
// History is persisted in the VFS by the interactive shell
|
|
13
|
-
const histPath = `/home/${authUser}/.bash_history`;
|
|
14
|
-
if (!shell.vfs.exists(histPath)) {
|
|
15
|
-
return { stdout: "", exitCode: 0 };
|
|
16
|
-
}
|
|
17
|
-
const raw = shell.vfs.readFile(histPath);
|
|
18
|
-
const lines = raw.split("\n").filter(Boolean);
|
|
19
|
-
const nArg = args[0];
|
|
20
|
-
const n = nArg ? parseInt(nArg, 10) : null;
|
|
21
|
-
const slice = n && !Number.isNaN(n) ? lines.slice(-n) : lines;
|
|
22
|
-
const offset = lines.length - slice.length + 1;
|
|
23
|
-
const numbered = slice.map((line, i) => `${String(offset + i).padStart(5)} ${line}`);
|
|
24
|
-
return { stdout: numbered.join("\n"), exitCode: 0 };
|
|
25
|
-
},
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hostname.d.ts","sourceRoot":"","sources":["hostname.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,WAM7B,CAAC"}
|
package/src/commands/hostname.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Print the configured hostname for the virtual shell.
|
|
3
|
-
* @category system
|
|
4
|
-
* @params []
|
|
5
|
-
*/
|
|
6
|
-
export const hostnameCommand = {
|
|
7
|
-
name: "hostname",
|
|
8
|
-
description: "Print hostname",
|
|
9
|
-
category: "system",
|
|
10
|
-
params: [],
|
|
11
|
-
run: ({ hostname }) => ({ stdout: hostname, exitCode: 0 }),
|
|
12
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"htop.d.ts","sourceRoot":"","sources":["htop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAYzB,CAAC"}
|
package/src/commands/htop.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive system monitor (requires terminal interaction).
|
|
3
|
-
* @category system
|
|
4
|
-
* @params []
|
|
5
|
-
*/
|
|
6
|
-
export const htopCommand = {
|
|
7
|
-
name: "htop",
|
|
8
|
-
description: "System monitor",
|
|
9
|
-
category: "system",
|
|
10
|
-
params: [],
|
|
11
|
-
run: ({ mode }) => {
|
|
12
|
-
if (mode === "exec") {
|
|
13
|
-
return { stderr: "htop: interactive terminal required", exitCode: 1 };
|
|
14
|
-
}
|
|
15
|
-
return { openHtop: true, exitCode: 0 };
|
|
16
|
-
},
|
|
17
|
-
};
|
package/src/commands/id.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,SAAS,EAAE,WAgBvB,CAAC"}
|
package/src/commands/id.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const idCommand = {
|
|
2
|
-
name: "id",
|
|
3
|
-
description: "Print user identity",
|
|
4
|
-
category: "system",
|
|
5
|
-
params: ["[user]"],
|
|
6
|
-
run: ({ authUser, shell, args }) => {
|
|
7
|
-
const target = args[0] ?? authUser;
|
|
8
|
-
const uid = target === "root" ? 0 : 1000;
|
|
9
|
-
const gid = uid;
|
|
10
|
-
const isSudo = shell.users.isSudoer(target);
|
|
11
|
-
const groups = isSudo ? `${gid}(${target}),0(root)` : `${gid}(${target})`;
|
|
12
|
-
return {
|
|
13
|
-
stdout: `uid=${uid}(${target}) gid=${gid}(${target}) groups=${groups}`,
|
|
14
|
-
exitCode: 0,
|
|
15
|
-
};
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,aAAa,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
package/src/commands/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kill.d.ts","sourceRoot":"","sources":["kill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAWzB,CAAC"}
|
package/src/commands/kill.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Send a signal to a process by PID.
|
|
3
|
-
* @category system
|
|
4
|
-
* @params ["[-9] <pid>"]
|
|
5
|
-
*/
|
|
6
|
-
export const killCommand = {
|
|
7
|
-
name: "kill",
|
|
8
|
-
description: "Send signal to process",
|
|
9
|
-
category: "system",
|
|
10
|
-
params: ["[-9] <pid>"],
|
|
11
|
-
run: ({ args }) => {
|
|
12
|
-
const pid = args.find((a) => !a.startsWith("-"));
|
|
13
|
-
if (!pid)
|
|
14
|
-
return { stderr: "kill: no pid specified", exitCode: 1 };
|
|
15
|
-
// In virtual env, we just acknowledge the kill
|
|
16
|
-
return { stdout: ``, exitCode: 0 };
|
|
17
|
-
},
|
|
18
|
-
};
|
package/src/commands/ln.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ln.d.ts","sourceRoot":"","sources":["ln.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,SAAS,EAAE,WA4CvB,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC"}
|
package/src/commands/ln.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ifFlag } from "./command-helpers";
|
|
2
|
-
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
-
export const lnCommand = {
|
|
4
|
-
name: "ln",
|
|
5
|
-
description: "Create links",
|
|
6
|
-
category: "files",
|
|
7
|
-
params: ["[-s] <target> <link_name>"],
|
|
8
|
-
run: ({ authUser, shell, cwd, args }) => {
|
|
9
|
-
const symbolic = ifFlag(args, ["-s", "--symbolic"]);
|
|
10
|
-
const positionals = args.filter((a) => !a.startsWith("-"));
|
|
11
|
-
const [targetArg, linkArg] = positionals;
|
|
12
|
-
if (!targetArg || !linkArg) {
|
|
13
|
-
return { stderr: "ln: missing operand", exitCode: 1 };
|
|
14
|
-
}
|
|
15
|
-
const linkPath = resolvePath(cwd, linkArg);
|
|
16
|
-
const targetPath = symbolic
|
|
17
|
-
? targetArg // keep relative for symlinks
|
|
18
|
-
: resolvePath(cwd, targetArg);
|
|
19
|
-
try {
|
|
20
|
-
assertPathAccess(authUser, linkPath, "ln");
|
|
21
|
-
if (!symbolic) {
|
|
22
|
-
// Hard link — copy file contents
|
|
23
|
-
const srcPath = resolvePath(cwd, targetArg);
|
|
24
|
-
assertPathAccess(authUser, srcPath, "ln");
|
|
25
|
-
if (!shell.vfs.exists(srcPath)) {
|
|
26
|
-
return {
|
|
27
|
-
stderr: `ln: ${targetArg}: No such file or directory`,
|
|
28
|
-
exitCode: 1,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
const content = shell.vfs.readFile(srcPath);
|
|
32
|
-
shell.writeFileAsUser(authUser, linkPath, content);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
shell.vfs.symlink(targetPath, linkPath);
|
|
36
|
-
}
|
|
37
|
-
return { exitCode: 0 };
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
41
|
-
return { stderr: `ln: ${msg}`, exitCode: 1 };
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
/** Shell command: print the value of a symbolic link. */
|
|
46
|
-
export const readlinkCommand = {
|
|
47
|
-
name: "readlink",
|
|
48
|
-
description: "Print resolved path of symbolic link",
|
|
49
|
-
category: "files",
|
|
50
|
-
params: ["[-f] <path>"],
|
|
51
|
-
run: ({ shell, cwd, args }) => {
|
|
52
|
-
const follow = args.includes("-f") || args.includes("-e");
|
|
53
|
-
const target = args.find((a) => !a.startsWith("-"));
|
|
54
|
-
if (!target)
|
|
55
|
-
return { stderr: "readlink: missing operand\n", exitCode: 1 };
|
|
56
|
-
const p = resolvePath(cwd, target);
|
|
57
|
-
if (!shell.vfs.exists(p)) {
|
|
58
|
-
return { stderr: `readlink: ${target}: No such file or directory\n`, exitCode: 1 };
|
|
59
|
-
}
|
|
60
|
-
if (!shell.vfs.isSymlink(p)) {
|
|
61
|
-
return { stderr: `readlink: ${target}: not a symbolic link\n`, exitCode: 1 };
|
|
62
|
-
}
|
|
63
|
-
const resolved = shell.vfs.resolveSymlink(follow ? p : p);
|
|
64
|
-
return { stdout: `${resolved}\n`, exitCode: 0 };
|
|
65
|
-
},
|
|
66
|
-
};
|
package/src/commands/ls.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["ls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgMrD,eAAO,MAAM,SAAS,EAAE,WAkDvB,CAAC"}
|