scai 0.1.53 → 0.1.55
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 +99 -24
- package/dist/commands/ReviewCmd.js +4 -8
- package/dist/utils/fileTree.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,12 +58,6 @@ No more struggling to write pull request descriptions by hand. `scai git review`
|
|
|
58
58
|
|
|
59
59
|
> ⚠️ These features are in **beta** — feedback welcome!
|
|
60
60
|
|
|
61
|
-
## 🙌 Feedback
|
|
62
|
-
|
|
63
|
-
Questions, ideas, or bugs?
|
|
64
|
-
Ping [@ticcr](https://bsky.app/profile/ticcr.xyz) on Bluesky — I'd love to hear your thoughts!
|
|
65
|
-
|
|
66
|
-
|
|
67
61
|
---
|
|
68
62
|
|
|
69
63
|
### 🔑 Setting Up Authentication (Required)
|
|
@@ -71,7 +65,7 @@ Ping [@ticcr](https://bsky.app/profile/ticcr.xyz) on Bluesky — I'd love to hea
|
|
|
71
65
|
To interact with GitHub and create pull requests, `scai` needs a personal access token with **repo** permissions.
|
|
72
66
|
|
|
73
67
|
1. **Create your GitHub Access Token**
|
|
74
|
-
Follow this link to generate a token: [https://github.com/settings/tokens
|
|
68
|
+
Follow this link to generate a token: [https://github.com/settings/personal-access-tokens](https://github.com/settings/personal-access-tokens)
|
|
75
69
|
|
|
76
70
|
Make sure you enable at least:
|
|
77
71
|
|
|
@@ -99,7 +93,7 @@ To interact with GitHub and create pull requests, `scai` needs a personal access
|
|
|
99
93
|
This is the repo from which scai will look up pull requests that can be reviewed.
|
|
100
94
|
|
|
101
95
|
---
|
|
102
|
-
|
|
96
|
+
## ⚒️ Usage Overview
|
|
103
97
|
### 🧠 How to Use `scai git review`
|
|
104
98
|
|
|
105
99
|
```bash
|
|
@@ -116,20 +110,67 @@ This will show you pull requests assigned to you for review:
|
|
|
116
110
|
* ✅ Explanation of why the changes matter
|
|
117
111
|
* ✅ Optional changelog bullets
|
|
118
112
|
|
|
119
|
-
You’ll be shown a preview and asked to confirm before pushing or opening a PR.
|
|
120
113
|
|
|
121
|
-
|
|
114
|
+
SCAI supports an integrated review flow for GitHub pull requests. To get started:
|
|
122
115
|
|
|
123
|
-
|
|
116
|
+
1. **Set your working index directory (once per repo):**
|
|
124
117
|
|
|
125
|
-
```
|
|
126
|
-
scai
|
|
118
|
+
```sh
|
|
119
|
+
scai set index-dir .
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
2. **Authenticate with GitHub:**
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
scai auth set
|
|
126
|
+
scai auth check
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
3. **Fetch and review pull requests:**
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
scai git review
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Use `-a` to list all PRs that require your review:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
scai git review -a
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Example Workflow
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
$ scai git review -a
|
|
145
|
+
🔍 Fetching pull requests and diffs...
|
|
146
|
+
📦 Resolving GitHub repo info from indexDir: ./
|
|
147
|
+
🔗 Git origin URL: git@github.com:org/repo.git
|
|
148
|
+
✅ Parsed: owner='org', repo='repo'
|
|
149
|
+
👤 Authenticated user: username
|
|
150
|
+
|
|
151
|
+
📦 Open Pull Requests with review requested:
|
|
152
|
+
1) #123 - Fix login timeout bug
|
|
153
|
+
2) #122 - Upgrade dependencies
|
|
154
|
+
|
|
155
|
+
👉 Choose a PR to review [1-2]: 1
|
|
156
|
+
✅ Model response received.
|
|
157
|
+
|
|
158
|
+
💡 AI-suggested review:
|
|
159
|
+
|
|
160
|
+
Solid improvement — this patch improves session stability and handles async state more reliably.
|
|
161
|
+
You might consider renaming `sessionManager` to better reflect its dual role in auth and persistence.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
1) ✅ Approve
|
|
165
|
+
2) ❌ Reject
|
|
166
|
+
3) ✍️ Edit
|
|
167
|
+
4) Write your own review
|
|
168
|
+
5) 🚪 Cancel
|
|
127
169
|
```
|
|
128
|
-
This will show you all pull requests that have not yet been reviewed.
|
|
129
170
|
|
|
130
|
-
## ⚒️ Usage Overview
|
|
131
171
|
|
|
132
|
-
|
|
172
|
+
|
|
173
|
+
### 🔧 How to Use `scai git sugg`
|
|
133
174
|
|
|
134
175
|
Use AI to suggest a meaningful commit message based on your staged code:
|
|
135
176
|
|
|
@@ -183,7 +224,7 @@ scai gen tests <file>
|
|
|
183
224
|
```
|
|
184
225
|
|
|
185
226
|
* `summ`: Summarize a file
|
|
186
|
-
* `comm`: Add comments
|
|
227
|
+
* `comm`: Add comments to a file
|
|
187
228
|
* `changelog`: Update or create `CHANGELOG.md` from Git diff
|
|
188
229
|
* `tests`: Create Jest test stubs (ALPHA)
|
|
189
230
|
|
|
@@ -271,17 +312,40 @@ You won't gain much value from the index unless you scope it to one repository.
|
|
|
271
312
|
|
|
272
313
|
5. **Natural-language questions:**
|
|
273
314
|
|
|
315
|
+
### 🧠 Natural-language questions
|
|
316
|
+
|
|
317
|
+
Ask questions about your codebase using `scai ask`.
|
|
318
|
+
|
|
319
|
+
You can run it in two ways:
|
|
320
|
+
|
|
321
|
+
1. **Inline question**
|
|
322
|
+
|
|
274
323
|
```bash
|
|
275
324
|
scai ask "How does mapcontrol work?"
|
|
276
325
|
```
|
|
277
326
|
|
|
278
|
-
|
|
327
|
+
2. **Interactive prompt**
|
|
279
328
|
|
|
280
|
-
|
|
329
|
+
```bash
|
|
330
|
+
scai ask
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Press enter**
|
|
334
|
+
, then type your question when prompted:
|
|
281
335
|
|
|
282
|
-
|
|
336
|
+
```
|
|
337
|
+
> How does mapcontrol work?
|
|
338
|
+
```
|
|
283
339
|
|
|
284
|
-
|
|
340
|
+
</br>
|
|
341
|
+
|
|
342
|
+
### 🚨 **OBS** 🚨
|
|
343
|
+
|
|
344
|
+
`find` and `ask` rely on that index—without it they will return no useful results.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
Note the **Migrate** command is for **internal use only**. Do **not** run it unless explicitly instructed, as it may delete existing data or corrupt your local database.
|
|
285
349
|
|
|
286
350
|
If you're upgrading from an earlier version, please run the following commands to avoid indexing issues:
|
|
287
351
|
|
|
@@ -289,6 +353,7 @@ If you're upgrading from an earlier version, please run the following commands t
|
|
|
289
353
|
scai reset-db
|
|
290
354
|
scai index
|
|
291
355
|
```
|
|
356
|
+
</br>
|
|
292
357
|
|
|
293
358
|
---
|
|
294
359
|
|
|
@@ -299,7 +364,7 @@ scai index
|
|
|
299
364
|
```bash
|
|
300
365
|
scai reset-db
|
|
301
366
|
```
|
|
302
|
-
* **
|
|
367
|
+
* **Backup only of `~/.scai`:**
|
|
303
368
|
|
|
304
369
|
```bash
|
|
305
370
|
scai backup
|
|
@@ -314,7 +379,6 @@ For custom pipelines on a single file:
|
|
|
314
379
|
```bash
|
|
315
380
|
scai src/file.ts -m summary,comments
|
|
316
381
|
```
|
|
317
|
-
|
|
318
382
|
---
|
|
319
383
|
|
|
320
384
|
## 🔐 License & Fair Use
|
|
@@ -332,10 +396,21 @@ You may **not**:
|
|
|
332
396
|
* ❌ Resell as a product or service
|
|
333
397
|
* ❌ Claim ownership of the tool
|
|
334
398
|
|
|
399
|
+
</br>
|
|
400
|
+
|
|
335
401
|
### 📄 License
|
|
336
402
|
|
|
337
403
|
Free for personal and internal company use only.
|
|
338
404
|
Commercial use (resale, SaaS, inclusion in paid tools) is prohibited.
|
|
339
405
|
Contact me for commercial licensing.
|
|
340
406
|
|
|
341
|
-
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
</br>
|
|
410
|
+
|
|
411
|
+
## 🙌 Feedback
|
|
412
|
+
|
|
413
|
+
Questions, ideas, or bugs?
|
|
414
|
+
Ping [@ticcr](https://bsky.app/profile/ticcr.xyz) on Bluesky — I'd love to hear your thoughts!
|
|
415
|
+
|
|
416
|
+
---
|
|
@@ -30,17 +30,13 @@ export async function getPullRequestsForReview(token, owner, repo, username, bra
|
|
|
30
30
|
filtered.push({ pr, diff });
|
|
31
31
|
}
|
|
32
32
|
catch (err) {
|
|
33
|
-
console.warn(`⚠️ Could not fetch diff for PR #${pr.number}: ${err.message}`);
|
|
34
33
|
failedPRs.push(pr);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
if (failedPRs.length > 0) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
console.warn(` - #${pr.number}: ${pr.title}`);
|
|
42
|
-
}
|
|
43
|
-
console.warn('These PRs will not be included in the review summary.\n');
|
|
38
|
+
const failedList = failedPRs.map(pr => `#${pr.number}`).join(', ');
|
|
39
|
+
console.warn(`⚠️ Skipped ${failedPRs.length} PR(s) (${failedList}) due to diff fetch errors.`);
|
|
44
40
|
}
|
|
45
41
|
return filtered;
|
|
46
42
|
}
|
|
@@ -80,8 +76,8 @@ function askReviewApproval(suggestion) {
|
|
|
80
76
|
console.log('1) ✅ Approve');
|
|
81
77
|
console.log('2) ❌ Reject');
|
|
82
78
|
console.log('3) ✍️ Edit');
|
|
83
|
-
console.log('4) Write your own review');
|
|
84
|
-
console.log('5)
|
|
79
|
+
console.log('4) ⌨️ Write your own review');
|
|
80
|
+
console.log('5) 🚫 Cancel');
|
|
85
81
|
const rl = readline.createInterface({
|
|
86
82
|
input: process.stdin,
|
|
87
83
|
output: process.stdout,
|
package/dist/utils/fileTree.js
CHANGED
|
@@ -9,7 +9,7 @@ export function generateFocusedFileTree(rootDir, focusPath, maxDepth = 2) {
|
|
|
9
9
|
}
|
|
10
10
|
function generateFileTree(dir, depth, highlightPath, prefix = '') {
|
|
11
11
|
if (depth < 0)
|
|
12
|
-
return '';
|
|
12
|
+
return ''; // Stop at maxDepth
|
|
13
13
|
let output = '';
|
|
14
14
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
15
15
|
const sorted = entries.sort((a, b) => Number(b.isDirectory()) - Number(a.isDirectory()));
|
|
@@ -18,11 +18,13 @@ function generateFileTree(dir, depth, highlightPath, prefix = '') {
|
|
|
18
18
|
const connector = isLast ? '└── ' : '├── ';
|
|
19
19
|
const fullPath = path.join(dir, entry.name);
|
|
20
20
|
const isHighlighted = highlightPath && path.resolve(fullPath) === path.resolve(highlightPath);
|
|
21
|
+
// If it is a directory, recurse and reduce depth
|
|
21
22
|
if (entry.isDirectory()) {
|
|
22
23
|
output += `${prefix}${connector}${entry.name}/\n`;
|
|
23
24
|
output += generateFileTree(fullPath, depth - 1, highlightPath, prefix + (isLast ? ' ' : '│ '));
|
|
24
25
|
}
|
|
25
26
|
else {
|
|
27
|
+
// Highlight the file if it matches the focusPath
|
|
26
28
|
const name = isHighlighted ? `➡️ ${entry.name}` : entry.name;
|
|
27
29
|
output += `${prefix}${connector}${name}\n`;
|
|
28
30
|
}
|