@alimaandev/ripple 0.5.0 → 0.6.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/README.md CHANGED
@@ -69,19 +69,22 @@ Just deterministic analysis against the code you actually have.
69
69
 
70
70
  ## Features
71
71
 
72
- | Feature | What it does |
73
- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------- |
74
- | **Impact analysis** | Reverse dependency traversal, transitively, with depth caps. Know who imports a target file. |
75
- | **Risk scoring** | A transparent 0–100 score from seven weighted signals, with a per-factor breakdown in `--verbose`. |
76
- | **Cycle detection** | Strongly-connected components with a concrete cycle path — `a → c → b → a`, not just a list of names. |
77
- | **Alias & path support** | tsconfig `paths` and custom aliases like `{ "@": "./src" }`, including single-wildcard patterns. |
78
- | **Real-world resolution** | Extension probing, index files, `.js` → `.ts` rewriting, dynamic `import()`, `require()`, `export … from`. |
79
- | **Categorized results** | Routes, layouts, components, utilities, and tests detected by path conventions — not a raw string of file names. |
80
- | **Entry-point intelligence** | `package.json` `main`/`bin` plus conventional root and `src` entry files, flagged in the report. |
81
- | **Stable JSON contract** | A machine-readable report for CI gates, dashboards, and tooling — additive-only compatibility. |
82
- | **Change-set gating** | `ripple diff` analyzes every changed file since a base ref and blocks the merge on risky code. |
83
- | **Error-tolerant parsing** | A broken file lowers confidence instead of aborting the run. No false precision. |
84
- | **Deterministic & offline** | Same input, same output, every time. No hidden network dependency. |
72
+ | Feature | What it does |
73
+ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
74
+ | **Impact analysis** | Reverse dependency traversal, transitively, with depth caps. Know who imports a target file. |
75
+ | **Risk scoring** | A transparent 0–100 score from seven weighted signals, with a per-factor breakdown in `--verbose`. |
76
+ | **Cycle detection** | Strongly-connected components with a concrete cycle path — `a → c → b → a`, not just a list of names. |
77
+ | **Alias & path support** | tsconfig `paths` and custom aliases like `{ "@": "./src" }`, including single-wildcard patterns. |
78
+ | **Real-world resolution** | Extension probing, index files, `.js` → `.ts` rewriting, dynamic `import()`, `require()`, `export … from`. |
79
+ | **Categorized results** | Routes, layouts, components, utilities, and tests detected by path conventions — not a raw string of file names. |
80
+ | **Entry-point intelligence** | `package.json` `main`/`bin` plus conventional root and `src` entry files, flagged in the report. |
81
+ | **Stable JSON contract** | A machine-readable report for CI gates, dashboards, and tooling — additive-only compatibility. |
82
+ | **Change-set gating** | `ripple diff` analyzes every changed file since a base ref and blocks the merge on risky code. |
83
+ | **Diff allowlist** | `--allow <glob>` (or `diff.allow` in config) exempts legacy files from blocking the gate — analyze, report, don't fail. |
84
+ | **Graph exports** | `ripple graph --format mermaid | dot | html` renders the project graph as a Mermaid flowchart, Graphviz digraph, or a self-contained HTML report. |
85
+ | **Config JSON Schema** | Editors autocomplete and validate `ripple.config.json` against the shipped `ripple.schema.json` via `$schema`. |
86
+ | **Error-tolerant parsing** | A broken file lowers confidence instead of aborting the run. No false precision. |
87
+ | **Deterministic & offline** | Same input, same output, every time. No hidden network dependency. |
85
88
 
86
89
  ## Quick start
87
90
 
@@ -97,7 +100,7 @@ Everything below is real output against a shipped example project in `tests/fixt
97
100
  ```bash
98
101
  npm install -g @alimaandev/ripple
99
102
 
100
- ripple version # → 0.5.0
103
+ ripple version # → 0.6.0
101
104
  ```
102
105
 
103
106
  Or install from source:
@@ -129,9 +132,7 @@ ripple analyze src/authentication/login.ts
129
132
  Expected output:
130
133
 
131
134
  ```text
132
- ╭ ripple ────────────────────────────╮
133
- │ ❯ impact analysis · v0.2.0 │
134
- ╰────────────────────────────────────╯
135
+ ripple · impact analysis · v0.6.0
135
136
 
136
137
  File src/authentication/login.ts
137
138
  Risk MEDIUM · 34.7/100 ███░░░░░░░
@@ -140,18 +141,15 @@ Affected 7 files
140
141
  Max depth 2
