scai 0.1.51 → 0.1.53

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 (3) hide show
  1. package/README.md +80 -2
  2. package/dist/index.js +17 -36
  3. package/package.json +15 -4
package/README.md CHANGED
@@ -52,6 +52,80 @@ scai runs entirely on your machine and doesn't require cloud APIs or API keys. T
52
52
  scai init
53
53
  ```
54
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
+
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
+ ---
68
+
69
+ ### 🔑 Setting Up Authentication (Required)
70
+
71
+ To interact with GitHub and create pull requests, `scai` needs a personal access token with **repo** permissions.
72
+
73
+ 1. **Create your GitHub Access Token**
74
+ Follow this link to generate a token: [https://github.com/settings/tokens?type=beta](https://github.com/settings/tokens?type=beta)
75
+
76
+ Make sure you enable at least:
77
+
78
+ * `repo` (Full control of private repositories)
79
+ * `workflow` (If you want PRs to trigger CI)
80
+
81
+ 2. **Set the token in scai:**
82
+
83
+ ```bash
84
+ scai auth set
85
+ ```
86
+
87
+ This stores your token locally in a secure config file. You can inspect the setup at any time:
88
+
89
+ ```bash
90
+ scai auth check
91
+ ```
92
+
93
+ 3. **Set the index dir:**
94
+
95
+ ```bash
96
+ scai set index-dir <repo path>
97
+ ```
98
+
99
+ This is the repo from which scai will look up pull requests that can be reviewed.
100
+
101
+ ---
102
+
103
+ ### 🧠 How to Use `scai git review`
104
+
105
+ ```bash
106
+ scai git review
107
+ ```
108
+
109
+ This will show you pull requests assigned to you for review:
110
+
111
+ * Understand the diffs using a local model
112
+ * Generate a structured pull request:
113
+
114
+ * ✅ Title
115
+ * ✅ Summary of changes
116
+ * ✅ Explanation of why the changes matter
117
+ * ✅ Optional changelog bullets
118
+
119
+ You’ll be shown a preview and asked to confirm before pushing or opening a PR.
120
+
121
+ #### Flags
122
+
123
+ You can override behavior like this:
124
+
125
+ ```bash
126
+ scai git review -a
127
+ ```
128
+ This will show you all pull requests that have not yet been reviewed.
55
129
 
56
130
  ## ⚒️ Usage Overview
57
131
 
@@ -205,7 +279,7 @@ You won't gain much value from the index unless you scope it to one repository.
205
279
 
206
280
  ## 🔄 Breaking Change in v0.1.47
207
281
 
208
- > 🛠️ As of `v0.1.47`, the internal database schema has changed.
282
+ > 🛠️ As of `v0.1.47`, the internal database schema has changed, and may well change in the future.
209
283
 
210
284
  🚨 **OBS**: 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.
211
285
 
@@ -258,6 +332,10 @@ You may **not**:
258
332
  * ❌ Resell as a product or service
259
333
  * ❌ Claim ownership of the tool
260
334
 
261
- See [LICENSE](./LICENSE) for full terms.
335
+ ### 📄 License
336
+
337
+ Free for personal and internal company use only.
338
+ Commercial use (resale, SaaS, inclusion in paid tools) is prohibited.
339
+ Contact me for commercial licensing.
262
340
 
263
341
  ```
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ //!/usr/bin/env node
2
2
  import { Command } from "commander";
3
3
  import path from "path";
4
4
  import { Config } from './config.js';
@@ -30,14 +30,6 @@ const cmd = new Command('scai')
30
30
  .version(version)
31
31
  .option('--model <model>', 'Set the model to use (e.g., codellama:34b)')
32
32
  .option('--lang <lang>', 'Set the target language (ts, java, rust)');
33
- function defineSuggCommand(cmd) {
34
- cmd
35
- .command('sugg')
36
- .description('Suggest a commit message from staged changes')
37
- .option('-c, --commit', 'Automatically commit with suggested message')
38
- .option('-l, --changelog', 'Generate and optionally stage a changelog entry')
39
- .action((options) => suggestCommitMessage(options));
40
- }
41
33
  // 🔧 Main command group
42
34
  cmd
43
35
  .command('init')
@@ -46,20 +38,22 @@ cmd
46
38
  await bootstrap();
47
39
  console.log('✅ Model initialization completed!');
48
40
  });
49
- // Register top-level `sugg` command
50
- defineSuggCommand(cmd);
51
41
  // 🔧 Group: Git-related commands
52
42
  const git = cmd.command('git').description('Git utilities');
53
43
  git
54
44
  .command('review')
55
45
  .description('Review an open pull request using AI')
56
- .option('-a, --all', 'Show all PRs requiring a review (not just for the current user)', false) // New option for showing all PRs
46
+ .option('-a, --all', 'Show all PRs requiring a review (not just for the current user)', false)
57
47
  .action(async (cmd) => {
58
- const showAll = cmd.all; // Access the flag passed via command line
59
- await reviewPullRequestCmd('main', showAll); // Pass the flag to the review function
48
+ const showAll = cmd.all;
49
+ await reviewPullRequestCmd('main', showAll);
60
50
  });
61
- // Register `sugg` under `git` group
62
- defineSuggCommand(git);
51
+ git
52
+ .command('sugg')
53
+ .description('Suggest a commit message from staged changes')
54
+ .option('-c, --commit', 'Automatically commit with suggested message')
55
+ .option('-l, --changelog', 'Generate and optionally stage a changelog entry')
56
+ .action((options) => suggestCommitMessage(options));
63
57
  // Add auth-related commands
