@llblab/pi-kit 0.3.1 → 0.4.0

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 (123) hide show
  1. package/AGENTS.md +3 -3
  2. package/BACKLOG.md +1 -1
  3. package/CHANGELOG.md +10 -0
  4. package/README.md +19 -10
  5. package/node_modules/@llblab/pi-actors/AGENTS.md +1 -0
  6. package/node_modules/@llblab/pi-actors/CHANGELOG.md +6 -0
  7. package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +16 -6
  8. package/node_modules/@llblab/pi-actors/dist/skills/music-player/SKILL.md +3 -3
  9. package/node_modules/@llblab/pi-actors/dist/skills/music-player/genapps/music-player.mjs +6 -4
  10. package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback.mjs +85 -18
  11. package/node_modules/@llblab/pi-actors/dist/skills/swarm/SKILL.md +2 -6
  12. package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/development-swarm.md +2 -31
  13. package/node_modules/@llblab/pi-actors/docs/recipe-library.md +1 -1
  14. package/node_modules/@llblab/pi-actors/package.json +1 -1
  15. package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +16 -6
  16. package/node_modules/@llblab/pi-actors/skills/music-player/SKILL.md +3 -3
  17. package/node_modules/@llblab/pi-actors/skills/music-player/genapps/music-player.mjs +6 -4
  18. package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback.mjs +85 -18
  19. package/node_modules/@llblab/pi-actors/skills/swarm/SKILL.md +2 -6
  20. package/node_modules/@llblab/pi-actors/skills/swarm/references/development-swarm.md +2 -31
  21. package/node_modules/@llblab/pi-clean-room/AGENTS.md +5 -0
  22. package/node_modules/@llblab/pi-clean-room/BACKLOG.md +3 -0
  23. package/node_modules/@llblab/pi-clean-room/CHANGELOG.md +15 -0
  24. package/node_modules/@llblab/pi-clean-room/README.md +61 -0
  25. package/node_modules/@llblab/pi-clean-room/banner.jpg +0 -0
  26. package/node_modules/@llblab/pi-clean-room/index.ts +178 -0
  27. package/node_modules/@llblab/pi-clean-room/package.json +53 -0
  28. package/node_modules/@llblab/pi-grow-loop/AGENTS.md +1 -1
  29. package/node_modules/@llblab/pi-grow-loop/CHANGELOG.md +4 -0
  30. package/node_modules/@llblab/pi-grow-loop/package.json +1 -1
  31. package/node_modules/@llblab/pi-grow-loop/skills/grow-loop/SKILL.md +3 -17
  32. package/node_modules/@llblab/pi-state-flow/AGENTS.md +28 -0
  33. package/node_modules/@llblab/pi-state-flow/BACKLOG.md +3 -0
  34. package/node_modules/@llblab/pi-state-flow/CHANGELOG.md +79 -0
  35. package/node_modules/@llblab/pi-state-flow/README.md +197 -0
  36. package/node_modules/@llblab/pi-state-flow/index.ts +4 -0
  37. package/node_modules/@llblab/pi-state-flow/lib/context.ts +88 -0
  38. package/node_modules/@llblab/pi-state-flow/lib/episode.ts +29 -0
  39. package/node_modules/@llblab/pi-state-flow/lib/extension.ts +238 -0
  40. package/node_modules/@llblab/pi-state-flow/lib/json.ts +78 -0
  41. package/node_modules/@llblab/pi-state-flow/lib/recovery.ts +38 -0
  42. package/node_modules/@llblab/pi-state-flow/lib/session.ts +49 -0
  43. package/node_modules/@llblab/pi-state-flow/lib/skills.ts +58 -0
  44. package/node_modules/@llblab/pi-state-flow/lib/snapshot.ts +103 -0
  45. package/node_modules/@llblab/pi-state-flow/lib/state.ts +20 -0
  46. package/node_modules/@llblab/pi-state-flow/lib/status.ts +16 -0
  47. package/node_modules/@llblab/pi-state-flow/lib/terminal.ts +148 -0
  48. package/node_modules/@llblab/pi-state-flow/lib/transition.ts +47 -0
  49. package/node_modules/@llblab/pi-state-flow/lib/validation.ts +27 -0
  50. package/node_modules/@llblab/pi-state-flow/package.json +55 -0
  51. package/node_modules/@llblab/pi-telegram/AGENTS.md +1 -1
  52. package/node_modules/@llblab/pi-telegram/BACKLOG.md +2 -0
  53. package/node_modules/@llblab/pi-telegram/CHANGELOG.md +16 -0
  54. package/node_modules/@llblab/pi-telegram/README.md +1 -1
  55. package/node_modules/@llblab/pi-telegram/docs/architecture.md +1 -1
  56. package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +17 -5
  57. package/node_modules/@llblab/pi-telegram/docs/outbound.md +3 -3
  58. package/node_modules/@llblab/pi-telegram/docs/public-api.md +2 -0
  59. package/node_modules/@llblab/pi-telegram/index.ts +9 -0
  60. package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +29 -18
  61. package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +15 -6
  62. package/node_modules/@llblab/pi-telegram/lib/bus.ts +11 -4
  63. package/node_modules/@llblab/pi-telegram/lib/outbound-markup.ts +34 -2
  64. package/node_modules/@llblab/pi-telegram/lib/outbound.ts +4 -1
  65. package/node_modules/@llblab/pi-telegram/lib/routing.ts +89 -32
  66. package/node_modules/@llblab/pi-telegram/lib/sync.ts +74 -15
  67. package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +32 -1
  68. package/node_modules/@llblab/pi-telegram/lib/thread-reconciler.ts +17 -0
  69. package/node_modules/@llblab/pi-telegram/lib/threads.ts +123 -15
  70. package/node_modules/@llblab/pi-telegram/package.json +1 -1
  71. package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/SKILL.md +1 -1
  72. package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/references/diagnosis.md +4 -2
  73. package/node_modules/@llblab/skills/abcd-context/AGENTS.md +40 -0
  74. package/node_modules/@llblab/skills/abcd-context/BACKLOG.md +3 -0
  75. package/node_modules/@llblab/skills/abcd-context/CHANGELOG.md +19 -0
  76. package/node_modules/@llblab/skills/abcd-context/README.md +30 -0
  77. package/node_modules/@llblab/skills/abcd-context/SKILL.md +122 -0
  78. package/node_modules/@llblab/skills/abcd-context/docs/README.md +9 -0
  79. package/node_modules/@llblab/skills/abcd-context/docs/protocols.md +199 -0
  80. package/node_modules/@llblab/skills/abcd-context/docs/templates.md +194 -0
  81. package/node_modules/@llblab/skills/abcd-context/docs/validation-design.md +117 -0
  82. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/AGENTS.md +10 -0
  83. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/BACKLOG.md +5 -0
  84. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/CHANGELOG.md +5 -0
  85. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/README.md +10 -0
  86. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/docs/README.md +7 -0
  87. package/node_modules/@llblab/skills/abcd-context/fixtures/abcd-project/docs/overview.md +3 -0
  88. package/node_modules/@llblab/skills/abcd-context/recipes/validate-context.json +7 -0
  89. package/node_modules/@llblab/skills/abcd-context/scripts/_self-test.mjs +244 -0
  90. package/node_modules/@llblab/skills/abcd-context/scripts/validate-context.mjs +497 -0
  91. package/node_modules/@llblab/skills/brain-storm/AGENTS.md +5 -0
  92. package/node_modules/@llblab/skills/brain-storm/SKILL.md +321 -0
  93. package/node_modules/@llblab/skills/coding-contract/SKILL.md +228 -0
  94. package/node_modules/@llblab/skills/domain-dag/AGENTS.md +6 -0
  95. package/node_modules/@llblab/skills/domain-dag/SKILL.md +257 -0
  96. package/node_modules/@llblab/skills/domain-dag/domain-dag.json +9 -0
  97. package/node_modules/@llblab/skills/domain-dag/recipes/validate-domain-dag.json +7 -0
  98. package/node_modules/@llblab/skills/domain-dag/scripts/validate-domain-dag.mjs +771 -0
  99. package/node_modules/@llblab/skills/domain-dag/scripts/validate-domain-dag.sh +4 -0
  100. package/node_modules/@llblab/skills/edge-tts/AGENTS.md +19 -0
  101. package/node_modules/@llblab/skills/edge-tts/SKILL.md +56 -0
  102. package/node_modules/@llblab/skills/edge-tts/recipes/say-edge.json +9 -0
  103. package/node_modules/@llblab/skills/edge-tts/scripts/say.mjs +1548 -0
  104. package/node_modules/@llblab/skills/edge-tts/scripts/say.sh +4 -0
  105. package/node_modules/@llblab/skills/extra-self/SKILL.md +229 -0
  106. package/node_modules/@llblab/skills/frontend-design/SKILL.md +78 -0
  107. package/node_modules/@llblab/skills/groq-stt/AGENTS.md +15 -0
  108. package/node_modules/@llblab/skills/groq-stt/SKILL.md +35 -0
  109. package/node_modules/@llblab/skills/groq-stt/recipes/transcribe-groq.json +10 -0
  110. package/node_modules/@llblab/skills/groq-stt/scripts/transcribe.mjs +190 -0
  111. package/node_modules/@llblab/skills/groq-stt/scripts/transcribe.sh +4 -0
  112. package/node_modules/@llblab/skills/mistral-stt/AGENTS.md +15 -0
  113. package/node_modules/@llblab/skills/mistral-stt/SKILL.md +35 -0
  114. package/node_modules/@llblab/skills/mistral-stt/recipes/transcribe-mistral.json +10 -0
  115. package/node_modules/@llblab/skills/mistral-stt/scripts/transcribe.mjs +191 -0
  116. package/node_modules/@llblab/skills/mistral-stt/scripts/transcribe.sh +4 -0
  117. package/node_modules/@llblab/skills/package.json +46 -0
  118. package/node_modules/@llblab/skills/re-review/SKILL.md +318 -0
  119. package/node_modules/@llblab/skills/release-flow/SKILL.md +456 -0
  120. package/node_modules/@llblab/skills/show-me/SKILL.md +144 -0
  121. package/package.json +20 -8
  122. package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback-client.mjs +0 -143
  123. package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback-client.mjs +0 -143
