@getcodesentinel/codesentinel 1.17.5 → 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 +49 -6
- 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
|
@@ -3451,6 +3451,9 @@ var parseNpmViewVersionOutput = (output) => {
|
|
|
3451
3451
|
var renderUpdateInProgressMessage = (packageName) => `Updating CodeSentinel via \`npm install -g ${packageName}\`...
|
|
3452
3452
|
`;
|
|
3453
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";
|
|
3454
3457
|
var readCache = async () => {
|
|
3455
3458
|
try {
|
|
3456
3459
|
const raw = await readFile2(UPDATE_CACHE_PATH, "utf8");
|
|
@@ -3606,6 +3609,38 @@ var installLatestVersion = async (packageName) => {
|
|
|
3606
3609
|
const result = await runCommand("npm", ["install", "-g", `${packageName}@latest`], "inherit");
|
|
3607
3610
|
return result.code === 0;
|
|
3608
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
|
+
};
|
|
3609
3644
|
var checkForCliUpdates = async (input) => {
|
|
3610
3645
|
try {
|
|
3611
3646
|
const nowMs = Date.now();
|
|
@@ -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
|