@yorha2b-lab/autodev 5.7.1 β†’ 5.7.2

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.
@@ -0,0 +1,28 @@
1
+ name: "CLA Assistant"
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_target:
7
+ types: [opened, synchronize, reopened]
8
+
9
+ permissions:
10
+ actions: write
11
+ contents: write
12
+ pull-requests: write
13
+ statuses: write
14
+
15
+ jobs:
16
+ CLA:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: "CLA Assistant Check"
20
+ if: (github.event.comment.issue.pull_request != null || github.event_name == 'pull_request_target')
21
+ uses: contributor-assistant/github-action@v2.4.0
22
+ env:
23
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24
+ with:
25
+ path-to-signatures: 'bunker/signatures/cla.json'
26
+ path-to-document: 'https://github.com/${{ github.repository }}/blob/main/CLA.md'
27
+ branch: 'main'
28
+ allowlist: 'bot*'
package/CLA.md ADDED
@@ -0,0 +1,41 @@
1
+ # Contributor License Agreement (CLA) for autodev
2
+
3
+ Thank you for your interest in contributing to **autodev** ("the Project").
4
+
5
+ In order to protect the Project, its users, and its maintainers, the Project requires a signed Contributor License Agreement ("CLA") before accepting any Pull Requests or code Contributions.
6
+
7
+ By signing this CLA, You agree to the following legally binding terms:
8
+
9
+ ---
10
+
11
+ ### 1. Definitions
12
+ - **"You" (or "Your")** means the individual or legal entity submitting the Contribution.
13
+ - **"Contribution"** means any code, documentation, bug fixes, features, or other materials submitted by You to the Project via Pull Requests, Commits, Issues, or other communication channels.
14
+
15
+ ### 2. Perpetual & Irrevocable License Grant
16
+ You hereby grant to the Project maintainers and all recipients of software distributed by the Project a **perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable** copyright and patent license to reproduce, prepare derivative works of, publicly display, sublicense, and distribute Your Contributions and any derivative works thereof.
17
+
18
+ ### 3. Irrevocability
19
+ Once Your Contribution is submitted and accepted into the Project, **this Agreement and the licenses granted herein cannot be revoked, withdrawn, or canceled by You for any reason**.
20
+
21
+ ### 4. Representation of Originality & Employer Clearance
22
+ You represent and warrant that:
23
+ - Your Contribution is **Your 100% original creation** and does not infringe upon any third-party copyrights, patents, trademarks, trade secrets, or proprietary rights.
24
+ - If Your employer or company holds rights to intellectual property created by You, You represent that You have received **explicit written permission or a legal waiver from Your employer** to submit this Contribution to the Project.
25
+
26
+ ### 5. Future Re-Licensing Authority
27
+ You explicitly agree that the Project maintainers reserve the sole and exclusive right to re-license, dual-license, or update the license terms of the Project (including under AGPL-3.0, MIT, Apache 2.0, or commercial enterprise licenses) in the future without requiring additional consent or notice to You.
28
+
29
+ ### 6. Disclaimer of Warranty
30
+ Except as expressly set forth herein, Your Contribution is provided on an **"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND**, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
31
+
32
+ ---
33
+
34
+ ### πŸ€– How to Sign
35
+
36
+ By replying in Your Pull Request with the exact phrase:
37
+ > **I have read the CLA Document and I hereby sign the CLA**
38
+
39
+ You acknowledge that You have read, understood, and agree to be bound by all terms in this Contributor License Agreement.
40
+
41
+ *Glory to Mankind.* πŸ€–βš”οΈ
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "5.7.1",
3
+ "version": "5.7.2",
4
4
  "description": "εŸΊδΊŽθ§†θ§‰ε€§ζ¨‘εž‹ηš„ε‰η«―(react+Antd)ε…¨θ‡ͺ动 CRUD δ»£η η”Ÿζˆε™¨",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
