@commonlyai/cli 0.1.312 → 0.1.313

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.312",
3
+ "version": "0.1.313",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -94,7 +94,7 @@ import {
94
94
  } from '../sandbox/seatbelt.js';
95
95
  import { CREDENTIAL_FILE_VAR, CREDENTIAL_KEY, writeCredentialFile } from '../credential-file.js';
96
96
  import { supportedGitHooks } from '../commit-attribution.js';
97
- import { workspaceGitAttachment } from '../workspace-git.js';
97
+ import { workspaceGitAttachment, workspaceGitEnabled } from '../workspace-git.js';
98
98
  import { deliverSeatCredential, withholdRuntimeCredential } from '../mcp-credential-delivery.js';
99
99
  import {
100
100
  prepareMcpSpawn, PUBLIC_MCP_UNAVAILABLE_CODE, publicMcpUnavailableError, selectedMcpVersionDir,
@@ -181,9 +181,11 @@ const workspaceGrants = (sandbox) => (
181
181
  );
182
182
  // A workspace seat reads its project's history through one read-only git tool
183
183
  // (git-readonly-server.js, attached by workspace-git.js). The server runs
184
- // inside the jail, so the jail admits its code and the real git binary.
184
+ // inside the jail, so the jail admits its code and the real git binary. The
185
+ // tool is opt-in (workspaceGitEnabled): without it the seat simply has none.
185
186
  const withWorkspaceGit = (ctx) => {
186
187
  if (ctx.environment?.sandbox?.trust !== 'workspace' || !ctx.cwd) return ctx;
188
+ if (!workspaceGitEnabled()) return ctx;
187
189
  const attachment = workspaceGitAttachment(ctx.cwd);
188
190
  if (!attachment) {
189
191
  // eslint-disable-next-line no-console
@@ -75,7 +75,7 @@ import { isOurGrantBroker } from '../grant-broker-guard.js';
75
75
  import { BRIDGE_PATH } from './codex-broker-bridge.mjs';
76
76
  import { brokerBridgeEntry } from './broker-bridge-entry.js';
77
77
  import { supportedGitHooks } from '../commit-attribution.js';
78
- import { WORKSPACE_GIT_SERVER_NAME, confinedWorkspaceGitServer } from '../workspace-git.js';
78
+ import { WORKSPACE_GIT_SERVER_NAME, confinedWorkspaceGitServer, workspaceGitEnabled } from '../workspace-git.js';
79
79
  import { deliverSeatCredential, withholdRuntimeCredential } from '../mcp-credential-delivery.js';
80
80
  import { prepareMcpSpawn, publicMcpUnavailableError, selectedMcpVersionDir } from '../mcp-home.js';
81
81
  import { BACKGROUND_PROCESS_CUE, buildMemoryPreamble, ROW_SLICING_CUE } from '../memory-bridge.js';
@@ -1132,19 +1132,27 @@ export default {
1132
1132
  const declaredMcp = ctx.environment?.mcp || [];
1133
1133
  let seatMcp = declaredMcp;
1134
1134
  if (workspacePath) {
1135
+ // The confined tool is opt-in (workspaceGitEnabled). A declared one is
1136
+ // dropped either way: Codex would run it outside the sandbox.
1137
+ const gitEnabled = workspaceGitEnabled();
1135
1138
  const declaresGit = declaredMcp.some((server) => server?.name === WORKSPACE_GIT_SERVER_NAME);
1136
1139
  if (declaresGit) {
1137
1140
  // eslint-disable-next-line no-console
1138
1141
  console.warn(`[codex] this public seat's environment declares ${WORKSPACE_GIT_SERVER_NAME}; `
1139
- + 'Codex would run it outside the sandbox, so the confined one replaces it');
1142
+ + (gitEnabled
1143
+ ? 'Codex would run it outside the sandbox, so the confined one replaces it'
1144
+ : 'Codex would run it outside the sandbox, so it is dropped'));
1140
1145
  }
1141
- const stateDir = join(dir, 'git-tool');
1142
- await mkdir(stateDir, { mode: 0o700 });
1143
- const workspaceGit = (ctx._workspaceGitServer || confinedWorkspaceGitServer)(workspacePath, {
1144
- stateDir,
1145
- platform: ctx._platform || process.platform,
1146
- });
1147
- if (!workspaceGit) {
1146
+ let workspaceGit = null;
1147
+ if (gitEnabled) {
1148
+ const stateDir = join(dir, 'git-tool');
1149
+ await mkdir(stateDir, { mode: 0o700 });
1150
+ workspaceGit = (ctx._workspaceGitServer || confinedWorkspaceGitServer)(workspacePath, {
1151
+ stateDir,
1152
+ platform: ctx._platform || process.platform,
1153
+ });
1154
+ }
1155
+ if (gitEnabled && !workspaceGit) {
1148
1156
  // eslint-disable-next-line no-console
1149
1157
  console.warn('[codex] the read-only git tool needs macOS and git on this machine, so this public seat has none');
1150
1158
  }
@@ -15,6 +15,12 @@ import { wrapArgvWithSeatbelt } from './sandbox/seatbelt.js';
15
15
  // no use for (git-readonly-server.test.mjs checks the two names agree).
16
16
  export const WORKSPACE_GIT_SERVER_NAME = 'workspace_git';
17
17
 
18
+ // The tool is opt-in: an adapter attaches it only when the environment the
19
+ // daemon itself runs in sets COMMONLY_WORKSPACE_GIT=1. Read from the daemon's
20
+ // own environment, never from a seat's record, so a seat cannot turn it on.
21
+ export const WORKSPACE_GIT_ENV = 'COMMONLY_WORKSPACE_GIT';
22
+ export const workspaceGitEnabled = (env = process.env) => env?.[WORKSPACE_GIT_ENV] === '1';
23
+
18
24
  // The server runs inside the sandbox, so the sandbox must admit its code
19
25
  // (cli/src/lib, plus package.json for the module type) and the git binary it runs.
20
26
  export const WORKSPACE_GIT_SERVER = fileURLToPath(new URL('./git-readonly-server.js', import.meta.url));