@ridit/lens 0.1.0

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.
Files changed (51) hide show
  1. package/LENS.md +25 -0
  2. package/LICENSE +21 -0
  3. package/README.md +0 -0
  4. package/dist/index.js +49363 -0
  5. package/package.json +38 -0
  6. package/src/colors.ts +1 -0
  7. package/src/commands/chat.tsx +23 -0
  8. package/src/commands/provider.tsx +224 -0
  9. package/src/commands/repo.tsx +120 -0
  10. package/src/commands/review.tsx +294 -0
  11. package/src/commands/task.tsx +36 -0
  12. package/src/commands/timeline.tsx +22 -0
  13. package/src/components/chat/ChatMessage.tsx +176 -0
  14. package/src/components/chat/ChatOverlays.tsx +329 -0
  15. package/src/components/chat/ChatRunner.tsx +732 -0
  16. package/src/components/provider/ApiKeyStep.tsx +243 -0
  17. package/src/components/provider/ModelStep.tsx +73 -0
  18. package/src/components/provider/ProviderTypeStep.tsx +54 -0
  19. package/src/components/provider/RemoveProviderStep.tsx +83 -0
  20. package/src/components/repo/DiffViewer.tsx +175 -0
  21. package/src/components/repo/FileReviewer.tsx +70 -0
  22. package/src/components/repo/FileViewer.tsx +60 -0
  23. package/src/components/repo/IssueFixer.tsx +666 -0
  24. package/src/components/repo/LensFileMenu.tsx +122 -0
  25. package/src/components/repo/NoProviderPrompt.tsx +28 -0
  26. package/src/components/repo/PreviewRunner.tsx +217 -0
  27. package/src/components/repo/ProviderPicker.tsx +76 -0
  28. package/src/components/repo/RepoAnalysis.tsx +343 -0
  29. package/src/components/repo/StepRow.tsx +69 -0
  30. package/src/components/task/TaskRunner.tsx +396 -0
  31. package/src/components/timeline/CommitDetail.tsx +274 -0
  32. package/src/components/timeline/CommitList.tsx +174 -0
  33. package/src/components/timeline/TimelineChat.tsx +167 -0
  34. package/src/components/timeline/TimelineRunner.tsx +1209 -0
  35. package/src/index.tsx +60 -0
  36. package/src/types/chat.ts +69 -0
  37. package/src/types/config.ts +20 -0
  38. package/src/types/repo.ts +42 -0
  39. package/src/utils/ai.ts +233 -0
  40. package/src/utils/chat.ts +833 -0
  41. package/src/utils/config.ts +61 -0
  42. package/src/utils/files.ts +104 -0
  43. package/src/utils/git.ts +155 -0
  44. package/src/utils/history.ts +86 -0
  45. package/src/utils/lensfile.ts +77 -0
  46. package/src/utils/llm.ts +81 -0
  47. package/src/utils/preview.ts +119 -0
  48. package/src/utils/repo.ts +69 -0
  49. package/src/utils/stats.ts +174 -0
  50. package/src/utils/thinking.tsx +191 -0
  51. package/tsconfig.json +24 -0
@@ -0,0 +1,60 @@
1
+ import React from "react";
2
+ import { Box, Text, useInput } from "ink";
3
+ import figures from "figures";
4
+ import { iconForFile } from "../../utils/files";
5
+ import type { ImportantFile } from "../../types/repo";
6
+
7
+ export const FileViewer = ({
8
+ file,
9
+ index,
10
+ total,
11
+ onBack,
12
+ }: {
13
+ file: ImportantFile;
14
+ index: number;
15
+ total: number;
16
+ onBack: () => void;
17
+ }) => {
18
+ useInput((_, key) => {
19
+ if (key.backspace || key.delete || key.leftArrow) onBack();
20
+ });
21
+
22
+ const lines = file.content.split("\n");
23
+
24
+ return (
25
+ <Box flexDirection="column">
26
+ <Box flexDirection="column" paddingX={1}>
27
+ {lines.map((line, i) => (
28
+ <Text key={i} color="white">
29
+ {line}
30
+ </Text>
31
+ ))}
32
+ </Box>
33
+
34
+ <Box
35
+ marginTop={1}
36
+ paddingX={1}
37
+ borderStyle="single"
38
+ borderColor="gray"
39
+ justifyContent="space-between"
40
+ >
41
+ <Text color="cyan">
42
+ {iconForFile(file.path)}
43
+ {" "}
44
+ {file.path}
45
+ </Text>
46
+ <Text color="gray">
47
+ {" "}
48
+ {lines.length} lines{" "}
49
+ {figures.bullet}
50
+ {" "}
51
+ {index + 1}/{total}
52
+ {" "}
53
+ {figures.bullet}
54
+ {" "}
55
+ {figures.arrowLeft} back
56
+ </Text>
57
+ </Box>
58
+ </Box>
59
+ );
60
+ };