joy-cli/domains/modiqi.sh
feibisi 3874b562c3 feat: joy CLI Python 2.0 — 50 命令全量重写 + pip 全集群部署
- 50 命令:patrol/health/board/recall/poke/who/inbox/mind/message/team 等
- 异步并行 SSH (asyncio subprocess)
- 命令注册表 + @command decorator + 插件扩展架构
- 环境检测 (Mac/VM/agent 身份)
- JSON 输出契约 (stdout=成功, stderr=错误 code)
- 权限模型 (agent 身份检测 + 环境限制)
- pytest 23/23 通过
- deploy-joy.sh 全集群 16 VM 部署脚本 (含 PEP 668 兼容)
- 旧 bash 版归档到 archive/commands.bash/

Closes: joy CLI 2.0 迁移
2026-07-07 11:38:03 +08:00

63 lines
2.4 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# modiqi 领域检查 — 域名资产 + 营销情报(高价值业务)
domain_check() {
local result="{"
local issues=()
# 1. 域名资产扫描
local domain_report=~/docs/domain-expiry-report.md
if [[ -f "$domain_report" ]]; then
local expired urgent critical
expired=$(grep -c '\[EXPIRED\]' "$domain_report" 2>/dev/null || echo 0)
urgent=$(grep -c '\[EXPIRING\]' "$domain_report" 2>/dev/null || echo 0)
# 提取紧急域名≤30天
local critical_list
critical_list=$(grep -E '^\[EXPIRED\]|^\[[0-9]+d\]' "$domain_report" 2>/dev/null | head -5 | sed 's/"/\\"/g')
result+="\"domains\":{\"total_expired\":${expired:-0},\"urgent_30d\":${urgent:-0}}"
(( expired > 10 || urgent > 5 )) && issues+=("域名: ${expired} 过期 + ${urgent} 临期")
else
result+="\"domains\":null"
issues+=("域名报告缺失")
fi
# 2. 营销情报
local intel_dir=~/docs/intel
if [[ -d "$intel_dir" ]]; then
local today_intel
today_intel=$(find "$intel_dir" -name "*.md" -mtime -1 2>/dev/null | wc -l | tr -d ' ')
result+=",\"intel\":{\"today\":${today_intel:-0}}"
fi
# 3. 域名检查(当康自己的)
local journal=~/office/modiqi/journal.jsonl
if [[ -f "$journal" ]]; then
local domain_issues
domain_issues=$(tail -10 "$journal" 2>/dev/null | python3 -c "
import json, sys
for line in sys.stdin:
line = line.strip()
if not line: continue
try:
d = json.loads(line)
se = d.get('self_eval','')
doubts = d.get('doubts','')
if 'expired' in se.lower() or '域名' in se:
print(se[:120])
if doubts and doubts not in ('无','none',''):
print(f'doubt: {doubts[:80]}')
except: pass
" 2>/dev/null | tail -3)
[[ -n "$domain_issues" ]] && issues+=("$domain_issues")
fi
result+=",\"issues\":$(jq -nc '$ARGS.positional' --args ${issues[@]+"${issues[@]}"})}"
echo "$result" | jq .
}
domain_summary() {
local report=~/docs/domain-expiry-report.md
if [[ -f "$report" ]]; then
echo "域名: $(grep -c '\[EXPIRED\]' "$report" 2>/dev/null) 过期, $(grep -c '\[EXPIRING\]' "$report" 2>/dev/null) 临期 | 情报: $(find ~/docs/intel -name '*.md' -mtime -1 2>/dev/null | wc -l) 条今日"
else
echo "域名/营销监控待更新"
fi
}