camouf 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 +346 -0
- package/dist/cli/commands/analyze.d.ts +8 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +81 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/init.d.ts +9 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +104 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/report.d.ts +8 -0
- package/dist/cli/commands/report.d.ts.map +1 -0
- package/dist/cli/commands/report.js +63 -0
- package/dist/cli/commands/report.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +9 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +87 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +9 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +93 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +48 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/version.d.ts +16 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +16 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/core/analyzer/architecture-visualizer.d.ts +25 -0
- package/dist/core/analyzer/architecture-visualizer.d.ts.map +1 -0
- package/dist/core/analyzer/architecture-visualizer.js +333 -0
- package/dist/core/analyzer/architecture-visualizer.js.map +1 -0
- package/dist/core/analyzer/dependency-analyzer.d.ts +49 -0
- package/dist/core/analyzer/dependency-analyzer.d.ts.map +1 -0
- package/dist/core/analyzer/dependency-analyzer.js +242 -0
- package/dist/core/analyzer/dependency-analyzer.js.map +1 -0
- package/dist/core/config/config-schema.d.ts +280 -0
- package/dist/core/config/config-schema.d.ts.map +1 -0
- package/dist/core/config/config-schema.js +199 -0
- package/dist/core/config/config-schema.js.map +1 -0
- package/dist/core/config/configuration-manager.d.ts +82 -0
- package/dist/core/config/configuration-manager.d.ts.map +1 -0
- package/dist/core/config/configuration-manager.js +306 -0
- package/dist/core/config/configuration-manager.js.map +1 -0
- package/dist/core/logger.d.ts +27 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +86 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/parsers/go-parser.d.ts +16 -0
- package/dist/core/parsers/go-parser.d.ts.map +1 -0
- package/dist/core/parsers/go-parser.js +117 -0
- package/dist/core/parsers/go-parser.js.map +1 -0
- package/dist/core/parsers/java-parser.d.ts +22 -0
- package/dist/core/parsers/java-parser.d.ts.map +1 -0
- package/dist/core/parsers/java-parser.js +114 -0
- package/dist/core/parsers/java-parser.js.map +1 -0
- package/dist/core/parsers/javascript-parser.d.ts +14 -0
- package/dist/core/parsers/javascript-parser.d.ts.map +1 -0
- package/dist/core/parsers/javascript-parser.js +19 -0
- package/dist/core/parsers/javascript-parser.js.map +1 -0
- package/dist/core/parsers/parser-registry.d.ts +45 -0
- package/dist/core/parsers/parser-registry.d.ts.map +1 -0
- package/dist/core/parsers/parser-registry.js +121 -0
- package/dist/core/parsers/parser-registry.js.map +1 -0
- package/dist/core/parsers/parser.interface.d.ts +49 -0
- package/dist/core/parsers/parser.interface.d.ts.map +1 -0
- package/dist/core/parsers/parser.interface.js +7 -0
- package/dist/core/parsers/parser.interface.js.map +1 -0
- package/dist/core/parsers/python-parser.d.ts +22 -0
- package/dist/core/parsers/python-parser.d.ts.map +1 -0
- package/dist/core/parsers/python-parser.js +136 -0
- package/dist/core/parsers/python-parser.js.map +1 -0
- package/dist/core/parsers/rust-parser.d.ts +16 -0
- package/dist/core/parsers/rust-parser.d.ts.map +1 -0
- package/dist/core/parsers/rust-parser.js +176 -0
- package/dist/core/parsers/rust-parser.js.map +1 -0
- package/dist/core/parsers/typescript-parser.d.ts +29 -0
- package/dist/core/parsers/typescript-parser.d.ts.map +1 -0
- package/dist/core/parsers/typescript-parser.js +251 -0
- package/dist/core/parsers/typescript-parser.js.map +1 -0
- package/dist/core/reporter/report-generator.d.ts +31 -0
- package/dist/core/reporter/report-generator.d.ts.map +1 -0
- package/dist/core/reporter/report-generator.js +417 -0
- package/dist/core/reporter/report-generator.js.map +1 -0
- package/dist/core/reporter/violation-reporter.d.ts +62 -0
- package/dist/core/reporter/violation-reporter.d.ts.map +1 -0
- package/dist/core/reporter/violation-reporter.js +265 -0
- package/dist/core/reporter/violation-reporter.js.map +1 -0
- package/dist/core/rules/builtin/api-versioning.rule.d.ts +28 -0
- package/dist/core/rules/builtin/api-versioning.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/api-versioning.rule.js +103 -0
- package/dist/core/rules/builtin/api-versioning.rule.js.map +1 -0
- package/dist/core/rules/builtin/circular-dependencies.rule.d.ts +26 -0
- package/dist/core/rules/builtin/circular-dependencies.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/circular-dependencies.rule.js +99 -0
- package/dist/core/rules/builtin/circular-dependencies.rule.js.map +1 -0
- package/dist/core/rules/builtin/data-flow-integrity.rule.d.ts +27 -0
- package/dist/core/rules/builtin/data-flow-integrity.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/data-flow-integrity.rule.js +111 -0
- package/dist/core/rules/builtin/data-flow-integrity.rule.js.map +1 -0
- package/dist/core/rules/builtin/ddd-boundaries.rule.d.ts +31 -0
- package/dist/core/rules/builtin/ddd-boundaries.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/ddd-boundaries.rule.js +141 -0
- package/dist/core/rules/builtin/ddd-boundaries.rule.js.map +1 -0
- package/dist/core/rules/builtin/distributed-transactions.rule.d.ts +27 -0
- package/dist/core/rules/builtin/distributed-transactions.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/distributed-transactions.rule.js +134 -0
- package/dist/core/rules/builtin/distributed-transactions.rule.js.map +1 -0
- package/dist/core/rules/builtin/index.d.ts +16 -0
- package/dist/core/rules/builtin/index.d.ts.map +1 -0
- package/dist/core/rules/builtin/index.js +16 -0
- package/dist/core/rules/builtin/index.js.map +1 -0
- package/dist/core/rules/builtin/layer-dependencies.rule.d.ts +30 -0
- package/dist/core/rules/builtin/layer-dependencies.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/layer-dependencies.rule.js +102 -0
- package/dist/core/rules/builtin/layer-dependencies.rule.js.map +1 -0
- package/dist/core/rules/builtin/performance-antipatterns.rule.d.ts +29 -0
- package/dist/core/rules/builtin/performance-antipatterns.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/performance-antipatterns.rule.js +148 -0
- package/dist/core/rules/builtin/performance-antipatterns.rule.js.map +1 -0
- package/dist/core/rules/builtin/resilience-patterns.rule.d.ts +29 -0
- package/dist/core/rules/builtin/resilience-patterns.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/resilience-patterns.rule.js +123 -0
- package/dist/core/rules/builtin/resilience-patterns.rule.js.map +1 -0
- package/dist/core/rules/builtin/security-context.rule.d.ts +32 -0
- package/dist/core/rules/builtin/security-context.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/security-context.rule.js +145 -0
- package/dist/core/rules/builtin/security-context.rule.js.map +1 -0
- package/dist/core/rules/builtin/type-safety.rule.d.ts +32 -0
- package/dist/core/rules/builtin/type-safety.rule.d.ts.map +1 -0
- package/dist/core/rules/builtin/type-safety.rule.js +175 -0
- package/dist/core/rules/builtin/type-safety.rule.js.map +1 -0
- package/dist/core/rules/rule-engine.d.ts +72 -0
- package/dist/core/rules/rule-engine.d.ts.map +1 -0
- package/dist/core/rules/rule-engine.js +225 -0
- package/dist/core/rules/rule-engine.js.map +1 -0
- package/dist/core/rules/rule.interface.d.ts +169 -0
- package/dist/core/rules/rule.interface.d.ts.map +1 -0
- package/dist/core/rules/rule.interface.js +38 -0
- package/dist/core/rules/rule.interface.js.map +1 -0
- package/dist/core/scanner/project-detector.d.ts +51 -0
- package/dist/core/scanner/project-detector.d.ts.map +1 -0
- package/dist/core/scanner/project-detector.js +310 -0
- package/dist/core/scanner/project-detector.js.map +1 -0
- package/dist/core/scanner/project-scanner.d.ts +101 -0
- package/dist/core/scanner/project-scanner.d.ts.map +1 -0
- package/dist/core/scanner/project-scanner.js +321 -0
- package/dist/core/scanner/project-scanner.js.map +1 -0
- package/dist/core/watcher/file-watcher.d.ts +48 -0
- package/dist/core/watcher/file-watcher.d.ts.map +1 -0
- package/dist/core/watcher/file-watcher.js +124 -0
- package/dist/core/watcher/file-watcher.js.map +1 -0
- package/dist/types/config.types.d.ts +163 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/config.types.js +36 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/core.types.d.ts +247 -0
- package/dist/types/core.types.d.ts.map +1 -0
- package/dist/types/core.types.js +7 -0
- package/dist/types/core.types.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +90 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Camouf Contributors
|
|
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,346 @@
|
|
|
1
|
+
# 🦎 Camouf
|
|
2
|
+
|
|
3
|
+
**Real-time Architecture Monitoring CLI Tool**
|
|
4
|
+
|
|
5
|
+
Camouf is a powerful, multi-language CLI tool for monitoring and enforcing software architecture in real-time. It detects architectural violations, anti-patterns, and provides actionable suggestions to maintain code quality.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/camouf)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
## ✨ Features
|
|
11
|
+
|
|
12
|
+
- **🔄 Real-time Monitoring**: Watch mode for continuous architecture validation
|
|
13
|
+
- **🌐 Multi-language Support**: TypeScript, JavaScript, Python, Java, Go, Rust
|
|
14
|
+
- **📊 Advanced Analysis**: Circular dependency detection, coupling metrics, hotspot identification
|
|
15
|
+
- **🛡️ 10 Built-in Rules**: Comprehensive rule set for modern architectures
|
|
16
|
+
- **📈 Multiple Report Formats**: HTML, JSON, Markdown, SARIF
|
|
17
|
+
- **🎯 IDE Integration**: SARIF export for VS Code and other editors
|
|
18
|
+
- **⚙️ Highly Configurable**: JSON, YAML, or JavaScript configuration
|
|
19
|
+
|
|
20
|
+
## 📦 Installation
|
|
21
|
+
|
|
22
|
+
### Global Installation (Recommended)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g camouf
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Local Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --save-dev camouf
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Using npx
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx camouf analyze
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 🚀 Quick Start
|
|
41
|
+
|
|
42
|
+
### 1. Initialize Configuration
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
camouf init
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This creates a `camouf.config.json` file with sensible defaults.
|
|
49
|
+
|
|
50
|
+
### 2. Run Analysis
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
camouf analyze
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Watch Mode
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
camouf watch
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 📋 Commands
|
|
63
|
+
|
|
64
|
+
### `camouf init`
|
|
65
|
+
|
|
66
|
+
Initialize Camouf configuration in your project.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
camouf init [options]
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
-f, --force Overwrite existing configuration
|
|
73
|
+
-t, --template Use a predefined template (clean-architecture, microservices, monolith)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### `camouf analyze`
|
|
77
|
+
|
|
78
|
+
Analyze project architecture and generate reports.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
camouf analyze [options]
|
|
82
|
+
|
|
83
|
+
Options:
|
|
84
|
+
-c, --config <path> Path to configuration file
|
|
85
|
+
-o, --output <path> Output directory for reports
|
|
86
|
+
-f, --format <type> Report format (text, json, html, sarif)
|
|
87
|
+
--visualize Generate architecture visualization
|
|
88
|
+
--rules <rules> Comma-separated list of rules to run
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `camouf watch`
|
|
92
|
+
|
|
93
|
+
Start real-time architecture monitoring.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
camouf watch [options]
|
|
97
|
+
|
|
98
|
+
Options:
|
|
99
|
+
-c, --config <path> Path to configuration file
|
|
100
|
+
--debounce <ms> Debounce time in milliseconds (default: 300)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### `camouf validate`
|
|
104
|
+
|
|
105
|
+
Validate architecture against configured rules (CI/CD friendly).
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
camouf validate [options]
|
|
109
|
+
|
|
110
|
+
Options:
|
|
111
|
+
-c, --config <path> Path to configuration file
|
|
112
|
+
--strict Fail on warnings
|
|
113
|
+
--bail Exit on first error
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### `camouf report`
|
|
117
|
+
|
|
118
|
+
Generate architecture report from existing analysis.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
camouf report [options]
|
|
122
|
+
|
|
123
|
+
Options:
|
|
124
|
+
-i, --input <path> Path to analysis JSON
|
|
125
|
+
-o, --output <path> Output path for report
|
|
126
|
+
-f, --format <type> Report format (html, json, markdown)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## ⚙️ Configuration
|
|
130
|
+
|
|
131
|
+
### Configuration File
|
|
132
|
+
|
|
133
|
+
Camouf supports multiple configuration formats:
|
|
134
|
+
- `camouf.config.json`
|
|
135
|
+
- `camouf.config.yaml`
|
|
136
|
+
- `camouf.config.js`
|
|
137
|
+
- `.camoufrc`
|
|
138
|
+
|
|
139
|
+
### Example Configuration
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"name": "my-project",
|
|
144
|
+
"rootDir": "./src",
|
|
145
|
+
"exclude": ["**/node_modules/**", "**/*.test.ts"],
|
|
146
|
+
"layers": [
|
|
147
|
+
{
|
|
148
|
+
"name": "presentation",
|
|
149
|
+
"directories": ["./src/controllers", "./src/routes"],
|
|
150
|
+
"allowedDependencies": ["application", "domain"]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "application",
|
|
154
|
+
"directories": ["./src/services", "./src/usecases"],
|
|
155
|
+
"allowedDependencies": ["domain"]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "domain",
|
|
159
|
+
"directories": ["./src/domain", "./src/entities"],
|
|
160
|
+
"allowedDependencies": []
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "infrastructure",
|
|
164
|
+
"directories": ["./src/infrastructure", "./src/repositories"],
|
|
165
|
+
"allowedDependencies": ["domain"]
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"rules": {
|
|
169
|
+
"builtin": {
|
|
170
|
+
"layer-dependencies": "error",
|
|
171
|
+
"circular-dependencies": "error",
|
|
172
|
+
"performance-antipatterns": "warn",
|
|
173
|
+
"type-safety": "warn",
|
|
174
|
+
"data-flow-integrity": "error",
|
|
175
|
+
"distributed-transactions": "warn",
|
|
176
|
+
"api-versioning": "info",
|
|
177
|
+
"security-context": "error",
|
|
178
|
+
"resilience-patterns": "warn",
|
|
179
|
+
"ddd-boundaries": "info"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"output": {
|
|
183
|
+
"format": "text",
|
|
184
|
+
"colors": true,
|
|
185
|
+
"verbose": false
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 🛡️ Built-in Rules
|
|
191
|
+
|
|
192
|
+
### Architecture Rules
|
|
193
|
+
|
|
194
|
+
| Rule | Description | Default |
|
|
195
|
+
|------|-------------|---------|
|
|
196
|
+
| `layer-dependencies` | Validates layer boundary compliance | `error` |
|
|
197
|
+
| `circular-dependencies` | Detects circular dependency cycles | `error` |
|
|
198
|
+
| `ddd-boundaries` | Validates DDD principles and bounded contexts | `warn` |
|
|
199
|
+
|
|
200
|
+
### Security Rules
|
|
201
|
+
|
|
202
|
+
| Rule | Description | Default |
|
|
203
|
+
|------|-------------|---------|
|
|
204
|
+
| `data-flow-integrity` | Validates data flow and input sanitization | `error` |
|
|
205
|
+
| `security-context` | Validates authentication and authorization | `error` |
|
|
206
|
+
|
|
207
|
+
### Reliability Rules
|
|
208
|
+
|
|
209
|
+
| Rule | Description | Default |
|
|
210
|
+
|------|-------------|---------|
|
|
211
|
+
| `distributed-transactions` | Validates distributed transaction patterns | `warn` |
|
|
212
|
+
| `resilience-patterns` | Validates circuit breakers, retries, timeouts | `warn` |
|
|
213
|
+
|
|
214
|
+
### Quality Rules
|
|
215
|
+
|
|
216
|
+
| Rule | Description | Default |
|
|
217
|
+
|------|-------------|---------|
|
|
218
|
+
| `performance-antipatterns` | Detects N+1 queries, memory leaks | `warn` |
|
|
219
|
+
| `type-safety` | Detects unsafe type usage | `warn` |
|
|
220
|
+
| `api-versioning` | Validates API versioning practices | `info` |
|
|
221
|
+
|
|
222
|
+
## 📊 Report Formats
|
|
223
|
+
|
|
224
|
+
### Text (Console)
|
|
225
|
+
Real-time colored output with violation details.
|
|
226
|
+
|
|
227
|
+
### JSON
|
|
228
|
+
Machine-readable format for CI/CD integration.
|
|
229
|
+
|
|
230
|
+
### HTML
|
|
231
|
+
Interactive visualization with dependency graphs.
|
|
232
|
+
|
|
233
|
+
### SARIF
|
|
234
|
+
Static Analysis Results Interchange Format for IDE integration.
|
|
235
|
+
|
|
236
|
+
### Markdown
|
|
237
|
+
Documentation-friendly format for pull requests.
|
|
238
|
+
|
|
239
|
+
## 🔧 CI/CD Integration
|
|
240
|
+
|
|
241
|
+
### GitHub Actions
|
|
242
|
+
|
|
243
|
+
```yaml
|
|
244
|
+
name: Architecture Check
|
|
245
|
+
on: [push, pull_request]
|
|
246
|
+
|
|
247
|
+
jobs:
|
|
248
|
+
architecture:
|
|
249
|
+
runs-on: ubuntu-latest
|
|
250
|
+
steps:
|
|
251
|
+
- uses: actions/checkout@v3
|
|
252
|
+
- uses: actions/setup-node@v3
|
|
253
|
+
with:
|
|
254
|
+
node-version: '18'
|
|
255
|
+
- run: npm ci
|
|
256
|
+
- run: npx camouf validate --strict
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### GitLab CI
|
|
260
|
+
|
|
261
|
+
```yaml
|
|
262
|
+
architecture:
|
|
263
|
+
stage: test
|
|
264
|
+
image: node:18
|
|
265
|
+
script:
|
|
266
|
+
- npm ci
|
|
267
|
+
- npx camouf validate --strict
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## 🌐 Multi-language Support
|
|
271
|
+
|
|
272
|
+
| Language | Parser | Features |
|
|
273
|
+
|----------|--------|----------|
|
|
274
|
+
| TypeScript | ts-morph | Full AST analysis, type resolution |
|
|
275
|
+
| JavaScript | ts-morph | ES6+ module support |
|
|
276
|
+
| Python | tree-sitter | Import/export detection |
|
|
277
|
+
| Java | tree-sitter | Package and class analysis |
|
|
278
|
+
| Go | tree-sitter | Module and import analysis |
|
|
279
|
+
| Rust | tree-sitter | Crate and module analysis |
|
|
280
|
+
|
|
281
|
+
## 📈 Architecture Visualization
|
|
282
|
+
|
|
283
|
+
Generate interactive HTML visualizations:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
camouf analyze --visualize -o ./reports
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Export to GraphViz DOT format:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
camouf analyze --visualize -f dot -o ./reports
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## 🔌 Extending Camouf
|
|
296
|
+
|
|
297
|
+
### Custom Rules
|
|
298
|
+
|
|
299
|
+
Create custom rules by implementing the `IRule` interface:
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
import { IRule, RuleContext, RuleViolation } from 'camouf';
|
|
303
|
+
|
|
304
|
+
export class MyCustomRule implements IRule {
|
|
305
|
+
readonly id = 'my-custom-rule';
|
|
306
|
+
readonly name = 'My Custom Rule';
|
|
307
|
+
readonly description = 'Description of what the rule checks';
|
|
308
|
+
readonly severity = 'warning';
|
|
309
|
+
readonly tags = ['custom'];
|
|
310
|
+
|
|
311
|
+
validate(context: RuleContext): RuleViolation[] {
|
|
312
|
+
// Your rule logic here
|
|
313
|
+
return [];
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Register custom rules in configuration:
|
|
319
|
+
|
|
320
|
+
```json
|
|
321
|
+
{
|
|
322
|
+
"rules": {
|
|
323
|
+
"custom": [
|
|
324
|
+
"./rules/my-custom-rule.js"
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## 🐳 Docker
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
docker run -v $(pwd):/app ghcr.io/camouf/camouf analyze
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## 📝 License
|
|
337
|
+
|
|
338
|
+
MIT © Camouf Contributors
|
|
339
|
+
|
|
340
|
+
## 🤝 Contributing
|
|
341
|
+
|
|
342
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
343
|
+
|
|
344
|
+
## 🔗 Links
|
|
345
|
+
|
|
346
|
+
-
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/analyze.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,cAAc,SA6EvB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analyze Command
|
|
3
|
+
*
|
|
4
|
+
* Performs deep analysis of project architecture and generates insights.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import { ConfigurationManager } from '../../core/config/configuration-manager.js';
|
|
8
|
+
import { ProjectScanner } from '../../core/scanner/project-scanner.js';
|
|
9
|
+
import { DependencyAnalyzer } from '../../core/analyzer/dependency-analyzer.js';
|
|
10
|
+
import { ArchitectureVisualizer } from '../../core/analyzer/architecture-visualizer.js';
|
|
11
|
+
import { Logger } from '../../core/logger.js';
|
|
12
|
+
import ora from 'ora';
|
|
13
|
+
export const analyzeCommand = new Command('analyze')
|
|
14
|
+
.description('Analyze project architecture and dependencies')
|
|
15
|
+
.option('-c, --config <path>', 'Path to configuration file')
|
|
16
|
+
.option('--depth <number>', 'Maximum depth for dependency analysis', '5')
|
|
17
|
+
.option('--focus <path>', 'Focus analysis on specific file or directory')
|
|
18
|
+
.option('--output <path>', 'Output directory for visualization files')
|
|
19
|
+
.option('--format <format>', 'Output format (html, json, dot)', 'html')
|
|
20
|
+
.option('--metrics', 'Include code metrics in analysis')
|
|
21
|
+
.option('--coupling', 'Analyze coupling between modules')
|
|
22
|
+
.action(async (options) => {
|
|
23
|
+
const spinner = ora('Loading configuration...').start();
|
|
24
|
+
try {
|
|
25
|
+
// Load configuration
|
|
26
|
+
const configManager = new ConfigurationManager();
|
|
27
|
+
const config = await configManager.loadConfig(options.config);
|
|
28
|
+
if (!config) {
|
|
29
|
+
spinner.fail('No configuration found. Run "camouf init" first.');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
// Initialize components
|
|
33
|
+
spinner.text = 'Scanning project...';
|
|
34
|
+
const scanner = new ProjectScanner(config);
|
|
35
|
+
const analyzer = new DependencyAnalyzer(config);
|
|
36
|
+
const visualizer = new ArchitectureVisualizer(config);
|
|
37
|
+
// Scan project
|
|
38
|
+
const graph = await scanner.scan();
|
|
39
|
+
spinner.succeed(`Scanned ${graph.nodeCount()} files`);
|
|
40
|
+
// Analyze dependencies
|
|
41
|
+
spinner.start('Analyzing dependencies...');
|
|
42
|
+
const analysis = await analyzer.analyze(graph, {
|
|
43
|
+
maxDepth: parseInt(options.depth, 10),
|
|
44
|
+
focus: options.focus,
|
|
45
|
+
includeMetrics: options.metrics,
|
|
46
|
+
analyzeCoupling: options.coupling,
|
|
47
|
+
});
|
|
48
|
+
spinner.succeed('Dependency analysis complete');
|
|
49
|
+
// Generate visualization
|
|
50
|
+
spinner.start('Generating visualization...');
|
|
51
|
+
await visualizer.generate(analysis, {
|
|
52
|
+
format: options.format,
|
|
53
|
+
outputPath: options.output || './camouf-report',
|
|
54
|
+
});
|
|
55
|
+
spinner.succeed(`Visualization generated at ${options.output || './camouf-report'}`);
|
|
56
|
+
// Print summary
|
|
57
|
+
Logger.info('\n📊 Analysis Summary:\n');
|
|
58
|
+
Logger.info(` Total files: ${analysis.summary.totalFiles}`);
|
|
59
|
+
Logger.info(` Total dependencies: ${analysis.summary.totalDependencies}`);
|
|
60
|
+
Logger.info(` Circular dependencies: ${analysis.summary.circularDependencies}`);
|
|
61
|
+
Logger.info(` Average coupling: ${analysis.summary.averageCoupling.toFixed(2)}`);
|
|
62
|
+
if (analysis.hotspots.length > 0) {
|
|
63
|
+
Logger.info('\n🔥 Hotspots (most depended upon):\n');
|
|
64
|
+
analysis.hotspots.slice(0, 5).forEach((hotspot, index) => {
|
|
65
|
+
Logger.info(` ${index + 1}. ${hotspot.file} (${hotspot.dependents} dependents)`);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (analysis.suggestions.length > 0) {
|
|
69
|
+
Logger.info('\n💡 Suggestions:\n');
|
|
70
|
+
analysis.suggestions.forEach((suggestion) => {
|
|
71
|
+
Logger.info(` • ${suggestion}`);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
Logger.info('');
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
spinner.fail(`Analysis failed: ${error.message}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=analyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.js","sourceRoot":"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IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Command
|
|
3
|
+
*
|
|
4
|
+
* Initializes a new Camouf configuration in the current project.
|
|
5
|
+
* Creates camouf.config.json with default settings.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
export declare const initCommand: Command;
|
|
9
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,WAAW,SAiGpB,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Command
|
|
3
|
+
*
|
|
4
|
+
* Initializes a new Camouf configuration in the current project.
|
|
5
|
+
* Creates camouf.config.json with default settings.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { ConfigurationManager } from '../../core/config/configuration-manager.js';
|
|
9
|
+
import { Logger } from '../../core/logger.js';
|
|
10
|
+
import { ProjectDetector } from '../../core/scanner/project-detector.js';
|
|
11
|
+
import inquirer from 'inquirer';
|
|
12
|
+
import ora from 'ora';
|
|
13
|
+
export const initCommand = new Command('init')
|
|
14
|
+
.description('Initialize Camouf configuration in the current project')
|
|
15
|
+
.option('-y, --yes', 'Skip interactive prompts and use defaults')
|
|
16
|
+
.option('-f, --force', 'Overwrite existing configuration')
|
|
17
|
+
.option('--template <template>', 'Use a predefined template (monorepo, microservices, fullstack)')
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
const spinner = ora('Detecting project structure...').start();
|
|
20
|
+
try {
|
|
21
|
+
const configManager = new ConfigurationManager();
|
|
22
|
+
const projectDetector = new ProjectDetector();
|
|
23
|
+
// Check if config already exists
|
|
24
|
+
if (configManager.configExists() && !options.force) {
|
|
25
|
+
spinner.fail('Configuration already exists. Use --force to overwrite.');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Detect project structure
|
|
29
|
+
const detection = await projectDetector.detect(process.cwd());
|
|
30
|
+
spinner.succeed('Project structure detected');
|
|
31
|
+
let config;
|
|
32
|
+
if (options.yes) {
|
|
33
|
+
// Use detected defaults
|
|
34
|
+
config = configManager.generateDefaultConfig(detection);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// Interactive prompts
|
|
38
|
+
const answers = await inquirer.prompt([
|
|
39
|
+
{
|
|
40
|
+
type: 'confirm',
|
|
41
|
+
name: 'useDetected',
|
|
42
|
+
message: `Detected: ${detection.languages.join(', ')}. Use detected settings?`,
|
|
43
|
+
default: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'checkbox',
|
|
47
|
+
name: 'languages',
|
|
48
|
+
message: 'Select languages to analyze:',
|
|
49
|
+
choices: ['typescript', 'javascript', 'python', 'java', 'go', 'rust'],
|
|
50
|
+
default: detection.languages,
|
|
51
|
+
when: (ans) => !ans.useDetected,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'input',
|
|
55
|
+
name: 'clientDir',
|
|
56
|
+
message: 'Client/Frontend directory (comma-separated if multiple):',
|
|
57
|
+
default: detection.directories.client.join(', '),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'input',
|
|
61
|
+
name: 'serverDir',
|
|
62
|
+
message: 'Server/Backend directory (comma-separated if multiple):',
|
|
63
|
+
default: detection.directories.server.join(', '),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'input',
|
|
67
|
+
name: 'sharedDir',
|
|
68
|
+
message: 'Shared/Common directory (comma-separated if multiple):',
|
|
69
|
+
default: detection.directories.shared.join(', '),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'checkbox',
|
|
73
|
+
name: 'rules',
|
|
74
|
+
message: 'Select rules to enable:',
|
|
75
|
+
choices: [
|
|
76
|
+
{ name: 'Layer Dependencies', value: 'layer-dependencies', checked: true },
|
|
77
|
+
{ name: 'Circular Dependencies', value: 'circular-dependencies', checked: true },
|
|
78
|
+
{ name: 'Data Flow Integrity', value: 'data-flow-integrity', checked: false },
|
|
79
|
+
{ name: 'API Versioning', value: 'api-versioning', checked: false },
|
|
80
|
+
{ name: 'Security Context', value: 'security-context', checked: false },
|
|
81
|
+
{ name: 'Performance Anti-Patterns', value: 'performance-antipatterns', checked: true },
|
|
82
|
+
{ name: 'DDD Boundaries', value: 'ddd-boundaries', checked: false },
|
|
83
|
+
{ name: 'Type Safety', value: 'type-safety', checked: true },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
]);
|
|
87
|
+
config = configManager.buildConfigFromAnswers(answers, detection);
|
|
88
|
+
}
|
|
89
|
+
// Write configuration
|
|
90
|
+
spinner.start('Writing configuration...');
|
|
91
|
+
await configManager.writeConfig(config);
|
|
92
|
+
spinner.succeed('Configuration written to camouf.config.json');
|
|
93
|
+
Logger.success('\n✨ Camouf initialized successfully!');
|
|
94
|
+
Logger.info('\nNext steps:');
|
|
95
|
+
Logger.info(' 1. Review and customize camouf.config.json');
|
|
96
|
+
Logger.info(' 2. Run "camouf validate" to check your architecture');
|
|
97
|
+
Logger.info(' 3. Run "camouf watch" to start real-time monitoring\n');
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
spinner.fail(`Initialization failed: ${error.message}`);
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAA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e,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,aAAa,SAwDtB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report Command
|
|
3
|
+
*
|
|
4
|
+
* Generates comprehensive architecture reports in various formats.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import { ConfigurationManager } from '../../core/config/configuration-manager.js';
|
|
8
|
+
import { ProjectScanner } from '../../core/scanner/project-scanner.js';
|
|
9
|
+
import { RuleEngine } from '../../core/rules/rule-engine.js';
|
|
10
|
+
import { ReportGenerator } from '../../core/reporter/report-generator.js';
|
|
11
|
+
import { Logger } from '../../core/logger.js';
|
|
12
|
+
import ora from 'ora';
|
|
13
|
+
export const reportCommand = new Command('report')
|
|
14
|
+
.description('Generate architecture reports')
|
|
15
|
+
.option('-c, --config <path>', 'Path to configuration file')
|
|
16
|
+
.option('--format <format>', 'Report format (html, pdf, json, markdown)', 'html')
|
|
17
|
+
.option('--output <path>', 'Output path for report', './camouf-report')
|
|
18
|
+
.option('--include-code', 'Include code snippets in report')
|
|
19
|
+
.option('--include-graphs', 'Include dependency graphs')
|
|
20
|
+
.option('--template <template>', 'Custom report template')
|
|
21
|
+
.action(async (options) => {
|
|
22
|
+
const spinner = ora('Loading configuration...').start();
|
|
23
|
+
try {
|
|
24
|
+
// Load configuration
|
|
25
|
+
const configManager = new ConfigurationManager();
|
|
26
|
+
const config = await configManager.loadConfig(options.config);
|
|
27
|
+
if (!config) {
|
|
28
|
+
spinner.fail('No configuration found. Run "camouf init" first.');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
// Initialize components
|
|
32
|
+
spinner.text = 'Scanning project...';
|
|
33
|
+
const scanner = new ProjectScanner(config);
|
|
34
|
+
const ruleEngine = new RuleEngine(config);
|
|
35
|
+
const reportGenerator = new ReportGenerator(config);
|
|
36
|
+
// Scan project
|
|
37
|
+
const graph = await scanner.scan();
|
|
38
|
+
spinner.succeed(`Scanned ${graph.nodeCount()} files`);
|
|
39
|
+
// Validate
|
|
40
|
+
spinner.start('Running validation...');
|
|
41
|
+
const violations = await ruleEngine.validate(graph);
|
|
42
|
+
spinner.succeed(`Found ${violations.length} violations`);
|
|
43
|
+
// Generate report
|
|
44
|
+
spinner.start('Generating report...');
|
|
45
|
+
await reportGenerator.generate({
|
|
46
|
+
graph,
|
|
47
|
+
violations,
|
|
48
|
+
format: options.format,
|
|
49
|
+
outputPath: options.output,
|
|
50
|
+
includeCode: options.includeCode,
|
|
51
|
+
includeGraphs: options.includeGraphs,
|
|
52
|
+
template: options.template,
|
|
53
|
+
});
|
|
54
|
+
spinner.succeed(`Report generated at ${options.output}`);
|
|
55
|
+
Logger.success(`\n✨ Report generated successfully!\n`);
|
|
56
|
+
Logger.info(`Open ${options.output}/index.html in your browser to view the report.\n`);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
spinner.fail(`Report generation failed: ${error.message}`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/cli/commands/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;A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