Land finished work - report git state, then ask how to publish (push / MR or PR / tag / leave local). With git.auto_close set in both config layers, it runs PR -> merge -> tag unattended, a chain that asks once, before the tag push, and halts on a surviving blocker
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cad Land?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/crenshawdev-cad-land)
---
name: cad-land
description: "Land finished work - report git state, then ask how to publish (push / MR or PR / tag / leave local). With git.auto_close set in both config layers, it runs PR -> merge -> tag unattended, a chain that asks once, before the tag push, and halts on a surviving blocker"
argument-hint: "[base branch | defaults to git.base_branch]"
allowed-tools:
- Read
- Task
- AskUserQuestion
- PushNotification
---
<objective>
Land the current branch's work: report the state, then publish as step 3 says.
</objective>
<execution_context>
@${CLAUDE_PLUGIN_ROOT}/cadence-core/references/git-guard.md
</execution_context>
<process>
Read every config key this run needs in ONE `config.mjs get` up front
(conventions.md Parallel work) - `git.base_branch git.protected_branches
git.on_land_cleanup git.create_tag git.integration_branch_name testing.scope` - and reuse the values across the steps
below rather than re-reading per step. Step 3 asks a seam, not this read.
1. **Report git state - base first.** The base = `$ARGUMENTS`, else
`git.base_branch`, else the first `git.protected_branches` entry that
exists here. Ask the seam about it BEFORE any git command is given it - the
commits-ahead count and the tracker call below included:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/land-cleanup.mjs" cleanup --base <base>`
On `baseRefused:true` the base is refused: run NO git command that takes it,
print the envelope's `reason` as the base line, and skip the commits-ahead
count and the tracker call. A refused `$ARGUMENTS` or `git.base_branch` ends
the search; in the protected-branches fallback the seam's answer IS the
"exists here" test, so ask it for each entry in order rather than probing
with git, and take the first it does not refuse. A `skip` without
`baseRefused` is the `on_land_cleanup` switch, not a refusal: the base is
usable.
**Then report:** current branch; commits ahead of base; unpushed commits;
uncommitted/untracked changes; and the remote host detected from the origin
URL (gitlab -> MR, github -> PR, any other host where `tea` holds a login ->
Forgejo/Gitea PR via `tea`, else local only). Show this plainly before doing
anything.
**Then the tracker, in the same report.** Run it here, before any publish
ask, on both step-3 arms:
```
node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/issue-check.mjs" check --dir <root> --base <base>
```
Branch on `action` alone. On `report`: say in ONE sentence which issues this
branch's commits reference and which of them are still open ("your branch
references #42 and #47; #42 is still open"), naming a `not-found` number as
not found and an `unresolved` one unresolved, never closed or not found.
Print the `open` list ONLY when
`referenced` is empty. On `skip`: print `reason` verbatim as
ONE line and carry on - never block, never retry, never ask, and never list
an issue the seam did not read. On `off` - `git.issue_check: false`, decided
before any forge CLI runs - say NOTHING about the tracker: not the reason,
not that it was skipped.
This report never writes: landing closes no issue, and closing one stays an
explicit ask you make at publish time.
**Then the already-merged arm.** Ask the forge: GitHub `gh pr view <branch>
--json state,mergedAt,headRefOid`, GitLab `glab mr view <branch> -F json`
(`sha`); Forgejo's `tea pr` names none: never there. It runs
only if the request is MERGED and the branch tip
(`git rev-parse <branch>`) equals that head; a mismatch or no head says why in
one line, leaving the branch; that and no merged request go to step 2,
publish ask included. On a match say so
and run step 3's deferred-queue stop, halting here too: no pull, tag or
reap. On an empty queue skip to step 4, passing `--merged true` and
clearing the carry and the name only when `<branch>` is
`git.integration_branch_name`, else leaving both with a one-line why (key
unset: nothing tells whose carry it is). The branch is deleted only when
`git branch --merged <base>` lists it.
2. **Uncommitted changes.** If the tree is dirty, do NOT auto-commit. Ask
(ask-user seam):
- header: "Uncommitted"
- question: "You have changes that aren't committed. What should happen to them before this work is published?"
- options:
- "Commit them first - you give a message, the changes are committed, and then publishing goes on"
- "Leave them out - publish only what is already committed, and the changes stay in your working tree"
- "Stop - publish nothing"
If HEAD is a protected branch, the protected-branch guard
(references/git-guard.md) applies to any commit here.
3. **Publish - branch on the `git.auto_close` authorization.**
**First the deferred queue, on BOTH arms and ahead of the branch below.** Ask
what is still queued:
```
node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/planning.mjs" deferred list
```
On ANY entry in `members`, STOP the land here: no publish ask, no seam call,
no merge, no tag, neither arm. Print each member's `trigger`,
`discriminator` and finding count with the `path` its bodies are in, then
point the reader at
`${CLAUDE_PLUGIN_ROOT}/cadence-core/references/triage-gate.md`, whose
`deferred` arm says how to clear one - triage the member's findings and
record the rulings with `planning.mjs adjudication` for the same trigger,
discriminator and round, which supersedes it. A non-empty `unreadable`
arrives as `ok:false` and refuses exactly as a member does: this gate never
reports "nothing deferred" about input it could not read.
It is NOT `land-cleanup.mjs gate`.
**Then the ONE answer both arms branch on**, on its own line:
```
node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/git-publish.mjs" authorized --dir <root>
```
`ok:true` takes 3(b), `ok:false` takes 3(a). It is true only when this
repository's config and your user-global config BOTH set `git.auto_close`;
either alone authorizes nothing. When the refusal's `requested` is true,
print its `detail` as one line first.
**(a) `git.auto_close` false, or not set in both layers (default): ask the
mechanism (ask-user seam, NO preselected default).** With `testing.scope`
set, first run `node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/planning.mjs"
test-policy check --root . --base <base>` and print any weakening it names
as ONE line before the question. Under a policy, when HEAD is the base
branch the Push the branch option is absent, because a commit pushed straight
onto the base cannot pass the required jobs before it lands: say so and
point at opening a PR from another branch. Pushing any other branch
stays.
Tag a release is offered only when HEAD is the base. On any other branch it
is absent, with one line saying why: a pushed `v*` tag starts the release
workflow on the commit it names, so tag-after-merge stays step 4's.
- header: "Publish"
- question: "How do you want to publish this work?"
- options:
- "Push the branch - send the current branch to its remote"
- "Open a pull or merge request - publish the branch if needed and open a request to merge it on your host"
- "Tag a release - create a tag on this commit, then ask whether to send it to the remote"
- "Leave it local - do nothing more"
What the request and tag options run:
- **Open a pull or merge request** - the detected host's mechanism (`glab mr
create` on GitLab, `gh pr create` on GitHub, `tea pr create --base <base>
--head <branch>` on a Forgejo/Gitea remote - `tea` does not push the source
branch itself, so push it first as part of this same chosen action). If
no remote, or `tea` holds no login at all, this option is absent. Before
it runs, show the title and summary and ask:
- header: "Request text"
- question: "Open the request with this title and summary?"
- options:
- "Use this text - open the request as shown"
- "Change it - you give a new title or summary, and the request opens with those"
- **Tag a release** - create an annotated tag. Ask its name:
- header: "Tag name"
- question: "What do you want to name the tag?"
- options: none, the person types the name
Then ask separately whether to push it:
- header: "Push tag"
- question: "Do you want to send the tag you just made to the remote?"
- options:
- "Push the tag - send it to the remote"
- "Keep it local - the tag stays on this machine"
**Before a direct push, an MR/PR, or a tag the user chose to push,** Read
`${CLAUDE_PLUGIN_ROOT}/cadence-core/references/git-publish.md` (one
consult site - step 3a or 3b, never both): rail 3 governs all three.
Then **execute exactly that, raw.** Run only the chosen action. Never push
unless push (or push-tag) was chosen. No PR-body templating beyond a
title/summary the user confirms. Report precisely what was done (branch
pushed, MR/PR URL, tag created) and nothing implied.
**(b) `git.auto_close` true, set in both layers: land the integration branch
on base via `PR -> merge`; it asks once, before the tag push.** Skip the 3a
ask.
- **Gate the unattended merge on the RULINGS, not the raw findings.** A
blocker/high finding still genuinely unfixed is a HARD halt before any
merge rather than an ask. This skill fires no review of its own: what it
reads is what this branch's `risk_surface` fires already ADJUDICATED. Read
every `ADJUDICATION-risk_surface*.json` under BOTH record roots -
`.planning/phases/*/records/` and `.planning/records/risk-carry/*/`, and on
an agile project (`.planning/agile/` there) its one root, each task's folder
`.planning/agile/tasks/*/` - and union every record's `entries[]`. On that
root every value is a task's own record and is read as untrusted input.
Every record, never the highest round
alone: a re-arm is a second fire, on its own range or at `-r2` of the same
`plan-<k>` or `<command>-<sha>` discriminator, and its record is not the
record of round 1. Do NOT read the `findings` arrays out of the
`REVIEW-risk_surface*.md` files.
Then name on `unruled` every `REVIEW-risk_surface*.md` nothing ruled - from
those roots plus a legacy `.planning/REVIEW-risk_surface-*.md` an
interrupted pre-`risk-carry` close may have left at the `.planning/` root.
A review and its record never share a basename, so do not look for one.
A range-named review (`<short base sha>-<short head sha>`, the grammar
`${CLAUDE_PLUGIN_ROOT}/cadence-core/references/review-triggers.md` step 5
states) is ruled only by the record with the same trigger and the same
range in the same directory, with no round and no asymmetry, because each
round is its own range. Every other review - `plan-<k>`, `plan-<k>-rN`,
`<command>-<short HEAD sha>` - keeps this rule whole:
`REVIEW-<trigger>-<discriminator>[-rN].md` is ruled by
`ADJUDICATION-<trigger>-<discriminator>[-rN].json` in the same directory -
same trigger, same discriminator, same round, with `REVIEW-` swapped for
`ADJUDICATION-` and `.md` for `.json`. `-r2` pairs with `-r2`, and a round-1
record never rules a round-2 review. One asymmetry, and the corpus forces
it: a LATER round's record does rule an earlier review, because a re-arm's
adjudication settles the round it re-armed. So such a review is
`unruled` only when its `<trigger>-<discriminator>` has no record at its own
round and none at any later one, and a range-named one only when its own
range has none. A fire nothing ruled says nothing about what survived, so
it halts by name rather than being read past.
That legacy root file is the one `unruled` entry no adjudication can ever
answer, so state its remedy in the halt instead of only its path: it holds
RAW findings under no discriminator, so no `ADJUDICATION-*.json` can ever
sit beside it. It is answered ONCE and BY HAND: read its findings, settle
any still genuinely unfixed against this branch, then delete the file.
Nothing in this skill does that for the user.
Pipe `{"findings": [...], "unruled": [...]}` on stdin to
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/land-cleanup.mjs" gate --dir <root>`,
the same `<root>` step 3's `authorized` call read; on
`action:"halt"` stop the chain and surface the `findings` instead of
merging over them, and surface a non-empty `overridden` with them.
When no root holds a record or a review, pipe an explicit
`{"findings":[]}` - that is the only spelling of "nothing survived", and
`action:"halt"` also fires when the payload could not be read at all,
since the gate never reports "no surviving finding" about input it never
parsed.
- **Read the publish rails first.** Read
`${CLAUDE_PLUGIN_ROOT}/cadence-core/references/git-publish.md` (one
consult site - step 3a or 3b, never both) before the
first bullet below that publishes anything, GitLab's request open
included: rail 3 governs from here on.
- **Publish the branch (GitHub and Forgejo arms).** On either host publish
the branch first through the git-publish seam. Run it on its own physical
line:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/git-publish.mjs" publish --dir <root>`
On `ok:true` proceed to open the PR; on `ok:false` stop and surface the
reason - do NOT fall back to a raw `git push`. Relay the envelope's
`warnings[]` to the user rather than dropping them:
`reason:"config-parse-failed"` means a config layer that could carry
`protected_branches` did not parse, so the branch was checked against the
DEFAULT list - fix the file, never retry past it.
- **Open (or reuse) the PR/MR.** The GitLab arm asks BEFORE it probes, on
its own physical line:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/git-publish.mjs" authorized --dir <root>`
On `ok:false` do not touch the remote at all - no view, no create, no merge -
stop and surface the `detail`, which names the missing half. ONE consult,
ahead of the whole bullet and not beside the create.
Then reuse an existing open one when
`gh pr view <branch>` / `glab mr view <branch>` / `tea pr list --state
open` (filtered by head branch) finds it, else open it on its own line
(`<forge>`: `github`, `gitlab` or `forgejo`; Forgejo's index is in `output`):
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/git-publish.mjs" open --dir <root> --forge <forge> --base <base>`
`ok:false` stops here; never retry it in Bash.
- **Under a policy, the required jobs gate the merge (GitHub arm).** With
`testing.scope` set, once the PR exists and before the merge, run
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/planning.mjs" test-policy check --root . --base <base>`.
A disagreement (`ok:false`) or any named weakening in `base.changes` is
shown and halts the unattended path until it is resolved, the way a
surviving finding halts it. Then Read
`${CLAUDE_PLUGIN_ROOT}/cadence-core/references/test-policy.md` (one consult
site, this step) for the bounded wait, and read the required jobs of the
branch head with a Bash timeout of 600000. Resolve the head sha ONCE with
`git rev-parse <branch>` and use that same sha for the read and the merge:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/planning.mjs" test-policy ci-status --commit <sha> --wait 540 --root .`
Only `answer:"pass"` reaches the merge, and that merge passes
`--sha <sha>`. `fail` stops and names each failing job.
`pending` after the wait stops with nothing landed, and a re-run resumes
here.
- **Merge on the platform**, on its own line:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/git-publish.mjs" merge --dir <root> --forge <forge>`,
with `--sha <sha>` on GitHub under a policy and `--index <index>` on
Forgejo.
- **Confirm it landed before any cleanup.** `gh pr view <branch> --json
state,mergedAt` must show MERGED, `glab mr view <branch>` must show
merged, or `tea pr <index>` must show state merged. The merge's `ok:false`
(protected-branch / not-mergeable) or a still-open
PR/MR (auto-merge only enabled, CI pending) means the merge did NOT land:
stop, surface the reason, and do NOT reap.
4. **Terminal cleanup - return to base + pull + reap (`git.on_land_cleanup`,
default on).** Run this ONLY when a merge actually landed on this machine,
or step 1's already-merged arm sent you here (skip it after an open-PR-only
or leave-local land). Once that request merges, step 1's already-merged arm
is the way back; where that arm doesn't run or doesn't clear the carry, clear
the carry by hand.
Pull FIRST, but ask the seam about the base before git sees it:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/land-cleanup.mjs" cleanup --base <base>`
with the base step 1 resolved, plus `--merged true` in the auto_close path
and on the already-merged arm within its limit.
`--base` is required. On `action:"skip"` or `returnToBase:false` run no
checkout, no pull, no tag and no reap: leave HEAD and the branch in place and
report the envelope's reason. Otherwise run `git checkout` on the `base` the
envelope names, then `git pull`.
**Release tag on the pulled base (tag-after-merge), before the reap.** When
`git.create_tag` is true and the shipped version - on an agile project the
`release.version` the `cleanup` call above printed (the newest closed
release, checked as the close checks a version; `null` means no tag), else
the manifest's `version` (`.claude-plugin/plugin.json` or the project's own
manifest), else the version PROJECT.md says just shipped - has no tag yet
(`git tag` membership), cut it HERE: write the milestone label to a scratch
file and run `git tag -a <version> -F <path>` on the now-current base - the
label is a PROJECT.md milestone name, or that call's `release.title` on an
agile project, so it reaches git as a PATH (caller-derived text
- references/conventions.md). Then ask separately whether to push it
(references/git-publish.md rails; never auto-push a tag):
- header: "Push tag"
- question: "Do you want to send the release tag you just made to the remote?"
- options:
- "Push the tag - send it to the remote"
- "Keep it local - the tag stays on this machine"
Skip silently when `git.create_tag`
is false or the tag already exists.
Then compute the reap decision against the now-current base:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/land-cleanup.mjs" cleanup --base <base>`.
In the auto_close path, and on the already-merged arm within its limit,
append `--merged true`: it confirms the merge for the name unset below,
while the reap still needs `git branch --merged <base>` to list the branch.
A manual land omits it. Relay its `warnings[]`: a layer that did not parse
means `on_land_cleanup` and `base` came from DEFAULTS. When the seam returns
`reap:true`, reap through the git-publish seam - never a Bash git call, never
a remote-tracking delete:
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/git-publish.mjs" reap --dir <root> --branch <decision.branch>`.
It refuses an unsafe, protected or checked-out branch. Relay its `warnings[]`
too, and treat `reason:"config-parse-failed"` as a stop and not a retry. When
either seam returns `action:"skip"` - the branch was already removed, or
`git.on_land_cleanup` is off - leave HEAD and the branch in place. Report the
final state: HEAD on `<base>`, pulled, branch reaped (or left).
**Then clear the carried rulings.** Delete `.planning/records/risk-carry/`.
This step is the ONLY actor that clears them, and only on a confirmed merge.
Do it whatever the reap seam answered, an `action:"skip"` included, but on the
already-merged arm only when the merged branch is
`git.integration_branch_name`. This stages nothing.
**Then stop the branch name applying.** When either cleanup envelope says
`clearIntegrationName:true` (the branch name setting is set and the merge is
confirmed), and on the already-merged arm only within that same limit
whatever the envelope says, run
`node "${CLAUDE_PLUGIN_ROOT}/cadence-core/bin/config.mjs" unset --file .planning/config.json git.integration_branch_name`
Do it whatever the reap seam answered, and with `git.on_land_cleanup` off too.
An open-PR-only land has no confirmed merge, so the key stays. Report it in
the final state line, and where the repository tracks `.planning/config.json`
say that file is now modified and rides the next docs commit: this skill never
auto-commits.
Before any question to the user, send one `PushNotification` naming the
command, the phase or position line and what is needed, in one line under 200
characters, and skip it when the host has no such tool
(`references/seam-ask-user.md` has the full rule).
</process>
<guardrails>
- `/cad-land` commits no fix, and whatever step 2 commits is published with no
review.
- An unadjudicated deferred finding is the one thing that stops it - on both
arms, before either publishes anything.
</guardrails>