@yandy-r/ycc-opencode 6.4.0 → 6.5.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.
- package/README.md +2 -2
- package/package.json +1 -1
- package/shared/references/branching-model.md +2 -1
- package/shared/references/worktree-strategy.md +4 -12
- package/shared/scripts/lib/ci-classify.sh +2 -2
- package/shared/scripts/release-feature-sets.sh +18 -0
- package/shared/scripts/release_feature_sets.py +232 -0
- package/shared/scripts/setup-worktree.sh +2 -69
- package/skills/bundle-author/references/surface-map.md +1 -1
- package/skills/bundle-author/references/when-not-to-scaffold.md +1 -1
- package/skills/bundle-release/SKILL.md +22 -5
- package/skills/bundle-release/references/release-checklist.md +9 -1
- package/skills/bundle-release/references/version-policy.md +11 -4
- package/skills/formatters/SKILL.md +2 -1
- package/skills/formatters/references/flag-reference.md +8 -4
- package/skills/formatters/references/templates/lint-autofix.yml.tmpl +184 -18
- package/skills/formatters/references/templates/readme-section.md.tmpl +1 -1
- package/skills/formatters/scripts/bundle/style.sh +2 -2
- package/skills/git-cleanup/SKILL.md +4 -5
- package/skills/init/references/conventional-commits.md +8 -1
- package/skills/init/references/template-library.md +1 -1
- package/skills/init/templates/git/gitmessage.tmpl +2 -1
- package/skills/release-model/templates/RELEASING.md.tmpl +2 -1
- package/skills/releaser/SKILL.md +5 -1
- package/skills/releaser/references/release-preparation.md +34 -15
- package/shared/scripts/merge-children.sh +0 -82
- package/skills/write-docs/templates/docs-readme.md +0 -34
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @yandy-r/ycc-opencode
|
|
2
2
|
|
|
3
|
-
OpenCode V2 plugin carrying the ycc bundle (version 6.
|
|
3
|
+
OpenCode V2 plugin carrying the ycc bundle (version 6.5.0). It is how ycc installs
|
|
4
4
|
into [OpenCode](https://opencode.ai): `install.sh install --target opencode` writes the `plugins` entry
|
|
5
5
|
below into `~/.config/opencode/opencode.json` for you.
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ Requires OpenCode `>=2.0.30` (V2 plugin API; V1 hook plugins are not supported).
|
|
|
15
15
|
`opencode.json`, pinned to an exact release:
|
|
16
16
|
|
|
17
17
|
```json
|
|
18
|
-
{ "plugins": ["@yandy-r/ycc-opencode@6.
|
|
18
|
+
{ "plugins": ["@yandy-r/ycc-opencode@6.5.0"] }
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Pin the version instead of using the bare name. Right after a release, the registry can briefly serve
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yandy-r/ycc-opencode",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "OpenCode V2 plugin registering the ycc bundle (skills, agents, ycc:<skill> commands, MCP servers, the sensitive-file guard and session instructions) through its setup hook. install.sh --target opencode installs it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -29,7 +29,8 @@ These apply to both models.
|
|
|
29
29
|
scenes and flip it in one final PR shortly before the release.
|
|
30
30
|
5. **A release is a tag on a branch.** Never assemble a release by picking commits after
|
|
31
31
|
the fact.
|
|
32
|
-
6. **
|
|
32
|
+
6. **One approval per release.** Once a maintainer approves the release ("ship x.y.z to
|
|
33
|
+
prod?"), agents may tag, publish and cut it.
|
|
33
34
|
|
|
34
35
|
## Models
|
|
35
36
|
|
|
@@ -24,12 +24,7 @@ plan annotation format, per-target dispatch matrix, and cleanup. There is
|
|
|
24
24
|
per parallel task, and not per-severity fan-out. Individual skills own flag
|
|
25
25
|
plumbing and per-phase behavior; the shared **invariant** lives here.
|
|
26
26
|
|
|
27
|
-
**Migration note (GitHub #79 / #80):**
|
|
28
|
-
describe a parent/child model, `**Children**` lists, per-task `**Worktree**:`,
|
|
29
|
-
or `merge-children.sh` fan-in. That model is **deprecated** for the shared
|
|
30
|
-
contract. `setup-worktree.sh child` and `merge-children.sh` are **compatibility
|
|
31
|
-
shims** (see shared scripts) until all executors are updated. New planners and
|
|
32
|
-
executors should follow **only** the single-worktree contract below.
|
|
27
|
+
**Migration note (GitHub #79 / #80):** the parent/child worktree model and its fan-in merge were removed; follow only the single-worktree contract below.
|
|
33
28
|
|
|
34
29
|
and how a single worktree pairs with parallel sub-agent dispatch.
|
|
35
30
|
|
|
@@ -232,8 +227,7 @@ Older plans may still include:
|
|
|
232
227
|
- A per-task line: `- **Worktree**: <path> ...` inside a task block
|
|
233
228
|
|
|
234
229
|
Parsers that support legacy plans may read these for migration or display, but
|
|
235
|
-
the shared **default** is: **one** worktree, no fan-in merge
|
|
236
|
-
`setup-worktree.sh child` in the new workflow path.
|
|
230
|
+
the shared **default** is: **one** worktree, no fan-in merge.
|
|
237
231
|
|
|
238
232
|
### Review / PR review artifacts
|
|
239
233
|
|
|
@@ -255,10 +249,8 @@ need not emit per-task `**Worktree**:` lines for new work.
|
|
|
255
249
|
1. **Once:** `setup-worktree.sh parent <repo> <feature-slug>` (optional `--base-ref` for existing branches).
|
|
256
250
|
2. **Per batch / task:** run work in the feature worktree; dispatch parallel agents
|
|
257
251
|
with `Working directory: <feature-worktree-path>` (or equivalent target-specific isolation) — **all share the same path**.
|
|
258
|
-
3. **
|
|
259
|
-
|
|
260
|
-
4. **Validate** between batches as the skill requires.
|
|
261
|
-
5. On **merge conflicts** or validation failure, handle in the feature worktree
|
|
252
|
+
3. **Validate** between batches as the skill requires.
|
|
253
|
+
4. On **merge conflicts** or validation failure, handle in the feature worktree
|
|
262
254
|
per skill policy (pause, user resolve, etc.).
|
|
263
255
|
|
|
264
256
|
---
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
# ci-classify.sh — Shared failure classification and signature helpers.
|
|
3
3
|
#
|
|
4
4
|
# Sourced by:
|
|
5
|
-
# -
|
|
6
|
-
# -
|
|
5
|
+
# - .opencode-plugin/shared/scripts/ci-monitor.sh (PR-mode monitor)
|
|
6
|
+
# - .opencode-plugin/shared/scripts/release-ci-monitor.sh (release-mode monitor)
|
|
7
7
|
#
|
|
8
8
|
# Contract:
|
|
9
9
|
# See _shared/references/ci-monitoring.md ("Failure classification" section)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# release-feature-sets.sh — group feat commits since the last tag into feature
|
|
3
|
+
# sets and compute the minimum semver bump. A feat commit alone does not force a
|
|
4
|
+
# minor: only feature sets the maintainer names complete (--complete) do.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# release-feature-sets.sh [--repo DIR] [--from REF] [--to REF]
|
|
8
|
+
# [--complete SET[,SET...]|all] [--format json|text]
|
|
9
|
+
#
|
|
10
|
+
# Feature set = `Feature-Set:` trailer, else the commit scope, else `unscoped`.
|
|
11
|
+
# Required bump: major (breaking) > minor (a set is complete) > patch > none.
|
|
12
|
+
# Requires python3 3.11+. Exit codes: 0 ok, 1 usage error, git error or unknown set.
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
15
|
+
# shellcheck source=require-python.sh
|
|
16
|
+
. "${SCRIPT_DIR}/require-python.sh"
|
|
17
|
+
export PYTHONDONTWRITEBYTECODE=1
|
|
18
|
+
exec python3 "${SCRIPT_DIR}/release_feature_sets.py" "$@"
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Group release commits into feature sets and compute the required semver bump.
|
|
3
|
+
|
|
4
|
+
A single ``feat:`` commit does not force a minor release. ``feat`` commits are
|
|
5
|
+
grouped into feature sets: the ``Feature-Set:`` trailer when present, otherwise
|
|
6
|
+
the Conventional Commits scope (``feat(worktree): ...`` -> ``worktree``),
|
|
7
|
+
otherwise ``unscoped``. A commit of any other type joins a set only through a
|
|
8
|
+
``Feature-Set:`` trailer. The maintainer names the sets that are complete and
|
|
9
|
+
user-visible with ``--complete``; only those require a minor.
|
|
10
|
+
|
|
11
|
+
A set whose ``feat`` commits shipped in an earlier (patch) release can still be
|
|
12
|
+
completed: name it with ``--complete`` and the helper finds it in the history
|
|
13
|
+
before the range (or add a ``Feature-Set:`` trailer to the finishing commit).
|
|
14
|
+
|
|
15
|
+
Required bump, first match wins:
|
|
16
|
+
|
|
17
|
+
- ``major``: any breaking change (``type!:``, ``type(scope)!:``, or a
|
|
18
|
+
``BREAKING CHANGE:`` / ``BREAKING-CHANGE:`` footer, merge commits included).
|
|
19
|
+
- ``minor``: at least one feature set is named complete.
|
|
20
|
+
- ``patch``: any other non-merge commit in the range.
|
|
21
|
+
- ``none``: the range has no non-merge commits.
|
|
22
|
+
|
|
23
|
+
The bump is a floor computed from commit markers only. Release policies may
|
|
24
|
+
require more (for example a renamed or removed public surface); apply those too.
|
|
25
|
+
Standard library only; the file is copied verbatim into every runtime bundle.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
30
|
+
import argparse
|
|
31
|
+
import json
|
|
32
|
+
import re
|
|
33
|
+
import subprocess
|
|
34
|
+
import sys
|
|
35
|
+
from dataclasses import dataclass, field
|
|
36
|
+
from typing import Any
|
|
37
|
+
|
|
38
|
+
HEADER_RE = re.compile(r"^(?P<type>[A-Za-z]+)(?:\((?P<scope>[^)]*)\))?(?P<bang>!)?:\s*(?P<desc>.+)$")
|
|
39
|
+
BREAKING_RE = re.compile(r"^BREAKING[ -]CHANGE:", re.MULTILINE)
|
|
40
|
+
TRAILER_RE = re.compile(r"^Feature-Set:\s*(?P<name>\S.*?)\s*$", re.MULTILINE | re.IGNORECASE)
|
|
41
|
+
UNSCOPED = "unscoped"
|
|
42
|
+
FIELD_SEP = "\x1f"
|
|
43
|
+
RECORD_SEP = "\x1e"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass
|
|
47
|
+
class Commit:
|
|
48
|
+
sha: str
|
|
49
|
+
subject: str
|
|
50
|
+
kind: str
|
|
51
|
+
breaking: bool
|
|
52
|
+
feature_set: str | None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class Report:
|
|
57
|
+
from_ref: str | None
|
|
58
|
+
to_ref: str
|
|
59
|
+
commits: list[Commit] = field(default_factory=list)
|
|
60
|
+
complete: list[str] = field(default_factory=list)
|
|
61
|
+
earlier: list[str] = field(default_factory=list)
|
|
62
|
+
|
|
63
|
+
def feature_sets(self) -> dict[str, list[Commit]]:
|
|
64
|
+
sets: dict[str, list[Commit]] = {}
|
|
65
|
+
for commit in self.commits:
|
|
66
|
+
if commit.feature_set is not None:
|
|
67
|
+
sets.setdefault(commit.feature_set, []).append(commit)
|
|
68
|
+
return sets
|
|
69
|
+
|
|
70
|
+
def required_bump(self) -> str:
|
|
71
|
+
if any(c.breaking for c in self.commits):
|
|
72
|
+
return "major"
|
|
73
|
+
if not any(c.kind != "merge" for c in self.commits):
|
|
74
|
+
return "none"
|
|
75
|
+
if self.complete:
|
|
76
|
+
return "minor"
|
|
77
|
+
return "patch"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def classify(sha: str, subject: str, body: str, *, merge: bool = False) -> Commit:
|
|
81
|
+
"""Classify one commit; a merge commit only contributes its breaking markers."""
|
|
82
|
+
match = HEADER_RE.match(subject)
|
|
83
|
+
breaking = bool(match and match.group("bang")) or bool(BREAKING_RE.search(body))
|
|
84
|
+
if merge:
|
|
85
|
+
return Commit(sha=sha, subject=subject, kind="merge", breaking=breaking, feature_set=None)
|
|
86
|
+
kind = match.group("type").lower() if match else "other"
|
|
87
|
+
trailer = TRAILER_RE.search(body)
|
|
88
|
+
feature_set: str | None = trailer.group("name") if trailer else None
|
|
89
|
+
if kind == "feat" and feature_set is None:
|
|
90
|
+
feature_set = ((match.group("scope") or "").strip() if match else "") or UNSCOPED
|
|
91
|
+
return Commit(sha=sha, subject=subject, kind=kind, breaking=breaking, feature_set=feature_set)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def git(repo: str, *args: str) -> subprocess.CompletedProcess[str]:
|
|
95
|
+
return subprocess.run(["git", "-C", repo, *args], capture_output=True, text=True, check=False)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def latest_tag(repo: str, to_ref: str) -> str | None:
|
|
99
|
+
result = git(repo, "describe", "--tags", "--abbrev=0", to_ref)
|
|
100
|
+
if result.returncode != 0:
|
|
101
|
+
return None
|
|
102
|
+
return result.stdout.strip() or None
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def read_commits(repo: str, rev_range: str) -> list[Commit]:
|
|
106
|
+
fmt = f"%H{FIELD_SEP}%P{FIELD_SEP}%s{FIELD_SEP}%b{RECORD_SEP}"
|
|
107
|
+
result = git(repo, "log", f"--format={fmt}", rev_range)
|
|
108
|
+
if result.returncode != 0:
|
|
109
|
+
raise ValueError(f"git log {rev_range} failed: {result.stderr.strip()}")
|
|
110
|
+
commits: list[Commit] = []
|
|
111
|
+
for record in result.stdout.split(RECORD_SEP):
|
|
112
|
+
record = record.strip("\n")
|
|
113
|
+
if not record:
|
|
114
|
+
continue
|
|
115
|
+
sha, parents, subject, body = (record.split(FIELD_SEP) + ["", "", ""])[:4]
|
|
116
|
+
commits.append(classify(sha, subject, body, merge=len(parents.split()) > 1))
|
|
117
|
+
return commits
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def resolve_complete(
|
|
121
|
+
requested: list[str], sets: dict[str, list[Commit]], earlier: set[str]
|
|
122
|
+
) -> tuple[list[str], list[str]]:
|
|
123
|
+
"""Validate ``--complete`` names. Return (complete, completed-from-earlier-releases).
|
|
124
|
+
|
|
125
|
+
``all`` selects every set in the range. A name not in the range is accepted
|
|
126
|
+
when a set of that name shipped before the range start.
|
|
127
|
+
"""
|
|
128
|
+
if requested == ["all"]:
|
|
129
|
+
return sorted(sets), []
|
|
130
|
+
unknown = [name for name in requested if name not in sets and name not in earlier]
|
|
131
|
+
if unknown:
|
|
132
|
+
known = ", ".join(sorted(sets)) or "(none)"
|
|
133
|
+
raise ValueError(
|
|
134
|
+
f"unknown feature set(s): {', '.join(unknown)}; sets in range: {known}; "
|
|
135
|
+
"no set of that name before the range either"
|
|
136
|
+
)
|
|
137
|
+
names = sorted(set(requested))
|
|
138
|
+
return names, [name for name in names if name not in sets]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def earlier_sets(repo: str, from_ref: str | None) -> set[str]:
|
|
142
|
+
"""Feature-set names from commits reachable from the range start."""
|
|
143
|
+
if from_ref is None:
|
|
144
|
+
return set()
|
|
145
|
+
return {c.feature_set for c in read_commits(repo, from_ref) if c.feature_set is not None}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def to_json(report: Report) -> dict[str, Any]:
|
|
149
|
+
def brief(c: Commit) -> dict[str, str]:
|
|
150
|
+
return {"sha": c.sha[:12], "kind": c.kind, "subject": c.subject}
|
|
151
|
+
|
|
152
|
+
counts: dict[str, int] = {"feat": 0, "fix": 0, "other": 0}
|
|
153
|
+
for c in report.commits:
|
|
154
|
+
if c.kind != "merge":
|
|
155
|
+
counts[c.kind if c.kind in counts else "other"] += 1
|
|
156
|
+
sets = [
|
|
157
|
+
{"name": name, "complete": name in report.complete, "earlier": False, "commits": [brief(c) for c in commits]}
|
|
158
|
+
for name, commits in sorted(report.feature_sets().items())
|
|
159
|
+
]
|
|
160
|
+
sets += [{"name": name, "complete": True, "earlier": True, "commits": []} for name in report.earlier]
|
|
161
|
+
return {
|
|
162
|
+
"from": report.from_ref,
|
|
163
|
+
"to": report.to_ref,
|
|
164
|
+
"counts": counts,
|
|
165
|
+
"breaking": [brief(c) for c in report.commits if c.breaking],
|
|
166
|
+
"feature_sets": sets,
|
|
167
|
+
"complete": report.complete,
|
|
168
|
+
"required_bump": report.required_bump(),
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def to_text(report: Report) -> str:
|
|
173
|
+
data = to_json(report)
|
|
174
|
+
lines = [f"Range: {data['from'] or '(root)'}..{data['to']}"]
|
|
175
|
+
counts = data["counts"]
|
|
176
|
+
lines.append(f"Commits: {counts['feat']} feat, {counts['fix']} fix, {counts['other']} other")
|
|
177
|
+
for item in data["breaking"]:
|
|
178
|
+
lines.append(f"BREAKING {item['sha']} {item['subject']}")
|
|
179
|
+
if data["feature_sets"]:
|
|
180
|
+
lines.append("Feature sets:")
|
|
181
|
+
for fs in data["feature_sets"]:
|
|
182
|
+
if fs["earlier"]:
|
|
183
|
+
lines.append(f" {fs['name']} (shipped in earlier releases, complete)")
|
|
184
|
+
continue
|
|
185
|
+
feats = sum(1 for c in fs["commits"] if c["kind"] == "feat")
|
|
186
|
+
mark = "complete" if fs["complete"] else "in progress"
|
|
187
|
+
extra = len(fs["commits"]) - feats
|
|
188
|
+
other = f" + {extra} other" if extra else ""
|
|
189
|
+
lines.append(f" {fs['name']} ({feats} feat{other}, {mark})")
|
|
190
|
+
lines.extend(f" {c['sha']} {c['subject']}" for c in fs["commits"])
|
|
191
|
+
else:
|
|
192
|
+
lines.append("Feature sets: none")
|
|
193
|
+
lines.append(f"Required bump: {data['required_bump']}")
|
|
194
|
+
return "\n".join(lines)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def parse_args(argv: list[str]) -> argparse.Namespace:
|
|
198
|
+
parser = argparse.ArgumentParser(prog="release-feature-sets.sh", description=__doc__.splitlines()[0])
|
|
199
|
+
parser.add_argument("--repo", default=".", help="repository path (default: .)")
|
|
200
|
+
parser.add_argument("--from", dest="from_ref", help="range start (default: latest tag reachable from --to)")
|
|
201
|
+
parser.add_argument("--to", dest="to_ref", default="HEAD", help="range end (default: HEAD)")
|
|
202
|
+
parser.add_argument(
|
|
203
|
+
"--complete",
|
|
204
|
+
default="",
|
|
205
|
+
help="comma-separated feature sets that are complete and user-visible, or 'all'",
|
|
206
|
+
)
|
|
207
|
+
parser.add_argument("--format", choices=("json", "text"), default="json")
|
|
208
|
+
return parser.parse_args(argv)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def main(argv: list[str] | None = None) -> int:
|
|
212
|
+
args = parse_args(sys.argv[1:] if argv is None else argv)
|
|
213
|
+
if git(args.repo, "rev-parse", "--git-dir").returncode != 0:
|
|
214
|
+
print(f"release-feature-sets: not a git repository: {args.repo}", file=sys.stderr)
|
|
215
|
+
return 1
|
|
216
|
+
from_ref = args.from_ref or latest_tag(args.repo, args.to_ref)
|
|
217
|
+
rev_range = f"{from_ref}..{args.to_ref}" if from_ref else args.to_ref
|
|
218
|
+
try:
|
|
219
|
+
report = Report(from_ref=from_ref, to_ref=args.to_ref, commits=read_commits(args.repo, rev_range))
|
|
220
|
+
requested = [n.strip() for n in args.complete.split(",") if n.strip()]
|
|
221
|
+
sets = report.feature_sets()
|
|
222
|
+
earlier = earlier_sets(args.repo, from_ref) if any(n not in sets for n in requested) else set()
|
|
223
|
+
report.complete, report.earlier = resolve_complete(requested, sets, earlier)
|
|
224
|
+
except ValueError as exc:
|
|
225
|
+
print(f"release-feature-sets: {exc}", file=sys.stderr)
|
|
226
|
+
return 1
|
|
227
|
+
print(json.dumps(to_json(report), indent=2) if args.format == "json" else to_text(report))
|
|
228
|
+
return 0
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
if __name__ == "__main__":
|
|
232
|
+
raise SystemExit(main())
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
#
|
|
5
5
|
# Usage:
|
|
6
6
|
# setup-worktree.sh parent <repo-name> <feature-slug> [--base-ref <branch>]
|
|
7
|
-
# setup-worktree.sh child <repo-name> <feature-slug> <task-id> [DEPRECATED]
|
|
8
7
|
#
|
|
9
8
|
# Modes:
|
|
10
9
|
# parent Creates <repo-root>/.opencode/worktrees/<repo>-<feature>/. This is the
|
|
@@ -15,15 +14,10 @@
|
|
|
15
14
|
# With --base-ref: checks out the existing branch (e.g. PR head). If the
|
|
16
15
|
# branch is missing locally, runs git fetch from origin once.
|
|
17
16
|
#
|
|
18
|
-
# child DEPRECATED. Does not create a separate per-task worktree. Prints a
|
|
19
|
-
# warning to stderr and echoes the *feature* worktree path (same as
|
|
20
|
-
# parent) if it already exists; otherwise instructs the caller to run
|
|
21
|
-
# `parent` first. Non-destructive — no new git worktrees for “children”.
|
|
22
|
-
#
|
|
23
17
|
# Idempotency (parent): if the path exists and is on the expected branch, echo path.
|
|
24
18
|
#
|
|
25
19
|
# Exit codes:
|
|
26
|
-
# 0 success (path echoed to stdout
|
|
20
|
+
# 0 success (path echoed to stdout)
|
|
27
21
|
# 1 error (message on stderr)
|
|
28
22
|
|
|
29
23
|
set -euo pipefail
|
|
@@ -36,12 +30,10 @@ usage() {
|
|
|
36
30
|
cat >&2 <<'EOF'
|
|
37
31
|
Usage:
|
|
38
32
|
setup-worktree.sh parent <repo-name> <feature-slug> [--base-ref <branch>]
|
|
39
|
-
setup-worktree.sh child <repo-name> <feature-slug> <task-id> (deprecated)
|
|
40
33
|
|
|
41
34
|
Arguments:
|
|
42
35
|
repo-name Short name of the repository (e.g. "ystack")
|
|
43
36
|
feature-slug Kebab-case feature identifier (e.g. "add-widget")
|
|
44
|
-
task-id (child only, ignored for path) legacy parallel-task id
|
|
45
37
|
--base-ref <b> (parent only) Check out the existing branch <b> into the
|
|
46
38
|
worktree instead of creating a new feat/<feature> branch.
|
|
47
39
|
|
|
@@ -51,9 +43,6 @@ Worktree (single contract):
|
|
|
51
43
|
|
|
52
44
|
Set YCC_WORKTREE_ROOT to override the root. Relative overrides are resolved
|
|
53
45
|
against the current repository root. Legacy roots are not migrated or touched.
|
|
54
|
-
|
|
55
|
-
'child' mode is deprecated: it echoes the feature worktree path if present; it does
|
|
56
|
-
not create separate child worktrees. See worktree-strategy.md.
|
|
57
46
|
EOF
|
|
58
47
|
}
|
|
59
48
|
|
|
@@ -69,12 +58,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
69
58
|
# shellcheck source=worktree-paths.sh
|
|
70
59
|
source "${SCRIPT_DIR}/worktree-paths.sh"
|
|
71
60
|
|
|
72
|
-
# Replace every '.' with '-' in a task-id string.
|
|
73
|
-
normalize_task_id() {
|
|
74
|
-
local raw="$1"
|
|
75
|
-
echo "${raw//./-}"
|
|
76
|
-
}
|
|
77
|
-
|
|
78
61
|
# Return the branch currently checked out in a worktree path.
|
|
79
62
|
# Uses `git worktree list --porcelain` output.
|
|
80
63
|
_worktree_branch() {
|
|
@@ -150,43 +133,6 @@ setup_parent() {
|
|
|
150
133
|
echo "$parent_path"
|
|
151
134
|
}
|
|
152
135
|
|
|
153
|
-
# ---------------------------------------------------------------------------
|
|
154
|
-
# Mode: child (deprecated — no separate worktree; echo feature path if exists)
|
|
155
|
-
# ---------------------------------------------------------------------------
|
|
156
|
-
|
|
157
|
-
setup_child() {
|
|
158
|
-
local repo_name="$1"
|
|
159
|
-
local feature_slug="$2"
|
|
160
|
-
local raw_task_id="$3"
|
|
161
|
-
|
|
162
|
-
if [[ -z "$repo_name" || -z "$feature_slug" || -z "$raw_task_id" ]]; then
|
|
163
|
-
_error "repo-name, feature-slug, and task-id must not be empty"
|
|
164
|
-
usage
|
|
165
|
-
exit 1
|
|
166
|
-
fi
|
|
167
|
-
|
|
168
|
-
local _task_id
|
|
169
|
-
_task_id="$(normalize_task_id "$raw_task_id")"
|
|
170
|
-
|
|
171
|
-
local repo_root
|
|
172
|
-
repo_root="$(ycc_repo_root)"
|
|
173
|
-
|
|
174
|
-
local feature_path
|
|
175
|
-
feature_path="$(ycc_feature_worktree_path "$repo_root" "$repo_name" "$feature_slug")"
|
|
176
|
-
|
|
177
|
-
echo "setup-worktree.sh: DEPRECATED: 'child' does not create a per-task worktree (task-id=${_task_id}). Use a single feature worktree; all agents share: ${feature_path}" >&2
|
|
178
|
-
|
|
179
|
-
if [[ -d "$feature_path" ]]; then
|
|
180
|
-
if git -C "$feature_path" rev-parse --git-dir >/dev/null 2>&1; then
|
|
181
|
-
echo "$feature_path"
|
|
182
|
-
return 0
|
|
183
|
-
fi
|
|
184
|
-
fi
|
|
185
|
-
|
|
186
|
-
_error "feature worktree not found at '${feature_path}'. Run: setup-worktree.sh parent ${repo_name} ${feature_slug}"
|
|
187
|
-
exit 1
|
|
188
|
-
}
|
|
189
|
-
|
|
190
136
|
parse_parent_args() {
|
|
191
137
|
local -n out_repo="$1"
|
|
192
138
|
local -n out_slug="$2"
|
|
@@ -249,15 +195,6 @@ run_parent_mode() {
|
|
|
249
195
|
setup_parent "$p_repo" "$p_slug" "$p_base_ref"
|
|
250
196
|
}
|
|
251
197
|
|
|
252
|
-
run_child_mode() {
|
|
253
|
-
if [[ $# -ne 3 ]]; then
|
|
254
|
-
_error "'child' mode requires exactly 3 arguments: <repo-name> <feature-slug> <task-id>"
|
|
255
|
-
usage
|
|
256
|
-
exit 1
|
|
257
|
-
fi
|
|
258
|
-
setup_child "$1" "$2" "$3"
|
|
259
|
-
}
|
|
260
|
-
|
|
261
198
|
# ---------------------------------------------------------------------------
|
|
262
199
|
# Entry point
|
|
263
200
|
# ---------------------------------------------------------------------------
|
|
@@ -269,16 +206,12 @@ main() {
|
|
|
269
206
|
shift
|
|
270
207
|
run_parent_mode "$@"
|
|
271
208
|
;;
|
|
272
|
-
child)
|
|
273
|
-
shift
|
|
274
|
-
run_child_mode "$@"
|
|
275
|
-
;;
|
|
276
209
|
--help|-h)
|
|
277
210
|
usage
|
|
278
211
|
exit 0
|
|
279
212
|
;;
|
|
280
213
|
*)
|
|
281
|
-
_error "first argument must be 'parent'
|
|
214
|
+
_error "first argument must be 'parent'"
|
|
282
215
|
usage
|
|
283
216
|
exit 1
|
|
284
217
|
;;
|
|
@@ -62,7 +62,7 @@ adding it.
|
|
|
62
62
|
|
|
63
63
|
| Field | Value |
|
|
64
64
|
| ----------- | -------------------------------------------------------- |
|
|
65
|
-
| Path | `.opencode-plugin/
|
|
65
|
+
| Path | `.opencode-plugin/shared/scripts/<kebab-name>.sh` |
|
|
66
66
|
| Sourced via | `{{package-root}}/shared/scripts/<name>.sh` |
|
|
67
67
|
| Threshold | Only create when two or more distinct skills need it |
|
|
68
68
|
|
|
@@ -33,7 +33,7 @@ same workflow will be reused repeatedly.
|
|
|
33
33
|
creates drift and makes fixes harder to apply consistently.
|
|
34
34
|
|
|
35
35
|
**Do this instead:** If two or more existing skills need the same helper, add it to
|
|
36
|
-
`.opencode-plugin/
|
|
36
|
+
`.opencode-plugin/shared/scripts/` and source it from each skill via
|
|
37
37
|
`{{package-root}}/shared/scripts/<name>.sh`. Do not create a new skill
|
|
38
38
|
just to house shared logic.
|
|
39
39
|
|
|
@@ -59,15 +59,32 @@ Read `ycc/skills/bundle-release/references/version-policy.md`.
|
|
|
59
59
|
Compare the current version (reported by preflight output) against the requested
|
|
60
60
|
`<new-version>`.
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Group the commits since the last tag into feature sets:
|
|
63
63
|
|
|
64
64
|
```
|
|
65
|
-
|
|
65
|
+
.opencode-plugin/shared/scripts/release-feature-sets.sh --format text
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
A single `feat` commit does not require a minor; a complete feature set does. When
|
|
69
|
+
feature sets are listed, ask which are complete and user-visible (one multi-select
|
|
70
|
+
question; "none" is valid), then rerun with `--complete <set,...>` to read
|
|
71
|
+
`Required bump`. Several `feat` commits for one feature are one set, and a set still in
|
|
72
|
+
progress or hidden behind an off-by-default switch is not complete. A set whose `feat`
|
|
73
|
+
commits shipped in an earlier patch is not listed; if it is now complete, name it in
|
|
74
|
+
`--complete` anyway (the helper finds it before the range).
|
|
75
|
+
|
|
76
|
+
`Required bump` reads commit markers only, so also apply the Major rules in
|
|
77
|
+
`references/version-policy.md`: a renamed or removed skill, command or agent is a major
|
|
78
|
+
even without a `!` marker. Check with
|
|
79
|
+
`git diff --name-status <last-tag>..HEAD -- ycc/skills ycc/agents` (any `D` or `R` entry
|
|
80
|
+
for a `SKILL.md` or agent file).
|
|
81
|
+
|
|
82
|
+
The floor is the higher of `Required bump` and the Major rules. A requested version below
|
|
83
|
+
it (a patch over a complete set, such as a finished new skill, or a non-major over a
|
|
84
|
+
breaking change or a renamed/removed surface) is refused, not confirmed: stop, name what
|
|
85
|
+
sets the floor, and ask for a version at or above it. A patch over in-progress sets is
|
|
86
|
+
expected; name those sets once and continue. Headless, treat every set as in progress,
|
|
87
|
+
and on a refusal print the concern plus the rerun command.
|
|
71
88
|
|
|
72
89
|
## Phase 2: Dry-run check
|
|
73
90
|
|
|
@@ -41,7 +41,15 @@ If pre-flight fails: resolve all failing conditions before proceeding. Do not sk
|
|
|
41
41
|
git log $(git describe --tags --abbrev=0)..HEAD --oneline
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
- [ ]
|
|
44
|
+
- [ ] Group `feat` commits into feature sets and mark the complete ones:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
.opencode-plugin/shared/scripts/release-feature-sets.sh --format text
|
|
48
|
+
.opencode-plugin/shared/scripts/release-feature-sets.sh --complete <set,...> --format text
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- [ ] Select the semver bump level (major / minor / patch) at or above `Required bump`,
|
|
52
|
+
per `references/version-policy.md`.
|
|
45
53
|
- [ ] Record the chosen new version: `<new-version>`
|
|
46
54
|
|
|
47
55
|
---
|
|
@@ -115,7 +115,7 @@ Use standard semver (`MAJOR.MINOR.PATCH`). Apply the first rule that matches:
|
|
|
115
115
|
- Change to the `name` field in `plugin.json`
|
|
116
116
|
- Restructure of how the bundle is loaded or distributed
|
|
117
117
|
|
|
118
|
-
**Minor** — any of the following:
|
|
118
|
+
**Minor** — a complete feature set that includes any of the following:
|
|
119
119
|
|
|
120
120
|
- New skill, command, or agent added
|
|
121
121
|
- Additive frontmatter fields on existing surfaces (no removals or renames)
|
|
@@ -127,9 +127,16 @@ Use standard semver (`MAJOR.MINOR.PATCH`). Apply the first rule that matches:
|
|
|
127
127
|
- Documentation-only change (SKILL.md prose, reference docs, templates)
|
|
128
128
|
- Template refinement or whitespace/linter-only fix
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
These rules apply to **feature sets**, not single commits. Several `feat` commits often
|
|
131
|
+
build one feature; `.opencode-plugin/shared/scripts/release-feature-sets.sh` groups them by
|
|
132
|
+
their `Feature-Set:` footer, else their scope. A set requires a minor only when it is
|
|
133
|
+
complete and user-visible. A set still in progress, or hidden behind an off-by-default
|
|
134
|
+
switch (see "Unfinished work" in `RELEASING.md`), ships in a patch, and its commits are
|
|
135
|
+
listed under the release notes' features as usual.
|
|
136
|
+
|
|
137
|
+
Tie-breaker: Major rules are never downgraded; when a change could be breaking, bump
|
|
138
|
+
major. Between minor and patch, the feature-set answer decides: when the maintainer is
|
|
139
|
+
unsure whether a set is complete, it is in progress and the release is a patch.
|
|
133
140
|
|
|
134
141
|
## Never-Edit List
|
|
135
142
|
|
|
@@ -150,7 +150,7 @@ Unless suppressed, run each applier. Each writes to a distinct file so they can
|
|
|
150
150
|
{{package-root}}/skills/formatters/scripts/apply-ci.sh --target "$TARGET" --profile-file "$PROFILE_FILE" [--force] [--no-autofix]
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
Pass `--no-autofix` when `NO_AUTOFIX=true` to install only the check workflow. The check workflow runs on every PR and on pushes to the default branch and `release/**`. The autofix workflow runs on same-repo PRs to the default branch (`origin/HEAD`, falling back to `main`),
|
|
153
|
+
Pass `--no-autofix` when `NO_AUTOFIX=true` to install only the check workflow. The check workflow runs on every PR and on pushes to the default branch and `release/**`. The autofix workflow runs on same-repo PRs to the default branch (`origin/HEAD`, falling back to `main`) as two jobs. The `format` job checks out the PR head without persisted credentials, runs `./scripts/style.sh format` + `lint --fix` with a read-only `GITHUB_TOKEN` and no secrets, and uploads any fixes as a patch artifact. The `push` job never checks out or runs PR code: it validates the patch (in-place text edits to existing files only; anything else, including any path under `.github/` such as `.github/workflows/`, fails the job without pushing), mints a GitHub App installation token with Contents write only (`actions/create-github-app-token`), applies the patch in a fresh repository with hooks disabled, and pushes. It uses an App token because a push made with `GITHUB_TOKEN` leaves every check on the fix commit waiting for approval. It reads the App's client ID from the `AUTOFIX_APP_CLIENT_ID` variable and its private key from the `AUTOFIX_APP_PRIVATE_KEY` secret; without them, or if minting fails, it reports the fixes in a warning and the job summary instead of pushing. Fork PRs are skipped by both jobs because the workflow cannot push to them.
|
|
154
154
|
|
|
155
155
|
4. **Hooks** (run when `HOOKS=true`, OR when the target already has a `lefthook.yml` / `.husky/pre-commit` — i.e., `has_lefthook=true` or `has_husky=true` in the profile):
|
|
156
156
|
|
|
@@ -177,6 +177,7 @@ Produce a summary with these sections:
|
|
|
177
177
|
- `lefthook install` (if `--hooks` + lefthook chosen)
|
|
178
178
|
- Review `scripts/` bundle in the first commit that adds it
|
|
179
179
|
- Re-run with `formatters --sync` after upstream bundle changes
|
|
180
|
+
- If `lint-autofix.yml` was written: create a GitHub App with repository permission Contents read and write (no Workflows permission: autofix never pushes changes under `.github/`, so format those locally), install it on the repository, and set the `AUTOFIX_APP_CLIENT_ID` variable and `AUTOFIX_APP_PRIVATE_KEY` secret; until then the workflow reports fixes instead of pushing. Anyone who can write to a repository holding the private key can mint tokens for every repository the App is installed on, so reuse one App only across repositories with the same trusted writers. Organization-level variables and secrets are not available to private repositories on GitHub Free; set them on the repository there
|
|
180
181
|
- Bypass a single hook run: `git commit --no-verify`
|
|
181
182
|
|
|
182
183
|
## Important Notes
|
|
@@ -90,9 +90,13 @@ The check workflow runs on every pull request and on pushes to the default branc
|
|
|
90
90
|
The autofix workflow:
|
|
91
91
|
|
|
92
92
|
- Triggers on pull requests to the target repo's default branch (detected via `git symbolic-ref refs/remotes/origin/HEAD`, falling back to `main`).
|
|
93
|
-
- Skips fork PRs via `github.event.pull_request.head.repo.full_name == github.repository
|
|
94
|
-
-
|
|
95
|
-
-
|
|
93
|
+
- Skips fork PRs in both jobs via `github.event.pull_request.head.repo.full_name == github.repository`; the workflow cannot push to fork branches.
|
|
94
|
+
- Runs two jobs. The `format` job checks out the PR head (`persist-credentials: false`), runs the language setup and `./scripts/style.sh format` + `lint --fix` with `GITHUB_TOKEN` at `contents: read` and no secrets, and uploads any fixes as a `git diff` patch artifact. With no fixes it succeeds and the `push` job is skipped.
|
|
95
|
+
- The `push` job holds the App key and token, so it never checks out or runs PR code: no `./scripts/style.sh`, package installs, or hooks. It treats the patch as untrusted, accepts only in-place text edits to existing regular files, and fails without pushing on anything else, including any path under `.github/` (workflows, local actions, and repository settings). It applies the patch to the PR head commit's index in a fresh repository (the PR tree is never written to disk, hooks are disabled), re-checks the result, and pushes. Keep it on GitHub-hosted or ephemeral runners so nothing started by the `format` job can outlive it. The split keeps the App key away from code that the formatters and package installs run; it does not protect against someone who can push a changed workflow file to a branch, so limit branch write access to trusted writers and review autofix commits like any other commit on the PR.
|
|
96
|
+
- Pushes with a GitHub App installation token minted by `actions/create-github-app-token` with Contents write only. A push made with `GITHUB_TOKEN` creates the `pull_request` runs for the fix commit in an approval-required state, so every check on it would wait for a maintainer.
|
|
97
|
+
- Needs the `AUTOFIX_APP_CLIENT_ID` variable and `AUTOFIX_APP_PRIVATE_KEY` secret and an App with repository permission Contents read and write, installed on the repo. The App needs no Workflows permission: the `format` job leaves `.github/` out of the patch (format those files locally; `lint.yml` still reports them) and the `push` job refuses them. Organization-level variables and secrets are not available to private repositories on GitHub Free, so set them on the repository there. Anyone who can write to a repository holding the private key can mint tokens for every repository the App is installed on, so reuse one App only across repositories with the same trusted writers. Without them, or if minting fails, the job prints a warning, lists the fixes in the job summary, and exits successfully without pushing.
|
|
98
|
+
- Commits as `github-actions[bot]`; the check workflow (`lint.yml`) still runs authoritatively on the resulting push. A loop guard stops a second push when the PR head is already the autofix commit and the fixers still change files.
|
|
99
|
+
- Carries a commented `git add -u -- . ':(exclude)...'` placeholder in the `format` job — customize after install if the project has generated files that should not be auto-fixed.
|
|
96
100
|
|
|
97
101
|
```
|
|
98
102
|
formatters --ci # installs both workflows
|
|
@@ -102,7 +106,7 @@ formatters --ci --no-autofix # install only lint.yml (check-only)
|
|
|
102
106
|
|
|
103
107
|
### `--no-autofix`
|
|
104
108
|
|
|
105
|
-
Only meaningful when `--ci` is set. Skips installing `lint-autofix.yml`. The existing check workflow (`lint.yml`) is still installed. Use when a repo has branch-protection rules that forbid bot pushes, or when the team prefers to run formatters exclusively via pre-commit hooks.
|
|
109
|
+
Only meaningful when `--ci` is set. Skips installing `lint-autofix.yml`. The existing check workflow (`lint.yml`) is still installed. Use when a repo has branch-protection rules that forbid bot pushes, when no GitHub App can be set up for the push, or when the team prefers to run formatters exclusively via pre-commit hooks.
|
|
106
110
|
|
|
107
111
|
```
|
|
108
112
|
formatters --ci --no-autofix
|
|
@@ -5,25 +5,33 @@ on:
|
|
|
5
5
|
branches: [{{DEFAULT_BRANCH}}]
|
|
6
6
|
|
|
7
7
|
permissions:
|
|
8
|
-
contents:
|
|
8
|
+
contents: read
|
|
9
9
|
|
|
10
10
|
concurrency:
|
|
11
11
|
group: lint-autofix-${{ github.event.pull_request.number || github.ref }}
|
|
12
12
|
cancel-in-progress: true
|
|
13
13
|
|
|
14
14
|
jobs:
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
# The work is split so PR code never shares a job with the App key or token:
|
|
16
|
+
# format: checks out and runs the PR branch (formatters, package installs) with a
|
|
17
|
+
# read-only GITHUB_TOKEN and no secrets, then uploads the fixes as a patch.
|
|
18
|
+
# push: never checks out or runs PR code. It treats the patch as untrusted input,
|
|
19
|
+
# validates it, mints the App token, applies the patch and pushes.
|
|
20
|
+
format:
|
|
21
|
+
name: Format (read-only)
|
|
17
22
|
# Fork PRs cannot be pushed back to; the check workflow (lint.yml) still runs authoritatively.
|
|
18
23
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
19
24
|
runs-on: ubuntu-latest
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
outputs:
|
|
28
|
+
has_patch: ${{ steps.patch.outputs.has_patch }}
|
|
20
29
|
steps:
|
|
21
|
-
- name: Checkout PR head
|
|
30
|
+
- name: Checkout PR head
|
|
22
31
|
uses: actions/checkout@v4
|
|
23
32
|
with:
|
|
24
|
-
ref: ${{ github.
|
|
25
|
-
|
|
26
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
34
|
+
persist-credentials: false
|
|
27
35
|
|
|
28
36
|
{{#IF_RUST}}
|
|
29
37
|
- uses: dtolnay/rust-toolchain@stable
|
|
@@ -69,26 +77,184 @@ jobs:
|
|
|
69
77
|
run: ./scripts/style.sh format
|
|
70
78
|
|
|
71
79
|
- name: Apply auto-fixable lint
|
|
72
|
-
# Unfixable violations are reported by the check workflow (lint.yml); do not block the
|
|
80
|
+
# Unfixable violations are reported by the check workflow (lint.yml); do not block the autofix here.
|
|
73
81
|
run: ./scripts/style.sh lint --fix
|
|
74
82
|
continue-on-error: true
|
|
75
83
|
|
|
76
|
-
- name:
|
|
84
|
+
- name: Export autofix patch
|
|
85
|
+
id: patch
|
|
86
|
+
run: |
|
|
87
|
+
# The push job refuses changes under .github/ (workflows, local actions and repo
|
|
88
|
+
# settings; its App token has no Workflows permission), so leave them out here.
|
|
89
|
+
# lint.yml still reports them. Customize exclusions here, e.g.:
|
|
90
|
+
# git add -u -- . ':(exclude).github' ':(exclude)CHANGELOG.md' ':(exclude)docs/internal/**'
|
|
91
|
+
git add -u -- . ':(exclude).github'
|
|
92
|
+
if ! git diff --quiet -- .github; then
|
|
93
|
+
echo "::notice title=Lint autofix skipped .github/ files::Format .github/ locally; autofix does not push files under .github/."
|
|
94
|
+
fi
|
|
95
|
+
if git diff --cached --quiet; then
|
|
96
|
+
echo "No autofix changes."
|
|
97
|
+
echo "has_patch=false" >> "$GITHUB_OUTPUT"
|
|
98
|
+
exit 0
|
|
99
|
+
fi
|
|
100
|
+
git diff --cached --stat
|
|
101
|
+
git diff --cached --no-color --no-ext-diff --no-textconv --no-renames --full-index > "$RUNNER_TEMP/autofix.patch"
|
|
102
|
+
echo "has_patch=true" >> "$GITHUB_OUTPUT"
|
|
103
|
+
|
|
104
|
+
- name: Upload autofix patch
|
|
105
|
+
if: steps.patch.outputs.has_patch == 'true'
|
|
106
|
+
uses: actions/upload-artifact@v4
|
|
107
|
+
with:
|
|
108
|
+
name: lint-autofix-patch
|
|
109
|
+
path: ${{ runner.temp }}/autofix.patch
|
|
110
|
+
if-no-files-found: error
|
|
111
|
+
retention-days: 1
|
|
112
|
+
overwrite: true
|
|
113
|
+
|
|
114
|
+
push:
|
|
115
|
+
name: Push autofix commit
|
|
116
|
+
needs: format
|
|
117
|
+
if: github.event.pull_request.head.repo.full_name == github.repository && needs.format.outputs.has_patch == 'true'
|
|
118
|
+
# This job holds the App key and token. It never checks out or runs PR code: no
|
|
119
|
+
# ./scripts/style.sh, no package installs, no hooks, and no PR files written to disk.
|
|
120
|
+
# Keep it on GitHub-hosted (or ephemeral self-hosted) runners so nothing the format
|
|
121
|
+
# job started on a runner can outlive that job and reach this one.
|
|
122
|
+
runs-on: ubuntu-latest
|
|
123
|
+
permissions:
|
|
124
|
+
contents: read
|
|
125
|
+
env:
|
|
126
|
+
# 'true' once the autofix App is configured for this repository (see the mint step).
|
|
127
|
+
AUTOFIX_APP_CONFIGURED: ${{ vars.AUTOFIX_APP_CLIENT_ID != '' && secrets.AUTOFIX_APP_PRIVATE_KEY != '' }}
|
|
128
|
+
steps:
|
|
129
|
+
- name: Download autofix patch
|
|
130
|
+
uses: actions/download-artifact@v4
|
|
131
|
+
with:
|
|
132
|
+
name: lint-autofix-patch
|
|
133
|
+
path: ${{ runner.temp }}/autofix-artifact
|
|
134
|
+
|
|
135
|
+
- name: Validate autofix patch
|
|
136
|
+
# The patch comes from a job that ran PR code, so it is untrusted: copy only the
|
|
137
|
+
# patch file out of the artifact, run git from an empty directory, and accept only
|
|
138
|
+
# in-place text edits to existing files outside .github/. Anything else fails
|
|
139
|
+
# without pushing. The push step re-checks the applied result.
|
|
140
|
+
run: |
|
|
141
|
+
refuse() {
|
|
142
|
+
echo "::error title=Lint autofix refused::$1"
|
|
143
|
+
exit 1
|
|
144
|
+
}
|
|
145
|
+
artifact="$RUNNER_TEMP/autofix-artifact/autofix.patch"
|
|
146
|
+
patch="$RUNNER_TEMP/autofix.patch"
|
|
147
|
+
[[ -f "$artifact" && ! -L "$artifact" ]] || refuse "The autofix patch is missing."
|
|
148
|
+
cp -- "$artifact" "$patch"
|
|
149
|
+
rm -rf -- "$RUNNER_TEMP/autofix-artifact"
|
|
150
|
+
[[ -s "$patch" ]] || refuse "The autofix patch is empty."
|
|
151
|
+
scratch="$(mktemp -d)"
|
|
152
|
+
cd "$scratch"
|
|
153
|
+
export GIT_CEILING_DIRECTORIES="${scratch%/*}"
|
|
154
|
+
summary="$(git apply --summary "$patch")" || refuse "The autofix patch could not be parsed."
|
|
155
|
+
if [[ -n "$summary" ]]; then
|
|
156
|
+
refuse "The autofix patch creates, deletes, renames, or changes the mode of a file."
|
|
157
|
+
fi
|
|
158
|
+
git apply --numstat -z "$patch" > "$scratch/numstat" || refuse "The autofix patch could not be parsed."
|
|
159
|
+
files=0
|
|
160
|
+
while IFS= read -r -d '' record; do
|
|
161
|
+
added="${record%%$'\t'*}"
|
|
162
|
+
path="${record#*$'\t'*$'\t'}"
|
|
163
|
+
[[ -n "$path" && "$path" != "$record" ]] || refuse "The autofix patch has an unexpected file entry."
|
|
164
|
+
[[ "$path" != *[[:cntrl:]]* ]] || refuse "The autofix patch has a file name with control characters."
|
|
165
|
+
[[ "$added" != "-" ]] || refuse "The autofix patch changes a binary file: $path"
|
|
166
|
+
case "/${path,,}/" in
|
|
167
|
+
/.github/*) refuse "The autofix patch changes a file under .github/: $path" ;;
|
|
168
|
+
//* | */../* | */./*) refuse "The autofix patch has an unsafe path: $path" ;;
|
|
169
|
+
esac
|
|
170
|
+
files=$((files + 1))
|
|
171
|
+
done < "$scratch/numstat"
|
|
172
|
+
(( files > 0 )) || refuse "The autofix patch changes no files."
|
|
173
|
+
echo "Autofix patch accepted: $files file(s)."
|
|
174
|
+
|
|
175
|
+
- name: Mint autofix App token
|
|
176
|
+
id: app-token
|
|
177
|
+
# A push made with GITHUB_TOKEN leaves every check on the autofix commit waiting for
|
|
178
|
+
# approval, so the push uses a GitHub App token with Contents write only.
|
|
179
|
+
# Without the App variable and secret (or if minting fails) the job reports, not pushes.
|
|
180
|
+
if: env.AUTOFIX_APP_CONFIGURED == 'true'
|
|
181
|
+
continue-on-error: true
|
|
182
|
+
uses: actions/create-github-app-token@v3
|
|
183
|
+
with:
|
|
184
|
+
client-id: ${{ vars.AUTOFIX_APP_CLIENT_ID }}
|
|
185
|
+
private-key: ${{ secrets.AUTOFIX_APP_PRIVATE_KEY }}
|
|
186
|
+
permission-contents: write
|
|
187
|
+
|
|
188
|
+
- name: Report fixes without pushing
|
|
189
|
+
if: steps.app-token.outputs.token == ''
|
|
190
|
+
run: |
|
|
191
|
+
patch="$RUNNER_TEMP/autofix.patch"
|
|
192
|
+
echo "::warning title=Lint autofix not pushed::Fixes found but not pushed: set the AUTOFIX_APP_CLIENT_ID variable and AUTOFIX_APP_PRIVATE_KEY secret (or check the App installation)."
|
|
193
|
+
{
|
|
194
|
+
echo "### Lint autofix: fixes found, not pushed"
|
|
195
|
+
echo
|
|
196
|
+
echo "This workflow pushes with a GitHub App token. Set the \`AUTOFIX_APP_CLIENT_ID\` variable and \`AUTOFIX_APP_PRIVATE_KEY\` secret, or run the formatters locally."
|
|
197
|
+
echo
|
|
198
|
+
echo '```'
|
|
199
|
+
(cd "$(mktemp -d)" && git apply --stat "$patch")
|
|
200
|
+
echo '```'
|
|
201
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
202
|
+
|
|
203
|
+
- name: Commit and push autofix patch
|
|
204
|
+
if: steps.app-token.outputs.token != ''
|
|
77
205
|
env:
|
|
78
206
|
PR_HEAD_REF: ${{ github.head_ref }}
|
|
207
|
+
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
208
|
+
AUTOFIX_SUBJECT: "chore: apply format + lint --fix (autofix workflow)"
|
|
209
|
+
AUTOFIX_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
79
210
|
run: |
|
|
211
|
+
patch="$RUNNER_TEMP/autofix.patch"
|
|
212
|
+
remote="https://x-access-token:${AUTOFIX_TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git"
|
|
213
|
+
# Work in a fresh repository with only the PR head commit in its object store and
|
|
214
|
+
# index: the PR tree is never written to disk, and hooks are disabled, so nothing
|
|
215
|
+
# from the PR runs. Only git fetch, apply, commit, and push run here.
|
|
216
|
+
repo="$RUNNER_TEMP/autofix-repo"
|
|
217
|
+
git -c core.hooksPath=/dev/null init -q --template= "$repo"
|
|
218
|
+
cd "$repo"
|
|
219
|
+
git config core.hooksPath /dev/null
|
|
80
220
|
git config user.name "github-actions[bot]"
|
|
81
221
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
82
|
-
|
|
83
|
-
|
|
222
|
+
git fetch -q --depth=1 --no-tags "$remote" "$PR_HEAD_SHA"
|
|
223
|
+
git update-ref HEAD "$PR_HEAD_SHA"
|
|
224
|
+
git read-tree HEAD
|
|
225
|
+
# Loop guard: the App push starts a new run on the autofix commit. If HEAD is already
|
|
226
|
+
# that commit and the fixers still change files, they are not idempotent; stop here.
|
|
227
|
+
if [[ "$(git log -1 --format=%s HEAD)" == "$AUTOFIX_SUBJECT" ]]; then
|
|
228
|
+
echo "::warning title=Lint autofix stopped::HEAD is already an autofix commit and the fixers still change files; not pushing again."
|
|
229
|
+
git apply --stat "$patch"
|
|
84
230
|
exit 0
|
|
85
231
|
fi
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
232
|
+
git apply --cached "$patch"
|
|
233
|
+
# Re-check what actually landed in the index: in-place edits to regular text files
|
|
234
|
+
# only (a forced-text diff can hide binary content from the validate step), nothing
|
|
235
|
+
# under .github/.
|
|
236
|
+
git diff --cached --raw -z --no-renames HEAD > "$RUNNER_TEMP/autofix.raw"
|
|
237
|
+
while IFS= read -r -d '' meta && IFS= read -r -d '' path; do
|
|
238
|
+
read -r old_mode new_mode old_blob new_blob status <<< "${meta#:}"
|
|
239
|
+
case "$old_mode:$new_mode:$status" in
|
|
240
|
+
100644:100644:M | 100755:100755:M) ;;
|
|
241
|
+
*) echo "::error title=Lint autofix refused::The autofix patch changes something other than a regular file's contents."; exit 1 ;;
|
|
242
|
+
esac
|
|
243
|
+
case "${path,,}" in
|
|
244
|
+
.github/*) echo "::error title=Lint autofix refused::The autofix patch changes a file under .github/."; exit 1 ;;
|
|
245
|
+
esac
|
|
246
|
+
for blob in "$old_blob" "$new_blob"; do
|
|
247
|
+
nul_bytes="$(git cat-file blob "$blob" | tr -dc '\000' | wc -c)"
|
|
248
|
+
if (( nul_bytes > 0 )); then
|
|
249
|
+
echo "::error title=Lint autofix refused::The autofix patch changes a binary file."
|
|
250
|
+
exit 1
|
|
251
|
+
fi
|
|
252
|
+
done
|
|
253
|
+
done < "$RUNNER_TEMP/autofix.raw"
|
|
254
|
+
if git diff --cached --quiet HEAD; then
|
|
255
|
+
echo "No autofix changes after applying the patch."
|
|
91
256
|
exit 0
|
|
92
257
|
fi
|
|
93
|
-
git commit -
|
|
94
|
-
git
|
|
258
|
+
git commit -q --no-verify -m "$AUTOFIX_SUBJECT"
|
|
259
|
+
git show --stat --format='%h %s' HEAD
|
|
260
|
+
git push -q --no-verify "$remote" "HEAD:refs/heads/${PR_HEAD_REF}"
|
|
@@ -96,7 +96,7 @@ just format-unstaged
|
|
|
96
96
|
### CI
|
|
97
97
|
|
|
98
98
|
{{#IF_CI_INSTALLED}}
|
|
99
|
-
Lint runs automatically on every pull request via `.github/workflows/lint.yml`. If `.github/workflows/lint-autofix.yml` is also present, it applies `./scripts/style.sh format` + `lint --fix` on same-repo PRs and pushes fixes back
|
|
99
|
+
Lint runs automatically on every pull request via `.github/workflows/lint.yml`. If `.github/workflows/lint-autofix.yml` is also present, it applies `./scripts/style.sh format` + `lint --fix` on same-repo PRs. When the `AUTOFIX_APP_CLIENT_ID` variable and `AUTOFIX_APP_PRIVATE_KEY` secret are set, it pushes the fixes back with a GitHub App token; without them it lists the fixes in the job summary and does not push. Fork PRs are skipped.
|
|
100
100
|
{{/IF_CI_INSTALLED}}
|
|
101
101
|
{{#IF_CI_NOT_INSTALLED}}
|
|
102
102
|
To wire lint into CI, run `formatters --ci` (installs both `lint.yml` and `lint-autofix.yml`) or pair it with `--no-autofix` to skip the autofix workflow.
|
|
@@ -12,9 +12,9 @@ while [[ -L "$SCRIPT_PATH" ]]; do
|
|
|
12
12
|
done
|
|
13
13
|
SCRIPT_DIR="$(cd -P "$(dirname "$SCRIPT_PATH")" >/dev/null 2>&1 && pwd)"
|
|
14
14
|
|
|
15
|
-
# shellcheck source=
|
|
15
|
+
# shellcheck source=lib/modified-files.sh
|
|
16
16
|
source "$SCRIPT_DIR/lib/modified-files.sh"
|
|
17
|
-
# shellcheck source=
|
|
17
|
+
# shellcheck source=lib/shellcheck-resolve.sh
|
|
18
18
|
source "$SCRIPT_DIR/lib/shellcheck-resolve.sh"
|
|
19
19
|
|
|
20
20
|
PROJECT_ROOT="$(detect_project_root)"
|
|
@@ -86,8 +86,8 @@ flags that emit machine-readable output.
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
- **Worktrees**: `git worktree list --porcelain`. Flag entries whose `worktree`
|
|
89
|
-
path no longer exists
|
|
90
|
-
|
|
89
|
+
path no longer exists or whose branch is `[gone]`; legacy roots are classified
|
|
90
|
+
per `active-code-rules.md`.
|
|
91
91
|
The managed roots under the repo root are `.claude/worktrees/`,
|
|
92
92
|
`.opencode/worktrees/`, `.codex/worktrees/`, `.cursor/worktrees/`,
|
|
93
93
|
`.omp/worktrees/` and `.agents/worktrees/`; every runtime checks all of them.
|
|
@@ -291,9 +291,8 @@ release-model rules (a malformed state has already stopped the run in Phase 0).
|
|
|
291
291
|
|
|
292
292
|
- **Worktrees under any repo-local managed root** (`.claude/`, `.opencode/`,
|
|
293
293
|
`.codex/`, `.cursor/`, `.omp/` or `.agents/` followed by `worktrees/`) are fair
|
|
294
|
-
game per this repo's convention.
|
|
295
|
-
|
|
296
|
-
worktrees under `~/.omp/wt`; OMP manages them (`omp worktree clear`).
|
|
294
|
+
game per this repo's convention. Never delete worktrees under `~/.omp/wt`; OMP
|
|
295
|
+
manages them (`omp worktree clear`).
|
|
297
296
|
|
|
298
297
|
- **Respect the repo's label taxonomy**. Do not invent stale/wontfix labels.
|
|
299
298
|
- **No secrets**. Do not log tokens or API responses containing credentials.
|
|
@@ -17,7 +17,7 @@ Condensed Conventional Commits 1.0.0 spec. The generated `AGENTS.md` carries a o
|
|
|
17
17
|
|
|
18
18
|
| Type | Purpose | Semver bump (release tooling) |
|
|
19
19
|
| ---------- | ----------------------------------------------- | ----------------------------- |
|
|
20
|
-
| `feat` | New user-facing feature | **minor**
|
|
20
|
+
| `feat` | New user-facing feature | **minor** once its set ships |
|
|
21
21
|
| `fix` | Bug fix | **patch** |
|
|
22
22
|
| `docs` | Documentation only | none |
|
|
23
23
|
| `refactor` | Code change that is neither a fix nor a feature | none |
|
|
@@ -71,6 +71,13 @@ Both forms trigger a **major** version bump in release tooling.
|
|
|
71
71
|
- Footers follow `Token: value` syntax (`BREAKING CHANGE`, `Closes`, `Co-authored-by`).
|
|
72
72
|
- `BREAKING CHANGE` footer MUST be uppercase — `breaking change` is not spec-compliant.
|
|
73
73
|
|
|
74
|
+
### Feature sets
|
|
75
|
+
|
|
76
|
+
Several `feat` commits often build one feature. Release tooling groups them into a
|
|
77
|
+
**feature set** (the commit scope by default, so `feat(sync): …` commits form the `sync`
|
|
78
|
+
set) and requires a minor only when a set is complete and user-visible; an in-progress
|
|
79
|
+
set ships in a patch. Add a `Feature-Set: <name>` footer when a feature spans scopes.
|
|
80
|
+
|
|
74
81
|
---
|
|
75
82
|
|
|
76
83
|
## Internal Docs Convention
|
|
@@ -37,7 +37,7 @@ Every template the skill can render, its target path, and the variables it subst
|
|
|
37
37
|
|
|
38
38
|
---
|
|
39
39
|
|
|
40
|
-
The `templates/CLAUDE.md.tmpl` row combines three mechanisms in one Placeholders cell on purpose: `CLAUDE_MD_SHIM` is the canonical shim token rendered by the shared helper (
|
|
40
|
+
The `templates/CLAUDE.md.tmpl` row combines three mechanisms in one Placeholders cell on purpose: `CLAUDE_MD_SHIM` is the canonical shim token rendered by the shared helper (`.opencode-plugin/shared/scripts/rules_pointer.py` via `rules_pointer.py`), so the pointer line is not user-overridable policy; `CLAUDE_ONLY_NOTES` is user/Phase 2 text substituted into that same template; and `IF_CLAUDE_ONLY` is the conditional block that gates the notes section. All three are aspects of the single default `CLAUDE.md` shim, so they share one row.
|
|
41
41
|
|
|
42
42
|
## Placeholder Reference
|
|
43
43
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#
|
|
9
9
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
10
10
|
# Types (Conventional Commits 1.0.0):
|
|
11
|
-
# feat new user-facing feature (minor
|
|
11
|
+
# feat new user-facing feature (minor bump once its feature set is complete)
|
|
12
12
|
# fix user-facing bug fix (patch version bump)
|
|
13
13
|
# docs documentation changes
|
|
14
14
|
# refactor code change that neither fixes a bug nor adds a feature
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
#
|
|
23
23
|
# Scope: lowercase area/module, e.g. feat(auth): …
|
|
24
24
|
# Breaking change: append `!` after type OR add `BREAKING CHANGE:` footer.
|
|
25
|
+
# Feature spanning scopes: add a `Feature-Set: <name>` footer to group its commits.
|
|
25
26
|
# Internal docs (not for release notes): use `docs(internal): …`.
|
|
26
27
|
#
|
|
27
28
|
# {{PROJECT_NAME}} • generated by the init workflow
|
|
@@ -40,7 +40,8 @@ The block below is read by tools; the table is generated from it. Change both wi
|
|
|
40
40
|
5. **No new long-lived branches.** Large work lands on `{{TRUNK}}` in small PRs. See
|
|
41
41
|
[Unfinished work](#unfinished-work).
|
|
42
42
|
6. **`{{TRUNK}}` is always releasable.** CI green, and nothing half-built reachable by users.
|
|
43
|
-
7. **
|
|
43
|
+
7. **A maintainer approves each release once** ("ship x.y.z to prod?"), following
|
|
44
|
+
[Releasing](#releasing). After that approval, agents may tag, publish and cut the release.
|
|
44
45
|
|
|
45
46
|
## Where does my change go?
|
|
46
47
|
|
package/skills/releaser/SKILL.md
CHANGED
|
@@ -43,7 +43,8 @@ Parse `$ARGUMENTS`:
|
|
|
43
43
|
|
|
44
44
|
- **version** (optional first positional) — target semver (`1.4.0`, `v1.4.0`, or a
|
|
45
45
|
pre-release like `1.4.0-rc.1`). If omitted, propose one from commit history
|
|
46
|
-
(
|
|
46
|
+
(feature-set bump: a `feat` commit requires a minor only once its feature set is
|
|
47
|
+
complete) and ask for confirmation before continuing.
|
|
47
48
|
- **--arch=\<list\>** — comma-separated target architectures (e.g. `amd64,arm64`).
|
|
48
49
|
Overrides language defaults.
|
|
49
50
|
- **--os=\<list\>** — comma-separated target operating systems
|
|
@@ -246,6 +247,9 @@ If a file cannot be read, say so.
|
|
|
246
247
|
Scripts (invoke as `{{package-root}}/skills/releaser/scripts/<name>`):
|
|
247
248
|
|
|
248
249
|
- `scripts/detect-project.sh` — Run when: Phase 1 detection (emits JSON).
|
|
250
|
+
- `{{package-root}}/shared/scripts/release-feature-sets.sh` — Run when:
|
|
251
|
+
Phase 2 version proposal or sanity check (groups `feat` commits into feature sets
|
|
252
|
+
and reports `required_bump`).
|
|
249
253
|
- `scripts/check-release-branch.sh` — Run when: Phase 2 branch check after the
|
|
250
254
|
version is confirmed.
|
|
251
255
|
- `scripts/draft-changelog.sh` — Run when: Phase 4 notes drafting.
|
|
@@ -77,25 +77,44 @@ matrix.
|
|
|
77
77
|
|
|
78
78
|
## Phase 2: Propose version and compute bump
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
Steps 1–2 run whether or not the user supplied a version; they produce
|
|
81
|
+
`required_bump` (printed as `Required bump:` by `--format text`).
|
|
82
|
+
|
|
83
|
+
1. Group the commits since `latest_tag` into feature sets:
|
|
84
|
+
`{{package-root}}/shared/scripts/release-feature-sets.sh --format text`
|
|
85
|
+
(`--from <ref>` when `latest_tag` is not the right range start; with no tag it covers
|
|
86
|
+
all history). `feat` commits are grouped by their `Feature-Set:` footer, else their
|
|
87
|
+
scope, else `unscoped`; merge commits are skipped.
|
|
88
|
+
2. If any feature sets are listed, ASK which ones are complete and user-visible (one
|
|
89
|
+
multi-select question listing each set with its commit count; "none" is a valid
|
|
90
|
+
answer). Several `feat` commits for one feature are one set, and a set that is still
|
|
91
|
+
in progress, or hidden behind an off-by-default switch, is not complete. Also ask
|
|
92
|
+
whether a set whose `feat` commits shipped in an earlier patch is now complete: it is
|
|
93
|
+
not listed, but naming it in `--complete` is accepted (the helper finds it before
|
|
94
|
+
the range). Rerun the helper with `--complete <set,...>` (or `--complete all`) to
|
|
95
|
+
get `required_bump`:
|
|
96
|
+
- Any `!` marker or `BREAKING CHANGE` footer → major.
|
|
97
|
+
- Any complete feature set → minor.
|
|
98
|
+
- Otherwise → patch. `feat` commits from in-progress sets ship in a patch.
|
|
99
|
+
3. If the user did NOT supply a version, propose the next semver from `required_bump`
|
|
100
|
+
and ASK for confirmation before writing anything. The bump is a floor; the
|
|
101
|
+
maintainer may choose a higher one.
|
|
102
|
+
|
|
103
|
+
If the user DID supply a version, check it against `required_bump`. A version below it
|
|
104
|
+
(a patch over a complete feature set, or a minor/patch over a breaking change) is
|
|
105
|
+
refused, not confirmed: stop, say which set or breaking commit sets the floor, and ask
|
|
106
|
+
for a version at or above it (headless: stop and print the rerun command). A patch over
|
|
107
|
+
`feat` commits whose sets are all in progress is not a mismatch; note the in-progress
|
|
108
|
+
sets once and continue. The `release/X.Y` rules below take precedence on that branch.
|
|
109
|
+
|
|
110
|
+
Headless (no question tool or chat turn): treat every set as in progress, report the
|
|
111
|
+
sets in the proposal, and require the version as an argument as usual.
|
|
93
112
|
|
|
94
113
|
The release model (from `release-state.sh get`) decides how commit types map to the bump:
|
|
95
114
|
|
|
96
115
|
- **No RELEASING.md, or trunk-only:** the rules above apply as written. Every release is
|
|
97
|
-
cut from the trunk
|
|
98
|
-
requested over
|
|
116
|
+
cut from the trunk; a complete feature set makes the next release a minor, and a
|
|
117
|
+
patch requested over a complete set is refused.
|
|
99
118
|
- **release-branches, on `release/X.Y`:** the branch bounds the bump to the next
|
|
100
119
|
`X.Y.Z` patch. Everything on the branch is a deliberate backport, so a `feat:`
|
|
101
120
|
cherry-pick is expected and does NOT raise the mismatch concern or make it a minor.
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# merge-children.sh — DEPRECATED compatibility shim (issue #80, single worktree
|
|
3
|
-
# contract). Does NOT merge branches, remove worktrees, or delete branches.
|
|
4
|
-
#
|
|
5
|
-
# The historical behavior (fan-in merge from per-task child worktrees) was
|
|
6
|
-
# unsafe and is removed. Callers that still invoke this script get an explicit
|
|
7
|
-
# deprecation message on stderr, confirmation that the feature worktree exists
|
|
8
|
-
# (when it does), and exit 0 so orchestration does not break before skills are
|
|
9
|
-
# updated.
|
|
10
|
-
#
|
|
11
|
-
# Usage: merge-children.sh <repo-name> <feature-slug> <task-id>[,<task-id>,...]
|
|
12
|
-
# (task-ids are accepted for argument compatibility; they are not used)
|
|
13
|
-
#
|
|
14
|
-
# Exit codes:
|
|
15
|
-
# 0 always (shim: no fan-in, no errors from missing children)
|
|
16
|
-
|
|
17
|
-
set -euo pipefail
|
|
18
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
19
|
-
|
|
20
|
-
usage() {
|
|
21
|
-
cat >&2 <<'EOF'
|
|
22
|
-
Usage: merge-children.sh <repo-name> <feature-slug> <task-id>[,<task-id>,...]
|
|
23
|
-
|
|
24
|
-
DEPRECATED: This script is a no-op. ycc uses one feature worktree per run; there
|
|
25
|
-
is no per-task child merge. Remove calls to merge-children.sh in favor of working
|
|
26
|
-
entirely in the path printed by: setup-worktree.sh parent <repo> <feature-slug>
|
|
27
|
-
EOF
|
|
28
|
-
printf '\nSee: %s\n' "${SCRIPT_DIR}/../references/worktree-strategy.md" >&2
|
|
29
|
-
exit 1
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
feature_worktree_status() {
|
|
33
|
-
local parent_path="$1"
|
|
34
|
-
if [[ -d "${parent_path}" ]] && git -C "${parent_path}" rev-parse --git-dir >/dev/null 2>&1; then
|
|
35
|
-
echo "OK: feature worktree present at ${parent_path}" >&2
|
|
36
|
-
echo "STATUS:feature_worktree=present path=${parent_path}" >&2
|
|
37
|
-
return 0
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
echo "merge-children.sh: NOTICE: feature worktree not found or not a git checkout: ${parent_path}" >&2
|
|
41
|
-
echo "STATUS:feature_worktree=missing path=${parent_path}" >&2
|
|
42
|
-
return 1
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
# shellcheck source=worktree-paths.sh
|
|
46
|
-
source "${SCRIPT_DIR}/worktree-paths.sh"
|
|
47
|
-
|
|
48
|
-
main() {
|
|
49
|
-
if [[ $# -ne 3 ]]; then
|
|
50
|
-
echo "ERROR: expected 3 arguments, got $#" >&2
|
|
51
|
-
usage
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
local repo_name="$1"
|
|
55
|
-
local feature_slug="$2"
|
|
56
|
-
local _raw_task_ids="$3"
|
|
57
|
-
|
|
58
|
-
if [[ -z "${repo_name}" || -z "${feature_slug}" || -z "${_raw_task_ids}" ]]; then
|
|
59
|
-
echo "ERROR: repo-name, feature-slug, and task-id list must be non-empty" >&2
|
|
60
|
-
usage
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
local repo_root
|
|
64
|
-
repo_root="$(ycc_repo_root)"
|
|
65
|
-
|
|
66
|
-
local parent_path
|
|
67
|
-
parent_path="$(ycc_feature_worktree_path "$repo_root" "$repo_name" "$feature_slug")"
|
|
68
|
-
|
|
69
|
-
echo "merge-children.sh: DEPRECATED: no-op (single worktree contract). Task IDs ignored: ${_raw_task_ids}" >&2
|
|
70
|
-
echo "merge-children.sh: Do not rely on child worktrees or fan-in merge. Use only: ${parent_path}" >&2
|
|
71
|
-
|
|
72
|
-
if ! feature_worktree_status "${parent_path}"; then
|
|
73
|
-
if [[ "${YCC_MERGE_CHILDREN_REQUIRE_FEATURE_WORKTREE:-0}" == "1" ]]; then
|
|
74
|
-
echo "merge-children.sh: strict mode enabled; failing because feature worktree is unavailable" >&2
|
|
75
|
-
exit 2
|
|
76
|
-
fi
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
exit 0
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
main "$@"
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# {{PROJECT_NAME}} Documentation
|
|
2
|
-
|
|
3
|
-
Welcome to the {{PROJECT_NAME}} documentation.
|
|
4
|
-
|
|
5
|
-
## Quick Links
|
|
6
|
-
|
|
7
|
-
{{#if HAS_ARCHITECTURE}}
|
|
8
|
-
|
|
9
|
-
- [Architecture Overview](architecture/overview.md)
|
|
10
|
-
{{/if}}
|
|
11
|
-
{{#if HAS_API}}
|
|
12
|
-
- [API Reference](api/README.md)
|
|
13
|
-
{{/if}}
|
|
14
|
-
{{#if HAS_FEATURES}}
|
|
15
|
-
- [Feature Guides](features/README.md)
|
|
16
|
-
{{/if}}
|
|
17
|
-
{{#if HAS_DEVELOPMENT}}
|
|
18
|
-
- [Developer Guide](development/README.md)
|
|
19
|
-
{{/if}}
|
|
20
|
-
|
|
21
|
-
## Documentation Map
|
|
22
|
-
|
|
23
|
-
{{NAVIGATION_TREE}}
|
|
24
|
-
|
|
25
|
-
## Recently Updated
|
|
26
|
-
|
|
27
|
-
{{#each RECENT_FILES}}
|
|
28
|
-
|
|
29
|
-
- [{{this.title}}]({{this.path}}) - _{{this.date}}_
|
|
30
|
-
{{/each}}
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
_Last updated: {{GENERATED_DATE}}_
|