@ariso-ai/ivan 1.0.14 → 1.0.15

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.
@@ -41,27 +41,34 @@ jobs:
41
41
  run: mkdir -p ~/.ivan
42
42
 
43
43
  - name: Write Ivan config
44
+ env:
45
+ OPENAI_KEY: ${{ secrets.OPEN_AI_KEY }}
46
+ ANTHROPIC_KEY: ${{ secrets.ANTHROPIC_KEY }}
47
+ GH_PAT: ${{ secrets.PAT }}
44
48
  run: |
45
- cat > ~/.ivan/config.json << 'EOF'
46
- {
47
- "openaiApiKey": "${{ secrets.OPEN_AI_KEY }}",
48
- "anthropicApiKey": "${{ secrets.ANTHROPIC_KEY }}",
49
- "version": "1.0.0",
50
- "executorType": "sdk",
51
- "githubAuthType": "pat",
52
- "githubPat": "${{ secrets.PAT }}",
53
- "repoInstructionsDeclined": {},
54
- "repoInstructions": {},
55
- "reviewAgent": "@coderabbitai"
56
- }
57
- EOF
49
+ jq -n \
50
+ --arg openai "$OPENAI_KEY" \
51
+ --arg anthropic "$ANTHROPIC_KEY" \
52
+ --arg pat "$GH_PAT" \
53
+ '{
54
+ openaiApiKey: $openai,
55
+ anthropicApiKey: $anthropic,
56
+ version: "1.0.0",
57
+ executorType: "sdk",
58
+ githubAuthType: "pat",
59
+ githubPat: $pat,
60
+ repoInstructionsDeclined: {},
61
+ repoInstructions: {},
62
+ reviewAgent: "@coderabbitai"
63
+ }' \
64
+ > ~/.ivan/config.json
58
65
  echo "Config file created at ~/.ivan/config.json"
59
66
 
60
67
  - name: Install Ivan CLI
61
68
  run: |
62
- npm install -g @ariso-ai/ivan@latest
69
+ npm install -g @ariso-ai/ivan@latest --prefix ~/.local
63
70
  echo "Ivan installed successfully"
64
- ivan --version
71
+ ~/.local/bin/ivan --version
65
72
 
66
73
  - name: Add eyes reaction to comment
67
74
  uses: peter-evans/create-or-update-comment@v4
@@ -84,44 +91,74 @@ jobs:
84
91
 
85
92
  - name: Run Ivan command
86
93
  id: run_ivan
94
+ env:
95
+ ISSUE_BODY: ${{ steps.get_issue.outputs.result }}
87
96
  run: |
88
- ISSUE_BODY=$(cat << 'ISSUE_EOF'
89
- ${{ steps.get_issue.outputs.result }}
90
- ISSUE_EOF
91
- )
92
-
93
97
  # Escape the issue body for JSON
94
98
  ESCAPED_ISSUE=$(echo "$ISSUE_BODY" | jq -Rs .)
95
99
 
96
- # Run ivan command and capture output
97
- OUTPUT=$(ivan -c "{\"tasks\": [$ESCAPED_ISSUE], \"generateSubtasks\": false, \"prStrategy\": \"multiple\", \"waitForComments\": true}" 2>&1 || true)
100
+ # Run ivan command with output streaming and also capture to file
101
+ set +e
102
+ ~/.local/bin/ivan -c "{\"tasks\": [$ESCAPED_ISSUE], \"generateSubtasks\": false, \"prStrategy\": \"multiple\"}" 2>&1 | tee /tmp/ivan_output.txt
103
+ EXIT_CODE=${PIPESTATUS[0]}
104
+ set -e
98
105
 
99
- echo "$OUTPUT"
100
- echo "$OUTPUT" > /tmp/ivan_output.txt
106
+ if [ $EXIT_CODE -ne 0 ]; then
107
+ echo "ivan_failed=true" >> $GITHUB_OUTPUT
108
+ else
109
+ echo "ivan_failed=false" >> $GITHUB_OUTPUT
110
+ fi
101
111
 
102
- # Extract PR URL from output (looking for github.com PR URLs)
103
- PR_URL=$(echo "$OUTPUT" | grep -oP 'https://github\.com/[^/]+/[^/]+/pull/\d+' | head -1 || echo "")
112
+ # Extract PR URL from output file (looking for github.com PR URLs)
113
+ PR_URL=$(grep -oP 'https://github\.com/[^/]+/[^/]+/pull/\d+' /tmp/ivan_output.txt | head -1 || echo "")
104
114
 
105
115
  if [ -n "$PR_URL" ]; then
106
116
  echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
