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
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import YAML from 'yaml';
|
|
4
|
+
import { loadTests, readContent, renderBundle, trustFooterInstruction } from './skill.js';
|
|
5
|
+
import { gradeDeterministic, JUDGE_SYSTEM } from './guard.js';
|
|
6
|
+
import { sha256 } from './sign.js';
|
|
7
|
+
export async function contentHash(ws, meta) {
|
|
8
|
+
const { entry, sections } = await readContent(ws, meta);
|
|
9
|
+
const bundle = renderBundle(meta, entry, sections);
|
|
10
|
+
const tests = loadTests(ws, meta.name);
|
|
11
|
+
return { hash: sha256(bundle + '\n' + JSON.stringify(tests)).slice(0, 16), bundle, tests };
|
|
12
|
+
}
|
|
13
|
+
export const HOW_TO = `Fill in "answer" for every test, then "verdict" for every test that has a "rubric".
|
|
14
|
+
1. 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.
|
|
15
|
+
2. Paste the model's reply into "answer" exactly as it came back. Do not edit or improve it.
|
|
16
|
+
3. 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).
|
|
17
|
+
4. Set "model" to the model you used, e.g. "Claude". Change nothing else, then run: skill-monster test <skill> --answers <this file>
|
|
18
|
+
The 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.`;
|
|
19
|
+
export async function emitPrompts(ws, meta, model = 'Claude') {
|
|
20
|
+
const { hash, bundle, tests } = await contentHash(ws, meta);
|
|
21
|
+
return {
|
|
22
|
+
how_to: HOW_TO,
|
|
23
|
+
skill: meta.name,
|
|
24
|
+
version: meta.version,
|
|
25
|
+
content_hash: hash,
|
|
26
|
+
model,
|
|
27
|
+
system: `${trustFooterInstruction(meta)}\n\n${bundle}`,
|
|
28
|
+
judge_instructions: JUDGE_SYSTEM,
|
|
29
|
+
tests: tests.map(t => ({ id: t.id, question: t.question, ...(t.expect.rubric ? { rubric: t.expect.rubric } : {}), answer: '', ...(t.expect.rubric ? { verdict: '' } : {}) })),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function writePromptFile(file, p) {
|
|
33
|
+
fs.writeFileSync(file, YAML.stringify(p, { lineWidth: 0, blockQuote: 'literal' }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The same prompts as one file per test, so whoever answers copies nothing between files:
|
|
37
|
+
* system.md, judge.md the two system prompts
|
|
38
|
+
* test-01.question.md the user message for test-01
|
|
39
|
+
* test-01.answer.md write the reply here, exactly as it came back
|
|
40
|
+
* test-01.judge-prompt.md written by "test --answers <dir>" once the answer exists (rubric tests only)
|
|
41
|
+
* test-01.verdict.md write the judge's reply here
|
|
42
|
+
* manifest.yaml skill, version, content hash, model: change only "model"
|
|
43
|
+
*/
|
|
44
|
+
export const DIR_HOW_TO = `One file per guard test. For each test-NN.question.md:
|
|
45
|
+
1. 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.
|
|
46
|
+
2. Save the reply, exactly as it came back, as test-NN.answer.md.
|
|
47
|
+
Then run: skill-monster test <skill> --answers <this folder>
|
|
48
|
+
It grades the answers and writes test-NN.judge-prompt.md for every rubric test that still needs a verdict.
|
|
49
|
+
3. 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.
|
|
50
|
+
4. Set "model" in manifest.yaml to the model you used, then run the same test --answers command again, or release with --answers <this folder>.
|
|
51
|
+
The folder stays valid until the content or the tests change; then emit a fresh folder.`;
|
|
52
|
+
export function writePromptDir(dir, p) {
|
|
53
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
54
|
+
const w = (f, t) => fs.writeFileSync(path.join(dir, f), t.replace(/\s*$/, '') + '\n');
|
|
55
|
+
w('HOW_TO.md', DIR_HOW_TO);
|
|
56
|
+
w('system.md', p.system);
|
|
57
|
+
w('judge.md', p.judge_instructions);
|
|
58
|
+
fs.writeFileSync(path.join(dir, 'manifest.yaml'), YAML.stringify({ skill: p.skill, version: p.version, content_hash: p.content_hash, model: p.model }));
|
|
59
|
+
// Answers from an earlier emit would be graded against new content: start the folder clean.
|
|
60
|
+
for (const f of fs.readdirSync(dir))
|
|
61
|
+
if (/\.(question|answer|verdict|judge-prompt)\.md$/.test(f))
|
|
62
|
+
fs.rmSync(path.join(dir, f));
|
|
63
|
+
for (const t of p.tests)
|
|
64
|
+
w(`${t.id}.question.md`, t.question);
|
|
65
|
+
}
|
|
66
|
+
export const judgePrompt = (rubric, question, answer) => `Rule: ${rubric}\n\nQuestion: ${question}\n\nAnswer: ${answer}`;
|
|
67
|
+
function readPromptDir(dir) {
|
|
68
|
+
const mf = path.join(dir, 'manifest.yaml');
|
|
69
|
+
if (!fs.existsSync(mf))
|
|
70
|
+
throw new Error(`${dir} has no manifest.yaml. Make the folder with: skill-monster test <skill> --emit-prompts ${dir}/`);
|
|
71
|
+
const m = YAML.parse(fs.readFileSync(mf, 'utf8'));
|
|
72
|
+
const read = (f) => { const x = path.join(dir, f); return fs.existsSync(x) ? fs.readFileSync(x, 'utf8').replace(/\r\n/g, '\n').trim() : ''; };
|
|
73
|
+
const ids = fs.readdirSync(dir).map(f => f.match(/^(.+)\.question\.md$/)?.[1]).filter((x) => !!x).sort();
|
|
74
|
+
return {
|
|
75
|
+
how_to: DIR_HOW_TO, ...m, system: read('system.md'), judge_instructions: read('judge.md'),
|
|
76
|
+
tests: ids.map(id => ({ id, question: read(`${id}.question.md`), answer: read(`${id}.answer.md`), verdict: read(`${id}.verdict.md`) })),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export const isPromptDir = (f) => /[\\/]$/.test(f) || (fs.existsSync(f) && fs.statSync(f).isDirectory());
|
|
80
|
+
export function readPromptFile(file) {
|
|
81
|
+
if (isPromptDir(file))
|
|
82
|
+
return readPromptDir(file);
|
|
83
|
+
const p = YAML.parse(fs.readFileSync(file, 'utf8'));
|
|
84
|
+
if (!p || !Array.isArray(p.tests))
|
|
85
|
+
throw new Error(`${file} is not an answers file from "skill-monster test --emit-prompts".`);
|
|
86
|
+
return p;
|
|
87
|
+
}
|
|
88
|
+
/** Grades an answers file. Refuses a file made for different content, so stale answers can't pass a new version. */
|
|
89
|
+
export async function gradeAnswers(ws, meta, file) {
|
|
90
|
+
const p = readPromptFile(file);
|
|
91
|
+
if (p.skill !== meta.name)
|
|
92
|
+
throw new Error(`${file} is for skill "${p.skill}", not "${meta.name}".`);
|
|
93
|
+
const { hash, tests } = await contentHash(ws, meta);
|
|
94
|
+
if (p.content_hash !== hash) {
|
|
95
|
+
throw new Error(`The skill or its tests changed since ${file} was made. Run "skill-monster test ${meta.name} --emit-prompts <file>" again and answer the new file.`);
|
|
96
|
+
}
|
|
97
|
+
const asDir = isPromptDir(file);
|
|
98
|
+
const given = new Map(p.tests.map(t => [t.id, t]));
|
|
99
|
+
const outcomes = tests.map(t => {
|
|
100
|
+
const a = given.get(t.id);
|
|
101
|
+
const answer = String(a?.answer ?? '').trim();
|
|
102
|
+
if (!answer)
|
|
103
|
+
return { id: t.id, pass: false, reason: asDir ? `No answer: save the reply to ${t.id}.question.md as ${t.id}.answer.md` : 'No answer in the file' };
|
|
104
|
+
let g = gradeDeterministic(t, answer);
|
|
105
|
+
if (g.pass && t.expect.rubric) {
|
|
106
|
+
const v = String(a?.verdict ?? '').trim();
|
|
107
|
+
if (!v && asDir) {
|
|
108
|
+
fs.writeFileSync(path.join(file, `${t.id}.judge-prompt.md`), judgePrompt(t.expect.rubric, t.question, answer) + '\n');
|
|
109
|
+
g = { pass: false, reason: `Needs a verdict: answer ${t.id}.judge-prompt.md with judge.md as the system prompt, save the reply as ${t.id}.verdict.md` };
|
|
110
|
+
}
|
|
111
|
+
else if (!v)
|
|
112
|
+
g = { pass: false, reason: 'Rubric test has no verdict in the file' };
|
|
113
|
+
else if (!/^\s*\**\s*PASS/i.test(v))
|
|
114
|
+
g = { pass: false, reason: `Judge: ${v.replace(/^\s*\**\s*FAIL[\s:*-]*/i, '').slice(0, 160)}` };
|
|
115
|
+
}
|
|
116
|
+
return { id: t.id, pass: g.pass, reason: g.reason, answer: answer.slice(0, 800) };
|
|
117
|
+
});
|
|
118
|
+
const model = String(p.model || 'Claude').slice(0, 40);
|
|
119
|
+
// The hash covers the content and the tests, not the version number, so answers made at 0.1.0
|
|
120
|
+
// still count for 0.2.0 when nothing else changed. Only the version in the trust footer differs.
|
|
121
|
+
const note = p.version && p.version !== meta.version ? `Answers were made at ${p.version}; the content and tests are unchanged, so they count for ${meta.version}. Only the version in the "Answered from" line differs.` : undefined;
|
|
122
|
+
return {
|
|
123
|
+
model, provider: 'answers file', outcomes, ...(note ? { note } : {}),
|
|
124
|
+
pass: outcomes.filter(o => o.pass).length, total: outcomes.length,
|
|
125
|
+
failed: outcomes.filter(o => !o.pass).map(o => o.id),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GuardTest, ModelConfig, ModelResult } from './types.js';
|
|
2
|
+
export declare const JUDGE_SYSTEM = "You check answers against a rule. Reply with exactly PASS or FAIL, then a short reason.";
|
|
3
|
+
/** Grades one answer against a guard test. Deterministic checks first, then an optional judge. */
|
|
4
|
+
export declare function gradeDeterministic(t: GuardTest, answer: string): {
|
|
5
|
+
pass: boolean;
|
|
6
|
+
reason: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function runTests(bundle: string, system: string, tests: GuardTest[], m: ModelConfig, opts?: {
|
|
9
|
+
concurrency?: number;
|
|
10
|
+
}): Promise<ModelResult>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ask, MissingKeyError } from '../providers/index.js';
|
|
2
|
+
export const JUDGE_SYSTEM = 'You check answers against a rule. Reply with exactly PASS or FAIL, then a short reason.';
|
|
3
|
+
/** Grades one answer against a guard test. Deterministic checks first, then an optional judge. */
|
|
4
|
+
export function gradeDeterministic(t, answer) {
|
|
5
|
+
const a = norm(answer);
|
|
6
|
+
for (const group of t.expect.include ?? []) {
|
|
7
|
+
if (!group.some(p => a.includes(norm(p))))
|
|
8
|
+
return { pass: false, reason: `Expected the answer to say: ${group.join(' / ')}` };
|
|
9
|
+
}
|
|
10
|
+
for (const bad of t.expect.exclude ?? []) {
|
|
11
|
+
if (a.includes(norm(bad)))
|
|
12
|
+
return { pass: false, reason: `The answer said "${bad}", which it must not` };
|
|
13
|
+
}
|
|
14
|
+
return { pass: true, reason: 'Matched expected answer' };
|
|
15
|
+
}
|
|
16
|
+
const norm = (s) => s.toLowerCase().replace(/[’']/g, "'").replace(/\s+/g, ' ');
|
|
17
|
+
export async function runTests(bundle, system, tests, m, opts = {}) {
|
|
18
|
+
const outcomes = new Array(tests.length);
|
|
19
|
+
try {
|
|
20
|
+
let i = 0;
|
|
21
|
+
const worker = async () => {
|
|
22
|
+
while (i < tests.length) {
|
|
23
|
+
const k = i++;
|
|
24
|
+
const t = tests[k];
|
|
25
|
+
const answer = await ask(m, { system: `${system}\n\n${bundle}`, user: t.question });
|
|
26
|
+
let g = gradeDeterministic(t, answer);
|
|
27
|
+
if (g.pass && t.expect.rubric) {
|
|
28
|
+
const verdict = await ask(m, {
|
|
29
|
+
system: JUDGE_SYSTEM,
|
|
30
|
+
user: `Rule: ${t.expect.rubric}\n\nQuestion: ${t.question}\n\nAnswer: ${answer}`, maxTokens: 80,
|
|
31
|
+
});
|
|
32
|
+
g = /^\s*PASS/i.test(verdict) ? g : { pass: false, reason: `Judge: ${verdict.replace(/^\s*FAIL[:\s-]*/i, '').slice(0, 160)}` };
|
|
33
|
+
}
|
|
34
|
+
outcomes[k] = { id: t.id, pass: g.pass, reason: g.reason, answer: answer.slice(0, 800) };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
await Promise.all(Array.from({ length: Math.min(opts.concurrency ?? 3, tests.length) }, worker));
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
const skipped = e instanceof MissingKeyError ? `skipped: ${e.message}` : `error: ${e.message}`;
|
|
41
|
+
return { model: m.name, provider: m.provider, pass: 0, total: tests.length, failed: [], outcomes: [], skipped };
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
model: m.name, provider: m.provider, outcomes,
|
|
45
|
+
pass: outcomes.filter(o => o.pass).length, total: tests.length,
|
|
46
|
+
failed: outcomes.filter(o => !o.pass).map(o => o.id),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SkillMeta } from './types.js';
|
|
2
|
+
export type Wiki = 'notion' | 'confluence';
|
|
3
|
+
/**
|
|
4
|
+
* Agent-pushed mirroring. "read --dir" writes one Markdown file per section; anything that can
|
|
5
|
+
* reach the team's wiki (an agent with a Notion or Confluence connector, a person) copies them
|
|
6
|
+
* across and back; "write --dir" takes the edited files in. Skill Monster needs no token for it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeMirror(meta: SkillMeta, sections: Record<string, string>, dir: string, wikiArg?: Wiki): string[];
|
|
9
|
+
/**
|
|
10
|
+
* mirror.yaml in the mirror folder remembers which wiki page holds each section and a hash of
|
|
11
|
+
* what was last pasted there, so a re-run lists only the pages that need pasting again.
|
|
12
|
+
* It holds page links, so it stays in the company with the rest of the folder.
|
|
13
|
+
*/
|
|
14
|
+
export interface MirrorState {
|
|
15
|
+
pages: Record<string, string>;
|
|
16
|
+
pasted: Record<string, string>;
|
|
17
|
+
wiki?: Wiki;
|
|
18
|
+
}
|
|
19
|
+
export declare function loadMirrorState(dir: string): MirrorState;
|
|
20
|
+
export declare function saveMirrorState(dir: string, st: MirrorState): void;
|
|
21
|
+
export type MirrorRowStatus = 'up to date' | 'paste again' | 'new page' | 'no file';
|
|
22
|
+
export declare function mirrorStatus(meta: SkillMeta, dir: string): {
|
|
23
|
+
id: string;
|
|
24
|
+
page: string;
|
|
25
|
+
status: MirrorRowStatus;
|
|
26
|
+
}[];
|
|
27
|
+
/** Record that these sections' files were pasted into their pages (and, optionally, which page). */
|
|
28
|
+
export declare function markPasted(meta: SkillMeta, dir: string, ids: string[], page?: string): string[];
|
|
29
|
+
export declare function readMirror(meta: SkillMeta, dir: string): Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Undo what a wiki round trip does to Markdown that nobody edited: the page title holds the
|
|
32
|
+
* section heading, so the pasted text may lack it; connectors may return inline code as
|
|
33
|
+
* <code>…</code>, line breaks as <br>, and escape &, < and >.
|
|
34
|
+
*/
|
|
35
|
+
export declare function normalizeMirrored(incoming: string, current: string): string;
|
|
36
|
+
/** Sections whose mirror file differs from the store, after normalizing. */
|
|
37
|
+
export declare function mirrorChanges(incoming: Record<string, string>, current: Record<string, string>): Record<string, string>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import YAML from 'yaml';
|
|
4
|
+
import { sha256 } from './sign.js';
|
|
5
|
+
import { looksLikeStorage, markdownToStorage, storageToMarkdown } from '../stores/confluence-format.js';
|
|
6
|
+
/**
|
|
7
|
+
* Agent-pushed mirroring. "read --dir" writes one Markdown file per section; anything that can
|
|
8
|
+
* reach the team's wiki (an agent with a Notion or Confluence connector, a person) copies them
|
|
9
|
+
* across and back; "write --dir" takes the edited files in. Skill Monster needs no token for it.
|
|
10
|
+
*/
|
|
11
|
+
export function writeMirror(meta, sections, dir, wikiArg) {
|
|
12
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
13
|
+
const st = loadMirrorState(dir);
|
|
14
|
+
const wiki = wikiArg ?? st.wiki;
|
|
15
|
+
if (wikiArg && wikiArg !== st.wiki)
|
|
16
|
+
saveMirrorState(dir, { ...st, wiki: wikiArg });
|
|
17
|
+
const files = [];
|
|
18
|
+
for (const id of meta.sections) {
|
|
19
|
+
const f = path.join(dir, `${id}.md`);
|
|
20
|
+
fs.writeFileSync(f, (sections[id] ?? '').replace(/\s*$/, '') + '\n');
|
|
21
|
+
files.push(f);
|
|
22
|
+
}
|
|
23
|
+
if (wiki === 'confluence') {
|
|
24
|
+
// For connectors that only take Confluence storage format (XHTML). Title heading left out: the page title holds it.
|
|
25
|
+
const sdir = path.join(dir, 'confluence');
|
|
26
|
+
fs.mkdirSync(sdir, { recursive: true });
|
|
27
|
+
for (const id of meta.sections)
|
|
28
|
+
fs.writeFileSync(path.join(sdir, `${id}.html`), markdownToStorage((sections[id] ?? '').replace(/^\s*#\s+[^\n]*\n/, '')) + '\n');
|
|
29
|
+
}
|
|
30
|
+
const heading = (id) => (sections[id] ?? '').match(/^#\s+(.+)$/m)?.[1]?.trim() ?? id;
|
|
31
|
+
// Confluence titles must be unique in a space, so they start with the skill's title.
|
|
32
|
+
const title = (id) => (wiki === 'confluence' ? `${meta.title ?? meta.name}: ${heading(id)}` : heading(id));
|
|
33
|
+
const rows = mirrorStatus(meta, dir);
|
|
34
|
+
const intro = wiki === 'confluence' ? [
|
|
35
|
+
'One file per section. To mirror into Confluence, pick one parent page in the space (a new, empty one for a test),',
|
|
36
|
+
'make one child page per file, titled exactly as below (Confluence titles must be unique in a space), and give it the file\'s Markdown.',
|
|
37
|
+
'Leave out the first line (the "# " heading): the page title holds it. If your connector asks for a body format, choose Markdown.',
|
|
38
|
+
'If it only takes storage format (XHTML), use confluence/<file id>.html instead: the same content, already converted.',
|
|
39
|
+
] : [
|
|
40
|
+
'One file per section. To mirror into a wiki such as Notion, make one page per file under the skill\'s page,',
|
|
41
|
+
'titled as below, and paste the file\'s Markdown. You can leave out the first line (the "# " heading): the page title holds it.',
|
|
42
|
+
];
|
|
43
|
+
fs.writeFileSync(path.join(dir, 'MIRROR.md'), [
|
|
44
|
+
`# ${meta.title ?? meta.name} ${meta.version}: mirror`,
|
|
45
|
+
'',
|
|
46
|
+
...intro,
|
|
47
|
+
`After pasting, record it: skill-monster mirror ${meta.name} --dir <this folder> --pasted <file id or all> [--page <link>]`,
|
|
48
|
+
'Then the Status column shows which pages need pasting again after the next release.',
|
|
49
|
+
'',
|
|
50
|
+
'To bring edits back, save each page\'s Markdown over its file and run:',
|
|
51
|
+
`skill-monster write ${meta.name} --dir <this folder> (add --dry-run to only list what differs)`,
|
|
52
|
+
'A missing title heading and the HTML some connectors return (<code>, <br>, &) are not counted as edits.',
|
|
53
|
+
...(wiki === 'confluence' ? ['A page\'s storage format (XHTML) saved into the .md file works too: it is converted back to Markdown.'] : []),
|
|
54
|
+
'',
|
|
55
|
+
'| File | Page title | Page | Status |',
|
|
56
|
+
'|---|---|---|---|',
|
|
57
|
+
...rows.map(r => `| ${r.id}.md | ${title(r.id).replace(/\|/g, '\\|')} | ${r.page ?? '–'} | ${r.status} |`),
|
|
58
|
+
'',
|
|
59
|
+
].join('\n'));
|
|
60
|
+
return files;
|
|
61
|
+
}
|
|
62
|
+
const STATE = 'mirror.yaml';
|
|
63
|
+
export function loadMirrorState(dir) {
|
|
64
|
+
const f = path.join(dir, STATE);
|
|
65
|
+
const raw = fs.existsSync(f) ? (YAML.parse(fs.readFileSync(f, 'utf8')) ?? {}) : {};
|
|
66
|
+
return { pages: raw.pages ?? {}, pasted: raw.pasted ?? {}, ...(raw.wiki ? { wiki: raw.wiki } : {}) };
|
|
67
|
+
}
|
|
68
|
+
export function saveMirrorState(dir, st) {
|
|
69
|
+
fs.writeFileSync(path.join(dir, STATE), '# Which page holds each section, and a hash of what was last pasted there. Written by skill-monster mirror.\n' + YAML.stringify(st));
|
|
70
|
+
}
|
|
71
|
+
const fileHash = (dir, id) => {
|
|
72
|
+
const f = path.join(dir, `${id}.md`);
|
|
73
|
+
return fs.existsSync(f) ? sha256(fs.readFileSync(f, 'utf8').replace(/\r\n/g, '\n').trim()).slice(0, 16) : undefined;
|
|
74
|
+
};
|
|
75
|
+
export function mirrorStatus(meta, dir) {
|
|
76
|
+
const st = loadMirrorState(dir);
|
|
77
|
+
return meta.sections.map(id => {
|
|
78
|
+
const h = fileHash(dir, id);
|
|
79
|
+
const status = !h ? 'no file' : !st.pasted[id] ? 'new page' : st.pasted[id] === h ? 'up to date' : 'paste again';
|
|
80
|
+
return { id, page: st.pages[id], status };
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** Record that these sections' files were pasted into their pages (and, optionally, which page). */
|
|
84
|
+
export function markPasted(meta, dir, ids, page) {
|
|
85
|
+
const st = loadMirrorState(dir);
|
|
86
|
+
const all = ids.includes('all') ? meta.sections : ids;
|
|
87
|
+
if (page && all.length !== 1)
|
|
88
|
+
throw new Error('--page names one page, so give one section with --pasted.');
|
|
89
|
+
for (const id of all) {
|
|
90
|
+
if (!meta.sections.includes(id))
|
|
91
|
+
throw new Error(`No section "${id}". Sections: ${meta.sections.join(', ')}`);
|
|
92
|
+
const h = fileHash(dir, id);
|
|
93
|
+
if (!h)
|
|
94
|
+
throw new Error(`No ${id}.md in ${dir}. Run: skill-monster read ${meta.name} --dir ${dir}`);
|
|
95
|
+
st.pasted[id] = h;
|
|
96
|
+
if (page)
|
|
97
|
+
st.pages[id] = page;
|
|
98
|
+
}
|
|
99
|
+
saveMirrorState(dir, st);
|
|
100
|
+
return all;
|
|
101
|
+
}
|
|
102
|
+
export function readMirror(meta, dir) {
|
|
103
|
+
if (!fs.existsSync(dir))
|
|
104
|
+
throw new Error(`No folder ${dir}. Make it with: skill-monster read ${meta.name} --dir ${dir}`);
|
|
105
|
+
const out = {};
|
|
106
|
+
for (const id of meta.sections) {
|
|
107
|
+
const f = path.join(dir, `${id}.md`);
|
|
108
|
+
if (fs.existsSync(f))
|
|
109
|
+
out[id] = fs.readFileSync(f, 'utf8').replace(/\r\n/g, '\n');
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Undo what a wiki round trip does to Markdown that nobody edited: the page title holds the
|
|
115
|
+
* section heading, so the pasted text may lack it; connectors may return inline code as
|
|
116
|
+
* <code>…</code>, line breaks as <br>, and escape &, < and >.
|
|
117
|
+
*/
|
|
118
|
+
export function normalizeMirrored(incoming, current) {
|
|
119
|
+
let t = incoming.replace(/\r\n/g, '\n');
|
|
120
|
+
if (looksLikeStorage(t))
|
|
121
|
+
t = storageToMarkdown(t);
|
|
122
|
+
t = t
|
|
123
|
+
.replace(/<code>([\s\S]*?)<\/code>/g, (_m, x) => '`' + x + '`')
|
|
124
|
+
.replace(/<br\s*\/?>/gi, '\n')
|
|
125
|
+
.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&');
|
|
126
|
+
const heading = current.match(/^\s*(#\s+[^\n]+)\n/)?.[1];
|
|
127
|
+
if (heading && !/^\s*#\s/.test(t))
|
|
128
|
+
t = `${heading}\n\n${t.replace(/^\s+/, '')}`;
|
|
129
|
+
return t;
|
|
130
|
+
}
|
|
131
|
+
/** Sections whose mirror file differs from the store, after normalizing. */
|
|
132
|
+
export function mirrorChanges(incoming, current) {
|
|
133
|
+
const out = {};
|
|
134
|
+
for (const [k, v] of Object.entries(incoming)) {
|
|
135
|
+
const cur = current[k] ?? '';
|
|
136
|
+
const n = normalizeMirrored(v, cur);
|
|
137
|
+
if (canon(n) === canon(cur))
|
|
138
|
+
continue;
|
|
139
|
+
// Storage format comes back in the converter's own Markdown style (_italic_, blank lines between blocks),
|
|
140
|
+
// so compare it with the current text after the same round trip.
|
|
141
|
+
if (looksLikeStorage(v.trim()) && canon(n) === canon(normalizeMirrored(storageToMarkdown(markdownToStorage(cur)), cur)))
|
|
142
|
+
continue;
|
|
143
|
+
out[k] = n;
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/** Text compared for "did anyone edit this": trailing spaces, blank lines and the bullet marker don't count. */
|
|
148
|
+
const canon = (s) => s.replace(/\r\n/g, '\n').split('\n').map(l => l.replace(/\s+$/, '').replace(/^(\s*)\* /, '$1- ')).filter(Boolean).join('\n');
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ModelResult, ReleaseRecord, SkillMeta } from './types.js';
|
|
2
|
+
import { type Workspace } from './workspace.js';
|
|
3
|
+
import { type Finding } from './checkup.js';
|
|
4
|
+
export interface ReleaseOptions {
|
|
5
|
+
version?: string;
|
|
6
|
+
changelog?: string;
|
|
7
|
+
corrections?: string[];
|
|
8
|
+
signedBy?: string;
|
|
9
|
+
/** Skip calling models (works-on shows "not tested"). */
|
|
10
|
+
offline?: boolean;
|
|
11
|
+
/** Grade answers from a file (test --emit-prompts) instead of calling that model. */
|
|
12
|
+
answersFile?: string;
|
|
13
|
+
/** false: don't commit or tag, even in a git repository. */
|
|
14
|
+
git?: boolean;
|
|
15
|
+
onProgress?: (msg: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface ReleaseOutcome {
|
|
18
|
+
record: ReleaseRecord;
|
|
19
|
+
results: ModelResult[];
|
|
20
|
+
findings: Finding[];
|
|
21
|
+
git: GitOutcome;
|
|
22
|
+
}
|
|
23
|
+
export declare class BlockedError extends Error {
|
|
24
|
+
findings: Finding[];
|
|
25
|
+
constructor(findings: Finding[]);
|
|
26
|
+
}
|
|
27
|
+
export declare function releaseDir(ws: Workspace, skill: string, version?: string): string;
|
|
28
|
+
export declare function listReleases(ws: Workspace, skill: string): ReleaseRecord[];
|
|
29
|
+
export declare function testSkill(ws: Workspace, meta: SkillMeta, opts?: {
|
|
30
|
+
offline?: boolean;
|
|
31
|
+
models?: string[];
|
|
32
|
+
answersFile?: string;
|
|
33
|
+
onProgress?: (m: string) => void;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
results: ModelResult[];
|
|
36
|
+
bundle: string;
|
|
37
|
+
entry: string;
|
|
38
|
+
sections: Record<string, string>;
|
|
39
|
+
tests: import("./types.js").GuardTest[];
|
|
40
|
+
}>;
|
|
41
|
+
export declare function release(ws: Workspace, name: string, opts?: ReleaseOptions): Promise<ReleaseOutcome>;
|
|
42
|
+
/** Verify a release: signature, and that the snapshot files still match their hashes. */
|
|
43
|
+
export declare function verifyRelease(ws: Workspace, name: string, version: string): {
|
|
44
|
+
ok: boolean;
|
|
45
|
+
reason: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Which version a given model should get: the newest signed release that passed every
|
|
49
|
+
* guard test on that model. A model that fails stays on its last passing version.
|
|
50
|
+
*/
|
|
51
|
+
export declare function servedVersion(ws: Workspace, name: string, model?: string): ReleaseRecord | undefined;
|
|
52
|
+
export declare function readReleasedBundle(ws: Workspace, rec: ReleaseRecord): {
|
|
53
|
+
meta: {
|
|
54
|
+
name: string;
|
|
55
|
+
title: string;
|
|
56
|
+
version: string;
|
|
57
|
+
owner: string;
|
|
58
|
+
description: string;
|
|
59
|
+
starter?: string;
|
|
60
|
+
sections: string[];
|
|
61
|
+
teams?: string[];
|
|
62
|
+
};
|
|
63
|
+
text: string;
|
|
64
|
+
};
|
|
65
|
+
/** done: committed and tagged. note: why not, worded for the person; absent when this isn't a git repository. */
|
|
66
|
+
export interface GitOutcome {
|
|
67
|
+
done: boolean;
|
|
68
|
+
note?: string;
|
|
69
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import YAML from 'yaml';
|
|
5
|
+
import { nowIso, readJson, writeJson } from './workspace.js';
|
|
6
|
+
import { compareVersions, loadSkill, loadTests, readContent, renderBundle, saveSkill, trustFooterInstruction } from './skill.js';
|
|
7
|
+
import { checkSkill } from './checkup.js';
|
|
8
|
+
import { runTests } from './guard.js';
|
|
9
|
+
import { gradeAnswers } from './external.js';
|
|
10
|
+
import { sha256, signRecord, verifyRecord } from './sign.js';
|
|
11
|
+
import { openStore } from '../stores/index.js';
|
|
12
|
+
export class BlockedError extends Error {
|
|
13
|
+
findings;
|
|
14
|
+
constructor(findings) {
|
|
15
|
+
super('Release blocked by check-up');
|
|
16
|
+
this.findings = findings;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function releaseDir(ws, skill, version) {
|
|
20
|
+
return version ? ws.records('releases', skill, version) : ws.records('releases', skill);
|
|
21
|
+
}
|
|
22
|
+
export function listReleases(ws, skill) {
|
|
23
|
+
const d = releaseDir(ws, skill);
|
|
24
|
+
if (!fs.existsSync(d))
|
|
25
|
+
return [];
|
|
26
|
+
return fs.readdirSync(d).filter(v => fs.existsSync(path.join(d, v, 'release.json')))
|
|
27
|
+
.map(v => readJson(path.join(d, v, 'release.json')))
|
|
28
|
+
.sort((a, b) => compareVersions(b.version, a.version));
|
|
29
|
+
}
|
|
30
|
+
export async function testSkill(ws, meta, opts = {}) {
|
|
31
|
+
const { entry, sections } = await readContent(ws, meta);
|
|
32
|
+
const bundle = renderBundle(meta, entry, sections);
|
|
33
|
+
const tests = loadTests(ws, meta.name);
|
|
34
|
+
const graded = opts.answersFile ? await gradeAnswers(ws, meta, opts.answersFile) : undefined;
|
|
35
|
+
const models = ws.config.models.filter(m => !opts.models || opts.models.includes(m.name));
|
|
36
|
+
const results = [];
|
|
37
|
+
if (graded && !models.some(m => m.name === graded.model))
|
|
38
|
+
results.push(graded);
|
|
39
|
+
for (const m of models) {
|
|
40
|
+
if (graded && m.name === graded.model) {
|
|
41
|
+
results.push(graded);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (m.provider === 'answers') {
|
|
45
|
+
results.push({ model: m.name, provider: m.provider, pass: 0, total: tests.length, failed: [], outcomes: [], skipped: 'skipped: needs an answers file (test --emit-prompts, then --answers)' });
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (opts.offline && m.provider !== 'offline') {
|
|
49
|
+
results.push({ model: m.name, provider: m.provider, pass: 0, total: tests.length, failed: [], outcomes: [], skipped: 'skipped: offline run' });
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
opts.onProgress?.(`Testing on ${m.name}…`);
|
|
53
|
+
results.push(await runTests(bundle, trustFooterInstruction(meta), tests, m));
|
|
54
|
+
}
|
|
55
|
+
return { results, bundle, entry, sections, tests };
|
|
56
|
+
}
|
|
57
|
+
export async function release(ws, name, opts = {}) {
|
|
58
|
+
const meta = loadSkill(ws, name);
|
|
59
|
+
const findings = await checkSkill(ws, name);
|
|
60
|
+
if (findings.some(f => f.level === 'block'))
|
|
61
|
+
throw new BlockedError(findings);
|
|
62
|
+
const previous = listReleases(ws, name)[0];
|
|
63
|
+
const version = opts.version ?? meta.version ?? '0.1.0';
|
|
64
|
+
if (previous && compareVersions(version, previous.version) <= 0)
|
|
65
|
+
throw new Error(`Version ${version} is not newer than the last release ${previous.version}. Bump the version first.`);
|
|
66
|
+
meta.version = version;
|
|
67
|
+
saveSkill(ws, meta);
|
|
68
|
+
const { results, entry, sections } = await testSkill(ws, meta, { offline: opts.offline, answersFile: opts.answersFile, onProgress: opts.onProgress });
|
|
69
|
+
// Snapshot exactly what ships, whatever the store is.
|
|
70
|
+
const dir = releaseDir(ws, name, version);
|
|
71
|
+
const files = {};
|
|
72
|
+
const put = (rel, content) => {
|
|
73
|
+
const f = path.join(dir, 'files', rel);
|
|
74
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
75
|
+
fs.writeFileSync(f, content);
|
|
76
|
+
files[rel] = sha256(content);
|
|
77
|
+
};
|
|
78
|
+
put('SKILL.md', entry);
|
|
79
|
+
for (const [id, md] of Object.entries(sections))
|
|
80
|
+
put(`sections/${id}.md`, md);
|
|
81
|
+
for (const t of fs.readdirSync(path.join(ws.skillDir(name), 'tests')).filter(f => f.endsWith('.yaml'))) {
|
|
82
|
+
put(`tests/${t}`, fs.readFileSync(path.join(ws.skillDir(name), 'tests', t), 'utf8'));
|
|
83
|
+
}
|
|
84
|
+
put('skill.yaml', fs.readFileSync(path.join(ws.skillDir(name), 'skill.yaml'), 'utf8'));
|
|
85
|
+
const works_on = {};
|
|
86
|
+
for (const r of results)
|
|
87
|
+
works_on[r.model] = { pass: r.pass, total: r.total, failed: r.failed, tested: !r.skipped };
|
|
88
|
+
const record = signRecord(ws, {
|
|
89
|
+
skill: name, version, previous: previous?.version,
|
|
90
|
+
changelog: opts.changelog ?? (previous ? 'Update' : 'First release'),
|
|
91
|
+
corrections: opts.corrections ?? [],
|
|
92
|
+
files, works_on, store: openStore(ws).describe(),
|
|
93
|
+
signed_by: opts.signedBy ?? meta.owner ?? ws.config.curator,
|
|
94
|
+
signed_at: nowIso(),
|
|
95
|
+
});
|
|
96
|
+
writeJson(path.join(dir, 'release.json'), record);
|
|
97
|
+
writeJson(path.join(dir, 'results.json'), results);
|
|
98
|
+
const git = opts.git === false ? { done: false, note: 'skipped (--no-git)' } : gitTag(ws, `${name}-v${version}`, `${name} ${version}: ${record.changelog}`);
|
|
99
|
+
return { record, results, findings, git };
|
|
100
|
+
}
|
|
101
|
+
/** Verify a release: signature, and that the snapshot files still match their hashes. */
|
|
102
|
+
export function verifyRelease(ws, name, version) {
|
|
103
|
+
const dir = releaseDir(ws, name, version);
|
|
104
|
+
const rec = readJson(path.join(dir, 'release.json'));
|
|
105
|
+
const sig = verifyRecord(ws, rec);
|
|
106
|
+
if (!sig.ok)
|
|
107
|
+
return sig;
|
|
108
|
+
for (const [rel, hash] of Object.entries(rec.files)) {
|
|
109
|
+
const f = path.join(dir, 'files', rel);
|
|
110
|
+
if (!fs.existsSync(f) || sha256(fs.readFileSync(f)) !== hash)
|
|
111
|
+
return { ok: false, reason: `File ${rel} was changed after signing` };
|
|
112
|
+
}
|
|
113
|
+
return { ok: true, reason: `Signed by ${rec.signed_by} on ${rec.signed_at.slice(0, 10)}. Signature and ${Object.keys(rec.files).length} files check out.` };
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Which version a given model should get: the newest signed release that passed every
|
|
117
|
+
* guard test on that model. A model that fails stays on its last passing version.
|
|
118
|
+
*/
|
|
119
|
+
export function servedVersion(ws, name, model) {
|
|
120
|
+
const rels = listReleases(ws, name);
|
|
121
|
+
if (!model)
|
|
122
|
+
return rels[0];
|
|
123
|
+
for (const r of rels) {
|
|
124
|
+
const w = r.works_on[model];
|
|
125
|
+
if (w && w.tested && w.failed.length === 0)
|
|
126
|
+
return r;
|
|
127
|
+
if ((!w || !w.tested) && ws.config.allow_untested)
|
|
128
|
+
return r;
|
|
129
|
+
}
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
export function readReleasedBundle(ws, rec) {
|
|
133
|
+
const dir = path.join(releaseDir(ws, rec.skill, rec.version), 'files');
|
|
134
|
+
const meta = { ...readYamlSafe(path.join(dir, 'skill.yaml')) };
|
|
135
|
+
const entry = fs.readFileSync(path.join(dir, 'SKILL.md'), 'utf8');
|
|
136
|
+
const sections = {};
|
|
137
|
+
for (const id of meta.sections) {
|
|
138
|
+
const f = path.join(dir, 'sections', `${id}.md`);
|
|
139
|
+
sections[id] = fs.existsSync(f) ? fs.readFileSync(f, 'utf8') : '';
|
|
140
|
+
}
|
|
141
|
+
return { meta, text: renderBundle(meta, entry, sections) };
|
|
142
|
+
}
|
|
143
|
+
function readYamlSafe(f) { return YAML.parse(fs.readFileSync(f, 'utf8')); }
|
|
144
|
+
function gitTag(ws, tag, msg) {
|
|
145
|
+
const git = (args) => execFileSync('git', args, { cwd: ws.root, stdio: ['ignore', 'pipe', 'pipe'] }).toString().trim();
|
|
146
|
+
try {
|
|
147
|
+
git(['rev-parse', '--is-inside-work-tree']);
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return { done: false };
|
|
151
|
+
}
|
|
152
|
+
const who = (k) => { try {
|
|
153
|
+
return git(['config', k]);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return '';
|
|
157
|
+
} };
|
|
158
|
+
if (!who('user.name') || !who('user.email')) {
|
|
159
|
+
return { done: false, note: "Couldn't commit or tag the release: git user.name / user.email aren't set here. The signed record in the folder is complete. Set them (git config user.name …, git config user.email …) or pass --no-git." };
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const paths = ['skills', '.skill-monster', 'skill-monster.yaml'].filter(p => fs.existsSync(path.join(ws.root, p)));
|
|
163
|
+
git(['add', '-A', '--', ...paths]);
|
|
164
|
+
// Commit only Skill Monster's own paths, never anything else the person has staged.
|
|
165
|
+
git(['commit', '-q', '-m', msg, '--allow-empty', '--', ...paths]);
|
|
166
|
+
git(['tag', '-a', tag, '-m', msg]);
|
|
167
|
+
return { done: true };
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
const err = String(e.stderr ?? e.message).trim().split('\n').pop();
|
|
171
|
+
return { done: false, note: `Couldn't commit or tag the release (${err}). The signed record in the folder is complete.` };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Workspace } from './workspace.js';
|
|
2
|
+
/**
|
|
3
|
+
* A run report that is safe to send outside the company: counts, versions, model names,
|
|
4
|
+
* provider types and test ids only. It never includes skill content, questions, answers,
|
|
5
|
+
* test expectations, error text, names, page ids or paths.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildReport(ws: Workspace, toolVersion: string, opts?: {
|
|
8
|
+
names?: boolean;
|
|
9
|
+
}): Promise<string>;
|
|
10
|
+
export declare function writeReport(file: string, text: string): void;
|