skill-monster 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +155 -2
- package/desk-ui/app.css +73 -0
- package/desk-ui/app.js +182 -0
- package/desk-ui/fonts/bricolage-grotesque-800.woff2 +0 -0
- package/desk-ui/fonts/ibm-plex-mono-400.woff2 +0 -0
- package/desk-ui/fonts/ibm-plex-mono-600.woff2 +0 -0
- package/desk-ui/fonts/ibm-plex-sans-400.woff2 +0 -0
- package/desk-ui/fonts/silkscreen-400.woff2 +0 -0
- package/desk-ui/fonts.css +70 -0
- package/desk-ui/index.html +29 -0
- package/desk-ui/mascot.svg +1 -0
- package/dist/build.json +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +640 -0
- package/dist/cli/ui.d.ts +18 -0
- package/dist/cli/ui.js +120 -0
- package/dist/core/checkup.d.ts +14 -0
- package/dist/core/checkup.js +69 -0
- package/dist/core/corrections.d.ts +54 -0
- package/dist/core/corrections.js +138 -0
- package/dist/core/digest.d.ts +36 -0
- package/dist/core/digest.js +91 -0
- package/dist/core/export.d.ts +8 -0
- package/dist/core/export.js +28 -0
- package/dist/core/external.d.ts +48 -0
- package/dist/core/external.js +127 -0
- package/dist/core/guard.d.ts +10 -0
- package/dist/core/guard.js +48 -0
- package/dist/core/mirror.d.ts +37 -0
- package/dist/core/mirror.js +148 -0
- package/dist/core/release.d.ts +69 -0
- package/dist/core/release.js +173 -0
- package/dist/core/report.d.ts +10 -0
- package/dist/core/report.js +65 -0
- package/dist/core/scrub.d.ts +20 -0
- package/dist/core/scrub.js +67 -0
- package/dist/core/sign.d.ts +25 -0
- package/dist/core/sign.js +86 -0
- package/dist/core/skill.d.ts +26 -0
- package/dist/core/skill.js +68 -0
- package/dist/core/starters.d.ts +54 -0
- package/dist/core/starters.js +184 -0
- package/dist/core/types.d.ts +187 -0
- package/dist/core/types.js +1 -0
- package/dist/core/version.d.ts +4 -0
- package/dist/core/version.js +17 -0
- package/dist/core/workspace.d.ts +23 -0
- package/dist/core/workspace.js +79 -0
- package/dist/desk/server.d.ts +10 -0
- package/dist/desk/server.js +140 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.js +112 -0
- package/dist/providers/index.d.ts +15 -0
- package/dist/providers/index.js +123 -0
- package/dist/slack/api.d.ts +6 -0
- package/dist/slack/api.js +18 -0
- package/dist/slack/app.d.ts +70 -0
- package/dist/slack/app.js +387 -0
- package/dist/slack/manifest.d.ts +50 -0
- package/dist/slack/manifest.js +71 -0
- package/dist/slack/messages.d.ts +414 -0
- package/dist/slack/messages.js +226 -0
- package/dist/slack/socket.d.ts +24 -0
- package/dist/slack/socket.js +84 -0
- package/dist/stores/airtable.d.ts +26 -0
- package/dist/stores/airtable.js +52 -0
- package/dist/stores/confluence-format.d.ts +34 -0
- package/dist/stores/confluence-format.js +458 -0
- package/dist/stores/confluence.d.ts +55 -0
- package/dist/stores/confluence.js +204 -0
- package/dist/stores/index.d.ts +30 -0
- package/dist/stores/index.js +53 -0
- package/dist/stores/notion.d.ts +43 -0
- package/dist/stores/notion.js +313 -0
- package/docs/SECURITY.md +45 -0
- package/docs/slack.md +78 -0
- package/package.json +48 -4
- package/starters/_core/SKILL.md +30 -0
- package/starters/customer-support-answers/starter.yaml +98 -0
- package/starters/data-warehouse-kb/starter.yaml +119 -0
- package/starters/engineering-house-rules/starter.yaml +106 -0
- package/starters/people-policies/starter.yaml +89 -0
- package/starters/pricing-and-packaging/starter.yaml +90 -0
- package/starters/product-analytics-kb/starter.yaml +109 -0
- package/starters/security-questionnaire-answers/starter.yaml +94 -0
package/dist/cli/ui.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/* Terminal styling for Skill Monster. Brand colours, pixel mascot, plain fallbacks. */
|
|
2
|
+
const tty = process.stdout.isTTY && !process.env.NO_COLOR && process.env.TERM !== 'dumb';
|
|
3
|
+
const rgb = (r, g, b) => (s) => (tty ? `\x1b[38;2;${r};${g};${b}m${s}\x1b[39m` : s);
|
|
4
|
+
const wrap = (o, c) => (s) => (tty ? `\x1b[${o}m${s}\x1b[${c}m` : s);
|
|
5
|
+
export const c = {
|
|
6
|
+
monster: rgb(198, 244, 50),
|
|
7
|
+
bite: rgb(255, 90, 54),
|
|
8
|
+
warn: rgb(232, 177, 74),
|
|
9
|
+
dim: rgb(138, 131, 117),
|
|
10
|
+
hi: wrap('1', '22'),
|
|
11
|
+
inv: (s) => (tty ? `\x1b[48;2;198;244;50m\x1b[38;2;22;20;15m ${s} \x1b[0m` : `[${s}]`),
|
|
12
|
+
};
|
|
13
|
+
export const ok = (s) => `${c.monster('✓')} ${s}`;
|
|
14
|
+
export const warn = (s) => `${c.warn('!')} ${s}`;
|
|
15
|
+
export const bad = (s) => `${c.bite('!')} ${c.bite(s)}`;
|
|
16
|
+
export const fail = (s) => `${c.bite('✗')} ${s}`;
|
|
17
|
+
// 12x12 pixel mascot. 0 empty, 1 monster, 2 ink. Same grid as the brand sheet.
|
|
18
|
+
const M = 1, I = 2;
|
|
19
|
+
export function grid(mood) {
|
|
20
|
+
const g = Array.from({ length: 12 }, () => Array(12).fill(0));
|
|
21
|
+
const r = (x, y, w, h, v) => { for (let j = y; j < y + h; j++)
|
|
22
|
+
for (let i = x; i < x + w; i++)
|
|
23
|
+
g[j][i] = v; };
|
|
24
|
+
r(2, 0, 1, 2, M);
|
|
25
|
+
r(3, 1, 1, 1, M);
|
|
26
|
+
r(8, 1, 2, 1, M);
|
|
27
|
+
r(1, 2, 10, 8, M);
|
|
28
|
+
r(2, 10, 2, 2, M);
|
|
29
|
+
r(8, 10, 2, 2, M);
|
|
30
|
+
if (mood === 'hungry') {
|
|
31
|
+
r(4, 3, 4, 3, I);
|
|
32
|
+
r(5, 4, 1, 1, M);
|
|
33
|
+
r(2, 7, 8, 2, I);
|
|
34
|
+
r(3, 7, 1, 1, M);
|
|
35
|
+
r(5, 7, 2, 1, M);
|
|
36
|
+
r(8, 7, 1, 1, M);
|
|
37
|
+
}
|
|
38
|
+
if (mood === 'chewing') {
|
|
39
|
+
r(4, 3, 4, 3, I);
|
|
40
|
+
r(6, 4, 1, 1, M);
|
|
41
|
+
r(2, 7, 8, 1, I);
|
|
42
|
+
r(4, 8, 4, 1, I);
|
|
43
|
+
r(3, 7, 1, 1, M);
|
|
44
|
+
r(5, 7, 2, 1, M);
|
|
45
|
+
r(8, 7, 1, 1, M);
|
|
46
|
+
}
|
|
47
|
+
if (mood === 'full') {
|
|
48
|
+
r(5, 3, 2, 1, I);
|
|
49
|
+
r(4, 4, 1, 1, I);
|
|
50
|
+
r(7, 4, 1, 1, I);
|
|
51
|
+
r(3, 8, 6, 1, I);
|
|
52
|
+
r(2, 7, 1, 1, I);
|
|
53
|
+
r(9, 7, 1, 1, I);
|
|
54
|
+
}
|
|
55
|
+
if (mood === 'sick') {
|
|
56
|
+
r(4, 3, 1, 1, I);
|
|
57
|
+
r(7, 3, 1, 1, I);
|
|
58
|
+
r(5, 4, 2, 1, I);
|
|
59
|
+
r(4, 5, 1, 1, I);
|
|
60
|
+
r(7, 5, 1, 1, I);
|
|
61
|
+
r(2, 8, 1, 1, I);
|
|
62
|
+
r(3, 7, 2, 1, I);
|
|
63
|
+
r(5, 8, 2, 1, I);
|
|
64
|
+
r(7, 7, 2, 1, I);
|
|
65
|
+
r(9, 8, 1, 1, I);
|
|
66
|
+
}
|
|
67
|
+
return g;
|
|
68
|
+
}
|
|
69
|
+
/** Renders the mascot with half blocks: 12x12 pixels in 12 columns x 6 rows. */
|
|
70
|
+
export function mascot(mood = 'hungry') {
|
|
71
|
+
const g = grid(mood);
|
|
72
|
+
const col = (v) => (v === M ? '198;244;50' : '22;20;15');
|
|
73
|
+
const lines = [];
|
|
74
|
+
for (let y = 0; y < 12; y += 2) {
|
|
75
|
+
let s = '';
|
|
76
|
+
for (let x = 0; x < 12; x++) {
|
|
77
|
+
const top = g[y][x], bot = g[y + 1][x];
|
|
78
|
+
if (!tty) {
|
|
79
|
+
const a = top === M, b = bot === M;
|
|
80
|
+
s += a && b ? '█' : a ? '▀' : b ? '▄' : ' ';
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (!top && !bot)
|
|
84
|
+
s += ' ';
|
|
85
|
+
else if (top && bot)
|
|
86
|
+
s += `\x1b[38;2;${col(top)}m\x1b[48;2;${col(bot)}m▀\x1b[0m`;
|
|
87
|
+
else if (top)
|
|
88
|
+
s += `\x1b[38;2;${col(top)}m▀\x1b[0m`;
|
|
89
|
+
else
|
|
90
|
+
s += `\x1b[38;2;${col(bot)}m▄\x1b[0m`;
|
|
91
|
+
}
|
|
92
|
+
lines.push(s);
|
|
93
|
+
}
|
|
94
|
+
return lines;
|
|
95
|
+
}
|
|
96
|
+
export function banner(version, lines = [], mood = 'hungry') {
|
|
97
|
+
const art = mascot(mood);
|
|
98
|
+
const text = [c.inv(`SKILL MONSTER ${version}`), c.hi('Wrong answers have a natural predator.'), c.dim('Apache-2.0 · runs in your repo · nothing leaves the company'), ...lines];
|
|
99
|
+
const out = [];
|
|
100
|
+
for (let i = 0; i < Math.max(art.length, text.length); i++)
|
|
101
|
+
out.push(` ${art[i] ?? ' '.repeat(12)} ${text[i] ?? ''}`);
|
|
102
|
+
return '\n' + out.join('\n') + '\n';
|
|
103
|
+
}
|
|
104
|
+
export function table(rows, head) {
|
|
105
|
+
const all = head ? [head, ...rows] : rows;
|
|
106
|
+
const strip = (s) => s.replace(/\x1b\[[0-9;]*m/g, '');
|
|
107
|
+
const w = all[0].map((_, i) => Math.max(...all.map(r => strip(r[i] ?? '').length)));
|
|
108
|
+
const fmt = (r) => r.map((x, i) => x + ' '.repeat(w[i] - strip(x).length)).join(' ').trimEnd();
|
|
109
|
+
return [...(head ? [c.dim(fmt(head))] : []), ...rows.map(fmt)].join('\n');
|
|
110
|
+
}
|
|
111
|
+
export function chew(label) {
|
|
112
|
+
if (!tty) {
|
|
113
|
+
process.stdout.write(`${label}…\n`);
|
|
114
|
+
return () => { };
|
|
115
|
+
}
|
|
116
|
+
const frames = ['▖', '▘', '▝', '▗'];
|
|
117
|
+
let i = 0;
|
|
118
|
+
const t = setInterval(() => process.stdout.write(`\r${c.monster(frames[i++ % 4])} ${label}… `), 120);
|
|
119
|
+
return (done) => { clearInterval(t); process.stdout.write(`\r\x1b[2K${done ? done + '\n' : ''}`); };
|
|
120
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Workspace } from './workspace.js';
|
|
2
|
+
export interface Finding {
|
|
3
|
+
level: 'block' | 'warn' | 'ok';
|
|
4
|
+
message: string;
|
|
5
|
+
file?: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
}
|
|
8
|
+
/** The free check-up that runs before every release. Anything at level "block" stops the release. */
|
|
9
|
+
export declare function checkSkill(ws: Workspace, name: string): Promise<Finding[]>;
|
|
10
|
+
/** Check-up for a plain folder of docs before it becomes a workspace (used by init). */
|
|
11
|
+
export declare function scanFolder(dir: string): {
|
|
12
|
+
files: string[];
|
|
13
|
+
findings: Finding[];
|
|
14
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { findBlanks, loadSkill, loadTests, readContent } from './skill.js';
|
|
4
|
+
import { findFigures, findSensitive } from './scrub.js';
|
|
5
|
+
/** The free check-up that runs before every release. Anything at level "block" stops the release. */
|
|
6
|
+
export async function checkSkill(ws, name) {
|
|
7
|
+
const out = [];
|
|
8
|
+
const meta = loadSkill(ws, name);
|
|
9
|
+
if (!/^\d+\.\d+\.\d+$/.test(meta.version ?? ''))
|
|
10
|
+
out.push({ level: 'warn', message: `${name} has no version number. It will be set to 0.1.0.` });
|
|
11
|
+
if (!meta.owner)
|
|
12
|
+
out.push({ level: 'block', message: `${name} has no owner. Set "owner" in skill.yaml so corrections have somewhere to go.` });
|
|
13
|
+
const { entry, sections } = await readContent(ws, meta);
|
|
14
|
+
const files = [['SKILL.md', entry], ...Object.entries(sections).map(([k, v]) => [`sections/${k}.md`, v])];
|
|
15
|
+
for (const [file, text] of files) {
|
|
16
|
+
text.split('\n').forEach((line, i) => {
|
|
17
|
+
for (const f of findSensitive(line))
|
|
18
|
+
out.push({ level: f.severity, message: `${aOrAn(f.kind)} ${f.kind} in ${file}:${i + 1}. Move it out before release.`, file, line: i + 1 });
|
|
19
|
+
for (const kind of findFigures(line))
|
|
20
|
+
out.push({ level: 'warn', message: `A ${kind} in ${file}:${i + 1}. If it's a real figure, replace it with a placeholder or a made-up example.`, file, line: i + 1 });
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const tests = loadTests(ws, name);
|
|
24
|
+
if (tests.length === 0)
|
|
25
|
+
out.push({ level: 'warn', message: `${name} has no guard tests yet. Add at least one so mistakes can't come back.` });
|
|
26
|
+
for (const t of tests)
|
|
27
|
+
for (const f of findSensitive(JSON.stringify(t)))
|
|
28
|
+
out.push({ level: 'block', message: `${aOrAn(f.kind)} ${f.kind} in tests/${t.id}.yaml. Guard tests use made-up values only.` });
|
|
29
|
+
const blanks = findBlanks(sections);
|
|
30
|
+
for (const t of tests.filter(t => t.blank)) {
|
|
31
|
+
const topic = t.blank.toLowerCase();
|
|
32
|
+
if (!blanks.some(b => b.what.toLowerCase().includes(topic)))
|
|
33
|
+
out.push({ level: 'warn', message: `tests/${t.id}.yaml checks that "${t.blank}" is still a blank, but the content now defines it. Point the test at a blank that remains${blanks[0] ? ` (e.g. "${blanks[0].what}")` : ''}, or make it check the new rule.` });
|
|
34
|
+
}
|
|
35
|
+
if (blanks.length)
|
|
36
|
+
out.push({ level: 'warn', message: `${blanks.length} visible blank${blanks.length > 1 ? 's' : ''} (fine for 0.x; they fill from real questions).` });
|
|
37
|
+
for (const id of meta.sections)
|
|
38
|
+
if (!(id in sections))
|
|
39
|
+
out.push({ level: 'block', message: `Section "${id}" is listed in skill.yaml but missing from the store.` });
|
|
40
|
+
if (!out.some(f => f.level === 'block'))
|
|
41
|
+
out.push({ level: 'ok', message: `${name} passed structure, owner and secret checks.` });
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
/** Check-up for a plain folder of docs before it becomes a workspace (used by init). */
|
|
45
|
+
export function scanFolder(dir) {
|
|
46
|
+
const files = [];
|
|
47
|
+
const walk = (d) => {
|
|
48
|
+
for (const e of fs.readdirSync(d, { withFileTypes: true })) {
|
|
49
|
+
if (e.name.startsWith('.') || e.name === 'node_modules')
|
|
50
|
+
continue;
|
|
51
|
+
const p = path.join(d, e.name);
|
|
52
|
+
if (e.isDirectory())
|
|
53
|
+
walk(p);
|
|
54
|
+
else if (/\.(md|mdx|txt|ya?ml|json)$/i.test(e.name))
|
|
55
|
+
files.push(p);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
walk(dir);
|
|
59
|
+
const findings = [];
|
|
60
|
+
for (const f of files) {
|
|
61
|
+
const rel = path.relative(dir, f);
|
|
62
|
+
fs.readFileSync(f, 'utf8').split('\n').forEach((line, i) => {
|
|
63
|
+
for (const s of findSensitive(line))
|
|
64
|
+
findings.push({ level: s.severity, message: `${aOrAn(s.kind)} ${s.kind} in ${rel}:${i + 1}. Move it out before release.`, file: rel, line: i + 1 });
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return { files, findings };
|
|
68
|
+
}
|
|
69
|
+
const aOrAn = (w) => (/^[aeiou]/i.test(w) ? 'An' : 'A');
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Correction, Receipt } from './types.js';
|
|
2
|
+
import { type Workspace } from './workspace.js';
|
|
3
|
+
import { type ReleaseOutcome } from './release.js';
|
|
4
|
+
export interface CorrectionInput {
|
|
5
|
+
skill: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
question: string;
|
|
8
|
+
answer?: string;
|
|
9
|
+
what_was_wrong: string;
|
|
10
|
+
suggested_rule?: string;
|
|
11
|
+
reporter_role?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Builds the scrubbed correction exactly as it would be written. Writes nothing. */
|
|
14
|
+
export declare function previewCorrection(ws: Workspace, input: CorrectionInput): Omit<Correction, 'id' | 'receipt_token' | 'created_at'>;
|
|
15
|
+
export declare function fileCorrection(ws: Workspace, input: CorrectionInput): Correction;
|
|
16
|
+
export declare function listCorrections(ws: Workspace, status?: Correction['status']): Correction[];
|
|
17
|
+
export declare function getCorrection(ws: Workspace, id: string): Correction;
|
|
18
|
+
export declare function saveCorrection(ws: Workspace, c: Correction): void;
|
|
19
|
+
/** Groups open corrections that look like the same problem (same skill, overlapping words). */
|
|
20
|
+
export declare function clusters(list: Correction[]): Correction[][];
|
|
21
|
+
export declare function vote(ws: Workspace, id: string, role: string, v: 1 | -1, note?: string): Correction;
|
|
22
|
+
export interface ApproveInput {
|
|
23
|
+
ids: string[];
|
|
24
|
+
section: string;
|
|
25
|
+
old_text?: string;
|
|
26
|
+
new_text: string;
|
|
27
|
+
test: {
|
|
28
|
+
question: string;
|
|
29
|
+
include: string[][];
|
|
30
|
+
exclude?: string[];
|
|
31
|
+
rubric?: string;
|
|
32
|
+
};
|
|
33
|
+
curator: string;
|
|
34
|
+
bump?: 'patch' | 'minor';
|
|
35
|
+
offline?: boolean;
|
|
36
|
+
onProgress?: (m: string) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The curator's approve: changes the rule in the knowledge store, adds a guard test so the
|
|
40
|
+
* mistake can't come back, signs and releases the next version, and writes receipts.
|
|
41
|
+
*/
|
|
42
|
+
export declare function approve(ws: Workspace, input: ApproveInput): Promise<ReleaseOutcome & {
|
|
43
|
+
receipts: Receipt[];
|
|
44
|
+
}>;
|
|
45
|
+
export declare function decline(ws: Workspace, id: string, curator: string, note: string): Correction;
|
|
46
|
+
export declare function makeReceipt(ws: Workspace, c: Correction, rec: {
|
|
47
|
+
skill: string;
|
|
48
|
+
version: string;
|
|
49
|
+
works_on: Record<string, {
|
|
50
|
+
tested: boolean;
|
|
51
|
+
failed: string[];
|
|
52
|
+
}>;
|
|
53
|
+
}): Receipt;
|
|
54
|
+
export declare function receiptsFor(ws: Workspace, tokens: string[]): Receipt[];
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { nowIso, readYaml, writeJson, writeYaml, readJson } from './workspace.js';
|
|
5
|
+
import { scrub } from './scrub.js';
|
|
6
|
+
import { bumpVersion, loadSkill, nextTestId, saveSkill, saveTest } from './skill.js';
|
|
7
|
+
import { openStore } from '../stores/index.js';
|
|
8
|
+
import { release } from './release.js';
|
|
9
|
+
/** Builds the scrubbed correction exactly as it would be written. Writes nothing. */
|
|
10
|
+
export function previewCorrection(ws, input) {
|
|
11
|
+
const meta = loadSkill(ws, input.skill);
|
|
12
|
+
const o = { names: ws.config.scrub.names, extra: ws.config.scrub.extra_patterns };
|
|
13
|
+
const removed = new Set();
|
|
14
|
+
const s = (t = '') => { const r = scrub(t, o); r.removed.forEach(x => removed.add(x)); return r.text; };
|
|
15
|
+
return {
|
|
16
|
+
skill: input.skill,
|
|
17
|
+
version: input.version ?? meta.version,
|
|
18
|
+
question: s(input.question),
|
|
19
|
+
answer_excerpt: s((input.answer ?? '').slice(0, 600)),
|
|
20
|
+
what_was_wrong: s(input.what_was_wrong),
|
|
21
|
+
suggested_rule: s(input.suggested_rule ?? ''),
|
|
22
|
+
reporter_role: (input.reporter_role ?? 'Colleague').replace(/[^A-Za-z &/-]/g, '').slice(0, 40) || 'Colleague',
|
|
23
|
+
status: 'open', removed: [...removed], votes: [],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function fileCorrection(ws, input) {
|
|
27
|
+
const c = { ...previewCorrection(ws, input), id: nextCorrectionId(ws), receipt_token: crypto.randomBytes(12).toString('hex'), created_at: nowIso() };
|
|
28
|
+
writeYaml(ws.records('corrections', `${c.id}.yaml`), c);
|
|
29
|
+
return c;
|
|
30
|
+
}
|
|
31
|
+
function nextCorrectionId(ws) {
|
|
32
|
+
const d = ws.records('corrections');
|
|
33
|
+
const n = fs.existsSync(d) ? fs.readdirSync(d).map(f => Number(f.match(/COR-(\d+)/)?.[1] ?? 0)) : [];
|
|
34
|
+
return `COR-${String((n.length ? Math.max(...n) : 0) + 1).padStart(3, '0')}`;
|
|
35
|
+
}
|
|
36
|
+
export function listCorrections(ws, status) {
|
|
37
|
+
const d = ws.records('corrections');
|
|
38
|
+
if (!fs.existsSync(d))
|
|
39
|
+
return [];
|
|
40
|
+
return fs.readdirSync(d).filter(f => f.endsWith('.yaml')).map(f => readYaml(path.join(d, f)))
|
|
41
|
+
.filter(c => !status || c.status === status).sort((a, b) => b.created_at.localeCompare(a.created_at));
|
|
42
|
+
}
|
|
43
|
+
export function getCorrection(ws, id) {
|
|
44
|
+
const f = ws.records('corrections', `${id}.yaml`);
|
|
45
|
+
if (!fs.existsSync(f))
|
|
46
|
+
throw new Error(`No correction ${id}`);
|
|
47
|
+
return readYaml(f);
|
|
48
|
+
}
|
|
49
|
+
export function saveCorrection(ws, c) { writeYaml(ws.records('corrections', `${c.id}.yaml`), c); }
|
|
50
|
+
/** Groups open corrections that look like the same problem (same skill, overlapping words). */
|
|
51
|
+
export function clusters(list) {
|
|
52
|
+
const key = (c) => new Set((c.what_was_wrong + ' ' + c.suggested_rule).toLowerCase().match(/[a-z]{5,}/g) ?? []);
|
|
53
|
+
const groups = [];
|
|
54
|
+
for (const c of list) {
|
|
55
|
+
const k = key(c);
|
|
56
|
+
const g = groups.find(g => g[0].skill === c.skill && overlap(key(g[0]), k) >= 0.5);
|
|
57
|
+
if (g)
|
|
58
|
+
g.push(c);
|
|
59
|
+
else
|
|
60
|
+
groups.push([c]);
|
|
61
|
+
}
|
|
62
|
+
return groups;
|
|
63
|
+
}
|
|
64
|
+
const overlap = (a, b) => { let n = 0; for (const x of a)
|
|
65
|
+
if (b.has(x))
|
|
66
|
+
n++; return n / Math.max(1, Math.min(a.size, b.size)); };
|
|
67
|
+
export function vote(ws, id, role, v, note) {
|
|
68
|
+
const c = getCorrection(ws, id);
|
|
69
|
+
c.votes = c.votes.filter(x => x.role !== role).concat({ role, vote: v, note });
|
|
70
|
+
saveCorrection(ws, c);
|
|
71
|
+
return c;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The curator's approve: changes the rule in the knowledge store, adds a guard test so the
|
|
75
|
+
* mistake can't come back, signs and releases the next version, and writes receipts.
|
|
76
|
+
*/
|
|
77
|
+
export async function approve(ws, input) {
|
|
78
|
+
const cors = input.ids.map(id => getCorrection(ws, id));
|
|
79
|
+
const skill = cors[0].skill;
|
|
80
|
+
if (cors.some(c => c.skill !== skill))
|
|
81
|
+
throw new Error('All corrections in one approval must be for the same skill.');
|
|
82
|
+
const meta = loadSkill(ws, skill);
|
|
83
|
+
if (!meta.sections.includes(input.section))
|
|
84
|
+
throw new Error(`Section "${input.section}" is not in ${skill}.`);
|
|
85
|
+
await openStore(ws).applyChange(meta, input.section, input.old_text ?? '', input.new_text);
|
|
86
|
+
const test = {
|
|
87
|
+
id: nextTestId(ws, skill), question: input.test.question,
|
|
88
|
+
expect: { include: input.test.include, exclude: input.test.exclude, rubric: input.test.rubric },
|
|
89
|
+
added_from: cors.map(c => c.id).join(', '), verified_on: nowIso().slice(0, 10),
|
|
90
|
+
};
|
|
91
|
+
saveTest(ws, skill, test);
|
|
92
|
+
meta.version = bumpVersion(meta.version, input.bump ?? 'patch');
|
|
93
|
+
saveSkill(ws, meta);
|
|
94
|
+
const out = await release(ws, skill, {
|
|
95
|
+
version: meta.version, corrections: cors.map(c => c.id), signedBy: input.curator, offline: input.offline,
|
|
96
|
+
changelog: `${input.new_text.split('\n')[0].slice(0, 120)} (${cors.map(c => c.id).join(', ')})`, onProgress: input.onProgress,
|
|
97
|
+
});
|
|
98
|
+
for (const c of cors) {
|
|
99
|
+
c.status = 'approved';
|
|
100
|
+
c.resolution = { version: meta.version, decided_at: nowIso(), decided_by: input.curator };
|
|
101
|
+
saveCorrection(ws, c);
|
|
102
|
+
}
|
|
103
|
+
const receipts = cors.map(c => makeReceipt(ws, c, out.record));
|
|
104
|
+
return { ...out, receipts };
|
|
105
|
+
}
|
|
106
|
+
export function decline(ws, id, curator, note) {
|
|
107
|
+
const c = getCorrection(ws, id);
|
|
108
|
+
c.status = 'declined';
|
|
109
|
+
c.resolution = { note, decided_at: nowIso(), decided_by: curator };
|
|
110
|
+
saveCorrection(ws, c);
|
|
111
|
+
return c;
|
|
112
|
+
}
|
|
113
|
+
export function makeReceipt(ws, c, rec) {
|
|
114
|
+
const ok = Object.entries(rec.works_on).filter(([, w]) => w.tested && w.failed.length === 0).map(([m]) => m);
|
|
115
|
+
const held = Object.entries(rec.works_on).filter(([, w]) => w.tested && w.failed.length > 0).map(([m]) => m);
|
|
116
|
+
const aud = ws.config.audience ?? {};
|
|
117
|
+
const live = ok.reduce((n, m) => n + (aud[m] ?? 0), 0);
|
|
118
|
+
const total = Object.values(aud).reduce((a, b) => a + b, 0);
|
|
119
|
+
const waiting = total ? total - live : undefined;
|
|
120
|
+
const subject = rec.skill;
|
|
121
|
+
const list = (xs) => xs.length <= 1 ? xs.join('') : `${xs.slice(0, -1).join(', ')} and ${xs[xs.length - 1]}`;
|
|
122
|
+
let message;
|
|
123
|
+
if (ok.length === 0)
|
|
124
|
+
message = `Your fix to ${subject} is approved in ${rec.skill} ${rec.version}. It goes live on each model once it passes the guard test there.`;
|
|
125
|
+
else if (total)
|
|
126
|
+
message = `Your fix to ${subject} is live for ${live} people, and it works on ${list(ok)}.` + (waiting ? ` The other ${waiting} get it once it passes on their model.` : '');
|
|
127
|
+
else
|
|
128
|
+
message = `Your fix to ${subject} is live in ${rec.skill} ${rec.version}, and it works on ${list(ok)}.` + (held.length ? ` People on ${list(held)} get it once it passes there.` : '');
|
|
129
|
+
const r = { correction: c.id, receipt_token: c.receipt_token, skill: rec.skill, version: rec.version, message, works_on: ok, held, live_for: total ? live : undefined, waiting, created_at: nowIso() };
|
|
130
|
+
writeJson(ws.records('receipts', `${c.id}.json`), r);
|
|
131
|
+
return r;
|
|
132
|
+
}
|
|
133
|
+
export function receiptsFor(ws, tokens) {
|
|
134
|
+
const d = ws.records('receipts');
|
|
135
|
+
if (!fs.existsSync(d))
|
|
136
|
+
return [];
|
|
137
|
+
return fs.readdirSync(d).map(f => readJson(path.join(d, f))).filter(r => tokens.includes(r.receipt_token));
|
|
138
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Workspace } from './workspace.js';
|
|
2
|
+
/** Escapes text for Slack mrkdwn, so a correction can't ping @channel or smuggle in a link. */
|
|
3
|
+
export declare const mrkdwn: (s: string) => string;
|
|
4
|
+
export interface DigestOptions {
|
|
5
|
+
deskUrl?: string;
|
|
6
|
+
/**
|
|
7
|
+
* true: add Approve buttons that the self-hosted Slack app answers (rung 2).
|
|
8
|
+
* false: link buttons only, which is all an incoming webhook can carry (rung 1).
|
|
9
|
+
*/
|
|
10
|
+
interactive?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** The curator's Monday digest: what to review, grouped, plus starter blanks still open. */
|
|
13
|
+
export declare function buildDigest(ws: Workspace, opts?: DigestOptions | string): Promise<{
|
|
14
|
+
headline: string;
|
|
15
|
+
text: string;
|
|
16
|
+
blocks: unknown[];
|
|
17
|
+
items: {
|
|
18
|
+
ids: string[];
|
|
19
|
+
skill: string;
|
|
20
|
+
version: string;
|
|
21
|
+
next: string | undefined;
|
|
22
|
+
summary: string;
|
|
23
|
+
roles: string[];
|
|
24
|
+
}[];
|
|
25
|
+
blanks: {
|
|
26
|
+
skill: string;
|
|
27
|
+
count: number;
|
|
28
|
+
filled: number;
|
|
29
|
+
total: number;
|
|
30
|
+
what: string[];
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
33
|
+
export declare function postDigest(webhook: string, digest: {
|
|
34
|
+
text: string;
|
|
35
|
+
blocks: unknown[];
|
|
36
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { clusters, listCorrections } from './corrections.js';
|
|
2
|
+
import { bumpVersion, findBlanks, loadSkill } from './skill.js';
|
|
3
|
+
import { openStore } from '../stores/index.js';
|
|
4
|
+
/** Escapes text for Slack mrkdwn, so a correction can't ping @channel or smuggle in a link. */
|
|
5
|
+
export const mrkdwn = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
6
|
+
/** The curator's Monday digest: what to review, grouped, plus starter blanks still open. */
|
|
7
|
+
export async function buildDigest(ws, opts = {}) {
|
|
8
|
+
const o = typeof opts === 'string' ? { deskUrl: opts } : opts;
|
|
9
|
+
const deskUrl = (o.deskUrl ?? ws.config.slack?.desk_url ?? 'http://localhost:4747').replace(/\/+$/, '');
|
|
10
|
+
const open = listCorrections(ws, 'open');
|
|
11
|
+
const groups = clusters(open);
|
|
12
|
+
const same = groups.filter(g => g.length > 1).reduce((n, g) => n + g.length, 0);
|
|
13
|
+
const items = groups.map(g => {
|
|
14
|
+
let next;
|
|
15
|
+
try {
|
|
16
|
+
next = bumpVersion(loadSkill(ws, g[0].skill).version);
|
|
17
|
+
}
|
|
18
|
+
catch { /* skill removed */ }
|
|
19
|
+
return {
|
|
20
|
+
ids: g.map(c => c.id), skill: g[0].skill, version: g[0].version, next,
|
|
21
|
+
summary: g[0].what_was_wrong.slice(0, 140), roles: [...new Set(g.map(c => c.reporter_role))],
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
const blanks = [];
|
|
25
|
+
for (const name of ws.listSkills()) {
|
|
26
|
+
const meta = loadSkill(ws, name);
|
|
27
|
+
if (!meta.starter)
|
|
28
|
+
continue;
|
|
29
|
+
try {
|
|
30
|
+
const sections = await openStore(ws).readSections(meta);
|
|
31
|
+
const b = findBlanks(sections);
|
|
32
|
+
const empty = new Set(b.map(x => x.section));
|
|
33
|
+
blanks.push({ skill: name, count: b.length, filled: meta.sections.length - empty.size, total: meta.sections.length, what: b.map(x => x.what) });
|
|
34
|
+
}
|
|
35
|
+
catch { /* store unreachable: skip in digest */ }
|
|
36
|
+
}
|
|
37
|
+
const openBlanks = blanks.filter(b => b.count);
|
|
38
|
+
const headline = open.length
|
|
39
|
+
? `${open.length} to review` + (same ? `, ${same} look like the same problem` : '')
|
|
40
|
+
: 'nothing to review';
|
|
41
|
+
const text = [
|
|
42
|
+
`Skill Monster · Monday feeding: ${headline}`,
|
|
43
|
+
...items.map(i => `• ${i.ids.join(' + ')} · ${i.skill} ${i.version}: ${i.summary} (${i.roles.join(', ')})`),
|
|
44
|
+
...openBlanks.map(b => `• ${b.skill}: ${b.filled} of ${b.total} sections filled, ${b.count} blanks open`),
|
|
45
|
+
...(open.length ? [] : ['The monster is hungry. Nobody has flagged a wrong answer this week.']),
|
|
46
|
+
`Review in the Desk: ${deskUrl}`,
|
|
47
|
+
].join('\n');
|
|
48
|
+
const list = (xs) => xs.length <= 1 ? xs.join('') : `${xs.slice(0, -1).join(', ')} and ${xs[xs.length - 1]}`;
|
|
49
|
+
const blocks = [
|
|
50
|
+
{ type: 'section', text: { type: 'mrkdwn', text: `*Monday feeding: ${mrkdwn(headline)}*` } },
|
|
51
|
+
];
|
|
52
|
+
if (!open.length)
|
|
53
|
+
blocks.push({ type: 'context', elements: [{ type: 'mrkdwn', text: 'The monster is hungry. Nobody has flagged a wrong answer this week.' }] });
|
|
54
|
+
for (const i of items.slice(0, 10)) {
|
|
55
|
+
const review = { type: 'button', text: { type: 'plain_text', text: 'Review' }, url: `${deskUrl}/#/review/${encodeURIComponent(i.ids[0])}`, action_id: `sm_review_${i.ids[0]}` };
|
|
56
|
+
blocks.push({
|
|
57
|
+
type: 'section',
|
|
58
|
+
text: { type: 'mrkdwn', text: `*${mrkdwn(i.ids.join(' + '))} · ${mrkdwn(i.skill)}*\n${mrkdwn(i.summary)} _(${mrkdwn(i.roles.join(', '))})_` },
|
|
59
|
+
...(o.interactive ? {} : { accessory: review }),
|
|
60
|
+
});
|
|
61
|
+
if (o.interactive) {
|
|
62
|
+
blocks.push({
|
|
63
|
+
type: 'actions', block_id: `sm_group_${i.ids[0]}`,
|
|
64
|
+
elements: [
|
|
65
|
+
review,
|
|
66
|
+
{ type: 'button', style: 'primary', text: { type: 'plain_text', text: i.next ? `Approve ${i.next}` : 'Approve' }, action_id: 'sm_approve', value: i.ids.join(',') },
|
|
67
|
+
{ type: 'button', text: { type: 'plain_text', text: 'Decline' }, action_id: 'sm_decline', value: i.ids.join(',') },
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (items.length > 10)
|
|
73
|
+
blocks.push({ type: 'context', elements: [{ type: 'mrkdwn', text: `${items.length - 10} more in the Desk.` }] });
|
|
74
|
+
if (openBlanks.length) {
|
|
75
|
+
const total = openBlanks.reduce((n, b) => n + b.count, 0);
|
|
76
|
+
const names = openBlanks.flatMap(b => b.what).slice(0, 6);
|
|
77
|
+
blocks.push({ type: 'divider' });
|
|
78
|
+
blocks.push({
|
|
79
|
+
type: 'section',
|
|
80
|
+
text: { type: 'mrkdwn', text: `*${total} starter blank${total === 1 ? '' : 's'} still open · ${mrkdwn(openBlanks.map(b => b.skill).join(', '))}*\n${mrkdwn(list(names))}` },
|
|
81
|
+
accessory: { type: 'button', text: { type: 'plain_text', text: 'Open Desk' }, url: deskUrl, action_id: 'sm_open_desk' },
|
|
82
|
+
});
|
|
83
|
+
blocks.push({ type: 'context', elements: openBlanks.map(b => ({ type: 'mrkdwn', text: `${mrkdwn(b.skill)}: ${b.filled}/${b.total} sections filled` })) });
|
|
84
|
+
}
|
|
85
|
+
return { headline, text, blocks, items, blanks };
|
|
86
|
+
}
|
|
87
|
+
export async function postDigest(webhook, digest) {
|
|
88
|
+
const r = await fetch(webhook, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: digest.text, blocks: digest.blocks }) });
|
|
89
|
+
if (!r.ok)
|
|
90
|
+
throw new Error(`Chat webhook failed: ${r.status} ${await r.text()}`);
|
|
91
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Workspace } from './workspace.js';
|
|
2
|
+
/**
|
|
3
|
+
* Exports a signed release in each vendor's shape, so no one hand-writes adapters.
|
|
4
|
+
* - agent-skill: SKILL.md folder (Agent Skills format: Claude, Claude Code and other skill-aware agents)
|
|
5
|
+
* - agents-md: one AGENTS.md file for coding agents
|
|
6
|
+
* - instructions: plain text for custom GPTs, Gemini Gems and system prompts
|
|
7
|
+
*/
|
|
8
|
+
export declare function exportSkill(ws: Workspace, name: string, format: 'agent-skill' | 'agents-md' | 'instructions', out: string, model?: string): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { readReleasedBundle, servedVersion } from './release.js';
|
|
4
|
+
import { trustFooterInstruction } from './skill.js';
|
|
5
|
+
/**
|
|
6
|
+
* Exports a signed release in each vendor's shape, so no one hand-writes adapters.
|
|
7
|
+
* - agent-skill: SKILL.md folder (Agent Skills format: Claude, Claude Code and other skill-aware agents)
|
|
8
|
+
* - agents-md: one AGENTS.md file for coding agents
|
|
9
|
+
* - instructions: plain text for custom GPTs, Gemini Gems and system prompts
|
|
10
|
+
*/
|
|
11
|
+
export function exportSkill(ws, name, format, out, model) {
|
|
12
|
+
const rec = servedVersion(ws, name, model);
|
|
13
|
+
if (!rec)
|
|
14
|
+
throw new Error(model ? `No release of ${name} passes its guard tests on ${model} yet.` : `${name} has no release yet. Run "skill-monster release ${name}".`);
|
|
15
|
+
const { meta, text } = readReleasedBundle(ws, rec);
|
|
16
|
+
const footer = trustFooterInstruction({ name, version: rec.version });
|
|
17
|
+
fs.mkdirSync(out, { recursive: true });
|
|
18
|
+
if (format === 'agent-skill') {
|
|
19
|
+
const dir = path.join(out, name);
|
|
20
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
21
|
+
const desc = meta.description.replace(/\n/g, ' ').slice(0, 1000);
|
|
22
|
+
fs.writeFileSync(path.join(dir, 'SKILL.md'), `---\nname: ${name}\ndescription: ${JSON.stringify(desc)}\n---\n<!-- ${name} ${rec.version} · signed by ${rec.signed_by} · do not edit, changes go through Skill Monster -->\n\n${footer}\n\n${text}`);
|
|
23
|
+
return dir;
|
|
24
|
+
}
|
|
25
|
+
const file = path.join(out, format === 'agents-md' ? 'AGENTS.md' : `${name}.instructions.txt`);
|
|
26
|
+
fs.writeFileSync(file, `<!-- ${name} ${rec.version} · signed by ${rec.signed_by} -->\n\n${footer}\n\n${text}`);
|
|
27
|
+
return file;
|
|
28
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ModelResult, SkillMeta } from './types.js';
|
|
2
|
+
import type { Workspace } from './workspace.js';
|
|
3
|
+
/**
|
|
4
|
+
* Guard tests answered outside Skill Monster. "test --emit-prompts" writes the system prompt
|
|
5
|
+
* and every question to a file; whoever has model access (an agent on the company's own
|
|
6
|
+
* account, a person in a chat window) fills in each answer and, for rubric tests, a verdict;
|
|
7
|
+
* "test --answers" grades the file. Nothing here calls a model or needs a key.
|
|
8
|
+
*/
|
|
9
|
+
export interface PromptFile {
|
|
10
|
+
how_to: string;
|
|
11
|
+
skill: string;
|
|
12
|
+
version: string;
|
|
13
|
+
content_hash: string;
|
|
14
|
+
model: string;
|
|
15
|
+
system: string;
|
|
16
|
+
judge_instructions: string;
|
|
17
|
+
tests: {
|
|
18
|
+
id: string;
|
|
19
|
+
question: string;
|
|
20
|
+
rubric?: string;
|
|
21
|
+
answer: string;
|
|
22
|
+
verdict?: string;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
export declare function contentHash(ws: Workspace, meta: SkillMeta): Promise<{
|
|
26
|
+
hash: string;
|
|
27
|
+
bundle: string;
|
|
28
|
+
tests: import("./types.js").GuardTest[];
|
|
29
|
+
}>;
|
|
30
|
+
export declare const HOW_TO = "Fill in \"answer\" for every test, then \"verdict\" for every test that has a \"rubric\".\n1. Answer each question in a FRESH context that sees only \"system\" as its system prompt and the question as the user message: a new chat or a subagent. Do not answer from your own knowledge of the knowledge base; that defeats the test.\n2. Paste the model's reply into \"answer\" exactly as it came back. Do not edit or improve it.\n3. For a test with a \"rubric\", ask a fresh context with \"judge_instructions\" as its system prompt and this as the user message: \"Rule: <rubric>\\n\\nQuestion: <question>\\n\\nAnswer: <answer>\". Put its reply in \"verdict\" (it starts with PASS or FAIL).\n4. Set \"model\" to the model you used, e.g. \"Claude\". Change nothing else, then run: skill-monster test <skill> --answers <this file>\nThe file stays valid for \"release --bump\" as long as the content and tests don't change: the version number is not part of the check.";
|
|
31
|
+
export declare function emitPrompts(ws: Workspace, meta: SkillMeta, model?: string): Promise<PromptFile>;
|
|
32
|
+
export declare function writePromptFile(file: string, p: PromptFile): void;
|
|
33
|
+
/**
|
|
34
|
+
* The same prompts as one file per test, so whoever answers copies nothing between files:
|
|
35
|
+
* system.md, judge.md the two system prompts
|
|
36
|
+
* test-01.question.md the user message for test-01
|
|
37
|
+
* test-01.answer.md write the reply here, exactly as it came back
|
|
38
|
+
* test-01.judge-prompt.md written by "test --answers <dir>" once the answer exists (rubric tests only)
|
|
39
|
+
* test-01.verdict.md write the judge's reply here
|
|
40
|
+
* manifest.yaml skill, version, content hash, model: change only "model"
|
|
41
|
+
*/
|
|
42
|
+
export declare const DIR_HOW_TO = "One file per guard test. For each test-NN.question.md:\n1. In a FRESH context whose system prompt is exactly system.md, send the question file's text as the user message. Never answer from your own knowledge of the knowledge base.\n2. Save the reply, exactly as it came back, as test-NN.answer.md.\nThen run: skill-monster test <skill> --answers <this folder>\nIt grades the answers and writes test-NN.judge-prompt.md for every rubric test that still needs a verdict.\n3. For each judge prompt, ask a FRESH context whose system prompt is exactly judge.md, with the judge prompt's text as the user message. Save its reply (it starts with PASS or FAIL) as test-NN.verdict.md.\n4. Set \"model\" in manifest.yaml to the model you used, then run the same test --answers command again, or release with --answers <this folder>.\nThe folder stays valid until the content or the tests change; then emit a fresh folder.";
|
|
43
|
+
export declare function writePromptDir(dir: string, p: PromptFile): void;
|
|
44
|
+
export declare const judgePrompt: (rubric: string, question: string, answer: string) => string;
|
|
45
|
+
export declare const isPromptDir: (f: string) => boolean;
|
|
46
|
+
export declare function readPromptFile(file: string): PromptFile;
|
|
47
|
+
/** Grades an answers file. Refuses a file made for different content, so stale answers can't pass a new version. */
|
|
48
|
+
export declare function gradeAnswers(ws: Workspace, meta: SkillMeta, file: string): Promise<ModelResult>;
|