mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-31 06:03:29 +08:00
- AGENTS.md: universal cross-tool file read by Claude Code, Cursor, Codex, and OpenCode - .cursor/: 15 hook events via hooks.json, 16 hook scripts with DRY adapter pattern, 29 rules (9 common + 20 language-specific) with Cursor YAML frontmatter - .codex/: reference config.toml, Codex-specific AGENTS.md supplement, 10 skills ported to .agents/skills/ with openai.yaml metadata - .opencode/: 3 new tools (format-code, lint-check, git-summary), 3 new hooks (shell.env, experimental.session.compacting, permission.ask), expanded instructions, version bumped to 1.6.0 - README: fixed Cursor section, added Codex section, added cross-tool parity table - install.sh: now copies hooks.json + hooks/ for --target cursor
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
/**
|
|
* ECC Custom Tool: Git Summary
|
|
*
|
|
* Provides a comprehensive git status including branch info, status,
|
|
* recent log, and diff against base branch.
|
|
*/
|
|
|
|
import { tool } from "@opencode-ai/plugin"
|
|
import { z } from "zod"
|
|
|
|
export default tool({
|
|
name: "git-summary",
|
|
description: "Get comprehensive git summary: branch, status, recent log, and diff against base branch.",
|
|
parameters: z.object({
|
|
depth: z.number().optional().describe("Number of recent commits to show (default: 5)"),
|
|
includeDiff: z.boolean().optional().describe("Include diff against base branch (default: true)"),
|
|
baseBranch: z.string().optional().describe("Base branch for comparison (default: main)"),
|
|
}),
|
|
execute: async ({ depth = 5, includeDiff = true, baseBranch = "main" }, { $ }) => {
|
|
const results: Record<string, string> = {}
|
|
|
|
try {
|
|
results.branch = (await $`git branch --show-current`.text()).trim()
|
|
} catch {
|
|
results.branch = "unknown"
|
|
}
|
|
|
|
try {
|
|
results.status = (await $`git status --short`.text()).trim()
|
|
} catch {
|
|
results.status = "unable to get status"
|
|
}
|
|
|
|
try {
|
|
results.log = (await $`git log --oneline -${depth}`.text()).trim()
|
|
} catch {
|
|
results.log = "unable to get log"
|
|
}
|
|
|
|
if (includeDiff) {
|
|
try {
|
|
results.stagedDiff = (await $`git diff --cached --stat`.text()).trim()
|
|
} catch {
|
|
results.stagedDiff = ""
|
|
}
|
|
|
|
try {
|
|
results.branchDiff = (await $`git diff ${baseBranch}...HEAD --stat`.text()).trim()
|
|
} catch {
|
|
results.branchDiff = `unable to diff against ${baseBranch}`
|
|
}
|
|
}
|
|
|
|
return results
|
|
},
|
|
})
|