141
142
  Confidence 100%
142
143
 
143
- ────────────────────────────────────
144
- Top impact
144
+ › Top impact
145
145
  ● Dashboard (2)
146
146
  ● Admin (1)
147
147
  ● Index TS (1)
148
148
 
149
- ────────────────────────────────────
150
- Circular dependencies
149
+ › Circular dependencies
151
150
  ◯ src/circular/a.ts → src/circular/c.ts → src/circular/b.ts → src/circular/a.ts
152
151
 
153
- ────────────────────────────────────
154
- Affected files (7)
152
+ › Affected files (7)
155
153
  ├─ src/admin/page.tsx · depth 1
156
154
  ├─ src/dashboard/page.tsx · depth 1
157
155
  └─ src/main.ts · depth 2
@@ -167,9 +165,7 @@ ripple graph
167
165
  ```
168
166
 
169
167
  ```text
170
- ╭ ripple ────────────────────────────╮
171
- │ ❯ dependency graph · v0.2.0 │
172
- ╰────────────────────────────────────╯
168
+ ripple · dependency graph · v0.6.0
173
169
 
174
170
  Files 25
175
171
  Edges 28
@@ -177,11 +173,19 @@ External 4
177
173
  Unresolved 0
178
174
  Circular groups 1
179
175
 
180
- ────────────────────────────────────
181
- Circular dependencies
176
+ › Circular dependencies
182
177
  ◯ src/circular/a.ts → src/circular/c.ts → src/circular/b.ts → src/circular/a.ts
183
178
  ```
184
179
 
180
+ Export the graph for documentation or a team wiki — no extra tooling needed:
181
+
182
+ ```bash
183
+ ripple graph --format mermaid # Mermaid flowchart (GitHub renders it natively)
184
+ ripple graph --format dot # Graphviz digraph
185
+ ripple graph --format html # self-contained dark-themed HTML report
186
+ ripple graph src/authentication/login.ts --format mermaid # just a file's blast radius
187
+ ```
188
+
185
189
  Point it at a file to see its dependency tree — forwards (what it imports)
186
190
  or, with `-r`, backwards (what imports it):
187
191
 
@@ -201,14 +205,14 @@ Dependents (reverse)
201
205
  ripple <command> [options]
202
206
  ```
203
207
 
204
- | Command | Description |
205
- | ---------------- | ------------------------------------------------- |
206
- | `analyze <file>` | Impact analysis for a target file |
207
- | `graph [file]` | Project stats, or a single file's dependency tree |
208
- | `diff` | Gate all files changed since a git base ref |
209
- | `doctor` | Project and environment health check |
210
- | `init` | Scaffold a `ripple.config.json` |
211
- | `version` | Print the current version |
208
+ | Command | Description | Example |
209
+ | ---------------- | ------------------------------------------------- | -------------------------------------------- |
210
+ | `analyze <file>` | Impact analysis for a target file | `ripple analyze src/authentication/login.ts` |
211
+ | `graph [file]` | Project stats, or a single file's dependency tree | `ripple graph src/circular/b.ts -r` |
212
+ | `diff` | Gate all files changed since a git base ref | `ripple diff --base main --gate critical` |
213
+ | `doctor` | Project and environment health check | `ripple doctor -v` |
214
+ | `init` | Scaffold a `ripple.config.json` | `ripple init` |
215
+ | `version` | Print the current version | `ripple version` |
212
216
 
213
217
  ### Options
214
218
 
@@ -263,6 +267,15 @@ $ ripple doctor
263
267
  ### `ripple init`
264
268
 
265
269
  Writes `ripple.config.json` with the recommended defaults, ready to edit.
270
+ The minimal config references the shipped JSON Schema so editors
271
+ autocomplete and validate as you type:
272
+
273
+ ```bash
274
+ ripple init # minimal ripple.config.json + $schema
275
+ ripple init --full # every built-in default, written out
276
+ ripple init --ts # typed ripple.config.ts
277
+ ripple init --ts --full # full defaults as TypeScript
278
+ ```
266
279
 
267
280
  ### `ripple diff`
268
281
 
@@ -276,23 +289,27 @@ cd my-project
276
289
  ripple diff # vs origin/main (then main, then HEAD~1)
277
290
  ripple diff --base HEAD~1 --json # machine-readable gate report
278
291
  ripple diff --gate critical # only CRITICAL blocks the merge
