@bakers-build/addon-claude 0.6.1-next.2 → 0.6.1-next.4

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.
@@ -22,7 +22,7 @@ export declare class ClaudeAgent implements BbAgent {
22
22
  private readonly args;
23
23
  private readonly model;
24
24
  private readonly effort;
25
- private readonly securityFlags;
25
+ private readonly security;
26
26
  /** The sandbox's own MCP servers, strict; undefined outside the sandbox. */
27
27
  private readonly sandboxMcpServers;
28
28
  private readonly securityMode;
@@ -32,7 +32,7 @@ export declare class ClaudeAgent implements BbAgent {
32
32
  constructor(options?: ClaudeAgentOptions, home?: string);
33
33
  /** A measured run stays without the conductor's tools, MCP or bridge. */
34
34
  get withoutConductorTools(): boolean;
35
- launchCommand(prompt: string, run?: AgentRunIdentity, _workspacePath?: string, tools?: {
35
+ launchCommand(prompt: string, run?: AgentRunIdentity, workspacePath?: string, tools?: {
36
36
  url: string;
37
37
  }): string;
38
38
  /**
package/dist/src/index.js CHANGED
@@ -3,7 +3,7 @@ import { homedir } from 'node:os';
3
3
  import { join } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { CONDUCTOR_TOKEN_ENV, CONDUCTOR_TOOLS_SERVER, installCommand, lastLine, resolveAgentCliOptions, resolveSecurityOptions, systemSandboxHost, validateOptionalBoolean, } from '@bakers-build/conductor/contract';
6
- import { shellQuote } from '@bakers-build/core';
6
+ import { gitSandboxPaths, shellQuote, withoutGitDirs, } from '@bakers-build/core';
7
7
  import { parseClaudeTranscript } from './footprint.js';
8
8
  export { parseClaudeTranscript } from './footprint.js';
9
9
  /** src/index.ts and dist/src/index.js both sit two levels below the package root. */
@@ -25,13 +25,17 @@ const SANDBOX_DEFAULTS = {
25
25
  mcp_servers: {},
26
26
  };
27
27
  /** The launch flags a security mode owns (`docs/addons/claude.md`). */
28
- function securityFlags({ mode, sandbox, config }) {
28
+ function securityFlags({ mode, sandbox, config }, workspacePath) {
29
29
  if (mode === 'system')
30
30
  return [];
31
31
  if (mode === 'yolo')
32
32
  return ['--dangerously-skip-permissions'];
33
33
  if (mode === 'custom')
34
34
  return ['--settings', JSON.stringify(config)];
35
+ // Git metadata only for a known workspace; the conductor always passes one.
36
+ const git = workspacePath === undefined
37
+ ? { write: [], protect: [] }
38
+ : gitSandboxPaths(workspacePath);
35
39
  const settings = {
36
40
  sandbox: {
37
41
  enabled: true,
@@ -42,7 +46,8 @@ function securityFlags({ mode, sandbox, config }) {
42
46
  excludedCommands: sandbox.trusted_commands.map((cmd) => cmd.endsWith('*') ? cmd : `${cmd} *`),
43
47
  filesystem: {
44
48
  denyRead: sandbox.deny_read,
45
- allowWrite: sandbox.allow_write,
49
+ allowWrite: [...sandbox.allow_write, ...git.write],
50
+ denyWrite: git.protect,
46
51
  },
47
52
  network: { allowedDomains: sandbox.network },
48
53
  },
@@ -98,7 +103,7 @@ export class ClaudeAgent {
98
103
  args;
99
104
  model;
100
105
  effort;
101
- securityFlags;
106
+ security;
102
107
  /** The sandbox's own MCP servers, strict; undefined outside the sandbox. */
103
108
  sandboxMcpServers;
104
109
  securityMode;
@@ -113,7 +118,13 @@ export class ClaudeAgent {
113
118
  this.effort = cli.effort;
114
119
  this.overrides = cli.overrides;
115
120
  const security = resolveSecurityOptions(options, SANDBOX_DEFAULTS);
116
- this.securityFlags = securityFlags(security);
121
+ this.security = {
122
+ ...security,
123
+ sandbox: {
124
+ ...security.sandbox,
125
+ allow_write: withoutGitDirs(security.sandbox.allow_write),
126
+ },
127
+ };
117
128
  this.sandboxMcpServers =
118
129
  security.mode === 'sandbox' ? security.sandbox.mcp_servers : undefined;
119
130
  this.securityMode = security.mode;
@@ -124,7 +135,7 @@ export class ClaudeAgent {
124
135
  get withoutConductorTools() {
125
136
  return this.measure;
126
137
  }
127
- launchCommand(prompt, run, _workspacePath, tools) {
138
+ launchCommand(prompt, run, workspacePath, tools) {
128
139
  if (prompt === '') {
129
140
  return 'claude';
130
141
  }
@@ -143,8 +154,10 @@ export class ClaudeAgent {
143
154
  parts.push('--effort', shellQuote(this.effort));
144
155
  }
145
156
  // The flags are constants; only their generated values need quoting.
146
- parts.push(...this.securityFlags.map((t) => t.startsWith('--') ? t : shellQuote(t)));
147
- parts.push(...this.mcpFlags(tools).map((t) => t.startsWith('--') ? t : shellQuote(t)));
157
+ parts.push(...[
158
+ ...securityFlags(this.security, workspacePath),
159
+ ...this.mcpFlags(tools),
160
+ ].map((t) => (t.startsWith('--') ? t : shellQuote(t))));
148
161
  // Pin the transcript's own session id to the run's UUID (BB-473), so
149
162
  // `getRunLog` can read that ONE file directly instead of scanning the
150
163
  // worktree-keyed directory by mtime — the scan is what let a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-claude",
3
- "version": "0.6.1-next.2",
3
+ "version": "0.6.1-next.4",
4
4
  "description": "bakers.build agent plugin for the Claude CLI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,11 +23,11 @@
23
23
  "directory": "bakers-cli/addons/claude"
24
24
  },
25
25
  "peerDependencies": {
26
- "@bakers-build/conductor": "^0.6.1-next.2",
27
- "@bakers-build/core": "^0.6.1-next.2"
26
+ "@bakers-build/conductor": "^0.6.1-next.4",
27
+ "@bakers-build/core": "^0.6.1-next.4"
28
28
  },
29
29
  "bakersBuild": {
30
- "commit": "9f3866c099b1a9d0db76bd304fef38aeddcce8bb",
30
+ "commit": "f9ce4e2980c83b80ba5f007fe2d8e534797cf66c",
31
31
  "channel": "next"
32
32
  }
33
33
  }