@ridit/lens 0.3.2 → 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/dist/index.mjs +1541 -264
- package/package.json +1 -1
- package/src/commands/commit.tsx +10 -2
- 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/utils/watch.ts +307 -0
package/package.json
CHANGED
package/src/commands/commit.tsx
CHANGED
|
@@ -144,7 +144,7 @@ Rules:
|
|
|
144
144
|
- Skip bullets that just restate the subject line or describe trivial version bumps
|
|
145
145
|
- Be specific — mention file names, feature names, component names
|
|
146
146
|
- No markdown, no backticks, no code blocks
|
|
147
|
-
- Output ONLY the commit message, nothing else
|
|
147
|
+
- Output ONLY the commit message, nothing else — no preamble, no explanation, no thinking
|
|
148
148
|
|
|
149
149
|
Examples of good short commits:
|
|
150
150
|
chore: bump version to 0.1.6
|
|
@@ -158,6 +158,13 @@ feat(chat): add persistent memory across sessions
|
|
|
158
158
|
- inject memory summary into system prompt on load
|
|
159
159
|
- expose /memory commands for manual management`;
|
|
160
160
|
|
|
161
|
+
function stripThinking(raw: string): string {
|
|
162
|
+
return raw
|
|
163
|
+
.replace(/<thinking>[\s\S]*?<\/thinking>/g, "")
|
|
164
|
+
.replace(/^[\s\n]+/, "")
|
|
165
|
+
.trim();
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
async function generateCommitMessage(
|
|
162
169
|
provider: Provider,
|
|
163
170
|
diff: string,
|
|
@@ -170,7 +177,8 @@ async function generateCommitMessage(
|
|
|
170
177
|
},
|
|
171
178
|
];
|
|
172
179
|
const raw = await callChat(provider, SYSTEM_PROMPT, msgs);
|
|
173
|
-
|
|
180
|
+
if (typeof raw !== "string") return "chore: update files";
|
|
181
|
+
return stripThinking(raw) || "chore: update files";
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
function trunc(s: string, n: number) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import figures from "figures";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { existsSync } from "fs";
|
|
6
|
+
import { WatchRunner } from "../components/watch/WatchRunner";
|
|
7
|
+
import { RED } from "../colors";
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
cmd: string;
|
|
11
|
+
path: string;
|
|
12
|
+
clean: boolean;
|
|
13
|
+
fixAll: boolean;
|
|
14
|
+
autoRestart: boolean;
|
|
15
|
+
prompt?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function WatchCommand({
|
|
19
|
+
cmd,
|
|
20
|
+
path: inputPath,
|
|
21
|
+
clean,
|
|
22
|
+
fixAll,
|
|
23
|
+
autoRestart,
|
|
24
|
+
prompt,
|
|
25
|
+
}: Props) {
|
|
26
|
+
const repoPath = path.resolve(inputPath);
|
|
27
|
+
|
|
28
|
+
if (!cmd.trim()) {
|
|
29
|
+
return (
|
|
30
|
+
<Box marginTop={1}>
|
|
31
|
+
<Text color={RED}>{figures.cross} Usage: lens watch "bun dev"</Text>
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!existsSync(repoPath)) {
|
|
37
|
+
return (
|
|
38
|
+
<Box marginTop={1}>
|
|
39
|
+
<Text color={RED}>
|
|
40
|
+
{figures.cross} Path not found: {repoPath}
|
|
41
|
+
</Text>
|
|
42
|
+
</Box>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<WatchRunner
|
|
48
|
+
cmd={cmd}
|
|
49
|
+
repoPath={repoPath}
|
|
50
|
+
clean={clean}
|
|
51
|
+
fixAll={fixAll}
|
|
52
|
+
autoRestart={autoRestart}
|
|
53
|
+
extraPrompt={prompt}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -1179,7 +1179,6 @@ export function TimelineRunner({
|
|
|
1179
1179
|
|
|
1180
1180
|
return (
|
|
1181
1181
|
<Box flexDirection="column">
|
|
1182
|
-
{/* header */}
|
|
1183
1182
|
<Box gap={2} marginBottom={1}>
|
|
1184
1183
|
<Text color={ACCENT} bold>
|
|
1185
1184
|
◈ TIMELINE
|
|
@@ -1195,7 +1194,6 @@ export function TimelineRunner({
|
|
|
1195
1194
|
)}
|
|
1196
1195
|
</Box>
|
|
1197
1196
|
|
|
1198
|
-
{/* status messages */}
|
|
1199
1197
|
<Static items={statusMsgs}>
|
|
1200
1198
|
{(msg) => (
|
|
1201
1199
|
<Box key={msg.id} paddingX={1} gap={1}>
|
|
@@ -1205,7 +1203,6 @@ export function TimelineRunner({
|
|
|
1205
1203
|
)}
|
|
1206
1204
|
</Static>
|
|
1207
1205
|
|
|
1208
|
-
{/* search bar */}
|
|
1209
1206
|
{isSearching && (
|
|
1210
1207
|
<Box gap={1} marginBottom={1}>
|
|
1211
1208
|
<Text color={ACCENT}>{"/"}</Text>
|
|
@@ -1218,7 +1215,6 @@ export function TimelineRunner({
|
|
|
1218
1215
|
</Box>
|
|
1219
1216
|
)}
|
|
1220
1217
|
|
|
1221
|
-
{/* commit list */}
|
|
1222
1218
|
{visible.map((commit, i) => {
|
|
1223
1219
|
const absIdx = scrollOffset + i;
|
|
1224
1220
|
const isSel = absIdx === selectedIdx;
|
|
@@ -1251,7 +1247,6 @@ export function TimelineRunner({
|
|
|
1251
1247
|
</Box>
|
|
1252
1248
|
)}
|
|
1253
1249
|
|
|
1254
|
-
{/* revert overlay */}
|
|
1255
1250
|
{isReverting && mode.type === "revert" && (
|
|
1256
1251
|
<RevertConfirm
|
|
1257
1252
|
commit={mode.commit}
|
|
@@ -1268,7 +1263,6 @@ export function TimelineRunner({
|
|
|
1268
1263
|
/>
|
|
1269
1264
|
)}
|
|
1270
1265
|
|
|
1271
|
-
{/* ask panel */}
|
|
1272
1266
|
{isAsking && provider && (
|
|
1273
1267
|
<AskPanel
|
|
1274
1268
|
commits={commits}
|
|
@@ -1281,7 +1275,6 @@ export function TimelineRunner({
|
|
|
1281
1275
|
/>
|
|
1282
1276
|
)}
|
|
1283
1277
|
|
|
1284
|
-
{/* shortcut bar */}
|
|
1285
1278
|
<Box marginTop={1}>
|
|
1286
1279
|
<Text color="gray" dimColor>
|
|
1287
1280
|
{shortcutHint}
|