cloving 0.1.14 → 0.1.15
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/README.md +43 -2
- package/dist/commands/generate/context.js +27 -13
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Cloving
|
|
1
|
+
# Cloving CLI Documentation
|
|
2
2
|
|
|
3
3
|
Cloving is an innovative CLI tool designed to seamlessly integrate AI into various aspects of the developer workflow. It enhances productivity and code quality by leveraging AI for tasks such as generating commit messages, conducting code reviews, creating unit tests, and even assisting with entire project lifecycles.
|
|
4
4
|
|
|
@@ -133,6 +133,44 @@ Options:
|
|
|
133
133
|
- `-s, --silent`: Run without asking for confirmation
|
|
134
134
|
- `-m, --model <model>`: Select the model to use
|
|
135
135
|
|
|
136
|
+
### Generating Code
|
|
137
|
+
|
|
138
|
+
Generate code based on a prompt:
|
|
139
|
+
```bash
|
|
140
|
+
cloving generate code
|
|
141
|
+
```
|
|
142
|
+
Options:
|
|
143
|
+
- `--save`: Automatically save all files after generating the code
|
|
144
|
+
- `-i, --interactive`: Auto-save generated code and then show a new prompt with existing context to revise the code further
|
|
145
|
+
- `-s, --silent`: Run the command without asking for confirmation of submitting prompts
|
|
146
|
+
- `-m, --model <model>`: Select the model to use
|
|
147
|
+
- `-p, --prompt <prompt>`: Specify the prompt to use
|
|
148
|
+
- `-f, --files <filenames...>`: Specify filenames of files with context to use for generating code
|
|
149
|
+
|
|
150
|
+
### Generating Context
|
|
151
|
+
|
|
152
|
+
Create a context string for generating prompts outside of the cloving cli:
|
|
153
|
+
```bash
|
|
154
|
+
cloving generate context
|
|
155
|
+
```
|
|
156
|
+
Options:
|
|
157
|
+
- `-f, --files <filenames...>`: Specify filenames of files with context
|
|
158
|
+
|
|
159
|
+
### Generating Shell Commands
|
|
160
|
+
|
|
161
|
+
Generate a shell command based on a prompt:
|
|
162
|
+
```bash
|
|
163
|
+
cloving generate shell
|
|
164
|
+
```
|
|
165
|
+
or
|
|
166
|
+
```bash
|
|
167
|
+
cloving generate sh
|
|
168
|
+
```
|
|
169
|
+
Options:
|
|
170
|
+
- `-s, --silent`: Run without asking for confirmation of submitting prompts
|
|
171
|
+
- `-m, --model <model>`: Select the model to use
|
|
172
|
+
- `-p, --prompt <prompt>`: Specify the prompt to use
|
|
173
|
+
|
|
136
174
|
### Project Commands
|
|
137
175
|
|
|
138
176
|
Cloving now includes commands for managing entire projects:
|
|
@@ -159,7 +197,7 @@ Cloving now includes commands for managing entire projects:
|
|
|
159
197
|
|
|
160
198
|
## Command Line Options
|
|
161
199
|
|
|
162
|
-
Usage: `cloving [
|
|
200
|
+
Usage: `cloving [command] [options]`
|
|
163
201
|
|
|
164
202
|
Options:
|
|
165
203
|
- `-V, --version`: Output the version number
|
|
@@ -172,6 +210,9 @@ Commands:
|
|
|
172
210
|
- `commit`: Alias for cloving generate commit
|
|
173
211
|
- `generate`: Generate various items like unit-tests and code reviews
|
|
174
212
|
- `commit`: Generate a commit message and commit the changes
|
|
213
|
+
- `code`: Generate code based on a prompt
|
|
214
|
+
- `context`: Generate context for building a prompt outside of cloving
|
|
215
|
+
- `shell`: Generate a shell command based on a prompt
|
|
175
216
|
- `unit-tests`: Generate unit tests
|
|
176
217
|
- `review`: Review the code for committed changes
|
|
177
218
|
- `project`: Commands for managing Cloving projects
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
7
7
|
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
8
8
|
const copy_paste_1 = __importDefault(require("copy-paste"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
9
11
|
const command_utils_1 = require("../../utils/command_utils");
|
|
10
12
|
const config_utils_1 = require("../../utils/config_utils");
|
|
11
13
|
const generateContextPrompt = (files, contextFiles) => {
|
|
@@ -25,24 +27,36 @@ ${contextFileContents}
|
|
|
25
27
|
${files.join('\n')}`;
|
|
26
28
|
};
|
|
27
29
|
const context = async (options) => {
|
|
30
|
+
let { files } = options;
|
|
28
31
|
options.silent = (0, config_utils_1.getConfig)(options).globalSilent || false;
|
|
29
32
|
const allSrcFiles = await (0, config_utils_1.getAllFiles)(options, false);
|
|
30
33
|
let contextFiles = {};
|
|
31
34
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
]);
|
|
41
|
-
if (contextFile) {
|
|
42
|
-
contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(contextFile, contextFiles, options);
|
|
35
|
+
if (files) {
|
|
36
|
+
for (const file of files) {
|
|
37
|
+
const filePath = path_1.default.resolve(file);
|
|
38
|
+
if (await fs_1.default.promises.stat(filePath).then(stat => stat.isFile()).catch(() => false)) {
|
|
39
|
+
const content = await fs_1.default.promises.readFile(filePath, 'utf-8');
|
|
40
|
+
contextFiles[file] = content;
|
|
41
|
+
}
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
let includeMoreFiles = true;
|
|
46
|
+
while (includeMoreFiles) {
|
|
47
|
+
const { contextFile } = await inquirer_1.default.prompt([
|
|
48
|
+
{
|
|
49
|
+
type: 'input',
|
|
50
|
+
name: 'contextFile',
|
|
51
|
+
message: `Enter the relative path of a file or directory you would like to include as context (or press enter to continue):`,
|
|
52
|
+
},
|
|
53
|
+
]);
|
|
54
|
+
if (contextFile) {
|
|
55
|
+
contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(contextFile, contextFiles, options);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
includeMoreFiles = false;
|
|
59
|
+
}
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
const contextPrompt = generateContextPrompt(allSrcFiles, contextFiles);
|
package/dist/index.js
CHANGED