The design language that makes your AI harness better at design.
JavaScript
An existing develop outranks a main-pointing origin/HEAD
Paul Bakause82653965c4f
diff --git a/skill/scripts/context-signals.mjs b/skill/scripts/context-signals.mjsindex d37610343..61763e1bb 100644--- a/skill/scripts/context-signals.mjs+++ b/skill/scripts/context-signals.mjs@@ -129,8 +129,13 @@ function gitSignals(cwd) {// The upstream tracks the actual merge target, so its own rev wins over// a possibly stale local branch of the same name.if (upstream) addCandidate(upstream.name, [upstream.rev]);+ // A develop branch marks a git-flow repo where features merge to develop+ // even when the platform default (origin/HEAD) was never flipped off+ // main; an existing develop therefore outranks the remote default. This+ // is #302's own repro shape, and repos without develop are unaffected.+ addCandidate('develop', ['develop', 'origin/develop']);if (remoteHead) addCandidate(remoteHead.name, [remoteHead.name, remoteHead.rev]);- for (const name of conventional) addCandidate(name, [name, `origin/${name}`]);+ for (const name of ['main', 'master']) addCandidate(name, [name, `origin/${name}`]);for (const c of candidates) {const rev = c.revs.find((r) => run(['rev-parse', '--verify', '--quiet', r]) !== null);if (rev) {diff --git a/tests/context-signals.test.mjs b/tests/context-signals.test.mjsindex 3631f8d48..432737282 100644--- a/tests/context-signals.test.mjs+++ b/tests/context-signals.test.mjs@@ -309,6 +309,31 @@ describe('gatherSignals', () => {assert.deepEqual(s.git.changedFiles, ['src/Hero.tsx']);});+ it('an existing develop outranks a main-pointing origin/HEAD (#302)', async () => {+ const { execFileSync } = await import('node:child_process');+ const git = (...args) => execFileSync('git', args, { cwd: scratch, stdio: 'ignore' });+ git('init', '-q', '-b', 'main');+ git('config', 'user.email', '[email protected]');+ git('config', 'user.name', 'Test');+ write('src/App.tsx', 'export default 1;\n');+ git('add', '.');+ git('commit', '-qm', 'init');+ git('branch', '-q', 'develop');+ // Classic git-flow with the platform default never flipped off main.+ git('update-ref', 'refs/remotes/origin/main', 'main');+ git('symbolic-ref', 'refs/remotes/origin/HEAD', 'refs/remotes/origin/main');+ git('checkout', '-q', 'develop');+ git('checkout', '-q', '-b', 'feature/g');+ write('src/Hero.tsx', 'export const Hero = () => null;\n');+ git('add', '.');+ git('commit', '-qm', 'feature work');+ const s = await gatherSignals(scratch);+ // Features merge to develop here; picking origin/HEAD's main would drag+ // the develop-vs-main divergence into scan targets.+ assert.equal(s.git.base, 'develop');+ assert.deepEqual(s.git.changedFiles, ['src/Hero.tsx']);+ });+it('remote signals cannot bypass the integration-branch guard (#302)', async () => {const { execFileSync } = await import('node:child_process');const git = (...args) => execFileSync('git', args, { cwd: scratch, stdio: 'ignore' });