critique 0.0.13 → 0.0.14

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.0.14
2
+
3
+ - Default command:
4
+ - Fix `/dev/null` appearing as filename for new/deleted files
5
+ - Simplify top navigation by removing "prev file" and "next file" text labels
6
+ - Move file counter from top to bottom navigation bar next to "select file"
7
+
1
8
  # 0.0.13
2
9
 
3
10
  - Default command:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "critique",
3
3
  "module": "src/diff.tsx",
4
4
  "type": "module",
5
- "version": "0.0.13",
5
+ "version": "0.0.14",
6
6
  "private": false,
7
7
  "bin": "./src/cli.tsx",
8
8
  "scripts": {
package/src/cli.tsx CHANGED
@@ -35,6 +35,17 @@ const IGNORED_FILES = [
35
35
 
36
36
  const BACKGROUND_COLOR = "#0f0f0f";
37
37
 
38
+ function getFileName(file: { oldFileName?: string; newFileName?: string }): string {
39
+ const newName = file.newFileName;
40
+ const oldName = file.oldFileName;
41
+
42
+ // Filter out /dev/null which appears for new/deleted files
43
+ if (newName && newName !== "/dev/null") return newName;
44
+ if (oldName && oldName !== "/dev/null") return oldName;
45
+
46
+ return "unknown";
47
+ }
48
+
38
49
  function execSyncWithError(
39
50
  command: string,
40
51
  options?: any,
@@ -147,7 +158,7 @@ function App({ parsedFiles }: AppProps) {
147
158
  );
148
159
  }
149
160
 
150
- const fileName = currentFile.newFileName || currentFile.oldFileName || "unknown";
161
+ const fileName = getFileName(currentFile);
151
162
 
152
163
  // Calculate additions and deletions
153
164
  let additions = 0;
@@ -160,7 +171,7 @@ function App({ parsedFiles }: AppProps) {
160
171
  });
161
172
 
162
173
  const dropdownOptions = parsedFiles.map((file, idx) => {
163
- const name = file.newFileName || file.oldFileName || "unknown";
174
+ const name = getFileName(file);
164
175
  return {
165
176
  title: name,
166
177
  value: String(idx),
@@ -200,18 +211,13 @@ function App({ parsedFiles }: AppProps) {
200
211
  {/* Navigation header */}
201
212
  <box style={{ paddingBottom: 1, paddingLeft: 1, paddingRight: 1, flexShrink: 0, flexDirection: "row", alignItems: "center" }}>
202
213
  <text fg="#ffffff">←</text>
203
- <text fg="#666666"> prev file</text>
204
214
  <box flexGrow={1} />
205
215
  <text onMouseDown={() => setShowDropdown(true)}>
206
216
  {fileName.trim()}
207
217
  </text>
208
218
  <text fg="#00ff00"> +{additions}</text>
209
- <text fg="#ff0000">-{deletions} </text>
210
- <text fg="#666666">
211
- ({validIndex + 1}/{parsedFiles.length})
212
- </text>
219
+ <text fg="#ff0000">-{deletions}</text>
213
220
  <box flexGrow={1} />
214
- <text fg="#666666">next file </text>
215
221
  <text fg="#ffffff">→</text>
216
222
  </box>
217
223
 
@@ -250,7 +256,8 @@ function App({ parsedFiles }: AppProps) {
250
256
  <text fg="#666666"> prev file</text>
251
257
  <box flexGrow={1} />
252
258
  <text fg="#ffffff">ctrl p</text>
253
- <text fg="#666666"> select file</text>
259
+ <text fg="#666666"> select file </text>
260
+ <text fg="#666666">({validIndex + 1}/{parsedFiles.length})</text>
254
261
  <box flexGrow={1} />
255
262
  <text fg="#666666">next file </text>
256
263
  <text fg="#ffffff">→</text>
@@ -307,7 +314,7 @@ cli
307
314
  const files = parsePatch(gitDiff);
308
315
 
309
316
  const filteredFiles = files.filter((file) => {
310
- const fileName = file.newFileName || file.oldFileName || "";
317
+ const fileName = getFileName(file);
311
318
  const baseName = fileName.split("/").pop() || "";
312
319
 
313
320
  if (IGNORED_FILES.includes(baseName) || baseName.endsWith(".lock")) {