@yorha2b-lab/autodev 2.1.1 → 2.1.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.
@@ -49,18 +49,34 @@ jobs:
49
49
  if [ -d "/tmp/bunker_assets/plots" ]; then sudo cp -r /tmp/bunker_assets/plots . ; fi
50
50
  if [ -f "report.md" ]; then sudo mv report.md README.md; fi
51
51
 
52
- # 4. 🔥 核心逻辑:执行全量战绩加和
53
- echo "🤖 Pod 042: 正在执行‘战绩全量加和协议’..."
54
- CSV_FILE="ghrs-data/views_clones_aggregate.csv"
55
- if [ -f "$CSV_FILE" ]; then
56
- # 使用 awk 物理加和第 2 列 (clones_total)
57
- TOTAL_CLONES=$(awk -F',' 'NR>1 {sum+=$2} END {print sum}' "$CSV_FILE")
58
- echo "{\"total_clones\": $TOTAL_CLONES}" > bunker-stats.json
59
- echo "✅ 构筑成功:地堡全时段总克隆数为 $TOTAL_CLONES"
52
+ # 4. 🔥 核心逻辑优化:精准定位 README 中的 Total Clones 累计值
53
+ echo "🤖 Pod 042: 正在执行‘精准数据侦察协议’..."
54
+
55
+ TARGET_FILE="README.md"
56
+ if [ ! -f "$TARGET_FILE" ]; then TARGET_FILE="report.md"; fi
57
+
58
+ if [ -f "$TARGET_FILE" ]; then
59
+ # 💡 精准定位逻辑:
60
+ # 1. 寻找包含 "Total clones" 的行
61
+ # 2. 锁定该行之后的第一个 "Cumulative" 关键字
62
+ # 3. 提取其中的数字
63
+ TOTAL_CLONES=$(awk '/Total clones/{flag=1; next} flag && /Cumulative/{print $0; flag=0}' "$TARGET_FILE" | grep -oE "[0-9]+" | head -n 1 || echo "")
64
+
65
+ if [ ! -z "$TOTAL_CLONES" ] && [ "$TOTAL_CLONES" -gt 0 ]; then
66
+ echo "{\"total_clones\": $TOTAL_CLONES}" > bunker-stats.json
67
+ echo "✅ 成功:已精准定位克隆总数:$TOTAL_CLONES"
68
+ else
69
+ echo "⚠️ 警告:精准提取失败,正在启动 CSV 账本回溯..."
70
+ # 最后的兜底:计算 CSV 的总和
71
+ CSV_FILE="ghrs-data/views_clones_aggregate.csv"
72
+ TOTAL_CLONES=$(awk -F',' 'NR>1 {sum+=$2} END {print sum}' "$CSV_FILE" || echo "0")
73
+ echo "{\"total_clones\": $TOTAL_CLONES}" > bunker-stats.json
74
+ fi
60
75
  else
61
- echo "❌ 严重错误:未发现 CSV 核心文件。" && exit 1
76
+ echo "❌ 严重错误:未发现任何报表文件。"
77
+ exit 1
62
78
  fi
63
-
79
+
64
80
  # 5. 封存推送
65
81
  sudo chown -R runner:docker .
66
82
  git config user.name github-actions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "基于视觉大模型的前端(react+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -1,5 +1,5 @@
1
1
  import { MyTable } from './MyTable'
2
- import { Modal, Button } from 'antd'
2
+ import { Modal, Space, Button } from 'antd'
3
3
  import { MySearchForm } from './MySearchForm'
4
4
  import { useTableQuery } from '../hooks/useTableQuery'
5
5
 
@@ -22,7 +22,7 @@ export const MyModalTable = ({ api, onOk, title, width, footer, visible, columns
22
22
  return (
23
23
  <Modal centered destroyOnClose title={title} width={width} open={visible} onOk={handleOk} footer={footer} onCancel={() => setModal({ visible: false })}>
24
24
  {formItems?.length > 0 && <MySearchForm search={search} formItems={formItems} setSearch={handleSearch} syncUrlParams={false} />}
25
- {functionButtons?.length > 0 && functionButtons.map(item => <Button key={item.name} type={item.type} onClick={item.onClick}>{item.name}</Button>)}
25
+ {functionButtons?.length > 0 && <Space>{functionButtons.map(item => <Button key={item.name} type={item.type} onClick={item.onClick}>{item.name}</Button>)}</Space>}
26
26
  <MyTable
27
27
  loading={loading}
28
28
  columns={columns}
@@ -45,11 +45,12 @@ export const timeRender = ({ time, date, minute }) => {
45
45
  }
46
46
  }
47
47
 
48
- export const exportDataToExcel = async (url, options, columns, fileName, resultKey = 'data') => {
48
+ export const exportDataToExcel = async (url, options, columns, fileName, formatter) => {
49
49
  /* const response = await request(url, options)
50
- if (response?.[resultKey]?.length > 0) {
50
+ const result = formatter ? formatter(response) : (response?.data ?? [])
51
+ if (result?.length > 0) {
51
52
  const XLSX = require('xlsx')
52
- const datas = response?.[resultKey]?.map(item => Object.fromEntries(columns.map(col => {
53
+ const datas = result.map(item => Object.fromEntries(columns.map(col => {
53
54
  let value = item[col.dataIndex]
54
55
  if (col.exportRender) {
55
56
  value = col.exportRender(value, item)