Skip to content

Add a project OpenCode config allowing git push and PR create/comment - #52

Merged
linghengqian merged 1 commit into
mainfrom
chore/opencode-project-permissions
Nov 3, 2026
Merged

linghengqian merged 1 commit into
mainfrom
chore/opencode-project-permissions

Conversation

@linghengqian

Copy link
Copy Markdown
Member

Add an opencode.jsonc that lets OpenCode agent sessions in this repository run git push *, gh pr create * and gh pr comment * without being blocked or asked.

  • OpenCode (v2) puts a project's permission rules after the user's global ones, and the last matching rule wins. So for anyone who runs OpenCode in this repository, these three allow rules override a personal global deny on the same commands. A contributor without such a deny sees no change: OpenCode's base policy already allows shell commands.
  • Nothing else is touched. gh pr merge * is left out on purpose, so a global deny on it still applies.
  • Checked on OpenCode 2.2.5 against a global config that denies all four commands (git push, gh pr create, gh pr comment, gh pr merge): before the file, git push was rejected; with it, git push --dry-run (to a nonexistent path), gh pr create --help and gh pr comment --help run, and gh pr merge --help is still rejected.
  • The Apache header is required: .licenserc.yaml exempts **/*.json, but license-eye checks .jsonc files. license-eye header check (apache/skywalking-eyes:0.9.0, as in docs/e2e.md) passes on a clean copy of the tree.

opencode.jsonc lets OpenCode agent sessions in this repository run
`git push *`, `gh pr create *` and `gh pr comment *` without being
blocked or asked.

- OpenCode (v2) puts a project's permission rules after the user's
  global ones and the last matching rule wins, so these three `allow`
  rules override a personal `deny` on the same commands. Checked on
  OpenCode 2.2.5 against a global config that denies all three: before
  the file, `git push` was rejected; with it, `git push --dry-run` (to
  a nonexistent path), `gh pr create --help` and `gh pr comment --help`
  run.
- Nothing else changes. `gh pr merge *` is left out on purpose and is
  still rejected under the same global config (checked with
  `gh pr merge --help`).
- A contributor without such a deny sees no change: OpenCode's base
  policy already allows shell commands.
- The Apache header is required. .licenserc.yaml exempts `**/*.json`,
  but license-eye checks `.jsonc` files; `header check` passes on a
  clean copy of the tree (apache/skywalking-eyes:0.9.0, as in
  docs/e2e.md).
@linghengqian linghengqian added the enhancement New feature or request label Nov 3, 2026
@linghengqian
linghengqian merged commit 563c967 into main Nov 3, 2026
10 checks passed
@linghengqian
linghengqian deleted the chore/opencode-project-permissions branch November 3, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant