( repoType: 'git' | 'sl', defaultBranch: string, prAttribution?: string, )
| 35 | ] |
| 36 | |
| 37 | function getPromptContent( |
| 38 | repoType: 'git' | 'sl', |
| 39 | defaultBranch: string, |
| 40 | prAttribution?: string, |
| 41 | ): string { |
| 42 | const { commit: commitAttribution, pr: defaultPrAttribution } = |
| 43 | getAttributionTexts() |
| 44 | // Use provided PR attribution or fall back to default |
| 45 | const effectivePrAttribution = prAttribution ?? defaultPrAttribution |
| 46 | const safeUser = process.env.SAFEUSER || '' |
| 47 | const username = process.env.USER || '' |
| 48 | |
| 49 | let prefix = '' |
| 50 | let reviewerArg = ' and `--reviewer anthropics/claude-code`' |
| 51 | let addReviewerArg = ' (and add `--add-reviewer anthropics/claude-code`)' |
| 52 | let changelogSection = ` |
| 53 | |
| 54 | ## Changelog |
| 55 | <!-- CHANGELOG:START --> |
| 56 | [If this PR contains user-facing changes, add a changelog entry here. Otherwise, remove this section.] |
| 57 | <!-- CHANGELOG:END -->` |
| 58 | let slackStep = ` |
| 59 | |
| 60 | 5. After creating/updating the PR, check if the user's NCODE.md (or legacy CLAUDE.md) mentions posting to Slack channels. If it does, use ToolSearch to search for "slack send message" tools. If ToolSearch finds a Slack tool, ask the user if they'd like me to post the PR URL to the relevant Slack channel. Only post if the user confirms. If ToolSearch returns no results or errors, skip this step silently—do not mention the failure, do not attempt workarounds, and do not try alternative approaches.` |
| 61 | if (isInternalBuild() && isUndercover()) { |
| 62 | prefix = getUndercoverInstructions() + '\n' |
| 63 | reviewerArg = '' |
| 64 | addReviewerArg = '' |
| 65 | changelogSection = '' |
| 66 | slackStep = '' |
| 67 | } |
| 68 | |
| 69 | const isGit = repoType === 'git' |
| 70 | const statusCmd = isGit ? 'git status' : 'sl status' |
| 71 | const diffCmd = isGit ? 'git diff HEAD' : 'sl diff' |
| 72 | const branchCmd = isGit ? 'git branch --show-current' : 'sl book' |
| 73 | const smartlogLine = isGit ? '' : `\n- \`sl smartlog\`: !\`sl smartlog\`` |
| 74 | const rangeDiffCmd = isGit |
| 75 | ? `git diff ${defaultBranch}...HEAD` |
| 76 | : `sl diff -r ${defaultBranch}` |
| 77 | const scmSafety = isGit ? 'Git Safety Protocol' : 'Sl Safety Protocol' |
| 78 | const configWarning = isGit ? 'NEVER update the git config' : 'NEVER update the sl config' |
| 79 | const destructiveWarning = isGit |
| 80 | ? 'NEVER run destructive/irreversible git commands (like push --force, hard reset, etc)' |
| 81 | : 'NEVER run destructive/irreversible sl commands (like push --force, hard reset, etc)' |
| 82 | const interactiveWarning = isGit |
| 83 | ? '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' |
| 84 | : 'Never use sl commands with the -i flag (like sl rebase -i or sl add -i) since they require interactive input which is not supported' |
| 85 | const branchAction = isGit |
| 86 | ? `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\`)` |
| 87 | : `Create a new bookmark if on ${defaultBranch} (use SAFEUSER from context above for the bookmark name prefix, falling back to whoami if SAFEUSER is empty, e.g., \`username/feature-name\`) using \`sl book <name>\`` |
| 88 | const commitCmd = isGit ? 'git commit' : 'sl commit' |
| 89 | const pushCmd = isGit |
| 90 | ? 'Push the branch to origin' |
| 91 | : 'Push the bookmark to origin using \`sl push -B <bookmark>\`' |
| 92 | |
| 93 | return `${prefix}## Context |
| 94 |
no test coverage detected