@bugb-technologies/bravos 1.9.3 → 1.12.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/cli.js +10 -10
- package/dist/context.js +1 -1
- package/dist/doctor.js +46 -3
- package/dist/guide.js +5 -2
- package/dist/help.js +32 -5
- package/dist/hooks.js +10 -1
- package/dist/plugin.js +4 -2
- package/dist/prefs.js +25 -5
- package/dist/start/index.js +3 -3
- package/dist/uninstall.js +1 -1
- package/docs/GUIDE.md +21 -3
- package/docs/UPGRADING.md +56 -1
- package/hooks/coach.mjs +89 -0
- package/hooks/lib/autopilot.mjs +8 -13
- package/hooks/lib/briefing.mjs +43 -11
- package/hooks/lib/coach.mjs +161 -0
- package/hooks/lib/context.mjs +6 -5
- package/hooks/lib/pre-pr.mjs +23 -2
- package/hooks/lib/prefs.mjs +28 -12
- package/hooks/lib/setup.mjs +3 -3
- package/hooks/lib/update-check.mjs +138 -0
- package/hooks/session-start.mjs +9 -0
- package/package.json +1 -1
- package/skills/bravos/SKILL.md +6 -5
- package/skills/bravos-annotate/SKILL.md +7 -5
- package/skills/bravos-annotate/scripts/lib/gate.mjs +6 -5
- package/skills/bravos-annotate/scripts/slice.mjs +4 -6
- package/skills/bravos-campaign/SKILL.md +2 -2
- package/skills/bravos-context/SKILL.md +8 -7
- package/skills/bravos-prove/SKILL.md +2 -0
- package/skills/bravos-recheck/SKILL.md +2 -1
- package/templates/review/review.html +5 -23
- package/templates/workflows/bravos-nightly-claude.yml +11 -10
- package/templates/workflows/bravos-nightly-codex.yml +11 -10
- package/templates/workflows/bravos-nightly-copilot.yml +6 -7
- package/templates/workflows/bravos-pr-gate.yml +9 -3
|
@@ -113,10 +113,9 @@ jobs:
|
|
|
113
113
|
name: bravos-replay-ledger
|
|
114
114
|
path: ${{ runner.temp }}/bravos-verified-ledger/hypotheses.json
|
|
115
115
|
retention-days: 1
|
|
116
|
-
#
|
|
117
|
-
#
|
|
118
|
-
# dependency-free script from the default branch;
|
|
119
|
-
# writes under .bravos/ or to the intent is ever staged.
|
|
116
|
+
# The intake's state, as a report. Annotation never waits for it: with no confirmed intent the agent judges against
|
|
117
|
+
# the draft in .guardlink/intent.md (or none), and this job says so in the run summary. The check is one
|
|
118
|
+
# dependency-free script from the default branch; nothing the agent writes under .bravos/ or to the intent is staged.
|
|
120
119
|
context:
|
|
121
120
|
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
122
121
|
runs-on: ubuntu-latest
|
|
@@ -133,23 +132,22 @@ jobs:
|
|
|
133
132
|
with:
|
|
134
133
|
node-version: 22
|
|
135
134
|
|
|
136
|
-
- name:
|
|
135
|
+
- name: Intake state
|
|
137
136
|
id: gate
|
|
138
137
|
run: |
|
|
139
138
|
if [ ! -f .bravos/hooks/lib/context.mjs ]; then
|
|
140
|
-
echo "::notice::This repository's bravos hook scripts predate the context check; run bravos sync. Annotating as before."
|
|
141
139
|
echo "open=true" >> "$GITHUB_OUTPUT"
|
|
142
140
|
elif node .bravos/hooks/lib/context.mjs gate . > "$RUNNER_TEMP/gate.txt"; then
|
|
143
141
|
echo "open=true" >> "$GITHUB_OUTPUT"
|
|
144
142
|
else
|
|
145
143
|
echo "open=false" >> "$GITHUB_OUTPUT"
|
|
146
|
-
{ echo "###
|
|
147
|
-
echo "::notice::
|
|
144
|
+
{ echo "### Annotating against the draft intent"; echo; cat "$RUNNER_TEMP/gate.txt"; } >> "$GITHUB_STEP_SUMMARY"
|
|
145
|
+
echo "::notice::Intake not confirmed: annotation runs against the draft intent. A person confirms it with bravos review intent."
|
|
148
146
|
fi
|
|
149
147
|
|
|
150
148
|
annotate:
|
|
151
149
|
needs: [replay, context]
|
|
152
|
-
if: always() && !cancelled() &&
|
|
150
|
+
if: always() && !cancelled() && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
153
151
|
runs-on: ubuntu-latest
|
|
154
152
|
env:
|
|
155
153
|
BRAVOS_LICENCE: ${{ secrets.BRAVOS_LICENCE }}
|
|
@@ -197,7 +195,10 @@ jobs:
|
|
|
197
195
|
next unannotated files that `guardlink unannotated --json` lists. You are the agent: do
|
|
198
196
|
the work in this session and never run guardlink annotate with an agent flag. Stop when
|
|
199
197
|
`guardlink lint . --since ${{ steps.start.outputs.sha }} --json` reports 0 errors and
|
|
200
|
-
`guardlink validate .` passes.
|
|
198
|
+
`guardlink validate .` passes. Intent confirmed: ${{ needs.context.outputs.open }}. Do not run
|
|
199
|
+
bravos-context or open the intake page here: judge against .guardlink/intent.md as it stands,
|
|
200
|
+
draft or confirmed, and without one say so in an @audit where a severity depends on intent.
|
|
201
|
+
Leave the changes uncommitted; a later step commits them
|
|
201
202
|
and opens the pull request. Draft kits this run: ${{ needs.replay.outputs.drafts }}.
|
|
202
203
|
Only when yes, for each newly testable exposure use the GuardLink translate method
|
|
203
204
|
in this session to author or update one scoped JavaScript probe under .guardlink/cxg-replay/,
|
|
@@ -44,24 +44,22 @@ jobs:
|
|
|
44
44
|
with:
|
|
45
45
|
node-version: 22
|
|
46
46
|
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
- name:
|
|
47
|
+
# The intake's state, as a report: Copilot is asked for a slice whatever it is, and judges against the draft intent
|
|
48
|
+
# while no named person has confirmed it (.guardlink/intent.md).
|
|
49
|
+
- name: Intake state
|
|
50
50
|
id: gate
|
|
51
51
|
run: |
|
|
52
52
|
if [ ! -f .bravos/hooks/lib/context.mjs ]; then
|
|
53
|
-
echo "::notice::This repository's bravos hook scripts predate the context check; run bravos sync. Asking Copilot as before."
|
|
54
53
|
echo "open=true" >> "$GITHUB_OUTPUT"
|
|
55
54
|
elif node .bravos/hooks/lib/context.mjs gate . > "$RUNNER_TEMP/gate.txt"; then
|
|
56
55
|
echo "open=true" >> "$GITHUB_OUTPUT"
|
|
57
56
|
else
|
|
58
57
|
echo "open=false" >> "$GITHUB_OUTPUT"
|
|
59
|
-
{ echo "###
|
|
60
|
-
echo "::notice::
|
|
58
|
+
{ echo "### Annotating against the draft intent"; echo; cat "$RUNNER_TEMP/gate.txt"; } >> "$GITHUB_STEP_SUMMARY"
|
|
59
|
+
echo "::notice::Intake not confirmed: the slice is judged against the draft intent. A person confirms it with bravos review intent."
|
|
61
60
|
fi
|
|
62
61
|
|
|
63
62
|
- name: Ask Copilot for the next slice
|
|
64
|
-
if: steps.gate.outputs.open == 'true'
|
|
65
63
|
env:
|
|
66
64
|
GH_TOKEN: ${{ secrets.COPILOT_ASSIGN_TOKEN }}
|
|
67
65
|
REPO: ${{ github.repository }}
|
|
@@ -84,6 +82,7 @@ jobs:
|
|
|
84
82
|
- Follow the bravos-annotate skill (\`.claude/skills/bravos-annotate/SKILL.md\` or \`.agents/skills/bravos-annotate/SKILL.md\`) in slice mode, its default, on the files \`guardlink unannotated --json\` lists first.
|
|
85
83
|
- Do the work yourself in this session. Never run guardlink annotate with an agent flag.
|
|
86
84
|
- Stop when \`guardlink lint . --since $START --json\` reports 0 errors and \`guardlink validate .\` passes.
|
|
85
|
+
- Judge against \`.guardlink/intent.md\` as it stands, draft or confirmed; do not run bravos-context or open the intake page.
|
|
87
86
|
- Change annotations only, not code, and open one pull request with them.
|
|
88
87
|
|
|
89
88
|
Opened by the bravos nightly. While this issue is open the nightly opens no other; the next one comes after it closes.
|
|
@@ -165,7 +165,8 @@ jobs:
|
|
|
165
165
|
# A design rule (a threat whose id starts inv-, written from the team's intent) that was holding, on a file
|
|
166
166
|
# this PR changed after the rule's last refused test, must be named in the PR body by its INV id or its
|
|
167
167
|
# threat id: the held result no longer describes the code. The same check as the pre-PR hook, at file
|
|
168
|
-
# level, with git and jq. A rule no test has tried yet is listed in the summary, never blocked.
|
|
168
|
+
# level, with git and jq. A rule no test has tried yet is listed in the summary, never blocked. A rule still a draft
|
|
169
|
+
# in intent.md (the agent's, not yet confirmed by a person) counts the same, and is labelled so.
|
|
169
170
|
- name: No untested change under a design rule
|
|
170
171
|
env:
|
|
171
172
|
PR_BODY: ${{ github.event.pull_request.body }}
|
|
@@ -200,6 +201,11 @@ jobs:
|
|
|
200
201
|
| .outcome.at | strings | (sub("\\.[0-9]+Z$"; "Z") | fromdateiso8601)?] | min) }
|
|
201
202
|
| select(.files | length > 0)]
|
|
202
203
|
' "$model" > "$touched"
|
|
204
|
+
# INV ids nobody has confirmed: the text after the last " — " starts with draft, or there is none.
|
|
205
|
+
drafts="$RUNNER_TEMP/bravos-rules-drafts.json"
|
|
206
|
+
jq -R -s '[split("\n")[] | capture("^\\s*[-*]\\s+(?<id>INV-[0-9]+)\\s*:\\s*(?<rest>.+)$")?
|
|
207
|
+
| select(.rest | split(" — ") | if length > 1 then (.[-1] | test("^\\s*draft\\b"; "i")) else true end) | .id] | unique
|
|
208
|
+
' .guardlink/intent.md > "$drafts"
|
|
203
209
|
# The last commit in this PR that touched each of those files, in seconds.
|
|
204
210
|
times="$RUNNER_TEMP/bravos-rules-times.json"
|
|
205
211
|
echo '{}' > "$times"
|
|
@@ -211,11 +217,11 @@ jobs:
|
|
|
211
217
|
jq -r '.[] | select(.tested == null) |
|
|
212
218
|
" " + ([.inv, .threat, (.files | join(", ")), "no test has tried this design rule yet"] | tojson)
|
|
213
219
|
' "$touched" >> "$GITHUB_STEP_SUMMARY"
|
|
214
|
-
jq -r -L "$RUNNER_TEMP" --arg body "$PR_BODY" --slurpfile times "$times" 'include "named";
|
|
220
|
+
jq -r -L "$RUNNER_TEMP" --arg body "$PR_BODY" --slurpfile times "$times" --slurpfile drafts "$drafts" 'include "named";
|
|
215
221
|
.[] | select(.tested != null) | . as $r | .files |= map(select(($times[0][.] // 0) > $r.tested))
|
|
216
222
|
| select(.files | length > 0)
|
|
217
223
|
| select((named($body; .threat) or named($body; .inv)) | not)
|
|
218
|
-
| "\(.inv // "rule") \(.threat) — \(.files | join(", ")) (last tested \(.tested | todate | .[0:10]))"
|
|
224
|
+
| "\(.inv // "rule")\(.inv as $i | if ($i != null and any($drafts[0][]; . == ($i | ascii_upcase))) then " (draft: not yet confirmed by a person)" else "" end) \(.threat) — \(.files | join(", ")) (last tested \(.tested | todate | .[0:10]))"
|
|
219
225
|
' "$touched" > "$RUNNER_TEMP/bravos-rules-lapsed.txt"
|
|
220
226
|
if [ -s "$RUNNER_TEMP/bravos-rules-lapsed.txt" ]; then
|
|
221
227
|
echo "::error::This PR changes code under a design rule that was holding, after the rule was last tested. Replay its test (bravos-recheck), or name each rule (its INV id or threat id) in the PR body:"
|