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.
Files changed (368) hide show
  1. package/.vscode/settings.json +0 -1
  2. package/README.md +674 -1504
  3. package/benchmark-results.txt +21 -21
  4. package/builds/self-standalone.js +282 -332
  5. package/builds/self-standalone.js.map +4 -4
  6. package/builds/standalone-wo-sftp.js +218 -282
  7. package/builds/standalone-wo-sftp.js.map +4 -4
  8. package/builds/standalone.js +271 -335
  9. package/builds/standalone.js.map +4 -4
  10. package/builds/web-full-api.min.js +3 -3
  11. package/builds/web-full-api.min.js.map +4 -4
  12. package/builds/web.min.js +2 -2
  13. package/builds/web.min.js.map +4 -4
  14. package/bun.lock +14 -12
  15. package/dist/SSHClient/index.d.ts.map +1 -1
  16. package/dist/SSHClient/index.js +5 -3
  17. package/dist/SSHMimic/executor.d.ts +1 -3
  18. package/dist/SSHMimic/executor.d.ts.map +1 -1
  19. package/dist/SSHMimic/executor.js +20 -22
  20. package/dist/SSHMimic/index.d.ts.map +1 -1
  21. package/dist/SSHMimic/index.js +5 -3
  22. package/dist/SSHMimic/sftp.d.ts.map +1 -1
  23. package/dist/SSHMimic/sftp.js +26 -21
  24. package/dist/VirtualPackageManager/index.d.ts.map +1 -1
  25. package/dist/VirtualPackageManager/index.js +29 -1
  26. package/dist/VirtualShell/shell.d.ts.map +1 -1
  27. package/dist/VirtualShell/shell.js +25 -3
  28. package/dist/VirtualShell/shellParser.d.ts +1 -8
  29. package/dist/VirtualShell/shellParser.d.ts.map +1 -1
  30. package/dist/VirtualShell/shellParser.js +2 -81
  31. package/dist/VirtualUserManager/index.d.ts +7 -1
  32. package/dist/VirtualUserManager/index.d.ts.map +1 -1
  33. package/dist/VirtualUserManager/index.js +47 -16
  34. package/dist/commands/adduser.d.ts +10 -4
  35. package/dist/commands/adduser.d.ts.map +1 -1
  36. package/dist/commands/adduser.js +75 -12
  37. package/dist/commands/alias.d.ts +5 -0
  38. package/dist/commands/alias.d.ts.map +1 -1
  39. package/dist/commands/alias.js +5 -0
  40. package/dist/commands/apt.d.ts +5 -0
  41. package/dist/commands/apt.d.ts.map +1 -1
  42. package/dist/commands/apt.js +5 -0
  43. package/dist/commands/awk.d.ts +10 -8
  44. package/dist/commands/awk.d.ts.map +1 -1
  45. package/dist/commands/awk.js +156 -28
  46. package/dist/commands/cd.d.ts.map +1 -1
  47. package/dist/commands/cd.js +0 -3
  48. package/dist/commands/clear.d.ts +5 -0
  49. package/dist/commands/clear.d.ts.map +1 -1
  50. package/dist/commands/clear.js +5 -0
  51. package/dist/commands/command-helpers.d.ts.map +1 -1
  52. package/dist/commands/command-helpers.js +8 -0
  53. package/dist/commands/curl.d.ts.map +1 -1
  54. package/dist/commands/curl.js +2 -1
  55. package/dist/commands/declare.d.ts +5 -0
  56. package/dist/commands/declare.d.ts.map +1 -1
  57. package/dist/commands/declare.js +5 -0
  58. package/dist/commands/deluser.d.ts +12 -0
  59. package/dist/commands/deluser.d.ts.map +1 -1
  60. package/dist/commands/deluser.js +72 -6
  61. package/dist/commands/df.d.ts +5 -0
  62. package/dist/commands/df.d.ts.map +1 -1
  63. package/dist/commands/df.js +5 -0
  64. package/dist/commands/du.d.ts +5 -0
  65. package/dist/commands/du.d.ts.map +1 -1
  66. package/dist/commands/du.js +5 -0
  67. package/dist/commands/export.d.ts +5 -0
  68. package/dist/commands/export.d.ts.map +1 -1
  69. package/dist/commands/export.js +5 -0
  70. package/dist/commands/grep.d.ts.map +1 -1
  71. package/dist/commands/grep.js +22 -4
  72. package/dist/commands/groups.d.ts +5 -0
  73. package/dist/commands/groups.d.ts.map +1 -1
  74. package/dist/commands/groups.js +5 -0
  75. package/dist/commands/gzip.d.ts +5 -2
  76. package/dist/commands/gzip.d.ts.map +1 -1
  77. package/dist/commands/gzip.js +54 -28
  78. package/dist/commands/head.d.ts.map +1 -1
  79. package/dist/commands/head.js +12 -3
  80. package/dist/commands/htop.d.ts +5 -0
  81. package/dist/commands/htop.d.ts.map +1 -1
  82. package/dist/commands/htop.js +5 -0
  83. package/dist/commands/kill.d.ts +5 -0
  84. package/dist/commands/kill.d.ts.map +1 -1
  85. package/dist/commands/kill.js +5 -0
  86. package/dist/commands/ln.d.ts +2 -0
  87. package/dist/commands/ln.d.ts.map +1 -1
  88. package/dist/commands/ln.js +22 -0
  89. package/dist/commands/ls.d.ts.map +1 -1
  90. package/dist/commands/ls.js +15 -0
  91. package/dist/commands/lsb-release.d.ts +5 -0
  92. package/dist/commands/lsb-release.d.ts.map +1 -1
  93. package/dist/commands/lsb-release.js +5 -0
  94. package/dist/commands/man.d.ts.map +1 -1
  95. package/dist/commands/man.js +30 -136
  96. package/dist/commands/mkdir.d.ts +5 -0
  97. package/dist/commands/mkdir.d.ts.map +1 -1
  98. package/dist/commands/mkdir.js +5 -0
  99. package/dist/commands/mv.d.ts +5 -0
  100. package/dist/commands/mv.d.ts.map +1 -1
  101. package/dist/commands/mv.js +5 -0
  102. package/dist/commands/nano.d.ts +5 -0
  103. package/dist/commands/nano.d.ts.map +1 -1
  104. package/dist/commands/nano.js +5 -0
  105. package/dist/commands/neofetch.d.ts +5 -0
  106. package/dist/commands/neofetch.d.ts.map +1 -1
  107. package/dist/commands/neofetch.js +14 -5
  108. package/dist/commands/passwd.d.ts +8 -0
  109. package/dist/commands/passwd.d.ts.map +1 -1
  110. package/dist/commands/passwd.js +32 -11
  111. package/dist/commands/ping.d.ts +5 -0
  112. package/dist/commands/ping.d.ts.map +1 -1
  113. package/dist/commands/ping.js +5 -0
  114. package/dist/commands/printf.d.ts +5 -0
  115. package/dist/commands/printf.d.ts.map +1 -1
  116. package/dist/commands/printf.js +43 -12
  117. package/dist/commands/ps.d.ts +5 -0
  118. package/dist/commands/ps.d.ts.map +1 -1
  119. package/dist/commands/ps.js +5 -0
  120. package/dist/commands/read.d.ts +5 -0
  121. package/dist/commands/read.d.ts.map +1 -1
  122. package/dist/commands/read.js +5 -0
  123. package/dist/commands/registry.d.ts.map +1 -1
  124. package/dist/commands/registry.js +4 -1
  125. package/dist/commands/rm.d.ts +5 -0
  126. package/dist/commands/rm.d.ts.map +1 -1
  127. package/dist/commands/rm.js +5 -0
  128. package/dist/commands/runtime.d.ts.map +1 -1
  129. package/dist/commands/runtime.js +1 -57
  130. package/dist/commands/sed.d.ts +5 -0
  131. package/dist/commands/sed.d.ts.map +1 -1
  132. package/dist/commands/sed.js +5 -0
  133. package/dist/commands/set.d.ts +5 -6
  134. package/dist/commands/set.d.ts.map +1 -1
  135. package/dist/commands/set.js +5 -22
  136. package/dist/commands/sh.d.ts +6 -0
  137. package/dist/commands/sh.d.ts.map +1 -1
  138. package/dist/commands/sh.js +6 -0
  139. package/dist/commands/shift.d.ts +10 -0
  140. package/dist/commands/shift.d.ts.map +1 -1
  141. package/dist/commands/shift.js +10 -0
  142. package/dist/commands/sleep.d.ts +5 -0
  143. package/dist/commands/sleep.d.ts.map +1 -1
  144. package/dist/commands/sleep.js +5 -0
  145. package/dist/commands/sort.d.ts +5 -0
  146. package/dist/commands/sort.d.ts.map +1 -1
  147. package/dist/commands/sort.js +5 -0
  148. package/dist/commands/source.d.ts +5 -0
  149. package/dist/commands/source.d.ts.map +1 -1
  150. package/dist/commands/source.js +5 -0
  151. package/dist/commands/stat.d.ts +7 -0
  152. package/dist/commands/stat.d.ts.map +1 -0
  153. package/dist/commands/stat.js +56 -0
  154. package/dist/commands/su.d.ts +13 -0
  155. package/dist/commands/su.d.ts.map +1 -1
  156. package/dist/commands/su.js +45 -14
  157. package/dist/commands/sudo.d.ts.map +1 -1
  158. package/dist/commands/sudo.js +5 -0
  159. package/dist/commands/tail.d.ts +5 -0
  160. package/dist/commands/tail.d.ts.map +1 -1
  161. package/dist/commands/tail.js +15 -3
  162. package/dist/commands/tar.d.ts +5 -0
  163. package/dist/commands/tar.d.ts.map +1 -1
  164. package/dist/commands/tar.js +40 -10
  165. package/dist/commands/tee.d.ts +5 -0
  166. package/dist/commands/tee.d.ts.map +1 -1
  167. package/dist/commands/tee.js +5 -0
  168. package/dist/commands/touch.d.ts +5 -0
  169. package/dist/commands/touch.d.ts.map +1 -1
  170. package/dist/commands/touch.js +5 -0
  171. package/dist/commands/tr.d.ts.map +1 -1
  172. package/dist/commands/tr.js +45 -10
  173. package/dist/commands/tree.d.ts +5 -0
  174. package/dist/commands/tree.d.ts.map +1 -1
  175. package/dist/commands/tree.js +5 -0
  176. package/dist/commands/true.d.ts +10 -0
  177. package/dist/commands/true.d.ts.map +1 -1
  178. package/dist/commands/true.js +10 -0
  179. package/dist/commands/type.d.ts +5 -0
  180. package/dist/commands/type.d.ts.map +1 -1
  181. package/dist/commands/type.js +5 -0
  182. package/dist/commands/uname.d.ts +5 -0
  183. package/dist/commands/uname.d.ts.map +1 -1
  184. package/dist/commands/uname.js +5 -0
  185. package/dist/commands/uniq.d.ts +5 -0
  186. package/dist/commands/uniq.d.ts.map +1 -1
  187. package/dist/commands/uniq.js +5 -0
  188. package/dist/commands/unset.d.ts +5 -0
  189. package/dist/commands/unset.d.ts.map +1 -1
  190. package/dist/commands/unset.js +5 -0
  191. package/dist/commands/uptime.d.ts +5 -0
  192. package/dist/commands/uptime.d.ts.map +1 -1
  193. package/dist/commands/uptime.js +5 -0
  194. package/dist/commands/wc.d.ts +5 -0
  195. package/dist/commands/wc.d.ts.map +1 -1
  196. package/dist/commands/wc.js +5 -0
  197. package/dist/commands/wget.d.ts +5 -0
  198. package/dist/commands/wget.d.ts.map +1 -1
  199. package/dist/commands/wget.js +16 -1
  200. package/dist/commands/who.d.ts +5 -0
  201. package/dist/commands/who.d.ts.map +1 -1
  202. package/dist/commands/who.js +5 -0
  203. package/dist/commands/whoami.d.ts +5 -0
  204. package/dist/commands/whoami.d.ts.map +1 -1
  205. package/dist/commands/whoami.js +5 -0
  206. package/dist/commands/xargs.d.ts +5 -0
  207. package/dist/commands/xargs.d.ts.map +1 -1
  208. package/dist/commands/xargs.js +5 -0
  209. package/dist/self-standalone.js +254 -30
  210. package/dist/types/commands.d.ts +36 -0
  211. package/dist/types/commands.d.ts.map +1 -1
  212. package/dist/utils/tokenize.d.ts +20 -0
  213. package/dist/utils/tokenize.d.ts.map +1 -0
  214. package/dist/utils/tokenize.js +74 -0
  215. package/examples/web.min.js +2 -2
  216. package/package.json +2 -2
  217. package/src/SSHClient/index.ts +6 -3
  218. package/src/SSHMimic/executor.ts +21 -44
  219. package/src/SSHMimic/index.ts +7 -5
  220. package/src/SSHMimic/sftp.ts +28 -21
  221. package/src/VirtualPackageManager/index.ts +29 -1
  222. package/src/VirtualShell/shell.ts +34 -4
  223. package/src/VirtualShell/shellParser.ts +2 -103
  224. package/src/VirtualUserManager/index.ts +43 -19
  225. package/src/commands/adduser.ts +86 -13
  226. package/src/commands/alias.ts +5 -0
  227. package/src/commands/apt.ts +5 -0
  228. package/src/commands/awk.ts +154 -29
  229. package/src/commands/cd.ts +0 -4
  230. package/src/commands/clear.ts +5 -0
  231. package/src/commands/command-helpers.ts +9 -0
  232. package/src/commands/curl.ts +2 -1
  233. package/src/commands/declare.ts +5 -0
  234. package/src/commands/deluser.ts +84 -7
  235. package/src/commands/df.ts +5 -0
  236. package/src/commands/du.ts +5 -0
  237. package/src/commands/export.ts +5 -0
  238. package/src/commands/grep.ts +21 -8
  239. package/src/commands/groups.ts +5 -0
  240. package/src/commands/gzip.ts +61 -28
  241. package/src/commands/head.ts +14 -4
  242. package/src/commands/htop.ts +5 -0
  243. package/src/commands/kill.ts +5 -0
  244. package/src/commands/ln.ts +22 -0
  245. package/src/commands/ls.ts +17 -0
  246. package/src/commands/lsb-release.ts +5 -0
  247. package/src/commands/man.ts +38 -143
  248. package/src/commands/manuals/adduser.txt +11 -0
  249. package/src/commands/manuals/apt-cache.txt +12 -0
  250. package/src/commands/manuals/apt.txt +20 -0
  251. package/src/commands/manuals/awk.txt +13 -0
  252. package/src/commands/manuals/cat.txt +14 -0
  253. package/src/commands/manuals/cd.txt +16 -0
  254. package/src/commands/manuals/chmod.txt +16 -0
  255. package/src/commands/manuals/clear.txt +10 -0
  256. package/src/commands/manuals/cp.txt +10 -0
  257. package/src/commands/manuals/curl.txt +20 -0
  258. package/src/commands/manuals/date.txt +14 -0
  259. package/src/commands/manuals/declare.txt +12 -0
  260. package/src/commands/manuals/deluser.txt +10 -0
  261. package/src/commands/manuals/df.txt +10 -0
  262. package/src/commands/manuals/dpkg-query.txt +11 -0
  263. package/src/commands/manuals/dpkg.txt +14 -0
  264. package/src/commands/manuals/du.txt +11 -0
  265. package/src/commands/manuals/echo.txt +11 -0
  266. package/src/commands/manuals/false.txt +10 -0
  267. package/src/commands/manuals/find.txt +11 -0
  268. package/src/commands/manuals/free.txt +12 -0
  269. package/src/commands/manuals/grep.txt +13 -0
  270. package/src/commands/manuals/groups.txt +10 -0
  271. package/src/commands/manuals/gzip.txt +11 -0
  272. package/src/commands/manuals/head.txt +10 -0
  273. package/src/commands/manuals/help.txt +11 -0
  274. package/src/commands/manuals/history.txt +11 -0
  275. package/src/commands/manuals/hostname.txt +10 -0
  276. package/src/commands/manuals/id.txt +10 -0
  277. package/src/commands/manuals/kill.txt +13 -0
  278. package/src/commands/manuals/ls.txt +20 -0
  279. package/src/commands/manuals/lsb_release.txt +14 -0
  280. package/src/commands/manuals/mkdir.txt +10 -0
  281. package/src/commands/manuals/mv.txt +10 -0
  282. package/src/commands/manuals/nano.txt +11 -0
  283. package/src/commands/manuals/neofetch.txt +10 -0
  284. package/src/commands/manuals/node.txt +13 -0
  285. package/src/commands/manuals/npm.txt +13 -0
  286. package/src/commands/manuals/npx.txt +13 -0
  287. package/src/commands/manuals/passwd.txt +11 -0
  288. package/src/commands/manuals/ping.txt +10 -0
  289. package/src/commands/manuals/printf.txt +11 -0
  290. package/src/commands/manuals/ps.txt +10 -0
  291. package/src/commands/manuals/pwd.txt +10 -0
  292. package/src/commands/manuals/python3.txt +13 -0
  293. package/src/commands/manuals/readlink.txt +10 -0
  294. package/src/commands/manuals/return.txt +10 -0
  295. package/src/commands/manuals/rm.txt +10 -0
  296. package/src/commands/manuals/sed.txt +11 -0
  297. package/src/commands/manuals/set.txt +11 -0
  298. package/src/commands/manuals/shift.txt +10 -0
  299. package/src/commands/manuals/sleep.txt +10 -0
  300. package/src/commands/manuals/sort.txt +12 -0
  301. package/src/commands/manuals/source.txt +11 -0
  302. package/src/commands/manuals/ssh.txt +11 -0
  303. package/src/commands/manuals/stat.txt +10 -0
  304. package/src/commands/manuals/su.txt +13 -0
  305. package/src/commands/manuals/sudo.txt +11 -0
  306. package/src/commands/manuals/tail.txt +10 -0
  307. package/src/commands/manuals/tar.txt +19 -0
  308. package/src/commands/manuals/tee.txt +10 -0
  309. package/src/commands/manuals/test.txt +11 -0
  310. package/src/commands/manuals/touch.txt +11 -0
  311. package/src/commands/manuals/tr.txt +10 -0
  312. package/src/commands/manuals/trap.txt +10 -0
  313. package/src/commands/manuals/true.txt +10 -0
  314. package/src/commands/manuals/type.txt +10 -0
  315. package/src/commands/manuals/uname.txt +12 -0
  316. package/src/commands/manuals/uniq.txt +12 -0
  317. package/src/commands/manuals/unset.txt +10 -0
  318. package/src/commands/manuals/uptime.txt +11 -0
  319. package/src/commands/manuals/wc.txt +12 -0
  320. package/src/commands/manuals/wget.txt +12 -0
  321. package/src/commands/manuals/which.txt +10 -0
  322. package/src/commands/manuals/whoami.txt +10 -0
  323. package/src/commands/manuals/xargs.txt +10 -0
  324. package/src/commands/mkdir.ts +5 -0
  325. package/src/commands/mv.ts +5 -0
  326. package/src/commands/nano.ts +5 -0
  327. package/src/commands/neofetch.ts +15 -6
  328. package/src/commands/passwd.ts +35 -12
  329. package/src/commands/ping.ts +5 -0
  330. package/src/commands/printf.ts +30 -13
  331. package/src/commands/ps.ts +5 -0
  332. package/src/commands/read.ts +5 -0
  333. package/src/commands/registry.ts +4 -1
  334. package/src/commands/rm.ts +5 -0
  335. package/src/commands/runtime.ts +1 -61
  336. package/src/commands/sed.ts +5 -0
  337. package/src/commands/set.ts +5 -24
  338. package/src/commands/sh.ts +9 -3
  339. package/src/commands/shift.ts +10 -0
  340. package/src/commands/sleep.ts +5 -0
  341. package/src/commands/sort.ts +5 -0
  342. package/src/commands/source.ts +5 -0
  343. package/src/commands/stat.ts +61 -0
  344. package/src/commands/su.ts +54 -16
  345. package/src/commands/sudo.ts +5 -0
  346. package/src/commands/tail.ts +17 -3
  347. package/src/commands/tar.ts +38 -15
  348. package/src/commands/tee.ts +5 -0
  349. package/src/commands/touch.ts +5 -0
  350. package/src/commands/tr.ts +54 -10
  351. package/src/commands/tree.ts +5 -0
  352. package/src/commands/true.ts +10 -0
  353. package/src/commands/type.ts +5 -0
  354. package/src/commands/uname.ts +5 -0
  355. package/src/commands/uniq.ts +5 -0
  356. package/src/commands/unset.ts +5 -0
  357. package/src/commands/uptime.ts +5 -0
  358. package/src/commands/wc.ts +5 -0
  359. package/src/commands/wget.ts +17 -1
  360. package/src/commands/who.ts +5 -0
  361. package/src/commands/whoami.ts +5 -0
  362. package/src/commands/xargs.ts +5 -0
  363. package/src/self-standalone.ts +316 -33
  364. package/src/types/commands.ts +37 -0
  365. package/src/utils/tokenize.ts +78 -0
  366. package/tests/new-features.test.ts +2 -2
  367. package/builds/web-iife.min.js +0 -13
  368. package/builds/web-iife.min.js.map +0 -7
