@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/README.md
CHANGED
|
@@ -16,21 +16,25 @@ Requires **Node.js 20 or newer**.
|
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm install -g @bugb-technologies/bravos
|
|
19
|
-
bravos
|
|
19
|
+
bravos setup
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
`bravos
|
|
22
|
+
`bravos setup` is the one command for setting Bravos up. Run it in a repository, in a terminal:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
- **The first time on a machine** it signs you in, installs the tools, then asks about the repository: which agents, PR checks, scheduled upkeep and testing. It shows the changes before you choose Apply.
|
|
25
|
+
- **In another repository** it skips what the machine already has and asks only that repository's questions.
|
|
26
|
+
- **In a repository that already has Bravos** it brings this machine and the repository up to date; `bravos setup --change` asks the repository's questions again.
|
|
27
|
+
|
|
28
|
+
Then open your agent and say anything: Bravos begins with what the app is for. Bravos never starts an agent itself.
|
|
29
|
+
|
|
30
|
+
For scripts, flags do one part without questions: `bravos setup --tools -y` installs GuardLink and cxg, `bravos setup --agent claude --autopilot --ci` sets up a repository, and `bravos setup --yes` does a first setup with the defaults.
|
|
25
31
|
|
|
26
32
|
## Core commands
|
|
27
33
|
|
|
28
34
|
| Command | Purpose |
|
|
29
35
|
|---|---|
|
|
30
|
-
| `bravos
|
|
31
|
-
| `bravos
|
|
32
|
-
| `bravos sync` | Refresh installed skills and wiring after an upgrade. |
|
|
33
|
-
| `bravos setup` | Install the tools Bravos drives. |
|
|
36
|
+
| `bravos setup` | Set up this machine and this repository, or bring them up to date. |
|
|
37
|
+
| `bravos setup --check` | Say what is installed and what setup would do; changes nothing. |
|
|
34
38
|
| `bravos graph build .` | Index the repository for code graph questions. |
|
|
35
39
|
| `bravos sast run` | Run static analysis against the repository. |
|
|
36
40
|
| `bravos doctor` | Check installed tools and configuration. |
|
package/dist/ci.js
CHANGED
|
@@ -7,7 +7,7 @@ export const WORKFLOW_MARKER = 'bravos:generated';
|
|
|
7
7
|
export const CADENCES = ['weekday', 'daily', 'weekly'];
|
|
8
8
|
// 03:17 UTC, off the hour so it does not land with everyone else's cron.
|
|
9
9
|
export const CRON = { weekday: '17 3 * * 1-5', daily: '17 3 * * *', weekly: '17 3 * * 0' };
|
|
10
|
-
/** The workflow files, by the name bravos
|
|
10
|
+
/** The workflow files, by the name bravos setup --workflows takes. */
|
|
11
11
|
export const WORKFLOW_NAMES = ['pr-gate', 'nightly-claude', 'nightly-codex', 'nightly-copilot'];
|
|
12
12
|
// @comment -- "The files each workflow name writes. The Copilot nightly also writes copilot-setup-steps.yml, the fixed file GitHub reads to prepare Copilot's session."
|
|
13
13
|
export const WORKFLOW_FILES = {
|
package/dist/cli.js
CHANGED
|
@@ -7,8 +7,8 @@ import { checkProofTool, formatProofTool } from './proof-tools.js';
|
|
|
7
7
|
import { DOCTOR_HELP, INIT_HELP, PROGRAM_HELP, SYNC_HELP } from './help.js';
|
|
8
8
|
import { Command, CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
9
9
|
import { CADENCES, CRON, WORKFLOW_NAMES, writeWorkflows } from './ci.js';
|
|
10
|
-
import { writeCursorPointer } from './cursor.js';
|
|
11
|
-
import { writeOmpExtension } from './omp.js';
|
|
10
|
+
import { CURSOR_RULE_PATH, writeCursorPointer } from './cursor.js';
|
|
11
|
+
import { OMP_EXTENSION_PATH, writeOmpExtension } from './omp.js';
|
|
12
12
|
import { homeOf, installGlobal } from './global.js';
|
|
13
13
|
import { uninstall } from './uninstall.js';
|
|
14
14
|
import { checkKind, newToken, prepareReview, readAllAnswers, readDraft, renderReview, summarize, writePage } from './review.js';
|
|
@@ -17,26 +17,51 @@ import { formatRules, gatherRules } from './rules.js';
|
|
|
17
17
|
import { spawn as spawnChild, spawnSync } from 'node:child_process';
|
|
18
18
|
import { createServer as netServer } from 'node:net';
|
|
19
19
|
import { dirname as pathDirname, join as pathJoin } from 'node:path';
|
|
20
|
-
import { OPENCODE_CONFIG, writeOpencode } from './opencode.js';
|
|
20
|
+
import { OPENCODE_CONFIG, OPENCODE_PLUGIN_PATH, writeOpencode } from './opencode.js';
|
|
21
21
|
import { GUIDE_TOPIC_IDS, renderGuide, renderGuideMarkdown } from './guide.js';
|
|
22
22
|
import { detectHarnesses } from './detect.js';
|
|
23
|
-
import { formatDoctor, runDoctor, withLicence } from './doctor.js';
|
|
23
|
+
import { formatDoctor, runDoctor, withLegacySkills, withLicence } from './doctor.js';
|
|
24
24
|
import { ensureGuardlink, registerPrePr, whichBin, writeScope } from './guardlink.js';
|
|
25
|
-
import { installHook, installedOptIns } from './hooks.js';
|
|
25
|
+
import { AGY_HOOKS_FILE, ALL_SESSION_COMMANDS, hookRegistered, installHook, installedOptIns } from './hooks.js';
|
|
26
26
|
import { activate, importLicence } from './account.js';
|
|
27
27
|
import { listDevices, logout, refresh as refreshDevice, revokeDevice } from './device.js';
|
|
28
28
|
import * as graph from './codegraph.js';
|
|
29
29
|
import { askGraph } from './watch.js';
|
|
30
30
|
import { plan as setupPlan, runSast, runSetup } from './setup.js';
|
|
31
|
+
import { isTerminal, setupRoute } from './setup-route.js';
|
|
32
|
+
import { leaveHandoff } from './prefs.js';
|
|
31
33
|
import { openInBrowser } from './open.js';
|
|
32
34
|
import { licenceDocument, licenceLib, licenceLines, requireFeature } from './licence.js';
|
|
33
35
|
import { migrateFromOldName, OLD_DIR, reportMigration } from './migrate.js';
|
|
34
36
|
import { listBundledSkills } from './skills.js';
|
|
35
37
|
import { installSkills, linkSkillRoots, mirrorGuardlinkSkills, skillRootsLinked } from './install.js';
|
|
36
|
-
import { readLock, sha256, writeLock } from './lock.js';
|
|
38
|
+
import { LOCK_PATH, readLock, sha256, writeLock } from './lock.js';
|
|
37
39
|
import { mergeCodexConfig, mergeMcpJson, selectServers } from './mcp.js';
|
|
38
40
|
import { hooksDir, skillsDir as bundledSkillsDir, version } from './paths.js';
|
|
39
41
|
import { BravosError } from './types.js';
|
|
42
|
+
// @comment -- "Which agents a repository already has Bravos installed for, read from the files Bravos wrote there: the two skills roots, the Codex and Antigravity hook registrations, and the opencode and omp plugins. Upkeep re-applies to exactly these, so a tool that happens to be on this machine, or an AGENTS.md someone added, never widens a team's setup."
|
|
43
|
+
export function installedAgents(root) {
|
|
44
|
+
const has = (rel) => existsSync(join(root, rel));
|
|
45
|
+
const out = [];
|
|
46
|
+
if (has('.claude/skills/bravos/SKILL.md'))
|
|
47
|
+
out.push('claude');
|
|
48
|
+
if (has('.agents/skills/bravos/SKILL.md')) {
|
|
49
|
+
if (hookRegistered(join(root, '.codex', 'hooks.json'), 'SessionStart', ALL_SESSION_COMMANDS))
|
|
50
|
+
out.push('agents');
|
|
51
|
+
try {
|
|
52
|
+
if ('bravos' in JSON.parse(readFileSync(join(root, AGY_HOOKS_FILE), 'utf8')))
|
|
53
|
+
out.push('agy');
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
/* no Antigravity registration */
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (has(OPENCODE_PLUGIN_PATH))
|
|
60
|
+
out.push('opencode');
|
|
61
|
+
if (has(OMP_EXTENSION_PATH))
|
|
62
|
+
out.push('omp');
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
40
65
|
// @comment -- "Parses --workflows pr-gate,nightly-claude,nightly-codex,nightly-copilot; anything else is a usage error"
|
|
41
66
|
function parseWorkflows(value) {
|
|
42
67
|
const out = [];
|
|
@@ -105,7 +130,7 @@ function oldHookReferences(root) {
|
|
|
105
130
|
for (const [rel, agent] of files) {
|
|
106
131
|
try {
|
|
107
132
|
if (readFileSync(join(root, rel), 'utf8').includes(`${OLD_DIR}/hooks/`)) {
|
|
108
|
-
out.push(`Hooks: ${rel} still runs the old ${OLD_DIR}/hooks scripts, which are gone; run bravos
|
|
133
|
+
out.push(`Hooks: ${rel} still runs the old ${OLD_DIR}/hooks scripts, which are gone; run bravos setup --agent ${agent} to replace them, or remove those entries.`);
|
|
109
134
|
}
|
|
110
135
|
}
|
|
111
136
|
catch {
|
|
@@ -116,10 +141,15 @@ function oldHookReferences(root) {
|
|
|
116
141
|
}
|
|
117
142
|
function pipeline(root, io, opts, withGuardlink, lines) {
|
|
118
143
|
const dryRun = !!opts.dryRun;
|
|
144
|
+
// Whether Bravos was here before this run: only a first install leaves the hand-off below.
|
|
145
|
+
const hadLock = existsSync(join(root, LOCK_PATH));
|
|
119
146
|
if (dryRun)
|
|
120
147
|
lines.push('dry-run: nothing written');
|
|
121
|
-
// @comment -- "The move from the old name runs whatever --agent selects: it removes only old-name files the old lock vouches for and moves the data folders, and creates nothing for an agent that was not chosen.
|
|
148
|
+
// @comment -- "The move from the old name runs whatever --agent selects: it removes only old-name files the old lock vouches for and moves the data folders, and creates nothing for an agent that was not chosen. the guided setup always passes --agent, so skipping it there would leave every old install unmigrated."
|
|
122
149
|
reportMigration(migrateFromOldName(root, { dryRun, ownSkills: listBundledSkills(io.skillsDir).map((s) => s.name) }), lines);
|
|
150
|
+
// Upkeep names the agents itself, from what is installed, so nothing below is decided by detection or by this machine's tools.
|
|
151
|
+
if (opts.refreshOnly)
|
|
152
|
+
opts = { ...opts, agent: installedAgents(root) };
|
|
123
153
|
const detected = detectHarnesses(root);
|
|
124
154
|
// @comment -- "Explicit --agent limits agent-specific writes, independent of detection and shared skill roots. Antigravity and Codex share .agents/skills but have separate hook registrations; omp/opencode alone use that skills root without installing Codex."
|
|
125
155
|
const explicit = opts.agent !== undefined;
|
|
@@ -208,7 +238,8 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
208
238
|
for (const s of mirror.skipped)
|
|
209
239
|
lines.push(` skipped ${s.path} — ${s.reason}`);
|
|
210
240
|
}
|
|
211
|
-
|
|
241
|
+
// With --agent the Cursor pointer is left alone; upkeep still refreshes one that is already there.
|
|
242
|
+
const cursor = explicit && !(opts.refreshOnly && existsSync(join(root, CURSOR_RULE_PATH))) ? { status: 'absent' } : writeCursorPointer(root, harnesses, { force: opts.force, dryRun });
|
|
212
243
|
if (cursor.status === 'skipped')
|
|
213
244
|
lines.push(`Cursor: skipped ${cursor.path} — ${cursor.reason}`);
|
|
214
245
|
else if (cursor.status === 'no-skills')
|
|
@@ -242,8 +273,8 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
242
273
|
for (const r of hook.registered)
|
|
243
274
|
lines.push(`Hooks: ${r.file} ${r.changed ? 'registered' : 'already registered'}`);
|
|
244
275
|
// A repository that keeps design documents gets the pre-push check in every clone that runs init or sync, not only
|
|
245
|
-
// in the clone of whoever added the first one.
|
|
246
|
-
if (!dryRun && !opts.global && existsSync(join(root, '.bravos', 'context', 'sources.json')))
|
|
276
|
+
// in the clone of whoever added the first one. Upkeep leaves the clone's git hooks to a person.
|
|
277
|
+
if (!dryRun && !opts.global && !opts.refreshOnly && existsSync(join(root, '.bravos', 'context', 'sources.json')))
|
|
247
278
|
lines.push(...installPrePush(root, io.env));
|
|
248
279
|
// An agent left out of --agent keeps its own settings, which may still run the old-name hook the migration moved.
|
|
249
280
|
for (const w of oldHookReferences(root))
|
|
@@ -252,7 +283,7 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
252
283
|
if (opts.prePrHook) {
|
|
253
284
|
const p = registerPrePr(root, { dryRun });
|
|
254
285
|
if (p.status === 'no-config')
|
|
255
|
-
lines.push(`pre_pr: ${p.path} absent, bravos's gate not listed in guardlink's agent block (run guardlink init, then bravos
|
|
286
|
+
lines.push(`pre_pr: ${p.path} absent, bravos's gate not listed in guardlink's agent block (run guardlink init, then bravos setup --pre-pr-hook)`);
|
|
256
287
|
else if (p.status === 'already-registered')
|
|
257
288
|
lines.push(`pre_pr: ${p.path} already lists bravos's gate`);
|
|
258
289
|
else {
|
|
@@ -275,7 +306,7 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
275
306
|
}
|
|
276
307
|
const { selected, deferred } = selectServers(io.env);
|
|
277
308
|
// opencode lists skills only through its skill tool and runs no hooks: commands, a plugin and MCP.
|
|
278
|
-
const oc = explicit && !forceOpencode ? { status: 'absent' } : writeOpencode(root, io.env, selected, { force: opts.force, dryRun, skillsDir: io.skillsDir, always: forceOpencode });
|
|
309
|
+
const oc = explicit && !forceOpencode ? { status: 'absent' } : writeOpencode(root, io.env, opts.refreshOnly ? {} : selected, { force: opts.force, dryRun, skillsDir: io.skillsDir, always: forceOpencode });
|
|
279
310
|
if (oc.status === 'done') {
|
|
280
311
|
lines.push(`opencode: ${oc.written.length} written, ${oc.unchanged.length} unchanged, ${oc.skipped.length} skipped (plugin, /bravos commands)${oc.mcpAdded.length ? `; ${OPENCODE_CONFIG} mcp added ${oc.mcpAdded.join(', ')}` : ''}${oc.mcpUpdated?.length ? `; ${OPENCODE_CONFIG} mcp refreshed ${oc.mcpUpdated.join(', ')}` : ''}`);
|
|
281
312
|
for (const s of oc.skipped)
|
|
@@ -283,9 +314,9 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
283
314
|
}
|
|
284
315
|
const mcpLine = (m) => lines.push(`MCP: ${m.path} added ${names(m.added)}; kept ${names(m.kept)}${m.updated?.length ? `; refreshed ${names(m.updated)} (it pointed at another bravos install or graph store)` : ''}`);
|
|
285
316
|
if (!explicit || harnesses.includes('claude'))
|
|
286
|
-
mcpLine(mergeMcpJson(root, selected, { dryRun }));
|
|
317
|
+
mcpLine(mergeMcpJson(root, selected, { dryRun, onlyExisting: opts.refreshOnly }));
|
|
287
318
|
if (codex)
|
|
288
|
-
mcpLine(mergeCodexConfig(root, selected, { dryRun }));
|
|
319
|
+
mcpLine(mergeCodexConfig(root, selected, { dryRun, onlyExisting: opts.refreshOnly }));
|
|
289
320
|
if (deferred.length) {
|
|
290
321
|
const tools = runDoctor(root, io.env).tools;
|
|
291
322
|
const bin = { cxg: 'cxg', codegraph: 'codegraph-mcp' };
|
|
@@ -306,7 +337,7 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
306
337
|
// A plain sync leaves workflows alone, but says when the installed ones are older than this bravos.
|
|
307
338
|
const stale = writeWorkflows(root, { dryRun: true, installedOnly: true }).updated;
|
|
308
339
|
if (stale.length)
|
|
309
|
-
lines.push(`Workflows: ${stale.length} bravos workflow(s) are older than this bravos (${stale.join(', ')}); run bravos
|
|
340
|
+
lines.push(`Workflows: ${stale.length} bravos workflow(s) are older than this bravos (${stale.join(', ')}); run bravos setup --ci to refresh them.`);
|
|
310
341
|
}
|
|
311
342
|
const cursorWritten = cursor.status === 'written' || cursor.status === 'updated' ? [cursor.path] : [];
|
|
312
343
|
const ompWritten = omp.status === 'written' || omp.status === 'updated' ? [omp.path] : [];
|
|
@@ -326,7 +357,7 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
326
357
|
// A user-level install of another version silently replaces these skills in Claude Code, so a
|
|
327
358
|
// repo sync brings an existing one up to date too (never creates one; a dry run only reports;
|
|
328
359
|
// BRAVOS_SYNC_GLOBAL=off keeps the two separate).
|
|
329
|
-
// @comment -- "When the person already has a user-level install (bravos
|
|
360
|
+
// @comment -- "When the person already has a user-level install (bravos setup --global) of another version, a repo sync re-applies it through installGlobal, so an older ~/.claude/skills copy never shadows the repo's; it never creates a user-level install, and BRAVOS_SYNC_GLOBAL=off opts out."
|
|
330
361
|
let userVersion = null;
|
|
331
362
|
try {
|
|
332
363
|
userVersion = JSON.parse(readFileSync(pathJoin(homeOf(io.env), '.bravos', 'skills.lock'), 'utf8'))?.bravos_version ?? null;
|
|
@@ -337,13 +368,16 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
337
368
|
if (userVersion && userVersion !== version() && resolve(homeOf(io.env)) !== resolve(root)) {
|
|
338
369
|
if (dryRun)
|
|
339
370
|
lines.push(`user-level bravos is ${userVersion}: a real sync would bring it to ${version()} too`);
|
|
371
|
+
// Upkeep writes inside the repository only: the person's own folders are theirs to update.
|
|
372
|
+
else if (opts.refreshOnly)
|
|
373
|
+
lines.push(`note: your user-level bravos (~/.claude/skills) is ${userVersion}, not ${version()}; upkeep left it alone. In your own terminal run: bravos setup --global`);
|
|
340
374
|
else if (io.env.BRAVOS_SYNC_GLOBAL === 'off') {
|
|
341
|
-
lines.push(`warning: your user-level bravos (~/.claude/skills) is ${userVersion}; Claude Code prefers it over this repo's ${version()}. Run: bravos
|
|
375
|
+
lines.push(`warning: your user-level bravos (~/.claude/skills) is ${userVersion}; Claude Code prefers it over this repo's ${version()}. Run: bravos setup --global`);
|
|
342
376
|
}
|
|
343
377
|
else if (io.env.CLAUDECODE) {
|
|
344
378
|
// Inside a Claude Code session, writes under ~/.claude can be held back by its sandbox while the
|
|
345
379
|
// lock in ~/.bravos still lands, which would mark a stale copy current. Leave the user install alone.
|
|
346
|
-
lines.push(`warning: your user-level bravos is ${userVersion}, older than ${version()}; this runs inside a Claude Code session, which may not write ~/.claude, so it was left alone. In your own terminal run: bravos
|
|
380
|
+
lines.push(`warning: your user-level bravos is ${userVersion}, older than ${version()}; this runs inside a Claude Code session, which may not write ~/.claude, so it was left alone. In your own terminal run: bravos setup --global`);
|
|
347
381
|
}
|
|
348
382
|
else {
|
|
349
383
|
try {
|
|
@@ -351,18 +385,22 @@ function pipeline(root, io, opts, withGuardlink, lines) {
|
|
|
351
385
|
installGlobal(io.env, sub, { skillsDir: io.skillsDir, hooksDir: io.hooksDir });
|
|
352
386
|
const skipped = sub.filter((l) => l.startsWith(' skipped'));
|
|
353
387
|
if (skipped.length) {
|
|
354
|
-
lines.push(`warning: user-level bravos only partly updated; ${skipped.length} file(s) were not written. Run: bravos
|
|
388
|
+
lines.push(`warning: user-level bravos only partly updated; ${skipped.length} file(s) were not written. Run: bravos setup --global`);
|
|
355
389
|
lines.push(...skipped);
|
|
356
390
|
}
|
|
357
391
|
else
|
|
358
392
|
lines.push(`user-level bravos updated ${userVersion} → ${version()} (~/.claude/skills, ~/.bravos/hooks), so Claude Code does not use an older copy. BRAVOS_SYNC_GLOBAL=off keeps them separate.`);
|
|
359
393
|
}
|
|
360
394
|
catch (e) {
|
|
361
|
-
lines.push(`warning: could not update your user-level bravos (${e instanceof Error ? e.message : String(e)}). Run: bravos
|
|
395
|
+
lines.push(`warning: could not update your user-level bravos (${e instanceof Error ? e.message : String(e)}). Run: bravos setup --global`);
|
|
362
396
|
}
|
|
363
397
|
}
|
|
364
398
|
}
|
|
365
|
-
|
|
399
|
+
// @comment -- "A first install, by any route, leaves the hand-off: the next session of an agent that runs the session hook begins the context step by itself. Not for a re-apply, a dry run, a workspace member, or agents that run no hook."
|
|
400
|
+
const handed = withGuardlink && !hadLock && !dryRun && opts.handoff !== false && (hookHarnesses.length > 0 || agy) && leaveHandoff(root, io.env);
|
|
401
|
+
lines.push(handed
|
|
402
|
+
? 'Next: open a session and say anything. Bravos begins by learning what the app is for, then maps the threats in your code.'
|
|
403
|
+
: 'Next: open a session. The banner and briefing load by themselves; /bravos is only for the next step.');
|
|
366
404
|
}
|
|
367
405
|
// @comment -- "Builds the commander program (init, sync, doctor); exit-code mapping lives in run()."
|
|
368
406
|
export function buildProgram(io, result) {
|
|
@@ -418,52 +456,44 @@ export function buildProgram(io, result) {
|
|
|
418
456
|
for (const l of lines)
|
|
419
457
|
io.stdout(l);
|
|
420
458
|
};
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
.option('--agent <list>', 'comma-separated agents: claude,codex,agy,opencode,omp, or all', parseAgents)
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
459
|
+
// Registered first so it leads the command list in help; its options and action are attached below, once the parts it dispatches to exist.
|
|
460
|
+
const setupCommand = program.command('setup [dir]');
|
|
461
|
+
// @comment -- "The options that set Bravos up in a repository, defined once: bravos setup takes them, and so do the older init and sync, which stay registered but hidden from help so scripts, the website's setup skill and 1.8 briefings that name them keep working unchanged."
|
|
462
|
+
const repositoryOptions = (cmd, o) => {
|
|
463
|
+
cmd.option('--agent <list>', 'comma-separated agents: claude,codex,agy,opencode,omp, or all', parseAgents);
|
|
464
|
+
if (o.guardlink) {
|
|
465
|
+
cmd.addOption(new Option('--guardlink-mode <mode>', 'guardlink annotation mode (default: GuardLink chooses)').choices(['inline', 'external']));
|
|
466
|
+
cmd.option('--no-guardlink-init', 'do not run guardlink init');
|
|
467
|
+
}
|
|
468
|
+
return cmd
|
|
469
|
+
.option('--force', 'overwrite edited or authored skill files')
|
|
470
|
+
.option('--pre-pr-hook', 'also register the PreToolUse gate that checks gh pr create / gh pr ready')
|
|
471
|
+
.option('--ci', 'also write the PR gate and nightly GitHub Actions workflows into .github/workflows/')
|
|
472
|
+
.option('--workflows <list>', `which workflows --ci writes: ${WORKFLOW_NAMES.join(',')} (implies --ci)`, parseWorkflows)
|
|
473
|
+
.addOption(new Option('--schedule <cadence>', 'how often the nightly workflow runs (implies --ci)').choices(CADENCES))
|
|
474
|
+
.option('--scope', 'also write the loopback-only cxg scope starter to .guardlink/scope.yaml when absent')
|
|
475
|
+
.option('--link-skills', 'make .agents/skills a link to .claude/skills so each skill exists once')
|
|
476
|
+
.option('--global', 'install for your user (home folder) instead of a repository')
|
|
477
|
+
.option('--autopilot', 'end-of-turn check plus the pre-PR gate, so upkeep happens without being asked')
|
|
478
|
+
.option('--dry-run', 'report what would change without writing')
|
|
479
|
+
.addOption(new Option('--no-handoff', 'do not leave the marker that makes the next agent session begin by itself').hideHelp());
|
|
480
|
+
};
|
|
481
|
+
// @comment -- "The repository part: the licence gate for the paid flags first, then the user-level install for --global, else the install pipeline. `first` is true for a first install (it runs guardlink init); the refusal names the command the person typed."
|
|
482
|
+
const repositoryAction = async (name, dir, opts, first, lines) => {
|
|
483
|
+
await gateInstallFlags(opts, name);
|
|
440
484
|
if (opts.global)
|
|
441
485
|
installGlobal(io.env, lines, { force: opts.force, dryRun: opts.dryRun, skillsDir: io.skillsDir, hooksDir: io.hooksDir });
|
|
442
486
|
else
|
|
443
|
-
pipeline(dirArg(dir), io, opts,
|
|
444
|
-
}
|
|
445
|
-
program
|
|
446
|
-
.command('
|
|
487
|
+
pipeline(dirArg(dir), io, opts, first, lines);
|
|
488
|
+
};
|
|
489
|
+
repositoryOptions(program
|
|
490
|
+
.command('init [dir]', { hidden: true })
|
|
491
|
+
.description('First install: detect agents, run guardlink init if needed, install skills, hooks and MCP wiring.')
|
|
492
|
+
.addHelpText('after', INIT_HELP), { guardlink: true }).action((dir, opts) => guardedAsync((lines) => repositoryAction('init', dir, opts, true, lines)));
|
|
493
|
+
repositoryOptions(program
|
|
494
|
+
.command('sync [dir]', { hidden: true })
|
|
447
495
|
.description('Re-apply the installed bravos version to a repository (never runs guardlink init).')
|
|
448
|
-
.addHelpText('after', SYNC_HELP)
|
|
449
|
-
.option('--agent <list>', 'comma-separated agents: claude,codex,agy,opencode,omp, or all', parseAgents)
|
|
450
|
-
.option('--force', 'overwrite edited or authored skill files')
|
|
451
|
-
.option('--pre-pr-hook', 'also register the PreToolUse gate that checks gh pr create / gh pr ready')
|
|
452
|
-
.option('--ci', 'also write the PR gate and nightly GitHub Actions workflows into .github/workflows/')
|
|
453
|
-
.option('--workflows <list>', `which workflows --ci writes: ${WORKFLOW_NAMES.join(',')} (implies --ci)`, parseWorkflows)
|
|
454
|
-
.addOption(new Option('--schedule <cadence>', 'how often the nightly workflow runs (implies --ci)').choices(CADENCES))
|
|
455
|
-
.option('--scope', 'also write the loopback-only cxg scope starter to .guardlink/scope.yaml when absent')
|
|
456
|
-
.option('--link-skills', 'make .agents/skills a link to .claude/skills so each skill exists once')
|
|
457
|
-
.option('--global', 'install for your user (home folder) instead of a repository')
|
|
458
|
-
.option('--autopilot', 'end-of-turn check plus the pre-PR gate, so upkeep happens without being asked')
|
|
459
|
-
.option('--dry-run', 'report what would change without writing')
|
|
460
|
-
.action((dir, opts) => guardedAsync(async (lines) => {
|
|
461
|
-
await gateInstallFlags(opts, 'sync');
|
|
462
|
-
if (opts.global)
|
|
463
|
-
installGlobal(io.env, lines, { force: opts.force, dryRun: opts.dryRun, skillsDir: io.skillsDir, hooksDir: io.hooksDir });
|
|
464
|
-
else
|
|
465
|
-
pipeline(dirArg(dir), io, opts, false, lines);
|
|
466
|
-
}));
|
|
496
|
+
.addHelpText('after', SYNC_HELP), { guardlink: false }).action((dir, opts) => guardedAsync((lines) => repositoryAction('sync', dir, opts, false, lines)));
|
|
467
497
|
program
|
|
468
498
|
.command('licence')
|
|
469
499
|
.alias('license')
|
|
@@ -518,24 +548,6 @@ export function buildProgram(io, result) {
|
|
|
518
548
|
else
|
|
519
549
|
throw new BravosError(`unknown account action ${JSON.stringify(action)}: activate, import <file>, status, refresh, devices, revoke <id> or logout`);
|
|
520
550
|
}));
|
|
521
|
-
program
|
|
522
|
-
.command('setup')
|
|
523
|
-
.description('Put the binaries bravos drives on this machine: the analyzer (bravos-cli, SAST) and the code graph (codegraph-build, codegraph-mcp) are licensed bundles fetched through the account portal, verified and staged under $BRAVOS_HOME; --tools adds guardlink and cxg through npm and cargo.')
|
|
524
|
-
.option('--analyzer', 'only the analyzer bundle')
|
|
525
|
-
.option('--codegraph', 'only the code graph bundle')
|
|
526
|
-
.option('--tools', 'also guardlink (npm) and cxg (cargo); needs -y')
|
|
527
|
-
.option('--check', 'report what is here and what setup would do; changes nothing')
|
|
528
|
-
.option('--dry-run', 'say what would be fetched or run; changes nothing')
|
|
529
|
-
.option('-y, --yes', 'run the package-manager installs, and refetch a bundle that is already staged')
|
|
530
|
-
.option('--json', 'with --check: print the plan as JSON (bravos.setup-plan/v1)')
|
|
531
|
-
.action((opts) => guardedAsync(async (lines) => {
|
|
532
|
-
if (opts.check && opts.json) {
|
|
533
|
-
const p = await setupPlan(io.env);
|
|
534
|
-
lines.push(JSON.stringify({ schema: 'bravos.setup-plan/v1', plan: p.licence.licensed ? 'licensed' : p.licence.state, items: p.items }, null, 2));
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
lines.push(...(await runSetup(io.env, opts, { echo: io.stdout })));
|
|
538
|
-
}));
|
|
539
551
|
program
|
|
540
552
|
.command('graph [question] [args...]')
|
|
541
553
|
.description('Ask the code graph (Team plan): `graph build [DIR] [--scip MODE]` indexes a repository; `graph <question> [args] --json` asks it (attack-surface, entry-points, callers <file::symbol>, reachable-sinks, call-chain, …; the same answers as the codegraph_ MCP tools); `graph mcp` serves those tools over MCP on stdio (what .mcp.json registers); `graph --json` lists every question this machine\'s binary answers.')
|
|
@@ -612,22 +624,17 @@ export function buildProgram(io, result) {
|
|
|
612
624
|
io.stderr(r.stderr.replace(/\n$/, ''));
|
|
613
625
|
result.code = r.status ?? 1;
|
|
614
626
|
}));
|
|
615
|
-
// @comment -- "bravos
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
.description('Guided first-run setup: licence, tools, repository, agents, PR checks, schedule and testing permission, one question at a time. Nothing changes until you confirm.')
|
|
619
|
-
.option('--again', 'ask again, with your previous answers selected')
|
|
620
|
-
.option('-y, --yes', 'no questions: take every default (testing permission stays unrecorded)')
|
|
621
|
-
.addOption(new Option('--preset <name>', 'starting point').choices(['annotate', 'pr', 'everything']))
|
|
622
|
-
.action((dir, opts) => guardedAsync(async () => {
|
|
627
|
+
// @comment -- "bravos setup: the guided first run (src/start). Interactive in a terminal; --yes takes every default and never invents what a person must answer. It installs through these same commands, run in-process."
|
|
628
|
+
// @comment -- "The guided setup (and its unattended --yes form), shared by bravos setup and the older bravos start: builds what the wizard needs (a prompter for a terminal or a scripted one, this CLI run in-process and as a child, the licence, the clipboard) and runs it. Without a terminal and without --yes it refuses, naming the command that was typed."
|
|
629
|
+
const wizardAction = async (name, dir, opts) => {
|
|
623
630
|
const { runStart } = await import('./start/index.js');
|
|
624
631
|
const ui = await import('./start/ui.js');
|
|
625
632
|
const { plan: startPlan } = await import('./setup.js');
|
|
626
633
|
const { licenceStatus } = await import('./licence.js');
|
|
627
634
|
const { bravosHome } = await import('./palette.js');
|
|
628
|
-
const interactive = !opts.yes &&
|
|
635
|
+
const interactive = !opts.yes && isTerminal(io);
|
|
629
636
|
if (!opts.yes && !interactive)
|
|
630
|
-
throw new BravosError(
|
|
637
|
+
throw new BravosError(`bravos ${name} asks questions, so it needs a terminal. In a script use: bravos ${name} --yes --preset pr <dir>`);
|
|
631
638
|
const prompter = interactive ? ui.terminalPrompter() : ui.scriptedPrompter({}, io.stdout);
|
|
632
639
|
const capture = async (argv) => {
|
|
633
640
|
const out = [];
|
|
@@ -635,7 +642,7 @@ export function buildProgram(io, result) {
|
|
|
635
642
|
const code = await run(argv, { ...io, stdout: (x) => out.push(x), stderr: (x) => err.push(x) });
|
|
636
643
|
return { code, out, err };
|
|
637
644
|
};
|
|
638
|
-
result.code = await runStart({ dir, again: opts.again, yes: opts.yes, preset: opts.preset }, {
|
|
645
|
+
result.code = await runStart({ dir, again: opts.again, yes: opts.yes, preset: opts.preset, command: name }, {
|
|
639
646
|
prompter,
|
|
640
647
|
env: io.env,
|
|
641
648
|
cwd: process.cwd(),
|
|
@@ -672,6 +679,93 @@ export function buildProgram(io, result) {
|
|
|
672
679
|
},
|
|
673
680
|
today: () => new Date().toISOString().slice(0, 10),
|
|
674
681
|
});
|
|
682
|
+
};
|
|
683
|
+
program
|
|
684
|
+
.command('start [dir]', { hidden: true })
|
|
685
|
+
.description('Guided first-run setup: licence, tools, repository, agents, PR checks, schedule and testing permission, one question at a time. Nothing changes until you confirm.')
|
|
686
|
+
.option('--again', 'ask again, with your previous answers selected')
|
|
687
|
+
.option('-y, --yes', 'no questions: take every default (testing permission stays unrecorded)')
|
|
688
|
+
.addOption(new Option('--preset <name>', 'starting point').choices(['annotate', 'pr', 'everything']))
|
|
689
|
+
.action((dir, opts) => guardedAsync(() => wizardAction('start', dir, opts)));
|
|
690
|
+
// @comment -- "Upkeep: what a plain bravos setup does where nobody can be asked (an agent's shell, a script, a pipe). It brings what is already installed up to date and nothing more. The repository's Bravos files are re-applied only where Bravos is installed and this bravos is not the older side, and only for the agents the repository already has (refreshOnly). Bravos's own signed bundles are fetched only when they are behind the version this bravos pins. It never installs Bravos into a repository, never runs the guardlink and cxg installers, never writes to the person's own folders, and it exits 0 with a line for everything it left to a person, so a session briefing can tell an agent to run it without asking."
|
|
691
|
+
const upkeepAction = async (root, dryRun, lines) => {
|
|
692
|
+
const { gatherUpkeep } = await import('./upkeep.js');
|
|
693
|
+
const u = await gatherUpkeep(root, io.env);
|
|
694
|
+
lines.push('bravos setup: no terminal here, so this is upkeep only: nothing is asked and nothing new is installed. In a terminal, bravos setup is the guided setup.');
|
|
695
|
+
if (u.repo === null)
|
|
696
|
+
lines.push(`repository: Bravos is not set up in ${root}; nothing was changed. A person sets it up: bravos setup in a terminal, or bravos setup --yes ${JSON.stringify(root)}`);
|
|
697
|
+
else if (u.sync.files === 0)
|
|
698
|
+
lines.push(`repository: up to date with bravos ${u.cli}`);
|
|
699
|
+
else if (u.sync.direction === 'repo-newer')
|
|
700
|
+
lines.push(`repository: its Bravos files are from ${u.repo}, newer than this bravos (${u.cli}); nothing was changed, because an older bravos would roll them back. Update bravos: npm install -g @bugb-technologies/bravos@latest`);
|
|
701
|
+
else {
|
|
702
|
+
lines.push(`repository: ${u.sync.files} file${u.sync.files === 1 ? '' : 's'} behind bravos ${u.cli}${dryRun ? ' would be' : ''} brought up to date`);
|
|
703
|
+
const sub = [];
|
|
704
|
+
pipeline(root, io, { refreshOnly: true, dryRun }, false, sub);
|
|
705
|
+
// The pipeline's own closing line is for a person after a first install; everything else it said is the record of what changed.
|
|
706
|
+
lines.push(...sub.filter((l) => !l.startsWith('Next: open a session')).map((l) => ` ${l}`));
|
|
707
|
+
}
|
|
708
|
+
for (const b of u.bundles) {
|
|
709
|
+
lines.push(...(await runSetup(io.env, { [b.id]: true, dryRun }, { echo: io.stdout })));
|
|
710
|
+
}
|
|
711
|
+
// Absent pieces are named, never fetched here: a first install is a person's go-ahead.
|
|
712
|
+
const plan = await setupPlan(io.env);
|
|
713
|
+
for (const item of plan.items) {
|
|
714
|
+
if (item.present)
|
|
715
|
+
continue;
|
|
716
|
+
if (item.id === 'analyzer' || item.id === 'codegraph') {
|
|
717
|
+
if (item.licensed)
|
|
718
|
+
lines.push(`${item.id}: not installed; left for a person's go-ahead: bravos setup --${item.id}`);
|
|
719
|
+
}
|
|
720
|
+
else
|
|
721
|
+
lines.push(`${item.id}: not installed; left for a person's go-ahead: bravos setup --tools -y`);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
// @comment -- "bravos setup: the one command. It looks at what was typed and whether there is a terminal (src/setup-route.ts) and does one job: the read-only check, the machine part, the user-level install, the repository part by flags, an unattended first setup, the guided wizard, or upkeep. It is declared after the wizard and repository actions it dispatches to."
|
|
725
|
+
const SETUP_FLAGS = 'bravos setup: --tools, --analyzer and --codegraph set up this machine; the other flags set up a repository. Run them as two commands, for example: bravos setup --tools -y, then bravos setup --agent claude';
|
|
726
|
+
repositoryOptions(setupCommand
|
|
727
|
+
.description('Set Bravos up, here and on this machine, doing only what is missing. In a terminal it is a guided setup: sign in, install the tools, then this repository\'s agents, PR checks and testing permission; in a repository that already has Bravos it only brings this machine and the repository up to date (--change re-asks the repository\'s choices). Without a terminal (an agent, a script) a plain bravos setup only brings what is already installed up to date. Flags do one part by hand: --tools, --analyzer, --codegraph for this machine; --agent, --autopilot, --ci and the rest for the repository; --yes for an unattended first setup; --check to look and change nothing.')
|
|
728
|
+
.option('--change', 'ask this repository\'s questions again, with the recorded answers selected')
|
|
729
|
+
.addOption(new Option('--again', 'the earlier name of --change').hideHelp())
|
|
730
|
+
.addOption(new Option('--preset <name>', 'starting point for the guided setup').choices(['annotate', 'pr', 'everything']))
|
|
731
|
+
.option('--analyzer', 'this machine: only the analyzer bundle')
|
|
732
|
+
.option('--codegraph', 'this machine: only the code graph bundle')
|
|
733
|
+
.option('--tools', 'this machine: guardlink (npm) and cxg (cargo); needs -y')
|
|
734
|
+
.option('--check', 'report what is here and what setup would do; changes nothing')
|
|
735
|
+
.option('-y, --yes', 'alone: no questions, set this repository up with the defaults (or join it). With --tools, --analyzer or --codegraph: run the installers, and fetch a staged bundle again')
|
|
736
|
+
.option('--json', 'with --check: print the plan as JSON (bravos.setup-plan/v1)'), { guardlink: true });
|
|
737
|
+
setupCommand.action((dir, opts) => guardedAsync(async (lines) => {
|
|
738
|
+
const given = new Set(Object.keys(opts).filter((k) => setupCommand.getOptionValueSource(k) === 'cli'));
|
|
739
|
+
if (given.has('again'))
|
|
740
|
+
given.add('change');
|
|
741
|
+
const route = setupRoute(given, isTerminal(io));
|
|
742
|
+
if (route === 'conflict')
|
|
743
|
+
throw new BravosError(SETUP_FLAGS);
|
|
744
|
+
if (route === 'needs-terminal')
|
|
745
|
+
throw new BravosError('bravos setup asks questions here, so it needs a terminal. Without one: bravos setup --yes [--preset pr] [dir]');
|
|
746
|
+
if (route === 'check' || route === 'machine') {
|
|
747
|
+
if (dir)
|
|
748
|
+
throw new BravosError(`bravos setup ${route === 'check' ? '--check' : '--tools, --analyzer and --codegraph'} is about this machine and takes no folder`);
|
|
749
|
+
if (route === 'check' && opts.json) {
|
|
750
|
+
const p = await setupPlan(io.env);
|
|
751
|
+
lines.push(JSON.stringify({ schema: 'bravos.setup-plan/v1', plan: p.licence.licensed ? 'licensed' : p.licence.state, items: p.items }, null, 2));
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
lines.push(...(await runSetup(io.env, { analyzer: opts.analyzer, codegraph: opts.codegraph, tools: opts.tools, check: opts.check, dryRun: opts.dryRun, yes: opts.yes }, { echo: io.stdout })));
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
if (route === 'upkeep') {
|
|
758
|
+
await upkeepAction(dirArg(dir), !!opts.dryRun, lines);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (route === 'global' || route === 'repository') {
|
|
762
|
+
// A repository that has Bravos is re-applied to (as sync did); one that does not gets a first install (as init did).
|
|
763
|
+
const first = !existsSync(join(dirArg(dir), LOCK_PATH));
|
|
764
|
+
await repositoryAction('setup', dir, opts, first, lines);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
// unattended or wizard
|
|
768
|
+
await wizardAction('setup', dir, { again: opts.change || opts.again, yes: route === 'unattended', preset: opts.preset });
|
|
675
769
|
}));
|
|
676
770
|
program
|
|
677
771
|
.command('doctor [dir]')
|
|
@@ -680,7 +774,7 @@ export function buildProgram(io, result) {
|
|
|
680
774
|
.action((dir) => guardedAsync(async (lines) => {
|
|
681
775
|
const L = await licenceLib();
|
|
682
776
|
const v = L.status(io.env);
|
|
683
|
-
lines.push(formatDoctor(withLicence(runDoctor(dirArg(dir), io.env), L.planLine(v), v.licensed)));
|
|
777
|
+
lines.push(formatDoctor(await withLegacySkills(withLicence(runDoctor(dirArg(dir), io.env), L.planLine(v), v.licensed), io.env)));
|
|
684
778
|
for (const name of ['guardlink', 'cxg'])
|
|
685
779
|
lines.push(formatProofTool(checkProofTool(name, io.env)));
|
|
686
780
|
}));
|
|
@@ -756,10 +850,10 @@ export function buildProgram(io, result) {
|
|
|
756
850
|
else
|
|
757
851
|
throw new BravosError(`unknown context action '${action}'; use add, update, list, check, gate or decline`);
|
|
758
852
|
}));
|
|
759
|
-
// @comment -- "bravos upkeep: what has fallen behind the installed bravos, here and on this machine: the repository's copies of the skills and hooks
|
|
853
|
+
// @comment -- "bravos upkeep: what has fallen behind the installed bravos, here and on this machine: the repository's copies of the skills and hooks, and staged bundles older than this version pins; bravos setup brings both up to date. Read-only, no network, free; the session hook asks it at every start so the agent can run those two commands itself."
|
|
760
854
|
program
|
|
761
855
|
.command('upkeep [dir]')
|
|
762
|
-
.description('Say what is behind the installed bravos: this repository\'s copies of the skills and hooks
|
|
856
|
+
.description('Say what is behind the installed bravos: this repository\'s copies of the skills and hooks, and staged bundles older than this version pins. bravos setup brings both up to date. Read-only; no network; free; runs no model.')
|
|
763
857
|
.option('--json', 'print bravos.upkeep/v1')
|
|
764
858
|
.action((dir, opts) => guardedAsync(async (lines) => {
|
|
765
859
|
const { gatherUpkeep, formatUpkeep } = await import('./upkeep.js');
|
|
@@ -885,7 +979,8 @@ export function buildProgram(io, result) {
|
|
|
885
979
|
lines.push(JSON.stringify(s, null, 2));
|
|
886
980
|
return;
|
|
887
981
|
}
|
|
888
|
-
|
|
982
|
+
// "Setup", not "bravos setup": that is the name of a command now.
|
|
983
|
+
lines.push(`Setup ${s.done}/${s.total} for ${inputs.repo}`);
|
|
889
984
|
// Which plan this machine is on, so the Team-plan steps below read as a choice and not a fault.
|
|
890
985
|
try {
|
|
891
986
|
if (inputs.licence?.state)
|
|
@@ -990,11 +1085,11 @@ export function buildProgram(io, result) {
|
|
|
990
1085
|
const ws = await import('./workspace.js');
|
|
991
1086
|
const env = io.env;
|
|
992
1087
|
const cwd = process.cwd();
|
|
993
|
-
// bravos
|
|
1088
|
+
// bravos setup (no bravos yet) or sync in one folder, in-process, summarised to one line.
|
|
994
1089
|
const install = async (path, appFolder = false) => {
|
|
995
1090
|
const out = [];
|
|
996
1091
|
const fresh = !appFolder && !existsSync(pathJoin(path, '.bravos', 'skills.lock'));
|
|
997
|
-
const code = await run([fresh ? 'init' : 'sync', path], { ...io, stdout: (s) => out.push(s), stderr: (s) => out.push(s) });
|
|
1092
|
+
const code = await run([fresh ? 'init' : 'sync', path, ...(fresh ? ['--no-handoff'] : [])], { ...io, stdout: (s) => out.push(s), stderr: (s) => out.push(s) });
|
|
998
1093
|
return `${code === 0 ? '✔' : '✘'} bravos ${fresh ? 'init' : 'sync'} ${path}${code === 0 ? '' : `: ${out.filter(Boolean).slice(-1)[0] ?? `exit ${code}`}`}`;
|
|
999
1094
|
};
|
|
1000
1095
|
const known = (name) => {
|
|
@@ -1292,7 +1387,7 @@ export async function run(argv, io = {}) {
|
|
|
1292
1387
|
const result = { code: 0 };
|
|
1293
1388
|
// @comment -- "Bare bravos in a repository bravos has not set up yet points at the guided setup first"
|
|
1294
1389
|
if (argv.length === 0 && !existsSync(join(process.cwd(), '.bravos')))
|
|
1295
|
-
full.stdout('New here? Run bravos
|
|
1390
|
+
full.stdout('New here? Run bravos setup: a guided setup, one question at a time.\n');
|
|
1296
1391
|
try {
|
|
1297
1392
|
await buildProgram(full, result).parseAsync(argv, { from: 'user' });
|
|
1298
1393
|
}
|
package/dist/context.js
CHANGED
|
@@ -362,7 +362,7 @@ export function installPrePush(root, env) {
|
|
|
362
362
|
mkdirSync(dir, { recursive: true });
|
|
363
363
|
writeFileSync(file, PRE_PUSH_SCRIPT, { mode: 0o755 });
|
|
364
364
|
chmodSync(file, 0o755);
|
|
365
|
-
return ['A pre-push check now runs in this clone: a push that changes the design documents is stopped if one carries a secret or a local path (teammates get it from bravos
|
|
365
|
+
return ['A pre-push check now runs in this clone: a push that changes the design documents is stopped if one carries a secret or a local path (teammates get it from bravos setup).'];
|
|
366
366
|
}
|
|
367
367
|
catch (e) {
|
|
368
368
|
return [`The pre-push check could not be installed (${e.message.split('\n')[0]}); bravos context check does the same by hand.`];
|