codex-plus-patcher 0.7.0 → 0.7.2
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 +2 -1
- package/package.json +2 -2
- package/src/cli.js +94 -0
- package/src/core/asar.js +6 -4
- package/src/core/dev-mode.js +339 -0
- package/src/core/plugin-audit.js +1605 -0
- package/src/patches/26.623.41415-4505.js +44 -0
- package/src/patches/26.623.42026-4514.js +44 -0
- package/src/patches/index.js +10 -1
- package/src/patches/lib/common-patches.js +621 -195
- package/src/patches/lib/hooks/message-composer.js +1 -1
- package/src/patches/lib/hooks/project-selector.js +2 -2
- package/src/patches/lib/hooks/review.js +4 -2
- package/src/patches/lib/hooks/settings-commands.js +3 -2
- package/src/patches/lib/hooks/sidebar.js +1 -6
- package/src/patches/lib/project-selector-shortcut-patch.js +141 -2
- package/src/runtime/api/index.js +3 -0
- package/src/runtime/assets.js +4 -4
- package/src/runtime/host/projectSelector.js +5 -1
- package/src/runtime/plugins/mermaidFullscreen.js +19 -6
- package/src/runtime/plugins/nestedRepositories.js +72 -11
- package/src/runtime/plugins/projectColors.js +96 -7
- package/src/runtime/plugins/projectSelectorShortcut.js +67 -12
- package/src/runtime/plugins/sidebarNameBlur.js +1 -1
- package/src/runtime/plugins/userBubbleColors.js +4 -0
|
@@ -36,14 +36,71 @@
|
|
|
36
36
|
].map((value) => normalizeForFzf(value).text.trim()).filter(Boolean).join(" ");
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function projectSearchFields(project) {
|
|
40
|
+
return [
|
|
41
|
+
{ text: project?.label, weight: 0 },
|
|
42
|
+
{ text: project?.repositoryData?.rootFolder, weight: 10 },
|
|
43
|
+
{ text: project?.hostDisplayName, weight: 20 },
|
|
44
|
+
{ text: project?.path, weight: 40 },
|
|
45
|
+
].map((field) => ({ ...field, text: normalizeForFzf(field.text).text.trim() })).filter((field) => field.text);
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
function fzfConstructor() {
|
|
40
49
|
return window.fzf?.Fzf;
|
|
41
50
|
}
|
|
42
51
|
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
function fallbackPositions(text, query) {
|
|
53
|
+
const normalizedText = normalizeForFzf(text);
|
|
54
|
+
const normalizedQuery = normalizeForFzf(query).text.trim().toLowerCase();
|
|
55
|
+
if (!normalizedText.text || !normalizedQuery) return null;
|
|
56
|
+
|
|
57
|
+
const haystack = normalizedText.text.toLowerCase();
|
|
58
|
+
const positions = [];
|
|
59
|
+
let cursor = 0;
|
|
60
|
+
|
|
61
|
+
for (const char of normalizedQuery) {
|
|
62
|
+
cursor = haystack.indexOf(char, cursor);
|
|
63
|
+
if (cursor === -1) return null;
|
|
64
|
+
positions.push(cursor);
|
|
65
|
+
cursor += 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return positions;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function fallbackScore(text, query) {
|
|
72
|
+
const positions = fallbackPositions(text, query);
|
|
73
|
+
if (positions == null) return null;
|
|
74
|
+
|
|
75
|
+
let score = positions[0] + (positions[positions.length - 1] - positions[0]);
|
|
76
|
+
for (let index = 1; index < positions.length; index += 1) {
|
|
77
|
+
score += positions[index] - positions[index - 1] - 1;
|
|
78
|
+
}
|
|
79
|
+
for (const position of positions) {
|
|
80
|
+
if (position === 0 || /\s/.test(text[position - 1] ?? "")) score -= 2;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return score;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function rankedFilter(items, query) {
|
|
87
|
+
return items
|
|
88
|
+
.map((item, index) => {
|
|
89
|
+
const scores = projectSearchFields(item)
|
|
90
|
+
.map((field) => {
|
|
91
|
+
const score = fallbackScore(field.text, query);
|
|
92
|
+
return score == null ? null : score + field.weight;
|
|
93
|
+
})
|
|
94
|
+
.filter((score) => score != null);
|
|
95
|
+
return { item, index, score: scores.length === 0 ? null : Math.min(...scores) };
|
|
96
|
+
})
|
|
97
|
+
.filter((entry) => entry.score != null)
|
|
98
|
+
.sort((left, right) =>
|
|
99
|
+
left.score - right.score ||
|
|
100
|
+
projectSearchText(left.item).length - projectSearchText(right.item).length ||
|
|
101
|
+
left.index - right.index,
|
|
102
|
+
)
|
|
103
|
+
.map((entry) => entry.item);
|
|
47
104
|
}
|
|
48
105
|
|
|
49
106
|
function fuzzyFilter(items, query) {
|
|
@@ -51,18 +108,16 @@
|
|
|
51
108
|
const normalizedQuery = normalizeForFzf(query).text.trim();
|
|
52
109
|
if (!normalizedQuery) return list;
|
|
53
110
|
|
|
54
|
-
|
|
55
|
-
if (typeof Fzf !== "function") return fallbackFilter(list, query);
|
|
56
|
-
|
|
57
|
-
return new Fzf(
|
|
58
|
-
list.map((project) => ({ project, searchText: projectSearchText(project) })),
|
|
59
|
-
{ selector: (entry) => entry.searchText },
|
|
60
|
-
).find(normalizedQuery).map((entry) => entry.item.project);
|
|
111
|
+
return rankedFilter(list, query);
|
|
61
112
|
}
|
|
62
113
|
|
|
63
114
|
function labelPositions(text, query) {
|
|
64
115
|
const Fzf = fzfConstructor();
|
|
65
|
-
if (typeof Fzf !== "function")
|
|
116
|
+
if (typeof Fzf !== "function") {
|
|
117
|
+
const positions = fallbackPositions(text, query);
|
|
118
|
+
const normalizedText = normalizeForFzf(text);
|
|
119
|
+
return positions?.map((index) => normalizedText.map[index]).filter((index) => Number.isInteger(index)) ?? null;
|
|
120
|
+
}
|
|
66
121
|
|
|
67
122
|
const normalizedText = normalizeForFzf(text);
|
|
68
123
|
const normalizedQuery = normalizeForFzf(query).text.trim();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
name: "Sidebar Name Blur",
|
|
7
7
|
description: "Registers the session-only Toggle sidebar blur command.",
|
|
8
8
|
required: true,
|
|
9
|
-
styles: ':root[data-codex-plus-sidebar-names-blurred="true"] :is([data-thread-title],[data-codex-plus-sidebar-name]){filter:blur(4px);user-select:none}',
|
|
9
|
+
styles: ':root[data-codex-plus-sidebar-names-blurred="true"] :is([data-thread-title],[data-codex-plus-sidebar-name],[data-app-action-sidebar-project-row]){filter:blur(4px);user-select:none}',
|
|
10
10
|
commands: [
|
|
11
11
|
{
|
|
12
12
|
id: "codexPlusToggleSidebarNameBlur",
|
|
@@ -95,9 +95,13 @@
|
|
|
95
95
|
styles:
|
|
96
96
|
':root:not(.dark):not(.electron-dark) :is([data-codex-plus-user-bubble],[data-codex-plus-user-entry]){background-color:var(--codex-plus-user-bubble-light-bg);color:var(--codex-plus-user-bubble-light-fg)}' +
|
|
97
97
|
':root:not(.dark):not(.electron-dark) [data-codex-plus-user-entry] :is(.ProseMirror,.ProseMirror *,textarea,[contenteditable="true"],[data-placeholder]),:root:not(.dark):not(.electron-dark) [data-codex-plus-user-entry] :is(button:not([class*="bg-token-foreground"]),[role="button"]:not([class*="bg-token-foreground"]),button:not([class*="bg-token-foreground"]) svg,[role="button"]:not([class*="bg-token-foreground"]) svg,[class*="text-token-foreground"],[class*="text-token-description-foreground"],[class*="text-token-input-placeholder-foreground"],[class*="text-token-text-link-foreground"],[class*="text-token-editor-warning-foreground"]){color:var(--codex-plus-user-bubble-light-fg)}' +
|
|
98
|
+
':root:not(.dark):not(.electron-dark) [data-codex-plus-user-entry] :is(button[aria-disabled="true"],button[class*="opacity-25"],[role="button"][aria-disabled="true"],[role="button"][class*="opacity-25"]){opacity:1!important;color:var(--codex-plus-user-bubble-light-fg)!important;-webkit-text-fill-color:currentColor!important}' +
|
|
99
|
+
':root:not(.dark):not(.electron-dark) [data-codex-plus-user-entry] :is(button[aria-disabled="true"],button[class*="opacity-25"],[role="button"][aria-disabled="true"],[role="button"][class*="opacity-25"]) *{animation:none!important;background-image:none!important;color:inherit!important;stroke:currentColor!important;-webkit-text-fill-color:currentColor!important}' +
|
|
98
100
|
':root:not(.dark):not(.electron-dark) [data-codex-plus-user-entry] :is([data-placeholder],[class*="text-token-input-placeholder-foreground"])::before,:root:not(.dark):not(.electron-dark) [data-codex-plus-user-entry] :is([data-placeholder],[class*="text-token-input-placeholder-foreground"])::after,:root:not(.dark):not(.electron-dark) [data-codex-plus-user-entry] :is(input,textarea,[contenteditable="true"],[class*="placeholder:text-token-input-placeholder-foreground"])::placeholder{color:var(--codex-plus-user-bubble-light-fg)}' +
|
|
99
101
|
':root.dark :is([data-codex-plus-user-bubble],[data-codex-plus-user-entry]),:root.electron-dark :is([data-codex-plus-user-bubble],[data-codex-plus-user-entry]){background-color:var(--codex-plus-user-bubble-dark-bg);color:var(--codex-plus-user-bubble-dark-fg)}' +
|
|
100
102
|
':root.dark [data-codex-plus-user-entry] :is(.ProseMirror,.ProseMirror *,textarea,[contenteditable="true"],[data-placeholder]),:root.electron-dark [data-codex-plus-user-entry] :is(.ProseMirror,.ProseMirror *,textarea,[contenteditable="true"],[data-placeholder]),:root.dark [data-codex-plus-user-entry] :is(button:not([class*="bg-token-foreground"]),[role="button"]:not([class*="bg-token-foreground"]),button:not([class*="bg-token-foreground"]) svg,[role="button"]:not([class*="bg-token-foreground"]) svg,[class*="text-token-foreground"],[class*="text-token-description-foreground"],[class*="text-token-input-placeholder-foreground"],[class*="text-token-text-link-foreground"],[class*="text-token-editor-warning-foreground"]),:root.electron-dark [data-codex-plus-user-entry] :is(button:not([class*="bg-token-foreground"]),[role="button"]:not([class*="bg-token-foreground"]),button:not([class*="bg-token-foreground"]) svg,[role="button"]:not([class*="bg-token-foreground"]) svg,[class*="text-token-foreground"],[class*="text-token-description-foreground"],[class*="text-token-input-placeholder-foreground"],[class*="text-token-text-link-foreground"],[class*="text-token-editor-warning-foreground"]){color:var(--codex-plus-user-bubble-dark-fg)}' +
|
|
103
|
+
':root.dark [data-codex-plus-user-entry] :is(button[aria-disabled="true"],button[class*="opacity-25"],[role="button"][aria-disabled="true"],[role="button"][class*="opacity-25"]),:root.electron-dark [data-codex-plus-user-entry] :is(button[aria-disabled="true"],button[class*="opacity-25"],[role="button"][aria-disabled="true"],[role="button"][class*="opacity-25"]){opacity:1!important;color:var(--codex-plus-user-bubble-dark-fg)!important;-webkit-text-fill-color:currentColor!important}' +
|
|
104
|
+
':root.dark [data-codex-plus-user-entry] :is(button[aria-disabled="true"],button[class*="opacity-25"],[role="button"][aria-disabled="true"],[role="button"][class*="opacity-25"]) *,:root.electron-dark [data-codex-plus-user-entry] :is(button[aria-disabled="true"],button[class*="opacity-25"],[role="button"][aria-disabled="true"],[role="button"][class*="opacity-25"]) *{animation:none!important;background-image:none!important;color:inherit!important;stroke:currentColor!important;-webkit-text-fill-color:currentColor!important}' +
|
|
101
105
|
':root.dark [data-codex-plus-user-entry] :is([data-placeholder],[class*="text-token-input-placeholder-foreground"])::before,:root.dark [data-codex-plus-user-entry] :is([data-placeholder],[class*="text-token-input-placeholder-foreground"])::after,:root.dark [data-codex-plus-user-entry] :is(input,textarea,[contenteditable="true"],[class*="placeholder:text-token-input-placeholder-foreground"])::placeholder,:root.electron-dark [data-codex-plus-user-entry] :is([data-placeholder],[class*="text-token-input-placeholder-foreground"])::before,:root.electron-dark [data-codex-plus-user-entry] :is([data-placeholder],[class*="text-token-input-placeholder-foreground"])::after,:root.electron-dark [data-codex-plus-user-entry] :is(input,textarea,[contenteditable="true"],[class*="placeholder:text-token-input-placeholder-foreground"])::placeholder{color:var(--codex-plus-user-bubble-dark-fg)}',
|
|
102
106
|
exports: {
|
|
103
107
|
defaultColor,
|