@happy-nut/monacori 0.1.10 → 0.1.12
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/README.md +3 -22
- package/dist/app-main.js +67 -11
- package/dist/commands.js +57 -216
- package/dist/diff.js +33 -18
- package/dist/git.d.ts +1 -0
- package/dist/git.js +9 -0
- package/dist/i18n.js +10 -0
- package/dist/render.d.ts +1 -1
- package/dist/render.js +11 -2
- package/dist/util.js +13 -3
- package/dist/viewer.client.js +346 -37
- package/dist/viewer.css +94 -26
- package/package.json +1 -1
package/dist/git.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GitSnapshot } from "./types.js";
|
|
2
2
|
export declare function isGitRepository(root: string): boolean;
|
|
3
3
|
export declare function git(root: string, args: string[]): string;
|
|
4
|
+
export declare function repoRoot(cwd?: string): string;
|
|
4
5
|
export declare function readGitSnapshot(root: string): GitSnapshot;
|
package/dist/git.js
CHANGED
|
@@ -13,6 +13,15 @@ export function git(root, args) {
|
|
|
13
13
|
}
|
|
14
14
|
return (result.stdout ?? "").trim();
|
|
15
15
|
}
|
|
16
|
+
// Resolve the repository root. `git diff` and `git ls-files` print paths relative to it, and the
|
|
17
|
+
// desktop tree shows them as-is — so every filesystem read of those paths must resolve against the
|
|
18
|
+
// SAME root, not process.cwd(). When `mo` runs from a monorepo subdirectory (cwd != root), joining a
|
|
19
|
+
// repo-root-relative path onto cwd points at a file that doesn't exist, which surfaced as a diff with
|
|
20
|
+
// no source preview ("file is not present in the working tree"). Falls back to cwd outside a repo.
|
|
21
|
+
export function repoRoot(cwd = process.cwd()) {
|
|
22
|
+
const top = git(cwd, ["rev-parse", "--show-toplevel"]);
|
|
23
|
+
return top || cwd;
|
|
24
|
+
}
|
|
16
25
|
export function readGitSnapshot(root) {
|
|
17
26
|
return {
|
|
18
27
|
branch: git(root, ["branch", "--show-current"]),
|
package/dist/i18n.js
CHANGED
|
@@ -62,6 +62,9 @@ export const MESSAGES = {
|
|
|
62
62
|
"settings.cat.prompts": "Merge prompts",
|
|
63
63
|
// Settings — General
|
|
64
64
|
"settings.language": "Language",
|
|
65
|
+
"settings.theme": "Theme",
|
|
66
|
+
"theme.dark": "Dark",
|
|
67
|
+
"theme.light": "Light",
|
|
65
68
|
"settings.checkingUpdates": "Checking for updates…",
|
|
66
69
|
"settings.updateRestart": "Update & Restart",
|
|
67
70
|
"settings.upToDate": "Up to date",
|
|
@@ -126,6 +129,8 @@ export const MESSAGES = {
|
|
|
126
129
|
"merged.copied": "Copied",
|
|
127
130
|
"merged.copyFailed": "Copy failed",
|
|
128
131
|
"merged.close": "Close",
|
|
132
|
+
"dropdown.navigate": "Go to comment",
|
|
133
|
+
"dropdown.remove": "Remove",
|
|
129
134
|
"merged.qHeading": "# Questions",
|
|
130
135
|
"merged.cHeading": "# Change requests",
|
|
131
136
|
// Prompt memo (Cmd/Ctrl+Shift+N) — a single freeform Markdown scratchpad with a live split preview.
|
|
@@ -188,6 +193,9 @@ export const MESSAGES = {
|
|
|
188
193
|
"settings.cat.prompts": "병합 프롬프트",
|
|
189
194
|
// Settings — General
|
|
190
195
|
"settings.language": "언어",
|
|
196
|
+
"settings.theme": "테마",
|
|
197
|
+
"theme.dark": "다크",
|
|
198
|
+
"theme.light": "라이트",
|
|
191
199
|
"settings.checkingUpdates": "업데이트 확인 중…",
|
|
192
200
|
"settings.updateRestart": "업데이트 후 재시작",
|
|
193
201
|
"settings.upToDate": "최신 버전입니다",
|
|
@@ -252,6 +260,8 @@ export const MESSAGES = {
|
|
|
252
260
|
"merged.copied": "복사됨",
|
|
253
261
|
"merged.copyFailed": "복사 실패",
|
|
254
262
|
"merged.close": "닫기",
|
|
263
|
+
"dropdown.navigate": "코멘트로 이동",
|
|
264
|
+
"dropdown.remove": "지우기",
|
|
255
265
|
// Structural markers stay English in both locales (the preamble prose below follows the locale).
|
|
256
266
|
"merged.qHeading": "# Questions",
|
|
257
267
|
"merged.cHeading": "# Change requests",
|
package/dist/render.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function splitDiffForLazy(diffHtml: string, files: DiffFile[]): {
|
|
|
6
6
|
islands: string;
|
|
7
7
|
bodies: string[];
|
|
8
8
|
};
|
|
9
|
-
export declare function renderReviewStatus(
|
|
9
|
+
export declare function renderReviewStatus(_input: {
|
|
10
10
|
files: number;
|
|
11
11
|
hunks: number;
|
|
12
12
|
embeddedFiles: number;
|
package/dist/render.js
CHANGED
|
@@ -84,8 +84,14 @@ export function splitDiffForLazy(diffHtml, files) {
|
|
|
84
84
|
}
|
|
85
85
|
// The toolbar's review-status row (file/hunk counts, index + live status). Extracted so the in-place
|
|
86
86
|
// update path can re-render just this strip; renderDiffHtml wraps it in <div class="review-status">.
|
|
87
|
-
export function renderReviewStatus(
|
|
88
|
-
|
|
87
|
+
export function renderReviewStatus(_input) {
|
|
88
|
+
// Deliberately empty. The reviewer asked for a clean header: file/hunk counts duplicate the Changes
|
|
89
|
+
// tab, the raw generatedAt ISO string is unreadable, and "<embedded>/<total> indexed" is a STATIC
|
|
90
|
+
// ratio (not a live counter), so it reads as a frozen/broken progress number. Symbol-index progress
|
|
91
|
+
// now surfaces only as the thin footer-progress bar (setIndexProgress still drives it via null-guards);
|
|
92
|
+
// the "viewed" toggle is a separate button outside this strip, so it stays. `.review-status:empty`
|
|
93
|
+
// collapses the now-empty strip so it takes no space next to the breadcrumb.
|
|
94
|
+
return "";
|
|
89
95
|
}
|
|
90
96
|
export function renderDiffHtml(input) {
|
|
91
97
|
const totalHunks = input.files.reduce((sum, file) => sum + file.hunks.length, 0);
|
|
@@ -123,6 +129,7 @@ export function renderDiffHtml(input) {
|
|
|
123
129
|
: `<div class="tab-panel" id="files-panel">${sourceNav}</div>`,
|
|
124
130
|
"</div>",
|
|
125
131
|
`<div class="sidebar-footer"><span class="app-version">monacori${packageVersion ? " v" + escapeHtml(packageVersion) : ""}</span><span id="app-update-flag" class="app-update-flag hidden" data-i18n="sidebar.updateAvailable" data-i18n-title="settings.updateAvailable" title="Update available">update available</span><button type="button" id="terminal-toggle" class="settings-btn terminal-toggle hidden" data-i18n-title="terminal.toggle" title="Toggle terminal (Ctrl+\`)" aria-label="Toggle terminal"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 7l4 5-4 5"/><path d="M13 17h6"/></svg></button><button type="button" id="app-info-btn" class="settings-btn" aria-haspopup="dialog" data-i18n-aria="about.title" data-i18n-title="about.title" aria-label="About monacori" title="About monacori">⚙</button></div>`,
|
|
132
|
+
'<div id="footer-progress" class="footer-progress hidden" aria-hidden="true"><div class="footer-progress-bar"></div></div>',
|
|
126
133
|
"</aside>",
|
|
127
134
|
'<div class="sidebar-resizer" aria-hidden="true"></div>',
|
|
128
135
|
'<main class="content">',
|
|
@@ -174,6 +181,8 @@ export function renderDiffHtml(input) {
|
|
|
174
181
|
'<button type="button" id="app-info-update" class="plain-button app-info-update hidden" data-i18n="settings.updateRestart">Update & Restart</button>',
|
|
175
182
|
'<label class="settings-label" for="settings-language" data-i18n="settings.language">Language</label>',
|
|
176
183
|
'<select id="settings-language" class="settings-select"><option value="en">English</option><option value="ko">한국어</option></select>',
|
|
184
|
+
'<label class="settings-label" for="settings-theme" data-i18n="settings.theme">Theme</label>',
|
|
185
|
+
'<select id="settings-theme" class="settings-select"><option value="dark" data-i18n="theme.dark">Dark</option><option value="light" data-i18n="theme.light">Light</option></select>',
|
|
177
186
|
'<div class="app-info-keys">' +
|
|
178
187
|
'<div class="app-info-keys-h" data-i18n="settings.kbd.title">Keyboard shortcuts</div>' +
|
|
179
188
|
'<div class="keys-cat" data-i18n="settings.kbd.cat.nav">Navigation</div>' +
|
package/dist/util.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
1
|
+
import { closeSync, existsSync, openSync, readFileSync, readSync, readdirSync, statSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
export function stripHtmlTags(value) {
|
|
@@ -56,8 +56,18 @@ export function languageForPath(path) {
|
|
|
56
56
|
return "text";
|
|
57
57
|
}
|
|
58
58
|
export function isLikelyBinary(path) {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
// Read only the first 8KB — a NUL byte in the head is our binary heuristic. The previous version read
|
|
60
|
+
// the WHOLE file just to slice 8KB off it, which on a large repo means re-reading every tracked file
|
|
61
|
+
// in full on each build (a major chunk of the per-second watch cost).
|
|
62
|
+
const fd = openSync(path, "r");
|
|
63
|
+
try {
|
|
64
|
+
const buf = Buffer.alloc(8000);
|
|
65
|
+
const n = readSync(fd, buf, 0, 8000, 0);
|
|
66
|
+
return buf.subarray(0, n).includes(0);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
closeSync(fd);
|
|
70
|
+
}
|
|
61
71
|
}
|
|
62
72
|
export function readOption(args, name) {
|
|
63
73
|
const index = args.indexOf(name);
|