@iaforged/context-code 1.0.58 → 1.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/src/bridge/bridgeMain.js +40 -40
- package/dist/src/cli/print.js +12 -12
- package/dist/src/commands/commit-push-pr.js +55 -55
- package/dist/src/commands/createMovedToPluginCommand.js +9 -9
- package/dist/src/commands/init-verifiers.js +241 -241
- package/dist/src/commands/init.js +216 -216
- package/dist/src/commands/install.js +2 -2
- package/dist/src/commands/review.js +22 -22
- package/dist/src/commands/terminalSetup/terminalSetup.js +24 -24
- package/dist/src/components/agents/generateAgent.js +92 -92
- package/dist/src/components/grove/Grove.js +10 -10
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +8 -8
- package/dist/src/constants/github-app.js +134 -134
- package/dist/src/constants/prompts.js +123 -123
- package/dist/src/coordinator/coordinatorMode.js +252 -252
- package/dist/src/ink/reconciler.js +7 -7
- package/dist/src/memdir/findRelevantMemories.js +6 -6
- package/dist/src/services/MagicDocs/prompts.js +56 -56
- package/dist/src/services/PromptSuggestion/promptSuggestion.js +29 -29
- package/dist/src/services/SessionMemory/prompts.js +66 -66
- package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +9 -9
- package/dist/src/skills/bundled/batch.js +78 -78
- package/dist/src/skills/bundled/claudeApi.js +34 -34
- package/dist/src/skills/bundled/claudeInChrome.js +4 -4
- package/dist/src/skills/bundled/debug.js +36 -36
- package/dist/src/skills/bundled/scheduleRemoteAgents.js +151 -151
- package/dist/src/skills/bundled/skillify.js +134 -134
- package/dist/src/skills/bundled/stuck.js +53 -53
- package/dist/src/skills/bundled/updateConfig.js +418 -418
- package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +26 -26
- package/dist/src/tools/AgentTool/AgentTool.js +7 -7
- package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +67 -67
- package/dist/src/tools/AgentTool/built-in/exploreAgent.js +32 -32
- package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +13 -13
- package/dist/src/tools/AgentTool/built-in/planAgent.js +49 -49
- package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +129 -129
- package/dist/src/tools/AgentTool/built-in/verificationAgent.js +119 -119
- package/dist/src/tools/AgentTool/prompt.js +131 -131
- package/dist/src/tools/AgentTool/runAgent.js +9 -9
- package/dist/src/tools/BashTool/BashTool.js +10 -10
- package/dist/src/tools/BashTool/prompt.js +94 -94
- package/dist/src/tools/ConfigTool/prompt.js +29 -29
- package/dist/src/tools/EnterWorktreeTool/prompt.js +27 -27
- package/dist/src/tools/FileReadTool/prompt.js +12 -12
- package/dist/src/tools/PowerShellTool/prompt.js +82 -82
- package/dist/src/tools/RemoteTriggerTool/prompt.js +9 -9
- package/dist/src/tools/ScheduleCronTool/prompt.js +37 -37
- package/dist/src/tools/TeamCreateTool/prompt.js +110 -110
- package/dist/src/tools/TeamDeleteTool/prompt.js +13 -13
- package/dist/src/utils/advisor.js +15 -15
- package/dist/src/utils/api.js +2 -2
- package/dist/src/utils/autoUpdater.js +18 -18
- package/dist/src/utils/bash/ShellSnapshot.js +86 -86
- package/dist/src/utils/bash/commands.js +61 -61
- package/dist/src/utils/claudeInChrome/prompt.js +53 -53
- package/dist/src/utils/claudeInChrome/setup.js +8 -8
- package/dist/src/utils/databaseMcp/server/queries.js +632 -632
- package/dist/src/utils/deepLink/registerProtocol.js +35 -35
- package/dist/src/utils/deepLink/terminalLauncher.js +12 -12
- package/dist/src/utils/hooks/execAgentHook.js +7 -7
- package/dist/src/utils/hooks/execPromptHook.js +4 -4
- package/dist/src/utils/hooks/skillImprovement.js +36 -36
- package/dist/src/utils/mcp/dateTimeParser.js +9 -9
- package/dist/src/utils/messages.js +191 -191
- package/dist/src/utils/powershell/parser.js +253 -253
- package/dist/src/utils/sessionTitle.js +12 -12
- package/dist/src/utils/sideQuestion.js +17 -17
- package/dist/src/utils/swarm/backends/registry.js +9 -9
- package/dist/src/utils/telemetry/instrumentation.js +9 -9
- package/dist/src/utils/teleport.js +15 -15
- package/dist/src/utils/undercover.js +28 -28
- package/package.json +170 -170
|
@@ -8,105 +8,105 @@ import { isAutoMemoryEnabled } from '../../memdir/paths.js';
|
|
|
8
8
|
import { logEvent, } from '../../services/analytics/index.js';
|
|
9
9
|
import { jsonParse } from '../../utils/slowOperations.js';
|
|
10
10
|
import { asSystemPrompt } from '../../utils/systemPromptType.js';
|
|
11
|
-
const AGENT_CREATION_SYSTEM_PROMPT = `You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
|
|
12
|
-
|
|
13
|
-
**Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
|
|
14
|
-
|
|
15
|
-
When a user describes what they want an agent to do, you will:
|
|
16
|
-
|
|
17
|
-
1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
|
|
18
|
-
|
|
19
|
-
2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
|
|
20
|
-
|
|
21
|
-
3. **Architect Comprehensive Instructions**: Develop a system prompt that:
|
|
22
|
-
- Establishes clear behavioral boundaries and operational parameters
|
|
23
|
-
- Provides specific methodologies and best practices for task execution
|
|
24
|
-
- Anticipates edge cases and provides guidance for handling them
|
|
25
|
-
- Incorporates any specific requirements or preferences mentioned by the user
|
|
26
|
-
- Defines output format expectations when relevant
|
|
27
|
-
- Aligns with project-specific coding standards and patterns from CLAUDE.md
|
|
28
|
-
|
|
29
|
-
4. **Optimize for Performance**: Include:
|
|
30
|
-
- Decision-making frameworks appropriate to the domain
|
|
31
|
-
- Quality control mechanisms and self-verification steps
|
|
32
|
-
- Efficient workflow patterns
|
|
33
|
-
- Clear escalation or fallback strategies
|
|
34
|
-
|
|
35
|
-
5. **Create Identifier**: Design a concise, descriptive identifier that:
|
|
36
|
-
- Uses lowercase letters, numbers, and hyphens only
|
|
37
|
-
- Is typically 2-4 words joined by hyphens
|
|
38
|
-
- Clearly indicates the agent's primary function
|
|
39
|
-
- Is memorable and easy to type
|
|
40
|
-
- Avoids generic terms like "helper" or "assistant"
|
|
41
|
-
|
|
42
|
-
6 **Example agent descriptions**:
|
|
43
|
-
- in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
|
|
44
|
-
- examples should be of the form:
|
|
45
|
-
- <example>
|
|
46
|
-
Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
|
|
47
|
-
user: "Please write a function that checks if a number is prime"
|
|
48
|
-
assistant: "Here is the relevant function: "
|
|
49
|
-
<function call omitted for brevity only for this example>
|
|
50
|
-
<commentary>
|
|
51
|
-
Since a significant piece of code was written, use the ${AGENT_TOOL_NAME} tool to launch the test-runner agent to run the tests.
|
|
52
|
-
</commentary>
|
|
53
|
-
assistant: "Now let me use the test-runner agent to run the tests"
|
|
54
|
-
</example>
|
|
55
|
-
- <example>
|
|
56
|
-
Context: User is creating an agent to respond to the word "hello" with a friendly jok.
|
|
57
|
-
user: "Hello"
|
|
58
|
-
assistant: "I'm going to use the ${AGENT_TOOL_NAME} tool to launch the greeting-responder agent to respond with a friendly joke"
|
|
59
|
-
<commentary>
|
|
60
|
-
Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
|
|
61
|
-
</commentary>
|
|
62
|
-
</example>
|
|
63
|
-
- If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
|
|
64
|
-
- NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
|
|
65
|
-
|
|
66
|
-
Your output must be a valid JSON object with exactly these fields:
|
|
67
|
-
{
|
|
68
|
-
"identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
|
|
69
|
-
"whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
|
|
70
|
-
"systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
Key principles for your system prompts:
|
|
74
|
-
- Be specific rather than generic - avoid vague instructions
|
|
75
|
-
- Include concrete examples when they would clarify behavior
|
|
76
|
-
- Balance comprehensiveness with clarity - every instruction should add value
|
|
77
|
-
- Ensure the agent has enough context to handle variations of the core task
|
|
78
|
-
- Make the agent proactive in seeking clarification when needed
|
|
79
|
-
- Build in quality assurance and self-correction mechanisms
|
|
80
|
-
|
|
81
|
-
Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
|
|
11
|
+
const AGENT_CREATION_SYSTEM_PROMPT = `You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
|
|
12
|
+
|
|
13
|
+
**Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
|
|
14
|
+
|
|
15
|
+
When a user describes what they want an agent to do, you will:
|
|
16
|
+
|
|
17
|
+
1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
|
|
18
|
+
|
|
19
|
+
2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
|
|
20
|
+
|
|
21
|
+
3. **Architect Comprehensive Instructions**: Develop a system prompt that:
|
|
22
|
+
- Establishes clear behavioral boundaries and operational parameters
|
|
23
|
+
- Provides specific methodologies and best practices for task execution
|
|
24
|
+
- Anticipates edge cases and provides guidance for handling them
|
|
25
|
+
- Incorporates any specific requirements or preferences mentioned by the user
|
|
26
|
+
- Defines output format expectations when relevant
|
|
27
|
+
- Aligns with project-specific coding standards and patterns from CLAUDE.md
|
|
28
|
+
|
|
29
|
+
4. **Optimize for Performance**: Include:
|
|
30
|
+
- Decision-making frameworks appropriate to the domain
|
|
31
|
+
- Quality control mechanisms and self-verification steps
|
|
32
|
+
- Efficient workflow patterns
|
|
33
|
+
- Clear escalation or fallback strategies
|
|
34
|
+
|
|
35
|
+
5. **Create Identifier**: Design a concise, descriptive identifier that:
|
|
36
|
+
- Uses lowercase letters, numbers, and hyphens only
|
|
37
|
+
- Is typically 2-4 words joined by hyphens
|
|
38
|
+
- Clearly indicates the agent's primary function
|
|
39
|
+
- Is memorable and easy to type
|
|
40
|
+
- Avoids generic terms like "helper" or "assistant"
|
|
41
|
+
|
|
42
|
+
6 **Example agent descriptions**:
|
|
43
|
+
- in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
|
|
44
|
+
- examples should be of the form:
|
|
45
|
+
- <example>
|
|
46
|
+
Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
|
|
47
|
+
user: "Please write a function that checks if a number is prime"
|
|
48
|
+
assistant: "Here is the relevant function: "
|
|
49
|
+
<function call omitted for brevity only for this example>
|
|
50
|
+
<commentary>
|
|
51
|
+
Since a significant piece of code was written, use the ${AGENT_TOOL_NAME} tool to launch the test-runner agent to run the tests.
|
|
52
|
+
</commentary>
|
|
53
|
+
assistant: "Now let me use the test-runner agent to run the tests"
|
|
54
|
+
</example>
|
|
55
|
+
- <example>
|
|
56
|
+
Context: User is creating an agent to respond to the word "hello" with a friendly jok.
|
|
57
|
+
user: "Hello"
|
|
58
|
+
assistant: "I'm going to use the ${AGENT_TOOL_NAME} tool to launch the greeting-responder agent to respond with a friendly joke"
|
|
59
|
+
<commentary>
|
|
60
|
+
Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
|
|
61
|
+
</commentary>
|
|
62
|
+
</example>
|
|
63
|
+
- If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
|
|
64
|
+
- NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
|
|
65
|
+
|
|
66
|
+
Your output must be a valid JSON object with exactly these fields:
|
|
67
|
+
{
|
|
68
|
+
"identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
|
|
69
|
+
"whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
|
|
70
|
+
"systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Key principles for your system prompts:
|
|
74
|
+
- Be specific rather than generic - avoid vague instructions
|
|
75
|
+
- Include concrete examples when they would clarify behavior
|
|
76
|
+
- Balance comprehensiveness with clarity - every instruction should add value
|
|
77
|
+
- Ensure the agent has enough context to handle variations of the core task
|
|
78
|
+
- Make the agent proactive in seeking clarification when needed
|
|
79
|
+
- Build in quality assurance and self-correction mechanisms
|
|
80
|
+
|
|
81
|
+
Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
|
|
82
82
|
`;
|
|
83
83
|
// Agent memory instructions to include in the system prompt when memory is mentioned or relevant
|
|
84
|
-
const AGENT_MEMORY_INSTRUCTIONS = `
|
|
85
|
-
|
|
86
|
-
7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.
|
|
87
|
-
|
|
88
|
-
Add a section like this to the systemPrompt, tailored to the agent's specific domain:
|
|
89
|
-
|
|
90
|
-
"**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
|
|
91
|
-
|
|
92
|
-
Examples of what to record:
|
|
93
|
-
- [domain-specific item 1]
|
|
94
|
-
- [domain-specific item 2]
|
|
95
|
-
- [domain-specific item 3]"
|
|
96
|
-
|
|
97
|
-
Examples of domain-specific memory instructions:
|
|
98
|
-
- For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
|
|
99
|
-
- For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
|
|
100
|
-
- For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
|
|
101
|
-
- For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
|
|
102
|
-
|
|
103
|
-
The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
|
|
84
|
+
const AGENT_MEMORY_INSTRUCTIONS = `
|
|
85
|
+
|
|
86
|
+
7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.
|
|
87
|
+
|
|
88
|
+
Add a section like this to the systemPrompt, tailored to the agent's specific domain:
|
|
89
|
+
|
|
90
|
+
"**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
|
|
91
|
+
|
|
92
|
+
Examples of what to record:
|
|
93
|
+
- [domain-specific item 1]
|
|
94
|
+
- [domain-specific item 2]
|
|
95
|
+
- [domain-specific item 3]"
|
|
96
|
+
|
|
97
|
+
Examples of domain-specific memory instructions:
|
|
98
|
+
- For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
|
|
99
|
+
- For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
|
|
100
|
+
- For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
|
|
101
|
+
- For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
|
|
102
|
+
|
|
103
|
+
The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
|
|
104
104
|
`;
|
|
105
105
|
export async function generateAgent(userPrompt, model, existingIdentifiers, abortSignal) {
|
|
106
106
|
const existingList = existingIdentifiers.length > 0
|
|
107
107
|
? `\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${existingIdentifiers.join(', ')}`
|
|
108
108
|
: '';
|
|
109
|
-
const prompt = `Create an agent configuration based on this request: "${userPrompt}".${existingList}
|
|
109
|
+
const prompt = `Create an agent configuration based on this request: "${userPrompt}".${existingList}
|
|
110
110
|
Return ONLY the JSON object, no other text.`;
|
|
111
111
|
const userMessage = createUserMessage({ content: prompt });
|
|
112
112
|
// Fetch user and system contexts
|
|
@@ -8,16 +8,16 @@ import { Select } from '../CustomSelect/index.js';
|
|
|
8
8
|
import { Byline } from '../design-system/Byline.js';
|
|
9
9
|
import { Dialog } from '../design-system/Dialog.js';
|
|
10
10
|
import { KeyboardShortcutHint } from '../design-system/KeyboardShortcutHint.js';
|
|
11
|
-
const NEW_TERMS_ASCII = ` _____________
|
|
12
|
-
| \\ \\
|
|
13
|
-
| NEW TERMS \\__\\
|
|
14
|
-
| |
|
|
15
|
-
| ---------- |
|
|
16
|
-
| ---------- |
|
|
17
|
-
| ---------- |
|
|
18
|
-
| ---------- |
|
|
19
|
-
| ---------- |
|
|
20
|
-
| |
|
|
11
|
+
const NEW_TERMS_ASCII = ` _____________
|
|
12
|
+
| \\ \\
|
|
13
|
+
| NEW TERMS \\__\\
|
|
14
|
+
| |
|
|
15
|
+
| ---------- |
|
|
16
|
+
| ---------- |
|
|
17
|
+
| ---------- |
|
|
18
|
+
| ---------- |
|
|
19
|
+
| ---------- |
|
|
20
|
+
| |
|
|
21
21
|
|______________|`;
|
|
22
22
|
function GracePeriodContentBody() {
|
|
23
23
|
const $ = _c(9);
|
|
@@ -290,11 +290,11 @@ function AskUserQuestionPermissionRequestBody(t0) {
|
|
|
290
290
|
}
|
|
291
291
|
return `- "${q_1.question}"\n (No answer provided)`;
|
|
292
292
|
}).join("\n");
|
|
293
|
-
const feedback = `The user wants to clarify these questions.
|
|
294
|
-
This means they may have additional information, context or questions for you.
|
|
295
|
-
Take their response into account and then reformulate the questions if appropriate.
|
|
296
|
-
Start by asking them what they would like to clarify.
|
|
297
|
-
|
|
293
|
+
const feedback = `The user wants to clarify these questions.
|
|
294
|
+
This means they may have additional information, context or questions for you.
|
|
295
|
+
Take their response into account and then reformulate the questions if appropriate.
|
|
296
|
+
Start by asking them what they would like to clarify.
|
|
297
|
+
|
|
298
298
|
Questions asked:\n${questionsWithAnswers}`;
|
|
299
299
|
if (metadataSource) {
|
|
300
300
|
logEvent("tengu_ask_user_question_respond_to_claude", {
|
|
@@ -331,9 +331,9 @@ function AskUserQuestionPermissionRequestBody(t0) {
|
|
|
331
331
|
}
|
|
332
332
|
return `- "${q_2.question}"\n (No answer provided)`;
|
|
333
333
|
}).join("\n");
|
|
334
|
-
const feedback_0 = `The user has indicated they have provided enough answers for the plan interview.
|
|
335
|
-
Stop asking clarifying questions and proceed to finish the plan with the information you have.
|
|
336
|
-
|
|
334
|
+
const feedback_0 = `The user has indicated they have provided enough answers for the plan interview.
|
|
335
|
+
Stop asking clarifying questions and proceed to finish the plan with the information you have.
|
|
336
|
+
|
|
337
337
|
Questions asked and answers provided:\n${questionsWithAnswers_0}`;
|
|
338
338
|
if (metadataSource) {
|
|
339
339
|
logEvent("tengu_ask_user_question_finish_plan_interview", {
|
|
@@ -1,139 +1,139 @@
|
|
|
1
1
|
export const PR_TITLE = 'Add Context Code GitHub Workflow';
|
|
2
2
|
export const GITHUB_ACTION_SETUP_DOCS_URL = 'https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md';
|
|
3
|
-
export const WORKFLOW_CONTENT = `name: Context Code
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
issue_comment:
|
|
7
|
-
types: [created]
|
|
8
|
-
pull_request_review_comment:
|
|
9
|
-
types: [created]
|
|
10
|
-
issues:
|
|
11
|
-
types: [opened, assigned]
|
|
12
|
-
pull_request_review:
|
|
13
|
-
types: [submitted]
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
claude:
|
|
17
|
-
if: |
|
|
18
|
-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
19
|
-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
20
|
-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
|
21
|
-
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
|
22
|
-
runs-on: ubuntu-latest
|
|
23
|
-
permissions:
|
|
24
|
-
contents: read
|
|
25
|
-
pull-requests: read
|
|
26
|
-
issues: read
|
|
27
|
-
id-token: write
|
|
28
|
-
actions: read # Required for Claude to read CI results on PRs
|
|
29
|
-
steps:
|
|
30
|
-
- name: Checkout repository
|
|
31
|
-
uses: actions/checkout@v4
|
|
32
|
-
with:
|
|
33
|
-
fetch-depth: 1
|
|
34
|
-
|
|
35
|
-
- name: Run Context Code
|
|
36
|
-
id: claude
|
|
37
|
-
uses: anthropics/claude-code-action@v1
|
|
38
|
-
with:
|
|
39
|
-
anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
|
|
40
|
-
|
|
41
|
-
# This is an optional setting that allows Claude to read CI results on PRs
|
|
42
|
-
additional_permissions: |
|
|
43
|
-
actions: read
|
|
44
|
-
|
|
45
|
-
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
|
|
46
|
-
# prompt: 'Update the pull request description to include a summary of changes.'
|
|
47
|
-
|
|
48
|
-
# Optional: Add claude_args to customize behavior and configuration
|
|
49
|
-
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
50
|
-
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
51
|
-
# claude_args: '--allowed-tools Bash(gh pr:*)'
|
|
52
|
-
|
|
3
|
+
export const WORKFLOW_CONTENT = `name: Context Code
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
issue_comment:
|
|
7
|
+
types: [created]
|
|
8
|
+
pull_request_review_comment:
|
|
9
|
+
types: [created]
|
|
10
|
+
issues:
|
|
11
|
+
types: [opened, assigned]
|
|
12
|
+
pull_request_review:
|
|
13
|
+
types: [submitted]
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
claude:
|
|
17
|
+
if: |
|
|
18
|
+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
19
|
+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
20
|
+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
|
21
|
+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
pull-requests: read
|
|
26
|
+
issues: read
|
|
27
|
+
id-token: write
|
|
28
|
+
actions: read # Required for Claude to read CI results on PRs
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout repository
|
|
31
|
+
uses: actions/checkout@v4
|
|
32
|
+
with:
|
|
33
|
+
fetch-depth: 1
|
|
34
|
+
|
|
35
|
+
- name: Run Context Code
|
|
36
|
+
id: claude
|
|
37
|
+
uses: anthropics/claude-code-action@v1
|
|
38
|
+
with:
|
|
39
|
+
anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
|
|
40
|
+
|
|
41
|
+
# This is an optional setting that allows Claude to read CI results on PRs
|
|
42
|
+
additional_permissions: |
|
|
43
|
+
actions: read
|
|
44
|
+
|
|
45
|
+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
|
|
46
|
+
# prompt: 'Update the pull request description to include a summary of changes.'
|
|
47
|
+
|
|
48
|
+
# Optional: Add claude_args to customize behavior and configuration
|
|
49
|
+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
50
|
+
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
51
|
+
# claude_args: '--allowed-tools Bash(gh pr:*)'
|
|
52
|
+
|
|
53
53
|
`;
|
|
54
|
-
export const PR_BODY = `## 🤖 Installing Context Code GitHub App
|
|
55
|
-
|
|
56
|
-
This PR adds a GitHub Actions workflow that enables Context Code integration in our repository.
|
|
57
|
-
|
|
58
|
-
### What is Context Code?
|
|
59
|
-
|
|
60
|
-
[Context Code](https://claude.com/claude-code) is an AI coding agent that can help with:
|
|
61
|
-
- Bug fixes and improvements
|
|
62
|
-
- Documentation updates
|
|
63
|
-
- Implementing new features
|
|
64
|
-
- Code reviews and suggestions
|
|
65
|
-
- Writing tests
|
|
66
|
-
- And more!
|
|
67
|
-
|
|
68
|
-
### How it works
|
|
69
|
-
|
|
70
|
-
Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
|
|
71
|
-
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
|
|
72
|
-
|
|
73
|
-
### Important Notes
|
|
74
|
-
|
|
75
|
-
- **This workflow won't take effect until this PR is merged**
|
|
76
|
-
- **@claude mentions won't work until after the merge is complete**
|
|
77
|
-
- The workflow runs automatically whenever Claude is mentioned in PR or issue comments
|
|
78
|
-
- Claude gets access to the entire PR or issue context including files, diffs, and previous comments
|
|
79
|
-
|
|
80
|
-
### Security
|
|
81
|
-
|
|
82
|
-
- Our Anthropic API key is securely stored as a GitHub Actions secret
|
|
83
|
-
- Only users with write access to the repository can trigger the workflow
|
|
84
|
-
- All Claude runs are stored in the GitHub Actions run history
|
|
85
|
-
- Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
|
|
86
|
-
- We can add more allowed tools by adding them to the workflow file like:
|
|
87
|
-
|
|
88
|
-
\`\`\`
|
|
89
|
-
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)
|
|
90
|
-
\`\`\`
|
|
91
|
-
|
|
92
|
-
There's more information in the [Context Code action repo](https://github.com/anthropics/claude-code-action).
|
|
93
|
-
|
|
54
|
+
export const PR_BODY = `## 🤖 Installing Context Code GitHub App
|
|
55
|
+
|
|
56
|
+
This PR adds a GitHub Actions workflow that enables Context Code integration in our repository.
|
|
57
|
+
|
|
58
|
+
### What is Context Code?
|
|
59
|
+
|
|
60
|
+
[Context Code](https://claude.com/claude-code) is an AI coding agent that can help with:
|
|
61
|
+
- Bug fixes and improvements
|
|
62
|
+
- Documentation updates
|
|
63
|
+
- Implementing new features
|
|
64
|
+
- Code reviews and suggestions
|
|
65
|
+
- Writing tests
|
|
66
|
+
- And more!
|
|
67
|
+
|
|
68
|
+
### How it works
|
|
69
|
+
|
|
70
|
+
Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
|
|
71
|
+
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
|
|
72
|
+
|
|
73
|
+
### Important Notes
|
|
74
|
+
|
|
75
|
+
- **This workflow won't take effect until this PR is merged**
|
|
76
|
+
- **@claude mentions won't work until after the merge is complete**
|
|
77
|
+
- The workflow runs automatically whenever Claude is mentioned in PR or issue comments
|
|
78
|
+
- Claude gets access to the entire PR or issue context including files, diffs, and previous comments
|
|
79
|
+
|
|
80
|
+
### Security
|
|
81
|
+
|
|
82
|
+
- Our Anthropic API key is securely stored as a GitHub Actions secret
|
|
83
|
+
- Only users with write access to the repository can trigger the workflow
|
|
84
|
+
- All Claude runs are stored in the GitHub Actions run history
|
|
85
|
+
- Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
|
|
86
|
+
- We can add more allowed tools by adding them to the workflow file like:
|
|
87
|
+
|
|
88
|
+
\`\`\`
|
|
89
|
+
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)
|
|
90
|
+
\`\`\`
|
|
91
|
+
|
|
92
|
+
There's more information in the [Context Code action repo](https://github.com/anthropics/claude-code-action).
|
|
93
|
+
|
|
94
94
|
After merging this PR, let's try mentioning @claude in a comment on any PR to get started!`;
|
|
95
|
-
export const CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT = `name: Context Code Review
|
|
96
|
-
|
|
97
|
-
on:
|
|
98
|
-
pull_request:
|
|
99
|
-
types: [opened, synchronize, ready_for_review, reopened]
|
|
100
|
-
# Optional: Only run on specific file changes
|
|
101
|
-
# paths:
|
|
102
|
-
# - "src/**/*.ts"
|
|
103
|
-
# - "src/**/*.tsx"
|
|
104
|
-
# - "src/**/*.js"
|
|
105
|
-
# - "src/**/*.jsx"
|
|
106
|
-
|
|
107
|
-
jobs:
|
|
108
|
-
claude-review:
|
|
109
|
-
# Optional: Filter by PR author
|
|
110
|
-
# if: |
|
|
111
|
-
# github.event.pull_request.user.login == 'external-contributor' ||
|
|
112
|
-
# github.event.pull_request.user.login == 'new-developer' ||
|
|
113
|
-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
|
|
114
|
-
|
|
115
|
-
runs-on: ubuntu-latest
|
|
116
|
-
permissions:
|
|
117
|
-
contents: read
|
|
118
|
-
pull-requests: read
|
|
119
|
-
issues: read
|
|
120
|
-
id-token: write
|
|
121
|
-
|
|
122
|
-
steps:
|
|
123
|
-
- name: Checkout repository
|
|
124
|
-
uses: actions/checkout@v4
|
|
125
|
-
with:
|
|
126
|
-
fetch-depth: 1
|
|
127
|
-
|
|
128
|
-
- name: Run Context Code Review
|
|
129
|
-
id: claude-review
|
|
130
|
-
uses: anthropics/claude-code-action@v1
|
|
131
|
-
with:
|
|
132
|
-
anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
|
|
133
|
-
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
|
|
134
|
-
plugins: 'code-review@claude-code-plugins'
|
|
135
|
-
prompt: '/code-review:code-review \${{ github.repository }}/pull/\${{ github.event.pull_request.number }}'
|
|
136
|
-
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
137
|
-
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
138
|
-
|
|
95
|
+
export const CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT = `name: Context Code Review
|
|
96
|
+
|
|
97
|
+
on:
|
|
98
|
+
pull_request:
|
|
99
|
+
types: [opened, synchronize, ready_for_review, reopened]
|
|
100
|
+
# Optional: Only run on specific file changes
|
|
101
|
+
# paths:
|
|
102
|
+
# - "src/**/*.ts"
|
|
103
|
+
# - "src/**/*.tsx"
|
|
104
|
+
# - "src/**/*.js"
|
|
105
|
+
# - "src/**/*.jsx"
|
|
106
|
+
|
|
107
|
+
jobs:
|
|
108
|
+
claude-review:
|
|
109
|
+
# Optional: Filter by PR author
|
|
110
|
+
# if: |
|
|
111
|
+
# github.event.pull_request.user.login == 'external-contributor' ||
|
|
112
|
+
# github.event.pull_request.user.login == 'new-developer' ||
|
|
113
|
+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
|
|
114
|
+
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
permissions:
|
|
117
|
+
contents: read
|
|
118
|
+
pull-requests: read
|
|
119
|
+
issues: read
|
|
120
|
+
id-token: write
|
|
121
|
+
|
|
122
|
+
steps:
|
|
123
|
+
- name: Checkout repository
|
|
124
|
+
uses: actions/checkout@v4
|
|
125
|
+
with:
|
|
126
|
+
fetch-depth: 1
|
|
127
|
+
|
|
128
|
+
- name: Run Context Code Review
|
|
129
|
+
id: claude-review
|
|
130
|
+
uses: anthropics/claude-code-action@v1
|
|
131
|
+
with:
|
|
132
|
+
anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
|
|
133
|
+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
|
|
134
|
+
plugins: 'code-review@claude-code-plugins'
|
|
135
|
+
prompt: '/code-review:code-review \${{ github.repository }}/pull/\${{ github.event.pull_request.number }}'
|
|
136
|
+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
137
|
+
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
138
|
+
|
|
139
139
|
`;
|