claude-all-config 3.7.7 → 3.8.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/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.7
1
+ 3.8.0
package/codex ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # codex — ClaudeAll shim that:
4
+ # 1. Sources ~/.codex/.env (and ~/.claude/.env as fallback) so MCP servers
5
+ # see CONTEXT7_API_KEY / EXA_API_KEY / Z_AI_API_KEY / TELEGRAM_* / etc.
6
+ # 2. Forwards all args to the REAL codex binary further down PATH.
7
+ #
8
+ # Bypass this shim entirely:
9
+ # command -v codex -a # see all codex binaries
10
+ # /usr/local/bin/codex ... # call the real one directly
11
+
12
+ set -u
13
+
14
+ # ─── Source env files (most-specific first) ───────────────────────────────
15
+ load_env() {
16
+ local f="$1"
17
+ if [ -f "$f" ]; then
18
+ set -a
19
+ # shellcheck disable=SC1090
20
+ . "$f" 2>/dev/null || true
21
+ set +a
22
+ fi
23
+ }
24
+ load_env "$HOME/.claude/.env"
25
+ load_env "$HOME/.codex/.env"
26
+
27
+ # ─── Find the REAL codex binary (skip ourselves) ──────────────────────────
28
+ SELF="$(readlink -f "$0" 2>/dev/null || realpath "$0" 2>/dev/null || echo "$0")"
29
+
30
+ REAL_CODEX=""
31
+ IFS=':' read -ra DIRS <<< "$PATH"
32
+ for dir in "${DIRS[@]}"; do
33
+ candidate="$dir/codex"
34
+ [ -x "$candidate" ] || continue
35
+ candidate_real="$(readlink -f "$candidate" 2>/dev/null || realpath "$candidate" 2>/dev/null || echo "$candidate")"
36
+ if [ "$candidate_real" = "$SELF" ]; then
37
+ continue
38
+ fi
39
+ REAL_CODEX="$candidate"
40
+ break
41
+ done
42
+
43
+ if [ -z "$REAL_CODEX" ]; then
44
+ echo "❌ ClaudeAll codex shim: real codex binary not found in PATH." >&2
45
+ echo " Install: npm install -g @openai/codex" >&2
46
+ exit 127
47
+ fi
48
+
49
+ exec "$REAL_CODEX" "$@"
package/codex-all ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # codex-all — Codex CLI launcher with ClaudeAll superpowers loaded.
4
+ #
5
+ # What it does:
6
+ # 1. Source ~/.codex/.env (and ~/.claude/.env as fallback) so MCP servers
7
+ # see CONTEXT7_API_KEY / EXA_API_KEY / Z_AI_API_KEY / TELEGRAM_* / etc.
8
+ # 2. Forward all args to the codex binary further down PATH.
9
+ #
10
+ # Usage:
11
+ # codex-all # interactive session
12
+ # codex-all "your prompt" # one-shot
13
+ # codex-all exec ... # subcommands
14
+ #
15
+ # Override:
16
+ # CODEX_BIN=/path/to/codex codex-all
17
+
18
+ set -u
19
+
20
+ # ─── Source env files (most-specific first) ───────────────────────────────
21
+ load_env() {
22
+ local f="$1"
23
+ if [ -f "$f" ]; then
24
+ set -a
25
+ # shellcheck disable=SC1090
26
+ . "$f" 2>/dev/null || true
27
+ set +a
28
+ fi
29
+ }
30
+ load_env "$HOME/.claude/.env"
31
+ load_env "$HOME/.codex/.env"
32
+
33
+ # ─── Locate codex binary ──────────────────────────────────────────────────
34
+ CODEX_CMD="${CODEX_BIN:-codex}"
35
+ if ! command -v "$CODEX_CMD" &>/dev/null; then
36
+ echo "❌ codex CLI not found in PATH." >&2
37
+ echo " Install: npm install -g @openai/codex" >&2
38
+ echo " Or set CODEX_BIN=/path/to/codex" >&2
39
+ exit 127
40
+ fi
41
+
42
+ exec "$CODEX_CMD" "$@"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-all-config",
3
- "version": "3.7.7",
3
+ "version": "3.8.0",
4
4
  "description": "🦾 MONSTER ENGINEER v2 - Ultimate AI CLI with 63 Skills, 12 Superpowers, 14 Agents. Multi-Agent Orchestration, Cost-Aware, Security Scorecard, Parallel-First.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -8,7 +8,8 @@
8
8
  "claude-all-skills": "./bin/skills-cli.js",
9
9
  "claude-all-update": "./update.sh",
10
10
  "claude-all-mcp": "./bin/mcp-install.js",
11
- "gemini-all": "./gemini-all"
11
+ "gemini-all": "./gemini-all",
12
+ "codex-all": "./codex-all"
12
13
  },