117
+ # Extract PR number from URL
118
+ PR_NUMBER=$(echo "$PR_URL" | grep -oP '/pull/\d+$' | grep -oP '\d+')
119
+ echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
107
120
  else
108
121
  echo "pr_url=" >> $GITHUB_OUTPUT
122
+ echo "pr_number=" >> $GITHUB_OUTPUT
109
123
  fi
110
124
 
111
- - name: Comment on issue with PR link
112
- if: steps.run_ivan.outputs.pr_url != ''
125
+ - name: Comment on issue with PR link and output
126
+ if: steps.run_ivan.outputs.pr_url != '' && steps.run_ivan.outputs.ivan_failed == 'false'
113
127
  uses: actions/github-script@v7
114
128
  with:
115
129
  script: |
130
+ const fs = require('fs');
131
+ const ivanOutput = fs.readFileSync('/tmp/ivan_output.txt', 'utf8');
132
+ const prUrl = '${{ steps.run_ivan.outputs.pr_url }}';
133
+
134
+ const body = '✅ Ivan has created a pull request: ' + prUrl + '\n\n' +
135
+ '⏳ **Addressing comments now...**\n\n' +
136
+ '<details>\n' +
137
+ '<summary>View Ivan command output</summary>\n\n' +
138
+ '```\n' + ivanOutput + '\n```\n\n' +
139
+ '</details>';
140
+
116
141
  await github.rest.issues.createComment({
117
142
  owner: context.repo.owner,
118
143
  repo: context.repo.repo,
119
144
  issue_number: context.issue.number,
120
- body: `✅ Ivan has created a pull request: ${{ steps.run_ivan.outputs.pr_url }}`
145
+ body: body
146
+ });
147
+
148
+ - name: Comment on issue if Ivan failed
149
+ if: steps.run_ivan.outputs.ivan_failed == 'true'
150
+ uses: actions/github-script@v7
151
+ with:
152
+ script: |
153
+ await github.rest.issues.createComment({
154
+ owner: context.repo.owner,
155
+ repo: context.repo.repo,
156
+ issue_number: context.issue.number,
157
+ body: `❌ Ivan command failed. Please check the workflow logs for details.`
121
158
  });
122
159
 
123
160
  - name: Comment on issue if no PR found
124
- if: steps.run_ivan.outputs.pr_url == ''
161
+ if: steps.run_ivan.outputs.pr_url == '' && steps.run_ivan.outputs.ivan_failed == 'false'
125
162
  uses: actions/github-script@v7
126
163
  with:
127
164
  script: |
@@ -131,3 +168,38 @@ jobs:
131
168
  issue_number: context.issue.number,
132
169
  body: `⚠️ Ivan command completed but no pull request URL was found in the output.`
133
170
  });
171
+
172
+ - name: Wait for 15 minutes
173
+ if: steps.run_ivan.outputs.pr_number != '' && steps.run_ivan.outputs.ivan_failed == 'false'
174
+ run: |
175
+ echo "Waiting 15 minutes before running ivan address command..."
176
+ sleep 900
177
+
178
+ - name: Run Ivan address command
179
+ if: steps.run_ivan.outputs.pr_number != '' && steps.run_ivan.outputs.ivan_failed == 'false'
180
+ run: |
181
+ echo "Running ivan address for PR #${{ steps.run_ivan.outputs.pr_number }}"
182
+ ~/.local/bin/ivan address ${{ steps.run_ivan.outputs.pr_number }} --yes 2>&1 | tee /tmp/ivan_address_output.txt
183
+
184
+ - name: Comment on issue after addressing PR
185
+ if: steps.run_ivan.outputs.pr_number != '' && steps.run_ivan.outputs.ivan_failed == 'false'
186
+ uses: actions/github-script@v7
187
+ with:
188
+ script: |
189
+ const fs = require('fs');
190
+ const addressOutput = fs.readFileSync('/tmp/ivan_address_output.txt', 'utf8');
191
+ const prNumber = '${{ steps.run_ivan.outputs.pr_number }}';
192
+
193
+ const body = '✅ **Ivan has finished addressing comments on PR #' + prNumber + '**\n\n' +
194
+ 'The PR has been updated based on any review comments received.\n\n' +
195
+ '<details>\n' +
196
+ '<summary>View ivan address command output</summary>\n\n' +
197
+ '```\n' + addressOutput + '\n```\n\n' +
198
+ '</details>';
199
+
200
+ await github.rest.issues.createComment({
201
+ owner: context.repo.owner,
202
+ repo: context.repo.repo,
203
+ issue_number: context.issue.number,
204
+ body: body
205
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariso-ai/ivan",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {