critique 0.1.10 → 0.1.11
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 +8 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/screenshot.png +0 -0
- package/src/ansi-html.ts +5 -5
- package/src/cli.tsx +10 -4
- package/diff-viewer-demo.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# 0.1.11
|
|
2
|
+
|
|
3
|
+
- All commands:
|
|
4
|
+
- Add support for passing file filters as positional args after `--` (e.g. `critique web -- src/cli.tsx`)
|
|
5
|
+
- Web command:
|
|
6
|
+
- Add `--title` option for custom HTML document title
|
|
7
|
+
- Add scrollbar styling to HTML output (dark/light mode aware)
|
|
8
|
+
|
|
1
9
|
# 0.1.10
|
|
2
10
|
|
|
3
11
|
- Default command:
|
package/README.md
CHANGED
package/package.json
CHANGED
package/screenshot.png
ADDED
|
Binary file
|
package/src/ansi-html.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface AnsiToHtmlOptions {
|
|
|
15
15
|
trimEmptyLines?: boolean
|
|
16
16
|
/** Enable auto light/dark mode based on system preference */
|
|
17
17
|
autoTheme?: boolean
|
|
18
|
+
/** HTML document title */
|
|
19
|
+
title?: string
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -129,6 +131,7 @@ export function ansiToHtmlDocument(input: string | Buffer, options: AnsiToHtmlOp
|
|
|
129
131
|
textColor = "#1a1a1a",
|
|
130
132
|
fontFamily = "Monaco, Menlo, 'Ubuntu Mono', Consolas, monospace",
|
|
131
133
|
fontSize = "14px",
|
|
134
|
+
title = "Critique Diff",
|
|
132
135
|
} = options
|
|
133
136
|
|
|
134
137
|
const content = ansiToHtml(input, options)
|
|
@@ -143,7 +146,7 @@ export function ansiToHtmlDocument(input: string | Buffer, options: AnsiToHtmlOp
|
|
|
143
146
|
<head>
|
|
144
147
|
<meta charset="utf-8">
|
|
145
148
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
146
|
-
<title
|
|
149
|
+
<title>${escapeHtml(title)}</title>
|
|
147
150
|
<style>
|
|
148
151
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
149
152
|
html {
|
|
@@ -189,10 +192,7 @@ ${options.autoTheme ? `@media (prefers-color-scheme: light) {
|
|
|
189
192
|
html {
|
|
190
193
|
filter: invert(1) hue-rotate(180deg);
|
|
191
194
|
}
|
|
192
|
-
}` : ''}
|
|
193
|
-
</style>
|
|
194
|
-
</head>
|
|
195
|
-
<body>
|
|
195
|
+
}` : ''}\nhtml{scrollbar-width:thin;scrollbar-color:#6b7280 #2d3748;}@media(prefers-color-scheme:light){html{scrollbar-color:#a0aec0 #edf2f7;}}::-webkit-scrollbar{width:12px;}::-webkit-scrollbar-track{background:#2d3748;}::-webkit-scrollbar-thumb{background:#6b7280;border-radius:6px;}::-webkit-scrollbar-thumb:hover{background:#a0aec0;}@media(prefers-color-scheme:light){::-webkit-scrollbar-track{background:#edf2f7;}::-webkit-scrollbar-thumb{background:#a0aec0;}::-webkit-scrollbar-thumb:hover{background:#cbd5e1;}}::-webkit-scrollbar {\n width: 12px;\n}\n::-webkit-scrollbar-track {\n background: #2d3748;\n}\n::-webkit-scrollbar-thumb {\n background: #6b7280;\n border-radius: 6px;\n}\n::-webkit-scrollbar-thumb:hover {\n background: #a0aec0;\n}\n@media (prefers-color-scheme: light) {\n ::-webkit-scrollbar-track {\n background: #edf2f7;\n }\n ::-webkit-scrollbar-thumb {\n background: #a0aec0;\n }\n ::-webkit-scrollbar-thumb:hover {\n background: #cbd5e1;\n }\n}\n</style>\n</head>\n<body>
|
|
196
196
|
<div id="content">
|
|
197
197
|
${content}
|
|
198
198
|
</div>
|
package/src/cli.tsx
CHANGED
|
@@ -566,7 +566,10 @@ cli
|
|
|
566
566
|
.action(async (base, head, options) => {
|
|
567
567
|
try {
|
|
568
568
|
const contextArg = options.context ? `-U${options.context}` : "";
|
|
569
|
-
|
|
569
|
+
// Combine --filter options with positional args after --
|
|
570
|
+
const filterOptions = options.filter ? (Array.isArray(options.filter) ? options.filter : [options.filter]) : [];
|
|
571
|
+
const positionalFilters = options['--'] || [];
|
|
572
|
+
const filters = [...filterOptions, ...positionalFilters];
|
|
570
573
|
const filterArg = filters.length > 0 ? `-- ${filters.map((f: string) => `"${f}"`).join(" ")}` : "";
|
|
571
574
|
const gitCommand = (() => {
|
|
572
575
|
if (options.staged)
|
|
@@ -1031,12 +1034,16 @@ cli
|
|
|
1031
1034
|
.option("--context <lines>", "Number of context lines (default: 3)")
|
|
1032
1035
|
.option("--theme <name>", "Theme to use for rendering")
|
|
1033
1036
|
.option("--filter <pattern>", "Filter files by glob pattern (can be used multiple times)")
|
|
1037
|
+
.option("--title <title>", "HTML document title")
|
|
1034
1038
|
.action(async (base, head, options) => {
|
|
1035
1039
|
const pty = await import("@xmorse/bun-pty");
|
|
1036
1040
|
const { ansiToHtmlDocument } = await import("./ansi-html.ts");
|
|
1037
1041
|
|
|
1038
1042
|
const contextArg = options.context ? `-U${options.context}` : "";
|
|
1039
|
-
|
|
1043
|
+
// Combine --filter options with positional args after --
|
|
1044
|
+
const filterOptions = options.filter ? (Array.isArray(options.filter) ? options.filter : [options.filter]) : [];
|
|
1045
|
+
const positionalFilters = options['--'] || [];
|
|
1046
|
+
const filters = [...filterOptions, ...positionalFilters];
|
|
1040
1047
|
const filterArg = filters.length > 0 ? `-- ${filters.map((f: string) => `"${f}"`).join(" ")}` : "";
|
|
1041
1048
|
const gitCommand = (() => {
|
|
1042
1049
|
if (options.staged)
|
|
@@ -1133,7 +1140,7 @@ cli
|
|
|
1133
1140
|
const backgroundColor = rgbaToHex(theme.background);
|
|
1134
1141
|
const textColor = rgbaToHex(theme.text);
|
|
1135
1142
|
|
|
1136
|
-
return ansiToHtmlDocument(ansiOutput, { cols, rows: renderRows, backgroundColor, textColor, autoTheme: !customTheme });
|
|
1143
|
+
return ansiToHtmlDocument(ansiOutput, { cols, rows: renderRows, backgroundColor, textColor, autoTheme: !customTheme, title: options.title });
|
|
1137
1144
|
}
|
|
1138
1145
|
|
|
1139
1146
|
// Generate desktop and mobile versions in parallel
|
|
@@ -1376,5 +1383,4 @@ cli
|
|
|
1376
1383
|
|
|
1377
1384
|
cli.help();
|
|
1378
1385
|
cli.version("1.0.0");
|
|
1379
|
-
// comment
|
|
1380
1386
|
cli.parse();
|
package/diff-viewer-demo.png
DELETED
|
Binary file
|