Skip to content

Commit bbf1f0e

Browse files
Default DuckDB cache to repo root
1 parent a18bb35 commit bbf1f0e

5 files changed

Lines changed: 62 additions & 5 deletions

File tree

.changeset/repo-local-duckdb.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"agentpond": patch
3+
---
4+
5+
Default the DuckDB cache to the current repository directory instead of the user's home directory.

docs/cli.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ The CLI reads the same configuration variables as the ingestion service. You can
3131

3232
```sh
3333
agentpond --env .env sync
34-
agentpond --db ~/.agentpond/cache.duckdb sync
34+
agentpond --db ./.agentpond/cache.duckdb sync
3535
agentpond --s3-bucket agentpond --s3-endpoint http://localhost:9000 sync
3636
```
3737

38+
By default, AgentPond stores its DuckDB cache at `./.agentpond/cache.duckdb` in the current working directory. Set `AGENTPOND_DB` or pass `--db <path>` to use a shared or custom cache location.
39+
3840
## Global Flags
3941

4042
```txt

packages/core/src/config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { readFileSync } from "node:fs";
2-
import { homedir } from "node:os";
32
import { join } from "node:path";
43

54
export type S3Config = {
@@ -67,7 +66,7 @@ export function configFromEnv(
6766
dbPath:
6867
overrides.dbPath ??
6968
process.env.AGENTPOND_DB ??
70-
join(homedir(), ".agentpond", "cache.duckdb"),
69+
join(process.cwd(), ".agentpond", "cache.duckdb"),
7170
s3: {
7271
bucket:
7372
overrides.s3Bucket ??

skills/agentpond/references/cli.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ export AGENTPOND_S3_FORCE_PATH_STYLE=true
1515
export AWS_ACCESS_KEY_ID=minio
1616
export AWS_SECRET_ACCESS_KEY=minio123
1717
export AWS_REGION=us-east-1
18-
export AGENTPOND_DB=~/.agentpond/cache.duckdb
18+
export AGENTPOND_DB=./.agentpond/cache.duckdb
1919
```
2020

21+
If `AGENTPOND_DB` is not set, AgentPond stores its DuckDB cache at `./.agentpond/cache.duckdb` in the current working directory.
22+
2123
The CLI also accepts common settings as flags:
2224

2325
```bash
2426
npx agentpond --env .env sync
25-
npx agentpond --db ~/.agentpond/cache.duckdb sync
27+
npx agentpond --db ./.agentpond/cache.duckdb sync
2628
npx agentpond --s3-bucket agentpond --s3-endpoint http://localhost:9000 sync
2729
```
2830

tests/config.test.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import assert from "node:assert/strict";
2+
import { mkdtempSync } from "node:fs";
3+
import { tmpdir } from "node:os";
4+
import { join } from "node:path";
5+
import test from "node:test";
6+
import { configFromEnv } from "@agentpond/core";
7+
8+
test("config defaults DuckDB cache to the current working directory", () => {
9+
const originalCwd = process.cwd();
10+
const originalDb = process.env.AGENTPOND_DB;
11+
const cwd = mkdtempSync(join(tmpdir(), "agentpond-config-"));
12+
13+
try {
14+
delete process.env.AGENTPOND_DB;
15+
process.chdir(cwd);
16+
17+
assert.equal(
18+
configFromEnv().dbPath,
19+
join(process.cwd(), ".agentpond", "cache.duckdb"),
20+
);
21+
} finally {
22+
process.chdir(originalCwd);
23+
if (originalDb === undefined) {
24+
delete process.env.AGENTPOND_DB;
25+
} else {
26+
process.env.AGENTPOND_DB = originalDb;
27+
}
28+
}
29+
});
30+
31+
test("config keeps DuckDB path override precedence", () => {
32+
const originalDb = process.env.AGENTPOND_DB;
33+
34+
try {
35+
process.env.AGENTPOND_DB = "/tmp/agentpond-env.duckdb";
36+
37+
assert.equal(configFromEnv().dbPath, "/tmp/agentpond-env.duckdb");
38+
assert.equal(
39+
configFromEnv({ dbPath: "/tmp/agentpond-override.duckdb" }).dbPath,
40+
"/tmp/agentpond-override.duckdb",
41+
);
42+
} finally {
43+
if (originalDb === undefined) {
44+
delete process.env.AGENTPOND_DB;
45+
} else {
46+
process.env.AGENTPOND_DB = originalDb;
47+
}
48+
}
49+
});

0 commit comments

Comments
 (0)