@brainervirus/workit-core 8.12.1 → 8.12.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-core",
3
- "version": "8.12.1",
3
+ "version": "8.12.2",
4
4
  "private": false,
5
5
  "description": "Workit shared core — task, policy, evidence, review, decision, worker, and writer state for agentic coding workflows",
6
6
  "keywords": [
package/src/autonomy.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  // a process that drives a pseudo-terminal or edits the file directly can
15
15
  // still defeat it; the host's permission prompt is the hard boundary.
16
16
  // - `release` gates `workit git push --release`: pushing the git-flow
17
- // production and develop branches (fast-forward only) and `v*` tags whose
17
+ // production and develop branches (fast-forward only) and release tags (`v*` or git-flow's prefix) whose
18
18
  // commit already landed (a tag never moves). Outside git-flow it pushes
19
19
  // tags only. It needs `push` too.
20
20
  // - Defaults (D4) when a kind is absent: push, pr and rerun are allowed;
package/src/git/ops.ts CHANGED
@@ -1138,12 +1138,22 @@ export type ReleasePushPlan = Omit<PushPlan, "branch" | "sha"> & {
1138
1138
  production: string | null;
1139
1139
  };
1140
1140
 
1141
- /** A release tag: `v` and a digit (`v4.1.0`, `v2`). */
1142
- const RELEASE_TAG = /^v\d/u;
1141
+ /**
1142
+ * The release tag prefix: git-flow's own `gitflow.prefix.versiontag` when the
1143
+ * repository sets it (an empty value means bare `4.1.0` tags), else `v`.
1144
+ */
1145
+ const releaseTagPrefix = (cwd: string): string => {
1146
+ const configured = git(cwd, ["config", "--get", "gitflow.prefix.versiontag"]);
1147
+ return configured.ok ? configured.stdout.trim() : "v";
1148
+ };
1149
+
1150
+ /** A release tag: the prefix and a digit (`v4.1.0`, `v2`, or `4.1.0` with an empty prefix). */
1151
+ const isReleaseTag = (name: string, prefix: string): boolean =>
1152
+ name.startsWith(prefix) && /^\d/u.test(name.slice(prefix.length));
1143
1153
 
1144
1154
  /**
1145
1155
  * What `workit git push --release` may push: the git-flow production and
1146
- * develop branches and `v*` tags, nothing else, each by its local ref. Everything else stays on the feature-branch
1156
+ * develop branches and release tags (`v*`, or git-flow's configured prefix), nothing else, each by its local ref. Everything else stays on the feature-branch
1147
1157
  * path (`workit git push`, `workit pr create`).
1148
1158
  */
1149
1159
  export function releasePushPreflight(
@@ -1172,11 +1182,12 @@ export function releasePushPreflight(
1172
1182
  `workit git push --release refs/heads/${raw} # or refs/tags/${raw}`,
1173
1183
  );
1174
1184
  if (tag) {
1175
- if (!RELEASE_TAG.test(tagName))
1185
+ const prefix = releaseTagPrefix(cwd);
1186
+ if (!isReleaseTag(tagName, prefix))
1176
1187
  return failure(
1177
1188
  "blocked",
1178
- `release_push_refused: tag ${tagName} is not a release tag (v<version>)`,
1179
- "git tag -a v<version> -m <message> # then: workit git push --release v<version>",
1189
+ `release_push_refused: tag ${tagName} is not a release tag (${prefix}<version>, from ${prefix === "v" ? "the default" : "gitflow.prefix.versiontag"})`,
1190
+ `git tag -a ${prefix}<version> -m <message> # then: workit git push --release ${prefix}<version>`,
1180
1191
  );
1181
1192
  refs.push({ kind: "tag", name: tagName, ref: `refs/tags/${tagName}`, sha: tag });
1182
1193
  continue;