codiedev 0.9.50 → 0.9.52

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.
@@ -2,7 +2,7 @@ import * as fs from "fs";
2
2
  export declare const CAPTURE_LOG_MAX_BYTES: number;
3
3
  export declare const CAPTURE_LOG_PATH: string;
4
4
  export interface CaptureLogEntry {
5
- stage: "capture-finish" | "upload" | "upload-deferred" | "security" | "stderr";
5
+ stage: "capture-finish" | "upload" | "upload-deferred" | "stderr";
6
6
  sessionId: string | undefined;
7
7
  outcome: string;
8
8
  detail?: string;
package/dist/cli.js CHANGED
@@ -34,7 +34,6 @@ const share_1 = require("./commands/share");
34
34
  const send_1 = require("./commands/send");
35
35
  const react_1 = require("./commands/react");
36
36
  const capture_1 = require("./commands/capture");
37
- const security_1 = require("./commands/security");
38
37
  const version_1 = require("./version");
39
38
  const HELP = `
40
39
  Codiedev CLI
@@ -45,13 +44,7 @@ Codiedev CLI
45
44
 
46
45
  Connect:
47
46
  codiedev connect Link Claude Code / Codex to your org
48
- codiedev doctor Verify setup, capture, and Agent Security
49
- codiedev security pilot Run safe synthetic policy checks
50
- codiedev security inventory Inventory MCPs, skills, hooks, plugins,
51
- instructions, and editor extensions
52
- codiedev security scan --deep Run installed open-source scanners too
53
- codiedev security sync Fetch administrator policy locally
54
- codiedev security rollback --yes Restore pre-update hook configuration
47
+ codiedev doctor Verify your setup after connecting
55
48
 
56
49
  Harness:
57
50
  codie Launch the governed Codie harness.
@@ -460,9 +453,6 @@ async function main() {
460
453
  case "verify":
461
454
  await (0, doctor_1.runDoctor)(rest);
462
455
  return;
463
- case "security":
464
- await (0, security_1.runSecurityCommand)(rest);
465
- return;
466
456
  case "push":
467
457
  await (0, push_1.runPush)(rest);
468
458
  return;
package/dist/codie.js CHANGED
@@ -169,120 +169,6 @@ function installBrandWordmarkUnsafe(runtime) {
169
169
  (0, child_process_1.spawnSync)("codesign", ["--force", "--sign", "-", runtime], { stdio: "ignore" });
170
170
  }
171
171
  }
172
- async function runNonInteractive(runtime, runtimeArgs, env) {
173
- const detached = process.platform !== "win32";
174
- const child = (0, child_process_1.spawn)(runtime, runtimeArgs, {
175
- stdio: ["pipe", "pipe", "pipe"],
176
- env,
177
- detached,
178
- });
179
- if (child.stdin)
180
- process.stdin.pipe(child.stdin);
181
- const signalChild = (signal) => {
182
- if (detached && child.pid) {
183
- try {
184
- process.kill(-child.pid, signal);
185
- return;
186
- }
187
- catch {
188
- // Fall back to the direct child if its process group already exited.
189
- }
190
- }
191
- child.kill(signal);
192
- };
193
- const forwardInterrupt = () => signalChild("SIGINT");
194
- const forwardTermination = () => signalChild("SIGTERM");
195
- process.once("SIGINT", forwardInterrupt);
196
- process.once("SIGTERM", forwardTermination);
197
- return await new Promise((resolve, reject) => {
198
- let blockReason;
199
- const errorPrefixes = [Buffer.from("\x1b[91m\x1b[1mError:"), Buffer.from("Error: {")];
200
- const retainedPrefixBytes = Math.max(...errorPrefixes.map((prefix) => prefix.length)) - 1;
201
- // OpenCode's generic UnknownError and the adapter's private reason can be
202
- // delivered in either order — and the generic block can arrive on stdout
203
- // or stderr. Gate both streams by content, retaining only a possible final
204
- // error block. Ordinary output stays streaming apart from the few bytes
205
- // needed to recognize a split prefix.
206
- const createOutputGate = (write) => {
207
- let tail = Buffer.alloc(0);
208
- let possibleError;
209
- return {
210
- push(chunk, blocked) {
211
- if (blocked) {
212
- if (possibleError)
213
- possibleError.push(Buffer.from(chunk));
214
- return;
215
- }
216
- if (possibleError) {
217
- possibleError.push(Buffer.from(chunk));
218
- return;
219
- }
220
- const combined = Buffer.concat([tail, chunk]);
221
- let errorStart = -1;
222
- for (const prefix of errorPrefixes) {
223
- const index = combined.indexOf(prefix);
224
- if (index >= 0 && (errorStart < 0 || index < errorStart))
225
- errorStart = index;
226
- }
227
- if (errorStart >= 0) {
228
- if (errorStart > 0)
229
- write(combined.subarray(0, errorStart));
230
- possibleError = [combined.subarray(errorStart)];
231
- tail = Buffer.alloc(0);
232
- return;
233
- }
234
- const flushBytes = Math.max(0, combined.length - retainedPrefixBytes);
235
- if (flushBytes > 0)
236
- write(combined.subarray(0, flushBytes));
237
- tail = combined.subarray(flushBytes);
238
- },
239
- finish(blocked) {
240
- if (tail.length > 0)
241
- write(tail);
242
- const heldError = possibleError ? Buffer.concat(possibleError).toString() : "";
243
- const genericBlockError = heldError.includes("UnknownError") &&
244
- heldError.includes("Unexpected server error");
245
- if (heldError && (!blocked || !genericBlockError))
246
- write(heldError);
247
- },
248
- };
249
- };
250
- const stdoutGate = createOutputGate((chunk) => process.stdout.write(chunk));
251
- const stderrGate = createOutputGate((chunk) => process.stderr.write(chunk));
252
- child.stdout?.on("data", (chunk) => {
253
- stdoutGate.push(Buffer.from(chunk), Boolean(blockReason));
254
- });
255
- child.stderr?.on("data", (chunk) => {
256
- const text = chunk.toString();
257
- const reason = (0, codieLauncher_1.extractCodieSecurityBlock)(text);
258
- if (reason) {
259
- blockReason = reason;
260
- signalChild("SIGTERM");
261
- return;
262
- }
263
- stderrGate.push(Buffer.from(chunk), Boolean(blockReason));
264
- });
265
- child.once("error", (error) => {
266
- if (child.stdin)
267
- process.stdin.unpipe(child.stdin);
268
- process.removeListener("SIGINT", forwardInterrupt);
269
- process.removeListener("SIGTERM", forwardTermination);
270
- reject(error);
271
- });
272
- child.once("close", (status) => {
273
- if (child.stdin)
274
- process.stdin.unpipe(child.stdin);
275
- process.removeListener("SIGINT", forwardInterrupt);
276
- process.removeListener("SIGTERM", forwardTermination);
277
- stdoutGate.finish(Boolean(blockReason));
278
- stderrGate.finish(Boolean(blockReason));
279
- if (blockReason) {
280
- console.error(`Codie Security blocked this action:\n${blockReason}`);
281
- }
282
- resolve(status);
283
- });
284
- });
285
- }
286
172
  async function main() {
287
173
  (0, codieRuntime_1.assertCodieNodeVersion)(process.versions.node);
288
174
  const connected = connectedCodiedevConfig();
@@ -346,13 +232,6 @@ async function main() {
346
232
  OPENCODE_CONFIG_CONTENT: JSON.stringify(config),
347
233
  };
348
234
  const runtimeArgs = (0, codieLauncher_1.withCodieWorkingDirectory)(parsed.args, process.cwd());
349
- const nonInteractiveRun = runtimeArgs[0] === "run";
350
- if (nonInteractiveRun)
351
- env.CODIEDEV_SECURITY_BLOCK_OUTPUT = "marker";
352
- if (nonInteractiveRun) {
353
- process.exitCode = (await runNonInteractive(runtime, runtimeArgs, env)) ?? 1;
354
- return;
355
- }
356
235
  const result = (0, child_process_1.spawnSync)(runtime, runtimeArgs, { stdio: "inherit", env });
357
236
  if (result.error)
358
237
  throw result.error;
@@ -2,11 +2,6 @@ export interface CatalogModel {
2
2
  id: string;
3
3
  name?: string;
4
4
  }
5
- export declare const CODIE_SECURITY_BLOCK_MARKER = "__CODIEDEV_SECURITY_BLOCK__";
6
- /** Extract the private adapter marker used to carry a local block reason
7
- * across OpenCode's generic 500 boundary. The marker never contains prompt or
8
- * tool input — only the deterministic policy reason. */
9
- export declare function extractCodieSecurityBlock(stderr: string): string | undefined;
10
5
  /**
11
6
  * Pin non-interactive runs to the directory where `codie` was launched.
12
7
  * OpenCode can reuse a previously-known project instance; without an explicit
@@ -42,8 +42,7 @@ var __importStar = (this && this.__importStar) || (function () {
42
42
  };
43
43
  })();
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.HIDDEN_WORDMARK = exports.CODIEDEV_WORDMARK = exports.LEGACY_CODIEDEV_WORDMARK = exports.STOCK_WORDMARK = exports.BRAND_PLUGIN_SPEC = exports.CODIE_SECURITY_BLOCK_MARKER = void 0;
46
- exports.extractCodieSecurityBlock = extractCodieSecurityBlock;
45
+ exports.HIDDEN_WORDMARK = exports.CODIEDEV_WORDMARK = exports.LEGACY_CODIEDEV_WORDMARK = exports.STOCK_WORDMARK = exports.BRAND_PLUGIN_SPEC = void 0;
47
46
  exports.withCodieWorkingDirectory = withCodieWorkingDirectory;
48
47
  exports.bareModel = bareModel;
49
48
  exports.buildCodieConfig = buildCodieConfig;
@@ -63,26 +62,6 @@ const DEFAULT_NAMES = {
63
62
  "z-ai/glm-5.2": "GLM 5.2 · Fireworks ZDR",
64
63
  "moonshotai/kimi-k2.7-code": "Kimi K2.7 Code · Fireworks ZDR",
65
64
  };
66
- exports.CODIE_SECURITY_BLOCK_MARKER = "__CODIEDEV_SECURITY_BLOCK__";
67
- /** Extract the private adapter marker used to carry a local block reason
68
- * across OpenCode's generic 500 boundary. The marker never contains prompt or
69
- * tool input — only the deterministic policy reason. */
70
- function extractCodieSecurityBlock(stderr) {
71
- for (const line of stderr.split(/\r?\n/)) {
72
- const markerIndex = line.indexOf(exports.CODIE_SECURITY_BLOCK_MARKER);
73
- if (markerIndex < 0)
74
- continue;
75
- try {
76
- const parsed = JSON.parse(line.slice(markerIndex + exports.CODIE_SECURITY_BLOCK_MARKER.length));
77
- if (typeof parsed?.reason === "string" && parsed.reason.trim())
78
- return parsed.reason.trim();
79
- }
80
- catch {
81
- // Ignore malformed or foreign stderr and preserve the original runtime error.
82
- }
83
- }
84
- return undefined;
85
- }
86
65
  /**
87
66
  * Pin non-interactive runs to the directory where `codie` was launched.
88
67
  * OpenCode can reuse a previously-known project instance; without an explicit
@@ -45,8 +45,6 @@ const version_1 = require("../version");
45
45
  const upgradeNudge_1 = require("../upgradeNudge");
46
46
  const captureReadiness_1 = require("../captureReadiness");
47
47
  const captureLog_1 = require("../captureLog");
48
- const securityDoctor_1 = require("../securityDoctor");
49
- const securityFeature_1 = require("../securityFeature");
50
48
  const CLAUDE_SETTINGS_PATH = path.join(os.homedir(), ".claude", "settings.json");
51
49
  const CLAUDE_INSTRUCTIONS_PATH = path.join(os.homedir(), ".claude", "CLAUDE.md");
52
50
  const CODEX_HOOKS_PATH = path.join(os.homedir(), ".codex", "hooks.json");
@@ -484,12 +482,6 @@ async function runDoctor(_args) {
484
482
  detail: "not installed on this machine",
485
483
  });
486
484
  }
487
- // Agent Security is part of installation health, not a separate setup
488
- // concept. Keep `codiedev security doctor` as an alias for focused output,
489
- // while the main doctor remains the one command users need to remember.
490
- if ((0, securityFeature_1.isAgentSecurityEnabled)(config)) {
491
- checks.push(...(0, securityDoctor_1.securityDoctorChecks)((0, securityDoctor_1.collectSecurityDoctorReport)(config.companyId)));
492
- }
493
485
  // 8. gh / glab CLIs (optional — only needed for reverse-ticket from a
494
486
  // specific PR/MR URL; branch mode works without either).
495
487
  checks.push({
package/dist/connect.js CHANGED
@@ -39,16 +39,11 @@ const https = __importStar(require("https"));
39
39
  const http = __importStar(require("http"));
40
40
  const crypto = __importStar(require("crypto"));
41
41
  const os = __importStar(require("os"));
42
- const fs = __importStar(require("fs"));
43
- const path = __importStar(require("path"));
44
42
  const utils_1 = require("./utils");
45
43
  const connectFlow_1 = require("./connectFlow");
46
44
  const version_1 = require("./version");
47
45
  const upgradeNudge_1 = require("./upgradeNudge");
48
46
  const shared_1 = require("./commands/shared");
49
- const securityInstall_1 = require("./securityInstall");
50
- const securityPolicy_1 = require("./securityPolicy");
51
- const securityFeature_1 = require("./securityFeature");
52
47
  // cli.codiedev.com is a Convex custom domain on the prod deployment; the
53
48
  // underlying judicious-falcon-861.convex.site URL keeps serving, so configs
54
49
  // written by older CLI versions stay valid without a re-connect.
@@ -205,7 +200,6 @@ async function runConnect(args = []) {
205
200
  // Extract fields from response
206
201
  const companyId = responseData.companyId;
207
202
  const companyName = responseData.companyName;
208
- const agentSecurityEnabled = responseData.agentSecurityEnabled === true;
209
203
  const repos = responseData.repos ?? [];
210
204
  if (!companyId || !companyName) {
211
205
  console.error("\nError: Invalid response from server. Token may be invalid.");
@@ -218,7 +212,6 @@ async function runConnect(args = []) {
218
212
  repos,
219
213
  lastSynced: new Date().toISOString(),
220
214
  backendUrl: BACKEND_URL,
221
- agentSecurityEnabled,
222
215
  deviceId: saved?.deviceId || crypto.randomUUID(),
223
216
  deviceName: saved?.deviceName || os.hostname(),
224
217
  captureIgnoredPaths: saved?.captureIgnoredPaths ?? [],
@@ -287,16 +280,6 @@ async function runConnect(args = []) {
287
280
  // /api/cli/markInstalled so the portal's "Connected" state reflects
288
281
  // what's actually wired up on this machine, not just "token validated."
289
282
  const installedTargets = [];
290
- const home = os.homedir();
291
- const securityConfigPaths = [
292
- path.join(home, ".claude", "settings.json"),
293
- path.join(home, ".codex", "hooks.json"),
294
- path.join(home, ".config", "opencode", "plugins", "codiedev.js"),
295
- path.join(home, ".codex", "config.toml"),
296
- ];
297
- // Snapshot before any hook update. Rollback is intentionally not automatic:
298
- // an administrator can inspect these 0600 copies before restoring them.
299
- const securitySnapshot = (0, securityInstall_1.createSecurityInstallSnapshot)(securityConfigPaths);
300
283
  // Wrap each per-target write so we emit one install_target row each. The
301
284
  // existing user-visible behavior (console.warn on failure, continue) is
302
285
  // unchanged — telemetry just observes the outcome.
@@ -319,11 +302,11 @@ async function runConnect(args = []) {
319
302
  }
320
303
  };
321
304
  if (hasClaude) {
322
- runInstall("claude-code-hook", () => (0, utils_1.installHook)(agentSecurityEnabled), "Claude Code SessionEnd (capture) + UserPromptSubmit (skill discovery) + Stop (auto-backup) hooks (~/.claude/settings.json)", "claudeCode-hook");
305
+ runInstall("claude-code-hook", utils_1.installHook, "Claude Code SessionEnd (capture) + UserPromptSubmit (skill discovery) + Stop (auto-backup) hooks (~/.claude/settings.json)", "claudeCode-hook");
323
306
  runInstall("claude-code-instructions", utils_1.installClaudeCodeInstructions, "Claude Code agent instructions (~/.claude/CLAUDE.md)", "claudeCode-instructions");
324
307
  }
325
308
  if (hasCodex) {
326
- runInstall("codex-hook", () => (0, utils_1.installCodexHook)(agentSecurityEnabled), "Codex Stop (capture + auto-backup) hooks (~/.codex/hooks.json)", "codex-hook");
309
+ runInstall("codex-hook", utils_1.installCodexHook, "Codex Stop (capture + auto-backup) hooks (~/.codex/hooks.json)", "codex-hook");
327
310
  runInstall("codex-instructions", utils_1.installCodexInstructions, "Codex agent instructions (~/.codex/AGENTS.md)", "codex-instructions");
328
311
  }
329
312
  if (hasCursor) {
@@ -333,36 +316,7 @@ async function runConnect(args = []) {
333
316
  // Always stage the adapter. It is dormant until OpenCode starts, which lets
334
317
  // a user connect Claude Code today and install the Codie harness tomorrow
335
318
  // without needing a second setup ritual.
336
- runInstall("opencode-capture-adapter", () => (0, utils_1.installOpenCodeCapturePlugin)(agentSecurityEnabled), "OpenCode session capture adapter (~/.config/opencode/plugins/codiedev.js)", "opencode-capture");
337
- // Record the exact installed hook bytes and the pre-update rollback files.
338
- // This supplies health/integrity checks without requiring a package publish
339
- // or trusting whichever `node` happens to be first on PATH later.
340
- try {
341
- const hookScriptPath = path.join(__dirname, "hook.js");
342
- if (agentSecurityEnabled && fs.existsSync(hookScriptPath)) {
343
- const targets = [];
344
- if (installedTargets.includes("claudeCode-hook"))
345
- targets.push({ surface: "claude-code", configPath: securityConfigPaths[0] });
346
- if (installedTargets.includes("codex-hook"))
347
- targets.push({ surface: "codex", configPath: securityConfigPaths[1] });
348
- if (installedTargets.includes("opencode-capture"))
349
- targets.push({ surface: "codie-harness", configPath: securityConfigPaths[2] });
350
- (0, securityInstall_1.writeSecurityInstallManifest)({ hookScriptPath, snapshot: securitySnapshot, targets });
351
- }
352
- }
353
- catch (err) {
354
- console.warn(`Warning: Security hooks installed, but integrity manifest could not be written — ${err.message}`);
355
- }
356
- // Prime the local cache after installation. Hooks read this file only, so
357
- // an endpoint decision never depends on live network latency.
358
- if (agentSecurityEnabled) {
359
- try {
360
- await (0, securityPolicy_1.syncEndpointSecurityPolicy)(config);
361
- }
362
- catch (err) {
363
- console.warn(`Warning: Agent-security policy will use safe defaults until sync succeeds — ${err.message}`);
364
- }
365
- }
319
+ runInstall("opencode-capture-adapter", utils_1.installOpenCodeCapturePlugin, "OpenCode session capture adapter (~/.config/opencode/plugins/codiedev.js)", "opencode-capture");
366
320
  // Tell the backend which targets we wired up so the portal's onboarding
367
321
  // card flips to "Connected" only when something actually installed —
368
322
  // not on bare token validation. Best-effort: a network failure here
@@ -401,8 +355,5 @@ async function runConnect(args = []) {
401
355
  }
402
356
  console.log();
403
357
  console.log("Run `codiedev doctor` to verify everything's wired up.");
404
- if ((0, securityFeature_1.isAgentSecurityEnabled)(config)) {
405
- console.log("Run `codiedev security pilot` to validate blocking safely.");
406
- }
407
358
  console.log();
408
359
  }