@@ -0,0 +1,456 @@
1
+ ---
2
+ name: release-flow
3
+ description: Select and run a guarded GitHub release flow for an administered repository, using a pre-PR squashed dedicated version branch, a dev-to-main pull request, or direct main as repository topology requires, then coordinating tags, GitHub Releases, and optional existing npm publication. Use only with explicit release intent and ADMIN permission; exclude contribution forks, ordinary feature integration, and non-GitHub workflows.
4
+ ---
5
+
6
+ # Release Flow
7
+
8
+ Use this skill to select and run the release path that matches an eligible GitHub repository administered by the authenticated user: a dedicated version branch squashed to one commit before its `main` PR, a guarded `dev` → `main` PR, or direct `main` when neither PR source applies. Release notes and PR text come from the canonical project changelog when one exists; otherwise they come from a verified outcome-focused narrative derived from the release diff. This skill never creates a changelog.
9
+
10
+ ## Eligibility Boundary
11
+
12
+ Establish eligibility before selecting a branch route or changing repository state.
13
+
14
+ 1. Confirm that `origin` resolves to a repository on `github.com`. Non-GitHub hosts and merge-request-based workflows are outside this skill.
15
+ 2. Confirm active GitHub CLI authentication and identify the authenticated user with `gh api user --jq .login`. Authentication, network, host, and repository-resolution failures make eligibility unknown; stop.
16
+ 3. Inspect the repository with `gh repo view --json nameWithOwner,owner,isFork,viewerPermission`.
17
+ 4. Require `viewerPermission: ADMIN`. Treat this repository-scoped permission, together with the user's explicit release request required by the hard gate, as sufficient release authority. Do not require owner-login equality, organization classification, or a second maintainership attestation. `WRITE` or `MAINTAIN` alone remains insufficient for this generic flow.
18
+ 5. Require the repository to be either not a fork, or explicitly classified as an independently maintained historical fork with its own release line rather than a contribution fork whose changes should flow through an upstream pull request.
19
+ 6. Treat `isFork` as a topology fact, not an automatic permission failure. For a fork, require explicit workflow classification in the current conversation before any release mutation; repository age, divergence, package identity, prior releases, or permission level cannot establish whether work should ship independently or flow upstream. Record that classification in the final eligibility evidence.
20
+ 7. Stop when the authenticated user lacks `ADMIN`, repository access cannot be verified, or a fork remains unclassified or serves an upstream-contribution workflow. Do not add a separate ownership or organization-maintainership confirmation gate after an explicit release request.
21
+ 8. Exclude ordinary feature, staging, and arbitrary integration branches. This skill may operate from `main`, long-lived `dev`, or a dedicated version branch whose name exactly identifies the intended version: bare SemVer (`0.7.2`), `v`-prefixed SemVer (`v0.7.2`), or `release/<semver>`. A version branch is a release source only when the current branch matches the intended manifest/changelog version; naming alone never promotes a feature branch. On a `dev` PR route, release actions run from `dev`; on a version PR route, they run from that version branch.
22
+
23
+ These boundaries do not gain an automatic override. An ineligible repository needs its own project-specific release process.
24
+
25
+ ## Route Selection
26
+
27
+ Select the route before staging, committing, pushing, opening a PR, tagging, creating a GitHub Release, publishing, or modifying release files.
28
+
29
+ 1. Confirm that the repository has an `origin` remote and read the current branch.
30
+ 2. If the current branch is a dedicated version branch matching the intended manifest/changelog version, select the **version PR route**. This route takes precedence over `dev` detection because the version branch owns the prepared release tree.
31
+ 3. Otherwise, check for a local `dev` branch with `git show-ref --verify refs/heads/dev`. If it exists, select the **dev PR route**; remote `dev` detection cannot make the route less strict.
32
+ 4. Only when neither a version route nor local `dev` applies, query `origin` directly for `refs/heads/dev`, for example with `git ls-remote --exit-code --heads origin refs/heads/dev`. Do not infer remote absence from a missing or stale `origin/dev` remote-tracking ref.
33
+ 5. For `git ls-remote --exit-code`, treat exit status `2` with no matching ref as authoritative absence. Treat exit status `0` with the ref as presence. Authentication, authorization, network, repository-resolution, and other failures make route selection unknown; stop instead of choosing direct-main.
34
+ 6. Select exactly one route:
35
+ - **Version PR route:** Current branch is a dedicated version branch for the intended release.
36
+ - **Dev PR route:** No version route applies, and local or remote `dev` exists.
37
+ - **Direct-main route:** No version route applies, local `dev` is absent, and the authoritative query confirms `origin/dev` is absent.
38
+
39
+ Once selected, keep that route for the entire run. A branch-state change, inconvenience, conflict, failed check, or failed PR action must not trigger fallback to another route.
40
+
41
+ ## Validation Evidence Identity
42
+
43
+ Release validation is evidence about a specific input state and relevant environment, not a ceremony attached to every workflow phase.
44
+
45
+ 1. Record the subject of each expensive successful validation when later topology changes are expected. Prefer the exact Git tree OID for source-bound checks, the artifact digest for artifact/network checks, and the relevant lock/toolchain identities when they affect the claim.
46
+ 2. Classify whether the validation consumes commit SHA, parent, branch, tag, signature, commit timestamp, remote state, credentials, or another condition outside the tree. Inspect the validation owner when sensitivity is unclear.
47
+ 3. Reuse successful evidence after an operation when the active release contract is unchanged and equivalence proves every relevant input and condition unchanged. Exact tree equality preserves tree-bound build, test, lint, benchmark, and generated-artifact evidence.
48
+ 4. A squash, rebase, amend, fast-forward wrapper removal, branch rename, or other topology-only operation does not by itself justify rerunning tree-bound validation. Never rerun an expensive profile solely because a validated tree received a new commit identity.
49
+ 5. Rerun only the invalidated layer when a check is commit/ref-sensitive. Require a full rerun only when the tree changed, relevant environment authority changed, external evidence expired, the prior run was incomplete or failed, or validation sensitivity remains materially unknown after inspection.
50
+ 6. Record reused evidence, its original subject, the equivalence proof, and any narrow post-operation checks in the release handoff. Evidence reuse must be auditable rather than assumed.
51
+
52
+ An explicit repository policy requiring a fresh run for a topology stage remains authoritative and must be followed even when exact equivalence preserves the validated subject. When creating or revising such policy, name the commit/ref-sensitive or freshness boundary it protects so future evidence reuse decisions remain auditable.
53
+
54
+ ## Dedicated Version Branch Pre-PR Squash
55
+
56
+ A dedicated version branch may contain many atomic development commits while work remains in progress. Those commits support review, bisecting, selective removal, and recovery during development. The release PR must nevertheless expose one release commit directly above the verified `main` baseline.
57
+
58
+ Apply this section only on the version PR route, after release files and validation are complete but before opening the PR:
59
+
60
+ 1. Require explicit confirmation that the operator authorizes rewriting the dedicated version branch with `--force-with-lease`. Release intent alone does not authorize rewriting a shared source branch.
61
+ 2. Require no existing open PR from the version branch unless the exact PR qualifies for the separately authorized blocked-PR correction path below. Never rewrite an active or healthy review merely to tidy history.
62
+ 3. Fetch `origin/main` and the version branch. Require local and remote source tips to match, except for clearly identified intentional release work. Reject conflicts, merge/rebase/cherry-pick state, dirty submodules, unrelated work, or unknown remote state.
63
+ 4. Require `origin/main` to be an ancestor of the version branch. If `main` moved in content, align the version branch through a separately reviewed rebase or merge before squashing; never hide divergence inside the release commit.
64
+ 5. Record the old source OID, remote source OID, and `origin/main` OID. Create a local safety ref named `archive/<sanitized-version-branch>-pre-squash-<short-oid>` at the old tip. Do not push the archive unless the operator explicitly requests a remote archive.
65
+ 6. Stage only intentional release files, inspect the complete staged diff, and reject any remaining unstaged or unintended untracked content. Record the exact prepared tree from the index with `git write-tree`. `HEAD^{tree}` is not a substitute because it omits staged or unstaged release changes that are not in the old commit.
66
+ 7. Soft-reset the version branch to `origin/main` without changing the prepared index, then create exactly one repository-style release commit. The resulting commit must have `origin/main` as its sole parent.
67
+ 8. Verify that `HEAD^{tree}` exactly equals the recorded prepared-tree OID and that `HEAD^` equals the recorded `origin/main` OID. Inspect the full `origin/main..HEAD` diff and require a clean worktree. Apply the Validation Evidence Identity contract: carry forward prior validation when its recorded subject is this exact tree and the check is tree-bound; run only commit/ref-sensitive checks invalidated by the new identity. Rerun the full release profile only when equivalence or sensitivity cannot be established.
68
+ 9. If the version branch already exists on `origin`, update only that source branch with `--force-with-lease=<branch>:<recorded-remote-oid>`. Never use a broad `--force`, never rewrite `main`, and never move a tag.
69
+ 10. Open the release PR only after the remote version branch resolves to the one-commit release tip. The PR must show exactly one commit and the expected release diff against `main`.
70
+
71
+ ## Blocked Version PR Correction Rewrite
72
+
73
+ An open version PR may keep its identity while its one release commit is replaced only to correct a concrete blocker discovered by that PR. This is a recovery path, not permission to rewrite healthy review history.
74
+
75
+ 1. Require explicit operator authorization to force-update the exact open PR branch after the blocker is known. Standing release intent and the original pre-PR rewrite approval are insufficient; the authorization may state a reusable preference for blocked release PRs.
76
+ 2. Verify the PR is open, belongs to the same repository, targets `main`, uses the current dedicated version branch, and is blocked by a failed, cancelled, timed-out, or configuration-invalid required check against its current head SHA. A pending healthy check, review inconvenience, desired cleanup, or unrelated scope growth does not qualify.
77
+ 3. Require that no release tag, GitHub Release, merge, deployment, publication, or downstream release consumption refers to the current PR head. Those states make replacement categorically unsafe.
78
+ 4. Inspect submitted reviews and unresolved review conversations. If human approval, requested changes, or substantive review comments exist, report that evidence and require separate confirmation that replacing the reviewed commit is intended; never silently orphan human review.
79
+ 5. Fetch `origin/main` and the version branch. Require local HEAD, the PR head, and the remote branch to equal one recorded old OID; require that commit to remain the sole child of the unchanged verified `origin/main` baseline. Stop on divergence or baseline movement instead of hiding it in the correction.
80
+ 6. Create a new local safety ref at the old PR head. Admit only the smallest release-scope correction and directly affected evidence or documentation, stage the complete intended tree, and inspect its diff against both the old PR head and `origin/main`.
81
+ 7. Recreate exactly one repository-style release commit with the same `origin/main` parent. Verify prepared-tree equality, one-parent topology, a clean worktree, and the narrow validation invalidated by the correction. Previous failed PR evidence is not reusable; unrelated tree-bound evidence may be reused only under the Validation Evidence Identity contract.
82
+ 8. Update only the exact version branch with `--force-with-lease=<branch>:<recorded-old-oid>`. Never use broad force, rewrite `main`, move a tag, or delete/recreate the PR.
83
+ 9. Verify the same PR number remains open, its head equals the new commit, it still contains exactly one release commit, and GitHub registered fresh required checks for that head. Treat review and check evidence attached to the replaced OID as stale.
84
+
85
+ After a release PR merges, history cleanup is too late. This skill must never squash or force-rewrite `main` to make a completed release look cleaner. A post-merge mistake receives a new reviewed correction/hotfix; a release tag, published Release, or downstream consumption makes history rewriting categorically forbidden.
86
+
87
+ ## PR Baseline Alignment
88
+
89
+ On the dev PR route, fetch `origin/main` and `origin/dev` before the hard gate, then distinguish commit topology from code state. The version PR route instead uses the stricter ancestry and one-parent contract in the pre-PR squash section:
90
+
91
+ 1. Require local `dev` to equal `origin/dev` unless the only difference is the intentional release commit created later in this flow. Stop on pre-existing local/remote `dev` divergence.
92
+ 2. Compare the committed trees of `dev` and `origin/main` before interpreting ahead/behind counts. Identical tree ids mean the code and version baseline already match, even when GitHub's merge commit leaves `main` one or more commits ahead of its merged `dev` parent. Keep `dev` unchanged; do not fast-forward, merge, rebase, or stash merely to copy merge-only topology back into the source branch.
93
+ 3. When the trees differ and `origin/main` is not an ancestor of `dev`, inspect the direct parents of `origin/main` before classifying divergence. If one direct parent is an ancestor of `dev` and that parent's tree equals `origin/main^{tree}`, classify `origin/main` as a content-neutral PR merge wrapper around a baseline already contained in `dev`. Keep `dev` unchanged: the source branch may correctly continue from the merged PR parent without copying GitHub's merge commit back after every release.
94
+ 4. When neither tree equality nor content-neutral merge-wrapper equivalence applies:
95
+ - If `origin/main` is an ancestor of `dev`, the release branch already contains the main baseline plus newer work.
96
+ - If `dev` is an ancestor of `origin/main`, `dev` is genuinely behind in content and must be safely aligned before release work continues.
97
+ - If both branches contain unique commits, stop and report divergence; do not infer equivalence from versions or commit counts.
98
+ 5. Tree and merge-wrapper equivalence prove baseline content equivalence, not release readiness. Version, changelog, validation, worktree intent, and all other hard gates still apply.
99
+
100
+ ## Wrong-Branch Recovery
101
+
102
+ Use this recovery only when the dev PR route was selected, the current branch is `main`, and all uncommitted changes are confirmed as intentional release work. Never use it for a version PR route or from a feature, staging, detached-HEAD, conflicted, rebasing, merging, or cherry-picking state.
103
+
104
+ Before moving changes, ask for explicit confirmation because the operation changes the worktree and may expose branch divergence. Then use the smallest reversible sequence:
105
+
106
+ 1. Reject mixed unrelated work, unresolved conflicts, dirty submodules, or untracked files that should not enter the release.
107
+ 2. Save tracked and intended untracked changes in one uniquely named stash with `--include-untracked`. Use `git stash apply`, not `pop`, so the recovery copy remains available until transfer verification completes.
108
+ 3. Fetch `origin/main` and query `origin/dev`. Require `origin/main`; stop on authentication, network, repository-resolution, or fetch failure. A missing `origin/dev` remains valid when local `dev` selected the dev PR route.
109
+ 4. Switch to local `dev`, or create it to track `origin/dev` when only the remote branch exists.
110
+ 5. When `origin/dev` exists, bring local `dev` to it only with a fast-forward. Stop if local and remote `dev` have diverged; do not discard either history.
111
+ 6. Compare the committed tree ids before ancestry:
112
+ - If `dev^{tree}` equals `origin/main^{tree}`, keep `dev` unchanged. This is the normal GitHub PR merge topology where `main` contains the merged dev commit plus a merge commit but no newer code; do not fast-forward merge-only history back into `dev`.
113
+ - Otherwise, if one direct parent of `origin/main` is an ancestor of `dev` and that parent tree equals `origin/main^{tree}`, keep `dev` unchanged. The latest main commit is a content-neutral PR merge wrapper around a baseline already contained in the continuing dev line.
114
+ - Otherwise, if `origin/main` is already an ancestor of `dev`, keep `dev` unchanged.
115
+ - Otherwise, if `dev` is an ancestor of `origin/main`, fast-forward `dev` to `origin/main` because the content genuinely differs.
116
+ - If both branches contain unique commits and neither equivalence rule applies, classify them as diverged. Do not rebase automatically.
117
+ 7. For diverged branches, report the commit ranges and ask separately before rebasing `dev` onto `origin/main`. Create a temporary backup ref first. Never force-push rewritten `dev` history as an implicit part of release approval; require separate explicit authorization and use only `--force-with-lease` if approved.
118
+ 8. Apply the saved stash with index state preserved. Stop on conflicts, leave the stash intact, and report recovery instructions rather than attempting broad conflict resolution.
119
+ 9. Verify that the transferred diff matches the saved release work and that no unrelated files appeared. Continue only when the worktree now represents the intended release on `dev`.
120
+ 10. Keep the stash until the release commit contains the verified transferred changes. Then drop only that exact recovery stash.
121
+
122
+ After successful recovery, re-enter the normal hard gate on `dev`. Recovery never permits direct-main and never counts as authorization for rebase, force-push, or conflict resolution.
123
+
124
+ ## Hard Gate
125
+
126
+ Run release actions only when all criteria are true:
127
+
128
+ 1. Repository eligibility, authenticated `ADMIN` permission, and explicit release intent were verified without ambiguity.
129
+ 2. Route selection completed without ambiguity.
130
+ 3. The current branch matches the selected route: the exact dedicated version branch for the version PR route, `dev` for the dev PR route, or `main` for the direct-main route.
131
+ 4. Baseline alignment passes for the selected PR route: the version branch satisfies the strict `origin/main` ancestry contract before its one-parent squash, or `dev` satisfies committed-tree equality, content-neutral merge-wrapper equivalence, or `origin/main` ancestry. Commit-count-only topology never proves alignment.
132
+ 5. Repository-owned tag automation has been inspected and its ownership of GitHub Release creation and npm publication is classified as automated, manual, or absent without ambiguity. Every automation-owned npm publication passes the pre-tag package-existence and version-eligibility checks below.
133
+ 6. Release intent is materialized safely for the route: dev/direct-main has intentional uncommitted release files to commit, while a version branch has a complete validated prepared tree and explicit source-history rewrite approval before the pre-PR squash.
134
+ 7. The package or application version is already bumped to the intended release version.
135
+ 8. The user explicitly asked to run the release flow, including its external actions such as pushing, opening and merging a PR when applicable, tagging, creating a GitHub Release, or publishing.
136
+
137
+ If any criterion fails, reject the flow and stop. Do not stage, commit, push, create PRs, merge, tag, create a GitHub Release, publish, or modify release files.
138
+
139
+ If the dev PR route was selected while release work sits on `main`, do not bypass the branch gate. Run the guarded wrong-branch recovery only after its explicit confirmation; otherwise stop without moving the changes. Version-branch work never uses wrong-branch recovery.
140
+
141
+ ## Direct-Main Boundary
142
+
143
+ Direct-main is a repository-shape route, not an urgency override or failure fallback. It is available only when authoritative checks confirm that both local `dev` and `origin/dev` are absent and the prepared release work is already on `main`.
144
+
145
+ A prior direct-main release, a small hotfix, urgency, PR inconvenience, branch protection failure, merge conflict, or failing checks does not permit direct-main while `dev` exists. If repository policy requires an exception despite an existing `dev`, stop and hand the request back as an out-of-scope owner decision before changing repository or release state.
146
+
147
+ Before committing on the direct-main route, fetch `origin/main` and require local `main` HEAD to equal `origin/main`. Stop on divergence, unpushed local commits, a missing `origin/main`, or a fetch failure; do not merge, rebase, reset, or pull automatically while prepared release changes are present.
148
+
149
+ The direct-main route retains every shared release safeguard: current-state audit, release-narrative freshness, validation, intentional staging, repository-style release commit, push verification, version confirmation, immutable tag checks, GitHub Release verification, and guarded registry publication.
150
+
151
+ ## Repository-Owned Release Automation
152
+
153
+ Inspect the intended tagged commit before the hard gate for active repository workflows, normally under `.github/workflows`, that trigger on version-tag pushes. Classify ownership by behavior rather than filename:
154
+
155
+ 1. Read each candidate workflow far enough to verify its trigger and release actions. A `push.tags` trigger alone does not own publication.
156
+ 2. Classify **GitHub Release automation** only when the workflow creates or publishes a release, for example through `gh release create`, a release-creation action, or an authenticated GitHub Releases API call.
157
+ 3. Classify **npm automation** separately from GitHub Release creation. Different actions may belong to different workflows. Tag-triggered publication to any registry other than npm is outside this generic skill; stop before tag creation and use a project-specific release process.
158
+ 4. Treat commented commands, docs, artifact uploads, changelog generation, and tag-only validation as non-owners. Stop before tag creation when workflow semantics remain ambiguous; do not race an uncertain automation owner.
159
+ 5. Record every owning workflow path, trigger, exact responsibilities, and expected run identity. Reinspect the committed workflow definitions before tagging; stop if they differ materially from the classified worktree versions.
160
+
161
+ Before the hard gate, preflight every automation-owned npm publication:
162
+
163
+ - Require a project-owned `package.json` with a package name and no `private: true`.
164
+ - Query `npm view <package-name> version`. Treat only an explicit npm not-found response as package absence; authentication, authorization, network, registry-resolution, and other failures are unknown states.
165
+ - Require the package to already exist and the intended version to be newer than the published version. Stop before commit or tag when either condition fails; triggering repository automation does not override the rule that this skill never publishes a new or non-newer package.
166
+ - Verify from workflow semantics that the intended tag would publish that package and version. Stop when package selection, version derivation, registry target, or publication conditions remain ambiguous.
167
+
168
+ When repository automation owns an action:
169
+
170
+ - Push the tag exactly once, then discover every expected workflow run for that exact tag, `push` event, and released commit SHA. Allow a bounded registration delay; do not interpret a briefly absent run as permission for manual fallback.
171
+ - Watch each owning run to terminal state. Do not manually perform any action classified as automation-owned while its run remains pending, succeeds, or fails.
172
+ - On success, verify each resulting GitHub Release and/or npm state using the same contracts as manual publication.
173
+ - If any owning run fails, remains uncorrelated, or omits its expected external state, stop and report the completed tag plus all run results. Never create a competing Release or publish manually as an implicit recovery; fix/rerun the repository workflow or obtain an explicit project-specific recovery decision.
174
+
175
+ When no workflow owns an action, retain the manual path below. Automation detection changes the executor, never the required final verification.
176
+
177
+ ## Release Flow
178
+
179
+ After the hard gate passes:
180
+
181
+ 1. Inspect `git status --short --branch`, confirm the selected route, and confirm that the repository is on its required branch with only route-appropriate release state.
182
+ 2. Resolve the version source under the [Version And Release Narrative Contract](#version-and-release-narrative-contract) and confirm it is already bumped to the intended release version.
183
+ 3. Detect whether the repository already owns a canonical project-level changelog, normally at the root or at a documented release-history path; a nested subsystem changelog does not become the package release source merely because it exists. If a canonical changelog exists, read only the intended version section and any `Unreleased` section, beginning with the first 50 lines and expanding to section boundaries as needed. Otherwise record its absence and use the contract's temporary-narrative path. The same contract owns when subsystem history needs an update.
184
+ 4. Inspect the actual release diff. For a version PR route, compare the complete version-branch tree with `origin/main` before and after the squash. For a dev PR route, compare `dev` with the `main` PR base and include staged/unstaged release files. For direct-main, inspect staged/unstaged changes against verified `main`. Apply the [Release Narrative Consolidation Rules](#release-narrative-consolidation-rules) to this evidence. When a canonical changelog exists, edit only its intended section without rewriting older history; otherwise create only temporary release notes.
185
+ 5. Confirm release-note freshness. When a canonical changelog exists, its intended version section must describe the release and must not leave the same shipped changes under `Unreleased`; stop if the section is missing, ambiguous, or conflicts with diff evidence. When no canonical changelog exists, its absence is not a blocker; instead verify that the temporary release narrative covers every meaningful shipped outcome. In either case, stop if safe consolidation would require guessing which behavior ships.
186
+ 6. Run the smallest meaningful validation first. Prefer the project release validation command when available. Record the validated tree or artifact identity and relevant environment authority so later topology-only operations can reuse the evidence instead of rerunning it.
187
+ 7. Stage only intentional release files and apply the [Release Commit Message Contract](#release-commit-message-contract) before any release commit is written.
188
+ 8. On a version PR route, complete all release files first and then execute the dedicated pre-PR squash section; do not create a preliminary PR or a second release commit.
189
+ 9. Create exactly one release commit. On a version PR route, use the one-parent commit already produced by the pre-PR squash; on dev/direct-main, create the normal release commit.
190
+ 10. Continue only through the selected route:
191
+
192
+ **Version PR route**
193
+
194
+ 1. Verify the remote version branch exposes the prepared one-commit release tip above `origin/main`; the pre-PR squash was completed in step 8.
195
+ 2. Open a pull request from the version branch to `main`. Build the PR body from the verified release narrative and watch all checks.
196
+ 3. Merge with a repository-supported method that leaves exactly one release commit directly above the verified baseline on `main`. Prefer fast-forward/rebase when it preserves the prepared commit; otherwise use squash merge, which may replace its OID but must preserve the exact prepared tree. Do not create a merge-wrapper commit for a dedicated version release.
197
+ 4. After merge, switch to `main`, pull the latest state, and verify parent OID, tree OID, version, and release narrative before tagging. If repository policy cannot produce the one-commit topology, stop before merge rather than rewriting `main` afterward.
198
+
199
+ **Dev PR route**
200
+
201
+ 1. Push `dev` to `origin/dev`.
202
+ 2. Open a pull request from `dev` to `main`.
203
+ 3. Build the PR body from the verified release narrative, using the consolidated canonical changelog section when one exists and the diff-derived temporary narrative otherwise.
204
+ 4. Watch PR checks until they finish.
205
+ 5. If all required checks pass, merge using the repository's established method. Prefer the repository default; if no convention is discoverable, use a normal merge commit rather than squash/rebase because it preserves the dev release commit and audit trail.
206
+ 6. After merge, switch to `main` and pull the latest state.
207
+
208
+ **Direct-main route**
209
+
210
+ 1. Reconfirm immediately before push that local `dev` and `origin/dev` remain absent. Stop if either now exists or the remote check fails.
211
+ 2. Push the release commit from local `main` to `origin/main` without creating a pull request.
212
+ 3. Verify that `origin/main` resolves to the pushed local `main` commit.
213
+
214
+ 4. Confirm the version on `main` matches the intended release version and that the current `main` commit is the released commit on `origin/main`.
215
+ 5. Create and push exactly one release tag for the confirmed version on the current `main` commit:
216
+
217
+ ```bash
218
+ git tag v<version>
219
+ git push origin v<version>
220
+ ```
221
+
222
+ If the tag already exists locally or remotely, verify it points to the current `main` commit before continuing. If an existing `v<version>` tag points anywhere else, stop and report the mismatch unless it qualifies for the explicitly authorized failed-unpublished-tag replacement path below. Never move, delete, or force-push a tag that represents any published or consumed release state.
223
+
224
+ If repository automation owns GitHub Release creation or npm publication, discover and watch every expected tag-triggered run now. Correlate each run to its recorded workflow, the exact tag, the `push` event, and the released commit SHA. Continue only after all owning runs succeed and create every expected external state. A failed or missing run is a release stop even when some external state exists; verify and report that partial state without racing it.
225
+
226
+ 13. Ensure exactly one published GitHub Release exists for the confirmed tag. First determine whether the intended version is stable or a prerelease from the version and verified release narrative, then check whether a release already exists:
227
+
228
+ ```bash
229
+ gh release view v<version> --json tagName,isDraft,isPrerelease,publishedAt,url
230
+ ```
231
+
232
+ Treat the release as absent only when GitHub explicitly reports that `v<version>` has no release, such as an HTTP 404 or `release not found`. Authentication, authorization, network, rate-limit, repository-resolution, and other CLI/API failures are not absence; stop and report them instead of attempting creation.
233
+
234
+ If automation owns GitHub Release creation and no release exists after its successful run, stop because automation violated its contract. Do not create the release manually.
235
+
236
+ Only when no repository workflow owns GitHub Release creation, create an absent release manually with the existing tag, a release title derived from the canonical changelog heading when available or `<version>: <concise release theme>` otherwise, and notes derived from the verified release narrative.
237
+
238
+ For a normal stable release:
239
+
240
+ ```bash
241
+ gh release create v<version> --verify-tag --latest --title "<release title>" --notes-file <release-notes-file>
242
+ ```
243
+
244
+ For an explicit prerelease:
245
+
246
+ ```bash
247
+ gh release create v<version> --verify-tag --prerelease --latest=false --title "<release title>" --notes-file <release-notes-file>
248
+ ```
249
+
250
+ If a release already exists, verify that `tagName` equals `v<version>`, `isDraft` is false, `publishedAt` is present, and `isPrerelease` matches the intended stable/prerelease state. Reuse it instead of creating a duplicate. If any field conflicts, stop and report the mismatch; do not silently edit, delete, or replace it.
251
+
252
+ After creation or reuse, verify latest state. For a stable release, the latest-release endpoint must resolve to the intended tag:
253
+
254
+ ```bash
255
+ gh api repos/{owner}/{repo}/releases/latest --jq .tag_name
256
+ ```
257
+
258
+ For a prerelease, confirm that the endpoint does not resolve to the prerelease tag. A missing latest stable release is acceptable for a prerelease-only repository.
259
+
260
+ 14. Determine whether npm publication applies. Require a project-owned `package.json` with a package name and no `private: true`. If the project is not a publishable npm package, skip npm checks and publication unless a tag workflow claims npm ownership; that conflict must already have stopped the flow during automation preflight. Do not guess or trigger another registry workflow.
261
+
262
+ For an applicable npm package without automation-owned npm publication, check whether that package already exists:
263
+
264
+ ```bash
265
+ npm view <package-name> version
266
+ ```
267
+
268
+ Treat an explicit npm not-found response as package absence. Authentication, authorization, network, registry-resolution, and other lookup failures are not absence; stop and report them. Automation-owned npm publication already performed this lookup before the hard gate and must not defer it until after tagging.
269
+
270
+ 15. Publish only when both conditions are true:
271
+
272
+ - The package already exists on npm.
273
+ - The `main` version matches the intended release version and is newer than the npm version established before publication.
274
+
275
+ When repository automation owns npm publication, never run `npm publish` manually. After all owning tag workflows succeed, require `npm view <package-name>@<version> version` to resolve to the intended version; stop if the package remains absent or mismatched.
276
+
277
+ When repository automation does not own npm publication and both conditions are true, run:
278
+
279
+ ```bash
280
+ npm publish --access public
281
+ ```
282
+
283
+ If the package does not exist or the intended version is not newer, skip publication and report the reason. New packages must never be published by this skill.
284
+
285
+ ## Failed Unpublished Tag Replacement
286
+
287
+ A tag whose workflow failed before producing any release state may be replaced at the same version only as an explicitly authorized recovery. A pushed tag is not automatically a published release, but uncertainty or partial publication fails closed.
288
+
289
+ 1. Require explicit operator authorization to delete and recreate the exact tag at the corrected commit. Ordinary release intent and generic retry permission are insufficient.
290
+ 2. Verify the repository and tag are administered by the authenticated `ADMIN`, the tag points to one recorded old commit, and the correlated tag workflow failed before publication. Completed validation jobs may have produced only an internal candidate handoff when its exact inventory is known and no downstream network, package, attestation, deployment, or publication job consumed it successfully. Require zero network summaries, final release bundles, attestations, deployments, packages, GitHub Releases, release assets, signatures advertised as final, or other publication state for that tag and commit.
291
+ 3. Inspect every workflow job and artifact plus repository releases, attestations, deployments, package registries owned by the workflow, and known downstream automation. Treat internal validation evidence as failed-run residue, never reusable release evidence for the replacement. Any other positive state or materially unavailable check makes replacement ineligible.
292
+ 4. Fix the root cause through the repository's normal protected-main route. Require fresh required checks, a verified corrected `main` commit and tree, unchanged intended version, and no release tag pointing at the corrected commit yet.
293
+ 5. Create a local safety ref at the old tagged commit and record the old tag object/peeled commit, failed workflow/run identity, corrected commit, and corrected tree. Do not publish the safety ref unless explicitly requested.
294
+ 6. Delete only the exact remote tag with an explicit lease bound to its recorded old object, then verify remote absence. Delete the matching local tag only after confirming its old target; never use wildcard deletion or broad force.
295
+ 7. Recreate the same tag once at the verified corrected `origin/main`, push it normally, and verify the remote tag resolves to that exact commit. Do not reuse, rerun, or reinterpret the failed workflow as evidence for the replacement.
296
+ 8. Discover and watch a fresh tag-triggered workflow correlated to the corrected commit. Continue through ordinary artifact, attestation, GitHub Release, and publication verification only after that new run succeeds.
297
+
298
+ This recovery never applies after a network or packaging job produced an artifact, after any attestation, GitHub Release, deployment, or registry publication exists, after signing was advertised as final, or when downstream consumption is known or materially uncertain. An internal candidate handoff from an otherwise successful validation job is eligible only when every downstream release job failed or remained skipped before consuming it successfully.
299
+
300
+ ## Version And Release Narrative Contract
301
+
302
+ The version source is project-local. For npm packages use `package.json` and lockfiles when present. For Python, Rust, mobile, or custom apps, use the manifest or release metadata that the repository treats as authoritative. If multiple version files exist, they must agree before release actions continue.
303
+
304
+ A canonical project changelog is optional. When one already exists, its intended version section is the persistent release-narrative source and must contain the shipped changes; `Unreleased` may remain empty but must not duplicate them. When no canonical project changelog exists, do not create one and do not treat absence as a release failure. Build a temporary release narrative from verified repository evidence instead.
305
+
306
+ Nested changelogs retain subsystem ownership. Do not add entries merely because package-wide versions move synchronously; update a nested changelog only for meaningful shipped behavior in that subsystem and only when local convention uses that history surface.
307
+
308
+ Treat an existing intended version section or temporary release narrative as a pre-release working set. Consolidate it into the smallest truthful set of outcome-focused entries before commit, PR, tag, and GitHub Release generation. Preserve distinct shipped domains and safety guarantees; remove chronology and superseded intermediate state. Consolidation means semantic compression, not vague summarization.
309
+
310
+ ## Release Narrative Consolidation Rules
311
+
312
+ The release narrative records the final shipped state, not the path taken to reach it. Changelogs when present, backlogs, plans, review notes, test logs, diffs, and intermediate notes are evidence inputs rather than text to preserve verbatim.
313
+
314
+ Before creating the release commit:
315
+
316
+ 1. Compare the narrative with the actual release diff and behavior established by tests, contracts, and user-facing documentation. Repository reality wins over narrative chronology.
317
+ 2. Group related entries by final user, operator, compatibility, safety, or developer outcome. Prefer one strong entry per distinct shipped outcome over one entry per commit, file, correction, or work session.
318
+ 3. State what changed and why it matters in the released version. Keep concrete behavior, affected users, migrations, compatibility boundaries, security properties, operational consequences, and known limitations when relevant.
319
+ 4. Collapse implementation iterations into their final result. Remove investigation trails, attempted approaches, fixed-then-reworked mechanics, temporary regressions, repeated validation runs, review-response chronology, and superseded design details.
320
+ 5. Omit file-by-file inventories, test counts, command transcripts, version-bump bookkeeping, and internal refactors unless they explain a meaningful public contract, compatibility effect, operational risk, or maintainability boundary relevant to consumers.
321
+ 6. Do not copy completed backlog items or mini-essays. Reconcile backlog state according to repository convention, but write the release narrative independently from verified shipped outcomes.
322
+ 7. Keep each entry concise enough to scan and complete enough to stand alone. Do not compress distinct risks or behavior domains into vague claims such as “improved stability” or “various fixes.”
323
+ 8. Read the result as if no implementation diary existed. If it cannot explain the release truthfully on its own, refine it before continuing.
324
+
325
+ The consolidated canonical section, when present, or temporary diff-derived narrative otherwise becomes the sole source for the PR body and GitHub Release notes. If repository evidence cannot establish the final shipped behavior without guessing, stop and ask instead of manufacturing a clean story.
326
+
327
+ ## GitHub Release Contract
328
+
329
+ The GitHub Release and Git tag are one release unit. A successful tag push is not a completed release until a matching published GitHub Release exists. Exactly one executor owns creation: a verified tag-triggered repository workflow when present, otherwise the manual release-flow path.
330
+
331
+ - Derive the title from the canonical changelog heading when available by removing the Markdown prefix, for example `## 0.4.0: Bounded Worker Meta-Protocol` becomes `0.4.0: Bounded Worker Meta-Protocol`. Without a canonical changelog, use `<version>: <concise release theme>` from the verified release narrative.
332
+ - Derive notes from the verified release narrative. Compress when needed, but cover every meaningful release group and never include unrelated older history.
333
+ - Use the already-pushed `v<version>` tag; never create a second tag through release creation.
334
+ - Mark a normal stable release as latest with `--latest`. Mark an explicit prerelease with `--prerelease --latest=false`; never promote a prerelease to latest.
335
+ - Verify the resulting release URL, tag, published state, prerelease state, and latest state before continuing to registry publication.
336
+
337
+ ## Release Commit Message Contract
338
+
339
+ The release commit subject is a repository-local convention, not a universal template.
340
+
341
+ Before committing, inspect recent history with `git log -5 --pretty=%s` (or fewer commits if the repository has fewer). Infer the broad subject style from nearby commits, especially prior release/version commits when present. Preserve observable conventions such as version prefixing, separators, casing, imperative vs noun-phrase wording, and whether a secondary theme is included.
342
+
343
+ Examples of adaptation, not mandatory formats:
344
+
345
+ - Recent: `0.8.1: outbound voice translation hotfix, queue safety` -> next release may use `<version>: <theme>, <secondary theme>`.
346
+ - Recent: `release: 0.8.1` -> next release may use `release: <version>`.
347
+ - Recent: `v0.8.1` -> next release may use `v<version>`.
348
+
349
+ If no stable pattern can be inferred, use the latest relevant commit subject as the fallback style template and adapt only the version/theme content. Do not stop solely because the style is mixed; stop only when the commit subject would be misleading or the release version/theme cannot be identified safely.
350
+
351
+ ## PR Body Contract
352
+
353
+ This contract applies only to the PR route. The direct-main route skips PR creation but uses the same verified release narrative for GitHub Release notes.
354
+
355
+ The PR body must include at minimum:
356
+
357
+ ```md
358
+ ## Summary
359
+
360
+ This release <primary outcome from the verified release narrative>.
361
+
362
+ It also <secondary behavior/safety/compatibility outcome from the verified release narrative>.
363
+
364
+ ## Validation
365
+
366
+ - <Validation command> — <result>
367
+ ```
368
+
369
+ Prefer this fuller shape when the release narrative has enough substance:
370
+
371
+ ```md
372
+ ## Summary
373
+
374
+ This release <primary outcome from the verified release narrative>.
375
+
376
+ It also <secondary behavior/safety/compatibility outcome from the verified release narrative>.
377
+
378
+ ## Why
379
+
380
+ <One short paragraph explaining the user/operator problem solved. Omit only when obvious. For hotfixes, include this section.>
381
+
382
+ ## User-visible behavior
383
+
384
+ - <User-facing change>
385
+ - <Operational or safety behavior>
386
+ - <Compatibility or UI behavior>
387
+
388
+ ## Changed areas
389
+
390
+ - `<domain/file>`: <review-relevant implementation summary>
391
+ - Docs/package metadata: <docs/version summary>
392
+
393
+ ## Risk Notes
394
+
395
+ - <Runtime, queue, rendering, lock, config, migration, external-service risk and mitigation, or `No migration/config changes required.`>
396
+
397
+ ## Validation
398
+
399
+ - <Validation command> — <result>
400
+ ```
401
+
402
+ ## PR Writing Rules
403
+
404
+ - Start `## Summary` with 1-2 short release paragraphs, not only bullets.
405
+ - First paragraph starts with `This release` or `This hotfix` and names the primary user-visible behavior.
406
+ - Second paragraph, when useful, explains the main safety, compatibility, or architecture impact.
407
+ - Add `## Why` when the release fixes a bug, race, stale state, missing context, or confusing behavior. Hotfixes must include it.
408
+ - Add `## User-visible behavior` or `## Behavior` for operator-facing behavior changes.
409
+ - Add `## Highlights` for broad feature releases where bullet scanning is better than a long changed-area list.
410
+ - Add `## Changed areas` only when implementation boundaries help reviewers understand risk. Group by domain, not every file.
411
+ - Add `## Risk Notes` for runtime, queue, rendering, locks, delivery, migrations, config, or external-service behavior.
412
+ - Cover every meaningful release-narrative group in compressed form.
413
+ - Keep wording release-focused and user-facing where possible.
414
+ - Mention implementation-only items only when they explain behavior, compatibility, or risk reduction.
415
+ - Do not paste a full changelog or raw diff.
416
+ - Avoid vague filler bullets such as “improves safety”, “updates tests”, or “bumps version” unless they name concrete behavior, risk reduction, or package version.
417
+ - Prefer exact operator verbs: “clears”, “preserves”, “blocks”, “forwards”, “retries”, “falls back”, “renders”, “strips”, “uploads”.
418
+
419
+ ## Stop Conditions
420
+
421
+ Stop further release actions and report the state already completed when:
422
+
423
+ - GitHub hosting, authenticated `ADMIN` permission, explicit release intent, required independent-fork classification, or repository release-automation ownership cannot be verified.
424
+ - The repository is ineligible because `ADMIN` is absent, it is an unclassified or contribution fork, it uses a non-GitHub host, or it requires an integration workflow outside `dev` and `main`.
425
+ - Route selection is ambiguous, the authoritative remote query fails, or the branch state no longer matches the selected route.
426
+ - Run criteria fail.
427
+ - Wrong-branch recovery encounters mixed work, unsafe repository state, transfer mismatch, conflicts, or branch divergence without the required separate approval.
428
+ - On the direct-main route, local `main` does not initially equal `origin/main` or either `dev` branch appears before push.
429
+ - The version source cannot be identified safely or multiple version files disagree.
430
+ - A canonical project changelog exists but its intended version section is missing, ambiguous, conflicts with release evidence, or remains duplicated under `Unreleased`.
431
+ - Version-branch pre-PR squash lacks explicit rewrite approval, finds an open PR that does not qualify for the blocked-PR correction path, loses tree equality, cannot prove `origin/main` ancestry, or fails its exact `--force-with-lease` update.
432
+ - Validation fails and cannot be fixed safely inside the release scope.
433
+ - PR checks fail on either PR route and no explicitly authorized bounded correction path applies.
434
+ - The released `main` version or commit does not match the intended local and `origin/main` state.
435
+ - The release tag exists on a different commit and does not qualify for the explicitly authorized failed-unpublished-tag replacement path.
436
+ - Repository-owned tag automation fails, creates incomplete or conflicting external state, or cannot be correlated to the exact tag and released commit, unless the run produced zero release state and the failed-unpublished-tag replacement path is explicitly authorized.
437
+ - GitHub Release creation or verification fails, or an existing release conflicts with the confirmed tag/version state.
438
+ - An applicable npm registry check or publication fails for reasons other than package absence or a non-newer version.
439
+
440
+ ## Final Report
441
+
442
+ Report:
443
+
444
+ - Commit hash
445
+ - Eligibility evidence: GitHub repository, authenticated account, `ADMIN` permission, explicit release request, fork topology, and—when applicable—the independent-fork workflow classification
446
+ - Selected route and branch-detection evidence
447
+ - Release-narrative source: canonical changelog section or temporary diff-derived notes, including changelog-absence confirmation when applicable
448
+ - Version-route squash evidence when applicable: baseline/source old/new OIDs, local archive ref, index-derived prepared-tree OID, final tree equality, one-parent topology, exact force-with-lease result, post-merge main topology, and reused-validation subject/equivalence evidence
449
+ - Wrong-branch transfer, branch-alignment, stash cleanup, and any approved rebase/force-with-lease result when recovery ran
450
+ - PR URL, checks result, and merge status for either PR route; `Not applicable — direct-main route` otherwise
451
+ - `main` version confirmation
452
+ - Release tag push/result
453
+ - Repository release-automation classification and, for every owner, the workflow/run URL, responsibility, correlation evidence, and terminal result
454
+ - GitHub Release URL and published/prerelease/latest state
455
+ - npm applicability and package existence/version check
456
+ - Publish result or publish skip reason
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: show-me
3
+ description: Explain the current topic or work through contextual Markdown replies, concise diagrams, code-shape sketches, and focused HTML artifacts.
4
+ ---
5
+
6
+ Help the user understand the current topic: completed work, a proposed change, system structure, or an idea. Skip the preamble and keep prose brief. Pick the smallest view that makes the key point clear.
7
+
8
+ ### Output Selection
9
+
10
+ - Infer the subject from the conversation and honor an explicitly requested format. With plain `show me`, choose the form that best explains the subject.
11
+ - Markdown in the reply is a complete output format for both chat and terminal surfaces. Use headings, emphasis, lists, and focused code blocks to explain outcomes, comparisons, and reasoning; add a diagram when relationships need one.
12
+ - `Show me markdown` requests a rendered Markdown reply. Create a Markdown file when the user asks for a saved document or file artifact.
13
+ - `Show me html` requests a focused HTML file. Save file artifacts in the project or filesystem as appropriate and deliver them through the active environment's file-delivery mechanism; open locally when that is the requested surface.
14
+
15
+ ### Visual Forms
16
+
17
+ - Show logic or an algorithm as pseudocode:
18
+
19
+ ```text
20
+ on(save)
21
+ if content is unchanged
22
+ return cached result
23
+ write new content
24
+ return fresh result
25
+ ```
26
+
27
+ - Show runtime control flow as a call tree:
28
+
29
+ ```text
30
+ submitForm
31
+ createSession
32
+ persistPrompt
33
+ launchAgent
34
+ navigateToSession
35
+ ```
36
+
37
+ - Show UI structure as a component tree, including state and module boundaries that matter:
38
+
39
+ ```tsx
40
+ <SessionPage> (apps/example/src/routes/session.tsx)
41
+ useSessionEvents()
42
+ <SessionToolbar>
43
+ <RunSkillButton> (packages/ui)
44
+ ```
45
+
46
+ - Show file responsibility or a broad refactor as a shallow file tree:
47
+
48
+ ```text
49
+ src/
50
+ ├─ commands/
51
+ │ └─ parses user actions
52
+ ├─ sessions/
53
+ │ └─ owns session state
54
+ └─ transport/
55
+ └─ sends API requests
56
+ ```
57
+
58
+ - Show component interaction, control flow, or data flow with Mermaid:
59
+
60
+ ```mermaid
61
+ sequenceDiagram
62
+ participant User
63
+ participant UI
64
+ participant Daemon
65
+ User->>UI: choose command
66
+ UI->>Daemon: send expanded prompt
67
+ Daemon-->>UI: stream result
68
+ ```
69
+
70
+ - Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.
71
+
72
+ For a component change:
73
+
74
+ ```diff
75
+ <SessionPage>
76
+ useSessionEvents()
77
+ <SessionToolbar>
78
+ + <RunSkillButton />
79
+ <SessionTimeline>
80
+ + <SkillResultCard />
81
+ ```
82
+
83
+ For a file-layout change:
84
+
85
+ ```diff
86
+ src/
87
+ ├─ commands/
88
+ +│ └─ show-me.ts
89
+ +│ └─ expands the slash command
90
+ ├─ sessions/
91
+ -└─ transport.ts
92
+ +└─ transport/
93
+ + ├─ client.ts
94
+ + └─ stream.ts
95
+ ```
96
+
97
+ For a call-tree or call-stack change:
98
+
99
+ ```diff
100
+ submitForm
101
+ createSession
102
+ persistPrompt
103
+ + expandSkillMention
104
+ launchAgent
105
+ - navigateToSession
106
+ + navigateToSession
107
+ + subscribeToEvents
108
+ ```
109
+
110
+ For a state or control-flow change:
111
+
112
+ ```diff
113
+ on(save)
114
+ - write content
115
+ + if content is unchanged
116
+ + return cached result
117
+ + write new content
118
+ + invalidate cache
119
+ ```
120
+
121
+ - Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:
122
+
123
+ ```ts
124
+ function expandSkill(command: string): string {
125
+ const skillName = command.slice(1)
126
+ return `use the ${skillName} skill`
127
+ }
128
+ ```
129
+
130
+ - For a visual UI, layout, state comparison, or concept too dense for Mermaid, use a focused HTML artifact — a diagram, an infographic, or a short slide deck, whichever fits the point. Match the product's colors, type, spacing, and components; use real labels and data; support desktop and mobile.
131
+
132
+ ### Text Rendering
133
+
134
+ - Adapt the view to the available width in both terminal and chat surfaces. Use shallow trees with `├─`, `└─`, and `│`, a space before labels, and a three-column nesting step for file hierarchy; use indentation for call trees and pseudocode.
135
+ - Keep labels concise and in the user's language. Express status with words; use text glyphs with predictable monospace width for aligned diagram structure.
136
+ - For changes, use a compact fenced `diff` block in Telegram or the terminal. Show the changed lines and only the surrounding context needed to understand them.
137
+ - In trees, place comments and explanations as child nodes one level below the item they describe. Keep the item's own line for its label.
138
+ - Use prose lists for independent statuses and split larger views into meaningful sections.
139
+
140
+ ### guidance
141
+
142
+ Place each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.
143
+
144
+ You may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.