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.
Files changed (35) hide show
  1. package/dist/abstract_gpt/index.js +55 -0
  2. package/dist/cloving_gpt/adapters/Adapter.js +2 -0
  3. package/dist/cloving_gpt/adapters/gpt4all.js +29 -0
  4. package/dist/commands/analyze.js +47 -0
  5. package/dist/commands/check.js +7 -0
  6. package/dist/commands/commit.js +44 -0
  7. package/dist/commands/describe.js +235 -0
  8. package/dist/commands/generate/context.js +1 -1
  9. package/dist/commands/generate/documentation.js +11 -0
  10. package/dist/commands/generate/fizzbuzz.js +35 -0
  11. package/dist/commands/generate/init.js +15 -0
  12. package/dist/commands/generate/sh.js +95 -0
  13. package/dist/commands/project/build.js +88 -0
  14. package/dist/commands/project/complete.js +12 -0
  15. package/dist/commands/project/init.js +82 -0
  16. package/dist/commands/project/plan.js +108 -0
  17. package/dist/commands/review.js +50 -0
  18. package/dist/commands/tokens.js +1 -1
  19. package/dist/commands/unit_tests.js +150 -0
  20. package/dist/commands/update.js +7 -0
  21. package/dist/file2.js +4 -0
  22. package/dist/index.js +0 -0
  23. package/dist/managers/DocumentationManager.js +114 -0
  24. package/dist/managers/ProxyManager.js +9 -2
  25. package/dist/managers/StreamManager.js +1 -1
  26. package/dist/managers/src/managers/ProxyManager.js +1 -0
  27. package/dist/newfile.js +2 -0
  28. package/dist/package.json +26 -26
  29. package/dist/utils/command_utils.js +384 -0
  30. package/dist/utils/config_utils.js +21 -4
  31. package/dist/utils/gitUtils.js +42 -0
  32. package/dist/utils/git_utils.js +109 -7
  33. package/dist/utils/modelUtils.js +7 -0
  34. package/dist/utils/prompt_utils.js +3 -3
  35. package/package.json +26 -26
@@ -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
- return `Generate a concise and meaningful commit message based on a diff.
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
- An example of the output for this should look like the following:
201
+ Here is an example of a valid conventional commit message:
102
202
 
103
203
  \`\`\`plaintext
104
- Update dependencies and package versions
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
- - Upgrade Ruby gems including aws-sdk, honeybadger, irb, and rubocop
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:
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getModel = void 0;
4
+ const getModel = () => {
5
+ return process.env.CLOVING_MODEL || 'claude:claude-3-5-sonnet-20240620';
6
+ };
7
+ exports.getModel = getModel;
@@ -56,7 +56,7 @@ const generateCodegenPrompt = (contextFilesContent) => {
56
56
  ## Description of App
57
57
 
58
58
  \`\`\`json
59
- ${JSON.stringify((0, config_utils_1.getClovingConfig)(), null, 2)}
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.getClovingConfig)(), null, 2)}
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.getClovingConfig)(), null, 2)}
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.16",
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": "^5.3.8",
43
- "axios": "^1.7.3",
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": "^12.1.0",
46
+ "commander": "^13.1.0",
47
47
  "copy-paste": "^1.5.3",
48
- "eslint": "^8.57.0",
49
- "eslint-config-prettier": "^9.1.0",
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.29.1",
53
- "eslint-plugin-jsdoc": "^50.1.0",
54
- "eslint-plugin-n": "^16.6.2",
55
- "eslint-plugin-promise": "^6.6.0",
56
- "express": "^4.19.2",
57
- "ignore": "^5.3.2",
58
- "ini": "^4.1.3",
59
- "isbinaryfile": "^5.0.2",
60
- "nock": "^13.5.4",
61
- "vite": "^5.4.0",
62
- "vite-node": "^2.0.5"
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": "^4.17.21",
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.12",
71
- "@types/node": "^22.2.0",
72
- "husky": "^9.1.4",
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": "^2.2.2",
75
- "lint-staged": "^15.2.9",
76
- "prettier": "^3.2.5",
77
- "ts-jest": "^29.2.4",
78
- "typescript": "^5.5.4"
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",