vibe-fabric 0.3.1 → 0.3.3
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/.claude/prompts/analyze/assess.md +208 -0
- package/.claude/prompts/analyze/synthesize.md +239 -0
- package/.claude/prompts/analyze/task-analyze-repo.md +260 -0
- package/.claude/prompts/gaps/assess.md +203 -0
- package/.claude/prompts/gaps/synthesize.md +180 -0
- package/.claude/prompts/gaps/task-analyze-module.md +198 -0
- package/.claude/prompts/prd/assess.md +156 -0
- package/.claude/prompts/prd/synthesize.md +191 -0
- package/.claude/prompts/prd/task-capture-feature.md +133 -0
- package/.claude/prompts/prd/task-deprecate.md +84 -0
- package/.claude/prompts/prd/task-document-code.md +110 -0
- package/.claude/prompts/prd/task-fix-format.md +102 -0
- package/.claude/prompts/prd/task-update-status.md +89 -0
- package/.claude/prompts/scope/assess.md +201 -0
- package/.claude/prompts/scope/synthesize.md +270 -0
- package/.claude/prompts/scope/task-analyze-prd.md +125 -0
- package/.claude/prompts/scope/task-check-deps.md +188 -0
- package/.claude/prompts/scope/task-create-scope.md +207 -0
- package/.claude/prompts/scope/task-recommend.md +146 -0
- package/.claude/prompts/scope/task-review-scope.md +191 -0
- package/.claude/prompts/scope/task-validate.md +203 -0
- package/dist/core/planning.d.ts.map +1 -1
- package/dist/core/planning.js +10 -4
- package/dist/core/planning.js.map +1 -1
- package/dist/core/project.d.ts.map +1 -1
- package/dist/core/project.js +49 -1
- package/dist/core/project.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Repository Analysis Assessment
|
|
2
|
+
|
|
3
|
+
## Variables
|
|
4
|
+
|
|
5
|
+
| Variable | Description | Required |
|
|
6
|
+
|----------|-------------|----------|
|
|
7
|
+
| {PROJECT_PATH} | Path to the project directory | Yes |
|
|
8
|
+
| {OUTPUT_FILE} | Path to write the assessment output | Yes |
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
|
|
14
|
+
You are helping analyze external repositories to extract structural maps (entities, APIs, services). These maps are used for:
|
|
15
|
+
- Understanding existing codebases
|
|
16
|
+
- Gap analysis against PRD
|
|
17
|
+
- Generating PRD from existing code
|
|
18
|
+
- Planning migrations or integrations
|
|
19
|
+
|
|
20
|
+
Project: {PROJECT_PATH}
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Your Task
|
|
25
|
+
|
|
26
|
+
Analyze configured repositories and prepare analysis tasks.
|
|
27
|
+
|
|
28
|
+
### Step 1: Load Repository Configuration
|
|
29
|
+
|
|
30
|
+
Read the vibe configuration:
|
|
31
|
+
- `.vibe/config.json` - Main config with repo list
|
|
32
|
+
- `docs/sync-cache/*/` - Already synced repos
|
|
33
|
+
|
|
34
|
+
Repository config format:
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"repos": [
|
|
38
|
+
{
|
|
39
|
+
"alias": "backend",
|
|
40
|
+
"url": "github.com/org/backend",
|
|
41
|
+
"branch": "main"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 2: Assess Each Repository
|
|
48
|
+
|
|
49
|
+
For each configured repository, determine:
|
|
50
|
+
- **Already synced:** Maps exist in `docs/sync-cache/{alias}/maps/`
|
|
51
|
+
- **Needs sync:** No maps or outdated
|
|
52
|
+
- **Framework:** Detected from package.json, requirements.txt, etc.
|
|
53
|
+
- **Size estimate:** File count indicator (S/M/L)
|
|
54
|
+
|
|
55
|
+
### Step 3: Present Findings
|
|
56
|
+
|
|
57
|
+
Summarize:
|
|
58
|
+
- Number of configured repositories
|
|
59
|
+
- Repos already analyzed (with dates)
|
|
60
|
+
- Repos needing analysis
|
|
61
|
+
- Detected frameworks
|
|
62
|
+
|
|
63
|
+
### Step 4: Ask User Intent
|
|
64
|
+
|
|
65
|
+
Ask the user: **"What would you like to analyze?"**
|
|
66
|
+
|
|
67
|
+
Options:
|
|
68
|
+
1. **All repositories** - Analyze everything
|
|
69
|
+
2. **Specific repo** - Analyze one repository (e.g., "analyze backend")
|
|
70
|
+
3. **Refresh all** - Re-analyze even if maps exist
|
|
71
|
+
4. **Just checking** - Show summary only
|
|
72
|
+
|
|
73
|
+
### Step 5: Create Task List
|
|
74
|
+
|
|
75
|
+
Based on findings and user intent, create tasks:
|
|
76
|
+
|
|
77
|
+
**Task Types:**
|
|
78
|
+
- `task-analyze-repo` - Analyze a single repository (non-interactive)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Output Format
|
|
83
|
+
|
|
84
|
+
Write to: {OUTPUT_FILE}
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"complexity": "S|M|L",
|
|
89
|
+
"assessment": {
|
|
90
|
+
"config_exists": true,
|
|
91
|
+
"repo_count": 2,
|
|
92
|
+
"repos": [
|
|
93
|
+
{
|
|
94
|
+
"alias": "backend",
|
|
95
|
+
"url": "github.com/org/backend",
|
|
96
|
+
"framework": "nestjs",
|
|
97
|
+
"synced": true,
|
|
98
|
+
"last_sync": "2026-01-20T10:00:00Z",
|
|
99
|
+
"maps_exist": true
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"alias": "frontend",
|
|
103
|
+
"url": "github.com/org/frontend",
|
|
104
|
+
"framework": "nextjs",
|
|
105
|
+
"synced": false,
|
|
106
|
+
"last_sync": null,
|
|
107
|
+
"maps_exist": false
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"user_intent": "analyze frontend"
|
|
111
|
+
},
|
|
112
|
+
"tasks": [
|
|
113
|
+
{
|
|
114
|
+
"id": 1,
|
|
115
|
+
"name": "analyze-frontend",
|
|
116
|
+
"description": "Analyze frontend repository (Next.js)",
|
|
117
|
+
"prompt": "task-analyze-repo",
|
|
118
|
+
"interactive": false,
|
|
119
|
+
"context": {
|
|
120
|
+
"alias": "frontend",
|
|
121
|
+
"url": "github.com/org/frontend",
|
|
122
|
+
"branch": "main",
|
|
123
|
+
"framework": "nextjs"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Rules
|
|
133
|
+
|
|
134
|
+
- Focus ONLY on repository analysis
|
|
135
|
+
- Maximum 5 tasks (one per repo to analyze)
|
|
136
|
+
- Detect framework from manifest files (package.json, etc.)
|
|
137
|
+
- If no repos configured, explain how to add with `vibe repo add`
|
|
138
|
+
- Skip repos that are already synced unless user requests refresh
|
|
139
|
+
- If user says "just checking", output empty tasks array
|
|
140
|
+
- Be concise in your analysis
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Framework Detection
|
|
145
|
+
|
|
146
|
+
Detect framework from files:
|
|
147
|
+
|
|
148
|
+
| File | Framework |
|
|
149
|
+
|------|-----------|
|
|
150
|
+
| `package.json` with `@nestjs/core` | NestJS |
|
|
151
|
+
| `package.json` with `next` | Next.js |
|
|
152
|
+
| `package.json` with `react` (no next) | React |
|
|
153
|
+
| `package.json` with `express` | Express |
|
|
154
|
+
| `requirements.txt` with `fastapi` | FastAPI |
|
|
155
|
+
| `requirements.txt` with `django` | Django |
|
|
156
|
+
| `requirements.txt` with `flask` | Flask |
|
|
157
|
+
| `go.mod` | Go |
|
|
158
|
+
| `Cargo.toml` | Rust |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Examples
|
|
163
|
+
|
|
164
|
+
**User says "just checking":**
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"complexity": "S",
|
|
168
|
+
"assessment": {...},
|
|
169
|
+
"tasks": []
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**User says "analyze all":**
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"complexity": "M",
|
|
177
|
+
"assessment": {...},
|
|
178
|
+
"tasks": [
|
|
179
|
+
{"id": 1, "name": "analyze-backend", "prompt": "task-analyze-repo", ...},
|
|
180
|
+
{"id": 2, "name": "analyze-frontend", "prompt": "task-analyze-repo", ...}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**User says "analyze backend":**
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"complexity": "S",
|
|
189
|
+
"assessment": {...},
|
|
190
|
+
"tasks": [
|
|
191
|
+
{"id": 1, "name": "analyze-backend", "prompt": "task-analyze-repo", ...}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**No repos configured:**
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"complexity": "S",
|
|
200
|
+
"assessment": {
|
|
201
|
+
"config_exists": true,
|
|
202
|
+
"repo_count": 0,
|
|
203
|
+
"repos": [],
|
|
204
|
+
"error": "No repositories configured. Add repos with: vibe repo add <url>"
|
|
205
|
+
},
|
|
206
|
+
"tasks": []
|
|
207
|
+
}
|
|
208
|
+
```
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Synthesize Repository Maps
|
|
2
|
+
|
|
3
|
+
## Variables
|
|
4
|
+
|
|
5
|
+
| Variable | Description | Required |
|
|
6
|
+
|----------|-------------|----------|
|
|
7
|
+
| {PROJECT_PATH} | Path to the project directory | Yes |
|
|
8
|
+
| {TASK_OUTPUTS} | JSON array of task output file paths | Yes |
|
|
9
|
+
| {TOTAL_TASKS} | Number of tasks completed | Yes |
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Context
|
|
14
|
+
|
|
15
|
+
You are synthesizing repository analysis results. Each task analyzed one repository and generated maps. Now you need to:
|
|
16
|
+
- Save maps to the correct locations
|
|
17
|
+
- Create a summary of all repositories
|
|
18
|
+
- Prepare for gap analysis or PRD generation
|
|
19
|
+
|
|
20
|
+
Project: {PROJECT_PATH}
|
|
21
|
+
Task outputs: {TASK_OUTPUTS}
|
|
22
|
+
Total tasks: {TOTAL_TASKS}
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Your Task
|
|
27
|
+
|
|
28
|
+
Combine all repository analyses and save to the sync cache.
|
|
29
|
+
|
|
30
|
+
### Step 1: Load Task Outputs
|
|
31
|
+
|
|
32
|
+
Read each task output file from {TASK_OUTPUTS}.
|
|
33
|
+
|
|
34
|
+
### Step 2: Save Maps to Sync Cache
|
|
35
|
+
|
|
36
|
+
For each repository analyzed, create the directory structure:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
docs/sync-cache/{alias}/
|
|
40
|
+
├── maps/
|
|
41
|
+
│ ├── entities.json
|
|
42
|
+
│ ├── api.json
|
|
43
|
+
│ ├── services.json
|
|
44
|
+
│ └── modules.json
|
|
45
|
+
└── metadata.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**entities.json:**
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"version": "1.0",
|
|
52
|
+
"source": "prisma/schema.prisma",
|
|
53
|
+
"generated_at": "2026-01-21T10:00:00Z",
|
|
54
|
+
"models": {...},
|
|
55
|
+
"enums": {...}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**api.json:**
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"version": "1.0",
|
|
63
|
+
"generated_at": "2026-01-21T10:00:00Z",
|
|
64
|
+
"endpoints": {...}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**services.json:**
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"version": "1.0",
|
|
72
|
+
"generated_at": "2026-01-21T10:00:00Z",
|
|
73
|
+
"services": {...}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**modules.json:**
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"version": "1.0",
|
|
81
|
+
"generated_at": "2026-01-21T10:00:00Z",
|
|
82
|
+
"modules": {...}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**metadata.json:**
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"alias": "backend",
|
|
90
|
+
"url": "github.com/org/backend",
|
|
91
|
+
"branch": "main",
|
|
92
|
+
"framework": "nestjs",
|
|
93
|
+
"analyzed_at": "2026-01-21T10:00:00Z",
|
|
94
|
+
"summary": {
|
|
95
|
+
"models": 24,
|
|
96
|
+
"endpoints": 47,
|
|
97
|
+
"services": 18,
|
|
98
|
+
"modules": 12
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Step 3: Generate Summary
|
|
104
|
+
|
|
105
|
+
Create a consolidated summary of all repositories.
|
|
106
|
+
|
|
107
|
+
### Step 4: Display Results
|
|
108
|
+
|
|
109
|
+
Print analysis summary and next steps.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Output
|
|
114
|
+
|
|
115
|
+
### Console Output
|
|
116
|
+
|
|
117
|
+
Print a summary:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Repository Analysis Complete
|
|
121
|
+
============================
|
|
122
|
+
|
|
123
|
+
Repositories Analyzed: 2
|
|
124
|
+
|
|
125
|
+
Backend (github.com/org/backend)
|
|
126
|
+
Framework: NestJS
|
|
127
|
+
Models: 24
|
|
128
|
+
Endpoints: 47
|
|
129
|
+
Services: 18
|
|
130
|
+
Modules: 12
|
|
131
|
+
|
|
132
|
+
Frontend (github.com/org/frontend)
|
|
133
|
+
Framework: Next.js
|
|
134
|
+
Models: 8
|
|
135
|
+
API Routes: 12
|
|
136
|
+
Components: 45
|
|
137
|
+
|
|
138
|
+
Maps saved to:
|
|
139
|
+
docs/sync-cache/backend/maps/
|
|
140
|
+
docs/sync-cache/frontend/maps/
|
|
141
|
+
|
|
142
|
+
Next Steps:
|
|
143
|
+
- Run gap analysis with: vibe gaps
|
|
144
|
+
- Generate PRD from maps with: vibe prd --from-maps
|
|
145
|
+
- View sync status with: vibe sync --status
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### File Operations
|
|
149
|
+
|
|
150
|
+
Create these directories and files:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
docs/sync-cache/
|
|
154
|
+
├── backend/
|
|
155
|
+
│ ├── maps/
|
|
156
|
+
│ │ ├── entities.json
|
|
157
|
+
│ │ ├── api.json
|
|
158
|
+
│ │ ├── services.json
|
|
159
|
+
│ │ └── modules.json
|
|
160
|
+
│ └── metadata.json
|
|
161
|
+
├── frontend/
|
|
162
|
+
│ ├── maps/
|
|
163
|
+
│ │ ├── entities.json
|
|
164
|
+
│ │ ├── api.json
|
|
165
|
+
│ │ ├── services.json
|
|
166
|
+
│ │ └── modules.json
|
|
167
|
+
│ └── metadata.json
|
|
168
|
+
└── _summary.json
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**_summary.json:**
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"generated_at": "2026-01-21T10:00:00Z",
|
|
175
|
+
"repositories": [
|
|
176
|
+
{
|
|
177
|
+
"alias": "backend",
|
|
178
|
+
"framework": "nestjs",
|
|
179
|
+
"summary": {
|
|
180
|
+
"models": 24,
|
|
181
|
+
"endpoints": 47,
|
|
182
|
+
"services": 18,
|
|
183
|
+
"modules": 12
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"alias": "frontend",
|
|
188
|
+
"framework": "nextjs",
|
|
189
|
+
"summary": {
|
|
190
|
+
"models": 8,
|
|
191
|
+
"endpoints": 12,
|
|
192
|
+
"services": 5,
|
|
193
|
+
"modules": 0
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"totals": {
|
|
198
|
+
"repositories": 2,
|
|
199
|
+
"models": 32,
|
|
200
|
+
"endpoints": 59,
|
|
201
|
+
"services": 23
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Rules
|
|
209
|
+
|
|
210
|
+
- Create directories if they don't exist
|
|
211
|
+
- Overwrite existing maps (this is a refresh)
|
|
212
|
+
- Preserve timestamps for tracking
|
|
213
|
+
- Use consistent JSON formatting (2-space indent)
|
|
214
|
+
- Include version numbers in all maps for future compatibility
|
|
215
|
+
- Handle empty/missing data gracefully
|
|
216
|
+
- Show clear summary with counts
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Error Handling
|
|
221
|
+
|
|
222
|
+
If a task output is invalid:
|
|
223
|
+
- Log warning
|
|
224
|
+
- Skip that repository
|
|
225
|
+
- Continue with others
|
|
226
|
+
|
|
227
|
+
If write fails:
|
|
228
|
+
- Show error message
|
|
229
|
+
- Suggest checking permissions
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Integration Notes
|
|
234
|
+
|
|
235
|
+
After maps are saved, they can be used by:
|
|
236
|
+
- `vibe gaps` - Compare PRD to maps
|
|
237
|
+
- `vibe prd --from-maps` - Generate PRD from implementation
|
|
238
|
+
- `vibe sync --status` - Check sync freshness
|
|
239
|
+
- `vibe send` - Include maps in scope packages
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Analyze Repository
|
|
2
|
+
|
|
3
|
+
## Variables
|
|
4
|
+
|
|
5
|
+
| Variable | Description | Required |
|
|
6
|
+
|----------|-------------|----------|
|
|
7
|
+
| {PROJECT_PATH} | Path to the project directory | Yes |
|
|
8
|
+
| {TASK_NAME} | Name of this task | Yes |
|
|
9
|
+
| {TASK_DESCRIPTION} | Description of this task | Yes |
|
|
10
|
+
| {OUTPUT_FILE} | Path to write the task output | Yes |
|
|
11
|
+
| {PREVIOUS_OUTPUTS} | JSON array of previous task output paths | Yes |
|
|
12
|
+
| {ALIAS} | Repository alias (e.g., "backend") | Yes |
|
|
13
|
+
| {URL} | Repository URL | Yes |
|
|
14
|
+
| {BRANCH} | Branch to analyze | Yes |
|
|
15
|
+
| {FRAMEWORK} | Detected framework | Yes |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Context
|
|
20
|
+
|
|
21
|
+
You are analyzing a repository to extract structural maps. These maps capture the repository's architecture without needing full code access.
|
|
22
|
+
|
|
23
|
+
Project: {PROJECT_PATH}
|
|
24
|
+
Repository: {ALIAS}
|
|
25
|
+
URL: {URL}
|
|
26
|
+
Branch: {BRANCH}
|
|
27
|
+
Framework: {FRAMEWORK}
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Your Task
|
|
32
|
+
|
|
33
|
+
Extract structural information from the repository and generate maps.
|
|
34
|
+
|
|
35
|
+
### Step 1: Access Repository
|
|
36
|
+
|
|
37
|
+
Use the GitHub CLI to fetch key files:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Fetch directory structure
|
|
41
|
+
gh api repos/{owner}/{repo}/git/trees/{branch}?recursive=1
|
|
42
|
+
|
|
43
|
+
# Fetch specific files
|
|
44
|
+
gh api repos/{owner}/{repo}/contents/{path}?ref={branch}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 2: Identify Key Files (Framework-Specific)
|
|
48
|
+
|
|
49
|
+
**NestJS:**
|
|
50
|
+
- `prisma/schema.prisma` - Data models
|
|
51
|
+
- `src/**/*.controller.ts` - API endpoints
|
|
52
|
+
- `src/**/*.service.ts` - Business logic
|
|
53
|
+
- `src/**/*.module.ts` - Module structure
|
|
54
|
+
|
|
55
|
+
**Next.js:**
|
|
56
|
+
- `prisma/schema.prisma` or `src/db/schema.ts` - Data models
|
|
57
|
+
- `pages/api/**/*.ts` or `app/api/**/route.ts` - API routes
|
|
58
|
+
- `src/lib/**/*.ts` - Utilities and services
|
|
59
|
+
- `src/components/**/*.tsx` - Components
|
|
60
|
+
|
|
61
|
+
**FastAPI:**
|
|
62
|
+
- `app/models/*.py` - Data models
|
|
63
|
+
- `app/routers/*.py` or `app/api/*.py` - API endpoints
|
|
64
|
+
- `app/services/*.py` - Business logic
|
|
65
|
+
- `app/schemas/*.py` - Pydantic schemas
|
|
66
|
+
|
|
67
|
+
**Express:**
|
|
68
|
+
- `src/models/*.js` or `src/models/*.ts` - Data models
|
|
69
|
+
- `src/routes/*.js` or `src/routes/*.ts` - API routes
|
|
70
|
+
- `src/controllers/*.js` - Controllers
|
|
71
|
+
- `src/services/*.js` - Services
|
|
72
|
+
|
|
73
|
+
### Step 3: Parse and Extract
|
|
74
|
+
|
|
75
|
+
For each key file type, extract structured data:
|
|
76
|
+
|
|
77
|
+
**Entities (from ORM/schema):**
|
|
78
|
+
- Model names
|
|
79
|
+
- Fields with types
|
|
80
|
+
- Relations
|
|
81
|
+
- Enums
|
|
82
|
+
|
|
83
|
+
**API (from routes/controllers):**
|
|
84
|
+
- HTTP method
|
|
85
|
+
- Path
|
|
86
|
+
- Handler/controller
|
|
87
|
+
- Request/response types
|
|
88
|
+
|
|
89
|
+
**Services (from service files):**
|
|
90
|
+
- Service name
|
|
91
|
+
- Methods
|
|
92
|
+
- Dependencies
|
|
93
|
+
|
|
94
|
+
**Modules (from module structure):**
|
|
95
|
+
- Module name
|
|
96
|
+
- Controllers
|
|
97
|
+
- Services
|
|
98
|
+
- Imports
|
|
99
|
+
|
|
100
|
+
### Step 4: Generate Maps
|
|
101
|
+
|
|
102
|
+
Create structured maps for each category.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Output Format
|
|
107
|
+
|
|
108
|
+
Write to: {OUTPUT_FILE}
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"repo": "{ALIAS}",
|
|
113
|
+
"url": "{URL}",
|
|
114
|
+
"branch": "{BRANCH}",
|
|
115
|
+
"framework": "{FRAMEWORK}",
|
|
116
|
+
"analyzed_at": "2026-01-21T10:00:00Z",
|
|
117
|
+
"maps": {
|
|
118
|
+
"entities": {
|
|
119
|
+
"version": "1.0",
|
|
120
|
+
"source": "prisma/schema.prisma",
|
|
121
|
+
"models": {
|
|
122
|
+
"User": {
|
|
123
|
+
"fields": {
|
|
124
|
+
"id": { "type": "String", "attributes": ["@id", "@default(cuid())"] },
|
|
125
|
+
"email": { "type": "String", "attributes": ["@unique"] },
|
|
126
|
+
"name": { "type": "String", "attributes": ["?"] },
|
|
127
|
+
"posts": { "type": "Post[]", "relation": true }
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"Post": {
|
|
131
|
+
"fields": {
|
|
132
|
+
"id": { "type": "String", "attributes": ["@id"] },
|
|
133
|
+
"title": { "type": "String", "attributes": [] },
|
|
134
|
+
"authorId": { "type": "String", "attributes": [] },
|
|
135
|
+
"author": { "type": "User", "relation": true }
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"enums": {
|
|
140
|
+
"Role": ["USER", "ADMIN"]
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"api": {
|
|
144
|
+
"version": "1.0",
|
|
145
|
+
"endpoints": {
|
|
146
|
+
"POST /users": {
|
|
147
|
+
"method": "POST",
|
|
148
|
+
"path": "/users",
|
|
149
|
+
"controller": "UsersController.create",
|
|
150
|
+
"description": "Create a new user",
|
|
151
|
+
"request_body": "CreateUserDto",
|
|
152
|
+
"response": "User"
|
|
153
|
+
},
|
|
154
|
+
"GET /users/:id": {
|
|
155
|
+
"method": "GET",
|
|
156
|
+
"path": "/users/:id",
|
|
157
|
+
"controller": "UsersController.findOne",
|
|
158
|
+
"description": "Get user by ID",
|
|
159
|
+
"params": ["id"],
|
|
160
|
+
"response": "User"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"services": {
|
|
165
|
+
"version": "1.0",
|
|
166
|
+
"services": {
|
|
167
|
+
"UsersService": {
|
|
168
|
+
"file": "src/users/users.service.ts",
|
|
169
|
+
"methods": ["create", "findAll", "findOne", "update", "remove"],
|
|
170
|
+
"dependencies": ["PrismaService"]
|
|
171
|
+
},
|
|
172
|
+
"AuthService": {
|
|
173
|
+
"file": "src/auth/auth.service.ts",
|
|
174
|
+
"methods": ["login", "logout", "validateUser"],
|
|
175
|
+
"dependencies": ["UsersService", "JwtService"]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"modules": {
|
|
180
|
+
"version": "1.0",
|
|
181
|
+
"modules": {
|
|
182
|
+
"UsersModule": {
|
|
183
|
+
"file": "src/users/users.module.ts",
|
|
184
|
+
"controllers": ["UsersController"],
|
|
185
|
+
"services": ["UsersService"],
|
|
186
|
+
"imports": ["PrismaModule"]
|
|
187
|
+
},
|
|
188
|
+
"AuthModule": {
|
|
189
|
+
"file": "src/auth/auth.module.ts",
|
|
190
|
+
"controllers": ["AuthController"],
|
|
191
|
+
"services": ["AuthService"],
|
|
192
|
+
"imports": ["UsersModule", "JwtModule"]
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"summary": {
|
|
198
|
+
"models": 2,
|
|
199
|
+
"enums": 1,
|
|
200
|
+
"endpoints": 2,
|
|
201
|
+
"services": 2,
|
|
202
|
+
"modules": 2
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Rules
|
|
210
|
+
|
|
211
|
+
- Use GitHub API to fetch files (requires GITHUB_TOKEN)
|
|
212
|
+
- Focus on structural information, not implementation details
|
|
213
|
+
- Don't include actual code, only signatures and structure
|
|
214
|
+
- Handle missing files gracefully (some repos won't have all components)
|
|
215
|
+
- Use consistent naming (camelCase for JSON keys)
|
|
216
|
+
- Include source file paths for traceability
|
|
217
|
+
- Timestamp the analysis
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Error Handling
|
|
222
|
+
|
|
223
|
+
If file not found:
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"maps": {
|
|
227
|
+
"entities": {
|
|
228
|
+
"version": "1.0",
|
|
229
|
+
"source": null,
|
|
230
|
+
"error": "No Prisma schema found",
|
|
231
|
+
"models": {}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
If access denied:
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"error": "GitHub API access denied. Check GITHUB_TOKEN permissions.",
|
|
241
|
+
"maps": {}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Map Storage
|
|
248
|
+
|
|
249
|
+
After analysis, maps should be saved to:
|
|
250
|
+
```
|
|
251
|
+
docs/sync-cache/{ALIAS}/
|
|
252
|
+
├── maps/
|
|
253
|
+
│ ├── entities.json
|
|
254
|
+
│ ├── api.json
|
|
255
|
+
│ ├── services.json
|
|
256
|
+
│ └── modules.json
|
|
257
|
+
└── metadata.json
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The synthesis phase will handle the actual file creation.
|