-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
107 lines (100 loc) Β· 4.02 KB
/
Copy pathcli.ts
File metadata and controls
107 lines (100 loc) Β· 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// CLI argument parsing and help text. The entry point (index.ts) prints HELP
// and exits; everything else is orchestration.
export const HELP = `revu β interactive diff reviewer
Usage:
revu [path] Review staged/unstaged changes in [path] (default: cwd)
revu --against <branch> Review all commits between <branch> and HEAD
revu --import <file.json> Seed annotations from an agent review, then triage
revu --export Build the review from .revu.json without the TUI
revu --against <branch> --push-pr
Post annotations as inline comments on the branch's PR
Options:
-h, --help Show this help
--no-watch Disable live diff reload (watch is on by default)
--import <file.json> Load annotations (tagged source: agent) for triage
--export Headless export β no TUI (for CI / agents)
--format <md|json> Export format (default: md)
--out <path> Export destination ('-' for stdout;
default: revu-review.md / .json)
--push-pr Post annotations to the current branch's GitHub PR
(requires --against; no network without this flag)
--dry-run With --push-pr, preview the payload without posting
Keys:
ββ / j k Move cursor
shift+ββ Select range
β΅ Annotate line / range
d Delete annotation on current line
v Cycle severity (blocker / concern / nitpick)
t Cycle triage status (open / accepted / dismissed / resolved)
] [ Jump to next / prev hunk
c C Jump to next / prev annotation
n p Next / prev file
{ } Scroll annotation preview up / down
β Back to file tree
e Export annotations to revu-review.md (with optional AI prompt)
s Settings (theme, view)
q Quit
Files:
.revu.json Autosaved annotations (JSON) β do not edit manually
revu-review.md Markdown export for AI review (press e to generate)`
export interface ParsedArgs {
help: boolean
againstBranch: string | null
rawTarget: string
exportMode: boolean
format: "md" | "json"
out: string | null
importPath: string | null
pushPr: boolean
dryRun: boolean
watch: boolean
}
export const parseArgs = (argv: string[]): ParsedArgs => {
const help = argv.includes("--help") || argv.includes("-h")
const pushPr = argv.includes("--push-pr")
const dryRun = argv.includes("--dry-run")
// Watch is on by default for the interactive reviewer; --no-watch opts out.
const watch = !argv.includes("--no-watch")
let againstBranch: string | null = null
let exportMode = false
let format: "md" | "json" = "md"
let out: string | null = null
let importPath: string | null = null
const positionalArgs: string[] = []
for (let i = 0; i < argv.length; i++) {
const a = argv[i]!
if (a === "--against" && argv[i + 1]) {
againstBranch = argv[++i]!
} else if (a === "--export") {
exportMode = true
} else if (a === "--format" && argv[i + 1]) {
format = argv[++i] === "json" ? "json" : "md"
} else if (a === "--out" && argv[i + 1]) {
out = argv[++i]!
} else if (a === "--import" && argv[i + 1]) {
importPath = argv[++i]!
} else if (
a === "--push-pr" ||
a === "--dry-run" ||
a === "--watch" ||
a === "--no-watch"
) {
// Boolean flags handled above via argv.includes.
} else {
positionalArgs.push(a)
}
}
const rawTarget = positionalArgs[0] ?? process.cwd()
return {
help,
againstBranch,
rawTarget,
exportMode,
format,
out,
importPath,
pushPr,
dryRun,
watch,
}
}