@greyworld/code-check-core 1.0.0 → 1.0.1
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 +55 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @greyworld/code-check-core
|
|
2
|
+
|
|
3
|
+
AI-powered code review core library.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @greyworld/code-check-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { CodeChecker } from "@greyworld/code-check-core";
|
|
15
|
+
|
|
16
|
+
async function main() {
|
|
17
|
+
const checker = new CodeChecker({
|
|
18
|
+
llm: {
|
|
19
|
+
apiKey: process.env.DASHSCOPE_API_KEY,
|
|
20
|
+
baseUrl: process.env.DASHSCOPE_BASE_URL,
|
|
21
|
+
model: process.env.QWEN_MODEL,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
await checker.initialize();
|
|
26
|
+
|
|
27
|
+
const report = await checker.check({
|
|
28
|
+
workflowId: "resource-check",
|
|
29
|
+
code: JSON.stringify({
|
|
30
|
+
providerRoot: "/path/to/terraform-provider-example",
|
|
31
|
+
serviceName: "ecs",
|
|
32
|
+
resourceName: "instance",
|
|
33
|
+
resourceType: "resource",
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
console.log(report);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
main().catch((err) => {
|
|
41
|
+
console.error(err);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
- `CodeChecker`: main entry for workflow registration and execution.
|
|
49
|
+
- `initialize()`: initializes checker and built-in workflows.
|
|
50
|
+
- `check({ workflowId, code })`: runs a workflow against input content.
|
|
51
|
+
- `listWorkflows()`: lists available workflows and rule metadata.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@greyworld/code-check-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "AI-powered code review core library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "greyworld",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
9
10
|
],
|
|
10
11
|
"main": "dist/index.js",
|
|
11
12
|
"types": "dist/index.d.ts",
|