package/src/ai/index.js CHANGED
@@ -1,37 +1,3 @@
1
- const askAI = async ({ model, yorha, dialog, openAI, messages, response_format = { type: 'json_object' }, retryCount = 0 }) => {
2
-
3
- if (retryCount >= 3) {
4
- yorha.commander.report(dialog.bunker.linkSevered, 'red')
5
- throw new Error(dialog.bunker.linkSevered)
6
- }
7
-
8
- try {
9
- const response = await openAI.chat.completions.create({
10
- model,
11
- messages,
12
- top_p: 0.1,
13
- response_format,
14
- temperature: 0.01,
15
- })
16
- let raw = response.choices[0].message.content.trim()
17
- raw = raw.replace(/^```json\n?/, '').replace(/\n?```$/, '')
18
- const match = raw.match(/[\{\[][\s\S]*[\}\]]/)
19
- const JSON5 = require('json5')
20
- return JSON5.parse(match ? match[0] : raw)
21
- } catch (err) {
22
- const statusCode = err.status || err.response?.status
23
- const isAuthError = [401, 402].includes(statusCode)
24
- if (isAuthError) {
25
- yorha.commander.report(dialog.bunker.accessDenied, 'red')
26
- throw new Error(dialog.bunker.accessDenied)
27
- }
28
-
29
- yorha.commander.report(dialog.bunker.networkInstability(retryCount + 1))
30
-
31
- return askAI({ model, yorha, dialog, openAI, messages, response_format, retryCount: retryCount + 1 })
32
- }
33
- }
34
-
35
1
  module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
36
2
 
37
3
  const sharp = require('sharp')
@@ -40,12 +6,43 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
40
6
  const { UI_DESIGNER, API_DESIGNER, MOCK_DESIGNER } = system
41
7
  const { textModel, visionModel } = utils.foundation.getConfig()
42
8
 
9
+ const askAI = async ({ model, messages, response_format = { type: 'json_object' }, retryCount = 0 }) => {
10
+
11
+ if (retryCount >= 3) {
12
+ yorha.commander.report(dialog.bunker.linkSevered, 'red')
13
+ throw new Error(dialog.bunker.linkSevered)
14
+ }
15
+
16
+ try {
17
+ const response = await openAI.chat.completions.create({
18
+ model,
19
+ messages,
20
+ top_p: 0.1,
21
+ response_format,
22
+ temperature: 0.01,
23
+ })
24
+ let raw = response.choices[0].message.content.trim()
25
+ raw = raw.replace(/^```json\n?/, '').replace(/\n?```$/, '')
26
+ const match = raw.match(/[\{\[][\s\S]*[\}\]]/)
27
+ const JSON5 = require('json5')
28
+ return JSON5.parse(match ? match[0] : raw)
29
+ } catch (err) {
30
+ const statusCode = err.status || err.response?.status
31
+ const isAuthError = [401, 402].includes(statusCode)
32
+ if (isAuthError) {
33
+ yorha.commander.report(dialog.bunker.accessDenied, 'red')
34
+ throw new Error(dialog.bunker.accessDenied)
35
+ }
36
+
37
+ yorha.commander.report(dialog.bunker.networkInstability(retryCount + 1))
38
+
39
+ return askAI({ model, yorha, dialog, openAI, messages, response_format, retryCount: retryCount + 1 })
40
+ }
41
+ }
42
+
43
43
  return {
44
44
  generateMock: async ({ columns, fileName }) => {
45
45
  return askAI({
46
- yorha,
47
- openAI,
48
- dialog,
49
46
  model: textModel,
50
47
  messages: [
51
48
  { role: 'system', content: MOCK_DESIGNER },
@@ -55,9 +52,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
55
52
  },
56
53
  nameSimilarity: async ({ fileName, english }) => {
57
54
  return askAI({
58
- yorha,
59
- openAI,
60
- dialog,
61
55
  model: textModel,
62
56
  messages: [
63
57
  { role: 'system', content: UI_DESIGNER },
@@ -67,9 +61,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
67
61
  },
68
62
  apiParser: async ({ bunkerAnchors, realApis }) => {
69
63
  return askAI({
70
- yorha,
71
- openAI,
72
- dialog,
73
64
  model: textModel,
74
65
  messages: [
75
66
  { role: 'system', content: API_DESIGNER },
@@ -85,9 +76,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
85
76
  const base64Image = compressedBuffer.toString('base64')
86
77
 
87
78
  return askAI({
88
- yorha,
89
- openAI,
90
- dialog,
91
79
  model: visionModel,
92
80
  messages: [
93
81
  { role: 'system', content: UI_DESIGNER },
@@ -104,9 +92,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
104
92
  },
105
93
  alignResponseFields: async ({ responseStr, resourceStr }) => {
106
94
  return askAI({
107
- yorha,
108
- openAI,
109
- dialog,
110
95
  model: textModel,
111
96
  messages: [
112
97
  { role: 'system', content: API_DESIGNER },