GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — claude-code-source-code/src/commands/commit.ts at main · memoryblade/claude-code-source-code Expand file tree/ Copy pathcommit.tsMore file actions 92 lines (77 loc) · 3.41 KB / Copy pathcommit.tsFile metadata and controls92 lines (77 loc) · 3.41 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 import type { Command } from '../commands.js' import { getAttributionTexts } from '../utils/attribution.js' import { executeShellCommandsInPrompt } from '../utils/promptShellExecution.js' import { getUndercoverInstructions, isUndercover } from '../utils/undercover.js' const ALLOWED_TOOLS = [ 'Bash(git add:*)', 'Bash(git status:*)', 'Bash(git commit:*)', ] function getPromptContent(): string { const { commit: commitAttribution } = getAttributionTexts() let prefix = '' if (process.env.USER_TYPE === 'ant' && isUndercover()) { prefix = getUndercoverInstructions() + '\n' } return `${prefix}## Context - Current git status: !\`git status\` - Current git diff (staged and unstaged changes): !\`git diff HEAD\` - Current branch: !\`git branch --show-current\` - Recent commits: !\`git log --oneline -10\` ## Git Safety Protocol - NEVER update the git config - NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it - CRITICAL: ALWAYS create NEW commits. NEVER use git commit --amend, unless the user explicitly requests it - Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files - If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit - Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported ## Your task Based on the above changes, create a single git commit: 1. Analyze all staged changes and draft a commit message: - Look at the recent commits above to follow this repository's commit message style - Summarize the nature of the changes (new feature, enhancement, bug fix, refactoring, test, docs, etc.) - Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.) - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what" 2. Stage relevant files and create the commit using HEREDOC syntax: \`\`\` git commit -m "$(cat <<'EOF' Commit message here.${commitAttribution ? `\n\n${commitAttribution}` : ''} EOF )" \`\`\` You have the capability to call multiple tools in a single response. Stage and create the commit using a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls.` } const command = { type: 'prompt', name: 'commit', description: 'Create a git commit', allowedTools: ALLOWED_TOOLS, contentLength: 0, // Dynamic content progressMessage: 'creating commit', source: 'builtin', async getPromptForCommand(_args, context) { const promptContent = getPromptContent() const finalContent = await executeShellCommandsInPrompt( promptContent, { ...context, getAppState() { const appState = context.getAppState() return { ...appState, toolPermissionContext: { ...appState.toolPermissionContext, alwaysAllowRules: { ...appState.toolPermissionContext.alwaysAllowRules, command: ALLOWED_TOOLS, }, }, } }, }, '/commit', ) return [{ type: 'text', text: finalContent }] }, } satisfies Command export default command |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |