cloving 0.1.7 → 0.1.9
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 +0 -2
- package/dist/cloving_gpt/adapters/claude.js +5 -5
- package/dist/cloving_gpt/adapters/openai.js +5 -5
- package/dist/cloving_gpt/index.js +48 -56
- package/dist/commands/config.js +92 -23
- package/dist/commands/generate/code.js +187 -0
- package/dist/commands/generate/commit.js +30 -5
- package/dist/commands/generate/review.js +10 -3
- package/dist/commands/generate/sh.js +95 -0
- package/dist/commands/generate/shell.js +101 -0
- package/dist/commands/init.js +20 -8
- package/dist/commands/project/build.js +13 -11
- package/dist/commands/project/init.js +13 -3
- package/dist/index.js +41 -4
- package/dist/package.json +71 -0
- package/dist/utils/command_utils.js +11 -15
- package/dist/utils/config_utils.js +5 -5
- package/dist/utils/git_utils.js +1 -22
- package/dist/utils/string_utils.js +12 -17
- package/package.json +5 -2
|
@@ -35,29 +35,24 @@ const extractJsonMetadata = (response) => {
|
|
|
35
35
|
exports.extractJsonMetadata = extractJsonMetadata;
|
|
36
36
|
// Function to extract markdown from the AI response
|
|
37
37
|
const extractMarkdown = (response) => {
|
|
38
|
-
let markdownString;
|
|
39
|
-
//
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
markdownString = response;
|
|
47
|
-
}
|
|
48
|
-
const plaintextBlockStart = response.indexOf('```plaintext');
|
|
49
|
-
const plaintextBlockEnd = response.indexOf('```', plaintextBlockStart + 12);
|
|
50
|
-
if (plaintextBlockStart !== -1 && plaintextBlockEnd !== -1) {
|
|
51
|
-
markdownString = response.substring(plaintextBlockStart + 12, plaintextBlockEnd).trim();
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
markdownString = response;
|
|
38
|
+
let markdownString = response;
|
|
39
|
+
// Regular expression to match any ```<word> block
|
|
40
|
+
const codeBlockRegex = /```(\w+)\s*([\s\S]*?)\s*```/g;
|
|
41
|
+
let match;
|
|
42
|
+
while ((match = codeBlockRegex.exec(response)) !== null) {
|
|
43
|
+
// Extract the content inside the code block
|
|
44
|
+
const [, , content] = match;
|
|
45
|
+
markdownString = content.trim();
|
|
55
46
|
}
|
|
56
47
|
// Remove any data before the first '#'
|
|
57
48
|
const jsonStartIndex = markdownString.indexOf('#');
|
|
58
49
|
if (jsonStartIndex !== -1) {
|
|
59
50
|
markdownString = markdownString.substring(jsonStartIndex);
|
|
60
51
|
}
|
|
52
|
+
// Remove the last ``` if it exists
|
|
53
|
+
if (markdownString.endsWith('```')) {
|
|
54
|
+
markdownString = markdownString.substring(0, markdownString.length - 3);
|
|
55
|
+
}
|
|
61
56
|
return markdownString;
|
|
62
57
|
};
|
|
63
58
|
exports.extractMarkdown = extractMarkdown;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloving",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "tsc",
|
|
7
|
+
"build": "tsc && cp package.json dist/package.json",
|
|
8
8
|
"start": "node dist/index.js",
|
|
9
9
|
"watch": "tsc -w",
|
|
10
10
|
"check": "bash -c 'npx tsc --noEmit --skipLibCheck'",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"axios": "^1.7.2",
|
|
41
41
|
"cli-highlight": "^2.1.11",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
|
+
"copy-paste": "^1.5.3",
|
|
43
44
|
"eslint": "^9.6.0",
|
|
44
45
|
"eslint-config-prettier": "^9.1.0",
|
|
45
46
|
"eslint-config-raine": "^0.5.0",
|
|
@@ -56,7 +57,9 @@
|
|
|
56
57
|
"vite-node": "^2.0.1"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
60
|
+
"@types/copy-paste": "^1.1.33",
|
|
59
61
|
"@types/ini": "^4.1.1",
|
|
62
|
+
"@types/inquirer": "^9.0.7",
|
|
60
63
|
"@types/jest": "^29.5.12",
|
|
61
64
|
"@types/node": "^20.14.10",
|
|
62
65
|
"husky": "^9.0.11",
|