@staff0rd/assist 0.1021.2 → 0.1022.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/commands/sessions/web/bundle.js +152 -152
- package/dist/index.js +39 -35
- 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.1022.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22653,6 +22653,9 @@ function validateCommentText(raw, isHash = false) {
|
|
|
22653
22653
|
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync27 } from "fs";
|
|
22654
22654
|
import { randomInt } from "crypto";
|
|
22655
22655
|
|
|
22656
|
+
// src/commands/notify/deliverPinNotification.ts
|
|
22657
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
22658
|
+
|
|
22656
22659
|
// src/commands/notify/showNotification.ts
|
|
22657
22660
|
import notifier from "node-notifier";
|
|
22658
22661
|
|
|
@@ -22708,6 +22711,27 @@ function showNotification(options2) {
|
|
|
22708
22711
|
return true;
|
|
22709
22712
|
}
|
|
22710
22713
|
|
|
22714
|
+
// src/commands/notify/deliverPinNotification.ts
|
|
22715
|
+
var ROUTE_TIMEOUT_MS = 1e4;
|
|
22716
|
+
async function relayToViewerNode(notification) {
|
|
22717
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
22718
|
+
if (!sessionId) return void 0;
|
|
22719
|
+
const requestId = randomUUID12();
|
|
22720
|
+
const reply2 = await requestDaemonReply(
|
|
22721
|
+
{ type: "notify-pin", sessionId, requestId, ...notification },
|
|
22722
|
+
"notify-pin-result",
|
|
22723
|
+
ROUTE_TIMEOUT_MS
|
|
22724
|
+
);
|
|
22725
|
+
if (reply2?.requestId !== requestId) return void 0;
|
|
22726
|
+
return reply2.node;
|
|
22727
|
+
}
|
|
22728
|
+
async function deliverPinNotification(notification) {
|
|
22729
|
+
const node = await relayToViewerNode(notification);
|
|
22730
|
+
if (node) return { delivered: true, node };
|
|
22731
|
+
const { title, message: message3 } = notification;
|
|
22732
|
+
return { delivered: showNotification({ title, message: message3 }) };
|
|
22733
|
+
}
|
|
22734
|
+
|
|
22711
22735
|
// src/commands/codeComment/issuePin.ts
|
|
22712
22736
|
function issuePin(file, lineNumber, text19) {
|
|
22713
22737
|
const pin2 = generatePin();
|
|
@@ -22717,7 +22741,9 @@ function issuePin(file, lineNumber, text19) {
|
|
|
22717
22741
|
getPinStatePath(pin2),
|
|
22718
22742
|
JSON.stringify({ pin: pin2, file, line: lineNumber, text: text19 })
|
|
22719
22743
|
);
|
|
22720
|
-
return
|
|
22744
|
+
return deliverPinNotification({
|
|
22745
|
+
area: "code-comment",
|
|
22746
|
+
pin: pin2,
|
|
22721
22747
|
title: "assist code-comment pin",
|
|
22722
22748
|
message: `Pin ${pin2} \u2014 run: assist code-comment confirm ${pin2}`
|
|
22723
22749
|
});
|
|
@@ -22727,7 +22753,7 @@ function generatePin() {
|
|
|
22727
22753
|
}
|
|
22728
22754
|
|
|
22729
22755
|
// src/commands/codeComment/codeCommentSet.ts
|
|
22730
|
-
function codeCommentSet(file, line, text19) {
|
|
22756
|
+
async function codeCommentSet(file, line, text19) {
|
|
22731
22757
|
const lineNumber = Number.parseInt(line, 10);
|
|
22732
22758
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
22733
22759
|
console.error(chalk119.red(`Invalid line number: ${line}`));
|
|
@@ -22748,7 +22774,7 @@ function codeCommentSet(file, line, text19) {
|
|
|
22748
22774
|
"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."
|
|
22749
22775
|
)
|
|
22750
22776
|
);
|
|
22751
|
-
const delivered = issuePin(file, lineNumber, validation.text);
|
|
22777
|
+
const { delivered, node } = await issuePin(file, lineNumber, validation.text);
|
|
22752
22778
|
if (!delivered) {
|
|
22753
22779
|
console.error(
|
|
22754
22780
|
chalk119.red(
|
|
@@ -22759,8 +22785,8 @@ function codeCommentSet(file, line, text19) {
|
|
|
22759
22785
|
return;
|
|
22760
22786
|
}
|
|
22761
22787
|
console.log(
|
|
22762
|
-
`A confirmation pin was sent to your desktop notifications.
|
|
22763
|
-
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
22788
|
+
`A confirmation pin was sent to your desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
22789
|
+
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run in this session:
|
|
22764
22790
|
${chalk119.cyan(" assist code-comment confirm <PIN>")}
|
|
22765
22791
|
using the pin from that notification.`
|
|
22766
22792
|
);
|
|
@@ -25284,7 +25310,7 @@ function nextMigrationId() {
|
|
|
25284
25310
|
}
|
|
25285
25311
|
|
|
25286
25312
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
25287
|
-
function dbMigrationUnlock() {
|
|
25313
|
+
async function dbMigrationUnlock() {
|
|
25288
25314
|
const migrationId = nextMigrationId();
|
|
25289
25315
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
25290
25316
|
mkdirSync19(getRestrictedDir(), { recursive: true });
|
|
@@ -25295,7 +25321,9 @@ function dbMigrationUnlock() {
|
|
|
25295
25321
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
25296
25322
|
)
|
|
25297
25323
|
);
|
|
25298
|
-
const delivered =
|
|
25324
|
+
const { delivered, node } = await deliverPinNotification({
|
|
25325
|
+
area: "db-migration",
|
|
25326
|
+
pin: pin2,
|
|
25299
25327
|
title: "assist db-migration pin",
|
|
25300
25328
|
message: `Pin ${pin2} \u2014 run: assist db-migration confirm ${pin2}`
|
|
25301
25329
|
});
|
|
@@ -25309,8 +25337,8 @@ function dbMigrationUnlock() {
|
|
|
25309
25337
|
return;
|
|
25310
25338
|
}
|
|
25311
25339
|
console.log(
|
|
25312
|
-
`A confirmation pin was sent to your desktop notifications.
|
|
25313
|
-
To approve creating migration ${migrationId}, run:
|
|
25340
|
+
`A confirmation pin was sent to your desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
25341
|
+
To approve creating migration ${migrationId}, run in this session:
|
|
25314
25342
|
${chalk156.cyan(" assist db-migration confirm <PIN>")}
|
|
25315
25343
|
using the pin from that notification.`
|
|
25316
25344
|
);
|
|
@@ -26092,30 +26120,6 @@ async function docsConfirm(pin2) {
|
|
|
26092
26120
|
import { randomInt as randomInt3 } from "crypto";
|
|
26093
26121
|
import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as writeFileSync34 } from "fs";
|
|
26094
26122
|
import chalk167 from "chalk";
|
|
26095
|
-
|
|
26096
|
-
// src/commands/notify/deliverPinNotification.ts
|
|
26097
|
-
import { randomUUID as randomUUID12 } from "crypto";
|
|
26098
|
-
var ROUTE_TIMEOUT_MS = 1e4;
|
|
26099
|
-
async function relayToViewerNode(notification) {
|
|
26100
|
-
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26101
|
-
if (!sessionId) return void 0;
|
|
26102
|
-
const requestId = randomUUID12();
|
|
26103
|
-
const reply2 = await requestDaemonReply(
|
|
26104
|
-
{ type: "notify-pin", sessionId, requestId, ...notification },
|
|
26105
|
-
"notify-pin-result",
|
|
26106
|
-
ROUTE_TIMEOUT_MS
|
|
26107
|
-
);
|
|
26108
|
-
if (reply2?.requestId !== requestId) return void 0;
|
|
26109
|
-
return reply2.node;
|
|
26110
|
-
}
|
|
26111
|
-
async function deliverPinNotification(notification) {
|
|
26112
|
-
const node = await relayToViewerNode(notification);
|
|
26113
|
-
if (node) return { delivered: true, node };
|
|
26114
|
-
const { title, message: message3 } = notification;
|
|
26115
|
-
return { delivered: showNotification({ title, message: message3 }) };
|
|
26116
|
-
}
|
|
26117
|
-
|
|
26118
|
-
// src/commands/docs/docsUnlock.ts
|
|
26119
26123
|
function fail7(message3) {
|
|
26120
26124
|
console.error(chalk167.red(message3));
|
|
26121
26125
|
process.exitCode = 1;
|
|
@@ -26155,7 +26159,7 @@ async function docsUnlock() {
|
|
|
26155
26159
|
}
|
|
26156
26160
|
console.log(
|
|
26157
26161
|
`A confirmation pin was sent to the user's desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
26158
|
-
To let this phase of ${label} edit docs pages and screenshots, the user runs
|
|
26162
|
+
To let this phase of ${label} edit docs pages and screenshots, the user runs in this session:
|
|
26159
26163
|
${chalk167.cyan(" assist docs confirm <PIN>")}
|
|
26160
26164
|
Wait for the user to confirm before editing docs.`
|
|
26161
26165
|
);
|