Skip to content

Commit 06317bf

Browse files
authored
Merge pull request #92 from benbernard/issue-cleanups
feat: TUI pipeline builder (Phase 1 MVP) + auto-versioning
2 parents 2bf041c + 116da46 commit 06317bf

37 files changed

Lines changed: 5442 additions & 2 deletions

bin/recs-tui.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bun
2+
/**
3+
* CLI entry point for the RecordStream TUI pipeline builder.
4+
*
5+
* Usage:
6+
* recs tui [inputfile] Open TUI with optional input file
7+
* recs tui --session <id> Resume a saved session
8+
* recs tui --list List saved sessions
9+
* recs tui --clean Remove sessions older than 7 days
10+
* recs tui --pipeline "..." Start with an initial pipeline command
11+
*/
12+
13+
import { launchTui, type TuiOptions } from "../src/tui/index.tsx";
14+
15+
const args = process.argv.slice(2);
16+
17+
// Handle --list
18+
if (args.includes("--list")) {
19+
// TODO: implement session listing (Phase 3)
20+
console.log("No saved sessions. (Session persistence coming in Phase 3)");
21+
process.exit(0);
22+
}
23+
24+
// Handle --clean
25+
if (args.includes("--clean")) {
26+
// TODO: implement session cleanup (Phase 3)
27+
console.log("Session cleanup not yet implemented. (Phase 3)");
28+
process.exit(0);
29+
}
30+
31+
// Parse options
32+
const options: TuiOptions = {};
33+
34+
for (let i = 0; i < args.length; i++) {
35+
const arg = args[i]!;
36+
37+
if (arg === "--session" || arg === "-s") {
38+
options.sessionId = args[i + 1];
39+
i++; // skip value
40+
} else if (arg === "--pipeline" || arg === "-p") {
41+
options.pipeline = args[i + 1];
42+
i++; // skip value
43+
} else if (arg === "--help" || arg === "-h") {
44+
console.log(`Usage: recs tui [options] [inputfile]
45+
46+
Options:
47+
--session, -s <id> Resume a saved session
48+
--pipeline, -p <cmd> Start with an initial pipeline command
49+
--list List saved sessions
50+
--clean Remove sessions older than 7 days
51+
--help, -h Show this help message
52+
53+
Examples:
54+
recs tui data.jsonl
55+
recs tui access.log --pipeline "fromre '^(\\S+)' | grep status=200"
56+
recs tui --session abc123
57+
recs tui`);
58+
process.exit(0);
59+
} else if (!arg.startsWith("-")) {
60+
// Positional arg = input file
61+
options.inputFile = arg;
62+
}
63+
}
64+
65+
await launchTui(options);

bin/recs.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ if (command === "story") {
9999
process.exit(0);
100100
}
101101

102+
// Handle TUI subcommand
103+
if (command === "tui") {
104+
const tuiArgs = args.slice(1);
105+
// Re-exec via recs-tui.ts with remaining args
106+
const { join } = await import("node:path");
107+
const tuiEntry = join(import.meta.dir, "recs-tui.ts");
108+
const proc = Bun.spawn(["bun", "run", tuiEntry, ...tuiArgs], {
109+
stdin: "inherit",
110+
stdout: "inherit",
111+
stderr: "inherit",
112+
});
113+
const code = await proc.exited;
114+
process.exit(code);
115+
}
116+
102117
// Handle alias management subcommand
103118
if (command === "alias") {
104119
const aliasArgs = args.slice(1);

bun.lock

Lines changed: 202 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@
2828
"vitepress": "^1.6.4"
2929
},
3030
"dependencies": {
31+
"@opentui/core": "^0.1.81",
32+
"@opentui/react": "^0.1.81",
33+
"@types/react": "^19.2.14",
3134
"better-sqlite3": "^12.6.2",
3235
"fast-xml-parser": "^5.3.7",
3336
"mongodb": "^7.1.0",
37+
"nanoid": "^5.1.6",
3438
"openai": "^6.22.0",
3539
"papaparse": "^5.5.3",
40+
"react": "^19.2.4",
3641
"string-width": "^8.2.0",
3742
"xlsx": "^0.18.5"
3843
}

0 commit comments

Comments
 (0)