dsh-advisor 0.1.3-alpha.2 → 0.1.3-alpha.4

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": "dsh-advisor",
3
- "version": "0.1.3-alpha.2",
3
+ "version": "0.1.3-alpha.4",
4
4
  "type": "module",
5
5
  "description": "dsh plugin bundle porting the omp advisor subsystem: a per-session reviewer model that observes the primary transcript and injects severity-ranked advice (nit/concern/blocker).",
6
6
  "repository": {
@@ -63,16 +63,42 @@ if (process.argv[2] !== undefined) {
63
63
  process.exit(1)
64
64
  }
65
65
  } else {
66
- const current = parseVersion(pkg.version)
67
- if (current === null) {
66
+ // Auto patch bump (mirrors sibling dsh-llm-fallbacks autoBumpPatch): parse
67
+ // the current version as X.Y.Z or X.Y.Z-pre, then:
68
+ // - formal version X.Y.Z -> X.Y.(Z+1) (0.1.2 -> 0.1.3)
69
+ // - prerelease with numeric tail -> bump only the tail, staying on the
70
+ // prerelease line (0.1.3-alpha.3 -> 0.1.3-alpha.4)
71
+ // - prerelease with non-numeric tail (e.g. 0.1.0-alpha) -> cannot auto
72
+ // bump; require an explicit version argument.
73
+ // The looser regex is deliberate: parseVersion (explicit args) requires a
74
+ // digit in the suffix, so it cannot tell "alpha" from a malformed version;
75
+ // this path needs the raw suffix to reject non-numeric tails with the
76
+ // explicit-version hint.
77
+ const m = /^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/.exec(pkg.version)
78
+ if (!m) {
68
79
  console.error(`Error: cannot parse current package.json version "${pkg.version}".`)
69
80
  process.exit(1)
70
81
  }
71
- // Auto patch bump: bump the numeric patch part and DROP any prerelease
72
- // suffix (a prerelease base 0.1.1-alpha.1 with no explicit arg -> 0.1.2,
73
- // i.e. the next formal patch after the 0.1.1 line). An explicit prerelease
74
- // argument is the way to prepare another prerelease (e.g. 0.1.1-alpha.2).
75
- target = { major: current.major, minor: current.minor, patch: current.patch + 1 }
82
+ const [, major, minor, patch, pre] = m
83
+ if (pre === undefined) {
84
+ target = { major: Number(major), minor: Number(minor), patch: Number(patch) + 1 }
85
+ } else {
86
+ const tail = pre.split('.').at(-1)
87
+ if (tail === undefined || !/^\d+$/.test(tail)) {
88
+ console.error(
89
+ `Error: cannot auto-bump "${pkg.version}": prerelease tail "${pre}" is not numeric. ` +
90
+ 'Pass an explicit version instead (e.g. `node scripts/prepare-release.mjs 0.1.1-alpha.1`).',
91
+ )
92
+ process.exit(1)
93
+ }
94
+ const prefix = pre.slice(0, pre.length - tail.length) // "alpha." for "alpha.1"
95
+ target = {
96
+ major: Number(major),
97
+ minor: Number(minor),
98
+ patch: Number(patch),
99
+ prerelease: `${prefix}${Number(tail) + 1}`,
100
+ }
101
+ }
76
102
  }
77
103
 
78
104
  const version =
@@ -153,11 +179,11 @@ function updateChangelog(version, notes) {
153
179
  } catch {
154
180
  content = CHANGELOG_HEADER
155
181
  }
156
- // A 0-byte CHANGELOG.md (e.g. manual truncation) is treated as missing:
157
- // an empty file must still bootstrap with the standard header, otherwise
158
- // the new section would land at the top with leading blank lines and no
159
- // `# Changelog` header.
160
- if (content === '') {
182
+ // A 0-byte or whitespace-only CHANGELOG.md (e.g. manual truncation) is
183
+ // treated as missing: such a file must still bootstrap with the standard
184
+ // header, otherwise the new section would land at the top with leading
185
+ // blank lines and no `# Changelog` header.
186
+ if (content.trim() === '') {
161
187
  content = CHANGELOG_HEADER
162
188
  }
163
189