@wipcomputer/wip-release 1.9.9 → 1.9.11

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 (2) hide show
  1. package/cli.js +28 -14
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -25,14 +25,21 @@ const notesFilePath = flag('notes-file');
25
25
  let notes = flag('notes');
26
26
  let notesSource = notes ? 'flag' : 'none'; // track where notes came from
27
27
 
28
- // Auto-detect RELEASE-NOTES-v{version}.md if no --notes or --notes-file provided.
29
- // Also supports explicit --notes-file for custom paths.
28
+ // Release notes priority (highest wins):
29
+ // 1. --notes-file=path Explicit file path (always wins)
30
+ // 2. RELEASE-NOTES-v{ver}.md In repo root (always wins over --notes flag)
31
+ // 3. ai/dev-updates/YYYY-MM-DD* Today's dev update (wins over --notes flag if longer)
32
+ // 4. --notes="text" Flag fallback (only if nothing better exists)
33
+ //
34
+ // Rule: written release notes on disk ALWAYS beat a CLI one-liner.
35
+ // The --notes flag is a fallback, not an override.
30
36
  {
31
37
  const { readFileSync, existsSync } = await import('node:fs');
32
38
  const { resolve, join } = await import('node:path');
39
+ const flagNotes = notes; // save original flag value for fallback
33
40
 
34
41
  if (notesFilePath) {
35
- // Explicit --notes-file
42
+ // 1. Explicit --notes-file (highest priority)
36
43
  const resolved = resolve(notesFilePath);
37
44
  if (!existsSync(resolved)) {
38
45
  console.error(` ✗ Notes file not found: ${resolved}`);
@@ -40,8 +47,8 @@ let notesSource = notes ? 'flag' : 'none'; // track where notes came from
40
47
  }
41
48
  notes = readFileSync(resolved, 'utf8').trim();
42
49
  notesSource = 'file';
43
- } else if (!notes && level) {
44
- // Auto-detect: compute the next version and look for RELEASE-NOTES-v{version}.md
50
+ } else if (level) {
51
+ // 2. Auto-detect RELEASE-NOTES-v{version}.md (ALWAYS checks, even if --notes provided)
45
52
  try {
46
53
  const { detectCurrentVersion, bumpSemver } = await import('./core.mjs');
47
54
  const cwd = process.cwd();
@@ -50,15 +57,19 @@ let notesSource = notes ? 'flag' : 'none'; // track where notes came from
50
57
  const dashed = newVersion.replace(/\./g, '-');
51
58
  const autoFile = join(cwd, `RELEASE-NOTES-v${dashed}.md`);
52
59
  if (existsSync(autoFile)) {
53
- notes = readFileSync(autoFile, 'utf8').trim();
60
+ const fileContent = readFileSync(autoFile, 'utf8').trim();
61
+ if (flagNotes && flagNotes !== fileContent) {
62
+ console.log(` ! --notes flag ignored: RELEASE-NOTES-v${dashed}.md takes priority`);
63
+ }
64
+ notes = fileContent;
54
65
  notesSource = 'file';
55
66
  console.log(` ✓ Found RELEASE-NOTES-v${dashed}.md`);
56
67
  }
57
68
  } catch {}
58
69
  }
59
70
 
60
- // Auto-detect dev update from ai/dev-updates/ if notes are missing or thin
61
- if (level && (!notes || notes.length < 100)) {
71
+ // 3. Auto-detect dev update from ai/dev-updates/ (wins over --notes flag if longer)
72
+ if (level && (!notes || (notesSource === 'flag' && notes.length < 200))) {
62
73
  try {
63
74
  const { readdirSync } = await import('node:fs');
64
75
  const devUpdatesDir = join(process.cwd(), 'ai', 'dev-updates');
@@ -73,6 +84,9 @@ let notesSource = notes ? 'flag' : 'none'; // track where notes came from
73
84
  const devUpdatePath = join(devUpdatesDir, todayFiles[0]);
74
85
  const devUpdateContent = readFileSync(devUpdatePath, 'utf8').trim();
75
86
  if (devUpdateContent.length > (notes || '').length) {
87
+ if (flagNotes) {
88
+ console.log(` ! --notes flag ignored: dev update takes priority`);
89
+ }
76
90
  notes = devUpdateContent;
77
91
  notesSource = 'dev-update';
78
92
  console.log(` ✓ Found dev update: ai/dev-updates/${todayFiles[0]}`);
@@ -104,12 +118,12 @@ Flags:
104
118
  --skip-stale-check Skip stale remote branch check
105
119
  --skip-worktree-check Skip worktree guard (allow release from worktree)
106
120
 
107
- Release notes:
108
- Auto-detects notes from three sources (first match wins):
109
- 1. --notes-file=path Explicit file path
110
- 2. RELEASE-NOTES-v{ver}.md In repo root (e.g. RELEASE-NOTES-v1-7-4.md)
111
- 3. ai/dev-updates/YYYY-MM-DD* Today's dev update files (most recent first)
112
- Write dev updates as you work. wip-release picks them up automatically.
121
+ Release notes (highest priority wins, files ALWAYS beat --notes flag):
122
+ 1. --notes-file=path Explicit file path (always wins)
123
+ 2. RELEASE-NOTES-v{ver}.md In repo root (wins over --notes)
124
+ 3. ai/dev-updates/YYYY-MM-DD* Today's dev update (wins over --notes if longer)
125
+ 4. --notes="text" Fallback only (use for repos without release notes files)
126
+ Written notes on disk always take priority over a CLI one-liner.
113
127
 
114
128
  Pipeline:
115
129
  1. Bump package.json version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-release",
3
- "version": "1.9.9",
3
+ "version": "1.9.11",
4
4
  "type": "module",
5
5
  "description": "One-command release pipeline. Bumps version, updates changelog + SKILL.md, publishes to npm + GitHub.",
6
6
  "main": "core.mjs",