Skip to content

armgit / cogit

Public Imported from GitHub
0

Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.

fix(build): download the team's sessions on a manual cogit build

Eren002a8ccf750c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5340680..c429e50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A map with thousands of sessions no longer freezes on "Unfold all" and "Fold all": only the open sessions near the screen are drawn, and the session list no longer does quadratic work (10,000 sessions: 11 s down to 2 s).
- `cogit init --help` and `cogit config git --help` named the removed `commit` policy; they now say `share` or `ignore`.
- `cogit pr` and `cogit show <sha>` no longer tell a reviewer that a teammate's thought is "not recorded yet" when it may never arrive: for someone else's commit they say it is not in this clone's record, because its author has not pushed it or it came from a fork.
+- `cogit build` in a fresh clone of a shared project downloads the team's sessions first, instead of writing an empty map.
## [1.0.0] - 2026-11-04
### Changed
diff --git a/packages/cli/src/program.ts b/packages/cli/src/program.ts
index ce59576..38baf25 100644
--- a/packages/cli/src/program.ts
+++ b/packages/cli/src/program.ts
@@ -453,7 +453,11 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =
.addHelpText("after", examples("cogit build", "cogit build ../my-app --quiet"))
.action(
run(async (dir: string, opts: { quiet?: boolean }) => {
- await buildProject({ dir, io: makeIo(false), quiet: opts.quiet === true });
+ const io = makeIo(false);
+ // A person in a fresh clone gets the team's sessions, not an empty map; the
+ // quiet build after every turn stays local.
+ if (opts.quiet !== true) await readyToRead(dir, io);
+ await buildProject({ dir, io, quiet: opts.quiet === true });
}),
);
diff --git a/packages/cli/test/record-sync.test.ts b/packages/cli/test/record-sync.test.ts
index 863614e..4a99f80 100644
--- a/packages/cli/test/record-sync.test.ts
+++ b/packages/cli/test/record-sync.test.ts
@@ -10,6 +10,7 @@ import { pruneCutoff, pruneRecords } from "../src/commands/prune.js";
import { cogitGitignore } from "../src/git.js";
import { installGitHooks, runGitHook } from "../src/git-hooks.js";
import { runHook } from "../src/hooks/run.js";
+import { createProgram } from "../src/program.js";
import { prepareRecords } from "../src/record-prepare.js";
import {
addRecordRefspec,
@@ -311,6 +312,23 @@ describe("the record on its own refs", () => {
expect((await recordSyncStatus(bob, env)).downloadError).toBeUndefined();
});
+ it("downloads on a person's cogit build, but not on the quiet build after a turn", async () => {
+ await record(alice, "s1", "First", "[email protected]");
+ await push(alice);
+ const build = async (root: string, ...flags: string[]): Promise<void> => {
+ const program = createProgram(() => fakeIo(env));
+ program.exitOverride().configureOutput({ writeErr: () => {}, writeOut: () => {} });
+ await program.parseAsync(["build", root, ...flags], { from: "user" });
+ };
+ const quiet = await cloneAs("quiet");
+ await build(quiet, "--quiet");
+ expect(await title(quiet, "s1")).toBeUndefined();
+ const bob = await cloneAs("bob");
+ await build(bob);
+ expect(await title(bob, "s1")).toBe("First");
+ expect(await readFile(join(bob, ".cogit", "map.html"), "utf8")).toContain("First");
+ });
+
it("adds the refspec once, in this clone's config only", async () => {
const bob = await cloneAs("bob");
expect(await addRecordRefspec(bob, env)).toBe(true);