buildproof 3.13.1 → 3.14.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 CHANGED
@@ -7,6 +7,8 @@ npx buildproof try # see it first, on a throw-away sample: a skipped test is
7
7
  npx buildproof init # then on your project: hooks for Claude Code / Cursor / git, 14-day free trial (add --ci for the GitHub PR check)
8
8
  ```
9
9
 
10
+ **New: BuildProof Review for GitHub** - install the GitHub App and every pull request gets a reviewer that only reports bugs it can prove: it writes a test, runs it in a locked container, and posts it only if it fails on the PR and passes on the base branch. JavaScript, TypeScript and Python, 20 free checks a month: https://buildproof.mgrprosnetwork.com/github
11
+
10
12
  After `init`, keep working as usual. When your AI tool finishes, BuildProof re-runs your real checks; if a test was skipped, deleted or weakened, or "all tests pass" is not true, it answers NOT PROVEN and sends the reason back to the AI.
11
13
 
12
14
  Works two ways, same guarantees:
@@ -31,7 +33,7 @@ Pull request checks (3.8.0; Team and Enterprise - in CI they need a paid licence
31
33
 
32
34
  Audit report (3.9.0; free trial, then Enterprise): `buildproof audit --since 2026-01-01` writes a signed HTML + JSON report of every accepted and rejected change; `buildproof audit --verify report.json` shows any later edit. Team dashboard (Team and Enterprise): `buildproof team` opens it; your licence key unlocks your own team's certificates.
33
35
 
34
- AI bug hunt (3.10.0; Pro and up, and the trial): `buildproof hunt --base main` uploads copies of the tracked files at the base commit and at your current version (including uncommitted edits), plus the change description, to the BuildProof server, where the hunter runs your code and the AI-written tests in a locked-down container (no network) and reports only bugs it PROVED (a test that fails on the new code and passes on the old). By default your own local model (Ollama) answers the AI's questions - free; `--cloud` uses the server's AI (one cloud check; 5 in the trial; `buildproof credits --buy 20`). Your code is deleted from the server when the check ends. Since 3.12 the hunter is told what the change was meant to do: taken from `--intent "..."`, else from the pull request (GitHub) or merge request (GitLab) title and description, else from the commit messages since the base. This helps it tell a real bug from an intended change. `--no-intent` turns it off.
36
+ AI bug hunt (3.10.0; every paid plan - Basic 3 hunts a month, Pro 30 cloud checks a month - and the trial): `buildproof hunt --base main` uploads copies of the tracked files at the base commit and at your current version (including uncommitted edits), plus the change description, to the BuildProof server, where the hunter runs your code and the AI-written tests in a locked-down container (no network) and reports only bugs it PROVED (a test that fails on the new code and passes on the old). By default your own local model (Ollama) answers the AI's questions - free; `--cloud` uses the server's AI (one cloud check; 5 in the trial; `buildproof credits --buy 20`). Your code is deleted from the server when the check ends. Since 3.12 the hunter is told what the change was meant to do: taken from `--intent "..."`, else from the pull request (GitHub) or merge request (GitLab) title and description, else from the commit messages since the base. This helps it tell a real bug from an intended change. `--no-intent` turns it off.
35
37
 
36
38
  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.
37
39
 
@@ -42,4 +44,4 @@ Background service: `init` and `try` start a small local service (127.0.0.1 only
42
44
 
43
45
  Certificates: the signature proves a certificate was not edited after it was issued. It does not prove who issued it: anyone can sign their own. `buildproof verify` therefore also checks the BuildProof public log (key registered to a licensed account, certificate countersigned with BuildProof's key) and says SELF_SIGNED otherwise. The real proof is `buildproof verify <cert> --rerun <folder>`: it re-runs the checks on the code you received.
44
46
 
45
- Network calls (all of them): trial start (`/api/trial/start`, a one-way hash of a device id, cached for 10 minutes when offline); licence activation / renewal / certificate countersigning (licence key or subscription id, signing public key and fingerprint, certificate hash - never your code); a daily npm registry version check; `ci --init` asks api.github.com whether your base branch is protected; `hunt` uploads the code as described above; `verify` reads the public log. The local web page loads Google Fonts and, on the phone-connect page, a QR code script from cdnjs.
47
+ Network calls (all of them): trial start (`/api/trial/start`, a one-way hash of a device id, plus the name of the command that ran and the BuildProof version, so we can see whether the trial is used - cached for 10 minutes when offline); the trial email, only if you give one (`buildproof trial --email you@example.com`, or the optional question in `buildproof init`): a confirmation link first, then a reminder before the trial ends and two questions after it, with one-click unsubscribe; licence activation / renewal / certificate countersigning (licence key or subscription id, signing public key and fingerprint, certificate hash - never your code); a daily npm registry version check; `ci --init` asks api.github.com whether your base branch is protected; `hunt` uploads the code as described above; `verify` reads the public log. The local web page loads Google Fonts and, on the phone-connect page, a QR code script from cdnjs.
package/bin/buildproof.js CHANGED
@@ -13,6 +13,7 @@
13
13
  * buildproof init [folder] [--ci] one-time setup: background service, project, AI tool hooks (--ci also adds the GitHub PR check)
14
14
  * buildproof try 30-second demo on a throw-away sample project: a skipped test is caught, the real fix is proven
15
15
  * buildproof activate <key> activate a license key buildproof license show the plan
16
+ * buildproof trial [--email you@example.com] trial days left; the email (optional) gets a reminder before the trial ends
16
17
  * buildproof open open BuildProof in the browser
17
18
  * buildproof stop stop the background service buildproof remote on|off allow your phone / tablet on this network (off = this computer only)
18
19
  * buildproof uninstall [folder] [--all --yes] remove BuildProof's hooks from the project and the start-at-login entry, stop the service (--all --yes also deletes ~/.buildproof)
@@ -37,7 +38,7 @@ const args = process.argv.slice(2);
37
38
  const cmd = ['-h', '--help'].includes(args[0]) ? 'help' : (args[0] || 'help');
38
39
  if (['-v', '--version', 'version'].includes(cmd)) { console.log(require('../package.json').version); process.exit(0); }
39
40
  // flags that take a value accept both --name=value and --name value
40
- const VALUE_FLAGS = new Set(['base', 'buy', 'intent', 'out', 'since', 'until', 'spec', 'verify', 'summary', 'claim']);
41
+ const VALUE_FLAGS = new Set(['email', 'base', 'buy', 'intent', 'out', 'since', 'until', 'spec', 'verify', 'summary', 'claim']);
41
42
  const flag = (n) => {
42
43
  const i = args.findIndex((x) => x === `--${n}` || x.startsWith(`--${n}=`));
43
44
  if (i < 0) return null;
@@ -176,11 +177,12 @@ async function main() {
176
177
  if (cmd === 'verify') {
177
178
  const certs = require('../core/certs');
178
179
  const file = positional[0];
179
- if (!file || !fs.existsSync(file)) out('usage: buildproof verify <certificate.html|.json>', 1);
180
- const raw = fs.readFileSync(file, 'utf8');
181
- const m = raw.match(/<script id="cert" type="application\/json">([\s\S]*?)<\/script>/);
182
- const cert = JSON.parse(m ? m[1] : raw);
183
- const ok = certs.verify(cert);
180
+ if (!file) out('usage: buildproof verify <certificate.html|.json>', 1);
181
+ if (!fs.existsSync(file)) out(`NOT_FOUND there is no file "${file}"`, 1);
182
+ let cert = null;
183
+ try { const raw = fs.readFileSync(file, 'utf8'); const m = raw.match(/<script id="cert" type="application\/json">([\s\S]*?)<\/script>/); cert = JSON.parse(m ? m[1] : raw); } catch { cert = null; }
184
+ if (!cert || typeof cert !== 'object' || !cert.payload) out(`NOT_A_CERTIFICATE "${file}" is not a BuildProof certificate (expected the .html or .json file BuildProof wrote)`, 1);
185
+ let ok = false; try { ok = certs.verify(cert); } catch { ok = false; }
184
186
  if (!ok) out('INVALID signature - the certificate was modified (or names a key it was not signed with)', 1);
185
187
  if (!flag('rerun')) {
186
188
  // a valid signature only shows the file was not edited; who stands behind it comes from the public log
@@ -233,6 +235,19 @@ async function main() {
233
235
  const sv = await require('../core/service').ensure({ autostart: false });
234
236
  if (!sv.ok) out(sv.how === 'port_busy' ? `DOWN port ${sv.port} is used by another program, not BuildProof - pick a free port: set MGR_PORT=38711` : `DOWN BuildProof could not start on port ${sv.port} (if another program uses it, pick a free port: set MGR_PORT=38711)`, 1);
235
237
  }
238
+ if (cmd === 'trial') { // BP_TRIAL_CARE: days left, and an optional email for a reminder before the end
239
+ const L = require('../core/license');
240
+ const e = flag('email');
241
+ if (e === true) out('TRIAL_EMAIL_FAIL add the address: buildproof trial --email you@example.com', 1);
242
+ if (typeof e === 'string') {
243
+ if (!/^[^\s@]+@[^\s@]+\.[A-Za-z]{2,}$/.test(e.trim())) out(`TRIAL_EMAIL_FAIL "${e}" does not look like an email address`, 1);
244
+ const r = await L.trialEmail(e);
245
+ const why = { no_trial: 'no trial on this computer yet: run any buildproof command first', invalid_email: 'the server did not accept this address', too_soon: 'wait a minute and try again', try_later: 'too many sign-ups right now, try again later', email_unavailable: 'our mail service is not answering, try again later', no_server: 'no licence server is set up on this computer', too_many_requests: 'too many tries, wait a minute' }[r.error] || `could not reach the BuildProof server (${r.error})`;
246
+ out(r.ok ? `TRIAL_EMAIL sent a confirmation link to ${e}. Click the button on that page and we will remind you before your trial ends, and ask 2 short questions after it. Every email has a one-click unsubscribe.` : `TRIAL_EMAIL_FAIL ${why}`, r.ok ? 0 : 1);
247
+ }
248
+ const st = L.status();
249
+ out(`TRIAL ${st.plan === 'trial' ? `${st.status} days_left=${st.daysLeft}${st.hasEmail ? ' reminder=on' : '\n Get a reminder before it ends: buildproof trial --email you@example.com'}` : `not in trial (licence: ${st.label} ${st.status})`}`, 0);
250
+ }
236
251
  if (cmd === 'license' || cmd === 'activate') {
237
252
  if (cmd === 'activate') {
238
253
  let key = positional[0] || '';
@@ -254,15 +269,20 @@ async function main() {
254
269
  }
255
270
  const r = await api('GET', '/api/license', null, 15000);
256
271
  if (!r.ok || !r.label) out(`DOWN ${r.error || 'unexpected answer on port ' + config.load().port}`, 1);
257
- out(`LICENSE ${r.label} ${r.status}${r.daysLeft != null ? ' days_left=' + r.daysLeft : ''}${r.projects ? ' projects_max=' + r.projects : ''}`, r.status === 'expired' ? 1 : 0);
272
+ out(`LICENSE ${r.label} ${r.status}${r.daysLeft != null ? ' days_left=' + r.daysLeft : ''}${r.projects ? ' projects_max=' + r.projects : ''}${r.plan === 'trial' && r.status === 'trial' && r.hasEmail === false ? '\n Get a reminder before your trial ends: buildproof trial --email you@example.com' : ''}`, r.status === 'expired' ? 1 : 0);
258
273
  }
259
274
  if (cmd === 'init') {
260
275
  const service = require('../core/service');
261
- const sv = await service.ensure({ autostart: !process.env.MGR_NO_AUTOSTART });
276
+ let autostart = !process.env.MGR_NO_AUTOSTART && !flag('no-autostart');
277
+ if (autostart && process.stdin.isTTY && process.stdout.isTTY && !process.env.CI && !flag('autostart')) {
278
+ const a = await new Promise((resolve) => { const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout }); const t = setTimeout(() => { rl.close(); resolve(''); }, 60000); rl.question('Start BuildProof automatically when you log in, so the AI-tool hooks always work? [Y/n] ', (x) => { clearTimeout(t); rl.close(); resolve(String(x || '').trim()); }); });
279
+ if (/^n/i.test(a)) autostart = false;
280
+ }
281
+ const sv = await service.ensure({ autostart });
262
282
  if (!sv.ok) out(`INIT_FAIL BuildProof could not start on port ${sv.port} (if another program uses it, pick a free port: set MGR_PORT=38711)`, 1);
263
283
  const dir = path.resolve(positional[0] || process.cwd());
264
284
  const pr = await api('POST', '/api/projects', { root: dir });
265
- if (!pr.ok) out(`INIT_FAIL ${pr.error}${pr.limit ? ' (limit ' + pr.limit + ' projects in this plan)' : ''}`, 1);
285
+ if (!pr.ok) out(`INIT_FAIL ${pr.error === 'plan_limit_projects' ? `this plan allows ${pr.limit} projects. Remove one in the BuildProof page (buildproof open), or upgrade: https://buildproof.mgrprosnetwork.com/#pricing` : pr.error}`, 1);
266
286
  const { spawnSync } = require('child_process');
267
287
  const onPath = (c) => { try { return spawnSync(process.platform === 'win32' ? 'where' : 'which', [c], { stdio: 'ignore' }).status === 0; } catch { return false; } };
268
288
  const tools = [];
@@ -277,8 +297,16 @@ async function main() {
277
297
  let ciNote = '';
278
298
  if (flag('ci')) { const w = require('../core/ci').init(dir); ciNote = w.ok ? `pull request check added: ${path.relative(dir, w.file)} - add your licence key as the BUILDPROOF_LICENSE secret in GitHub` : `pull request check already there: ${path.relative(dir, w.file)}`; }
279
299
  console.log(initSummary({ project: pr.project, connected, lic, ciNote, git: tools.includes('git') }));
280
- if (!process.env.MGR_NO_AUTOSTART && !process.env.MGR_NO_OPEN) openUrl(`http://127.0.0.1:${sv.port}/connect`);
281
- out(`OPEN http://127.0.0.1:${sv.port}/connect (BuildProof on this computer + add your phone)`, 0);
300
+ if (lic.plan === 'trial' && lic.status === 'trial' && lic.hasEmail === false && process.stdin.isTTY && process.stdout.isTTY && !process.env.CI && !flag('ci')) {
301
+ const answer = await new Promise((resolve) => {
302
+ const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
303
+ const t = setTimeout(() => { rl.close(); resolve(''); }, 60000);
304
+ rl.question('Your email for a reminder before the trial ends (optional, Enter to skip): ', (a) => { clearTimeout(t); rl.close(); resolve(String(a || '').trim()); });
305
+ });
306
+ if (answer) { const r = await require('../core/license').trialEmail(answer); console.log(r.ok ? ` Sent a confirmation link to ${answer}. Click it to get the reminder.` : ` Could not save the email (${r.error}). Later: buildproof trial --email you@example.com`); }
307
+ }
308
+ if (flag('open')) openUrl(`http://127.0.0.1:${sv.port}/connect`);
309
+ out(`READY BuildProof page: http://127.0.0.1:${sv.port}/connect (or: buildproof open)${sv.autostart ? ' · starts at login (turn off: buildproof uninstall)' : ''}`, 0);
282
310
  }
