querysub 0.447.0 → 0.448.0
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/package.json
CHANGED
|
@@ -67,6 +67,16 @@ function cleanCommitMessage(text: string): string {
|
|
|
67
67
|
return text;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/** Extracts just the added/removed lines from a unified diff, dropping context
|
|
71
|
+
* lines and diff/hunk headers — i.e. only the lines that actually changed. */
|
|
72
|
+
function extractChangedLines(diff: string): string {
|
|
73
|
+
return diff.split("\n")
|
|
74
|
+
.filter(line =>
|
|
75
|
+
(line.startsWith("+") || line.startsWith("-"))
|
|
76
|
+
&& !line.startsWith("+++") && !line.startsWith("---"))
|
|
77
|
+
.join("\n");
|
|
78
|
+
}
|
|
79
|
+
|
|
70
80
|
const rowButtonStyle = css.pad2(12, 8).button.bord2(0, 0, 20).fontWeight("bold");
|
|
71
81
|
|
|
72
82
|
export class CommitModal extends qreact.Component<{
|
|
@@ -101,6 +111,7 @@ export class CommitModal extends qreact.Component<{
|
|
|
101
111
|
let isQuerysub = Querysub.localRead(() => this.props.isQuerysub);
|
|
102
112
|
let controller = MachineServiceController(SocketFunction.browserNodeId());
|
|
103
113
|
let diff = await controller.getGitDiff.promise({ useQuerysub: isQuerysub });
|
|
114
|
+
console.log("Received commit diff, changed lines:\n" + extractChangedLines(diff));
|
|
104
115
|
Querysub.localCommit(() => {
|
|
105
116
|
this.state.diff = diff;
|
|
106
117
|
this.state.diffLoading = false;
|
|
@@ -176,7 +187,6 @@ export class CommitModal extends qreact.Component<{
|
|
|
176
187
|
|
|
177
188
|
render() {
|
|
178
189
|
let { diff, diffLoading, summarizing, committing } = this.state;
|
|
179
|
-
let diffBytes = diff ? new TextEncoder().encode(diff).length : 0;
|
|
180
190
|
|
|
181
191
|
let summarizeLabel: string;
|
|
182
192
|
if (diffLoading) {
|
|
@@ -184,7 +194,7 @@ export class CommitModal extends qreact.Component<{
|
|
|
184
194
|
} else if (summarizing) {
|
|
185
195
|
summarizeLabel = "Summarizing…";
|
|
186
196
|
} else {
|
|
187
|
-
summarizeLabel = `Summarize ${
|
|
197
|
+
summarizeLabel = `Summarize ${extractChangedLines(diff).length} changed characters`;
|
|
188
198
|
}
|
|
189
199
|
|
|
190
200
|
return <div className={css.vbox(12).minWidth(620)}>
|
|
@@ -211,6 +221,7 @@ export class CommitModal extends qreact.Component<{
|
|
|
211
221
|
<button
|
|
212
222
|
className={rowButtonStyle.hsl(45, 80, 85)}
|
|
213
223
|
disabled={diffLoading || summarizing}
|
|
224
|
+
title={diff ? extractChangedLines(diff) : ""}
|
|
214
225
|
onClick={() => void this.doSummarize()}
|
|
215
226
|
>
|
|
216
227
|
🤖 {summarizeLabel}
|
|
@@ -20,6 +20,7 @@ import { isClient } from "../config2";
|
|
|
20
20
|
import { isLocal } from "../config";
|
|
21
21
|
import { pathWatcher } from "../0-path-value-core/PathWatcher";
|
|
22
22
|
import { debugNodeId } from "../-c-identity/IdentityController";
|
|
23
|
+
import debugbreak from "debugbreak";
|
|
23
24
|
|
|
24
25
|
if (!isClient()) {
|
|
25
26
|
// Comment this line out to disable our functionality
|
|
@@ -332,7 +333,7 @@ async function auditAuthority(nodeId: string, pathsToAudit: { path: string }[],
|
|
|
332
333
|
if (response.valid && response.time && compareTime(response.time, ourValue.time) > 0) {
|
|
333
334
|
valuesToRequest.push({ path: response.path, time: response.time });
|
|
334
335
|
let authorities = PathRouter.getAllAuthorities(response.path);
|
|
335
|
-
|
|
336
|
+
debugbreak(2);
|
|
336
337
|
debugger;
|
|
337
338
|
trackSyncAge({
|
|
338
339
|
path: response.path,
|
|
@@ -348,7 +349,7 @@ async function auditAuthority(nodeId: string, pathsToAudit: { path: string }[],
|
|
|
348
349
|
// - Send it our value
|
|
349
350
|
else if (response.valid === undefined && (!response.time || compareTime(ourValue.time, response.time) > 0)) {
|
|
350
351
|
valuesToSend.push(ourValue);
|
|
351
|
-
|
|
352
|
+
debugbreak(2);
|
|
352
353
|
debugger;
|
|
353
354
|
trackSyncAge({
|
|
354
355
|
path: response.path,
|
|
@@ -369,7 +370,7 @@ async function auditAuthority(nodeId: string, pathsToAudit: { path: string }[],
|
|
|
369
370
|
let age = now - ourValue.time.time;
|
|
370
371
|
if (age >= MAX_CHANGE_AGE) {
|
|
371
372
|
pathsToForceSync.add(response.path);
|
|
372
|
-
|
|
373
|
+
debugbreak(2);
|
|
373
374
|
debugger;
|
|
374
375
|
trackSyncAge({
|
|
375
376
|
path: response.path,
|