@@ -0,0 +1,10 @@
1
+ SLEEP(1) User Commands SLEEP(1)
2
+
3
+ NAME
4
+ sleep - delay for a specified amount of time
5
+
6
+ SYNOPSIS
7
+ sleep NUMBER
8
+
9
+ DESCRIPTION
10
+ Pause execution for NUMBER seconds.
@@ -0,0 +1,12 @@
1
+ SORT(1) User Commands SORT(1)
2
+
3
+ NAME
4
+ sort - sort lines of text files
5
+
6
+ SYNOPSIS
7
+ sort [OPTION]... [FILE]...
8
+
9
+ OPTIONS
10
+ -r reverse the result of comparisons
11
+ -n compare according to string numerical value
12
+ -u output only the first of an equal run
@@ -0,0 +1,11 @@
1
+ SOURCE(1) Shell Builtins SOURCE(1)
2
+
3
+ NAME
4
+ source - execute commands from a file in the current shell
5
+
6
+ SYNOPSIS
7
+ source FILE
8
+ . FILE
9
+
10
+ DESCRIPTION
11
+ Read and execute commands from FILE in the current shell context.
@@ -0,0 +1,11 @@
1
+ SSH(1) OpenSSH SSH(1)
2
+
3
+ NAME
4
+ ssh - OpenSSH remote login client
5
+
6
+ SYNOPSIS
7
+ ssh [-p port] [user@]hostname [command]
8
+
9
+ DESCRIPTION
10
+ ssh (SSH client) is a program for logging into a remote machine and
11
+ for executing commands on a remote machine.
@@ -0,0 +1,10 @@
1
+ STAT(1) User Commands STAT(1)
2
+
3
+ NAME
4
+ stat - display file status
5
+
6
+ SYNOPSIS
7
+ stat [OPTION]... FILE...
8
+
9
+ OPTIONS
10
+ -c, --format=FORMAT use the specified output format
@@ -0,0 +1,13 @@
1
+ SU(1) User Commands SU(1)
2
+
3
+ NAME
4
+ su - run a command with substitute user and group ID
5
+
6
+ SYNOPSIS
7
+ su [OPTION]... [USER]
8
+
9
+ OPTIONS
10
+ - start a login shell
11
+
12
+ DESCRIPTION
13
+ Switch to another user account in the current session.
@@ -0,0 +1,11 @@
1
+ SUDO(8) User Commands SUDO(8)
2
+
3
+ NAME
4
+ sudo - execute a command as another user
5
+
6
+ SYNOPSIS
7
+ sudo [OPTION]... COMMAND [ARG]...
8
+
9
+ OPTIONS
10
+ -i run login shell as target user
11
+ -u USER run command as USER
@@ -0,0 +1,10 @@
1
+ TAIL(1) User Commands TAIL(1)
2
+
3
+ NAME
4
+ tail - output the last part of files
5
+
6
+ SYNOPSIS
7
+ tail [OPTION]... [FILE]...
8
+
9
+ OPTIONS
10
+ -n, --lines=[+]NUM output the last NUM lines
@@ -0,0 +1,19 @@
1
+ TAR(1) GNU tar Manual TAR(1)
2
+
3
+ NAME
4
+ tar - an archiving utility
5
+
6
+ SYNOPSIS
7
+ tar [OPTION...] [FILE]...
8
+
9
+ DESCRIPTION
10
+ tar saves many files together into a single tape or disk archive,
11
+ and can restore individual files from the archive.
12
+
13
+ OPTIONS
14
+ -c, --create create a new archive
15
+ -x, --extract extract files from an archive
16
+ -z, --gzip filter the archive through gzip
17
+ -f, --file=ARCHIVE use archive file or device ARCHIVE
18
+ -v, --verbose verbosely list files processed
19
+ -t, --list list the contents of an archive
@@ -0,0 +1,10 @@
1
+ TEE(1) User Commands TEE(1)
2
+
3
+ NAME
4
+ tee - read from standard input and write to standard output and files
5
+
6
+ SYNOPSIS
7
+ tee [OPTION]... [FILE]...
8
+
9
+ OPTIONS
10
+ -a append to the given FILEs, do not overwrite
@@ -0,0 +1,11 @@
1
+ TEST(1) Shell Builtins TEST(1)
2
+
3
+ NAME
4
+ test - check file types and compare values
5
+
6
+ SYNOPSIS
7
+ test EXPRESSION
8
+ [ EXPRESSION ]
9
+
10
+ DESCRIPTION
11
+ Evaluate conditional expressions for scripts and shell logic.
@@ -0,0 +1,11 @@
1
+ TOUCH(1) User Commands TOUCH(1)
2
+
3
+ NAME
4
+ touch - change file timestamps / create file
5
+
6
+ SYNOPSIS
7
+ touch FILE...
8
+
9
+ DESCRIPTION
10
+ Update access and modification times.
11
+ If FILE does not exist, create an empty file.
@@ -0,0 +1,10 @@
1
+ TR(1) User Commands TR(1)
2
+
3
+ NAME
4
+ tr - translate or delete characters
5
+
6
+ SYNOPSIS
7
+ tr [OPTION]... SET1 [SET2]
8
+
9
+ OPTIONS
10
+ -d delete characters in SET1 instead of translating
@@ -0,0 +1,10 @@
1
+ TRAP(1) Shell Builtins TRAP(1)
2
+
3
+ NAME
4
+ trap - trap signals and other events
5
+
6
+ SYNOPSIS
7
+ trap [ACTION] [SIGNAL]...
8
+
9
+ DESCRIPTION
10
+ Define or clear handlers for shell signals and EXIT.
@@ -0,0 +1,10 @@
1
+ TRUE(1) User Commands TRUE(1)
2
+
3
+ NAME
4
+ true - do nothing, successfully
5
+
6
+ SYNOPSIS
7
+ true
8
+
9
+ DESCRIPTION
10
+ Exit with a status code indicating success (0).
@@ -0,0 +1,10 @@
1
+ TYPE(1) Shell Builtins TYPE(1)
2
+
3
+ NAME
4
+ type - display how a command name is interpreted
5
+
6
+ SYNOPSIS
7
+ type NAME...
8
+
9
+ DESCRIPTION
10
+ Indicate whether NAME is a shell builtin, alias, or found in PATH.
@@ -0,0 +1,12 @@
1
+ UNAME(1) User Commands UNAME(1)
2
+
3
+ NAME
4
+ uname - print system information
5
+
6
+ SYNOPSIS
7
+ uname [OPTION]...
8
+
9
+ OPTIONS
10
+ -a print all information
11
+ -r print kernel release
12
+ -m print machine hardware name
@@ -0,0 +1,12 @@
1
+ UNIQ(1) User Commands UNIQ(1)
2
+
3
+ NAME
4
+ uniq - report or omit repeated lines
5
+
6
+ SYNOPSIS
7
+ uniq [OPTION]... [INPUT [OUTPUT]]
8
+
9
+ OPTIONS
10
+ -c prefix lines by the number of occurrences
11
+ -d only print duplicate lines
12
+ -u only print unique lines
@@ -0,0 +1,10 @@
1
+ UNSET(1) Shell Builtins UNSET(1)
2
+
3
+ NAME
4
+ unset - unset values and attributes of shell variables
5
+
6
+ SYNOPSIS
7
+ unset NAME...
8
+
9
+ DESCRIPTION
10
+ Remove one or more shell variables from the current environment.
@@ -0,0 +1,11 @@
1
+ UPTIME(1) User Commands UPTIME(1)
2
+
3
+ NAME
4
+ uptime - tell how long the system has been running
5
+
6
+ SYNOPSIS
7
+ uptime [OPTION]
8
+
9
+ OPTIONS
10
+ -p show uptime in a pretty format
11
+ -s show system up since time
@@ -0,0 +1,12 @@
1
+ WC(1) User Commands WC(1)
2
+
3
+ NAME
4
+ wc - print newline, word, and byte counts for each file
5
+
6
+ SYNOPSIS
7
+ wc [OPTION]... [FILE]...
8
+
9
+ OPTIONS
10
+ -l print the newline counts
11
+ -w print the word counts
12
+ -c print the byte counts
@@ -0,0 +1,12 @@
1
+ WGET(1) User Commands WGET(1)
2
+
3
+ NAME
4
+ wget - non-interactive network downloader
5
+
6
+ SYNOPSIS
7
+ wget [OPTION]... [URL]...
8
+
9
+ OPTIONS
10
+ -O FILE write documents to FILE
11
+ -P DIR save files to DIR
12
+ -q quiet mode
@@ -0,0 +1,10 @@
1
+ WHICH(1) User Commands WHICH(1)
2
+
3
+ NAME
4
+ which - locate a command
5
+
6
+ SYNOPSIS
7
+ which COMMAND...
8
+
9
+ DESCRIPTION
10
+ Print the path of COMMAND found in $PATH.
@@ -0,0 +1,10 @@
1
+ WHOAMI(1) User Commands WHOAMI(1)
2
+
3
+ NAME
4
+ whoami - print effective user name
5
+
6
+ SYNOPSIS
7
+ whoami
8
+
9
+ DESCRIPTION
10
+ Print the user name associated with the current effective user ID.
@@ -0,0 +1,10 @@
1
+ XARGS(1) User Commands XARGS(1)
2
+
3
+ NAME
4
+ xargs - build and execute command lines from standard input
5
+
6
+ SYNOPSIS
7
+ xargs [COMMAND [INITIAL-ARGS]]
8
+
9
+ DESCRIPTION
10
+ Read items from stdin and execute COMMAND with those items as arguments.
@@ -2,6 +2,11 @@ import type { ShellModule } from "../types/commands";
2
2
  import { getArg } from "./command-helpers";
