@codacy/gate-cli 0.9.0 → 0.10.1
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/gate.js +15 -2
- package/package.json +1 -1
package/bin/gate.js
CHANGED
|
@@ -11926,7 +11926,7 @@ function computeDiff(oldContent, newContent, filePath) {
|
|
|
11926
11926
|
(0, import_node_fs8.writeFileSync)(tmpOld, oldContent);
|
|
11927
11927
|
(0, import_node_fs8.writeFileSync)(tmpNew, newContent);
|
|
11928
11928
|
const result = (0, import_node_child_process7.execSync)(
|
|
11929
|
-
`git diff --no-index --unified=
|
|
11929
|
+
`git diff --no-index --unified=10 -- "${tmpOld}" "${tmpNew}"`,
|
|
11930
11930
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
11931
11931
|
);
|
|
11932
11932
|
return result || null;
|
|
@@ -12039,7 +12039,17 @@ function hasDebugIntent(prompt) {
|
|
|
12039
12039
|
}
|
|
12040
12040
|
return true;
|
|
12041
12041
|
}
|
|
12042
|
+
var GIT_ONLY_PATTERN = /\b(commit|push|deploy|merge|rebase|tag|release|publish|ship)\b/i;
|
|
12043
|
+
var CODE_AUTHORING_PATTERN = /\b(add|create|implement|build|write|fix|update|change|refactor|modify|remove|delete|move|rename)\b.*\b(function|component|feature|endpoint|test|file|module|class|type|interface|hook|page|route|style|migration|code|bug|error|issue)\b/i;
|
|
12044
|
+
function isGitOnlyPrompt(prompt) {
|
|
12045
|
+
if (!GIT_ONLY_PATTERN.test(prompt)) return false;
|
|
12046
|
+
if (CODE_AUTHORING_PATTERN.test(prompt)) return false;
|
|
12047
|
+
return true;
|
|
12048
|
+
}
|
|
12042
12049
|
function detectAnalysisMode(noFilesChanged, assistantResponse, conversationPrompts) {
|
|
12050
|
+
if (conversationPrompts.length > 0 && conversationPrompts.every(isGitOnlyPrompt)) {
|
|
12051
|
+
return "skip";
|
|
12052
|
+
}
|
|
12043
12053
|
if (noFilesChanged && !!assistantResponse) {
|
|
12044
12054
|
return "plan";
|
|
12045
12055
|
}
|
|
@@ -12115,6 +12125,9 @@ async function runAnalyze(opts, globals) {
|
|
|
12115
12125
|
const plans = discoverPlans();
|
|
12116
12126
|
const conversationPrompts = (conversation?.prompts ?? []).map((p) => p.prompt);
|
|
12117
12127
|
let analysisMode = detectAnalysisMode(noFilesChanged, assistantResponse, conversationPrompts);
|
|
12128
|
+
if (analysisMode === "skip") {
|
|
12129
|
+
passAndExit("Git operation only \u2014 no code authored to analyze");
|
|
12130
|
+
}
|
|
12118
12131
|
let staticResults = {
|
|
12119
12132
|
tool: "@codacy/analysis-cli",
|
|
12120
12133
|
findings: [],
|
|
@@ -12603,7 +12616,7 @@ function registerInitCommand(program2) {
|
|
|
12603
12616
|
}
|
|
12604
12617
|
|
|
12605
12618
|
// src/cli.ts
|
|
12606
|
-
program.name("gate").description("CLI for GATE.md quality gate service").version("0.
|
|
12619
|
+
program.name("gate").description("CLI for GATE.md quality gate service").version("0.10.1").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
|
|
12607
12620
|
registerAuthCommands(program);
|
|
12608
12621
|
registerHooksCommands(program);
|
|
12609
12622
|
registerIntentCommands(program);
|