legacy-squad 1.0.0-beta.8 β 1.0.1
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/README.md +471 -408
- package/README.pt-br.md +471 -408
- package/package.json +58 -58
package/README.md
CHANGED
|
@@ -1,408 +1,471 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<h1 align="center">Legacy Squad Framework</h1>
|
|
3
|
-
<p align="center"><strong>AI-Powered Legacy Modernization Platform</strong></p>
|
|
4
|
-
<p align="center"><em>Understand. Plan. Modernize.</em></p>
|
|
5
|
-
<p align="center">
|
|
6
|
-
<a href="README.pt-br.md">π§π· PortuguΓͺs</a> Β· <strong>πΊπΈ English</strong>
|
|
7
|
-
</p>
|
|
8
|
-
</p>
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
Legacy Squad is an open-source framework that installs inside your legacy project with a single command, automatically analyzes the codebase, and provides specialized AI agents in your IDE to produce a complete diagnostic β without changing a single line of code.
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npx legacy-squad install
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## The Problem
|
|
21
|
-
|
|
22
|
-
Legacy systems support critical processes, but frequently suffer from:
|
|
23
|
-
|
|
24
|
-
- Missing or outdated documentation
|
|
25
|
-
- Hardcoded credentials in source code
|
|
26
|
-
- Business rules buried in conditionals no one documented
|
|
27
|
-
- Coupling that makes any change risky
|
|
28
|
-
- Fear of modifying production code
|
|
29
|
-
- Dependency on 1-2 developers who "know the system"
|
|
30
|
-
|
|
31
|
-
Traditional approaches (full rewrites, unstructured refactoring) are expensive, slow, and risky.
|
|
32
|
-
|
|
33
|
-
## The Solution
|
|
34
|
-
|
|
35
|
-
Legacy Squad combines **deterministic analysis** (scanner + compliance engine with OWASP/CWE rules) with **specialized AI agents** that run in your IDE (Claude Code, Codex, Cursor) to produce:
|
|
36
|
-
|
|
37
|
-
| Artifact | What it does |
|
|
38
|
-
|----------|-------------|
|
|
39
|
-
| **Repo Index** | Full inventory: stack, modules, dependencies, integrations, hotspots |
|
|
40
|
-
| **Findings** | Security findings with evidence, impact, OWASP reference and recommendation |
|
|
41
|
-
| **Security Assessment** | Deep analysis of auth, secrets, LGPD/GDPR, API security |
|
|
42
|
-
| **Architecture Assessment** | C4 diagrams, coupling analysis, structural risks, target architecture |
|
|
43
|
-
| **Legacy Code Assessment** | Hotspots, JSβTS migration, duplication, test coverage |
|
|
44
|
-
| **Business Rules Assessment** | 60+ rules extracted from code, preservation checklist |
|
|
45
|
-
| **Modernization
|
|
46
|
-
| **PRS** | Product Refactor Specification β consolidated report
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/legacy-squad-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
β
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
β
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
β
|
|
171
|
-
|
|
172
|
-
β
|
|
173
|
-
β
|
|
174
|
-
β
|
|
175
|
-
β
|
|
176
|
-
β
|
|
177
|
-
β
|
|
178
|
-
β
|
|
179
|
-
β
|
|
180
|
-
β
|
|
181
|
-
βββ
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
|
263
|
-
|
|
264
|
-
|
|
|
265
|
-
|
|
|
266
|
-
|
|
|
267
|
-
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
-
|
|
282
|
-
-
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
-
|
|
322
|
-
-
|
|
323
|
-
-
|
|
324
|
-
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
327
|
-
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
###
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">Legacy Squad Framework</h1>
|
|
3
|
+
<p align="center"><strong>AI-Powered Legacy Modernization Platform</strong></p>
|
|
4
|
+
<p align="center"><em>Understand. Plan. Modernize.</em></p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="README.pt-br.md">π§π· PortuguΓͺs</a> Β· <strong>πΊπΈ English</strong>
|
|
7
|
+
</p>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Legacy Squad is an open-source framework that installs inside your legacy project with a single command, automatically analyzes the codebase, and provides specialized AI agents in your IDE to produce a complete diagnostic β without changing a single line of code.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx legacy-squad install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## The Problem
|
|
21
|
+
|
|
22
|
+
Legacy systems support critical processes, but frequently suffer from:
|
|
23
|
+
|
|
24
|
+
- Missing or outdated documentation
|
|
25
|
+
- Hardcoded credentials in source code
|
|
26
|
+
- Business rules buried in conditionals no one documented
|
|
27
|
+
- Coupling that makes any change risky
|
|
28
|
+
- Fear of modifying production code
|
|
29
|
+
- Dependency on 1-2 developers who "know the system"
|
|
30
|
+
|
|
31
|
+
Traditional approaches (full rewrites, unstructured refactoring) are expensive, slow, and risky.
|
|
32
|
+
|
|
33
|
+
## The Solution
|
|
34
|
+
|
|
35
|
+
Legacy Squad combines **deterministic analysis** (scanner + compliance engine with OWASP/CWE rules) with **specialized AI agents** that run in your IDE (Claude Code, Codex, Cursor) to produce:
|
|
36
|
+
|
|
37
|
+
| Artifact | What it does |
|
|
38
|
+
|----------|-------------|
|
|
39
|
+
| **Repo Index** | Full inventory: stack, modules, dependencies, integrations, hotspots |
|
|
40
|
+
| **Findings** | Security findings with evidence, impact, OWASP reference and recommendation |
|
|
41
|
+
| **Security Assessment** | Deep analysis of auth, secrets, LGPD/GDPR, API security |
|
|
42
|
+
| **Architecture Assessment** | C4 diagrams, coupling analysis, structural risks, target architecture |
|
|
43
|
+
| **Legacy Code Assessment** | Hotspots, JSβTS migration, duplication, test coverage |
|
|
44
|
+
| **Business Rules Assessment** | 60+ rules extracted from code, preservation checklist |
|
|
45
|
+
| **Modernization Assessment** | Incremental phased roadmap with rollback and scores |
|
|
46
|
+
| **PRS** | Product Refactor Specification β consolidated diagnostic report |
|
|
47
|
+
| **SDD** | Software Design Document β current/target architecture with ADRs |
|
|
48
|
+
| **MMP** | Modernization Master Plan β phased roadmap with Execution Readiness + Deployability scores |
|
|
49
|
+
| **Execution Specs** | Atomic, individually deployable units of work with binary acceptance criteria and rollback |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
### Prerequisites
|
|
56
|
+
|
|
57
|
+
- Node.js β₯ 18
|
|
58
|
+
- An AI-enabled IDE: [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Codex CLI](https://github.com/openai/codex), or [Cursor](https://cursor.sh)
|
|
59
|
+
|
|
60
|
+
### Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
cd your-legacy-project
|
|
64
|
+
npx legacy-squad install
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The command:
|
|
68
|
+
1. Detects the stack (React Native, PHP, .NET, Java, Node β via manifest)
|
|
69
|
+
2. Scans the repository and generates the inventory
|
|
70
|
+
3. Runs the Compliance Engine (OWASP/CWE rules)
|
|
71
|
+
4. Generates Context Packs per module
|
|
72
|
+
5. Installs agents as slash commands in your IDE
|
|
73
|
+
6. Verifies the installation (8 checks)
|
|
74
|
+
|
|
75
|
+
### Usage with Claude Code
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
claude # Open Claude Code in the project
|
|
79
|
+
|
|
80
|
+
# Step 1 β Analysis (5 agents, run in order)
|
|
81
|
+
/legacy-squad-security # Security Agent
|
|
82
|
+
/legacy-squad-architecture # Architecture Agent
|
|
83
|
+
/legacy-squad-legacy-code # Legacy Code Agent
|
|
84
|
+
/legacy-squad-business-rules # Business Rules Agent
|
|
85
|
+
/legacy-squad-modernization # Modernization Agent
|
|
86
|
+
|
|
87
|
+
# Step 2 β Consolidated artifacts (4 generators, run after analysis)
|
|
88
|
+
/legacy-squad-generate-prs # Product Refactor Specification
|
|
89
|
+
/legacy-squad-generate-sdd # Software Design Document
|
|
90
|
+
/legacy-squad-generate-mmp # Modernization Master Plan
|
|
91
|
+
/legacy-squad-generate-specs # Execution Specs (one YAML per unit of work)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Usage with Codex CLI
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
codex # Open Codex in the project
|
|
98
|
+
# AGENTS.md at the root defines available agents
|
|
99
|
+
@legacy-squad-security # Activate Security Agent
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Other Commands
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx legacy-squad scan # Re-scan without reinstalling agents
|
|
106
|
+
npx legacy-squad doctor # Verify installation health
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## How It Works
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
βββββββββββββββββββββββ
|
|
115
|
+
β npx legacy-squad β
|
|
116
|
+
β install β
|
|
117
|
+
βββββββββββ¬ββββββββββββ
|
|
118
|
+
β
|
|
119
|
+
βββββββββββββββββΌββββββββββββββββ
|
|
120
|
+
βΌ βΌ βΌ
|
|
121
|
+
ββββββββββββ ββββββββββββββ ββββββββββββββ
|
|
122
|
+
β Scanner β β Compliance β β Context β
|
|
123
|
+
β (stack, β β Engine β β Manager β
|
|
124
|
+
β modules) β β (OWASP) β β (packs) β
|
|
125
|
+
ββββββ¬ββββββ βββββββ¬βββββββ βββββββ¬βββββββ
|
|
126
|
+
β β β
|
|
127
|
+
βΌ βΌ βΌ
|
|
128
|
+
ββββββββββββββββββββββββββββββββββββββββββββ
|
|
129
|
+
β .legacy-squad/memory/ β
|
|
130
|
+
β repo-index.json | findings.json | β
|
|
131
|
+
β context-packs.json β
|
|
132
|
+
ββββββββββββββββββββ¬ββββββββββββββββββββββββ
|
|
133
|
+
β
|
|
134
|
+
ββββββββββββββΌβββββββββββββ
|
|
135
|
+
βΌ βΌ βΌ
|
|
136
|
+
ββββββββββββ ββββββββββββ ββββββββββββ
|
|
137
|
+
β .claude/ β β AGENTS.mdβ β .cursor/ β
|
|
138
|
+
β commands/β β (Codex) β β rules/ β
|
|
139
|
+
β (Claude) β β β β (Cursor) β
|
|
140
|
+
ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ
|
|
141
|
+
β β β
|
|
142
|
+
βββββββββββββββΌββββββββββββββ
|
|
143
|
+
β
|
|
144
|
+
ββββββββΌβββββββ
|
|
145
|
+
β IDE + AI β
|
|
146
|
+
β (Claude Codeβ
|
|
147
|
+
β Codex, β
|
|
148
|
+
β Cursor) β
|
|
149
|
+
ββββββββ¬βββββββ
|
|
150
|
+
β
|
|
151
|
+
ββββββββΌβββββββ
|
|
152
|
+
β Assessments β
|
|
153
|
+
β + Final PRS β
|
|
154
|
+
βββββββββββββββ
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**The framework prepares data and installs agents. AI runs in the dev's IDE.**
|
|
158
|
+
|
|
159
|
+
Zero API keys required. Zero external server calls. Everything runs locally.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Installed Structure
|
|
164
|
+
|
|
165
|
+
After `npx legacy-squad install`:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
your-project/
|
|
169
|
+
βββ .legacy-squad/
|
|
170
|
+
β βββ config/
|
|
171
|
+
β β βββ project.yaml # Detected configuration
|
|
172
|
+
β βββ memory/
|
|
173
|
+
β β βββ repo-index.json # Repository inventory
|
|
174
|
+
β β βββ findings.json # Compliance engine findings
|
|
175
|
+
β β βββ context-packs.json # Context per module
|
|
176
|
+
β βββ outputs/
|
|
177
|
+
β β βββ assessments/ # Agent assessments (5 .md files)
|
|
178
|
+
β β βββ reports/ # PRS.md + PRS.json
|
|
179
|
+
β β βββ sdd/ # SDD.md + SDD.json
|
|
180
|
+
β β βββ mmp/ # MMP.md + MMP.json
|
|
181
|
+
β β βββ specs/ # SPEC-*.yaml + INDEX.md
|
|
182
|
+
β βββ logs/
|
|
183
|
+
β βββ install.log
|
|
184
|
+
βββ .claude/
|
|
185
|
+
β βββ commands/
|
|
186
|
+
β βββ legacy-squad/
|
|
187
|
+
β βββ security.md # /legacy-squad-security
|
|
188
|
+
β βββ architecture.md # /legacy-squad-architecture
|
|
189
|
+
β βββ legacy-code.md # /legacy-squad-legacy-code
|
|
190
|
+
β βββ business-rules.md # /legacy-squad-business-rules
|
|
191
|
+
β βββ modernization.md # /legacy-squad-modernization
|
|
192
|
+
β βββ generate-prs.md # /legacy-squad-generate-prs
|
|
193
|
+
β βββ generate-sdd.md # /legacy-squad-generate-sdd
|
|
194
|
+
β βββ generate-mmp.md # /legacy-squad-generate-mmp
|
|
195
|
+
β βββ generate-specs.md # /legacy-squad-generate-specs
|
|
196
|
+
β βββ scan.md # /legacy-squad-scan
|
|
197
|
+
βββ AGENTS.md # Codex compatibility
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Agents
|
|
203
|
+
|
|
204
|
+
### Security Agent (`/legacy-squad-security`)
|
|
205
|
+
|
|
206
|
+
Analyzes authentication, secrets, insecure storage, PII exposure, and privacy compliance (LGPD, GDPR).
|
|
207
|
+
|
|
208
|
+
**References:** OWASP MASVS V2, OWASP ASVS, CWE Top 25, LGPD, GDPR, NIST SSDF
|
|
209
|
+
|
|
210
|
+
### Architecture Agent (`/legacy-squad-architecture`)
|
|
211
|
+
|
|
212
|
+
Maps current architecture with C4 diagrams, identifies coupling, structural risks, and proposes incremental target architecture.
|
|
213
|
+
|
|
214
|
+
**References:** C4 Model, Clean Architecture, arc42, ADR
|
|
215
|
+
|
|
216
|
+
### Legacy Code Agent (`/legacy-squad-legacy-code`)
|
|
217
|
+
|
|
218
|
+
Identifies hotspots, duplication, JSβTS migration progress, test coverage, and refactoring priorities.
|
|
219
|
+
|
|
220
|
+
**References:** Clean Code, Sonar Rules, Cognitive Complexity
|
|
221
|
+
|
|
222
|
+
### Business Rules Agent (`/legacy-squad-business-rules`)
|
|
223
|
+
|
|
224
|
+
Extracts business rules hidden in code β validations, permissions, flows, magic numbers, implicit rules in catch blocks.
|
|
225
|
+
|
|
226
|
+
**References:** DDD, Event Storming
|
|
227
|
+
|
|
228
|
+
### Modernization Agent (`/legacy-squad-modernization`)
|
|
229
|
+
|
|
230
|
+
Synthesizes all assessments into an incremental plan with phases, rollback, Deployability Score (1-10), and Execution Readiness Score (0-100).
|
|
231
|
+
|
|
232
|
+
**References:** Strangler Fig, Branch by Abstraction, Progressive Delivery
|
|
233
|
+
|
|
234
|
+
### PRS Generator (`/legacy-squad-generate-prs`)
|
|
235
|
+
|
|
236
|
+
Consolidates all assessments into the PRS (Product Refactor Specification) β the diagnostic report for decision makers.
|
|
237
|
+
|
|
238
|
+
### SDD Generator (`/legacy-squad-generate-sdd`)
|
|
239
|
+
|
|
240
|
+
Produces the Software Design Document with current and target architecture (Mermaid C4 diagrams), component inventory, integrations, cross-cutting concerns (security, observability, error handling, configuration), constraints, and Architecture Decision Records (ADRs) with alternatives considered.
|
|
241
|
+
|
|
242
|
+
**References:** C4 Model, arc42, ADR, Clean Architecture
|
|
243
|
+
|
|
244
|
+
### MMP Generator (`/legacy-squad-generate-mmp`)
|
|
245
|
+
|
|
246
|
+
Produces the Modernization Master Plan with phase roadmap (Foundation β Core β Evolution, with optional Emergency phase when critical findings exist), stack upgrade plan, risk matrix, rollback strategy per phase, Execution Readiness Score (0-100) justified dimension by dimension, Deployability Score per phase, and success metrics across security, code quality, test coverage, and architecture.
|
|
247
|
+
|
|
248
|
+
**References:** Strangler Fig, Branch by Abstraction, Progressive Delivery
|
|
249
|
+
|
|
250
|
+
### Execution Specs Generator (`/legacy-squad-generate-specs`)
|
|
251
|
+
|
|
252
|
+
Decomposes the MMP into atomic Execution Specs β one YAML file per unit of work, each individually deployable, with binary acceptance criteria, mandatory rollback strategy, evidence traceability (compliance finding IDs + assessment references), dependency graph between specs, and explicit `human_approval_required` flag for high-risk changes.
|
|
253
|
+
|
|
254
|
+
**References:** FRAMEWORK_SPECIFICATION Section 8 (Execution Spec schema)
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Supported Stacks
|
|
259
|
+
|
|
260
|
+
### Manifest Detection (Layer 1 β deterministic)
|
|
261
|
+
|
|
262
|
+
| Manifest | Stack |
|
|
263
|
+
|----------|-------|
|
|
264
|
+
| `package.json` | Node.js, React, React Native, Expo, Next.js |
|
|
265
|
+
| `composer.json` | PHP, Laravel |
|
|
266
|
+
| `.csproj` | C#, .NET |
|
|
267
|
+
| `pom.xml` | Java, Spring Boot |
|
|
268
|
+
|
|
269
|
+
### Extension Detection (Layer 2 β heuristic)
|
|
270
|
+
|
|
271
|
+
TypeScript, JavaScript, PHP, C#, Java, Python, Dart
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Compliance Engine
|
|
276
|
+
|
|
277
|
+
The scanner automatically runs deterministic rules based on OWASP and CWE:
|
|
278
|
+
|
|
279
|
+
| Rule | Detects | Stacks | Reference |
|
|
280
|
+
|------|---------|--------|-----------|
|
|
281
|
+
| SEC-CRED-001 | Hardcoded credentials (passwords, API keys, tokens) | all | OWASP MASVS, CWE-798 |
|
|
282
|
+
| SEC-CRED-002 | Keystores/certificates committed to repository | mobile, all | OWASP MASVS, CWE-312 |
|
|
283
|
+
| SEC-SQL-001 | SQL injection (string concatenation in queries) | PHP, .NET, Java, Node | OWASP A03, CWE-89 |
|
|
284
|
+
| SEC-CRYPTO-001 | Weak cryptography (MD5, SHA1) | PHP, .NET, Java, Node | OWASP A02, CWE-327 |
|
|
285
|
+
| SEC-DESER-001 | Insecure deserialization (BinaryFormatter, `unserialize`, `readObject`) | .NET, PHP, Java | OWASP A08, CWE-502 |
|
|
286
|
+
| SEC-CMD-001 | Command injection (`exec`, `Runtime.exec`, `shell_exec` with user input) | PHP, .NET, Java, Node | OWASP A03, CWE-78 |
|
|
287
|
+
| SEC-PATH-001 | Path traversal (unvalidated file paths) | PHP, .NET, Java, Node | OWASP A01, CWE-22 |
|
|
288
|
+
| SEC-XSS-001 | XSS via unescaped output (`echo $_GET`, `Html.Raw`) | PHP, .NET | OWASP A03, CWE-79 |
|
|
289
|
+
| SEC-LOG-001 | Active `console.log` in production | JS/TS, mobile | CWE-532 |
|
|
290
|
+
| SEC-LOG-002 | PII (CPF, SSN, IDs) in logs/external services | all | CWE-532, LGPD/GDPR |
|
|
291
|
+
| SEC-ERR-001 | Empty catch blocks | all | CWE-390 |
|
|
292
|
+
| SEC-STORE-001 | Token in AsyncStorage (insecure storage) | mobile | OWASP MASVS |
|
|
293
|
+
| CQ-MIX-001 | Mixed JS and TS files (incomplete TS migration) | JS/TS | Clean Code |
|
|
294
|
+
| CQ-DEPRECATED-001 | Deprecated APIs (`mysql_*`, `ereg`, `Vector`) | PHP, Java | CVE-classified |
|
|
295
|
+
|
|
296
|
+
Every finding includes: evidence (file, line, snippet), impact, technical reference, and recommendation.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Principles
|
|
301
|
+
|
|
302
|
+
| Principle | Description |
|
|
303
|
+
|-----------|-------------|
|
|
304
|
+
| **Install-First** | One command installs everything. No manual setup. |
|
|
305
|
+
| **IDE-Native** | Agents are IDE slash commands. AI comes from the dev's environment. |
|
|
306
|
+
| **Evidence-Driven** | Every finding has concrete evidence (file, line, snippet). |
|
|
307
|
+
| **Context-First** | No LLM receives the entire repository β only context packs. |
|
|
308
|
+
| **Read-Only** | The framework does not modify code. It only reads and generates reports. |
|
|
309
|
+
| **Production-First** | Every recommendation assumes the system is in production. |
|
|
310
|
+
| **Incremental** | Every modernization step is incremental, reversible, and deployable. |
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Validated in Production
|
|
315
|
+
|
|
316
|
+
The framework was validated against a **production mobile app** (~18k lines of code, 98 dependencies, real financial transactions):
|
|
317
|
+
|
|
318
|
+
**Compliance Engine (deterministic):** 7 findings via pattern matching
|
|
319
|
+
|
|
320
|
+
**AI Agents (via Claude Code):** +43 additional findings, including:
|
|
321
|
+
- Service account credentials decoded from Base64 in source code
|
|
322
|
+
- Remote config flag capable of bypassing all authentication in production
|
|
323
|
+
- User passwords logged in plaintext to a cloud database
|
|
324
|
+
- PII used as primary key in a cloud database (enumerable)
|
|
325
|
+
- Session recording capturing sensitive data without user consent
|
|
326
|
+
- 63 business rules extracted from code (11 implicit, never documented)
|
|
327
|
+
- Potential bug in a date calculation affecting core business logic
|
|
328
|
+
|
|
329
|
+
**Generated artifacts (4 official deliverables of V1):**
|
|
330
|
+
- **PRS** β Product Refactor Specification consolidating the diagnostic
|
|
331
|
+
- **SDD** β Software Design Document with current/target architecture and 8 ADRs
|
|
332
|
+
- **MMP** β Modernization Master Plan with 4-phase roadmap (Emergency β Foundation β Core β Evolution), Execution Readiness Score 38β88/100, Deployability scores per phase, and concrete rollback strategies
|
|
333
|
+
- **37 Execution Specs** β atomic, individually deployable units of work with binary acceptance criteria, mandatory rollback, evidence traceability, and dependency graph
|
|
334
|
+
|
|
335
|
+
**Total:** 50 findings + 4 consolidated artifacts + 37 executable specs from a single `npx legacy-squad install` followed by 9 slash command activations.
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Open Core
|
|
340
|
+
|
|
341
|
+
### Community Edition (V1) β Open Source
|
|
342
|
+
|
|
343
|
+
Focus: **Understand + Plan**
|
|
344
|
+
|
|
345
|
+
- Scanner with multi-stack detection (PHP/Laravel/Symfony, .NET/ASP.NET, Java/Spring, Node, React Native/Expo)
|
|
346
|
+
- Compliance Engine with 14 deterministic rules (OWASP MASVS, ASVS, CWE Top 25)
|
|
347
|
+
- Context Manager (basic)
|
|
348
|
+
- **5 analysis agents** as slash commands: security, architecture, legacy-code, business-rules, modernization
|
|
349
|
+
- **4 artifact generators** as slash commands: PRS, SDD, MMP, Execution Specs
|
|
350
|
+
- Claude Code, Codex CLI support (Cursor / Gemini CLI on the roadmap)
|
|
351
|
+
|
|
352
|
+
### Enterprise Edition (V2) β In development
|
|
353
|
+
|
|
354
|
+
Focus: **Modernize**
|
|
355
|
+
|
|
356
|
+
- Execution Engine (AI-assisted refactoring)
|
|
357
|
+
- Pull Request Engine
|
|
358
|
+
- QA Gates
|
|
359
|
+
- CI/CD Integration
|
|
360
|
+
- Custom Rule Packs
|
|
361
|
+
- Dashboard + Team Collaboration
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Roadmap
|
|
366
|
+
|
|
367
|
+
### V1 β Discovery Platform (Community Edition) β
|
|
368
|
+
|
|
369
|
+
- [x] Scanner + Compliance Engine
|
|
370
|
+
- [x] Install command + IDE integration
|
|
371
|
+
- [x] Context Manager (basic)
|
|
372
|
+
- [x] End-to-end validation with real project (mobile, ~18k LoC)
|
|
373
|
+
- [x] Multi-stack rule catalog (PHP, .NET, Java, Node, mobile)
|
|
374
|
+
- [x] Language-agnostic agent templates (stack-aware analysis)
|
|
375
|
+
- [x] 4 official artifacts (PRS, SDD, MMP, Execution Specs)
|
|
376
|
+
|
|
377
|
+
### V1 β Continuous improvements
|
|
378
|
+
|
|
379
|
+
- [ ] Cursor + Gemini CLI support
|
|
380
|
+
- [ ] Framework-specific rule packs (Eloquent raw queries, EF Core, Hibernate HQL)
|
|
381
|
+
- [ ] AST-based scanner (current is regex-based)
|
|
382
|
+
|
|
383
|
+
### V2 β Execution Platform (Enterprise Edition) β In development
|
|
384
|
+
|
|
385
|
+
- [ ] Execution Engine (AI-assisted refactoring from Execution Specs)
|
|
386
|
+
- [ ] Pull Request Engine
|
|
387
|
+
- [ ] QA Gates
|
|
388
|
+
- [ ] CI/CD Integration
|
|
389
|
+
- [ ] Custom Rule Packs
|
|
390
|
+
- [ ] Dashboard + Team Collaboration
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## Development
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
git clone https://github.com/hrpimenta/legacy-squad.git
|
|
398
|
+
cd legacy-squad
|
|
399
|
+
pnpm install
|
|
400
|
+
pnpm approve-builds esbuild
|
|
401
|
+
|
|
402
|
+
# Tests
|
|
403
|
+
npx vitest run
|
|
404
|
+
|
|
405
|
+
# Dev mode (no build)
|
|
406
|
+
npx tsx apps/cli/src/index.ts install -p /path/to/project
|
|
407
|
+
|
|
408
|
+
# Build
|
|
409
|
+
node build.mjs
|
|
410
|
+
|
|
411
|
+
# Test bundled version
|
|
412
|
+
node dist/cli.mjs install -p /path/to/project
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### Monorepo Structure
|
|
416
|
+
|
|
417
|
+
```
|
|
418
|
+
legacy-squad/
|
|
419
|
+
βββ packages/
|
|
420
|
+
β βββ core/ # Domain types, ports (Clean Architecture)
|
|
421
|
+
β βββ scanner/ # Stack detection, repo index generation
|
|
422
|
+
β βββ context/ # Context packs builder
|
|
423
|
+
β βββ rules/ # Compliance engine, rule catalog
|
|
424
|
+
β βββ agents/ # Agent definitions, installer, doctor
|
|
425
|
+
β βββ output/ # PRS generator
|
|
426
|
+
βββ apps/
|
|
427
|
+
β βββ cli/ # CLI entry point (Commander.js)
|
|
428
|
+
βββ templates/
|
|
429
|
+
β βββ claude-commands/ # Slash command templates
|
|
430
|
+
βββ docs/
|
|
431
|
+
βββ plans/ # Architecture decisions, plans
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Tests
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
npx vitest run # 93 tests (domain, scanner, compliance, agents, installer)
|
|
438
|
+
npx vitest --watch # Watch mode
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## Contributing
|
|
444
|
+
|
|
445
|
+
1. Fork the repository
|
|
446
|
+
2. Create a branch (`git checkout -b feature/my-feature`)
|
|
447
|
+
3. Follow the standards: TDD (RedβGreenβRefactor), SOLID, Clean Architecture
|
|
448
|
+
4. Run tests (`npx vitest run`)
|
|
449
|
+
5. Open a PR
|
|
450
|
+
|
|
451
|
+
### Ways to contribute
|
|
452
|
+
|
|
453
|
+
- New rules for the Compliance Engine (PHP, .NET, Java)
|
|
454
|
+
- Agent template improvements
|
|
455
|
+
- New IDE support
|
|
456
|
+
- Documentation and translation
|
|
457
|
+
- Tests and fixtures for other stacks
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## License
|
|
462
|
+
|
|
463
|
+
MIT β see [LICENSE](LICENSE) for details.
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
<p align="center">
|
|
468
|
+
<strong>Understand. Plan. Modernize.</strong>
|
|
469
|
+
<br>
|
|
470
|
+
<em>Legacy Squad Framework</em>
|
|
471
|
+
</p>
|