cloving 0.3.16 → 0.3.18
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/dist/abstract_gpt/index.js +55 -0
- package/dist/cloving_gpt/adapters/Adapter.js +2 -0
- package/dist/cloving_gpt/adapters/gpt4all.js +29 -0
- package/dist/commands/analyze.js +47 -0
- package/dist/commands/check.js +7 -0
- package/dist/commands/commit.js +44 -0
- package/dist/commands/describe.js +235 -0
- package/dist/commands/generate/context.js +1 -1
- package/dist/commands/generate/documentation.js +11 -0
- package/dist/commands/generate/fizzbuzz.js +35 -0
- package/dist/commands/generate/init.js +15 -0
- package/dist/commands/generate/sh.js +95 -0
- package/dist/commands/project/build.js +88 -0
- package/dist/commands/project/complete.js +12 -0
- package/dist/commands/project/init.js +82 -0
- package/dist/commands/project/plan.js +108 -0
- package/dist/commands/review.js +50 -0
- package/dist/commands/tokens.js +1 -1
- package/dist/commands/unit_tests.js +150 -0
- package/dist/commands/update.js +7 -0
- package/dist/file2.js +4 -0
- package/dist/index.js +0 -0
- package/dist/managers/DocumentationManager.js +114 -0
- package/dist/managers/ProxyManager.js +9 -2
- package/dist/managers/StreamManager.js +1 -1
- package/dist/managers/src/managers/ProxyManager.js +1 -0
- package/dist/newfile.js +2 -0
- package/dist/package.json +26 -26
- package/dist/utils/command_utils.js +384 -0
- package/dist/utils/config_utils.js +21 -4
- package/dist/utils/gitUtils.js +42 -0
- package/dist/utils/git_utils.js +109 -7
- package/dist/utils/modelUtils.js +7 -0
- package/dist/utils/prompt_utils.js +3 -3
- package/package.json +26 -26
package/dist/utils/git_utils.js
CHANGED
|
@@ -7,9 +7,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.generateCommitMessagePrompt = exports.getCurrentBranchName = exports.getDefaultBranchName = exports.getGitDiff = void 0;
|
|
10
|
+
exports.generateCommitMessagePrompt = exports.readCommitlintConfig = exports.findCommitlintConfig = exports.getCurrentBranchName = exports.getDefaultBranchName = exports.getGitDiff = void 0;
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const readline_1 = __importDefault(require("readline"));
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const COMMITLINT_CONFIG_FILES = [
|
|
16
|
+
'.commitlintrc',
|
|
17
|
+
'.commitlintrc.json',
|
|
18
|
+
'.commitlintrc.yaml',
|
|
19
|
+
'.commitlintrc.yml',
|
|
20
|
+
'.commitlintrc.js',
|
|
21
|
+
'.commitlintrc.cjs',
|
|
22
|
+
'.commitlintrc.mjs',
|
|
23
|
+
'.commitlintrc.ts',
|
|
24
|
+
'.commitlintrc.cts',
|
|
25
|
+
'commitlint.config.js',
|
|
26
|
+
'commitlint.config.cjs',
|
|
27
|
+
'commitlint.config.mjs',
|
|
28
|
+
'commitlint.config.ts',
|
|
29
|
+
'commitlint.config.cts',
|
|
30
|
+
];
|
|
13
31
|
/**
|
|
14
32
|
* Prompts the user with a question and returns their answer.
|
|
15
33
|
* @param {string} question - The question to ask the user.
|
|
@@ -88,24 +106,108 @@ const getCurrentBranchName = () => {
|
|
|
88
106
|
}
|
|
89
107
|
};
|
|
90
108
|
exports.getCurrentBranchName = getCurrentBranchName;
|
|
109
|
+
/**
|
|
110
|
+
* Checks if a commitlint configuration file exists in the project.
|
|
111
|
+
* @returns {string | null} The path to the commitlint config file if found, null otherwise.
|
|
112
|
+
*/
|
|
113
|
+
const findCommitlintConfig = () => {
|
|
114
|
+
for (const configFile of COMMITLINT_CONFIG_FILES) {
|
|
115
|
+
if (fs_1.default.existsSync(configFile)) {
|
|
116
|
+
return configFile;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
};
|
|
121
|
+
exports.findCommitlintConfig = findCommitlintConfig;
|
|
122
|
+
/**
|
|
123
|
+
* Reads and parses the commitlint configuration file.
|
|
124
|
+
* @param {string} configPath - Path to the commitlint config file.
|
|
125
|
+
* @returns {object | null} The parsed configuration object or null if unable to parse.
|
|
126
|
+
*/
|
|
127
|
+
const readCommitlintConfig = (configPath) => {
|
|
128
|
+
try {
|
|
129
|
+
const ext = path_1.default.extname(configPath);
|
|
130
|
+
if (['.js', '.cjs', '.mjs', '.ts', '.cts'].includes(ext)) {
|
|
131
|
+
// For JavaScript/TypeScript config files, we can't safely require them
|
|
132
|
+
// as they might have dependencies or complex configurations
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
if (['.json', '', '.yaml', '.yml'].includes(ext)) {
|
|
136
|
+
const content = fs_1.default.readFileSync(configPath, 'utf-8');
|
|
137
|
+
if (ext === '.json' || ext === '') {
|
|
138
|
+
return JSON.parse(content);
|
|
139
|
+
}
|
|
140
|
+
// For YAML files, we'll just return the raw content as a string
|
|
141
|
+
return { config: content };
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
console.error('Error reading commitlint config:', error.message);
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
exports.readCommitlintConfig = readCommitlintConfig;
|
|
91
151
|
/**
|
|
92
152
|
* Generates a prompt for creating a commit message based on a Git diff.
|
|
93
153
|
* @param {string} diff - The Git diff to base the commit message on.
|
|
94
154
|
* @returns {string} A prompt string for generating a commit message.
|
|
95
155
|
*/
|
|
96
156
|
const generateCommitMessagePrompt = (diff) => {
|
|
97
|
-
|
|
157
|
+
// Check if commitlint is configured
|
|
158
|
+
const commitlintConfig = (0, exports.findCommitlintConfig)();
|
|
159
|
+
let configInfo = '';
|
|
160
|
+
if (commitlintConfig) {
|
|
161
|
+
const config = (0, exports.readCommitlintConfig)(commitlintConfig);
|
|
162
|
+
if (config) {
|
|
163
|
+
configInfo = `\nFound commitlint configuration at ${commitlintConfig}:
|
|
164
|
+
\`\`\`json
|
|
165
|
+
${JSON.stringify(config, null, 2)}
|
|
166
|
+
\`\`\`
|
|
167
|
+
Please ensure the commit message follows any additional rules specified in this configuration.
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return `Generate a conventional commit message following the Conventional Commits specification (www.conventionalcommits.org).${configInfo}
|
|
172
|
+
|
|
173
|
+
The commit message should follow this format:
|
|
174
|
+
<type>[optional scope]: <description>
|
|
175
|
+
|
|
176
|
+
[optional body]
|
|
177
|
+
|
|
178
|
+
[optional footer(s)]
|
|
179
|
+
|
|
180
|
+
Types must be one of:
|
|
181
|
+
1. revert: Reverts a previous commit
|
|
182
|
+
2. feat: A new feature
|
|
183
|
+
3. fix: A bug fix
|
|
184
|
+
4. refactor: A code change that neither fixes a bug nor adds a feature
|
|
185
|
+
5. perf: A code change that improves performance
|
|
186
|
+
6. build: Changes that affect the build system or external dependencies or updates to versions of dependencies or version bumps
|
|
187
|
+
7. test: Adding missing tests or correcting existing tests
|
|
188
|
+
8. docs: Documentation only changes
|
|
189
|
+
9. style: Changes that do not affect the meaning of the code
|
|
190
|
+
10. ci: Changes to our CI configuration files and scripts
|
|
191
|
+
11. chore: Other changes that don't modify src or test files
|
|
192
|
+
|
|
193
|
+
Use the order of types as an order of precedence for the commit message if there are multiple types in one commit.
|
|
194
|
+
|
|
195
|
+
The scope should be the part of the codebase affected.
|
|
196
|
+
The description should be imperative, present tense, and not capitalized.
|
|
197
|
+
Breaking changes should be indicated by "!" before the ":" or by "BREAKING CHANGE:" in the footer.
|
|
98
198
|
|
|
99
199
|
Do not add any commentary or context to the message other than the commit message itself.
|
|
100
200
|
|
|
101
|
-
|
|
201
|
+
Here is an example of a valid conventional commit message:
|
|
102
202
|
|
|
103
203
|
\`\`\`plaintext
|
|
104
|
-
|
|
204
|
+
feat(api): add new endpoint for user authentication
|
|
205
|
+
|
|
206
|
+
- Implement JWT token generation
|
|
207
|
+
- Add password hashing with bcrypt
|
|
208
|
+
- Create user validation middleware
|
|
105
209
|
|
|
106
|
-
|
|
107
|
-
- Update Node.js packages including esbuild, tinymce, and trix
|
|
108
|
-
- Bump TypeScript and ESLint related packages to latest versions
|
|
210
|
+
BREAKING CHANGE: 'auth' endpoint now requires API key in headers
|
|
109
211
|
\`\`\`
|
|
110
212
|
|
|
111
213
|
Here is the diff to help you write the commit message:
|
|
@@ -56,7 +56,7 @@ const generateCodegenPrompt = (contextFilesContent) => {
|
|
|
56
56
|
## Description of App
|
|
57
57
|
|
|
58
58
|
\`\`\`json
|
|
59
|
-
${JSON.stringify((0, config_utils_1.
|
|
59
|
+
${JSON.stringify((0, config_utils_1.getNearestClovingConfig)().config, null, 2)}
|
|
60
60
|
\`\`\`
|
|
61
61
|
|
|
62
62
|
## Special Files
|
|
@@ -99,7 +99,7 @@ ${prompts_1.CODEGEN_EXAMPLES}
|
|
|
99
99
|
## Description of App
|
|
100
100
|
|
|
101
101
|
\`\`\`json
|
|
102
|
-
${JSON.stringify((0, config_utils_1.
|
|
102
|
+
${JSON.stringify((0, config_utils_1.getNearestClovingConfig)().config, null, 2)}
|
|
103
103
|
\`\`\`
|
|
104
104
|
|
|
105
105
|
## Special Files
|
|
@@ -136,7 +136,7 @@ const generateReviewPrompt = (options, contextFiles) => {
|
|
|
136
136
|
.join('\n');
|
|
137
137
|
prompt += `### Description of App
|
|
138
138
|
|
|
139
|
-
${JSON.stringify((0, config_utils_1.
|
|
139
|
+
${JSON.stringify((0, config_utils_1.getNearestClovingConfig)().config, null, 2)}
|
|
140
140
|
|
|
141
141
|
${contextFileContents}
|
|
142
142
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloving",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"packageManager": "yarn@1.22.22",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,43 +39,43 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@inquirer/prompts": "^
|
|
43
|
-
"axios": "^1.7.
|
|
42
|
+
"@inquirer/prompts": "^7.3.2",
|
|
43
|
+
"axios": "^1.7.9",
|
|
44
44
|
"cli-highlight": "^2.1.11",
|
|
45
45
|
"colors": "^1.4.0",
|
|
46
|
-
"commander": "^
|
|
46
|
+
"commander": "^13.1.0",
|
|
47
47
|
"copy-paste": "^1.5.3",
|
|
48
|
-
"eslint": "^
|
|
49
|
-
"eslint-config-prettier": "^
|
|
48
|
+
"eslint": "^9.20.1",
|
|
49
|
+
"eslint-config-prettier": "^10.0.1",
|
|
50
50
|
"eslint-config-raine": "^0.5.0",
|
|
51
51
|
"eslint-config-standard": "^17.1.0",
|
|
52
|
-
"eslint-plugin-import": "^2.
|
|
53
|
-
"eslint-plugin-jsdoc": "^50.
|
|
54
|
-
"eslint-plugin-n": "^
|
|
55
|
-
"eslint-plugin-promise": "^
|
|
56
|
-
"express": "^4.
|
|
57
|
-
"ignore": "^
|
|
58
|
-
"ini": "^
|
|
59
|
-
"isbinaryfile": "^5.0.
|
|
60
|
-
"nock": "^
|
|
61
|
-
"vite": "^
|
|
62
|
-
"vite-node": "^
|
|
52
|
+
"eslint-plugin-import": "^2.31.0",
|
|
53
|
+
"eslint-plugin-jsdoc": "^50.6.3",
|
|
54
|
+
"eslint-plugin-n": "^17.15.1",
|
|
55
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
56
|
+
"express": "^4.21.2",
|
|
57
|
+
"ignore": "^7.0.3",
|
|
58
|
+
"ini": "^5.0.0",
|
|
59
|
+
"isbinaryfile": "^5.0.4",
|
|
60
|
+
"nock": "^14.0.1",
|
|
61
|
+
"vite": "^6.1.1",
|
|
62
|
+
"vite-node": "^3.0.6"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/body-parser": "^1.19.5",
|
|
66
66
|
"@types/copy-paste": "^1.1.33",
|
|
67
|
-
"@types/express": "^
|
|
67
|
+
"@types/express": "^5.0.0",
|
|
68
68
|
"@types/ini": "^4.1.1",
|
|
69
69
|
"@types/inquirer": "^9.0.7",
|
|
70
|
-
"@types/jest": "^29.5.
|
|
71
|
-
"@types/node": "^22.
|
|
72
|
-
"husky": "^9.1.
|
|
70
|
+
"@types/jest": "^29.5.14",
|
|
71
|
+
"@types/node": "^22.13.4",
|
|
72
|
+
"husky": "^9.1.7",
|
|
73
73
|
"jest": "^29.7.0",
|
|
74
|
-
"lint-prepush": "^
|
|
75
|
-
"lint-staged": "^15.
|
|
76
|
-
"prettier": "^3.
|
|
77
|
-
"ts-jest": "^29.2.
|
|
78
|
-
"typescript": "^5.
|
|
74
|
+
"lint-prepush": "^3.0.2",
|
|
75
|
+
"lint-staged": "^15.4.3",
|
|
76
|
+
"prettier": "^3.5.1",
|
|
77
|
+
"ts-jest": "^29.2.5",
|
|
78
|
+
"typescript": "^5.7.3"
|
|
79
79
|
},
|
|
80
80
|
"resolutions": {
|
|
81
81
|
"eslint": "8.57.0",
|