@yeaft/webchat-agent 1.0.525 → 1.0.527

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.
@@ -1,78 +0,0 @@
1
- ---
2
- name: review-merge-tag
3
- description: 用 RepoWorkflow 在任意 GitHub 仓库执行开发 worktree、精确 PR review snapshot、base-ref CAS landing、数字 tag 与 workflow 验证;避免重复手工 git/gh 检查。
4
- ---
5
-
6
- # Repository Workflow
7
-
8
- 不要逐条调用 `git fetch`、`git worktree list`、`gh pr view`、`git ls-remote` 和 `gh run watch` 来发现同一批事实。Session 内使用 `RepoWorkflow` 工具。非 Yeaft 环境可用 `yeaft-repo` CLI 执行 `prepare` 和 `review-prep`,这两个阶段返回与工具相同的紧凑 JSON;CLI 不能执行 `land`。
9
-
10
- ## 三个边界
11
-
12
- ### 1. 开发准备
13
-
14
- ```json
15
- {
16
- "phase": "prepare",
17
- "name": "fix-short-description"
18
- }
19
- ```
20
-
21
- 它会在当前仓库中确定远端默认分支、拉取最新精确基线、检查 worktree/branch/path 冲突,并创建或安全复用 `yeaft-wt/<name>`。后续开发只使用返回的 `worktree.path`。
22
-
23
- ### 2. 独立 review 准备
24
-
25
- Reviewer 调用:
26
-
27
- ```json
28
- {
29
- "phase": "review-prep",
30
- "pr": 123
31
- }
32
- ```
33
-
34
- 它会一次冻结 GitHub PR 的 base branch/base SHA/head/merge snapshot、检查 draft/conflict/checks,并创建 detached exact-snapshot review worktree。Reviewer 必须审查返回的 `reviewWorktree.path`,并把明确结论、`pullRequest.baseBranch`、`pullRequest.baseSha`、`pullRequest.headSha` 和 `pullRequest.snapshotSha` 交回开发者。
35
-
36
- 工具只冻结事实,不替代代码审查。
37
-
38
- ### 3. Review 通过后的落地
39
-
40
- 只有收到独立 reviewer 的明确批准后才能调用。Reviewer 必须用 `RouteForward` 把绑定仓库、PR、exact base branch/base SHA/head/merge snapshot 的结构化批准交回 landing VP;宿主会随该 handoff 铸造不可序列化、一次性的 approval capability。随后 landing VP 才能在处理该 handoff 的同一 turn 调用:
41
-
42
- ```json
43
- {
44
- "phase": "land",
45
- "pr": 123,
46
- "baseBranch": "main",
47
- "baseSha": "<exact 40-char base SHA>",
48
- "reviewedHead": "<exact 40-char head SHA>",
49
- "reviewedSnapshot": "<exact 40-char merge snapshot SHA>",
50
- "tagPrefix": "v1.0.",
51
- "workflow": "Dev Release"
52
- }
53
- ```
54
-
55
- `approvedBy` 等普通字符串没有授权语义。`land` 只接受宿主 capability,并重新冻结 PR;任何 repo、PR、recipient、base branch、base SHA、head 或 snapshot 不匹配都会停止。Reviewed snapshot 必须以批准的 base SHA/head 为两个父提交;landing 的目标 ref 只从批准的 base branch 推导,并在任何写入前拒绝 PR retarget。之后它通过单次 receive-pack 更新,用 `--force-with-lease=<base-ref>:<approved-base>` 将该 exact snapshot 安装到批准的远端 base。若 base 在最后冻结与 receive 之间前进,lease 会拒绝更新,并且不会创建 tag。若要求 tag,它只在 base CAS 成功后从远端 tags 数值计算下一版,用 create-only lease 推送并复核 base 与 tag。若要求 workflow,它等待匹配 tag 与 reviewed snapshot SHA 的 run 完成。
56
-
57
- Worktree cleanup 不属于 landing。`land` 会在任何仓库或远端副作用前拒绝 cleanup 请求,包括 active `repoRoot`;需要 cleanup 时必须在 landing 完成后走独立操作,cleanup 失败不能改变 landing 结果。
58
-
59
- ## 通用性与边界
60
-
61
- - 适用于 Agent 可访问的任意本地 GitHub 仓库,不包含项目路径或固定 `main` 假设。
62
- - 需要 `git` 和已认证的 `gh` CLI;不依赖 Python,也不通过 shell 拼接命令。
63
- - 当前不支持 GitLab/Bitbucket;不要把 GitHub 成功误报为 forge-agnostic。
64
- - 自动化只消除重复事实核对,不消除独立 review、测试选择、代码判断或用户授权。
65
- - `land` 后若 workflow 失败,merge/tag 可能已经完成;读取错误 JSON 的 `details.remoteEffects`,不要盲目重试或重打 tag。
66
-
67
- ## CLI
68
-
69
- Yeaft 外部或人工终端只可运行准备阶段:
70
-
71
- ```bash
72
- yeaft-repo prepare --name fix-short-description
73
- yeaft-repo review-prep --pr 123
74
- ```
75
-
76
- 独立 CLI 不能执行 `land`。Landing 必须在 Session 中通过 `RepoWorkflow` 工具执行,并携带当前 handoff 由宿主签发、绑定 exact review 的 approval capability;普通参数或 `approvedBy` 字符串不能替代该 capability。
77
-
78
- 每条可用命令 stdout 只输出一个成功 JSON;失败时 stderr 输出一个带稳定 `code` 和副作用状态的 JSON。
@@ -1,80 +0,0 @@
1
- import { defineTool } from './types.js';
2
- import {
3
- formatRepoWorkflowError,
4
- landRepoWorkflow,
5
- prepareRepoReview,
6
- prepareRepoWorkflow,
7
- } from '../../repo-workflow.js';
8
-
9
- const repoWorkflow = defineTool({
10
- name: 'RepoWorkflow',
11
- description: {
12
- en: `Run one deterministic GitHub repository workflow phase and return compact structured evidence.
13
-
14
- Use this instead of repeatedly issuing git/gh shell commands:
15
- - prepare: fetch the remote default branch and create/reuse an exact-base development worktree.
16
- - review-prep: freeze a PR's exact base/head/GitHub merge snapshot and create/reuse a clean detached review worktree.
17
- - land: re-freeze an independently approved exact base branch/base SHA/head/snapshot and atomically install that exact snapshot on the approved remote base with an expected-old lease, then optionally create the next numeric tag and wait for a workflow. Worktree cleanup is deliberately separate.
18
-
19
- This tool does not review code and never infers approval. The land phase requires the reviewer identity and exact SHAs returned by review-prep. Supports any local GitHub repository available to the Agent; git and authenticated gh CLIs are required.`,
20
- zh: `执行一个确定性的 GitHub 仓库工作流阶段,并返回紧凑的结构化证据。
21
-
22
- 应使用此工具代替反复执行 git/gh shell 命令:
23
- - prepare:拉取远端默认分支,并创建或复用精确基线的开发 worktree。
24
- - review-prep:冻结 PR 的精确 base/head/GitHub merge snapshot,并创建或复用干净的 detached review worktree。
25
- - land:重新冻结已经独立批准的 exact base branch/base SHA/head/snapshot,以 expected-old lease 在已批准的远端 base 上原子安装该 exact snapshot,随后可选创建下一个数字 tag 并等待 workflow。Worktree cleanup 刻意与 landing 分离。
26
-
27
- 此工具不做代码审查,也不会推断 review 已通过。land 必须提供 reviewer 身份以及 review-prep 返回的精确 SHA。适用于 Agent 可访问的任意本地 GitHub 仓库;需要 git 和已认证的 gh CLI。`,
28
- },
29
- parameters: {
30
- type: 'object',
31
- properties: {
32
- phase: { type: 'string', enum: ['prepare', 'review-prep', 'land'] },
33
- cwd: { type: 'string', description: 'Repository or worktree path; defaults to the current engine cwd' },
34
- remote: { type: 'string', description: 'Git remote name (default: origin)' },
35
- baseBranch: { type: 'string', description: 'Explicit base branch for prepare, or exact approved destination branch for land' },
36
- baseSha: { type: 'string', description: 'Exact independently approved base SHA for land' },
37
- name: { type: 'string', description: 'Development or review worktree name' },
38
- worktreePath: { type: 'string', description: 'Explicit worktree path' },
39
- pr: { type: 'integer', description: 'GitHub pull request number' },
40
- reviewedHead: { type: 'string', description: 'Exact independently approved PR head SHA' },
41
- reviewedSnapshot: { type: 'string', description: 'Exact independently approved GitHub merge snapshot SHA' },
42
- tagPrefix: { type: 'string', description: 'Optional numeric tag prefix, for example v1.0.' },
43
- tagStart: { type: 'integer', minimum: 0 },
44
- workflow: { type: 'string', description: 'Optional GitHub Actions workflow name to wait for' },
45
- waitTimeoutMs: { type: 'integer', minimum: 1 },
46
- pollIntervalMs: { type: 'integer', minimum: 1 },
47
- },
48
- required: ['phase'],
49
- },
50
- timeoutMs: 0,
51
- isConcurrencySafe: () => false,
52
- isReadOnly: () => false,
53
- isDestructive: input => input?.phase === 'land',
54
- async execute(input, ctx) {
55
- const options = { ...input, cwd: input.cwd || ctx?.cwd || process.cwd() };
56
- try {
57
- const dependencies = input.phase === 'land'
58
- ? {
59
- signal: ctx?.signal,
60
- approvalCapability: ctx?.inboundEnvelope?._repoApproval,
61
- approvalContext: {
62
- sessionId: ctx?.sessionId,
63
- recipientVpId: ctx?.senderVpId,
64
- turnId: ctx?.turnId,
65
- },
66
- }
67
- : { signal: ctx?.signal };
68
- const result = input.phase === 'prepare'
69
- ? await prepareRepoWorkflow(options, dependencies)
70
- : input.phase === 'review-prep'
71
- ? await prepareRepoReview(options, dependencies)
72
- : await landRepoWorkflow(options, dependencies);
73
- return JSON.stringify(result);
74
- } catch (error) {
75
- return JSON.stringify(formatRepoWorkflowError(error));
76
- }
77
- },
78
- });
79
-
80
- export default repoWorkflow;