@wipcomputer/wip-release 1.9.8 → 1.9.9
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/cli.js +3 -0
- package/core.mjs +31 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -20,6 +20,7 @@ const dryRun = args.includes('--dry-run');
|
|
|
20
20
|
const noPublish = args.includes('--no-publish');
|
|
21
21
|
const skipProductCheck = args.includes('--skip-product-check');
|
|
22
22
|
const skipStaleCheck = args.includes('--skip-stale-check');
|
|
23
|
+
const skipWorktreeCheck = args.includes('--skip-worktree-check');
|
|
23
24
|
const notesFilePath = flag('notes-file');
|
|
24
25
|
let notes = flag('notes');
|
|
25
26
|
let notesSource = notes ? 'flag' : 'none'; // track where notes came from
|
|
@@ -101,6 +102,7 @@ Flags:
|
|
|
101
102
|
--no-publish Bump + tag only, skip npm/GitHub
|
|
102
103
|
--skip-product-check Skip product docs check (dev update, roadmap, readme-first)
|
|
103
104
|
--skip-stale-check Skip stale remote branch check
|
|
105
|
+
--skip-worktree-check Skip worktree guard (allow release from worktree)
|
|
104
106
|
|
|
105
107
|
Release notes:
|
|
106
108
|
Auto-detects notes from three sources (first match wins):
|
|
@@ -130,6 +132,7 @@ release({
|
|
|
130
132
|
noPublish,
|
|
131
133
|
skipProductCheck,
|
|
132
134
|
skipStaleCheck,
|
|
135
|
+
skipWorktreeCheck,
|
|
133
136
|
}).catch(err => {
|
|
134
137
|
console.error(` ✗ ${err.message}`);
|
|
135
138
|
process.exit(1);
|
package/core.mjs
CHANGED
|
@@ -552,7 +552,7 @@ export function checkStaleBranches(repoPath, level) {
|
|
|
552
552
|
/**
|
|
553
553
|
* Run the full release pipeline.
|
|
554
554
|
*/
|
|
555
|
-
export async function release({ repoPath, level, notes, notesSource, dryRun, noPublish, skipProductCheck, skipStaleCheck }) {
|
|
555
|
+
export async function release({ repoPath, level, notes, notesSource, dryRun, noPublish, skipProductCheck, skipStaleCheck, skipWorktreeCheck }) {
|
|
556
556
|
repoPath = repoPath || process.cwd();
|
|
557
557
|
const currentVersion = detectCurrentVersion(repoPath);
|
|
558
558
|
const newVersion = bumpSemver(currentVersion, level);
|
|
@@ -562,6 +562,36 @@ export async function release({ repoPath, level, notes, notesSource, dryRun, noP
|
|
|
562
562
|
console.log(` ${repoName}: ${currentVersion} -> ${newVersion} (${level})`);
|
|
563
563
|
console.log(` ${'─'.repeat(40)}`);
|
|
564
564
|
|
|
565
|
+
// -1. Worktree guard: block releases from linked worktrees
|
|
566
|
+
if (!skipWorktreeCheck) {
|
|
567
|
+
try {
|
|
568
|
+
const gitDir = execFileSync('git', ['rev-parse', '--git-dir'], {
|
|
569
|
+
cwd: repoPath, encoding: 'utf8'
|
|
570
|
+
}).trim();
|
|
571
|
+
|
|
572
|
+
// Linked worktrees have "/worktrees/" in their git-dir path
|
|
573
|
+
if (gitDir.includes('/worktrees/')) {
|
|
574
|
+
// Get the main working tree path from `git worktree list`
|
|
575
|
+
const worktreeList = execFileSync('git', ['worktree', 'list', '--porcelain'], {
|
|
576
|
+
cwd: repoPath, encoding: 'utf8'
|
|
577
|
+
});
|
|
578
|
+
const mainWorktree = worktreeList.split('\n')
|
|
579
|
+
.find(line => line.startsWith('worktree '));
|
|
580
|
+
const mainPath = mainWorktree ? mainWorktree.replace('worktree ', '') : '(unknown)';
|
|
581
|
+
|
|
582
|
+
console.log(` \u2717 wip-release must run from the main working tree, not a worktree.`);
|
|
583
|
+
console.log(` Current: ${repoPath}`);
|
|
584
|
+
console.log(` Main working tree: ${mainPath}`);
|
|
585
|
+
console.log(` Switch to the main working tree and run again.`);
|
|
586
|
+
console.log('');
|
|
587
|
+
return { currentVersion, newVersion, dryRun: false, failed: true };
|
|
588
|
+
}
|
|
589
|
+
console.log(' \u2713 Running from main working tree');
|
|
590
|
+
} catch {
|
|
591
|
+
// Git command failed... skip check gracefully
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
565
595
|
// 0. License compliance gate
|
|
566
596
|
const configPath = join(repoPath, '.license-guard.json');
|
|
567
597
|
if (existsSync(configPath)) {
|
package/package.json
CHANGED