🧩 Phase 1: Core Foundation (Fix + Harden Existing Commands) ✅ 1. Audit and Fix Current Builtins
Some builtins are functional but fragile or incomplete. We’ll fix them first.
Command Problem Fix cd Doesn’t handle .., relative paths, or errors cleanly. Implement proper path expansion and error handling. pwd Works fine. ✅ Nothing urgent. echo OK but should handle flags (-n) and variable expansion later. Add optional improvements. ls Logic fine but no error display consistency and doesn’t support flags like -lh or --help. Normalize output, support more flags later. type Currently just says “builtin.” Should detect external commands too. exit Calls os.Exit() immediately, which kills the shell instantly even in tests. Wrap with graceful exit (return a signal instead). 🧠 Goal: Clean, robust, testable command layer.
We’ll:
Fix cd error handling.
Make exit test-safe.
Improve consistency of Stdout writes.
Start adding unit tests for each command.
⚙️ Phase 2: Extend Command System
After the builtins are stable, we’ll extend your core system so it supports:
Pipes (|) — real data flow between commands using StdoutPipe/StdinPipe.
Redirections (>, <, >>) — file I/O handling.
External command fallback — if a command isn’t builtin, run as external (/bin/ls, etc.).
Error messaging + exit codes — like a real shell.
This means upgrading your parser:
Parse multi-part commands like ls -l | grep go > out.txt
Build CompositeCommand or PipelineCommand objects
🌐 Phase 3: Networking Commands (New Category)
After the basics are bulletproof, we’ll start adding network-level commands, to simulate a real interactive shell that can:
Ping hosts
Download files
Fetch APIs
Listen on sockets
Here’s the brainstorm list for that:
Command Description Notes ping Simple ICMP-like ping using net.DialTimeout() No root privileges needed. curl Minimal HTTP GET/POST using net/http Parse flags (-d, -X, -H). server Start a basic TCP/HTTP server Useful for learning concurrency. netstat List open ports / connections Use net package or ss equivalent. download Fetch a file from URL to local disk Simple wrapper around http.Get. 🧠 Phase 4: Developer Tools / Advanced Builtins
Once networking works, you can start adding developer-centric shell utilities:
Command Function whoami Show current user date Current system time uptime System uptime ps List running shell commands kill Terminate background job history Command history alias Define shortcuts env Print environment variables ⚙️ Phase 5: System Features
Add:
Background jobs (&)
Command substitution ($(...))
Conditional execution (&&, ||)
Config file support (~/.myshellrc)
Completion and syntax highlighting