From 0b243c8eb1e7609b203045e5fc400e59fe852987 Mon Sep 17 00:00:00 2001 From: yihuishou Date: Sat, 21 Mar 2026 10:32:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=205.2c=20?= =?UTF-8?q?Agent=20=E6=9D=83=E9=99=90=E4=B8=8E=E5=AE=89=E5=85=A8=20?= =?UTF-8?q?=E4=B8=AD=20TaskTool=20=E5=8F=82=E6=95=B0=E8=AF=A6=E8=A7=A3=20?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/5-advanced/02c-agent-permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/5-advanced/02c-agent-permissions.md b/docs/5-advanced/02c-agent-permissions.md index 00a4a11..7190415 100644 --- a/docs/5-advanced/02c-agent-permissions.md +++ b/docs/5-advanced/02c-agent-permissions.md @@ -337,7 +337,7 @@ task 权限控制 **Agent 可以调用哪些 subagent**。 Task 工具的完整参数定义如下: | 参数 | 类型 | 必需 | 说明 | -|------|------|------| +|------|------|------|------| | `description` | string | 是 | 任务描述(3-5 个词),用作子会话标题 | | `prompt` | string | 是 | 子代理要执行的任务提示 | | `subagent_type` | string | 是 | 要调用的子代理名称(必须是非 primary agent) | From 208c31e2bc7739eae4c3602cff045e3263949f4d Mon Sep 17 00:00:00 2001 From: yihuishou Date: Sat, 21 Mar 2026 12:01:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=20Windows=20?= =?UTF-8?q?PowerShell=20=E7=BB=9F=E8=AE=A1=E8=84=9A=E6=9C=AC=E5=92=8C=20np?= =?UTF-8?q?m=20=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +++- scripts/stats.ps1 | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 scripts/stats.ps1 diff --git a/package.json b/package.json index be4a320..4631a1a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "scripts": { "dev": "bash scripts/stats.sh && vitepress dev docs", "build": "bash scripts/stats.sh && vitepress build docs", - "preview": "vitepress preview docs" + "preview": "vitepress preview docs", + "dev:win": "powershell -ExecutionPolicy Bypass -File scripts/stats.ps1 && vitepress dev docs", + "build:win": "powershell -ExecutionPolicy Bypass -File scripts/stats.ps1 && vitepress build docs" }, "keywords": [ "opencode", diff --git a/scripts/stats.ps1 b/scripts/stats.ps1 new file mode 100644 index 0000000..a118210 --- /dev/null +++ b/scripts/stats.ps1 @@ -0,0 +1,61 @@ +# Statistics Tutorial Word Count and Notes (Word-style) +# Chinese: each Han character counts as 1 word +# English: each word counts as 1 word + +function Count-Words { + param([string]$FilePath) + + # Read file content (UTF-8 encoding) + $content = Get-Content -Path $FilePath -Raw -Encoding UTF8 + + # Remove frontmatter (content between ---) + $content = $content -replace '^---\r?\n.*?\r?\n---\r?\n', '' + + # Count Chinese characters (Unicode range: \u4e00-\u9fff) + $chineseMatches = [regex]::Matches($content, '[\u4e00-\u9fff]') + $cnCount = $chineseMatches.Count + + # Remove Chinese characters + $noChinese = $content -replace '[\u4e00-\u9fff]', ' ' + + # Remove Markdown syntax and punctuation + $cleaned = $noChinese -replace '[#*|`[(){}<>:,:,.!?,,;""''''—...·\-_=+\/\\@$%^&~]', ' ' + + # Count English words + $englishMatches = [regex]::Matches($cleaned, '[a-zA-Z][a-zA-Z0-9]*') + $enCount = $englishMatches.Count + + return $cnCount + $enCount +} + +# Count all .md files under docs (excluding .vitepress directory) +$total = 0 +$mdFiles = Get-ChildItem -Path docs -Filter *.md -Recurse -File | + Where-Object { $_.FullName -notmatch '\\.vitepress\\' } + +foreach ($file in $mdFiles) { + $count = Count-Words -FilePath $file.FullName + $total += $count +} + +# Count 4K HD notes +try { + $notes = (Get-ChildItem -Path docs\public\images -Filter *-notes.jpeg -Recurse -File | + Where-Object { $_.Name -notmatch '\.mini\.jpeg$' }).Count +} catch { + $notes = 0 +} + +# Generate JSON object +$stats = @{ + wordCount = $total + notesCount = $notes +} + +# Write JSON file +$stats | ConvertTo-Json | Out-File -FilePath docs\data\stats.json -Encoding UTF8 -Force + +# Output results +Write-Host "Tutorial word count: $total" +Write-Host "4K notes: $notes images" +Write-Host "OK: docs\data\stats.json has been generated"