283
311
  if (cmd === 'try') { // 30-second demo on a throw-away sample project, never on your code (installs nothing that starts at login)
284
312
  const service = require('../core/service');
@@ -70,7 +70,7 @@ async function run({ root, base, cloud, intent, cfg, license, server, llm, log =
70
70
  const start = await request('POST', server + '/api/hunt', headers, { before: a.before, after: a.after, mode: cloud ? 'cloud' : 'local', intent }, 300000);
71
71
  if (start.code !== 200 || !start.j || !start.j.ok) {
72
72
  const e = (start.j && start.j.error) || 'server_unavailable';
73
- const hint = { no_cloud_checks: 'no cloud checks left: buildproof credits --buy 20, or run without --cloud (your own model, free)', hunter_not_in_plan: 'the hunter is in Pro and up', trial_ended: 'the trial has ended', cloud_ai_not_configured: 'cloud AI is not available yet, run without --cloud' }[e];
73
+ const hint = { no_cloud_checks: 'no cloud checks left: buildproof credits --buy 20, or run without --cloud (your own model, free)', hunter_not_in_plan: 'the hunter is in every paid plan (Basic: 3 a month)', basic_hunts_used: 'the 3 hunts of Basic this month are used - Pro has 30 a month: https://buildproof.mgrprosnetwork.com/#pricing', trial_ended: 'the trial has ended', cloud_ai_not_configured: 'cloud AI is not available yet, run without --cloud' }[e];
74
74
  return { code: 2, text: `CANNOT_HUNT ${e}${hint ? ' - ' + hint : ''}` };
75
75
  }
76
76
  const id = start.j.id;
package/core/license.js CHANGED
@@ -17,7 +17,7 @@ const GRACE_DAYS = 3;
17
17
  const DAY = 864e5;
18
18
 
19
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
- const BASIC = [F.guard, F.hooks, F.certificates]; // signed certificates are what sets BuildProof apart: in every paid plan
20
+ const BASIC = [F.guard, F.hooks, F.certificates, F.revertCheck, F.claims]; // 3.14: Basic also checks what the AI claims, and has 3 bug hunts a month (counted on the server) // signed certificates are what sets BuildProof apart: in every paid plan
21
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 = {
@@ -112,8 +112,10 @@ function onlineTrial(){
112
112
  try{const o=JSON.parse(fs.readFileSync(OFFLINE_FILE(),'utf8'));if(o.base===base&&Date.now()<o.until&&o.until<=Date.now()+10*60*1000)return null;}catch{}
113
113
  const device=deviceId();
114
114
  const url=new URL('/api/trial/start',base).href;
115
- const childCode="const u=process.argv[1],d=process.argv[2],m=u.startsWith('https:')?require('https'):require('http');const r=m.request(u,{method:'POST',headers:{'content-type':'application/json'},timeout:2500},s=>{let b='';s.on('data',x=>b+=x);s.on('end',()=>{if(s.statusCode!==200)process.exit(4);try{const v=JSON.parse(b);if(!v.ok||!['trial','expired'].includes(v.status)||!Number.isInteger(v.daysLeft))process.exit(5);process.stdout.write(JSON.stringify(v))}catch{process.exit(6)}})});r.on('timeout',()=>r.destroy());r.on('error',()=>process.exit(7));r.end(JSON.stringify({device:d}))";
116
- const r=cp.spawnSync(process.execPath,['-e',childCode,url,device],{encoding:'utf8',timeout:3500,windowsHide:true});
115
+ const childCode="const u=process.argv[1],d=process.argv[2],m=u.startsWith('https:')?require('https'):require('http');const r=m.request(u,{method:'POST',headers:{'content-type':'application/json'},timeout:2500},s=>{let b='';s.on('data',x=>b+=x);s.on('end',()=>{if(s.statusCode!==200)process.exit(4);try{const v=JSON.parse(b);if(!v.ok||!['trial','expired'].includes(v.status)||!Number.isInteger(v.daysLeft))process.exit(5);process.stdout.write(JSON.stringify(v))}catch{process.exit(6)}})});r.on('timeout',()=>r.destroy());r.on('error',()=>process.exit(7));r.end(JSON.stringify({device:d,ev:process.argv[3]||'',v:process.argv[4]||''}))";
116
+ const ev=String(global.__bpTrialEv||process.argv[2]&&!/[\\/]/.test(process.argv[2])&&process.argv[2]||'service').replace(/[^a-z-]/gi,'').slice(0,20).toLowerCase();
117
+ let ver='';try{ver=require('../package.json').version}catch{}
118
+ const r=cp.spawnSync(process.execPath,['-e',childCode,url,device,ev,ver],{encoding:'utf8',timeout:3500,windowsHide:true});
117
119
  let result=null;
118
120
  if(r.status===0&&!r.error){try{result=JSON.parse(r.stdout)}catch{result=null}}
119
121
  if(!result){ // server unreachable: use the local trial clock, never lock a user out because of the network
@@ -143,7 +145,7 @@ function status() {
143
145
  const online=onlineTrial();
144
146
  if(online){
145
147
  const left=online.daysLeft;
146
- return { status:online.status, plan:'trial',label:'Trial',daysLeft:left,trialStarted:online.started||null,projects:PLANS.trial.projects,features:online.status==='trial'?PLANS.trial.features:[], ...(online.reason?{reason:online.reason}:{}) };
148
+ return { status:online.status, plan:'trial',label:'Trial',daysLeft:left,trialStarted:online.started||null,hasEmail:online.hasEmail===true,projects:PLANS.trial.projects,features:online.status==='trial'?PLANS.trial.features:[], ...(online.reason?{reason:online.reason}:{}) };
147
149
  }
148
150
  const start = trialStart();
149
151
  const left = Math.max(0, Math.ceil((start + TRIAL_DAYS * DAY - Math.max(now, start)) / DAY));
@@ -188,4 +190,16 @@ function publicInfo() {
188
190
  return { ...status(), plans: Object.fromEntries(Object.entries(PLANS).map(([k, v]) => [k, { label: v.label, price: v.price, projects: v.projects === Infinity ? null : v.projects, features: v.features }])), featureText: FEATURE_TEXT };
189
191
  }
190
192
 
191
- module.exports = { deviceId, status, has, currentKey, activate, renew, parseKey, signKey, publicInfo, PLANS, F, TRIAL_DAYS };
193
+ /** BP_TRIAL_CARE: an optional email for the trial (a reminder before it ends, and 2 questions after). The server sends a confirmation link first. */
194
+ function trialEmail(email){
195
+ const cfg=require('./config').load();
196
+ const base=process.env.MGR_TRIAL_SERVER||cfg.licenseServer;
197
+ if(!base)return Promise.resolve({ok:false,error:'no_server'});
198
+ const u=new URL('/api/trial/email',base);const m=u.protocol==='https:'?require('https'):require('http');
199
+ return new Promise((resolve)=>{
200
+ const r=m.request(u,{method:'POST',headers:{'content-type':'application/json'},timeout:8000},(s)=>{let b='';s.on('data',(x)=>b+=x);s.on('end',()=>{try{resolve(JSON.parse(b))}catch{resolve({ok:false,error:'bad_answer_'+s.statusCode})}})});
201
+ r.on('timeout',()=>r.destroy(Error('timeout')));r.on('error',(e)=>resolve({ok:false,error:String(e.message||e)}));
202
+ r.end(JSON.stringify({device:deviceId(),email:String(email||'').trim()}));
203
+ });
204
+ }
205
+ module.exports = { trialEmail, deviceId, status, has, currentKey, activate, renew, parseKey, signKey, publicInfo, PLANS, F, TRIAL_DAYS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "buildproof",
3
- "version": "3.13.1",
3
+ "version": "3.14.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": {