archgraph-argo 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: "公众号发布:将 ArchGraph 项目的文章(洞察报告、官宣介绍、开发者社区等)撰写为符合微信公众号格式的 Markdown,并通过 wechat-public-cli 创建草稿、跟进公众号后台手动发布流程。Use when: 发布公众号文章、创建公众号草稿、微信公众平台、wechat、公众号发布员、撰写 .wechat.md 文章。"
3
+ name: "公众号发布员"
4
+ model: "Qwen3.7-Plus"
5
+ tools: [read, edit, search, execute]
6
+ user-invocable: true
7
+ argument-hint: "要发布的文章主题或源文档路径"
8
+ ---
9
+ 你是 ArchGraph 项目的「公众号发布员」,专职把项目文章发布到微信公众号。
10
+
11
+ ## 职责
12
+ 1. 阅读源内容(洞察报告、官宣介绍、开发者社区等文档),提炼并撰写为符合微信公众号格式的 Markdown 文章。
13
+ 2. 通过本地 wechat-public-cli 创建公众号草稿。
14
+ 3. 返回草稿 media_id,并说明公众号后台手动发布的跟进步骤。
15
+
16
+ ## 约束
17
+ - 只用 `wechat:draft` 创建草稿。**禁止**运行 `wechat:publish` / `wechat:sendall` / `freepublish`:本公众号是个人未认证订阅号(appid wxdf79e7cb44995aa3),这些 API 永远返回 48001 api unauthorized,只能登录公众号后台「草稿箱」手动发布。
18
+ - 文章内容必须基于仓库内已有文档,不得凭空编造。
19
+ - 不得打印或泄露 `wechat-public.config.json` 中的 appid/secret 等凭据。
20
+ - 发布前需确认当前公网 IP 已加入公众号后台 IP 白名单(否则 token 刷新报 40164)。
21
+
22
+ ## 工作方法
23
+ 1. 定位源文档,并参考 `docs/*.wechat.md` 既有文章的格式与文风。
24
+ 2. 撰写 `docs/<主题>.wechat.md`,YAML frontmatter 至少含 `title` / `author` / `digest`,并按需含 `banner_path`(相对文章目录)、`open_comment`、`source_url`。
25
+ 3. 若 `tests/wechat-article.test.js` 尚无对应验收用例,先补一条 GIVEN-WHEN-THEN 用例,再运行 `node --test tests/wechat-article.test.js` 通过。
26
+ 4. 创建草稿(banner_path 相对文章文件目录解析):
27
+ ```powershell
28
+ node "d:\Projects\_tools\wechat-cli-src\obsidian-wechat-public-platform-master\dist\wechat-public-cli.js" wechat:draft --file "<文章绝对路径>" --config "d:\Projects\archgraph\wechat-public.config.json" --css "d:\Projects\_tools\wechat-cli-src\obsidian-wechat-public-platform-master\custom.css"
29
+ ```
30
+
31
+ ## 输出格式
32
+ 返回:文章路径、草稿 media_id(或确切失败原因)、状态(草稿已创建 / BLOCKED)。并提醒:API 发布不可用,需在公众号后台「草稿箱」手动发布。
package/install-argo.ps1 CHANGED
@@ -8,6 +8,9 @@ param(
8
8
  [string]$OpenCodeSkillsRoot = "$env:USERPROFILE\.config\opencode\skills",
9
9
  [string]$OpenCodeAgentsPath = "$env:USERPROFILE\.config\opencode\AGENTS.md",
10
10
  [string]$OpenCodeConfigPath = "$env:USERPROFILE\.config\opencode\opencode.json",
11
+ [string]$CopilotAgentsRoot = "$env:USERPROFILE\.copilot\agents",
12
+ [string]$CursorAgentsRoot = "$env:USERPROFILE\.cursor\agents",
13
+ [string]$OpenCodeAgentsRoot = "$env:USERPROFILE\.config\opencode\agents",
11
14
  [switch]$SkipEnv,
12
15
  [switch]$SkipDeps,
13
16
  [switch]$SkipMcp,
@@ -24,6 +27,66 @@ function Copy-Tree {
24
27
  Copy-Item -Recurse -Force -Path (Join-Path $Source '*') -Destination $Destination
25
28
  }
26
29
 
30
+ function Copy-Agents {
31
+ param(
32
+ [string]$Source,
33
+ [string]$Destination,
34
+ [string]$Target
35
+ )
36
+ New-Item -ItemType Directory -Force -Path $Destination | Out-Null
37
+ $files = @(Get-ChildItem -Path (Join-Path $Source '*.agent.md') -ErrorAction SilentlyContinue)
38
+ foreach ($file in $files) {
39
+ if (-not $Target) {
40
+ # Copilot: VS Code format, keep the .agent.md extension verbatim.
41
+ Copy-Item -Force -Path $file.FullName -Destination (Join-Path $Destination $file.Name)
42
+ continue
43
+ }
44
+ $targetName = ($file.BaseName -replace '\.agent$', '') + '.md'
45
+ Convert-AgentFile -SourceFile $file.FullName -DestinationFile (Join-Path $Destination $targetName) -Target $Target
46
+ }
47
+ }
48
+
49
+ function Convert-AgentFile {
50
+ param(
51
+ [string]$SourceFile,
52
+ [string]$DestinationFile,
53
+ [string]$Target
54
+ )
55
+ $content = Get-Content $SourceFile -Raw -Encoding UTF8
56
+ $m = [regex]::Match($content, '(?s)^---\s*\r?\n(.*?)\r?\n---\s*\r?\n(.*)$')
57
+ if (-not $m.Success) {
58
+ Copy-Item -Force -Path $SourceFile -Destination $DestinationFile
59
+ return
60
+ }
61
+ $front = $m.Groups[1].Value
62
+ $body = $m.Groups[2].Value
63
+
64
+ $name = ''
65
+ $desc = ''
66
+ $nm = [regex]::Match($front, '(?m)^name:\s*(.*)$')
67
+ if ($nm.Success) { $name = $nm.Groups[1].Value.Trim().Trim('"').Trim("'") }
68
+ $dm = [regex]::Match($front, '(?m)^description:\s*(.*)$')
69
+ if ($dm.Success) { $desc = $dm.Groups[1].Value.Trim().Trim('"').Trim("'") }
70
+
71
+ if ($Target -eq 'opencode') {
72
+ # OpenCode markdown agent: description is required; mode: all keeps it
73
+ # usable as primary and subagent. Drop VS Code-only fields (tools array,
74
+ # model, user-invocable, argument-hint) which OpenCode rejects.
75
+ $newFront = "---`r`n"
76
+ if ($desc) { $newFront += "description: `"$($desc -replace '"','\"')`"`r`n" }
77
+ $newFront += "mode: all`r`n---`r`n"
78
+ } else {
79
+ # Cursor markdown agent: name + description; drop VS Code-only fields.
80
+ $newFront = "---`r`n"
81
+ if ($name) { $newFront += "name: `"$name`"`r`n" }
82
+ if ($desc) { $newFront += "description: `"$($desc -replace '"','\"')`"`r`n" }
83
+ $newFront += "---`r`n"
84
+ }
85
+
86
+ $result = $newFront + "`r`n" + $body
87
+ [System.IO.File]::WriteAllText($DestinationFile, $result, (New-Object System.Text.UTF8Encoding $false))
88
+ }
89
+
27
90
  function Write-McpConfig {
28
91
  param(
29
92
  [string]$Path,
@@ -107,46 +170,56 @@ Write-Host '==> Deploying Argo toolchain'
107
170
 
108
171
  $schemaSrc = Join-Path $argoDir 'schema'
109
172
  $schemaDest = Join-Path $ArgoRoot 'schema'
110
- Write-Host "[1/6] argo\schema -> $schemaDest"
173
+ Write-Host "[1/12] argo\schema -> $schemaDest"
111
174
  Copy-Tree -Source $schemaSrc -Destination $schemaDest
112
175
 
113
176
  $scriptsSrc = Join-Path $argoDir 'scripts'
114
177
  $scriptsDest = Join-Path $ArgoRoot 'scripts'
115
- Write-Host "[2/6] argo\scripts -> $scriptsDest"
178
+ Write-Host "[2/12] argo\scripts -> $scriptsDest"
116
179
  Copy-Tree -Source $scriptsSrc -Destination $scriptsDest
117
180
 
118
181
  $defaultsSrc = Join-Path $argoDir 'defaults'
119
182
  $defaultsDest = Join-Path $ArgoRoot 'defaults'
120
- Write-Host "[3/6] argo\defaults -> $defaultsDest"
183
+ Write-Host "[3/12] argo\defaults -> $defaultsDest"
121
184
  Copy-Tree -Source $defaultsSrc -Destination $defaultsDest
122
185
 
123
186
  $skillSrc = Join-Path (Join-Path $argoDir 'skills') 'argo-init'
124
187
  $skillDest = Join-Path $SkillsRoot 'argo-init'
125
- Write-Host "[4/6] argo\skills\argo-init -> $skillDest"
188
+ Write-Host "[4/12] argo\skills\argo-init -> $skillDest"
126
189
  Copy-Tree -Source $skillSrc -Destination $skillDest
127
190
 
128
191
  $ruleSrc = Join-Path (Join-Path $argoDir 'rules') 'archgraph.instructions.md'
129
192
  $ruleDest = Join-Path $PromptsRoot 'archgraph.instructions.md'
130
- Write-Host "[5/6] argo\rules\archgraph.instructions.md -> $ruleDest"
193
+ Write-Host "[5/12] argo\rules\archgraph.instructions.md -> $ruleDest"
131
194
  New-Item -ItemType Directory -Force -Path $PromptsRoot | Out-Null
132
195
  Copy-Item -Force -Path $ruleSrc -Destination $ruleDest
133
196
 
134
197
  $depsSrc = Join-Path $argoDir 'package.json'
135
198
  $depsDest = Join-Path $ArgoRoot 'package.json'
136
- Write-Host "[6/6] argo\package.json -> $depsDest"
199
+ Write-Host "[6/12] argo\package.json -> $depsDest"
137
200
  Copy-Item -Force -Path $depsSrc -Destination $depsDest
138
201
 
139
202
  $cursorSkillDest = Join-Path $CursorSkillsRoot 'argo-init'
140
- Write-Host "[7/10] argo\skills\argo-init -> $cursorSkillDest (Cursor)"
203
+ Write-Host "[7/12] argo\skills\argo-init -> $cursorSkillDest (Cursor)"
141
204
  Copy-Tree -Source $skillSrc -Destination $cursorSkillDest
142
205
 
143
206
  $openCodeSkillDest = Join-Path $OpenCodeSkillsRoot 'argo-init'
144
- Write-Host "[8/10] argo\skills\argo-init -> $openCodeSkillDest (OpenCode)"
207
+ Write-Host "[8/12] argo\skills\argo-init -> $openCodeSkillDest (OpenCode)"
145
208
  Copy-Tree -Source $skillSrc -Destination $openCodeSkillDest
146
209
 
147
- Write-Host "[9/10] argo\rules\archgraph.instructions.md -> $OpenCodeAgentsPath (OpenCode global AGENTS.md)"
210
+ Write-Host "[9/12] argo\rules\archgraph.instructions.md -> $OpenCodeAgentsPath (OpenCode global AGENTS.md)"
148
211
  Add-AgentsRule -AgentsPath $OpenCodeAgentsPath -RulePath $ruleSrc
149
212
 
213
+ $agentsSrc = Join-Path $argoDir 'agents'
214
+ Write-Host "[10/12] argo\agents -> $CopilotAgentsRoot (Copilot user-level)"
215
+ Copy-Agents -Source $agentsSrc -Destination $CopilotAgentsRoot
216
+
217
+ Write-Host "[11/12] argo\agents -> $CursorAgentsRoot (Cursor user-level, converted to .md)"
218
+ Copy-Agents -Source $agentsSrc -Destination $CursorAgentsRoot -Target cursor
219
+
220
+ Write-Host "[12/12] argo\agents -> $OpenCodeAgentsRoot (OpenCode user-level, converted to .md)"
221
+ Copy-Agents -Source $agentsSrc -Destination $OpenCodeAgentsRoot -Target opencode
222
+
150
223
  if ($SkipDeps) {
151
224
  Write-Host 'Skipped dependency install (-SkipDeps).'
152
225
  } elseif (Get-Command npm -ErrorAction SilentlyContinue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Deploy the ArchGraph ARGO toolchain, skills, and rules (schema, scripts, argo-init skill, global rule) with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "argo/scripts",
11
11
  "argo/schema",
12
12
  "argo/defaults",
13
+ "argo/agents",
13
14
  "argo/skills/argo-init",
14
15
  "argo/rules",
15
16
  "argo/package.json",