Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Total Tools**: Increased from 4 to 6 custom tools
- **Total Agents**: Increased from 22 to 24 with vertical specialists
- **Total Resources**: 40+ curated resources (24 agents + 6 tools + 5 instructions + 5 prompts + 5 skills)
- **Activation Message**: Updated to reflect "22 expert agents + 6 custom tools"
- **Activation Message**: Updated to reflect "24 expert agents + 6 custom tools"
- **Description**: Highlights analytics and industry-specific expertise
- **All Tools**: Integrated telemetry logging for success/failure tracking
- **Validation Script**: Enhanced with content analysis and security checks
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,24 @@ Detects performance anti-patterns:
- Deep clone anti-patterns
- Framework-specific optimizations

### 5. Dependency Analyzer

Scans and analyzes project dependencies:

- Supports: package.json (Node.js), requirements.txt (Python), go.mod (Go), Cargo.toml (Rust)
- Detects outdated packages and provides update recommendations
- Security scanning suggestions (Dependabot, Renovate, pip-audit, cargo audit)

### 6. API Designer

REST API design and OpenAPI specification generator:

- OpenAPI 3.1 templates and best practices
- HTTP verb mapping and resource naming conventions
- API design patterns (pagination, filtering, sorting, HATEOAS)
- Security guidelines (OAuth 2.0, JWT, rate limiting)
- Framework-specific tool recommendations (FastAPI, Express, SpringDoc)

## 🎓 Quick Start Workflows

### Building a Web API
Expand Down Expand Up @@ -188,8 +206,8 @@ Detects performance anti-patterns:

### Custom Tools (Phase 2)

- 4 VSCode native tools for all agents
- Code analysis, test generation, documentation, performance profiling
- 6 VSCode native tools for all agents
- Code analysis, test generation, documentation, performance profiling, dependency analysis, and API design
- Production-ready error handling

### Extended Language Support (Phase 1)
Expand Down
31 changes: 21 additions & 10 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,20 @@ class TelemetryReporter {
* Register custom tools for Copilot Chat agents
* These tools extend the built-in capabilities with specialized functionality
*/
function registerCustomTools(context) {
const telemetry = new TelemetryReporter(context);
function registerCustomTools(context, telemetry) {

const codeAnalyzer = vscode.lm.registerTool('codeAnalyzer', {
displayName: 'Code Analyzer',
description: 'Analyzes code complexity, patterns, and potential improvements',

async invoke(options, token) {
const startTime = Date.now();
let success = true;

try {
const { input } = options;
const editor = vscode.window.activeTextEditor;

if (!editor) {
success = false;
await telemetry.logToolUsage('codeAnalyzer', false, { reason: 'no_editor' });
return new vscode.LanguageModelToolResult([
new vscode.LanguageModelTextPart('No active editor found')
Expand All @@ -95,13 +92,17 @@ function registerCustomTools(context) {
fileName: path.basename(document.fileName)
};

const commentRatio = analysis.codeLines > 0
? ((analysis.commentLines / analysis.codeLines) * 100).toFixed(1) + '%'
: 'N/A';

const result = `Code Analysis for ${analysis.fileName}:
- Language: ${analysis.language}
- Total Lines: ${analysis.totalLines}
- Code Lines: ${analysis.codeLines}
- Comment Lines: ${analysis.commentLines}
- Average Line Length: ${analysis.averageLineLength} characters
- Comment Ratio: ${((analysis.commentLines / analysis.codeLines) * 100).toFixed(1)}%`;
- Comment Ratio: ${commentRatio}`;

await telemetry.logToolUsage('codeAnalyzer', true, {
language: languageId,
Expand All @@ -113,7 +114,6 @@ function registerCustomTools(context) {
new vscode.LanguageModelTextPart(result)
]);
} catch (error) {
success = false;
await telemetry.logToolUsage('codeAnalyzer', false, { error: error.message });
return new vscode.LanguageModelToolResult([
new vscode.LanguageModelTextPart(`Error analyzing code: ${error.message}`)
Expand Down Expand Up @@ -338,7 +338,19 @@ General Recommendations:
// Check for package.json (Node.js/JavaScript)
const packageJsonPath = path.join(rootPath, 'package.json');
if (fs.existsSync(packageJsonPath)) {
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
let packageJson;
try {
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf8');
packageJson = JSON.parse(packageJsonContent);
} catch (e) {
await telemetry.logToolUsage('dependencyAnalyzer', false, { reason: 'invalid_package_json', error: e.message });
return new vscode.LanguageModelToolResult([
new vscode.LanguageModelTextPart(
`The package.json file at "${packageJsonPath}" contains invalid JSON and could not be parsed. ` +
'Please fix the JSON syntax and run the dependency analyzer again.'
)
]);
}
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
const depCount = Object.keys(deps).length;

Expand Down Expand Up @@ -530,9 +542,8 @@ async function activate(context) {
console.log('Agent Pro: Activating...');

try {
registerCustomTools(context);

const telemetry = new TelemetryReporter(context);
registerCustomTools(context, telemetry);

const showStatsCommand = vscode.commands.registerCommand('agentPro.showStats', async () => {
const stats = await telemetry.getStats();
Expand Down Expand Up @@ -606,7 +617,7 @@ async function activate(context) {

console.log(`Resources installed to ${resourcesPath}`);
vscode.window.showInformationMessage(
'Agent Pro: Activated! Your 22 expert agents + 6 custom tools are ready. Open Copilot Chat and type @ to see them.'
'Agent Pro: Activated! Your 24 expert agents + 6 custom tools are ready. Open Copilot Chat and type @ to see them.'
);
} else {
console.log(`Resources already installed (version ${currentVersion})`);
Expand Down
Loading
Loading