opencode-github-release 0.4.2 → 0.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 +4 -0
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,6 +83,10 @@ Suggested bump: major -> v1.0.0
|
|
|
83
83
|
|
|
84
84
|
You can invoke `suggest_bump` directly at any time ("Suggest a bump") — it analyzes commits since the latest tag and recommends a bump without creating anything.
|
|
85
85
|
|
|
86
|
+
The `suggest_bump` tool works exceptionally well if your commit messages follow the [conventional commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
|
|
87
|
+
|
|
88
|
+
There are commit skills such as (https://github.com/PedroHBO/opencode-config-skills/tree/main/skills/git-commit) that makes it all automatic and seamless.
|
|
89
|
+
|
|
86
90
|
## Prerequisites
|
|
87
91
|
|
|
88
92
|
- [Git](https://git-scm.com/)
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,8 @@ var plugin = async ({ $ }) => {
|
|
|
36
36
|
suggest_bump: tool({
|
|
37
37
|
description: "Analyze git history since the latest tag and suggest a semantic version bump. Call this tool when the user asks to create a release but does NOT specify patch/minor/major or an explicit version string. After receiving the suggestion, present it to the user and ask for confirmation before calling create_release.",
|
|
38
38
|
args: {},
|
|
39
|
-
async execute(_args,
|
|
39
|
+
async execute(_args, context) {
|
|
40
|
+
context.metadata({ title: "Fetching tags\u2026" });
|
|
40
41
|
await $`git fetch --tags --force 2>/dev/null || true`.quiet();
|
|
41
42
|
const tagResult = await $`git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"`.text();
|
|
42
43
|
const latestTag = tagResult.trim();
|
|
@@ -89,11 +90,12 @@ var plugin = async ({ $ }) => {
|
|
|
89
90
|
notes: tool.schema.string().optional(),
|
|
90
91
|
force: tool.schema.boolean().optional()
|
|
91
92
|
},
|
|
92
|
-
async execute(args,
|
|
93
|
+
async execute(args, context) {
|
|
93
94
|
const { bump, version, notes, force } = args;
|
|
94
95
|
if (!bump && !version) {
|
|
95
96
|
throw new Error("Provide either `bump` (patch/minor/major) or an explicit `version` string");
|
|
96
97
|
}
|
|
98
|
+
context.metadata({ title: "Checking working tree\u2026" });
|
|
97
99
|
const status = (await $`git status --porcelain`.text()).trim();
|
|
98
100
|
if (status && !force) {
|
|
99
101
|
const count = status.split("\n").length;
|
|
@@ -102,6 +104,7 @@ var plugin = async ({ $ }) => {
|
|
|
102
104
|
output: `${count} uncommitted file(s) detected. Call create_release with force: true to proceed anyway, or commit/stash first.`
|
|
103
105
|
};
|
|
104
106
|
}
|
|
107
|
+
context.metadata({ title: "Fetching tags\u2026" });
|
|
105
108
|
await $`git fetch --tags --force 2>/dev/null || true`.quiet();
|
|
106
109
|
const tagResult = await $`git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"`.text();
|
|
107
110
|
const latestTag = tagResult.trim();
|
|
@@ -127,6 +130,7 @@ var plugin = async ({ $ }) => {
|
|
|
127
130
|
} else {
|
|
128
131
|
newTag = bumpVersion(latestTag, bump);
|
|
129
132
|
}
|
|
133
|
+
context.metadata({ title: `Bumping to ${newTag}\u2026` });
|
|
130
134
|
const branch = (await $`git rev-parse --abbrev-ref HEAD`.text()).trim();
|
|
131
135
|
let unpushedBefore = [];
|
|
132
136
|
if (branch !== "HEAD") {
|
|
@@ -146,11 +150,14 @@ var plugin = async ({ $ }) => {
|
|
|
146
150
|
await $`git commit -m ${`chore(release): bump version to ${newTag}`}`.quiet();
|
|
147
151
|
}
|
|
148
152
|
if (branch !== "HEAD") {
|
|
153
|
+
context.metadata({ title: "Pushing commits\u2026" });
|
|
149
154
|
await $`git push origin ${branch}`.quiet();
|
|
150
155
|
}
|
|
156
|
+
context.metadata({ title: "Tagging release\u2026" });
|
|
151
157
|
const message = notes || `Release ${newTag}`;
|
|
152
158
|
await $`git tag -a ${newTag} -m ${message}`.quiet();
|
|
153
159
|
await $`git push origin ${newTag}`.quiet();
|
|
160
|
+
context.metadata({ title: "Creating GitHub release\u2026" });
|
|
154
161
|
if (notes) {
|
|
155
162
|
await $`gh release create ${newTag} --title ${newTag} --notes ${notes}`.quiet();
|
|
156
163
|
} else {
|