aico-ai 1.1.3 ā 1.1.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 +7 -0
- package/index.js +72 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- **Multi-Provider Support**: Groq, OpenAI, DeepSeek, Gemini, or local Ollama
|
|
10
10
|
- **Auto-Fix Suggestions**: Apply AI-recommended fixes with one click
|
|
11
11
|
- **Parallel Processing**: Fast reviews even for large diffs
|
|
12
|
+
- **Code Explanation**: Get instant explanations for complex files
|
|
12
13
|
|
|
13
14
|
### Team Rules Engine
|
|
14
15
|
- **Custom Standards**: Define your team's code quality rules
|
|
@@ -175,6 +176,12 @@ aico review
|
|
|
175
176
|
# Generate AI commit message
|
|
176
177
|
aico commit
|
|
177
178
|
|
|
179
|
+
# Generate Pull Request description
|
|
180
|
+
aico pr
|
|
181
|
+
|
|
182
|
+
# Explain the code and commit that was generated
|
|
183
|
+
aico explain
|
|
184
|
+
|
|
178
185
|
# Run security scan
|
|
179
186
|
aico security scan
|
|
180
187
|
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { getStagedDiff, applyFix, getDiffChunks } from './lib/git-utils.js';
|
|
3
|
-
import { reviewCode, generateCommitMessage } from './lib/ai-service.js';
|
|
3
|
+
import { reviewCode, generateCommitMessage, generatePRDescription, explainCode } from './lib/ai-service.js';
|
|
4
4
|
import { parseAIResponse, displayIssues } from './lib/reviewer.js';
|
|
5
5
|
import {
|
|
6
6
|
initializeTeamRules,
|
|
@@ -715,7 +715,9 @@ ${pc.bold('Usage:')}
|
|
|
715
715
|
${pc.bold('Commands:')}
|
|
716
716
|
${pc.cyan('review')} Analyze staged changes and suggest improvements (default)
|
|
717
717
|
${pc.cyan('commit')} Generate and apply an AI-suggested commit message
|
|
718
|
+
${pc.cyan('pr')} Generate Pull Request description from diff
|
|
718
719
|
${pc.cyan('ci')} Run in CI/CD mode with machine-readable output
|
|
720
|
+
${pc.cyan('explain <file>')} Explain a specific file
|
|
719
721
|
${pc.cyan('security <subcommand>')} Security vulnerability scanning
|
|
720
722
|
${pc.dim('scan')} Full security scan (dependencies + code + config)
|
|
721
723
|
${pc.dim('check')} Check specific areas (--dependencies or --code)
|
|
@@ -742,6 +744,8 @@ ${pc.bold('Options:')}
|
|
|
742
744
|
${pc.bold('Examples:')}
|
|
743
745
|
aico review --silent
|
|
744
746
|
aico commit
|
|
747
|
+
aico pr
|
|
748
|
+
aico explain src/utils.js
|
|
745
749
|
aico ci --format json --output report.json
|
|
746
750
|
aico security scan
|
|
747
751
|
aico security check --dependencies
|
|
@@ -790,6 +794,73 @@ async function main() {
|
|
|
790
794
|
return;
|
|
791
795
|
}
|
|
792
796
|
|
|
797
|
+
if (command === 'pr') {
|
|
798
|
+
try {
|
|
799
|
+
const currentBranch = execSync('git branch --show-current').toString().trim();
|
|
800
|
+
|
|
801
|
+
// Try to detect base branch (main, master, or develop)
|
|
802
|
+
let baseBranch = 'main';
|
|
803
|
+
const branches = ['main', 'master', 'develop', 'dev'];
|
|
804
|
+
for (const branch of branches) {
|
|
805
|
+
try {
|
|
806
|
+
execSync(`git rev-parse --verify origin/${branch}`, { stdio: 'ignore' });
|
|
807
|
+
baseBranch = branch;
|
|
808
|
+
break;
|
|
809
|
+
} catch (e) {
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
console.log(pc.dim(`Comparing ${currentBranch} with origin/${baseBranch}...`));
|
|
815
|
+
const diff = execSync(`git diff origin/${baseBranch}...${currentBranch}`).toString();
|
|
816
|
+
|
|
817
|
+
if (!diff || diff.trim() === '') {
|
|
818
|
+
console.log(pc.yellow(`No differences found between ${currentBranch} and origin/${baseBranch}.`));
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
startSpinner('Generating PR description...');
|
|
823
|
+
const description = await generatePRDescription(diff);
|
|
824
|
+
stopSpinner();
|
|
825
|
+
|
|
826
|
+
console.log(pc.bold('\nš Suggested PR Description:\n'));
|
|
827
|
+
console.log(description);
|
|
828
|
+
} catch (error) {
|
|
829
|
+
stopSpinner();
|
|
830
|
+
console.error(pc.red('Error generating PR description:'), error.message);
|
|
831
|
+
process.exit(1);
|
|
832
|
+
}
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (command === 'explain') {
|
|
837
|
+
const filePath = args[1];
|
|
838
|
+
if (!filePath) {
|
|
839
|
+
console.error(pc.red('Please provide a file path: aico explain <file>'));
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
if (!fs.existsSync(filePath)) {
|
|
844
|
+
console.error(pc.red(`File not found: ${filePath}`));
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
try {
|
|
849
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
850
|
+
startSpinner(`Analyzing ${filePath}...`);
|
|
851
|
+
const explanation = await explainCode(content, filePath);
|
|
852
|
+
stopSpinner();
|
|
853
|
+
|
|
854
|
+
console.log(pc.bold(`\nš Explanation for ${filePath}:\n`));
|
|
855
|
+
console.log(explanation);
|
|
856
|
+
} catch (error) {
|
|
857
|
+
stopSpinner();
|
|
858
|
+
console.error(pc.red('Error explaining file:'), error.message);
|
|
859
|
+
process.exit(1);
|
|
860
|
+
}
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
|
|
793
864
|
if (command !== 'review' && command !== 'commit') {
|
|
794
865
|
console.error(pc.red(`Unknown command: ${command}`));
|
|
795
866
|
console.log(`Run ${pc.cyan('aico help')} to see available commands.`);
|