typescript-virtual-container 1.3.4 → 1.4.1
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/.vscode/settings.json +0 -1
- package/README.md +674 -1504
- package/benchmark-results.txt +21 -21
- package/builds/self-standalone.js +282 -332
- package/builds/self-standalone.js.map +4 -4
- package/builds/standalone-wo-sftp.js +218 -282
- package/builds/standalone-wo-sftp.js.map +4 -4
- package/builds/standalone.js +271 -335
- package/builds/standalone.js.map +4 -4
- package/builds/web-full-api.min.js +3 -3
- package/builds/web-full-api.min.js.map +4 -4
- package/builds/web.min.js +2 -2
- package/builds/web.min.js.map +4 -4
- package/bun.lock +14 -12
- package/dist/SSHClient/index.d.ts.map +1 -1
- package/dist/SSHClient/index.js +5 -3
- package/dist/SSHMimic/executor.d.ts +1 -3
- package/dist/SSHMimic/executor.d.ts.map +1 -1
- package/dist/SSHMimic/executor.js +20 -22
- package/dist/SSHMimic/index.d.ts.map +1 -1
- package/dist/SSHMimic/index.js +5 -3
- package/dist/SSHMimic/sftp.d.ts.map +1 -1
- package/dist/SSHMimic/sftp.js +26 -21
- package/dist/VirtualPackageManager/index.d.ts.map +1 -1
- package/dist/VirtualPackageManager/index.js +29 -1
- package/dist/VirtualShell/shell.d.ts.map +1 -1
- package/dist/VirtualShell/shell.js +25 -3
- package/dist/VirtualShell/shellParser.d.ts +1 -8
- package/dist/VirtualShell/shellParser.d.ts.map +1 -1
- package/dist/VirtualShell/shellParser.js +2 -81
- package/dist/VirtualUserManager/index.d.ts +7 -1
- package/dist/VirtualUserManager/index.d.ts.map +1 -1
- package/dist/VirtualUserManager/index.js +47 -16
- package/dist/commands/adduser.d.ts +10 -4
- package/dist/commands/adduser.d.ts.map +1 -1
- package/dist/commands/adduser.js +75 -12
- package/dist/commands/alias.d.ts +5 -0
- package/dist/commands/alias.d.ts.map +1 -1
- package/dist/commands/alias.js +5 -0
- package/dist/commands/apt.d.ts +5 -0
- package/dist/commands/apt.d.ts.map +1 -1
- package/dist/commands/apt.js +5 -0
- package/dist/commands/awk.d.ts +10 -8
- package/dist/commands/awk.d.ts.map +1 -1
- package/dist/commands/awk.js +156 -28
- package/dist/commands/cd.d.ts.map +1 -1
- package/dist/commands/cd.js +0 -3
- package/dist/commands/clear.d.ts +5 -0
- package/dist/commands/clear.d.ts.map +1 -1
- package/dist/commands/clear.js +5 -0
- package/dist/commands/command-helpers.d.ts.map +1 -1
- package/dist/commands/command-helpers.js +8 -0
- package/dist/commands/curl.d.ts.map +1 -1
- package/dist/commands/curl.js +2 -1
- package/dist/commands/declare.d.ts +5 -0
- package/dist/commands/declare.d.ts.map +1 -1
- package/dist/commands/declare.js +5 -0
- package/dist/commands/deluser.d.ts +12 -0
- package/dist/commands/deluser.d.ts.map +1 -1
- package/dist/commands/deluser.js +72 -6
- package/dist/commands/df.d.ts +5 -0
- package/dist/commands/df.d.ts.map +1 -1
- package/dist/commands/df.js +5 -0
- package/dist/commands/du.d.ts +5 -0
- package/dist/commands/du.d.ts.map +1 -1
- package/dist/commands/du.js +5 -0
- package/dist/commands/export.d.ts +5 -0
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +5 -0
- package/dist/commands/grep.d.ts.map +1 -1
- package/dist/commands/grep.js +22 -4
- package/dist/commands/groups.d.ts +5 -0
- package/dist/commands/groups.d.ts.map +1 -1
- package/dist/commands/groups.js +5 -0
- package/dist/commands/gzip.d.ts +5 -2
- package/dist/commands/gzip.d.ts.map +1 -1
- package/dist/commands/gzip.js +54 -28
- package/dist/commands/head.d.ts.map +1 -1
- package/dist/commands/head.js +12 -3
- package/dist/commands/htop.d.ts +5 -0
- package/dist/commands/htop.d.ts.map +1 -1
- package/dist/commands/htop.js +5 -0
- package/dist/commands/kill.d.ts +5 -0
- package/dist/commands/kill.d.ts.map +1 -1
- package/dist/commands/kill.js +5 -0
- package/dist/commands/ln.d.ts +2 -0
- package/dist/commands/ln.d.ts.map +1 -1
- package/dist/commands/ln.js +22 -0
- package/dist/commands/ls.d.ts.map +1 -1
- package/dist/commands/ls.js +15 -0
- package/dist/commands/lsb-release.d.ts +5 -0
- package/dist/commands/lsb-release.d.ts.map +1 -1
- package/dist/commands/lsb-release.js +5 -0
- package/dist/commands/man.d.ts.map +1 -1
- package/dist/commands/man.js +30 -136
- package/dist/commands/mkdir.d.ts +5 -0
- package/dist/commands/mkdir.d.ts.map +1 -1
- package/dist/commands/mkdir.js +5 -0
- package/dist/commands/mv.d.ts +5 -0
- package/dist/commands/mv.d.ts.map +1 -1
- package/dist/commands/mv.js +5 -0
- package/dist/commands/nano.d.ts +5 -0
- package/dist/commands/nano.d.ts.map +1 -1
- package/dist/commands/nano.js +5 -0
- package/dist/commands/neofetch.d.ts +5 -0
- package/dist/commands/neofetch.d.ts.map +1 -1
- package/dist/commands/neofetch.js +14 -5
- package/dist/commands/passwd.d.ts +8 -0
- package/dist/commands/passwd.d.ts.map +1 -1
- package/dist/commands/passwd.js +32 -11
- package/dist/commands/ping.d.ts +5 -0
- package/dist/commands/ping.d.ts.map +1 -1
- package/dist/commands/ping.js +5 -0
- package/dist/commands/printf.d.ts +5 -0
- package/dist/commands/printf.d.ts.map +1 -1
- package/dist/commands/printf.js +43 -12
- package/dist/commands/ps.d.ts +5 -0
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +5 -0
- package/dist/commands/read.d.ts +5 -0
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +5 -0
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/registry.js +4 -1
- package/dist/commands/rm.d.ts +5 -0
- package/dist/commands/rm.d.ts.map +1 -1
- package/dist/commands/rm.js +5 -0
- package/dist/commands/runtime.d.ts.map +1 -1
- package/dist/commands/runtime.js +1 -57
- package/dist/commands/sed.d.ts +5 -0
- package/dist/commands/sed.d.ts.map +1 -1
- package/dist/commands/sed.js +5 -0
- package/dist/commands/set.d.ts +5 -6
- package/dist/commands/set.d.ts.map +1 -1
- package/dist/commands/set.js +5 -22
- package/dist/commands/sh.d.ts +6 -0
- package/dist/commands/sh.d.ts.map +1 -1
- package/dist/commands/sh.js +6 -0
- package/dist/commands/shift.d.ts +10 -0
- package/dist/commands/shift.d.ts.map +1 -1
- package/dist/commands/shift.js +10 -0
- package/dist/commands/sleep.d.ts +5 -0
- package/dist/commands/sleep.d.ts.map +1 -1
- package/dist/commands/sleep.js +5 -0
- package/dist/commands/sort.d.ts +5 -0
- package/dist/commands/sort.d.ts.map +1 -1
- package/dist/commands/sort.js +5 -0
- package/dist/commands/source.d.ts +5 -0
- package/dist/commands/source.d.ts.map +1 -1
- package/dist/commands/source.js +5 -0
- package/dist/commands/stat.d.ts +7 -0
- package/dist/commands/stat.d.ts.map +1 -0
- package/dist/commands/stat.js +56 -0
- package/dist/commands/su.d.ts +13 -0
- package/dist/commands/su.d.ts.map +1 -1
- package/dist/commands/su.js +45 -14
- package/dist/commands/sudo.d.ts.map +1 -1
- package/dist/commands/sudo.js +5 -0
- package/dist/commands/tail.d.ts +5 -0
- package/dist/commands/tail.d.ts.map +1 -1
- package/dist/commands/tail.js +15 -3
- package/dist/commands/tar.d.ts +5 -0
- package/dist/commands/tar.d.ts.map +1 -1
- package/dist/commands/tar.js +40 -10
- package/dist/commands/tee.d.ts +5 -0
- package/dist/commands/tee.d.ts.map +1 -1
- package/dist/commands/tee.js +5 -0
- package/dist/commands/touch.d.ts +5 -0
- package/dist/commands/touch.d.ts.map +1 -1
- package/dist/commands/touch.js +5 -0
- package/dist/commands/tr.d.ts.map +1 -1
- package/dist/commands/tr.js +45 -10
- package/dist/commands/tree.d.ts +5 -0
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +5 -0
- package/dist/commands/true.d.ts +10 -0
- package/dist/commands/true.d.ts.map +1 -1
- package/dist/commands/true.js +10 -0
- package/dist/commands/type.d.ts +5 -0
- package/dist/commands/type.d.ts.map +1 -1
- package/dist/commands/type.js +5 -0
- package/dist/commands/uname.d.ts +5 -0
- package/dist/commands/uname.d.ts.map +1 -1
- package/dist/commands/uname.js +5 -0
- package/dist/commands/uniq.d.ts +5 -0
- package/dist/commands/uniq.d.ts.map +1 -1
- package/dist/commands/uniq.js +5 -0
- package/dist/commands/unset.d.ts +5 -0
- package/dist/commands/unset.d.ts.map +1 -1
- package/dist/commands/unset.js +5 -0
- package/dist/commands/uptime.d.ts +5 -0
- package/dist/commands/uptime.d.ts.map +1 -1
- package/dist/commands/uptime.js +5 -0
- package/dist/commands/wc.d.ts +5 -0
- package/dist/commands/wc.d.ts.map +1 -1
- package/dist/commands/wc.js +5 -0
- package/dist/commands/wget.d.ts +5 -0
- package/dist/commands/wget.d.ts.map +1 -1
- package/dist/commands/wget.js +16 -1
- package/dist/commands/who.d.ts +5 -0
- package/dist/commands/who.d.ts.map +1 -1
- package/dist/commands/who.js +5 -0
- package/dist/commands/whoami.d.ts +5 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +5 -0
- package/dist/commands/xargs.d.ts +5 -0
- package/dist/commands/xargs.d.ts.map +1 -1
- package/dist/commands/xargs.js +5 -0
- package/dist/self-standalone.js +254 -30
- package/dist/types/commands.d.ts +36 -0
- package/dist/types/commands.d.ts.map +1 -1
- package/dist/utils/tokenize.d.ts +20 -0
- package/dist/utils/tokenize.d.ts.map +1 -0
- package/dist/utils/tokenize.js +74 -0
- package/examples/web.min.js +2 -2
- package/package.json +2 -2
- package/src/SSHClient/index.ts +6 -3
- package/src/SSHMimic/executor.ts +21 -44
- package/src/SSHMimic/index.ts +7 -5
- package/src/SSHMimic/sftp.ts +28 -21
- package/src/VirtualPackageManager/index.ts +29 -1
- package/src/VirtualShell/shell.ts +34 -4
- package/src/VirtualShell/shellParser.ts +2 -103
- package/src/VirtualUserManager/index.ts +43 -19
- package/src/commands/adduser.ts +86 -13
- package/src/commands/alias.ts +5 -0
- package/src/commands/apt.ts +5 -0
- package/src/commands/awk.ts +154 -29
- package/src/commands/cd.ts +0 -4
- package/src/commands/clear.ts +5 -0
- package/src/commands/command-helpers.ts +9 -0
- package/src/commands/curl.ts +2 -1
- package/src/commands/declare.ts +5 -0
- package/src/commands/deluser.ts +84 -7
- package/src/commands/df.ts +5 -0
- package/src/commands/du.ts +5 -0
- package/src/commands/export.ts +5 -0
- package/src/commands/grep.ts +21 -8
- package/src/commands/groups.ts +5 -0
- package/src/commands/gzip.ts +61 -28
- package/src/commands/head.ts +14 -4
- package/src/commands/htop.ts +5 -0
- package/src/commands/kill.ts +5 -0
- package/src/commands/ln.ts +22 -0
- package/src/commands/ls.ts +17 -0
- package/src/commands/lsb-release.ts +5 -0
- package/src/commands/man.ts +38 -143
- package/src/commands/manuals/adduser.txt +11 -0
- package/src/commands/manuals/apt-cache.txt +12 -0
- package/src/commands/manuals/apt.txt +20 -0
- package/src/commands/manuals/awk.txt +13 -0
- package/src/commands/manuals/cat.txt +14 -0
- package/src/commands/manuals/cd.txt +16 -0
- package/src/commands/manuals/chmod.txt +16 -0
- package/src/commands/manuals/clear.txt +10 -0
- package/src/commands/manuals/cp.txt +10 -0
- package/src/commands/manuals/curl.txt +20 -0
- package/src/commands/manuals/date.txt +14 -0
- package/src/commands/manuals/declare.txt +12 -0
- package/src/commands/manuals/deluser.txt +10 -0
- package/src/commands/manuals/df.txt +10 -0
- package/src/commands/manuals/dpkg-query.txt +11 -0
- package/src/commands/manuals/dpkg.txt +14 -0
- package/src/commands/manuals/du.txt +11 -0
- package/src/commands/manuals/echo.txt +11 -0
- package/src/commands/manuals/false.txt +10 -0
- package/src/commands/manuals/find.txt +11 -0
- package/src/commands/manuals/free.txt +12 -0
- package/src/commands/manuals/grep.txt +13 -0
- package/src/commands/manuals/groups.txt +10 -0
- package/src/commands/manuals/gzip.txt +11 -0
- package/src/commands/manuals/head.txt +10 -0
- package/src/commands/manuals/help.txt +11 -0
- package/src/commands/manuals/history.txt +11 -0
- package/src/commands/manuals/hostname.txt +10 -0
- package/src/commands/manuals/id.txt +10 -0
- package/src/commands/manuals/kill.txt +13 -0
- package/src/commands/manuals/ls.txt +20 -0
- package/src/commands/manuals/lsb_release.txt +14 -0
- package/src/commands/manuals/mkdir.txt +10 -0
- package/src/commands/manuals/mv.txt +10 -0
- package/src/commands/manuals/nano.txt +11 -0
- package/src/commands/manuals/neofetch.txt +10 -0
- package/src/commands/manuals/node.txt +13 -0
- package/src/commands/manuals/npm.txt +13 -0
- package/src/commands/manuals/npx.txt +13 -0
- package/src/commands/manuals/passwd.txt +11 -0
- package/src/commands/manuals/ping.txt +10 -0
- package/src/commands/manuals/printf.txt +11 -0
- package/src/commands/manuals/ps.txt +10 -0
- package/src/commands/manuals/pwd.txt +10 -0
- package/src/commands/manuals/python3.txt +13 -0
- package/src/commands/manuals/readlink.txt +10 -0
- package/src/commands/manuals/return.txt +10 -0
- package/src/commands/manuals/rm.txt +10 -0
- package/src/commands/manuals/sed.txt +11 -0
- package/src/commands/manuals/set.txt +11 -0
- package/src/commands/manuals/shift.txt +10 -0
- package/src/commands/manuals/sleep.txt +10 -0
- package/src/commands/manuals/sort.txt +12 -0
- package/src/commands/manuals/source.txt +11 -0
- package/src/commands/manuals/ssh.txt +11 -0
- package/src/commands/manuals/stat.txt +10 -0
- package/src/commands/manuals/su.txt +13 -0
- package/src/commands/manuals/sudo.txt +11 -0
- package/src/commands/manuals/tail.txt +10 -0
- package/src/commands/manuals/tar.txt +19 -0
- package/src/commands/manuals/tee.txt +10 -0
- package/src/commands/manuals/test.txt +11 -0
- package/src/commands/manuals/touch.txt +11 -0
- package/src/commands/manuals/tr.txt +10 -0
- package/src/commands/manuals/trap.txt +10 -0
- package/src/commands/manuals/true.txt +10 -0
- package/src/commands/manuals/type.txt +10 -0
- package/src/commands/manuals/uname.txt +12 -0
- package/src/commands/manuals/uniq.txt +12 -0
- package/src/commands/manuals/unset.txt +10 -0
- package/src/commands/manuals/uptime.txt +11 -0
- package/src/commands/manuals/wc.txt +12 -0
- package/src/commands/manuals/wget.txt +12 -0
- package/src/commands/manuals/which.txt +10 -0
- package/src/commands/manuals/whoami.txt +10 -0
- package/src/commands/manuals/xargs.txt +10 -0
- package/src/commands/mkdir.ts +5 -0
- package/src/commands/mv.ts +5 -0
- package/src/commands/nano.ts +5 -0
- package/src/commands/neofetch.ts +15 -6
- package/src/commands/passwd.ts +35 -12
- package/src/commands/ping.ts +5 -0
- package/src/commands/printf.ts +30 -13
- package/src/commands/ps.ts +5 -0
- package/src/commands/read.ts +5 -0
- package/src/commands/registry.ts +4 -1
- package/src/commands/rm.ts +5 -0
- package/src/commands/runtime.ts +1 -61
- package/src/commands/sed.ts +5 -0
- package/src/commands/set.ts +5 -24
- package/src/commands/sh.ts +9 -3
- package/src/commands/shift.ts +10 -0
- package/src/commands/sleep.ts +5 -0
- package/src/commands/sort.ts +5 -0
- package/src/commands/source.ts +5 -0
- package/src/commands/stat.ts +61 -0
- package/src/commands/su.ts +54 -16
- package/src/commands/sudo.ts +5 -0
- package/src/commands/tail.ts +17 -3
- package/src/commands/tar.ts +38 -15
- package/src/commands/tee.ts +5 -0
- package/src/commands/touch.ts +5 -0
- package/src/commands/tr.ts +54 -10
- package/src/commands/tree.ts +5 -0
- package/src/commands/true.ts +10 -0
- package/src/commands/type.ts +5 -0
- package/src/commands/uname.ts +5 -0
- package/src/commands/uniq.ts +5 -0
- package/src/commands/unset.ts +5 -0
- package/src/commands/uptime.ts +5 -0
- package/src/commands/wc.ts +5 -0
- package/src/commands/wget.ts +17 -1
- package/src/commands/who.ts +5 -0
- package/src/commands/whoami.ts +5 -0
- package/src/commands/xargs.ts +5 -0
- package/src/self-standalone.ts +316 -33
- package/src/types/commands.ts +37 -0
- package/src/utils/tokenize.ts +78 -0
- package/tests/new-features.test.ts +2 -2
- package/builds/web-iife.min.js +0 -13
- package/builds/web-iife.min.js.map +0 -7
package/dist/commands/mv.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mv.d.ts","sourceRoot":"","sources":["../../src/commands/mv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,SAAS,EAAE,WAyCvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mv.d.ts","sourceRoot":"","sources":["../../src/commands/mv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,WAyCvB,CAAC"}
|
package/dist/commands/mv.js
CHANGED
package/dist/commands/nano.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nano.d.ts","sourceRoot":"","sources":["../../src/commands/nano.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,WAAW,EAAE,WA4BzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"nano.d.ts","sourceRoot":"","sources":["../../src/commands/nano.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA4BzB,CAAC"}
|
package/dist/commands/nano.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Simple text editor for editing files.
|
|
5
|
+
* @category files
|
|
6
|
+
* @params ["<file>"]
|
|
7
|
+
*/
|
|
3
8
|
export const nanoCommand = {
|
|
4
9
|
name: "nano",
|
|
5
10
|
description: "Text editor",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neofetch.d.ts","sourceRoot":"","sources":["../../src/commands/neofetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"neofetch.d.ts","sourceRoot":"","sources":["../../src/commands/neofetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,WA2C7B,CAAC"}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { buildNeofetchOutput } from "../modules/neofetch";
|
|
2
2
|
import { ifFlag } from "./command-helpers";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Display system information in a decorative format.
|
|
5
|
+
* @category system
|
|
6
|
+
* @params ["[--off]"]
|
|
7
|
+
*/
|
|
4
8
|
export const neofetchCommand = {
|
|
5
9
|
name: "neofetch",
|
|
6
10
|
description: "System info display",
|
|
7
11
|
category: "system",
|
|
8
12
|
params: ["[--off]"],
|
|
9
|
-
run: ({ args, authUser, hostname, shell }) => {
|
|
10
|
-
|
|
13
|
+
run: ({ args, authUser, hostname, shell, env }) => {
|
|
14
|
+
if (!shell.packageManager.isInstalled("neofetch")) {
|
|
15
|
+
return {
|
|
16
|
+
stderr: "bash: neofetch: command not found\nHint: install it with: apt install neofetch\n",
|
|
17
|
+
exitCode: 127,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
11
20
|
if (ifFlag(args, "--help")) {
|
|
12
21
|
return {
|
|
13
22
|
stdout: "Usage: neofetch [--off]",
|
|
@@ -24,9 +33,9 @@ export const neofetchCommand = {
|
|
|
24
33
|
stdout: buildNeofetchOutput({
|
|
25
34
|
user: authUser,
|
|
26
35
|
host: hostname,
|
|
27
|
-
shell: env.SHELL,
|
|
36
|
+
shell: env.vars.SHELL,
|
|
28
37
|
shellProps: shell.properties,
|
|
29
|
-
terminal: env.TERM,
|
|
38
|
+
terminal: env.vars.TERM,
|
|
30
39
|
uptimeSeconds: Math.floor((Date.now() - shell.startTime) / 1000),
|
|
31
40
|
packages: (() => {
|
|
32
41
|
const count = shell.packageManager?.installedCount() ?? 0;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* `passwd [username]` — change a virtual user's password.
|
|
4
|
+
*
|
|
5
|
+
* - Root can change any user's password.
|
|
6
|
+
* - Non-root can only change their own password.
|
|
7
|
+
* - Interactive: emits `passwordChallenge` for hidden-input prompting.
|
|
8
|
+
* - Non-interactive: reads new password from stdin first line.
|
|
9
|
+
*/
|
|
2
10
|
export declare const passwdCommand: ShellModule;
|
|
3
11
|
//# sourceMappingURL=passwd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passwd.d.ts","sourceRoot":"","sources":["../../src/commands/passwd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"passwd.d.ts","sourceRoot":"","sources":["../../src/commands/passwd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,WAuC3B,CAAC"}
|
package/dist/commands/passwd.js
CHANGED
|
@@ -1,22 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `passwd [username]` — change a virtual user's password.
|
|
3
|
+
*
|
|
4
|
+
* - Root can change any user's password.
|
|
5
|
+
* - Non-root can only change their own password.
|
|
6
|
+
* - Interactive: emits `passwordChallenge` for hidden-input prompting.
|
|
7
|
+
* - Non-interactive: reads new password from stdin first line.
|
|
8
|
+
*/
|
|
1
9
|
export const passwdCommand = {
|
|
2
10
|
name: "passwd",
|
|
3
11
|
description: "Change user password",
|
|
4
12
|
category: "users",
|
|
5
|
-
params: ["
|
|
6
|
-
run: async ({ authUser, args, shell }) => {
|
|
7
|
-
const [
|
|
8
|
-
|
|
13
|
+
params: ["[username]"],
|
|
14
|
+
run: async ({ authUser, args, shell, stdin }) => {
|
|
15
|
+
const targetUser = args[0] ?? authUser;
|
|
16
|
+
// Permission check
|
|
17
|
+
if (authUser !== "root" && authUser !== targetUser) {
|
|
18
|
+
return { stderr: "passwd: permission denied", exitCode: 1 };
|
|
19
|
+
}
|
|
20
|
+
// Target must exist
|
|
21
|
+
if (!shell.users.listUsers().includes(targetUser)) {
|
|
22
|
+
return { stderr: `passwd: user '${targetUser}' does not exist`, exitCode: 1 };
|
|
23
|
+
}
|
|
24
|
+
// Non-interactive: read new password from stdin
|
|
25
|
+
if (stdin !== undefined && stdin.trim().length > 0) {
|
|
26
|
+
const password = stdin.trim().split("\n")[0];
|
|
27
|
+
await shell.users.setPassword(targetUser, password);
|
|
9
28
|
return {
|
|
10
|
-
|
|
11
|
-
exitCode:
|
|
29
|
+
stdout: `passwd: password updated successfully\n`,
|
|
30
|
+
exitCode: 0,
|
|
12
31
|
};
|
|
13
32
|
}
|
|
14
|
-
|
|
15
|
-
return { stderr: "passwd: permission denied", exitCode: 1 };
|
|
16
|
-
}
|
|
17
|
-
await shell.users.setPassword(username, password);
|
|
33
|
+
// Interactive: emit password challenge
|
|
18
34
|
return {
|
|
19
|
-
|
|
35
|
+
passwordChallenge: {
|
|
36
|
+
prompt: "New password: ",
|
|
37
|
+
confirmPrompt: "Retype new password: ",
|
|
38
|
+
action: "passwd",
|
|
39
|
+
targetUsername: targetUser,
|
|
40
|
+
},
|
|
20
41
|
exitCode: 0,
|
|
21
42
|
};
|
|
22
43
|
},
|
package/dist/commands/ping.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Send ICMP ECHO_REQUEST packets (mock implementation).
|
|
4
|
+
* @category network
|
|
5
|
+
* @params ["[-c <count>] <host>"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const pingCommand: ShellModule;
|
|
3
8
|
//# sourceMappingURL=ping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ping.d.ts","sourceRoot":"","sources":["../../src/commands/ping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,WAAW,EAAE,WAuBzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"ping.d.ts","sourceRoot":"","sources":["../../src/commands/ping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAuBzB,CAAC"}
|
package/dist/commands/ping.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { parseArgs } from "./command-helpers";
|
|
2
|
+
/**
|
|
3
|
+
* Send ICMP ECHO_REQUEST packets (mock implementation).
|
|
4
|
+
* @category network
|
|
5
|
+
* @params ["[-c <count>] <host>"]
|
|
6
|
+
*/
|
|
2
7
|
export const pingCommand = {
|
|
3
8
|
name: "ping",
|
|
4
9
|
description: "Send ICMP ECHO_REQUEST (mock)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printf.d.ts","sourceRoot":"","sources":["../../src/commands/printf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"printf.d.ts","sourceRoot":"","sources":["../../src/commands/printf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgHrD;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,WAW3B,CAAC"}
|
package/dist/commands/printf.js
CHANGED
|
@@ -48,38 +48,64 @@ function renderPrintf(fmt, args) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
if (fmt[i] === "%" && i + 1 < fmt.length) {
|
|
51
|
-
// Optional width/precision: %[-][width][.prec]spec
|
|
52
51
|
let j = i + 1;
|
|
53
|
-
|
|
52
|
+
let leftAlign = false;
|
|
53
|
+
if (fmt[j] === "-") {
|
|
54
|
+
leftAlign = true;
|
|
54
55
|
j++;
|
|
55
|
-
|
|
56
|
+
}
|
|
57
|
+
let zeroPad = false;
|
|
58
|
+
if (fmt[j] === "0") {
|
|
59
|
+
zeroPad = true;
|
|
60
|
+
j++;
|
|
61
|
+
}
|
|
62
|
+
let width = 0;
|
|
63
|
+
while (j < fmt.length && /\d/.test(fmt[j])) {
|
|
64
|
+
width = width * 10 + parseInt(fmt[j], 10);
|
|
56
65
|
j++;
|
|
66
|
+
}
|
|
67
|
+
let precision = -1;
|
|
57
68
|
if (fmt[j] === ".") {
|
|
58
69
|
j++;
|
|
59
|
-
|
|
70
|
+
precision = 0;
|
|
71
|
+
while (j < fmt.length && /\d/.test(fmt[j])) {
|
|
72
|
+
precision = precision * 10 + parseInt(fmt[j], 10);
|
|
60
73
|
j++;
|
|
74
|
+
}
|
|
61
75
|
}
|
|
62
76
|
const spec = fmt[j];
|
|
63
77
|
const arg = args[argIdx++] ?? "";
|
|
78
|
+
const pad = (s, ch = " ") => {
|
|
79
|
+
if (width <= 0 || s.length >= width)
|
|
80
|
+
return s;
|
|
81
|
+
const fill = ch.repeat(width - s.length);
|
|
82
|
+
return leftAlign ? s + fill : fill + s;
|
|
83
|
+
};
|
|
64
84
|
switch (spec) {
|
|
65
|
-
case "s":
|
|
66
|
-
|
|
85
|
+
case "s": {
|
|
86
|
+
let val = String(arg);
|
|
87
|
+
if (precision >= 0)
|
|
88
|
+
val = val.slice(0, precision);
|
|
89
|
+
out += pad(val);
|
|
67
90
|
break;
|
|
91
|
+
}
|
|
68
92
|
case "d":
|
|
69
93
|
case "i":
|
|
70
|
-
out += String(parseInt(arg, 10) || 0);
|
|
94
|
+
out += pad(String(parseInt(arg, 10) || 0), zeroPad ? "0" : " ");
|
|
71
95
|
break;
|
|
72
|
-
case "f":
|
|
73
|
-
|
|
96
|
+
case "f": {
|
|
97
|
+
const prec = precision >= 0 ? precision : 6;
|
|
98
|
+
out += pad((parseFloat(arg) || 0).toFixed(prec));
|
|
74
99
|
break;
|
|
100
|
+
}
|
|
75
101
|
case "o":
|
|
76
|
-
out += (parseInt(arg, 10) || 0).toString(8);
|
|
102
|
+
out += pad((parseInt(arg, 10) || 0).toString(8), zeroPad ? "0" : " ");
|
|
77
103
|
break;
|
|
78
104
|
case "x":
|
|
79
|
-
out += (parseInt(arg, 10) || 0).toString(16);
|
|
105
|
+
out += pad((parseInt(arg, 10) || 0).toString(16), zeroPad ? "0" : " ");
|
|
80
106
|
break;
|
|
81
107
|
case "X":
|
|
82
|
-
out += (parseInt(arg, 10) || 0).toString(16).toUpperCase();
|
|
108
|
+
out += pad((parseInt(arg, 10) || 0).toString(16).toUpperCase(), zeroPad ? "0" : " ");
|
|
83
109
|
break;
|
|
84
110
|
case "%":
|
|
85
111
|
out += "%";
|
|
@@ -98,6 +124,11 @@ function renderPrintf(fmt, args) {
|
|
|
98
124
|
}
|
|
99
125
|
return out;
|
|
100
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Format and print data to stdout.
|
|
129
|
+
* @category shell
|
|
130
|
+
* @params ["<format> [args...]"]
|
|
131
|
+
*/
|
|
101
132
|
export const printfCommand = {
|
|
102
133
|
name: "printf",
|
|
103
134
|
description: "Format and print data",
|
package/dist/commands/ps.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ps.d.ts","sourceRoot":"","sources":["../../src/commands/ps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,SAAS,EAAE,WAiDvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"ps.d.ts","sourceRoot":"","sources":["../../src/commands/ps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,WAiDvB,CAAC"}
|
package/dist/commands/ps.js
CHANGED
package/dist/commands/read.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Read a line from stdin into one or more variables.
|
|
4
|
+
* @category shell
|
|
5
|
+
* @params ["[-r] [-p prompt] <var...>"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const readCommand: ShellModule;
|
|
3
8
|
//# sourceMappingURL=read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/commands/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,WAAW,EAAE,WAqCzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/commands/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAqCzB,CAAC"}
|
package/dist/commands/read.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ifFlag } from "./command-helpers";
|
|
2
|
+
/**
|
|
3
|
+
* Read a line from stdin into one or more variables.
|
|
4
|
+
* @category shell
|
|
5
|
+
* @params ["[-r] [-p prompt] <var...>"]
|
|
6
|
+
*/
|
|
2
7
|
export const readCommand = {
|
|
3
8
|
name: "read",
|
|
4
9
|
description: "Read a line from stdin into variables",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/commands/registry.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/commands/registry.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmNpF,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAYzD;AAED,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAE,EAChB,GAAG,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,GAClE,WAAW,CAEb;AAED,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAG1C;AAED,wBAAgB,uBAAuB,IAAI,WAAW,EAAE,CAEvD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAGnE"}
|
|
@@ -33,7 +33,8 @@ import { hostnameCommand } from "./hostname";
|
|
|
33
33
|
import { htopCommand } from "./htop";
|
|
34
34
|
import { idCommand } from "./id";
|
|
35
35
|
import { killCommand } from "./kill";
|
|
36
|
-
import { lnCommand } from "./ln";
|
|
36
|
+
import { lnCommand, readlinkCommand } from "./ln";
|
|
37
|
+
import { statCommand } from "./stat";
|
|
37
38
|
import { lsCommand } from "./ls";
|
|
38
39
|
import { lsbReleaseCommand } from "./lsb-release";
|
|
39
40
|
import { manCommand } from "./man";
|
|
@@ -93,7 +94,9 @@ const BASE_COMMANDS = [
|
|
|
93
94
|
cpCommand,
|
|
94
95
|
mvCommand,
|
|
95
96
|
lnCommand,
|
|
97
|
+
readlinkCommand,
|
|
96
98
|
chmodCommand,
|
|
99
|
+
statCommand,
|
|
97
100
|
findCommand,
|
|
98
101
|
// Text processing
|
|
99
102
|
grepCommand,
|
package/dist/commands/rm.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../src/commands/rm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,SAAS,EAAE,WAgCvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../src/commands/rm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,WAgCvB,CAAC"}
|
package/dist/commands/rm.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { getArg, ifFlag } from "./command-helpers";
|
|
2
2
|
import { assertPathAccess, resolvePath } from "./helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Remove files or directories from the filesystem.
|
|
5
|
+
* @category files
|
|
6
|
+
* @params ["[-r|-rf] <path>"]
|
|
7
|
+
*/
|
|
3
8
|
export const rmCommand = {
|
|
4
9
|
name: "rm",
|
|
5
10
|
description: "Remove files or directories",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/commands/runtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EACR,WAAW,EACX,aAAa,EACb,QAAQ,EACX,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/commands/runtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EACR,WAAW,EACX,aAAa,EACb,QAAQ,EACX,MAAM,mBAAmB,CAAC;AAK3B,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAc3E;AAyCD,wBAAsB,gBAAgB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,QAAQ,GACX,OAAO,CAAC,aAAa,CAAC,CA4ExB;AAED,wBAAsB,UAAU,CAC/B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,QAAQ,GACZ,OAAO,CAAC,aAAa,CAAC,CA+HxB"}
|
package/dist/commands/runtime.js
CHANGED
|
@@ -2,64 +2,8 @@
|
|
|
2
2
|
import { executeStatements } from "../SSHMimic/executor";
|
|
3
3
|
import { parseScript } from "../VirtualShell/shellParser";
|
|
4
4
|
import { expandAsync } from "../utils/expand";
|
|
5
|
+
import { tokenizeCommand } from "../utils/tokenize";
|
|
5
6
|
import { resolveModule } from "./registry";
|
|
6
|
-
// ── Tokenize command input respecting quotes ──────────────────────────────────
|
|
7
|
-
function tokenizeCommand(input) {
|
|
8
|
-
const tokens = [];
|
|
9
|
-
let current = "";
|
|
10
|
-
let inQ = false;
|
|
11
|
-
let qChar = "";
|
|
12
|
-
let i = 0;
|
|
13
|
-
while (i < input.length) {
|
|
14
|
-
const ch = input[i];
|
|
15
|
-
const next = input[i + 1];
|
|
16
|
-
if ((ch === '"' || ch === "'") && !inQ) {
|
|
17
|
-
inQ = true;
|
|
18
|
-
qChar = ch;
|
|
19
|
-
i++;
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (inQ && ch === qChar) {
|
|
23
|
-
inQ = false;
|
|
24
|
-
qChar = "";
|
|
25
|
-
i++;
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (inQ) {
|
|
29
|
-
current += ch;
|
|
30
|
-
i++;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (ch === " ") {
|
|
34
|
-
if (current) {
|
|
35
|
-
tokens.push(current);
|
|
36
|
-
current = "";
|
|
37
|
-
}
|
|
38
|
-
i++;
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if ((ch === ">" || ch === "<") && !inQ) {
|
|
42
|
-
if (current) {
|
|
43
|
-
tokens.push(current);
|
|
44
|
-
current = "";
|
|
45
|
-
}
|
|
46
|
-
if (ch === ">" && next === ">") {
|
|
47
|
-
tokens.push(">>");
|
|
48
|
-
i += 2;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
tokens.push(ch);
|
|
52
|
-
i++;
|
|
53
|
-
}
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
current += ch;
|
|
57
|
-
i++;
|
|
58
|
-
}
|
|
59
|
-
if (current)
|
|
60
|
-
tokens.push(current);
|
|
61
|
-
return tokens;
|
|
62
|
-
}
|
|
63
7
|
export function makeDefaultEnv(authUser, hostname) {
|
|
64
8
|
return {
|
|
65
9
|
vars: {
|
package/dist/commands/sed.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Stream editor for filtering and transforming text lines.
|
|
4
|
+
* @category text
|
|
5
|
+
* @params ["-e <expr> [file]", "s/pattern/replace/[g]"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const sedCommand: ShellModule;
|
|
3
8
|
//# sourceMappingURL=sed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sed.d.ts","sourceRoot":"","sources":["../../src/commands/sed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,UAAU,EAAE,WA0DxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"sed.d.ts","sourceRoot":"","sources":["../../src/commands/sed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WA0DxB,CAAC"}
|
package/dist/commands/sed.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { getFlag, ifFlag } from "./command-helpers";
|
|
2
2
|
import { resolvePath } from "./helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Stream editor for filtering and transforming text lines.
|
|
5
|
+
* @category text
|
|
6
|
+
* @params ["-e <expr> [file]", "s/pattern/replace/[g]"]
|
|
7
|
+
*/
|
|
3
8
|
export const sedCommand = {
|
|
4
9
|
name: "sed",
|
|
5
10
|
description: "Stream editor for filtering and transforming text",
|
package/dist/commands/set.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/** biome-ignore-all lint/style/useNamingConvention: env variables */
|
|
2
2
|
import type { ShellModule } from "../types/commands";
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare function getAllEnvVars(authUser: string): Record<string, string>;
|
|
3
|
+
/**
|
|
4
|
+
* Display or set shell variables and options.
|
|
5
|
+
* @category shell
|
|
6
|
+
* @params ["[VAR=value]"]
|
|
7
|
+
*/
|
|
9
8
|
export declare const setCommand: ShellModule;
|
|
10
9
|
//# sourceMappingURL=set.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/commands/set.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/commands/set.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,WAoBxB,CAAC"}
|
package/dist/commands/set.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
TERM: "xterm-256color",
|
|
7
|
-
USER: "user",
|
|
8
|
-
};
|
|
9
|
-
/** @deprecated use env.vars from CommandContext */
|
|
10
|
-
export function getEnvVar(name) {
|
|
11
|
-
return _globalEnv[name];
|
|
12
|
-
}
|
|
13
|
-
/** @deprecated use env.vars from CommandContext */
|
|
14
|
-
export function setEnvVar(name, value) {
|
|
15
|
-
_globalEnv[name] = value;
|
|
16
|
-
}
|
|
17
|
-
/** @deprecated use env.vars from CommandContext */
|
|
18
|
-
export function getAllEnvVars(authUser) {
|
|
19
|
-
_globalEnv.USER = authUser;
|
|
20
|
-
_globalEnv.HOME = `/home/${authUser}`;
|
|
21
|
-
return { ..._globalEnv };
|
|
22
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Display or set shell variables and options.
|
|
3
|
+
* @category shell
|
|
4
|
+
* @params ["[VAR=value]"]
|
|
5
|
+
*/
|
|
23
6
|
export const setCommand = {
|
|
24
7
|
name: "set",
|
|
25
8
|
description: "Display or set shell variables",
|
package/dist/commands/sh.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Execute shell scripts or commands with a minimal shell interpreter.
|
|
4
|
+
* Supports if/elif/else, for loops, while loops, and variable expansion.
|
|
5
|
+
* @category shell
|
|
6
|
+
* @params ["-c <script>", "[<file>]"]
|
|
7
|
+
*/
|
|
2
8
|
export declare const shCommand: ShellModule;
|
|
3
9
|
//# sourceMappingURL=sh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sh.d.ts","sourceRoot":"","sources":["../../src/commands/sh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sh.d.ts","sourceRoot":"","sources":["../../src/commands/sh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,WAAW,EACX,MAAM,mBAAmB,CAAC;AA4R3B;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,WA4CvB,CAAC"}
|
package/dist/commands/sh.js
CHANGED
|
@@ -233,6 +233,12 @@ async function runBlocks(blocks, ctx) {
|
|
|
233
233
|
}
|
|
234
234
|
return { ...lastResult, stdout: output.trim() || lastResult.stdout };
|
|
235
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Execute shell scripts or commands with a minimal shell interpreter.
|
|
238
|
+
* Supports if/elif/else, for loops, while loops, and variable expansion.
|
|
239
|
+
* @category shell
|
|
240
|
+
* @params ["-c <script>", "[<file>]"]
|
|
241
|
+
*/
|
|
236
242
|
export const shCommand = {
|
|
237
243
|
name: "sh",
|
|
238
244
|
aliases: ["bash"],
|
package/dist/commands/shift.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ShellModule } from "../types/commands";
|
|
2
|
+
/**
|
|
3
|
+
* Shift positional parameters (remove first N arguments).
|
|
4
|
+
* @category shell
|
|
5
|
+
* @params ["[n]"]
|
|
6
|
+
*/
|
|
2
7
|
export declare const shiftCommand: ShellModule;
|
|
8
|
+
/**
|
|
9
|
+
* Trap signals and execute actions on signal receipt or shell exit.
|
|
10
|
+
* @category shell
|
|
11
|
+
* @params ["[action] [signal...]"]
|
|
12
|
+
*/
|
|
3
13
|
export declare const trapCommand: ShellModule;
|
|
4
14
|
export declare const returnCommand: ShellModule;
|
|
5
15
|
//# sourceMappingURL=shift.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shift.d.ts","sourceRoot":"","sources":["../../src/commands/shift.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,YAAY,EAAE,WAoB1B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAezB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAW3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"shift.d.ts","sourceRoot":"","sources":["../../src/commands/shift.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAoB1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAezB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAW3B,CAAC"}
|