@eduardbar/drift 1.2.0 → 1.4.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/.gga +50 -0
- package/.github/actions/drift-review/README.md +60 -0
- package/.github/actions/drift-review/action.yml +131 -0
- package/.github/actions/drift-scan/README.md +28 -32
- package/.github/actions/drift-scan/action.yml +78 -14
- package/.github/workflows/publish-vscode.yml +3 -3
- package/.github/workflows/publish.yml +3 -3
- package/.github/workflows/review-pr.yml +94 -9
- package/AGENTS.md +75 -245
- package/CHANGELOG.md +28 -0
- package/README.md +308 -51
- package/ROADMAP.md +6 -5
- package/dist/analyzer.d.ts +2 -2
- package/dist/analyzer.js +420 -159
- package/dist/benchmark.d.ts +2 -0
- package/dist/benchmark.js +204 -0
- package/dist/cli.js +693 -67
- package/dist/config.js +16 -2
- package/dist/diff.js +66 -10
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.js +133 -0
- package/dist/format.d.ts +17 -0
- package/dist/format.js +45 -0
- package/dist/git.js +12 -0
- package/dist/guard-types.d.ts +57 -0
- package/dist/guard-types.js +2 -0
- package/dist/guard.d.ts +14 -0
- package/dist/guard.js +239 -0
- package/dist/index.d.ts +12 -3
- package/dist/index.js +6 -1
- package/dist/init.d.ts +15 -0
- package/dist/init.js +273 -0
- package/dist/map-cycles.d.ts +2 -0
- package/dist/map-cycles.js +34 -0
- package/dist/map-svg.d.ts +19 -0
- package/dist/map-svg.js +97 -0
- package/dist/map.js +78 -138
- package/dist/metrics.js +70 -55
- package/dist/output-metadata.d.ts +13 -0
- package/dist/output-metadata.js +17 -0
- package/dist/plugins-capabilities.d.ts +4 -0
- package/dist/plugins-capabilities.js +21 -0
- package/dist/plugins-messages.d.ts +10 -0
- package/dist/plugins-messages.js +16 -0
- package/dist/plugins-rules.d.ts +9 -0
- package/dist/plugins-rules.js +137 -0
- package/dist/plugins.d.ts +2 -1
- package/dist/plugins.js +80 -28
- package/dist/printer.js +4 -0
- package/dist/reporter-constants.d.ts +16 -0
- package/dist/reporter-constants.js +39 -0
- package/dist/reporter.d.ts +3 -3
- package/dist/reporter.js +35 -55
- package/dist/review.d.ts +2 -1
- package/dist/review.js +4 -3
- package/dist/rules/comments.js +2 -2
- package/dist/rules/complexity.js +2 -7
- package/dist/rules/nesting.js +3 -13
- package/dist/rules/phase0-basic.js +10 -10
- package/dist/rules/phase3-configurable.js +23 -15
- package/dist/rules/shared.d.ts +2 -0
- package/dist/rules/shared.js +27 -3
- package/dist/saas/constants.d.ts +15 -0
- package/dist/saas/constants.js +48 -0
- package/dist/saas/dashboard.d.ts +8 -0
- package/dist/saas/dashboard.js +132 -0
- package/dist/saas/errors.d.ts +19 -0
- package/dist/saas/errors.js +37 -0
- package/dist/saas/helpers.d.ts +21 -0
- package/dist/saas/helpers.js +110 -0
- package/dist/saas/ingest.d.ts +3 -0
- package/dist/saas/ingest.js +249 -0
- package/dist/saas/organization.d.ts +5 -0
- package/dist/saas/organization.js +82 -0
- package/dist/saas/plan-change.d.ts +10 -0
- package/dist/saas/plan-change.js +15 -0
- package/dist/saas/store.d.ts +21 -0
- package/dist/saas/store.js +159 -0
- package/dist/saas/types.d.ts +191 -0
- package/dist/saas/types.js +2 -0
- package/dist/saas.d.ts +8 -82
- package/dist/saas.js +7 -320
- package/dist/sarif.d.ts +74 -0
- package/dist/sarif.js +122 -0
- package/dist/trust-advanced.d.ts +14 -0
- package/dist/trust-advanced.js +65 -0
- package/dist/trust-kpi-fs.d.ts +3 -0
- package/dist/trust-kpi-fs.js +141 -0
- package/dist/trust-kpi-parse.d.ts +7 -0
- package/dist/trust-kpi-parse.js +186 -0
- package/dist/trust-kpi-types.d.ts +16 -0
- package/dist/trust-kpi-types.js +2 -0
- package/dist/trust-kpi.d.ts +7 -0
- package/dist/trust-kpi.js +185 -0
- package/dist/trust-policy.d.ts +32 -0
- package/dist/trust-policy.js +160 -0
- package/dist/trust-render.d.ts +9 -0
- package/dist/trust-render.js +54 -0
- package/dist/trust-scoring.d.ts +9 -0
- package/dist/trust-scoring.js +208 -0
- package/dist/trust.d.ts +37 -0
- package/dist/trust.js +168 -0
- package/dist/types/app.d.ts +30 -0
- package/dist/types/app.js +2 -0
- package/dist/types/config.d.ts +25 -0
- package/dist/types/config.js +2 -0
- package/dist/types/core.d.ts +100 -0
- package/dist/types/core.js +2 -0
- package/dist/types/diff.d.ts +55 -0
- package/dist/types/diff.js +2 -0
- package/dist/types/plugin.d.ts +41 -0
- package/dist/types/plugin.js +2 -0
- package/dist/types/trust.d.ts +120 -0
- package/dist/types/trust.js +2 -0
- package/dist/types.d.ts +8 -211
- package/docs/PRD.md +187 -109
- package/docs/plugin-contract.md +61 -0
- package/docs/release-notes-draft.md +40 -0
- package/docs/rules-catalog.md +49 -0
- package/docs/trust-core-release-checklist.md +87 -0
- package/package.json +6 -3
- package/packages/vscode-drift/src/code-actions.ts +1 -1
- package/schemas/drift-ai-output.v1.json +162 -0
- package/schemas/drift-report.v1.json +151 -0
- package/schemas/drift-trust.v1.json +131 -0
- package/scripts/smoke-repo.mjs +394 -0
- package/src/analyzer.ts +484 -155
- package/src/benchmark.ts +266 -0
- package/src/cli.ts +840 -85
- package/src/config.ts +19 -2
- package/src/diff.ts +84 -10
- package/src/doctor.ts +173 -0
- package/src/format.ts +81 -0
- package/src/git.ts +16 -0
- package/src/guard-types.ts +64 -0
- package/src/guard.ts +324 -0
- package/src/index.ts +83 -0
- package/src/init.ts +298 -0
- package/src/map-cycles.ts +38 -0
- package/src/map-svg.ts +124 -0
- package/src/map.ts +111 -142
- package/src/metrics.ts +78 -59
- package/src/output-metadata.ts +30 -0
- package/src/plugins-capabilities.ts +36 -0
- package/src/plugins-messages.ts +35 -0
- package/src/plugins-rules.ts +296 -0
- package/src/plugins.ts +148 -27
- package/src/printer.ts +4 -0
- package/src/reporter-constants.ts +46 -0
- package/src/reporter.ts +64 -65
- package/src/review.ts +6 -4
- package/src/rules/comments.ts +2 -2
- package/src/rules/complexity.ts +2 -7
- package/src/rules/nesting.ts +3 -13
- package/src/rules/phase0-basic.ts +11 -12
- package/src/rules/phase3-configurable.ts +39 -26
- package/src/rules/shared.ts +31 -3
- package/src/saas/constants.ts +56 -0
- package/src/saas/dashboard.ts +172 -0
- package/src/saas/errors.ts +45 -0
- package/src/saas/helpers.ts +140 -0
- package/src/saas/ingest.ts +278 -0
- package/src/saas/organization.ts +99 -0
- package/src/saas/plan-change.ts +19 -0
- package/src/saas/store.ts +172 -0
- package/src/saas/types.ts +216 -0
- package/src/saas.ts +49 -433
- package/src/sarif.ts +232 -0
- package/src/trust-advanced.ts +99 -0
- package/src/trust-kpi-fs.ts +169 -0
- package/src/trust-kpi-parse.ts +219 -0
- package/src/trust-kpi-types.ts +19 -0
- package/src/trust-kpi.ts +210 -0
- package/src/trust-policy.ts +246 -0
- package/src/trust-render.ts +61 -0
- package/src/trust-scoring.ts +231 -0
- package/src/trust.ts +260 -0
- package/src/types/app.ts +30 -0
- package/src/types/config.ts +27 -0
- package/src/types/core.ts +105 -0
- package/src/types/diff.ts +61 -0
- package/src/types/plugin.ts +46 -0
- package/src/types/trust.ts +134 -0
- package/src/types.ts +78 -238
- package/tests/cli-sarif.test.ts +92 -0
- package/tests/diff.test.ts +124 -0
- package/tests/format.test.ts +157 -0
- package/tests/new-features.test.ts +80 -1
- package/tests/phase1-init-doctor-guard.test.ts +199 -0
- package/tests/plugins.test.ts +219 -0
- package/tests/rules.test.ts +23 -1
- package/tests/saas-foundation.test.ts +358 -1
- package/tests/sarif.test.ts +160 -0
- package/tests/trust-kpi.test.ts +147 -0
- package/tests/trust.test.ts +602 -0
package/AGENTS.md
CHANGED
|
@@ -2,288 +2,118 @@
|
|
|
2
2
|
|
|
3
3
|
## Qué es drift
|
|
4
4
|
|
|
5
|
-
`@eduardbar/drift` es un CLI
|
|
5
|
+
`@eduardbar/drift` es un CLI de auditoría estática para repos TypeScript/JavaScript orientado a deuda estructural y confianza de merge en PRs asistidas por AI.
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
Publicado en npm como `@eduardbar/drift`. MIT.
|
|
7
|
+
- Publicado en npm como `@eduardbar/drift`
|
|
8
|
+
- Licencia MIT
|
|
9
|
+
- Versión del paquete: `1.3.0` (`package.json`)
|
|
11
10
|
|
|
12
11
|
---
|
|
13
12
|
|
|
14
|
-
## Stack
|
|
13
|
+
## Stack y runtime
|
|
15
14
|
|
|
16
15
|
| Dep | Rol |
|
|
17
16
|
|-----|-----|
|
|
18
|
-
| `ts-morph ^27` |
|
|
19
|
-
| `commander ^14` | CLI
|
|
20
|
-
| `kleur ^4` |
|
|
21
|
-
| `typescript ^5.9` |
|
|
22
|
-
|
|
|
23
|
-
| `vitest ^4` | Testing |
|
|
24
|
-
|
|
25
|
-
**Runtime:** Node.js 18+, ES Modules (`"type": "module"`).
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Estructura del proyecto
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
drift/
|
|
33
|
-
├── bin/
|
|
34
|
-
│ └── drift.js ← wrapper cross-platform (Windows npx fix)
|
|
35
|
-
├── src/
|
|
36
|
-
│ ├── analyzer.ts ← motor AST + 26 reglas + drift-ignore
|
|
37
|
-
│ ├── types.ts ← interfaces: DriftIssue, FileReport, DriftReport, AIOutput
|
|
38
|
-
│ ├── reporter.ts ← buildReport(), formatMarkdown(), formatAIOutput()
|
|
39
|
-
│ ├── printer.ts ← salida consola con colores y score bar ASCII
|
|
40
|
-
│ ├── utils.ts ← scoreToGrade, severityIcon, scoreBar
|
|
41
|
-
│ ├── index.ts ← re-exports públicos (librería)
|
|
42
|
-
│ ├── cli.ts ← entry point Commander.js
|
|
43
|
-
│ ├── config.ts ← drift.config.ts support
|
|
44
|
-
│ ├── fix.ts ← drift fix command
|
|
45
|
-
│ ├── ci.ts ← drift ci command
|
|
46
|
-
│ ├── diff.ts ← drift diff command
|
|
47
|
-
│ ├── report.ts ← drift report command
|
|
48
|
-
│ ├── badge.ts ← drift badge command
|
|
49
|
-
│ ├── snapshot.ts ← drift snapshot command
|
|
50
|
-
│ ├── git.ts ← re-exports git analyzers
|
|
51
|
-
│ ├── git/
|
|
52
|
-
│ │ ├── trend.ts ← drift trend (historial de scores)
|
|
53
|
-
│ │ ├── blame.ts ← drift blame (atribución de deuda)
|
|
54
|
-
│ │ └── helpers.ts
|
|
55
|
-
│ └── rules/ ← reglas modularizadas por fase
|
|
56
|
-
│ ├── phase0-basic.ts
|
|
57
|
-
│ ├── phase1-complexity.ts
|
|
58
|
-
│ ├── phase2-crossfile.ts ← dead-file, unused-export, unused-dependency
|
|
59
|
-
│ ├── phase3-arch.ts ← circular-dependency, layer-violation
|
|
60
|
-
│ ├── phase5-ai.ts
|
|
61
|
-
│ ├── phase8-semantic.ts ← semantic-duplication
|
|
62
|
-
│ ├── complexity.ts
|
|
63
|
-
│ ├── coupling.ts
|
|
64
|
-
│ ├── nesting.ts
|
|
65
|
-
│ ├── promise.ts
|
|
66
|
-
│ ├── magic.ts
|
|
67
|
-
│ ├── comments.ts
|
|
68
|
-
│ └── shared.ts
|
|
69
|
-
├── packages/
|
|
70
|
-
│ ├── eslint-plugin-drift/ ← ESLint plugin oficial
|
|
71
|
-
│ └── vscode-drift/ ← VS Code extension
|
|
72
|
-
├── dist/ ← output tsc (no editar a mano)
|
|
73
|
-
├── assets/
|
|
74
|
-
│ ├── og.svg / og.png
|
|
75
|
-
│ ├── og-v030-linkedin.svg/png
|
|
76
|
-
│ └── og-v030-x.svg/png
|
|
77
|
-
├── .github/workflows/publish.yml
|
|
78
|
-
├── package.json
|
|
79
|
-
├── tsconfig.json
|
|
80
|
-
└── AGENTS.md ← este archivo
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Comandos de desarrollo
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npm run build # tsc — compila src/ → dist/
|
|
89
|
-
npm run dev # tsc --watch
|
|
90
|
-
npm start # node dist/cli.js (desarrollo local)
|
|
91
|
-
npm test # vitest run
|
|
92
|
-
npm run test:watch # vitest (watch mode)
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Pre-publicación:** `prepublishOnly` corre `build` automáticamente.
|
|
96
|
-
|
|
97
|
-
---
|
|
17
|
+
| `ts-morph ^27` | análisis AST |
|
|
18
|
+
| `commander ^14` | CLI y flags |
|
|
19
|
+
| `kleur ^4` | salida con color |
|
|
20
|
+
| `typescript ^5.9` | compilación |
|
|
21
|
+
| `vitest ^4` | testing |
|
|
98
22
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
| Flag | Tipo | Descripción |
|
|
102
|
-
|------|------|-------------|
|
|
103
|
-
| `scan <path>` | positional | Ruta a escanear (requerido) |
|
|
104
|
-
| `--output <file>` / `-o` | string | Escribe reporte Markdown a archivo |
|
|
105
|
-
| `--json` | boolean | Imprime `DriftReport` crudo como JSON |
|
|
106
|
-
| `--ai` | boolean | JSON optimizado para LLMs (`AIOutput`) |
|
|
107
|
-
| `--fix` | boolean | Muestra sugerencias de fix en consola |
|
|
108
|
-
| `--min-score <n>` | number | Exit code 1 si score supera umbral (CI) |
|
|
109
|
-
|
|
110
|
-
**Uso básico:**
|
|
111
|
-
```bash
|
|
112
|
-
npx @eduardbar/drift scan .
|
|
113
|
-
npx @eduardbar/drift scan ./src --min-score 60
|
|
114
|
-
npx @eduardbar/drift scan ./src --ai | pbcopy # pegar en Claude/GPT
|
|
115
|
-
npx @eduardbar/drift scan ./src --fix # ver sugerencias inline
|
|
116
|
-
npx @eduardbar/drift scan ./src -o report.md # exportar Markdown
|
|
117
|
-
```
|
|
23
|
+
Runtime: Node.js 18+, ES Modules (`"type": "module"`).
|
|
118
24
|
|
|
119
25
|
---
|
|
120
26
|
|
|
121
|
-
##
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
| `inconsistent-error-handling` | warning | 8 |
|
|
145
|
-
| `promise-style-mix` | warning | 7 |
|
|
146
|
-
| `unnecessary-abstraction` | warning | 7 |
|
|
147
|
-
| `naming-inconsistency` | warning | 6 |
|
|
148
|
-
| `unused-dependency` | warning | 6 |
|
|
149
|
-
| `no-return-type` | info | 5 |
|
|
150
|
-
| `over-commented` | info | 4 |
|
|
151
|
-
| `magic-number` | info | 3 |
|
|
152
|
-
|
|
153
|
-
**Score = suma de pesos capped a 100. Score del proyecto = promedio de archivos.**
|
|
27
|
+
## Comandos CLI actuales
|
|
28
|
+
|
|
29
|
+
Comandos top-level definidos en `src/cli.ts`:
|
|
30
|
+
|
|
31
|
+
- `scan [path]`
|
|
32
|
+
- `init`
|
|
33
|
+
- `diff [ref]`
|
|
34
|
+
- `guard [path]`
|
|
35
|
+
- `benchmark`
|
|
36
|
+
- `review`
|
|
37
|
+
- `trust [path]`
|
|
38
|
+
- `trust-gate <trustJsonFile>`
|
|
39
|
+
- `doctor`
|
|
40
|
+
- `kpi <path>`
|
|
41
|
+
- `map [path]`
|
|
42
|
+
- `report [path]`
|
|
43
|
+
- `badge [path]`
|
|
44
|
+
- `ci [path]`
|
|
45
|
+
- `trend [period]`
|
|
46
|
+
- `blame [target]`
|
|
47
|
+
- `fix [path]`
|
|
48
|
+
- `snapshot [path]`
|
|
49
|
+
- `cloud` (con subcomandos: `ingest`, `summary`, `plan-set`, `plan-changes`, `usage`, `dashboard`)
|
|
154
50
|
|
|
155
51
|
---
|
|
156
52
|
|
|
157
|
-
##
|
|
53
|
+
## Reglas y scoring (estado real)
|
|
158
54
|
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
55
|
+
- La fuente de verdad de reglas/pesos/severidad es `RULE_WEIGHTS` en `src/analyzer.ts`.
|
|
56
|
+
- Estado actual: **35 rule IDs** (incluye reglas de detección, reglas configurables, meta-reglas y diagnósticos de plugins/guardrails de análisis).
|
|
57
|
+
- Score por archivo: suma de pesos cap a 100.
|
|
58
|
+
- Score de proyecto: promedio de scores por archivo.
|
|
162
59
|
|
|
163
|
-
|
|
164
|
-
- Se coloca en las primeras 10 líneas del archivo.
|
|
165
|
-
- `analyzeFile()` devuelve reporte vacío (score 0, cero issues) para ese archivo.
|
|
166
|
-
- Usar en archivos con `console.log` intencional (ej: `printer.ts`).
|
|
60
|
+
Catálogo completo actualizado en `docs/rules-catalog.md`.
|
|
167
61
|
|
|
168
62
|
---
|
|
169
63
|
|
|
170
|
-
##
|
|
171
|
-
|
|
172
|
-
```typescript
|
|
173
|
-
interface AIOutput {
|
|
174
|
-
summary: {
|
|
175
|
-
score: number
|
|
176
|
-
grade: string // "CLEAN" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
|
|
177
|
-
total_issues: number
|
|
178
|
-
files_affected: number
|
|
179
|
-
files_clean: number
|
|
180
|
-
}
|
|
181
|
-
priority_order: Array<{
|
|
182
|
-
rank: number
|
|
183
|
-
file: string
|
|
184
|
-
line: number
|
|
185
|
-
rule: string
|
|
186
|
-
severity: "error" | "warning" | "info"
|
|
187
|
-
message: string
|
|
188
|
-
snippet: string
|
|
189
|
-
fix_suggestion: string
|
|
190
|
-
effort: "low" | "medium" | "high"
|
|
191
|
-
}>
|
|
192
|
-
context_for_ai: {
|
|
193
|
-
project_type: "typescript"
|
|
194
|
-
scan_path: string
|
|
195
|
-
rules_detected: string[]
|
|
196
|
-
recommended_action: string
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Los issues se ordenan: error > warning > info, luego low effort primero (quick wins).
|
|
64
|
+
## Configuración soportada (`drift.config.*`)
|
|
202
65
|
|
|
203
|
-
|
|
66
|
+
`DriftConfig` actual (ver `src/types/app.ts`):
|
|
204
67
|
|
|
205
|
-
|
|
68
|
+
- `layers`: capas para `layer-violation`
|
|
69
|
+
- `modules`: boundaries para `cross-boundary-import`
|
|
70
|
+
- `moduleBoundaries` / `boundaries`: alias legacy normalizados a `modules`
|
|
71
|
+
- `plugins`: plugins drift
|
|
72
|
+
- `performance`: `lowMemory`, `chunkSize`, `maxFiles`, `maxFileSizeKb`, `includeSemanticDuplication`
|
|
73
|
+
- `architectureRules`: `controllerNoDb`, `serviceNoHttp`, `maxFunctionLines`
|
|
74
|
+
- `saas`: límites/política local multi-tenant (`strictActorEnforcement` incluido)
|
|
75
|
+
- `trustGate`: políticas de gating para `trust` / `trust-gate`
|
|
206
76
|
|
|
207
|
-
|
|
208
|
-
┌──────────────────────────────────────────────────────┐
|
|
209
|
-
│ - console.log(userData)
|
|
210
|
-
│ + Remove this console.log statement
|
|
211
|
-
│ + Or replace with a proper logging library
|
|
212
|
-
└──────────────────────────────────────────────────────┘
|
|
213
|
-
```
|
|
77
|
+
Notas:
|
|
214
78
|
|
|
215
|
-
|
|
79
|
+
- Sin config, reglas puramente configurables/arquitectónicas se omiten.
|
|
80
|
+
- `exclude` y overrides tipo `rules: { ... }` **no** forman parte del contrato tipado actual de `DriftConfig`.
|
|
216
81
|
|
|
217
82
|
---
|
|
218
83
|
|
|
219
|
-
##
|
|
220
|
-
|
|
221
|
-
Workflow en `.github/workflows/publish.yml`:
|
|
222
|
-
- **Trigger único:** `release: published` (evita doble publish)
|
|
223
|
-
- **Fallback manual:** `workflow_dispatch` con input `tag`
|
|
224
|
-
- **Guard:** verifica `npm view @eduardbar/drift@$VERSION` antes de publicar
|
|
225
|
-
|
|
226
|
-
**Integración CI en proyectos externos:**
|
|
227
|
-
```yaml
|
|
228
|
-
- name: Check drift score
|
|
229
|
-
run: npx @eduardbar/drift scan ./src --min-score 60
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
## Compatibilidad Windows
|
|
235
|
-
|
|
236
|
-
`bin/drift.js` es el wrapper cross-platform:
|
|
237
|
-
```javascript
|
|
238
|
-
#!/usr/bin/env node
|
|
239
|
-
import('../dist/cli.js')
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
`package.json` apunta `bin.drift` a `bin/drift.js`, **no** a `dist/cli.js`.
|
|
243
|
-
Sin esto, Windows no ejecuta el shebang correctamente con ES modules.
|
|
244
|
-
|
|
245
|
-
---
|
|
84
|
+
## Flags transversales de recursos
|
|
246
85
|
|
|
247
|
-
|
|
86
|
+
`scan`, `diff`, `guard`, `trust`, `report`, `badge`, `ci`, `snapshot` comparten:
|
|
248
87
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
| **0.2.2** | Refactor: `formatMarkdown` dividido en helpers + fix CI doble publish |
|
|
255
|
-
| **0.2.1** | `drift-ignore` por línea y por archivo + fix console output propio |
|
|
256
|
-
| **0.2.0** | Score bar ASCII + header hierarchy + DRY utils + file count en CLI |
|
|
257
|
-
| **0.1.x** | Bootstrap: tipos, analyzer (10 reglas), reporter, printer, CLI, CI/CD |
|
|
88
|
+
- `--low-memory`
|
|
89
|
+
- `--chunk-size <n>`
|
|
90
|
+
- `--max-files <n>`
|
|
91
|
+
- `--max-file-size-kb <n>`
|
|
92
|
+
- `--with-semantic-duplication`
|
|
258
93
|
|
|
259
94
|
---
|
|
260
95
|
|
|
261
|
-
##
|
|
96
|
+
## Comandos incorporados recientes (operativos)
|
|
262
97
|
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
- **Top issues:** 51× magic-number, 2× deep-nesting, 2× catch-swallow
|
|
267
|
-
- **26 reglas activas** organizadas en fases
|
|
98
|
+
- `init`: scaffolding de `drift.config.ts`, workflow CI y baseline (`drift-baseline.json`)
|
|
99
|
+
- `doctor`: diagnóstico de entorno/proyecto (`--json` opcional)
|
|
100
|
+
- `guard`: evaluación de regresión por diff (`--base`) o baseline (`--baseline`) con `--budget` y `--by-severity`
|
|
268
101
|
|
|
269
102
|
---
|
|
270
103
|
|
|
271
|
-
## Convenciones de
|
|
104
|
+
## Convenciones de contribución (rápidas)
|
|
272
105
|
|
|
273
|
-
-
|
|
274
|
-
-
|
|
275
|
-
- Conventional Commits
|
|
276
|
-
- `// drift-ignore-file` en `printer.ts` — sus `console.log` son output intencional
|
|
277
|
-
- `scoreToGrade`, `severityIcon`, `scoreBar` viven en `utils.ts` — no duplicar
|
|
278
|
-
- Nuevas reglas: agregar entrada en `RULE_WEIGHTS` en `analyzer.ts` + lógica de detección AST
|
|
106
|
+
- Evitar drift real en el propio repo (drift se corre sobre sí mismo).
|
|
107
|
+
- Mantener README + AGENTS + catálogo de reglas sincronizados cuando cambian reglas/CLI.
|
|
108
|
+
- Usar Conventional Commits.
|
|
279
109
|
|
|
280
110
|
---
|
|
281
111
|
|
|
282
|
-
##
|
|
112
|
+
## Archivos clave
|
|
283
113
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
114
|
+
- `src/cli.ts` — contrato de comandos y flags
|
|
115
|
+
- `src/analyzer.ts` — orquestación de análisis + `RULE_WEIGHTS`
|
|
116
|
+
- `src/rules/*.ts` — detecciones por fase
|
|
117
|
+
- `src/config.ts` y `src/types/*.ts` — contrato de configuración
|
|
118
|
+
- `README.md` — documentación de uso pública
|
|
119
|
+
- `docs/rules-catalog.md` — inventario completo de reglas
|
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,34 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
18
18
|
|
|
19
19
|
## [Unreleased]
|
|
20
20
|
|
|
21
|
+
- No unreleased changes yet.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## [1.4.0] - 2026-03-18
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- `drift init`: project scaffolding command for `drift.config.ts`, optional CI workflow, and baseline generation.
|
|
30
|
+
- `drift doctor`: environment and project diagnostics command with optional JSON output.
|
|
31
|
+
- `drift guard [path]`: non-regression gate command for diff-aware (`--base`) or baseline-aware (`--baseline`) quality checks.
|
|
32
|
+
- Output schema contracts and metadata for machine-consumable outputs (v1 JSON schemas).
|
|
33
|
+
- SARIF mapper/public API and SARIF output support for `scan`, `ci`, `diff`, `review`, and `trust`.
|
|
34
|
+
- CI integration update for SARIF publishing in pull request workflows and action v2 contract alignment.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- Unified CLI output format handling around `--format` with legacy alias compatibility (`--json`, `--ai`, `--comment`, `--markdown`).
|
|
39
|
+
- `docs/rules-catalog.md` and command format matrix updated to reflect current SARIF-capable commands and 35-rule catalog.
|
|
40
|
+
|
|
41
|
+
### Tests
|
|
42
|
+
|
|
43
|
+
- Added and expanded coverage for init/doctor/guard flows and SARIF paths (`tests/phase1-init-doctor-guard.test.ts`, `tests/cli-sarif.test.ts`, `tests/sarif.test.ts`, `tests/format.test.ts`).
|
|
44
|
+
|
|
45
|
+
### Docs
|
|
46
|
+
|
|
47
|
+
- Updated trust-core and release-oriented docs to match current CLI behavior, trust artifacts, and SARIF workflow expectations.
|
|
48
|
+
|
|
21
49
|
---
|
|
22
50
|
|
|
23
51
|
## [0.9.0] - 2026-02-24
|