@difflab/pi 0.1.0 → 0.2.0-rc.202609170958.44c1e9f

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.
Files changed (70) hide show
  1. package/README.md +36 -1
  2. package/agents/diffpi-autonomous.md +15 -0
  3. package/agents/diffpi-copilot.md +22 -0
  4. package/agents/diffpi-orchestrator.md +23 -0
  5. package/agents/diffpi-planner.md +15 -0
  6. package/agents/diffpi-reviewer.md +27 -0
  7. package/agents/diffpi-tutor.md +20 -0
  8. package/agents/diffpi-worker.md +19 -0
  9. package/dist/assets.d.ts +4 -0
  10. package/dist/assets.d.ts.map +1 -0
  11. package/dist/config.d.ts +28 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/environment.d.ts +40 -0
  14. package/dist/environment.d.ts.map +1 -0
  15. package/dist/extensions/index.js +2919 -183
  16. package/dist/forge.d.ts +48 -0
  17. package/dist/forge.d.ts.map +1 -0
  18. package/dist/fsx.d.ts +6 -0
  19. package/dist/fsx.d.ts.map +1 -0
  20. package/dist/gates.d.ts +12 -0
  21. package/dist/gates.d.ts.map +1 -0
  22. package/dist/index.d.ts +26 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +2162 -162
  25. package/dist/modes.d.ts +59 -0
  26. package/dist/modes.d.ts.map +1 -0
  27. package/dist/pi.d.ts +21 -5
  28. package/dist/pi.d.ts.map +1 -1
  29. package/dist/process.d.ts +2 -0
  30. package/dist/process.d.ts.map +1 -1
  31. package/dist/review-backend.d.ts +15 -0
  32. package/dist/review-backend.d.ts.map +1 -0
  33. package/dist/review-publication.d.ts +17 -0
  34. package/dist/review-publication.d.ts.map +1 -0
  35. package/dist/review-types.d.ts +49 -0
  36. package/dist/review-types.d.ts.map +1 -0
  37. package/dist/review.d.ts +62 -0
  38. package/dist/review.d.ts.map +1 -0
  39. package/dist/setup.d.ts +11 -0
  40. package/dist/setup.d.ts.map +1 -1
  41. package/dist/store.d.ts +15 -0
  42. package/dist/store.d.ts.map +1 -0
  43. package/dist/templates.d.ts +14 -0
  44. package/dist/templates.d.ts.map +1 -0
  45. package/dist/tools/index.d.ts +6 -2
  46. package/dist/tools/index.d.ts.map +1 -1
  47. package/dist/tools/index.js +2631 -172
  48. package/dist/tools/modes.d.ts +4 -0
  49. package/dist/tools/modes.d.ts.map +1 -0
  50. package/dist/tools/review.d.ts +7 -0
  51. package/dist/tools/review.d.ts.map +1 -0
  52. package/dist/tools/setup.d.ts.map +1 -1
  53. package/dist/tools/templates.d.ts +3 -0
  54. package/dist/tools/templates.d.ts.map +1 -0
  55. package/dist/tuicr.d.ts +55 -0
  56. package/dist/tuicr.d.ts.map +1 -0
  57. package/dist/zed.d.ts +11 -0
  58. package/dist/zed.d.ts.map +1 -0
  59. package/package.json +4 -2
  60. package/skills/diffpi-setup/SKILL.md +15 -1
  61. package/skills/mode/SKILL.md +38 -0
  62. package/skills/review/SKILL.md +15 -0
  63. package/skills/review/references/workflows/address.md +10 -0
  64. package/skills/review/references/workflows/edit.md +9 -0
  65. package/skills/review/references/workflows/help.md +12 -0
  66. package/skills/review/references/workflows/merge.md +6 -0
  67. package/skills/review/references/workflows/new.md +9 -0
  68. package/skills/review/references/workflows/open.md +7 -0
  69. package/skills/review/references/workflows/publish.md +8 -0
  70. package/templates/review/draft-pr.md +18 -0
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from '@earendil-works/pi-coding-agent';
2
+ import type { ModeController } from '../modes';
3
+ export declare function createModeTools(controller: ModeController): readonly ToolDefinition[];
4
+ //# sourceMappingURL=modes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../../src/tools/modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAElF,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB5D,wBAAgB,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,CAiErF"}
@@ -0,0 +1,7 @@
1
+ import { type ToolDefinition } from '@earendil-works/pi-coding-agent';
2
+ import { type GateResult } from '../gates';
3
+ export declare function conventionalMergeGuard(subject: string): GateResult;
4
+ export declare function workingTreeDiff(cwd: string): Promise<string>;
5
+ export { assertGitHubMergeReady } from '../forge';
6
+ export declare function createReviewTools(): readonly ToolDefinition[];
7
+ //# sourceMappingURL=review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/tools/review.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqC,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAIzG,OAAO,EAAkD,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAoG3F,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAElE;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAalE;AAED,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIlD,wBAAgB,iBAAiB,IAAI,SAAS,cAAc,EAAE,CA+X7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/tools/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAgBlF,eAAO,MAAM,eAAe,EAAE,cA0B5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,cAsB/B,CAAC"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/tools/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAqBlF,eAAO,MAAM,eAAe,EAAE,cA6B5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,cAyB/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from '@earendil-works/pi-coding-agent';
2
+ export declare const diffpiTemplateTool: ToolDefinition;
3
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAUlF,eAAO,MAAM,kBAAkB,EAAE,cAiB/B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { type LaunchResult } from './environment';
2
+ import type { ReviewComment } from './review-types';
3
+ export interface SessionSummary {
4
+ slug: string;
5
+ kind: string;
6
+ path: string;
7
+ updatedAt: string;
8
+ commentCount: number;
9
+ anchor: string;
10
+ active: boolean;
11
+ }
12
+ interface SessionCommentJson {
13
+ content: string;
14
+ side?: 'old' | 'new' | null;
15
+ username?: string;
16
+ author?: string;
17
+ }
18
+ interface SessionFileJson {
19
+ file_comments?: SessionCommentJson[];
20
+ line_comments?: Record<string, SessionCommentJson[]>;
21
+ }
22
+ export interface SessionJson {
23
+ branch_name?: string;
24
+ repo_path?: string;
25
+ review_comments?: SessionCommentJson[];
26
+ files?: Record<string, SessionFileJson>;
27
+ }
28
+ export declare function tuicrAvailable(): Promise<boolean>;
29
+ export declare function listSessions(repo?: string): Promise<SessionSummary[]>;
30
+ export declare function resolveSession(cwd: string, branch: string): Promise<SessionSummary | undefined>;
31
+ export declare function resolveReviewSession(cwd: string, target: {
32
+ branch: string;
33
+ workingTree?: boolean;
34
+ owner?: string;
35
+ repo?: string;
36
+ number?: number;
37
+ }): Promise<SessionSummary | undefined>;
38
+ export declare function resolvePrSession(cwd: string, owner: string, repo: string, number: number): Promise<SessionSummary | undefined>;
39
+ export declare function findMatchingSession(sessions: readonly SessionSummary[], cwd: string, branch: string): Promise<SessionSummary | undefined>;
40
+ export declare function readSession(path: string): Promise<SessionJson>;
41
+ export declare function addComment(session: string, body: string, opts?: {
42
+ targetFile?: string;
43
+ line?: number;
44
+ side?: 'old' | 'new';
45
+ username?: string;
46
+ }): Promise<void>;
47
+ export declare function launch(cwd: string, pr?: number | string): Promise<LaunchResult>;
48
+ export declare function toFindings(session: SessionJson, options?: {
49
+ agentOnly?: boolean;
50
+ }): {
51
+ comments: ReviewComment[];
52
+ body: string;
53
+ };
54
+ export {};
55
+ //# sourceMappingURL=tuicr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tuicr.d.ts","sourceRoot":"","sources":["../src/tuicr.ts"],"names":[],"mappings":"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"}
package/dist/zed.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export declare const ZED_REVIEW_TASK_NAME = "diffpi: tuicr review";
2
+ export interface ZedEnsureResult {
3
+ path: string;
4
+ changed: boolean;
5
+ existed: boolean;
6
+ }
7
+ export declare function zedTasksPath(homeDir?: string): string;
8
+ export declare function zedKeymapPath(homeDir?: string): string;
9
+ export declare function ensureZedReviewTask(homeDir?: string): Promise<ZedEnsureResult>;
10
+ export declare function ensureZedReviewKeybinding(homeDir?: string): Promise<ZedEnsureResult>;
11
+ //# sourceMappingURL=zed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zed.d.ts","sourceRoot":"","sources":["../src/zed.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAmB3D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAWD,wBAAgB,YAAY,CAAC,OAAO,SAAY,GAAG,MAAM,CAExD;AAED,wBAAgB,aAAa,CAAC,OAAO,SAAY,GAAG,MAAM,CAEzD;AAED,wBAAsB,mBAAmB,CAAC,OAAO,SAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAWvF;AAED,wBAAsB,yBAAyB,CAAC,OAAO,SAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAgB7F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difflab/pi",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-rc.202609170958.44c1e9f",
4
4
  "description": "Tools and skills for the pi coding agent",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,8 +28,10 @@
