Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

fix(core): retain commit and detached facts in one query [C7]

Corey Olsonb5ef44655d58
diff --git a/src/git.js b/src/git.js
index 6b782030..7a54a328 100644
--- a/src/git.js
+++ b/src/git.js
@@ -541,17 +541,17 @@ export function repoInfo(cwd, { env } = {}) {
*/
function readRepoInfo(cwd, env) {
const combined = !env && gitFacts.getStore()?.active && plainRepositoryEnvironment();
- const primary = combined ? ['HEAD', 'main-worktree/HEAD', '--symbolic-full-name', 'main-worktree/HEAD'] : [];
+ const primary = combined ? ['HEAD^{commit}', 'main-worktree/HEAD^{commit}', '--symbolic-full-name', 'main-worktree/HEAD'] : [];
const info = tryGit(cwd, ['rev-parse', '--path-format=absolute', '--show-toplevel', '--git-dir', '--git-common-dir', ...primary], { env });
// An unborn branch here or in the primary checkout fails the combined call after the paths; ask for the paths alone.
if (combined && info.status !== 0 && info.stdout) return readRepoInfo(cwd, process.env);
const fields = info.stdout.split('\n');
- if (combined && info.status === 0 && fields.length === 6 && fields.every(Boolean)) {
+ if (combined && info.status === 0 && [5, 6].includes(fields.length) && fields.slice(0, 5).every(Boolean)) {
const [root, , , head, commit, branch] = fields;
const { facts } = gitFacts.getStore();
facts.set(`headCommit:${resolve(root)}`, head);
// A detached primary checkout names no branch, as symbolic-ref reports it.
- facts.set(`mainCheckout:${resolve(root)}`, branch.startsWith('refs/') ? { branch, commit } : null);
+ facts.set(`mainCheckout:${resolve(root)}`, branch?.startsWith('refs/') ? { branch, commit } : null);
fields.length = 3;
}
if (info.status !== 0 || fields.length !== 3 || fields.some((field) => !field)) {