@yorha2b-lab/autodev 2.1.5 → 2.1.7
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.
|
@@ -21,11 +21,16 @@ jobs:
|
|
|
21
21
|
token: ${{ secrets.STATS_TOKEN }}
|
|
22
22
|
fetch-depth: 0
|
|
23
23
|
|
|
24
|
+
# 1. 环境准备:安装绘图依赖
|
|
25
|
+
- name: Setup Plotting Environment
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install matplotlib pandas
|
|
29
|
+
|
|
30
|
+
# 2. 情报采集与账本物理焊接
|
|
24
31
|
- name: Intelligence Gathering & Sovereign Merge
|
|
25
32
|
run: |
|
|
26
|
-
echo "🤖 Pod 042:
|
|
27
|
-
|
|
28
|
-
# A. [情报收集]:修正 API 路径,加入 /popular/ 层级
|
|
33
|
+
echo "🤖 Pod 042: 启动‘全频道情报采集协议’..."
|
|
29
34
|
curl -s -H "Authorization: token ${{ secrets.STATS_TOKEN }}" \
|
|
30
35
|
-H "Accept: application/vnd.github.v3+json" \
|
|
31
36
|
https://api.github.com/repos/${{ github.repository }}/traffic/clones > raw_clones.json
|
|
@@ -34,12 +39,10 @@ jobs:
|
|
|
34
39
|
-H "Accept: application/vnd.github.v3+json" \
|
|
35
40
|
https://api.github.com/repos/${{ github.repository }}/traffic/popular/referrers > raw_referrers.json
|
|
36
41
|
|
|
37
|
-
# B. [格式处理]
|
|
38
42
|
mkdir -p ghrs-data
|
|
39
43
|
echo "date,clones,uniques" > /tmp/new_data.csv
|
|
40
44
|
jq -r '.clones[] | "\(.timestamp[0:10]),\(.count),\(.uniques)"' raw_clones.json >> /tmp/new_data.csv
|
|
41
45
|
|
|
42
|
-
# C. [物理焊接]
|
|
43
46
|
LEDGER="ghrs-data/clones_ledger.csv"
|
|
44
47
|
if [ ! -f "$LEDGER" ]; then
|
|
45
48
|
cp /tmp/new_data.csv "$LEDGER"
|
|
@@ -53,24 +56,64 @@ jobs:
|
|
|
53
56
|
if(length(a[3])==1) a[3]="0"a[3];
|
|
54
57
|
printf "%s-%s-%s,%s,%s\n", a[1], a[2], a[3], $2, $3
|
|
55
58
|
}' | awk -F',' '!a[$1]++' | sort -r > /tmp/final_ledger.csv
|
|
56
|
-
|
|
57
59
|
echo "date,clones,uniques" > "$LEDGER"
|
|
58
60
|
cat /tmp/final_ledger.csv >> "$LEDGER"
|
|
59
61
|
fi
|
|
60
62
|
|
|
61
|
-
# D. [战绩结算]
|
|
62
63
|
TOTAL_CLONES=$(awk -F',' 'NR>1 {sum+=$2} END {print sum}' "$LEDGER")
|
|
63
64
|
echo "{\"total_clones\": $TOTAL_CLONES}" > bunker-stats.json
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
# 3. 🧬 【核心新增】:构筑战绩可视化图像
|
|
67
|
+
- name: Construct Visual Radar
|
|
68
|
+
run: |
|
|
69
|
+
echo "🤖 Pod 042: 执行‘图像构筑协议’..."
|
|
70
|
+
python3 <<EOF
|
|
71
|
+
import pandas as pd
|
|
72
|
+
import matplotlib.pyplot as plt
|
|
73
|
+
import os
|
|
74
|
+
|
|
75
|
+
# 读取账本并反转顺序(变为正序绘图)
|
|
76
|
+
df = pd.read_csv('ghrs-data/clones_ledger.csv')
|
|
77
|
+
df['date'] = pd.to_datetime(df['date'])
|
|
78
|
+
df = df.sort_values('date')
|
|
79
|
+
|
|
80
|
+
# 样式设置:地堡深邃黑
|
|
81
|
+
plt.style.use('dark_background')
|
|
82
|
+
fig, ax = plt.subplots(figsize=(10, 5))
|
|
83
|
+
|
|
84
|
+
# 绘制曲线(地堡绿)
|
|
85
|
+
ax.plot(df['date'], df['clones'], color='#33cc33', marker='o', markersize=4, linewidth=2, label='Daily Clones')
|
|
86
|
+
ax.fill_between(df['date'], df['clones'], color='#33cc33', alpha=0.2)
|
|
87
|
+
|
|
88
|
+
ax.set_title('YoRHa Bunker - Physical Construction Trend', fontsize=14, pad=20, color='#33cc33')
|
|
89
|
+
ax.set_ylabel('Clone Count', color='#888')
|
|
90
|
+
ax.grid(color='#444', linestyle='--', linewidth=0.5)
|
|
91
|
+
|
|
92
|
+
# 旋转日期防挤占
|
|
93
|
+
plt.xticks(rotation=45, color='#888')
|
|
94
|
+
plt.yticks(color='#888')
|
|
95
|
+
|
|
96
|
+
# 自动保存
|
|
97
|
+
os.makedirs('plots', exist_ok=True)
|
|
98
|
+
plt.tight_layout()
|
|
99
|
+
plt.savefig('plots/clones_trend.png', dpi=100)
|
|
100
|
+
EOF
|
|
101
|
+
|
|
102
|
+
# 4. [报表装修]
|
|
103
|
+
- name: Assemble Report
|
|
104
|
+
run: |
|
|
66
105
|
echo "# 🛰️ 地堡运行报告 (Sovereign Report)" > README.md
|
|
67
|
-
echo "### 📊 累计物理克隆总数: **$
|
|
68
|
-
echo "数据已根据 AGPL-3.0 协议物理封存。愿人类荣光永存。" >> README.md
|
|
106
|
+
echo "### 📊 累计物理克隆总数: **$(grep -oE "[0-9]+" bunker-stats.json | head -n 1)**" >> README.md
|
|
69
107
|
echo "" >> README.md
|
|
108
|
+
|
|
109
|
+
# 💡 物理植入图片
|
|
110
|
+
echo "#### 📈 战绩增长雷达 (Growth Radar)" >> README.md
|
|
111
|
+
echo "" >> README.md
|
|
112
|
+
echo "" >> README.md
|
|
113
|
+
|
|
70
114
|
echo "#### 📡 流量来源实时追踪 (Top Referrers)" >> README.md
|
|
71
115
|
echo "| 来源站点 | 总访问量 | 独立指挥官 |" >> README.md
|
|
72
116
|
echo "| :--- | :--- | :--- |" >> README.md
|
|
73
|
-
# 增加判定,防止 referrers 为空时 jq 报错
|
|
74
117
|
if [ -s raw_referrers.json ]; then
|
|
75
118
|
jq -r '.[] | "| \(.referrer) | \(.count) | \(.uniques) |"' raw_referrers.json >> README.md
|
|
76
119
|
else
|
|
@@ -79,11 +122,12 @@ jobs:
|
|
|
79
122
|
echo "" >> README.md
|
|
80
123
|
echo "> 📡 信号状态:全频道在线 | 数据物理封存点: $(date +'%Y-%m-%d %H:%M:%S') CST" >> README.md
|
|
81
124
|
|
|
125
|
+
# 5. 最终物理封存
|
|
82
126
|
- name: Sync Ledger to Cloud
|
|
83
127
|
run: |
|
|
84
128
|
git config user.name github-actions
|
|
85
129
|
git config user.email github-actions@github.com
|
|
86
130
|
git add -A
|
|
87
131
|
TOTAL=$(grep -oE "[0-9]+" bunker-stats.json | head -n 1)
|
|
88
|
-
git commit -m "chore:
|
|
132
|
+
git commit -m "chore: sovereign update v5.0 - total $TOTAL [$(date +'%Y-%m-%d')]" || echo "no changes"
|
|
89
133
|
git push origin github-repo-stats --force
|
package/package.json
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
1
2
|
import { initOSS } from '../utils/utils'
|
|
2
|
-
import { useState, useEffect } from 'react'
|
|
3
3
|
import { UploadOutlined } from '@ant-design/icons'
|
|
4
4
|
import { Button, Tree, Radio, Input, Upload, Select, Cascader, Checkbox, DatePicker, InputNumber, TreeSelect, AutoComplete } from 'antd'
|
|
5
5
|
|
|
6
|
-
const AliyunOSSUpload = ({
|
|
6
|
+
const AliyunOSSUpload = ({ value, onChange, ...restProps }) => {
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const { oss, url, path, options, ...originUploadProps } = restProps
|
|
9
|
+
|
|
10
|
+
const [OSSData, setOSSData] = useState(oss)
|
|
9
11
|
|
|
10
12
|
const init = async () => {
|
|
11
13
|
try {
|
|
12
|
-
const result = await initOSS()
|
|
14
|
+
const result = await initOSS(url, options)
|
|
13
15
|
setOSSData(result)
|
|
14
16
|
} catch (err) {
|
|
15
17
|
console.log(err)
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
init()
|
|
21
|
-
}, [])
|
|
22
|
-
|
|
23
21
|
const handleChange = ({ fileList }) => onChange?.([...fileList])
|
|
24
22
|
|
|
25
23
|
const onRemove = file => {
|
|
@@ -36,11 +34,8 @@ const AliyunOSSUpload = ({ path, style, value, disabled, onChange }) => {
|
|
|
36
34
|
})
|
|
37
35
|
|
|
38
36
|
const beforeUpload = async file => {
|
|
39
|
-
if (!OSSData) {
|
|
40
|
-
return false
|
|
41
|
-
}
|
|
42
37
|
const expire = Number(OSSData.expire) * 1000
|
|
43
|
-
if (expire < Date.now()) {
|
|
38
|
+
if (expire < Date.now() || !OSSData) {
|
|
44
39
|
await init()
|
|
45
40
|
}
|
|
46
41
|
file.url = `${OSSData.dir ?? path}/${file.uid}_${file.name}`.replace(/\/\//g, '/')
|
|
@@ -55,10 +50,11 @@ const AliyunOSSUpload = ({ path, style, value, disabled, onChange }) => {
|
|
|
55
50
|
data: getExtraData,
|
|
56
51
|
action: OSSData?.host,
|
|
57
52
|
onChange: handleChange,
|
|
53
|
+
...originUploadProps
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
return (
|
|
61
|
-
<Upload {...uploadProps}
|
|
57
|
+
<Upload {...uploadProps}>
|
|
62
58
|
<Button icon={<UploadOutlined />}>选择文件</Button>
|
|
63
59
|
</Upload>
|
|
64
60
|
)
|
|
@@ -3,6 +3,16 @@ import { request } from './request'
|
|
|
3
3
|
|
|
4
4
|
//常用工具函数,使用前确保已安装对应模块
|
|
5
5
|
|
|
6
|
+
export const parseExcel = async file => {
|
|
7
|
+
/* const arrayBuffer = await file.arrayBuffer()
|
|
8
|
+
const XLSX = require('xlsx')
|
|
9
|
+
const workbook = XLSX.read(arrayBuffer, { type: 'array' })
|
|
10
|
+
const firstSheetName = workbook.SheetNames?.[0]
|
|
11
|
+
const worksheet = workbook.Sheets[firstSheetName]
|
|
12
|
+
const excelData = XLSX.utils.sheet_to_json(worksheet, { header: 1 })
|
|
13
|
+
return excelData.filter(item => item.length > 0) */
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
export const initOSS = async (url, options) => {
|
|
7
17
|
/* const OSS = require('ali-oss')
|
|
8
18
|
const crypto = require('crypto-js')
|
|
@@ -16,7 +26,7 @@ export const initOSS = async (url, options) => {
|
|
|
16
26
|
],
|
|
17
27
|
}))
|
|
18
28
|
const signature = crypto.enc.Base64.stringify(crypto.HmacSHA1(policy, accessKeySecret))
|
|
19
|
-
return { client, policy, signature, ...response?.data } */
|
|
29
|
+
return { client, policy, signature,host: `https://${bucket}.${endpoint.split('//')[1]}`, ...response?.data } */
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
export const formatQuery = (params, formItems) => {
|
|
@@ -55,7 +65,7 @@ export const exportDataToExcel = async (url, options, columns, fileName, formatt
|
|
|
55
65
|
if (col.exportRender) {
|
|
56
66
|
value = col.exportRender(value, item)
|
|
57
67
|
}
|
|
58
|
-
if (col.render) {
|
|
68
|
+
if (col.render&&!col.exportRender) {
|
|
59
69
|
const rendered = col.render(value, item)
|
|
60
70
|
value = typeof rendered === 'object' ? (rendered?.props?.children || value) : rendered
|
|
61
71
|
}
|