critique 0.1.87 → 0.1.103
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/AGENTS.md +11 -0
- package/CHANGELOG.md +105 -0
- package/README.md +8 -0
- package/global.d.ts +5 -0
- package/package.json +4 -4
- package/parsers-config.ts +11 -1
- package/queries/json/highlights.scm +42 -0
- package/scripts/fixtures/json-syntax-example.json +13 -0
- package/src/cli-scroll.test.tsx +66 -0
- package/src/cli.tsx +115 -72
- package/src/components/diff-view.test.tsx +119 -0
- package/src/components/diff-view.tsx +11 -1
- package/src/dropdown.test.tsx +62 -1
- package/src/dropdown.tsx +31 -24
- package/src/hooks/use-copy-selection.ts +1 -0
- package/src/image.test.ts +2 -2
- package/src/image.ts +8 -7
- package/src/license.ts +49 -10
- package/src/og-layout.test.ts +1 -1
- package/src/review/fixtures/tool-call-response.json +2 -2
- package/src/review/review-app.test.tsx +30 -30
- package/src/themes/cursor.json +35 -35
- package/src/web-utils.tsx +102 -11
- package/src/worker.tsx +62 -0
package/AGENTS.md
CHANGED
|
@@ -131,3 +131,14 @@ npx opensrc <owner>/<repo> # GitHub repo (e.g., npx opensrc vercel/ai)
|
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
<!-- opensrc:end -->
|
|
134
|
+
|
|
135
|
+
## opentui fork
|
|
136
|
+
|
|
137
|
+
we are using an opentui fork with name opentuah with my personal PRs merged
|
|
138
|
+
|
|
139
|
+
"@opentui/core": "npm:@opentuah/core@^0.1.80",
|
|
140
|
+
"@opentui/react": "npm:@opentuah/react@^0.1.80",
|
|
141
|
+
|
|
142
|
+
To find my opentui folder with that fork see kimaki projects via kimaki cli, the one named opentui.
|
|
143
|
+
|
|
144
|
+
To apply fixes there you must create a new branch and then merge it in the branch called opentuah. then publish and update the versions here. to publish there is a script specifically for opentuah.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,108 @@
|
|
|
1
|
+
# 0.1.103
|
|
2
|
+
|
|
3
|
+
- Syntax highlighting:
|
|
4
|
+
- JSON: render punctuation (quotes/brackets/separators) using comment color instead of operator red / full-bright
|
|
5
|
+
|
|
6
|
+
# 0.1.102
|
|
7
|
+
|
|
8
|
+
- `critique --web` / `critique web`:
|
|
9
|
+
- Render the upload notice block in a single muted color (no mixed emphasis)
|
|
10
|
+
|
|
11
|
+
# 0.1.101
|
|
12
|
+
|
|
13
|
+
- `critique` / `critique --web` / OG images:
|
|
14
|
+
- Pass `addedBg`/`removedBg` alongside content backgrounds so opentui's word-level highlights don't inherit dark defaults on light themes
|
|
15
|
+
- Keep a small `github-light`-only `addedWordBg` override to make added word highlights visible in images
|
|
16
|
+
|
|
17
|
+
# 0.1.100
|
|
18
|
+
|
|
19
|
+
- Dependencies:
|
|
20
|
+
- Update `@opentui/core` / `@opentui/react` npm aliases to `@opentuah/*@0.1.88`
|
|
21
|
+
- Remove `@opentuah/core-darwin-arm64` optional dependency (core pulls the correct platform binary via its own optional deps)
|
|
22
|
+
|
|
23
|
+
# 0.1.99
|
|
24
|
+
|
|
25
|
+
- `critique` / `critique review` / `critique web` / `critique hunks list`:
|
|
26
|
+
- Define `--filter <pattern>` as an array schema in goke so repeated flags are parsed explicitly as `string[]`
|
|
27
|
+
- `critique review`:
|
|
28
|
+
- Define `--session <id>` as an array schema so repeated session flags are handled natively
|
|
29
|
+
|
|
30
|
+
# 0.1.98
|
|
31
|
+
|
|
32
|
+
- Dependencies:
|
|
33
|
+
- Replace `@xmorse/cac` with `goke` for CLI argument parsing
|
|
34
|
+
|
|
35
|
+
# 0.1.97
|
|
36
|
+
|
|
37
|
+
- `README`:
|
|
38
|
+
- Make the `CodeRabbit` sponsor text clickable while keeping the compact logo link
|
|
39
|
+
|
|
40
|
+
# 0.1.96
|
|
41
|
+
|
|
42
|
+
- `README`:
|
|
43
|
+
- Add a bottom `Sponsors` section with a compact CodeRabbit logo link to `https://coderabbit.link/remorses`
|
|
44
|
+
|
|
45
|
+
# 0.1.95
|
|
46
|
+
|
|
47
|
+
- Syntax highlighting:
|
|
48
|
+
- `json`:
|
|
49
|
+
- Color JSON quote characters (`"`) separately as `punctuation.delimiter` while keeping string text highlighted as `property` (keys) and `string` (values)
|
|
50
|
+
|
|
51
|
+
# 0.1.94
|
|
52
|
+
|
|
53
|
+
- Syntax highlighting:
|
|
54
|
+
- Fix JSON syntax highlighting by using local query file with captures compatible with themes.ts (nvim-treesitter uses incompatible `#set!` and `#eq?` predicates)
|
|
55
|
+
- Fix syntax highlighting in web preview by pre-initializing TreeSitter client before rendering
|
|
56
|
+
|
|
57
|
+
# 0.1.93
|
|
58
|
+
|
|
59
|
+
- Dependencies:
|
|
60
|
+
- Update `@opentui/core` and `@opentui/react` npm aliases to `@opentuah/*@^0.1.81`
|
|
61
|
+
|
|
62
|
+
# 0.1.92
|
|
63
|
+
|
|
64
|
+
- `critique`:
|
|
65
|
+
- Keep dropdown search on `<textarea>` and fix filtering by syncing `plainText` from `onContentChange` in a microtask, plus extract shared filtering logic for deterministic matching across theme/file pickers
|
|
66
|
+
- Make watch-mode loading/empty backgrounds reactive to the selected theme by subscribing to `useAppStore` instead of reading `getState()` once
|
|
67
|
+
- `critique pick`:
|
|
68
|
+
- Use the active global theme for picker UI colors instead of always forcing the default theme
|
|
69
|
+
- `diff rendering`:
|
|
70
|
+
- Remount the `DiffView` wrapper on theme changes so internal diff backgrounds refresh more reliably when switching themes
|
|
71
|
+
- Tests:
|
|
72
|
+
- Add `src/components/diff-view.test.tsx` to verify theme-switch background updates in `DiffView`
|
|
73
|
+
- Add dropdown filtering coverage via exported `filterDropdownOptions` tests in `src/dropdown.test.tsx`
|
|
74
|
+
|
|
75
|
+
# 0.1.91
|
|
76
|
+
|
|
77
|
+
- `critique`:
|
|
78
|
+
- Improve main diff layout scrolling behavior by allowing the scrollbox to shrink within the column layout (`flexShrink: 1`)
|
|
79
|
+
- Tests:
|
|
80
|
+
- Add `src/cli-scroll.test.tsx` using opentui test renderer to verify mouse-wheel scrolling changes visible content in the main diff view
|
|
81
|
+
- Guard CLI entrypoint parsing with `import.meta.main` and export `App`/`AppProps` to support renderer-driven CLI view tests
|
|
82
|
+
|
|
83
|
+
# 0.1.90
|
|
84
|
+
|
|
85
|
+
- `critique`:
|
|
86
|
+
- Fix dropdown search input in file/theme pickers by switching to `<input onInput>` so typed text filters options immediately
|
|
87
|
+
- Ensure diff internals fully refresh on theme change by remounting `<diff>` when `themeName` changes
|
|
88
|
+
- Make loading/empty-state backgrounds reactive to theme changes in watch mode
|
|
89
|
+
- `critique pick`:
|
|
90
|
+
- Use the currently selected global theme instead of always forcing the default theme
|
|
91
|
+
- Tests:
|
|
92
|
+
- Add a dropdown regression test that reproduces and verifies theme search filtering
|
|
93
|
+
- Add a DiffView regression test that verifies diff background colors actually change after a runtime theme switch
|
|
94
|
+
|
|
95
|
+
# 0.1.89
|
|
96
|
+
|
|
97
|
+
- `critique`:
|
|
98
|
+
- Keep the main diff scrollbox focused so mouse-wheel scrolling works reliably in the default diff view
|
|
99
|
+
|
|
100
|
+
# 0.1.88
|
|
101
|
+
|
|
102
|
+
- Dependencies:
|
|
103
|
+
- Keep `@opentui/*` imports/package names and install Jake's fork via npm alias mapping
|
|
104
|
+
- Map `@opentui/core` -> `npm:@opentuah/core@latest` and `@opentui/react` -> `npm:@opentuah/react@latest`
|
|
105
|
+
|
|
1
106
|
# 0.1.87
|
|
2
107
|
|
|
3
108
|
- `hunks`:
|
package/README.md
CHANGED
|
@@ -318,6 +318,14 @@ Files with more than 6000 lines of diff are also hidden for performance.
|
|
|
318
318
|
- [diff](https://github.com/kpdecker/jsdiff) - Diff algorithm
|
|
319
319
|
- [Hono](https://hono.dev/) - Web framework for the preview worker
|
|
320
320
|
|
|
321
|
+
## Sponsors
|
|
322
|
+
|
|
323
|
+
<a href="https://coderabbit.link/remorses" target="_blank" rel="noopener noreferrer">
|
|
324
|
+
<img src="https://github.com/coderabbitai.png" alt="CodeRabbit" height="24" />
|
|
325
|
+
</a>
|
|
326
|
+
|
|
327
|
+
Sponsored by [CodeRabbit](https://coderabbit.link/remorses).
|
|
328
|
+
|
|
321
329
|
## License
|
|
322
330
|
|
|
323
331
|
MIT
|
package/global.d.ts
ADDED
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.1.
|
|
5
|
+
"version": "0.1.103",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
8
8
|
"bin": "./src/cli.tsx",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@agentclientprotocol/sdk": "^0.13.1",
|
|
30
30
|
"@clack/prompts": "1.0.0-alpha.9",
|
|
31
|
-
"@opentui/core": "
|
|
32
|
-
"@opentui/react": "
|
|
31
|
+
"@opentui/core": "npm:@opentuah/core@0.1.88",
|
|
32
|
+
"@opentui/react": "npm:@opentuah/react@0.1.88",
|
|
33
33
|
"@parcel/watcher": "^2.5.6",
|
|
34
|
-
"
|
|
34
|
+
"goke": "^6.1.3",
|
|
35
35
|
"diff": "^8.0.2",
|
|
36
36
|
"js-yaml": "^4.1.1",
|
|
37
37
|
"marked": "^17.0.1",
|
package/parsers-config.ts
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
// Warn: when taking queries from the nvim-treesitter repo, make sure to include the query dependencies as well
|
|
4
4
|
// marked with for example `; inherits: ecma` at the top of the file. Just put the dependencies before the actual query.
|
|
5
5
|
// ALSO: Some queries use breaking changes in the nvim-treesitter repo, that are not compatible with the (web-)tree-sitter parser.
|
|
6
|
+
import { resolve, dirname } from "path"
|
|
7
|
+
import { fileURLToPath } from "url"
|
|
8
|
+
|
|
9
|
+
// Local query files for languages where remote queries have incompatible predicates
|
|
10
|
+
import jsonHighlights from "./queries/json/highlights.scm" with { type: "file" }
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
13
|
+
|
|
6
14
|
export default {
|
|
7
15
|
parsers: [
|
|
8
16
|
{
|
|
@@ -164,7 +172,9 @@ export default {
|
|
|
164
172
|
wasm: "https://github.com/tree-sitter/tree-sitter-json/releases/download/v0.24.8/tree-sitter-json.wasm",
|
|
165
173
|
queries: {
|
|
166
174
|
highlights: [
|
|
167
|
-
|
|
175
|
+
// Local query file - nvim-treesitter and tree-sitter-json queries use predicates/captures
|
|
176
|
+
// incompatible with web-tree-sitter or themes.ts
|
|
177
|
+
resolve(__dirname, jsonHighlights),
|
|
168
178
|
],
|
|
169
179
|
},
|
|
170
180
|
},
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
; JSON highlights query for critique
|
|
2
|
+
; Uses captures compatible with themes.ts mappings
|
|
3
|
+
; No predicates (like #set! or #eq?) that are unsupported by web-tree-sitter
|
|
4
|
+
|
|
5
|
+
(pair
|
|
6
|
+
key: (string
|
|
7
|
+
(string_content) @property))
|
|
8
|
+
|
|
9
|
+
(pair
|
|
10
|
+
value: (string
|
|
11
|
+
(string_content) @string))
|
|
12
|
+
|
|
13
|
+
(array
|
|
14
|
+
(string
|
|
15
|
+
(string_content) @string))
|
|
16
|
+
|
|
17
|
+
(number) @number
|
|
18
|
+
|
|
19
|
+
[
|
|
20
|
+
(true)
|
|
21
|
+
(false)
|
|
22
|
+
] @boolean
|
|
23
|
+
|
|
24
|
+
(null) @constant
|
|
25
|
+
|
|
26
|
+
(escape_sequence) @string
|
|
27
|
+
|
|
28
|
+
; Keep JSON punctuation muted (not operator-red / not full-bright)
|
|
29
|
+
("\"") @comment
|
|
30
|
+
|
|
31
|
+
; JSON separators should render muted, not like operators
|
|
32
|
+
[
|
|
33
|
+
","
|
|
34
|
+
":"
|
|
35
|
+
] @comment
|
|
36
|
+
|
|
37
|
+
[
|
|
38
|
+
"["
|
|
39
|
+
"]"
|
|
40
|
+
"{"
|
|
41
|
+
"}"
|
|
42
|
+
] @comment
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Example JSON for critique syntax highlighting preview.",
|
|
3
|
+
"name": "critique",
|
|
4
|
+
"count": 12,
|
|
5
|
+
"enabled": true,
|
|
6
|
+
"ratio": 0.125,
|
|
7
|
+
"tags": ["diff", "tui", "web"],
|
|
8
|
+
"nested": {
|
|
9
|
+
"a": 1,
|
|
10
|
+
"b": null,
|
|
11
|
+
"url": "https://critique.work/v/example"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Tests mouse-wheel scrolling behavior in the main diff App scrollbox.
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { afterEach, describe, expect, it } from "bun:test"
|
|
5
|
+
import { act } from "react"
|
|
6
|
+
import { testRender } from "@opentui/react/test-utils"
|
|
7
|
+
import { App } from "./cli.tsx"
|
|
8
|
+
import type { ParsedFile } from "./diff-utils.ts"
|
|
9
|
+
|
|
10
|
+
function createParsedFile(index: number): ParsedFile {
|
|
11
|
+
const path = `src/file-${index.toString().padStart(2, "0")}.ts`
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
oldFileName: `a/${path}`,
|
|
15
|
+
newFileName: `b/${path}`,
|
|
16
|
+
hunks: [{ lines: [`+export const value${index} = ${index}`] }],
|
|
17
|
+
rawDiff: [
|
|
18
|
+
`diff --git a/${path} b/${path}`,
|
|
19
|
+
`--- a/${path}`,
|
|
20
|
+
`+++ b/${path}`,
|
|
21
|
+
"@@ -0,0 +1 @@",
|
|
22
|
+
`+export const value${index} = ${index}`,
|
|
23
|
+
].join("\n"),
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe("App scrollbox", () => {
|
|
28
|
+
let testSetup: Awaited<ReturnType<typeof testRender>>
|
|
29
|
+
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
if (testSetup) {
|
|
32
|
+
act(() => {
|
|
33
|
+
testSetup.renderer.destroy()
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("scrolls diff view content with mouse wheel", async () => {
|
|
39
|
+
const parsedFiles = Array.from({ length: 40 }, (_, index) => createParsedFile(index))
|
|
40
|
+
|
|
41
|
+
testSetup = await testRender(<App parsedFiles={parsedFiles} />, {
|
|
42
|
+
width: 80,
|
|
43
|
+
height: 20,
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
await act(async () => {
|
|
47
|
+
await testSetup.renderOnce()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const before = testSetup.captureCharFrame()
|
|
51
|
+
expect(before).toContain("file-00.ts")
|
|
52
|
+
expect(before).not.toContain("a/src/file-")
|
|
53
|
+
|
|
54
|
+
for (let i = 0; i < 20; i++) {
|
|
55
|
+
await act(async () => {
|
|
56
|
+
await testSetup.mockMouse.scroll(10, 10, "down")
|
|
57
|
+
await testSetup.renderOnce()
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const after = testSetup.captureCharFrame()
|
|
62
|
+
expect(after).not.toBe(before)
|
|
63
|
+
expect(after).toContain("a/src/file-")
|
|
64
|
+
expect(after).not.toContain("file-00.ts")
|
|
65
|
+
})
|
|
66
|
+
})
|