@rafter-security/cli 0.7.9 → 0.8.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.
@@ -1,40 +0,0 @@
1
- import { Command } from "commander";
2
- import { BinaryManager, GITLEAKS_VERSION } from "../../utils/binary-manager.js";
3
- import { fmt } from "../../utils/formatter.js";
4
- export function createUpdateGitleaksCommand() {
5
- return new Command("update-gitleaks")
6
- .description("Update (or reinstall) the managed gitleaks binary")
7
- .option("--version <version>", "Gitleaks version to install", GITLEAKS_VERSION)
8
- .action(async (opts) => {
9
- const bm = new BinaryManager();
10
- if (!bm.isPlatformSupported()) {
11
- const { platform, arch } = bm.getPlatformInfo();
12
- console.error(fmt.error(`Gitleaks not available for ${platform}/${arch}`));
13
- process.exit(1);
14
- }
15
- // Show current version if installed
16
- if (bm.isGitleaksInstalled()) {
17
- const current = await bm.getGitleaksVersion();
18
- console.log(fmt.info(`Current: ${current}`));
19
- }
20
- else {
21
- console.log(fmt.info("Gitleaks not currently installed (managed binary)"));
22
- }
23
- console.log(fmt.info(`Installing gitleaks v${opts.version}...`));
24
- console.log();
25
- try {
26
- await bm.downloadGitleaks((msg) => console.log(` ${msg}`), opts.version);
27
- console.log();
28
- const installed = await bm.getGitleaksVersion();
29
- console.log(fmt.success(`Gitleaks updated: ${installed}`));
30
- console.log(fmt.info(` Binary: ${bm.getGitleaksPath()}`));
31
- }
32
- catch (e) {
33
- console.log();
34
- console.error(fmt.error(`Update failed: ${e}`));
35
- console.log(fmt.info("To fix: install gitleaks manually (https://github.com/gitleaks/gitleaks/releases) " +
36
- "and ensure it is on PATH."));
37
- process.exit(1);
38
- }
39
- });
40
- }