64
58
  const auth = cmd.command('auth').description('GitHub authentication commands');
65
59
  auth
@@ -72,7 +66,6 @@ auth
72
66
  console.log('❌ GitHub authentication not found. Please set your token.');
73
67
  return;
74
68
  }
75
- // Call the new check
76
69
  const result = await validateGitHubTokenAgainstRepo();
77
70
  console.log(result);
78
71
  }
@@ -84,16 +77,10 @@ auth
84
77
  .command('reset')
85
78
  .description('Reset GitHub authentication credentials')
86
79
  .action(() => {
87
- Config.setGitHubToken(''); // Clears the GitHub token from the config
80
+ Config.setGitHubToken('');
88
81
  console.log('🔄 GitHub authentication has been reset.');
89
- // Check if the token is successfully removed
90
82
  const token = Config.getGitHubToken();
91
- if (!token) {
92
- console.log('✅ Token successfully removed from configuration.');
93
- }
94
- else {
95
- console.log('❌ Token still exists in the configuration.');
96
- }
83
+ console.log(token ? '❌ Token still exists in the configuration.' : '✅ Token successfully removed.');
97
84
  });
98
85
  auth
99
86
  .command('set')
@@ -147,14 +134,12 @@ set
147
134
  Config.setIndexDir(path.resolve(dir));
148
135
  Config.show();
149
136
  });
150
- // 🧪 Diagnostics and info
151
137
  cmd
152
138
  .command('config')
153
139
  .description('Show the currently active model and language settings')
154
140
  .action(() => {
155
141
  Config.show();
156
142
  });
157
- // 🔍 Indexing
158
143
  cmd
159
144
  .command('index [targetDir]')
160
145
  .description('Index supported files in the given directory (or current folder if none)')
@@ -166,24 +151,22 @@ cmd
166
151
  .command('backup')
167
152
  .description('Backup the current .scai folder')
168
153
  .action(runBackupCommand);
169
- // 🧠 Query and assistant
170
154
  cmd
171
155
  .command('find <query>')
172
156
  .description('Search indexed files by keyword')
173
157
  .action(runFindCommand);
174
158
  cmd
175
- .command('ask [question...]') // <- the ... makes it variadic
159
+ .command('ask [question...]')
176
160
  .description('Ask a question based on indexed files')
177
161
  .action((questionParts) => {
178
162
  const fullQuery = questionParts?.join(' ');
179
163
  runAskCommand(fullQuery);
180
164
  });
181
- // 🛠️ Background tasks and maintenance
182
165
  cmd
183
166
  .command('daemon')
184
167
  .description('Run background summarization of indexed files')
185
168
  .action(async () => {
186
- await startDaemon(); // ignore the return value
169
+ await startDaemon();
187
170
  });
188
171
  cmd
189
172
  .command('stop-daemon')
@@ -204,9 +187,10 @@ cmd
204
187
  .command('reset-db')
205
188
  .description('Delete and reset the SQLite database')
206
189
  .action(() => resetDatabase());
207
- // 🧬 Fallback: Pipeline mode
208
190
  cmd
209
- .arguments('<file>')
191
+ .command('pipe')
192
+ .description('Run a module pipeline on a given file')
193
+ .argument('<file>', 'Target file')
210
194
  .option('-m, --modules <modules>', 'Comma-separated list of modules to run (e.g., comments,cleanup,summary)')
211
195
  .action((file, options) => {
212
196
  if (!options.modules) {
@@ -215,7 +199,6 @@ cmd
215
199
  }
216
200
  runModulePipelineFromCLI(file, options);
217
201
  });
218
- // Add explanation about alpha features directly in the help menu
219
202
  cmd.addHelpText('after', `
220
203
  🚨 Alpha Features:
221
204
  - The "index", "daemon", "stop-daemon", "reset-db" commands are considered alpha features.
@@ -223,9 +206,7 @@ cmd.addHelpText('after', `
223
206
 
224
207
  💡 Use with caution and expect possible changes or instability.
225
208
  `);
226
- // ✅ Parse CLI args
227
209
  cmd.parse(process.argv);
228
- // 🔁 Apply global options post-parse
229
210
  const opts = cmd.opts();
230
211
  if (opts.model)
231
212
  Config.setModel(opts.model);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scai",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "scai": "./dist/index.js"
@@ -10,15 +10,26 @@
10
10
  "url": "git+https://github.com/rzs/scai.git"
11
11
  },
12
12
  "author": "Rasmus Uhd Norgaard",
13
- "license": "SEE LICENSE IN LICENSE",
13
+ "license": "Proprietary",
14
+ "readmeFilename": "README.md",
14
15
  "keywords": [
15
16
  "cli",
16
17
  "ai",
17
18
  "refactor",
18
19
  "devtools",
20
+ "developer-tools",
19
21
  "local",
22
+ "offline",
20
23
  "typescript",
21
- "llm"
24
+ "llm",
25
+ "code-review",
26
+ "commit-message",
27
+ "git",
28
+ "changelog",
29
+ "productivity",
30
+ "scai",
31
+ "review",
32
+ "commit"
22
33
  ],
23
34
  "scripts": {
24
35
  "build": "rm -rfd dist && tsc && git add .",
@@ -46,4 +57,4 @@
46
57
  "dist/",
47
58
  "README.md"
48
59
  ]
49
- }
60
+ }