@skyramp/mcp 0.0.60-rc.4 → 0.0.61
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/build/index.js +16 -40
- package/build/prompts/test-recommendation/repository-analysis-prompt.js +326 -0
- package/build/prompts/test-recommendation/test-mapping-prompt.js +266 -0
- package/build/prompts/test-recommendation/test-recommendation-prompt.js +104 -166
- package/build/prompts/testGenerationPrompt.js +3 -2
- package/build/prompts/testbot/testbot-prompts.js +93 -102
- package/build/services/ScenarioGenerationService.js +26 -70
- package/build/services/TestExecutionService.js +1 -1
- package/build/services/TestHealthService.js +6 -3
- package/build/services/TestHealthService.test.js +30 -0
- package/build/tools/generate-tests/generateIntegrationRestTool.js +1 -54
- package/build/tools/generate-tests/generateScenarioRestTool.js +5 -8
- package/build/tools/submitReportTool.js +0 -28
- package/build/tools/test-maintenance/stateCleanupTool.js +0 -8
- package/build/tools/test-recommendation/analyzeRepositoryTool.js +217 -349
- package/build/tools/test-recommendation/mapTestsTool.js +243 -0
- package/build/tools/test-recommendation/recommendTestsTool.js +159 -163
- package/build/tools/workspace/initializeWorkspaceTool.js +1 -1
- package/build/types/RepositoryAnalysis.js +12 -99
- package/build/types/TestMapping.js +173 -0
- package/build/utils/AnalysisStateManager.js +23 -40
- package/build/utils/scoring-engine.js +380 -0
- package/package.json +2 -2
- package/build/prompts/test-recommendation/analysisOutputPrompt.js +0 -98
- package/build/prompts/test-recommendation/recommendationSections.js +0 -226
- package/build/prompts/test-recommendation/registerRecommendTestsPrompt.js +0 -71
- package/build/resources/analysisResources.js +0 -254
- package/build/utils/branchDiff.js +0 -47
- package/build/utils/pr-comment-parser.js +0 -124
- package/build/utils/projectMetadata.js +0 -188
- package/build/utils/projectMetadata.test.js +0 -81
- package/build/utils/repoScanner.js +0 -378
- package/build/utils/routeParsers.js +0 -213
- package/build/utils/routeParsers.test.js +0 -87
- package/build/utils/scenarioDrafting.js +0 -119
- package/build/utils/scenarioDrafting.test.js +0 -66
- package/build/utils/trace-parser.js +0 -166
- package/build/utils/workspaceAuth.js +0 -16
package/build/index.js
CHANGED
|
@@ -19,8 +19,8 @@ import { registerLoginTool } from "./tools/auth/loginTool.js";
|
|
|
19
19
|
import { registerLogoutTool } from "./tools/auth/logoutTool.js";
|
|
20
20
|
import { registerFixErrorTool } from "./tools/fixErrorTool.js";
|
|
21
21
|
import { registerAnalyzeRepositoryTool } from "./tools/test-recommendation/analyzeRepositoryTool.js";
|
|
22
|
+
import { registerMapTestsTool } from "./tools/test-recommendation/mapTestsTool.js";
|
|
22
23
|
import { registerRecommendTestsTool } from "./tools/test-recommendation/recommendTestsTool.js";
|
|
23
|
-
import { registerRecommendTestsPrompt } from "./prompts/test-recommendation/registerRecommendTestsPrompt.js";
|
|
24
24
|
import { registerModularizationTool } from "./tools/code-refactor/modularizationTool.js";
|
|
25
25
|
import { registerCodeReuseTool } from "./tools/code-refactor/codeReuseTool.js";
|
|
26
26
|
import { registerScenarioTestTool } from "./tools/generate-tests/generateScenarioRestTool.js";
|
|
@@ -34,7 +34,6 @@ import { registerTestbotPrompt, registerTestbotResource, } from "./prompts/testb
|
|
|
34
34
|
import { registerInitTestbotTool } from "./tools/initTestbotTool.js";
|
|
35
35
|
import { registerSubmitReportTool } from "./tools/submitReportTool.js";
|
|
36
36
|
import { registerInitializeWorkspaceTool } from "./tools/workspace/initializeWorkspaceTool.js";
|
|
37
|
-
import { registerAnalysisResources } from "./resources/analysisResources.js";
|
|
38
37
|
import { AnalyticsService } from "./services/AnalyticsService.js";
|
|
39
38
|
import { initCheck } from "./utils/initAgent.js";
|
|
40
39
|
const server = new McpServer({
|
|
@@ -48,43 +47,27 @@ const server = new McpServer({
|
|
|
48
47
|
prompts: {
|
|
49
48
|
listChanged: true,
|
|
50
49
|
},
|
|
51
|
-
resources: {
|
|
52
|
-
listChanged: true,
|
|
53
|
-
},
|
|
54
50
|
},
|
|
55
|
-
instructions: `Skyramp MCP Server — generates and executes API tests (fuzz, contract, integration, E2E, UI).
|
|
51
|
+
instructions: `Skyramp MCP Server — generates and executes API tests (smoke, fuzz, contract, load, integration, E2E, UI).
|
|
56
52
|
|
|
57
53
|
## Rules
|
|
58
54
|
- NEVER show CLI commands. ALWAYS use the MCP tools provided.
|
|
59
55
|
- For UI and E2E tests, use the trace collection start/stop tools.
|
|
60
56
|
|
|
61
|
-
## Test Recommendation Flow (2-step)
|
|
62
|
-
1. Call \`skyramp_analyze_repository\` → returns a \`sessionId\`.
|
|
63
|
-
The analysis scans source code (code-first) to build enriched endpoints
|
|
64
|
-
(Path → Method → Interaction with request/response bodies, headers, cookies)
|
|
65
|
-
and draft user-flow scenarios for integration/E2E tests.
|
|
66
|
-
2. Call \`skyramp_recommend_tests\` with \`sessionId\` → the LLM reasons over the
|
|
67
|
-
enriched data to recommend tests, referencing specific interactions and scenarios.
|
|
68
|
-
|
|
69
|
-
After analysis, you can also inspect data via MCP Resources:
|
|
70
|
-
- \`skyramp://analysis/{sessionId}/summary\` — high-level overview
|
|
71
|
-
- \`skyramp://analysis/{sessionId}/endpoints\` — compact endpoint listing
|
|
72
|
-
- \`skyramp://analysis/{sessionId}/endpoints/{path}\` — full path detail
|
|
73
|
-
- \`skyramp://analysis/{sessionId}/endpoints/{path}/{method}\` — single method detail
|
|
74
|
-
- \`skyramp://analysis/{sessionId}/scenarios\` — drafted scenarios
|
|
75
|
-
- \`skyramp://analysis/{sessionId}/diff\` — branch diff context
|
|
76
|
-
|
|
77
57
|
## Workspace Initialization (before ANY other Skyramp tool)
|
|
78
58
|
Follow this flow EVERY time before calling any Skyramp tool:
|
|
79
59
|
|
|
80
|
-
1. **Check**:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
60
|
+
1. **Check**: Is the workspace root a git repository? (i.e. does a \`.git\` directory exist at the root?)
|
|
61
|
+
- **If NO** → it is a non-git repo. Do NOT call \`skyramp_initialize_workspace\`. Proceed directly with the requested tool. STOP — do not continue to step 2.
|
|
62
|
+
- **If YES** → it is a git repo. Continue to step 2.
|
|
63
|
+
2. **Check**: Does .skyramp/workspace.yml exist at the workspace root?
|
|
64
|
+
- **If YES** → workspace is already initialized. Proceed with the requested tool. STOP here.
|
|
65
|
+
- **If NO** → you MUST call \`skyramp_initialize_workspace\` BEFORE doing anything else.
|
|
66
|
+
- Do NOT skip this step. Do NOT proceed to the requested tool first.
|
|
67
|
+
- Scan the repo for ALL services (see the tool description for detailed steps).
|
|
68
|
+
- A fullstack or monorepo MUST produce multiple services — never just one.
|
|
69
|
+
- After workspace init completes, THEN proceed with the originally requested tool.
|
|
70
|
+
3. **ONLY skip init in these two cases: non-git repo (step 1) or explicit user decline** (i.e. user EXPLICITLY says "no", "skip", "don't create workspace", or similar).
|
|
88
71
|
- A request like "execute tests" or "generate tests" is NOT a signal to skip init.
|
|
89
72
|
- If the user does decline, respect it — do NOT ask again, and proceed with the requested tool.
|
|
90
73
|
|
|
@@ -95,13 +78,8 @@ Before calling ANY test generation tool, you MUST follow this flow:
|
|
|
95
78
|
2. **Extract** the \`language\`, \`framework\`, \`outputDir\`, and \`api.baseUrl\` from the services section.
|
|
96
79
|
3. **Use those values** as defaults for the test generation tool call. Do NOT ask the user for these values if they are already configured in the workspace file.
|
|
97
80
|
4. **CRITICAL — endpointURL**: The \`endpointURL\` parameter MUST be the full URL to the specific endpoint being tested, NOT just the base URL. Construct it by combining \`api.baseUrl\` with the endpoint path. Example: if \`api.baseUrl\` is \`http://localhost:8000\` and the endpoint is \`/api/v1/products\`, pass \`endpointURL: "http://localhost:8000/api/v1/products"\`. NEVER pass just the base URL (e.g. \`http://localhost:8000\`) as \`endpointURL\`.
|
|
98
|
-
5. **
|
|
99
|
-
|
|
100
|
-
- \`authHeader\`: The auth header name from \`api.authHeader\` in the workspace config. Use \`Cookie\` for cookie/session-based auth (NextAuth, etc.), \`Authorization\` for Bearer tokens, \`X-API-Key\` for API keys. Without it, the trace defaults to \`Authorization: Bearer\` which breaks cookie-based apps.
|
|
101
|
-
- \`apiSchema\` is OPTIONAL — omit it for code-first apps without OpenAPI specs.
|
|
102
|
-
6. **CRITICAL — integration test from scenario**: When calling \`skyramp_integration_test_generation\` with a \`scenarioFile\`, ALSO pass \`authHeader\` (same value as used in scenario generation). This tells the CLI which header to parameterize with the auth token. Without it, the generated test defaults to \`Authorization: Bearer\` regardless of what's in the trace.
|
|
103
|
-
7. **If the workspace file does not exist**, or the needed values (language, framework, outputDir) are missing from the workspace config, ASK the user which language and framework they want before calling the tool.
|
|
104
|
-
8. The user can always override workspace defaults by explicitly specifying values in their request.
|
|
81
|
+
5. **If the workspace file does not exist**, or the needed values (language, framework, outputDir) are missing from the workspace config, ASK the user which language and framework they want before calling the tool.
|
|
82
|
+
6. The user can always override workspace defaults by explicitly specifying values in their request.
|
|
105
83
|
`,
|
|
106
84
|
});
|
|
107
85
|
// Check for first-time invocation after version update (runs in background, doesn't block)
|
|
@@ -141,7 +119,6 @@ const prompts = [
|
|
|
141
119
|
registerTestGenerationPrompt,
|
|
142
120
|
registerStartTraceCollectionPrompt,
|
|
143
121
|
registerTestHealthPrompt,
|
|
144
|
-
registerRecommendTestsPrompt,
|
|
145
122
|
];
|
|
146
123
|
if (process.env.SKYRAMP_FEATURE_TESTBOT === "1") {
|
|
147
124
|
prompts.push(registerTestbotPrompt);
|
|
@@ -171,9 +148,8 @@ const codeQualityTools = [
|
|
|
171
148
|
codeQualityTools.forEach((registerTool) => registerTool(server));
|
|
172
149
|
// Register test recommendation tools
|
|
173
150
|
registerAnalyzeRepositoryTool(server);
|
|
151
|
+
registerMapTestsTool(server);
|
|
174
152
|
registerRecommendTestsTool(server);
|
|
175
|
-
// Register analysis resources (MCP Resources for enriched data access)
|
|
176
|
-
registerAnalysisResources(server);
|
|
177
153
|
// Register test maintenance tools
|
|
178
154
|
registerDiscoverTestsTool(server);
|
|
179
155
|
registerAnalyzeTestDriftTool(server);
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repository Analysis Prompt
|
|
3
|
+
* Comprehensive prompt for analyzing code repositories
|
|
4
|
+
*/
|
|
5
|
+
export function getRepositoryAnalysisPrompt(repositoryPath, analysisScope = "full_repo", parsedDiff) {
|
|
6
|
+
const isDiffScope = analysisScope === "current_branch_diff";
|
|
7
|
+
return `
|
|
8
|
+
Analyze this repository systematically using the guide below.
|
|
9
|
+
|
|
10
|
+
REPOSITORY PATH: ${repositoryPath}
|
|
11
|
+
ANALYSIS SCOPE: ${analysisScope}${isDiffScope ? " (focus on branch changes only)" : " (full repository)"}
|
|
12
|
+
|
|
13
|
+
IMPORTANT OUTPUT FORMAT:
|
|
14
|
+
- Return analysis as valid JSON matching the RepositoryAnalysis interface
|
|
15
|
+
- Use empty arrays [] for unavailable data rather than omitting fields
|
|
16
|
+
- Use "unknown" for unknown string values
|
|
17
|
+
- Provide evidence (file paths, line numbers) where possible
|
|
18
|
+
${isDiffScope ? '- MUST include the "branchDiffContext" field in the output JSON' : ""}
|
|
19
|
+
|
|
20
|
+
## CRITICAL RULES
|
|
21
|
+
- If user flows are defined in documentation explicitly, follow them strictly and do not generate new ones.
|
|
22
|
+
${isDiffScope ? `- Do NOT run git commands — the diff has already been parsed by the tool
|
|
23
|
+
- Still gather full repo context (tech stack, infra, auth, existing tests) for accurate scoring
|
|
24
|
+
- For branchDiffContext, use the following pre-parsed metadata:
|
|
25
|
+
- currentBranch: "${parsedDiff?.currentBranch || "unknown"}"
|
|
26
|
+
- baseBranch: "${parsedDiff?.baseBranch || "main"}"
|
|
27
|
+
- changedFiles: [${parsedDiff?.changedFiles.map((f) => `"${f}"`).join(", ") || ""}]
|
|
28
|
+
- For newEndpoints and modifiedEndpoints: use the pre-parsed endpoint information provided by the tool as the primary source of truth.
|
|
29
|
+
- You may refine this list using only the metadata and code/context that is explicitly included in this prompt.
|
|
30
|
+
- Do NOT attempt to scan or open additional repository files beyond what has been provided here.
|
|
31
|
+
- It is acceptable if some indirect or transitive impacts are not fully captured; do not speculate beyond the available information.
|
|
32
|
+
- When you adjust endpoints, clearly explain your reasoning based on the pre-parsed data and any in-prompt context.
|
|
33
|
+
- affectedServices: treat the changed file paths as high-level hints about which services are likely impacted, but do not perform exhaustive dependency tracing beyond the information provided` : ""}
|
|
34
|
+
|
|
35
|
+
# Repository Analysis Guide
|
|
36
|
+
|
|
37
|
+
## 1. Initial Repository Analysis
|
|
38
|
+
|
|
39
|
+
### Documentation
|
|
40
|
+
Review documentation files for any project-specific details and instructions
|
|
41
|
+
|
|
42
|
+
### Project Type
|
|
43
|
+
Identify what kind of application this is:
|
|
44
|
+
- REST API service
|
|
45
|
+
- Frontend application (React/Vue/Angular)
|
|
46
|
+
- Full-stack application
|
|
47
|
+
- Library/SDK
|
|
48
|
+
- CLI tool
|
|
49
|
+
- Microservices
|
|
50
|
+
- Other (describe)
|
|
51
|
+
|
|
52
|
+
### Primary Technology Stack
|
|
53
|
+
- **Language**: Identify the primary programming language(s)
|
|
54
|
+
- **Framework**: Identify the main framework(s) used
|
|
55
|
+
- **Key Dependencies**: List critical dependencies from package files
|
|
56
|
+
|
|
57
|
+
### Main Purpose
|
|
58
|
+
Describe what this application does in 1-2 sentences.
|
|
59
|
+
|
|
60
|
+
### Business Logic
|
|
61
|
+
- **Common User Flows**: How do users typically interact with this system?
|
|
62
|
+
- Infer from documentation, endpoint analysis, and code structure
|
|
63
|
+
- **Common Data Flows**: How does data move through the system?
|
|
64
|
+
- **Common Integration Patterns**: How does this system integrate with other services?
|
|
65
|
+
|
|
66
|
+
## 2. Artifact Discovery
|
|
67
|
+
|
|
68
|
+
### OpenAPI/Swagger Specifications
|
|
69
|
+
**Search Patterns:**
|
|
70
|
+
- \`**/*{openapi,swagger}*.{yaml,yml,json}\`
|
|
71
|
+
- \`**/api-spec.{yaml,yml,json}\`
|
|
72
|
+
- \`**/docs/**/*.{yaml,yml,json}\`
|
|
73
|
+
|
|
74
|
+
**Extract:**
|
|
75
|
+
- OpenAPI/Swagger version
|
|
76
|
+
- Total endpoint count
|
|
77
|
+
- Base URL(s)
|
|
78
|
+
- Authentication schemes
|
|
79
|
+
- Paths and operations
|
|
80
|
+
|
|
81
|
+
### Playwright Recordings
|
|
82
|
+
**Search Patterns:**
|
|
83
|
+
- \`**/*.zip\` in \`/recordings/\`, \`/tests/\`, \`/e2e/\` directories
|
|
84
|
+
|
|
85
|
+
### API Trace Files
|
|
86
|
+
**Search Patterns:**
|
|
87
|
+
- \`**/*trace*.json\` - JSON trace files
|
|
88
|
+
- \`**/*.har\` - HAR (HTTP Archive) files
|
|
89
|
+
- \`**/traces/**/*.json\` - Trace directories
|
|
90
|
+
|
|
91
|
+
## 3. API Endpoint Discovery
|
|
92
|
+
|
|
93
|
+
### If OpenAPI Spec Available
|
|
94
|
+
- Parse all paths and operations
|
|
95
|
+
- Extract: path, HTTP methods, authentication requirements, path parameters
|
|
96
|
+
- Count total endpoints
|
|
97
|
+
- Identify base URL from servers section
|
|
98
|
+
- Detect authentication type (bearer, api_key, oauth2, basic)
|
|
99
|
+
|
|
100
|
+
### If No OpenAPI Spec
|
|
101
|
+
Scan code for route definitions based on framework:
|
|
102
|
+
|
|
103
|
+
**Express (Node.js):**
|
|
104
|
+
- Patterns: \`app.get(\`, \`app.post(\`, \`router.get(\`, \`router.post(\`
|
|
105
|
+
|
|
106
|
+
**FastAPI (Python):**
|
|
107
|
+
- Patterns: \`@app.get(\`, \`@router.post(\`, \`@app.put(\`
|
|
108
|
+
|
|
109
|
+
**Spring (Java):**
|
|
110
|
+
- Patterns: \`@GetMapping\`, \`@PostMapping\`, \`@RestController\`, \`@RequestMapping\`
|
|
111
|
+
|
|
112
|
+
**Django (Python):**
|
|
113
|
+
- Patterns: \`path(\`, \`url(\` in \`urls.py\` files
|
|
114
|
+
|
|
115
|
+
**Flask (Python):**
|
|
116
|
+
- Patterns: \`@app.route(\`, \`@blueprint.route(\`
|
|
117
|
+
|
|
118
|
+
## 4. Authentication Analysis
|
|
119
|
+
|
|
120
|
+
Investigate how the application handles authentication and authorization.
|
|
121
|
+
|
|
122
|
+
### Look For:
|
|
123
|
+
- Environment variables: \`API_KEY\`, \`TOKEN\`, \`SECRET\`, \`AUTH_\`, \`JWT_\`
|
|
124
|
+
- Authentication middleware or decorators
|
|
125
|
+
- JWT handling libraries
|
|
126
|
+
- OAuth configuration files
|
|
127
|
+
- API key validation logic
|
|
128
|
+
- Session management
|
|
129
|
+
|
|
130
|
+
### Identify:
|
|
131
|
+
1. **Authentication Method**: Bearer token, API key, OAuth 2.0, Basic Auth, JWT, etc.
|
|
132
|
+
2. **Configuration Location**: Where auth is configured (env files, config files, middleware)
|
|
133
|
+
3. **Credential Setup**: How to set authentication credentials
|
|
134
|
+
|
|
135
|
+
## 5. Infrastructure Analysis
|
|
136
|
+
|
|
137
|
+
Analyze deployment and infrastructure configuration.
|
|
138
|
+
|
|
139
|
+
### Containerization
|
|
140
|
+
**Check for:**
|
|
141
|
+
- \`Dockerfile\`
|
|
142
|
+
- \`docker-compose.yml\`
|
|
143
|
+
- \`.dockerignore\`
|
|
144
|
+
|
|
145
|
+
### Orchestration
|
|
146
|
+
**Kubernetes:**
|
|
147
|
+
- Check for manifests in \`k8s/\`, \`kubernetes/\`, or \`.yaml\` files with \`kind: Deployment\`
|
|
148
|
+
|
|
149
|
+
**Docker Compose:**
|
|
150
|
+
- Check for multi-service setup
|
|
151
|
+
|
|
152
|
+
### CI/CD
|
|
153
|
+
**Identify platforms from config files:**
|
|
154
|
+
- GitHub Actions: \`.github/workflows/\`
|
|
155
|
+
- GitLab CI: \`.gitlab-ci.yml\`
|
|
156
|
+
- Jenkins: \`Jenkinsfile\`
|
|
157
|
+
- CircleCI: \`.circleci/config.yml\`
|
|
158
|
+
- Travis CI: \`.travis.yml\`
|
|
159
|
+
|
|
160
|
+
### Deployment Pattern Inference
|
|
161
|
+
- **Microservices**: Kubernetes AND multiple services detected
|
|
162
|
+
- **Full-stack**: Docker Compose AND both API and Frontend components detected
|
|
163
|
+
- **Containerized Monolith**: Single Dockerfile only (no compose, no K8s)
|
|
164
|
+
- **Traditional**: No container configurations found
|
|
165
|
+
|
|
166
|
+
## 6. Existing Test Analysis
|
|
167
|
+
|
|
168
|
+
Analyze the testing infrastructure and coverage.
|
|
169
|
+
|
|
170
|
+
### Test Directory Detection
|
|
171
|
+
**Search Patterns:**
|
|
172
|
+
- \`**/test/**\`
|
|
173
|
+
- \`**/tests/**\`
|
|
174
|
+
- \`**/__tests__/**\`
|
|
175
|
+
- \`**/spec/**\`
|
|
176
|
+
|
|
177
|
+
**Count test files:**
|
|
178
|
+
- \`**/*{.test,.spec}.{ts,js,tsx,jsx,py,java,go}\`
|
|
179
|
+
|
|
180
|
+
### Test Framework Detection
|
|
181
|
+
**Configuration Files:**
|
|
182
|
+
- \`pytest.ini\`, \`setup.cfg\` (pytest)
|
|
183
|
+
- \`jest.config.js\`, \`jest.config.ts\` (Jest)
|
|
184
|
+
- \`karma.conf.js\` (Karma)
|
|
185
|
+
- \`playwright.config.ts\` (Playwright)
|
|
186
|
+
- \`cypress.config.js\` (Cypress)
|
|
187
|
+
|
|
188
|
+
### Test Type Inference
|
|
189
|
+
**File Name Patterns:**
|
|
190
|
+
- **Unit Tests**: \`*unit*.{test,spec}\`, \`*.unit.*\`
|
|
191
|
+
- **Integration Tests**: \`*integration*.{test,spec}\`, \`*.integration.*\`
|
|
192
|
+
- **E2E Tests**: \`*e2e*.{test,spec}\`, \`*end-to-end*\`, \`*.e2e.*\`
|
|
193
|
+
- **Smoke Tests**: \`*smoke*.{test,spec}\`
|
|
194
|
+
- **Load Tests**: \`*load*.{test,spec}\`, \`*performance*\`
|
|
195
|
+
|
|
196
|
+
## OUTPUT STRUCTURE
|
|
197
|
+
|
|
198
|
+
Return a JSON object with this exact structure:
|
|
199
|
+
|
|
200
|
+
\`\`\`json
|
|
201
|
+
{
|
|
202
|
+
"metadata": {
|
|
203
|
+
"repositoryName": "name-from-path",
|
|
204
|
+
"analysisDate": "2025-10-15T14:30:00Z",
|
|
205
|
+
"scanDepth": "full",
|
|
206
|
+
"analysisScope": "${analysisScope}"
|
|
207
|
+
},
|
|
208
|
+
"projectClassification": {
|
|
209
|
+
"projectType": "rest-api | frontend | full-stack | microservices | library | cli | other",
|
|
210
|
+
"primaryLanguage": "language",
|
|
211
|
+
"primaryFramework": "framework",
|
|
212
|
+
"deploymentPattern": "microservices | full-stack | containerized-monolith | traditional | unknown"
|
|
213
|
+
},
|
|
214
|
+
"technologyStack": {
|
|
215
|
+
"languages": ["language1", "language2"],
|
|
216
|
+
"frameworks": ["framework1", "framework2"],
|
|
217
|
+
"runtime": "runtime version",
|
|
218
|
+
"keyDependencies": [
|
|
219
|
+
{ "name": "dep1", "version": "1.0.0", "purpose": "description" }
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"businessContext": {
|
|
223
|
+
"mainPurpose": "1-2 sentence description",
|
|
224
|
+
"userFlows": ["flow1", "flow2"],
|
|
225
|
+
"dataFlows": ["flow1", "flow2"],
|
|
226
|
+
"integrationPatterns": ["pattern1", "pattern2"]
|
|
227
|
+
},
|
|
228
|
+
"artifacts": {
|
|
229
|
+
"openApiSpecs": [
|
|
230
|
+
{
|
|
231
|
+
"path": "./docs/openapi.yaml",
|
|
232
|
+
"version": "3.0.0",
|
|
233
|
+
"endpointCount": 18,
|
|
234
|
+
"baseUrl": "http://localhost:3000/api/v1",
|
|
235
|
+
"authType": "bearer"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"playwrightRecordings": [],
|
|
239
|
+
"traceFiles": [
|
|
240
|
+
{
|
|
241
|
+
"path": "./traces/user-session.json",
|
|
242
|
+
"format": "json"
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
"notFound": ["Playwright recordings"]
|
|
246
|
+
},
|
|
247
|
+
"apiEndpoints": {
|
|
248
|
+
"totalCount": 18,
|
|
249
|
+
"baseUrl": "http://localhost:3000/api",
|
|
250
|
+
"endpoints": [
|
|
251
|
+
{
|
|
252
|
+
"path": "/users",
|
|
253
|
+
"method": "GET",
|
|
254
|
+
"resourceGroup": "Users",
|
|
255
|
+
"authRequired": true,
|
|
256
|
+
"sourceFile": "src/routes/user.js:10"
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
"authentication": {
|
|
261
|
+
"method": "bearer | api-key | oauth2 | basic | jwt | none",
|
|
262
|
+
"configLocation": "path/to/config",
|
|
263
|
+
"envVarsRequired": ["VAR1", "VAR2"],
|
|
264
|
+
"setupExample": "export API_KEY=value"
|
|
265
|
+
},
|
|
266
|
+
"infrastructure": {
|
|
267
|
+
"isContainerized": true,
|
|
268
|
+
"hasDockerCompose": true,
|
|
269
|
+
"hasKubernetes": false,
|
|
270
|
+
"hasCiCd": true,
|
|
271
|
+
"ciCdPlatform": "github-actions"
|
|
272
|
+
},
|
|
273
|
+
"existingTests": {
|
|
274
|
+
"frameworks": ["jest", "supertest"],
|
|
275
|
+
"coverage": {
|
|
276
|
+
"unit": 45,
|
|
277
|
+
"integration": 0,
|
|
278
|
+
"e2e": 0,
|
|
279
|
+
"ui": 0,
|
|
280
|
+
"load": 0,
|
|
281
|
+
"contract": 0,
|
|
282
|
+
"smoke": 0
|
|
283
|
+
},
|
|
284
|
+
"testLocations": {
|
|
285
|
+
"unit": "src/tests/unit/"
|
|
286
|
+
},
|
|
287
|
+
"hasCoverageReports": true,
|
|
288
|
+
"estimatedCoverage": 78
|
|
289
|
+
}${isDiffScope ? `,
|
|
290
|
+
"branchDiffContext": {
|
|
291
|
+
"currentBranch": "feature/my-feature",
|
|
292
|
+
"baseBranch": "main",
|
|
293
|
+
"changedFiles": ["src/routes/products.ts", "src/models/Product.ts"],
|
|
294
|
+
"newEndpoints": [
|
|
295
|
+
{ "path": "/api/v1/products/search", "method": "GET", "sourceFile": "src/routes/products.ts:45" }
|
|
296
|
+
],
|
|
297
|
+
"modifiedEndpoints": [
|
|
298
|
+
{ "path": "/api/v1/products", "method": "POST", "sourceFile": "src/routes/products.ts:12" }
|
|
299
|
+
],
|
|
300
|
+
"affectedServices": ["product-service"],
|
|
301
|
+
"summary": "Added product search endpoint and modified product creation validation"
|
|
302
|
+
}` : ""}
|
|
303
|
+
}
|
|
304
|
+
\`\`\`
|
|
305
|
+
|
|
306
|
+
VALIDATION CHECKLIST:
|
|
307
|
+
- [ ] Project type identified with evidence
|
|
308
|
+
- [ ] All artifacts searched with file paths
|
|
309
|
+
- [ ] API endpoints counted and categorized
|
|
310
|
+
- [ ] Authentication method determined
|
|
311
|
+
- [ ] Infrastructure flags verified
|
|
312
|
+
- [ ] Existing tests catalogued${isDiffScope ? `
|
|
313
|
+
- [ ] branchDiffContext.changedFiles matches the list provided above
|
|
314
|
+
- [ ] branchDiffContext.modifiedEndpoints includes ALL endpoints whose behaviour changed — including those affected by model/schema/validator changes (trace: changed file → which models/types → which endpoints use them)
|
|
315
|
+
- [ ] branchDiffContext.newEndpoints includes any brand-new routes added in the diff
|
|
316
|
+
- [ ] branchDiffContext.summary describes what changed in plain English` : ""}
|
|
317
|
+
|
|
318
|
+
**CRITICAL INSTRUCTIONS**:
|
|
319
|
+
- Construct the complete RepositoryAnalysis JSON object.
|
|
320
|
+
- DO NOT create any .md or documentation files.
|
|
321
|
+
- Save the analysis JSON to the state file path provided in the tool response.
|
|
322
|
+
- Then call \`skyramp_map_tests\` with the \`stateFile\` parameter (NOT analysisReport) to avoid serialization issues.
|
|
323
|
+
|
|
324
|
+
Begin analysis now.
|
|
325
|
+
`;
|
|
326
|
+
}
|