Skip to content

Commit 6cae9eb

Browse files
committed
docs: add roadmap and process sub parsing session notes
1 parent a81b67d commit 6cae9eb

2 files changed

Lines changed: 683 additions & 0 deletions

File tree

docs/ROADMAP_TO_V1.md

Lines changed: 398 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,398 @@
1+
# Valence Shell: Roadmap to v1.0.0
2+
3+
**Current Version**: 0.10.0 (Command Substitution)
4+
**Target**: v1.0.0 (Production-Ready Shell)
5+
**Date**: 2026-01-29
6+
7+
---
8+
9+
## Current Status
10+
11+
### ✅ Implemented (v0.1.0 - v0.10.0)
12+
13+
| Feature | Version | Status |
14+
|---------|---------|--------|
15+
| Filesystem Operations | v0.1.0 |`mkdir`, `rmdir`, `touch`, `rm` |
16+
| Undo/Redo | v0.2.0 | ✅ Reversible operations |
17+
| History | v0.3.0 | ✅ Command history tracking |
18+
| Transactions | v0.4.0 |`begin`, `commit`, `rollback` |
19+
| Proof References | v0.5.0 | ✅ 256 theorems linked |
20+
| External Commands | v0.7.0 | ✅ Fork/exec with PATH |
21+
| I/O Redirections | v0.8.0 |`>`, `>>`, `<`, `2>`, `2>&1` |
22+
| Pipelines | v0.8.0 | ✅ Multi-stage `cmd1 | cmd2 | cmd3` |
23+
| Variables | v0.9.0 |`VAR=value`, `$VAR`, `${VAR}`, special vars |
24+
| Quote Parsing | v0.9.0 | ✅ Single/double quotes, escaping |
25+
| Command Substitution | v0.10.0 |`$(cmd)`, `` `cmd` `` |
26+
| Process Sub Parsing | v0.10.0 |`<(cmd)`, `>(cmd)` (execution deferred) |
27+
28+
### 🚧 In Progress
29+
30+
| Feature | Version | Status |
31+
|---------|---------|--------|
32+
| Process Substitution Execution | v0.11.0 | 🚧 Parsing done, FIFO execution pending |
33+
34+
---
35+
36+
## Roadmap to v1.0.0
37+
38+
### Phase 6 Completion: Shell Features
39+
40+
#### M7: Process Substitution Execution (v0.11.0)
41+
**Timeline**: 3-4 days
42+
**Complexity**: High (FIFO management, background processes)
43+
44+
**Requirements**:
45+
- [ ] FIFO (named pipe) creation using `mkfifo()` syscall
46+
- [ ] Background process spawning with redirected file descriptors
47+
- [ ] Process management (track PIDs, wait for completion)
48+
- [ ] FIFO cleanup (remove after main command completes)
49+
- [ ] Error handling (deadlocks, broken pipes, process failures)
50+
- [ ] Platform support: Linux/macOS only (Windows has no FIFOs)
51+
52+
**Success Criteria**:
53+
- `diff <(ls dir1) <(ls dir2)` executes correctly
54+
- `tee >(wc -l) >(grep pattern)` works
55+
- FIFOs cleaned up even on errors
56+
- No zombie processes or resource leaks
57+
58+
---
59+
60+
#### M8: Arithmetic Expansion (v0.12.0)
61+
**Timeline**: 2-3 days
62+
**Complexity**: Medium (expression parsing, overflow handling)
63+
64+
**Requirements**:
65+
- [ ] Parse `$((expr))` syntax
66+
- [ ] Evaluate arithmetic expressions: `+`, `-`, `*`, `/`, `%`, `**`
67+
- [ ] Handle precedence and parentheses
68+
- [ ] Bitwise operators: `&`, `|`, `^`, `~`, `<<`, `>>`
69+
- [ ] Comparison operators: `<`, `>`, `<=`, `>=`, `==`, `!=`
70+
- [ ] Variable expansion in expressions: `$((x + y))`
71+
- [ ] Overflow detection and safe math
72+
- [ ] Integer-only (POSIX behavior)
73+
74+
**Examples**:
75+
```bash
76+
echo $((2 + 3)) # 5
77+
echo $((10 / 3)) # 3 (integer division)
78+
VAR=5; echo $((VAR * 2)) # 10
79+
```
80+
81+
---
82+
83+
#### M9: Here Documents (v0.13.0)
84+
**Timeline**: 2 days
85+
**Complexity**: Low (input buffering)
86+
87+
**Requirements**:
88+
- [ ] Parse `<<EOF` syntax
89+
- [ ] Collect lines until delimiter
90+
- [ ] Feed to command stdin
91+
- [ ] Variable expansion in here-docs (unless `<<'EOF'`)
92+
- [ ] No expansion with quoted delimiter: `<<'EOF'`
93+
94+
**Examples**:
95+
```bash
96+
cat <<EOF
97+
Hello $USER
98+
Current directory: $(pwd)
99+
EOF
100+
101+
cat <<'EOF'
102+
Literal: $USER and $(pwd)
103+
EOF
104+
```
105+
106+
---
107+
108+
#### M10: Job Control (v0.14.0)
109+
**Timeline**: 4-5 days
110+
**Complexity**: High (process groups, signals)
111+
112+
**Requirements**:
113+
- [ ] Background jobs: `cmd &`
114+
- [ ] Job list: `jobs`
115+
- [ ] Foreground: `fg %1`
116+
- [ ] Background: `bg %1`
117+
- [ ] Process group management
118+
- [ ] Signal handling (SIGTSTP, SIGCONT, SIGCHLD)
119+
- [ ] Terminal control (tcsetpgrp)
120+
121+
**Deferred** (not required for v1.0):
122+
- Job control on Windows (no POSIX signals)
123+
- Advanced job features (disown, wait)
124+
125+
---
126+
127+
### Phase 7: Scripting Support
128+
129+
#### M11: Conditionals (v0.15.0)
130+
**Timeline**: 3-4 days
131+
**Complexity**: Medium (AST for conditionals)
132+
133+
**Requirements**:
134+
- [ ] `if` / `then` / `elif` / `else` / `fi`
135+
- [ ] Exit code checking: `if cmd; then ...`
136+
- [ ] Test command: `if [ -f file ]; then ...`
137+
- [ ] Built-in `test` / `[` command
138+
- [ ] String comparisons: `=`, `!=`
139+
- [ ] Integer comparisons: `-eq`, `-ne`, `-lt`, `-le`, `-gt`, `-ge`
140+
- [ ] File tests: `-f`, `-d`, `-e`, `-r`, `-w`, `-x`
141+
- [ ] Boolean operators: `-a` (and), `-o` (or), `!` (not)
142+
143+
**Examples**:
144+
```bash
145+
if [ -f config.txt ]; then
146+
echo "Config exists"
147+
else
148+
echo "No config"
149+
fi
150+
```
151+
152+
---
153+
154+
#### M12: Loops (v0.16.0)
155+
**Timeline**: 3 days
156+
**Complexity**: Medium (control flow)
157+
158+
**Requirements**:
159+
- [ ] `for` loops: `for var in list; do ...; done`
160+
- [ ] `while` loops: `while condition; do ...; done`
161+
- [ ] `until` loops: `until condition; do ...; done`
162+
- [ ] `break` and `continue`
163+
- [ ] C-style for: `for ((i=0; i<10; i++)); do ...; done`
164+
165+
**Examples**:
166+
```bash
167+
for file in *.txt; do
168+
echo "Processing $file"
169+
done
170+
171+
i=0
172+
while [ $i -lt 5 ]; do
173+
echo $i
174+
i=$((i + 1))
175+
done
176+
```
177+
178+
---
179+
180+
#### M13: Functions (v0.17.0)
181+
**Timeline**: 3-4 days
182+
**Complexity**: Medium (scope, local variables)
183+
184+
**Requirements**:
185+
- [ ] Function definition: `func() { ...; }`
186+
- [ ] Function calls
187+
- [ ] Positional parameters: `$1`, `$2`, etc.
188+
- [ ] `local` keyword for function-scoped variables
189+
- [ ] `return` statement with exit code
190+
- [ ] `$@` and `$*` for all arguments
191+
192+
**Examples**:
193+
```bash
194+
greet() {
195+
local name=$1
196+
echo "Hello, $name!"
197+
}
198+
199+
greet "World"
200+
```
201+
202+
---
203+
204+
### Phase 8: MAA Framework Integration
205+
206+
#### M14: Provenance Tracking (v0.18.0)
207+
**Timeline**: 5-6 days
208+
**Complexity**: High (cryptographic hashing, audit trails)
209+
210+
**Requirements**:
211+
- [ ] Hash-chained audit log for all operations
212+
- [ ] Operation metadata: user, timestamp, command, exit code
213+
- [ ] Before/after filesystem state hashing
214+
- [ ] Tamper-evident log storage
215+
- [ ] Log verification command
216+
- [ ] Integration with proven's `SafeProvenance` (Idris2)
217+
218+
**MAA Guarantees**:
219+
- Every operation creates an audit entry
220+
- Entries are cryptographically chained (hash of previous)
221+
- Tampering with any entry breaks the chain
222+
- GDPR compliance: immutable proof of data operations
223+
224+
---
225+
226+
#### M15: Capability-Based Security (v0.19.0)
227+
**Timeline**: 4-5 days
228+
**Complexity**: High (permission modeling)
229+
230+
**Requirements**:
231+
- [ ] Capability tokens for file access
232+
- [ ] Least-privilege enforcement
233+
- [ ] Delegation and revocation
234+
- [ ] Integration with proven's `SafeCapability` (Idris2)
235+
236+
**Deferred** (post-v1.0):
237+
- Network capabilities
238+
- Time-limited capabilities
239+
240+
---
241+
242+
### Phase 9: Production Readiness
243+
244+
#### M16: Error Handling & Robustness (v0.20.0)
245+
**Timeline**: 3-4 days
246+
247+
**Requirements**:
248+
- [ ] Comprehensive error messages
249+
- [ ] Graceful degradation (missing commands)
250+
- [ ] Resource limit handling (max file descriptors, memory)
251+
- [ ] SIGINT handling (Ctrl+C in external commands)
252+
- [ ] SIGTERM handling (graceful shutdown)
253+
- [ ] Cleanup on abnormal exit
254+
- [ ] Fuzzing integration (OSS-Fuzz or ClusterFuzzLite)
255+
256+
---
257+
258+
#### M17: Configuration & Customization (v0.21.0)
259+
**Timeline**: 2-3 days
260+
261+
**Requirements**:
262+
- [ ] Config file: `~/.vshrc`
263+
- [ ] Prompt customization
264+
- [ ] Aliases
265+
- [ ] Environment variable persistence
266+
- [ ] History file: `~/.vsh_history`
267+
- [ ] History size limits
268+
269+
---
270+
271+
#### M18: Documentation & Examples (v0.22.0)
272+
**Timeline**: 3-4 days
273+
274+
**Requirements**:
275+
- [ ] User manual (AsciiDoc)
276+
- [ ] Tutorial: Getting Started
277+
- [ ] Example scripts
278+
- [ ] Proof reference guide
279+
- [ ] MAA framework guide
280+
- [ ] API documentation (rustdoc)
281+
- [ ] Man page: `man vsh`
282+
283+
---
284+
285+
#### M19: Performance Optimization (v0.23.0)
286+
**Timeline**: 2-3 days
287+
288+
**Requirements**:
289+
- [ ] Benchmarking suite
290+
- [ ] Command lookup caching
291+
- [ ] Fork overhead reduction
292+
- [ ] Memory usage optimization
293+
- [ ] Startup time optimization (< 50ms)
294+
295+
---
296+
297+
#### M20: v1.0.0 Release Candidate (v0.24.0)
298+
**Timeline**: 1 week
299+
300+
**Requirements**:
301+
- [ ] All critical features complete
302+
- [ ] All tests passing (unit, integration, property)
303+
- [ ] Security audit (manual + automated)
304+
- [ ] Performance regression tests
305+
- [ ] User acceptance testing
306+
- [ ] Release notes
307+
- [ ] Migration guide (from bash/zsh)
308+
309+
---
310+
311+
## v1.0.0 Release Criteria
312+
313+
### Must-Have Features
314+
- ✅ All Phase 6 milestones (shell features)
315+
- ✅ All Phase 7 milestones (scripting)
316+
- ✅ MAA Framework (provenance tracking)
317+
- ✅ Error handling and robustness
318+
- ✅ Documentation complete
319+
320+
### Quality Gates
321+
- [ ] 100% of critical tests passing
322+
- [ ] No known critical bugs
323+
- [ ] No resource leaks (valgrind clean)
324+
- [ ] Fuzzing: 24+ hours without crashes
325+
- [ ] Startup time < 50ms (cold start)
326+
- [ ] Memory usage < 10MB (idle)
327+
328+
### Platform Support
329+
- ✅ Linux (x86_64, aarch64)
330+
- ✅ macOS (Intel, Apple Silicon)
331+
- ⚠️ Windows: Limited (no FIFOs, no job control)
332+
333+
### Proof Coverage
334+
- [ ] All reversible operations proven in 6 systems
335+
- [ ] Extraction verified (Coq → OCaml, Lean → Rust correspondence)
336+
- [ ] MAA framework mathematically verified
337+
338+
---
339+
340+
## Timeline Estimate
341+
342+
| Phase | Milestones | Estimated Time |
343+
|-------|-----------|----------------|
344+
| Phase 6 (Shell Features) | M7-M10 | 11-14 days |
345+
| Phase 7 (Scripting) | M11-M13 | 9-11 days |
346+
| Phase 8 (MAA Framework) | M14-M15 | 9-11 days |
347+
| Phase 9 (Production) | M16-M20 | 11-14 days |
348+
| **Total** | **M7-M20** | **40-50 days** |
349+
350+
**Target v1.0.0 Release**: ~6-8 weeks from now
351+
352+
---
353+
354+
## Proven Library Integration
355+
356+
### Applicable Modules (Idris2 only)
357+
358+
| Proven Module | Use Case | Integration Point |
359+
|---------------|----------|-------------------|
360+
| `SafeFile.idr` | File operations | Replace Rust file I/O with proven calls |
361+
| `SafePath.idr` | Path manipulation | Validate paths before operations |
362+
| `SafeStateMachine.idr` | Shell state transitions | Model REPL state machine |
363+
| `SafeProvenance.idr` | MAA audit trails | Hash-chained operation log |
364+
| `SafeCapability.idr` | Permission modeling | Capability-based security |
365+
366+
### Integration Strategy
367+
368+
1. **Compile Idris2 modules** to shared library
369+
2. **Create minimal FFI wrapper** in valence-shell Rust code
370+
3. **Ignore all bindings directories** in proven repo (contaminated)
371+
4. **Direct Zig FFI if needed**, or use Idris2's native FFI
372+
373+
---
374+
375+
## Post-v1.0 Features (v1.1+)
376+
377+
- Command-line editing (readline-like)
378+
- Tab completion
379+
- Syntax highlighting (via rustyline)
380+
- vi/emacs keybindings
381+
- Advanced job control (disown, wait)
382+
- Shell scripts with shebang: `#!/usr/bin/vsh`
383+
- Plugin system
384+
- Remote shell execution (SSH integration)
385+
386+
---
387+
388+
## Success Metrics for v1.0.0
389+
390+
- [ ] Can run basic shell scripts (bash compatibility: 80%+)
391+
- [ ] Undo works for all reversible operations
392+
- [ ] MAA audit log verifiable
393+
- [ ] Zero known security vulnerabilities
394+
- [ ] Production deployment by 1+ user
395+
396+
---
397+
398+
**Co-Authored-By**: Claude Sonnet 4.5 <noreply@anthropic.com>

0 commit comments

Comments
 (0)