@alimaandev/ripple 0.3.0 → 0.5.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.
@@ -22,6 +22,10 @@ var DEFAULT_CONFIG = {
22
22
  high: 55,
23
23
  critical: 80
24
24
  }
25
+ },
26
+ diff: {
27
+ base: void 0,
28
+ gate: "high"
25
29
  }
26
30
  };
27
31
 
@@ -46,12 +50,17 @@ var riskConfigSchema = z.object({
46
50
  weights: riskWeightsSchema.default(DEFAULT_CONFIG.risk.weights),
47
51
  thresholds: riskThresholdsSchema.default(DEFAULT_CONFIG.risk.thresholds)
48
52
  }).strict();
53
+ var diffConfigSchema = z.object({
54
+ base: z.string().min(1).optional(),
55
+ gate: z.enum(["medium", "high", "critical"]).default(DEFAULT_CONFIG.diff.gate)
56
+ }).strict();
49
57
  var rippleConfigSchema = z.object({
50
58
  include: z.array(z.string().min(1)).min(1).default(DEFAULT_CONFIG.include),
51
59
  ignore: z.array(z.string()).default(DEFAULT_CONFIG.ignore),
52
60
  aliases: z.record(z.string(), z.string()).default(DEFAULT_CONFIG.aliases),
53
61
  tsconfigPath: z.string().min(1).default(DEFAULT_CONFIG.tsconfigPath),
54
- risk: riskConfigSchema.default(DEFAULT_CONFIG.risk)
62
+ risk: riskConfigSchema.default(DEFAULT_CONFIG.risk),
63
+ diff: diffConfigSchema.default(DEFAULT_CONFIG.diff)
55
64
  }).strict();
