@cbartens/bkit 5.0.1 → 5.0.3

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.
Files changed (37) hide show
  1. package/.bkit/README.md +3 -3
  2. package/.bkit/core/.agents/rules.md +57 -57
  3. package/.bkit/core/.bkit/README.md +2 -2
  4. package/.bkit/core/.bkit/cloud.md +7 -6
  5. package/.bkit/core/.bkit/comparison.md +32 -27
  6. package/.bkit/core/.bkit/install.md +3 -3
  7. package/.bkit/core/.bkit/providers.md +6 -3
  8. package/.bkit/core/.bkit/templates.md +8 -5
  9. package/.bkit/core/.bkit/trackers.md +1 -1
  10. package/.bkit/core/engine/checks/after/github.ts +1 -1
  11. package/.bkit/core/engine/checks/after/index.ts +2 -2
  12. package/.bkit/core/engine/checks/before/env.ts +1 -1
  13. package/.bkit/core/engine/commands/install/uninstall.ts +33 -1
  14. package/.bkit/core/engine/install/cloud-env.ts +4 -1
  15. package/.bkit/core/engine/install/modules/cloud.ts +2 -2
  16. package/.bkit/core/engine/install/modules/opencode.ts +34 -13
  17. package/.bkit/core/engine/install/template-copies.ts +19 -1
  18. package/.bkit/shared/.bkit/.env.example +41 -12
  19. package/.bkit/shared/.claude/bkit-cloud.md +1 -1
  20. package/.bkit/shared/.cursor/bkit-cloud.md +2 -2
  21. package/.bkit/shared/.opencode/opencode.json +3 -1
  22. package/.bkit/shared/docs/deployments.md +6 -4
  23. package/.bkit/shared/docs/setup.md +11 -0
  24. package/.bkit/templates/.github/workflows/bkit-ci.yml +18 -2
  25. package/.bkit/templates/.github/workflows/bkit-renovate.yml +7 -5
  26. package/.bkit/templates/scripts/secrets/bkit-secrets.mjs +125 -12
  27. package/CHANGELOG.md +34 -0
  28. package/README.md +94 -35
  29. package/dist/checks/after/github.js +1 -1
  30. package/dist/checks/after/index.js +2 -2
  31. package/dist/checks/before/env.js +1 -1
  32. package/dist/commands/install/uninstall.js +21 -1
  33. package/dist/install/cloud-env.js +4 -1
  34. package/dist/install/modules/cloud.js +2 -2
  35. package/dist/install/modules/opencode.js +34 -14
  36. package/dist/install/template-copies.js +16 -1
  37. package/package.json +24 -2
@@ -212,10 +212,11 @@ const OPENCODE_PROVIDER_BASE_URL_SENTINEL = "@@OPENCODE_PROVIDER_BASE_URL@@";
212
212
  * Resolves the @@OPENCODE_TRACKER_MCP@@ sentinel into the correct mcpServers entry
213
213
  * and fills in provider-specific fields.
214
214
  *
215
- * Also injects `curl *{domain}*` / `wget *{domain}*` **allow** rules (after the
216
- * template's `curl *` / `wget *` ask) for {@link resolveNetworkAllowlist} so
217
- * context-fetch / provider hosts do not prompt (OpenCode bash is last-match-wins), and
218
- * `<server>_*` allows for the consumer's `mcp-servers` block.
215
+ * Also injects derived **allow** rules for {@link resolveNetworkAllowlist} so
216
+ * context-fetch / provider hosts do not prompt on either fetch surface: `curl *{domain}*` /
217
+ * `wget *{domain}*` after the template's `curl *` / `wget *` ask (OpenCode bash is
218
+ * last-match-wins), and `*{domain}*` into the `permission.webfetch` URL map (after its
219
+ * `"*": "ask"`). Adds `<server>_*` allows for the consumer's `mcp-servers` block.
219
220
  */
