🚀 Day 20:拥抱开源 —— GitHub 仓库建设与 Release 发布
今日目标:在本地建立Git仓库并配置严谨的.gitignore以实现源码级合规、避免敏感信息泄露;编写专业的README.md完成门面建设;最后将代码推送至GitHub并发布v1.0版本Release,供开发者克隆下载。
💻 第一部分:本地 Git 初始化与严谨的 .gitignore
虽然我们在 Day 19 使用 tar 命令排除了隐私目录,但在通过 Git 进行版本控制时,如果没有配置好屏蔽规则,你的真实 API Key 依然会被 git add . 连锅端并推送到公网!
请打开你的终端,进入插件根目录:
cd /opt/splunk/etc/apps/TA-peak-llm-analyzer
1. 初始化 Git 仓库:
git init
2. 创建 .gitignore 文件:
vi .gitignore
进入 vi 后,输入 :set paste 开启防干扰模式,按 i 粘贴以下规则:
# ==========================================
# PEAK AI Hunter - Security & Splunk Ignores
# ==========================================
# 1. 绝对禁止提交的本地隐私目录与配置
local/
metadata/local.meta
*.conf.spec.bak
# 2. Python 缓存与编译垃圾
__pycache__/
*.py[cod]
*$py.class
*.so
# 3. 操作系统环境文件
.DS_Store
Thumbs.db
# 4. 打包生成的 Release 文件 (避免仓库体积暴增)
*.spl
*.tar.gz
保存并退出 (Esc -> :wq)。有了这个文件,你就可以放心大胆地执行全量提交了。
💻 第二部分:撰写极客风的 README.md
开源项目的 README.md 就是产品的灵魂。一个优秀的 README 必须包含:动态徽章、核心特性、架构说明以及傻瓜式的安装指引。
在插件根目录创建 README 文件:
vi README.md
将以下英文/国际化视角的模板粘贴进去(这正是你在教程一开始所见到的顶级排版):
# 🚀 Splunk PEAK AI Threat Hunter




An enterprise-grade Splunk Add-on that transforms your SOC into an autonomous Threat Hunting operation center based on the **PEAK Framework** (Prepare, Execute, Act).
## ✨ Core Features
* **Autonomous Reasoning**: Dynamically generates ABLE hypothesis and multi-round drill-down SPL queries.
* **FinOps Tracking**: Granular tracking of LLM API token consumption and financial costs per hunt.
* **Executive Dashboard**: A dark-themed, pure XML dashboard displaying real-time risk scores and automated hunting trajectories.
* **Bulletproof Architecture**: Built-in context truncation, hallucination safeguards, and robust cross-phase data validation.
## 📦 Installation Guide
1. Go to the [Releases](https://github.com/YourGitHubName/TA-peak-llm-analyzer/releases) page and download the latest `TA-peak-llm-analyzer-1.0.x.spl` package.
2. In your Splunk Web UI, navigate to **Manage Apps** -> **Install app from file**.
3. Upload the `.spl` file and restart Splunk if prompted.
4. Navigate to the App's **Configuration** page to securely enter your LLM API Key and Base URL.
## 🤝 Contribution
Contributions are highly welcome! Please ensure you do not commit any files within the `local/` directory. Submit your Pull Requests to the `main` branch.
保存并退出 (Esc -> :wq)。
💻 第三部分:推送至 GitHub 与发布 v1.0 Release
现在,代码合规且文档齐备,是时候向世界宣告你的成果了。
1. 提交本地代码:
git add .
git commit -m "feat: Initial release of PEAK AI Hunter v1.0 with robust architecture and executive dashboard"
2. 关联并推送至远程仓库:在浏览器中登录你的 GitHub,新建一个名为 TA-peak-llm-analyzer 的公开仓库(不要勾选初始化 README)。然后在终端执行:(注意:请将 YourGitHubName 替换为你真实的 GitHub 用户名)
git branch -M main
git remote add origin https://github.com/YourGitHubName/TA-peak-llm-analyzer.git
git push -u origin main
3. 发布闪亮的 v1.0 Release:代码推送到 GitHub 后,打开你的 GitHub 仓库页面:
• 点击右侧的 Releases,然后点击 Draft a new release。
• Tag version: 输入 v1.0.0。
• Release title: 输入 PEAK AI Hunter v1.0.0 - Enterprise Edition。
• Description: 简述本次发布包含的自动化引擎、FinOps 统计和高级大屏特性。
• Attach binaries: 将我们在 Day 19 打包生成的 TA-peak-llm-analyzer-1.0.0.spl 文件拖拽上传到这里!
• 点击底部的 Publish release 按钮。
🎉 Day 20 结语:
当你在 GitHub 上看到那个带有 .spl 附件的绿色 Release 徽标时,你已经完成了一次真正的产品化交付。你的代码不再是孤芳自赏的实验品,而是全球 Splunk 开发者和安全工程师都可以一键下载、安装的强大开源资产。
最后一步,也是最艰难的一步。明天,我们将迎来本教程的最终章——Day 21:进军殿堂 —— Splunkbase 上架与 AppInspect 认证。我们将直面 Splunk 官方的底层代码审计,完成敲钟上市的最后冲刺!
👇 全套教程多平台同步更新 👇
https://blog.csdn.net/thewindrider/category_13144991.html
https://gitcode.com/Chang_feng_Po/Splunk-AI-PEAK-Tutorial
夜雨聆风