critique 0.0.21 → 0.0.23
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 +11 -0
- package/package.json +1 -1
- package/src/cli.tsx +19 -16
- package/wrangler.jsonc +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# 0.0.23
|
|
2
|
+
|
|
3
|
+
- Web preview:
|
|
4
|
+
- Use unified diff (instead of split view) when `--cols < 150` for better mobile readability
|
|
5
|
+
|
|
6
|
+
# 0.0.22
|
|
7
|
+
|
|
8
|
+
- Web preview:
|
|
9
|
+
- Rename `--width`/`--height` options to `--cols`/`--rows` for clarity
|
|
10
|
+
- Add hint in help text: use `--cols ~100` for mobile-friendly output
|
|
11
|
+
|
|
1
12
|
# 0.0.21
|
|
2
13
|
|
|
3
14
|
- Update `@xmorse/bun-pty` to 0.4.0
|
package/package.json
CHANGED
package/src/cli.tsx
CHANGED
|
@@ -676,8 +676,8 @@ cli
|
|
|
676
676
|
.command("web [ref]", "Generate web preview of diff")
|
|
677
677
|
.option("--staged", "Show staged changes")
|
|
678
678
|
.option("--commit <ref>", "Show changes from a specific commit")
|
|
679
|
-
.option("--
|
|
680
|
-
.option("--
|
|
679
|
+
.option("--cols <cols>", "Number of columns for rendering (use ~100 for mobile)", { default: 240 })
|
|
680
|
+
.option("--rows <rows>", "Number of rows for rendering", { default: 2000 })
|
|
681
681
|
.option("--local", "Open local preview instead of uploading")
|
|
682
682
|
.action(async (ref, options) => {
|
|
683
683
|
const pty = await import("@xmorse/bun-pty");
|
|
@@ -690,8 +690,8 @@ cli
|
|
|
690
690
|
return "git add -N . && git diff --no-prefix";
|
|
691
691
|
})();
|
|
692
692
|
|
|
693
|
-
const
|
|
694
|
-
const
|
|
693
|
+
const cols = parseInt(options.cols) || 240;
|
|
694
|
+
const rows = parseInt(options.rows) || 2000;
|
|
695
695
|
|
|
696
696
|
console.log("Capturing diff output...");
|
|
697
697
|
|
|
@@ -713,12 +713,12 @@ cli
|
|
|
713
713
|
process.argv[1]!, // path to cli.tsx
|
|
714
714
|
"web-render",
|
|
715
715
|
diffFile,
|
|
716
|
-
"--
|
|
717
|
-
"--
|
|
716
|
+
"--cols", String(cols),
|
|
717
|
+
"--rows", String(rows),
|
|
718
718
|
], {
|
|
719
719
|
name: "xterm-256color",
|
|
720
|
-
cols:
|
|
721
|
-
rows:
|
|
720
|
+
cols: cols,
|
|
721
|
+
rows: rows,
|
|
722
722
|
|
|
723
723
|
cwd: process.cwd(),
|
|
724
724
|
env: { ...process.env, TERM: "xterm-256color" } as Record<string, string>,
|
|
@@ -752,7 +752,7 @@ cli
|
|
|
752
752
|
}
|
|
753
753
|
|
|
754
754
|
// Convert ANSI to HTML document
|
|
755
|
-
const html = ansiToHtmlDocument(ansiOutput, { cols
|
|
755
|
+
const html = ansiToHtmlDocument(ansiOutput, { cols, rows });
|
|
756
756
|
|
|
757
757
|
if (options.local) {
|
|
758
758
|
// Save locally and open
|
|
@@ -812,11 +812,11 @@ cli
|
|
|
812
812
|
// Internal command for web rendering (captures output to PTY)
|
|
813
813
|
cli
|
|
814
814
|
.command("web-render <diffFile>", "Internal: Render diff for web capture", { allowUnknownOptions: true })
|
|
815
|
-
.option("--
|
|
816
|
-
.option("--
|
|
815
|
+
.option("--cols <cols>", "Terminal columns", { default: 120 })
|
|
816
|
+
.option("--rows <rows>", "Terminal rows", { default: 1000 })
|
|
817
817
|
.action(async (diffFile: string, options) => {
|
|
818
|
-
const
|
|
819
|
-
const
|
|
818
|
+
const cols = parseInt(options.cols) || 120;
|
|
819
|
+
const rows = parseInt(options.rows) || 40;
|
|
820
820
|
|
|
821
821
|
const [diffModule, { parsePatch }] = await Promise.all([
|
|
822
822
|
import("./diff.tsx"),
|
|
@@ -850,8 +850,8 @@ cli
|
|
|
850
850
|
const { FileEditPreview, ErrorBoundary } = diffModule;
|
|
851
851
|
|
|
852
852
|
// Override terminal size
|
|
853
|
-
process.stdout.columns =
|
|
854
|
-
process.stdout.rows =
|
|
853
|
+
process.stdout.columns = cols;
|
|
854
|
+
process.stdout.rows = rows;
|
|
855
855
|
|
|
856
856
|
const renderer = await createCliRenderer({
|
|
857
857
|
exitOnCtrlC: false,
|
|
@@ -872,6 +872,9 @@ cli
|
|
|
872
872
|
}, 100);
|
|
873
873
|
};
|
|
874
874
|
|
|
875
|
+
// Use unified diff for narrow viewports (mobile), split view for wider ones
|
|
876
|
+
const useSplitView = cols >= 150;
|
|
877
|
+
|
|
875
878
|
// Static component - no hooks that cause re-renders
|
|
876
879
|
function WebApp() {
|
|
877
880
|
return (
|
|
@@ -897,7 +900,7 @@ cli
|
|
|
897
900
|
<FileEditPreview
|
|
898
901
|
hunks={file.hunks}
|
|
899
902
|
paddingLeft={0}
|
|
900
|
-
splitView={
|
|
903
|
+
splitView={useSplitView}
|
|
901
904
|
filePath={fileName}
|
|
902
905
|
/>
|
|
903
906
|
</box>
|
package/wrangler.jsonc
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"main": "src/worker.ts",
|
|
5
5
|
"compatibility_date": "2025-05-26",
|
|
6
6
|
"compatibility_flags": ["nodejs_compat"],
|
|
7
|
+
"workers_dev": true,
|
|
7
8
|
|
|
8
9
|
// KV Namespace binding for storing HTML content
|
|
9
10
|
"kv_namespaces": [
|
|
@@ -11,5 +12,11 @@
|
|
|
11
12
|
"binding": "CRITIQUE_KV",
|
|
12
13
|
"id": "844b10c9fea049c8b20fa4a8c5cae44e"
|
|
13
14
|
}
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
// Custom domain
|
|
18
|
+
"routes": [
|
|
19
|
+
{ "pattern": "critique.work", "custom_domain": true },
|
|
20
|
+
{ "pattern": "www.critique.work", "custom_domain": true }
|
|
14
21
|
]
|
|
15
22
|
}
|