28
28
  }
29
29
  },
30
30
  "files": [
31
+ "agents/",
31
32
  "dist/",
32
- "skills/"
33
+ "skills/",
34
+ "templates/"
33
35
  ],
34
36
  "pi": {
35
37
  "extensions": [
@@ -23,6 +23,16 @@ ask_user_question({
23
23
  ],
24
24
  multiSelect: false,
25
25
  },
26
+ {
27
+ question: 'Which forge should diffpi configure for /review?',
28
+ header: 'Forge',
29
+ options: [
30
+ { label: 'None', description: 'Use local tuicr review without a forge CLI or MCP server.' },
31
+ { label: 'GitHub', description: 'Install gh and register the GitHub MCP server with OAuth.' },
32
+ { label: 'GitLab', description: 'Install glab and register the GitLab MCP server with OAuth.' },
33
+ ],
34
+ multiSelect: false,
35
+ },
26
36
  {
27
37
  question:
28
38
  'Allow diffpi to install mise, add its activation hook to your shell configuration, and install required development tools if they are missing?',
@@ -43,4 +53,8 @@ ask_user_question({
43
53
  });
44
54
  ```
45
55
 
46
- Map `None`, `Linear`, and `Jira` to `none`, `linear`, and `jira`. If the user selects `Skip` or declines the questionnaire, stop without calling `diffpi_setup`. After successful setup, call `diffpi_reload` when the setup result says pi must restart.
56
+ Map `None`, `Linear`, and `Jira` to `none`, `linear`, and `jira`. Map the forge answer `None`, `GitHub`, or `GitLab` to `forge: none`, `github`, or `gitlab`. Keep the forge at `none` unless the user selects one. If the user selects `Skip` or declines the questionnaire, stop without calling `diffpi_setup`. After successful setup, call `diffpi_reload` when the setup result says pi must restart.
57
+
58
+ When the user is using Zed, ask separately whether to bind `cmd-alt-r` to the `diffpi: tuicr review` task. Only pass `bindZedKey: true` when the user opts in; otherwise pass `false`.
59
+
60
+ Setup installs Diffpi's bundled agent Markdown into Pi's standard global agent directory. Explain that each default can run through the subagent plugin or as the current inline prompt. `/skill:mode` opens the structured picker. It also accepts `--include-skills`, one agent id, a qualified `skill:agent` id, or `clear`.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: mode
3
+ description: List, select, or clear an inline agent profile. Use when the user invokes /skill:mode or asks to change the current Diffpi mode.
4
+ allowed-tools: ask_user_question diffpi_modes_list diffpi_modes_set diffpi_modes_unset
5
+ ---
6
+
7
+ # Mode
8
+
9
+ Pi appends `/skill:mode` arguments as `User: <arguments>`. Route those arguments without manual command parsing in the extension.
10
+
11
+ ## Direct requests
12
+
13
+ - If the argument is `help`, `-h`, or `--help`, print the usage and examples below. Do not call a tool.
14
+ - If the argument is `clear`, call `diffpi_modes_unset` and stop.
15
+ - If the argument is one agent id, call `diffpi_modes_set` with that exact id and stop.
16
+ - A qualified id such as `spec:planner` is one agent id. The tool enables skill-agent discovery for it.
17
+ - If the request contains multiple agent ids or an unsupported flag, print the usage and stop.
18
+
19
+ ```text
20
+ /skill:mode [--include-skills] [agent|clear]
21
+ /skill:mode
22
+ /skill:mode --include-skills
23
+ /skill:mode worker
24
+ /skill:mode spec:planner
25
+ /skill:mode clear
26
+ ```
27
+
28
+ ## Picker
29
+
30
+ Use the picker when there are no arguments or when the only argument is `--include-skills`.
31
+
32
+ 1. Call `diffpi_modes_list`. Set `includeSkills` to true only for `--include-skills`.
33
+ 2. Call `ask_user_question` with one single-select question. Do not ask as plain chat text.
34
+ 3. Put the complete list of valid ids in the question text. Offer Default plus at most three relevant agents as structured options. The custom-answer row lets the user enter any other valid id.
35
+ 4. If the user selects Default or enters `clear`, call `diffpi_modes_unset`.
36
+ 5. Otherwise, call `diffpi_modes_set` with the selected or entered id.
37
+
38
+ Do not perform unrelated work. Explain that the selected prompt, preferred available model, thinking level, and tool set start on the next turn. Mode selection is not a security boundary.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: review
3
+ description: Code review workflows over GitHub, GitLab, or the local tuicr backend. Use for review open, new, edit, address, publish, merge, or local review requests.
4
+ allowed-tools: ask_user_question review_context review_open review_edit review_diff review_gates review_submit review_add_comment review_comments review_respond review_publish review_merge review_launch diffpi_template
5
+ ---
6
+
7
+ # review
8
+
9
+ Treat `--local` as a backend selector. The local backend is `tuicr`; the remote backend is the detected GitHub or GitLab forge. Target selection, storage, provenance, templates, comment staging, replies, publication, and forge calls belong to the tools.
10
+
11
+ Parse the first non-flag argument as VERB and preserve remaining flags. Normalize `create` and `draft` to `open`, `ready` to `publish`, and `land` to `merge`. An empty or unknown verb uses `references/workflows/help.md`. The removed `complete` verb is not an alias.
12
+
13
+ Read and follow `references/workflows/{VERB}.md`. Call `review_context` first in every workflow. Use `ask_user_question` for choices that cannot be derived from the request. Never ask those questions as plain chat text.
14
+
15
+ Workflow index: `open` creates a draft PR/MR or opens a local target; `new` generates a review and leaves remote comments pending; `edit` opens an existing target in tuicr without generating comments; `address` fixes comments and records or posts replies; `publish` promotes local drafts and publishes with a status; `merge` is the separate GitHub-only merge action; `help` prints the reference.
@@ -0,0 +1,10 @@
1
+ # address
2
+
3
+ 1. Parse an optional PR/MR id or URL and `--local`.
4
+ 2. Call `review_context` with the target and backend selection.
5
+ 3. Call `review_comments`. With `--local`, the tool pulls remote threads or the exact matching tuicr session into `.diffpi/reviews/YYMMDD-<short-head-sha>.md` or `.diffpi/reviews/YYMMDD-local.md`. This Markdown file is the local reply overlay for remote threads.
6
+ 4. For each comment, inspect the referenced code. Apply a justified fix when the comment requests a change. Answer every question even when no code change is needed.
7
+ 5. Call `review_respond` for each thread. With `--local`, replies stay in the local overlay until `publish --local`. Without `--local`, replies post to the forge immediately.
8
+ 6. Pass `question: true` for a question. Question threads remain open after the reply. A non-question remote thread resolves only after its requested change is applied; otherwise pass `resolve: false`.
9
+ 7. With `--local`, call `review_edit` after replies are recorded so the user can inspect the PR and local draft in tuicr.
10
+ 8. Report fixed, answered, unresolved, and deferred counts. Do not publish pending comments or replies in this workflow.
@@ -0,0 +1,9 @@
1
+ # edit
2
+
3
+ This workflow is local-only. It opens a review target in tuicr without generating findings or changing existing comments.
4
+
5
+ 1. Parse an optional PR/MR id or URL and `--working-tree`.
6
+ 2. Call `review_context` with `local: true` and the supplied target.
7
+ 3. Call `review_edit`. With no target, the tool opens the current branch PR/MR when one exists and otherwise opens working-tree changes.
8
+ 4. If an id or URL names a PR/MR on another branch, the tool requires a clean worktree, fetches that branch, and switches the current worktree before it opens tuicr.
9
+ 5. Report whether tuicr opened in a mux, prepared a Zed task, or returned a command for the user to run.
@@ -0,0 +1,12 @@
1
+ # help
2
+
3
+ ```text
4
+ /review open [--local] [--base branch]
5
+ /review new [target] [--local] [--working-tree]
6
+ /review edit [target] [--working-tree]
7
+ /review address [target] [--local]
8
+ /review publish [target] [--local] [--comment|--approve|--request-changes|--close]
9
+ /review merge [target]
10
+ ```
11
+
12
+ `--local` selects tuicr as the review backend. `new` generates findings; `edit` only opens an existing target. Local records and reply overlays are stored under `.diffpi/reviews/`. Publish makes pending work public with a status but never merges. Merge remains a separate GitHub-only workflow.
@@ -0,0 +1,6 @@
1
+ # merge
2
+
3
+ 1. Call `review_context` and confirm the PR/MR is approved and ready.
4
+ 2. If a conventional squash subject is required and the subject is unclear, use `ask_user_question`.
5
+ 3. Call `review_merge` with the chosen subject.
6
+ 4. Report the merge result.
@@ -0,0 +1,9 @@
1
+ # new
2
+
3
+ 1. Parse an optional PR/MR id or URL, `--local`, and `--working-tree`.
4
+ 2. Call `review_context` with the same target and backend selection.
5
+ 3. Call `review_diff` and `review_gates`. With `--local`, the default target is the current branch PR/MR when one exists; otherwise it is the working tree. `--working-tree` always selects staged and unstaged local changes.
6
+ 4. Review the diff for intent, correctness, slop, and adversarial risk. Build findings as `{ file, line, severity, body, reference }`. Collect unanchorable blocking issues separately.
7
+ 5. For `--local`, call `review_launch` before `review_submit` so tuicr creates the target session. Call `review_submit` with `local: true`. The tool records the exact active provider/model as the tuicr author and writes `.diffpi/reviews/YYMMDD-<short-head-sha>.md` or `.diffpi/reviews/YYMMDD-local.md`.
8
+ 6. For a remote review, call `review_submit` without `local`. The tool adds the provider/model disclaimer to every comment and leaves the review pending. Do not publish it in this workflow.
9
+ 7. Report the artifact path, comment count, backend, and whether the user must run a printed tuicr command.
@@ -0,0 +1,7 @@
1
+ # open
2
+
3
+ 1. Parse an optional title, intent, base branch, and `--local`.
4
+ 2. Call `review_context`.
5
+ 3. With `--local`, call `review_open` with `local: true`. The tool auto-detects the current branch PR/MR and opens it in tuicr; when no PR/MR exists, it opens working-tree changes.
6
+ 4. Without `--local`, derive a concise title and intent from the branch and change context, then call `review_open`. The tool loads `review/draft-pr.md` from the generic template registry, preferring `~/.difflab/diffpi/templates/review/draft-pr.md` over the bundled default, renders it, and creates a draft PR/MR against the requested or repository default branch.
7
+ 5. Report the PR/MR URL or the tuicr launch instruction. Do not publish or merge.
@@ -0,0 +1,8 @@
1
+ # publish
2
+
3
+ 1. Parse an optional PR/MR id or URL, `--local`, and one status: `--comment`, `--approve`, `--request-changes`, or `--close`. The default is comment.
4
+ 2. Call `review_context` with the target and backend selection.
5
+ 3. For `--local`, call `review_publish` with `local: true`. The tool reads the exact tuicr session, promotes its unpublished line comments to a pending forge review, follows the stored local overlay path, posts unpublished replies to their remote threads, and then publishes the selected status. Question replies remain open. The tool does not post an overall review comment.
6
+ 4. For a remote review, call `review_publish` without `local`. The existing pending forge comments already contain provenance, so the tool only publishes them with the selected status and no overall comment.
7
+ 5. Comment, approve, and request-changes mark a draft PR/MR ready before publication. Close publishes pending work as comment status and then closes the PR/MR. GitLab rejects request-changes because it has no equivalent review state.
8
+ 6. Report promoted comment and reply counts, the public status, and the final PR/MR state. Publishing never merges.
@@ -0,0 +1,18 @@
1
+ ## Intent
2
+
3
+ {{intent}}
4
+
5
+ ## Changes
6
+
7
+ <!-- List the user-visible or architectural changes. -->
8
+
9
+ ## Validation
10
+
11
+ <!-- List the checks that were run. -->
12
+
13
+ - [ ] Existing tests pass
14
+
15
+ ## Review context
16
+
17
+ - Source branch: `{{head}}`
18
+ - Target branch: `{{base}}`