Skip to content

Commit b2023fc

Browse files
committed
feat: bridge Codex v0.5–v0.6 (.env hardening, trust/activation messaging)
Adopt the portable behavioral improvements from Codex-Game-Studios v0.5–v0.6 (upstream commit 259cff8) into the OpenCode-native port. - opencode.json: add edit and glob *.env* denies (edit covers write/patch, closing a gap where agents could create/overwrite secrets via the write tool); consolidate read to a single *.env* catch-all so nested files and .envrc are covered. *.env.example stays allowed for non-secret templates. - install.sh: banner now states installer success is static-only and a new opencode session is required before hooks/permissions/agents are active. - audit.sh run_config: assert an edit *.env* deny exists (regression guard). - README.md / UPGRADING.md: document the static-install-only caveat. Verified: json.tool valid; audit.sh all 0 errors; runtime probes post-restart deny read/write on .env, sub/.env, .envrc and allow .env.example. Codex-only changes (MultiAgent-V2 role-activation proof, .codex installer internals, CCGS framework frontmatter, skill delegation dialect) intentionally not adopted — OpenCode Task/subagent model and .opencode structure make them inapplicable or already-equivalent.
1 parent 1ce600c commit b2023fc

5 files changed

Lines changed: 37 additions & 6 deletions

File tree

.opencode/audit.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,10 @@ if 'instructions' not in cfg:
500500
print('missing instructions'); sys.exit(1)
501501
if 'plugin' not in cfg:
502502
print('missing plugin'); sys.exit(1)
503+
perm = cfg.get('permission', {})
504+
edit_rules = perm.get('edit', {})
505+
if not isinstance(edit_rules, dict) or not any(v == 'deny' and '.env' in str(k) for k, v in edit_rules.items()):
506+
print('missing edit .env* deny'); sys.exit(1)
503507
sys.exit(0)
504508
" 2>/dev/null && pass "opencode.json valid" || fail "opencode.json invalid"
505509

.opencode/install.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,11 @@ printf ' install-state.json written (schema v2).\n'
369369

370370
# ── Done ─────────────────────────────────────────────────────────
371371
printf '\n╔══════════════════════════════════════════════════════════════╗\n'
372-
printf '║ Setup complete! ║\n'
373-
printf '║ ║\n'
374-
printf '║ Run: opencode ║\n'
375-
printf '║ Then: /start ║\n'
372+
printf '║ %-60s║\n' "Setup complete! (static install only)"
373+
printf '║ %-60s║\n' ""
374+
printf '║ %-60s║\n' "Trust this project + start a NEW opencode session before"
375+
printf '║ %-60s║\n' "hooks, permissions, and agents are active."
376+
printf '║ %-60s║\n' ""
377+
printf '║ %-60s║\n' "Run: opencode"
378+
printf '║ %-60s║\n' "Then: /start"
376379
printf '╚══════════════════════════════════════════════════════════════╝\n'

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ project files. See [Coexistence](#coexistence) below.
276276
4. **`.opencode/install-state.json`** — schema-v2 with SHA256 hashes, detected
277277
mode, preserved/created paths, and model configuration
278278

279+
> **Static install only.** Installer success proves package deployment and
280+
> static verification only. Trust the target project and start a **new
281+
> `opencode` session** before treating its hooks, rules, permission profile,
282+
> or agents as active.
283+
279284
## Uninstall
280285

281286
Restore the model-agnostic state (strips injected `model:` and `variant:` from

UPGRADING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ Best when: you didn't use git to set up the template (just downloaded a zip).
125125

126126
---
127127

128+
## Verify After Upgrade
129+
130+
Installer success is static evidence only — it proves package deployment and
131+
the static audit, not that project hooks, rules, permissions, or agents are
132+
live. After any upgrade, trust the target project and start a **new
133+
`opencode` session** before verifying hooks, rules, permission profile, and
134+
agents. Keep the exact failing command and output if verification is blocked.
135+
136+
---
137+
128138
## v0.4.1
129139

130140
**Released:** 2026-04-02

opencode.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,17 @@
3737
},
3838
"read": {
3939
"*": "allow",
40-
"*.env": "deny",
41-
"*.env.*": "deny",
40+
"*.env*": "deny",
41+
"*.env.example": "allow"
42+
},
43+
"edit": {
44+
"*": "allow",
45+
"*.env*": "deny",
46+
"*.env.example": "allow"
47+
},
48+
"glob": {
49+
"*": "allow",
50+
"*.env*": "deny",
4251
"*.env.example": "allow"
4352
}
4453
},

0 commit comments

Comments
 (0)