feat: Add opencode init command with interactive setup and AI-powered AGENTS.md generation
#6188
+338
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
opencode initcommand that provides an interactive setup wizard for initializing OpenCode in a project. Currently, by default, all projects have "allow all" permissions for everything (webfetch, bash, edit, etc.), which is risky. Most people don't create anopencode.jsoncfile on their own because they probably don't even know it exists (reading docs has become a thing of the past lol). Theopencode initcommand solves this by walking users through permission configuration interactively and also performs the same codebase analysis that the/initslash command does to generate project-specificAGENTS.mdinstructions.Changes
New Command:
opencode initFeatures:
AGENTS.mdby analyzing the codebase using the/initcommand.gitignoremanagement foropencode.jsonc--skipflag for automationBehavior
Interactive Mode (
opencode init)opencode.jsoncwith selected permissionsopencode.jsoncto.gitignore(or creates it)Skip Mode (
opencode init --skip)Testing
Tested both interactive and skip modes:
Interactive mode
Skip mode for automation