@getcodesentinel/codesentinel 1.17.4 → 1.18.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 +4 -0
- package/dist/index.js +54 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -149,6 +149,7 @@ codesentinel report [path]
|
|
|
149
149
|
codesentinel check [path]
|
|
150
150
|
codesentinel ci [path]
|
|
151
151
|
codesentinel dependency-risk <dependency[@version]>
|
|
152
|
+
codesentinel update
|
|
152
153
|
```
|
|
153
154
|
|
|
154
155
|
Examples:
|
|
@@ -173,8 +174,11 @@ codesentinel ci --baseline-ref origin/main --max-risk-delta 0.03 --no-new-cycles
|
|
|
173
174
|
codesentinel ci --baseline-ref auto --fail-on error
|
|
174
175
|
codesentinel dependency-risk react
|
|
175
176
|
codesentinel dependency-risk react@19.0.0
|
|
177
|
+
codesentinel update
|
|
176
178
|
```
|
|
177
179
|
|
|
180
|
+
Use `codesentinel update` to manually check for a newer CLI release and install it without waiting for the startup notifier.
|
|
181
|
+
|
|
178
182
|
Author identity mode:
|
|
179
183
|
|
|
180
184
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -3448,6 +3448,12 @@ var parseNpmViewVersionOutput = (output) => {
|
|
|
3448
3448
|
}
|
|
3449
3449
|
return null;
|
|
3450
3450
|
};
|
|
3451
|
+
var renderUpdateInProgressMessage = (packageName) => `Updating CodeSentinel via \`npm install -g ${packageName}\`...
|
|
3452
|
+
`;
|
|
3453
|
+
var renderUpdateSuccessMessage = () => "\u{1F389} Update ran successfully! Please restart CodeSentinel.\n";
|
|
3454
|
+
var renderAlreadyUpToDateMessage = (currentVersion) => `CodeSentinel is already up to date (${currentVersion}).
|
|
3455
|
+
`;
|
|
3456
|
+
var renderUpdateCheckFailedMessage = () => "CodeSentinel could not check for updates right now. Please try again later.\n";
|
|
3451
3457
|
var readCache = async () => {
|
|
3452
3458
|
try {
|
|
3453
3459
|
const raw = await readFile2(UPDATE_CACHE_PATH, "utf8");
|
|
@@ -3566,8 +3572,7 @@ var promptInstall = async (packageName, latestVersion, currentVersion) => {
|
|
|
3566
3572
|
}
|
|
3567
3573
|
clearPromptArea();
|
|
3568
3574
|
if (choice === "install") {
|
|
3569
|
-
stderr.write(`${ANSI.yellow}
|
|
3570
|
-
`);
|
|
3575
|
+
stderr.write(`${ANSI.yellow}${renderUpdateInProgressMessage(packageName)}${ANSI.reset}`);
|
|
3571
3576
|
} else {
|
|
3572
3577
|
stderr.write("\n");
|
|
3573
3578
|
}
|
|
@@ -3604,6 +3609,38 @@ var installLatestVersion = async (packageName) => {
|
|
|
3604
3609
|
const result = await runCommand("npm", ["install", "-g", `${packageName}@latest`], "inherit");
|
|
3605
3610
|
return result.code === 0;
|
|
3606
3611
|
};
|
|
3612
|
+
var runManualCliUpdate = async (input) => {
|
|
3613
|
+
const latestVersion = await fetchLatestVersion(input.packageName);
|
|
3614
|
+
if (latestVersion === null) {
|
|
3615
|
+
stderr.write(renderUpdateCheckFailedMessage());
|
|
3616
|
+
return 1;
|
|
3617
|
+
}
|
|
3618
|
+
const comparison = compareVersions(latestVersion, input.currentVersion);
|
|
3619
|
+
if (comparison === null) {
|
|
3620
|
+
stderr.write(renderUpdateCheckFailedMessage());
|
|
3621
|
+
return 1;
|
|
3622
|
+
}
|
|
3623
|
+
if (comparison <= 0) {
|
|
3624
|
+
stderr.write(renderAlreadyUpToDateMessage(input.currentVersion));
|
|
3625
|
+
return 0;
|
|
3626
|
+
}
|
|
3627
|
+
const choice = await promptInstall(input.packageName, latestVersion, input.currentVersion);
|
|
3628
|
+
if (choice === "interrupt") {
|
|
3629
|
+
return 130;
|
|
3630
|
+
}
|
|
3631
|
+
if (choice !== "install") {
|
|
3632
|
+
return 0;
|
|
3633
|
+
}
|
|
3634
|
+
const installed = await installLatestVersion(input.packageName);
|
|
3635
|
+
if (installed) {
|
|
3636
|
+
stderr.write(renderUpdateSuccessMessage());
|
|
3637
|
+
return 0;
|
|
3638
|
+
}
|
|
3639
|
+
stderr.write(
|
|
3640
|
+
"CodeSentinel update failed. You can retry with: npm install -g @getcodesentinel/codesentinel@latest\n"
|
|
3641
|
+
);
|
|
3642
|
+
return 1;
|
|
3643
|
+
};
|
|
3607
3644
|
var checkForCliUpdates = async (input) => {
|
|
3608
3645
|
try {
|
|
3609
3646
|
const nowMs = Date.now();
|
|
@@ -3636,9 +3673,7 @@ var checkForCliUpdates = async (input) => {
|
|
|
3636
3673
|
}
|
|
3637
3674
|
const installed = await installLatestVersion(input.packageName);
|
|
3638
3675
|
if (installed) {
|
|
3639
|
-
stderr.write(
|
|
3640
|
-
"CodeSentinel updated to latest version. Rerun your command to use the new version.\n"
|
|
3641
|
-
);
|
|
3676
|
+
stderr.write(renderUpdateSuccessMessage());
|
|
3642
3677
|
process.exit(0);
|
|
3643
3678
|
} else {
|
|
3644
3679
|
stderr.write(
|
|
@@ -7486,6 +7521,12 @@ var scoringProfileOption = () => new Option(
|
|
|
7486
7521
|
"scoring profile: default (balanced) or personal (down-weights single-maintainer ownership penalties for risk and health ownership)"
|
|
7487
7522
|
).choices(["default", "personal"]).default("default");
|
|
7488
7523
|
program.name("codesentinel").description("Structural and evolutionary risk analysis for TypeScript/JavaScript codebases").version(version);
|
|
7524
|
+
program.command("update").description("check for a newer CodeSentinel version and install it").action(async () => {
|
|
7525
|
+
process.exitCode = await runManualCliUpdate({
|
|
7526
|
+
packageName: "@getcodesentinel/codesentinel",
|
|
7527
|
+
currentVersion: version
|
|
7528
|
+
});
|
|
7529
|
+
});
|
|
7489
7530
|
program.command("analyze").argument("[path]", "path to the project to analyze").addOption(scoringProfileOption()).addOption(
|
|
7490
7531
|
new Option(
|
|
7491
7532
|
"--author-identity <mode>",
|
|
@@ -8022,11 +8063,13 @@ if (argv.length <= 2) {
|
|
|
8022
8063
|
program.outputHelp();
|
|
8023
8064
|
process.exit(0);
|
|
8024
8065
|
}
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8066
|
+
if (argv[2] !== "update") {
|
|
8067
|
+
await checkForCliUpdates({
|
|
8068
|
+
packageName: "@getcodesentinel/codesentinel",
|
|
8069
|
+
currentVersion: version,
|
|
8070
|
+
argv: process.argv,
|
|
8071
|
+
env: process.env
|
|
8072
|
+
});
|
|
8073
|
+
}
|
|
8031
8074
|
await program.parseAsync(argv);
|
|
8032
8075
|
//# sourceMappingURL=index.js.map
|