Skip to content

Commit 44e7b88

Browse files
committed
major update
major update
1 parent c42c0db commit 44e7b88

35 files changed

+2661
-128
lines changed

README.md

Lines changed: 84 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cmd4coder - 命令行工具大全
22

3-
![Version](https://img.shields.io/badge/version-1.2.0-blue)
3+
![Version](https://img.shields.io/badge/version-1.5.0-blue)
44
![License](https://img.shields.io/badge/license-MIT-green)
55
![Go Version](https://img.shields.io/badge/go-%3E%3D1.21-blue)
66
![Test Coverage](https://img.shields.io/badge/coverage-75%25-green)
@@ -12,7 +12,7 @@ cmd4coder 是一个面向运维工程师和开发者的命令行工具大全,
1212

1313
### ✨ 核心特性
1414

15-
- 📚 **全面的命令清单**: 涵盖 Linux、编程语言工具链、诊断工具、网络工具、Kubernetes生态系统等32+分类,420+精选命令
15+
- 📚 **全面的命令清单**: 涵盖 Linux、编程语言工具链、诊断工具、网络工具、Kubernetes生态系统等38+分类,500+精选命令
1616
- 🔍 **强大的搜索功能**: 支持模糊搜索、关键词匹配和智能排序,4级优先级匹配算法
1717
-**快速查询**: 本地化存储,无需网络,毫秒级响应,LRU缓存优化
1818
- 📝 **详细的命令说明**: 包含用法、选项、示例、注意事项和风险提示
@@ -105,7 +105,26 @@ go run ./cmd/cli -d ./data
105105
- `?`: 显示帮助
106106
- `q`: 退出
107107

108-
## 📚 命令清单
108+
## 📚 文档组织
109+
110+
项目文档按照用途进行了分类整理:
111+
112+
### 📖 使用指南 (docs/guides/)
113+
- **DEPLOYMENT.md**: 部署指南和最佳实践
114+
115+
### 📊 技术参考 (docs/reference/)
116+
- **IMPLEMENTATION_SUMMARY.md**: 实现摘要和技术细节
117+
- **K8S_INTEGRATION_REPORT.md**: Kubernetes集成报告
118+
- **KUBERNETES_COMMANDS.md**: Kubernetes命令清单
119+
120+
### 🏗️ 架构文档 (docs/architecture/)
121+
- **ARCHITECTURE.md**: 系统架构设计文档
122+
123+
### 📈 项目报告 (docs/reports/)
124+
包含项目开发过程中的各类报告文档。
125+
126+
### 🎨 网站资源 (docs/css/, docs/js/, docs/assets/)
127+
项目官网的前端资源文件。
109128

110129
### 操作系统 (45个命令)
111130
- ✅ Ubuntu 系统命令 (20个)
@@ -127,18 +146,20 @@ go run ./cmd/cli -d ./data
127146
- ✅ 网络诊断 (tcpdump, netstat, ss等) (6个)
128147
- ✅ HTTP 工具 (curl, wget等) (5个)
129148

130-
### 容器编排 (140+个命令)
149+
### 容器编排 (200+个命令)
131150
- ✅ Docker 命令 (10个)
132-
- ✅ Kubernetes 命令 (kubectl) (16个)
133-
- ✅ K8s 集群管理 (kubeadm, kubelet, etcdctl) (12个)
151+
- ✅ Kubernetes 命令 (kubectl) (25个)
152+
- ✅ K8s 集群管理 (kubeadm, kubelet, etcdctl) (20个)
134153
- ✅ K8s 容器运行时 (crictl, ctr, containerd) (9个)
135-
- ✅ K8s 监控日志 (prometheus, grafana, opentelemetry, loki, fluentd) (28个)
136-
- ✅ K8s 网络插件 (calicoctl, cilium) (7个)
137-
- ✅ K8s 存储管理 (helm) (8个)
154+
- ✅ K8s 监控日志 (prometheus, grafana, opentelemetry, loki, fluentd) (45个)
155+
- ✅ K8s 网络插件 (calicoctl, cilium) (15个)
156+
- ✅ K8s 存储管理 (PV/PVC, StorageClass) (25个)
157+
- ✅ K8s Helm包管理 (35个)
138158
- ✅ K8s CI/CD (argocd, flux, tekton) (11个)
139159
- ✅ K8s 配置管理 (ansible, terraform) (27个)
140160
- ✅ K8s 备份恢复 (velero, restic) (8个)
141-
- ✅ K8s 安全工具 (trivy, kube-bench, falco) (7个)
161+
- ✅ K8s 安全工具 (trivy, kube-bench, falco, RBAC) (25个)
162+
- ✅ K8s 故障排查 (30个)
142163
- ✅ K8s 辅助工具 (k9s, kubectx, kubens, stern, popeye) (5个)
143164
- ✅ K8s 云平台工具 (eksctl, az aks, gcloud) (9个)
144165
- ✅ K8s 开发调试 (skaffold, tilt, telepresence) (8个)
@@ -162,22 +183,23 @@ go run ./cmd/cli -d ./data
162183
- ✅ MLOps平台 (kfp, mlflow) (2个)
163184
- ✅ 模型服务 (bentoml) (1个)
164185

165-
**总计**: 380+个精选命令
186+
**总计**: 500+个精选命令
166187

167-
## 🏗️ 项目架构
188+
## 📁 目录结构
168189

169190
```
170191
cmd4coder/
171-
├── cmd/cli/ # CLI 入口和命令定义
172-
├── internal/
192+
├── cmd/ # 命令行程序入口
193+
│ ├── cli/ # 主CLI程序
194+
│ └── validator/ # 数据验证工具
195+
├── internal/ # 内部包
173196
│ ├── model/ # 数据模型
174197
│ ├── data/ # 数据加载和索引
175198
│ ├── service/ # 业务逻辑层
176-
│ ├── ui/ # 用户界面(CLI/TUI)
177-
│ └── util/ # 工具函数
178-
├── pkg/
199+
│ └── ui/tui/ # TUI用户界面
200+
├── pkg/ # 公共包
179201
│ └── export/ # 导出功能
180-
├── data/ # YAML 命令清单数据
202+
├── data/ # YAML命令清单数据
181203
│ ├── metadata.yaml # 元数据
182204
│ ├── os/ # 操作系统命令
183205
│ ├── lang/ # 编程语言工具
@@ -187,7 +209,22 @@ cmd4coder/
187209
│ ├── database/ # 数据库工具
188210
│ ├── vcs/ # 版本控制
189211
│ └── build/ # 构建工具
190-
└── test/ # 测试文件
212+
├── docs/ # 文档目录
213+
│ ├── guides/ # 使用指南
214+
│ ├── reference/ # 技术参考
215+
│ ├── architecture/ # 架构文档
216+
│ ├── reports/ # 项目报告
217+
│ ├── css/ # 样式文件
218+
│ ├── js/ # JavaScript文件
219+
│ ├── assets/ # 静态资源
220+
│ └── index.html # 主页
221+
├── scripts/ # 构建脚本
222+
│ ├── build.sh # Linux/macOS构建脚本
223+
│ └── build.ps1 # Windows构建脚本
224+
├── coverage_reports/ # 测试覆盖率报告
225+
├── test/ # 集成测试
226+
├── .github/ # GitHub配置
227+
└── .git/ # Git版本控制
191228
```
192229

193230
## 🔧 开发
@@ -230,6 +267,31 @@ go vet ./...
230267
golangci-lint run
231268
```
232269

270+
### 构建项目
271+
272+
```bash
273+
# 使用构建脚本
274+
./scripts/build.sh # Linux/macOS
275+
cd scripts && ./build.ps1 # Windows (PowerShell)
276+
277+
# 或者手动构建
278+
go build -o bin/cmd4coder ./cmd/cli
279+
280+
# 如果需要指定模块目录
281+
cd build/config && go build -o ../../bin/cmd4coder ../../cmd/cli
282+
```
283+
284+
### 查看测试覆盖率
285+
286+
```bash
287+
# 生成覆盖率报告
288+
go test -coverprofile=coverage_reports/coverage.out ./...
289+
go tool cover -html=coverage_reports/coverage.out -o coverage_reports/coverage.html
290+
291+
# 查看覆盖率统计
292+
go tool cover -func=coverage_reports/coverage.out
293+
```
294+
233295
### 添加新命令
234296

235297
1. 在对应的 YAML 文件中添加命令定义
@@ -261,7 +323,7 @@ golangci-lint run
261323
262324
## 🤝 贡献
263325
264-
欢迎贡献!请查看 [CONTRIBUTING.md](CONTRIBUTING.md) 了解详情。
326+
欢迎贡献!请查看 [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) 了解详情。
265327
266328
### 贡献方式
267329
@@ -273,7 +335,7 @@ golangci-lint run
273335
274336
### 行为准则
275337
276-
请阅读并遵守 [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) 中的社区准则。
338+
请阅读并遵守 [docs/legal/CODE_OF_CONDUCT.md](docs/legal/CODE_OF_CONDUCT.md) 中的社区准则。
277339
278340
## ❓ 常见问题 (FAQ)
279341
@@ -321,7 +383,7 @@ A:
321383

322384
## 📝 许可证
323385

324-
本项目采用 MIT 许可证。详见 [LICENSE](LICENSE) 文件。
386+
本项目采用 MIT 许可证。详见 [docs/legal/LICENSE](docs/legal/LICENSE) 文件。
325387

326388
## 🙏 致谢
327389

File renamed without changes.

data/container/k8s-cluster.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,61 @@ commands:
198198
install_method: "Built-in systemd command"
199199
version_check: "journalctl --version"
200200

201+
# Cluster Backup and Disaster Recovery Commands
202+
- name: "etcdctl snapshot save"
203+
description: "Create etcd snapshot for cluster backup"
204+
category: "Kubernetes Cluster Management"
205+
platforms:
206+
- "linux"
207+
usage:
208+
- "etcdctl snapshot save [filename] [flags]"
209+
options:
210+
- flag: "--endpoints"
211+
description: "etcd endpoints (default: 127.0.0.1:2379)"
212+
- flag: "--cacert"
213+
description: "CA certificate for SSL/TLS"
214+
- flag: "--cert"
215+
description: "Client certificate for SSL/TLS"
216+
- flag: "--key"
217+
description: "Client key for SSL/TLS"
218+
examples:
219+
- command: "etcdctl snapshot save backup.db"
220+
description: "Create etcd snapshot"
221+
- command: "etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key snapshot save backup.db"
222+
description: "Create secure etcd snapshot"
223+
risks:
224+
- level: "low"
225+
description: "Read-only snapshot creation; no cluster impact"
226+
install_method: "Included with etcd package"
227+
version_check: "etcdctl version"
228+
229+
- name: "etcdctl snapshot restore"
230+
description: "Restore etcd snapshot for disaster recovery"
231+
category: "Kubernetes Cluster Management"
232+
platforms:
233+
- "linux"
234+
usage:
235+
- "etcdctl snapshot restore [filename] [flags]"
236+
options:
237+
- flag: "--data-dir"
238+
description: "Path to the data directory"
239+
- flag: "--initial-cluster"
240+
description: "Initial cluster configuration for restore"
241+
- flag: "--initial-cluster-token"
242+
description: "Initial cluster token for the etcd cluster during restore"
243+
examples:
244+
- command: "etcdctl snapshot restore backup.db --data-dir=/var/lib/etcd-restore"
245+
description: "Restore snapshot to new data directory"
246+
- command: "etcdctl snapshot restore backup.db --data-dir=/var/lib/etcd-restore --initial-cluster=master-1=https://192.168.1.10:2380 --initial-cluster-token=etcd-cluster-1"
247+
description: "Restore with cluster configuration"
248+
risks:
249+
- level: "critical"
250+
description: "Restores cluster state; can overwrite current data"
251+
- level: "high"
252+
description: "Must stop etcd before restore; coordinate with team"
253+
install_method: "Included with etcd package"
254+
version_check: "etcdctl version"
255+
201256
- name: "etcdctl snapshot save"
202257
description: "Create backup snapshot of etcd data"
203258
category: "Kubernetes Cluster Management"
@@ -305,3 +360,52 @@ commands:
305360
description: "Read-only operation; retrieves data only"
306361
install_method: "Installed with etcd or download from etcd releases"
307362
version_check: "etcdctl version"
363+
364+
# Advanced Node Management
365+
- name: "kubectl taint nodes"
366+
description: "Add or remove taints from nodes"
367+
category: "Kubernetes Cluster Management"
368+
platforms:
369+
- "linux"
370+
- "darwin"
371+
- "windows"
372+
usage:
373+
- "kubectl taint nodes [node-name] [key]=[value]:[effect]"
374+
effects:
375+
- "NoSchedule": "Prevent new pods from scheduling"
376+
- "PreferNoSchedule": "Avoid scheduling if possible"
377+
- "NoExecute": "Evict existing pods and prevent new ones"
378+
examples:
379+
- command: "kubectl taint nodes worker-node-1 key=value:NoSchedule"
380+
description: "Add NoSchedule taint to node"
381+
- command: "kubectl taint nodes worker-node-1 key=value:NoExecute"
382+
description: "Add NoExecute taint to node"
383+
- command: "kubectl taint nodes worker-node-1 key:NoSchedule-"
384+
description: "Remove NoSchedule taint from node"
385+
risks:
386+
- level: "medium"
387+
description: "Affects pod scheduling; may cause service disruption"
388+
install_method: "kubectl built-in command"
389+
version_check: "kubectl version --client"
390+
391+
- name: "kubectl label nodes"
392+
description: "Add or remove labels from nodes"
393+
category: "Kubernetes Cluster Management"
394+
platforms:
395+
- "linux"
396+
- "darwin"
397+
- "windows"
398+
usage:
399+
- "kubectl label nodes [node-name] [key]=[value]"
400+
examples:
401+
- command: "kubectl label nodes worker-node-1 disktype=ssd"
402+
description: "Add label to node"
403+
- command: "kubectl label nodes worker-node-1 disktype-"
404+
description: "Remove label from node"
405+
- command: "kubectl label nodes --all disktype=ssd"
406+
description: "Label all nodes"
407+
risks:
408+
- level: "low"
409+
description: "Labels affect scheduling but don't impact running pods"
410+
install_method: "kubectl built-in command"
411+
version_check: "kubectl version --client"

0 commit comments

Comments
 (0)