@eduardbar/drift 1.2.0 → 1.3.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/.github/workflows/publish-vscode.yml +3 -3
- package/.github/workflows/publish.yml +3 -3
- package/.github/workflows/review-pr.yml +98 -6
- package/AGENTS.md +6 -0
- package/README.md +160 -10
- 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 +185 -0
- package/dist/cli.js +453 -62
- package/dist/diff.js +74 -10
- package/dist/git.js +12 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -1
- package/dist/plugins.d.ts +2 -1
- package/dist/plugins.js +177 -28
- package/dist/printer.js +4 -0
- package/dist/review.js +2 -2
- 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/shared.d.ts +2 -0
- package/dist/rules/shared.js +27 -3
- package/dist/saas.d.ts +143 -7
- package/dist/saas.js +478 -37
- package/dist/trust-kpi.d.ts +9 -0
- package/dist/trust-kpi.js +445 -0
- package/dist/trust.d.ts +65 -0
- package/dist/trust.js +571 -0
- package/dist/types.d.ts +154 -0
- package/docs/PRD.md +187 -109
- package/docs/plugin-contract.md +61 -0
- package/docs/trust-core-release-checklist.md +55 -0
- package/package.json +5 -3
- package/src/analyzer.ts +484 -155
- package/src/benchmark.ts +244 -0
- package/src/cli.ts +562 -79
- package/src/diff.ts +75 -10
- package/src/git.ts +16 -0
- package/src/index.ts +48 -0
- package/src/plugins.ts +354 -26
- package/src/printer.ts +4 -0
- package/src/review.ts +2 -2
- 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/shared.ts +31 -3
- package/src/saas.ts +641 -43
- package/src/trust-kpi.ts +518 -0
- package/src/trust.ts +774 -0
- package/src/types.ts +171 -0
- package/tests/diff.test.ts +124 -0
- package/tests/new-features.test.ts +71 -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/trust-kpi.test.ts +120 -0
- package/tests/trust.test.ts +584 -0
package/dist/types.d.ts
CHANGED
|
@@ -92,6 +92,123 @@ export interface AIIssue {
|
|
|
92
92
|
fix_suggestion: string;
|
|
93
93
|
effort: 'low' | 'medium' | 'high';
|
|
94
94
|
}
|
|
95
|
+
export type MergeRiskLevel = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
|
|
96
|
+
export interface TrustGatePolicyPreset {
|
|
97
|
+
branch: string;
|
|
98
|
+
enabled?: boolean;
|
|
99
|
+
minTrust?: number;
|
|
100
|
+
maxRisk?: MergeRiskLevel;
|
|
101
|
+
}
|
|
102
|
+
export interface TrustGatePolicyPack {
|
|
103
|
+
enabled?: boolean;
|
|
104
|
+
minTrust?: number;
|
|
105
|
+
maxRisk?: MergeRiskLevel;
|
|
106
|
+
}
|
|
107
|
+
export interface TrustGatePolicyConfig {
|
|
108
|
+
enabled?: boolean;
|
|
109
|
+
minTrust?: number;
|
|
110
|
+
maxRisk?: MergeRiskLevel;
|
|
111
|
+
presets?: TrustGatePolicyPreset[];
|
|
112
|
+
policyPacks?: Record<string, TrustGatePolicyPack>;
|
|
113
|
+
}
|
|
114
|
+
export interface TrustReason {
|
|
115
|
+
label: string;
|
|
116
|
+
detail: string;
|
|
117
|
+
impact: number;
|
|
118
|
+
}
|
|
119
|
+
export interface TrustFixPriority {
|
|
120
|
+
rank: number;
|
|
121
|
+
rule: string;
|
|
122
|
+
severity: DriftIssue['severity'];
|
|
123
|
+
occurrences: number;
|
|
124
|
+
estimated_trust_gain: number;
|
|
125
|
+
effort: 'low' | 'medium' | 'high';
|
|
126
|
+
suggestion: string;
|
|
127
|
+
confidence?: 'low' | 'medium' | 'high';
|
|
128
|
+
explanation?: string;
|
|
129
|
+
systemic?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface TrustAdvancedComparison {
|
|
132
|
+
source: 'previous-trust-json' | 'snapshot-history';
|
|
133
|
+
trend: 'improving' | 'regressing' | 'stable';
|
|
134
|
+
summary: string;
|
|
135
|
+
trust_delta?: number;
|
|
136
|
+
previous_trust_score?: number;
|
|
137
|
+
previous_merge_risk?: MergeRiskLevel;
|
|
138
|
+
snapshot_score_delta?: number;
|
|
139
|
+
snapshot_label?: string;
|
|
140
|
+
snapshot_timestamp?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface TrustAdvancedContext {
|
|
143
|
+
comparison?: TrustAdvancedComparison;
|
|
144
|
+
team_guidance: string[];
|
|
145
|
+
}
|
|
146
|
+
export interface TrustDiffContext {
|
|
147
|
+
baseRef: string;
|
|
148
|
+
status: 'improved' | 'regressed' | 'neutral';
|
|
149
|
+
scoreDelta: number;
|
|
150
|
+
newIssues: number;
|
|
151
|
+
resolvedIssues: number;
|
|
152
|
+
filesChanged: number;
|
|
153
|
+
penalty: number;
|
|
154
|
+
bonus: number;
|
|
155
|
+
netImpact: number;
|
|
156
|
+
}
|
|
157
|
+
export interface DriftTrustReport {
|
|
158
|
+
scannedAt: string;
|
|
159
|
+
targetPath: string;
|
|
160
|
+
trust_score: number;
|
|
161
|
+
merge_risk: MergeRiskLevel;
|
|
162
|
+
top_reasons: TrustReason[];
|
|
163
|
+
fix_priorities: TrustFixPriority[];
|
|
164
|
+
diff_context?: TrustDiffContext;
|
|
165
|
+
advanced_context?: TrustAdvancedContext;
|
|
166
|
+
}
|
|
167
|
+
export interface TrustKpiDiagnostic {
|
|
168
|
+
level: 'warning' | 'error';
|
|
169
|
+
code: 'path-not-found' | 'path-not-supported' | 'read-failed' | 'parse-failed' | 'invalid-shape' | 'invalid-diff-context';
|
|
170
|
+
message: string;
|
|
171
|
+
file?: string;
|
|
172
|
+
}
|
|
173
|
+
export interface TrustScoreStats {
|
|
174
|
+
average: number | null;
|
|
175
|
+
median: number | null;
|
|
176
|
+
min: number | null;
|
|
177
|
+
max: number | null;
|
|
178
|
+
}
|
|
179
|
+
export interface TrustDiffTrendSummary {
|
|
180
|
+
available: boolean;
|
|
181
|
+
samples: number;
|
|
182
|
+
statusDistribution: {
|
|
183
|
+
improved: number;
|
|
184
|
+
regressed: number;
|
|
185
|
+
neutral: number;
|
|
186
|
+
};
|
|
187
|
+
scoreDelta: {
|
|
188
|
+
average: number | null;
|
|
189
|
+
median: number | null;
|
|
190
|
+
};
|
|
191
|
+
issues: {
|
|
192
|
+
newTotal: number;
|
|
193
|
+
resolvedTotal: number;
|
|
194
|
+
netNew: number;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export interface TrustKpiReport {
|
|
198
|
+
generatedAt: string;
|
|
199
|
+
input: string;
|
|
200
|
+
files: {
|
|
201
|
+
matched: number;
|
|
202
|
+
parsed: number;
|
|
203
|
+
malformed: number;
|
|
204
|
+
};
|
|
205
|
+
prsEvaluated: number;
|
|
206
|
+
mergeRiskDistribution: Record<MergeRiskLevel, number>;
|
|
207
|
+
trustScore: TrustScoreStats;
|
|
208
|
+
highRiskRatio: number | null;
|
|
209
|
+
diffTrend: TrustDiffTrendSummary;
|
|
210
|
+
diagnostics: TrustKpiDiagnostic[];
|
|
211
|
+
}
|
|
95
212
|
/**
|
|
96
213
|
* Layer definition for architectural boundary enforcement.
|
|
97
214
|
*/
|
|
@@ -116,6 +233,7 @@ export interface DriftConfig {
|
|
|
116
233
|
layers?: LayerDefinition[];
|
|
117
234
|
modules?: ModuleBoundary[];
|
|
118
235
|
plugins?: string[];
|
|
236
|
+
performance?: DriftPerformanceConfig;
|
|
119
237
|
architectureRules?: {
|
|
120
238
|
controllerNoDb?: boolean;
|
|
121
239
|
serviceNoHttp?: boolean;
|
|
@@ -126,7 +244,29 @@ export interface DriftConfig {
|
|
|
126
244
|
maxRunsPerWorkspacePerMonth?: number;
|
|
127
245
|
maxReposPerWorkspace?: number;
|
|
128
246
|
retentionDays?: number;
|
|
247
|
+
strictActorEnforcement?: boolean;
|
|
248
|
+
maxWorkspacesPerOrganizationByPlan?: {
|
|
249
|
+
free?: number;
|
|
250
|
+
sponsor?: number;
|
|
251
|
+
team?: number;
|
|
252
|
+
business?: number;
|
|
253
|
+
};
|
|
129
254
|
};
|
|
255
|
+
trustGate?: TrustGatePolicyConfig;
|
|
256
|
+
}
|
|
257
|
+
export interface DriftPerformanceConfig {
|
|
258
|
+
lowMemory?: boolean;
|
|
259
|
+
chunkSize?: number;
|
|
260
|
+
maxFiles?: number;
|
|
261
|
+
maxFileSizeKb?: number;
|
|
262
|
+
includeSemanticDuplication?: boolean;
|
|
263
|
+
}
|
|
264
|
+
export interface DriftAnalysisOptions {
|
|
265
|
+
lowMemory?: boolean;
|
|
266
|
+
chunkSize?: number;
|
|
267
|
+
maxFiles?: number;
|
|
268
|
+
maxFileSizeKb?: number;
|
|
269
|
+
includeSemanticDuplication?: boolean;
|
|
130
270
|
}
|
|
131
271
|
export interface PluginRuleContext {
|
|
132
272
|
projectRoot: string;
|
|
@@ -134,13 +274,17 @@ export interface PluginRuleContext {
|
|
|
134
274
|
config?: DriftConfig;
|
|
135
275
|
}
|
|
136
276
|
export interface DriftPluginRule {
|
|
277
|
+
id?: string;
|
|
137
278
|
name: string;
|
|
138
279
|
severity?: DriftIssue['severity'];
|
|
139
280
|
weight?: number;
|
|
140
281
|
detect: (file: SourceFile, context: PluginRuleContext) => DriftIssue[];
|
|
282
|
+
fix?: (issue: DriftIssue, file: SourceFile, context: PluginRuleContext) => DriftIssue | void;
|
|
141
283
|
}
|
|
142
284
|
export interface DriftPlugin {
|
|
143
285
|
name: string;
|
|
286
|
+
apiVersion?: number;
|
|
287
|
+
capabilities?: Record<string, string | number | boolean>;
|
|
144
288
|
rules: DriftPluginRule[];
|
|
145
289
|
}
|
|
146
290
|
export interface LoadedPlugin {
|
|
@@ -149,6 +293,16 @@ export interface LoadedPlugin {
|
|
|
149
293
|
}
|
|
150
294
|
export interface PluginLoadError {
|
|
151
295
|
pluginId: string;
|
|
296
|
+
pluginName?: string;
|
|
297
|
+
ruleId?: string;
|
|
298
|
+
code?: string;
|
|
299
|
+
message: string;
|
|
300
|
+
}
|
|
301
|
+
export interface PluginLoadWarning {
|
|
302
|
+
pluginId: string;
|
|
303
|
+
pluginName?: string;
|
|
304
|
+
ruleId?: string;
|
|
305
|
+
code?: string;
|
|
152
306
|
message: string;
|
|
153
307
|
}
|
|
154
308
|
export interface FileDiff {
|
package/docs/PRD.md
CHANGED
|
@@ -1,157 +1,235 @@
|
|
|
1
1
|
# PRD - drift
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Estado: Activo
|
|
5
|
-
Producto: `@eduardbar/drift`
|
|
3
|
+
> **AI Code Audit CLI para recuperar confianza de merge en PRs asistidos por IA.**
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
**Version del PRD**: 1.3.0-scope-refresh
|
|
6
|
+
**Version de producto vigente**: 1.2.0
|
|
7
|
+
**Estado**: Activo
|
|
8
|
+
**Producto**: `@eduardbar/drift`
|
|
9
|
+
**Owner**: Eduardo Barba
|
|
10
|
+
**Fecha**: 2026-03-15
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
---
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
## 1. Contexto y problema
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
El uso de IA para programar acelera entregas, pero tambien aumenta ruido tecnico en Pull Requests: cambios grandes, deuda encubierta, reglas de arquitectura rotas y riesgo de merge dificil de evaluar rapido.
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
Hoy muchos equipos hacen review "a ojo" o dependen de checks incompletos. Resultado: se mergea codigo con riesgo real porque falta una senial consolidada y accionable para decidir si un PR esta listo.
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
Drift se reposiciona para cerrar ese gap: pasar de "scanner de deuda" a "decision engine de confianza de merge" para repos TypeScript/JavaScript con flujo local y CI.
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
---
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
## 2. Reposicionamiento de producto
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
### 2.1 Nueva tesis
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
`drift` es un **AI Code Audit CLI** orientado a responder una pregunta critica antes de mergear:
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
- `drift map` basico para generar `architecture.svg`.
|
|
29
|
-
- Senial de IA en salida (`ai_likelihood` y `files_suspected`).
|
|
30
|
-
- Reglas de arquitectura configurables via `drift.config.ts`.
|
|
31
|
-
- Score y breakdown por dimensiones para lectura ejecutiva y tecnica.
|
|
32
|
-
- Metricas de maintenance risk/hotspots.
|
|
33
|
-
- Plugin system MVP (`drift-plugin-*`) con aislamiento de errores.
|
|
34
|
-
- `drift fix` con modos preview/write.
|
|
35
|
-
- Workflow CI para comentario automatico unico y actualizable de `drift review`.
|
|
36
|
-
- `drift map` con marcado de cycle edges y layer violations en el SVG.
|
|
37
|
-
- VSCode quick actions para fixes de bajo riesgo.
|
|
38
|
-
- Confirmacion interactiva para `drift fix --write` (con `--yes` para CI/no-interactive).
|
|
39
|
-
- `drift report` HTML (`drift-report.html`) sin flag extra.
|
|
40
|
-
- Documentacion y tests del release.
|
|
30
|
+
**"Este PR asistido por IA es confiable para merge?"**
|
|
41
31
|
|
|
42
|
-
###
|
|
32
|
+
### 2.2 North Star de posicionamiento
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
Mover el foco de "contar smells" a "reducir riesgo de merge" con una salida resumida, priorizada y utilizable por developers, reviewers y tech leads.
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
---
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
- Evolucion del dashboard SaaS foundations a experiencia multi-tenant full (auth, permisos por rol y billing activo post-umbral).
|
|
38
|
+
## 3. Que NO es y que SI es Drift
|
|
50
39
|
|
|
51
|
-
|
|
40
|
+
| Categoria | Definicion |
|
|
41
|
+
|---|---|
|
|
42
|
+
| No es | Un code generator ni un copiloto para escribir features |
|
|
43
|
+
| No es | Un SaaS dependiente de backend propio para funcionar |
|
|
44
|
+
| No es | Un reemplazo completo de code review humano |
|
|
45
|
+
| No es | Un quality gate magico multi-lenguaje full stack |
|
|
46
|
+
| Si es | Un CLI local/CI de auditoria tecnica para codigo TypeScript/JavaScript |
|
|
47
|
+
| Si es | Un sistema de scoring y priorizacion de deuda con foco en riesgo de merge |
|
|
48
|
+
| Si es | Una herramienta para PRs asistidos por IA con salida accionable |
|
|
49
|
+
| Si es | Un producto operable sin infraestructura propietaria (user-run) |
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
---
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
- `drift scan --ai` incluye `ai_likelihood` y ranking `files_suspected`.
|
|
57
|
-
- `drift map <path>` genera `architecture.svg` utilizable sin edicion manual.
|
|
58
|
-
- `drift report [path]` genera HTML self-contained (no requiere `--html`).
|
|
59
|
-
- `drift fix --preview` muestra antes/despues y `drift fix --write` aplica reglas soportadas.
|
|
53
|
+
## 4. Estado real del producto (v1.2.0)
|
|
60
54
|
|
|
61
|
-
###
|
|
55
|
+
### 4.1 Capacidades entregadas y activas
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
| Area | Estado | Capacidades vigentes |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| Analisis AST y scoring | Entregado | Reglas de drift, score por archivo/repositorio, salida CLI/JSON/AI |
|
|
60
|
+
| PR review | Entregado | `drift review` con diff vs base, markdown para PR, delta de issues |
|
|
61
|
+
| Arquitectura | Entregado | `drift map` con `architecture.svg`, cycle edges, layer violations |
|
|
62
|
+
| Fixes | Entregado | `drift fix --preview` y `drift fix --write` con confirmacion (`--yes` para CI) |
|
|
63
|
+
| Reporteria | Entregado | `drift report` HTML self-contained |
|
|
64
|
+
| CI | Entregado | Workflow para comentario unico y actualizable en PR |
|
|
65
|
+
| Editor | Entregado | VSCode quick actions para fixes de bajo riesgo |
|
|
66
|
+
| Extensibilidad | MVP entregado | Plugin system `drift-plugin-*` con aislamiento de errores |
|
|
67
|
+
| Foundations cloud-like | Entregado (base) | `drift cloud ingest|summary|dashboard`, politica free-until-7500 en PRD |
|
|
67
68
|
|
|
68
|
-
###
|
|
69
|
+
### 4.2 Abiertos actuales
|
|
69
70
|
|
|
70
|
-
- Hardening del contrato de plugins para
|
|
71
|
+
- Hardening del contrato de plugins para ecosistema externo de largo plazo.
|
|
72
|
+
- Evolucion de foundations cloud-like hacia experiencia multi-tenant completa (auth, roles, billing) cuando corresponda.
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
Nota: este PRD no declara como implementado nada fuera de las capacidades ya reflejadas en v1.2.0.
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
---
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
- CLI de review para PR, mapa basico, salida AI, reglas configurables, report HTML, fix preview/write, hotspots, plugin MVP.
|
|
78
|
+
## 5. Feature estrella: `drift trust`
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
- Features documentadas.
|
|
81
|
-
- Tests de paths principales.
|
|
82
|
-
- Salidas CLI/JSON/AI consistentes para uso local y CI.
|
|
80
|
+
### 5.1 Objetivo
|
|
83
81
|
|
|
84
|
-
|
|
82
|
+
Introducir `drift trust` como salida de alto nivel para decision de merge en PRs asistidos por IA.
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
- Comentario automatico actualizable en PR desde workflow CI.
|
|
88
|
-
- Mejora de `drift map` para destacar ciclos y violaciones.
|
|
89
|
-
- UX de seguridad para `drift fix --write` con confirmacion interactiva.
|
|
84
|
+
### 5.2 Output conceptual esperado
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
- Flujo CI reproducible con comentario unico por PR.
|
|
93
|
-
- Visualizaciones verificables en SVG sobre repos medianos.
|
|
94
|
-
- Confirmacion interactiva implementada para write mode.
|
|
86
|
+
`drift trust` debe sintetizar en un bloque corto y accionable:
|
|
95
87
|
|
|
96
|
-
|
|
88
|
+
| Campo | Proposito |
|
|
89
|
+
|---|---|
|
|
90
|
+
| Trust Score | Puntaje de confianza de merge (0-100) |
|
|
91
|
+
| Merge Risk | Clasificacion de riesgo (`LOW`, `MEDIUM`, `HIGH`, `CRITICAL`) |
|
|
92
|
+
| Top Reasons | Principales razones que explican el riesgo |
|
|
93
|
+
| Fix Priorities | Orden recomendado de correcciones para bajar riesgo rapido |
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
- Consolidacion de API de plugins y hardening de compatibilidad.
|
|
100
|
-
- Reglas de plugin versionadas y validacion de contrato avanzada.
|
|
95
|
+
### 5.3 Alcance funcional del feature
|
|
101
96
|
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
97
|
+
- Usa seniales ya existentes en Drift (reglas, severidad, diff, arquitectura, hotspots) para componer una conclusion ejecutiva.
|
|
98
|
+
- Prioriza interpretabilidad: cada resultado debe explicar por que sube/baja la confianza.
|
|
99
|
+
- Se diseña para uso local y CI sin requerir servicio central.
|
|
105
100
|
|
|
106
|
-
|
|
101
|
+
Importante: en este documento, `drift trust` se define como **scope de producto**; su implementacion tecnica se planifica por etapas.
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
- Base de datos local de snapshots para cloud MVP.
|
|
110
|
-
- Ingestion de reportes en storage local SaaS-like.
|
|
111
|
-
- Summary de uso/threshold y dashboard HTML inicial.
|
|
112
|
-
- Guardrails de fase gratuita por workspace + politica free-until-7500.
|
|
103
|
+
---
|
|
113
104
|
|
|
114
|
-
|
|
115
|
-
- Auth real multi-tenant, permisos por equipo y backend remoto persistente.
|
|
116
|
-
- Activacion de billing cuando el umbral de 7.500 usuarios se cumpla.
|
|
105
|
+
## 6. Scope de producto: Core vs Premium
|
|
117
106
|
|
|
118
|
-
|
|
107
|
+
### 6.1 Drift Core (base abierta y utilizable)
|
|
119
108
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- Feature flags de pricing listas antes del trigger para evitar corte abrupto.
|
|
109
|
+
| Incluido en Core | Notas |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `scan`, `review`, `fix`, `report`, `map`, `ci`, `diff`, `snapshot`, `trend`, `blame` | Mantiene propuesta actual de CLI tecnico |
|
|
112
|
+
| Reglas de drift y score base | Incluye salida JSON/AI para automatizacion |
|
|
113
|
+
| `drift trust` baseline | Trust Score + Merge Risk + Top Reasons + Fix Priorities en modo esencial |
|
|
114
|
+
| Uso local + CI en runners del usuario | Sin infraestructura Drift obligatoria |
|
|
127
115
|
|
|
128
|
-
|
|
116
|
+
### 6.2 Drift Premium (valor para equipos)
|
|
129
117
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
118
|
+
| Incluido en Premium | Propuesta de valor |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `drift trust` avanzado | Mayor contexto historico, comparativas y guidance de remediacion de equipo |
|
|
121
|
+
| Policy packs y controles por equipo | Gates y criterios de merge mas finos |
|
|
122
|
+
| Reportes ejecutivos extendidos | Vistas para liderazgo tecnico y seguimiento de riesgo |
|
|
123
|
+
| Soporte y prioridad | Respuesta mas rapida y acompanamiento de adopcion |
|
|
133
124
|
|
|
134
|
-
|
|
125
|
+
Nota: Premium define direccion comercial; la activacion concreta depende del roadmap de producto y capacidad operativa.
|
|
135
126
|
|
|
136
|
-
|
|
137
|
-
- % de PRs con feedback drift resuelto antes de merge.
|
|
138
|
-
- Tiempo medio desde deteccion hasta fix aplicado.
|
|
139
|
-
- Adopcion de reglas de arquitectura configurables por equipo.
|
|
127
|
+
---
|
|
140
128
|
|
|
141
|
-
##
|
|
129
|
+
## 7. Pricing inicial y propuesta comercial
|
|
142
130
|
|
|
143
|
-
|
|
144
|
-
- Calidad de senial en `ai_likelihood` (falsos positivos/negativos).
|
|
145
|
-
- Variabilidad de entornos CI para publicar comentarios de PR.
|
|
146
|
-
- Evolucion de API de plugins sin romper backward compatibility.
|
|
131
|
+
### 7.1 Planes
|
|
147
132
|
|
|
148
|
-
|
|
133
|
+
| Plan | Precio | Publico objetivo | Valor principal |
|
|
134
|
+
|---|---:|---|---|
|
|
135
|
+
| Free | USD 0 (forever) | Developers individuales + open source | Analisis local ilimitado, output accionable y adopcion sin friccion |
|
|
136
|
+
| Sponsor | USD 8/mes o USD 80/anio | Fans, freelancers y power users | Apoyo al proyecto + rule packs premium ligeros + early access |
|
|
137
|
+
| Team | USD 39/mes por org o USD 390/anio | Equipos pequenos/medianos | Gobernanza inicial: policies, thresholds por branch y suppressions por regla |
|
|
138
|
+
| Business | USD 149/mes por org o USD 1490/anio | Equipos con mayor exigencia | Governance/compliance avanzado, custom rules y soporte prioritario |
|
|
149
139
|
|
|
150
|
-
|
|
140
|
+
### 7.2 Hipotesis de monetizacion
|
|
151
141
|
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
- Inicio con **GitHub Sponsors** como canal principal de conversion (Sponsor plan).
|
|
143
|
+
- Validar willingness-to-pay antes de escalar complejidad comercial.
|
|
144
|
+
- Evolucionar hacia Team/Business conforme se consolide `drift trust` y demanda de gobierno por equipo.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 8. Estrategia operativa (sin infraestructura propia)
|
|
149
|
+
|
|
150
|
+
### 8.1 Principios
|
|
151
|
+
|
|
152
|
+
- Drift corre donde ya corre el codigo: laptop del developer, CI existente, runners del usuario.
|
|
153
|
+
- No se requiere backend propietario para la propuesta principal de valor.
|
|
154
|
+
- Costos operativos iniciales bajos para maximizar foco en producto y distribucion.
|
|
155
|
+
|
|
156
|
+
### 8.2 Modelo operativo
|
|
157
|
+
|
|
158
|
+
| Dimension | Decision |
|
|
159
|
+
|---|---|
|
|
160
|
+
| Compute | Local/CI del usuario |
|
|
161
|
+
| Storage | Artefactos y reportes en entorno del usuario |
|
|
162
|
+
| Integracion | CLI + GitHub Actions + outputs markdown/JSON/AI |
|
|
163
|
+
| Monetizacion inicial | GitHub Sponsors + futura oferta Team/Business |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 9. Launch strategy por etapas
|
|
168
|
+
|
|
169
|
+
### Etapa 1 - Reposicionamiento y mensaje (inmediato)
|
|
170
|
+
|
|
171
|
+
- Actualizar narrativa publica: de "deuda tecnica IA" a "merge trust para PRs asistidos por IA".
|
|
172
|
+
- Publicar docs y ejemplos orientados a decision de merge.
|
|
173
|
+
- CTA principal: probar `drift review` y futura experiencia `drift trust`.
|
|
174
|
+
|
|
175
|
+
### Etapa 2 - `drift trust` baseline (producto)
|
|
176
|
+
|
|
177
|
+
- Entregar salida conceptual en CLI/CI con Trust Score, Merge Risk, Top Reasons, Fix Priorities.
|
|
178
|
+
- Incorporar senales de diff/PR de forma deterministica (`--base`) y salida markdown lista para comentarios de PR.
|
|
179
|
+
- Medir adopcion en PR workflows y feedback de interpretabilidad.
|
|
180
|
+
- Ajustar pesos/heuristicas con evidencia de uso real.
|
|
181
|
+
|
|
182
|
+
### Etapa 3 - Conversion y expansion
|
|
183
|
+
|
|
184
|
+
- Activar perks para Sponsor y clarificar diferencia Core vs Premium.
|
|
185
|
+
- Formalizar Team plan con policies y reportes de riesgo compartidos.
|
|
186
|
+
- Preparar oferta Business para cuentas con necesidad de governance.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 10. Positioning copy (taglines y one-liners)
|
|
191
|
+
|
|
192
|
+
### 10.1 Taglines
|
|
193
|
+
|
|
194
|
+
- "Merge con confianza, incluso cuando el PR vino asistido por IA."
|
|
195
|
+
- "Tu AI Code Audit CLI para decidir merge sin adivinar."
|
|
196
|
+
- "Menos ruido de PR, mas confianza de release."
|
|
197
|
+
|
|
198
|
+
### 10.2 One-liners
|
|
199
|
+
|
|
200
|
+
- "Drift convierte senales tecnicas de un PR en una decision clara de merge risk."
|
|
201
|
+
- "Deuda tecnica IA detectada, priorizada y traducida a acciones concretas antes de mergear."
|
|
202
|
+
- "TypeScript AI audit en local y CI, sin depender de infraestructura externa."
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## 11. KPIs y metricas de exito
|
|
207
|
+
|
|
208
|
+
| KPI | Objetivo |
|
|
209
|
+
|---|---|
|
|
210
|
+
| % de PRs evaluados con senial de confianza | Medir adopcion de flujo `review/trust` |
|
|
211
|
+
| Reduccion de issues de alto riesgo antes de merge | Medir impacto real en calidad |
|
|
212
|
+
| Tiempo desde deteccion a fix | Medir accionabilidad de la salida |
|
|
213
|
+
| Conversion a Sponsor/Team | Validar monetizacion temprana |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 12. Riesgos y mitigaciones
|
|
218
|
+
|
|
219
|
+
| Riesgo | Mitigacion |
|
|
220
|
+
|---|---|
|
|
221
|
+
| Falsos positivos en senal de riesgo | Transparencia en Top Reasons + ajuste iterativo de reglas/pesos |
|
|
222
|
+
| Confusion entre "auditoria" y "autofix magico" | Mensaje explicito de que Drift no reemplaza revision humana |
|
|
223
|
+
| Presion por features enterprise tempranas | Enfoque por etapas: Sponsors primero, Team/Business luego |
|
|
224
|
+
| Variabilidad de entornos CI | Mantener salida portable y documentar integraciones recomendadas |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## 13. Definition of Done para este refresh de scope
|
|
229
|
+
|
|
230
|
+
- PRD unificado con posicionamiento "AI Code Audit CLI".
|
|
231
|
+
- `drift trust` definido como feature estrella con output conceptual completo.
|
|
232
|
+
- Delimitacion explicita de que Drift es/no es.
|
|
233
|
+
- Pricing y Core vs Premium documentados de forma consistente.
|
|
234
|
+
- Estrategia operativa sin infraestructura propia y monetizacion via Sponsors declaradas.
|
|
235
|
+
- Launch strategy por etapas y copy de posicionamiento incluidos.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Drift Plugin Contract (v2)
|
|
2
|
+
|
|
3
|
+
This document defines the external plugin contract for `@eduardbar/drift`.
|
|
4
|
+
|
|
5
|
+
## Minimal plugin shape
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
module.exports = {
|
|
9
|
+
name: 'my-plugin',
|
|
10
|
+
apiVersion: 1,
|
|
11
|
+
capabilities: {
|
|
12
|
+
fixes: true,
|
|
13
|
+
tags: 'security',
|
|
14
|
+
},
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
id: 'no-debug-leftovers',
|
|
18
|
+
severity: 'warning',
|
|
19
|
+
weight: 8,
|
|
20
|
+
detect(file, context) {
|
|
21
|
+
return []
|
|
22
|
+
},
|
|
23
|
+
fix(issue, file, context) {
|
|
24
|
+
return issue
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Contract rules
|
|
32
|
+
|
|
33
|
+
- `name`: required non-empty string.
|
|
34
|
+
- `apiVersion`: recommended and currently supported value is `1`.
|
|
35
|
+
- `capabilities`: optional object map with primitive values (`string | number | boolean`).
|
|
36
|
+
- `rules`: required array with at least one valid rule.
|
|
37
|
+
- Rule `id` (or legacy `name` fallback):
|
|
38
|
+
- for `apiVersion: 1` must match `^[a-z][a-z0-9]*(?:[-_/][a-z0-9]+)*$`
|
|
39
|
+
- must be unique within the plugin.
|
|
40
|
+
- `detect(file, context)`: required function returning `DriftIssue[]`.
|
|
41
|
+
|
|
42
|
+
## Legacy compatibility
|
|
43
|
+
|
|
44
|
+
- Plugins without `apiVersion` still load for backward compatibility.
|
|
45
|
+
- Drift emits warning code `plugin-api-version-implicit` and assumes compatibility mode.
|
|
46
|
+
- In compatibility mode, non-standard rule IDs are warnings (`plugin-rule-id-format-legacy`) instead of hard errors.
|
|
47
|
+
|
|
48
|
+
## Failure isolation
|
|
49
|
+
|
|
50
|
+
- Invalid plugin contracts are skipped and reported as diagnostics.
|
|
51
|
+
- Runtime errors thrown by one plugin rule are isolated to that rule; scan continues for other rules/files.
|
|
52
|
+
|
|
53
|
+
## Common diagnostic codes
|
|
54
|
+
|
|
55
|
+
- `plugin-api-version-implicit`: missing `apiVersion`; plugin loaded in legacy mode.
|
|
56
|
+
- `plugin-api-version-invalid`: `apiVersion` is not a positive integer.
|
|
57
|
+
- `plugin-api-version-unsupported`: plugin version is not supported by current drift runtime.
|
|
58
|
+
- `plugin-rule-id-invalid`: rule ID format invalid for explicit API version.
|
|
59
|
+
- `plugin-rule-id-duplicate`: duplicate rule ID inside the same plugin.
|
|
60
|
+
- `plugin-capabilities-invalid`: `capabilities` is not an object.
|
|
61
|
+
- `plugin-capabilities-value-invalid`: capability value is not a primitive.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Trust Core Tonight - Release Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist before releasing the trust-core milestone.
|
|
4
|
+
|
|
5
|
+
## 1) Local validation
|
|
6
|
+
|
|
7
|
+
- [x] `npm ci`
|
|
8
|
+
- [x] `npm test`
|
|
9
|
+
- [x] `npx --no-install tsx ./src/cli.ts trust . --base origin/master --markdown`
|
|
10
|
+
- [x] `npx --no-install tsx ./src/cli.ts trust . --base origin/master --json-output drift-trust.json`
|
|
11
|
+
- [x] `npx --no-install tsx ./src/cli.ts trust-gate drift-trust.json --min-trust 40 --max-risk HIGH`
|
|
12
|
+
- [x] `npx --no-install tsx ./src/cli.ts review --base origin/master --comment`
|
|
13
|
+
|
|
14
|
+
## 2) CI workflow validation
|
|
15
|
+
|
|
16
|
+
- [x] Open or update a non-fork PR and confirm `.github/workflows/review-pr.yml` runs successfully.
|
|
17
|
+
- [x] Confirm sticky PR comment is updated once (marker: `<!-- drift-review -->`).
|
|
18
|
+
- [x] Confirm PR comment includes both sections in this order: `drift trust` then `drift review`.
|
|
19
|
+
- [x] E2E: `trust-gate` runs from generated `drift-trust.json` in `review-pr` workflow.
|
|
20
|
+
- [x] E2E: `kpi` aggregates over generated trust JSON artifact (`drift-trust-kpi.json`).
|
|
21
|
+
- [x] E2E: `drift-trust-json-pr-<PR_NUMBER>-run-<RUN_ATTEMPT>` artifact now bundles:
|
|
22
|
+
- `drift-trust.json`
|
|
23
|
+
- `drift-trust-gate.txt`
|
|
24
|
+
- `drift-trust-kpi.json`
|
|
25
|
+
- [x] Confirm step summary shows trust KPI values: trust score, merge risk, new issues, resolved issues.
|
|
26
|
+
- [x] E2E: step summary includes aggregate KPI block (matched/parsed/malformed, PR samples, avg trust, high-risk ratio).
|
|
27
|
+
|
|
28
|
+
Smoke PR runbook:
|
|
29
|
+
|
|
30
|
+
- [x] Create a short-lived branch (for example `chore/trust-ci-smoke`) with a docs-only change.
|
|
31
|
+
- [x] Open a PR against `master` and wait for `review-pr` workflow to complete.
|
|
32
|
+
- [x] Verify gate behavior and comment rendering, then close or merge the PR.
|
|
33
|
+
- [x] Delete the short-lived branch after validation.
|
|
34
|
+
|
|
35
|
+
## 3) Gate behavior acceptance
|
|
36
|
+
|
|
37
|
+
Default trust gate for this milestone:
|
|
38
|
+
|
|
39
|
+
- `--min-trust 40`
|
|
40
|
+
- `--max-risk HIGH`
|
|
41
|
+
|
|
42
|
+
Checks:
|
|
43
|
+
|
|
44
|
+
- [x] PR fails when trust score is below 40.
|
|
45
|
+
- [x] PR fails when merge risk is `CRITICAL`.
|
|
46
|
+
- [x] PR passes when trust score is 40+ and merge risk is `LOW`, `MEDIUM`, or `HIGH`.
|
|
47
|
+
|
|
48
|
+
Calibration evidence from docs-only smoke runs: trust score 49 (PR #11), 46 (PR #12), 41 (PR #13). Gate floor set to 40 to avoid false negatives while still blocking `CRITICAL` risk.
|
|
49
|
+
|
|
50
|
+
## 4) Narrative and docs acceptance
|
|
51
|
+
|
|
52
|
+
- [x] `README.md` positions drift as an AI Code Audit CLI for merge trust in AI-assisted PRs.
|
|
53
|
+
- [x] `package.json` description matches the same positioning.
|
|
54
|
+
- [x] `src/cli.ts` program description matches the same positioning.
|
|
55
|
+
- [x] `ROADMAP.md` no longer contradicts PRD on core vs premium direction.
|