220
221
  export function renderOpencodeJson(templatePath, tracker, provider, cwd = process.cwd()) {
221
222
  const raw = fs.readFileSync(templatePath, "utf-8");
@@ -229,10 +230,14 @@ export function renderOpencodeJson(templatePath, tracker, provider, cwd = proces
229
230
  // opencode's MCP schema differs from Claude/Cursor: remote servers use type "remote"
230
231
  // (NOT "http" — not in opencode's enum, which makes the whole config invalid) and read
231
232
  // secrets via {env:VAR} (NOT shell ${VAR}). See https://opencode.ai/config.json.
233
+ // github: "oauth": false disables opencode's automatic OAuth. api.githubcopilot.com/mcp/
234
+ // authenticates via the Authorization header and has no OAuth DCR, so a stale/empty
235
+ // {env:BKIT_GH_TOKEN} would otherwise surface as a "sign in" prompt whose flow fails with
236
+ // "dynamic auth not supported" instead of a clear 401. See opencode.ai/docs/mcp-servers.
232
237
  let mcpEntry;
233
238
  if (tracker === "github") {
234
239
  mcpEntry =
235
- '"github": { "type": "remote", "url": "https://api.githubcopilot.com/mcp/", "headers": { "Authorization": "Bearer {env:BKIT_GH_TOKEN}", "X-MCP-Toolsets": "context,issues,pull_requests,repos,users,projects" } }';
240
+ '"github": { "type": "remote", "url": "https://api.githubcopilot.com/mcp/", "oauth": false, "headers": { "Authorization": "Bearer {env:BKIT_GH_TOKEN}", "X-MCP-Toolsets": "context,issues,pull_requests,repos,users,projects" } }';
236
241
  }
237
242
  else if (tracker === "linear") {
238
243
  mcpEntry = '"linear": { "type": "remote", "url": "https://mcp.linear.app/mcp" }';
@@ -287,9 +292,16 @@ export function renderOpencodeJson(templatePath, tracker, provider, cwd = proces
287
292
  }
288
293
  }
289
294
  /**
290
- * Append curl/wget domain allows after template ask rules (OpenCode last-match-wins),
291
- * and one `<server>_*` allow per declared MCP server — opencode names MCP tools
292
- * `<server>_<tool>` and matches permission keys as globs against the tool name.
295
+ * Append derived allows for the consumer's resolved network allowlist (OpenCode
296
+ * last-match-wins), and one `<server>_*` allow per declared MCP server — opencode names
297
+ * MCP tools `<server>_<tool>` and matches permission keys as globs against the tool name.
298
+ *
299
+ * The allowlist is applied to BOTH fetch surfaces, so an allowlisted host does not prompt
300
+ * whichever path the agent takes:
301
+ * - fetch tool — `permission.webfetch` is a URL-keyed map (`{ "*": "ask" }` from the
302
+ * template); opencode matches the resource against the URL, so `*{base}*` allows it;
303
+ * - shell fetch — `permission.bash` gains `curl *{base}*` / `wget *{base}*` after the
304
+ * template's `curl *` / `wget *` ask.
293
305
  */
294
306
  function injectOpencodeDerivedAllows(parsed, cwd) {
295
307
  const permission = parsed.permission;
@@ -298,12 +310,20 @@ function injectOpencodeDerivedAllows(parsed, cwd) {
298
310
  for (const server of extractMcpServers(cwd)) {
299
311
  permission[`${server}_*`] = "allow";
300
312
  }
301
- if (typeof permission.bash !== "object" || permission.bash === null)
302
- return;
303
- const bash = permission.bash;
304
- for (const base of networkAllowlistBases(resolveNetworkAllowlist(cwd))) {
305
- bash[`curl *${base}*`] = "allow";
306
- bash[`wget *${base}*`] = "allow";
313
+ const bases = networkAllowlistBases(resolveNetworkAllowlist(cwd));
314
+ if (typeof permission.bash === "object" && permission.bash !== null) {
315
+ const bash = permission.bash;
316
+ for (const base of bases) {
317
+ bash[`curl *${base}*`] = "allow";
318
+ bash[`wget *${base}*`] = "allow";
319
+ }
320
+ }
321
+ // Fetch tool — opencode matches the webfetch resource against the requested URL.
322
+ if (typeof permission.webfetch === "object" && permission.webfetch !== null) {
323
+ const webfetch = permission.webfetch;
324
+ for (const base of bases) {
325
+ webfetch[`*${base}*`] = "allow";
326
+ }
307
327
  }
308
328
  }
309
329
  /**
@@ -86,13 +86,28 @@ function pruneEmptyDirs(root) {
86
86
  }
87
87
  /** One-line pointer to the template docs, shared by the install and upgrade messages. */
88
88
  export const TEMPLATES_POINTER = "Templates (adopt, do not skip): read .bkit/templates.md; bkit never applies templates, so adopt each copy in .bkit/templates/ unless adoption would break existing functionality — state which you did not adopt and why. (If your own gates scan the repo, ignore .bkit/templates/.)";
89
+ /**
90
+ * Changed templates whose ADOPTED copy also backs a gate: the consequence of leaving it
91
+ * stale, keyed by template rel path. The upgrade line names it so the consequence reaches
92
+ * the same run that changed the copy — a stale adopted copy can redden a gate that a
93
+ * bkit-installed file trips, and the agent at that gate never sees this report.
94
+ */
95
+ export const TEMPLATE_CHANGE_CONSEQUENCES = {
96
+ "slop-scan.config.json": "your adopted copy's guardrails exemptions are now stale; your slop gate may go red",
97
+ };
98
+ /** ` changed: <dest>`, plus the consequence when that template's adopted copy backs a gate. */
99
+ function formatChangedLine(rel) {
100
+ const line = ` changed: ${path.join(TEMPLATE_COPIES_DIR, rel)}`;
101
+ const note = TEMPLATE_CHANGE_CONSEQUENCES[rel];
102
+ return note === undefined ? line : `${line} — ${note}`;
103
+ }
89
104
  /**
90
105
  * The upgrade report for a template sync: one line per changed, added or removed
91
106
  * template, then where to read about adopting them. Empty when nothing changed.
92
107
  */
93
108
  export function formatTemplateChanges(changes) {
94
109
  const lines = [
95
- ...changes.changed.map((p) => ` changed: ${path.join(TEMPLATE_COPIES_DIR, p)}`),
110
+ ...changes.changed.map(formatChangedLine),
96
111
  ...changes.added.map((p) => ` added: ${path.join(TEMPLATE_COPIES_DIR, p)}`),
97
112
  ...changes.removed.map((p) => ` removed: ${path.join(TEMPLATE_COPIES_DIR, p)}`),
98
113
  ];
package/package.json CHANGED
@@ -1,8 +1,30 @@
1
1
  {
2
2
  "name": "@cbartens/bkit",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "private": false,
5
- "description": "Agent-stack consolidation CLI.",
5
+ "description": "From vibe coding to production code. A senior engineering team's process, ready-made: AI agents design, plan, build, review, fix and ship your features on Claude Code, Cursor, Codex and opencode.",
6
+ "keywords": [
7
+ "ai-agents",
8
+ "agentic-coding",
9
+ "agentic-workflow",
10
+ "multi-agent",
11
+ "vibe-coding",
12
+ "claude-code",
13
+ "cursor",
14
+ "codex",
15
+ "opencode",
16
+ "ai-code-review",
17
+ "code-review",
18
+ "developer-tools",
19
+ "workflow-automation",
20
+ "ci-cd",
21
+ "github-actions",
22
+ "linear",
23
+ "llm",
24
+ "cli"
25
+ ],
26
+ "homepage": "https://github.com/cbartens/bkit#readme",
27
+ "bugs": "https://github.com/cbartens/bkit/issues",
6
28
  "type": "module",
7
29
  "bin": {
8
30
  "bkit": "./dist/cli.js"