292
+ ripple diff --allow "src/legacy/**" # legacy files never block the gate
279
293
  ```
280
294
 
295
+ Adopting the gate on an existing codebase? Allowlist the files you haven't
296
+ fixed yet — they are still analyzed and shown in the report, marked
297
+ `(allowed)`, but they can't fail CI. The same list lives in config as
298
+ `diff.allow`, so the whole team shares it.
299
+
281
300
  ```text
282
- ╭ ripple ─────────────────────╮
283
- │ ❯ diff vs origin/main │
284
- ╰─────────────────────────────╯
301
+ ripple · diff vs origin/main
285
302
 
286
303
  Changed 2 files
287
304
  Source 2 files
305
+ Allowed 1 file
288
306
  Duration 118ms
289
307
 
290
- ✖ Gate blocked — 1 CRITICAL (no HIGH or CRITICAL)
308
+ ✔ Gate passed — none (no HIGH or CRITICAL)
291
309
 
292
- ─────────────────────────────────────
293
- Risk analysis (2 files)
310
+ › Risk analysis (2 files)
294
311
  ✖ src/auth/token.ts CRITICAL · 88.2/100 ████████░░
295
- ● src/auth/session.ts LOW · 12.4/100 █░░░░░░░░░
312
+ ✔ src/legacy/session.ts LOW · 12.4/100 █░░░░░░░░░ (allowed)
296
313
  … src/api/legacy.js (not a source file)
297
314
  ```
298
315
 
@@ -324,6 +341,7 @@ defaults — every field is optional.
324
341
 
325
342
  ```json
326
343
  {
344
+ "$schema": "./node_modules/@alimaandev/ripple/ripple.schema.json",
327
345
  "include": ["**/*.{ts,tsx,js,jsx}"],
328
346
  "ignore": ["node_modules", "dist", "build", "coverage", ".next", "out"],
329
347
  "aliases": { "@": "./src" },
@@ -342,11 +360,16 @@ defaults — every field is optional.
342
360
  },
343
361
  "diff": {
344
362
  "base": "origin/main",
345
- "gate": "high"
363
+ "gate": "high",
364
+ "allow": ["src/legacy/**"]
346
365
  }
347
366
  }
348
367
  ```
349
368
 
369
+ > [!TIP]
370
+ > The `$schema` line powers editor autocomplete and validation for
371
+ > `ripple.config.json` — the package ships `ripple.schema.json` for it.
372
+
350
373
  | Field | Default | Purpose |
351
374
  | ----------------- | ----------------------------------------------------------- | ------------------------------------------------------ |
352
375
  | `include` | `**/*.{ts,tsx,js,jsx}` | Source globs to analyze |
@@ -356,6 +379,7 @@ defaults — every field is optional.
356
379
  | `risk.weights` | see example | Risk signal weights |
357
380
  | `risk.thresholds` | 30 / 55 / 80 | Score thresholds for MEDIUM / HIGH / CRITICAL |
358
381
  | `diff.base` | `origin/main` → `main` → `HEAD~1` | Git ref to diff against when `--base` is not given |
382
+ | `diff.allow` | `[]` | Globs of files that never block the gate |
359
383
  | `diff.gate` | `high` | Blocking level when `--gate` is not given |
360
384
 
361
385
  `node_modules` is always excluded, regardless of config.
@@ -418,7 +442,7 @@ error-tolerant recovery, `graph/` resolves specifiers and detects cycles, and
418
442
  ```json
419
443
  {
420
444
  "tool": "ripple",
421
- "version": "0.1.0",
445
+ "version": "0.5.0",
422
446
  "command": "analyze",
423
447
  "file": "src/authentication/login.ts",
424
448
  "risk": { "score": 34.4, "level": "MEDIUM", "factors": [] },
@@ -469,7 +493,7 @@ verdict:
469
493
  ```json
470
494
  {
471
495
  "tool": "ripple",
472
- "version": "0.3.0",
496
+ "version": "0.5.0",
473
497
  "command": "diff",
474
498
  "base": "origin/main",
475
499
  "changedFiles": 2,
@@ -579,6 +603,11 @@ pnpm run build # tsup
579
603
  Architecture and design decisions live in [docs/architecture.md](docs/architecture.md).
580
604
  Before contributing, read [CONTRIBUTING.md](CONTRIBUTING.md).
581
605
 
606
+ Quality gates run on every pull request: lint, typecheck, build, unit tests
607
+ (against a global coverage floor for `src/**`), integration tests on Linux
608
+ and Windows, and a dogfood job — Ripple gates its own PRs with
609
+ `ripple diff --format github`.
610
+
582
611
  ## Get started
583
612
 
584
613
  ```bash