git init | first commit
This commit is contained in:
62
opencode-config/agent/executor.md
Normal file
62
opencode-config/agent/executor.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
description: Runs shell commands and returns command results. Use this instead
|
||||
of the general agent whenever a task is only to execute commands.
|
||||
mode: subagent
|
||||
temperature: 0.1
|
||||
tools:
|
||||
write: false
|
||||
edit: false
|
||||
bash: true
|
||||
permission:
|
||||
doom_loop: ask
|
||||
external_directory:
|
||||
"*": ask
|
||||
/home/.local/share/opencode/tool-output/*: allow
|
||||
/tmp/opencode/*: allow
|
||||
question: deny
|
||||
plan_enter: deny
|
||||
plan_exit: deny
|
||||
read:
|
||||
"*": deny
|
||||
"*.env": ask
|
||||
"*.env.*": ask
|
||||
"*.env.example": allow
|
||||
edit: deny
|
||||
bash:
|
||||
rm *: deny
|
||||
git push*: deny
|
||||
git reset --hard*: deny
|
||||
glob: deny
|
||||
grep: deny
|
||||
list: deny
|
||||
task: deny
|
||||
todowrite: deny
|
||||
webfetch: deny
|
||||
websearch: deny
|
||||
model: openai/gpt-5.4-mini
|
||||
---
|
||||
|
||||
You are the executor agent.
|
||||
|
||||
Your only responsibility is to run shell commands requested by the caller and report the results. Do not inspect files with non-shell tools, edit files, research, plan, or perform general coding work.
|
||||
|
||||
## Fail-Fast Capability Check
|
||||
|
||||
Before running a command, check whether it requires a denied permission, destructive action, or unavailable shell utility. If a command fails because a utility is missing or permission is denied, do not retry variants blindly.
|
||||
|
||||
Stop immediately and report:
|
||||
|
||||
- `FAIL_FAST_CAPABILITY_MISSING`
|
||||
- Missing utility, denied permission, or blocked command
|
||||
- Why it is required
|
||||
- The exact command attempted or requested
|
||||
- Exact next action for the caller
|
||||
|
||||
For each requested command:
|
||||
|
||||
1. Run the command exactly as needed, using the shell tool.
|
||||
2. Report whether it succeeded or failed.
|
||||
3. Include the relevant stdout, stderr, and exit status when available.
|
||||
4. Keep analysis minimal and limited to what the command output shows.
|
||||
|
||||
If the request is not primarily command execution, say that it should be handled by another agent.
|
||||
74
opencode-config/command/commit.md
Normal file
74
opencode-config/command/commit.md
Normal file
@@ -0,0 +1,74 @@
|
||||
---
|
||||
description: Create git commit with auto-generated conventional commit message
|
||||
agent: build
|
||||
model: opencode/deepseek-v4-flash-free
|
||||
---
|
||||
|
||||
# Git Commit Command
|
||||
|
||||
Create a well-structured git commit by analyzing staged changes and generating a conventional commit message.
|
||||
|
||||
## Phase 1: Gather Context
|
||||
|
||||
Run these commands in parallel to understand the current state:
|
||||
|
||||
1. `git status` - See all staged and unstaged changes
|
||||
2. `git diff --cached` - View the actual staged changes that will be committed
|
||||
3. `git log --oneline -5` - Review recent commit message style for consistency
|
||||
|
||||
## Phase 2: Analyze Changes
|
||||
|
||||
Based on the staged diff, determine:
|
||||
|
||||
1. **Change Type** (use conventional commits):
|
||||
- `feat`: New feature
|
||||
- `fix`: Bug fix
|
||||
- `refactor`: Code restructuring without behavior change
|
||||
- `docs`: Documentation only
|
||||
- `test`: Adding or updating tests
|
||||
- `chore`: Maintenance tasks
|
||||
- `style`: Formatting, whitespace
|
||||
- `perf`: Performance improvement
|
||||
- `ci`: CI/CD changes
|
||||
|
||||
2. **Scope** (optional): Affected module or component
|
||||
|
||||
3. **Description**: Concise summary focusing on WHY, not WHAT
|
||||
|
||||
## Phase 3: Generate Commit Message
|
||||
|
||||
Format: `type(scope): description`
|
||||
|
||||
Rules:
|
||||
- Use imperative mood ("Add feature" not "Added feature")
|
||||
- Keep first line under 72 characters
|
||||
- Focus on the purpose and impact
|
||||
- Add body for complex changes explaining reasoning
|
||||
|
||||
## Phase 4: Execute Commit
|
||||
|
||||
1. If there are unstaged changes that should be included, ask user first
|
||||
2. Stage any additional files if requested
|
||||
3. Execute the commit with the generated message
|
||||
4. Run `git status` to verify success
|
||||
|
||||
## Output Format
|
||||
|
||||
```
|
||||
Commit Analysis
|
||||
---------------
|
||||
Type: [type]
|
||||
Scope: [scope or "none"]
|
||||
Files: [number] files changed
|
||||
|
||||
Generated Message:
|
||||
[commit message]
|
||||
|
||||
Commit Status: [success/failure]
|
||||
```
|
||||
|
||||
## Safety Checks
|
||||
|
||||
- NEVER commit files that appear to contain secrets (.env, credentials, API keys)
|
||||
- WARN if committing lock files or large binary files
|
||||
- CONFIRM before committing if there are untracked files that might be forgotten
|
||||
57
opencode-config/command/rapid.md
Normal file
57
opencode-config/command/rapid.md
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
description: Fast iteration mode - quick fixes without extensive planning
|
||||
agent: build
|
||||
subtask: false
|
||||
---
|
||||
# Rapid Mode - Fast Iteration
|
||||
|
||||
You are in **rapid mode**. Optimize for speed and iteration velocity. Skip extensive planning and get to implementation quickly.
|
||||
|
||||
## Your Mission
|
||||
|
||||
Execute the following task with minimal ceremony:
|
||||
|
||||
$ARGUMENTS
|
||||
|
||||
## Rapid Execution Protocol
|
||||
|
||||
1. **Understand** (30 seconds max)
|
||||
- What exactly needs to change?
|
||||
- What's the fastest path to working code?
|
||||
|
||||
2. **Execute** (immediately)
|
||||
- Make the change directly
|
||||
- Use existing patterns - don't reinvent
|
||||
- Keep changes minimal and focused
|
||||
|
||||
3. **Verify** (quick check)
|
||||
- Does it work? Test it.
|
||||
- Any obvious issues? Fix them.
|
||||
|
||||
## Rapid Mode Rules
|
||||
|
||||
- **No extensive planning** - Act first, refine later
|
||||
- **Minimal changes** - Touch only what's necessary
|
||||
- **Use existing patterns** - Copy from similar code in the codebase
|
||||
- **Skip documentation** - Unless explicitly requested
|
||||
- **Iterate fast** - Ship something, then improve
|
||||
- **Ask only if blocked** - Make reasonable assumptions otherwise
|
||||
|
||||
## What Rapid Mode is NOT
|
||||
|
||||
- Not for complex architectural changes (use `/architect`)
|
||||
- Not for learning or understanding (use `/mentor`)
|
||||
- Not for critical security code (use `/review`)
|
||||
- Not for large refactors (use `/refactor`)
|
||||
|
||||
## Output Style
|
||||
|
||||
Keep responses concise:
|
||||
|
||||
```
|
||||
Changed: [what was modified]
|
||||
Verified: [how it was tested]
|
||||
Note: [any caveats, if critical]
|
||||
```
|
||||
|
||||
Do not explain decisions unless they're non-obvious. Just ship it.
|
||||
156
opencode-config/plugin/fail-fast.ts
Normal file
156
opencode-config/plugin/fail-fast.ts
Normal file
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* Fail Fast Plugin
|
||||
* Converts denied permissions and missing shell utilities into explicit task
|
||||
* failures so agents do not repeatedly retry or stall on unavailable actions.
|
||||
*/
|
||||
|
||||
import type { Plugin } from "@opencode-ai/plugin"
|
||||
|
||||
const MISSING_UTILITY_PATTERNS = [
|
||||
/(?:^|\n)(?:sh|bash|zsh|fish):\s*(?<command>[\w./-]+):\s*command not found\b/i,
|
||||
/(?:^|\n)(?<command>[\w./-]+):\s*command not found\b/i,
|
||||
/(?:^|\n)(?:sh|bash|zsh|fish):\s*(?<command>[\w./-]+):\s*not found\b/i,
|
||||
/(?:^|\n)(?<command>[\w./-]+):\s*not found\b/i,
|
||||
/(?:^|\n)env:\s*(?<command>[\w./-]+):\s*No such file or directory\b/i,
|
||||
/(?:^|\n).*spawn\s+(?<command>[\w./-]+)\s+ENOENT\b/i,
|
||||
]
|
||||
|
||||
const SHELL_BUILTINS = new Set([
|
||||
"alias",
|
||||
"break",
|
||||
"cd",
|
||||
"command",
|
||||
"continue",
|
||||
"dirs",
|
||||
"echo",
|
||||
"eval",
|
||||
"exec",
|
||||
"exit",
|
||||
"export",
|
||||
"false",
|
||||
"fg",
|
||||
"hash",
|
||||
"jobs",
|
||||
"popd",
|
||||
"printf",
|
||||
"pushd",
|
||||
"pwd",
|
||||
"read",
|
||||
"return",
|
||||
"set",
|
||||
"shift",
|
||||
"source",
|
||||
"test",
|
||||
"true",
|
||||
"type",
|
||||
"ulimit",
|
||||
"unalias",
|
||||
"unset",
|
||||
])
|
||||
|
||||
function normalizeCommand(command: string): string {
|
||||
return command.replace(/^['"]|['"]$/g, "").trim()
|
||||
}
|
||||
|
||||
function findMissingUtility(output: string): string | undefined {
|
||||
for (const pattern of MISSING_UTILITY_PATTERNS) {
|
||||
const match = pattern.exec(output)
|
||||
const command = match?.groups?.command
|
||||
|
||||
if (!command) {
|
||||
continue
|
||||
}
|
||||
|
||||
const normalized = normalizeCommand(command)
|
||||
|
||||
if (normalized && !SHELL_BUILTINS.has(normalized)) {
|
||||
return normalized
|
||||
}
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
function getBashCommand(args: unknown): string | undefined {
|
||||
if (!args || typeof args !== "object") {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const record = args as Record<string, unknown>
|
||||
const command = record.command ?? record.cmd ?? record.script
|
||||
|
||||
return typeof command === "string" ? command : undefined
|
||||
}
|
||||
|
||||
function describePermission(input: {
|
||||
type: string
|
||||
pattern?: string | string[]
|
||||
title: string
|
||||
}): string {
|
||||
const pattern = Array.isArray(input.pattern)
|
||||
? input.pattern.join(", ")
|
||||
: input.pattern
|
||||
|
||||
return [input.type, pattern].filter(Boolean).join(" ") || input.title
|
||||
}
|
||||
|
||||
export const FailFastPlugin = (async () => {
|
||||
return {
|
||||
"permission.ask": async (input, output) => {
|
||||
if (output.status !== "deny") {
|
||||
return
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
[
|
||||
"FAIL_FAST_PERMISSION_DENIED: A required tool permission was denied.",
|
||||
`Permission: ${describePermission(input)}`,
|
||||
`Title: ${input.title}`,
|
||||
"Next action: reroute to an agent with the required permission, request permission from the user, or fail the task explicitly.",
|
||||
].join("\n")
|
||||
)
|
||||
},
|
||||
|
||||
"tool.execute.before": async (input, output) => {
|
||||
if (input.tool !== "bash") {
|
||||
return
|
||||
}
|
||||
|
||||
const command = getBashCommand(output.args)
|
||||
|
||||
if (command === undefined || command.trim()) {
|
||||
return
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"FAIL_FAST_INVALID_COMMAND: The bash tool was called without a command. Stop and report the missing command instead of retrying."
|
||||
)
|
||||
},
|
||||
|
||||
"tool.execute.after": async (input, output) => {
|
||||
if (input.tool !== "bash") {
|
||||
return
|
||||
}
|
||||
|
||||
const missingUtility = findMissingUtility(output.output ?? "")
|
||||
|
||||
if (!missingUtility) {
|
||||
return
|
||||
}
|
||||
|
||||
const command = getBashCommand(input.args)
|
||||
|
||||
const commandLine = command ? `\nCommand: ${command}` : ""
|
||||
|
||||
throw new Error(
|
||||
[
|
||||
`FAIL_FAST_MISSING_UTILITY: Required shell utility "${missingUtility}" is not available in this environment.`,
|
||||
commandLine.trim(),
|
||||
"Next action: install or mount the missing utility, choose a different validation path, or fail the task explicitly.",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("\n")
|
||||
)
|
||||
},
|
||||
}
|
||||
}) satisfies Plugin
|
||||
7
opencode-config/snippet/commit-message.md
Normal file
7
opencode-config/snippet/commit-message.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
aliases:
|
||||
- cm
|
||||
description: Creates a commit message
|
||||
---
|
||||
|
||||
Based on only the current changes recommend me a commit message.
|
||||
7
opencode-config/snippet/create-plan.md
Normal file
7
opencode-config/snippet/create-plan.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
aliases:
|
||||
- plan
|
||||
description: It creates and implementation plan from the previous interactions and chat
|
||||
---
|
||||
|
||||
I want you to create an implementation plan based on our conversation in this session. It should contain a precise instructions so even someone with less knowledge of the system can implement the plan without going into the wrong direction.
|
||||
Reference in New Issue
Block a user