56
65
  function formatSchemaIssues(error) {
57
66
  return error.issues.map((issue) => {
@@ -62,5 +71,5 @@ function formatSchemaIssues(error) {
62
71
  }
63
72
 
64
73
  export { DEFAULT_CONFIG, formatSchemaIssues, rippleConfigSchema };
65
- //# sourceMappingURL=chunk-OOERV74D.js.map
66
- //# sourceMappingURL=chunk-OOERV74D.js.map
74
+ //# sourceMappingURL=chunk-LDCFNORX.js.map
75
+ //# sourceMappingURL=chunk-LDCFNORX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/defaults.ts","../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AAA,GAA8C,EACxD,MAAA,CAAO;AAAA,EACN,OAAA,EAAS,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,QAAO,CAAE,GAAA,CAAI,CAAC,CAAC,EAAE,GAAA,CAAI,CAAC,CAAA,CAAE,OAAA,CAAQ,eAAe,OAAO,CAAA;AAAA,EACzE,MAAA,EAAQ,EAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,cAAA,CAAe,MAAM,CAAA;AAAA,EACzD,OAAA,EAAS,CAAA,CAAE,MAAA,CAAO,CAAA,CAAE,MAAA,EAAO,EAAG,CAAA,CAAE,MAAA,EAAQ,CAAA,CAAE,OAAA,CAAQ,cAAA,CAAe,OAAO,CAAA;AAAA,EACxE,YAAA,EAAc,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,OAAA,CAAQ,cAAA,CAAe,YAAY,CAAA;AAAA,EACnE,IAAA,EAAM,gBAAA,CAAiB,OAAA,CAAQ,cAAA,CAAe,IAAI,CAAA;AAAA,EAClD,IAAA,EAAM,gBAAA,CAAiB,OAAA,CAAQ,cAAA,CAAe,IAAI;AACpD,CAAC,EACA,MAAA;AAGI,SAAS,mBAAmB,KAAA,EAA6B;AAC9D,EAAA,OAAO,KAAA,CAAM,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,KAAU;AACjC,IAAA,MAAM,IAAA,GAAO,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA;AAChC,IAAA,MAAM,QAAA,GAAW,IAAA,KAAS,EAAA,GAAK,QAAA,GAAW,UAAU,IAAI,CAAA,CAAA;AACxD,IAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAK,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,EACtC,CAAC,CAAA;AACH","file":"chunk-LDCFNORX.js","sourcesContent":["import type { RippleConfig } from \"../types/config.js\";\n\n/**\n * Built-in defaults. A user config only overrides fields it sets; anything\n * else keeps these values.\n */\nexport const DEFAULT_CONFIG: RippleConfig = {\n include: [\"**/*.{ts,tsx,js,jsx}\"],\n ignore: [\"node_modules\", \"dist\", \"build\", \"coverage\", \".next\", \"out\", \".git\"],\n aliases: {},\n tsconfigPath: \"tsconfig.json\",\n risk: {\n weights: {\n affectedFiles: 0.3,\n entryPoint: 0.15,\n sharedUtility: 0.15,\n publicExports: 0.1,\n tests: 0.1,\n routes: 0.1,\n cycleMembership: 0.1,\n },\n thresholds: {\n medium: 30,\n high: 55,\n critical: 80,\n },\n },\n diff: {\n base: undefined,\n gate: \"high\",\n },\n};\n","import { z } from \"zod\";\nimport type { RippleConfig } from \"../types/config.js\";\nimport { DEFAULT_CONFIG } from \"./defaults.js\";\n\n/**\n * Zod schema for `ripple.config.ts`. Every field has a default, so parsing a\n * partial user config yields a complete validated `RippleConfig`.\n *\n * Note: outer objects default to their *full* default object. `.default({})`\n * would skip inner field defaults, since zod uses the default value as-is\n * without re-parsing it.\n */\n\nconst fraction = z.number().min(0).max(1);\nconst score = z.number().min(0).max(100);\n\nconst riskWeightsSchema = z\n .object({\n affectedFiles: fraction.default(DEFAULT_CONFIG.risk.weights.affectedFiles),\n entryPoint: fraction.default(DEFAULT_CONFIG.risk.weights.entryPoint),\n sharedUtility: fraction.default(DEFAULT_CONFIG.risk.weights.sharedUtility),\n publicExports: fraction.default(DEFAULT_CONFIG.risk.weights.publicExports),\n tests: fraction.default(DEFAULT_CONFIG.risk.weights.tests),\n routes: fraction.default(DEFAULT_CONFIG.risk.weights.routes),\n cycleMembership: fraction.default(DEFAULT_CONFIG.risk.weights.cycleMembership),\n })\n .strict();\n\nconst riskThresholdsSchema = z\n .object({\n medium: score.default(DEFAULT_CONFIG.risk.thresholds.medium),\n high: score.default(DEFAULT_CONFIG.risk.thresholds.high),\n critical: score.default(DEFAULT_CONFIG.risk.thresholds.critical),\n })\n .strict();\n\nconst riskConfigSchema = z\n .object({\n weights: riskWeightsSchema.default(DEFAULT_CONFIG.risk.weights),\n thresholds: riskThresholdsSchema.default(DEFAULT_CONFIG.risk.thresholds),\n })\n .strict();\n\nconst diffConfigSchema = z\n .object({\n base: z.string().min(1).optional(),\n gate: z.enum([\"medium\", \"high\", \"critical\"]).default(DEFAULT_CONFIG.diff.gate),\n })\n .strict();\n\nexport const rippleConfigSchema: z.ZodType<RippleConfig> = z\n .object({\n include: z.array(z.string().min(1)).min(1).default(DEFAULT_CONFIG.include),\n ignore: z.array(z.string()).default(DEFAULT_CONFIG.ignore),\n aliases: z.record(z.string(), z.string()).default(DEFAULT_CONFIG.aliases),\n tsconfigPath: z.string().min(1).default(DEFAULT_CONFIG.tsconfigPath),\n risk: riskConfigSchema.default(DEFAULT_CONFIG.risk),\n diff: diffConfigSchema.default(DEFAULT_CONFIG.diff),\n })\n .strict();\n\n/** Human-readable list of validation problems, for friendly error output. */\nexport function formatSchemaIssues(error: z.ZodError): string[] {\n return error.issues.map((issue) => {\n const path = issue.path.join(\".\");\n const location = path === \"\" ? \"config\" : `config.${path}`;\n return `${location}: ${issue.message}`;\n });\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,40 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ /**
4
+ * Risk engine types: a deterministic weighted heuristic that maps graph
5
+ * signals to a 0-100 score and a level.
6
+ */
7
+ type RiskLevel = "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
8
+ /** One contributing factor of the score, for transparency in `--verbose`. */
9
+ interface RiskFactor {
10
+ /** Stable machine-readable factor name. */
11
+ name: string;
12
+ /** Human-readable label. */
13
+ label: string;
14
+ /** Configured weight (0-1). */
15
+ weight: number;
16
+ /** Normalized signal value (0-1). */
17
+ value: number;
18
+ /** `weight * value * 100`, the points this factor contributes. */
19
+ contribution: number;
20
+ }
21
+ interface RiskResult {
22
+ /** Final score, 0-100. */
23
+ score: number;
24
+ level: RiskLevel;
25
+ /** Every factor and its contribution. */
26
+ factors: RiskFactor[];
27
+ }
28
+
29
+ /** Minimum risk level that blocks the `ripple diff` gate. */
30
+ type GateLevel = "medium" | "high" | "critical";
31
+
3
32
  /**
4
33
  * User-facing configuration for Ripple, validated by `src/config/schema.ts`.
5
34
  *
6
35
  * Every field has a default; a user config only overrides what it sets.
7
36
  */
37
+
8
38
  interface RiskWeights {
9
39
  /** Weight of the (log-scaled) number of affected files. */
10
40
  affectedFiles: number;
@@ -35,6 +65,16 @@ interface RiskConfig {
35
65
  weights: RiskWeights;
36
66
  thresholds: RiskThresholds;
37
67
  }
68
+ /**
69
+ * Diff command tuning. CLI flags (`--base`, `--gate`) always take precedence
70
+ * over these values.
71
+ */
72
+ interface DiffConfig {
73
+ /** Git ref used as the change-set base when no `--base` is given. */
74
+ base?: string;
75
+ /** Minimum risk level that fails the diff gate. Defaults to `"high"`. */
76
+ gate: GateLevel;
77
+ }
38
78
  /**
39
79
  * The validated `ripple.config.ts` shape.
40
80
  */
@@ -49,6 +89,8 @@ interface RippleConfig {
49
89
  tsconfigPath: string;
50
90
  /** Risk engine tuning. */
51
91
  risk: RiskConfig;
92
+ /** Diff command tuning. */
93
+ diff: DiffConfig;
52
94
  }
53
95
  /**
54
96
  * Normalized alias map used by the resolver: pattern → absolute target.
@@ -86,34 +128,8 @@ interface ProjectContext {
86
128
  aliases: AliasMap;
87
129
  }
88
130
 
89
- /**
90
- * Risk engine types: a deterministic weighted heuristic that maps graph
91
- * signals to a 0-100 score and a level.
92
- */
93
- type RiskLevel = "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
94
- /** One contributing factor of the score, for transparency in `--verbose`. */
95
- interface RiskFactor {
96
- /** Stable machine-readable factor name. */
97
- name: string;
98
- /** Human-readable label. */
99
- label: string;
100
- /** Configured weight (0-1). */
101
- weight: number;
102
- /** Normalized signal value (0-1). */
103
- value: number;
104
- /** `weight * value * 100`, the points this factor contributes. */
105
- contribution: number;
106
- }
107
- interface RiskResult {
108
- /** Final score, 0-100. */
109
- score: number;
110
- level: RiskLevel;
111
- /** Every factor and its contribution. */
112
- factors: RiskFactor[];
113
- }
114
-
115
131
  declare const rippleConfigSchema: z.ZodType<RippleConfig>;
116
132
  /** Human-readable list of validation problems, for friendly error output. */
117
133
  declare function formatSchemaIssues(error: z.ZodError): string[];
118
134
 
119
- export { type AliasMap, type ProjectContext, type RippleConfig, type RiskFactor, type RiskLevel, type RiskResult, type TsconfigInfo, formatSchemaIssues, rippleConfigSchema };
135
+ export { type AliasMap, type DiffConfig, type ProjectContext, type RippleConfig, type RiskFactor, type RiskLevel, type RiskResult, type TsconfigInfo, formatSchemaIssues, rippleConfigSchema };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- export { formatSchemaIssues, rippleConfigSchema } from './chunk-OOERV74D.js';
2
+ export { formatSchemaIssues, rippleConfigSchema } from './chunk-LDCFNORX.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alimaandev/ripple",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Dependency impact analysis for TypeScript projects. Answers the question: what will break if I change this file?",
5
5
  "keywords": [
6
6
  "cli",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "bin": {
37
- "ripple": "./dist/bin.js"
37
+ "ripple": "dist/bin.js"
38
38
  },
39
39
  "files": [
40
40
  "dist"
@@ -48,6 +48,8 @@
48
48
  "dev": "tsup --watch",
49
49
  "typecheck": "tsc --noEmit",
50
50
  "test": "vitest run",
51
+ "test:unit": "vitest run tests/unit",
52
+ "test:integration": "vitest run tests/integration",
51
53
  "test:watch": "vitest",
52
54
  "test:coverage": "vitest run --coverage",
53
55
  "lint": "eslint .",
@@ -73,6 +75,7 @@
73
75
  "@types/node": "^26.1.2",
74
76
  "@types/treeify": "^1.0.3",
75
77
  "@vitest/coverage-v8": "^4.1.10",
78
+ "esbuild": "^0.28.1",
76
79
  "eslint": "^10.8.0",
77
80
  "eslint-config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AM,CAAA;AAAA,EACzD,OAAA,EAAS,CAAA,CAAE,MAAA,CAAO,CAAA,CAAE,MAAA,EAAO,EAAG,CAAA,CAAE,MAAA,EAAQ,CAAA,CAAE,OAAA,CAAQ,cAAA,CAAe,OAAO,CAAA;AAAA,EACxE,YAAA,EAAc,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,OAAA,CAAQ,cAAA,CAAe,YAAY,CAAA;AAAA,EACnE,IAAA,EAAM,gBAAA,CAAiB,OAAA,CAAQ,cAAA,CAAe,IAAI;AACpD,CAAC,EACA,MAAA;AAGI,SAAS,mBAAmB,KAAA,EAA6B;AAC9D,EAAA,OAAO,KAAA,CAAM,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,KAAU;AACjC,IAAA,MAAM,IAAA,GAAO,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA;AAChC,IAAA,MAAM,QAAA,GAAW,IAAA,KAAS,EAAA,GAAK,QAAA,GAAW,UAAU,IAAI,CAAA,CAAA;AACxD,IAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAK,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,EACtC,CAAC,CAAA;AACH","file":"chunk-OOERV74D.js","sourcesContent":["import type { RippleConfig } from \"../types/config.js\";\n\n/**\n * Built-in defaults. A user config only overrides fields it sets; anything\n * else keeps these values.\n */\nexport const DEFAULT_CONFIG: RippleConfig = {\n include: [\"**/*.{ts,tsx,js,jsx}\"],\n ignore: [\"node_modules\", \"dist\", \"build\", \"coverage\", \".next\", \"out\", \".git\"],\n aliases: {},\n tsconfigPath: \"tsconfig.json\",\n risk: {\n weights: {\n affectedFiles: 0.3,\n entryPoint: 0.15,\n sharedUtility: 0.15,\n publicExports: 0.1,\n tests: 0.1,\n routes: 0.1,\n cycleMembership: 0.1,\n },\n thresholds: {\n medium: 30,\n high: 55,\n critical: 80,\n },\n },\n};\n","import { z } from \"zod\";\nimport type { RippleConfig } from \"../types/config.js\";\nimport { DEFAULT_CONFIG } from \"./defaults.js\";\n\n/**\n * Zod schema for `ripple.config.ts`. Every field has a default, so parsing a\n * partial user config yields a complete validated `RippleConfig`.\n *\n * Note: outer objects default to their *full* default object. `.default({})`\n * would skip inner field defaults, since zod uses the default value as-is\n * without re-parsing it.\n */\n\nconst fraction = z.number().min(0).max(1);\nconst score = z.number().min(0).max(100);\n\nconst riskWeightsSchema = z\n .object({\n affectedFiles: fraction.default(DEFAULT_CONFIG.risk.weights.affectedFiles),\n entryPoint: fraction.default(DEFAULT_CONFIG.risk.weights.entryPoint),\n sharedUtility: fraction.default(DEFAULT_CONFIG.risk.weights.sharedUtility),\n publicExports: fraction.default(DEFAULT_CONFIG.risk.weights.publicExports),\n tests: fraction.default(DEFAULT_CONFIG.risk.weights.tests),\n routes: fraction.default(DEFAULT_CONFIG.risk.weights.routes),\n cycleMembership: fraction.default(DEFAULT_CONFIG.risk.weights.cycleMembership),\n })\n .strict();\n\nconst riskThresholdsSchema = z\n .object({\n medium: score.default(DEFAULT_CONFIG.risk.thresholds.medium),\n high: score.default(DEFAULT_CONFIG.risk.thresholds.high),\n critical: score.default(DEFAULT_CONFIG.risk.thresholds.critical),\n })\n .strict();\n\nconst riskConfigSchema = z\n .object({\n weights: riskWeightsSchema.default(DEFAULT_CONFIG.risk.weights),\n thresholds: riskThresholdsSchema.default(DEFAULT_CONFIG.risk.thresholds),\n })\n .strict();\n\nexport const rippleConfigSchema: z.ZodType<RippleConfig> = z\n .object({\n include: z.array(z.string().min(1)).min(1).default(DEFAULT_CONFIG.include),\n ignore: z.array(z.string()).default(DEFAULT_CONFIG.ignore),\n aliases: z.record(z.string(), z.string()).default(DEFAULT_CONFIG.aliases),\n tsconfigPath: z.string().min(1).default(DEFAULT_CONFIG.tsconfigPath),\n risk: riskConfigSchema.default(DEFAULT_CONFIG.risk),\n })\n .strict();\n\n/** Human-readable list of validation problems, for friendly error output. */\nexport function formatSchemaIssues(error: z.ZodError): string[] {\n return error.issues.map((issue) => {\n const path = issue.path.join(\".\");\n const location = path === \"\" ? \"config\" : `config.${path}`;\n return `${location}: ${issue.message}`;\n });\n}\n"]}