scai 0.1.84 → 0.1.85

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.
Files changed (2) hide show
  1. package/README.md +452 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,452 @@
1
+ # ⚙️ scai — Smart Commit AI ✨
2
+
3
+ > AI-powered CLI tool for commit messages **and** pull request reviews — using local models.
4
+
5
+ **scai** is your AI pair‑programmer in the terminal. Focus on coding while scai:
6
+
7
+ - 🤖 **Reviews open pull requests** and provides AI‑driven feedback (BETA)
8
+ - 💬 **Suggests intelligent Git commit messages** based on your staged diff
9
+ - 📝 Summarizes files in plain English
10
+ - 📜 Auto‑updates your changelog
11
+ - 🔍 (ALPHA) Search & ask questions across your codebase
12
+ - 🔐 100% local — no API keys, no cloud, no telemetry
13
+
14
+ ---
15
+
16
+ ## 🚀 Features
17
+
18
+ - ⚡ Powered by open-source models (e.g. `llama3`, `codellama`)
19
+ - 🔍 Full-text indexing & semantic search (ALPHA)
20
+ - 🛠️ Built with Node.js and TypeScript
21
+ - ✅ Easily configurable via CLI or global flags
22
+
23
+ ---
24
+
25
+ ## ❤️ Why Local AI?
26
+
27
+ **Your code stays yours.**
28
+ scai runs entirely on your machine and doesn't require cloud APIs or API keys. That means:
29
+
30
+ - ✅ **Privacy-first**: no telemetry, no server round-trips
31
+ - ✅ **EU & GDPR-friendly**: designed with compliance in mind
32
+ - ✅ **Developer control**: full transparency and override options
33
+ - ✅ **Offline support**: works even without an internet connection
34
+
35
+ ---
36
+
37
+ ## 📦 Installation
38
+
39
+ 1. **Install Ollama (for local models)**
40
+ - macOS: `brew install ollama`
41
+ - Windows: [Download here](https://ollama.com/download)
42
+ - Start Ollama after installing.
43
+
44
+ 2. **Install scai globally:**
45
+ ```bash
46
+ npm install -g scai
47
+ ```
48
+
49
+ 3. **Initialize models:**
50
+
51
+ ```bash
52
+ scai init
53
+ ```
54
+
55
+ ## ✨ AI Code Review, Powered by Your Terminal
56
+
57
+ No more struggling to write pull request descriptions by hand. `scai git review` automatically generates a rich summary of your changes, complete with context, suggestions, and rationale.
58
+
59
+ > ⚠️ These features are in **beta** — feedback welcome!
60
+ Ping [@ticcr](https://bsky.app/profile/ticcr.xyz) on Bluesky — I'd love to hear your thoughts!
61
+
62
+ ---
63
+
64
+ ### 🔑 Setting Up Authentication (Required)
65
+
66
+ To interact with GitHub and create pull requests, `scai` needs a personal access token with **repo** permissions.
67
+
68
+ 1. **Create your GitHub Access Token**
69
+ Follow this link to generate a token: [https://github.com/settings/personal-access-tokens](https://github.com/settings/personal-access-tokens)
70
+
71
+ Make sure you enable at least:
72
+
73
+ * `repo` (Full control of private repositories)
74
+ * `workflow` (If you want PRs to trigger CI)
75
+
76
+ 2. **Set the token in scai:**
77
+
78
+ ```bash
79
+ scai auth set
80
+ ```
81
+
82
+ This stores your token locally in a secure config file. You can inspect the setup at any time:
83
+
84
+ ```bash
85
+ scai auth check
86
+ ```
87
+
88
+ 3. **Set the index dir:**
89
+
90
+ ```bash
91
+ scai index set /path/to/repo
92
+ ```
93
+
94
+ This is the repo from which scai will look up pull requests that can be reviewed.
95
+
96
+ ---
97
+ ## ⚒️ Usage Overview
98
+ ### 🧠 How to Use `scai git review`
99
+
100
+ ```bash
101
+ scai git review
102
+ ```
103
+
104
+ This will show you pull requests assigned to you for review:
105
+
106
+ * Understand the diffs using a local model
107
+ * Generate a structured pull request:
108
+
109
+ * ✅ Title
110
+ * ✅ Summary of changes
111
+ * ✅ Explanation of why the changes matter
112
+ * ✅ Optional changelog bullets
113
+
114
+
115
+ SCAI supports an integrated review flow for GitHub pull requests. To get started:
116
+
117
+ 1. **Set your working index directory (once per repo):**
118
+
119
+ ```sh
120
+ scai index set /path/to/repo
121
+ ```
122
+
123
+ 2. **Authenticate with GitHub:**
124
+ ```sh
125
+ scai git review
126
+ ```
127
+
128
+ This command will query you for the Personal Access Token and set it for you.
129
+ You may also do this with the auth commands below
130
+
131
+ ```sh
132
+ scai auth set
133
+ scai auth check
134
+ ```
135
+
136
+ 3. **Fetch and review pull requests:**
137
+
138
+ ```sh
139
+ scai git review
140
+ ```
141
+
142
+ Use `-a` to list all PRs that require a review:
143
+
144
+ ```sh
145
+ scai git review -a
146
+ ```
147
+
148
+ #### Example Workflow
149
+
150
+ ```sh
151
+ $ scai git review -a
152
+ 📦 Resolving GitHub repo info from indexDir: ./
153
+ 🔗 Git origin URL: git@github.com:org/repo.git
154
+ ✅ Parsed: owner='org', repo='repo'
155
+ 👤 Authenticated user: dev-user123
156
+
157
+ 🔍 Fetching pull requests and diffs...
158
+ ✅ Fetched 5 PR(s) with diffs.
159
+
160
+ 📦 Open Pull Requests with review requested:
161
+ | # | ID | TITLE | AUTHOR | STATUS | CREATED | REVIEWERS | REVIEWS |
162
+ | - | ---- | ----------------------------- | ---------- | ------ | ---------- | ----------------------------- | ------------------- |
163
+ | 1 | #120 | fix/session-timeout | dev-alice | Open | 2025-08-08 | code-analyzer\[bot], dev-bob | ✅ Approved |
164
+ | 2 | #118 | feature/1482-support-wfs2 | dev-carol | Open | 2025-08-07 | code-analyzer\[bot], dev-dave | ✅ Approved |
165
+ | 3 | #117 | refactor/win-server-support | dev-erin | Open | 2025-08-06 | dev-frank, dev-alice | ❌ Changes Requested |
166
+ | 4 | #114 | bump/vue-i18n-9.14.5 | dependabot | Open | 2025-08-04 | code-analyzer\[bot] | ✅ Approved |
167
+ | 5 | #113 | bugfix/null-navigator-check | dev-bob | Open | 2025-08-03 | dev-alice, dev-carol | ✅ Approved |
168
+
169
+ 👉 Choose a PR to review [1-2]: 1
170
+ ✅ Model response received.
171
+
172
+ 💡 AI-suggested review:
173
+
174
+ Solid improvement — this patch improves session stability and handles async state more reliably.
175
+ You might consider renaming `sessionManager` to better reflect its dual role in auth and persistence.
176
+
177
+ ---
178
+ 1) ✅ Approve
179
+ 2) ❌ Reject
180
+ 3) ✍️ Edit
181
+ 4) Write your own review
182
+ 5) 🚪 Cancel
183
+ ```
184
+
185
+
186
+
187
+ ### 🔧 How to Use `scai git commit`
188
+
189
+ Use AI to suggest a meaningful commit message based on your staged code:
190
+
191
+ ```bash
192
+ git add .
193
+ scai git commit
194
+ ```
195
+
196
+ You can also include a changelog entry along with the commit:
197
+
198
+ ```bash
199
+ scai git commit --changelog
200
+ ```
201
+
202
+ This will:
203
+ 1. Suggest a commit message based on your `git diff --cached`
204
+ 2. Propose a changelog entry (if relevant)
205
+ 3. Allow you to approve, regenerate, or skip the changelog
206
+ 4. Automatically stage and commit the changes
207
+
208
+ ---
209
+
210
+ ### 📝 Generate a Standalone Changelog Entry
211
+
212
+ If you want to generate a changelog entry without committing:
213
+
214
+ ```bash
215
+ scai gen changelog
216
+ ```
217
+
218
+ This will:
219
+ - Analyze the current `git diff` (staged or unstaged)
220
+ - Propose a list of **user-facing changes** in clean markdown bullet points
221
+ - Let you accept, regenerate, or skip the update
222
+ - Append the entry to `CHANGELOG.md` and stage it if accepted
223
+
224
+
225
+ ### 🛠️ Code Generation Commands (`gen` group)
226
+
227
+ ```bash
228
+ scai gen summ <file>
229
+ scai gen comm <file>
230
+ scai gen changelog
231
+ scai gen tests <file>
232
+ ```
233
+
234
+ * `summ`: Summarize a file
235
+ * `comm`: Add comments to a file
236
+ * `changelog`: Update or create `CHANGELOG.md` from Git diff
237
+ * `tests`: Create Jest test stubs (ALPHA)
238
+
239
+ You can also pipe file content directly:
240
+
241
+ ```bash
242
+ cat src/utils/math.ts | scai gen summ
243
+ ```
244
+
245
+ ---
246
+
247
+ ## ⚙️ Configuration
248
+
249
+ scai stores settings in `~/.scai/config.json`. You can override or view them:
250
+
251
+ * **Set model:**
252
+
253
+ ```bash
254
+ scai set model codellama:7b
255
+ ```
256
+ * **Set language:**
257
+
258
+ ```bash
259
+ scai set lang ts
260
+ ```
261
+ * **Show config:**
262
+
263
+ ```bash
264
+ scai config
265
+ ```
266
+
267
+ <br>
268
+
269
+ ## 🔁 Background Daemon and Indexing ⚠️ ALPHA Notice
270
+
271
+ These features are experimental and subject to change:
272
+
273
+ * `index`, `find`, `ask`
274
+ * `daemon`, `stop-daemon`
275
+ * `gen tests` (test generation)
276
+
277
+ <br>
278
+
279
+ ## Commands
280
+
281
+ ### `index`
282
+ The `index` command is used to manage and perform operations on the indexed files and repositories.
283
+
284
+ #### `scai index start`
285
+
286
+ Index supported files in the configured index directory.
287
+
288
+ ```bash
289
+ scai index set <dir>
290
+ ```
291
+
292
+ Set and activate the index directory.
293
+ ```bash
294
+ scai index list
295
+ ```
296
+
297
+ List all indexed repositories.
298
+ ```bash
299
+ scai index switch
300
+ ```
301
+
302
+ Switch active repository (by key or indexDir). Run without input for an interactive list of repositories.
303
+
304
+
305
+ ---
306
+
307
+ > **Note:** Indexing very large repositories (millions of lines) may take **hours or days**. Please be patient, and only index huge codebases if you are ok with some extra processing taking place on your computer.
308
+
309
+ The `scai index` command **automatically** starts a background daemon that continuously:
310
+
311
+ * Scans your target directory
312
+ * Summarizes new or changed files
313
+ * Updates embeddings and the search index
314
+
315
+ You won't gain much value from the index unless you scope it to one repository.
316
+
317
+ ---
318
+
319
+ ### 🔍 Codebase Search & Ask (ALPHA)
320
+
321
+ > **Important:** You must `index` a **code repository** first or `find` and `ask` have no context to work with.
322
+
323
+ 1. **Set index directory:**
324
+
325
+ ```bash
326
+ scai index set /path/to/repo
327
+ ```
328
+
329
+ 2. **Index your repo (once):**
330
+
331
+ ```bash
332
+ scai index start
333
+ ```
334
+
335
+ 3. The daemon is designed to **consume minimal resources** and run unobtrusively. You can control it with:
336
+
337
+ ```bash
338
+ scai daemon # Start or show daemon status
339
+ scai stop-daemon # Stop the background indexer
340
+ ```
341
+
342
+
343
+ 4. **Keyword search:**
344
+
345
+ ```bash
346
+ scai find YourClassName
347
+ ```
348
+
349
+ 5. **Natural-language questions:**
350
+
351
+ ### 🧠 Natural-language questions
352
+
353
+ Ask questions about your codebase using `scai ask`.
354
+
355
+ You can run it in two ways:
356
+
357
+ 1. **Inline question**
358
+
359
+ ```bash
360
+ scai ask "How does the controller work?"
361
+ ```
362
+
363
+ 2. **Interactive prompt**
364
+
365
+ ```bash
366
+ scai ask
367
+ ```
368
+
369
+ **Press enter**
370
+ , then type your question when prompted:
371
+
372
+ ```
373
+ > How does the controller work?
374
+ ```
375
+
376
+ </br>
377
+
378
+ ### 🚨 **OBS** 🚨
379
+
380
+ `find` and `ask` rely on that index—without it they will return no useful results.
381
+
382
+ ---
383
+
384
+ 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.
385
+
386
+ If you're upgrading from an earlier version, please run the following commands to avoid indexing issues:
387
+
388
+ ```bash
389
+ scai reset-db
390
+ scai index
391
+ ```
392
+ </br>
393
+
394
+ ---
395
+
396
+ ## 🛍️ Maintenance & Utilities
397
+
398
+ * **Reset database (w/ backup):**
399
+
400
+ ```bash
401
+ scai reset-db
402
+ ```
403
+ * **Backup only of `~/.scai`:**
404
+
405
+ ```bash
406
+ scai backup
407
+ ```
408
+
409
+ ---
410
+
411
+ ## 🧺 Module Pipeline Mode
412
+
413
+ For custom pipelines on a single file:
414
+
415
+ ```bash
416
+ scai src/file.ts -m summary,comments
417
+ ```
418
+ ---
419
+
420
+ ## 🔐 License & Fair Use
421
+
422
+ **scai is free to use** for individuals, teams, and commercial projects.
423
+
424
+ You may:
425
+
426
+ * ✅ Use internally or commercially
427
+ * ✅ Fork and improve
428
+ * ✅ Recommend to others
429
+
430
+ You may **not**:
431
+
432
+ * ❌ Resell as a product or service
433
+ * ❌ Claim ownership of the tool
434
+
435
+ </br>
436
+
437
+ ### 📄 License
438
+
439
+ Free for personal and internal company use only.
440
+ Commercial use (resale, SaaS, inclusion in paid tools) is prohibited.
441
+ Contact me for commercial licensing.
442
+
443
+ ---
444
+
445
+ </br>
446
+
447
+ ## 🙌 Feedback
448
+
449
+ Questions, ideas, or bugs?
450
+ Ping [@ticcr](https://bsky.app/profile/ticcr.xyz) on Bluesky — I'd love to hear your thoughts!
451
+
452
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scai",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "scai": "./dist/index.js"