packagepurge 1.0.0 → 2.0.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.
Files changed (40) hide show
  1. package/.agent/workflows/build.md +58 -0
  2. package/.github/workflows/release.yml +176 -0
  3. package/README.md +215 -49
  4. package/dist/cli/index.d.ts +1 -0
  5. package/dist/cli/index.js +122 -132
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/core/bindings.d.ts +11 -0
  8. package/dist/core/bindings.d.ts.map +1 -1
  9. package/dist/core/bindings.js +40 -94
  10. package/dist/core/bindings.js.map +1 -1
  11. package/dist/utils/core-utils.d.ts +31 -0
  12. package/dist/utils/core-utils.d.ts.map +1 -0
  13. package/dist/utils/core-utils.js +121 -0
  14. package/dist/utils/core-utils.js.map +1 -0
  15. package/dist/utils/formatter.d.ts +63 -0
  16. package/dist/utils/formatter.d.ts.map +1 -0
  17. package/dist/utils/formatter.js +295 -0
  18. package/dist/utils/formatter.js.map +1 -0
  19. package/package.json +3 -3
  20. package/core/src/arc_lfu.rs +0 -91
  21. package/core/src/cache.rs +0 -205
  22. package/core/src/lockfiles.rs +0 -112
  23. package/core/src/main.rs +0 -125
  24. package/core/src/ml.rs +0 -188
  25. package/core/src/optimization.rs +0 -314
  26. package/core/src/safety.rs +0 -103
  27. package/core/src/scanner.rs +0 -136
  28. package/core/src/symlink.rs +0 -223
  29. package/core/src/types.rs +0 -87
  30. package/core/src/usage_tracker.rs +0 -107
  31. package/src/cli/index.ts +0 -212
  32. package/src/core/bindings.ts +0 -157
  33. package/src/managers/base-manager.ts +0 -117
  34. package/src/managers/index.ts +0 -32
  35. package/src/managers/npm-manager.ts +0 -96
  36. package/src/managers/pnpm-manager.ts +0 -107
  37. package/src/managers/yarn-manager.ts +0 -112
  38. package/src/types/index.ts +0 -97
  39. package/src/utils/logger.ts +0 -50
  40. package/tsconfig.json +0 -22
@@ -1,97 +0,0 @@
1
- /**
2
- * Core type definitions for PackagePurge service
3
- */
4
-
5
- export enum PackageManager {
6
- NPM = 'npm',
7
- YARN = 'yarn',
8
- PNPM = 'pnpm',
9
- }
10
-
11
- export interface PackageInfo {
12
- name: string;
13
- version: string;
14
- path: string;
15
- lastAccessed: Date;
16
- size: number; // in bytes
17
- manager: PackageManager;
18
- projectPaths: string[]; // projects that use this package
19
- }
20
-
21
- export interface ProjectInfo {
22
- path: string;
23
- manager: PackageManager;
24
- dependencies: Map<string, string>; // package -> version
25
- lastModified: Date;
26
- lockFilePath?: string;
27
- }
28
-
29
- export interface CleanupStrategy {
30
- name: string;
31
- rules: CleanupRule[];
32
- mlEnabled: boolean;
33
- }
34
-
35
- export interface CleanupRule {
36
- name: string;
37
- condition: (packageInfo: PackageInfo) => boolean;
38
- priority: number;
39
- }
40
-
41
- export interface CleanupResult {
42
- packagesDeleted: PackageInfo[];
43
- spaceSaved: number; // in bytes
44
- rollbackId?: string;
45
- timestamp: Date;
46
- }
47
-
48
- export interface BackupInfo {
49
- id: string;
50
- timestamp: Date;
51
- packages: PackageInfo[];
52
- totalSize: number;
53
- archivePath: string;
54
- }
55
-
56
- export interface Analytics {
57
- totalSpaceSaved: number; // in bytes
58
- totalRollbacks: number;
59
- totalReinstalls: number;
60
- savingsToRiskRatio: number;
61
- cacheHitRate: number;
62
- projectsAnalyzed: number;
63
- lastCleanup: Date | null;
64
- }
65
-
66
- export interface OptimizationConfig {
67
- preserveDays: number;
68
- keepVersions: number;
69
- enableML: boolean;
70
- enableSymlinking: boolean;
71
- backupEnabled: boolean;
72
- managers: PackageManager[];
73
- dryRun: boolean;
74
- lruMaxPackages?: number;
75
- lruMaxSizeBytes?: number;
76
- }
77
-
78
- export interface OptimizeResult {
79
- items: Array<{
80
- target_path: string;
81
- estimated_size_bytes: number;
82
- reason: string;
83
- }>;
84
- total_estimated_bytes: number;
85
- }
86
-
87
- export interface SymlinkResult {
88
- status: string;
89
- symlinked_count: number;
90
- }
91
-
92
- export interface DependencyGraph {
93
- nodes: Map<string, PackageInfo>;
94
- edges: Map<string, string[]>; // package -> dependencies
95
- rootProjects: ProjectInfo[];
96
- }
97
-
@@ -1,50 +0,0 @@
1
- /**
2
- * Logger utility for PackagePurge
3
- */
4
- import chalk from 'chalk';
5
-
6
- export enum LogLevel {
7
- DEBUG = 0,
8
- INFO = 1,
9
- WARN = 2,
10
- ERROR = 3,
11
- }
12
-
13
- class Logger {
14
- private level: LogLevel = LogLevel.INFO;
15
-
16
- setLevel(level: LogLevel): void {
17
- this.level = level;
18
- }
19
-
20
- debug(message: string, ...args: any[]): void {
21
- if (this.level <= LogLevel.DEBUG) {
22
- console.log(chalk.gray(`[DEBUG] ${message}`), ...args);
23
- }
24
- }
25
-
26
- info(message: string, ...args: any[]): void {
27
- if (this.level <= LogLevel.INFO) {
28
- console.log(chalk.blue(`[INFO] ${message}`), ...args);
29
- }
30
- }
31
-
32
- warn(message: string, ...args: any[]): void {
33
- if (this.level <= LogLevel.WARN) {
34
- console.warn(chalk.yellow(`[WARN] ${message}`), ...args);
35
- }
36
- }
37
-
38
- error(message: string, ...args: any[]): void {
39
- if (this.level <= LogLevel.ERROR) {
40
- console.error(chalk.red(`[ERROR] ${message}`), ...args);
41
- }
42
- }
43
-
44
- success(message: string, ...args: any[]): void {
45
- console.log(chalk.green(`[SUCCESS] ${message}`), ...args);
46
- }
47
- }
48
-
49
- export const logger = new Logger();
50
-
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "lib": ["ES2020"],
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "resolveJsonModule": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "sourceMap": true,
16
- "moduleResolution": "node",
17
- "types": ["node", "jest"]
18
- },
19
- "include": ["src/**/*"],
20
- "exclude": ["node_modules", "dist", "**/*.test.ts"]
21
- }
22
-