@bugb-technologies/bravos 1.24.0 → 1.26.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/dist/bin.js +12 -0
- package/dist/cli.js +222 -16
- package/dist/context.js +4 -4
- package/dist/cursor.js +24 -5
- package/dist/dashboard-sast.js +113 -0
- package/dist/dashboard.js +22 -11
- package/dist/doctor.js +29 -2
- package/dist/graphbin.js +2 -2
- package/dist/guide.js +4 -2
- package/dist/hook-launcher.js +92 -0
- package/dist/hooks.js +56 -3
- package/dist/plugin-release.js +38 -12
- package/dist/prefs.js +13 -3
- package/dist/principles.js +1 -1
- package/dist/records-conflicts.js +128 -0
- package/dist/records-drafts.js +106 -0
- package/dist/records-ledger.js +103 -0
- package/dist/records-team.js +398 -0
- package/dist/records.js +158 -0
- package/dist/review-server.js +3 -1
- package/dist/review.js +16 -1
- package/dist/rules.js +97 -4
- package/dist/setup.js +6 -6
- package/dist/uninstall.js +1 -1
- package/dist/upkeep.js +3 -0
- package/docs/GUIDE.md +11 -1
- package/docs/UPGRADING.md +56 -0
- package/hooks/cards.mjs +63 -14
- package/hooks/coach.mjs +3 -1
- package/hooks/lib/agent-io.mjs +118 -0
- package/hooks/lib/briefing.mjs +94 -3
- package/hooks/lib/cards.mjs +8 -1
- package/hooks/lib/draft-check.mjs +104 -0
- package/hooks/lib/drafts.mjs +121 -0
- package/hooks/lib/ledger.mjs +270 -0
- package/hooks/lib/pre-pr.mjs +74 -0
- package/hooks/lib/prefs.mjs +7 -3
- package/hooks/lib/record-guard.mjs +272 -0
- package/hooks/lib/records.mjs +581 -0
- package/hooks/lib/replay.mjs +2 -1
- package/hooks/lib/sast.mjs +3 -1
- package/hooks/record-guard.mjs +62 -0
- package/hooks/session-start.mjs +4 -3
- package/package.json +2 -2
- package/skills/bravos/SKILL.md +1 -0
- package/skills/bravos-records/SKILL.md +57 -0
- package/templates/dashboard/dashboard.html +198 -1
- package/templates/omp/bravos.js +85 -1
- package/templates/opencode/bravos.js +84 -1
- package/templates/plugin/workspace-hook.mjs +37 -0
- package/templates/workflows/bravos-pr-gate.yml +23 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @comment -- "For a plugin whose hooks run in the plugin's own folder (Antigravity): reads the hook payload, finds the workspace it names (workspacePaths), and runs the installed CLI there (bravos hook <name> <args>) with the same payload on stdin, printing its answer. The CLI is found on PATH, never shipped. Fail-open: no workspace, no bravos, an error, more than 8 seconds or output that is not JSON all print {}, so the edit goes ahead."
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
|
|
4
|
+
// @flows #records -> #hook-launcher via stdin -- "A plugin's hook payload goes to bravos hook in the workspace it names: a fixed argv (no shell), the payload on stdin only"
|
|
5
|
+
const read = async () => {
|
|
6
|
+
const chunks = [];
|
|
7
|
+
for await (const c of process.stdin) chunks.push(c);
|
|
8
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const allow = () => {
|
|
12
|
+
process.stdout.write('{}\n');
|
|
13
|
+
process.exit(0);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const raw = await Promise.race([read(), new Promise((r) => setTimeout(() => r(''), 3000).unref())]);
|
|
18
|
+
const payload = JSON.parse(raw || '{}');
|
|
19
|
+
const cwd = Array.isArray(payload?.workspacePaths) ? payload.workspacePaths.find((p) => typeof p === 'string' && p) : null;
|
|
20
|
+
if (!cwd) allow();
|
|
21
|
+
const child = execFile('bravos', ['hook', ...process.argv.slice(2)], { cwd, timeout: 8000, maxBuffer: 1024 * 1024 }, (err, stdout) => {
|
|
22
|
+
try {
|
|
23
|
+
const last = String(stdout).trim().split('\n').pop() || '{}';
|
|
24
|
+
if (err) allow();
|
|
25
|
+
JSON.parse(last);
|
|
26
|
+
process.stdout.write(`${last}\n`);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
} catch {
|
|
29
|
+
allow();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
child.on('error', allow);
|
|
33
|
+
child.stdin?.on('error', () => {});
|
|
34
|
+
child.stdin?.end(raw);
|
|
35
|
+
} catch {
|
|
36
|
+
allow();
|
|
37
|
+
}
|
|
@@ -13,6 +13,8 @@ on:
|
|
|
13
13
|
|
|
14
14
|
permissions:
|
|
15
15
|
contents: read
|
|
16
|
+
# The records review check reads this PR's reviews and the reviews of the PR that last changed each record.
|
|
17
|
+
pull-requests: read
|
|
16
18
|
security-events: write
|
|
17
19
|
# upload-sarif reads the run's metadata; private repositories need this to upload.
|
|
18
20
|
actions: read
|
|
@@ -247,6 +249,27 @@ jobs:
|
|
|
247
249
|
git show "$BASE_SHA:.bravos/hooks/lib/context.mjs" > "$RUNNER_TEMP/bravos-context.mjs"
|
|
248
250
|
node "$RUNNER_TEMP/bravos-context.mjs" check .
|
|
249
251
|
|
|
252
|
+
# Security decision records: whether a CODEOWNERS owner approved each record's last change on the base branch, and
|
|
253
|
+
# this PR's changes to records, read with the job's own token. It reports and never fails the job: the base
|
|
254
|
+
# branch's protection is what makes a PR wait for that review. A team owner the token may not read is said, not
|
|
255
|
+
# guessed. As with the design documents, the base branch's copy of the script runs, never this PR's.
|
|
256
|
+
- name: Security decision records reviewed by their code owners
|
|
257
|
+
env:
|
|
258
|
+
BASE_SHA: ${{ steps.base.outputs.sha }}
|
|
259
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
260
|
+
run: |
|
|
261
|
+
[[ -d .guardlink/records ]] || exit 0
|
|
262
|
+
lib="$RUNNER_TEMP/bravos-records-lib"
|
|
263
|
+
mkdir -p "$lib"
|
|
264
|
+
for f in records principles context; do
|
|
265
|
+
if ! git show "$BASE_SHA:.bravos/hooks/lib/$f.mjs" > "$lib/$f.mjs" 2> /dev/null; then
|
|
266
|
+
echo "The base branch's Bravos has no records review check yet (bravos sync adds it); records were not checked here." >> "$GITHUB_STEP_SUMMARY"
|
|
267
|
+
exit 0
|
|
268
|
+
fi
|
|
269
|
+
done
|
|
270
|
+
grep -q verify-github "$lib/records.mjs" || { echo "The base branch's Bravos predates the records review check (bravos sync adds it)." >> "$GITHUB_STEP_SUMMARY"; exit 0; }
|
|
271
|
+
node "$lib/records.mjs" verify-github
|
|
272
|
+
|
|
250
273
|
- name: Changed source to review
|
|
251
274
|
if: always() && steps.base.outcome == 'success'
|
|
252
275
|
continue-on-error: true
|