@bugb-technologies/bravos 1.8.0 → 1.9.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 +11 -7
- package/dist/ci.js +1 -1
- package/dist/cli.js +195 -100
- package/dist/context.js +1 -1
- package/dist/doctor.js +20 -11
- package/dist/global.js +3 -3
- package/dist/guardlink.js +1 -1
- package/dist/guide.js +9 -9
- package/dist/help.js +23 -16
- package/dist/hooks.js +44 -21
- package/dist/mcp.js +3 -2
- package/dist/palette.js +2 -2
- package/dist/plugin-release.js +2 -2
- package/dist/plugin.js +3 -3
- package/dist/prefs.js +20 -1
- package/dist/setup-route.js +37 -0
- package/dist/setup.js +3 -2
- package/dist/skills.js +1 -1
- package/dist/start/answers.js +4 -4
- package/dist/start/index.js +69 -29
- package/dist/start/repos.js +1 -1
- package/dist/start/ui.js +2 -2
- package/dist/upkeep.js +6 -6
- package/dist/watch-frame.js +1 -1
- package/dist/watch.js +1 -1
- package/docs/GUIDE.md +10 -10
- package/docs/UPGRADING.md +24 -1
- package/hooks/lib/briefing.mjs +28 -7
- package/hooks/lib/legacy-skills.mjs +68 -0
- package/hooks/lib/palette.mjs +4 -4
- package/hooks/lib/prefs.mjs +2 -2
- package/hooks/lib/setup.mjs +7 -7
- package/hooks/session-start.mjs +2 -2
- package/package.json +1 -1
- package/skills/bravos/SKILL.md +2 -2
- package/skills/bravos-annotate/SKILL.md +2 -2
- package/skills/bravos-cicd/SKILL.md +1 -1
- package/skills/bravos-codegraph/SKILL.md +1 -1
- package/skills/bravos-schedule/SKILL.md +1 -1
- package/skills/bravos-ship/SKILL.md +2 -2
package/dist/start/answers.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// @comment -- "What bravos
|
|
1
|
+
// @comment -- "What bravos setup asks and records: the answers, the three starting presets, the bravos setup command they amount to, and the two files only start writes itself — the person's proving choice (.guardlink/proving.md, their words and name) and the saved answers (.bravos/setup.json, for --again)."
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
export const PRESETS = {
|
|
5
5
|
annotate: { label: 'Map my threats only', hint: 'annotations; nothing runs on its own', pr: 'none', autopilot: false, schedule: 'none', proving: 'none' },
|
|
6
|
-
// @comment -- "Autopilot is on for the pr preset in the preset itself, so bravos
|
|
6
|
+
// @comment -- "Autopilot is on for the pr preset in the preset itself, so bravos setup --yes and the interactive default agree."
|
|
7
7
|
pr: { label: 'Map threats and check every pull request', hint: 'no AI key needed', pr: 'hook+github', autopilot: true, schedule: 'none', proving: 'ask' },
|
|
8
8
|
// @comment -- "The label says what the schedule does by default: an annotation run. Scheduled testing happens only when the person picks it at the testing question."
|
|
9
9
|
everything: { label: 'Everything: annotations, PR checks and a scheduled annotation run', hint: 'weekly run, autopilot on; testing is the next choice', pr: 'hook+github', autopilot: true, schedule: 'weekly', proving: 'ask' },
|
|
10
10
|
};
|
|
11
11
|
/** Pricing for optional CXG model generation. */
|
|
12
12
|
export const PENTEST_COST_URL = 'https://bugb.io/pricing#pentest-cost';
|
|
13
|
-
/** The bravos
|
|
13
|
+
/** The bravos setup arguments these answers amount to (the review step prints them). */
|
|
14
14
|
// @comment -- "The init flags for the chosen answers: agents, the pre-PR hook, autopilot, which workflows and the nightly cadence, and the loopback scope starter when testing is on"
|
|
15
15
|
export function initArgs(a) {
|
|
16
16
|
const args = ['init', a.repo, '--agent', a.agents.join(',')];
|
|
@@ -41,7 +41,7 @@ export function provingText(a, date) {
|
|
|
41
41
|
return [
|
|
42
42
|
'# How findings are proven',
|
|
43
43
|
'',
|
|
44
|
-
'Recorded by `bravos start` from the answers below. Edit it, or run `bravos
|
|
44
|
+
'Recorded by `bravos start` from the answers below. Edit it, or run `bravos setup --change`, to change it.',
|
|
45
45
|
'',
|
|
46
46
|
`choice: ${a.proving}`,
|
|
47
47
|
...(a.proving === 'auto' ? [`kits: ${a.kitPolicy ?? 'reviewed'}`] : []),
|
package/dist/start/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @comment -- "bravos
|
|
1
|
+
// @comment -- "bravos setup: the guided first run. One question per step (theme, licence, tools, repository, agents, goal, PR checks, autopilot, schedule, testing permission, continuous pentest, the person's words and name, GitHub secrets), each step able to go back with Esc, then every change and the equivalent bravos setup command, and nothing written until the person says Apply; signing in is the one step that acts when chosen. It then installs through the existing commands, records the proving choice in the person's own words, builds the code graph and reports what it found, and hands the first annotation to their own agent — bravos never starts an agent itself."
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { join, resolve } from 'node:path';
|
|
4
4
|
import { resolveTheme, THEMES } from '../palette.js';
|
|
@@ -7,6 +7,7 @@ import { CRON } from '../ci.js';
|
|
|
7
7
|
import { initArgs, nightlySecrets, normalTarget, PRESETS, provingText, readAnswers, targetProblem, writeAnswers, writeTheme, } from './answers.js';
|
|
8
8
|
import { findRepos, isGitRepo, repoHint, repoProblem, tildify } from './repos.js';
|
|
9
9
|
import { Back, Cancelled } from './ui.js';
|
|
10
|
+
import { BravosError } from '../types.js';
|
|
10
11
|
import { prefsLib } from '../prefs.js';
|
|
11
12
|
const AGENTS = [
|
|
12
13
|
{ value: 'claude', label: 'Claude Code' },
|
|
@@ -70,9 +71,23 @@ async function flow(opts, d) {
|
|
|
70
71
|
if (shadow && /\.local\/bin\/bravos$|site-packages|pipx/.test(shadow)) {
|
|
71
72
|
p.warn(`The old Python bravos at ${shadow} may run instead of this one. Rename it: mv ${shadow} ${shadow}-py`);
|
|
72
73
|
}
|
|
74
|
+
// What to type to ask the repository's questions again, in the words of the command the person used.
|
|
75
|
+
const change = opts.command === 'setup' ? 'bravos setup --change' : 'bravos start --again';
|
|
76
|
+
// @comment -- "The setup has two parts, and each says so once: this machine (colours, sign-in, tools: set once, used by every repository) and this repository (agents, checks, testing: recorded in the repository for the team). A second repository on a machine that is ready skips the first part with one line saying so."
|
|
77
|
+
const said = { machine: false, repository: false };
|
|
78
|
+
const heading = (part) => {
|
|
79
|
+
if (said[part])
|
|
80
|
+
return;
|
|
81
|
+
said[part] = true;
|
|
82
|
+
p.info(part === 'machine'
|
|
83
|
+
? 'This machine — colours, sign-in and tools. Set once; every repository on this machine uses them.'
|
|
84
|
+
: 'This repository — which agents, pull-request checks and testing. Recorded in the repository, so your team gets the same.');
|
|
85
|
+
};
|
|
86
|
+
let themeKept = false;
|
|
73
87
|
const has = (s, f) => !!s.lic?.unlocked.includes(f);
|
|
74
88
|
const missingTools = (s) => (s.items ?? []).filter((i) => (i.id === 'guardlink' || i.id === 'cxg') && (!i.present || (i.proofTool && i.proofTool.status !== 'ready')));
|
|
75
|
-
|
|
89
|
+
// A bundle older than this version pins counts as missing: setting up again after an upgrade must bring it up to date.
|
|
90
|
+
const missingBundles = (s) => (s.items ?? []).filter((i) => (i.id === 'analyzer' || i.id === 'codegraph') && (!i.present || !!i.behind) && i.licensed);
|
|
76
91
|
// @comment -- "A repository-level question is skipped when joining: those answers are the team's, already committed."
|
|
77
92
|
const team = (step) => async (s) => {
|
|
78
93
|
if (!s.join)
|
|
@@ -81,8 +96,15 @@ async function flow(opts, d) {
|
|
|
81
96
|
const steps = [
|
|
82
97
|
// theme
|
|
83
98
|
async (s) => {
|
|
84
|
-
p.note(themeSample(), 'Colours');
|
|
85
99
|
const detected = resolveTheme(d.env);
|
|
100
|
+
// Colours chosen in an earlier setup are kept; --change asks again.
|
|
101
|
+
themeKept = !opts.again && s.theme === undefined && detected.source.startsWith('saved');
|
|
102
|
+
if (themeKept) {
|
|
103
|
+
s.theme = detected.theme;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
heading('machine');
|
|
107
|
+
p.note(themeSample(), 'Colours');
|
|
86
108
|
const initial = s.theme ?? saved?.theme ?? detected.theme;
|
|
87
109
|
s.theme = await p.select('theme', 'How does your terminal look?', [
|
|
88
110
|
{ value: 'dark', label: 'Dark background', recommended: detected.source !== 'default' && detected.theme === 'dark' },
|
|
@@ -93,6 +115,8 @@ async function flow(opts, d) {
|
|
|
93
115
|
// licence
|
|
94
116
|
async (s) => {
|
|
95
117
|
s.lic = await d.licence();
|
|
118
|
+
if (!s.lic.licensed && !opts.yes)
|
|
119
|
+
heading('machine');
|
|
96
120
|
if (!s.lic.licensed && !opts.yes) {
|
|
97
121
|
const how = await p.select('licence', 'No Bravos licence on this machine yet.', [
|
|
98
122
|
{ value: 'activate', label: 'Sign in now', hint: 'activate your licence, or start the free 30-day Team trial', recommended: true },
|
|
@@ -119,20 +143,35 @@ async function flow(opts, d) {
|
|
|
119
143
|
p.note(s.items.map((i) => {
|
|
120
144
|
if (i.present && i.proofTool && i.proofTool.status !== 'ready')
|
|
121
145
|
return `✗ ${i.id.padEnd(10)} ${i.present} needs a compatible build for ${i.proofTool.capability}`;
|
|
146
|
+
if (i.present && i.behind && i.licensed)
|
|
147
|
+
return `↑ ${i.id.padEnd(10)} ${i.behind} installed, this version uses ${i.wanted}`;
|
|
122
148
|
return `${i.present ? '✔' : '✗'} ${i.id.padEnd(10)} ${i.present ? 'installed' : i.licensed === false ? 'Team plan' : `missing — ${i.action}`}`;
|
|
123
149
|
}).join('\n'), 'Tools');
|
|
124
150
|
const missing = [...missingTools(s), ...missingBundles(s)];
|
|
151
|
+
// @comment -- "The answer given before (Esc returns here) is kept as the default; the first time the default is yes. It used to be reset to no before the question, so Enter skipped the install. An unattended run is never asked: it fetches Bravos's own bundles at Apply and leaves guardlink and cxg, whose installers are other people's, to a person."
|
|
152
|
+
const before = s.installTools;
|
|
125
153
|
s.installTools = false;
|
|
126
|
-
if (!missing.length)
|
|
154
|
+
if (!missing.length && themeKept && s.lic?.licensed)
|
|
155
|
+
p.info('This machine is ready: signed in, tools installed, colours chosen. Nothing to set up here.');
|
|
156
|
+
if (!missing.length || opts.yes)
|
|
127
157
|
return;
|
|
158
|
+
heading('machine');
|
|
128
159
|
if (missingTools(s).some((i) => i.id === 'cxg') && !d.which('cargo')) {
|
|
129
160
|
p.warn('cxg (the test engine) installs with Rust\'s cargo, which is not here. Install Rust first: curl --proto \'=https\' --tlsv1.2 -sSf https://sh.rustup.rs | sh — or skip cxg for now; annotations work without it.');
|
|
130
161
|
}
|
|
131
|
-
s.installTools = await p.confirm('tools', `Install ${missing.map((i) => i.id).join(', ')} when you apply?`,
|
|
162
|
+
s.installTools = await p.confirm('tools', `Install ${missing.map((i) => i.id).join(', ')} when you apply?`, before ?? true);
|
|
132
163
|
},
|
|
133
164
|
// repository
|
|
134
165
|
async (s) => {
|
|
166
|
+
heading('repository');
|
|
135
167
|
let repo = opts.dir ? resolve(opts.dir) : '';
|
|
168
|
+
// @comment -- "An unattended run sets up the folder it was given, or the one it runs in, and nothing else: it never looks around for a repository to pick, because nobody is there to see which one it chose. A folder that is not a git repository is refused before anything is written."
|
|
169
|
+
if (opts.yes) {
|
|
170
|
+
repo = repo || resolve(d.cwd);
|
|
171
|
+
const problem = repoProblem(repo);
|
|
172
|
+
if (problem)
|
|
173
|
+
throw new BravosError(`${tildify(repo, d.home)}: ${problem}. Nothing was changed. Run it inside the repository, or name it: bravos ${opts.command ?? 'start'} --yes <dir>`);
|
|
174
|
+
}
|
|
136
175
|
if (repo && repoProblem(repo)) {
|
|
137
176
|
p.warn(`${tildify(repo)}: ${repoProblem(repo)}`);
|
|
138
177
|
repo = '';
|
|
@@ -160,11 +199,12 @@ async function flow(opts, d) {
|
|
|
160
199
|
}
|
|
161
200
|
}
|
|
162
201
|
s.repo = repo;
|
|
163
|
-
// @comment -- "Joining: the repository already carries Bravos's files and the team's recorded setup, so a teammate (or a second machine) is asked only about this machine, and nothing the team decided is rewritten. bravos
|
|
164
|
-
|
|
202
|
+
// @comment -- "Joining: the repository already carries Bravos's files and the team's recorded setup, so a teammate (or a second machine) is asked only about this machine, and nothing the team decided is rewritten. bravos setup --change is the way to change the repository's setup."
|
|
203
|
+
// The lock alone means Bravos is here, whichever way it was installed (the guided setup, or flags, which leave no setup.json): bravos setup in such a repository brings it up to date, and only --change asks its questions.
|
|
204
|
+
s.join = !opts.again && existsSync(join(repo, '.bravos', 'skills.lock'));
|
|
165
205
|
if (s.join) {
|
|
166
206
|
s.agents = readAnswers(repo)?.agents ?? s.agents;
|
|
167
|
-
p.info(
|
|
207
|
+
p.info(`Bravos is already set up in this repository, so only this machine is set up now; the team's choices stay as they are. To change them: ${change}`);
|
|
168
208
|
}
|
|
169
209
|
},
|
|
170
210
|
// agents
|
|
@@ -249,7 +289,7 @@ async function flow(opts, d) {
|
|
|
249
289
|
const autoReady = defaultRef.code === 0 && !!defaultRef.out.trim()
|
|
250
290
|
&& d.exec('git', ['rev-parse', '--verify', `${defaultRef.out.trim()}^{commit}`], { cwd: s.repo }).code === 0;
|
|
251
291
|
if (!autoReady)
|
|
252
|
-
p.warn(
|
|
292
|
+
p.warn(`Automatic proving is unavailable: origin/HEAD is missing or unresolved. Fetch the default branch, then run git remote set-head origin --auto (or git remote set-head origin <branch>), and run ${change}. Use Ask me every time for a local clone.`);
|
|
253
293
|
const choices = [
|
|
254
294
|
{ value: 'ask', label: 'Ask me every time before testing', recommended: true },
|
|
255
295
|
...(autoReady ? [
|
|
@@ -368,10 +408,10 @@ async function flow(opts, d) {
|
|
|
368
408
|
const answers = toAnswers(s);
|
|
369
409
|
const changes = [
|
|
370
410
|
`Colours: ${answers.theme} (saved in ${tildify(join(d.home, 'config.json'), d.env.HOME)})`,
|
|
371
|
-
...(answers.installTools ? [`Install: ${[...missingTools(s), ...missingBundles(s)].map((i) => i.id).join(', ')}`] : []),
|
|
411
|
+
...(answers.installTools ? [`Install: ${[...missingTools(s), ...missingBundles(s)].map((i) => i.id).join(', ')}`] : opts.yes && missingBundles(s).length ? [`Install: ${missingBundles(s).map((i) => i.id).join(', ')}`] : []),
|
|
372
412
|
...(s.commits ? [`Commits: ${{ commit: 'your agent commits Bravos\'s own files without asking', leave: 'your agent leaves Bravos\'s files for you', ask: 'your agent asks each session' }[s.commits]} (your answer, kept in this clone only)`] : []),
|
|
373
413
|
`In ${tildify(answers.repo, d.env.HOME)}:`,
|
|
374
|
-
...(s.join ? [' ~ skills, hooks and MCP brought up to date for this machine
|
|
414
|
+
...(s.join ? [' ~ skills, hooks and MCP brought up to date for this machine ', ' = the team\'s setup, testing permission and workflows stay as they are'] : []),
|
|
375
415
|
...(s.join ? [] : [
|
|
376
416
|
` + skills, hooks and MCP for ${answers.agents.join(', ')}`,
|
|
377
417
|
' + .guardlink/ threat model (guardlink init, if not there yet)',
|
|
@@ -383,7 +423,7 @@ async function flow(opts, d) {
|
|
|
383
423
|
...(answers.proving !== 'none' ? [' + .guardlink/scope.yaml (localhost only; authorization left for you)'] : []),
|
|
384
424
|
...(answers.name ? [` + .guardlink/proving.md (${answers.proving}${answers.target ? ` on ${answers.target}` : ''}, confirmed by ${answers.name})`] : []),
|
|
385
425
|
...(Object.keys(s.secrets).length ? [` + GitHub secrets: ${Object.keys(s.secrets).join(', ')}`] : []),
|
|
386
|
-
|
|
426
|
+
` + .bravos/setup.json (your answers, for ${change})`,
|
|
387
427
|
]),
|
|
388
428
|
...(has(s, 'codegraph') ? ['Then: build the code graph for this repository'] : []),
|
|
389
429
|
];
|
|
@@ -411,8 +451,9 @@ async function flow(opts, d) {
|
|
|
411
451
|
break;
|
|
412
452
|
p.note([
|
|
413
453
|
...(answers.installTools && missingTools(s).length ? ['bravos setup --tools -y'] : []),
|
|
414
|
-
...(answers.installTools && missingBundles(s).length ? ['bravos setup'] : []),
|
|
415
|
-
|
|
454
|
+
...(answers.installTools && missingBundles(s).length ? ['bravos setup --analyzer --codegraph'] : []),
|
|
455
|
+
// Shown as the one command a person would type; Apply runs the same install underneath.
|
|
456
|
+
s.join ? `bravos setup ${JSON.stringify(answers.repo)} (brings it up to date)` : `bravos ${['setup', ...initArgs(answers).slice(1)].map((x) => (/\s/.test(x) ? JSON.stringify(x) : x)).join(' ')}`,
|
|
416
457
|
...Object.keys(s.secrets).map((n) => `gh secret set ${n} (value from your paste)`),
|
|
417
458
|
...(has(s, 'codegraph') ? [`bravos graph build ${JSON.stringify(answers.repo)} --scip no-exec`] : []),
|
|
418
459
|
].join('\n'), 'Commands');
|
|
@@ -442,7 +483,7 @@ async function apply(answers, s, d, opts, has) {
|
|
|
442
483
|
const p = d.prompter;
|
|
443
484
|
const { repo, agents } = answers;
|
|
444
485
|
writeTheme(d.home, answers.theme);
|
|
445
|
-
if (answers.installTools && has.missingTools) {
|
|
486
|
+
if (answers.installTools && has.missingTools && !opts.yes) {
|
|
446
487
|
const r = await p.spin('Installing guardlink and cxg', () => d.bravos(['setup', '--tools', '-y']), (r) => (r.code ? { fail: 'Installing guardlink and cxg — failed' } : 'Installed guardlink and cxg'));
|
|
447
488
|
for (const l of [...r.out, ...r.err])
|
|
448
489
|
(r.code ? p.warn : p.info)(l);
|
|
@@ -451,12 +492,13 @@ async function apply(answers, s, d, opts, has) {
|
|
|
451
492
|
if (r.code)
|
|
452
493
|
p.warn('Carrying on without them: annotation and the briefing work now; proving needs guardlink and cxg. Fix the line above, then run bravos setup --tools.');
|
|
453
494
|
}
|
|
454
|
-
|
|
455
|
-
|
|
495
|
+
// The bundles are named: a bare `bravos setup` is the whole setup now, and would start this wizard again. An unattended run fetches them too; they are Bravos's own, signed.
|
|
496
|
+
if ((answers.installTools || opts.yes) && has.missingBundles) {
|
|
497
|
+
const r = await p.spin('Fetching the Bravos analyzer and code graph', () => d.bravos(['setup', '--analyzer', '--codegraph']), (r) => (r.code ? { fail: 'Fetching the analyzer and code graph — failed' } : 'Fetched the analyzer and code graph'));
|
|
456
498
|
for (const l of [...r.out, ...r.err])
|
|
457
499
|
(r.code ? p.warn : p.info)(l);
|
|
458
500
|
}
|
|
459
|
-
// @comment -- "Joining runs bravos
|
|
501
|
+
// @comment -- "Joining runs bravos setup, which re-applies what the repository already has and never rewrites the team's choices; a first setup runs bravos setup with the flags the answers amount to."
|
|
460
502
|
const init = has.join
|
|
461
503
|
? await p.spin('Bringing this machine up to date with the repository', () => d.bravos(['sync', repo]), (r) => (r.code ? { fail: 'Syncing the repository — failed' } : 'Repository in sync'))
|
|
462
504
|
: await p.spin('Setting up the repository', () => d.bravos(initArgs(answers)), (r) => (r.code ? { fail: 'Setting up the repository — failed' } : 'Repository set up'));
|
|
@@ -465,7 +507,7 @@ async function apply(answers, s, d, opts, has) {
|
|
|
465
507
|
if (init.code !== 0) {
|
|
466
508
|
for (const l of init.err)
|
|
467
509
|
p.warn(l);
|
|
468
|
-
p.outro(
|
|
510
|
+
p.outro(`Setup stopped: the repository step did not finish. Fix the line above and run ${opts.command === 'setup' ? 'bravos setup' : has.join ? 'bravos start' : 'bravos start --again'} once more.`);
|
|
469
511
|
return init.code;
|
|
470
512
|
}
|
|
471
513
|
// Joining never writes the team's proving.md or setup.json: both are theirs, already committed.
|
|
@@ -514,16 +556,14 @@ async function apply(answers, s, d, opts, has) {
|
|
|
514
556
|
const handoff = `${sigil(lead)}bravos-context`;
|
|
515
557
|
// A scripted run (--yes) leaves the person's clipboard alone.
|
|
516
558
|
const copied = opts.yes ? false : d.clipboard(handoff);
|
|
517
|
-
// @comment -- "The hand-off: a dated marker in this clone's git directory
|
|
559
|
+
// @comment -- "The hand-off: the install step above leaves a dated marker in this clone's git directory (src/prefs.ts leaveHandoff) where the chosen agent runs the session hook, and the briefing then has the agent begin the context step itself. Here the note to the person follows what was written: 'say anything' where the marker is there, else the command to type."
|
|
518
560
|
let begins = false;
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
begins = false;
|
|
526
|
-
}
|
|
561
|
+
try {
|
|
562
|
+
const L = await prefsLib();
|
|
563
|
+
begins = L.readHandoff(L.gitCommonDir(repo, d.env));
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
begins = false;
|
|
527
567
|
}
|
|
528
568
|
const banner = 'The Bravos banner shows the next step each time you open a session.';
|
|
529
569
|
p.note((begins
|
|
@@ -548,7 +588,7 @@ async function apply(answers, s, d, opts, has) {
|
|
|
548
588
|
'Follow along in a second terminal: bravos watch',
|
|
549
589
|
]).join('\n'), 'One step left, in your agent');
|
|
550
590
|
if (opts.yes && !answers.name)
|
|
551
|
-
p.info(
|
|
591
|
+
p.info(`Testing permission was not recorded (a person has to answer it): run ${opts.command === 'setup' ? 'bravos setup --change' : 'bravos start --again'} in a terminal.`);
|
|
552
592
|
p.outro('Bravos is set up.');
|
|
553
593
|
return 0;
|
|
554
594
|
}
|
package/dist/start/repos.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @comment -- "Finds git repositories to offer in bravos
|
|
1
|
+
// @comment -- "Finds git repositories to offer in bravos setup: the current folder, then repos at most two levels under the current folder's parent and the usual code folders. Read-only directory listings only, capped in count and time, never inside node_modules or dot folders."
|
|
2
2
|
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { basename, dirname, join, resolve } from 'node:path';
|
package/dist/start/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @comment -- "The prompts bravos
|
|
1
|
+
// @comment -- "The prompts bravos setup asks through: one small interface, a terminal implementation drawn by this file on @clack/core, and a scripted one for tests and --yes. Every prompt has an id so a test can answer it by name. The terminal one uses no dim or faint colour: markers are plain text ([x], ( ), ❯) in the terminal's own foreground, so they read on light and dark themes alike; Esc steps back, Ctrl-C quits."
|
|
2
2
|
import * as clack from '@clack/prompts';
|
|
3
3
|
import { MultiSelectPrompt, PasswordPrompt, SelectPrompt, TextPrompt, isCancel } from '@clack/core';
|
|
4
4
|
/** The person pressed Ctrl-C (or chose Cancel): nothing has been written. */
|
|
@@ -155,7 +155,7 @@ export function terminalPrompter() {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
* Answers from a table, for tests and for `bravos
|
|
158
|
+
* Answers from a table, for tests and for `bravos setup --yes`. An id with no answer
|
|
159
159
|
* takes the prompt's default (initial) when it has one, and is otherwise an error, so
|
|
160
160
|
* a scripted run never silently invents an answer a person should give. '__back__'
|
|
161
161
|
* answers as Esc would (once), '__cancel__' as Ctrl-C.
|
package/dist/upkeep.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @comment -- "bravos upkeep: what in this repository or on this machine has fallen behind the installed bravos, read-only and without the network, fast enough for the session hook to ask at every start. Two things: the repository's own copies of the skills and hook scripts (compared file by file with what this bravos would write, so a lock that still names an old version cannot hide or invent a difference), and a staged bundle older than the version this bravos pins. It also says which side is newer, because
|
|
1
|
+
// @comment -- "bravos upkeep: what in this repository or on this machine has fallen behind the installed bravos, read-only and without the network, fast enough for the session hook to ask at every start. Two things: the repository's own copies of the skills and hook scripts (compared file by file with what this bravos would write, so a lock that still names an old version cannot hide or invent a difference), and a staged bundle older than the version this bravos pins. It also says which side is newer, because re-applying from an older bravos would roll a repository back."
|
|
2
2
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { join, relative } from 'node:path';
|
|
4
4
|
import { olderThan, VERSIONS } from './artifacts.js';
|
|
@@ -41,7 +41,7 @@ function staleHooks(root) {
|
|
|
41
41
|
}
|
|
42
42
|
export async function gatherUpkeep(root, env) {
|
|
43
43
|
const cli = version();
|
|
44
|
-
const out = { schema: UPKEEP_SCHEMA, cli, repo: null, sync: { files: 0, sample: [], direction: 'same' }, bundles: [] };
|
|
44
|
+
const out = { schema: UPKEEP_SCHEMA, cli, repo: null, sync: { files: 0, sample: [], direction: 'same' }, bundles: [], unified: true };
|
|
45
45
|
if (existsSync(join(root, LOCK_PATH))) {
|
|
46
46
|
try {
|
|
47
47
|
const lock = readLock(root);
|
|
@@ -57,7 +57,7 @@ export async function gatherUpkeep(root, env) {
|
|
|
57
57
|
out.sync.sample = stale.slice(0, 5);
|
|
58
58
|
}
|
|
59
59
|
catch {
|
|
60
|
-
/* a lock that does not read: bravos
|
|
60
|
+
/* a lock that does not read: bravos setup says why; nothing to report here */
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
const L = await licenceLib();
|
|
@@ -74,13 +74,13 @@ export async function gatherUpkeep(root, env) {
|
|
|
74
74
|
export function formatUpkeep(u) {
|
|
75
75
|
const lines = [];
|
|
76
76
|
if (u.repo === null)
|
|
77
|
-
lines.push('repository: bravos is not installed here (bravos
|
|
77
|
+
lines.push('repository: bravos is not installed here (bravos setup in a terminal, or bravos setup --yes)');
|
|
78
78
|
else if (u.sync.files === 0)
|
|
79
79
|
lines.push(`repository: up to date with bravos ${u.cli}`);
|
|
80
80
|
else if (u.sync.direction === 'repo-newer')
|
|
81
|
-
lines.push(`repository: its Bravos files are from ${u.repo}, newer than this bravos (${u.cli}) — update bravos: npm install -g @bugb-technologies/bravos@latest (
|
|
81
|
+
lines.push(`repository: its Bravos files are from ${u.repo}, newer than this bravos (${u.cli}) — update bravos: npm install -g @bugb-technologies/bravos@latest (this older one leaves the repository alone)`);
|
|
82
82
|
else
|
|
83
|
-
lines.push(`repository: ${u.sync.files} file${u.sync.files === 1 ? '' : 's'} behind bravos ${u.cli} — bravos
|
|
83
|
+
lines.push(`repository: ${u.sync.files} file${u.sync.files === 1 ? '' : 's'} behind bravos ${u.cli} — bravos setup (${u.sync.sample.join(', ')}${u.sync.files > u.sync.sample.length ? ', …' : ''})`);
|
|
84
84
|
for (const b of u.bundles)
|
|
85
85
|
lines.push(`${b.id}: staged ${b.staged}, this bravos pins ${b.pinned} — bravos setup`);
|
|
86
86
|
if (!u.bundles.length)
|
package/dist/watch-frame.js
CHANGED
|
@@ -359,7 +359,7 @@ function teamPanel(sn, inner) {
|
|
|
359
359
|
if (sn.review.drafted)
|
|
360
360
|
body.push([s(`intent review: ${sn.review.answers.length} answered${sn.review.answers.length ? ` (${sn.review.answers.map((a) => a.by).join(', ')})` : ''}`, C.steel)]);
|
|
361
361
|
if (sn.bravos?.repo && sn.bravos.repo !== sn.bravos.cli)
|
|
362
|
-
body.push([s(`skills here ${sn.bravos.repo}, bravos ${sn.bravos.cli} → bravos
|
|
362
|
+
body.push([s(`skills here ${sn.bravos.repo}, bravos ${sn.bravos.cli} → bravos setup`, C.amber)]);
|
|
363
363
|
return { title: 'BRANCH · TEAM', body };
|
|
364
364
|
}
|
|
365
365
|
// @comment -- "The REPORT panel: the newest bravos-report write-up's title, kind and age, its findings by evidence level and severity, the check verdict, exported formats and how far HEAD has moved since its evidence; or how to write one."
|
package/dist/watch.js
CHANGED
|
@@ -878,7 +878,7 @@ export async function runWatch(root, env, opts) {
|
|
|
878
878
|
}
|
|
879
879
|
if (a.kind === 'theme') {
|
|
880
880
|
theme = nextTheme(theme);
|
|
881
|
-
note = `colours: ${theme} — keep it with BRAVOS_THEME=${theme} or bravos
|
|
881
|
+
note = `colours: ${theme} — keep it with BRAVOS_THEME=${theme} or bravos setup`;
|
|
882
882
|
}
|
|
883
883
|
if (a.kind === 'refresh') {
|
|
884
884
|
note = 'refreshing everything, the code graph too…';
|
package/docs/GUIDE.md
CHANGED
|
@@ -30,9 +30,9 @@ Every skill reads one dial: low, medium (default), high or max. Say it ("annotat
|
|
|
30
30
|
|
|
31
31
|
### Installing
|
|
32
32
|
|
|
33
|
-
npm install -g @bugb-technologies/bravos (Node 20 or newer), then bravos
|
|
33
|
+
npm install -g @bugb-technologies/bravos (Node 20 or newer), then bravos setup: a guided setup that asks one question at a time (colours, licence, tools, repository, AI tools, PR checks, a scheduled run, how testing is allowed), shows every change, and writes nothing until you choose Apply. Then open your agent and say anything: Bravos begins with what the app is for and goes on to your code once you confirm (where the agent runs no hooks, it tells you the one thing to type).
|
|
34
34
|
|
|
35
|
-
By hand instead: bravos account activate signs you in once in the browser and writes the licence — a 30-day Team trial when the account has no plan; skip it to stay on Free — bravos
|
|
35
|
+
By hand instead: bravos account activate signs you in once in the browser and writes the licence — a 30-day Team trial when the account has no plan; skip it to stay on Free — bravos setup --agent claude in a repository writes the skills, hooks and MCP wiring, bravos setup --analyzer --codegraph puts the analyzer and the code graph on the machine (Team plan), and guardlink and cxg come from bravos setup --tools -y, or npm and cargo by hand. If you used the Python bravos, rename its command so bravos means this one: mv ~/.local/bin/bravos ~/.local/bin/bravos-py (this CLI still finds its code graph and analyzer), or remove it with pipx or uv.
|
|
36
36
|
|
|
37
37
|
### Your first day
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ Keep bravos watch running in a second terminal pane beside your agent (free, rea
|
|
|
44
44
|
|
|
45
45
|
### Hands-off: autopilot
|
|
46
46
|
|
|
47
|
-
bravos
|
|
47
|
+
bravos setup --autopilot makes upkeep happen without anyone asking. At turn end the agent reviews changed code, including edits inside annotated files. It follows the recorded proving preference for affected claims. The pre-PR gate runs on every gh pr create.
|
|
48
48
|
|
|
49
49
|
Proving follows your choice, not a fixed rule: the first time it comes up the agent asks you once — prove automatically on your loopback target, ask each time, on a schedule, or not now — and records your words in .guardlink/proving.md. Say "ask me first" or "stop auto-proving" at any time to change it. Non-loopback targets still need a reviewed scope and your typed authorization every time.
|
|
50
50
|
|
|
@@ -70,7 +70,7 @@ Start by recording what the product intends (bravos-context), so severities refl
|
|
|
70
70
|
|
|
71
71
|
Skills: `/bravos-campaign` · `/bravos-schedule` · `/bravos-cicd`
|
|
72
72
|
|
|
73
|
-
Turn on bravos
|
|
73
|
+
Turn on bravos setup --autopilot so the threat model keeps up as people work, with no commands to remember, and settle once with the team how findings should be proven (it is recorded in .guardlink/proving.md and shows in every briefing).
|
|
74
74
|
|
|
75
75
|
Coverage and findings are visible to everyone from the repo itself. To raise coverage or clear the backlog, run bravos-campaign with a goal ("coverage 100%", "test every open exposure"): it plans disjoint batches, runs one subagent per batch, gates each, rests, and reports before-and-after numbers. Use bravos-schedule for recurring upkeep (an in-session loop or the nightly workflow) and bravos-cicd for the PR gate and code-scanning upload. Acceptances (@accepts) and entitlements are yours to write; agents never write them.
|
|
76
76
|
|
|
@@ -84,7 +84,7 @@ Run bravos first: it reads the briefing, explains the loop in five lines and rou
|
|
|
84
84
|
|
|
85
85
|
Skills: `/bravos-cicd` · `/bravos-schedule`
|
|
86
86
|
|
|
87
|
-
bravos
|
|
87
|
+
bravos setup --ci writes the PR gate and nightly workflows. bravos-cicd audits existing workflows: broken guardlink calls, script injection from pull-request text, missing SARIF upload. The Claude and Codex nightlies can replay committed, bound kits when scheduled testing is authorized. The Copilot job assigns an annotation task.
|
|
88
88
|
|
|
89
89
|
## What to do, by task
|
|
90
90
|
|
|
@@ -206,13 +206,13 @@ Clone the services side by side in one folder, then run bravos workspace create
|
|
|
206
206
|
|
|
207
207
|
Skills: `/bravos`
|
|
208
208
|
|
|
209
|
-
Nothing to run by hand in a repository you work in with an agent: at the start of a session bravos upkeep (read-only, no network) tells the agent what is behind the installed version, and the agent runs bravos
|
|
209
|
+
Nothing to run by hand in a repository you work in with an agent: at the start of a session bravos upkeep (read-only, no network) tells the agent what is behind the installed version, and the agent runs bravos setup, which brings the repository's skills and hooks and Bravos's own bundles up to date, without asking. If a teammate synced the repository with a newer bravos than yours, the agent syncs nothing and tells you to update. Installing guardlink and cxg (bravos setup --tools) still waits for your go-ahead.
|
|
210
210
|
|
|
211
211
|
### Stop being asked about commits
|
|
212
212
|
|
|
213
213
|
Skills: `/bravos`
|
|
214
214
|
|
|
215
|
-
Say once whether your agent commits the files Bravos writes (annotations, intent, definitions, tests): bravos prefs set commits commit|leave|ask --by "<your name>". bravos
|
|
215
|
+
Say once whether your agent commits the files Bravos writes (annotations, intent, definitions, tests): bravos prefs set commits commit|leave|ask --by "<your name>". bravos setup asks it too. The answer is kept in this clone's git directory, never committed, and your own code is never part of such a commit. bravos prefs get shows it.
|
|
216
216
|
|
|
217
217
|
### See the findings on one page
|
|
218
218
|
|
|
@@ -246,7 +246,7 @@ Bounded questions to codegraph-mcp: routes, attack surface, sinks a symbol reach
|
|
|
246
246
|
|
|
247
247
|
### bravos-ship
|
|
248
248
|
|
|
249
|
-
The pre-PR gate. Optional PreToolUse hook (bravos
|
|
249
|
+
The pre-PR gate. Optional PreToolUse hook (bravos setup --pre-pr-hook) runs it on every gh pr create / gh pr ready.
|
|
250
250
|
|
|
251
251
|
### bravos-templatize
|
|
252
252
|
|
|
@@ -364,10 +364,10 @@ Reads hooks from .claude/settings.json (preview), so the briefing can load there
|
|
|
364
364
|
|
|
365
365
|
### Every repo, or one copy of each skill
|
|
366
366
|
|
|
367
|
-
bravos
|
|
367
|
+
bravos setup --global installs for your user: skills in ~/.claude/skills (linked from ~/.agents/skills) and a user hook that briefs repos with a threat model but no bravos install. bravos setup --link-skills makes a repo's .agents/skills a link to .claude/skills, so tools that read both (Warp) list each skill once.
|
|
368
368
|
|
|
369
369
|
### Banner switches
|
|
370
370
|
|
|
371
371
|
BRAVOS_BANNER=off hides it; BRAVOS_BANNER_COLOR=off or NO_COLOR prints it plain. The briefing for the model is unchanged either way.
|
|
372
372
|
|
|
373
|
-
Light terminal? BRAVOS_THEME=light (or dark, or neutral) picks the colours for the banner and bravos watch; otherwise COLORFGBG, the choice saved by bravos
|
|
373
|
+
Light terminal? BRAVOS_THEME=light (or dark, or neutral) picks the colours for the banner and bravos watch; otherwise COLORFGBG, the choice saved by bravos setup, then neutral. bravos doctor shows which, and the c key in bravos watch switches.
|
package/docs/UPGRADING.md
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
# Upgrading Bravos
|
|
2
2
|
|
|
3
|
-
After `npm install -g @bugb-technologies/bravos`, run **`bravos setup
|
|
3
|
+
After `npm install -g @bugb-technologies/bravos`, run **`bravos setup`** in a repository you work in: it brings this machine and that repository up to date. In repositories you work in with an agent you can skip even that: the agent runs it at the start of a session. The notes below say what else changes, newest first. (Before 1.9 the same was `bravos setup --tools -y` per machine and `bravos sync` per repository; both still work.)
|
|
4
|
+
|
|
5
|
+
## 1.9.0
|
|
6
|
+
|
|
7
|
+
1.9 makes **`bravos setup`** the one command for setting Bravos up. It looks at this machine and the repository you are in and does only what is missing.
|
|
8
|
+
|
|
9
|
+
- **In a terminal, `bravos setup` is the guided setup.**
|
|
10
|
+
- The first time on a machine it signs you in and installs the tools, then asks about the repository.
|
|
11
|
+
- In another repository it skips what the machine has ("This machine is ready") and asks only that repository's questions.
|
|
12
|
+
- In a repository that already has Bravos it brings the machine and the repository up to date. `bravos setup --change` asks the repository's questions again.
|
|
13
|
+
- **`bravos start`, `bravos init` and `bravos sync` still work**, with the same flags, but help and every hint name `bravos setup`: `bravos sync --ci` is `bravos setup --ci`, `bravos init --agent claude` is `bravos setup --agent claude`, `bravos start --again` is `bravos setup --change`.
|
|
14
|
+
- **Two things behave differently under the name `setup`:**
|
|
15
|
+
- A plain `bravos setup` in a terminal opens the guided setup. It used to fetch the bundles; that is `bravos setup --analyzer --codegraph`.
|
|
16
|
+
- `bravos setup -y` on its own is an unattended first setup of the repository you are in. Fetching a staged bundle again is `bravos setup --codegraph -y` (or `--analyzer -y`).
|
|
17
|
+
- **With no terminal, a plain `bravos setup` is safe upkeep.** This is what an agent or a script gets: the repository's Bravos files and Bravos's own bundles brought up to date, and nothing else. It never installs Bravos into a repository, never installs guardlink or cxg, never adds agents or MCP entries, and leaves your own `~/.claude` alone. A bundle that is missing is named, not fetched.
|
|
18
|
+
- **`bravos setup --yes` is the unattended first setup.** It sets up the folder it is given or run in, refuses a folder that is not a git repository, and never picks one for you. It fetches Bravos's bundles and leaves guardlink and cxg to `bravos setup --tools -y`.
|
|
19
|
+
- **Any first install makes the agent begin.** Installing by flags or from a script now leaves the same hand-off the guided setup does, so the next agent session starts the context step by itself.
|
|
20
|
+
- **Fixed:** "Install guardlink, cxg when you apply?" defaulted to No; it defaults to Yes. A bundle older than this version uses is now offered for install in the guided setup.
|
|
21
|
+
- `bravos next` prints "Setup N/9 for <repo>".
|
|
22
|
+
|
|
23
|
+
## 1.8.1
|
|
24
|
+
|
|
25
|
+
- **Hooks work from any folder.** Until now the hook commands were relative to the current folder, so once your agent changed folder (`cd ios/Runner`) every hook failed with "Cannot find module": autopilot stopped, and the pre-PR check let `gh pr create` through. Claude Code's commands now start from the project root (`${CLAUDE_PROJECT_DIR}`), Codex's from the git top level. **Run `bravos sync` in each repository**: it rewrites the commands in `.claude/settings.json` and `.codex/hooks.json`, one line per hook.
|
|
26
|
+
- **Old skills from the Python bravos are named.** If you used the earlier Python CLI, its skills may still sit in `~/.claude/skills` and `~/.agents/skills`, and an agent can load one and follow commands this bravos does not have. The session briefing now tells the agent not to follow them, and `bravos doctor` lists them with one command that moves them aside (nothing is deleted).
|
|
4
27
|
|
|
5
28
|
## 1.8.0
|
|
6
29
|
|
package/hooks/lib/briefing.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { spawn, spawnSync } from 'node:child_process';
|
|
|
3
3
|
import { accessSync, constants, readFileSync } from 'node:fs';
|
|
4
4
|
import { basename, delimiter, dirname, join } from 'node:path';
|
|
5
5
|
import { contextGate, readContext } from './context.mjs';
|
|
6
|
+
import { legacySkills, legacySkillsLine } from './legacy-skills.mjs';
|
|
6
7
|
import { THEMES } from './palette.mjs';
|
|
7
8
|
import { commitsLine, commonDirFrom, readHandoff, readPrefs } from './prefs.mjs';
|
|
8
9
|
import { readProving } from './proving.mjs';
|
|
@@ -135,7 +136,7 @@ export function contextLine(context, harness) {
|
|
|
135
136
|
// @comment -- "The briefing's Intent line. While the context gate is closed it also says so in words an agent acts on: do not start threat-modelling, run the context skill first, and how a person declines. A recorded decline is shown with the name and date of the person who made it."
|
|
136
137
|
function intentLine(intent, harness, gate, handoff = false) {
|
|
137
138
|
const run = harness === 'claude' ? '/bravos-context' : 'the bravos-context skill';
|
|
138
|
-
// Right after bravos
|
|
139
|
+
// Right after bravos setup (a fresh hand-off marker), the person expects Bravos to begin: the agent starts the context step itself and goes on to annotation, unless their first message asks for something else.
|
|
139
140
|
const begin = handoff && intent.status === 'none' ? ` Setup just finished here and the person expects Bravos to begin: start ${run} in your first reply without being asked, and go on to annotation once they have confirmed. If their first message asks for something else, do that and offer this once after.` : '';
|
|
140
141
|
const closed = gate && gate.open === false ? `. Context comes first: do not annotate or start a campaign until a named person has confirmed it (or run bravos context decline --by "<name>" themselves).${begin}` : '';
|
|
141
142
|
const declined = gate?.state === 'declined' ? `declined by ${gate.by} on ${gate.at}` : '';
|
|
@@ -251,13 +252,16 @@ export function buildBriefing(inputs) {
|
|
|
251
252
|
}
|
|
252
253
|
if (i.shadow) {
|
|
253
254
|
tail.push(i.shadow.userNewer
|
|
254
|
-
? `Note: this repo's bravos (${i.shadow.repo}) is behind the person's user-level copy (${i.shadow.user}), which Claude Code uses; suggest they run bravos
|
|
255
|
-
: `Note: the person's user-level bravos skills (~/.claude/skills, ${i.shadow.user}) are used instead of this repo's (${i.shadow.repo}); tell them to run bravos
|
|
255
|
+
? `Note: this repo's bravos (${i.shadow.repo}) is behind the person's user-level copy (${i.shadow.user}), which Claude Code uses; suggest they run bravos setup in this repo from their own terminal`
|
|
256
|
+
: `Note: the person's user-level bravos skills (~/.claude/skills, ${i.shadow.user}) are used instead of this repo's (${i.shadow.repo}); tell them to run bravos setup --global from their own terminal, then start a new session`);
|
|
256
257
|
}
|
|
257
258
|
const upkeep = upkeepLine(i.upkeep);
|
|
258
259
|
if (upkeep) tail.push(upkeep);
|
|
259
260
|
// The portal's last refusal to renew this machine, until it is signed in again (a revocation) or renewed (a plan that ended).
|
|
260
261
|
if (i.licenceNote && (i.licenceNote.outcome === 'lapsed' || i.licence?.licensed === false)) tail.push(`Licence: ${i.licenceNote.note} Tell the person once, in plain words.`);
|
|
262
|
+
// Skills the retired Python bravos left at user level: the agent must not follow them (hooks/lib/legacy-skills.mjs).
|
|
263
|
+
const legacy = legacySkillsLine(i.legacy);
|
|
264
|
+
if (legacy) tail.push(legacy);
|
|
261
265
|
if ((i.autopilot || i.prePr) && hooksLocked(i)) {
|
|
262
266
|
// The repo registers the hooks for everyone; this person's copy answers nothing until they have a licence.
|
|
263
267
|
const which = i.autopilot ? 'Autopilot (the end-of-turn check and the pre-PR gate)' : 'The pre-PR gate';
|
|
@@ -433,6 +437,19 @@ export function upkeepLine(u) {
|
|
|
433
437
|
else parts.push(`this repository's Bravos files are behind the installed bravos (${repo && repo !== cli ? `${repo} → ${cli}, ` : ''}${count}): run \`bravos sync\` now without asking and include what it changes in your next commit of Bravos's files`);
|
|
434
438
|
}
|
|
435
439
|
const bundles = (Array.isArray(u.bundles) ? u.bundles : []).filter((b) => ['analyzer', 'codegraph'].includes(b?.id) && ver(b.staged) && ver(b.pinned));
|
|
440
|
+
// From 1.9 one command does all of this upkeep (the answer says so with `unified`); an older bravos on PATH keeps the two commands it understands, below.
|
|
441
|
+
if (u.unified === true && cli) {
|
|
442
|
+
const repo = ver(u.repo);
|
|
443
|
+
const newer = files > 0 && u.sync.direction === 'repo-newer';
|
|
444
|
+
const behind = [
|
|
445
|
+
...(files && !newer ? [`this repository's Bravos files (${repo && repo !== cli ? `${repo} → ${cli}, ` : ''}${files} file${files === 1 ? '' : 's'})`] : []),
|
|
446
|
+
...bundles.map((b) => `the ${b.id} bundle on this machine (${b.staged} → ${b.pinned})`),
|
|
447
|
+
];
|
|
448
|
+
const out = [];
|
|
449
|
+
if (behind.length) out.push(`${behind.join(' and ')} ${behind.length === 1 && bundles.length === 1 ? 'is' : 'are'} behind the installed bravos: run \`bravos setup\` now without asking. With no terminal it only brings what is already installed up to date (Bravos's own files and signed bundles), asks nothing and installs nothing new; include what it changes in your next commit of Bravos's files`);
|
|
450
|
+
if (newer) out.push(`this repository's Bravos files${repo ? ` (${repo})` : ''} are newer than the installed bravos (${cli}): bravos setup will leave them alone; tell the person once to update with npm install -g @bugb-technologies/bravos@latest`);
|
|
451
|
+
return out.length ? `Upkeep: ${out.join('; ')}.` : null;
|
|
452
|
+
}
|
|
436
453
|
if (bundles.length) parts.push(`the ${bundles.map((b) => `${b.id} bundle (${b.staged} → ${b.pinned})`).join(' and ')} on this machine ${bundles.length === 1 ? 'is' : 'are'} older than this bravos pins: run \`bravos setup\` now without asking (it fetches Bravos's own signed bundles and nothing else)`);
|
|
437
454
|
return parts.length ? `Upkeep: ${parts.join('; ')}.` : null;
|
|
438
455
|
}
|
|
@@ -551,6 +568,7 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
|
|
|
551
568
|
harness: env.CLAUDE_PROJECT_DIR ? 'claude' : 'other',
|
|
552
569
|
prePr: prePrRegistered(root),
|
|
553
570
|
shadow: userSkillsShadow(root, env),
|
|
571
|
+
legacy: legacySkills(env),
|
|
554
572
|
autopilot: autopilotRegistered(root),
|
|
555
573
|
proving: readProving(root),
|
|
556
574
|
workspace,
|
|
@@ -655,7 +673,7 @@ export function autopilotRegistered(root) {
|
|
|
655
673
|
return false;
|
|
656
674
|
}
|
|
657
675
|
|
|
658
|
-
// @comment -- "Detects a user-level bravos install (bravos
|
|
676
|
+
// @comment -- "Detects a user-level bravos install (bravos setup --global) whose version differs from this repo's: Claude Code prefers personal skills over project skills of the same name, so an older ~/.claude/skills copy silently replaces the repo's. Returns { user, repo } versions, or null when there is no conflict."
|
|
659
677
|
export function userSkillsShadow(root, env) {
|
|
660
678
|
const home = env?.HOME;
|
|
661
679
|
if (!home) return null;
|
|
@@ -756,7 +774,7 @@ const TIPS = [
|
|
|
756
774
|
'run bravos doctor to see which of guardlink, cxg, codegraph-mcp, bravos-cli you have.',
|
|
757
775
|
'"unknown" in the briefing means a tool failed, never that the count is zero.',
|
|
758
776
|
'bravos-campaign clears big backlogs in rounds of subagents, with rests between.',
|
|
759
|
-
'bravos
|
|
777
|
+
'bravos setup --pre-pr-hook runs the ship gate on every gh pr create.',
|
|
760
778
|
'intended-by-design behaviour goes in .guardlink/intent.md, not in @accepts.',
|
|
761
779
|
'stale means the code under a claim changed; bravos-recheck clears it.',
|
|
762
780
|
'anything beyond loopback needs a reviewed scope.yaml and your typed authorization.',
|
|
@@ -821,9 +839,12 @@ function bannerWarnings(i, plan) {
|
|
|
821
839
|
else if (arr(i.stranded).length > 0) lines.push(`~ Work on ${clean(i.stranded[0].branch)} is not on ${clean(i.base)} · bravos-resync`);
|
|
822
840
|
if (i.shadow) {
|
|
823
841
|
lines.push(i.shadow.userNewer
|
|
824
|
-
? `~ repo bravos ${i.shadow.repo} is behind your ${i.shadow.user} · run: bravos
|
|
825
|
-
: `! your user-level bravos ${i.shadow.user} overrides repo ${i.shadow.repo} · run: bravos
|
|
842
|
+
? `~ repo bravos ${i.shadow.repo} is behind your ${i.shadow.user} · run: bravos setup`
|
|
843
|
+
: `! your user-level bravos ${i.shadow.user} overrides repo ${i.shadow.repo} · run: bravos setup --global`);
|
|
826
844
|
}
|
|
845
|
+
// One line for old Python skills at user level; bravos doctor prints the command that moves them aside.
|
|
846
|
+
const old = arr(i.legacy).reduce((n, f) => n + arr(f?.names).length, 0);
|
|
847
|
+
if (old > 0) lines.push(`! ${old} old Python bravos skill${old === 1 ? '' : 's'} in your user folder · bravos doctor`);
|
|
827
848
|
return lines;
|
|
828
849
|
}
|
|
829
850
|
|