@ridit/lens 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.tsx CHANGED
@@ -1,110 +1,144 @@
1
- import React from "react";
2
- import "./utils/tools/registry";
3
- import { render } from "ink";
4
- import { Command } from "commander";
5
- import { RepoCommand } from "./commands/repo";
6
- import { InitCommand } from "./commands/provider";
7
- import { ReviewCommand } from "./commands/review";
8
- import { TaskCommand } from "./commands/task";
9
- import { ChatCommand } from "./commands/chat";
10
- import { TimelineCommand } from "./commands/timeline";
11
- import { CommitCommand } from "./commands/commit";
12
- import { registerBuiltins } from "./utils/tools/builtins";
13
- import { loadAddons } from "./utils/addons/loadAddons";
14
-
15
- registerBuiltins();
16
- await loadAddons();
17
-
18
- const program = new Command();
19
-
20
- program
21
- .command("stalk <url>")
22
- .alias("repo")
23
- .description("Analyze a remote repository")
24
- .action((url) => {
25
- render(<RepoCommand url={url} />);
26
- });
27
-
28
- program
29
- .command("provider")
30
- .description("Configure AI providers")
31
- .action(() => {
32
- render(<InitCommand />);
33
- });
34
-
35
- program
36
- .command("judge [path]")
37
- .alias("review")
38
- .description("Review a local codebase")
39
- .action((inputPath) => {
40
- render(<ReviewCommand path={inputPath ?? "."} />);
41
- });
42
-
43
- program
44
- .command("cook <text>")
45
- .alias("task")
46
- .description("Apply a natural language change to the codebase")
47
- .option("-p, --path <path>", "Path to the repo", ".")
48
- .action((text: string, opts: { path: string }) => {
49
- render(<TaskCommand prompt={text} path={opts.path} />);
50
- });
51
-
52
- program
53
- .command("vibe")
54
- .alias("chat")
55
- .description("Chat with your codebase — ask questions or make changes")
56
- .option("-p, --path <path>", "Path to the repo", ".")
57
- .action((opts: { path: string }) => {
58
- render(<ChatCommand path={opts.path} />);
59
- });
60
-
61
- program
62
- .command("history")
63
- .alias("timeline")
64
- .description(
65
- "Explore your code history — see commits, changes, and evolution",
66
- )
67
- .option("-p, --path <path>", "Path to the repo", ".")
68
- .action((opts: { path: string }) => {
69
- render(<TimelineCommand path={opts.path} />);
70
- });
71
-
72
- program
73
- .command("crimes [files...]")
74
- .alias("commit")
75
- .description(
76
- "Generate a smart conventional commit message from staged changes or specific files",
77
- )
78
- .option("-p, --path <path>", "Path to the repo", ".")
79
- .option(
80
- "--auto",
81
- "Stage all changes (or the given files) and commit without confirmation",
82
- )
83
- .option("--confirm", "Show preview before committing even when using --auto")
84
- .option("--preview", "Show the generated message without committing")
85
- .option("--push", "Push to remote after committing")
86
- .action(
87
- (
88
- files: string[],
89
- opts: {
90
- path: string;
91
- auto: boolean;
92
- confirm: boolean;
93
- preview: boolean;
94
- push: boolean;
95
- },
96
- ) => {
97
- render(
98
- <CommitCommand
99
- path={opts.path}
100
- files={files ?? []}
101
- auto={opts.auto ?? false}
102
- confirm={opts.confirm ?? false}
103
- preview={opts.preview ?? false}
104
- push={opts.push ?? false}
105
- />,
106
- );
107
- },
108
- );
109
-
110
- program.parse(process.argv);
1
+ import React from "react";
2
+ import "./utils/tools/registry";
3
+ import { render } from "ink";
4
+ import { Command } from "commander";
5
+ import { RepoCommand } from "./commands/repo";
6
+ import { InitCommand } from "./commands/provider";
7
+ import { ReviewCommand } from "./commands/review";
8
+ import { TaskCommand } from "./commands/task";
9
+ import { ChatCommand } from "./commands/chat";
10
+ import { WatchCommand } from "./commands/watch";
11
+ import { TimelineCommand } from "./commands/timeline";
12
+ import { CommitCommand } from "./commands/commit";
13
+ import { registerBuiltins } from "./utils/tools/builtins";
14
+ import { loadAddons } from "./utils/addons/loadAddons";
15
+
16
+ registerBuiltins();
17
+ await loadAddons();
18
+
19
+ const program = new Command();
20
+
21
+ program
22
+ .command("stalk <url>")
23
+ .alias("repo")
24
+ .description("Analyze a remote repository")
25
+ .action((url) => {
26
+ render(<RepoCommand url={url} />);
27
+ });
28
+
29
+ program
30
+ .command("provider")
31
+ .description("Configure AI providers")
32
+ .action(() => {
33
+ render(<InitCommand />);
34
+ });
35
+
36
+ program
37
+ .command("judge [path]")
38
+ .alias("review")
39
+ .description("Review a local codebase")
40
+ .action((inputPath) => {
41
+ render(<ReviewCommand path={inputPath ?? "."} />);
42
+ });
43
+
44
+ program
45
+ .command("cook <text>")
46
+ .alias("task")
47
+ .description("Apply a natural language change to the codebase")
48
+ .option("-p, --path <path>", "Path to the repo", ".")
49
+ .action((text: string, opts: { path: string }) => {
50
+ render(<TaskCommand prompt={text} path={opts.path} />);
51
+ });
52
+
53
+ program
54
+ .command("vibe")
55
+ .alias("chat")
56
+ .description("Chat with your codebase ask questions or make changes")
57
+ .option("-p, --path <path>", "Path to the repo", ".")
58
+ .action((opts: { path: string }) => {
59
+ render(<ChatCommand path={opts.path} />);
60
+ });
61
+
62
+ program
63
+ .command("history")
64
+ .alias("timeline")
65
+ .description(
66
+ "Explore your code history — see commits, changes, and evolution",
67
+ )
68
+ .option("-p, --path <path>", "Path to the repo", ".")
69
+ .action((opts: { path: string }) => {
70
+ render(<TimelineCommand path={opts.path} />);
71
+ });
72
+
73
+ program
74
+ .command("crimes [files...]")
75
+ .alias("commit")
76
+ .description(
77
+ "Generate a smart conventional commit message from staged changes or specific files",
78
+ )
79
+ .option("-p, --path <path>", "Path to the repo", ".")
80
+ .option(
81
+ "--auto",
82
+ "Stage all changes (or the given files) and commit without confirmation",
83
+ )
84
+ .option("--confirm", "Show preview before committing even when using --auto")
85
+ .option("--preview", "Show the generated message without committing")
86
+ .option("--push", "Push to remote after committing")
87
+ .action(
88
+ (
89
+ files: string[],
90
+ opts: {
91
+ path: string;
92
+ auto: boolean;
93
+ confirm: boolean;
94
+ preview: boolean;
95
+ push: boolean;
96
+ },
97
+ ) => {
98
+ render(
99
+ <CommitCommand
100
+ path={opts.path}
101
+ files={files ?? []}
102
+ auto={opts.auto ?? false}
103
+ confirm={opts.confirm ?? false}
104
+ preview={opts.preview ?? false}
105
+ push={opts.push ?? false}
106
+ />,
107
+ );
108
+ },
109
+ );
110
+
111
+ program
112
+ .command("watch <cmd>")
113
+ .alias("spy")
114
+ .description("Watch a dev command and get AI suggestions for errors")
115
+ .option("-p, --path <path>", "Path to the repo", ".")
116
+ .option("--clean", "Only show AI suggestions, hide raw logs")
117
+ .option("--fix-all", "Auto-apply fixes as errors are detected")
118
+ .option("--auto-restart", "Automatically re-run the command after a crash")
119
+ .option("--prompt <text>", "Extra context for the AI about your project")
120
+ .action(
121
+ (
122
+ cmd: string,
123
+ opts: {
124
+ path: string;
125
+ clean: boolean;
126
+ fixAll: boolean;
127
+ autoRestart: boolean;
128
+ prompt?: string;
129
+ },
130
+ ) => {
131
+ render(
132
+ <WatchCommand
133
+ cmd={cmd}
134
+ path={opts.path}
135
+ clean={opts.clean ?? false}
136
+ fixAll={opts.fixAll ?? false}
137
+ autoRestart={opts.autoRestart ?? false}
138
+ prompt={opts.prompt}
139
+ />,
140
+ );
141
+ },
142
+ );
143
+
144
+ program.parse(process.argv);