@codemieai/code 0.0.3 → 0.0.4
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/README.md +375 -325
- package/bin/codemie-claude.js +23 -0
- package/bin/codemie-code.js +49 -11
- package/bin/codemie-codex.js +12 -13
- package/dist/agents/adapters/claude-code.d.ts +5 -0
- package/dist/agents/adapters/claude-code.d.ts.map +1 -1
- package/dist/agents/adapters/claude-code.js +76 -18
- package/dist/agents/adapters/claude-code.js.map +1 -1
- package/dist/agents/adapters/codex.d.ts +5 -0
- package/dist/agents/adapters/codex.d.ts.map +1 -1
- package/dist/agents/adapters/codex.js +75 -17
- package/dist/agents/adapters/codex.js.map +1 -1
- package/dist/agents/codemie-code/agent.d.ts.map +1 -1
- package/dist/agents/codemie-code/agent.js +187 -21
- package/dist/agents/codemie-code/agent.js.map +1 -1
- package/dist/agents/codemie-code/config.d.ts.map +1 -1
- package/dist/agents/codemie-code/config.js +29 -27
- package/dist/agents/codemie-code/config.js.map +1 -1
- package/dist/agents/codemie-code/index.d.ts +16 -2
- package/dist/agents/codemie-code/index.d.ts.map +1 -1
- package/dist/agents/codemie-code/index.js +74 -6
- package/dist/agents/codemie-code/index.js.map +1 -1
- package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts +87 -0
- package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts.map +1 -0
- package/dist/agents/codemie-code/modes/contextAwarePlanning.js +957 -0
- package/dist/agents/codemie-code/modes/contextAwarePlanning.js.map +1 -0
- package/dist/agents/codemie-code/modes/planMode.d.ts +116 -0
- package/dist/agents/codemie-code/modes/planMode.d.ts.map +1 -0
- package/dist/agents/codemie-code/modes/planMode.js +537 -0
- package/dist/agents/codemie-code/modes/planMode.js.map +1 -0
- package/dist/agents/codemie-code/prompts.d.ts +29 -0
- package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
- package/dist/agents/codemie-code/prompts.js +129 -0
- package/dist/agents/codemie-code/prompts.js.map +1 -1
- package/dist/agents/codemie-code/storage/todoStorage.d.ts +78 -0
- package/dist/agents/codemie-code/storage/todoStorage.d.ts.map +1 -0
- package/dist/agents/codemie-code/storage/todoStorage.js +225 -0
- package/dist/agents/codemie-code/storage/todoStorage.js.map +1 -0
- package/dist/agents/codemie-code/tokenUtils.js +1 -1
- package/dist/agents/codemie-code/tokenUtils.js.map +1 -1
- package/dist/agents/codemie-code/tools/index.d.ts +26 -0
- package/dist/agents/codemie-code/tools/index.d.ts.map +1 -1
- package/dist/agents/codemie-code/tools/index.js +182 -14
- package/dist/agents/codemie-code/tools/index.js.map +1 -1
- package/dist/agents/codemie-code/tools/planning.d.ts +53 -0
- package/dist/agents/codemie-code/tools/planning.d.ts.map +1 -0
- package/dist/agents/codemie-code/tools/planning.js +224 -0
- package/dist/agents/codemie-code/tools/planning.js.map +1 -0
- package/dist/agents/codemie-code/types.d.ts +170 -6
- package/dist/agents/codemie-code/types.d.ts.map +1 -1
- package/dist/agents/codemie-code/types.js.map +1 -1
- package/dist/agents/codemie-code/ui/progressTracker.d.ts +125 -0
- package/dist/agents/codemie-code/ui/progressTracker.d.ts.map +1 -0
- package/dist/agents/codemie-code/ui/progressTracker.js +343 -0
- package/dist/agents/codemie-code/ui/progressTracker.js.map +1 -0
- package/dist/agents/codemie-code/ui/todoPanel.d.ts +112 -0
- package/dist/agents/codemie-code/ui/todoPanel.d.ts.map +1 -0
- package/dist/agents/codemie-code/ui/todoPanel.js +318 -0
- package/dist/agents/codemie-code/ui/todoPanel.js.map +1 -0
- package/dist/agents/codemie-code/ui.d.ts +106 -10
- package/dist/agents/codemie-code/ui.d.ts.map +1 -1
- package/dist/agents/codemie-code/ui.js +913 -129
- package/dist/agents/codemie-code/ui.js.map +1 -1
- package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts +87 -0
- package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts.map +1 -0
- package/dist/agents/codemie-code/utils/progressionEnforcer.js +293 -0
- package/dist/agents/codemie-code/utils/progressionEnforcer.js.map +1 -0
- package/dist/agents/codemie-code/utils/todoParser.d.ts +41 -0
- package/dist/agents/codemie-code/utils/todoParser.d.ts.map +1 -0
- package/dist/agents/codemie-code/utils/todoParser.js +305 -0
- package/dist/agents/codemie-code/utils/todoParser.js.map +1 -0
- package/dist/agents/codemie-code/utils/todoValidator.d.ts +65 -0
- package/dist/agents/codemie-code/utils/todoValidator.d.ts.map +1 -0
- package/dist/agents/codemie-code/utils/todoValidator.js +249 -0
- package/dist/agents/codemie-code/utils/todoValidator.js.map +1 -0
- package/dist/agents/codemie-code/validators/planValidator.d.ts +94 -0
- package/dist/agents/codemie-code/validators/planValidator.d.ts.map +1 -0
- package/dist/agents/codemie-code/validators/planValidator.js +281 -0
- package/dist/agents/codemie-code/validators/planValidator.js.map +1 -0
- package/dist/agents/registry.d.ts.map +1 -1
- package/dist/agents/registry.js +7 -5
- package/dist/agents/registry.js.map +1 -1
- package/dist/cli/commands/auth.d.ts +3 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +170 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +40 -13
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +209 -16
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/env.js +3 -3
- package/dist/cli/commands/env.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +2 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +15 -9
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +177 -11
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/tools.d.ts +6 -0
- package/dist/cli/commands/tools.d.ts.map +1 -0
- package/dist/cli/commands/tools.js +244 -0
- package/dist/cli/commands/tools.js.map +1 -0
- package/dist/cli/commands/version.js +1 -1
- package/dist/cli/commands/version.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts +6 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +424 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.js +39 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/clients/adapters/github.d.ts +17 -0
- package/dist/clients/adapters/github.d.ts.map +1 -0
- package/dist/clients/adapters/github.js +150 -0
- package/dist/clients/adapters/github.js.map +1 -0
- package/dist/clients/adapters/gitlab.d.ts +17 -0
- package/dist/clients/adapters/gitlab.d.ts.map +1 -0
- package/dist/clients/adapters/gitlab.js +147 -0
- package/dist/clients/adapters/gitlab.js.map +1 -0
- package/dist/clients/registry.d.ts +20 -0
- package/dist/clients/registry.d.ts.map +1 -0
- package/dist/clients/registry.js +27 -0
- package/dist/clients/registry.js.map +1 -0
- package/dist/tools/detector.d.ts +33 -0
- package/dist/tools/detector.d.ts.map +1 -0
- package/dist/tools/detector.js +145 -0
- package/dist/tools/detector.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manager.d.ts +21 -0
- package/dist/tools/manager.d.ts.map +1 -0
- package/dist/tools/manager.js +104 -0
- package/dist/tools/manager.js.map +1 -0
- package/dist/tools/registry.d.ts +8 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +36 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +41 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +5 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/sso.d.ts +42 -0
- package/dist/types/sso.d.ts.map +1 -0
- package/dist/types/sso.js +2 -0
- package/dist/types/sso.js.map +1 -0
- package/dist/utils/agent-compatibility.d.ts +32 -0
- package/dist/utils/agent-compatibility.d.ts.map +1 -0
- package/dist/utils/agent-compatibility.js +140 -0
- package/dist/utils/agent-compatibility.js.map +1 -0
- package/dist/utils/codemie-integration-validator.d.ts +17 -0
- package/dist/utils/codemie-integration-validator.d.ts.map +1 -0
- package/dist/utils/codemie-integration-validator.js +105 -0
- package/dist/utils/codemie-integration-validator.js.map +1 -0
- package/dist/utils/codemie-model-fetcher.d.ts +11 -0
- package/dist/utils/codemie-model-fetcher.d.ts.map +1 -0
- package/dist/utils/codemie-model-fetcher.js +242 -0
- package/dist/utils/codemie-model-fetcher.js.map +1 -0
- package/dist/utils/config-loader.d.ts +23 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +73 -27
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/credential-store.d.ts +16 -0
- package/dist/utils/credential-store.d.ts.map +1 -0
- package/dist/utils/credential-store.js +109 -0
- package/dist/utils/credential-store.js.map +1 -0
- package/dist/utils/first-time.d.ts +1 -1
- package/dist/utils/first-time.d.ts.map +1 -1
- package/dist/utils/first-time.js +52 -71
- package/dist/utils/first-time.js.map +1 -1
- package/dist/utils/health-checker.d.ts.map +1 -1
- package/dist/utils/health-checker.js +5 -1
- package/dist/utils/health-checker.js.map +1 -1
- package/dist/utils/model-fetcher.d.ts.map +1 -1
- package/dist/utils/model-fetcher.js +15 -2
- package/dist/utils/model-fetcher.js.map +1 -1
- package/dist/utils/sso-auth.d.ts +15 -0
- package/dist/utils/sso-auth.d.ts.map +1 -0
- package/dist/utils/sso-auth.js +207 -0
- package/dist/utils/sso-auth.js.map +1 -0
- package/dist/utils/sso-gateway.d.ts +47 -0
- package/dist/utils/sso-gateway.d.ts.map +1 -0
- package/dist/utils/sso-gateway.js +298 -0
- package/dist/utils/sso-gateway.js.map +1 -0
- package/dist/workflows/detector.d.ts +37 -0
- package/dist/workflows/detector.d.ts.map +1 -0
- package/dist/workflows/detector.js +160 -0
- package/dist/workflows/detector.js.map +1 -0
- package/dist/workflows/index.d.ts +8 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +8 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/installer.d.ts +24 -0
- package/dist/workflows/installer.d.ts.map +1 -0
- package/dist/workflows/installer.js +105 -0
- package/dist/workflows/installer.js.map +1 -0
- package/dist/workflows/registry.d.ts +29 -0
- package/dist/workflows/registry.d.ts.map +1 -0
- package/dist/workflows/registry.js +54 -0
- package/dist/workflows/registry.js.map +1 -0
- package/dist/workflows/templates/github/metadata.d.ts +6 -0
- package/dist/workflows/templates/github/metadata.d.ts.map +1 -0
- package/dist/workflows/templates/github/metadata.js +111 -0
- package/dist/workflows/templates/github/metadata.js.map +1 -0
- package/dist/workflows/templates/gitlab/metadata.d.ts +6 -0
- package/dist/workflows/templates/gitlab/metadata.d.ts.map +1 -0
- package/dist/workflows/templates/gitlab/metadata.js +14 -0
- package/dist/workflows/templates/gitlab/metadata.js.map +1 -0
- package/dist/workflows/types.d.ts +71 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +5 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +19 -6
- package/src/workflows/templates/github/code-ci.yml +529 -0
- package/src/workflows/templates/github/inline-fix.yml +665 -0
- package/src/workflows/templates/github/pr-review.yml +677 -0
- package/.claude/agents/README.md +0 -298
- package/.claude/agents/release-manager.md +0 -857
- package/.codemie/guides/git-workflow.md +0 -493
- package/CLAUDE.md +0 -225
- package/config.example.json +0 -10
- package/dist/agents/codemie-code/streaming/events.d.ts +0 -7
- package/dist/agents/codemie-code/streaming/events.d.ts.map +0 -1
- package/dist/agents/codemie-code/streaming/events.js +0 -7
- package/dist/agents/codemie-code/streaming/events.js.map +0 -1
- package/dist/agents/codemie-code/streaming/formatter.d.ts +0 -2
- package/dist/agents/codemie-code/streaming/formatter.d.ts.map +0 -1
- package/dist/agents/codemie-code/streaming/formatter.js +0 -2
- package/dist/agents/codemie-code/streaming/formatter.js.map +0 -1
- package/dist/agents/codemie-code/streaming/ui.d.ts +0 -2
- package/dist/agents/codemie-code/streaming/ui.d.ts.map +0 -1
- package/dist/agents/codemie-code/streaming/ui.js +0 -2
- package/dist/agents/codemie-code/streaming/ui.js.map +0 -1
- package/dist/agents/codemie-code/tools/command.d.ts +0 -2
- package/dist/agents/codemie-code/tools/command.d.ts.map +0 -1
- package/dist/agents/codemie-code/tools/command.js +0 -2
- package/dist/agents/codemie-code/tools/command.js.map +0 -1
- package/dist/agents/codemie-code/tools/filesystem.d.ts +0 -2
- package/dist/agents/codemie-code/tools/filesystem.d.ts.map +0 -1
- package/dist/agents/codemie-code/tools/filesystem.js +0 -2
- package/dist/agents/codemie-code/tools/filesystem.js.map +0 -1
- package/dist/agents/codemie-code/tools/git.d.ts +0 -2
- package/dist/agents/codemie-code/tools/git.d.ts.map +0 -1
- package/dist/agents/codemie-code/tools/git.js +0 -2
- package/dist/agents/codemie-code/tools/git.js.map +0 -1
- package/dist/agents/codemie-code/tools/security.d.ts +0 -2
- package/dist/agents/codemie-code/tools/security.d.ts.map +0 -1
- package/dist/agents/codemie-code/tools/security.js +0 -2
- package/dist/agents/codemie-code/tools/security.js.map +0 -1
- package/eslint.config.mjs +0 -43
- package/scripts/README.md +0 -80
- package/scripts/release.sh +0 -156
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
name: '🔧 CodeMie Inline Code Fix'
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
pull_request_review_comment:
|
|
7
|
+
types: [created]
|
|
8
|
+
pull_request_review:
|
|
9
|
+
types: [submitted]
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number }}-${{ github.event.comment.id || github.event.review.id }}
|
|
13
|
+
cancel-in-progress: false # Don't cancel - each fix request is independent
|
|
14
|
+
|
|
15
|
+
defaults:
|
|
16
|
+
run:
|
|
17
|
+
shell: bash
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: write
|
|
21
|
+
pull-requests: write
|
|
22
|
+
issues: write
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
codemie-fix:
|
|
26
|
+
# Only run if @codemie is mentioned but NOT @codemie-review or @codemie-ai-review (which trigger the review workflow)
|
|
27
|
+
if: |
|
|
28
|
+
(github.event_name == 'issue_comment' &&
|
|
29
|
+
github.event.issue.pull_request != null &&
|
|
30
|
+
(contains(github.event.comment.body, '@codemie') ||
|
|
31
|
+
contains(github.event.comment.body, '@CodeMie') ||
|
|
32
|
+
contains(github.event.comment.body, '@CODEMIE')) &&
|
|
33
|
+
!(contains(github.event.comment.body, '@codemie-review') ||
|
|
34
|
+
contains(github.event.comment.body, '@codemie-ai-review') ||
|
|
35
|
+
contains(github.event.comment.body, '@CodeMie-review') ||
|
|
36
|
+
contains(github.event.comment.body, '@CODEMIE-REVIEW'))) ||
|
|
37
|
+
(github.event_name == 'pull_request_review_comment' &&
|
|
38
|
+
(contains(github.event.comment.body, '@codemie') ||
|
|
39
|
+
contains(github.event.comment.body, '@CodeMie') ||
|
|
40
|
+
contains(github.event.comment.body, '@CODEMIE')) &&
|
|
41
|
+
!(contains(github.event.comment.body, '@codemie-review') ||
|
|
42
|
+
contains(github.event.comment.body, '@codemie-ai-review') ||
|
|
43
|
+
contains(github.event.comment.body, '@CodeMie-review') ||
|
|
44
|
+
contains(github.event.comment.body, '@CODEMIE-REVIEW'))) ||
|
|
45
|
+
(github.event_name == 'pull_request_review' &&
|
|
46
|
+
(contains(github.event.review.body, '@codemie') ||
|
|
47
|
+
contains(github.event.review.body, '@CodeMie') ||
|
|
48
|
+
contains(github.event.review.body, '@CODEMIE')) &&
|
|
49
|
+
!(contains(github.event.review.body, '@codemie-review') ||
|
|
50
|
+
contains(github.event.review.body, '@codemie-ai-review') ||
|
|
51
|
+
contains(github.event.review.body, '@CodeMie-review') ||
|
|
52
|
+
contains(github.event.review.body, '@CODEMIE-REVIEW')))
|
|
53
|
+
|
|
54
|
+
timeout-minutes: 10
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
environment: dev
|
|
57
|
+
|
|
58
|
+
steps:
|
|
59
|
+
- name: Add "eyes" reaction to show we're working
|
|
60
|
+
uses: actions/github-script@v7
|
|
61
|
+
continue-on-error: true
|
|
62
|
+
with:
|
|
63
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
64
|
+
script: |
|
|
65
|
+
try {
|
|
66
|
+
let commentId;
|
|
67
|
+
let reactionType;
|
|
68
|
+
|
|
69
|
+
if (context.eventName === 'pull_request_review_comment') {
|
|
70
|
+
// For PR review comments (inline), use different API
|
|
71
|
+
commentId = context.payload.comment.id;
|
|
72
|
+
reactionType = 'createForPullRequestReviewComment';
|
|
73
|
+
} else if (context.eventName === 'issue_comment') {
|
|
74
|
+
// For issue/PR conversation comments
|
|
75
|
+
commentId = context.payload.comment.id;
|
|
76
|
+
reactionType = 'createForIssueComment';
|
|
77
|
+
} else if (context.eventName === 'pull_request_review') {
|
|
78
|
+
// For review summaries - can't add reaction, skip
|
|
79
|
+
console.log('Cannot add reaction to review summary, skipping');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (commentId) {
|
|
84
|
+
await github.rest.reactions[reactionType]({
|
|
85
|
+
owner: context.repo.owner,
|
|
86
|
+
repo: context.repo.repo,
|
|
87
|
+
comment_id: commentId,
|
|
88
|
+
content: 'eyes'
|
|
89
|
+
});
|
|
90
|
+
console.log('Added eyes reaction to comment', commentId);
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.log('Failed to add reaction (non-critical):', error.message);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
- name: Extract PR and branch information
|
|
97
|
+
id: pr_info
|
|
98
|
+
uses: actions/github-script@v7
|
|
99
|
+
with:
|
|
100
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
101
|
+
script: |
|
|
102
|
+
let prNumber, branchName, commentBody, commentUrl, commentPath, commentLine, isReply;
|
|
103
|
+
|
|
104
|
+
// Get PR number and comment details based on event type
|
|
105
|
+
if (context.eventName === 'issue_comment' && context.payload.issue.pull_request) {
|
|
106
|
+
// Comment on PR conversation (includes replies)
|
|
107
|
+
prNumber = context.payload.issue.number;
|
|
108
|
+
commentBody = context.payload.comment.body;
|
|
109
|
+
commentUrl = context.payload.comment.html_url;
|
|
110
|
+
|
|
111
|
+
// Check if this is a reply to another comment
|
|
112
|
+
if (context.payload.comment.in_reply_to_id) {
|
|
113
|
+
isReply = true;
|
|
114
|
+
console.log('This is a reply to comment:', context.payload.comment.in_reply_to_id);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Get PR details to find branch
|
|
118
|
+
const pr = await github.rest.pulls.get({
|
|
119
|
+
owner: context.repo.owner,
|
|
120
|
+
repo: context.repo.repo,
|
|
121
|
+
pull_number: prNumber
|
|
122
|
+
});
|
|
123
|
+
branchName = pr.data.head.ref;
|
|
124
|
+
|
|
125
|
+
} else if (context.eventName === 'pull_request_review_comment') {
|
|
126
|
+
// Inline comment on PR diff (or reply to inline comment)
|
|
127
|
+
prNumber = context.payload.pull_request.number;
|
|
128
|
+
branchName = context.payload.pull_request.head.ref;
|
|
129
|
+
commentBody = context.payload.comment.body;
|
|
130
|
+
commentUrl = context.payload.comment.html_url;
|
|
131
|
+
commentPath = context.payload.comment.path;
|
|
132
|
+
commentLine = context.payload.comment.line || context.payload.comment.original_line;
|
|
133
|
+
|
|
134
|
+
// Check if this is a reply
|
|
135
|
+
if (context.payload.comment.in_reply_to_id) {
|
|
136
|
+
isReply = true;
|
|
137
|
+
console.log('This is a reply to inline comment:', context.payload.comment.in_reply_to_id);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
} else if (context.eventName === 'pull_request_review') {
|
|
141
|
+
// Review comment
|
|
142
|
+
prNumber = context.payload.pull_request.number;
|
|
143
|
+
branchName = context.payload.pull_request.head.ref;
|
|
144
|
+
commentBody = context.payload.review.body;
|
|
145
|
+
commentUrl = context.payload.review.html_url;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Extract instructions after @codemie or @codemie-ai (case-insensitive)
|
|
149
|
+
const instructions = commentBody.replace(/@codemie(-ai)?\s*/i, '').trim();
|
|
150
|
+
|
|
151
|
+
core.setOutput('pr_number', prNumber);
|
|
152
|
+
core.setOutput('branch_name', branchName);
|
|
153
|
+
core.setOutput('comment_body', commentBody);
|
|
154
|
+
core.setOutput('comment_url', commentUrl);
|
|
155
|
+
core.setOutput('instructions', instructions);
|
|
156
|
+
core.setOutput('comment_path', commentPath || '');
|
|
157
|
+
core.setOutput('comment_line', commentLine || '');
|
|
158
|
+
core.setOutput('is_reply', isReply || false);
|
|
159
|
+
|
|
160
|
+
console.log('='.repeat(50));
|
|
161
|
+
console.log('PR Number:', prNumber);
|
|
162
|
+
console.log('Branch:', branchName);
|
|
163
|
+
console.log('Is Reply:', isReply || false);
|
|
164
|
+
console.log('Instructions:', instructions);
|
|
165
|
+
console.log('File:', commentPath || 'N/A');
|
|
166
|
+
console.log('Line:', commentLine || 'N/A');
|
|
167
|
+
console.log('Comment URL:', commentUrl);
|
|
168
|
+
console.log('='.repeat(50));
|
|
169
|
+
|
|
170
|
+
- name: Checkout PR branch
|
|
171
|
+
uses: actions/checkout@v4
|
|
172
|
+
with:
|
|
173
|
+
ref: ${{ steps.pr_info.outputs.branch_name }}
|
|
174
|
+
fetch-depth: 0
|
|
175
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
176
|
+
|
|
177
|
+
- name: Set up Node.js
|
|
178
|
+
uses: actions/setup-node@v4
|
|
179
|
+
with:
|
|
180
|
+
node-version: '24'
|
|
181
|
+
|
|
182
|
+
- name: Install CodeMie CLI
|
|
183
|
+
run: npm install -g @codemieai/code
|
|
184
|
+
|
|
185
|
+
- name: Install Claude Code
|
|
186
|
+
run: codemie install claude
|
|
187
|
+
|
|
188
|
+
- name: Set up Python
|
|
189
|
+
uses: actions/setup-python@v5
|
|
190
|
+
with:
|
|
191
|
+
python-version: '3.11'
|
|
192
|
+
|
|
193
|
+
- name: Install Poetry
|
|
194
|
+
uses: snok/install-poetry@v1
|
|
195
|
+
with:
|
|
196
|
+
version: '1.8.0'
|
|
197
|
+
virtualenvs-create: true
|
|
198
|
+
virtualenvs-in-project: true
|
|
199
|
+
|
|
200
|
+
- name: Cache Poetry dependencies
|
|
201
|
+
uses: actions/cache@v4
|
|
202
|
+
with:
|
|
203
|
+
path: ~/.cache/pypoetry
|
|
204
|
+
key: poetry-cache-${{ runner.os }}-py3.11-${{ hashFiles('**/poetry.lock') }}
|
|
205
|
+
restore-keys: |
|
|
206
|
+
poetry-cache-${{ runner.os }}-py3.11-
|
|
207
|
+
|
|
208
|
+
- name: Load cached venv
|
|
209
|
+
id: cached-poetry-dependencies
|
|
210
|
+
uses: actions/cache@v4
|
|
211
|
+
with:
|
|
212
|
+
path: .venv
|
|
213
|
+
key: venv-${{ runner.os }}-py3.11-${{ hashFiles('**/poetry.lock') }}
|
|
214
|
+
restore-keys: |
|
|
215
|
+
venv-${{ runner.os }}-py3.11-
|
|
216
|
+
|
|
217
|
+
- name: Install dependencies
|
|
218
|
+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
219
|
+
run: poetry install --no-interaction
|
|
220
|
+
|
|
221
|
+
- name: Configure Git
|
|
222
|
+
run: |
|
|
223
|
+
git config --global user.email "codemie-bot[bot]@users.noreply.github.com"
|
|
224
|
+
git config --global user.name "CodeMie Bot"
|
|
225
|
+
|
|
226
|
+
- name: Verify AWS Credentials
|
|
227
|
+
run: |
|
|
228
|
+
if [ -z "${{ secrets.AWS_REGION }}" ]; then
|
|
229
|
+
echo "❌ ERROR: AWS_REGION secret is not set"
|
|
230
|
+
exit 1
|
|
231
|
+
fi
|
|
232
|
+
if [ -z "${{ secrets.AWS_ACCESS_KEY_ID }}" ]; then
|
|
233
|
+
echo "❌ ERROR: AWS_ACCESS_KEY_ID secret is not set"
|
|
234
|
+
exit 1
|
|
235
|
+
fi
|
|
236
|
+
if [ -z "${{ secrets.AWS_SECRET_ACCESS_KEY }}" ]; then
|
|
237
|
+
echo "❌ ERROR: AWS_SECRET_ACCESS_KEY secret is not set"
|
|
238
|
+
exit 1
|
|
239
|
+
fi
|
|
240
|
+
echo "✅ AWS credentials configured"
|
|
241
|
+
|
|
242
|
+
- name: Run CodeMie Inline Fix
|
|
243
|
+
id: codemie_fix
|
|
244
|
+
env:
|
|
245
|
+
# AWS Bedrock Configuration
|
|
246
|
+
CLAUDE_CODE_USE_BEDROCK: "1"
|
|
247
|
+
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
248
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
249
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
250
|
+
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
251
|
+
# Project Configuration
|
|
252
|
+
PYTHONPATH: "src"
|
|
253
|
+
POETRY_VIRTUALENVS_IN_PROJECT: "true"
|
|
254
|
+
# CI Configuration
|
|
255
|
+
CI: "true"
|
|
256
|
+
GITHUB_ACTIONS: "true"
|
|
257
|
+
# Claude Configuration
|
|
258
|
+
MAX_TURNS: ${{ vars.CODEMIE_MAX_TURNS || '50' }}
|
|
259
|
+
# Context
|
|
260
|
+
PR_NUMBER: ${{ steps.pr_info.outputs.pr_number }}
|
|
261
|
+
BRANCH_NAME: ${{ steps.pr_info.outputs.branch_name }}
|
|
262
|
+
INSTRUCTIONS: ${{ steps.pr_info.outputs.instructions }}
|
|
263
|
+
COMMENT_PATH: ${{ steps.pr_info.outputs.comment_path }}
|
|
264
|
+
COMMENT_LINE: ${{ steps.pr_info.outputs.comment_line }}
|
|
265
|
+
COMMENT_URL: ${{ steps.pr_info.outputs.comment_url }}
|
|
266
|
+
run: |
|
|
267
|
+
set -euo pipefail
|
|
268
|
+
|
|
269
|
+
# Determine model
|
|
270
|
+
MODEL="${{ secrets.ANTHROPIC_MODEL }}"
|
|
271
|
+
if [ -z "$MODEL" ]; then
|
|
272
|
+
MODEL="anthropic.claude-3-5-sonnet-20241022-v2:0"
|
|
273
|
+
fi
|
|
274
|
+
|
|
275
|
+
echo "================================================"
|
|
276
|
+
echo "CodeMie Inline Fix"
|
|
277
|
+
echo "================================================"
|
|
278
|
+
echo "PR: #${PR_NUMBER}"
|
|
279
|
+
echo "Branch: ${BRANCH_NAME}"
|
|
280
|
+
echo "Model: ${MODEL}"
|
|
281
|
+
echo "Instructions: ${INSTRUCTIONS}"
|
|
282
|
+
if [ -n "${COMMENT_PATH}" ]; then
|
|
283
|
+
echo "File: ${COMMENT_PATH}:${COMMENT_LINE}"
|
|
284
|
+
fi
|
|
285
|
+
echo "Comment: ${COMMENT_URL}"
|
|
286
|
+
echo "================================================"
|
|
287
|
+
|
|
288
|
+
# Create focused prompt for quick inline fix
|
|
289
|
+
cat > /tmp/fix-prompt.txt << 'PROMPT_EOF'
|
|
290
|
+
## Your Role
|
|
291
|
+
|
|
292
|
+
You are CodeMie, a focused code assistant that makes quick, precise code changes based on comments.
|
|
293
|
+
|
|
294
|
+
## Your Task
|
|
295
|
+
|
|
296
|
+
Someone has commented on code in a Pull Request asking you to make a change. Your job is to:
|
|
297
|
+
1. Understand the request
|
|
298
|
+
2. Make the specific change requested
|
|
299
|
+
3. Commit it
|
|
300
|
+
4. Keep it simple and focused
|
|
301
|
+
|
|
302
|
+
## Context
|
|
303
|
+
|
|
304
|
+
- **PR Number**: ${PR_NUMBER}
|
|
305
|
+
- **Branch**: ${BRANCH_NAME}
|
|
306
|
+
- **Request**: ${INSTRUCTIONS}
|
|
307
|
+
PROMPT_EOF
|
|
308
|
+
|
|
309
|
+
# Add file context if this is an inline comment
|
|
310
|
+
if [ -n "${COMMENT_PATH}" ]; then
|
|
311
|
+
cat >> /tmp/fix-prompt.txt << PROMPT_EOF2
|
|
312
|
+
|
|
313
|
+
- **File commented on**: ${COMMENT_PATH}
|
|
314
|
+
- **Line number**: ${COMMENT_LINE}
|
|
315
|
+
- **Comment location**: ${COMMENT_URL}
|
|
316
|
+
|
|
317
|
+
## Instructions
|
|
318
|
+
|
|
319
|
+
1. First, read the file that was commented on:
|
|
320
|
+
\`\`\`bash
|
|
321
|
+
cat "${COMMENT_PATH}"
|
|
322
|
+
\`\`\`
|
|
323
|
+
|
|
324
|
+
2. Look at the specific line (around line ${COMMENT_LINE}) and understand the context
|
|
325
|
+
|
|
326
|
+
3. Make the change requested: ${INSTRUCTIONS}
|
|
327
|
+
|
|
328
|
+
4. The change should be focused on the commented code area
|
|
329
|
+
PROMPT_EOF2
|
|
330
|
+
else
|
|
331
|
+
cat >> /tmp/fix-prompt.txt << 'PROMPT_EOF3'
|
|
332
|
+
|
|
333
|
+
## Instructions
|
|
334
|
+
|
|
335
|
+
1. Review the PR changes to understand context:
|
|
336
|
+
```bash
|
|
337
|
+
git diff origin/main...HEAD
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
2. Understand what needs to be changed: ${INSTRUCTIONS}
|
|
341
|
+
|
|
342
|
+
3. Make the requested changes
|
|
343
|
+
PROMPT_EOF3
|
|
344
|
+
fi
|
|
345
|
+
|
|
346
|
+
# Add common instructions
|
|
347
|
+
cat >> /tmp/fix-prompt.txt << 'PROMPT_EOF4'
|
|
348
|
+
|
|
349
|
+
## Guidelines
|
|
350
|
+
|
|
351
|
+
**DO:**
|
|
352
|
+
- ✅ Make the exact change requested
|
|
353
|
+
- ✅ Keep it simple and focused
|
|
354
|
+
- ✅ Follow existing code style
|
|
355
|
+
- ✅ Test your change if possible (run relevant commands)
|
|
356
|
+
- ✅ Commit with a clear message
|
|
357
|
+
|
|
358
|
+
**DON'T:**
|
|
359
|
+
- ❌ Make unrelated changes
|
|
360
|
+
- ❌ Refactor surrounding code
|
|
361
|
+
- ❌ Add unnecessary features
|
|
362
|
+
- ❌ Change code style unnecessarily
|
|
363
|
+
- ❌ Over-engineer the solution
|
|
364
|
+
|
|
365
|
+
## Commit Message Format
|
|
366
|
+
|
|
367
|
+
Use this format:
|
|
368
|
+
```
|
|
369
|
+
fix: [brief description of the change]
|
|
370
|
+
|
|
371
|
+
Requested by: ${COMMENT_URL}
|
|
372
|
+
|
|
373
|
+
Co-authored-by: CodeMie AI <codemie.ai@gmail.com>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## Important
|
|
377
|
+
|
|
378
|
+
- You're on branch: ${BRANCH_NAME}
|
|
379
|
+
- Changes will be committed directly to this branch
|
|
380
|
+
- Keep it quick: this is a focused inline fix, not a feature implementation
|
|
381
|
+
- If you need to activate venv: `source .venv/bin/activate`
|
|
382
|
+
- Follow DEV_GUIDE.md patterns if they exist
|
|
383
|
+
|
|
384
|
+
## Start
|
|
385
|
+
|
|
386
|
+
Begin by understanding the request and the code context, then make the change.
|
|
387
|
+
PROMPT_EOF4
|
|
388
|
+
|
|
389
|
+
# Replace environment variables in prompt
|
|
390
|
+
sed -i "s|\${PR_NUMBER}|${PR_NUMBER}|g" /tmp/fix-prompt.txt
|
|
391
|
+
sed -i "s|\${BRANCH_NAME}|${BRANCH_NAME}|g" /tmp/fix-prompt.txt
|
|
392
|
+
sed -i "s|\${INSTRUCTIONS}|${INSTRUCTIONS}|g" /tmp/fix-prompt.txt
|
|
393
|
+
sed -i "s|\${COMMENT_PATH}|${COMMENT_PATH}|g" /tmp/fix-prompt.txt
|
|
394
|
+
sed -i "s|\${COMMENT_LINE}|${COMMENT_LINE}|g" /tmp/fix-prompt.txt
|
|
395
|
+
sed -i "s|\${COMMENT_URL}|${COMMENT_URL}|g" /tmp/fix-prompt.txt
|
|
396
|
+
|
|
397
|
+
echo ""
|
|
398
|
+
echo "Running CodeMie fix with max-turns: ${MAX_TURNS}..."
|
|
399
|
+
echo ""
|
|
400
|
+
|
|
401
|
+
# Run CodeMie Code with focused permissions for quick fixes
|
|
402
|
+
timeout 10m claude \
|
|
403
|
+
-p "$(cat /tmp/fix-prompt.txt)" \
|
|
404
|
+
--model "${MODEL}" \
|
|
405
|
+
--max-turns "${MAX_TURNS}" \
|
|
406
|
+
--dangerously-skip-permissions \
|
|
407
|
+
--allowedTools "Bash(*),Read(*),Write(*),Edit(*),Grep(*),Glob(*)" \
|
|
408
|
+
--debug \
|
|
409
|
+
2>&1 | tee /tmp/codemie-fix-output.log || {
|
|
410
|
+
EXIT_CODE=$?
|
|
411
|
+
echo "CodeMie exited with code: ${EXIT_CODE}"
|
|
412
|
+
if [ ${EXIT_CODE} -eq 124 ]; then
|
|
413
|
+
echo "Error: CodeMie timed out after 10 minutes"
|
|
414
|
+
exit 1
|
|
415
|
+
fi
|
|
416
|
+
exit ${EXIT_CODE}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
echo "✅ CodeMie fix completed"
|
|
420
|
+
|
|
421
|
+
- name: Upload CodeMie Output
|
|
422
|
+
if: always()
|
|
423
|
+
uses: actions/upload-artifact@v4
|
|
424
|
+
with:
|
|
425
|
+
name: codemie-fix-output-${{ github.run_number }}
|
|
426
|
+
path: /tmp/codemie-fix-output.log
|
|
427
|
+
retention-days: 7
|
|
428
|
+
|
|
429
|
+
- name: Commit any uncommitted changes
|
|
430
|
+
id: commit_changes
|
|
431
|
+
run: |
|
|
432
|
+
# Check if there are uncommitted changes (modified or new files)
|
|
433
|
+
if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
|
434
|
+
echo "Found uncommitted changes, committing them..."
|
|
435
|
+
|
|
436
|
+
# Stage all changes
|
|
437
|
+
git add -A
|
|
438
|
+
|
|
439
|
+
# Create commit message
|
|
440
|
+
COMMIT_MSG="fix: apply CodeMie requested changes
|
|
441
|
+
|
|
442
|
+
Requested by: ${{ steps.pr_info.outputs.comment_url }}
|
|
443
|
+
|
|
444
|
+
Co-authored-by: CodeMie AI <codemie.ai@gmail.com>"
|
|
445
|
+
|
|
446
|
+
# Commit changes
|
|
447
|
+
git commit -m "$COMMIT_MSG" || echo "Commit may have been done by Claude already"
|
|
448
|
+
|
|
449
|
+
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
450
|
+
echo "✅ Changes committed"
|
|
451
|
+
else
|
|
452
|
+
echo "No uncommitted changes"
|
|
453
|
+
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
454
|
+
fi
|
|
455
|
+
|
|
456
|
+
- name: Check if there are commits to push
|
|
457
|
+
id: check_push
|
|
458
|
+
run: |
|
|
459
|
+
# Check if local branch is ahead of remote
|
|
460
|
+
git fetch origin ${{ steps.pr_info.outputs.branch_name }}
|
|
461
|
+
|
|
462
|
+
LOCAL=$(git rev-parse HEAD)
|
|
463
|
+
REMOTE=$(git rev-parse origin/${{ steps.pr_info.outputs.branch_name }} 2>/dev/null || echo "")
|
|
464
|
+
|
|
465
|
+
if [ "$LOCAL" != "$REMOTE" ]; then
|
|
466
|
+
echo "has_commits=true" >> $GITHUB_OUTPUT
|
|
467
|
+
echo "Local branch is ahead of remote, push needed"
|
|
468
|
+
|
|
469
|
+
# Show what will be pushed
|
|
470
|
+
if [ -n "$REMOTE" ]; then
|
|
471
|
+
echo "Commits to push:"
|
|
472
|
+
git log --oneline origin/${{ steps.pr_info.outputs.branch_name }}..HEAD
|
|
473
|
+
else
|
|
474
|
+
echo "New branch will be pushed"
|
|
475
|
+
fi
|
|
476
|
+
else
|
|
477
|
+
echo "has_commits=false" >> $GITHUB_OUTPUT
|
|
478
|
+
echo "Local branch is up to date with remote"
|
|
479
|
+
fi
|
|
480
|
+
|
|
481
|
+
- name: Push changes to PR branch with retry
|
|
482
|
+
if: steps.check_push.outputs.has_commits == 'true'
|
|
483
|
+
run: |
|
|
484
|
+
BRANCH="${{ steps.pr_info.outputs.branch_name }}"
|
|
485
|
+
MAX_ATTEMPTS=3
|
|
486
|
+
|
|
487
|
+
for i in $(seq 1 $MAX_ATTEMPTS); do
|
|
488
|
+
echo "================================================"
|
|
489
|
+
echo "Push attempt $i of $MAX_ATTEMPTS"
|
|
490
|
+
echo "================================================"
|
|
491
|
+
|
|
492
|
+
# Fetch latest changes from remote
|
|
493
|
+
echo "Fetching latest changes from origin/$BRANCH..."
|
|
494
|
+
git fetch origin "$BRANCH"
|
|
495
|
+
|
|
496
|
+
# Try to push
|
|
497
|
+
echo "Attempting to push to $BRANCH..."
|
|
498
|
+
if git push origin HEAD 2>&1; then
|
|
499
|
+
echo "✅ Changes pushed successfully on attempt $i"
|
|
500
|
+
exit 0
|
|
501
|
+
fi
|
|
502
|
+
|
|
503
|
+
# Push failed, check if we should retry
|
|
504
|
+
if [ $i -lt $MAX_ATTEMPTS ]; then
|
|
505
|
+
echo "⚠️ Push failed (likely non-fast-forward), attempting rebase..."
|
|
506
|
+
|
|
507
|
+
# Try to rebase on top of remote changes
|
|
508
|
+
if git rebase "origin/$BRANCH"; then
|
|
509
|
+
echo "✅ Rebased successfully on origin/$BRANCH"
|
|
510
|
+
echo "Retrying push..."
|
|
511
|
+
else
|
|
512
|
+
echo "❌ Rebase failed due to conflicts"
|
|
513
|
+
git rebase --abort
|
|
514
|
+
echo ""
|
|
515
|
+
echo "This usually means:"
|
|
516
|
+
echo "- Multiple CodeMie workflows modified the same lines"
|
|
517
|
+
echo "- Manual intervention needed to resolve conflicts"
|
|
518
|
+
exit 1
|
|
519
|
+
fi
|
|
520
|
+
else
|
|
521
|
+
echo "❌ Failed to push after $MAX_ATTEMPTS attempts"
|
|
522
|
+
exit 1
|
|
523
|
+
fi
|
|
524
|
+
|
|
525
|
+
echo ""
|
|
526
|
+
done
|
|
527
|
+
|
|
528
|
+
echo "❌ Unexpected: Loop completed without success or failure"
|
|
529
|
+
exit 1
|
|
530
|
+
|
|
531
|
+
- name: Reply to comment with success
|
|
532
|
+
if: success() && steps.check_push.outputs.has_commits == 'true'
|
|
533
|
+
uses: actions/github-script@v7
|
|
534
|
+
continue-on-error: true
|
|
535
|
+
with:
|
|
536
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
537
|
+
script: |
|
|
538
|
+
const prNumber = ${{ steps.pr_info.outputs.pr_number }};
|
|
539
|
+
const branchName = '${{ steps.pr_info.outputs.branch_name }}';
|
|
540
|
+
const runUrl = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
|
|
541
|
+
|
|
542
|
+
// Get list of changed files
|
|
543
|
+
const { execSync } = require('child_process');
|
|
544
|
+
const changedFiles = execSync('git diff HEAD~1 --name-only').toString().trim();
|
|
545
|
+
|
|
546
|
+
const reply = `✅ **Fixed by CodeMie!**
|
|
547
|
+
|
|
548
|
+
Changes have been committed to branch \`${branchName}\`.
|
|
549
|
+
|
|
550
|
+
**Files modified:**
|
|
551
|
+
\`\`\`
|
|
552
|
+
${changedFiles}
|
|
553
|
+
\`\`\`
|
|
554
|
+
|
|
555
|
+
**Commit**: ${context.sha.substring(0, 7)}
|
|
556
|
+
|
|
557
|
+
[View workflow run](${runUrl}) | [View changes](https://github.com/${{ github.repository }}/pull/${prNumber}/files)
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
🤖 *CodeMie - Your inline code assistant*`;
|
|
561
|
+
|
|
562
|
+
try {
|
|
563
|
+
// Try to post as regular PR comment (works for all cases)
|
|
564
|
+
await github.rest.issues.createComment({
|
|
565
|
+
owner: context.repo.owner,
|
|
566
|
+
repo: context.repo.repo,
|
|
567
|
+
issue_number: prNumber,
|
|
568
|
+
body: reply
|
|
569
|
+
});
|
|
570
|
+
console.log('Posted success reply to PR #' + prNumber);
|
|
571
|
+
|
|
572
|
+
// Try to add thumbs up reaction to original comment
|
|
573
|
+
try {
|
|
574
|
+
const commentId = context.payload.comment?.id || context.payload.review?.id;
|
|
575
|
+
if (commentId) {
|
|
576
|
+
if (context.eventName === 'pull_request_review_comment') {
|
|
577
|
+
await github.rest.reactions.createForPullRequestReviewComment({
|
|
578
|
+
owner: context.repo.owner,
|
|
579
|
+
repo: context.repo.repo,
|
|
580
|
+
comment_id: commentId,
|
|
581
|
+
content: '+1'
|
|
582
|
+
});
|
|
583
|
+
} else if (context.eventName === 'issue_comment') {
|
|
584
|
+
await github.rest.reactions.createForIssueComment({
|
|
585
|
+
owner: context.repo.owner,
|
|
586
|
+
repo: context.repo.repo,
|
|
587
|
+
comment_id: commentId,
|
|
588
|
+
content: '+1'
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
console.log('Added thumbs up reaction');
|
|
592
|
+
}
|
|
593
|
+
} catch (reactionError) {
|
|
594
|
+
console.log('Could not add reaction (non-critical):', reactionError.message);
|
|
595
|
+
}
|
|
596
|
+
} catch (error) {
|
|
597
|
+
console.log('Failed to post reply:', error.message);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
- name: Reply to comment with no changes
|
|
601
|
+
if: success() && steps.check_push.outputs.has_commits == 'false'
|
|
602
|
+
uses: actions/github-script@v7
|
|
603
|
+
continue-on-error: true
|
|
604
|
+
with:
|
|
605
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
606
|
+
script: |
|
|
607
|
+
const prNumber = ${{ steps.pr_info.outputs.pr_number }};
|
|
608
|
+
const runUrl = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
|
|
609
|
+
|
|
610
|
+
const reply = `ℹ️ **CodeMie completed**
|
|
611
|
+
|
|
612
|
+
No changes were needed, or the requested change couldn't be applied.
|
|
613
|
+
|
|
614
|
+
This might mean:
|
|
615
|
+
- The change was already present in the code
|
|
616
|
+
- The request wasn't clear enough
|
|
617
|
+
- The change couldn't be made safely
|
|
618
|
+
|
|
619
|
+
[View workflow run](${runUrl}) for details.
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
🤖 *CodeMie - Your inline code assistant*`;
|
|
623
|
+
|
|
624
|
+
await github.rest.issues.createComment({
|
|
625
|
+
owner: context.repo.owner,
|
|
626
|
+
repo: context.repo.repo,
|
|
627
|
+
issue_number: prNumber,
|
|
628
|
+
body: reply
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
- name: Reply to comment with failure
|
|
632
|
+
if: failure()
|
|
633
|
+
uses: actions/github-script@v7
|
|
634
|
+
continue-on-error: true
|
|
635
|
+
with:
|
|
636
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
637
|
+
script: |
|
|
638
|
+
const prNumber = ${{ steps.pr_info.outputs.pr_number }};
|
|
639
|
+
const runUrl = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
|
|
640
|
+
|
|
641
|
+
const reply = `❌ **CodeMie encountered an error**
|
|
642
|
+
|
|
643
|
+
I wasn't able to complete the requested change due to an error.
|
|
644
|
+
|
|
645
|
+
**Common issues:**
|
|
646
|
+
- AWS Bedrock credentials not configured
|
|
647
|
+
- Request was too complex for quick fix
|
|
648
|
+
- Code conflicts or merge issues
|
|
649
|
+
|
|
650
|
+
[View workflow logs](${runUrl}) for details.
|
|
651
|
+
|
|
652
|
+
**Try:**
|
|
653
|
+
- Simplify the request (one specific change at a time)
|
|
654
|
+
- Make sure the file/line still exists
|
|
655
|
+
- Check if there are merge conflicts
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
🤖 *CodeMie - Your inline code assistant*`;
|
|
659
|
+
|
|
660
|
+
await github.rest.issues.createComment({
|
|
661
|
+
owner: context.repo.owner,
|
|
662
|
+
repo: context.repo.repo,
|
|
663
|
+
issue_number: prNumber,
|
|
664
|
+
body: reply
|
|
665
|
+
});
|