@codacy/verity-cli 0.23.1 → 0.23.2
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/bin/verity.js +32 -8
- package/package.json +1 -1
package/bin/verity.js
CHANGED
|
@@ -10902,7 +10902,9 @@ function isLegacyHook(entry) {
|
|
|
10902
10902
|
return LEGACY_STOP_RE.test(c) || LEGACY_INTENT_RE.test(c) || c.includes(".gate/hooks/analyze.sh") || c.includes(".gate/hooks/capture-intent.sh");
|
|
10903
10903
|
}
|
|
10904
10904
|
var SETTINGS_LOCAL_FILE = ".claude/settings.local.json";
|
|
10905
|
-
|
|
10905
|
+
function globalSettingsFile() {
|
|
10906
|
+
return `${process.env.HOME || process.env.USERPROFILE || ""}/.claude/settings.json`;
|
|
10907
|
+
}
|
|
10906
10908
|
async function readSettings() {
|
|
10907
10909
|
try {
|
|
10908
10910
|
const content = await (0, import_promises4.readFile)(CLAUDE_SETTINGS_FILE, "utf-8");
|
|
@@ -10912,7 +10914,7 @@ async function readSettings() {
|
|
|
10912
10914
|
}
|
|
10913
10915
|
}
|
|
10914
10916
|
async function readAllSettings() {
|
|
10915
|
-
const files = [CLAUDE_SETTINGS_FILE, SETTINGS_LOCAL_FILE,
|
|
10917
|
+
const files = [CLAUDE_SETTINGS_FILE, SETTINGS_LOCAL_FILE, globalSettingsFile()];
|
|
10916
10918
|
const out = [];
|
|
10917
10919
|
for (const f of files) {
|
|
10918
10920
|
try {
|
|
@@ -10936,6 +10938,24 @@ async function checkAllVerityHooks() {
|
|
|
10936
10938
|
}
|
|
10937
10939
|
return { stop, intent, guard, guardOn };
|
|
10938
10940
|
}
|
|
10941
|
+
async function checkExternalVerityHooks() {
|
|
10942
|
+
let stop = false;
|
|
10943
|
+
let intent = false;
|
|
10944
|
+
let guardOn = [];
|
|
10945
|
+
for (const f of [SETTINGS_LOCAL_FILE, globalSettingsFile()]) {
|
|
10946
|
+
let settings;
|
|
10947
|
+
try {
|
|
10948
|
+
settings = JSON.parse(await (0, import_promises4.readFile)(f, "utf-8"));
|
|
10949
|
+
} catch {
|
|
10950
|
+
continue;
|
|
10951
|
+
}
|
|
10952
|
+
const r = checkVerityHooks(settings);
|
|
10953
|
+
stop = stop || r.stop;
|
|
10954
|
+
intent = intent || r.intent;
|
|
10955
|
+
if (r.guardOn.length > guardOn.length) guardOn = r.guardOn;
|
|
10956
|
+
}
|
|
10957
|
+
return { stop, intent, guardOn };
|
|
10958
|
+
}
|
|
10939
10959
|
async function checkAllVerityHooksDetailed() {
|
|
10940
10960
|
let stop = false;
|
|
10941
10961
|
let intent = false;
|
|
@@ -11102,6 +11122,12 @@ function reconcileMomentHooks(settings, moments, externalPresent = {
|
|
|
11102
11122
|
if (Object.keys(s.hooks).length === 0) delete s.hooks;
|
|
11103
11123
|
return s;
|
|
11104
11124
|
}
|
|
11125
|
+
async function applyMomentSelection(moments) {
|
|
11126
|
+
const external = await checkExternalVerityHooks();
|
|
11127
|
+
const settings = reconcileMomentHooks(await readSettings(), moments, external);
|
|
11128
|
+
await writeSettings(settings);
|
|
11129
|
+
return settings;
|
|
11130
|
+
}
|
|
11105
11131
|
|
|
11106
11132
|
// src/commands/hooks.ts
|
|
11107
11133
|
var ALL_MOMENTS = ["stop", "pre-commit", "pre-push"];
|
|
@@ -11118,15 +11144,13 @@ function registerHooksCommands(program2) {
|
|
|
11118
11144
|
const force = opts.force ?? false;
|
|
11119
11145
|
if (opts.moments != null) {
|
|
11120
11146
|
const moments = parseMoments(opts.moments);
|
|
11121
|
-
|
|
11122
|
-
const settings2 = reconcileMomentHooks(await readSettings(), moments, external);
|
|
11123
|
-
await writeSettings(settings2);
|
|
11147
|
+
await applyMomentSelection(moments);
|
|
11124
11148
|
const status = await checkAllVerityHooks();
|
|
11125
11149
|
printInfo("Verity hooks reconciled in .claude/settings.json:");
|
|
11126
|
-
printInfo(` Stop (verity analyze): ${
|
|
11150
|
+
printInfo(` Stop (verity analyze): ${status.stop ? "on" : "off"}`);
|
|
11127
11151
|
printInfo(` Pre-commit gate: ${status.guardOn.includes("commit") ? "on" : "off"}`);
|
|
11128
11152
|
printInfo(` Pre-push/PR gate: ${status.guardOn.includes("push") ? "on" : "off"}`);
|
|
11129
|
-
printInfo(
|
|
11153
|
+
printInfo(` UserPromptSubmit (verity intent capture): ${status.intent ? "on" : "off"}`);
|
|
11130
11154
|
return;
|
|
11131
11155
|
}
|
|
11132
11156
|
const detail = await checkAllVerityHooksDetailed();
|
|
@@ -16317,7 +16341,7 @@ function registerTelemetryCommands(program2) {
|
|
|
16317
16341
|
}
|
|
16318
16342
|
|
|
16319
16343
|
// src/cli.ts
|
|
16320
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.23.
|
|
16344
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.23.2").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
|
|
16321
16345
|
registerAuthCommands(program);
|
|
16322
16346
|
registerHooksCommands(program);
|
|
16323
16347
|
registerIntentCommands(program);
|