3
3
  import { assertPathAccess, resolvePath } from "./helpers";
4
4
 
5
+ /**
6
+ * Create one or more directories.
7
+ * @category files
8
+ * @params ["<dir>"]
9
+ */
5
10
  export const mkdirCommand: ShellModule = {
6
11
  name: "mkdir",
7
12
  description: "Make directories",
@@ -1,6 +1,11 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
  import { assertPathAccess, resolvePath } from "./helpers";
3
3
 
4
+ /**
5
+ * Move or rename files and directories.
6
+ * @category files
7
+ * @params ["<source> <dest>"]
8
+ */
4
9
  export const mvCommand: ShellModule = {
5
10
  name: "mv",
6
11
  description: "Move or rename files",
@@ -2,6 +2,11 @@ import * as path from "node:path";
2
2
  import type { ShellModule } from "../types/commands";
3
3
  import { assertPathAccess, resolvePath } from "./helpers";
4
4
 
5
+ /**
6
+ * Simple text editor for editing files.
7
+ * @category files
8
+ * @params ["<file>"]
9
+ */
5
10
  export const nanoCommand: ShellModule = {
6
11
  name: "nano",
7
12
  description: "Text editor",
@@ -1,16 +1,25 @@
1
1
  import { buildNeofetchOutput } from "../modules/neofetch";
2
2
  import type { ShellModule } from "../types/commands";
3
3
  import { ifFlag } from "./command-helpers";
4
- import { getAllEnvVars } from "./set";
5
4
 
5
+ /**
6
+ * Display system information in a decorative format.
7
+ * @category system
8
+ * @params ["[--off]"]
9
+ */
6
10
  export const neofetchCommand: ShellModule = {
7
11
  name: "neofetch",
8
12
  description: "System info display",
9
13
  category: "system",
10
14
  params: ["[--off]"],
11
- run: ({ args, authUser, hostname, shell }) => {
12
- const env = getAllEnvVars(authUser);
13
-
15
+ run: ({ args, authUser, hostname, shell, env }) => {
16
+ if (!shell.packageManager.isInstalled("neofetch")) {
17
+ return {
18
+ stderr:
19
+ "bash: neofetch: command not found\nHint: install it with: apt install neofetch\n",
20
+ exitCode: 127,
21
+ };
22
+ }
14
23
  if (ifFlag(args, "--help")) {
15
24
  return {
16
25
  stdout: "Usage: neofetch [--off]",
@@ -29,9 +38,9 @@ export const neofetchCommand: ShellModule = {
29
38
  stdout: buildNeofetchOutput({
30
39
  user: authUser,
31
40
  host: hostname,
32
- shell: env.SHELL,
41
+ shell: env.vars.SHELL,
33
42
  shellProps: shell.properties,
34
- terminal: env.TERM,
43
+ terminal: env.vars.TERM,
35
44
  uptimeSeconds: Math.floor((Date.now() - shell.startTime) / 1000),
36
45
  packages: (() => {
37
46
  const count = shell.packageManager?.installedCount() ?? 0;
@@ -1,26 +1,49 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
 
3
+ /**
4
+ * `passwd [username]` — change a virtual user's password.
5
+ *
6
+ * - Root can change any user's password.
7
+ * - Non-root can only change their own password.
8
+ * - Interactive: emits `passwordChallenge` for hidden-input prompting.
9
+ * - Non-interactive: reads new password from stdin first line.
10
+ */
3
11
  export const passwdCommand: ShellModule = {
4
12
  name: "passwd",
5
13
  description: "Change user password",
6
14
  category: "users",
7
- params: ["<username> <password>"],
8
- run: async ({ authUser, args, shell }) => {
9
- const [username, password] = args;
10
- if (!username || !password) {
11
- return {
12
- stderr: "passwd: usage: passwd <username> <password>",
13
- exitCode: 1,
14
- };
15
- }
15
+ params: ["[username]"],
16
+ run: async ({ authUser, args, shell, stdin }) => {
17
+ const targetUser = args[0] ?? authUser;
16
18
 
17
- if (authUser !== "root" && authUser !== username) {
19
+ // Permission check
20
+ if (authUser !== "root" && authUser !== targetUser) {
18
21
  return { stderr: "passwd: permission denied", exitCode: 1 };
19
22
  }
20
23
 
21
- await shell.users.setPassword(username, password);
24
+ // Target must exist
25
+ if (!shell.users.listUsers().includes(targetUser)) {
26
+ return { stderr: `passwd: user '${targetUser}' does not exist`, exitCode: 1 };
27
+ }
28
+
29
+ // Non-interactive: read new password from stdin
30
+ if (stdin !== undefined && stdin.trim().length > 0) {
31
+ const password = stdin.trim().split("\n")[0]!;
32
+ await shell.users.setPassword(targetUser, password);
33
+ return {
34
+ stdout: `passwd: password updated successfully\n`,
35
+ exitCode: 0,
36
+ };
37
+ }
38
+
39
+ // Interactive: emit password challenge
22
40
  return {
23
- stdout: `passwd: password updated for '${username}'`,
41
+ passwordChallenge: {
42
+ prompt: "New password: ",
43
+ confirmPrompt: "Retype new password: ",
44
+ action: "passwd" as const,
45
+ targetUsername: targetUser,
46
+ },
24
47
  exitCode: 0,
25
48
  };
26
49
  },
@@ -1,6 +1,11 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
  import { parseArgs } from "./command-helpers";
3
3
 
4
+ /**
5
+ * Send ICMP ECHO_REQUEST packets (mock implementation).
6
+ * @category network
7
+ * @params ["[-c <count>] <host>"]
8
+ */
4
9
  export const pingCommand: ShellModule = {
5
10
  name: "ping",
6
11
  description: "Send ICMP ECHO_REQUEST (mock)",
@@ -50,35 +50,47 @@ function renderPrintf(fmt: string, args: string[]): string {
50
50
  }
51
51
  }
52
52
  if (fmt[i] === "%" && i + 1 < fmt.length) {
53
- // Optional width/precision: %[-][width][.prec]spec
54
53
  let j = i + 1;
55
- if (fmt[j] === "-") j++;
56
- while (j < fmt.length && /\d/.test(fmt[j]!)) j++;
54
+ let leftAlign = false; if (fmt[j] === "-") { leftAlign = true; j++; }
55
+ let zeroPad = false; if (fmt[j] === "0") { zeroPad = true; j++; }
56
+ let width = 0;
57
+ while (j < fmt.length && /\d/.test(fmt[j]!)) { width = width * 10 + parseInt(fmt[j]!, 10); j++; }
58
+ let precision = -1;
57
59
  if (fmt[j] === ".") {
58
- j++;
59
- while (j < fmt.length && /\d/.test(fmt[j]!)) j++;
60
+ j++; precision = 0;
61
+ while (j < fmt.length && /\d/.test(fmt[j]!)) { precision = precision * 10 + parseInt(fmt[j]!, 10); j++; }
60
62
  }
61
63
  const spec = fmt[j];
62
64
  const arg = args[argIdx++] ?? "";
65
+ const pad = (s: string, ch = " "): string => {
66
+ if (width <= 0 || s.length >= width) return s;
67
+ const fill = ch.repeat(width - s.length);
68
+ return leftAlign ? s + fill : fill + s;
69
+ };
63
70
  switch (spec) {
64
- case "s":
65
- out += arg;
71
+ case "s": {
72
+ let val = String(arg);
73
+ if (precision >= 0) val = val.slice(0, precision);
74
+ out += pad(val);
66
75
  break;
76
+ }
67
77
  case "d":
68
78
  case "i":
69
- out += String(parseInt(arg, 10) || 0);
79
+ out += pad(String(parseInt(arg, 10) || 0), zeroPad ? "0" : " ");
70
80
  break;
71
- case "f":
72
- out += String(parseFloat(arg) || 0);
81
+ case "f": {
82
+ const prec = precision >= 0 ? precision : 6;
83
+ out += pad((parseFloat(arg) || 0).toFixed(prec));
73
84
  break;
85
+ }
74
86
  case "o":
75
- out += (parseInt(arg, 10) || 0).toString(8);
87
+ out += pad((parseInt(arg, 10) || 0).toString(8), zeroPad ? "0" : " ");
76
88
  break;
77
89
  case "x":
78
- out += (parseInt(arg, 10) || 0).toString(16);
90
+ out += pad((parseInt(arg, 10) || 0).toString(16), zeroPad ? "0" : " ");
79
91
  break;
80
92
  case "X":
81
- out += (parseInt(arg, 10) || 0).toString(16).toUpperCase();
93
+ out += pad((parseInt(arg, 10) || 0).toString(16).toUpperCase(), zeroPad ? "0" : " ");
82
94
  break;
83
95
  case "%":
84
96
  out += "%";
@@ -98,6 +110,11 @@ function renderPrintf(fmt: string, args: string[]): string {
98
110
  return out;
99
111
  }
100
112
 
113
+ /**
114
+ * Format and print data to stdout.
115
+ * @category shell
116
+ * @params ["<format> [args...]"]
117
+ */
101
118
  export const printfCommand: ShellModule = {
102
119
  name: "printf",
103
120
  description: "Format and print data",
@@ -1,6 +1,11 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
  import { ifFlag } from "./command-helpers";
3
3
 
4
+ /**
5
+ * Report process status with various formatting options.
6
+ * @category system
7
+ * @params ["[-a] [-u] [-x] [aux]"]
8
+ */
4
9
  export const psCommand: ShellModule = {
5
10
  name: "ps",
6
11
  description: "Report process status",
@@ -1,6 +1,11 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
  import { ifFlag } from "./command-helpers";
3
3
 
4
+ /**
5
+ * Read a line from stdin into one or more variables.
6
+ * @category shell
7
+ * @params ["[-r] [-p prompt] <var...>"]
8
+ */
4
9
  export const readCommand: ShellModule = {
5
10
  name: "read",
6
11
  description: "Read a line from stdin into variables",
@@ -35,7 +35,8 @@ import { hostnameCommand } from "./hostname";
35
35
  import { htopCommand } from "./htop";
36
36
  import { idCommand } from "./id";
37
37
  import { killCommand } from "./kill";
38
- import { lnCommand } from "./ln";
38
+ import { lnCommand, readlinkCommand } from "./ln";
39
+ import { statCommand } from "./stat";
39
40
  import { lsCommand } from "./ls";
40
41
  import { lsbReleaseCommand } from "./lsb-release";
41
42
  import { manCommand } from "./man";
@@ -96,7 +97,9 @@ const BASE_COMMANDS: ShellModule[] = [
96
97
  cpCommand,
97
98
  mvCommand,
98
99
  lnCommand,
100
+ readlinkCommand,
99
101
  chmodCommand,
102
+ statCommand,
100
103
  findCommand,
101
104
  // Text processing
102
105
  grepCommand,
@@ -2,6 +2,11 @@ import type { ShellModule } from "../types/commands";
2
2
  import { getArg, ifFlag } from "./command-helpers";
3
3
  import { assertPathAccess, resolvePath } from "./helpers";
4
4
 
5
+ /**
6
+ * Remove files or directories from the filesystem.
7
+ * @category files
8
+ * @params ["[-r|-rf] <path>"]
9
+ */
5
10
  export const rmCommand: ShellModule = {
6
11
  name: "rm",
7
12
  description: "Remove files or directories",