@yorha2b-lab/autodev 7.5.2 → 7.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "7.5.2",
3
+ "version": "7.5.3",
4
4
  "description": "基于 AI 视觉与语义协议的前端 (React+Antd) 代码构筑与旧系统重构引擎",
5
5
  "bin": {
6
6
  "bunker": "bin/bunker.js"
@@ -93,8 +93,14 @@ module.exports = async ({ llm, yorha, dialog, logistics }) => {
93
93
  const pagesConfig = result?.['BUNKER_API_ANCHOR_pages']
94
94
  if (pagesConfig) {
95
95
  const { uri: pagesApi, method: pagesMethod } = pagesConfig
96
- const definitions = (apiData.paths[pagesApi]?.[pagesMethod] ?? apiData.paths[pagesApi]?.[pagesMethod?.toLowerCase()])?.parameters?.flatMap(item => Object.values(item.schema ?? {})?.flatMap(def => def?.split('/')?.at(-1))) || []
97
- const parameters = apiData.definitions?.[definitions[0]]?.properties ?? {}
96
+ const schemas = apiData.definitions || apiData.components?.schemas || {}
97
+ const methodObj = apiData.paths[pagesApi]?.[pagesMethod] ?? apiData.paths[pagesApi]?.[pagesMethod?.toLowerCase()]
98
+ let schemaName = methodObj?.parameters?.flatMap(item => Object.values(item.schema ?? {})?.flatMap(def => def?.split('/')?.at(-1)))?.[0]
99
+ if (!schemaName && methodObj?.requestBody) {
100
+ const bodySchema = methodObj.requestBody.content?.['application/json']?.schema
101
+ schemaName = (bodySchema?.$ref || bodySchema?.items?.$ref)?.split('/')?.at(-1)
102
+ }
103
+ const parameters = schemas[schemaName]?.properties ?? {}
98
104
  const enumParams = Object.entries(parameters)?.filter(([_, value]) => value.hasOwnProperty('enum')) || []
99
105
  enumParamsMap[fileName] = contextStringify({
100
106
  maxLength: 100,
@@ -52,14 +52,13 @@ module.exports = {
52
52
  } else {
53
53
  pod042.update(spinner, dialog.pod042.uploadVisualMetadata)
54
54
  pageConfig = await recognizePage({ prompt: striker, filePath: mission.input, schema: require(`../workshop/${template}/protocols/striker.json`) })
55
- }
56
-
57
- const { similarity } = await nameSimilarity({ fileName, english: pageConfig.title?.english })
58
- if (similarity === 0) {
59
- fileName = pageConfig.title?.english
60
- targetDir = path.join(process.cwd(), pagesDir, pageConfig.title?.english)
61
- if (fs.existsSync(targetDir)) {
62
- targetDir = `${targetDir}_temp`
55
+ const { similarity } = await nameSimilarity({ fileName, english: pageConfig.title?.english })
56
+ if (similarity === 0) {
57
+ fileName = pageConfig.title?.english
58
+ targetDir = path.join(process.cwd(), pagesDir, pageConfig.title?.english)
59
+ if (fs.existsSync(targetDir)) {
60
+ targetDir = `${targetDir}_temp`
61
+ }
63
62
  }
64
63
  }
65
64
 
@@ -3,6 +3,13 @@ const initialParams = {{initParams}}
3
3
 
4
4
  const query = formatQuery(Object.fromEntries(new URLSearchParams(location.search).entries()), {{formItems}})
5
5
 
6
+ /**
7
+ * 💡 [BUNKER 战术锚点提示]
8
+ * 代码中带有 BUNKER_API_ANCHOR_ 前缀的为待通电接口。
9
+ * 1. 自动模式:配置 config.js 中的 apiDoc 后,系统将自动扫描 Swagger 并对齐真实路径;
10
+ * 2. 手动模式:搜索 BUNKER_API_ANCHOR 手动替换为真实接口。
11
+ */
12
+
6
13
  const { total, columns, loading, dataSource, search, setSearch, setDataSource, refresh } = useTableQuery({
7
14
  cols:tableColumns,
8
15
  initialParams: { ...initialParams, ...query },
@@ -111,7 +111,7 @@ module.exports = ({ template, logistics, headquarters }) => {
111
111
  },
112
112
  index: ({ fileName, pageConfig }) => {
113
113
  const hasTabs = pageConfig.tabs?.length > 0
114
- const hasPagination = pageConfig.table.pagination
114
+ const hasPagination = pageConfig.table?.pagination
115
115
  const hasFormItems = pageConfig.formItems?.length > 0
116
116
  const hasOperate = pageConfig.table?.operation?.length > 0
117
117
  const hasImageColumn = pageConfig.table?.columns?.some(item => item.type === 'image')