code-foundry 0.30.4 → 0.31.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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/commands/release.mjs +23 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.31.0](https://github.com/0xPlayerOne/code-foundry/compare/v0.30.4...v0.31.0) (2026-07-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **release:** open safe staging sync PRs ([6adb1dc](https://github.com/0xPlayerOne/code-foundry/commit/6adb1dc63966e5bfe70deb3ccd3c3aa5e93ccfad))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **release:** compare promoted branch tips ([081666b](https://github.com/0xPlayerOne/code-foundry/commit/081666b774418ab333d34eb9a3ca2a8c3bd60c78))
|
|
14
|
+
|
|
3
15
|
## [0.30.4](https://github.com/0xPlayerOne/code-foundry/compare/v0.30.3...v0.30.4) (2026-07-29)
|
|
4
16
|
|
|
5
17
|
|
package/package.json
CHANGED
package/src/commands/release.mjs
CHANGED
|
@@ -22,8 +22,12 @@ export function reconcileRelease(root, options) {
|
|
|
22
22
|
const mainSha = git(target, ['rev-parse', `origin/${base}`]) || git(target, ['rev-parse', base])
|
|
23
23
|
const stagingSha = git(target, ['rev-parse', `origin/${head}`]) || git(target, ['rev-parse', head])
|
|
24
24
|
const mergeBaseSha = git(target, ['merge-base', mainSha, stagingSha])
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// Compare the branch tips directly. Release Please may rebase or recreate
|
|
26
|
+
// commits during promotion, leaving equivalent code with different ancestry.
|
|
27
|
+
// Comparing both tips preserves the fail-closed behavior for real content
|
|
28
|
+
// differences without mistaking that normal history rewrite for a change.
|
|
29
|
+
const mainChangedPaths = diffNames(target, stagingSha, mainSha)
|
|
30
|
+
const stagingChangedPaths = diffNames(target, mainSha, stagingSha)
|
|
27
31
|
const plan = classifyReconciliation({
|
|
28
32
|
mainSha,
|
|
29
33
|
stagingSha,
|
|
@@ -34,6 +38,23 @@ export function reconcileRelease(root, options) {
|
|
|
34
38
|
})
|
|
35
39
|
console.log(JSON.stringify({ base, head, ...plan }, null, 2))
|
|
36
40
|
if (plan.action === 'fail') throw new Error(plan.reason + (plan.unexpected?.length ? ` Unexpected paths: ${plan.unexpected.join(', ')}` : ''))
|
|
41
|
+
if (plan.action === 'pull-request' && options.github && !options.dryRun) {
|
|
42
|
+
if (!process.env.GITHUB_REPOSITORY) throw new Error('GITHUB_REPOSITORY is required for synchronization PRs.')
|
|
43
|
+
const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN
|
|
44
|
+
if (!token) throw new Error('GH_TOKEN or GITHUB_TOKEN is required for synchronization PRs.')
|
|
45
|
+
const existing = ghJson(target, ['pr', 'list', '--repo', process.env.GITHUB_REPOSITORY, '--state', 'open', '--base', head, '--head', base, '--json', 'number,url'])
|
|
46
|
+
if (Array.isArray(existing) && existing.length) {
|
|
47
|
+
return { ...plan, synchronizationPullRequest: existing[0].url ?? existing[0].number }
|
|
48
|
+
}
|
|
49
|
+
const result = spawnSync('gh', [
|
|
50
|
+
'pr', 'create', '--repo', process.env.GITHUB_REPOSITORY,
|
|
51
|
+
'--base', head, '--head', base,
|
|
52
|
+
'--title', `chore(release): synchronize ${base} -> ${head}`,
|
|
53
|
+
'--body', `Synchronize ${head} with ${base} after Release Please publication.\n\nOnly approved release metadata differs between the branch tips; Code Foundry verified the content before opening this PR.`,
|
|
54
|
+
], { cwd: resolve(root), encoding: 'utf8', env: { ...process.env, GH_TOKEN: token } })
|
|
55
|
+
if (result.status !== 0) throw new Error(`Failed to create synchronization PR: ${result.stderr.trim()}`)
|
|
56
|
+
return { ...plan, synchronizationPullRequest: result.stdout.trim() }
|
|
57
|
+
}
|
|
37
58
|
if (plan.action !== 'fast-forward' || !options.github || options.dryRun) return plan
|
|
38
59
|
if (!process.env.GITHUB_REPOSITORY) throw new Error('GITHUB_REPOSITORY is required for --github reconciliation.')
|
|
39
60
|
const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN
|