@rainy-updates/cli 0.5.7 → 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/CHANGELOG.md +81 -0
- package/README.md +90 -31
- package/dist/bin/cli.js +16 -16
- package/dist/bin/dispatch.js +29 -32
- package/dist/bin/help.js +32 -2
- package/dist/cache/cache.js +13 -11
- package/dist/commands/audit/parser.js +2 -2
- package/dist/commands/audit/runner.js +27 -46
- package/dist/commands/audit/targets.js +13 -13
- package/dist/commands/bisect/oracle.js +28 -11
- package/dist/commands/bisect/parser.js +3 -3
- package/dist/commands/bisect/runner.js +15 -8
- package/dist/commands/changelog/fetcher.js +11 -5
- package/dist/commands/dashboard/parser.js +103 -1
- package/dist/commands/dashboard/runner.d.ts +2 -2
- package/dist/commands/dashboard/runner.js +67 -37
- package/dist/commands/doctor/parser.js +9 -4
- package/dist/commands/doctor/runner.js +2 -2
- package/dist/commands/ga/parser.js +4 -4
- package/dist/commands/ga/runner.js +13 -7
- package/dist/commands/health/parser.js +2 -2
- package/dist/commands/licenses/runner.js +4 -4
- package/dist/commands/resolve/runner.js +9 -4
- package/dist/commands/review/parser.js +57 -4
- package/dist/commands/review/runner.js +31 -5
- package/dist/commands/snapshot/runner.js +17 -17
- package/dist/commands/snapshot/store.d.ts +0 -12
- package/dist/commands/snapshot/store.js +26 -38
- package/dist/commands/unused/runner.js +6 -7
- package/dist/commands/unused/scanner.js +17 -20
- package/dist/config/loader.d.ts +2 -2
- package/dist/config/loader.js +2 -5
- package/dist/config/policy.js +20 -11
- package/dist/core/analysis/run-silenced.js +0 -1
- package/dist/core/artifacts.js +6 -5
- package/dist/core/baseline.js +3 -5
- package/dist/core/check.js +2 -2
- package/dist/core/ci.js +52 -1
- package/dist/core/decision-plan.d.ts +14 -0
- package/dist/core/decision-plan.js +107 -0
- package/dist/core/doctor/result.js +8 -5
- package/dist/core/fix-pr-batch.js +38 -28
- package/dist/core/fix-pr.js +27 -24
- package/dist/core/init-ci.js +25 -21
- package/dist/core/options.js +95 -4
- package/dist/core/review-model.js +3 -0
- package/dist/core/summary.js +6 -0
- package/dist/core/upgrade.js +64 -2
- package/dist/core/verification.d.ts +2 -0
- package/dist/core/verification.js +106 -0
- package/dist/core/warm-cache.js +2 -2
- package/dist/output/format.js +15 -0
- package/dist/output/github.js +6 -0
- package/dist/output/sarif.js +12 -12
- package/dist/parsers/package-json.js +2 -4
- package/dist/pm/detect.d.ts +3 -1
- package/dist/pm/detect.js +24 -12
- package/dist/pm/install.d.ts +2 -1
- package/dist/pm/install.js +15 -16
- package/dist/registry/npm.js +34 -76
- package/dist/rup +0 -0
- package/dist/types/index.d.ts +76 -5
- package/dist/ui/tui.d.ts +4 -1
- package/dist/ui/tui.js +5 -4
- package/dist/utils/io.js +5 -6
- package/dist/utils/lockfile.js +24 -19
- package/dist/utils/runtime-paths.d.ts +4 -0
- package/dist/utils/runtime-paths.js +35 -0
- package/dist/utils/runtime.d.ts +7 -0
- package/dist/utils/runtime.js +32 -0
- package/dist/workspace/discover.js +55 -51
- package/package.json +16 -16
- package/dist/ui/dashboard/DashboardTUI.d.ts +0 -6
- package/dist/ui/dashboard/DashboardTUI.js +0 -34
- package/dist/ui/dashboard/components/DetailPanel.d.ts +0 -4
- package/dist/ui/dashboard/components/DetailPanel.js +0 -30
- package/dist/ui/dashboard/components/Footer.d.ts +0 -4
- package/dist/ui/dashboard/components/Footer.js +0 -9
- package/dist/ui/dashboard/components/Header.d.ts +0 -4
- package/dist/ui/dashboard/components/Header.js +0 -12
- package/dist/ui/dashboard/components/Sidebar.d.ts +0 -4
- package/dist/ui/dashboard/components/Sidebar.js +0 -23
- package/dist/ui/dashboard/store.d.ts +0 -34
- package/dist/ui/dashboard/store.js +0 -148
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore } from "react";
|
|
2
|
-
import { runResolve } from "../../commands/resolve/runner.js";
|
|
3
|
-
import { runAudit } from "../../commands/audit/runner.js";
|
|
4
|
-
class DashboardStore {
|
|
5
|
-
state;
|
|
6
|
-
listeners = new Set();
|
|
7
|
-
constructor(initialState) {
|
|
8
|
-
this.state = initialState;
|
|
9
|
-
}
|
|
10
|
-
getState = () => this.state;
|
|
11
|
-
setState = (partial) => {
|
|
12
|
-
const changes = typeof partial === "function" ? partial(this.state) : partial;
|
|
13
|
-
this.state = { ...this.state, ...changes };
|
|
14
|
-
this.emit();
|
|
15
|
-
};
|
|
16
|
-
subscribe = (listener) => {
|
|
17
|
-
this.listeners.add(listener);
|
|
18
|
-
return () => this.listeners.delete(listener);
|
|
19
|
-
};
|
|
20
|
-
emit() {
|
|
21
|
-
for (const listener of this.listeners) {
|
|
22
|
-
listener();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// Global singleton per run
|
|
27
|
-
let store = null;
|
|
28
|
-
export function initStore(options, initialResult) {
|
|
29
|
-
if (!store) {
|
|
30
|
-
store = new DashboardStore({
|
|
31
|
-
selectedIndex: 0,
|
|
32
|
-
view: options.view ?? "dependencies",
|
|
33
|
-
modal: "none",
|
|
34
|
-
updates: initialResult.updates,
|
|
35
|
-
summary: initialResult.summary,
|
|
36
|
-
options,
|
|
37
|
-
shouldApply: false,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return store;
|
|
41
|
-
}
|
|
42
|
-
// Hook to use the store in components, taking a selector to prevent unnecessary re-renders
|
|
43
|
-
export function useDashboardStore(selector) {
|
|
44
|
-
if (!store)
|
|
45
|
-
throw new Error("Store not initialized");
|
|
46
|
-
// Custom equality check could be added, but returning primitive/stable references from selector works best
|
|
47
|
-
return useSyncExternalStore(store.subscribe, () => selector(store.getState()));
|
|
48
|
-
}
|
|
49
|
-
// Export actions to modify state without re-rendering the caller
|
|
50
|
-
export const dashboardActions = {
|
|
51
|
-
moveCursorUp: () => {
|
|
52
|
-
store?.setState((s) => ({
|
|
53
|
-
selectedIndex: Math.max(0, s.selectedIndex - 1),
|
|
54
|
-
}));
|
|
55
|
-
},
|
|
56
|
-
moveCursorDown: () => {
|
|
57
|
-
store?.setState((s) => ({
|
|
58
|
-
selectedIndex: Math.min(s.updates.length - 1, s.selectedIndex + 1),
|
|
59
|
-
}));
|
|
60
|
-
},
|
|
61
|
-
setView: (view) => {
|
|
62
|
-
store?.setState({ view, selectedIndex: 0 }); // reset cursor on view change
|
|
63
|
-
},
|
|
64
|
-
setModal: (modal) => {
|
|
65
|
-
store?.setState({ modal });
|
|
66
|
-
},
|
|
67
|
-
setShouldApply: (shouldApply) => {
|
|
68
|
-
store?.setState({ shouldApply });
|
|
69
|
-
},
|
|
70
|
-
runResolveAction: async () => {
|
|
71
|
-
if (!store)
|
|
72
|
-
return;
|
|
73
|
-
const s = store.getState();
|
|
74
|
-
store.setState({ modal: "resolving" });
|
|
75
|
-
try {
|
|
76
|
-
const resolveOpts = {
|
|
77
|
-
cwd: s.options.cwd,
|
|
78
|
-
workspace: s.options.workspace,
|
|
79
|
-
afterUpdate: true,
|
|
80
|
-
safe: true,
|
|
81
|
-
concurrency: s.options.concurrency,
|
|
82
|
-
registryTimeoutMs: s.options.registryTimeoutMs,
|
|
83
|
-
cacheTtlSeconds: s.options.cacheTtlSeconds,
|
|
84
|
-
silent: true,
|
|
85
|
-
};
|
|
86
|
-
const result = await runResolve(resolveOpts);
|
|
87
|
-
// Update updates array with the conflict severity
|
|
88
|
-
const updatedUpdates = s.updates.map((update) => {
|
|
89
|
-
const hasError = result.conflicts.some((c) => c.requester === update.name && c.severity === "error");
|
|
90
|
-
const hasWarning = result.conflicts.some((c) => c.requester === update.name && c.severity === "warning");
|
|
91
|
-
const severity = (hasError ? "error" : hasWarning ? "warning" : "none");
|
|
92
|
-
return { ...update, peerConflictSeverity: severity };
|
|
93
|
-
});
|
|
94
|
-
store.setState({ updates: updatedUpdates });
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
store.setState({ error: String(err) });
|
|
98
|
-
}
|
|
99
|
-
finally {
|
|
100
|
-
store.setState({ modal: "none" });
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
runAuditAction: async () => {
|
|
104
|
-
if (!store)
|
|
105
|
-
return;
|
|
106
|
-
const s = store.getState();
|
|
107
|
-
store.setState({ modal: "auditing" });
|
|
108
|
-
try {
|
|
109
|
-
const auditOpts = {
|
|
110
|
-
cwd: s.options.cwd,
|
|
111
|
-
workspace: s.options.workspace,
|
|
112
|
-
fix: false,
|
|
113
|
-
dryRun: false,
|
|
114
|
-
commit: false,
|
|
115
|
-
packageManager: "auto",
|
|
116
|
-
reportFormat: "summary",
|
|
117
|
-
sourceMode: "auto",
|
|
118
|
-
concurrency: s.options.concurrency,
|
|
119
|
-
registryTimeoutMs: s.options.registryTimeoutMs,
|
|
120
|
-
silent: true,
|
|
121
|
-
};
|
|
122
|
-
const result = await runAudit(auditOpts);
|
|
123
|
-
// Map advisories back to updates
|
|
124
|
-
const updatedUpdates = s.updates.map((update) => {
|
|
125
|
-
const pkgSummary = result.packages.find((p) => p.packageName === update.name);
|
|
126
|
-
if (pkgSummary) {
|
|
127
|
-
return {
|
|
128
|
-
...update,
|
|
129
|
-
riskLevel: pkgSummary.severity,
|
|
130
|
-
advisoryCount: pkgSummary.advisoryCount,
|
|
131
|
-
toRange: pkgSummary.patchedVersion || update.toRange, // suggest the patch!
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return update;
|
|
135
|
-
});
|
|
136
|
-
store.setState({ updates: updatedUpdates });
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
store.setState({ error: String(err) });
|
|
140
|
-
}
|
|
141
|
-
finally {
|
|
142
|
-
store.setState({ modal: "none" });
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
export function getStore() {
|
|
147
|
-
return store;
|
|
148
|
-
}
|