@bugb-technologies/bravos 1.5.0 → 1.5.1
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/dist/cli.js +4 -2
- package/dist/dashboard.js +46 -5
- package/dist/guide.js +1 -1
- package/dist/help.js +5 -2
- package/docs/GUIDE.md +1 -1
- package/docs/UPGRADING.md +7 -0
- package/hooks/lib/briefing.mjs +33 -2
- package/package.json +1 -1
- package/skills/bravos/SKILL.md +1 -1
- package/skills/bravos-annotate/SKILL.md +1 -0
- package/skills/bravos-codegraph/SKILL.md +1 -1
- package/skills/bravos-recheck/SKILL.md +1 -0
- package/skills/bravos-report/SKILL.md +1 -0
- package/skills/bravos-ship/SKILL.md +1 -0
- package/templates/dashboard/dashboard.html +22 -1
package/dist/cli.js
CHANGED
|
@@ -786,16 +786,18 @@ export function buildProgram(io, result) {
|
|
|
786
786
|
}));
|
|
787
787
|
program
|
|
788
788
|
.command('dashboard [dir]')
|
|
789
|
-
.description("One page for the repository's security picture, opened in the browser: GuardLink's threat model with who introduced and fixed each exposure and what changed since the default branch, and on the Team plan the code graph (map, owners, coupling, attack surface, entry points). Written to .bravos/dashboard/index.html (git-ignored); one self-contained file, no server, no network, no model.")
|
|
789
|
+
.description("One page for the repository's security picture, opened in the browser: GuardLink's threat model with who introduced and fixed each exposure and what changed since the default branch, and on the Team plan the code graph (map, owners, coupling, attack surface, entry points). Rebuilt from the code every time: on the Team plan a code graph that is missing or behind is rebuilt first. Written to .bravos/dashboard/index.html (git-ignored); one self-contained file, no server, no network, no model.")
|
|
790
790
|
.option('--out <file>', 'write the page here instead; nothing is then written inside the repository')
|
|
791
791
|
.option('--since <ref>', "compare against this branch, tag or commit instead of the repository's default branch")
|
|
792
792
|
.option('--no-blame', 'leave git names out (who introduced and fixed each exposure, and the code graph\'s owners), for a page you will share')
|
|
793
793
|
.option('--no-open', 'write the page and print its path without opening a browser')
|
|
794
|
+
.option('--no-graph-build', 'draw from the code graph as it is; do not rebuild it first when it is missing or behind the code')
|
|
794
795
|
.option('--json', 'print the result as JSON (bravos.dashboard-run/v1)')
|
|
795
796
|
.action((dir, opts) => guardedAsync(async (lines) => {
|
|
796
797
|
const root = dirArg(dir);
|
|
797
798
|
const { buildDashboard } = await import('./dashboard.js');
|
|
798
|
-
|
|
799
|
+
// What takes minutes is said as it starts, on stderr, so --json output stays one document.
|
|
800
|
+
const r = await buildDashboard(root, io.env, { out: opts.out, since: opts.since, blame: opts.blame, graphBuild: opts.graphBuild, onProgress: (line) => io.stderr(line) });
|
|
799
801
|
// Opening is a convenience: the path is always printed, and a session with no display just reads it.
|
|
800
802
|
const opened = opts.open !== false && !opts.json && openInBrowser(r.path, io.env);
|
|
801
803
|
if (opts.json) {
|
package/dist/dashboard.js
CHANGED
|
@@ -8,6 +8,8 @@ import { templatesDir, version } from './paths.js';
|
|
|
8
8
|
import { BravosError } from './types.js';
|
|
9
9
|
export const DASHBOARD_DIR = '.bravos/dashboard';
|
|
10
10
|
export const DASHBOARD_PATH = `${DASHBOARD_DIR}/index.html`;
|
|
11
|
+
/** What the saved page was built from, for the session briefing to tell a current page from an old one. */
|
|
12
|
+
export const DASHBOARD_META = `${DASHBOARD_DIR}/meta.json`;
|
|
11
13
|
const git = (root, env, args) => {
|
|
12
14
|
const r = spawnSync('git', args, { cwd: root, env, encoding: 'utf8', timeout: 10000, stdio: ['ignore', 'pipe', 'ignore'] });
|
|
13
15
|
return r.error || r.status !== 0 ? null : r.stdout.trim();
|
|
@@ -135,7 +137,41 @@ export function codeGraphStore(answers) {
|
|
|
135
137
|
links: { type: 'links', entryPoints: entries, asked: asked('entries') },
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
const NOT_BUILT = /no graph|No CodeGraph|codegraph_unavailable|not built|nothing is there|not available for project/i;
|
|
141
|
+
// @comment -- "What the code graph says about itself for this checkout, from one cheap question: current, not-built (no graph for this commit), diverged (the working tree has moved since it was built), or unknown when it cannot say. Read-only."
|
|
142
|
+
export async function graphState(root, env) {
|
|
143
|
+
try {
|
|
144
|
+
const a = (await graph.askMany(root, env, [{ tool: 'codegraph_entry_points', args: { limit: 1 } }], 60000)).answers.codegraph_entry_points;
|
|
145
|
+
if (!a)
|
|
146
|
+
return 'unknown';
|
|
147
|
+
if ('error' in a)
|
|
148
|
+
return NOT_BUILT.test(a.error) ? 'not-built' : 'unknown';
|
|
149
|
+
const state = text(obj(obj(a.result).graph_currency).state);
|
|
150
|
+
return state === 'current' ? 'current' : state ? 'diverged' : 'unknown';
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return 'unknown';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// @comment -- "Makes the code graph match the code before the dashboard draws from it, so a fresh page is never drawn from an old graph: no graph for this commit is built, and one the working tree has moved away from is rebuilt for the tree as it stands (--mode build; the default mode would reuse the commit's graph). Always --scip no-exec, which runs none of the repository's code, and no model. Returns a sentence for the page, empty when nothing was needed; a failed build is said, never thrown."
|
|
157
|
+
export async function refreshGraph(root, env, onProgress) {
|
|
158
|
+
const state = await graphState(root, env);
|
|
159
|
+
if (state !== 'not-built' && state !== 'diverged')
|
|
160
|
+
return '';
|
|
161
|
+
onProgress?.(state === 'not-built' ? 'Building the code graph for this commit first (no repository code runs; minutes on a large repository)…' : 'The code has moved since the code graph was built: rebuilding it first…');
|
|
162
|
+
const started = Date.now();
|
|
163
|
+
try {
|
|
164
|
+
const r = graph.build(root, env, { scip: 'no-exec', ...(state === 'diverged' ? { mode: 'build' } : {}) });
|
|
165
|
+
if (r.status === 0)
|
|
166
|
+
return ` The graph was rebuilt for this page (${Math.max(1, Math.round((Date.now() - started) / 1000))} s).`;
|
|
167
|
+
const why = `${r.stderr}\n${r.stdout}`.split('\n').map((l) => l.trim()).filter(Boolean).pop() ?? `exit ${r.status}`;
|
|
168
|
+
return ` The graph could not be rebuilt (${why.slice(0, 160)}).`;
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
return ` The graph could not be rebuilt (${e.message.slice(0, 160)}).`;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// @comment -- "The Code graph part of the dashboard. The code graph is on the Team plan, so the licence is checked before anything is asked (a refusal is a note on the page, not an error, and the graph binary is never started without a licence). Then one session asks the eight questions the pages are drawn from; they read git history and the whole map, so each may take minutes on a large repository. Unless told not to, a graph that is missing for this commit or behind the code is rebuilt first (refreshGraph), so the page is drawn from the code as it stands. A graph that is not installed, still not built, or that answers nothing is a short note naming the command that fixes it."
|
|
139
175
|
export async function buildCodeGraph(root, env, opts = {}) {
|
|
140
176
|
const note = (state, sentence) => ({ state, note: sentence, store: null });
|
|
141
177
|
let entitled = false;
|
|
@@ -149,6 +185,8 @@ export async function buildCodeGraph(root, env, opts = {}) {
|
|
|
149
185
|
return note('locked', 'The code graph is on the Team plan: bravos account activate starts a 30-day trial, no card. The threat model tab is complete without it.');
|
|
150
186
|
if (!graph.graphBin('codegraph-mcp', env))
|
|
151
187
|
return note('missing', 'The code graph is not installed on this machine: run bravos setup --codegraph, then bravos graph build . and bravos dashboard again.');
|
|
188
|
+
// The licence and the binary are settled, so a missing or behind graph is rebuilt before it is asked.
|
|
189
|
+
const rebuilt = opts.refresh === false ? '' : await refreshGraph(root, env, opts.onProgress);
|
|
152
190
|
let answered;
|
|
153
191
|
try {
|
|
154
192
|
answered = await graph.askMany(root, env, Object.values(QUESTIONS).map((q) => ({ tool: q.tool, args: { ...q.args } })), 300000);
|
|
@@ -157,8 +195,8 @@ export async function buildCodeGraph(root, env, opts = {}) {
|
|
|
157
195
|
return note('failed', `The code graph could not be asked (${e.message.slice(0, 200)}).`);
|
|
158
196
|
}
|
|
159
197
|
const errors = Object.values(answered.answers).map((a) => ('error' in a ? a.error : ''));
|
|
160
|
-
if (errors.some((m) =>
|
|
161
|
-
return note('not-built',
|
|
198
|
+
if (errors.some((m) => NOT_BUILT.test(m))) {
|
|
199
|
+
return note('not-built', `No code graph is built for this repository at this commit: run bravos graph build . (a few minutes, no tokens), then bravos dashboard again.${rebuilt}`);
|
|
162
200
|
}
|
|
163
201
|
if (errors.every(Boolean))
|
|
164
202
|
return note('failed', `The code graph answered none of the questions (${errors[0].slice(0, 200)}).`);
|
|
@@ -166,7 +204,7 @@ export async function buildCodeGraph(root, env, opts = {}) {
|
|
|
166
204
|
const store = codeGraphStore(scrubAnswers(answered.answers, { root: resolve(root), repo: repoName(root, env), names: opts.names !== false }));
|
|
167
205
|
const states = Object.values(answered.answers).map((a) => ('result' in a ? text(obj(obj(a.result).graph_currency).state) : '')).filter(Boolean);
|
|
168
206
|
const stale = states.find((x) => x !== 'current');
|
|
169
|
-
return { state: 'present', store, note: `The code graph's answers when this page was built: the map, owners and history, coupling, trust, attack surface, entry points and links.${stale ? ` The graph is ${stale}: the code has moved since it was built, so rebuild it with bravos graph build .` : ''}` };
|
|
207
|
+
return { state: 'present', store, note: `The code graph's answers when this page was built: the map, owners and history, coupling, trust, attack surface, entry points and links.${rebuilt}${stale ? ` The graph is ${stale}: the code has moved since it was built, so rebuild it with bravos graph build .` : ''}` };
|
|
170
208
|
}
|
|
171
209
|
/** A value as JSON that is safe inside a <script type="application/json"> tag: no '<' can close the tag, no raw line separators. */
|
|
172
210
|
const inert = (value) => JSON.stringify(value).replace(/</g, '\\u003c').replace(/[\u2028\u2029]/g, (c) => `\\u${c.charCodeAt(0).toString(16)}`);
|
|
@@ -203,7 +241,7 @@ export async function buildDashboard(root, env, opts = {}) {
|
|
|
203
241
|
}
|
|
204
242
|
const base = opts.since ?? baseRef(root, env);
|
|
205
243
|
const tm = buildThreatModel(root, env, { base, blame: opts.blame !== false });
|
|
206
|
-
const cg = await buildCodeGraph(root, env, { names: opts.blame !== false });
|
|
244
|
+
const cg = await buildCodeGraph(root, env, { names: opts.blame !== false, refresh: opts.graphBuild !== false, onProgress: opts.onProgress });
|
|
207
245
|
let plan = null;
|
|
208
246
|
try {
|
|
209
247
|
const L = (await licenceLib());
|
|
@@ -236,6 +274,9 @@ export async function buildDashboard(root, env, opts = {}) {
|
|
|
236
274
|
if (!existsSync(ignore))
|
|
237
275
|
writeFileSync(ignore, '*\n');
|
|
238
276
|
path = join(root, DASHBOARD_PATH);
|
|
277
|
+
// Beside the page: what it was built from, so the session briefing can say when it has fallen behind.
|
|
278
|
+
const meta = { schema: 'bravos.dashboard-meta/v1', generatedAt: data.generatedAt, commit: git(root, env, ['rev-parse', 'HEAD']), branch: data.branch, threatModel: tm.state, codeGraph: cg.state };
|
|
279
|
+
writeFileSync(join(root, DASHBOARD_META), `${JSON.stringify(meta, null, 2)}\n`);
|
|
239
280
|
}
|
|
240
281
|
writeFileSync(path, page);
|
|
241
282
|
return { path, threatModel: { state: tm.state, note: tm.note }, codeGraph: { state: cg.state, note: cg.note } };
|
package/dist/guide.js
CHANGED
|
@@ -127,7 +127,7 @@ export const GUIDE_TOPICS = [
|
|
|
127
127
|
{ name: 'Keep it fresh while I work, or nightly', skills: ['bravos-schedule'], body: ['An in-session /loop from .claude/loop.md, the nightly workflow, or a cloud task you create. Loops never send test traffic.'] },
|
|
128
128
|
{ name: 'Add or fix security CI', skills: ['bravos-cicd'], body: ['PR gate, nightly annotation, SARIF to code scanning, script-injection fixes.'] },
|
|
129
129
|
{ name: 'An app made of several repositories (microservices)', skills: ['bravos-annotate', 'bravos-codegraph', 'bravos-prove'], body: ['Clone the services side by side in one folder, then run bravos workspace create NAME --member ./gateway=gateway@http://127.0.0.1:8080 --member ./orders=orders@http://127.0.0.1:8081 (bravos workspace plus guardlink link-project plus bravos in each repo and in the shared folder). Work on a service from its own repo; ask questions that cross services from the shared folder, where the briefing and bravos watch show every service. Declare each call to another service as @flows #<this>-<x> -> #<other>-<y> via http (plain ids, not #repo.tag). Build the code graph over the shared folder so it links one service\'s client calls to another\'s handlers. bravos report data --workspace writes one report across the services.'] },
|
|
130
|
-
{ name: 'See the findings on one page', skills: ['bravos'], body: ['Run bravos dashboard (free, no model): it writes one self-contained page under .bravos/dashboard/ (git-ignored) and opens it in your browser. It is GuardLink\'s threat model with who introduced and fixed each exposure and what changed since the default branch; on the Team plan, with the code graph built, a second tab shows the code graph: a map of where the risk sits, owners and history, coupling, trust, the attack surface, entry points and links. --no-blame leaves git names out of a page you will share; --no-open only prints the path. Or ask your agent "show me the findings".'] },
|
|
130
|
+
{ name: 'See the findings on one page', skills: ['bravos'], body: ['Run bravos dashboard (free, no model): it writes one self-contained page under .bravos/dashboard/ (git-ignored) and opens it in your browser. It is GuardLink\'s threat model with who introduced and fixed each exposure and what changed since the default branch; on the Team plan, with the code graph built, a second tab shows the code graph: a map of where the risk sits, owners and history, coupling, trust, the attack surface, entry points and links. Run it again whenever you want the picture: it rebuilds from the code as it stands, rebuilding a code graph that is missing or behind first, and a saved page says when it is more than half a day old. --no-blame leaves git names out of a page you will share; --no-open only prints the path. Or ask your agent "show me the findings".'] },
|
|
131
131
|
{ name: 'Write up the assessment, a finding or a retest', skills: ['bravos-report'], body: ['Ask "write the assessment report" (or a finding, a retest, an executive brief). bravos report data gathers the evidence; the agent writes report.md in the eight-section reading order, with every proof claim citing its evidence; bravos report check refuses a finding labelled reproduced without a run or ledger record; bravos report export writes md, txt, html and pdf. bravos watch shows the newest report (p to read it, o to open the pdf or html).'] },
|
|
132
132
|
],
|
|
133
133
|
},
|
package/dist/help.js
CHANGED
|
@@ -31,8 +31,11 @@ Commands
|
|
|
31
31
|
changed since the default branch, and on the Team plan the code graph: a map of
|
|
32
32
|
where the risk sits, owners and history, coupling, trust, attack surface, entry
|
|
33
33
|
points and links. One self-contained file under
|
|
34
|
-
.bravos/dashboard/ (git-ignored); no server, no network, no model.
|
|
35
|
-
|
|
34
|
+
.bravos/dashboard/ (git-ignored); no server, no network, no model. Rebuilt from
|
|
35
|
+
the code every time: a code graph that is missing or behind is rebuilt first
|
|
36
|
+
(--no-graph-build skips that), and the page says when it has grown old.
|
|
37
|
+
--no-open prints the path only, --no-blame leaves git names out, --out writes
|
|
38
|
+
elsewhere.
|
|
36
39
|
watch [dir] A live view for a second terminal pane beside any agent: setup, open and
|
|
37
40
|
confirmed exposures, the hypothesis ledger, what to test next, stale claims, the
|
|
38
41
|
code graph's resolution and entry points, SAST, the branch, PRs and autopilot
|
package/docs/GUIDE.md
CHANGED
|
@@ -188,7 +188,7 @@ Clone the services side by side in one folder, then run bravos workspace create
|
|
|
188
188
|
|
|
189
189
|
Skills: `/bravos`
|
|
190
190
|
|
|
191
|
-
Run bravos dashboard (free, no model): it writes one self-contained page under .bravos/dashboard/ (git-ignored) and opens it in your browser. It is GuardLink's threat model with who introduced and fixed each exposure and what changed since the default branch; on the Team plan, with the code graph built, a second tab shows the code graph: a map of where the risk sits, owners and history, coupling, trust, the attack surface, entry points and links. --no-blame leaves git names out of a page you will share; --no-open only prints the path. Or ask your agent "show me the findings".
|
|
191
|
+
Run bravos dashboard (free, no model): it writes one self-contained page under .bravos/dashboard/ (git-ignored) and opens it in your browser. It is GuardLink's threat model with who introduced and fixed each exposure and what changed since the default branch; on the Team plan, with the code graph built, a second tab shows the code graph: a map of where the risk sits, owners and history, coupling, trust, the attack surface, entry points and links. Run it again whenever you want the picture: it rebuilds from the code as it stands, rebuilding a code graph that is missing or behind first, and a saved page says when it is more than half a day old. --no-blame leaves git names out of a page you will share; --no-open only prints the path. Or ask your agent "show me the findings".
|
|
192
192
|
|
|
193
193
|
### Write up the assessment, a finding or a retest
|
|
194
194
|
|
package/docs/UPGRADING.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
After `npm install -g @bugb-technologies/bravos`, run **`bravos setup --tools -y`** once on each machine and **`bravos sync`** in each repository. The notes below say what else changes, newest first.
|
|
4
4
|
|
|
5
|
+
## 1.5.1
|
|
6
|
+
|
|
7
|
+
- **`bravos dashboard` makes the code graph current first** (Team plan). With no graph for this commit it builds one; when the code has moved since the graph was built, it rebuilds it. It says so as it starts and runs none of the repository's code. A first build on a large repository takes minutes; `--no-graph-build` draws from the graph as it is.
|
|
8
|
+
- **A saved dashboard says how old it is.** The bar shows when it was built, and a page opened more than half a day later says it may be behind the code and names the command.
|
|
9
|
+
- **Your agent keeps you off old pages.** The briefing has a `Dashboard:` line saying whether the saved page is current or how many commits behind it is, and the skills run `bravos dashboard` afresh instead of opening a saved copy. After annotating or rechecking, the agent says an earlier dashboard is now behind and offers to rebuild it.
|
|
10
|
+
- Run `bravos sync` in each repository to get the updated skills and briefing.
|
|
11
|
+
|
|
5
12
|
## 1.5.0
|
|
6
13
|
|
|
7
14
|
1.5 adds a dashboard and tells you which plan you are on. It includes everything listed under 1.4.3, which was not published on its own.
|
package/hooks/lib/briefing.mjs
CHANGED
|
@@ -77,6 +77,30 @@ export function readAnnotationMode(root) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
// @comment -- "Reads .bravos/dashboard/meta.json, which bravos dashboard writes beside the page it saves: when the page was built and from which commit. null when no page was saved here or the record is unreadable; the commit is returned only when it is a plain hex id, since it is handed to git. Read-only."
|
|
81
|
+
export function readDashboard(root) {
|
|
82
|
+
try {
|
|
83
|
+
const m = JSON.parse(readFileSync(join(root, '.bravos', 'dashboard', 'meta.json'), 'utf8'));
|
|
84
|
+
const at = Date.parse(m?.generatedAt);
|
|
85
|
+
if (!Number.isFinite(at)) return null;
|
|
86
|
+
return { generatedAt: at, commit: typeof m.commit === 'string' && /^[0-9a-f]{7,40}$/.test(m.commit) ? m.commit : null };
|
|
87
|
+
} catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// @comment -- "One briefing line about the saved dashboard, so the agent never sends the person to an old page: out of date when commits have landed since it was built or it is more than half a day old, with the one command that rebuilds it (and, on the Team plan, the code graph it draws from). Pure."
|
|
93
|
+
export function dashboardLine(d, now = Date.now()) {
|
|
94
|
+
if (!d || !Number.isFinite(d.generatedAt)) return null;
|
|
95
|
+
const minutes = Math.max(0, Math.round((now - d.generatedAt) / 60000));
|
|
96
|
+
const age = minutes < 2 ? 'just now' : minutes < 90 ? `${minutes} minutes ago` : minutes < 36 * 60 ? `${Math.round(minutes / 60)} hours ago` : `${Math.round(minutes / 1440)} days ago`;
|
|
97
|
+
const behind = num(d.behind);
|
|
98
|
+
if (behind > 0 || minutes > 12 * 60) {
|
|
99
|
+
return `Dashboard: the saved page is out of date (built ${age}${behind > 0 ? `, ${behind} commit${behind === 1 ? '' : 's'} behind` : ''}) — never send the person to it as it is; \`bravos dashboard\` rebuilds it from the code as it stands`;
|
|
100
|
+
}
|
|
101
|
+
return `Dashboard: built ${age} at this commit (.bravos/dashboard/index.html); after changes to code or annotations, \`bravos dashboard\` rebuilds it`;
|
|
102
|
+
}
|
|
103
|
+
|
|
80
104
|
// @comment -- "Reads .guardlink/intent.md (written by bravos-context) and reports whether the product's intent is recorded: none, draft (any item marked '— draft') or confirmed, with the invariant count; read-only."
|
|
81
105
|
export function readIntent(root) {
|
|
82
106
|
let text;
|
|
@@ -118,7 +142,7 @@ function coachLines(i) {
|
|
|
118
142
|
`- After you edit security-relevant code, offer to record what it exposes (${k('bravos-annotate')}); before a PR, run the ship check (${k('bravos-ship')}); after a fix, offer a recheck (${k('bravos-recheck')}).`,
|
|
119
143
|
'- Commits are the person\'s call: before the first commit of a session ask once (commit now, or leave the files for them to review), even where a skill says to commit; skip the question only when they already asked for commits (a campaign, a schedule).',
|
|
120
144
|
'- When a request would go better with the next unlock above, say what it would add, once. Plain words first, skill name second. Never send test traffic without the authorization bravos-env asks for.',
|
|
121
|
-
'- Once, when it helps them follow along, mention that `bravos watch` in a second terminal pane shows this live as you work (free, read-only), and that `bravos dashboard` opens the findings as one page in their browser.',
|
|
145
|
+
'- Once, when it helps them follow along, mention that `bravos watch` in a second terminal pane shows this live as you work (free, read-only), and that `bravos dashboard` opens the findings as one page in their browser (rebuilt from the code each time; never open a saved copy instead).',
|
|
122
146
|
);
|
|
123
147
|
return out;
|
|
124
148
|
}
|
|
@@ -214,6 +238,8 @@ export function buildBriefing(inputs) {
|
|
|
214
238
|
else if (i.codegraph === 'locked') tail.push('Code graph: on the Team plan (see Plan above) — skills trace routes by reading until then');
|
|
215
239
|
else if (i.codegraph === 'unavailable') tail.push('Code graph: unavailable — skills trace routes by reading; when the person asks, set it up yourself (bravos-codegraph step 1: bravos setup with their go-ahead, then bravos graph build .)');
|
|
216
240
|
if (i.sast && typeof i.sast === 'object') tail.push(sastLine(i.sast.summary, i.sast.available));
|
|
241
|
+
const dash = dashboardLine(i.dashboard, i.now);
|
|
242
|
+
if (dash) tail.push(dash);
|
|
217
243
|
if (i.workspace) tail.push(...workspaceLines(i.workspace, i.workspaceCounts));
|
|
218
244
|
|
|
219
245
|
const sections = [fix, next, staleSec, tickets].filter((s) => s.items.length > 0);
|
|
@@ -361,11 +387,14 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
|
|
|
361
387
|
const base = ref || 'origin/main';
|
|
362
388
|
const name = branch && branch !== 'HEAD' ? branch : null;
|
|
363
389
|
const later = (args) => git(args, budget());
|
|
364
|
-
const
|
|
390
|
+
const saved = readDashboard(root);
|
|
391
|
+
const [diff, behind, stranded, defaultHead, since] = await Promise.all([
|
|
365
392
|
later(['diff', '--name-only', `${base}...HEAD`]),
|
|
366
393
|
gitStaleness(later, base),
|
|
367
394
|
strandedBranches(later, base, { current: name }),
|
|
368
395
|
ref ? later(['rev-parse', '--verify', `${ref}^{commit}`]) : null,
|
|
396
|
+
// How many commits have landed since the saved dashboard was built; unknown (a rebased-away commit) reads as none.
|
|
397
|
+
saved?.commit ? later(['rev-list', '--count', `${saved.commit}..HEAD`]) : null,
|
|
369
398
|
]);
|
|
370
399
|
return {
|
|
371
400
|
sha: sha ?? 'unknown',
|
|
@@ -375,6 +404,7 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
|
|
|
375
404
|
changedFiles: diff ? diff.split('\n').filter(Boolean) : [],
|
|
376
405
|
stale: staleness({ ...behind, branch: name, base }),
|
|
377
406
|
stranded,
|
|
407
|
+
dashboard: saved ? { ...saved, behind: /^\d+$/.test(since ?? '') ? Number(since) : 0 } : null,
|
|
378
408
|
};
|
|
379
409
|
})();
|
|
380
410
|
|
|
@@ -429,6 +459,7 @@ export async function collect(root, env, { deadlineMs = 20000, nextCount = 3 } =
|
|
|
429
459
|
stranded: facts.stranded,
|
|
430
460
|
guardlink,
|
|
431
461
|
changedFiles: facts.changedFiles,
|
|
462
|
+
dashboard: facts.dashboard,
|
|
432
463
|
inFlight,
|
|
433
464
|
intent: readIntent(root),
|
|
434
465
|
annotationMode: readAnnotationMode(root),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bugb-technologies/bravos",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Skills pack and installer that make Claude Code and Codex power users of guardlink (threat-model-as-code) and cert-x-gen (pentest-as-code).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"security",
|
package/skills/bravos/SKILL.md
CHANGED
|
@@ -27,7 +27,7 @@ description: "Start here in any repo bravos is installed in: reads the security
|
|
|
27
27
|
proving a finding, testing whether an exposure is exploitable → bravos-prove (after bravos-env).
|
|
28
28
|
a fix landed, stale claims, closing a security ticket → bravos-recheck.
|
|
29
29
|
the briefing says the branch is far behind its base, annotation work sits on an idle branch, a branch was moved or abandoned → bravos-resync.
|
|
30
|
-
"what is open?", "show me the findings", "is there a dashboard?" → answer in two or three lines from the briefing, then offer the page: `bravos dashboard` writes one self-contained HTML page (GuardLink's threat model, who introduced and fixed each exposure, what changed since the default branch; on the Team plan with the code graph built, also a Code graph tab: a map of where the risk sits, owners and history, coupling, the attack surface and entry points) under `.bravos/dashboard/`, git-ignored, and opens it in their browser. Run it when they say yes or asked to see it; add `--no-open` and give the path when no browser can open here, and `--no-blame` when they will share the page.
|
|
30
|
+
"what is open?", "show me the findings", "is there a dashboard?" → answer in two or three lines from the briefing, then offer the page: `bravos dashboard` writes one self-contained HTML page (GuardLink's threat model, who introduced and fixed each exposure, what changed since the default branch; on the Team plan with the code graph built, also a Code graph tab: a map of where the risk sits, owners and history, coupling, the attack surface and entry points) under `.bravos/dashboard/`, git-ignored, and opens it in their browser. Run it when they say yes or asked to see it; add `--no-open` and give the path when no browser can open here, and `--no-blame` when they will share the page. Always run the command: it rebuilds the page from the code as it stands, and on the Team plan rebuilds a code graph that is missing or behind first. Never open or point to a saved page instead, and when the briefing's `Dashboard:` line says the saved page is out of date, say so.
|
|
31
31
|
write up the assessment, a finding, a retest or a brief for leadership → bravos-report.
|
|
32
32
|
static analysis, dependency, secret or IaC findings → bravos-sast; "what did SAST find" → `bravos sast candidates` (the briefing's `SAST:` line says whether a run exists, or that SAST is unavailable).
|
|
33
33
|
keep annotating while I work, nightly or periodic runs → bravos-schedule.
|
|
@@ -45,6 +45,7 @@ description: "Keep the GuardLink threat model correct and growing, in this sessi
|
|
|
45
45
|
- You reported the delta line from step 10, the files left in `skipped`, and any lint violation on a line you did not write.
|
|
46
46
|
- Each new `@exposes` carries a severity with its reason, and every "intended?" `@audit` is listed for the user.
|
|
47
47
|
- Each new claim's state is clear: open or mitigated (none accepted by you), untested (an annotation alone confirms or refutes nothing), and verified or stale per `guardlink ci`. Say what was not tested. Do not call the code clean; the lint gate judges annotations, not code.
|
|
48
|
+
- If a dashboard was built earlier (the briefing's `Dashboard:` line, or one you opened this session), you said it is now behind these changes and offered to rebuild it with `bravos dashboard`.
|
|
48
49
|
|
|
49
50
|
## What it leaves for the next skill
|
|
50
51
|
|
|
@@ -16,7 +16,7 @@ description: "Ask the repo's code graph (codegraph-mcp) one bounded question —
|
|
|
16
16
|
**Plan check first.** The code graph is on the Team plan. Run `bravos licence --json` once per session (the briefing's `Plan:` line says the same); if `licensed` is false, tell the person in two sentences what this skill would do here and that it needs a Team licence — `bravos account activate` starts a 30-day trial with no card, or https://account.bugb.io/pricing — then stop, and do nothing else from this skill. A licence in grace still counts.
|
|
17
17
|
|
|
18
18
|
1. Ask the graph one bounded question per call; a graph answer replaces reading or grepping the tree. There are two ways in, with the same answers: the MCP tools (`codegraph_attack_surface` …) when the `codegraph` server is connected, or `bravos graph <question> --json` in the shell, where the question is the tool name without `codegraph_` and with hyphens (`codegraph_attack_surface` → `bravos graph attack-surface --json`, `codegraph_callers` → `bravos graph callers '<file>::<symbol>' --json`; `bravos graph --json` lists every question and its arguments). The shell route needs no MCP reconnect and works in every harness. The briefing's `Code graph:` line says which route is there. If neither is (no codegraph-mcp), set it up yourself: `bravos setup --check` reports what is missing without changing anything; show the person `bravos setup --dry-run --codegraph` and with their go-ahead run `bravos setup --codegraph` (it fetches the signed bundle through the account portal and verifies it before anything lands). If an install fails, quote its error and give the exact command for their own terminal; until then say "code graph unavailable; the other skills read the code instead" and answer by reading. Read the effort: the user's words ("at high"), else a `bravos effort: <level>` line in `AGENTS.md` / `CLAUDE.md`, else medium. It sets a starting budget, not a limit; go beyond it when the work needs it and say why in one line. Starting budget — low: the one question asked; medium: whatever questions the task needs; high: start from `codegraph_attack_surface`; max: the full attack surface plus `codegraph_impact` on every changed symbol.
|
|
19
|
-
2. Build or refresh the graph when an answer says there is none for this repository, or its `graph_currency` is `diverged`: `bravos graph build . --scip no-exec` indexes without running the repository's build scripts (`--scip auto` and `--isolate` run them; use those only on a repo the user trusts and only when they say so). A build that reports `semantic <language>: off` lacks that language's type checker; say that calls through interfaces may not connect and that `bravos setup --indexers` (with their go-ahead) adds it. For the MCP route, `bravos sync` registers the server from the bravos install; the person reconnects MCP (`/mcp` in Claude Code) to load it. In a bravos workspace, build one graph over the app folder (`bravos graph build <app folder> --scip no-exec`, the folder the briefing's `Workspace:` line names) and ask cross-service questions there: only a graph that holds both services links one service's HTTP, gRPC, GraphQL or OpenAPI client call to the other's handler (`callees` shows `via_framework`). A graph built inside one member stops at its own repository.
|
|
19
|
+
2. Build or refresh the graph when an answer says there is none for this repository, or its `graph_currency` is `diverged`: `bravos graph build . --scip no-exec` indexes without running the repository's build scripts (`--scip auto` and `--isolate` run them; use those only on a repo the user trusts and only when they say so). A build that reports `semantic <language>: off` lacks that language's type checker; say that calls through interfaces may not connect and that `bravos setup --indexers` (with their go-ahead) adds it. For the MCP route, `bravos sync` registers the server from the bravos install; the person reconnects MCP (`/mcp` in Claude Code) to load it. In a bravos workspace, build one graph over the app folder (`bravos graph build <app folder> --scip no-exec`, the folder the briefing's `Workspace:` line names) and ask cross-service questions there: only a graph that holds both services links one service's HTTP, gRPC, GraphQL or OpenAPI client call to the other's handler (`callees` shows `via_framework`). A graph built inside one member stops at its own repository. A graph belongs to the commit it was built at: after a commit it answers nothing until it is rebuilt, so rebuild before the next graph question and carry on with other work while it builds. `bravos dashboard` rebuilds a missing or behind graph itself and draws it as the Code graph tab (the map, owners and history, coupling, the attack surface, entry points), which is the view to offer a person who wants to see the graph.
|
|
20
20
|
3. Pick the one tool that answers the question:
|
|
21
21
|
find a symbol → `codegraph_search`
|
|
22
22
|
routes → `codegraph_routes`
|
|
@@ -36,6 +36,7 @@ description: "Keep findings from going stale after code changes: list the claims
|
|
|
36
36
|
- Every confirmed threat on a changed path was replayed, or you said why it was not.
|
|
37
37
|
- `guardlink diff <base> --fail-on-new --markdown` exits 0, or each new exposure it lists is reported as open.
|
|
38
38
|
- You named the three states for each claim you touched and what was not tested.
|
|
39
|
+
- If a dashboard was built earlier (the briefing's `Dashboard:` line, or one you opened this session), you said it is now behind these changes and offered to rebuild it with `bravos dashboard`.
|
|
39
40
|
|
|
40
41
|
## What it leaves for the next skill
|
|
41
42
|
|
|
@@ -39,6 +39,7 @@ description: "Write a crisp, evidence-bound white-box VAPT write-up in this sess
|
|
|
39
39
|
- `bravos report check <id>` passes for the report.
|
|
40
40
|
- The exports the user asked for exist beside `report.md`, and you named them.
|
|
41
41
|
- The user knows what is reproduced, what is code-review only, what is suspected, and what was not tested.
|
|
42
|
+
- When the reader also wants the live picture, you offered `bravos dashboard --no-blame --out <file>`: one shareable page without git names, a snapshot of the commit it was built at.
|
|
42
43
|
|
|
43
44
|
## What it leaves for the next skill
|
|
44
45
|
|
|
@@ -50,6 +50,7 @@ description: "The no-mistakes security gate before a pull request: validate the
|
|
|
50
50
|
## What it leaves for the next skill
|
|
51
51
|
|
|
52
52
|
- The Security gate section (in the PR body if one was asked for), the open exposures for the human to decide on, and the undefended-path count for the next bravos-annotate round.
|
|
53
|
+
- For a person who wants to see the change, `bravos dashboard` rebuilds one page showing what changed since the base; a dashboard saved before this check is out of date.
|
|
53
54
|
|
|
54
55
|
## Go deeper
|
|
55
56
|
|
|
@@ -53,6 +53,9 @@ main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
|
|
53
53
|
section { flex: 1; min-height: 0; display: none; flex-direction: column; }
|
|
54
54
|
section.on { display: flex; }
|
|
55
55
|
iframe { flex: 1; width: 100%; border: 0; background: var(--canvas); }
|
|
56
|
+
.aged { padding: 8px 16px; font-size: 13px; color: var(--fg); background: var(--canvas-inset); border-bottom: 1px solid var(--border); border-left: 3px solid var(--review); }
|
|
57
|
+
.aged[hidden] { display: none; }
|
|
58
|
+
.aged p { margin: 0; }
|
|
56
59
|
.strip { padding: 6px 16px; font-size: 12px; color: var(--fg-subtle); background: var(--canvas-inset); border-bottom: 1px solid var(--border); }
|
|
57
60
|
.note { max-width: 640px; margin: 48px auto; padding: 20px 24px; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--review); border-radius: var(--radius); }
|
|
58
61
|
.note h2 { margin: 0 0 6px; font-size: 15px; }
|
|
@@ -66,6 +69,7 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
66
69
|
<span class="facts" id="facts"></span>
|
|
67
70
|
<nav class="tabs" id="tabs" role="tablist" aria-label="Dashboard views"></nav>
|
|
68
71
|
</div>
|
|
72
|
+
<div class="aged" id="aged" role="status" hidden></div>
|
|
69
73
|
<main id="main"></main>
|
|
70
74
|
<script type="application/json" id="bravos-data">__BRAVOS_DATA__</script>
|
|
71
75
|
<script type="application/json" id="bravos-threat-model">__BRAVOS_THREAT_MODEL__</script>
|
|
@@ -104,7 +108,24 @@ code { font: 12.5px var(--mono); background: var(--raised); border: 1px solid va
|
|
|
104
108
|
fact('repo', DATA.repo);
|
|
105
109
|
fact('at', [DATA.branch, DATA.sha].filter(Boolean).join(' @ '));
|
|
106
110
|
fact('plan', DATA.plan);
|
|
107
|
-
|
|
111
|
+
// A saved page cannot see the repository, so its age is the honest signal it has: the bar says how long ago
|
|
112
|
+
// it was built, and past half a day a strip says it may be behind the code and how to rebuild it.
|
|
113
|
+
const builtAt = Date.parse(DATA.generatedAt);
|
|
114
|
+
const age = Number.isFinite(builtAt) ? Math.max(0, Date.now() - builtAt) : null;
|
|
115
|
+
const ago = (ms) => {
|
|
116
|
+
const minutes = Math.round(ms / 60000);
|
|
117
|
+
if (minutes < 2) return 'just now';
|
|
118
|
+
if (minutes < 90) return minutes + ' minutes ago';
|
|
119
|
+
if (minutes < 36 * 60) return Math.round(minutes / 60) + ' hours ago';
|
|
120
|
+
return Math.round(minutes / 1440) + ' days ago';
|
|
121
|
+
};
|
|
122
|
+
fact('built', String(DATA.generatedAt || '').slice(0, 16).replace('T', ' ') + ' UTC' + (age === null ? '' : ' (' + ago(age) + ')'));
|
|
123
|
+
const STALE_AFTER_MS = 12 * 60 * 60 * 1000;
|
|
124
|
+
if (age !== null && age > STALE_AFTER_MS) {
|
|
125
|
+
const aged = document.getElementById('aged');
|
|
126
|
+
aged.append(prose('This page was built ' + ago(age) + (DATA.sha ? ' at commit ' + DATA.sha : '') + ' and may be behind the code. Run bravos dashboard in the repository to rebuild it.'));
|
|
127
|
+
aged.hidden = false;
|
|
128
|
+
}
|
|
108
129
|
document.title = `Bravos — ${DATA.repo}`;
|
|
109
130
|
|
|
110
131
|
const views = [];
|