13
14
  "scripts": {
14
15
  "postinstall": "node postinstall.js || bash install.sh",
@@ -89,6 +90,8 @@
89
90
  "claude-all",
90
91
  "gemini-all",
91
92
  "gemini",
93
+ "codex-all",
94
+ "codex",
92
95
  "install.sh",
93
96
  "install-termux.sh",
94
97
  "install-universal.sh",
package/postinstall.js CHANGED
@@ -147,12 +147,14 @@ function mergeEnvFile(srcPath, destPath) {
147
147
 
148
148
  const hasClaude = commandExists('claude');
149
149
  const hasGemini = commandExists('gemini');
150
+ const hasCodex = commandExists('codex');
150
151
 
151
152
  console.log('🤖 ClaudeAll - Installing configurations...\n');
152
153
 
153
154
  if (hasClaude) console.log('✅ Claude CLI detected');
154
155
  if (hasGemini) console.log('✅ Gemini CLI detected');
155
- if (!hasClaude && !hasGemini) {
156
+ if (hasCodex) console.log('✅ Codex CLI detected');
157
+ if (!hasClaude && !hasGemini && !hasCodex) {
156
158
  console.log('⚠️ No CLI detected, installing configs anyway...');
157
159
  }
158
160
  console.log('');
@@ -428,6 +430,122 @@ function installGemini() {
428
430
  console.log(` ⚙️ settings.json (MONSTER ENGINEER + auto-approve)`);
429
431
  }
430
432
 
433
+ // Install to Codex (~/.codex/) — Codex CLI from OpenAI uses TOML config and
434
+ // AGENTS.md for global instructions (analogous to CLAUDE.md / GEMINI.md).
435
+ function installCodex() {
436
+ const CODEX_DIR = path.join(HOME, '.codex');
437
+ console.log('📦 Installing to Codex (~/.codex/)...');
438
+
439
+ // Create directories — Codex looks for skills directly under ~/.codex/skills/
440
+ const dirs = ['agents', 'skills', 'commands', 'hooks', 'lib'];
441
+ dirs.forEach(dir => {
442
+ const targetDir = path.join(CODEX_DIR, dir);
443
+ try {
444
+ if (!fs.existsSync(targetDir)) fs.mkdirSync(targetDir, { recursive: true });
445
+ } catch {}
446
+ });
447
+
448
+ // Copy content (resilient to root-owned existing files)
449
+ const agentCount = copyDir(path.join(PKG_DIR, 'agents'), path.join(CODEX_DIR, 'agents'));
450
+ console.log(` 🤖 ${agentCount} agents`);
451
+
452
+ const skillCount = copyDir(path.join(PKG_DIR, 'skills'), path.join(CODEX_DIR, 'skills'));
453
+ console.log(` ⚡ ${skillCount} skill files`);
454
+
455
+ const cmdCount = copyDir(path.join(PKG_DIR, 'commands'), path.join(CODEX_DIR, 'commands'));
456
+ console.log(` 📝 ${cmdCount} commands`);
457
+
458
+ const hookCount = copyDir(path.join(PKG_DIR, 'hooks'), path.join(CODEX_DIR, 'hooks'));
459
+ console.log(` 🔗 ${hookCount} hooks`);
460
+
461
+ if (fs.existsSync(path.join(PKG_DIR, 'lib'))) {
462
+ copyDir(path.join(PKG_DIR, 'lib'), path.join(CODEX_DIR, 'lib'));
463
+ console.log(` 📚 lib`);
464
+ }
465
+
466
+ // AGENTS.md — Codex's equivalent of CLAUDE.md, generated from CLAUDE.md
467
+ // (single source of truth) with surface substitutions.
468
+ const claudeMdInPkg = path.join(PKG_DIR, 'CLAUDE.md');
469
+ const agentsMdDest = path.join(CODEX_DIR, 'AGENTS.md');
470
+ if (fs.existsSync(claudeMdInPkg)) {
471
+ try {
472
+ let content = fs.readFileSync(claudeMdInPkg, 'utf8');
473
+ content = content
474
+ .replace(/# ClaudeAll Global Instructions/, '# Codex Agent Instructions (ClaudeAll Global Instructions)')
475
+ .replace(/Claude Code enhanced with ClaudeAll superpowers\./, 'OpenAI Codex CLI enhanced with ClaudeAll superpowers.\n\n**Bypass mode**: configure approval policy in ~/.codex/config.toml (default: never).')
476
+ .replace(/~\/\.claude\//g, '~/.codex/')
477
+ .replace(/CLAUDE\.md/g, 'AGENTS.md');
478
+ fs.writeFileSync(agentsMdDest, content);
479
+ console.log(` 📄 AGENTS.md (synced from CLAUDE.md, ${content.split('\n').length} lines)`);
480
+ } catch (e) {
481
+ console.log(` ⚠️ AGENTS.md write skipped (${e.code || 'error'})`);
482
+ }
483
+ }
484
+
485
+ // config.toml — translate mcp.json into Codex's TOML schema for MCP servers.
486
+ const mcpSrc = path.join(PKG_DIR, 'mcp.json');
487
+ const codexConfigDest = path.join(CODEX_DIR, 'config.toml');
488
+ if (fs.existsSync(mcpSrc)) {
489
+ try {
490
+ const mcpRaw = fs.readFileSync(mcpSrc, 'utf8').replace(/\$\{HOME\}/g, HOME);
491
+ const mcp = JSON.parse(mcpRaw);
492
+ let toml = '# ClaudeAll-managed Codex config (auto-generated from mcp.json)\n';
493
+ toml += '# Edit ~/.codex/.env for secrets. Re-run `npm install -g claude-all-config@latest`\n';
494
+ toml += '# to regenerate this file from the latest mcp.json.\n\n';
495
+
496
+ // Sandbox-friendly defaults so codex on a fresh proot/container works
497
+ toml += '# Default approval — match ClaudeAll style: autonomous unless overridden.\n';
498
+ toml += 'approval_policy = "never"\n\n';
499
+
500
+ for (const [name, cfg] of Object.entries(mcp.mcpServers || {})) {
501
+ const safeName = name.includes('-') ? `"${name}"` : name;
502
+ toml += `[mcp_servers.${safeName}]\n`;
503
+ if (cfg.type === 'http' || cfg.url) {
504
+ toml += `url = ${JSON.stringify(cfg.url)}\n`;
505
+ if (cfg.headers && cfg.headers.Authorization) {
506
+ // Pull env var name out of "Bearer ${VAR_NAME}"
507
+ const m = cfg.headers.Authorization.match(/\$\{([A-Z_][A-Z0-9_]*)\}/);
508
+ if (m) toml += `bearer_token_env_var = "${m[1]}"\n`;
509
+ }
510
+ } else if (cfg.command) {
511
+ toml += `command = ${JSON.stringify(cfg.command)}\n`;
512
+ if (Array.isArray(cfg.args)) {
513
+ toml += `args = ${JSON.stringify(cfg.args)}\n`;
514
+ }
515
+ if (cfg.env && Object.keys(cfg.env).length > 0) {
516
+ toml += `\n[mcp_servers.${safeName}.env]\n`;
517
+ for (const [k, v] of Object.entries(cfg.env)) {
518
+ toml += `${k} = ${JSON.stringify(v)}\n`;
519
+ }
520
+ }
521
+ }
522
+ toml += '\n';
523
+ }
524
+
525
+ // Preserve any existing user customization above ours? For now we
526
+ // overwrite — the user's secrets are in .env, not in this file.
527
+ fs.writeFileSync(codexConfigDest, toml);
528
+ const serverCount = Object.keys(mcp.mcpServers || {}).length;
529
+ console.log(` ⚙️ config.toml (${serverCount} MCP servers, approval_policy=never)`);
530
+ } catch (e) {
531
+ console.log(` ⚠️ config.toml write skipped (${e.code || e.message || 'error'})`);
532
+ }
533
+ }
534
+
535
+ // .env merge — same template as Claude/Gemini
536
+ const envSrc = path.join(PKG_DIR, '.env.example');
537
+ const envDest = path.join(CODEX_DIR, '.env');
538
+ if (fs.existsSync(envSrc)) {
539
+ try {
540
+ const r = mergeEnvFile(envSrc, envDest);
541
+ try { fs.chmodSync(envDest, 0o600); } catch {}
542
+ console.log(` 🔐 .env ${r.action} (${r.filled} filled, ${r.preserved} preserved)`);
543
+ } catch (e) {
544
+ console.log(` ⚠️ .env merge skipped (${e.code || 'error'})`);
545
+ }
546
+ }
547
+ }
548
+
431
549
  // Install uvx for MiniMax MCP support
432
550
  function installUvx() {
433
551
  const hasUvx = commandExists('uvx');
@@ -476,6 +594,9 @@ function setupLocalBinSymlinks() {
476
594
  // 'gemini' shim shadows the real `gemini` binary so plain `gemini` runs
477
595
  // in YOLO mode by default with .env loaded. Opt out with --no-yolo.
478
596
  'gemini': path.join(PKG_DIR, 'gemini'),
597
+ 'codex-all': path.join(PKG_DIR, 'codex-all'),
598
+ // 'codex' shim shadows the real `codex` so plain `codex` auto-loads .env.
599
+ 'codex': path.join(PKG_DIR, 'codex'),
479
600
  };
480
601
 
481
602
  let created = 0;
@@ -543,6 +664,11 @@ if (hasGemini) {
543
664
  installGemini();
544
665
  }
545
666
 
667
+ if (hasCodex) {
668
+ console.log('');
669
+ installCodex();
670
+ }
671
+
546
672
  setupLocalBinSymlinks();
547
673
 
548
674
  // If we ran under sudo, hand ownership back to the original user so that a
@@ -551,6 +677,7 @@ if (SUDO_USER) {
551
677
  console.log(`\n🔒 Restoring ownership to ${SUDO_USER}...`);
552
678
  fixOwnership(path.join(HOME, '.claude'));
553
679
  fixOwnership(path.join(HOME, '.gemini'));
680
+ fixOwnership(path.join(HOME, '.codex'));
554
681
  fixOwnership(path.join(HOME, '.mcp.json'));
555
682
  fixOwnership(path.join(HOME, '.local'));
556
683
  console.log(' ✅ Ownership fixed.');