smart-commit-copilot-cli 0.1.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/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +392 -0
- package/docs/configuration.md +262 -0
- package/docs/contracts.md +134 -0
- package/docs/getting-started.md +177 -0
- package/docs/integrations.md +85 -0
- package/docs/publish.md +135 -0
- package/docs/release-checklist.md +39 -0
- package/docs/releases/0.1.0-draft.md +52 -0
- package/docs/roadmap.md +94 -0
- package/examples/agent/bridge-agent.mjs +51 -0
- package/examples/agent/report-agent.mjs +48 -0
- package/examples/config/smart-commit.json +60 -0
- package/examples/hooks/cursor-bridge-wrapper.sh +12 -0
- package/examples/hooks/husky-pre-commit.sh +6 -0
- package/examples/hooks/smart-commit-bridge.sh +11 -0
- package/out/cli.js +19 -0
- package/out/cli.js.map +1 -0
- package/out/cliApp.js +239 -0
- package/out/cliApp.js.map +1 -0
- package/out/commands/bridge.js +607 -0
- package/out/commands/bridge.js.map +1 -0
- package/out/commands/report.js +266 -0
- package/out/commands/report.js.map +1 -0
- package/out/commands/types.js +3 -0
- package/out/commands/types.js.map +1 -0
- package/out/commitMessage/index.js +110 -0
- package/out/commitMessage/index.js.map +1 -0
- package/out/commitMessage/mockProvider.js +27 -0
- package/out/commitMessage/mockProvider.js.map +1 -0
- package/out/commitMessage/openaiProvider.js +44 -0
- package/out/commitMessage/openaiProvider.js.map +1 -0
- package/out/commitMessage/prompt.js +65 -0
- package/out/commitMessage/prompt.js.map +1 -0
- package/out/commitMessage/protocol.js +126 -0
- package/out/commitMessage/protocol.js.map +1 -0
- package/out/commitMessage/provider.js +3 -0
- package/out/commitMessage/provider.js.map +1 -0
- package/out/config/cliArgs.js +249 -0
- package/out/config/cliArgs.js.map +1 -0
- package/out/config/constants.js +47 -0
- package/out/config/constants.js.map +1 -0
- package/out/config/env.js +183 -0
- package/out/config/env.js.map +1 -0
- package/out/config/file.js +245 -0
- package/out/config/file.js.map +1 -0
- package/out/config/index.js +46 -0
- package/out/config/index.js.map +1 -0
- package/out/config/legacySmartCommit.js +200 -0
- package/out/config/legacySmartCommit.js.map +1 -0
- package/out/config/merge.js +70 -0
- package/out/config/merge.js.map +1 -0
- package/out/config/runtime.js +36 -0
- package/out/config/runtime.js.map +1 -0
- package/out/config/schema.js +204 -0
- package/out/config/schema.js.map +1 -0
- package/out/contracts.js +311 -0
- package/out/contracts.js.map +1 -0
- package/out/git.js +119 -0
- package/out/git.js.map +1 -0
- package/out/logger.js +17 -0
- package/out/logger.js.map +1 -0
- package/out/openaiCompatible.js +67 -0
- package/out/openaiCompatible.js.map +1 -0
- package/out/output.js +23 -0
- package/out/output.js.map +1 -0
- package/out/passHistory/index.js +119 -0
- package/out/passHistory/index.js.map +1 -0
- package/out/passHistory/store.js +252 -0
- package/out/passHistory/store.js.map +1 -0
- package/out/passHistory/types.js +6 -0
- package/out/passHistory/types.js.map +1 -0
- package/out/promptContext.js +72 -0
- package/out/promptContext.js.map +1 -0
- package/out/renderOutput.js +89 -0
- package/out/renderOutput.js.map +1 -0
- package/out/reporting/aggregate.js +113 -0
- package/out/reporting/aggregate.js.map +1 -0
- package/out/reporting/index.js +72 -0
- package/out/reporting/index.js.map +1 -0
- package/out/reporting/mockProvider.js +25 -0
- package/out/reporting/mockProvider.js.map +1 -0
- package/out/reporting/openaiProvider.js +19 -0
- package/out/reporting/openaiProvider.js.map +1 -0
- package/out/reporting/prompt.js +28 -0
- package/out/reporting/prompt.js.map +1 -0
- package/out/reporting/provider.js +3 -0
- package/out/reporting/provider.js.map +1 -0
- package/out/reporting/render.js +151 -0
- package/out/reporting/render.js.map +1 -0
- package/out/reporting/timeWindow.js +79 -0
- package/out/reporting/timeWindow.js.map +1 -0
- package/out/reporting/types.js +11 -0
- package/out/reporting/types.js.map +1 -0
- package/out/review/index.js +64 -0
- package/out/review/index.js.map +1 -0
- package/out/review/mockProvider.js +57 -0
- package/out/review/mockProvider.js.map +1 -0
- package/out/review/openaiProvider.js +40 -0
- package/out/review/openaiProvider.js.map +1 -0
- package/out/review/parser.js +92 -0
- package/out/review/parser.js.map +1 -0
- package/out/review/prompt.js +61 -0
- package/out/review/prompt.js.map +1 -0
- package/out/review/provider.js +3 -0
- package/out/review/provider.js.map +1 -0
- package/out/review/types.js +3 -0
- package/out/review/types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultCliConfig = void 0;
|
|
4
|
+
exports.parseOutputLanguage = parseOutputLanguage;
|
|
5
|
+
exports.parseCommitMessageValidationProtocol = parseCommitMessageValidationProtocol;
|
|
6
|
+
exports.parseReportWeekStartsOn = parseReportWeekStartsOn;
|
|
7
|
+
exports.parseOutputFormat = parseOutputFormat;
|
|
8
|
+
exports.parseLogLevel = parseLogLevel;
|
|
9
|
+
exports.parseFiniteNumber = parseFiniteNumber;
|
|
10
|
+
exports.parseBoolean = parseBoolean;
|
|
11
|
+
exports.parseString = parseString;
|
|
12
|
+
exports.parseObject = parseObject;
|
|
13
|
+
exports.parseStringMap = parseStringMap;
|
|
14
|
+
exports.assertValidRegexPattern = assertValidRegexPattern;
|
|
15
|
+
exports.resolveBuiltinSkillId = resolveBuiltinSkillId;
|
|
16
|
+
exports.validateCliConfig = validateCliConfig;
|
|
17
|
+
const constants_1 = require("./constants");
|
|
18
|
+
exports.defaultCliConfig = {
|
|
19
|
+
connection: {
|
|
20
|
+
baseUrl: "",
|
|
21
|
+
apiKey: "",
|
|
22
|
+
model: "",
|
|
23
|
+
extraHeaders: {},
|
|
24
|
+
requestTimeoutMs: 1000000
|
|
25
|
+
},
|
|
26
|
+
review: {
|
|
27
|
+
threshold: 6,
|
|
28
|
+
language: "zh",
|
|
29
|
+
maxDiffChars: 100000,
|
|
30
|
+
skill: {
|
|
31
|
+
id: "code-review",
|
|
32
|
+
path: "",
|
|
33
|
+
promptTuning: ""
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
commitMessage: {
|
|
37
|
+
input: "",
|
|
38
|
+
language: "zh",
|
|
39
|
+
autoGenerate: true,
|
|
40
|
+
hybridGenerate: false,
|
|
41
|
+
skill: {
|
|
42
|
+
id: "conventional",
|
|
43
|
+
path: "",
|
|
44
|
+
promptTuning: ""
|
|
45
|
+
},
|
|
46
|
+
validation: {
|
|
47
|
+
protocol: "none",
|
|
48
|
+
pattern: "",
|
|
49
|
+
extractTicketIdFromBranch: true,
|
|
50
|
+
requireTicketIdInMessage: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
git: {
|
|
54
|
+
autoStageWhenNothingStaged: true,
|
|
55
|
+
autoCommit: true,
|
|
56
|
+
autoPush: true,
|
|
57
|
+
pushTimeoutMs: 90000
|
|
58
|
+
},
|
|
59
|
+
passHistory: {
|
|
60
|
+
enabled: false,
|
|
61
|
+
dirPath: "",
|
|
62
|
+
maxEntries: 5000
|
|
63
|
+
},
|
|
64
|
+
reporting: {
|
|
65
|
+
language: "zh",
|
|
66
|
+
weekStartsOn: "monday",
|
|
67
|
+
outputDirPath: "",
|
|
68
|
+
prompt: "",
|
|
69
|
+
ai: {
|
|
70
|
+
enabled: false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
output: {
|
|
74
|
+
format: "json",
|
|
75
|
+
logLevel: "info"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
function parseOutputLanguage(value, sourceLabel) {
|
|
79
|
+
const normalized = value.trim().toLowerCase();
|
|
80
|
+
if ((0, constants_1.isOutputLanguage)(normalized)) {
|
|
81
|
+
return normalized;
|
|
82
|
+
}
|
|
83
|
+
throw new Error(`${sourceLabel} must be one of ${(0, constants_1.formatSupportedOutputLanguages)()}.`);
|
|
84
|
+
}
|
|
85
|
+
function parseCommitMessageValidationProtocol(value, sourceLabel) {
|
|
86
|
+
const normalized = value.trim().toLowerCase();
|
|
87
|
+
if (!normalized || normalized === "none") {
|
|
88
|
+
return "none";
|
|
89
|
+
}
|
|
90
|
+
if (!(0, constants_1.isCommitMessageProtocol)(normalized)) {
|
|
91
|
+
throw new Error(`${sourceLabel} must be one of: none, conventional, semantic, gitmoji.`);
|
|
92
|
+
}
|
|
93
|
+
return normalized;
|
|
94
|
+
}
|
|
95
|
+
function parseReportWeekStartsOn(value, sourceLabel) {
|
|
96
|
+
const normalized = value.trim().toLowerCase();
|
|
97
|
+
if (normalized === "monday" || normalized === "sunday") {
|
|
98
|
+
return normalized;
|
|
99
|
+
}
|
|
100
|
+
throw new Error(`${sourceLabel} must be either monday or sunday.`);
|
|
101
|
+
}
|
|
102
|
+
function parseOutputFormat(value, sourceLabel) {
|
|
103
|
+
const normalized = value.trim().toLowerCase();
|
|
104
|
+
if (normalized === "json" || normalized === "text") {
|
|
105
|
+
return normalized;
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`${sourceLabel} must be either json or text.`);
|
|
108
|
+
}
|
|
109
|
+
function parseLogLevel(value, sourceLabel) {
|
|
110
|
+
const normalized = value.trim().toLowerCase();
|
|
111
|
+
if (normalized === "debug" || normalized === "info" || normalized === "warn" || normalized === "error") {
|
|
112
|
+
return normalized;
|
|
113
|
+
}
|
|
114
|
+
throw new Error(`${sourceLabel} must be one of: debug, info, warn, error.`);
|
|
115
|
+
}
|
|
116
|
+
function parseFiniteNumber(value, sourceLabel) {
|
|
117
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
118
|
+
throw new Error(`${sourceLabel} must be a finite number.`);
|
|
119
|
+
}
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
function parseBoolean(value, sourceLabel) {
|
|
123
|
+
if (typeof value !== "boolean") {
|
|
124
|
+
throw new Error(`${sourceLabel} must be a boolean.`);
|
|
125
|
+
}
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
function parseString(value, sourceLabel) {
|
|
129
|
+
if (typeof value !== "string") {
|
|
130
|
+
throw new Error(`${sourceLabel} must be a string.`);
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
function parseObject(value, sourceLabel) {
|
|
135
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
136
|
+
throw new Error(`${sourceLabel} must be a JSON object.`);
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
function parseStringMap(value, sourceLabel) {
|
|
141
|
+
const objectValue = parseObject(value, sourceLabel);
|
|
142
|
+
return Object.fromEntries(Object.entries(objectValue).map(([key, item]) => [key, String(item)]));
|
|
143
|
+
}
|
|
144
|
+
function assertValidRegexPattern(pattern, sourceLabel) {
|
|
145
|
+
if (!pattern) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
new RegExp(pattern);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
153
|
+
throw new Error(`${sourceLabel} must be a valid JavaScript RegExp pattern: ${message}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function resolveBuiltinSkillId(skillId, category, sourceLabel) {
|
|
157
|
+
const available = constants_1.builtinSkillIds[category];
|
|
158
|
+
if (!available.includes(skillId)) {
|
|
159
|
+
throw new Error(`${sourceLabel} must be one of: ${available.join(", ")}.`);
|
|
160
|
+
}
|
|
161
|
+
return skillId;
|
|
162
|
+
}
|
|
163
|
+
function validateCliConfig(config, options = {}) {
|
|
164
|
+
const requireConnection = options.requireConnection ?? true;
|
|
165
|
+
if (requireConnection && !config.connection.baseUrl) {
|
|
166
|
+
throw new Error("connection.baseUrl is required.");
|
|
167
|
+
}
|
|
168
|
+
if (requireConnection && !config.connection.apiKey) {
|
|
169
|
+
throw new Error("connection.apiKey is required.");
|
|
170
|
+
}
|
|
171
|
+
if (requireConnection && !config.connection.model) {
|
|
172
|
+
throw new Error("connection.model is required.");
|
|
173
|
+
}
|
|
174
|
+
if (config.review.threshold < 0 || config.review.threshold > 10) {
|
|
175
|
+
throw new Error("review.threshold must be between 0 and 10.");
|
|
176
|
+
}
|
|
177
|
+
if (config.connection.requestTimeoutMs < 5000) {
|
|
178
|
+
throw new Error("connection.requestTimeoutMs must be greater than or equal to 5000.");
|
|
179
|
+
}
|
|
180
|
+
if (config.git.pushTimeoutMs < 5000) {
|
|
181
|
+
throw new Error("git.pushTimeoutMs must be greater than or equal to 5000.");
|
|
182
|
+
}
|
|
183
|
+
if (config.review.maxDiffChars < 1000) {
|
|
184
|
+
throw new Error("review.maxDiffChars must be greater than or equal to 1000.");
|
|
185
|
+
}
|
|
186
|
+
if (!Number.isInteger(config.passHistory.maxEntries) || config.passHistory.maxEntries < 1) {
|
|
187
|
+
throw new Error("passHistory.maxEntries must be an integer greater than or equal to 1.");
|
|
188
|
+
}
|
|
189
|
+
parseOutputLanguage(config.review.language, "review.language");
|
|
190
|
+
parseOutputLanguage(config.commitMessage.language, "commitMessage.language");
|
|
191
|
+
parseOutputLanguage(config.reporting.language, "reporting.language");
|
|
192
|
+
parseCommitMessageValidationProtocol(config.commitMessage.validation.protocol, "commitMessage.validation.protocol");
|
|
193
|
+
parseReportWeekStartsOn(config.reporting.weekStartsOn, "reporting.weekStartsOn");
|
|
194
|
+
parseOutputFormat(config.output.format, "output.format");
|
|
195
|
+
parseLogLevel(config.output.logLevel, "output.logLevel");
|
|
196
|
+
assertValidRegexPattern(config.commitMessage.validation.pattern, "commitMessage.validation.pattern");
|
|
197
|
+
if (!config.review.skill.path) {
|
|
198
|
+
resolveBuiltinSkillId(config.review.skill.id, "code-review", "review.skill.id");
|
|
199
|
+
}
|
|
200
|
+
if (!config.commitMessage.skill.path) {
|
|
201
|
+
resolveBuiltinSkillId(config.commitMessage.skill.id, "git-commit-message", "commitMessage.skill.id");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema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@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reportGenerateOutputSchema = exports.bridgeOutputSchema = exports.configResolveOutputSchema = exports.smartCommitCliFileSchema = exports.SMART_COMMIT_CLI_SCHEMA_VERSION = void 0;
|
|
4
|
+
exports.getSchemaDocument = getSchemaDocument;
|
|
5
|
+
exports.SMART_COMMIT_CLI_SCHEMA_VERSION = "1.0.0";
|
|
6
|
+
const nullableString = { type: ["string", "null"] };
|
|
7
|
+
const nullableNumber = { type: ["number", "null"] };
|
|
8
|
+
const publicCliConfigSchema = {
|
|
9
|
+
type: "object",
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
required: ["connection", "review", "commitMessage", "git", "passHistory", "reporting", "output"],
|
|
12
|
+
properties: {
|
|
13
|
+
connection: {
|
|
14
|
+
type: "object",
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
required: ["baseUrl", "apiKey", "model", "extraHeaders", "requestTimeoutMs"],
|
|
17
|
+
properties: {
|
|
18
|
+
baseUrl: { type: "string" },
|
|
19
|
+
apiKey: { type: "string" },
|
|
20
|
+
model: { type: "string" },
|
|
21
|
+
extraHeaders: {
|
|
22
|
+
type: "object",
|
|
23
|
+
additionalProperties: { type: "string" }
|
|
24
|
+
},
|
|
25
|
+
requestTimeoutMs: { type: "number" }
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
review: {
|
|
29
|
+
type: "object",
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
required: ["threshold", "language", "maxDiffChars", "skill"],
|
|
32
|
+
properties: {
|
|
33
|
+
threshold: { type: "number" },
|
|
34
|
+
language: { type: "string" },
|
|
35
|
+
maxDiffChars: { type: "number" },
|
|
36
|
+
skill: {
|
|
37
|
+
type: "object",
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
required: ["id", "path", "promptTuning"],
|
|
40
|
+
properties: {
|
|
41
|
+
id: { type: "string" },
|
|
42
|
+
path: { type: "string" },
|
|
43
|
+
promptTuning: { type: "string" }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
commitMessage: {
|
|
49
|
+
type: "object",
|
|
50
|
+
additionalProperties: false,
|
|
51
|
+
required: ["input", "language", "autoGenerate", "hybridGenerate", "skill", "validation"],
|
|
52
|
+
properties: {
|
|
53
|
+
input: { type: "string" },
|
|
54
|
+
language: { type: "string" },
|
|
55
|
+
autoGenerate: { type: "boolean" },
|
|
56
|
+
hybridGenerate: { type: "boolean" },
|
|
57
|
+
skill: {
|
|
58
|
+
type: "object",
|
|
59
|
+
additionalProperties: false,
|
|
60
|
+
required: ["id", "path", "promptTuning"],
|
|
61
|
+
properties: {
|
|
62
|
+
id: { type: "string" },
|
|
63
|
+
path: { type: "string" },
|
|
64
|
+
promptTuning: { type: "string" }
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
validation: {
|
|
68
|
+
type: "object",
|
|
69
|
+
additionalProperties: false,
|
|
70
|
+
required: ["protocol", "pattern", "extractTicketIdFromBranch", "requireTicketIdInMessage"],
|
|
71
|
+
properties: {
|
|
72
|
+
protocol: { type: "string" },
|
|
73
|
+
pattern: { type: "string" },
|
|
74
|
+
extractTicketIdFromBranch: { type: "boolean" },
|
|
75
|
+
requireTicketIdInMessage: { type: "boolean" }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
git: {
|
|
81
|
+
type: "object",
|
|
82
|
+
additionalProperties: false,
|
|
83
|
+
required: ["autoStageWhenNothingStaged", "autoCommit", "autoPush", "pushTimeoutMs"],
|
|
84
|
+
properties: {
|
|
85
|
+
autoStageWhenNothingStaged: { type: "boolean" },
|
|
86
|
+
autoCommit: { type: "boolean" },
|
|
87
|
+
autoPush: { type: "boolean" },
|
|
88
|
+
pushTimeoutMs: { type: "number" }
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
passHistory: {
|
|
92
|
+
type: "object",
|
|
93
|
+
additionalProperties: false,
|
|
94
|
+
required: ["enabled", "dirPath", "maxEntries"],
|
|
95
|
+
properties: {
|
|
96
|
+
enabled: { type: "boolean" },
|
|
97
|
+
dirPath: { type: "string" },
|
|
98
|
+
maxEntries: { type: "number" }
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
reporting: {
|
|
102
|
+
type: "object",
|
|
103
|
+
additionalProperties: false,
|
|
104
|
+
required: ["language", "weekStartsOn", "outputDirPath", "prompt", "ai"],
|
|
105
|
+
properties: {
|
|
106
|
+
language: { type: "string" },
|
|
107
|
+
weekStartsOn: { enum: ["monday", "sunday"] },
|
|
108
|
+
outputDirPath: { type: "string" },
|
|
109
|
+
prompt: { type: "string" },
|
|
110
|
+
ai: {
|
|
111
|
+
type: "object",
|
|
112
|
+
additionalProperties: false,
|
|
113
|
+
required: ["enabled"],
|
|
114
|
+
properties: {
|
|
115
|
+
enabled: { type: "boolean" }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
output: {
|
|
121
|
+
type: "object",
|
|
122
|
+
additionalProperties: false,
|
|
123
|
+
required: ["format", "logLevel"],
|
|
124
|
+
properties: {
|
|
125
|
+
format: { enum: ["json", "text"] },
|
|
126
|
+
logLevel: { enum: ["debug", "info", "warn", "error"] }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
exports.smartCommitCliFileSchema = {
|
|
132
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
133
|
+
$id: "smart-commit-cli://schemas/config-file",
|
|
134
|
+
title: "smart-commit CLI Config File",
|
|
135
|
+
type: "object",
|
|
136
|
+
additionalProperties: true,
|
|
137
|
+
properties: {
|
|
138
|
+
smartCommitCli: publicCliConfigSchema
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
exports.configResolveOutputSchema = {
|
|
142
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
143
|
+
$id: "smart-commit-cli://schemas/config-resolve-output",
|
|
144
|
+
title: "smart-commit config resolve Output",
|
|
145
|
+
type: "object",
|
|
146
|
+
additionalProperties: false,
|
|
147
|
+
required: ["schemaVersion", "status", "command", "runtime", "config"],
|
|
148
|
+
properties: {
|
|
149
|
+
schemaVersion: { type: "string" },
|
|
150
|
+
status: { const: "ok" },
|
|
151
|
+
command: { const: "config resolve" },
|
|
152
|
+
runtime: {
|
|
153
|
+
type: "object",
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
properties: {
|
|
156
|
+
repositoryPath: nullableString,
|
|
157
|
+
configPath: nullableString
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
config: publicCliConfigSchema
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
exports.bridgeOutputSchema = {
|
|
164
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
165
|
+
$id: "smart-commit-cli://schemas/bridge-output",
|
|
166
|
+
title: "smart-commit bridge Output",
|
|
167
|
+
type: "object",
|
|
168
|
+
additionalProperties: false,
|
|
169
|
+
required: [
|
|
170
|
+
"schemaVersion",
|
|
171
|
+
"status",
|
|
172
|
+
"command",
|
|
173
|
+
"repositoryPath",
|
|
174
|
+
"reviewLanguage",
|
|
175
|
+
"commitMessageLanguage",
|
|
176
|
+
"didCommit",
|
|
177
|
+
"didPush",
|
|
178
|
+
"commitSha",
|
|
179
|
+
"dryRun",
|
|
180
|
+
"phase",
|
|
181
|
+
"config",
|
|
182
|
+
"passHistory",
|
|
183
|
+
"commitMessage",
|
|
184
|
+
"commitMessageSource",
|
|
185
|
+
"threshold",
|
|
186
|
+
"reviewSummary",
|
|
187
|
+
"score",
|
|
188
|
+
"reviewDecision",
|
|
189
|
+
"reviewProvider"
|
|
190
|
+
],
|
|
191
|
+
properties: {
|
|
192
|
+
schemaVersion: { type: "string" },
|
|
193
|
+
status: { enum: ["ready", "passed", "blocked", "error"] },
|
|
194
|
+
command: { const: "bridge" },
|
|
195
|
+
repositoryPath: nullableString,
|
|
196
|
+
reviewLanguage: { type: "string" },
|
|
197
|
+
commitMessageLanguage: { type: "string" },
|
|
198
|
+
didCommit: { type: "boolean" },
|
|
199
|
+
didPush: { type: "boolean" },
|
|
200
|
+
commitSha: nullableString,
|
|
201
|
+
dryRun: { type: "boolean" },
|
|
202
|
+
phase: { enum: ["preflight", "review", "commit", "push"] },
|
|
203
|
+
config: publicCliConfigSchema,
|
|
204
|
+
passHistory: {
|
|
205
|
+
type: "object",
|
|
206
|
+
additionalProperties: false,
|
|
207
|
+
required: ["enabled", "wrote", "filePath", "eventType", "error"],
|
|
208
|
+
properties: {
|
|
209
|
+
enabled: { type: "boolean" },
|
|
210
|
+
wrote: { type: "boolean" },
|
|
211
|
+
filePath: nullableString,
|
|
212
|
+
eventType: { enum: ["review_passed", "commit_push_completed", null] },
|
|
213
|
+
error: nullableString
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
summary: { type: "string" },
|
|
217
|
+
commitMessage: nullableString,
|
|
218
|
+
commitMessageSource: { enum: ["provided", "generated", "hybrid", "missing"] },
|
|
219
|
+
stagedChanges: {
|
|
220
|
+
type: "object",
|
|
221
|
+
additionalProperties: false,
|
|
222
|
+
required: ["changedFiles", "fullDiffChars", "autoStaged"],
|
|
223
|
+
properties: {
|
|
224
|
+
changedFiles: {
|
|
225
|
+
type: "array",
|
|
226
|
+
items: { type: "string" }
|
|
227
|
+
},
|
|
228
|
+
fullDiffChars: { type: "number" },
|
|
229
|
+
autoStaged: { type: "boolean" }
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
threshold: { type: "number" },
|
|
233
|
+
reviewSummary: nullableString,
|
|
234
|
+
score: nullableNumber,
|
|
235
|
+
reviewDecision: { enum: ["pass", "block", null] },
|
|
236
|
+
reviewProvider: nullableString,
|
|
237
|
+
error: {
|
|
238
|
+
type: "object",
|
|
239
|
+
additionalProperties: false,
|
|
240
|
+
required: ["code", "message"],
|
|
241
|
+
properties: {
|
|
242
|
+
code: { type: "string" },
|
|
243
|
+
message: { type: "string" }
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
exports.reportGenerateOutputSchema = {
|
|
249
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
250
|
+
$id: "smart-commit-cli://schemas/report-generate-output",
|
|
251
|
+
title: "smart-commit report generate Output",
|
|
252
|
+
type: "object",
|
|
253
|
+
additionalProperties: false,
|
|
254
|
+
required: [
|
|
255
|
+
"schemaVersion",
|
|
256
|
+
"status",
|
|
257
|
+
"command",
|
|
258
|
+
"repositoryPath",
|
|
259
|
+
"periodType",
|
|
260
|
+
"passHistoryFilePath",
|
|
261
|
+
"outputFilePath",
|
|
262
|
+
"warnings",
|
|
263
|
+
"renderMode",
|
|
264
|
+
"reportProvider",
|
|
265
|
+
"facts",
|
|
266
|
+
"config",
|
|
267
|
+
"summary"
|
|
268
|
+
],
|
|
269
|
+
properties: {
|
|
270
|
+
schemaVersion: { type: "string" },
|
|
271
|
+
status: { enum: ["ok", "error"] },
|
|
272
|
+
command: { const: "report generate" },
|
|
273
|
+
repositoryPath: nullableString,
|
|
274
|
+
periodType: { enum: ["daily", "weekly", "monthly", "quarterly", "yearly", null] },
|
|
275
|
+
passHistoryFilePath: nullableString,
|
|
276
|
+
outputFilePath: nullableString,
|
|
277
|
+
warnings: {
|
|
278
|
+
type: "array",
|
|
279
|
+
items: { type: "string" }
|
|
280
|
+
},
|
|
281
|
+
renderMode: { enum: ["local", "ai", "ai-fallback-local"] },
|
|
282
|
+
reportProvider: { type: ["string", "null"] },
|
|
283
|
+
facts: {
|
|
284
|
+
type: ["object", "null"]
|
|
285
|
+
},
|
|
286
|
+
config: publicCliConfigSchema,
|
|
287
|
+
summary: { type: "string" },
|
|
288
|
+
error: {
|
|
289
|
+
type: "object",
|
|
290
|
+
additionalProperties: false,
|
|
291
|
+
required: ["code", "message"],
|
|
292
|
+
properties: {
|
|
293
|
+
code: { enum: ["CONFIG_ERROR", "RUNTIME_ERROR"] },
|
|
294
|
+
message: { type: "string" }
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
function getSchemaDocument(target) {
|
|
300
|
+
switch (target) {
|
|
301
|
+
case "config-file":
|
|
302
|
+
return exports.smartCommitCliFileSchema;
|
|
303
|
+
case "config-resolve":
|
|
304
|
+
return exports.configResolveOutputSchema;
|
|
305
|
+
case "bridge":
|
|
306
|
+
return exports.bridgeOutputSchema;
|
|
307
|
+
case "report-generate":
|
|
308
|
+
return exports.reportGenerateOutputSchema;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";;;AA+SA,8CAWC;AA1TY,QAAA,+BAA+B,GAAG,OAAO,CAAC;AAIvD,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;AACpD,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;AAEpD,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,CAAC;IAChG,UAAU,EAAE;QACV,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,kBAAkB,CAAC;YAC5E,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBA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B,CAAC;IACtC,CAAC;AACH,CAAC"}
|
package/out/git.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitExecutionError = void 0;
|
|
4
|
+
exports.resolveGitRepositoryRoot = resolveGitRepositoryRoot;
|
|
5
|
+
exports.getStagedDiffSnapshot = getStagedDiffSnapshot;
|
|
6
|
+
exports.getCurrentBranch = getCurrentBranch;
|
|
7
|
+
exports.createCommit = createCommit;
|
|
8
|
+
exports.getHeadCommitSha = getHeadCommitSha;
|
|
9
|
+
exports.hasWorkingTreeChanges = hasWorkingTreeChanges;
|
|
10
|
+
exports.hasUpstreamBranch = hasUpstreamBranch;
|
|
11
|
+
exports.pushCurrentBranch = pushCurrentBranch;
|
|
12
|
+
exports.stageAllChanges = stageAllChanges;
|
|
13
|
+
const node_child_process_1 = require("node:child_process");
|
|
14
|
+
const node_util_1 = require("node:util");
|
|
15
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
16
|
+
const GIT_MAX_BUFFER = 10 * 1024 * 1024;
|
|
17
|
+
class GitExecutionError extends Error {
|
|
18
|
+
command;
|
|
19
|
+
stderr;
|
|
20
|
+
constructor(message, command, stderr) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.command = command;
|
|
23
|
+
this.stderr = stderr;
|
|
24
|
+
this.name = "GitExecutionError";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.GitExecutionError = GitExecutionError;
|
|
28
|
+
async function resolveGitRepositoryRoot(repositoryPath) {
|
|
29
|
+
const { stdout } = await runGit(repositoryPath, ["rev-parse", "--show-toplevel"], "git rev-parse --show-toplevel");
|
|
30
|
+
const root = stdout.trim();
|
|
31
|
+
if (!root) {
|
|
32
|
+
throw new GitExecutionError("Git repository root could not be resolved.", "git rev-parse --show-toplevel");
|
|
33
|
+
}
|
|
34
|
+
return root;
|
|
35
|
+
}
|
|
36
|
+
async function getStagedDiffSnapshot(repositoryPath) {
|
|
37
|
+
const { stdout } = await runGit(repositoryPath, ["diff", "--cached", "--no-ext-diff", "--unified=3"], "git diff --cached --no-ext-diff --unified=3");
|
|
38
|
+
const changedFilesResult = await runGit(repositoryPath, ["diff", "--cached", "--name-only", "--diff-filter=ACMR"], "git diff --cached --name-only --diff-filter=ACMR");
|
|
39
|
+
return {
|
|
40
|
+
diff: stdout,
|
|
41
|
+
changedFiles: changedFilesResult.stdout
|
|
42
|
+
.split(/\r?\n/)
|
|
43
|
+
.map((line) => line.trim())
|
|
44
|
+
.filter((line) => line.length > 0),
|
|
45
|
+
fullDiffChars: stdout.length
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async function getCurrentBranch(repositoryPath) {
|
|
49
|
+
try {
|
|
50
|
+
const { stdout } = await runGit(repositoryPath, ["symbolic-ref", "--quiet", "--short", "HEAD"], "git symbolic-ref --quiet --short HEAD");
|
|
51
|
+
const branchName = stdout.trim();
|
|
52
|
+
if (branchName) {
|
|
53
|
+
return branchName;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (!(error instanceof GitExecutionError)) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const { stdout } = await runGit(repositoryPath, ["rev-parse", "--abbrev-ref", "HEAD"], "git rev-parse --abbrev-ref HEAD");
|
|
62
|
+
return stdout.trim();
|
|
63
|
+
}
|
|
64
|
+
async function createCommit(repositoryPath, message) {
|
|
65
|
+
await runGit(repositoryPath, ["commit", "--message", message], "git commit --message <message>");
|
|
66
|
+
}
|
|
67
|
+
async function getHeadCommitSha(repositoryPath) {
|
|
68
|
+
const { stdout } = await runGit(repositoryPath, ["rev-parse", "HEAD"], "git rev-parse HEAD");
|
|
69
|
+
const sha = stdout.trim();
|
|
70
|
+
if (!sha) {
|
|
71
|
+
throw new GitExecutionError("HEAD commit SHA could not be resolved.", "git rev-parse HEAD");
|
|
72
|
+
}
|
|
73
|
+
return sha;
|
|
74
|
+
}
|
|
75
|
+
async function hasWorkingTreeChanges(repositoryPath) {
|
|
76
|
+
const { stdout } = await runGit(repositoryPath, ["status", "--porcelain", "-u"], "git status --porcelain -u");
|
|
77
|
+
return stdout.trim().length > 0;
|
|
78
|
+
}
|
|
79
|
+
async function hasUpstreamBranch(repositoryPath) {
|
|
80
|
+
try {
|
|
81
|
+
const { stdout } = await runGit(repositoryPath, ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"], "git rev-parse --abbrev-ref --symbolic-full-name @{upstream}");
|
|
82
|
+
return stdout.trim().length > 0;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (error instanceof GitExecutionError &&
|
|
86
|
+
((error.stderr && /no upstream configured|no upstream/i.test(error.stderr)) ||
|
|
87
|
+
/@{upstream}|no upstream/i.test(error.message))) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function pushCurrentBranch(repositoryPath, timeoutMs) {
|
|
94
|
+
await runGit(repositoryPath, ["push"], "git push", { timeoutMs });
|
|
95
|
+
}
|
|
96
|
+
async function stageAllChanges(repositoryPath) {
|
|
97
|
+
await runGit(repositoryPath, ["add", "-A"], "git add -A");
|
|
98
|
+
}
|
|
99
|
+
async function runGit(cwd, args, commandLabel, options = {}) {
|
|
100
|
+
try {
|
|
101
|
+
const result = await execFileAsync("git", args, {
|
|
102
|
+
cwd,
|
|
103
|
+
maxBuffer: GIT_MAX_BUFFER,
|
|
104
|
+
...(options.timeoutMs ? { timeout: options.timeoutMs } : {})
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
stdout: result.stdout,
|
|
108
|
+
stderr: result.stderr
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
113
|
+
const stderr = typeof error === "object" && error !== null && "stderr" in error && typeof error.stderr === "string"
|
|
114
|
+
? error.stderr
|
|
115
|
+
: undefined;
|
|
116
|
+
throw new GitExecutionError(`${commandLabel} failed: ${message}`, commandLabel, stderr);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=git.js.map
|
package/out/git.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";;;AAuBA,4DAQC;AAED,sDAoBC;AAED,4CAmBC;AAED,oCAEC;AAED,4CAQC;AAED,sDAGC;AAED,8CAmBC;AAED,8CAEC;AAED,0CAEC;AA1HD,2DAA8C;AAC9C,yCAAsC;AAEtC,MAAM,aAAa,GAAG,IAAA,qBAAS,EAAC,6BAAQ,CAAC,CAAC;AAC1C,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAQxC,MAAa,iBAAkB,SAAQ,KAAK;IAGxB;IACA;IAHlB,YACE,OAAe,EACC,OAAe,EACf,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAS;QAG/B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AATD,8CASC;AAEM,KAAK,UAAU,wBAAwB,CAAC,cAAsB;IACnE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE,+BAA+B,CAAC,CAAC;IACnH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,iBAAiB,CAAC,4CAA4C,EAAE,+BAA+B,CAAC,CAAC;IAC7G,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAEM,KAAK,UAAU,qBAAq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