@lifo-sh/core 0.4.6 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/{awk-BFrGImnt.js → awk-Bhywv7pU.js} +1 -1
- package/dist/base64-ncdb27yL.js +72 -0
- package/dist/{basename-MGz8cBxd.js → basename-D-_r1VN_.js} +1 -1
- package/dist/browser-Bymgnrli.js +35 -0
- package/dist/{cat-BnEyWWFr.js → cat-DSe6FHma.js} +1 -1
- package/dist/{chmod-CdrI3hZV.js → chmod-BZIlNR2-.js} +1 -1
- package/dist/{chown-7yY3iC6J.js → chown-BAOEOuMn.js} +1 -1
- package/dist/commands/net/curl.d.ts +2 -2
- package/dist/commands/net/curl.d.ts.map +1 -1
- package/dist/commands/net/forward.d.ts +14 -0
- package/dist/commands/net/forward.d.ts.map +1 -0
- package/dist/commands/net/host.d.ts +14 -0
- package/dist/commands/net/host.d.ts.map +1 -0
- package/dist/commands/net/ifconfig.d.ts +8 -0
- package/dist/commands/net/ifconfig.d.ts.map +1 -0
- package/dist/commands/net/ip.d.ts +14 -0
- package/dist/commands/net/ip.d.ts.map +1 -0
- package/dist/commands/net/netstat.d.ts +8 -0
- package/dist/commands/net/netstat.d.ts.map +1 -0
- package/dist/commands/net/ports.d.ts +8 -0
- package/dist/commands/net/ports.d.ts.map +1 -0
- package/dist/commands/net/route.d.ts +8 -0
- package/dist/commands/net/route.d.ts.map +1 -0
- package/dist/commands/net/test-registry.d.ts +8 -0
- package/dist/commands/net/test-registry.d.ts.map +1 -0
- package/dist/commands/net/tunnel-v2.d.ts +4 -0
- package/dist/commands/net/tunnel-v2.d.ts.map +1 -0
- package/dist/commands/net/tunnel.d.ts +6 -0
- package/dist/commands/net/tunnel.d.ts.map +1 -0
- package/dist/commands/registry.d.ts +1 -0
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/system/fastfetch.d.ts +4 -0
- package/dist/commands/system/fastfetch.d.ts.map +1 -0
- package/dist/commands/system/kill.d.ts +2 -2
- package/dist/commands/system/kill.d.ts.map +1 -1
- package/dist/commands/system/lifo.d.ts +17 -0
- package/dist/commands/system/lifo.d.ts.map +1 -1
- package/dist/commands/system/logout.d.ts +5 -0
- package/dist/commands/system/logout.d.ts.map +1 -0
- package/dist/commands/system/man.d.ts.map +1 -1
- package/dist/commands/system/newtab.d.ts +8 -0
- package/dist/commands/system/newtab.d.ts.map +1 -0
- package/dist/commands/system/node.d.ts +2 -2
- package/dist/commands/system/node.d.ts.map +1 -1
- package/dist/commands/system/npm.d.ts +20 -7
- package/dist/commands/system/npm.d.ts.map +1 -1
- package/dist/commands/system/ps.d.ts +3 -2
- package/dist/commands/system/ps.d.ts.map +1 -1
- package/dist/commands/system/sha256sum.d.ts +4 -0
- package/dist/commands/system/sha256sum.d.ts.map +1 -0
- package/dist/commands/system/sl.d.ts +4 -0
- package/dist/commands/system/sl.d.ts.map +1 -0
- package/dist/commands/system/systemctl.d.ts +4 -0
- package/dist/commands/system/systemctl.d.ts.map +1 -0
- package/dist/commands/system/top.d.ts +2 -2
- package/dist/commands/system/top.d.ts.map +1 -1
- package/dist/commands/system/whoami.d.ts.map +1 -1
- package/dist/commands/text/base64.d.ts +4 -0
- package/dist/commands/text/base64.d.ts.map +1 -0
- package/dist/commands/text/less.d.ts +4 -0
- package/dist/commands/text/less.d.ts.map +1 -0
- package/dist/commands/text/nano.d.ts +4 -0
- package/dist/commands/text/nano.d.ts.map +1 -0
- package/dist/commands/text/seq.d.ts +4 -0
- package/dist/commands/text/seq.d.ts.map +1 -0
- package/dist/commands/text/strings.d.ts +4 -0
- package/dist/commands/text/strings.d.ts.map +1 -0
- package/dist/commands/text/tac.d.ts +4 -0
- package/dist/commands/text/tac.d.ts.map +1 -0
- package/dist/commands/types.d.ts +1 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/{cp-7dOXCu3Q.js → cp-DOXzF2_m.js} +1 -1
- package/dist/{cut-vn4vxL9L.js → cut-B4rQvMRc.js} +1 -1
- package/dist/{diff-DnKPewP-.js → diff-BndHU0Ne.js} +1 -1
- package/dist/{dirname-B3ciBZhS.js → dirname-wtPE8QZ6.js} +1 -1
- package/dist/{du-i2qiYYnL.js → du-BLkl3BkN.js} +1 -1
- package/dist/fastfetch-aPM9Z3ym.js +310 -0
- package/dist/{file-Dd6iLk05.js → file-DfmI5Gyk.js} +1 -1
- package/dist/{find-Cz4GdaPT.js → find-Wdkys9OU.js} +1 -1
- package/dist/{grep-DYSAPbxr.js → grep-xmx3I05f.js} +1 -1
- package/dist/{gunzip-BHAbNGHO.js → gunzip-Dbr2fm5t.js} +1 -1
- package/dist/{gzip-JLrrHn6u.js → gzip-D1GwSnNe.js} +1 -1
- package/dist/{head-bFamSv7p.js → head-DUXuKw3m.js} +1 -1
- package/dist/index-Djm2onjx.js +13915 -0
- package/dist/index.d.ts +28 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +90 -65
- package/dist/kernel/ServiceManager.d.ts +51 -0
- package/dist/kernel/ServiceManager.d.ts.map +1 -0
- package/dist/kernel/index.d.ts +11 -0
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/network/Bridge.d.ts +110 -0
- package/dist/kernel/network/Bridge.d.ts.map +1 -0
- package/dist/kernel/network/DNSResolver.d.ts +55 -0
- package/dist/kernel/network/DNSResolver.d.ts.map +1 -0
- package/dist/kernel/network/NetworkInterface.d.ts +83 -0
- package/dist/kernel/network/NetworkInterface.d.ts.map +1 -0
- package/dist/kernel/network/NetworkNamespace.d.ts +98 -0
- package/dist/kernel/network/NetworkNamespace.d.ts.map +1 -0
- package/dist/kernel/network/NetworkStack.d.ts +178 -0
- package/dist/kernel/network/NetworkStack.d.ts.map +1 -0
- package/dist/kernel/network/NetworkStack.example.d.ts +8 -0
- package/dist/kernel/network/NetworkStack.example.d.ts.map +1 -0
- package/dist/kernel/network/NetworkStack.test.d.ts +2 -0
- package/dist/kernel/network/NetworkStack.test.d.ts.map +1 -0
- package/dist/kernel/network/PortBridge.d.ts +49 -0
- package/dist/kernel/network/PortBridge.d.ts.map +1 -0
- package/dist/kernel/network/RoutingTable.d.ts +55 -0
- package/dist/kernel/network/RoutingTable.d.ts.map +1 -0
- package/dist/kernel/network/Socket.d.ts +65 -0
- package/dist/kernel/network/Socket.d.ts.map +1 -0
- package/dist/kernel/network/index.d.ts +11 -0
- package/dist/kernel/network/index.d.ts.map +1 -0
- package/dist/kernel/network/tunnel/BaseTunnel.d.ts +55 -0
- package/dist/kernel/network/tunnel/BaseTunnel.d.ts.map +1 -0
- package/dist/kernel/network/tunnel/VETHPair.d.ts +71 -0
- package/dist/kernel/network/tunnel/VETHPair.d.ts.map +1 -0
- package/dist/kernel/network/tunnel/WebSocketTunnel.d.ts +89 -0
- package/dist/kernel/network/tunnel/WebSocketTunnel.d.ts.map +1 -0
- package/dist/kernel/network/types.d.ts +159 -0
- package/dist/kernel/network/types.d.ts.map +1 -0
- package/dist/kernel/storage/ContentStore.d.ts +3 -1
- package/dist/kernel/storage/ContentStore.d.ts.map +1 -1
- package/dist/kernel/unit-parser.d.ts +22 -0
- package/dist/kernel/unit-parser.d.ts.map +1 -0
- package/dist/less-VW-Lb-t9.js +230 -0
- package/dist/{ls-BSsn2qVd.js → ls-DjuSFYCA.js} +1 -1
- package/dist/{man-CJ5pI0_W.js → man-Dg26tZ-a.js} +19 -6
- package/dist/{mkdir-CF_ugDtu.js → mkdir-qMgrbMfK.js} +1 -1
- package/dist/{mktemp-CaEiJi87.js → mktemp-BNrdUgqA.js} +1 -1
- package/dist/{mv-BSS_QQM-.js → mv-DxovuvmA.js} +1 -1
- package/dist/nano-CVa6vpFX.js +304 -0
- package/dist/{nl-D30ka89P.js → nl-E4qmf3dZ.js} +1 -1
- package/dist/node-compat/crypto.d.ts +8 -1
- package/dist/node-compat/crypto.d.ts.map +1 -1
- package/dist/node-compat/dns.d.ts +117 -0
- package/dist/node-compat/dns.d.ts.map +1 -0
- package/dist/node-compat/esbuild.d.ts +10 -0
- package/dist/node-compat/esbuild.d.ts.map +1 -0
- package/dist/node-compat/fs.d.ts +25 -5
- package/dist/node-compat/fs.d.ts.map +1 -1
- package/dist/node-compat/http.d.ts +54 -9
- package/dist/node-compat/http.d.ts.map +1 -1
- package/dist/node-compat/index.d.ts.map +1 -1
- package/dist/node-compat/module.d.ts +55 -0
- package/dist/node-compat/module.d.ts.map +1 -0
- package/dist/node-compat/path.d.ts +28 -0
- package/dist/node-compat/path.d.ts.map +1 -1
- package/dist/node-compat/process.d.ts +67 -2
- package/dist/node-compat/process.d.ts.map +1 -1
- package/dist/node-compat/readline.d.ts +79 -0
- package/dist/node-compat/readline.d.ts.map +1 -0
- package/dist/node-compat/rimraf.d.ts +23 -0
- package/dist/node-compat/rimraf.d.ts.map +1 -0
- package/dist/node-compat/tty.d.ts +32 -0
- package/dist/node-compat/tty.d.ts.map +1 -0
- package/dist/node-compat/url.d.ts +4 -0
- package/dist/node-compat/url.d.ts.map +1 -1
- package/dist/node-compat/util.d.ts +21 -1
- package/dist/node-compat/util.d.ts.map +1 -1
- package/dist/{realpath-BWqrTa-J.js → realpath-BaYc6QSr.js} +1 -1
- package/dist/{rev-Cfja5xbl.js → rev-CtqOEUEH.js} +1 -1
- package/dist/{rm-DUR35EZn.js → rm-DtLSFhWn.js} +1 -1
- package/dist/{rmdir-DXjx17-Z.js → rmdir-k65U0Fef.js} +1 -1
- package/dist/sandbox/Sandbox.d.ts.map +1 -1
- package/dist/sandbox/types.d.ts +2 -2
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/{sed-YKJ5wcuu.js → sed-BpypU_CO.js} +1 -1
- package/dist/seq-B01YKIbO.js +37 -0
- package/dist/sha256sum-x-mlDY9n.js +64 -0
- package/dist/shell/ProcessRegistry.d.ts +144 -0
- package/dist/shell/ProcessRegistry.d.ts.map +1 -0
- package/dist/shell/ProcessRegistry.example.d.ts +8 -0
- package/dist/shell/ProcessRegistry.example.d.ts.map +1 -0
- package/dist/shell/ProcessRegistry.test.d.ts +2 -0
- package/dist/shell/ProcessRegistry.test.d.ts.map +1 -0
- package/dist/shell/Shell.d.ts +10 -2
- package/dist/shell/Shell.d.ts.map +1 -1
- package/dist/shell/interpreter.d.ts +4 -0
- package/dist/shell/interpreter.d.ts.map +1 -1
- package/dist/shell/terminal-stdin.d.ts +4 -0
- package/dist/shell/terminal-stdin.d.ts.map +1 -1
- package/dist/sl-Dv4iPBN6.js +138 -0
- package/dist/{sort-C2sQ841N.js → sort-C1n7kWmJ.js} +1 -1
- package/dist/{stat-gLLpq3JZ.js → stat-Co_5pgto.js} +1 -1
- package/dist/strings-tFgYFAvp.js +42 -0
- package/dist/tac-BQvVvnoM.js +31 -0
- package/dist/{tail-FnC8M40k.js → tail-CLWVwfZD.js} +1 -1
- package/dist/{tar-tfiT1iFt.js → tar-wo7UUSK5.js} +1 -1
- package/dist/{tee-CoymtuKa.js → tee-DlyeS1Yd.js} +1 -1
- package/dist/{touch-C4pyouV6.js → touch-DVzPgqSy.js} +1 -1
- package/dist/{tree-DfPczgli.js → tree-DHBQhXD7.js} +1 -1
- package/dist/{uniq-Dhsoj7Lk.js → uniq-CmmP6k_t.js} +1 -1
- package/dist/{unzip-CqIKZ8NK.js → unzip-BIOvH2jT.js} +1 -1
- package/dist/{wc-DBPO6xRf.js → wc-DfI1Q3lo.js} +1 -1
- package/dist/{wget-CYImxeOz.js → wget-Dd25MxcO.js} +1 -1
- package/dist/whoami-C_q-p-Vo.js +25 -0
- package/dist/{zip-TPdwPkrA.js → zip-Cc3IoNSB.js} +1 -1
- package/package.json +6 -3
- package/dist/index-BVIfyOAv.js +0 -8578
- package/dist/whoami-B1237V5e.js +0 -8
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Packet } from '../types.js';
|
|
2
|
+
import { NetworkStack } from '../NetworkStack.js';
|
|
3
|
+
import { BaseTunnel } from './BaseTunnel.js';
|
|
4
|
+
/**
|
|
5
|
+
* WebSocket Tunnel - Bridge virtual network to external WebSocket server
|
|
6
|
+
*
|
|
7
|
+
* This tunnel connects Lifo's virtual network stack to an external WebSocket
|
|
8
|
+
* tunnel server, enabling host machine access to virtual servers.
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
* tunnel --server=ws://localhost:3005
|
|
12
|
+
*
|
|
13
|
+
* Access from host:
|
|
14
|
+
* http://localhost:3005/3000/ → Port 3000 in virtual network
|
|
15
|
+
*/
|
|
16
|
+
export declare class WebSocketTunnel extends BaseTunnel {
|
|
17
|
+
type: 'ssh';
|
|
18
|
+
private wsUrl;
|
|
19
|
+
private ws;
|
|
20
|
+
private portRegistry?;
|
|
21
|
+
private defaultPort;
|
|
22
|
+
private reconnectTimer?;
|
|
23
|
+
private isReconnecting;
|
|
24
|
+
private packetQueue;
|
|
25
|
+
private waitingResolvers;
|
|
26
|
+
constructor(id: string, wsUrl: string, networkStack: NetworkStack, portRegistry?: Map<number, any>, namespace?: string, defaultPort?: number | null);
|
|
27
|
+
protected getTunnelPrefix(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Bring tunnel up - connect to WebSocket server
|
|
30
|
+
*/
|
|
31
|
+
up(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Bring tunnel down - disconnect from WebSocket server
|
|
34
|
+
*/
|
|
35
|
+
down(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Send packet through WebSocket tunnel
|
|
38
|
+
*/
|
|
39
|
+
send(packet: Packet): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Receive packet from WebSocket tunnel
|
|
42
|
+
*/
|
|
43
|
+
recv(): Promise<Packet>;
|
|
44
|
+
/**
|
|
45
|
+
* Connect to WebSocket server
|
|
46
|
+
*/
|
|
47
|
+
private connect;
|
|
48
|
+
/**
|
|
49
|
+
* Schedule reconnection attempt
|
|
50
|
+
*/
|
|
51
|
+
private scheduleReconnect;
|
|
52
|
+
/**
|
|
53
|
+
* Handle incoming WebSocket message
|
|
54
|
+
*/
|
|
55
|
+
private handleMessage;
|
|
56
|
+
/**
|
|
57
|
+
* Handle HTTP request from tunnel server
|
|
58
|
+
*/
|
|
59
|
+
private handleHttpRequest;
|
|
60
|
+
/**
|
|
61
|
+
* Handle HTTP response (for client-side requests)
|
|
62
|
+
*/
|
|
63
|
+
private handleHttpResponse;
|
|
64
|
+
/**
|
|
65
|
+
* Send HTTP response through WebSocket
|
|
66
|
+
*/
|
|
67
|
+
private sendResponse;
|
|
68
|
+
/**
|
|
69
|
+
* Send error response through WebSocket
|
|
70
|
+
*/
|
|
71
|
+
private sendError;
|
|
72
|
+
/**
|
|
73
|
+
* Serialize packet to bytes
|
|
74
|
+
*/
|
|
75
|
+
private serializePacket;
|
|
76
|
+
/**
|
|
77
|
+
* Get tunnel status string
|
|
78
|
+
*/
|
|
79
|
+
toString(): string;
|
|
80
|
+
/**
|
|
81
|
+
* Get connection status
|
|
82
|
+
*/
|
|
83
|
+
isConnected(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Get active ports
|
|
86
|
+
*/
|
|
87
|
+
getActivePorts(): number[];
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=WebSocketTunnel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebSocketTunnel.d.ts","sourceRoot":"","sources":["../../../../src/kernel/network/tunnel/WebSocketTunnel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;;;;;;;;;GAWG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC9C,IAAI,EAAE,KAAK,CAAS;IAEpB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,YAAY,CAAC,CAAmB;IACxC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAM;IAC7B,OAAO,CAAC,cAAc,CAAS;IAG/B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,gBAAgB,CAAuC;gBAG9D,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,EAC1B,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,SAAS,SAAY,EACrB,WAAW,GAAE,MAAM,GAAG,IAAW;IAgBlC,SAAS,CAAC,eAAe,IAAI,MAAM;IAInC;;OAEG;IACY,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAUlC;;OAEG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBpC;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBzC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAc7B;;OAEG;YACW,OAAO;IA4CrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;OAEG;IACH,OAAO,CAAC,aAAa;IAgBrB;;OAEG;YACW,iBAAiB;IA2E/B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,OAAO,CAAC,SAAS;IAgBjB;;OAEG;IACH,OAAO,CAAC,eAAe;IAgBvB;;OAEG;IACM,QAAQ,IAAI,MAAM;IAQ3B;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;CAG1B"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network layer types and interfaces
|
|
3
|
+
* Implements a virtual network stack similar to Linux
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* IP address (v4 or v6)
|
|
7
|
+
*/
|
|
8
|
+
export interface IPAddress {
|
|
9
|
+
version: 4 | 6;
|
|
10
|
+
address: string;
|
|
11
|
+
subnet?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Network interface state
|
|
15
|
+
*/
|
|
16
|
+
export type InterfaceState = 'up' | 'down';
|
|
17
|
+
/**
|
|
18
|
+
* Network interface statistics
|
|
19
|
+
*/
|
|
20
|
+
export interface InterfaceStats {
|
|
21
|
+
rxPackets: number;
|
|
22
|
+
txPackets: number;
|
|
23
|
+
rxBytes: number;
|
|
24
|
+
txBytes: number;
|
|
25
|
+
rxErrors: number;
|
|
26
|
+
txErrors: number;
|
|
27
|
+
rxDropped: number;
|
|
28
|
+
txDropped: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Virtual network interface (like eth0, lo, etc.)
|
|
32
|
+
*/
|
|
33
|
+
export interface NetworkInterface {
|
|
34
|
+
name: string;
|
|
35
|
+
type: 'loopback' | 'ethernet' | 'tunnel';
|
|
36
|
+
state: InterfaceState;
|
|
37
|
+
mtu: number;
|
|
38
|
+
addresses: IPAddress[];
|
|
39
|
+
mac?: string;
|
|
40
|
+
stats: InterfaceStats;
|
|
41
|
+
namespace: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Routing table entry
|
|
45
|
+
*/
|
|
46
|
+
export interface RouteEntry {
|
|
47
|
+
destination: string;
|
|
48
|
+
gateway?: string;
|
|
49
|
+
interface: string;
|
|
50
|
+
metric: number;
|
|
51
|
+
namespace: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Socket types
|
|
55
|
+
*/
|
|
56
|
+
export type SocketType = 'tcp' | 'udp' | 'raw';
|
|
57
|
+
export type SocketState = 'closed' | 'listen' | 'syn-sent' | 'established' | 'close-wait' | 'fin-wait';
|
|
58
|
+
/**
|
|
59
|
+
* Socket address
|
|
60
|
+
*/
|
|
61
|
+
export interface SocketAddress {
|
|
62
|
+
ip: string;
|
|
63
|
+
port: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Virtual socket
|
|
67
|
+
*/
|
|
68
|
+
export interface Socket {
|
|
69
|
+
fd: number;
|
|
70
|
+
type: SocketType;
|
|
71
|
+
state: SocketState;
|
|
72
|
+
localAddress?: SocketAddress;
|
|
73
|
+
remoteAddress?: SocketAddress;
|
|
74
|
+
namespace: string;
|
|
75
|
+
bind(address: SocketAddress): void;
|
|
76
|
+
connect(address: SocketAddress): Promise<void>;
|
|
77
|
+
listen(backlog?: number): void;
|
|
78
|
+
accept(): Promise<Socket>;
|
|
79
|
+
send(data: Uint8Array): Promise<number>;
|
|
80
|
+
recv(maxBytes: number): Promise<Uint8Array>;
|
|
81
|
+
close(): void;
|
|
82
|
+
deliverPacket(packet: Packet): void;
|
|
83
|
+
toString(): string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Network packet
|
|
87
|
+
*/
|
|
88
|
+
export interface Packet {
|
|
89
|
+
source: SocketAddress;
|
|
90
|
+
destination: SocketAddress;
|
|
91
|
+
protocol: SocketType;
|
|
92
|
+
data: Uint8Array;
|
|
93
|
+
timestamp: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* DNS record types
|
|
97
|
+
*/
|
|
98
|
+
export type DNSRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT';
|
|
99
|
+
/**
|
|
100
|
+
* DNS record
|
|
101
|
+
*/
|
|
102
|
+
export interface DNSRecord {
|
|
103
|
+
type: DNSRecordType;
|
|
104
|
+
name: string;
|
|
105
|
+
value: string;
|
|
106
|
+
ttl: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Network namespace
|
|
110
|
+
*/
|
|
111
|
+
export interface NetworkNamespace {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
interfaces: Map<string, NetworkInterface>;
|
|
115
|
+
routes: RouteEntry[];
|
|
116
|
+
sockets: Map<number, Socket>;
|
|
117
|
+
arpTable: Map<string, string>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Tunnel types
|
|
121
|
+
*/
|
|
122
|
+
export type TunnelType = 'ssh' | 'gre' | 'ipip' | 'vxlan';
|
|
123
|
+
/**
|
|
124
|
+
* SSH tunnel configuration
|
|
125
|
+
*/
|
|
126
|
+
export interface SSHTunnelConfig {
|
|
127
|
+
type: 'local' | 'remote' | 'dynamic';
|
|
128
|
+
localAddress: SocketAddress;
|
|
129
|
+
remoteAddress: SocketAddress;
|
|
130
|
+
sshHost: string;
|
|
131
|
+
sshPort: number;
|
|
132
|
+
sshUser?: string;
|
|
133
|
+
sshKey?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Network tunnel
|
|
137
|
+
*/
|
|
138
|
+
export interface NetworkTunnel {
|
|
139
|
+
id: string;
|
|
140
|
+
type: TunnelType;
|
|
141
|
+
state: 'up' | 'down';
|
|
142
|
+
interface: NetworkInterface;
|
|
143
|
+
config: SSHTunnelConfig | Record<string, unknown>;
|
|
144
|
+
up(): Promise<void>;
|
|
145
|
+
down(): Promise<void>;
|
|
146
|
+
send(packet: Packet): Promise<void>;
|
|
147
|
+
recv(): Promise<Packet>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Port binding
|
|
151
|
+
*/
|
|
152
|
+
export interface PortBinding {
|
|
153
|
+
port: number;
|
|
154
|
+
address: string;
|
|
155
|
+
protocol: SocketType;
|
|
156
|
+
handler: (socket: Socket) => void | Promise<void>;
|
|
157
|
+
namespace: string;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/kernel/network/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM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AAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* The LRU eviction removes least-recently-accessed entries when the total
|
|
9
9
|
* stored bytes exceed the configured budget.
|
|
10
10
|
*/
|
|
11
|
-
/** Files at or above this size are chunked rather than stored inline.
|
|
11
|
+
/** Files at or above this size are chunked rather than stored inline.
|
|
12
|
+
* Set high to avoid LRU eviction silently losing file data during npm install
|
|
13
|
+
* (many packages installed back-to-back can exceed the ContentStore budget). */
|
|
12
14
|
export declare const CHUNK_THRESHOLD: number;
|
|
13
15
|
/** Size of each chunk for large files. */
|
|
14
16
|
export declare const CHUNK_SIZE: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentStore.d.ts","sourceRoot":"","sources":["../../../src/kernel/storage/ContentStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH
|
|
1
|
+
{"version":3,"file":"ContentStore.d.ts","sourceRoot":"","sources":["../../../src/kernel/storage/ContentStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;iFAEiF;AACjF,eAAO,MAAM,eAAe,QAAmB,CAAC;AAEhD,0CAA0C;AAC1C,eAAO,MAAM,UAAU,QAAa,CAAC;AAIrC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AASD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,GAAE,MAAyB;IAI/C,6DAA6D;IAC7D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAOpC,oEAAoE;IACpE,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;IAY7B,oCAAoC;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ1B,2CAA2C;IAC3C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,oCAAoC;IACpC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,kCAAkC;IAClC,IAAI,KAAK,IAAI,MAAM,CAElB;IAID;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,EAAE;IAW1C;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,GAAG,IAAI;IAalD;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI;IAQvC,OAAO,CAAC,KAAK;CAad"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INI-style unit file parser for systemd-like service definitions.
|
|
3
|
+
*/
|
|
4
|
+
export interface UnitFile {
|
|
5
|
+
Unit: {
|
|
6
|
+
Description?: string;
|
|
7
|
+
};
|
|
8
|
+
Service: {
|
|
9
|
+
ExecStart?: string;
|
|
10
|
+
ExecStop?: string;
|
|
11
|
+
Type?: 'simple' | 'oneshot';
|
|
12
|
+
Restart?: 'no' | 'always' | 'on-failure';
|
|
13
|
+
RestartSec?: number;
|
|
14
|
+
Environment?: Record<string, string>;
|
|
15
|
+
WorkingDirectory?: string;
|
|
16
|
+
};
|
|
17
|
+
Install: {
|
|
18
|
+
WantedBy?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function parseUnitFile(content: string): UnitFile;
|
|
22
|
+
//# sourceMappingURL=unit-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-parser.d.ts","sourceRoot":"","sources":["../../src/kernel/unit-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;QAC5B,OAAO,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC;QACzC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAwEvD"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { r as E, V as L } from "./index-Djm2onjx.js";
|
|
2
|
+
const n = "\x1B[", R = `${n}2J`, d = `${n}H`, B = `${n}?25l`, k = `${n}?25h`, g = `${n}2K`, y = `${n}7m`, S = `${n}1m`, C = `${n}0m`;
|
|
3
|
+
function m(e, r) {
|
|
4
|
+
return `${n}${e + 1};${r + 1}H`;
|
|
5
|
+
}
|
|
6
|
+
function v(e) {
|
|
7
|
+
if (e === "\r") return { type: "enter" };
|
|
8
|
+
if (e === "" || e === "\b") return { type: "backspace" };
|
|
9
|
+
if (e === "\x1B" && e.length === 1) return { type: "escape" };
|
|
10
|
+
if (e.startsWith("\x1B[")) {
|
|
11
|
+
const r = e.slice(2);
|
|
12
|
+
return r === "A" ? { type: "up" } : r === "B" ? { type: "down" } : r === "C" ? { type: "right" } : r === "D" ? { type: "left" } : r === "H" ? { type: "home" } : r === "F" ? { type: "end" } : r === "1~" || r === "7~" ? { type: "home" } : r === "4~" || r === "8~" ? { type: "end" } : r === "5~" ? { type: "pageup" } : r === "6~" ? { type: "pagedown" } : { type: "unknown" };
|
|
13
|
+
}
|
|
14
|
+
return e.length >= 1 && e.charCodeAt(0) >= 32 ? { type: "char", char: e } : { type: "unknown" };
|
|
15
|
+
}
|
|
16
|
+
function u(e) {
|
|
17
|
+
return e.rows - 1;
|
|
18
|
+
}
|
|
19
|
+
function N(e, r) {
|
|
20
|
+
const t = [];
|
|
21
|
+
if (!r) return t;
|
|
22
|
+
const o = r.toLowerCase();
|
|
23
|
+
for (let c = 0; c < e.length; c++)
|
|
24
|
+
e[c].toLowerCase().includes(o) && t.push(c);
|
|
25
|
+
return t;
|
|
26
|
+
}
|
|
27
|
+
function $(e) {
|
|
28
|
+
if (e.searchMatches.length !== 0) {
|
|
29
|
+
for (let r = 0; r < e.searchMatches.length; r++)
|
|
30
|
+
if (e.searchMatches[r] > e.scrollRow) {
|
|
31
|
+
e.currentMatch = r, e.scrollRow = e.searchMatches[r];
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
e.currentMatch = 0, e.scrollRow = e.searchMatches[0];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function I(e) {
|
|
38
|
+
if (e.searchMatches.length !== 0) {
|
|
39
|
+
for (let r = e.searchMatches.length - 1; r >= 0; r--)
|
|
40
|
+
if (e.searchMatches[r] < e.scrollRow) {
|
|
41
|
+
e.currentMatch = r, e.scrollRow = e.searchMatches[r];
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
e.currentMatch = e.searchMatches.length - 1, e.scrollRow = e.searchMatches[e.currentMatch];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function b(e, r) {
|
|
48
|
+
const t = u(e);
|
|
49
|
+
let o = B;
|
|
50
|
+
for (let c = 0; c < t; c++) {
|
|
51
|
+
const l = e.scrollRow + c;
|
|
52
|
+
if (o += m(c, 0) + g, l < e.lines.length) {
|
|
53
|
+
let a = e.lines[l].slice(e.scrollCol, e.scrollCol + e.cols);
|
|
54
|
+
e.searchQuery && a.toLowerCase().includes(e.searchQuery.toLowerCase()) && (a = H(a, e.searchQuery)), o += a;
|
|
55
|
+
} else
|
|
56
|
+
o += "~";
|
|
57
|
+
}
|
|
58
|
+
if (o += m(e.rows - 1, 0) + y + g, e.mode === "search")
|
|
59
|
+
o += "/" + e.searchBuf;
|
|
60
|
+
else {
|
|
61
|
+
const c = e.lines.length <= t || e.scrollRow + t >= e.lines.length ? "(END)" : `${Math.round((e.scrollRow + t) / e.lines.length * 100)}%`, l = e.searchQuery && e.searchMatches.length > 0 ? ` [${e.currentMatch + 1}/${e.searchMatches.length}]` : "", a = `${e.fileName} ${c}${l}`;
|
|
62
|
+
o += a.padEnd(e.cols);
|
|
63
|
+
}
|
|
64
|
+
o += C + k, r.write(o);
|
|
65
|
+
}
|
|
66
|
+
function H(e, r) {
|
|
67
|
+
const t = e.toLowerCase(), o = r.toLowerCase();
|
|
68
|
+
let c = "", l = 0;
|
|
69
|
+
for (; l < e.length; ) {
|
|
70
|
+
const a = t.indexOf(o, l);
|
|
71
|
+
if (a === -1) {
|
|
72
|
+
c += e.slice(l);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
c += e.slice(l, a), c += S + y + e.slice(a, a + r.length) + C, l = a + r.length;
|
|
76
|
+
}
|
|
77
|
+
return c;
|
|
78
|
+
}
|
|
79
|
+
function O(e, r) {
|
|
80
|
+
const t = u(e);
|
|
81
|
+
switch (r.type) {
|
|
82
|
+
case "char":
|
|
83
|
+
switch (r.char) {
|
|
84
|
+
case "q":
|
|
85
|
+
return !0;
|
|
86
|
+
case "j":
|
|
87
|
+
e.scrollRow = Math.min(e.scrollRow + 1, i(e));
|
|
88
|
+
break;
|
|
89
|
+
case "k":
|
|
90
|
+
e.scrollRow = Math.max(e.scrollRow - 1, 0);
|
|
91
|
+
break;
|
|
92
|
+
case "f":
|
|
93
|
+
case " ":
|
|
94
|
+
e.scrollRow = Math.min(e.scrollRow + t, i(e));
|
|
95
|
+
break;
|
|
96
|
+
case "b":
|
|
97
|
+
e.scrollRow = Math.max(e.scrollRow - t, 0);
|
|
98
|
+
break;
|
|
99
|
+
case "d":
|
|
100
|
+
e.scrollRow = Math.min(e.scrollRow + Math.floor(t / 2), i(e));
|
|
101
|
+
break;
|
|
102
|
+
case "u":
|
|
103
|
+
e.scrollRow = Math.max(e.scrollRow - Math.floor(t / 2), 0);
|
|
104
|
+
break;
|
|
105
|
+
case "g":
|
|
106
|
+
e.scrollRow = 0;
|
|
107
|
+
break;
|
|
108
|
+
case "G":
|
|
109
|
+
e.scrollRow = i(e);
|
|
110
|
+
break;
|
|
111
|
+
case "/":
|
|
112
|
+
e.mode = "search", e.searchBuf = "";
|
|
113
|
+
break;
|
|
114
|
+
case "n":
|
|
115
|
+
$(e);
|
|
116
|
+
break;
|
|
117
|
+
case "N":
|
|
118
|
+
I(e);
|
|
119
|
+
break;
|
|
120
|
+
case "h":
|
|
121
|
+
e.scrollCol = Math.max(e.scrollCol - 1, 0);
|
|
122
|
+
break;
|
|
123
|
+
case "l":
|
|
124
|
+
e.scrollCol++;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
case "up":
|
|
129
|
+
e.scrollRow = Math.max(e.scrollRow - 1, 0);
|
|
130
|
+
break;
|
|
131
|
+
case "down":
|
|
132
|
+
e.scrollRow = Math.min(e.scrollRow + 1, i(e));
|
|
133
|
+
break;
|
|
134
|
+
case "pageup":
|
|
135
|
+
e.scrollRow = Math.max(e.scrollRow - t, 0);
|
|
136
|
+
break;
|
|
137
|
+
case "pagedown":
|
|
138
|
+
e.scrollRow = Math.min(e.scrollRow + t, i(e));
|
|
139
|
+
break;
|
|
140
|
+
case "home":
|
|
141
|
+
e.scrollRow = 0;
|
|
142
|
+
break;
|
|
143
|
+
case "end":
|
|
144
|
+
e.scrollRow = i(e);
|
|
145
|
+
break;
|
|
146
|
+
case "left":
|
|
147
|
+
e.scrollCol = Math.max(e.scrollCol - 1, 0);
|
|
148
|
+
break;
|
|
149
|
+
case "right":
|
|
150
|
+
e.scrollCol++;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
return !1;
|
|
154
|
+
}
|
|
155
|
+
function Q(e, r) {
|
|
156
|
+
switch (r.type) {
|
|
157
|
+
case "enter":
|
|
158
|
+
e.searchQuery = e.searchBuf, e.searchMatches = N(e.lines, e.searchQuery), e.currentMatch = -1, e.mode = "view", e.searchMatches.length > 0 && $(e);
|
|
159
|
+
break;
|
|
160
|
+
case "escape":
|
|
161
|
+
e.mode = "view";
|
|
162
|
+
break;
|
|
163
|
+
case "backspace":
|
|
164
|
+
e.searchBuf = e.searchBuf.slice(0, -1);
|
|
165
|
+
break;
|
|
166
|
+
case "char":
|
|
167
|
+
e.searchBuf += r.char;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function i(e) {
|
|
172
|
+
return Math.max(0, e.lines.length - u(e));
|
|
173
|
+
}
|
|
174
|
+
const D = async (e) => {
|
|
175
|
+
var a, f, w;
|
|
176
|
+
let r, t;
|
|
177
|
+
if (e.args.length > 0) {
|
|
178
|
+
const s = E(e.cwd, e.args[0]);
|
|
179
|
+
try {
|
|
180
|
+
r = e.vfs.readFileString(s), t = e.args[0];
|
|
181
|
+
} catch (h) {
|
|
182
|
+
if (h instanceof L)
|
|
183
|
+
return e.stderr.write(`less: ${e.args[0]}: ${h.message}
|
|
184
|
+
`), 1;
|
|
185
|
+
throw h;
|
|
186
|
+
}
|
|
187
|
+
} else if (e.stdin)
|
|
188
|
+
r = await e.stdin.readAll(), t = "(stdin)";
|
|
189
|
+
else
|
|
190
|
+
return e.stderr.write(`Usage: less FILE
|
|
191
|
+
`), e.stderr.write(`View file contents one screen at a time. q to quit, / to search.
|
|
192
|
+
`), 1;
|
|
193
|
+
const o = r.split(`
|
|
194
|
+
`);
|
|
195
|
+
o.length > 1 && o[o.length - 1] === "" && o.pop(), o.length === 0 && o.push("");
|
|
196
|
+
const c = parseInt(e.env.LINES || "24", 10), l = parseInt(e.env.COLUMNS || "80", 10);
|
|
197
|
+
if (o.length <= c - 1)
|
|
198
|
+
return e.stdout.write(r), 0;
|
|
199
|
+
(a = e.setRawMode) == null || a.call(e, !0);
|
|
200
|
+
try {
|
|
201
|
+
const s = {
|
|
202
|
+
lines: o,
|
|
203
|
+
scrollRow: 0,
|
|
204
|
+
scrollCol: 0,
|
|
205
|
+
rows: c,
|
|
206
|
+
cols: l,
|
|
207
|
+
fileName: t,
|
|
208
|
+
mode: "view",
|
|
209
|
+
searchBuf: "",
|
|
210
|
+
searchQuery: "",
|
|
211
|
+
searchMatches: [],
|
|
212
|
+
currentMatch: -1
|
|
213
|
+
};
|
|
214
|
+
for (e.stdout.write(R + d), b(s, e.stdout); ; ) {
|
|
215
|
+
const h = await ((f = e.stdin) == null ? void 0 : f.read());
|
|
216
|
+
if (h == null) break;
|
|
217
|
+
const M = v(h);
|
|
218
|
+
let p = !1;
|
|
219
|
+
if (s.mode === "view" ? p = O(s, M) : Q(s, M), p) break;
|
|
220
|
+
b(s, e.stdout);
|
|
221
|
+
}
|
|
222
|
+
e.stdout.write(R + d + k);
|
|
223
|
+
} finally {
|
|
224
|
+
(w = e.setRawMode) == null || w.call(e, !1);
|
|
225
|
+
}
|
|
226
|
+
return 0;
|
|
227
|
+
};
|
|
228
|
+
export {
|
|
229
|
+
D as default
|
|
230
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as h } from "./args-CG6b9cZt.js";
|
|
2
|
-
import { r as m, V as d, B as w, a as y, R as $ } from "./index-
|
|
2
|
+
import { r as m, V as d, B as w, a as y, R as $ } from "./index-Djm2onjx.js";
|
|
3
3
|
const S = {
|
|
4
4
|
long: { type: "boolean", short: "l" },
|
|
5
5
|
all: { type: "boolean", short: "a" },
|
|
@@ -12,7 +12,7 @@ const a = {
|
|
|
12
12
|
fg: { synopsis: "fg [JOB_ID]", description: "Move a background job to the foreground." },
|
|
13
13
|
bg: { synopsis: "bg [JOB_ID]", description: "Resume a stopped background job." },
|
|
14
14
|
history: { synopsis: "history", description: "Display the command history list." },
|
|
15
|
-
source: { synopsis: "source FILE", description: "Read and execute commands from FILE in the current shell environment." },
|
|
15
|
+
source: { synopsis: "source FILE", description: "Read and execute commands from FILE in the current shell environment. Shell sources /etc/profile and ~/.liforc on startup." },
|
|
16
16
|
alias: { synopsis: "alias [NAME=VALUE...]", description: "Define or display aliases. Without arguments, lists all aliases." },
|
|
17
17
|
unalias: { synopsis: "unalias NAME...", description: "Remove alias definitions." },
|
|
18
18
|
// Filesystem
|
|
@@ -85,6 +85,19 @@ const a = {
|
|
|
85
85
|
gunzip: { synopsis: "gunzip [-k] FILE...", description: "Decompress gzip files. -k keep original." },
|
|
86
86
|
zip: { synopsis: "zip [-r] ARCHIVE FILE...", description: "Package and compress files. -r recursive." },
|
|
87
87
|
unzip: { synopsis: "unzip [-lo] ARCHIVE", description: "Extract files from a ZIP archive. -l list, -o overwrite." },
|
|
88
|
+
// Text editors & pagers
|
|
89
|
+
nano: { synopsis: "nano [FILE]", description: "A simple text editor. ^O save, ^X exit, ^K cut line, ^U paste, ^W search, arrow keys to navigate." },
|
|
90
|
+
less: { synopsis: "less [FILE]", description: "View file contents one screen at a time. j/k scroll, f/b page, /pattern search, n/N next/prev match, q quit." },
|
|
91
|
+
// Text utilities (continued)
|
|
92
|
+
seq: { synopsis: "seq [-s SEP] [FIRST [INCR]] LAST", description: "Print a sequence of numbers from FIRST to LAST with optional INCRement. -s sets separator (default newline)." },
|
|
93
|
+
tac: { synopsis: "tac [FILE...]", description: "Concatenate and print files in reverse line order (opposite of cat)." },
|
|
94
|
+
base64: { synopsis: "base64 [-d] [-w COLS] [FILE]", description: "Base64 encode or decode data. -d decode, -w wrap encoded lines at COLS (default 76, 0 disables)." },
|
|
95
|
+
strings: { synopsis: "strings [-n MIN] [FILE...]", description: "Print sequences of printable characters from files. -n sets minimum string length (default 4)." },
|
|
96
|
+
sha256sum: { synopsis: "sha256sum [-c FILE] [FILE...]", description: "Compute or verify SHA-256 checksums. -c reads checksums from FILE and verifies them." },
|
|
97
|
+
// Fun
|
|
98
|
+
sl: { synopsis: "sl", description: "Steam Locomotive. Displays a train animation. A classic punishment for mistyping ls." },
|
|
99
|
+
fastfetch: { synopsis: "fastfetch [--logo default|small|none] [--color COLOR]", description: "Display system information with a custom Lifo logo. Config at ~/.config/fastfetch/config.json. Supports custom logos, colors (256-color), and module selection." },
|
|
100
|
+
neofetch: { synopsis: "neofetch", description: "Alias for fastfetch. Display system information with a custom Lifo logo." },
|
|
88
101
|
// Node.js
|
|
89
102
|
node: { synopsis: "node [-e CODE] [FILE]", description: "Execute JavaScript using the Node.js-compatible runtime." },
|
|
90
103
|
pkg: { synopsis: "pkg install|remove|list [PACKAGE]", description: "Package manager for installing and managing packages." }
|
|
@@ -98,11 +111,11 @@ const a = {
|
|
|
98
111
|
return s.stderr.write(`man: -k requires a keyword
|
|
99
112
|
`), 1;
|
|
100
113
|
const n = s.args[1].toLowerCase();
|
|
101
|
-
let
|
|
102
|
-
for (const [
|
|
103
|
-
(
|
|
104
|
-
`),
|
|
105
|
-
return
|
|
114
|
+
let o = !1;
|
|
115
|
+
for (const [r, t] of Object.entries(a))
|
|
116
|
+
(r.includes(n) || t.synopsis.toLowerCase().includes(n) || t.description.toLowerCase().includes(n)) && (s.stdout.write(`${r}(1) - ${t.description.split(".")[0]}
|
|
117
|
+
`), o = !0);
|
|
118
|
+
return o ? 0 : (s.stderr.write(`man: nothing appropriate for "${s.args[1]}"
|
|
106
119
|
`), 1);
|
|
107
120
|
}
|
|
108
121
|
const i = s.args[0], e = a[i];
|