Skip to content

Commit 0b042f5

Browse files
test: migrate references from git-agent to ai-commit
- Updated tests to use .ai-commit config paths - Adjusted file and hook references to ai-commit - Renamed temp dirs and repo scaffolding prefixes - Aligned CLI messages and outputs with ai-commit naming - Updated test fixtures and helpers accordingly tests and helpers were updated to replace git-agent with ai-commit naming and paths, ensuring consistency across tests and fixtures. Co-Authored-By: Ai Commit <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 65ce470 commit 0b042f5

10 files changed

Lines changed: 45 additions & 45 deletions

tests/cli-integration-git.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const seedGitRepoWithScopes = Effect.fn(function* () {
2727
const repo = yield* seedGitRepo();
2828
yield* writeTextFile(
2929
repo,
30-
".git-agent/config.yml",
30+
".ai-commit/config.yml",
3131
projectScopesConfig([
3232
["api", "Backend API handlers"],
3333
["web", "Frontend pages"],
@@ -70,7 +70,7 @@ describe.concurrent("CLI integration (git)", () => {
7070

7171
expect(result.exitCode).toBe(0);
7272
expect(result.stdout).toContain("scopes written");
73-
const config = yield* readTextFile(repo, ".git-agent/config.yml");
73+
const config = yield* readTextFile(repo, ".ai-commit/config.yml");
7474
expect(config).toContain("name: api");
7575
expect(config).toContain("description: Backend API handlers");
7676
expect(config).toContain("name: web");
@@ -118,7 +118,7 @@ describe.concurrent("CLI integration (git)", () => {
118118
expect(result.exitCode).toBe(0);
119119
expect(result.stdout).toContain(".gitignore updated: node, visualstudiocode");
120120
const content = yield* readTextFile(repo, ".gitignore");
121-
expect(content).toContain("### git-agent auto-generated");
121+
expect(content).toContain("### ai-commit auto-generated");
122122
expect(content).toContain("# Technologies: node, visualstudiocode");
123123
expect(content).toContain("node_modules/");
124124
expect(content).toContain(".vscode/");
@@ -331,7 +331,7 @@ describe.concurrent("CLI integration (git)", () => {
331331

332332
expect(result.exitCode).toBe(0);
333333
expect(result.stdout).toContain("feat(api): update routes");
334-
expect(yield* fileExists(repo, ".git-agent/config.yml")).toBe(false);
334+
expect(yield* fileExists(repo, ".ai-commit/config.yml")).toBe(false);
335335
expect(llm.requests).toHaveLength(3);
336336
}),
337337
);
@@ -430,7 +430,7 @@ describe.concurrent("CLI integration (git)", () => {
430430
const repo = yield* createGitRepo();
431431
yield* writeTextFile(
432432
repo,
433-
".git-agent/config.yml",
433+
".ai-commit/config.yml",
434434
"scopes:\n - name: core\n description: Shared application logic\nhook:\n - conventional\n",
435435
);
436436
yield* writeTextFile(repo, "src/app.ts", "export const value = 'base';\n");
@@ -586,7 +586,7 @@ describe.concurrent("CLI integration (git)", () => {
586586
const repo = yield* createGitRepo();
587587
yield* writeTextFile(
588588
repo,
589-
".git-agent/config.yml",
589+
".ai-commit/config.yml",
590590
"scopes:\n - name: core\n description: Shared application logic\nhook:\n - conventional\n",
591591
);
592592
yield* writeTextFile(repo, "src/app.ts", "export const value = 'base';\n");

tests/cli-integration-jj.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ const seedJjRepoWithScopes = Effect.fn(function* () {
2626
const repo = yield* seedJjRepo();
2727
yield* writeTextFile(
2828
repo,
29-
".git-agent/config.yml",
29+
".ai-commit/config.yml",
3030
projectScopesConfig([
3131
["cli", "Command line flows"],
3232
["core", "Shared application logic"],
3333
]),
3434
);
35-
yield* jjCommitAll(repo, "chore: add repo config", [".git-agent/config.yml"]);
35+
yield* jjCommitAll(repo, "chore: add repo config", [".ai-commit/config.yml"]);
3636
return repo;
3737
});
3838

@@ -75,7 +75,7 @@ describe.concurrent("CLI integration (jj)", () => {
7575
expect(result.stdout).toContain(".gitignore updated: node");
7676
expect(result.stdout).toContain("scopes written");
7777

78-
const config = yield* readTextFile(repo, ".git-agent/config.yml");
78+
const config = yield* readTextFile(repo, ".ai-commit/config.yml");
7979
const ignore = yield* readTextFile(repo, ".gitignore");
8080
expect(config).toContain("name: core");
8181
expect(config).toContain("hook:");
@@ -345,11 +345,11 @@ describe.concurrent("CLI integration (jj)", () => {
345345
const repo = yield* createJjRepo();
346346
yield* writeTextFile(
347347
repo,
348-
".git-agent/config.yml",
348+
".ai-commit/config.yml",
349349
"scopes:\n - name: core\n description: Shared application logic\nhook:\n - conventional\n",
350350
);
351351
yield* writeTextFile(repo, "src/app.ts", "export const value = 'base';\n");
352-
yield* jjCommitAll(repo, "chore: seed repo", [".git-agent/config.yml", "src/app.ts"]);
352+
yield* jjCommitAll(repo, "chore: seed repo", [".ai-commit/config.yml", "src/app.ts"]);
353353
yield* writeTextFile(repo, "src/app.ts", "export const value = 'next';\n");
354354

355355
const firstTitle =
@@ -412,11 +412,11 @@ describe.concurrent("CLI integration (jj)", () => {
412412
const repo = yield* createJjRepo();
413413
yield* writeTextFile(
414414
repo,
415-
".git-agent/config.yml",
415+
".ai-commit/config.yml",
416416
"scopes:\n - name: core\n description: Shared application logic\nhook:\n - conventional\n",
417417
);
418418
yield* writeTextFile(repo, "src/app.ts", "export const value = 'base';\n");
419-
yield* jjCommitAll(repo, "chore: seed repo", [".git-agent/config.yml", "src/app.ts"]);
419+
yield* jjCommitAll(repo, "chore: seed repo", [".ai-commit/config.yml", "src/app.ts"]);
420420
yield* writeTextFile(repo, "src/app.ts", "export const value = 'next';\n");
421421

422422
const badMessage = {

tests/cli-integration.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ describe.concurrent("CLI integration", () => {
1616
"get prefers local hook over project hook",
1717
Effect.fn(function* () {
1818
const repo = yield* createGitRepo();
19-
yield* writeTextFile(repo, ".git-agent/config.yml", "hook:\n - conventional\n");
20-
yield* writeTextFile(repo, ".git-agent/config.local.yml", "hook:\n - empty\n");
19+
yield* writeTextFile(repo, ".ai-commit/config.yml", "hook:\n - conventional\n");
20+
yield* writeTextFile(repo, ".ai-commit/config.local.yml", "hook:\n - empty\n");
2121

2222
const result = yield* runCli(["config", "get", "hook"], {
2323
cwd: repo,
@@ -30,7 +30,7 @@ describe.concurrent("CLI integration", () => {
3030
);
3131

3232
it.effect(
33-
"config set hook installs the script into .git-agent/hooks",
33+
"config set hook installs the script into .ai-commit/hooks",
3434
Effect.fn(function* () {
3535
const repo = yield* createGitRepo();
3636
const hookPath = yield* writeTextFile(repo, "scripts/pre-commit.sh", "#!/bin/sh\nexit 0\n");
@@ -42,8 +42,8 @@ describe.concurrent("CLI integration", () => {
4242

4343
expect(result.exitCode).toBe(0);
4444
expect(result.stdout).toContain(`installed hook: ${hookPath}`);
45-
expect(yield* fileExists(repo, ".git-agent/hooks/pre-commit")).toBe(true);
46-
expect(yield* readTextFile(repo, ".git-agent/config.yml")).toContain(hookPath);
45+
expect(yield* fileExists(repo, ".ai-commit/hooks/pre-commit")).toBe(true);
46+
expect(yield* readTextFile(repo, ".ai-commit/config.yml")).toContain(hookPath);
4747
}),
4848
);
4949

@@ -78,7 +78,7 @@ describe.concurrent("CLI integration", () => {
7878
expect(result.exitCode).toBe(0);
7979
expect(result.stdout).toContain("set model = gpt-4o-mini (user)");
8080

81-
const userConfig = yield* readTextFile(repo, "../.xdg/git-agent/config.yml");
81+
const userConfig = yield* readTextFile(repo, "../.xdg/ai-commit/config.yml");
8282
expect(userConfig).toContain("model: gpt-4o-mini");
8383
}),
8484
);
@@ -93,7 +93,7 @@ describe.concurrent("CLI integration", () => {
9393
);
9494

9595
expect(result.exitCode).not.toBe(0);
96-
expect(yield* fileExists(repo, ".git-agent/config.yml")).toBe(false);
96+
expect(yield* fileExists(repo, ".ai-commit/config.yml")).toBe(false);
9797
}),
9898
);
9999

tests/cli-smoke.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const runCli = (
2626
});
2727

2828
const newGitRepo = (): string => {
29-
const dir = mkdtempSync(join(tmpdir(), "git-agent-cli-"));
29+
const dir = mkdtempSync(join(tmpdir(), "ai-commit-"));
3030
tempDirs.push(dir);
3131
execFileSync("git", ["init"], { cwd: dir, stdio: "ignore" });
3232
return dir;
@@ -63,16 +63,16 @@ describe.concurrent("cli smoke", () => {
6363
const result = runCli(["wat"]);
6464

6565
expect(result.status).toBe(1);
66-
expect(result.stderr).toContain('Unknown subcommand "wat" for "git-agent"');
66+
expect(result.stderr).toContain('Unknown subcommand "wat" for "ai-commit"');
6767
expect(result.stderr).not.toContain("~effect/cli/CliError/ShowHelp");
6868
expect(result.stderr).not.toContain("Help requested");
6969
});
7070

7171
it("config get prefers local hook over project hook", () => {
7272
const dir = newGitRepo();
73-
mkdirSync(join(dir, ".git-agent"), { recursive: true });
74-
writeFileSync(join(dir, ".git-agent", "config.yml"), "hook:\n - conventional\n");
75-
writeFileSync(join(dir, ".git-agent", "config.local.yml"), "hook:\n - empty\n");
73+
mkdirSync(join(dir, ".ai-commit"), { recursive: true });
74+
writeFileSync(join(dir, ".ai-commit", "config.yml"), "hook:\n - conventional\n");
75+
writeFileSync(join(dir, ".ai-commit", "config.local.yml"), "hook:\n - empty\n");
7676

7777
const result = runCli(["config", "get", "--cwd", dir, "hook"]);
7878
expect(result.status).toBe(0);
@@ -99,7 +99,7 @@ describe.concurrent("cli smoke", () => {
9999

100100
it("config show resolves provider settings from environment", () => {
101101
const dir = newGitRepo();
102-
const xdgHome = mkdtempSync(join(tmpdir(), "git-agent-cli-xdg-"));
102+
const xdgHome = mkdtempSync(join(tmpdir(), "ai-commit-xdg-"));
103103
tempDirs.push(xdgHome);
104104

105105
const result = runCli(["config", "show", "--cwd", dir], {
@@ -130,13 +130,13 @@ describe.concurrent("cli smoke", () => {
130130

131131
it("init --local reports the local config path when it already exists", () => {
132132
const dir = newGitRepo();
133-
mkdirSync(join(dir, ".git-agent"), { recursive: true });
134-
writeFileSync(join(dir, ".git-agent", "config.local.yml"), "hook:\n - conventional\n");
133+
mkdirSync(join(dir, ".ai-commit"), { recursive: true });
134+
writeFileSync(join(dir, ".ai-commit", "config.local.yml"), "hook:\n - conventional\n");
135135

136136
const result = runCli(["init", "--cwd", dir, "--local", "--hook", "conventional"]);
137137

138138
expect(result.status).toBe(1);
139-
expect(result.stderr).toContain(join(dir, ".git-agent", "config.local.yml"));
140-
expect(result.stderr).not.toContain(join(dir, ".git-agent", "config.yml"));
139+
expect(result.stderr).toContain(join(dir, ".ai-commit", "config.local.yml"));
140+
expect(result.stderr).not.toContain(join(dir, ".ai-commit", "config.yml"));
141141
});
142142
});

tests/commit-message-service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const makeInput = (
1616
apiKey: "test-key",
1717
baseUrl: "https://example.test/v1",
1818
model: "test-model",
19-
noGitAgentCoAuthor: false,
19+
noCommitCoAuthor: false,
2020
noModelCoAuthor: false,
2121
},
2222
diff: {

tests/commit-planner-service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const makeInput = (overrides: Partial<PlanCommitsInput> = {}): PlanCommitsInput
1313
apiKey: "test-key",
1414
baseUrl: "https://example.test/v1",
1515
model: "test-model",
16-
noGitAgentCoAuthor: false,
16+
noCommitCoAuthor: false,
1717
noModelCoAuthor: false,
1818
},
1919
stagedFiles: ["src/staged.ts"],

tests/config.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ describe("config keys", () => {
3737
});
3838

3939
it("fails when project config contains malformed hook values", async () => {
40-
const repoRoot = mkdtempSync(join(tmpdir(), "git-agent-config-"));
40+
const repoRoot = mkdtempSync(join(tmpdir(), "ai-commit-config-"));
4141
tempDirs.push(repoRoot);
42-
mkdirSync(join(repoRoot, ".git-agent"), { recursive: true });
43-
writeFileSync(join(repoRoot, ".git-agent", "config.yml"), "hook: 123\n");
42+
mkdirSync(join(repoRoot, ".ai-commit"), { recursive: true });
43+
writeFileSync(join(repoRoot, ".ai-commit", "config.yml"), "hook: 123\n");
4444

4545
await expect(runEffect(loadProjectConfig(repoRoot))).rejects.toMatchObject({
4646
message: expect.stringContaining("invalid config"),

tests/hooks.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const hookInput: HookInput = {
1717
scopes: [],
1818
hooks: [],
1919
maxDiffLines: 0,
20-
noGitAgentCoAuthor: false,
20+
noCommitCoAuthor: false,
2121
noModelCoAuthor: false,
2222
},
2323
};
@@ -38,7 +38,7 @@ describe("HookService", () => {
3838
it.effect(
3939
"fails when a configured shell hook is missing",
4040
Effect.fn(function* () {
41-
const dir = mkdtempSync(join(tmpdir(), "git-agent-hooks-"));
41+
const dir = mkdtempSync(join(tmpdir(), "ai-commit-hooks-"));
4242
tempDirs.push(dir);
4343
const hookPath = join(dir, "missing-hook.sh");
4444
const hookService = yield* HookService;
@@ -52,7 +52,7 @@ describe("HookService", () => {
5252
it.effect(
5353
"fails for non-executable hook files",
5454
Effect.fn(function* () {
55-
const dir = mkdtempSync(join(tmpdir(), "git-agent-hooks-"));
55+
const dir = mkdtempSync(join(tmpdir(), "gai-commit-hooks-"));
5656
tempDirs.push(dir);
5757
const hookPath = join(dir, "hook.sh");
5858
writeFileSync(hookPath, "#!/bin/sh\nexit 0\n");

tests/integration/helpers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,24 +155,24 @@ export const chmodFile = (pathValue: string, mode: number) =>
155155
export const createGitRepo = Effect.fn(function* () {
156156
const fs = yield* FileSystem.FileSystem;
157157
const path = yield* Path.Path;
158-
const root = yield* createTempDir("git-agent-git-");
158+
const root = yield* createTempDir("ai-commit-git-");
159159
const dir = path.join(root, "repo");
160160
yield* fs.makeDirectory(dir, { recursive: true });
161161
yield* run("git", ["init"], dir);
162-
yield* run("git", ["config", "user.name", "Git Agent Test"], dir);
163-
yield* run("git", ["config", "user.email", "git-agent@example.com"], dir);
162+
yield* run("git", ["config", "user.name", "Ai Commit Test"], dir);
163+
yield* run("git", ["config", "user.email", "ai-commit@example.com"], dir);
164164
return dir;
165165
});
166166

167167
export const createJjRepo = Effect.fn(function* () {
168168
const fs = yield* FileSystem.FileSystem;
169169
const path = yield* Path.Path;
170-
const root = yield* createTempDir("git-agent-jj-");
170+
const root = yield* createTempDir("ai-commit-jj-");
171171
const dir = path.join(root, "repo");
172172
yield* fs.makeDirectory(dir, { recursive: true });
173173
yield* run("jj", ["git", "init", "."], dir);
174-
yield* run("jj", ["config", "set", "--repo", "user.name", "Git Agent Test"], dir);
175-
yield* run("jj", ["config", "set", "--repo", "user.email", "git-agent@example.com"], dir);
174+
yield* run("jj", ["config", "set", "--repo", "user.name", "Ai Commit Test"], dir);
175+
yield* run("jj", ["config", "set", "--repo", "user.email", "ai-commit@example.com"], dir);
176176
return dir;
177177
});
178178

tests/scope-service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const provider: ProviderConfig = {
99
apiKey: "test-key",
1010
baseUrl: "https://example.test/v1",
1111
model: "test-model",
12-
noGitAgentCoAuthor: false,
12+
noCommitCoAuthor: false,
1313
noModelCoAuthor: false,
1414
};
1515

0 commit comments

Comments
 (0)