Commit 69e30f7
authored
feat: add session-aware history commands (ghistory, lhistory) (#111)
Add two new CLI commands for command history with session metadata:
- ghistory: global history across all sessions
- ghistory N: show last N entries
- ghistory -s <session_id>: filter by session
- lhistory: local history for current session only
- lhistory N: show last N entries
Implementation details:
- Add session identity fields (session_id, session_tty, session_start)
to DATA struct in CLIcore.h and CLIcore_standalone.h
- Create ~/.milk_history_log as append-only TSV file recording
every command with: timestamp, session_id, terminal, command
- Session ID format: <processname>-<PID> (e.g., milk-12345)
- Structured log runs alongside readline history (no opt-in needed)
- Existing ~/.milk_history (readline) remains unchanged1 parent 3b0be87 commit 69e30f7
5 files changed
Lines changed: 424 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
524 | 527 | | |
525 | 528 | | |
526 | 529 | | |
| |||
1348 | 1351 | | |
1349 | 1352 | | |
1350 | 1353 | | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
1351 | 1372 | | |
1352 | 1373 | | |
1353 | 1374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
383 | 390 | | |
384 | 391 | | |
385 | 392 | | |
| |||
0 commit comments