@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/addons/README.md +55 -3
- package/addons/clean-cache.js +48 -0
- package/addons/generate-readme.js +67 -0
- package/addons/git-stats.js +29 -0
- package/dist/index.mjs +1695 -750
- package/package.json +1 -1
- package/src/commands/commit.tsx +31 -49
- package/src/commands/watch.tsx +56 -0
- package/src/components/timeline/TimelineRunner.tsx +0 -7
- package/src/components/watch/WatchRunner.tsx +929 -0
- package/src/index.tsx +144 -110
- package/src/prompts/fewshot.ts +46 -286
- package/src/prompts/system.ts +71 -92
- package/src/utils/tools/builtins.ts +14 -10
- package/src/utils/watch.ts +307 -0
- package/LENS.md +0 -32
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 {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
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
|
-
.option(
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.option("--
|
|
85
|
-
.option("--
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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);
|