Files
ai-app-ops-tools/templates/disk.yaml
T
huty dc2d2acc82 feat: initial framework for AI-powered ops terminal
Scaffold an MVP of the natural-language ops terminal: inventory + intent
template registry, SSH/WinRM/local connectors, risk-gated executor with
SQLite audit log, Claude-driven agent layer using Function Calling, plus a
Typer CLI and FastAPI surface.

Includes 10 cross-OS intents (disk/system/service) and example inventory.
Verified end-to-end on the local Windows host: hosts/intents listing,
check_disk_usage execution, and WRITE-class confirmation gating.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
2026-05-21 11:01:43 +09:00

28 lines
1.2 KiB
YAML

# 磁盘相关意图模板
intents:
- intent: check_disk_usage
description: 查看主机各分区磁盘使用率
risk_level: READ
params: []
implementations:
linux:
command: "df -h --output=source,size,used,avail,pcent,target"
darwin:
command: "df -h"
windows:
command: "Get-PSDrive -PSProvider FileSystem | Select-Object Name,@{N='UsedGB';E={[math]::Round($_.Used/1GB,1)}},@{N='FreeGB';E={[math]::Round($_.Free/1GB,1)}} | ConvertTo-Json"
- intent: check_largest_dirs
description: 在指定路径下找出占用最大的目录(Top 10)
risk_level: READ
params:
- name: path
type: string
required: true
description: 要扫描的根路径,如 /var
implementations:
linux:
command: "du -h --max-depth=1 {{path}} 2>/dev/null | sort -hr | head -n 10"
windows:
command: "Get-ChildItem -Path '{{path}}' -Directory | ForEach-Object { [PSCustomObject]@{ Path=$_.FullName; SizeMB=[math]::Round(((Get-ChildItem $_.FullName -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum)/1MB,1) } } | Sort-Object SizeMB -Descending | Select-Object -First 10 | ConvertTo-Json"