ai-first-cli 1.1.2 → 1.1.5
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/ANALISIS_MEJORAS.md +327 -0
- package/BUGS.md +455 -0
- package/CHANGELOG.md +100 -225
- package/TEST_RESULTS.md +198 -0
- package/TEST_RESULTS_COMPARATIVE.md +159 -0
- package/TEST_RESULTS_COMPLETE.md +127 -0
- package/TEST_RESULTS_COMPREHENSIVE.md +208 -0
- package/ai/ai_context.md +17 -10
- package/ai/ai_rules.md +5 -3
- package/ai/architecture.md +28 -7
- package/ai/cache.json +832 -52
- package/ai/context/features/commands.json +18 -0
- package/ai/context/features/src.json +61 -0
- package/ai/context/features/test-projects.json +56 -0
- package/ai/context/flows/account.json +9 -0
- package/ai/context/flows/add_.json +9 -0
- package/ai/context/flows/ai-first.json +9 -0
- package/ai/context/flows/auth..json +10 -0
- package/ai/context/flows/auth.json +12 -0
- package/ai/context/flows/dashboard.json +9 -0
- package/ai/context/flows/doctor.json +9 -0
- package/ai/context/flows/explore.json +9 -0
- package/ai/context/flows/list_.json +9 -0
- package/ai/context/flows/login.json +9 -0
- package/ai/context/flows/opportunity.json +9 -0
- package/ai/context/flows/remove_.json +9 -0
- package/ai/context/flows/user.json +14 -0
- package/ai/context/flows/users..json +10 -0
- package/ai/context/flows/users.json +9 -0
- package/ai/conventions.md +3 -2
- package/ai/dependencies.json +429 -251
- package/ai/entrypoints.md +10 -0
- package/ai/files.json +822 -46
- package/ai/git/commit-activity.json +126 -39
- package/ai/git/recent-features.json +3 -1
- package/ai/git/recent-files.json +6 -6
- package/ai/git/recent-flows.json +3 -1
- package/ai/graph/knowledge-graph.json +954 -182
- package/ai/graph/module-graph.json +270 -0
- package/ai/graph/symbol-graph.json +48991 -16523
- package/ai/graph/symbol-references.json +953 -56
- package/ai/hierarchy.json +3 -24
- package/ai/index-state.json +1261 -253
- package/ai/index.db +0 -0
- package/ai/modules.json +226 -0
- package/ai/project.json +29 -0
- package/ai/repo-map.json +2284 -250
- package/ai/repo_map.json +2731 -231
- package/ai/repo_map.md +559 -2
- package/ai/schema.json +5 -0
- package/ai/summary.md +16 -7
- package/ai/tech_stack.md +4 -1
- package/ai/tools.json +10 -0
- package/dist/analyzers/dependencies.d.ts.map +1 -1
- package/dist/analyzers/dependencies.js +8 -16
- package/dist/analyzers/dependencies.js.map +1 -1
- package/dist/analyzers/symbols.d.ts.map +1 -1
- package/dist/analyzers/symbols.js +60 -0
- package/dist/analyzers/symbols.js.map +1 -1
- package/dist/commands/ai-first.d.ts +1 -0
- package/dist/commands/ai-first.d.ts.map +1 -1
- package/dist/commands/ai-first.js +29 -6
- package/dist/commands/ai-first.js.map +1 -1
- package/dist/core/semanticContexts.d.ts.map +1 -1
- package/dist/core/semanticContexts.js +48 -26
- package/dist/core/semanticContexts.js.map +1 -1
- package/dist/core/symbolGraph.d.ts.map +1 -1
- package/dist/core/symbolGraph.js +14 -2
- package/dist/core/symbolGraph.js.map +1 -1
- package/dist/utils/fileUtils.d.ts.map +1 -1
- package/dist/utils/fileUtils.js +5 -0
- package/dist/utils/fileUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/analyzers/dependencies.ts +10 -20
- package/src/analyzers/symbols.ts +64 -0
- package/src/commands/ai-first.ts +32 -8
- package/src/core/semanticContexts.ts +54 -29
- package/src/core/symbolGraph.ts +16 -2
- package/src/utils/fileUtils.ts +5 -0
- package/test-projects/express-api/ai/ai_context.md +112 -0
- package/test-projects/express-api/ai/ai_rules.md +50 -0
- package/test-projects/express-api/ai/architecture.md +62 -0
- package/test-projects/express-api/ai/cache.json +125 -0
- package/test-projects/express-api/ai/context/features/controllers.json +13 -0
- package/test-projects/express-api/ai/context/features/services.json +13 -0
- package/test-projects/express-api/ai/context/flows/auth.json +12 -0
- package/test-projects/express-api/ai/context/flows/user.json +13 -0
- package/test-projects/express-api/ai/conventions.md +51 -0
- package/test-projects/express-api/ai/dependencies.json +54 -0
- package/test-projects/express-api/ai/entrypoints.md +17 -0
- package/test-projects/express-api/ai/files.json +169 -0
- package/test-projects/express-api/ai/graph/knowledge-graph.json +98 -0
- package/test-projects/express-api/ai/graph/module-graph.json +44 -0
- package/test-projects/express-api/ai/graph/symbol-graph.json +882 -0
- package/test-projects/express-api/ai/graph/symbol-references.json +51 -0
- package/test-projects/express-api/ai/index-state.json +238 -0
- package/test-projects/express-api/ai/index.db +0 -0
- package/test-projects/express-api/ai/modules.json +30 -0
- package/test-projects/express-api/ai/project.json +15 -0
- package/test-projects/express-api/ai/repo-map.json +291 -0
- package/test-projects/express-api/ai/repo_map.json +100 -0
- package/test-projects/express-api/ai/repo_map.md +36 -0
- package/test-projects/express-api/ai/schema.json +5 -0
- package/test-projects/express-api/ai/summary.md +14 -0
- package/test-projects/express-api/ai/symbols.json +1174 -0
- package/test-projects/express-api/ai/tech_stack.md +38 -0
- package/test-projects/express-api/ai/tools.json +10 -0
- package/test-projects/express-api/controllers/authController.js +32 -0
- package/test-projects/express-api/controllers/userController.js +51 -0
- package/test-projects/express-api/index.js +21 -0
- package/test-projects/express-api/middleware/authMiddleware.js +30 -0
- package/test-projects/express-api/models/userRepository.js +25 -0
- package/test-projects/express-api/package.json +18 -0
- package/test-projects/express-api/services/authService.js +17 -0
- package/test-projects/express-api/services/userService.js +28 -0
- package/test-projects/nestjs-backend/ai/ai_context.md +110 -0
- package/test-projects/nestjs-backend/ai/ai_rules.md +52 -0
- package/test-projects/nestjs-backend/ai/architecture.md +43 -0
- package/test-projects/nestjs-backend/ai/cache.json +137 -0
- package/test-projects/nestjs-backend/ai/context/features/src.json +23 -0
- package/test-projects/nestjs-backend/ai/context/flows/auth..json +10 -0
- package/test-projects/nestjs-backend/ai/context/flows/users..json +10 -0
- package/test-projects/nestjs-backend/ai/conventions.md +52 -0
- package/test-projects/nestjs-backend/ai/dependencies.json +152 -0
- package/test-projects/nestjs-backend/ai/entrypoints.md +18 -0
- package/test-projects/nestjs-backend/ai/files.json +184 -0
- package/test-projects/nestjs-backend/ai/graph/knowledge-graph.json +74 -0
- package/test-projects/nestjs-backend/ai/graph/module-graph.json +29 -0
- package/test-projects/nestjs-backend/ai/graph/symbol-graph.json +304 -0
- package/test-projects/nestjs-backend/ai/graph/symbol-references.json +5 -0
- package/test-projects/nestjs-backend/ai/index-state.json +259 -0
- package/test-projects/nestjs-backend/ai/index.db +0 -0
- package/test-projects/nestjs-backend/ai/modules.json +19 -0
- package/test-projects/nestjs-backend/ai/project.json +14 -0
- package/test-projects/nestjs-backend/ai/repo-map.json +323 -0
- package/test-projects/nestjs-backend/ai/repo_map.json +141 -0
- package/test-projects/nestjs-backend/ai/repo_map.md +39 -0
- package/test-projects/nestjs-backend/ai/schema.json +5 -0
- package/test-projects/nestjs-backend/ai/summary.md +11 -0
- package/test-projects/nestjs-backend/ai/symbols.json +527 -0
- package/test-projects/nestjs-backend/ai/tech_stack.md +37 -0
- package/test-projects/nestjs-backend/ai/tools.json +10 -0
- package/test-projects/nestjs-backend/package.json +22 -0
- package/test-projects/nestjs-backend/src/app.module.ts +8 -0
- package/test-projects/nestjs-backend/src/auth/auth.controller.ts +22 -0
- package/test-projects/nestjs-backend/src/auth/auth.module.ts +11 -0
- package/test-projects/nestjs-backend/src/auth/auth.service.ts +28 -0
- package/test-projects/nestjs-backend/src/auth/dto/login.dto.ts +4 -0
- package/test-projects/nestjs-backend/src/auth/strategies/jwt.strategy.ts +18 -0
- package/test-projects/nestjs-backend/src/main.ts +9 -0
- package/test-projects/nestjs-backend/src/users/users.controller.ts +32 -0
- package/test-projects/nestjs-backend/src/users/users.module.ts +10 -0
- package/test-projects/nestjs-backend/src/users/users.service.ts +42 -0
- package/test-projects/nestjs-backend/tsconfig.json +21 -0
- package/test-projects/python-cli/__init__.py +1 -0
- package/test-projects/python-cli/ai/ai_context.md +94 -0
- package/test-projects/python-cli/ai/ai_rules.md +47 -0
- package/test-projects/python-cli/ai/architecture.md +49 -0
- package/test-projects/python-cli/ai/cache.json +129 -0
- package/test-projects/python-cli/ai/context/features/cli.json +16 -0
- package/test-projects/python-cli/ai/context/flows/add_.json +9 -0
- package/test-projects/python-cli/ai/context/flows/list_.json +9 -0
- package/test-projects/python-cli/ai/context/flows/remove_.json +9 -0
- package/test-projects/python-cli/ai/conventions.md +51 -0
- package/test-projects/python-cli/ai/dependencies.json +66 -0
- package/test-projects/python-cli/ai/entrypoints.md +4 -0
- package/test-projects/python-cli/ai/files.json +174 -0
- package/test-projects/python-cli/ai/graph/knowledge-graph.json +83 -0
- package/test-projects/python-cli/ai/graph/module-graph.json +31 -0
- package/test-projects/python-cli/ai/graph/symbol-graph.json +358 -0
- package/test-projects/python-cli/ai/graph/symbol-references.json +11 -0
- package/test-projects/python-cli/ai/index-state.json +245 -0
- package/test-projects/python-cli/ai/index.db +0 -0
- package/test-projects/python-cli/ai/modules.json +21 -0
- package/test-projects/python-cli/ai/project.json +15 -0
- package/test-projects/python-cli/ai/repo-map.json +290 -0
- package/test-projects/python-cli/ai/repo_map.json +99 -0
- package/test-projects/python-cli/ai/repo_map.md +32 -0
- package/test-projects/python-cli/ai/schema.json +5 -0
- package/test-projects/python-cli/ai/summary.md +11 -0
- package/test-projects/python-cli/ai/symbols.json +475 -0
- package/test-projects/python-cli/ai/tech_stack.md +30 -0
- package/test-projects/python-cli/ai/tools.json +10 -0
- package/test-projects/python-cli/cli/__init__.py +1 -0
- package/test-projects/python-cli/cli/add_command.py +6 -0
- package/test-projects/python-cli/cli/list_command.py +7 -0
- package/test-projects/python-cli/cli/remove_command.py +6 -0
- package/test-projects/python-cli/main.py +34 -0
- package/test-projects/python-cli/models/__init__.py +2 -0
- package/test-projects/python-cli/models/task.py +19 -0
- package/test-projects/python-cli/models/task_repository.py +44 -0
- package/test-projects/react-app/ai/ai_context.md +95 -0
- package/test-projects/react-app/ai/ai_rules.md +49 -0
- package/test-projects/react-app/ai/architecture.md +33 -0
- package/test-projects/react-app/ai/cache.json +129 -0
- package/test-projects/react-app/ai/context/features/src.json +18 -0
- package/test-projects/react-app/ai/context/flows/dashboard.json +9 -0
- package/test-projects/react-app/ai/context/flows/login.json +9 -0
- package/test-projects/react-app/ai/context/flows/users.json +9 -0
- package/test-projects/react-app/ai/conventions.md +52 -0
- package/test-projects/react-app/ai/dependencies.json +128 -0
- package/test-projects/react-app/ai/entrypoints.md +4 -0
- package/test-projects/react-app/ai/files.json +174 -0
- package/test-projects/react-app/ai/graph/knowledge-graph.json +83 -0
- package/test-projects/react-app/ai/graph/module-graph.json +31 -0
- package/test-projects/react-app/ai/graph/symbol-graph.json +868 -0
- package/test-projects/react-app/ai/graph/symbol-references.json +31 -0
- package/test-projects/react-app/ai/index-state.json +245 -0
- package/test-projects/react-app/ai/index.db +0 -0
- package/test-projects/react-app/ai/modules.json +17 -0
- package/test-projects/react-app/ai/project.json +15 -0
- package/test-projects/react-app/ai/repo-map.json +305 -0
- package/test-projects/react-app/ai/repo_map.json +114 -0
- package/test-projects/react-app/ai/repo_map.md +31 -0
- package/test-projects/react-app/ai/schema.json +5 -0
- package/test-projects/react-app/ai/summary.md +11 -0
- package/test-projects/react-app/ai/symbols.json +985 -0
- package/test-projects/react-app/ai/tech_stack.md +38 -0
- package/test-projects/react-app/ai/tools.json +10 -0
- package/test-projects/react-app/package.json +16 -0
- package/test-projects/react-app/src/App.tsx +21 -0
- package/test-projects/react-app/src/context/AuthContext.tsx +41 -0
- package/test-projects/react-app/src/hooks/useAuth.ts +10 -0
- package/test-projects/react-app/src/main.tsx +10 -0
- package/test-projects/react-app/src/pages/DashboardPage.tsx +17 -0
- package/test-projects/react-app/src/pages/LoginPage.tsx +41 -0
- package/test-projects/react-app/src/pages/UsersPage.tsx +36 -0
- package/test-projects/react-app/src/services/userService.ts +37 -0
- package/test-projects/salesforce-cli/.forceignore +27 -0
- package/test-projects/salesforce-cli/ai/ai_context.md +88 -0
- package/test-projects/salesforce-cli/ai/ai_rules.md +47 -0
- package/test-projects/salesforce-cli/ai/architecture.md +33 -0
- package/test-projects/salesforce-cli/ai/cache.json +105 -0
- package/test-projects/salesforce-cli/ai/context/features/force-app.json +14 -0
- package/test-projects/salesforce-cli/ai/context/flows/account.json +9 -0
- package/test-projects/salesforce-cli/ai/context/flows/opportunity.json +9 -0
- package/test-projects/salesforce-cli/ai/conventions.md +51 -0
- package/test-projects/salesforce-cli/ai/dependencies.json +6 -0
- package/test-projects/salesforce-cli/ai/entrypoints.md +4 -0
- package/test-projects/salesforce-cli/ai/files.json +144 -0
- package/test-projects/salesforce-cli/ai/graph/knowledge-graph.json +64 -0
- package/test-projects/salesforce-cli/ai/graph/module-graph.json +13 -0
- package/test-projects/salesforce-cli/ai/graph/symbol-graph.json +148 -0
- package/test-projects/salesforce-cli/ai/graph/symbol-references.json +1 -0
- package/test-projects/salesforce-cli/ai/index-state.json +203 -0
- package/test-projects/salesforce-cli/ai/index.db +0 -0
- package/test-projects/salesforce-cli/ai/modules.json +12 -0
- package/test-projects/salesforce-cli/ai/project.json +14 -0
- package/test-projects/salesforce-cli/ai/repo-map.json +251 -0
- package/test-projects/salesforce-cli/ai/repo_map.json +69 -0
- package/test-projects/salesforce-cli/ai/repo_map.md +21 -0
- package/test-projects/salesforce-cli/ai/schema.json +5 -0
- package/test-projects/salesforce-cli/ai/summary.md +11 -0
- package/test-projects/salesforce-cli/ai/symbols.json +245 -0
- package/test-projects/salesforce-cli/ai/tech_stack.md +30 -0
- package/test-projects/salesforce-cli/ai/tools.json +10 -0
- package/test-projects/salesforce-cli/force-app/main/default/classes/AccountController.cls +24 -0
- package/test-projects/salesforce-cli/force-app/main/default/classes/OpportunityController.cls +25 -0
- package/test-projects/salesforce-cli/force-app/main/default/objects/Project__c.object.xml +45 -0
- package/test-projects/salesforce-cli/force-app/main/default/triggers/AccountTrigger.trigger +33 -0
- package/test-projects/salesforce-cli/sfdx-project.json +11 -0
- package/tests/e2e/README.md +85 -0
- package/tests/e2e/run-e2e.sh +88 -0
- package/tests/semanticContexts.test.ts +23 -25
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
public with sharing class OpportunityController {
|
|
2
|
+
|
|
3
|
+
@AuraEnabled(cacheable=true)
|
|
4
|
+
public static List<Opportunity> getOpportunitiesByStage(String stageName) {
|
|
5
|
+
return [SELECT Id, Name, Amount, CloseDate, StageName, Account.Name
|
|
6
|
+
FROM Opportunity
|
|
7
|
+
WHERE StageName = :stageName
|
|
8
|
+
ORDER BY CloseDate DESC
|
|
9
|
+
LIMIT 50];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@AuraEnabled
|
|
13
|
+
public static void closeWon(String opportunityId) {
|
|
14
|
+
Opportunity opp = [SELECT Id, StageName FROM Opportunity WHERE Id = :opportunityId];
|
|
15
|
+
opp.StageName = 'Closed Won';
|
|
16
|
+
opp.CloseDate = Date.today();
|
|
17
|
+
update opp;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public static void validateOpportunity(Opportunity opp) {
|
|
21
|
+
if (opp.Amount != null && opp.Amount > 1000000) {
|
|
22
|
+
opp.addError('Amount exceeds maximum allowed');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
3
|
+
<label>Project</label>
|
|
4
|
+
<pluralLabel>Projects</pluralLabel>
|
|
5
|
+
<nameField>
|
|
6
|
+
<label>Project Name</label>
|
|
7
|
+
<type>Text</type>
|
|
8
|
+
</nameField>
|
|
9
|
+
<fields>
|
|
10
|
+
<fullName>Status__c</fullName>
|
|
11
|
+
<label>Status</label>
|
|
12
|
+
<type>Picklist</type>
|
|
13
|
+
<valueSet>
|
|
14
|
+
<valueSetDefinition>
|
|
15
|
+
<value>
|
|
16
|
+
<fullName>Planning</fullName>
|
|
17
|
+
<default>false</default>
|
|
18
|
+
</value>
|
|
19
|
+
<value>
|
|
20
|
+
<fullName>In Progress</fullName>
|
|
21
|
+
<default>false</default>
|
|
22
|
+
</value>
|
|
23
|
+
<value>
|
|
24
|
+
<fullName>Completed</fullName>
|
|
25
|
+
<default>false</default>
|
|
26
|
+
</value>
|
|
27
|
+
</valueSetDefinition>
|
|
28
|
+
</valueSet>
|
|
29
|
+
</fields>
|
|
30
|
+
<fields>
|
|
31
|
+
<fullName>Budget__c</fullName>
|
|
32
|
+
<label>Budget</label>
|
|
33
|
+
<type>Currency</type>
|
|
34
|
+
</fields>
|
|
35
|
+
<fields>
|
|
36
|
+
<fullName>StartDate__c</fullName>
|
|
37
|
+
<label>Start Date</label>
|
|
38
|
+
<type>Date</type>
|
|
39
|
+
</fields>
|
|
40
|
+
<fields>
|
|
41
|
+
<fullName>EndDate__c</fullName>
|
|
42
|
+
<label>End Date</label>
|
|
43
|
+
<type>Date</type>
|
|
44
|
+
</fields>
|
|
45
|
+
</CustomObject>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
trigger AccountTrigger on Account (before insert, before update, after insert, after update) {
|
|
2
|
+
|
|
3
|
+
if (Trigger.isBefore) {
|
|
4
|
+
if (Trigger.isInsert || Trigger.isUpdate) {
|
|
5
|
+
for (Account acc : Trigger.new) {
|
|
6
|
+
if (acc.Industry == null) {
|
|
7
|
+
acc.Industry = 'Other';
|
|
8
|
+
}
|
|
9
|
+
if (acc.Name != null && acc.Name.length() > 80) {
|
|
10
|
+
acc.Name.addError('Account name cannot exceed 80 characters');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (Trigger.isAfter) {
|
|
17
|
+
if (Trigger.isInsert) {
|
|
18
|
+
List<Task> tasks = new List<Task>();
|
|
19
|
+
for (Account acc : Trigger.new) {
|
|
20
|
+
Task t = new Task(
|
|
21
|
+
Subject = 'Welcome ' + acc.Name,
|
|
22
|
+
WhatId = acc.Id,
|
|
23
|
+
Status = 'Not Started',
|
|
24
|
+
Priority = 'Normal'
|
|
25
|
+
);
|
|
26
|
+
tasks.add(t);
|
|
27
|
+
}
|
|
28
|
+
if (!tasks.isEmpty()) {
|
|
29
|
+
insert tasks;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# ai-first E2E Test Suite
|
|
2
|
+
|
|
3
|
+
This directory contains end-to-end tests for ai-first-cli across different project types.
|
|
4
|
+
|
|
5
|
+
## Test Projects
|
|
6
|
+
|
|
7
|
+
| Project | Path | Type | Framework |
|
|
8
|
+
|---------|------|------|-----------|
|
|
9
|
+
| Express API | `test-projects/express-api` | Backend | Express.js |
|
|
10
|
+
| NestJS Backend | `test-projects/nestjs-backend` | Backend | NestJS |
|
|
11
|
+
| Python CLI | `test-projects/python-cli` | CLI | Python |
|
|
12
|
+
| React App | `test-projects/react-app` | Frontend | React + Vite |
|
|
13
|
+
|
|
14
|
+
## Test Commands
|
|
15
|
+
|
|
16
|
+
### Init Command Tests
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Test init on all projects
|
|
20
|
+
npm run test:e2e:init
|
|
21
|
+
|
|
22
|
+
# Individual project tests
|
|
23
|
+
node dist/commands/ai-first.js init --root test-projects/express-api
|
|
24
|
+
node dist/commands/ai-first.js init --root test-projects/nestjs-backend
|
|
25
|
+
node dist/commands/ai-first.js init --root test-projects/python-cli
|
|
26
|
+
node dist/commands/ai-first.js init --root test-projects/react-app
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Map Command Tests
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Test map on all projects
|
|
33
|
+
npm run test:e2e:map
|
|
34
|
+
|
|
35
|
+
# Individual project tests
|
|
36
|
+
node dist/commands/ai-first.js map --root test-projects/express-api
|
|
37
|
+
node dist/commands/ai-first.js map --root test-projects/nestjs-backend
|
|
38
|
+
node dist/commands/ai-first.js map --root test-projects/python-cli
|
|
39
|
+
node dist/commands/ai-first.js map --root test-projects/react-app
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Expected Results
|
|
43
|
+
|
|
44
|
+
### init command should generate:
|
|
45
|
+
|
|
46
|
+
- [x] `ai/repo_map.md`
|
|
47
|
+
- [x] `ai/repo_map.json`
|
|
48
|
+
- [x] `ai/summary.md`
|
|
49
|
+
- [x] `ai/architecture.md`
|
|
50
|
+
- [x] `ai/tech_stack.md`
|
|
51
|
+
- [x] `ai/entrypoints.md`
|
|
52
|
+
- [x] `ai/conventions.md`
|
|
53
|
+
- [x] `ai/symbols.json`
|
|
54
|
+
- [x] `ai/dependencies.json`
|
|
55
|
+
- [x] `ai/ai_rules.md`
|
|
56
|
+
- [x] `ai/ai_context.md`
|
|
57
|
+
- [ ] `ai/context/features/*.json` ← NOT WORKING
|
|
58
|
+
- [ ] `ai/context/flows/*.json` ← NOT WORKING (except NestJS with map)
|
|
59
|
+
|
|
60
|
+
### map command should generate:
|
|
61
|
+
|
|
62
|
+
- [x] `ai/graph/module-graph.json`
|
|
63
|
+
- [x] `ai/graph/symbol-graph.json`
|
|
64
|
+
- [x] `ai/files.json`
|
|
65
|
+
- [ ] `ai/context/features/*.json` ← NOT WORKING for JS/Python/React
|
|
66
|
+
- [x] `ai/context/flows/*.json` ← Only works for NestJS
|
|
67
|
+
|
|
68
|
+
## Running Tests
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Build first
|
|
72
|
+
npm run build
|
|
73
|
+
|
|
74
|
+
# Run init tests
|
|
75
|
+
for project in express-api nestjs-backend python-cli react-app; do
|
|
76
|
+
rm -rf test-projects/$project/ai
|
|
77
|
+
node dist/commands/ai-first.js init --root test-projects/$project
|
|
78
|
+
done
|
|
79
|
+
|
|
80
|
+
# Run map tests
|
|
81
|
+
for project in express-api nestjs-backend python-cli react-app; do
|
|
82
|
+
rm -rf test-projects/$project/ai
|
|
83
|
+
node dist/commands/ai-first.js map --root test-projects/$project
|
|
84
|
+
done
|
|
85
|
+
```
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# E2E Test Runner for ai-first-cli
|
|
4
|
+
# Runs all commands on all test projects
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
CLI="node dist/commands/ai-first.js"
|
|
9
|
+
PROJECTS=("express-api" "nestjs-backend" "python-cli" "react-app")
|
|
10
|
+
|
|
11
|
+
echo "========================================"
|
|
12
|
+
echo "ai-first-cli E2E Test Suite"
|
|
13
|
+
echo "========================================"
|
|
14
|
+
|
|
15
|
+
# Build first
|
|
16
|
+
echo "Building..."
|
|
17
|
+
npm run build
|
|
18
|
+
|
|
19
|
+
# Test each command on each project
|
|
20
|
+
for project in "${PROJECTS[@]}"; do
|
|
21
|
+
echo ""
|
|
22
|
+
echo "========================================"
|
|
23
|
+
echo "Testing: $project"
|
|
24
|
+
echo "========================================"
|
|
25
|
+
|
|
26
|
+
# Clean ai directory
|
|
27
|
+
rm -rf "test-projects/$project/ai"
|
|
28
|
+
|
|
29
|
+
# Test init
|
|
30
|
+
echo ""
|
|
31
|
+
echo "--- init ---"
|
|
32
|
+
$CLI init --root "test-projects/$project" || true
|
|
33
|
+
|
|
34
|
+
# Test doctor
|
|
35
|
+
echo ""
|
|
36
|
+
echo "--- doctor ---"
|
|
37
|
+
$CLI doctor --root "test-projects/$project" || true
|
|
38
|
+
|
|
39
|
+
# Test map
|
|
40
|
+
echo ""
|
|
41
|
+
echo "--- map ---"
|
|
42
|
+
$CLI map --root "test-projects/$project" || true
|
|
43
|
+
|
|
44
|
+
# Test index
|
|
45
|
+
echo ""
|
|
46
|
+
echo "--- index ---"
|
|
47
|
+
$CLI index --root "test-projects/$project" || true
|
|
48
|
+
|
|
49
|
+
# Test explore
|
|
50
|
+
echo ""
|
|
51
|
+
echo "--- explore ---"
|
|
52
|
+
$CLI explore all --root "test-projects/$project" || true
|
|
53
|
+
|
|
54
|
+
# Test graph
|
|
55
|
+
echo ""
|
|
56
|
+
echo "--- graph ---"
|
|
57
|
+
$CLI graph --root "test-projects/$project" || true
|
|
58
|
+
|
|
59
|
+
# Test git
|
|
60
|
+
echo ""
|
|
61
|
+
echo "--- git ---"
|
|
62
|
+
$CLI git --root "test-projects/$project" || true
|
|
63
|
+
|
|
64
|
+
# Check results
|
|
65
|
+
echo ""
|
|
66
|
+
echo "--- Results ---"
|
|
67
|
+
if [ -d "test-projects/$project/ai" ]; then
|
|
68
|
+
echo "Files generated:"
|
|
69
|
+
ls "test-projects/$project/ai/"
|
|
70
|
+
|
|
71
|
+
if [ -d "test-projects/$project/ai/context/features" ]; then
|
|
72
|
+
FEATURES=$(ls -1 "test-projects/$project/ai/context/features/" 2>/dev/null | wc -l)
|
|
73
|
+
echo "Features: $FEATURES"
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
if [ -d "test-projects/$project/ai/context/flows" ]; then
|
|
77
|
+
FLOWS=$(ls -1 "test-projects/$project/ai/context/flows/" 2>/dev/null | wc -l)
|
|
78
|
+
echo "Flows: $FLOWS"
|
|
79
|
+
fi
|
|
80
|
+
else
|
|
81
|
+
echo "ERROR: No ai directory created"
|
|
82
|
+
fi
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
echo ""
|
|
86
|
+
echo "========================================"
|
|
87
|
+
echo "E2E Tests Complete"
|
|
88
|
+
echo "========================================"
|
|
@@ -19,11 +19,16 @@ function createTempTestDir(files: Record<string, string[]>): string {
|
|
|
19
19
|
fs.mkdirSync(path.join(aiDir, "context", "flows"), { recursive: true });
|
|
20
20
|
fs.mkdirSync(path.join(aiDir, "graph"), { recursive: true });
|
|
21
21
|
|
|
22
|
-
// Create modules.json
|
|
22
|
+
// Create modules.json - use key as module name, derive path from files
|
|
23
23
|
const modules: Record<string, { path: string; files: string[] }> = {};
|
|
24
24
|
for (const [moduleName, moduleFiles] of Object.entries(files)) {
|
|
25
|
+
// Derive path from the first file's directory
|
|
26
|
+
const firstFile = moduleFiles[0] || "";
|
|
27
|
+
const pathParts = firstFile.split("/");
|
|
28
|
+
const derivedPath = pathParts.length > 1 ? pathParts.slice(0, -1).join("/") : moduleName;
|
|
29
|
+
|
|
25
30
|
modules[moduleName] = {
|
|
26
|
-
path: moduleName,
|
|
31
|
+
path: derivedPath || moduleName,
|
|
27
32
|
files: moduleFiles
|
|
28
33
|
};
|
|
29
34
|
}
|
|
@@ -39,25 +44,20 @@ describe("Feature Detection", () => {
|
|
|
39
44
|
describe("generateFeatures", () => {
|
|
40
45
|
it("should detect valid business features", () => {
|
|
41
46
|
const aiDir = createTempTestDir({
|
|
42
|
-
"
|
|
47
|
+
"auth": [
|
|
43
48
|
"src/auth/authController.ts",
|
|
44
49
|
"src/auth/authService.ts",
|
|
45
|
-
"src/auth/authRepository.ts"
|
|
46
|
-
"src/auth/types.ts"
|
|
50
|
+
"src/auth/authRepository.ts"
|
|
47
51
|
],
|
|
48
|
-
"
|
|
52
|
+
"users": [
|
|
49
53
|
"src/users/userController.ts",
|
|
50
54
|
"src/users/userService.ts",
|
|
51
55
|
"src/users/userRepository.ts"
|
|
52
56
|
],
|
|
53
|
-
"
|
|
57
|
+
"payments": [
|
|
54
58
|
"src/payments/paymentController.ts",
|
|
55
59
|
"src/payments/paymentService.ts",
|
|
56
60
|
"src/payments/paymentRepository.ts"
|
|
57
|
-
],
|
|
58
|
-
"utils": [
|
|
59
|
-
"utils/helper.ts",
|
|
60
|
-
"utils/logger.ts"
|
|
61
61
|
]
|
|
62
62
|
});
|
|
63
63
|
|
|
@@ -97,24 +97,22 @@ describe("Feature Detection", () => {
|
|
|
97
97
|
expect(featureNames).not.toContain("types");
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
it("should require at least
|
|
100
|
+
it("should require at least 2 source files", () => {
|
|
101
101
|
const aiDir = createTempTestDir({
|
|
102
102
|
"src/small": [
|
|
103
|
-
"src/small/file1.ts"
|
|
104
|
-
"src/small/file2.ts"
|
|
103
|
+
"src/small/file1.ts"
|
|
105
104
|
],
|
|
106
105
|
"src/auth": [
|
|
107
106
|
"src/auth/controller.ts",
|
|
108
|
-
"src/auth/service.ts"
|
|
109
|
-
"src/auth/repository.ts"
|
|
107
|
+
"src/auth/service.ts"
|
|
110
108
|
]
|
|
111
109
|
});
|
|
112
110
|
|
|
113
111
|
const features = generateFeatures(path.join(aiDir, "modules.json"), "");
|
|
114
112
|
|
|
115
|
-
// Small feature should be filtered out
|
|
113
|
+
// Small feature should be filtered out (only 1 file)
|
|
116
114
|
expect(features.find(f => f.name === "small")).toBeUndefined();
|
|
117
|
-
// Auth should exist
|
|
115
|
+
// Auth should exist (2 files = minimum)
|
|
118
116
|
expect(features.find(f => f.name === "auth")).toBeDefined();
|
|
119
117
|
});
|
|
120
118
|
|
|
@@ -159,7 +157,7 @@ describe("Feature Detection", () => {
|
|
|
159
157
|
|
|
160
158
|
it("should include entrypoints in feature output", () => {
|
|
161
159
|
const aiDir = createTempTestDir({
|
|
162
|
-
"
|
|
160
|
+
"auth": [
|
|
163
161
|
"src/auth/authController.ts",
|
|
164
162
|
"src/auth/authService.ts",
|
|
165
163
|
"src/auth/authRepository.ts"
|
|
@@ -176,7 +174,7 @@ describe("Feature Detection", () => {
|
|
|
176
174
|
|
|
177
175
|
it("should include path in feature output", () => {
|
|
178
176
|
const aiDir = createTempTestDir({
|
|
179
|
-
"
|
|
177
|
+
"auth": [
|
|
180
178
|
"src/auth/authController.ts",
|
|
181
179
|
"src/auth/authService.ts",
|
|
182
180
|
"src/auth/authRepository.ts"
|
|
@@ -235,9 +233,9 @@ describe("Feature Detection", () => {
|
|
|
235
233
|
path.join(aiDir, "modules.json")
|
|
236
234
|
);
|
|
237
235
|
|
|
238
|
-
// Flows should be filtered out if less than
|
|
236
|
+
// Flows should be filtered out if less than 2 files
|
|
239
237
|
for (const flow of flows) {
|
|
240
|
-
expect(flow.files.length).toBeGreaterThanOrEqual(
|
|
238
|
+
expect(flow.files.length).toBeGreaterThanOrEqual(2);
|
|
241
239
|
}
|
|
242
240
|
});
|
|
243
241
|
|
|
@@ -255,9 +253,9 @@ describe("Feature Detection", () => {
|
|
|
255
253
|
path.join(aiDir, "modules.json")
|
|
256
254
|
);
|
|
257
255
|
|
|
258
|
-
// Flows should have at least
|
|
256
|
+
// Flows should have at least 1 layer
|
|
259
257
|
for (const flow of flows) {
|
|
260
|
-
expect(flow.layers.length).toBeGreaterThanOrEqual(
|
|
258
|
+
expect(flow.layers.length).toBeGreaterThanOrEqual(1);
|
|
261
259
|
}
|
|
262
260
|
});
|
|
263
261
|
|
|
@@ -408,7 +406,7 @@ describe("Feature Detection", () => {
|
|
|
408
406
|
path.join(aiDir, "modules.json"),
|
|
409
407
|
JSON.stringify({
|
|
410
408
|
modules: {
|
|
411
|
-
"
|
|
409
|
+
"auth": {
|
|
412
410
|
path: "src/auth",
|
|
413
411
|
files: [
|
|
414
412
|
"src/auth/authController.ts",
|