@staff0rd/assist 0.325.1 → 0.326.1
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/dist/index.js +46 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.326.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6654,8 +6654,10 @@ async function connect2() {
|
|
|
6654
6654
|
await ensureDaemonRunning("web log stream");
|
|
6655
6655
|
const socket = await connectToDaemon();
|
|
6656
6656
|
wire(socket);
|
|
6657
|
-
socket.write(
|
|
6658
|
-
|
|
6657
|
+
socket.write(
|
|
6658
|
+
`${JSON.stringify({ type: "subscribe-logs", replay: false })}
|
|
6659
|
+
`
|
|
6660
|
+
);
|
|
6659
6661
|
} catch {
|
|
6660
6662
|
scheduleReconnect();
|
|
6661
6663
|
}
|
|
@@ -9381,8 +9383,6 @@ function codeCommentConfirm(pin) {
|
|
|
9381
9383
|
}
|
|
9382
9384
|
|
|
9383
9385
|
// src/commands/codeComment/codeCommentSet.ts
|
|
9384
|
-
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync23 } from "fs";
|
|
9385
|
-
import { randomBytes } from "crypto";
|
|
9386
9386
|
import chalk93 from "chalk";
|
|
9387
9387
|
|
|
9388
9388
|
// src/commands/codeComment/validateCommentText.ts
|
|
@@ -9410,10 +9410,27 @@ function validateCommentText(raw) {
|
|
|
9410
9410
|
return { ok: true, text: text6 };
|
|
9411
9411
|
}
|
|
9412
9412
|
|
|
9413
|
-
// src/commands/codeComment/
|
|
9413
|
+
// src/commands/codeComment/issuePin.ts
|
|
9414
|
+
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync23 } from "fs";
|
|
9415
|
+
import { randomInt } from "crypto";
|
|
9416
|
+
function issuePin(file, lineNumber, text6) {
|
|
9417
|
+
const pin = generatePin();
|
|
9418
|
+
mkdirSync11(getRestrictedDir(), { recursive: true });
|
|
9419
|
+
sweepRestrictedDir();
|
|
9420
|
+
writeFileSync23(
|
|
9421
|
+
getPinStatePath(pin),
|
|
9422
|
+
JSON.stringify({ pin, file, line: lineNumber, text: text6 })
|
|
9423
|
+
);
|
|
9424
|
+
return showNotification({
|
|
9425
|
+
title: "assist code-comment pin",
|
|
9426
|
+
message: `Pin ${pin} \u2014 run: assist code-comment confirm ${pin}`
|
|
9427
|
+
});
|
|
9428
|
+
}
|
|
9414
9429
|
function generatePin() {
|
|
9415
|
-
return
|
|
9430
|
+
return randomInt(0, 1e3).toString().padStart(3, "0");
|
|
9416
9431
|
}
|
|
9432
|
+
|
|
9433
|
+
// src/commands/codeComment/codeCommentSet.ts
|
|
9417
9434
|
function codeCommentSet(file, line, text6) {
|
|
9418
9435
|
const lineNumber = Number.parseInt(line, 10);
|
|
9419
9436
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
@@ -9430,20 +9447,24 @@ function codeCommentSet(file, line, text6) {
|
|
|
9430
9447
|
}
|
|
9431
9448
|
console.error(
|
|
9432
9449
|
chalk93.yellow.bold(
|
|
9433
|
-
"
|
|
9450
|
+
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
9434
9451
|
)
|
|
9435
9452
|
);
|
|
9436
|
-
const
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9453
|
+
const delivered = issuePin(file, lineNumber, validation.text);
|
|
9454
|
+
if (!delivered) {
|
|
9455
|
+
console.error(
|
|
9456
|
+
chalk93.red(
|
|
9457
|
+
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
9458
|
+
)
|
|
9459
|
+
);
|
|
9460
|
+
process.exitCode = 1;
|
|
9461
|
+
return;
|
|
9462
|
+
}
|
|
9443
9463
|
console.log(
|
|
9444
|
-
|
|
9464
|
+
`A confirmation pin was sent to your desktop notifications.
|
|
9445
9465
|
To insert "// ${validation.text}" at ${file}:${lineNumber}, run:
|
|
9446
|
-
${chalk93.cyan(
|
|
9466
|
+
${chalk93.cyan(" assist code-comment confirm <PIN>")}
|
|
9467
|
+
using the pin from that notification.`
|
|
9447
9468
|
);
|
|
9448
9469
|
}
|
|
9449
9470
|
|
|
@@ -19408,7 +19429,7 @@ function registerVoice(program2) {
|
|
|
19408
19429
|
}
|
|
19409
19430
|
|
|
19410
19431
|
// src/commands/roam/auth.ts
|
|
19411
|
-
import { randomBytes
|
|
19432
|
+
import { randomBytes } from "crypto";
|
|
19412
19433
|
import chalk178 from "chalk";
|
|
19413
19434
|
|
|
19414
19435
|
// src/commands/roam/waitForCallback.ts
|
|
@@ -19538,7 +19559,7 @@ async function auth() {
|
|
|
19538
19559
|
const existingRoam = config.roam ?? {};
|
|
19539
19560
|
config.roam = { ...existingRoam, clientId, clientSecret };
|
|
19540
19561
|
saveGlobalConfig(config);
|
|
19541
|
-
const state =
|
|
19562
|
+
const state = randomBytes(16).toString("hex");
|
|
19542
19563
|
console.log(
|
|
19543
19564
|
chalk178.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
19544
19565
|
);
|
|
@@ -20560,9 +20581,11 @@ var ClientHub = class extends Set {
|
|
|
20560
20581
|
sendTo(client, { type: "limits", rateLimits: this.latestLimits });
|
|
20561
20582
|
}
|
|
20562
20583
|
}
|
|
20563
|
-
subscribeLogs(client) {
|
|
20564
|
-
|
|
20565
|
-
|
|
20584
|
+
subscribeLogs(client, replay = true) {
|
|
20585
|
+
if (replay) {
|
|
20586
|
+
for (const line of recentDaemonLogLines()) {
|
|
20587
|
+
sendTo(client, { type: "log", line });
|
|
20588
|
+
}
|
|
20566
20589
|
}
|
|
20567
20590
|
this.logSubscribers.add(client);
|
|
20568
20591
|
}
|
|
@@ -22179,7 +22202,7 @@ function routed(local) {
|
|
|
22179
22202
|
}
|
|
22180
22203
|
var messageHandlers = {
|
|
22181
22204
|
ping: (client) => sendTo(client, { type: "pong", pid: process.pid }),
|
|
22182
|
-
"subscribe-logs": (client, m) => m.clients.subscribeLogs(client),
|
|
22205
|
+
"subscribe-logs": (client, m, d) => m.clients.subscribeLogs(client, d.replay !== false),
|
|
22183
22206
|
hello: (client) => sendTo(client, buildHello()),
|
|
22184
22207
|
create: creator(
|
|
22185
22208
|
true,
|