@promptowl/contextnest-community 1.7.0 → 1.8.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/CONFIGURATION.md +182 -181
- package/LICENSE.md +142 -142
- package/README.md +224 -224
- package/dist/{chunk-43DOX4LH.js → chunk-PJTAUVD7.js} +11 -1
- package/dist/{chunk-QMLAXQES.js → chunk-PLAHCDQG.js} +59 -1
- package/dist/{chunk-VD5QX2ZQ.js → chunk-XNGOO6RI.js} +1 -1
- package/dist/{chunk-MOXICJPD.js → chunk-Z3Y46ZGU.js} +62 -3
- package/dist/index.js +745 -35
- package/dist/{migrations.postgres-3HMGLKOV.js → migrations.postgres-VCG45LMK.js} +35 -1
- package/dist/{review-service-2FSKW425.js → review-service-G5US3SMG.js} +4 -4
- package/dist/{stewardship-service-I2JAFYJU.js → stewardship-service-ZXAMFTXO.js} +2 -2
- package/dist/{version-service-FJWVTZKR.js → version-service-B3SDOJQE.js} +2 -2
- package/dist/web3/assets/{hootie-_U3ECslt.svg → hootie-C2ocYkn4.svg} +8 -8
- package/dist/web3/assets/{index-DpM8J4RN.js → index-Den-5nzY.js} +239 -224
- package/dist/web3/assets/index-Jfj-2MHm.css +1 -0
- package/dist/web3/index.html +14 -14
- package/package.json +152 -152
- package/dist/web3/assets/index-24dBhQSQ.css +0 -1
|
@@ -1,22 +1,68 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVersion,
|
|
3
3
|
setApprovedVersion
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XNGOO6RI.js";
|
|
5
5
|
import {
|
|
6
6
|
buildTitleMap,
|
|
7
7
|
canUserApprove,
|
|
8
|
+
describeNode,
|
|
8
9
|
engineCache,
|
|
9
10
|
resolveStewardsForNode
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PJTAUVD7.js";
|
|
11
12
|
import {
|
|
13
|
+
config,
|
|
12
14
|
getDb,
|
|
13
15
|
insertOrReplace,
|
|
14
16
|
nowExpr
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-PLAHCDQG.js";
|
|
16
18
|
|
|
17
19
|
// src/governance/review-service.ts
|
|
18
20
|
import { v4 as uuid } from "uuid";
|
|
19
21
|
|
|
22
|
+
// src/notify/slack.ts
|
|
23
|
+
var warnedOnce = false;
|
|
24
|
+
async function notifySlackForNest(nestId, message) {
|
|
25
|
+
if (!config.SLACK_WEBHOOK_URL) return;
|
|
26
|
+
let nestName = nestId;
|
|
27
|
+
try {
|
|
28
|
+
const row = await getDb().get("SELECT name FROM nests WHERE id = ?", [
|
|
29
|
+
nestId
|
|
30
|
+
]);
|
|
31
|
+
if (row?.name) nestName = row.name;
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
return notifySlack(`*[${nestName}]* ${message}`);
|
|
35
|
+
}
|
|
36
|
+
function escapeMrkdwn(s) {
|
|
37
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
38
|
+
}
|
|
39
|
+
async function notifySlack(text) {
|
|
40
|
+
const url = config.SLACK_WEBHOOK_URL;
|
|
41
|
+
if (!url) return;
|
|
42
|
+
try {
|
|
43
|
+
const ctrl = new AbortController();
|
|
44
|
+
const timer = setTimeout(() => ctrl.abort(), 3e3);
|
|
45
|
+
try {
|
|
46
|
+
await fetch(url, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: { "Content-Type": "application/json" },
|
|
49
|
+
body: JSON.stringify({ text: escapeMrkdwn(text) }),
|
|
50
|
+
signal: ctrl.signal
|
|
51
|
+
});
|
|
52
|
+
} finally {
|
|
53
|
+
clearTimeout(timer);
|
|
54
|
+
}
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (!warnedOnce) {
|
|
57
|
+
warnedOnce = true;
|
|
58
|
+
console.warn(
|
|
59
|
+
"[slack] notification failed (suppressing further warnings):",
|
|
60
|
+
err instanceof Error ? err.message : err
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
20
66
|
// src/governance/safe-publish.ts
|
|
21
67
|
import {
|
|
22
68
|
publishDocument,
|
|
@@ -73,6 +119,10 @@ async function submitForReview(params) {
|
|
|
73
119
|
"UPDATE node_versions SET status = 'pending_review' WHERE nest_id = ? AND node_id = ? AND version = ?",
|
|
74
120
|
[params.nestId, params.nodeId, params.version]
|
|
75
121
|
);
|
|
122
|
+
void notifySlackForNest(
|
|
123
|
+
params.nestId,
|
|
124
|
+
`:memo: Review requested on *${await describeNode(params.nestId, params.nodeId)}* (v${params.version}) by ${params.requestedBy}${params.note ? ` \u2014 "${params.note}"` : ""}`
|
|
125
|
+
);
|
|
76
126
|
return await getReviewRequest(id);
|
|
77
127
|
}
|
|
78
128
|
async function approve(params) {
|
|
@@ -148,6 +198,10 @@ async function approve(params) {
|
|
|
148
198
|
err
|
|
149
199
|
);
|
|
150
200
|
}
|
|
201
|
+
void notifySlackForNest(
|
|
202
|
+
params.nestId,
|
|
203
|
+
`:white_check_mark: *${await describeNode(params.nestId, params.nodeId)}* v${params.version} approved by ${params.approvedBy}`
|
|
204
|
+
);
|
|
151
205
|
return await getReviewRequest(pending.id);
|
|
152
206
|
}
|
|
153
207
|
async function reject(params) {
|
|
@@ -177,6 +231,10 @@ async function reject(params) {
|
|
|
177
231
|
"UPDATE node_versions SET status = 'rejected' WHERE nest_id = ? AND node_id = ? AND version = ?",
|
|
178
232
|
[params.nestId, params.nodeId, params.version]
|
|
179
233
|
);
|
|
234
|
+
void notifySlackForNest(
|
|
235
|
+
params.nestId,
|
|
236
|
+
`:x: *${await describeNode(params.nestId, params.nodeId)}* v${params.version} rejected by ${params.rejectedBy} \u2014 "${params.note}"`
|
|
237
|
+
);
|
|
180
238
|
return await getReviewRequest(pending.id);
|
|
181
239
|
}
|
|
182
240
|
async function cancelReview(params) {
|
|
@@ -293,6 +351,7 @@ function rowToReviewRequest(row) {
|
|
|
293
351
|
|
|
294
352
|
export {
|
|
295
353
|
safePublishDocument,
|
|
354
|
+
notifySlackForNest,
|
|
296
355
|
submitForReview,
|
|
297
356
|
approve,
|
|
298
357
|
reject,
|