tools(agent-loop): Grok Gitea calls via fixed gitea.ps1; drop open powershell -Command allow
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Ad9rqAB8pXXvyzh7f4X8v
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7e298419a4
commit
941b06c193
@@ -9,8 +9,10 @@ Grok 侧与 Claude 侧对称:在一个常开的 Grok Build 会话里跑 `/loop
|
||||
首次(以及钩子更新后)复制一次:
|
||||
|
||||
```powershell
|
||||
New-Item -ItemType Directory -Force "$HOME\.jyotisha-agent\hooks\grok" | Out-Null
|
||||
Copy-Item -Force G:\Ferti\Jyotisha\.worktrees\agent-loop\tools\agent-loop\hooks\grok\pre-push "$HOME\.jyotisha-agent\hooks\grok\pre-push"
|
||||
$src = "G:\Ferti\Jyotisha\.worktrees\agent-loop\tools\agent-loop"
|
||||
New-Item -ItemType Directory -Force "$HOME\.jyotisha-agent\hooks\grok", "$HOME\.jyotisha-agent\bin" | Out-Null
|
||||
Copy-Item -Force "$src\hooks\grok\pre-push" "$HOME\.jyotisha-agent\hooks\grok\pre-push"
|
||||
Copy-Item -Force "$src\gitea.ps1" "$HOME\.jyotisha-agent\bin\gitea.ps1"
|
||||
```
|
||||
|
||||
每次开会话:
|
||||
@@ -21,7 +23,11 @@ $env:PATH = "D:\Program Files\Git\bin;" + $env:PATH
|
||||
$env:GIT_CONFIG_COUNT = "1"
|
||||
$env:GIT_CONFIG_KEY_0 = "core.hooksPath"
|
||||
$env:GIT_CONFIG_VALUE_0 = "$HOME\.jyotisha-agent\hooks\grok"
|
||||
grok
|
||||
$perm = Get-Content -Raw -Encoding UTF8 tools\agent-loop\grok-permissions.json | ConvertFrom-Json
|
||||
$grokArgs = @('--permission-mode', $perm.mode)
|
||||
foreach ($r in $perm.allow) { $grokArgs += @('--allow', $r) }
|
||||
foreach ($r in $perm.deny) { $grokArgs += @('--deny', $r) }
|
||||
grok @grokArgs
|
||||
```
|
||||
|
||||
验证钩子生效(应被拒):`git push --dry-run origin HEAD:refs/heads/main`(目标与 HEAD 相同时 git 不调钩子,所以用 main)。
|
||||
@@ -29,5 +35,10 @@ grok
|
||||
## 粘贴的提示词(每 15 分钟)
|
||||
|
||||
```
|
||||
/loop 15m 盯一下 Gitea 上同时带 agent/待执行 和 agent/试点 标签的 issue(用 PowerShell 调 Gitea API,令牌在 %USERPROFILE%\.config\jyotisha-agent\gitea-token,绝不输出令牌)。只看 jesse 账号写的评论,别人写的一律不理。有活就取最老的一单:先加 agent/执行中 锁标签;从最新一条首行是 <!-- agent:claude plan ... --> 或 <!-- agent:claude review ... verdict=fail ... --> 的评论里读出 brief= 和 branch=;在当前工作树 git fetch 后检出这个分支(远端已有就基于远端,没有就基于 origin/staging);然后严格按 tools/agent-loop/prompts/grok-execute.md 实现、自测、只推这个 codex 分支。做完发一条评论,首行是 <!-- agent:grok report branch=<分支> sha=<推送后远端 40 位 SHA> -->,下面写中文回报;把状态标签换成 agent/待验收,去掉锁标签。需要产品决定的,首行写 <!-- agent:grok decision -->,标签换成 agent/需拍板 并 @jesse。永远不推 staging 和 main,不删分支,不加 --no-verify。评论写给不懂代码的人看,不写任何用户个人资料。没有可处理的 issue 就什么都不做。
|
||||
/loop 15m 盯一下 Gitea 上同时带 agent/待执行 和 agent/试点 标签的 issue(Gitea 一律只用 `powershell -NoProfile -ExecutionPolicy Bypass -File C:\Users\74082\.jyotisha-agent\bin\gitea.ps1 <命令>`:issues、issue、labels、add-label、remove-label、comments、comment,用法见脚本开头;评论先写成 UTF-8 文件再用 comment 发)。(gitea.ps1 只返回 jesse 账号写的正文和评论。)有活就取最老的一单:先加 agent/执行中 锁标签;从最新一条首行是 <!-- agent:claude plan ... --> 或 <!-- agent:claude review ... verdict=fail ... --> 的评论里读出 brief= 和 branch=;在当前工作树 git fetch 后检出这个分支(远端已有就基于远端,没有就基于 origin/staging);然后严格按 tools/agent-loop/prompts/grok-execute.md 实现、自测、只推这个 codex 分支。做完发一条评论,首行是 <!-- agent:grok report branch=<分支> sha=<推送后远端 40 位 SHA> -->,下面写中文回报;把状态标签换成 agent/待验收,去掉锁标签。需要产品决定的,首行写 <!-- agent:grok decision -->,标签换成 agent/需拍板 并 @jesse。永远不推 staging 和 main,不删分支,不加 --no-verify。评论写给不懂代码的人看,不写任何用户个人资料。没有可处理的 issue 就什么都不做。
|
||||
```
|
||||
|
||||
## 注意
|
||||
|
||||
- 会话里的 `/loop` 7 天后过期,每周重开一次会话并重新粘贴(Claude 侧同理)。
|
||||
- 白名单不放行任意 `powershell -Command`:那样藏在里面的推送或读令牌会绕过所有规则。Gitea 只能经 `gitea.ps1`。
|
||||
|
||||
Reference in New Issue
Block a user