@wtdlee/repomap 0.1.0
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/LICENSE +21 -0
- package/README.md +527 -0
- package/dist/analyzers/base-analyzer.d.ts +46 -0
- package/dist/analyzers/base-analyzer.d.ts.map +1 -0
- package/dist/analyzers/base-analyzer.js +48 -0
- package/dist/analyzers/base-analyzer.js.map +1 -0
- package/dist/analyzers/dataflow-analyzer.d.ts +30 -0
- package/dist/analyzers/dataflow-analyzer.d.ts.map +1 -0
- package/dist/analyzers/dataflow-analyzer.js +426 -0
- package/dist/analyzers/dataflow-analyzer.js.map +1 -0
- package/dist/analyzers/graphql-analyzer.d.ts +23 -0
- package/dist/analyzers/graphql-analyzer.d.ts.map +1 -0
- package/dist/analyzers/graphql-analyzer.js +387 -0
- package/dist/analyzers/graphql-analyzer.js.map +1 -0
- package/dist/analyzers/index.d.ts +6 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +6 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/analyzers/pages-analyzer.d.ts +85 -0
- package/dist/analyzers/pages-analyzer.d.ts.map +1 -0
- package/dist/analyzers/pages-analyzer.js +1696 -0
- package/dist/analyzers/pages-analyzer.js.map +1 -0
- package/dist/analyzers/rails/index.d.ts +47 -0
- package/dist/analyzers/rails/index.d.ts.map +1 -0
- package/dist/analyzers/rails/index.js +146 -0
- package/dist/analyzers/rails/index.js.map +1 -0
- package/dist/analyzers/rails/rails-controller-analyzer.d.ts +83 -0
- package/dist/analyzers/rails/rails-controller-analyzer.d.ts.map +1 -0
- package/dist/analyzers/rails/rails-controller-analyzer.js +479 -0
- package/dist/analyzers/rails/rails-controller-analyzer.js.map +1 -0
- package/dist/analyzers/rails/rails-grpc-analyzer.d.ts +45 -0
- package/dist/analyzers/rails/rails-grpc-analyzer.d.ts.map +1 -0
- package/dist/analyzers/rails/rails-grpc-analyzer.js +263 -0
- package/dist/analyzers/rails/rails-grpc-analyzer.js.map +1 -0
- package/dist/analyzers/rails/rails-model-analyzer.d.ts +89 -0
- package/dist/analyzers/rails/rails-model-analyzer.d.ts.map +1 -0
- package/dist/analyzers/rails/rails-model-analyzer.js +494 -0
- package/dist/analyzers/rails/rails-model-analyzer.js.map +1 -0
- package/dist/analyzers/rails/rails-react-analyzer.d.ts +42 -0
- package/dist/analyzers/rails/rails-react-analyzer.d.ts.map +1 -0
- package/dist/analyzers/rails/rails-react-analyzer.js +530 -0
- package/dist/analyzers/rails/rails-react-analyzer.js.map +1 -0
- package/dist/analyzers/rails/rails-routes-analyzer.d.ts +63 -0
- package/dist/analyzers/rails/rails-routes-analyzer.d.ts.map +1 -0
- package/dist/analyzers/rails/rails-routes-analyzer.js +541 -0
- package/dist/analyzers/rails/rails-routes-analyzer.js.map +1 -0
- package/dist/analyzers/rails/rails-view-analyzer.d.ts +50 -0
- package/dist/analyzers/rails/rails-view-analyzer.d.ts.map +1 -0
- package/dist/analyzers/rails/rails-view-analyzer.js +387 -0
- package/dist/analyzers/rails/rails-view-analyzer.js.map +1 -0
- package/dist/analyzers/rails/ruby-parser.d.ts +64 -0
- package/dist/analyzers/rails/ruby-parser.d.ts.map +1 -0
- package/dist/analyzers/rails/ruby-parser.js +213 -0
- package/dist/analyzers/rails/ruby-parser.js.map +1 -0
- package/dist/analyzers/rest-api-analyzer.d.ts +66 -0
- package/dist/analyzers/rest-api-analyzer.d.ts.map +1 -0
- package/dist/analyzers/rest-api-analyzer.js +480 -0
- package/dist/analyzers/rest-api-analyzer.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +550 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/cache.d.ts +48 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +152 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/engine.d.ts +47 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/engine.js +320 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/generators/assets/common.css +187 -0
- package/dist/generators/assets/docs.css +363 -0
- package/dist/generators/assets/page-map.css +305 -0
- package/dist/generators/assets/rails-map.css +473 -0
- package/dist/generators/index.d.ts +4 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +4 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/markdown-generator.d.ts +26 -0
- package/dist/generators/markdown-generator.d.ts.map +1 -0
- package/dist/generators/markdown-generator.js +783 -0
- package/dist/generators/markdown-generator.js.map +1 -0
- package/dist/generators/mermaid-generator.d.ts +36 -0
- package/dist/generators/mermaid-generator.d.ts.map +1 -0
- package/dist/generators/mermaid-generator.js +365 -0
- package/dist/generators/mermaid-generator.js.map +1 -0
- package/dist/generators/page-map-generator.d.ts +23 -0
- package/dist/generators/page-map-generator.d.ts.map +1 -0
- package/dist/generators/page-map-generator.js +3563 -0
- package/dist/generators/page-map-generator.js.map +1 -0
- package/dist/generators/rails-map-generator.d.ts +22 -0
- package/dist/generators/rails-map-generator.d.ts.map +1 -0
- package/dist/generators/rails-map-generator.js +909 -0
- package/dist/generators/rails-map-generator.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/server/doc-server.d.ts +31 -0
- package/dist/server/doc-server.d.ts.map +1 -0
- package/dist/server/doc-server.js +1233 -0
- package/dist/server/doc-server.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -0
- package/dist/types.d.ts +294 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/env-detector.d.ts +32 -0
- package/dist/utils/env-detector.d.ts.map +1 -0
- package/dist/utils/env-detector.js +189 -0
- package/dist/utils/env-detector.js.map +1 -0
- package/dist/utils/parallel.d.ts +24 -0
- package/dist/utils/parallel.d.ts.map +1 -0
- package/dist/utils/parallel.js +71 -0
- package/dist/utils/parallel.js.map +1 -0
- package/package.json +131 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kyuhwan Lee
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
# repomap
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/repomap)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Interactive documentation generator for code repositories. Visualize pages, components, routes, and data flows with an intuitive web interface.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
### 🗺️ Page Map
|
|
11
|
+
- **Multi-framework support** - Next.js (Pages/App Router), React, Rails
|
|
12
|
+
- **Interactive graph view** - Visual representation of page relationships
|
|
13
|
+
- **Route analysis** - Automatic detection of routes, authentication, and data dependencies
|
|
14
|
+
- **React component tracking** - Detect React components used in Rails views
|
|
15
|
+
|
|
16
|
+
### 🛤️ Rails Map
|
|
17
|
+
- **Routes explorer** - Browse all routes with method, path, controller info
|
|
18
|
+
- **Controllers view** - List controllers with actions, filters, and inheritance
|
|
19
|
+
- **Models view** - View models with associations, validations, and scopes
|
|
20
|
+
- **gRPC services** - Browse gRPC services with RPC methods
|
|
21
|
+
- **Model Relationships diagram** - Auto-generated ER diagram using Mermaid
|
|
22
|
+
- **Advanced filtering** - Filter by namespace, HTTP methods (multi-select with Ctrl/Cmd)
|
|
23
|
+
- **Search** - Full-text search across routes, controllers, models
|
|
24
|
+
|
|
25
|
+
### 🔗 GraphQL Analysis
|
|
26
|
+
- **Operations mapping** - Extract queries, mutations, and fragments
|
|
27
|
+
- **Field details** - View all fields with types and arguments
|
|
28
|
+
- **Usage tracking** - See where operations are used
|
|
29
|
+
|
|
30
|
+
### 📊 Data Flow
|
|
31
|
+
- **Visual diagrams** - Mermaid-generated flowcharts
|
|
32
|
+
- **Cross-component tracking** - Follow data through your application
|
|
33
|
+
- **REST API detection** - Automatic API endpoint discovery
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Global installation
|
|
39
|
+
npm install -g repomap
|
|
40
|
+
|
|
41
|
+
# Or use directly with npx
|
|
42
|
+
npx repomap serve
|
|
43
|
+
|
|
44
|
+
# Or install as project dependency
|
|
45
|
+
npm install repomap
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### CLI Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Navigate to your project
|
|
54
|
+
cd my-project
|
|
55
|
+
|
|
56
|
+
# Start the documentation server (auto-detects project type)
|
|
57
|
+
npx repomap serve
|
|
58
|
+
|
|
59
|
+
# Open http://localhost:3030
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### CLI Commands
|
|
63
|
+
|
|
64
|
+
| Command | Description |
|
|
65
|
+
|---------|-------------|
|
|
66
|
+
| `repomap serve` | Start interactive documentation server |
|
|
67
|
+
| `repomap generate` | Generate static documentation files |
|
|
68
|
+
| `repomap init` | Create configuration file |
|
|
69
|
+
| `repomap rails` | Analyze Rails application and generate HTML map |
|
|
70
|
+
| `repomap diff` | Show changes since last generation |
|
|
71
|
+
|
|
72
|
+
### CLI Options
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# serve command options
|
|
76
|
+
repomap serve [options]
|
|
77
|
+
-p, --port <number> Server port (default: 3030)
|
|
78
|
+
-c, --config <path> Path to config file
|
|
79
|
+
--path <path> Path to repository to analyze
|
|
80
|
+
--no-cache Disable caching (always analyze from scratch)
|
|
81
|
+
--no-open Don't open browser automatically
|
|
82
|
+
|
|
83
|
+
# generate command options
|
|
84
|
+
repomap generate [options]
|
|
85
|
+
-c, --config <path> Path to config file
|
|
86
|
+
-o, --output <path> Output directory
|
|
87
|
+
--repo <name> Analyze specific repository only
|
|
88
|
+
--watch Watch for changes and regenerate
|
|
89
|
+
--no-cache Disable caching
|
|
90
|
+
--static Generate standalone HTML files (for GitHub Pages)
|
|
91
|
+
--ci CI mode: minimal output, exit codes for errors
|
|
92
|
+
--format <type> Output format: json, html, markdown (default: all)
|
|
93
|
+
|
|
94
|
+
# rails command options
|
|
95
|
+
repomap rails [options]
|
|
96
|
+
--path <path> Path to Rails application
|
|
97
|
+
-o, --output <path> Output HTML file path
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## CI/CD Integration
|
|
101
|
+
|
|
102
|
+
### Deploy to GitHub Pages
|
|
103
|
+
|
|
104
|
+
Generate static documentation and deploy to GitHub Pages:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Generate static HTML files
|
|
108
|
+
npx repomap generate --static --output ./docs
|
|
109
|
+
|
|
110
|
+
# In CI mode (minimal output)
|
|
111
|
+
npx repomap generate --static --ci --output ./docs
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Example GitHub Actions workflow (`.github/workflows/docs.yml`):
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
name: Deploy Docs
|
|
118
|
+
on:
|
|
119
|
+
push:
|
|
120
|
+
branches: [main]
|
|
121
|
+
|
|
122
|
+
permissions:
|
|
123
|
+
contents: read
|
|
124
|
+
pages: write
|
|
125
|
+
id-token: write
|
|
126
|
+
|
|
127
|
+
jobs:
|
|
128
|
+
build:
|
|
129
|
+
runs-on: ubuntu-latest
|
|
130
|
+
steps:
|
|
131
|
+
- uses: actions/checkout@v4
|
|
132
|
+
- uses: actions/setup-node@v4
|
|
133
|
+
with:
|
|
134
|
+
node-version: '20'
|
|
135
|
+
- run: npm ci
|
|
136
|
+
- run: npx repomap generate --static --ci --output ./docs
|
|
137
|
+
- uses: actions/upload-pages-artifact@v3
|
|
138
|
+
with:
|
|
139
|
+
path: './docs'
|
|
140
|
+
|
|
141
|
+
deploy:
|
|
142
|
+
needs: build
|
|
143
|
+
runs-on: ubuntu-latest
|
|
144
|
+
environment:
|
|
145
|
+
name: github-pages
|
|
146
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
147
|
+
steps:
|
|
148
|
+
- uses: actions/deploy-pages@v4
|
|
149
|
+
id: deployment
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### PR Preview with Comment
|
|
153
|
+
|
|
154
|
+
Generate documentation stats on pull requests:
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
name: PR Preview
|
|
158
|
+
on:
|
|
159
|
+
pull_request:
|
|
160
|
+
branches: [main]
|
|
161
|
+
|
|
162
|
+
jobs:
|
|
163
|
+
preview:
|
|
164
|
+
runs-on: ubuntu-latest
|
|
165
|
+
permissions:
|
|
166
|
+
pull-requests: write
|
|
167
|
+
steps:
|
|
168
|
+
- uses: actions/checkout@v4
|
|
169
|
+
- uses: actions/setup-node@v4
|
|
170
|
+
with:
|
|
171
|
+
node-version: '20'
|
|
172
|
+
- run: npm ci
|
|
173
|
+
- run: npx repomap generate --static --ci --format json --output ./docs
|
|
174
|
+
- name: Post Comment
|
|
175
|
+
uses: actions/github-script@v7
|
|
176
|
+
with:
|
|
177
|
+
script: |
|
|
178
|
+
const report = require('./docs/report.json');
|
|
179
|
+
const pages = report.repositoryReports.reduce((sum, r) => sum + r.summary.totalPages, 0);
|
|
180
|
+
github.rest.issues.createComment({
|
|
181
|
+
owner: context.repo.owner,
|
|
182
|
+
repo: context.repo.repo,
|
|
183
|
+
issue_number: context.issue.number,
|
|
184
|
+
body: `📊 Documentation: ${pages} pages analyzed`
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Output Structure
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
docs/
|
|
192
|
+
├── index.html # Page map (main view)
|
|
193
|
+
├── rails-map.html # Rails map (if Rails detected)
|
|
194
|
+
├── report.json # JSON data for custom integrations
|
|
195
|
+
└── assets/ # CSS stylesheets
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
See more examples in [`examples/ci/`](./examples/ci/)
|
|
199
|
+
|
|
200
|
+
## Programmatic Usage
|
|
201
|
+
|
|
202
|
+
### Basic Usage
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { DocGeneratorEngine, DocServer } from "repomap";
|
|
206
|
+
import type { DocGeneratorConfig, DocumentationReport } from "repomap";
|
|
207
|
+
|
|
208
|
+
const config: DocGeneratorConfig = {
|
|
209
|
+
outputDir: "./.repomap",
|
|
210
|
+
site: {
|
|
211
|
+
title: "My Project Documentation",
|
|
212
|
+
description: "Auto-generated documentation",
|
|
213
|
+
baseUrl: "/docs",
|
|
214
|
+
},
|
|
215
|
+
repositories: [
|
|
216
|
+
{
|
|
217
|
+
name: "my-project",
|
|
218
|
+
displayName: "My Project",
|
|
219
|
+
description: "Main application",
|
|
220
|
+
path: ".",
|
|
221
|
+
branch: "main",
|
|
222
|
+
type: "nextjs",
|
|
223
|
+
analyzers: ["pages", "graphql", "dataflow"],
|
|
224
|
+
settings: {
|
|
225
|
+
pagesDir: "src/pages",
|
|
226
|
+
featuresDir: "src/features",
|
|
227
|
+
componentsDir: "src/components",
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
analysis: {
|
|
232
|
+
include: ["**/*.tsx", "**/*.ts"],
|
|
233
|
+
exclude: ["**/node_modules/**", "**/__tests__/**"],
|
|
234
|
+
maxDepth: 5,
|
|
235
|
+
},
|
|
236
|
+
diagrams: {
|
|
237
|
+
enabled: true,
|
|
238
|
+
types: ["flowchart", "sequence"],
|
|
239
|
+
theme: "default",
|
|
240
|
+
},
|
|
241
|
+
watch: {
|
|
242
|
+
enabled: false,
|
|
243
|
+
debounce: 1000,
|
|
244
|
+
},
|
|
245
|
+
integrations: {
|
|
246
|
+
github: { enabled: false, organization: "" },
|
|
247
|
+
slack: { enabled: false },
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// Generate documentation
|
|
252
|
+
const engine = new DocGeneratorEngine(config);
|
|
253
|
+
const report: DocumentationReport = await engine.generate();
|
|
254
|
+
|
|
255
|
+
console.log(`Generated docs for ${report.repositories.length} repositories`);
|
|
256
|
+
console.log(`Total pages: ${report.repositories[0].summary.totalPages}`);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Start Documentation Server
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import { DocServer } from "repomap";
|
|
263
|
+
|
|
264
|
+
const server = new DocServer(config, 3030, { noCache: false });
|
|
265
|
+
await server.start(true); // true = open browser automatically
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Using Submodule Imports
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
// Import specific modules
|
|
272
|
+
import { PagesAnalyzer, GraphQLAnalyzer } from "repomap/analyzers";
|
|
273
|
+
import { PageMapGenerator, MermaidGenerator } from "repomap/generators";
|
|
274
|
+
import { DocServer } from "repomap/server";
|
|
275
|
+
import type { PageInfo, GraphQLOperation } from "repomap/types";
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Analyzing Rails Applications
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
import { RailsMapGenerator } from "repomap";
|
|
282
|
+
|
|
283
|
+
const generator = new RailsMapGenerator("/path/to/rails-app");
|
|
284
|
+
await generator.generate({
|
|
285
|
+
title: "My Rails App - Architecture Map",
|
|
286
|
+
outputPath: "./rails-map.html",
|
|
287
|
+
});
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Configuration File
|
|
291
|
+
|
|
292
|
+
Create `repomap.config.ts` in your project root:
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import type { DocGeneratorConfig } from "repomap";
|
|
296
|
+
|
|
297
|
+
export const config: DocGeneratorConfig = {
|
|
298
|
+
outputDir: "./.repomap",
|
|
299
|
+
site: {
|
|
300
|
+
title: "My Project Documentation",
|
|
301
|
+
description: "Auto-generated documentation",
|
|
302
|
+
baseUrl: "/docs",
|
|
303
|
+
},
|
|
304
|
+
repositories: [
|
|
305
|
+
{
|
|
306
|
+
name: "frontend",
|
|
307
|
+
displayName: "Frontend App",
|
|
308
|
+
description: "Next.js frontend application",
|
|
309
|
+
path: "./frontend",
|
|
310
|
+
branch: "main",
|
|
311
|
+
type: "nextjs",
|
|
312
|
+
analyzers: ["pages", "graphql", "components", "dataflow"],
|
|
313
|
+
settings: {
|
|
314
|
+
pagesDir: "src/pages",
|
|
315
|
+
featuresDir: "src/features",
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: "backend",
|
|
320
|
+
displayName: "Backend API",
|
|
321
|
+
description: "Rails API server",
|
|
322
|
+
path: "./backend",
|
|
323
|
+
branch: "main",
|
|
324
|
+
type: "rails",
|
|
325
|
+
analyzers: ["routes", "controllers", "models"],
|
|
326
|
+
settings: {},
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
analysis: {
|
|
330
|
+
include: ["**/*.tsx", "**/*.ts", "**/*.rb"],
|
|
331
|
+
exclude: ["**/node_modules/**", "**/vendor/**", "**/__tests__/**"],
|
|
332
|
+
maxDepth: 5,
|
|
333
|
+
},
|
|
334
|
+
diagrams: {
|
|
335
|
+
enabled: true,
|
|
336
|
+
types: ["flowchart", "sequence", "er"],
|
|
337
|
+
theme: "default",
|
|
338
|
+
},
|
|
339
|
+
watch: {
|
|
340
|
+
enabled: false,
|
|
341
|
+
debounce: 1000,
|
|
342
|
+
},
|
|
343
|
+
integrations: {
|
|
344
|
+
github: { enabled: false, organization: "" },
|
|
345
|
+
slack: { enabled: false },
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export default config;
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Web Interface
|
|
353
|
+
|
|
354
|
+
### `/page-map` - Page Map
|
|
355
|
+
- **Tree View**: Hierarchical list of all pages grouped by framework/directory
|
|
356
|
+
- **Graph View**: Interactive force-directed graph visualization
|
|
357
|
+
- **Rails Routes**: Browse routes with response type indicators (JSON, HTML, Redirect)
|
|
358
|
+
- **Rails Screens**: View-based screen listing with template info
|
|
359
|
+
- **React Components**: React components used in Rails views with usage locations
|
|
360
|
+
|
|
361
|
+
#### Route Indicators
|
|
362
|
+
| Tag | Meaning |
|
|
363
|
+
|-----|---------|
|
|
364
|
+
| `JSON` | Returns JSON response |
|
|
365
|
+
| `HTML` | Returns HTML response |
|
|
366
|
+
| `→` | Redirects to another path |
|
|
367
|
+
| `View` | Has associated view template |
|
|
368
|
+
| `Svc` | Uses service objects |
|
|
369
|
+
| `gRPC` | Makes gRPC calls |
|
|
370
|
+
| `DB` | Accesses database models |
|
|
371
|
+
|
|
372
|
+
### `/rails-map` - Rails Map
|
|
373
|
+
- **Routes Tab**: All routes with filtering and search
|
|
374
|
+
- **Controllers Tab**: Controllers with actions and filters
|
|
375
|
+
- **Models Tab**: Models with associations and validations
|
|
376
|
+
- **gRPC Tab**: gRPC services with RPC methods
|
|
377
|
+
- **Diagram Tab**: Model relationships ER diagram
|
|
378
|
+
|
|
379
|
+
#### Features
|
|
380
|
+
- Multi-select filters (Ctrl/Cmd + click)
|
|
381
|
+
- URL state persistence (refresh preserves filters)
|
|
382
|
+
- Show more pagination (200 items at a time)
|
|
383
|
+
- Search includes hidden items
|
|
384
|
+
|
|
385
|
+
### `/docs` - Documentation
|
|
386
|
+
- Auto-generated markdown documentation
|
|
387
|
+
- Navigation sidebar
|
|
388
|
+
- Syntax-highlighted code blocks
|
|
389
|
+
|
|
390
|
+
## Supported Frameworks
|
|
391
|
+
|
|
392
|
+
| Framework | Features |
|
|
393
|
+
|-----------|----------|
|
|
394
|
+
| **Next.js** | Pages Router, App Router, API routes, data fetching |
|
|
395
|
+
| **React** | Components, GraphQL operations, hooks |
|
|
396
|
+
| **Rails** | Routes, Controllers, Models, Views, gRPC, React integration |
|
|
397
|
+
|
|
398
|
+
## Type Definitions
|
|
399
|
+
|
|
400
|
+
### Main Types
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
// Configuration
|
|
404
|
+
interface DocGeneratorConfig {
|
|
405
|
+
outputDir: string;
|
|
406
|
+
site: SiteConfig;
|
|
407
|
+
repositories: RepositoryConfig[];
|
|
408
|
+
analysis: AnalysisConfig;
|
|
409
|
+
diagrams: DiagramConfig;
|
|
410
|
+
watch: WatchConfig;
|
|
411
|
+
integrations: IntegrationsConfig;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Analysis Results
|
|
415
|
+
interface AnalysisResult {
|
|
416
|
+
repository: string;
|
|
417
|
+
timestamp: string;
|
|
418
|
+
version: string;
|
|
419
|
+
commitHash: string;
|
|
420
|
+
pages: PageInfo[];
|
|
421
|
+
graphqlOperations: GraphQLOperation[];
|
|
422
|
+
apiCalls: APICall[];
|
|
423
|
+
components: ComponentInfo[];
|
|
424
|
+
dataFlows: DataFlow[];
|
|
425
|
+
apiEndpoints: APIEndpoint[];
|
|
426
|
+
models: ModelInfo[];
|
|
427
|
+
crossRepoLinks: CrossRepoLink[];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Report
|
|
431
|
+
interface DocumentationReport {
|
|
432
|
+
generatedAt: string;
|
|
433
|
+
repositories: RepositoryReport[];
|
|
434
|
+
crossRepoAnalysis: CrossRepoAnalysis;
|
|
435
|
+
diagrams: MermaidDiagram[];
|
|
436
|
+
}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Project Structure
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
src/
|
|
443
|
+
├── analyzers/
|
|
444
|
+
│ ├── base-analyzer.ts # Base analyzer class
|
|
445
|
+
│ ├── pages-analyzer.ts # Page/route analysis
|
|
446
|
+
│ ├── graphql-analyzer.ts # GraphQL operations
|
|
447
|
+
│ ├── rest-api-analyzer.ts # REST API detection
|
|
448
|
+
│ ├── dataflow-analyzer.ts # Data flow tracking
|
|
449
|
+
│ └── rails/
|
|
450
|
+
│ ├── rails-routes-analyzer.ts
|
|
451
|
+
│ ├── rails-controller-analyzer.ts
|
|
452
|
+
│ ├── rails-model-analyzer.ts
|
|
453
|
+
│ ├── rails-view-analyzer.ts
|
|
454
|
+
│ ├── rails-grpc-analyzer.ts
|
|
455
|
+
│ └── rails-react-analyzer.ts
|
|
456
|
+
├── generators/
|
|
457
|
+
│ ├── page-map-generator.ts # Page map HTML generation
|
|
458
|
+
│ ├── rails-map-generator.ts # Rails map HTML generation
|
|
459
|
+
│ ├── markdown-generator.ts # Markdown docs
|
|
460
|
+
│ ├── mermaid-generator.ts # Diagram generation
|
|
461
|
+
│ └── assets/ # CSS stylesheets
|
|
462
|
+
├── server/
|
|
463
|
+
│ └── doc-server.ts # Express server with live reload
|
|
464
|
+
├── core/
|
|
465
|
+
│ ├── engine.ts # Main documentation engine
|
|
466
|
+
│ └── cache.ts # Caching utilities
|
|
467
|
+
├── utils/
|
|
468
|
+
│ ├── env-detector.ts # Environment detection
|
|
469
|
+
│ └── parallel.ts # Parallel processing utilities
|
|
470
|
+
└── types.ts # Type definitions
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
## Requirements
|
|
474
|
+
|
|
475
|
+
- Node.js >= 18.0.0
|
|
476
|
+
- For Rails analysis: Ruby project with `config/routes.rb`
|
|
477
|
+
|
|
478
|
+
## Development
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
# Clone repository
|
|
482
|
+
git clone https://github.com/wtdlee/repomap.git
|
|
483
|
+
cd repomap
|
|
484
|
+
|
|
485
|
+
# Install dependencies
|
|
486
|
+
pnpm install
|
|
487
|
+
|
|
488
|
+
# Build
|
|
489
|
+
pnpm build
|
|
490
|
+
|
|
491
|
+
# Run development server
|
|
492
|
+
pnpm dev:serve
|
|
493
|
+
|
|
494
|
+
# Run tests
|
|
495
|
+
pnpm test
|
|
496
|
+
|
|
497
|
+
# Lint code
|
|
498
|
+
pnpm lint
|
|
499
|
+
|
|
500
|
+
# Format code
|
|
501
|
+
pnpm format
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
## Contributing
|
|
505
|
+
|
|
506
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
507
|
+
|
|
508
|
+
1. Fork the repository
|
|
509
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
510
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
511
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
512
|
+
5. Open a Pull Request
|
|
513
|
+
|
|
514
|
+
## License
|
|
515
|
+
|
|
516
|
+
MIT
|
|
517
|
+
|
|
518
|
+
## Changelog
|
|
519
|
+
|
|
520
|
+
### 0.1.0
|
|
521
|
+
- Initial release
|
|
522
|
+
- Page map visualization for Next.js/React
|
|
523
|
+
- Rails application analysis (routes, controllers, models, views)
|
|
524
|
+
- GraphQL operations detection and visualization
|
|
525
|
+
- Data flow analysis
|
|
526
|
+
- Interactive web interface with live reload
|
|
527
|
+
- Multi-repository support
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RepositoryConfig, AnalysisResult } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for all analyzers
|
|
4
|
+
* 全分析器の基底クラス
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseAnalyzer {
|
|
7
|
+
protected config: RepositoryConfig;
|
|
8
|
+
protected basePath: string;
|
|
9
|
+
constructor(config: RepositoryConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Run the analysis
|
|
12
|
+
* 分析を実行
|
|
13
|
+
*/
|
|
14
|
+
abstract analyze(): Promise<Partial<AnalysisResult>>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the analyzer name
|
|
17
|
+
* 分析器名を取得
|
|
18
|
+
*/
|
|
19
|
+
abstract getName(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve path relative to repository root
|
|
22
|
+
* リポジトリルートからの相対パスを解決
|
|
23
|
+
*/
|
|
24
|
+
protected resolvePath(relativePath: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get setting value with fallback
|
|
27
|
+
* 設定値を取得(フォールバック付き)
|
|
28
|
+
*/
|
|
29
|
+
protected getSetting(key: string, defaultValue?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Log analysis progress
|
|
32
|
+
* 分析進捗をログ出力
|
|
33
|
+
*/
|
|
34
|
+
protected log(message: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Log warning
|
|
37
|
+
* 警告をログ出力
|
|
38
|
+
*/
|
|
39
|
+
protected warn(message: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Log error
|
|
42
|
+
* エラーをログ出力
|
|
43
|
+
*/
|
|
44
|
+
protected error(message: string, error?: Error): void;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=base-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-analyzer.d.ts","sourceRoot":"","sources":["../../src/analyzers/base-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEpE;;;GAGG;AACH,8BAAsB,YAAY;IAChC,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAC;IACnC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEf,MAAM,EAAE,gBAAgB;IAKpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,MAAM;IAE1B;;;OAGG;IACH,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAInD;;;OAGG;IACH,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;IAIpE;;;OAGG;IACH,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIpC;;;OAGG;IACH,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrC;;;OAGG;IACH,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;CAGtD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all analyzers
|
|
3
|
+
* 全分析器の基底クラス
|
|
4
|
+
*/
|
|
5
|
+
export class BaseAnalyzer {
|
|
6
|
+
config;
|
|
7
|
+
basePath;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.config = config;
|
|
10
|
+
this.basePath = config.path;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolve path relative to repository root
|
|
14
|
+
* リポジトリルートからの相対パスを解決
|
|
15
|
+
*/
|
|
16
|
+
resolvePath(relativePath) {
|
|
17
|
+
return `${this.basePath}/${relativePath}`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get setting value with fallback
|
|
21
|
+
* 設定値を取得(フォールバック付き)
|
|
22
|
+
*/
|
|
23
|
+
getSetting(key, defaultValue = '') {
|
|
24
|
+
return this.config.settings[key] ?? defaultValue;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Log analysis progress
|
|
28
|
+
* 分析進捗をログ出力
|
|
29
|
+
*/
|
|
30
|
+
log(message) {
|
|
31
|
+
console.log(`[${this.getName()}] ${message}`);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Log warning
|
|
35
|
+
* 警告をログ出力
|
|
36
|
+
*/
|
|
37
|
+
warn(message) {
|
|
38
|
+
console.warn(`[${this.getName()}] ⚠️ ${message}`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Log error
|
|
42
|
+
* エラーをログ出力
|
|
43
|
+
*/
|
|
44
|
+
error(message, error) {
|
|
45
|
+
console.error(`[${this.getName()}] ❌ ${message}`, error?.message || '');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=base-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-analyzer.js","sourceRoot":"","sources":["../../src/analyzers/base-analyzer.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAgB,YAAY;IACtB,MAAM,CAAmB;IACzB,QAAQ,CAAS;IAE3B,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;IAC9B,CAAC;IAcD;;;OAGG;IACO,WAAW,CAAC,YAAoB;QACxC,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,YAAY,EAAE,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,GAAW,EAAE,eAAuB,EAAE;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC;IACnD,CAAC;IAED;;;OAGG;IACO,GAAG,CAAC,OAAe;QAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACO,IAAI,CAAC,OAAe;QAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,OAAe,EAAE,KAAa;QAC5C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseAnalyzer } from './base-analyzer.js';
|
|
2
|
+
import type { AnalysisResult, RepositoryConfig } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Analyzer for data flow patterns
|
|
5
|
+
* データフローパターンの分析器
|
|
6
|
+
*/
|
|
7
|
+
export declare class DataFlowAnalyzer extends BaseAnalyzer {
|
|
8
|
+
private project;
|
|
9
|
+
private componentCache;
|
|
10
|
+
constructor(config: RepositoryConfig);
|
|
11
|
+
getName(): string;
|
|
12
|
+
analyze(): Promise<Partial<AnalysisResult>>;
|
|
13
|
+
private analyzeComponents;
|
|
14
|
+
private analyzeComponentFile;
|
|
15
|
+
private isComponentName;
|
|
16
|
+
private extractComponentInfo;
|
|
17
|
+
private extractHookInfo;
|
|
18
|
+
private extractProps;
|
|
19
|
+
private extractHooksUsed;
|
|
20
|
+
private extractOperationName;
|
|
21
|
+
private extractContextName;
|
|
22
|
+
private extractDependencies;
|
|
23
|
+
private extractStateManagement;
|
|
24
|
+
private buildDependencyGraph;
|
|
25
|
+
private analyzeDataFlows;
|
|
26
|
+
private analyzeContextFlows;
|
|
27
|
+
private analyzeApolloFlows;
|
|
28
|
+
private analyzePropDrilling;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=dataflow-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataflow-analyzer.d.ts","sourceRoot":"","sources":["../../src/analyzers/dataflow-analyzer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,EAId,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,cAAc,CAAyC;gBAEnD,MAAM,EAAE,gBAAgB;IAQpC,OAAO,IAAI,MAAM;IAIX,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAcnC,iBAAiB;IAqD/B,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,oBAAoB;IAkD5B,OAAO,CAAC,eAAe;IAyBvB,OAAO,CAAC,YAAY;IA0BpB,OAAO,CAAC,gBAAgB;IAoCxB,OAAO,CAAC,oBAAoB;IAwB5B,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,mBAAmB;IA+B3B,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,oBAAoB;YAgBd,gBAAgB;IAmB9B,OAAO,CAAC,mBAAmB;IAmC3B,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,mBAAmB;CAmB5B"}
|