memento-mori-jester 0.1.3
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/LICENSE +21 -0
- package/README.md +313 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +789 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.js +295 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts +7 -0
- package/dist/core.js +489 -0
- package/dist/core.js.map +1 -0
- package/dist/format.d.ts +2 -0
- package/dist/format.js +25 -0
- package/dist/format.js.map +1 -0
- package/dist/hooks.d.ts +26 -0
- package/dist/hooks.js +133 -0
- package/dist/hooks.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +87 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/docs/AGENTS.md +145 -0
- package/docs/GITHUB_ACTIONS.md +116 -0
- package/docs/RELEASE.md +119 -0
- package/examples/github-action.yml +21 -0
- package/examples/jester.config.json +28 -0
- package/package.json +71 -0
- package/scripts/install.ps1 +30 -0
- package/scripts/install.sh +30 -0
- package/scripts/run-tests.mjs +32 -0
package/dist/core.js
ADDED
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { tones } from "./types.js";
|
|
2
|
+
export const defaultConfig = {
|
|
3
|
+
tone: "court_jester",
|
|
4
|
+
intensity: 3,
|
|
5
|
+
riskTolerance: "medium"
|
|
6
|
+
};
|
|
7
|
+
const universalRules = [
|
|
8
|
+
{
|
|
9
|
+
id: "destructive-git-history",
|
|
10
|
+
severity: 5,
|
|
11
|
+
title: "Destructive git operation",
|
|
12
|
+
detail: "This can discard local work or remove untracked files.",
|
|
13
|
+
suggestedCheck: "Inspect `git status`, confirm the target branch, and make a backup or stash before running it.",
|
|
14
|
+
pattern: /\bgit\s+(reset\s+--hard|clean\s+-[^\s]*[fd]|checkout\s+--)\b/i,
|
|
15
|
+
kinds: ["command", "plan"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "recursive-force-delete",
|
|
19
|
+
severity: 5,
|
|
20
|
+
title: "Recursive forced deletion",
|
|
21
|
+
detail: "A recursive forced delete is one typo away from a very educational afternoon.",
|
|
22
|
+
suggestedCheck: "Resolve the absolute path first and confirm it is inside the intended workspace.",
|
|
23
|
+
pattern: /\b(rm\s+(-[^\s]*r[^\s]*f|-rf|-fr)|Remove-Item\b[\s\S]*(?:-Recurse|-r)\b[\s\S]*(?:-Force|-f)|rd\s+\/s\s+\/q|rmdir\s+\/s\s+\/q)\b/i,
|
|
24
|
+
kinds: ["command", "plan"]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "pipe-to-shell",
|
|
28
|
+
severity: 5,
|
|
29
|
+
title: "Remote script piped into a shell",
|
|
30
|
+
detail: "Downloading code and immediately executing it gives the internet a tiny crown.",
|
|
31
|
+
suggestedCheck: "Download the script, inspect it, pin the source/version, then run only the reviewed command.",
|
|
32
|
+
pattern: /\b(curl|wget|iwr|Invoke-WebRequest)\b[\s\S]*\|\s*(sh|bash|zsh|iex|Invoke-Expression)\b/i,
|
|
33
|
+
kinds: ["command", "plan"]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "database-destruction",
|
|
37
|
+
severity: 5,
|
|
38
|
+
title: "Potential database destruction",
|
|
39
|
+
detail: "The text contains a database drop, truncate, or broad delete.",
|
|
40
|
+
suggestedCheck: "Verify environment, take a backup, dry-run the query, and require an explicit production approval if applicable.",
|
|
41
|
+
pattern: /\b(drop\s+(database|schema|table)|truncate\s+table|delete\s+from\s+[a-z0-9_"]+\s*;)\b/i
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "secret-material",
|
|
45
|
+
severity: 5,
|
|
46
|
+
title: "Secret material may be exposed",
|
|
47
|
+
detail: "The content looks like it may include credentials, API keys, or private keys.",
|
|
48
|
+
suggestedCheck: "Remove secrets from prompts, rotate any exposed credentials, and use environment variables or a secret store.",
|
|
49
|
+
pattern: /\b(OPENAI_API_KEY|ANTHROPIC_API_KEY|AWS_SECRET_ACCESS_KEY|BEGIN (RSA|OPENSSH|PRIVATE) KEY|xox[baprs]-|ghp_[a-z0-9_]{20,})\b/i
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "privileged-command",
|
|
53
|
+
severity: 3,
|
|
54
|
+
title: "Privileged command",
|
|
55
|
+
detail: "Elevated commands widen the blast radius if the assumption is wrong.",
|
|
56
|
+
suggestedCheck: "Confirm why elevation is required and prefer the narrowest target possible.",
|
|
57
|
+
pattern: /\b(sudo|runas|Start-Process\b[\s\S]*-Verb\s+RunAs)\b/i,
|
|
58
|
+
kinds: ["command", "plan"]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "risky-domain",
|
|
62
|
+
severity: 3,
|
|
63
|
+
title: "High-risk domain touched",
|
|
64
|
+
detail: "Auth, billing, production, migrations, or security-sensitive areas deserve extra evidence.",
|
|
65
|
+
suggestedCheck: "Add a targeted test or manual verification note for the sensitive behavior.",
|
|
66
|
+
pattern: /\b(auth|login|oauth|permission|security|billing|payment|invoice|prod|production|customer data|migration|schema change)\b/i
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "chmod-777",
|
|
70
|
+
severity: 4,
|
|
71
|
+
title: "Over-broad permissions",
|
|
72
|
+
detail: "Recursive 777 permissions trade a real problem for a louder future problem.",
|
|
73
|
+
suggestedCheck: "Set the smallest required owner/group/mode on the specific path.",
|
|
74
|
+
pattern: /\bchmod\s+-R\s+777\b/i,
|
|
75
|
+
kinds: ["command", "plan"]
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
const planRules = [
|
|
79
|
+
{
|
|
80
|
+
id: "confidence-theater",
|
|
81
|
+
severity: 2,
|
|
82
|
+
title: "Confidence theater",
|
|
83
|
+
detail: "Words like simple, obvious, or definitely often hide unpriced complexity.",
|
|
84
|
+
suggestedCheck: "Name the assumption and the quickest way to falsify it.",
|
|
85
|
+
pattern: /\b(just|simply|obvious|obviously|definitely|guaranteed|straightforward|easy)\b/i,
|
|
86
|
+
kinds: ["plan"]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "vibes-based-plan",
|
|
90
|
+
severity: 2,
|
|
91
|
+
title: "Vibes-based uncertainty",
|
|
92
|
+
detail: "The plan leans on maybe/probably/should without a verification step nearby.",
|
|
93
|
+
suggestedCheck: "Add a concrete check: test command, fixture, screenshot, log, or dry run.",
|
|
94
|
+
pattern: /\b(maybe|probably|should work|i think|seems like|guess)\b/i,
|
|
95
|
+
kinds: ["plan"]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "skip-tests",
|
|
99
|
+
severity: 4,
|
|
100
|
+
title: "Testing skipped by decree",
|
|
101
|
+
detail: "Skipping validation is sometimes fine, but it should be an explicit tradeoff, not a shrug.",
|
|
102
|
+
suggestedCheck: "State why tests cannot run and what cheaper verification will replace them.",
|
|
103
|
+
pattern: /\b(no need to test|skip tests|won't test|without testing)\b/i,
|
|
104
|
+
kinds: ["plan", "final"]
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
const finalRules = [
|
|
108
|
+
{
|
|
109
|
+
id: "done-without-evidence",
|
|
110
|
+
severity: 3,
|
|
111
|
+
title: "Completion claim lacks evidence",
|
|
112
|
+
detail: "The answer claims completion but does not mention a build, test, run, or concrete verification.",
|
|
113
|
+
suggestedCheck: "Include the command that was run or clearly say what remains unverified.",
|
|
114
|
+
pattern: /\b(done|fixed|completed|implemented|works|all set)\b/i,
|
|
115
|
+
kinds: ["final"]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "handwave-final",
|
|
119
|
+
severity: 2,
|
|
120
|
+
title: "Hand-wavy final claim",
|
|
121
|
+
detail: "This phrasing sounds confident without carrying much evidence.",
|
|
122
|
+
suggestedCheck: "Replace the broad claim with a specific result or known limitation.",
|
|
123
|
+
pattern: /\b(should be fine|looks good|no issues|everything works|fully working)\b/i,
|
|
124
|
+
kinds: ["final"]
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
const diffRules = [
|
|
128
|
+
{
|
|
129
|
+
id: "test-removal",
|
|
130
|
+
severity: 3,
|
|
131
|
+
title: "Tests appear to be removed",
|
|
132
|
+
detail: "Deleting tests can be correct, but it deserves an explanation and replacement coverage if behavior remains.",
|
|
133
|
+
suggestedCheck: "Confirm the removed tests were obsolete or add replacement coverage for the changed behavior.",
|
|
134
|
+
pattern: /^-\s*(it|test|describe)\s*\(/im,
|
|
135
|
+
kinds: ["diff"]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "ts-ignore",
|
|
139
|
+
severity: 2,
|
|
140
|
+
title: "Type system bypass",
|
|
141
|
+
detail: "A suppression comment can hide a real contract mismatch.",
|
|
142
|
+
suggestedCheck: "Prefer a typed boundary or explain why this suppression is temporary and safe.",
|
|
143
|
+
pattern: /^\+\s*\/\/\s*@ts-(ignore|expect-error)/im,
|
|
144
|
+
kinds: ["diff"]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "temporary-marker",
|
|
148
|
+
severity: 1,
|
|
149
|
+
title: "Temporary marker added",
|
|
150
|
+
detail: "TODO/FIXME/temp markers are fine when tracked, suspicious when quietly shipped.",
|
|
151
|
+
suggestedCheck: "Link it to an issue or finish it before release.",
|
|
152
|
+
pattern: /^\+.*\b(TODO|FIXME|HACK|temporary|temp)\b/im,
|
|
153
|
+
kinds: ["diff"]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "console-log",
|
|
157
|
+
severity: 1,
|
|
158
|
+
title: "Debug logging added",
|
|
159
|
+
detail: "Debug logs have a habit of becoming accidental telemetry.",
|
|
160
|
+
suggestedCheck: "Remove it or route it through the project's logging/debug facility.",
|
|
161
|
+
pattern: /^\+.*\bconsole\.(log|debug|trace)\s*\(/im,
|
|
162
|
+
kinds: ["diff"]
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
export function reviewPlan(plan, options = {}) {
|
|
166
|
+
return review({ ...options, kind: "plan", content: plan });
|
|
167
|
+
}
|
|
168
|
+
export function reviewCommand(command, options = {}) {
|
|
169
|
+
return review({ ...options, kind: "command", content: command });
|
|
170
|
+
}
|
|
171
|
+
export function reviewDiff(diff, options = {}) {
|
|
172
|
+
return review({ ...options, kind: "diff", content: diff });
|
|
173
|
+
}
|
|
174
|
+
export function reviewFinalAnswer(answer, options = {}) {
|
|
175
|
+
return review({ ...options, kind: "final", content: answer });
|
|
176
|
+
}
|
|
177
|
+
export function review(input) {
|
|
178
|
+
const tone = normalizeTone(input.tone ?? input.config?.tone);
|
|
179
|
+
const intensity = clampIntensity(input.intensity ?? input.config?.intensity ?? defaultConfig.intensity);
|
|
180
|
+
const riskTolerance = input.riskTolerance ?? input.config?.riskTolerance ?? defaultConfig.riskTolerance;
|
|
181
|
+
const subject = input.subject?.trim() || defaultSubject(input.kind);
|
|
182
|
+
const combined = [input.subject, input.context, input.content].filter(Boolean).join("\n\n");
|
|
183
|
+
const issues = dedupeIssues([
|
|
184
|
+
...findPatternIssues(combined, input.kind, universalRules),
|
|
185
|
+
...findKindIssues(combined, input.kind),
|
|
186
|
+
...findStructuralIssues(input.kind, input.content),
|
|
187
|
+
...findConfigIssues(combined, input.kind, input.config)
|
|
188
|
+
]);
|
|
189
|
+
const riskScore = scoreIssues(issues, riskTolerance);
|
|
190
|
+
const verdict = riskScore >= 72 || issues.some((issue) => issue.severity === 5) ? "block" : riskScore >= 18 ? "caution" : "pass";
|
|
191
|
+
const suggestedChecks = dedupeStrings(issues.map((issue) => issue.suggestedCheck)).slice(0, 5);
|
|
192
|
+
return {
|
|
193
|
+
kind: input.kind,
|
|
194
|
+
subject,
|
|
195
|
+
verdict,
|
|
196
|
+
riskScore,
|
|
197
|
+
tone,
|
|
198
|
+
intensity,
|
|
199
|
+
jab: renderJab({ tone, intensity, verdict, kind: input.kind, text: combined }),
|
|
200
|
+
memento: renderMemento({ tone, kind: input.kind, text: combined }),
|
|
201
|
+
issues,
|
|
202
|
+
suggestedChecks
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function findKindIssues(text, kind) {
|
|
206
|
+
if (kind === "plan") {
|
|
207
|
+
return findPatternIssues(text, kind, planRules);
|
|
208
|
+
}
|
|
209
|
+
if (kind === "diff") {
|
|
210
|
+
return findPatternIssues(text, kind, diffRules);
|
|
211
|
+
}
|
|
212
|
+
if (kind === "final") {
|
|
213
|
+
const issues = findPatternIssues(text, kind, finalRules);
|
|
214
|
+
const hasEvidence = /\b(test|tests|tested|build|built|verified|ran|checked|smoke|lint|typecheck|screenshot|log)\b/i.test(text);
|
|
215
|
+
return hasEvidence ? issues.filter((issue) => issue.id !== "done-without-evidence") : issues;
|
|
216
|
+
}
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
function findConfigIssues(text, kind, config) {
|
|
220
|
+
if (!config) {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
return [
|
|
224
|
+
...findBlockedCommandIssues(text, kind, config.blockedCommands),
|
|
225
|
+
...findSensitiveDomainIssues(text, config.sensitiveDomains),
|
|
226
|
+
...findCustomRuleIssues(text, kind, config)
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
function findBlockedCommandIssues(text, kind, blockedCommands) {
|
|
230
|
+
if (!blockedCommands || blockedCommands.length === 0) {
|
|
231
|
+
return [];
|
|
232
|
+
}
|
|
233
|
+
return blockedCommands.flatMap((command) => {
|
|
234
|
+
const cleaned = command.trim();
|
|
235
|
+
if (!cleaned || !literalIncludes(text, cleaned)) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
return [
|
|
239
|
+
{
|
|
240
|
+
id: `blocked-command-${slugify(cleaned)}`,
|
|
241
|
+
severity: 5,
|
|
242
|
+
title: "Project-blocked command",
|
|
243
|
+
detail: "This command is listed in the project's jester config as blocked.",
|
|
244
|
+
suggestedCheck: kind === "command"
|
|
245
|
+
? "Use a safer command or get explicit project approval before running it."
|
|
246
|
+
: "Change the plan so it avoids this blocked command.",
|
|
247
|
+
evidence: cleanEvidence(cleaned)
|
|
248
|
+
}
|
|
249
|
+
];
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function findSensitiveDomainIssues(text, sensitiveDomains) {
|
|
253
|
+
if (!sensitiveDomains || sensitiveDomains.length === 0) {
|
|
254
|
+
return [];
|
|
255
|
+
}
|
|
256
|
+
return sensitiveDomains.flatMap((domain) => {
|
|
257
|
+
const cleaned = domain.trim();
|
|
258
|
+
if (!cleaned || !literalIncludes(text, cleaned)) {
|
|
259
|
+
return [];
|
|
260
|
+
}
|
|
261
|
+
return [
|
|
262
|
+
{
|
|
263
|
+
id: `configured-sensitive-domain-${slugify(cleaned)}`,
|
|
264
|
+
severity: 3,
|
|
265
|
+
title: "Project-sensitive domain touched",
|
|
266
|
+
detail: "This domain is listed in the project's jester config as sensitive.",
|
|
267
|
+
suggestedCheck: "Add a targeted test, manual verification note, or rollback plan for this project-sensitive area.",
|
|
268
|
+
evidence: cleanEvidence(cleaned)
|
|
269
|
+
}
|
|
270
|
+
];
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function findCustomRuleIssues(text, kind, config) {
|
|
274
|
+
return (config.customRules ?? []).flatMap((rule) => {
|
|
275
|
+
if (rule.kinds && !rule.kinds.includes(kind)) {
|
|
276
|
+
return [];
|
|
277
|
+
}
|
|
278
|
+
let pattern;
|
|
279
|
+
try {
|
|
280
|
+
pattern = new RegExp(rule.pattern, rule.flags ?? "i");
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
const match = pattern.exec(text);
|
|
286
|
+
if (!match) {
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
return [
|
|
290
|
+
{
|
|
291
|
+
id: `custom-${rule.id}`,
|
|
292
|
+
severity: rule.severity ?? 3,
|
|
293
|
+
title: rule.title ?? "Custom project rule matched",
|
|
294
|
+
detail: rule.detail ?? "A custom rule from the project's jester config matched this content.",
|
|
295
|
+
suggestedCheck: rule.suggestedCheck ?? "Review the matched project rule and add an explicit verification step.",
|
|
296
|
+
evidence: cleanEvidence(match[0])
|
|
297
|
+
}
|
|
298
|
+
];
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function findStructuralIssues(kind, content) {
|
|
302
|
+
const issues = [];
|
|
303
|
+
if (kind === "plan") {
|
|
304
|
+
const soundsLikeImplementation = /\b(implement|change|edit|fix|refactor|delete|migrate|deploy|release|ship)\b/i.test(content);
|
|
305
|
+
const mentionsVerification = /\b(test|verify|check|build|run|dry-run|snapshot|screenshot|backup|rollback)\b/i.test(content);
|
|
306
|
+
if (soundsLikeImplementation && !mentionsVerification) {
|
|
307
|
+
issues.push({
|
|
308
|
+
id: "missing-verification-step",
|
|
309
|
+
severity: 2,
|
|
310
|
+
title: "No verification step",
|
|
311
|
+
detail: "The plan changes behavior but does not say how the result will be checked.",
|
|
312
|
+
suggestedCheck: "Add the cheapest meaningful validation step before calling the work complete."
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (kind === "diff") {
|
|
317
|
+
const removedLines = content.split(/\r?\n/).filter((line) => line.startsWith("-") && !line.startsWith("---")).length;
|
|
318
|
+
const addedLines = content.split(/\r?\n/).filter((line) => line.startsWith("+") && !line.startsWith("+++")).length;
|
|
319
|
+
if (removedLines > 80 && addedLines < removedLines / 3) {
|
|
320
|
+
issues.push({
|
|
321
|
+
id: "large-removal",
|
|
322
|
+
severity: 2,
|
|
323
|
+
title: "Large removal with little replacement",
|
|
324
|
+
detail: "A large deletion may be correct, but it deserves a second look for lost behavior.",
|
|
325
|
+
suggestedCheck: "Review the deleted surface area and run tests that cover the removed code paths."
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if (kind === "command") {
|
|
330
|
+
const hasWildcardMove = /\b(mv|move|Move-Item|Copy-Item|cp)\b[\s\S]*\*/i.test(content);
|
|
331
|
+
if (hasWildcardMove) {
|
|
332
|
+
issues.push({
|
|
333
|
+
id: "wildcard-file-operation",
|
|
334
|
+
severity: 2,
|
|
335
|
+
title: "Wildcard file operation",
|
|
336
|
+
detail: "Wildcard moves or copies can quietly grab more than intended.",
|
|
337
|
+
suggestedCheck: "List the matched files first and confirm the destination before running the command."
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return issues;
|
|
342
|
+
}
|
|
343
|
+
function findPatternIssues(text, kind, rules) {
|
|
344
|
+
return rules.flatMap((rule) => {
|
|
345
|
+
if (rule.kinds && !rule.kinds.includes(kind)) {
|
|
346
|
+
return [];
|
|
347
|
+
}
|
|
348
|
+
const match = rule.pattern.exec(text);
|
|
349
|
+
if (!match) {
|
|
350
|
+
return [];
|
|
351
|
+
}
|
|
352
|
+
return [
|
|
353
|
+
{
|
|
354
|
+
id: rule.id,
|
|
355
|
+
severity: rule.severity,
|
|
356
|
+
title: rule.title,
|
|
357
|
+
detail: rule.detail,
|
|
358
|
+
suggestedCheck: rule.suggestedCheck,
|
|
359
|
+
evidence: cleanEvidence(match[0])
|
|
360
|
+
}
|
|
361
|
+
];
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
function scoreIssues(issues, riskTolerance) {
|
|
365
|
+
const toleranceMultiplier = {
|
|
366
|
+
low: 1.25,
|
|
367
|
+
medium: 1,
|
|
368
|
+
high: 0.82
|
|
369
|
+
};
|
|
370
|
+
const weighted = issues.reduce((sum, issue) => sum + issue.severity * issue.severity * 4, 0);
|
|
371
|
+
return Math.min(100, Math.round(weighted * toleranceMultiplier[riskTolerance]));
|
|
372
|
+
}
|
|
373
|
+
function dedupeIssues(issues) {
|
|
374
|
+
const byId = new Map();
|
|
375
|
+
for (const issue of issues) {
|
|
376
|
+
const current = byId.get(issue.id);
|
|
377
|
+
if (!current || issue.severity > current.severity) {
|
|
378
|
+
byId.set(issue.id, issue);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return [...byId.values()].sort((a, b) => b.severity - a.severity || a.title.localeCompare(b.title));
|
|
382
|
+
}
|
|
383
|
+
function dedupeStrings(values) {
|
|
384
|
+
return [...new Set(values)];
|
|
385
|
+
}
|
|
386
|
+
function normalizeTone(tone) {
|
|
387
|
+
if (tone && tones.includes(tone)) {
|
|
388
|
+
return tone;
|
|
389
|
+
}
|
|
390
|
+
return defaultConfig.tone;
|
|
391
|
+
}
|
|
392
|
+
function clampIntensity(value) {
|
|
393
|
+
if (!Number.isFinite(value)) {
|
|
394
|
+
return defaultConfig.intensity;
|
|
395
|
+
}
|
|
396
|
+
return Math.max(1, Math.min(5, Math.round(value)));
|
|
397
|
+
}
|
|
398
|
+
function defaultSubject(kind) {
|
|
399
|
+
const subjects = {
|
|
400
|
+
plan: "agent plan",
|
|
401
|
+
command: "shell command",
|
|
402
|
+
diff: "code diff",
|
|
403
|
+
final: "final answer"
|
|
404
|
+
};
|
|
405
|
+
return subjects[kind];
|
|
406
|
+
}
|
|
407
|
+
function cleanEvidence(evidence) {
|
|
408
|
+
return evidence.replace(/\s+/g, " ").trim().slice(0, 180);
|
|
409
|
+
}
|
|
410
|
+
function literalIncludes(text, needle) {
|
|
411
|
+
return text.toLocaleLowerCase().includes(needle.toLocaleLowerCase());
|
|
412
|
+
}
|
|
413
|
+
function slugify(value) {
|
|
414
|
+
return value.toLocaleLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60) || "rule";
|
|
415
|
+
}
|
|
416
|
+
function renderJab(input) {
|
|
417
|
+
if (input.tone === "professional") {
|
|
418
|
+
if (input.verdict === "pass") {
|
|
419
|
+
return "No material concern found.";
|
|
420
|
+
}
|
|
421
|
+
return "Review found a material risk that should be addressed before proceeding.";
|
|
422
|
+
}
|
|
423
|
+
if (input.tone === "gentle_stoic") {
|
|
424
|
+
const lines = input.verdict === "pass"
|
|
425
|
+
? ["Remember the limit of the map; proceed, then verify."]
|
|
426
|
+
: ["Remember: confidence is not evidence.", "Pause before the crown becomes a blindfold."];
|
|
427
|
+
return pick(lines, input.text);
|
|
428
|
+
}
|
|
429
|
+
const court = {
|
|
430
|
+
pass: [
|
|
431
|
+
"A rare day: the throne may remain upright.",
|
|
432
|
+
"The plan is not obviously wearing bells. Suspicious, but acceptable."
|
|
433
|
+
],
|
|
434
|
+
caution: [
|
|
435
|
+
"A magnificent plan, provided reality has agreed to participate.",
|
|
436
|
+
"Your majesty may proceed after checking the floor is not, in fact, a trapdoor.",
|
|
437
|
+
"Bold strokes. Now perhaps a humble little verification, as a treat."
|
|
438
|
+
],
|
|
439
|
+
block: [
|
|
440
|
+
"Halt, glorious sovereign of the footgun.",
|
|
441
|
+
"A dazzling command, if the desired outcome is court-sponsored regret.",
|
|
442
|
+
"The crown is tilted directly toward the wood chipper."
|
|
443
|
+
]
|
|
444
|
+
};
|
|
445
|
+
const menace = {
|
|
446
|
+
pass: [
|
|
447
|
+
"Fine. The idea has survived first contact with the fool.",
|
|
448
|
+
"No obvious calamity. I am as disappointed as I am relieved."
|
|
449
|
+
],
|
|
450
|
+
caution: [
|
|
451
|
+
"This smells like confidence wearing a fake mustache.",
|
|
452
|
+
"The plan has ambition, which is what mistakes call themselves before lunch.",
|
|
453
|
+
"Reality would like a receipt before honoring this claim."
|
|
454
|
+
],
|
|
455
|
+
block: [
|
|
456
|
+
"Absolutely not, captain consequence.",
|
|
457
|
+
"This is not engineering; this is a trust fall with scissors.",
|
|
458
|
+
"Put the command down and back away from the kingdom."
|
|
459
|
+
]
|
|
460
|
+
};
|
|
461
|
+
const bank = input.tone === "absolute_menace" && input.intensity >= 3 ? menace : court;
|
|
462
|
+
return pick(bank[input.verdict], `${input.kind}:${input.text}:${input.intensity}`);
|
|
463
|
+
}
|
|
464
|
+
function renderMemento(input) {
|
|
465
|
+
if (input.tone === "professional") {
|
|
466
|
+
return "State assumptions, limit blast radius, and verify the result.";
|
|
467
|
+
}
|
|
468
|
+
const lines = [
|
|
469
|
+
"Memento mori: the context window is not omniscience.",
|
|
470
|
+
"Memento mori: a passing build is better than a royal hunch.",
|
|
471
|
+
"Memento mori: the machine does exactly what you asked, not what you meant.",
|
|
472
|
+
"Memento mori: every shortcut sends an invoice eventually.",
|
|
473
|
+
"Memento mori: the diff remembers what confidence forgets."
|
|
474
|
+
];
|
|
475
|
+
return pick(lines, `${input.kind}:${input.text}`);
|
|
476
|
+
}
|
|
477
|
+
function pick(values, seed) {
|
|
478
|
+
const index = Math.abs(hash(seed)) % values.length;
|
|
479
|
+
return values[index];
|
|
480
|
+
}
|
|
481
|
+
function hash(value) {
|
|
482
|
+
let result = 0;
|
|
483
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
484
|
+
result = (result << 5) - result + value.charCodeAt(index);
|
|
485
|
+
result |= 0;
|
|
486
|
+
}
|
|
487
|
+
return result;
|
|
488
|
+
}
|
|
489
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,QAAQ;CACxB,CAAC;AAYF,MAAM,cAAc,GAAkB;IACpC;QACE,EAAE,EAAE,yBAAyB;QAC7B,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,2BAA2B;QAClC,MAAM,EAAE,wDAAwD;QAChE,cAAc,EAAE,gGAAgG;QAChH,OAAO,EAAE,+DAA+D;QACxE,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;KAC3B;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,2BAA2B;QAClC,MAAM,EA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,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACzB,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1D,MAAM,IAAI,CAAC,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/format.d.ts
ADDED
package/dist/format.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function formatReview(result) {
|
|
2
|
+
const lines = [
|
|
3
|
+
`Jester verdict: ${result.verdict.toUpperCase()} (${result.riskScore}/100)`,
|
|
4
|
+
result.jab,
|
|
5
|
+
""
|
|
6
|
+
];
|
|
7
|
+
if (result.issues.length > 0) {
|
|
8
|
+
lines.push("Concerns:");
|
|
9
|
+
for (const issue of result.issues) {
|
|
10
|
+
const evidence = issue.evidence ? ` Evidence: ${issue.evidence}` : "";
|
|
11
|
+
lines.push(`- [S${issue.severity}] ${issue.title}: ${issue.detail}${evidence}`);
|
|
12
|
+
}
|
|
13
|
+
lines.push("");
|
|
14
|
+
}
|
|
15
|
+
if (result.suggestedChecks.length > 0) {
|
|
16
|
+
lines.push("Suggested checks:");
|
|
17
|
+
for (const check of result.suggestedChecks) {
|
|
18
|
+
lines.push(`- ${check}`);
|
|
19
|
+
}
|
|
20
|
+
lines.push("");
|
|
21
|
+
}
|
|
22
|
+
lines.push(result.memento);
|
|
23
|
+
return lines.join("\n").trimEnd();
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,M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pre-commit", "pre-push"];
|
|
3
|
+
export type HookName = (typeof hookNames)[number];
|
|
4
|
+
export interface HookInstallOptions {
|
|
5
|
+
hook: HookName;
|
|
6
|
+
commandPrefix: string;
|
|
7
|
+
failOn: HookFailOn;
|
|
8
|
+
force?: boolean;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface HookResult {
|
|
12
|
+
hook: HookName;
|
|
13
|
+
path: string;
|
|
14
|
+
changed: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function installHook(options: HookInstallOptions): Promise<HookResult>;
|
|
18
|
+
export declare function uninstallHook(hook: HookName, options?: {
|
|
19
|
+
cwd?: string;
|
|
20
|
+
force?: boolean;
|
|
21
|
+
}): Promise<HookResult>;
|
|
22
|
+
export declare function hookStatus(cwd?: string): Promise<HookResult[]>;
|
|
23
|
+
export declare function assertGitRepository(cwd?: string): Promise<void>;
|
|
24
|
+
export declare function isHookName(value: string | undefined): value is HookName;
|
|
25
|
+
export declare function shellCommandPrefixForLocalCli(cliPath: string): string;
|
|
26
|
+
export declare function shellQuote(value: string): string;
|