Files
climperor/web/run_notify_site_traffic.ps1
vosonandCursor 9c5aa5b610 Reorganize repository into pc web shared monorepo
Separate the local recognition, web publishing, and shared data paths while preserving direct script execution and existing site content.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 14:29:08 +08:00

39 lines
1.2 KiB
PowerShell

# Local / scheduled runner: inject both keyzoo secrets then post Feishu digest.
#
# Requires Keyzoo desktop daemon (MCP asset_exec). From an agent:
# run this script is not enough alone — use notify_site_traffic.py via
# dual asset_exec, or set env manually:
#
# $env:CLOUDFLARE_EMAIL = "..."
# $env:CLOUDFLARE_API_KEY = "..."
# $env:FEISHU_WEBHOOK_URL = "..."
# python notify_site_traffic.py
#
# Windows Task Scheduler example (after env is available in the task):
# Program: python
# Arguments: notify_site_traffic.py
# Start in: <repo>
# Trigger: Daily 09:00
param(
[string]$Day = "",
[switch]$DryRun
)
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $Root
$argsList = @()
if ($Day) { $argsList += @("--day", $Day) }
if ($DryRun) { $argsList += "--dry-run" }
if (-not $env:CLOUDFLARE_API_KEY -and -not $env:KEYZOO_ASSET_SECRET_GLOBAL_API_KEY) {
Write-Error "Missing Cloudflare API key in env (set CLOUDFLARE_* or run via keyzoo)."
}
if (-not $env:FEISHU_WEBHOOK_URL -and -not $env:KEYZOO_ASSET_SECRET_FEISHU_WEBHOOK_URL) {
Write-Error "Missing Feishu webhook in env (set FEISHU_WEBHOOK_URL or run via keyzoo)."
}
python notify_site_traffic.py @argsList