You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Bun-first glob and JSON config; align engines; consolidate docs
- Add glob-sync (Bun Glob vs fast-glob) for collectFiles and benchmark
- Load codemap.config.json with readFile on Node; Bun.file on Bun
- Set engines from oxc-parser/better-sqlite3; trim packaging doc
- Merge bench-repo into benchmark.md; remove bun-reference and extraction
- Update agent rules, README, CONTRIBUTING, .env.example
Index another project: **`--root /path/to/repo`**, or set **`CODEMAP_ROOT`** or **`CODEMAP_TEST_BENCH`** (e.g. in **`.env`** in this repo — see [docs/bench-repo.md](../../docs/bench-repo.md)). Full rebuild: **`--full`**. Targeted re-index: **`--files path/to/a.ts path/to/b.tsx`**.
21
+
Index another project: **`--root /path/to/repo`**, or set **`CODEMAP_ROOT`** or **`CODEMAP_TEST_BENCH`** (e.g. in **`.env`** in this repo — see [docs/benchmark.md § Indexing another project](../../docs/benchmark.md#indexing-another-project)). Full rebuild: **`--full`**. Targeted re-index: **`--files path/to/a.ts path/to/b.tsx`**.
Copy file name to clipboardExpand all lines: .agents/rules/verify-after-each-step.mdc
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -42,5 +42,5 @@ A "step" is any self-contained unit of work where you've finished editing and ar
42
42
2. **Fix before moving on** — If any check fails, fix it immediately while context is fresh. Never carry forward known failures.
43
43
3. **Use the right scope** — Run `bun run lint` and `bun run format:check` on specific files when possible. Prefer `bun run typecheck` project-wide when types may depend on unstaged files.
44
44
4. **Run affected tests** — If you modified or created `*.test.ts` files, run `bun test <file>` on them.
45
-
5. **Re-index before querying Codemap** — If you changed indexed source and plan to run SQL against the structural index next, run `bun src/index.ts --files <paths>` with paths **relative to the indexed project root** (set `CODEMAP_TEST_BENCH` / `CODEMAP_ROOT` or `--root` so that root is correct — see [docs/bench-repo.md](../../docs/bench-repo.md)).
45
+
5. **Re-index before querying Codemap** — If you changed indexed source and plan to run SQL against the structural index next, run `bun src/index.ts --files <paths>` with paths **relative to the indexed project root** (set `CODEMAP_TEST_BENCH` / `CODEMAP_ROOT` or `--root` so that root is correct — see [docs/benchmark.md § Indexing another project](../../docs/benchmark.md#indexing-another-project)).
46
46
6. **Don't duplicate the hook's job** — You don't need to re-verify at commit time; the pre-commit hook (`lint-staged`) handles that automatically when AI/agent env vars trigger it. Your job is to stay green *between* commits.
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
Codemap is in **bootstrap / extraction** phase. Before large PRs, please open an issue so we can align on:
4
4
5
5
-**Core vs adapter** — core should stay small; language-specific logic belongs in **adapters** (see [docs/roadmap.md](../docs/roadmap.md)).
6
-
-**Runtimes** — **Node ≥20** and **Bun ≥1.1** are both supported for the CLI and library; SQLite is **`better-sqlite3`** on Node and **`bun:sqlite`** on Bun ([docs/architecture.md](../docs/architecture.md), [docs/packaging.md § Node vs Bun](../docs/packaging.md#node-vs-bun)).
6
+
-**Runtimes** — **Node**`^20.19.0 || >=22.12.0`and **Bun**`>=1.0.0` (`package.json`**engines**); SQLite is **`better-sqlite3`** on Node and **`bun:sqlite`** on Bun ([docs/architecture.md](../docs/architecture.md), [docs/packaging.md § Node vs Bun](../docs/packaging.md#node-vs-bun)).
7
7
8
8
## Dev workflow
9
9
@@ -27,7 +27,7 @@ bun run check # format + lint + tests + typecheck + build
27
27
28
28
### QA against a real app (testing bench)
29
29
30
-
Do **not** add Codemap as a dependency to the bench repo. In **this** repo, copy `.env.example` to `.env` and set **`CODEMAP_TEST_BENCH`** to an **absolute path** to the other clone, then run `bun src/index.ts` as usual. See [docs/bench-repo.md](../docs/bench-repo.md).
30
+
Do **not** add Codemap as a dependency to the bench repo. In **this** repo, copy `.env.example` to `.env` and set **`CODEMAP_TEST_BENCH`** to an **absolute path** to the other clone, then run `bun src/index.ts` as usual. See [docs/benchmark.md § Indexing another project](../docs/benchmark.md#indexing-another-project).
31
31
32
32
Releases: **[@changesets/cli](https://github.com/changesets/changesets)** — run **`bun run changeset`** when your PR should bump the version; see [docs/packaging.md § Releases](../docs/packaging.md#releases).
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ bun add @stainless-code/codemap
20
20
21
21
The package exposes a **`codemap`** binary, a **library** entry (`import` / `exports`), compiled **`dist/`**, and **`templates/agents`** for **`codemap agents init`** — see [docs/packaging.md](docs/packaging.md).
22
22
23
-
**Engines:** Node **≥20** and/or Bun **≥1.1**(see `package.json`).
23
+
**Engines:** Node **`^20.19.0 || >=22.12.0`** and/or Bun **`>=1.0.0`**— see `package.json` and [docs/packaging.md](docs/packaging.md).
24
24
25
25
---
26
26
@@ -56,7 +56,7 @@ codemap agents init
56
56
codemap agents init --force
57
57
```
58
58
59
-
**Environment / flags:**`--root` overrides **`CODEMAP_ROOT`** / **`CODEMAP_TEST_BENCH`**, then **`process.cwd()`**. Using a separate app as a QA target: [docs/bench-repo.md](docs/bench-repo.md).
59
+
**Environment / flags:**`--root` overrides **`CODEMAP_ROOT`** / **`CODEMAP_TEST_BENCH`**, then **`process.cwd()`**. Indexing a project outside this clone: [docs/benchmark.md § Indexing another project](docs/benchmark.md#indexing-another-project).
60
60
61
61
**Configuration:** optional **`codemap.config.ts`** (default export object or async factory) or **`codemap.config.json`**. Shape: [codemap.config.example.json](codemap.config.example.json). When developing inside this repo you can use `defineConfig` from `@stainless-code/codemap` or `./src/config`. If you set **`include`**, it **replaces** the default glob list entirely.
|[packaging.md](./packaging.md)|`dist/`, npm **`files`**, **engines**, **[Node vs Bun](./packaging.md#node-vs-bun)**, **[Releases](./packaging.md#releases)** (Changesets) |
10
+
|[roadmap.md](./roadmap.md)| Forward-looking backlog (not a `src/` inventory) |
11
+
|[why-codemap.md](./why-codemap.md)| Why index + SQL for agents (speed, tokens, accuracy) |
15
12
16
-
**Conventions:** one topic per file; relative links; no symbol/file counts or source line numbers in docs (use `codemap query` / `bun run dev query` to measure). **Contributors:**`bun run check`, JSDoc on public API — [.github/CONTRIBUTING.md](../.github/CONTRIBUTING.md) (tooling, `.agents/` / `.cursor/`, `.gitignore` / format config).
13
+
**Cross-cutting:** SQLite, workers, include globs, and JSON config use Bun when available — **[packaging.md § Node vs Bun](./packaging.md#node-vs-bun)** (single table; don’t duplicate elsewhere).
14
+
15
+
**Conventions:** one topic per file; relative links; no symbol/file counts or source line numbers (use `codemap query` / `bun run dev query` after indexing). **This repo:**`bun run dev` → `bun src/index.ts`; **`bun run build`** → tsdown → `dist/`. **Contributors:**`bun run check`, JSDoc on public API — [.github/CONTRIBUTING.md](../.github/CONTRIBUTING.md).
Copy file name to clipboardExpand all lines: docs/architecture.md
+24-19Lines changed: 24 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Codemap — Architecture
2
2
3
+
See [documentation index](./README.md).
4
+
3
5
## Overview
4
6
5
7
A local SQLite database (`.codemap.db`) indexes the project tree and stores structural metadata (symbols, imports, exports, components, dependencies, CSS tokens, markers) for SQL queries instead of repeated full-tree scans.
@@ -8,7 +10,9 @@ A local SQLite database (`.codemap.db`) indexes the project tree and stores stru
8
10
9
11
**`src/sqlite-db.ts`:** Node uses **`better-sqlite3`**; Bun uses **`bun:sqlite`**. Same schema everywhere. **`better-sqlite3`** allows **one SQL statement per `prepare()`**; **`bun:sqlite`** accepts **multiple statements** in one `run()`. On Node, **`runSql()`** splits multi-statement strings on **`;`** and runs each fragment. Do **not** put **`;`** inside **`--` line comments** in **`db.ts`** DDL strings (naive split would break). Details: [packaging.md § Node vs Bun](./packaging.md#node-vs-bun).
10
12
11
-
**`src/worker-pool.ts`:** Bun `Worker` or Node `worker_threads`. **Shipped artifact:****`dist/`** — `package.json`**`bin`** and **`exports`** both point at **`dist/index.mjs`** ([packaging.md](./packaging.md)); tsdown also emits **lazy CLI chunks** (`cmd-index`, `cmd-query`, `cmd-agents`, …) loaded via **`import()`** from **`src/cli/main.ts`**.
13
+
**`src/worker-pool.ts`:** Bun `Worker` or Node `worker_threads`. **`src/glob-sync.ts`:** Bun **`Glob`** or **`fast-glob`** for include patterns. **`src/config.ts`:** JSON user config via **`Bun.file`** on Bun, **`readFile` + `JSON.parse`** on Node. Full table: [packaging.md § Node vs Bun](./packaging.md#node-vs-bun).
14
+
15
+
**Shipped artifact:****`dist/`** — `package.json`**`bin`** and **`exports`** both point at **`dist/index.mjs`** ([packaging.md](./packaging.md)); tsdown also emits **lazy CLI chunks** (`cmd-index`, `cmd-query`, `cmd-agents`, …) loaded via **`import()`** from **`src/cli/main.ts`**.
12
16
13
17
## Layering
14
18
@@ -88,24 +92,25 @@ A local SQLite database (`.codemap.db`) indexes the project tree and stores stru
0 commit comments