MCPcopy Index your code
hub / github.com/Noumena-Network/code / getPromptForCommand

Function getPromptForCommand

src/commands/commit-push-pr.ts:155–194  ·  view source on GitHub ↗
(args, context)

Source from the content-addressed store, hash-verified

153 progressMessage: 'creating commit and PR',
154 source: 'builtin',
155 async getPromptForCommand(args, context) {
156 // Get default branch and enhanced PR attribution
157 const [defaultBranch, prAttribution] = await Promise.all([
158 getDefaultBranch(),
159 getEnhancedPRAttribution(context.getAppState),
160 ])
161 const isGit = await getIsGit()
162 const isSl = !isGit && await getIsSl()
163 const repoType = isGit ? 'git' : isSl ? 'sl' : 'git'
164 let promptContent = getPromptContent(repoType, defaultBranch, prAttribution)
165
166 // Append user instructions if args provided
167 const trimmedArgs = args?.trim()
168 if (trimmedArgs) {
169 promptContent += `\n\n## Additional instructions from user\n\n${trimmedArgs}`
170 }
171
172 const finalContent = await executeShellCommandsInPrompt(
173 promptContent,
174 {
175 ...context,
176 getAppState() {
177 const appState = context.getAppState()
178 return {
179 ...appState,
180 toolPermissionContext: {
181 ...appState.toolPermissionContext,
182 alwaysAllowRules: {
183 ...appState.toolPermissionContext.alwaysAllowRules,
184 command: ALLOWED_TOOLS,
185 },
186 },
187 }
188 },
189 },
190 '/commit-push-pr',
191 )
192
193 return [{ type: 'text', text: finalContent }]
194 },
195} satisfies Command
196
197export default command

Callers

nothing calls this directly

Calls 4

getDefaultBranchFunction · 0.85
getEnhancedPRAttributionFunction · 0.85
getPromptContentFunction · 0.70

Tested by

no test coverage detected