MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getPromptContent

Function getPromptContent

src/commands/commit-push-pr.ts:26–106  ·  view source on GitHub ↗
(
  defaultBranch: string,
  prAttribution?: string,
)

Source from the content-addressed store, hash-verified

24]
25
26function getPromptContent(
27 defaultBranch: string,
28 prAttribution?: string,
29): string {
30 const { commit: commitAttribution, pr: defaultPrAttribution } =
31 getAttributionTexts()
32 // Use provided PR attribution or fall back to default
33 const effectivePrAttribution = prAttribution ?? defaultPrAttribution
34 const safeUser = process.env.SAFEUSER || ''
35 const username = process.env.USER || ''
36
37 let prefix = ''
38 let reviewerArg = ' and `--reviewer anthropics/claude-code`'
39 let addReviewerArg = ' (and add `--add-reviewer anthropics/claude-code`)'
40 let changelogSection = `
41
42## Changelog
43<!-- CHANGELOG:START -->
44[If this PR contains user-facing changes, add a changelog entry here. Otherwise, remove this section.]
45<!-- CHANGELOG:END -->`
46 let slackStep = `
47
485. After creating/updating the PR, check if the user's CLAUDE.md mentions posting to Slack channels. If it does, use SearchExtraTools to search for "slack send message" tools. If SearchExtraTools finds a Slack tool, ask the user if they'd like you to post the PR URL to the relevant Slack channel. Only post if the user confirms. If SearchExtraTools returns no results or errors, skip this step silently—do not mention the failure, do not attempt workarounds, and do not try alternative approaches.`
49 if (process.env.USER_TYPE === 'ant' && isUndercover()) {
50 prefix = getUndercoverInstructions() + '\n'
51 reviewerArg = ''
52 addReviewerArg = ''
53 changelogSection = ''
54 slackStep = ''
55 }
56
57 return `${prefix}## Context
58
59- \`SAFEUSER\`: ${safeUser}
60- \`whoami\`: ${username}
61- \`git status\`: !\`git status\`
62- \`git diff HEAD\`: !\`git diff HEAD\`
63- \`git branch --show-current\`: !\`git branch --show-current\`
64- \`git diff ${defaultBranch}...HEAD\`: !\`git diff ${defaultBranch}...HEAD\`
65- \`gh pr view --json number 2>/dev/null || true\`: !\`gh pr view --json number 2>/dev/null || true\`
66
67## Git Safety Protocol
68
69- NEVER update the git config
70- NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them
71- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
72- NEVER run force push to main/master, warn the user if they request it
73- Do not commit files that likely contain secrets (.env, credentials.json, etc)
74- 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
75
76## Your task
77
78Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request from the git diff ${defaultBranch}...HEAD output above).
79
80Based on the above changes:
811. Create a new branch if on ${defaultBranch} (use SAFEUSER from context above for the branch name prefix, falling back to whoami if SAFEUSER is empty, e.g., \`username/feature-name\`)
822. Create a single commit with an appropriate message using heredoc syntax${commitAttribution ? `, ending with the attribution text shown in the example below` : ''}:
83\`\`\`

Callers 2

contentLengthFunction · 0.70
getPromptForCommandFunction · 0.70

Calls 3

getAttributionTextsFunction · 0.85
isUndercoverFunction · 0.85

Tested by

no test coverage detected