typescript-virtual-container 1.3.4 → 1.4.0

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 (282) 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 +274 -208
  5. package/builds/self-standalone.js.map +4 -4
  6. package/builds/standalone-wo-sftp.js +201 -149
  7. package/builds/standalone-wo-sftp.js.map +4 -4
  8. package/builds/standalone.js +263 -211
  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/VirtualShell/shell.d.ts.map +1 -1
  25. package/dist/VirtualShell/shell.js +25 -3
  26. package/dist/VirtualShell/shellParser.d.ts +1 -8
  27. package/dist/VirtualShell/shellParser.d.ts.map +1 -1
  28. package/dist/VirtualShell/shellParser.js +2 -81
  29. package/dist/VirtualUserManager/index.d.ts +7 -1
  30. package/dist/VirtualUserManager/index.d.ts.map +1 -1
  31. package/dist/VirtualUserManager/index.js +47 -16
  32. package/dist/commands/adduser.d.ts +10 -4
  33. package/dist/commands/adduser.d.ts.map +1 -1
  34. package/dist/commands/adduser.js +75 -12
  35. package/dist/commands/alias.d.ts +5 -0
  36. package/dist/commands/alias.d.ts.map +1 -1
  37. package/dist/commands/alias.js +5 -0
  38. package/dist/commands/apt.d.ts +5 -0
  39. package/dist/commands/apt.d.ts.map +1 -1
  40. package/dist/commands/apt.js +5 -0
  41. package/dist/commands/awk.d.ts +10 -8
  42. package/dist/commands/awk.d.ts.map +1 -1
  43. package/dist/commands/awk.js +156 -28
  44. package/dist/commands/cd.d.ts.map +1 -1
  45. package/dist/commands/cd.js +0 -3
  46. package/dist/commands/clear.d.ts +5 -0
  47. package/dist/commands/clear.d.ts.map +1 -1
  48. package/dist/commands/clear.js +5 -0
  49. package/dist/commands/command-helpers.d.ts.map +1 -1
  50. package/dist/commands/command-helpers.js +8 -0
  51. package/dist/commands/declare.d.ts +5 -0
  52. package/dist/commands/declare.d.ts.map +1 -1
  53. package/dist/commands/declare.js +5 -0
  54. package/dist/commands/deluser.d.ts +12 -0
  55. package/dist/commands/deluser.d.ts.map +1 -1
  56. package/dist/commands/deluser.js +72 -6
  57. package/dist/commands/df.d.ts +5 -0
  58. package/dist/commands/df.d.ts.map +1 -1
  59. package/dist/commands/df.js +5 -0
  60. package/dist/commands/du.d.ts +5 -0
  61. package/dist/commands/du.d.ts.map +1 -1
  62. package/dist/commands/du.js +5 -0
  63. package/dist/commands/export.d.ts +5 -0
  64. package/dist/commands/export.d.ts.map +1 -1
  65. package/dist/commands/export.js +5 -0
  66. package/dist/commands/grep.d.ts.map +1 -1
  67. package/dist/commands/grep.js +22 -4
  68. package/dist/commands/groups.d.ts +5 -0
  69. package/dist/commands/groups.d.ts.map +1 -1
  70. package/dist/commands/groups.js +5 -0
  71. package/dist/commands/gzip.d.ts +5 -2
  72. package/dist/commands/gzip.d.ts.map +1 -1
  73. package/dist/commands/gzip.js +48 -28
  74. package/dist/commands/head.d.ts.map +1 -1
  75. package/dist/commands/head.js +12 -3
  76. package/dist/commands/htop.d.ts +5 -0
  77. package/dist/commands/htop.d.ts.map +1 -1
  78. package/dist/commands/htop.js +5 -0
  79. package/dist/commands/kill.d.ts +5 -0
  80. package/dist/commands/kill.d.ts.map +1 -1
  81. package/dist/commands/kill.js +5 -0
  82. package/dist/commands/ln.d.ts +2 -0
  83. package/dist/commands/ln.d.ts.map +1 -1
  84. package/dist/commands/ln.js +22 -0
  85. package/dist/commands/ls.d.ts.map +1 -1
  86. package/dist/commands/ls.js +15 -0
  87. package/dist/commands/lsb-release.d.ts +5 -0
  88. package/dist/commands/lsb-release.d.ts.map +1 -1
  89. package/dist/commands/lsb-release.js +5 -0
  90. package/dist/commands/mkdir.d.ts +5 -0
  91. package/dist/commands/mkdir.d.ts.map +1 -1
  92. package/dist/commands/mkdir.js +5 -0
  93. package/dist/commands/mv.d.ts +5 -0
  94. package/dist/commands/mv.d.ts.map +1 -1
  95. package/dist/commands/mv.js +5 -0
  96. package/dist/commands/nano.d.ts +5 -0
  97. package/dist/commands/nano.d.ts.map +1 -1
  98. package/dist/commands/nano.js +5 -0
  99. package/dist/commands/neofetch.d.ts +5 -0
  100. package/dist/commands/neofetch.d.ts.map +1 -1
  101. package/dist/commands/neofetch.js +8 -5
  102. package/dist/commands/passwd.d.ts +8 -0
  103. package/dist/commands/passwd.d.ts.map +1 -1
  104. package/dist/commands/passwd.js +32 -11
  105. package/dist/commands/ping.d.ts +5 -0
  106. package/dist/commands/ping.d.ts.map +1 -1
  107. package/dist/commands/ping.js +5 -0
  108. package/dist/commands/printf.d.ts +5 -0
  109. package/dist/commands/printf.d.ts.map +1 -1
  110. package/dist/commands/printf.js +43 -12
  111. package/dist/commands/ps.d.ts +5 -0
  112. package/dist/commands/ps.d.ts.map +1 -1
  113. package/dist/commands/ps.js +5 -0
  114. package/dist/commands/read.d.ts +5 -0
  115. package/dist/commands/read.d.ts.map +1 -1
  116. package/dist/commands/read.js +5 -0
  117. package/dist/commands/registry.d.ts.map +1 -1
  118. package/dist/commands/registry.js +4 -1
  119. package/dist/commands/rm.d.ts +5 -0
  120. package/dist/commands/rm.d.ts.map +1 -1
  121. package/dist/commands/rm.js +5 -0
  122. package/dist/commands/runtime.d.ts.map +1 -1
  123. package/dist/commands/runtime.js +1 -57
  124. package/dist/commands/sed.d.ts +5 -0
  125. package/dist/commands/sed.d.ts.map +1 -1
  126. package/dist/commands/sed.js +5 -0
  127. package/dist/commands/set.d.ts +5 -6
  128. package/dist/commands/set.d.ts.map +1 -1
  129. package/dist/commands/set.js +5 -22
  130. package/dist/commands/sh.d.ts +6 -0
  131. package/dist/commands/sh.d.ts.map +1 -1
  132. package/dist/commands/sh.js +6 -0
  133. package/dist/commands/shift.d.ts +10 -0
  134. package/dist/commands/shift.d.ts.map +1 -1
  135. package/dist/commands/shift.js +10 -0
  136. package/dist/commands/sleep.d.ts +5 -0
  137. package/dist/commands/sleep.d.ts.map +1 -1
  138. package/dist/commands/sleep.js +5 -0
  139. package/dist/commands/sort.d.ts +5 -0
  140. package/dist/commands/sort.d.ts.map +1 -1
  141. package/dist/commands/sort.js +5 -0
  142. package/dist/commands/source.d.ts +5 -0
  143. package/dist/commands/source.d.ts.map +1 -1
  144. package/dist/commands/source.js +5 -0
  145. package/dist/commands/stat.d.ts +7 -0
  146. package/dist/commands/stat.d.ts.map +1 -0
  147. package/dist/commands/stat.js +56 -0
  148. package/dist/commands/su.d.ts +13 -0
  149. package/dist/commands/su.d.ts.map +1 -1
  150. package/dist/commands/su.js +45 -14
  151. package/dist/commands/sudo.d.ts.map +1 -1
  152. package/dist/commands/sudo.js +5 -0
  153. package/dist/commands/tail.d.ts +5 -0
  154. package/dist/commands/tail.d.ts.map +1 -1
  155. package/dist/commands/tail.js +15 -3
  156. package/dist/commands/tar.d.ts +5 -0
  157. package/dist/commands/tar.d.ts.map +1 -1
  158. package/dist/commands/tar.js +40 -10
  159. package/dist/commands/tee.d.ts +5 -0
  160. package/dist/commands/tee.d.ts.map +1 -1
  161. package/dist/commands/tee.js +5 -0
  162. package/dist/commands/touch.d.ts +5 -0
  163. package/dist/commands/touch.d.ts.map +1 -1
  164. package/dist/commands/touch.js +5 -0
  165. package/dist/commands/tr.d.ts.map +1 -1
  166. package/dist/commands/tr.js +45 -10
  167. package/dist/commands/tree.d.ts +5 -0
  168. package/dist/commands/tree.d.ts.map +1 -1
  169. package/dist/commands/tree.js +5 -0
  170. package/dist/commands/true.d.ts +10 -0
  171. package/dist/commands/true.d.ts.map +1 -1
  172. package/dist/commands/true.js +10 -0
  173. package/dist/commands/type.d.ts +5 -0
  174. package/dist/commands/type.d.ts.map +1 -1
  175. package/dist/commands/type.js +5 -0
  176. package/dist/commands/uname.d.ts +5 -0
  177. package/dist/commands/uname.d.ts.map +1 -1
  178. package/dist/commands/uname.js +5 -0
  179. package/dist/commands/uniq.d.ts +5 -0
  180. package/dist/commands/uniq.d.ts.map +1 -1
  181. package/dist/commands/uniq.js +5 -0
  182. package/dist/commands/unset.d.ts +5 -0
  183. package/dist/commands/unset.d.ts.map +1 -1
  184. package/dist/commands/unset.js +5 -0
  185. package/dist/commands/uptime.d.ts +5 -0
  186. package/dist/commands/uptime.d.ts.map +1 -1
  187. package/dist/commands/uptime.js +5 -0
  188. package/dist/commands/wc.d.ts +5 -0
  189. package/dist/commands/wc.d.ts.map +1 -1
  190. package/dist/commands/wc.js +5 -0
  191. package/dist/commands/wget.d.ts +5 -0
  192. package/dist/commands/wget.d.ts.map +1 -1
  193. package/dist/commands/wget.js +5 -0
  194. package/dist/commands/who.d.ts +5 -0
  195. package/dist/commands/who.d.ts.map +1 -1
  196. package/dist/commands/who.js +5 -0
  197. package/dist/commands/whoami.d.ts +5 -0
  198. package/dist/commands/whoami.d.ts.map +1 -1
  199. package/dist/commands/whoami.js +5 -0
  200. package/dist/commands/xargs.d.ts +5 -0
  201. package/dist/commands/xargs.d.ts.map +1 -1
  202. package/dist/commands/xargs.js +5 -0
  203. package/dist/self-standalone.js +254 -30
  204. package/dist/types/commands.d.ts +36 -0
  205. package/dist/types/commands.d.ts.map +1 -1
  206. package/dist/utils/tokenize.d.ts +20 -0
  207. package/dist/utils/tokenize.d.ts.map +1 -0
  208. package/dist/utils/tokenize.js +74 -0
  209. package/examples/web.min.js +2 -2
  210. package/package.json +1 -1
  211. package/src/SSHClient/index.ts +6 -3
  212. package/src/SSHMimic/executor.ts +21 -44
  213. package/src/SSHMimic/index.ts +7 -5
  214. package/src/SSHMimic/sftp.ts +28 -21
  215. package/src/VirtualShell/shell.ts +34 -4
  216. package/src/VirtualShell/shellParser.ts +2 -103
  217. package/src/VirtualUserManager/index.ts +43 -19
  218. package/src/commands/adduser.ts +86 -13
  219. package/src/commands/alias.ts +5 -0
  220. package/src/commands/apt.ts +5 -0
  221. package/src/commands/awk.ts +154 -29
  222. package/src/commands/cd.ts +0 -4
  223. package/src/commands/clear.ts +5 -0
  224. package/src/commands/command-helpers.ts +9 -0
  225. package/src/commands/declare.ts +5 -0
  226. package/src/commands/deluser.ts +84 -7
  227. package/src/commands/df.ts +5 -0
  228. package/src/commands/du.ts +5 -0
  229. package/src/commands/export.ts +5 -0
  230. package/src/commands/grep.ts +21 -8
  231. package/src/commands/groups.ts +5 -0
  232. package/src/commands/gzip.ts +54 -28
  233. package/src/commands/head.ts +14 -4
  234. package/src/commands/htop.ts +5 -0
  235. package/src/commands/kill.ts +5 -0
  236. package/src/commands/ln.ts +22 -0
  237. package/src/commands/ls.ts +17 -0
  238. package/src/commands/lsb-release.ts +5 -0
  239. package/src/commands/mkdir.ts +5 -0
  240. package/src/commands/mv.ts +5 -0
  241. package/src/commands/nano.ts +5 -0
  242. package/src/commands/neofetch.ts +8 -6
  243. package/src/commands/passwd.ts +35 -12
  244. package/src/commands/ping.ts +5 -0
  245. package/src/commands/printf.ts +30 -13
  246. package/src/commands/ps.ts +5 -0
  247. package/src/commands/read.ts +5 -0
  248. package/src/commands/registry.ts +4 -1
  249. package/src/commands/rm.ts +5 -0
  250. package/src/commands/runtime.ts +1 -61
  251. package/src/commands/sed.ts +5 -0
  252. package/src/commands/set.ts +5 -24
  253. package/src/commands/sh.ts +9 -3
  254. package/src/commands/shift.ts +10 -0
  255. package/src/commands/sleep.ts +5 -0
  256. package/src/commands/sort.ts +5 -0
  257. package/src/commands/source.ts +5 -0
  258. package/src/commands/stat.ts +61 -0
  259. package/src/commands/su.ts +54 -16
  260. package/src/commands/sudo.ts +5 -0
  261. package/src/commands/tail.ts +17 -3
  262. package/src/commands/tar.ts +38 -15
  263. package/src/commands/tee.ts +5 -0
  264. package/src/commands/touch.ts +5 -0
  265. package/src/commands/tr.ts +54 -10
  266. package/src/commands/tree.ts +5 -0
  267. package/src/commands/true.ts +10 -0
  268. package/src/commands/type.ts +5 -0
  269. package/src/commands/uname.ts +5 -0
  270. package/src/commands/uniq.ts +5 -0
  271. package/src/commands/unset.ts +5 -0
  272. package/src/commands/uptime.ts +5 -0
  273. package/src/commands/wc.ts +5 -0
  274. package/src/commands/wget.ts +5 -0
  275. package/src/commands/who.ts +5 -0
  276. package/src/commands/whoami.ts +5 -0
  277. package/src/commands/xargs.ts +5 -0
  278. package/src/self-standalone.ts +316 -33
  279. package/src/types/commands.ts +37 -0
  280. package/src/utils/tokenize.ts +78 -0
  281. package/builds/web-iife.min.js +0 -13
  282. package/builds/web-iife.min.js.map +0 -7
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Set or display shell environment variables for child processes.
4
+ * @category shell
5
+ * @params ["[VAR=value]"]
6
+ */
2
7
  export declare const exportCommand: ShellModule;
3
8
  //# sourceMappingURL=export.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,aAAa,EAAE,WAwB3B,CAAC"}
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,WAwB3B,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Set or display shell environment variables for child processes.
3
+ * @category shell
4
+ * @params ["[VAR=value]"]
5
+ */
1
6
  export const exportCommand = {
2
7
  name: "export",
3
8
  description: "Set shell environment variable",
@@ -1 +1 @@
1
- {"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/commands/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA6FzB,CAAC"}
1
+ {"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/commands/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA0GzB,CAAC"}
@@ -12,12 +12,15 @@ export const grepCommand = {
12
12
  params: ["[-i] [-v] [-n] [-r] <pattern> [file...]"],
13
13
  run: ({ authUser, shell, cwd, args, stdin }) => {
14
14
  const { flags, positionals } = parseArgs(args, {
15
- flags: ["-i", "-v", "-n", "-r"],
15
+ flags: ["-i", "-v", "-n", "-r", "-c", "-l", "-L", "-q", "--quiet", "--silent"],
16
16
  });
17
17
  const caseInsensitive = flags.has("-i");
18
18
  const invertMatch = flags.has("-v");
19
19
  const showLineNumbers = flags.has("-n");
20
20
  const recursive = flags.has("-r");
21
+ const countOnly = flags.has("-c");
22
+ const filesWithMatches = flags.has("-l");
23
+ const quiet = flags.has("-q") || flags.has("--quiet") || flags.has("--silent");
21
24
  const pattern = positionals[0];
22
25
  const files = positionals.slice(1);
23
26
  if (!pattern) {
@@ -72,7 +75,12 @@ export const grepCommand = {
72
75
  if (files.length === 0) {
73
76
  if (!stdin)
74
77
  return { stdout: "", exitCode: 1 };
75
- results.push(...matchLines(stdin));
78
+ const matched = matchLines(stdin);
79
+ if (countOnly)
80
+ return { stdout: `${matched.length}\n`, exitCode: matched.length > 0 ? 0 : 1 };
81
+ if (quiet)
82
+ return { exitCode: matched.length > 0 ? 0 : 1 };
83
+ results.push(...matched);
76
84
  }
77
85
  else {
78
86
  const resolvedPaths = files.flatMap((f) => {
@@ -84,7 +92,17 @@ export const grepCommand = {
84
92
  assertPathAccess(authUser, filePath, "grep");
85
93
  const content = shell.vfs.readFile(filePath);
86
94
  const prefix = resolvedPaths.length > 1 ? `${file}:` : "";
87
- results.push(...matchLines(content, prefix));
95
+ const matched = matchLines(content, prefix);
96
+ if (countOnly) {
97
+ results.push(resolvedPaths.length > 1 ? `${file}:${matched.length}` : String(matched.length));
98
+ }
99
+ else if (filesWithMatches) {
100
+ if (matched.length > 0)
101
+ results.push(file);
102
+ }
103
+ else {
104
+ results.push(...matched);
105
+ }
88
106
  }
89
107
  catch {
90
108
  return {
@@ -95,7 +113,7 @@ export const grepCommand = {
95
113
  }
96
114
  }
97
115
  return {
98
- stdout: results.length > 0 ? results.join("\n") : "",
116
+ stdout: results.length > 0 ? `${results.join("\n")}\n` : "",
99
117
  exitCode: results.length > 0 ? 0 : 1,
100
118
  };
101
119
  },
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Print group memberships for a user.
4
+ * @category system
5
+ * @params ["[user]"]
6
+ */
2
7
  export declare const groupsCommand: ShellModule;
3
8
  //# sourceMappingURL=groups.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/commands/groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,aAAa,EAAE,WAW3B,CAAC"}
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/commands/groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,WAW3B,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Print group memberships for a user.
3
+ * @category system
4
+ * @params ["[user]"]
5
+ */
1
6
  export const groupsCommand = {
2
7
  name: "groups",
3
8
  description: "Print group memberships",
@@ -1,9 +1,12 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
  /**
3
- * Compress files using gzip (stores in VFS as compressed content).
3
+ * Compress files using gzip renames file to `<file>.gz`, removes original.
4
4
  * @category archive
5
- * @params ["<file>"]
6
5
  */
7
6
  export declare const gzipCommand: ShellModule;
7
+ /**
8
+ * Decompress gzip files — renames `<file>.gz` to `<file>`, removes original.
9
+ * @category archive
10
+ */
8
11
  export declare const gunzipCommand: ShellModule;
9
12
  //# sourceMappingURL=gzip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/commands/gzip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAmBzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAyB3B,CAAC"}
1
+ {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/commands/gzip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,WAyCzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,WA0B3B,CAAC"}
@@ -1,56 +1,76 @@
1
1
  import { resolvePath } from "./helpers";
2
2
  /**
3
- * Compress files using gzip (stores in VFS as compressed content).
3
+ * Compress files using gzip renames file to `<file>.gz`, removes original.
4
4
  * @category archive
5
- * @params ["<file>"]
6
5
  */
7
6
  export const gzipCommand = {
8
7
  name: "gzip",
9
8
  description: "Compress files",
10
9
  category: "archive",
11
- params: ["<file>"],
10
+ params: ["[-k] [-d] <file>"],
12
11
  run: ({ shell, cwd, args }) => {
13
- const file = args[0];
12
+ const keepOrig = args.includes("-k") || args.includes("--keep");
13
+ const decompress = args.includes("-d");
14
+ const file = args.find((a) => !a.startsWith("-"));
14
15
  if (!file)
15
- return { stderr: "gzip: no file specified", exitCode: 1 };
16
+ return { stderr: "gzip: no file specified\n", exitCode: 1 };
16
17
  const p = resolvePath(cwd, file);
17
- try {
18
- shell.vfs.compressFile(p);
18
+ if (decompress) {
19
+ // gzip -d = gunzip
20
+ if (!file.endsWith(".gz")) {
21
+ return { stderr: `gzip: ${file}: unknown suffix -- ignored\n`, exitCode: 1 };
22
+ }
23
+ if (!shell.vfs.exists(p)) {
24
+ return { stderr: `gzip: ${file}: No such file or directory\n`, exitCode: 1 };
25
+ }
26
+ const content = shell.vfs.readFile(p);
27
+ const dest = p.slice(0, -3);
28
+ shell.vfs.writeFile(dest, content);
29
+ if (!keepOrig)
30
+ shell.vfs.remove(p);
19
31
  return { exitCode: 0 };
20
32
  }
21
- catch {
22
- return {
23
- stderr: `gzip: ${file}: No such file or directory`,
24
- exitCode: 1,
25
- };
33
+ if (!shell.vfs.exists(p)) {
34
+ return { stderr: `gzip: ${file}: No such file or directory\n`, exitCode: 1 };
26
35
  }
36
+ if (file.endsWith(".gz")) {
37
+ return { stderr: `gzip: ${file}: already has .gz suffix -- unchanged\n`, exitCode: 1 };
38
+ }
39
+ const rawContent = shell.vfs.readFileRaw(p);
40
+ const gzPath = `${p}.gz`;
41
+ shell.vfs.writeFile(gzPath, rawContent, { compress: true });
42
+ if (!keepOrig)
43
+ shell.vfs.remove(p);
44
+ return { exitCode: 0 };
27
45
  },
28
46
  };
47
+ /**
48
+ * Decompress gzip files — renames `<file>.gz` to `<file>`, removes original.
49
+ * @category archive
50
+ */
29
51
  export const gunzipCommand = {
30
- /**
31
- * Decompress gzip files (or zcat alias).
32
- * @category archive
33
- * @params ["<file>"]
34
- */
35
52
  name: "gunzip",
36
53
  description: "Decompress files",
37
54
  category: "archive",
38
- params: ["<file>"],
39
55
  aliases: ["zcat"],
56
+ params: ["[-k] <file>"],
40
57
  run: ({ shell, cwd, args }) => {
41
- const file = args[0];
58
+ const keepOrig = args.includes("-k") || args.includes("--keep");
59
+ const file = args.find((a) => !a.startsWith("-"));
42
60
  if (!file)
43
- return { stderr: "gunzip: no file specified", exitCode: 1 };
61
+ return { stderr: "gunzip: no file specified\n", exitCode: 1 };
44
62
  const p = resolvePath(cwd, file);
45
- try {
46
- shell.vfs.decompressFile(p);
47
- return { exitCode: 0 };
63
+ if (!shell.vfs.exists(p)) {
64
+ return { stderr: `gunzip: ${file}: No such file or directory\n`, exitCode: 1 };
48
65
  }
49
- catch {
50
- return {
51
- stderr: `gunzip: ${file}: No such file or directory`,
52
- exitCode: 1,
53
- };
66
+ if (!file.endsWith(".gz")) {
67
+ return { stderr: `gunzip: ${file}: unknown suffix -- ignored\n`, exitCode: 1 };
54
68
  }
69
+ const content = shell.vfs.readFile(p);
70
+ const dest = p.slice(0, -3);
71
+ shell.vfs.writeFile(dest, content);
72
+ if (!keepOrig)
73
+ shell.vfs.remove(p);
74
+ return { exitCode: 0 };
55
75
  },
56
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../src/commands/head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAgCzB,CAAC"}
1
+ {"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../src/commands/head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WA0CzB,CAAC"}
@@ -12,9 +12,18 @@ export const headCommand = {
12
12
  params: ["[-n <lines>] [file...]"],
13
13
  run: ({ authUser, shell, cwd, args, stdin }) => {
14
14
  const nArg = getFlag(args, ["-n"]);
15
- const n = typeof nArg === "string" ? parseInt(nArg, 10) : 10;
16
- const positionals = args.filter((a) => !a.startsWith("-") && a !== nArg);
17
- const take = (content) => content.split("\n").slice(0, n).join("\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
+ };
18
27
  if (positionals.length === 0) {
19
28
  return { stdout: take(stdin ?? ""), exitCode: 0 };
20
29
  }
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Interactive system monitor (requires terminal interaction).
4
+ * @category system
5
+ * @params []
6
+ */
2
7
  export declare const htopCommand: ShellModule;
3
8
  //# sourceMappingURL=htop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"htop.d.ts","sourceRoot":"","sources":["../../src/commands/htop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,WAYzB,CAAC"}
1
+ {"version":3,"file":"htop.d.ts","sourceRoot":"","sources":["../../src/commands/htop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAYzB,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Interactive system monitor (requires terminal interaction).
3
+ * @category system
4
+ * @params []
5
+ */
1
6
  export const htopCommand = {
2
7
  name: "htop",
3
8
  description: "System monitor",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Send a signal to a process by PID.
4
+ * @category system
5
+ * @params ["[-9] <pid>"]
6
+ */
2
7
  export declare const killCommand: ShellModule;
3
8
  //# sourceMappingURL=kill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kill.d.ts","sourceRoot":"","sources":["../../src/commands/kill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,WAAW,EAAE,WAWzB,CAAC"}
1
+ {"version":3,"file":"kill.d.ts","sourceRoot":"","sources":["../../src/commands/kill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,WAWzB,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Send a signal to a process by PID.
3
+ * @category system
4
+ * @params ["[-9] <pid>"]
5
+ */
1
6
  export const killCommand = {
2
7
  name: "kill",
3
8
  description: "Send signal to process",
@@ -1,3 +1,5 @@
1
1
  import type { ShellModule } from "../types/commands";
2
2
  export declare const lnCommand: ShellModule;
3
+ /** Shell command: print the value of a symbolic link. */
4
+ export declare const readlinkCommand: ShellModule;
3
5
  //# sourceMappingURL=ln.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ln.d.ts","sourceRoot":"","sources":["../../src/commands/ln.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,SAAS,EAAE,WA4CvB,CAAC"}
1
+ {"version":3,"file":"ln.d.ts","sourceRoot":"","sources":["../../src/commands/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"}
@@ -42,3 +42,25 @@ export const lnCommand = {
42
42
  }
43
43
  },
44
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
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../src/commands/ls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA4BrD,eAAO,MAAM,SAAS,EAAE,WA4BvB,CAAC"}
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../src/commands/ls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA4BrD,eAAO,MAAM,SAAS,EAAE,WA6CvB,CAAC"}
@@ -34,6 +34,21 @@ export const lsCommand = {
34
34
  });
35
35
  const target = resolvePath(cwd, targetArg ?? cwd);
36
36
  assertPathAccess(authUser, target, "ls");
37
+ // If target is a file, show its info directly (ls -l /etc/passwd)
38
+ if (shell.vfs.exists(target)) {
39
+ const st = shell.vfs.stat(target);
40
+ if (st.type === "file" || shell.vfs.isSymlink(target)) {
41
+ if (longFormat) {
42
+ const name = target.split("/").pop() ?? target;
43
+ const size = st.type === "file" ? st.size : 0;
44
+ return {
45
+ stdout: `${formatPermissions(st.mode, false)} 1 root root ${size} ${formatDate(st.updatedAt)} ${name}\n`,
46
+ exitCode: 0,
47
+ };
48
+ }
49
+ return { stdout: target.split("/").pop() ?? target, exitCode: 0 };
50
+ }
51
+ }
37
52
  const items = shell.vfs
38
53
  .list(target)
39
54
  .filter((name) => showHidden || !name.startsWith("."));
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Print Linux distribution information.
4
+ * @category system
5
+ * @params ["[-a] [-i] [-d] [-r] [-c]"]
6
+ */
2
7
  export declare const lsbReleaseCommand: ShellModule;
3
8
  //# sourceMappingURL=lsb-release.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lsb-release.d.ts","sourceRoot":"","sources":["../../src/commands/lsb-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,iBAAiB,EAAE,WAsD/B,CAAC"}
1
+ {"version":3,"file":"lsb-release.d.ts","sourceRoot":"","sources":["../../src/commands/lsb-release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAsD/B,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { ifFlag } from "./command-helpers";
2
+ /**
3
+ * Print Linux distribution information.
4
+ * @category system
5
+ * @params ["[-a] [-i] [-d] [-r] [-c]"]
6
+ */
2
7
  export const lsbReleaseCommand = {
3
8
  name: "lsb_release",
4
9
  description: "Print distribution-specific information",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Create one or more directories.
4
+ * @category files
5
+ * @params ["<dir>"]
6
+ */
2
7
  export declare const mkdirCommand: ShellModule;
3
8
  //# sourceMappingURL=mkdir.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mkdir.d.ts","sourceRoot":"","sources":["../../src/commands/mkdir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,YAAY,EAAE,WAqB1B,CAAC"}
1
+ {"version":3,"file":"mkdir.d.ts","sourceRoot":"","sources":["../../src/commands/mkdir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAqB1B,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import { getArg } from "./command-helpers";
2
2
  import { assertPathAccess, resolvePath } from "./helpers";
3
+ /**
4
+ * Create one or more directories.
5
+ * @category files
6
+ * @params ["<dir>"]
7
+ */
3
8
  export const mkdirCommand = {
4
9
  name: "mkdir",
5
10
  description: "Make directories",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Move or rename files and directories.
4
+ * @category files
5
+ * @params ["<source> <dest>"]
6
+ */
2
7
  export declare const mvCommand: ShellModule;
3
8
  //# sourceMappingURL=mv.d.ts.map
@@ -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"}
@@ -1,4 +1,9 @@
1
1
  import { assertPathAccess, resolvePath } from "./helpers";
2
+ /**
3
+ * Move or rename files and directories.
4
+ * @category files
5
+ * @params ["<source> <dest>"]
6
+ */
2
7
  export const mvCommand = {
3
8
  name: "mv",
4
9
  description: "Move or rename files",
@@ -1,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Simple text editor for editing files.
4
+ * @category files
5
+ * @params ["<file>"]
6
+ */
2
7
  export declare const nanoCommand: ShellModule;
3
8
  //# sourceMappingURL=nano.d.ts.map
@@ -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"}
@@ -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,3 +1,8 @@
1
1
  import type { ShellModule } from "../types/commands";
2
+ /**
3
+ * Display system information in a decorative format.
4
+ * @category system
5
+ * @params ["[--off]"]
6
+ */
2
7
  export declare const neofetchCommand: ShellModule;
3
8
  //# sourceMappingURL=neofetch.d.ts.map
@@ -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;AAIrD,eAAO,MAAM,eAAe,EAAE,WAsC7B,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,WAoC7B,CAAC"}
@@ -1,13 +1,16 @@
1
1
  import { buildNeofetchOutput } from "../modules/neofetch";
2
2
  import { ifFlag } from "./command-helpers";
3
- import { getAllEnvVars } from "./set";
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
- const env = getAllEnvVars(authUser);
13
+ run: ({ args, authUser, hostname, shell, env }) => {
11
14
  if (ifFlag(args, "--help")) {
12
15
  return {
13
16
  stdout: "Usage: neofetch [--off]",
@@ -24,9 +27,9 @@ export const neofetchCommand = {
24
27
  stdout: buildNeofetchOutput({
25
28
  user: authUser,
26
29
  host: hostname,
27
- shell: env.SHELL,
30
+ shell: env.vars.SHELL,
28
31
  shellProps: shell.properties,
29
- terminal: env.TERM,
32
+ terminal: env.vars.TERM,
30
33
  uptimeSeconds: Math.floor((Date.now() - shell.startTime) / 1000),
31
34
  packages: (() => {
32
35
  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,WAwB3B,CAAC"}
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"}
@@ -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: ["<username> <password>"],
6
- run: async ({ authUser, args, shell }) => {
7
- const [username, password] = args;
8
- if (!username || !password) {
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
- stderr: "passwd: usage: passwd <username> <password>",
11
- exitCode: 1,
29
+ stdout: `passwd: password updated successfully\n`,
30
+ exitCode: 0,
12
31
  };
13
32
  }
14
- if (authUser !== "root" && authUser !== username) {
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
- stdout: `passwd: password updated for '${username}'`,
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
  },
@@ -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"}