buildproof 3.7.2 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/bin/buildproof.js +15 -1
- package/core/ci.js +254 -0
- package/core/license.js +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,9 @@ One-tap hooks (Projects -> AI tools, or `buildproof connect git,claude,cursor`):
|
|
|
18
18
|
Projects: Node / Web (npm scripts typecheck, lint, build, test) and Python (syntax check of every file without writing .pyc, ruff and mypy when configured, pytest or unittest).
|
|
19
19
|
Also (3.7.1): Go (go build, go vet, go test), Rust (cargo build, cargo test - also tests inside the source file), Java with Maven or Gradle (JUnit results), .NET (dotnet build, dotnet test), Ruby (syntax check, RSpec or Minitest), PHP (syntax check, PHPUnit). Each uses its own toolchain on your computer; a missing toolchain or unreadable test results is reported, never counted as proven.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Pull request checks (3.8.0; free trial, then Team and Enterprise): `buildproof ci --init` adds a GitHub workflow; every pull request is compared with its base branch - test-integrity rules on the changed files, build/test on both sides, fail-closed verdict in the job summary. Spec check (free trial, then Pro and up; `buildproof spec` locally or inside `buildproof ci`): `.buildproof/spec.md`, one requirement per line with the test that proves it (`- Free shipping from $50 => test: free shipping from 50`); a requirement without a passing test is never accepted. Live demo: https://buildproof.mgrprosnetwork.com/demo
|
|
22
|
+
|
|
23
|
+
CLI: `buildproof start | check [--claim "..."] | accept [--force] | rollback | connect | verify <cert.html> | status | ci [--base origin/main] [--spec spec.md]`. `buildproof check` exits 0 only when proven.
|
|
22
24
|
|
|
23
25
|
Run: `node scripts/guard.js` (keeps core/server.js alive on port 38700). Test: `node test/run-all.js`.
|
|
24
26
|
Data (config, token, signing key, tasks, backups, certificates, learned fixes): `data/` - never shipped, kept on reinstall.
|
package/bin/buildproof.js
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* buildproof init [folder] one-time setup: background service, project, AI tool hooks
|
|
15
15
|
* buildproof activate <key> activate a license key buildproof license show the plan
|
|
16
16
|
* buildproof open open BuildProof in the browser
|
|
17
|
+
* buildproof ci [folder] [--base origin/main] [--spec spec.md] pull request check for CI (--init writes the GitHub workflow)
|
|
18
|
+
* buildproof spec [folder] [--base main] check the change against .buildproof/spec.md (every requirement needs a passing test)
|
|
17
19
|
*
|
|
18
20
|
* Hook mode (installed by "connect"): --hook=claude | --hook=cursor | --hook=git
|
|
19
21
|
*/
|
|
@@ -89,6 +91,18 @@ async function activeGuard(projectId) {
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
async function main() {
|
|
94
|
+
if (cmd === 'ci' || cmd === 'spec') { // pull request check (Team+) / spec check (Pro+): no background service needed
|
|
95
|
+
const ci = require('../core/ci');
|
|
96
|
+
const folder = positional[0] || process.cwd();
|
|
97
|
+
if (cmd === 'ci' && flag('init')) { const r = ci.init(folder); out(r.ok ? `CI_WORKFLOW ${r.file} - add your key as the BUILDPROOF_LICENSE secret` : `CI_WORKFLOW_EXISTS ${r.file}`, r.ok ? 0 : 1); }
|
|
98
|
+
const lic = ci.licensed(require('../core/license'), cmd);
|
|
99
|
+
if (!lic.ok) out(`CANNOT_CHECK ${lic.why}`, 2);
|
|
100
|
+
const base = typeof flag('base') === 'string' ? flag('base') : null;
|
|
101
|
+
const r = await ci.check(folder, { base, spec: typeof flag('spec') === 'string' ? flag('spec') : null, requireSpec: cmd === 'spec', noBaseline: !!flag('no-baseline') });
|
|
102
|
+
const sum = typeof flag('summary') === 'string' ? flag('summary') : process.env.GITHUB_STEP_SUMMARY;
|
|
103
|
+
if (sum) { try { fs.appendFileSync(sum, r.md + '\n'); } catch { /* summary is optional */ } }
|
|
104
|
+
out(r.text, r.code);
|
|
105
|
+
}
|
|
92
106
|
if (cmd === 'verify') {
|
|
93
107
|
const certs = require('../core/certs');
|
|
94
108
|
const file = positional[0];
|
|
@@ -182,7 +196,7 @@ async function main() {
|
|
|
182
196
|
out(r.ok ? `BUILDPROOF v${r.version} AI=${r.ai.ok ? 'OK' : 'DOWN'} fixes=${r.fixes} key=${r.fingerprint}` : `DOWN ${r.error}`, r.ok ? 0 : 1);
|
|
183
197
|
}
|
|
184
198
|
if (!['start', 'check', 'accept', 'rollback', 'connect'].includes(cmd)) {
|
|
185
|
-
out(fs.readFileSync(__filename, 'utf8').split('\n').slice(3,
|
|
199
|
+
out(fs.readFileSync(__filename, 'utf8').split('\n').slice(3, 19).map((l) => l.replace(/^ \* ?/, '')).join('\n'), cmd === 'help' ? 0 : 1);
|
|
186
200
|
}
|
|
187
201
|
|
|
188
202
|
const input = await readStdin();
|
package/core/ci.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* CI / pull request check: compare the pull request (HEAD) with its base branch, without the background service.
|
|
4
|
+
*
|
|
5
|
+
* buildproof ci [folder] [--base origin/main] [--spec spec.md] [--no-baseline] [--summary file.md]
|
|
6
|
+
*
|
|
7
|
+
* 1. test-integrity rules on every changed file (deleted / skipped / weakened tests, silenced checkers...)
|
|
8
|
+
* 2. the project's build / test scripts on the base and on the pull request
|
|
9
|
+
* 3. spec check (optional): every requirement in .buildproof/spec.md (or --spec) must name a test that exists and passes
|
|
10
|
+
* 4. fail-closed verdict: PROVEN only if the checks really ran, nothing regressed, no fewer tests ran and the spec is met
|
|
11
|
+
* Exit code: 0 = PROVEN, 1 = NOT PROVEN, 2 = cannot check (no licence, no git, no base).
|
|
12
|
+
*/
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const os = require('os');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const cp = require('child_process');
|
|
17
|
+
const integrity = require('./integrity');
|
|
18
|
+
const gate = require('./gate');
|
|
19
|
+
const { run } = require('./runner');
|
|
20
|
+
|
|
21
|
+
const STRICT_TYPES = new Set(['go', 'rust', 'java-maven', 'java-gradle', 'dotnet', 'ruby', 'php']);
|
|
22
|
+
|
|
23
|
+
function git(args, cwd) { return cp.execFileSync('git', args, { cwd, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'] }).trim(); }
|
|
24
|
+
|
|
25
|
+
/** Base ref: --base, then the GitHub pull request base, then origin/main or origin/master. */
|
|
26
|
+
function findBase(root, wanted) {
|
|
27
|
+
const tries = wanted ? [wanted] : [process.env.GITHUB_BASE_REF && 'origin/' + process.env.GITHUB_BASE_REF, 'origin/main', 'origin/master', 'main', 'master'].filter(Boolean);
|
|
28
|
+
for (const ref of tries) { try { git(['rev-parse', '--verify', '--quiet', ref + '^{commit}'], root); return ref; } catch { /* next */ } }
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Changed files between the merge base and HEAD, in the shape integrity.analyze expects. */
|
|
33
|
+
function changesBetween(root, base) {
|
|
34
|
+
const out = git(['diff', '--name-status', '--no-renames', '--no-color', base + '...HEAD'], root);
|
|
35
|
+
const changes = [];
|
|
36
|
+
for (const line of out.split(/\r?\n/).filter(Boolean)) {
|
|
37
|
+
const [st, file] = line.split('\t');
|
|
38
|
+
const kind = st[0] === 'A' ? 'added' : st[0] === 'D' ? 'deleted' : 'modified';
|
|
39
|
+
changes.push({ file: file.replace(/\\/g, '/'), kind });
|
|
40
|
+
}
|
|
41
|
+
return changes;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function listFiles(root) {
|
|
45
|
+
try { return git(['ls-files'], root).split(/\r?\n/).filter(Boolean); } catch { return []; }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Install dependencies in the base copy (Node only: other toolchains fetch them inside their own test command). */
|
|
49
|
+
async function installDeps(dir, info, timeoutMs) {
|
|
50
|
+
if (!info.needsInstall) return null;
|
|
51
|
+
const pm = info.packageManager || 'npm';
|
|
52
|
+
const lock = { npm: 'package-lock.json', yarn: 'yarn.lock', pnpm: 'pnpm-lock.yaml' }[pm];
|
|
53
|
+
const args = pm === 'npm' ? (fs.existsSync(path.join(dir, lock)) ? ['ci', '--no-audit', '--no-fund'] : ['install', '--no-audit', '--no-fund']) : ['install', '--frozen-lockfile'];
|
|
54
|
+
return run(pm, args, { cwd: dir, timeoutMs });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function verifyDir(dir, info, commandFor, timeoutMs) {
|
|
58
|
+
const results = {};
|
|
59
|
+
for (const step of info.verify) {
|
|
60
|
+
const { cmd, args } = commandFor(info, step);
|
|
61
|
+
// NODE_TEST_CONTEXT would make a nested `node --test` report to its parent instead of failing here
|
|
62
|
+
const r = await run(cmd, args, { cwd: dir, timeoutMs, env: { PYTHONDONTWRITEBYTECODE: '1', NODE_TEST_CONTEXT: undefined } });
|
|
63
|
+
const g = gate.evaluate(step, r, { strictCounts: STRICT_TYPES.has(info.type) });
|
|
64
|
+
results[step] = { ...g, tail: String(r.output || '').slice(-1500) };
|
|
65
|
+
}
|
|
66
|
+
return results;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Can this machine run the check? feature 'ci' (pull request gate, Team and up) or 'spec' (spec check, Pro and up).
|
|
71
|
+
* Key from BUILDPROOF_LICENSE (CI secret) or the local licence. A CI runner without a key gets no trial:
|
|
72
|
+
* every runner is a new machine, so the trial is for your own computer.
|
|
73
|
+
*/
|
|
74
|
+
function licensed(license, feature = 'ci') {
|
|
75
|
+
const need = license.F[feature];
|
|
76
|
+
const planName = feature === 'ci' ? 'Team' : 'Pro';
|
|
77
|
+
const key = process.env.BUILDPROOF_LICENSE;
|
|
78
|
+
if (key) {
|
|
79
|
+
const k = license.parseKey(String(key).trim());
|
|
80
|
+
if (!k.ok) return { ok: false, why: 'BUILDPROOF_LICENSE is not a valid BuildProof key' };
|
|
81
|
+
const exp = Date.parse(k.payload.exp);
|
|
82
|
+
if (!(exp + 3 * 864e5 > Date.now())) return { ok: false, why: 'the licence in BUILDPROOF_LICENSE has expired' };
|
|
83
|
+
const plan = license.PLANS[k.payload.plan];
|
|
84
|
+
return plan && plan.features.includes(need) ? { ok: true, plan: k.payload.plan } : { ok: false, why: `${feature === 'ci' ? 'pull request checks are' : 'the spec check is'} in the ${planName} plan and up (this key is ${k.payload.plan})` };
|
|
85
|
+
}
|
|
86
|
+
if (process.env.GITHUB_ACTIONS || process.env.CI) return { ok: false, why: 'add your licence key as the BUILDPROOF_LICENSE secret (the free trial runs on your own computer)' };
|
|
87
|
+
const st = license.status();
|
|
88
|
+
return st.features.includes(need) ? { ok: true, plan: st.plan } : { ok: false, why: `${feature === 'ci' ? 'pull request checks are' : 'the spec check is'} in the ${planName} plan and up${st.plan === 'trial' ? ' (your trial has ended)' : ''}` };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Spec file: one requirement per list line, each tied to the test that proves it.
|
|
93
|
+
* - Users can reset their password => test: reset password sends an email
|
|
94
|
+
* A requirement without "test:" can never be proven (fail closed).
|
|
95
|
+
*/
|
|
96
|
+
function parseSpec(text) {
|
|
97
|
+
const items = [];
|
|
98
|
+
for (const raw of String(text || '').split(/\r?\n/)) {
|
|
99
|
+
const m = /^\s*(?:[-*]|\d+[.)])\s+(?:\[[ xX]\]\s*)?(.+?)\s*$/.exec(raw);
|
|
100
|
+
if (!m) continue;
|
|
101
|
+
const t = /^(.*?)\s*(?:=>|->|\|)?\s*\btest:\s*["'`]?(.+?)["'`]?\s*$/i.exec(m[1]);
|
|
102
|
+
items.push(t ? { req: t[1].trim() || t[2].trim(), test: t[2].trim() } : { req: m[1], test: null });
|
|
103
|
+
}
|
|
104
|
+
return items;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** A test name appears in a test file as the first string argument of test( / it( / describe( / def test_... */
|
|
108
|
+
function testNameIn(src, name) {
|
|
109
|
+
const esc = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
110
|
+
return new RegExp(`\\b(?:test|it|specify|describe)(?:\\.only)?\\s*\\(\\s*["'\`]${esc}["'\`]`).test(src) || new RegExp(`\\bdef\\s+${esc.replace(/\s+/g, '_')}\\s*\\(`).test(src) || new RegExp(`\\b(?:func|fn|void|public\\s+void)\\s+${esc.replace(/\s+/g, '_')}\\s*\\(`).test(src);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function checkSpec(items, { root, baseDir, testFiles, after, baseline }) {
|
|
114
|
+
const read = (d, f) => { try { return fs.readFileSync(path.join(d, f), 'utf8'); } catch { return ''; } };
|
|
115
|
+
const headSrc = testFiles.map((f) => read(root, f));
|
|
116
|
+
const baseSrc = baseDir ? testFiles.map((f) => read(baseDir, f)) : [];
|
|
117
|
+
const testSteps = Object.keys(after || {}).filter((s) => /test/.test(s));
|
|
118
|
+
const failedNow = testSteps.flatMap((s) => after[s].failedTests || []);
|
|
119
|
+
const failedBefore = testSteps.flatMap((s) => (baseline && baseline[s] && baseline[s].failedTests) || []);
|
|
120
|
+
const stepsPass = testSteps.length > 0 && testSteps.every((s) => after[s].pass);
|
|
121
|
+
return items.map((it) => {
|
|
122
|
+
if (!it.test) return { ...it, status: 'no_test', why: 'no test is named for this requirement' };
|
|
123
|
+
if (!headSrc.some((src) => testNameIn(src, it.test))) return { ...it, status: 'missing', why: 'the named test does not exist' };
|
|
124
|
+
if (!stepsPass || failedNow.some((n) => n.includes(it.test))) return { ...it, status: 'failing', why: 'the test does not pass' };
|
|
125
|
+
const isNew = !baseSrc.some((src) => testNameIn(src, it.test)) || failedBefore.some((n) => n.includes(it.test));
|
|
126
|
+
return { ...it, status: 'met', isNew };
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function stepLine(s, r) {
|
|
131
|
+
if (!r) return `- ${s}: did not run`;
|
|
132
|
+
const t = r.tests ? ` (${r.tests.passed}/${r.tests.total} tests)` : '';
|
|
133
|
+
return `- ${s}: ${r.pass ? 'pass' : r.ran ? 'FAIL' : 'did not really run (' + r.reason + ')'}${t}`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function markdown(res) {
|
|
137
|
+
const L = [`## BuildProof: ${res.proven ? 'PROVEN' : 'NOT PROVEN'}`, '', res.why, ''];
|
|
138
|
+
L.push(`Compared with \`${res.base}\`: ${res.changes.length} changed file(s).`, '');
|
|
139
|
+
if (res.integrity.findings.length) {
|
|
140
|
+
L.push('### Checks weakened in this change');
|
|
141
|
+
for (const f of res.integrity.findings) L.push(`- **${f.text}** \`${f.file}\` ${f.detail ? '- `' + f.detail.replace(/`/g, "'") + '`' : ''}`);
|
|
142
|
+
L.push('');
|
|
143
|
+
}
|
|
144
|
+
if (res.spec) {
|
|
145
|
+
L.push('### Spec');
|
|
146
|
+
for (const x of res.spec) L.push(`- ${x.status === 'met' ? 'met' : 'NOT MET'}: ${x.req}${x.test ? ` (test: \`${x.test}\`${x.isNew ? ', new in this change' : ''})` : ''}${x.why ? ' - ' + x.why : ''}`);
|
|
147
|
+
L.push('');
|
|
148
|
+
}
|
|
149
|
+
if (res.after) {
|
|
150
|
+
L.push('### Checks on this pull request');
|
|
151
|
+
for (const s of res.steps) L.push(stepLine(s, res.after[s]));
|
|
152
|
+
L.push('');
|
|
153
|
+
}
|
|
154
|
+
if (res.baseline) {
|
|
155
|
+
L.push(`### Checks on ${res.base}`);
|
|
156
|
+
for (const s of res.steps) L.push(stepLine(s, res.baseline[s]));
|
|
157
|
+
L.push('');
|
|
158
|
+
}
|
|
159
|
+
L.push('_BuildProof is fail-closed: anything it cannot see is a fail, never a pass._');
|
|
160
|
+
return L.join('\n');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @returns {Promise<{code:number, proven:boolean, why:string, text:string, md:string}>}
|
|
165
|
+
*/
|
|
166
|
+
async function check(root, opts = {}) {
|
|
167
|
+
const projects = opts.projects || require('./projects');
|
|
168
|
+
const timeoutMs = opts.timeoutMs || 15 * 60 * 1000;
|
|
169
|
+
root = path.resolve(root);
|
|
170
|
+
try { git(['rev-parse', '--is-inside-work-tree'], root); } catch { return fail('not a git repository: ' + root); }
|
|
171
|
+
const base = findBase(root, opts.base);
|
|
172
|
+
if (!base) return fail('base branch not found. Use --base <branch>, and fetch it (actions/checkout with fetch-depth: 0)');
|
|
173
|
+
|
|
174
|
+
const changes = changesBetween(root, base);
|
|
175
|
+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'bp-ci-'));
|
|
176
|
+
const baseDir = path.join(tmp, 'base');
|
|
177
|
+
try {
|
|
178
|
+
let mergeBase;
|
|
179
|
+
try { mergeBase = git(['merge-base', base, 'HEAD'], root); } catch { return fail('no common history with ' + base + ' (fetch-depth: 0 is needed)'); }
|
|
180
|
+
git(['worktree', 'add', '--detach', '--force', baseDir, mergeBase], root);
|
|
181
|
+
|
|
182
|
+
const testFiles = listFiles(root).filter((f) => integrity.isTestFile(f));
|
|
183
|
+
const integ = integrity.analyze({ root, beforeDir: baseDir, changes, testFiles });
|
|
184
|
+
|
|
185
|
+
const info = projects.detect(root);
|
|
186
|
+
const steps = info.verify || [];
|
|
187
|
+
let after = null, baseline = null, verdict = null;
|
|
188
|
+
if (steps.length) {
|
|
189
|
+
after = await verifyDir(root, info, projects.commandFor, timeoutMs);
|
|
190
|
+
if (!opts.noBaseline) {
|
|
191
|
+
const binfo = projects.detect(baseDir);
|
|
192
|
+
binfo.verify = steps.filter((s) => (binfo.verify || []).includes(s));
|
|
193
|
+
await installDeps(baseDir, binfo, timeoutMs);
|
|
194
|
+
baseline = await verifyDir(baseDir, binfo, projects.commandFor, timeoutMs);
|
|
195
|
+
}
|
|
196
|
+
// no baseline: every step must pass on its own (stricter)
|
|
197
|
+
verdict = gate.judge(baseline || after, after, steps, true); // a pull request must leave every check passing
|
|
198
|
+
}
|
|
199
|
+
let spec = null;
|
|
200
|
+
const specFile = opts.spec ? path.resolve(root, opts.spec) : path.join(root, '.buildproof', 'spec.md');
|
|
201
|
+
if (opts.spec && !fs.existsSync(specFile)) return fail('spec file not found: ' + opts.spec);
|
|
202
|
+
if (opts.requireSpec && !fs.existsSync(specFile)) return fail('no spec: write .buildproof/spec.md (one line per requirement: - requirement => test: test name)');
|
|
203
|
+
if (fs.existsSync(specFile)) {
|
|
204
|
+
const items = parseSpec(fs.readFileSync(specFile, 'utf8'));
|
|
205
|
+
if (!items.length) return fail('the spec file has no requirements (one per list line: - requirement => test: test name)');
|
|
206
|
+
spec = checkSpec(items, { root, baseDir, testFiles, after, baseline });
|
|
207
|
+
}
|
|
208
|
+
const specBad = spec ? spec.filter((x) => x.status !== 'met') : [];
|
|
209
|
+
const proven = integ.clean && !!verdict && verdict.ok && specBad.length === 0;
|
|
210
|
+
const why = proven ? `The checks really ran, nothing regressed, no test was weakened${spec ? ', every spec requirement is proven by a passing test' : ''}.`
|
|
211
|
+
: (integ.clean && verdict && verdict.ok ? `Spec not met: ${specBad.slice(0, 3).map((x) => `${x.req} (${x.why})`).join('; ')}` : gate.whyNot(verdict, integ));
|
|
212
|
+
const res = { proven, why, base, changes, integrity: integ, steps, after, baseline, spec };
|
|
213
|
+
const md = markdown(res);
|
|
214
|
+
const text = `${proven ? 'PROVEN' : 'NOT_PROVEN'} files=${changes.length} base=${base} | ${why}`;
|
|
215
|
+
return { code: proven ? 0 : 1, proven, why, text, md };
|
|
216
|
+
} finally {
|
|
217
|
+
try { git(['worktree', 'remove', '--force', baseDir], root); } catch { /* ignore */ }
|
|
218
|
+
try { fs.rmSync(tmp, { recursive: true, force: true }); } catch { /* ignore */ }
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function fail(why) { return { code: 2, proven: false, why, text: 'CANNOT_CHECK ' + why, md: `## BuildProof: cannot check\n\n${why}\n` }; }
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const WORKFLOW = `name: BuildProof
|
|
225
|
+
on:
|
|
226
|
+
pull_request:
|
|
227
|
+
permissions:
|
|
228
|
+
contents: read
|
|
229
|
+
jobs:
|
|
230
|
+
buildproof:
|
|
231
|
+
runs-on: ubuntu-latest
|
|
232
|
+
steps:
|
|
233
|
+
- uses: actions/checkout@v4
|
|
234
|
+
with:
|
|
235
|
+
fetch-depth: 0
|
|
236
|
+
- uses: actions/setup-node@v4
|
|
237
|
+
with:
|
|
238
|
+
node-version: 20
|
|
239
|
+
- run: npm ci
|
|
240
|
+
- run: npx -y buildproof ci --base origin/\${{ github.base_ref }}
|
|
241
|
+
env:
|
|
242
|
+
BUILDPROOF_LICENSE: \${{ secrets.BUILDPROOF_LICENSE }}
|
|
243
|
+
`;
|
|
244
|
+
|
|
245
|
+
/** Write .github/workflows/buildproof.yml (never overwrites an existing file). */
|
|
246
|
+
function init(root) {
|
|
247
|
+
const f = path.join(path.resolve(root), '.github', 'workflows', 'buildproof.yml');
|
|
248
|
+
if (fs.existsSync(f)) return { ok: false, file: f, error: 'exists' };
|
|
249
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
250
|
+
fs.writeFileSync(f, WORKFLOW);
|
|
251
|
+
return { ok: true, file: f };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
module.exports = { check, init, licensed, changesBetween, findBase, markdown, parseSpec, testNameIn, WORKFLOW };
|
package/core/license.js
CHANGED
|
@@ -16,12 +16,12 @@ const TRIAL_DAYS = 14;
|
|
|
16
16
|
const GRACE_DAYS = 3;
|
|
17
17
|
const DAY = 864e5;
|
|
18
18
|
|
|
19
|
-
const F = { guard: 'guard', hooks: 'hooks', certificates: 'certificates', remote: 'remote', revertCheck: 'revertCheck', claims: 'claims', aiFix: 'aiFix', ci: 'ci', verifyPage: 'verifyPage', dashboard: 'dashboard', sso: 'sso', audit: 'audit' };
|
|
19
|
+
const F = { guard: 'guard', hooks: 'hooks', certificates: 'certificates', remote: 'remote', revertCheck: 'revertCheck', claims: 'claims', aiFix: 'aiFix', ci: 'ci', spec: 'spec', verifyPage: 'verifyPage', dashboard: 'dashboard', sso: 'sso', audit: 'audit' };
|
|
20
20
|
const BASIC = [F.guard, F.hooks];
|
|
21
|
-
const PRO = [...BASIC, F.certificates, F.remote, F.revertCheck, F.claims, F.aiFix];
|
|
21
|
+
const PRO = [...BASIC, F.certificates, F.remote, F.revertCheck, F.claims, F.aiFix, F.spec];
|
|
22
22
|
const TEAM = [...PRO, F.ci, F.verifyPage, F.dashboard];
|
|
23
23
|
const PLANS = {
|
|
24
|
-
trial: { label: 'Trial', price: 'free for 14 days', projects: 2, features: PRO },
|
|
24
|
+
trial: { label: 'Trial', price: 'free for 14 days', projects: 2, features: [...PRO, F.ci] }, // the trial opens everything up to Team checks
|
|
25
25
|
basic: { label: 'Basic', price: '$15 / month', projects: 3, features: BASIC },
|
|
26
26
|
pro: { label: 'Pro', price: '$25 / month', projects: Infinity, features: PRO },
|
|
27
27
|
team: { label: 'Team', price: '$50 / user / month', projects: Infinity, features: TEAM },
|
|
@@ -30,7 +30,7 @@ const PLANS = {
|
|
|
30
30
|
const FEATURE_TEXT = {
|
|
31
31
|
guard: 'Guard any AI tool + test-integrity rules', hooks: 'One-tap Claude Code / Cursor / git hooks', certificates: 'Signed proof certificates',
|
|
32
32
|
remote: 'Phone and tablet control', revertCheck: 'Revert check', claims: 'AI claim check', aiFix: 'BuildProof fixes it (local AI)',
|
|
33
|
-
ci: 'CI / pull request checks', verifyPage: 'Public verify page', dashboard: 'Team dashboard', sso: 'Single sign-on', audit: 'Audit reports',
|
|
33
|
+
ci: 'CI / pull request checks', spec: 'Spec check: every requirement proven by a passing test', verifyPage: 'Public verify page', dashboard: 'Team dashboard', sso: 'Single sign-on', audit: 'Audit reports',
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const FILE = () => path.join(DATA_DIR, 'license.json');
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buildproof",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "BuildProof - proof gate for AI-written code: test-integrity guard, fail-closed checks, scope lock, full rollback, signed certificates, local AI under supervision.",
|
|
5
5
|
"main": "core/server.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node core/server.js",
|
|
8
8
|
"guard": "node scripts/guard.js",
|
|
9
9
|
"test": "node test/run-all.js && npm run test:unit",
|
|
10
|
-
"test:unit": "node --test test/modules.test.js test/guard-process.test.js test/av-scan.test.js test/license-net.test.js test/guard-force.test.js test/guard-security.test.js tools/mutation-runner/acceptance.test.js",
|
|
10
|
+
"test:unit": "node --test test/ci.test.js test/modules.test.js test/guard-process.test.js test/av-scan.test.js test/license-net.test.js test/guard-force.test.js test/guard-security.test.js tools/mutation-runner/acceptance.test.js",
|
|
11
11
|
"bench": "node tools/benchmark/run.js",
|
|
12
12
|
"test:hard": "node test/hardening.js"
|
|
13
13
|
},
|