Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
</p>

<p align="center">
<a href="https://github.com/justrach/codedb2/releases/latest"><img src="https://img.shields.io/github/v/release/justrach/codedb2?style=flat-square&label=version" alt="Release" /></a>
<a href="https://github.com/justrach/codedb2/blob/main/LICENSE"><img src="https://img.shields.io/github/license/justrach/codedb2?style=flat-square" alt="License" /></a>
<a href="https://github.com/justrach/codedb/releases/latest"><img src="https://img.shields.io/github/v/release/justrach/codedb?style=flat-square&label=version" alt="Release" /></a>
<a href="https://github.com/justrach/codedb/blob/main/LICENSE"><img src="https://img.shields.io/github/license/justrach/codedb?style=flat-square" alt="License" /></a>
<img src="https://img.shields.io/badge/zig-0.15-f7a41d?style=flat-square" alt="Zig 0.15" />
<img src="https://img.shields.io/badge/status-alpha-orange?style=flat-square" alt="Alpha" />
<a href="https://deepwiki.com/justrach/codedb2"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki" /></a>
<a href="https://deepwiki.com/justrach/codedb"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki" /></a>
</p>

<h1 align="center">codedb</h1>
Expand Down Expand Up @@ -73,7 +73,7 @@ Downloads the binary for your platform and auto-registers codedb as an MCP serve
| Linux ARM64 | `codedb-linux-arm64` | — |
| Linux x86_64 | `codedb-linux-x86_64` | — |

Or install manually from [GitHub Releases](https://github.com/justrach/codedb2/releases/latest).
Or install manually from [GitHub Releases](https://github.com/justrach/codedb/releases/latest).

---

Expand Down Expand Up @@ -318,8 +318,8 @@ rm -f codedb.snapshot # remove snapshot from project
**Requirements:** Zig 0.15+

```bash
git clone https://github.com/justrach/codedb2.git
cd codedb2
git clone https://github.com/justrach/codedb.git
cd codedb
zig build # debug build
zig build -Doptimize=ReleaseFast # release build
zig build test # run tests
Expand Down
51 changes: 7 additions & 44 deletions install/worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const GITHUB_REPO = "justrach/codedb2";
const FALLBACK_VERSION = "0.2.0";
const GITHUB_REPO = "justrach/codedb";
const FALLBACK_VERSION = "0.2.1";
const INSTALL_SCRIPT_URL = `https://raw.githubusercontent.com/${GITHUB_REPO}/main/install/install.sh`;

export default {
Expand Down Expand Up @@ -75,51 +75,14 @@ async function serveLatestVersion() {
}

async function proxyReleaseBinary(version, assetName) {
// First, get the release by tag to find the asset download URL
const tag = `v${version}`;
const releaseResp = await fetch(
`https://api.github.com/repos/${GITHUB_REPO}/releases/tags/${tag}`,
{ headers: { "User-Agent": "codedb-worker", Accept: "application/vnd.github.v3+json" } }
);

if (!releaseResp.ok) {
return new Response(`release ${tag} not found`, { status: 404 });
}

const release = await releaseResp.json();

// Find the matching asset
// Asset names on GitHub: "codedb-darwin-arm64", "codedb-linux-x86_64", etc.
// If the release just has "codedb" (no platform suffix), try exact match first then bare name
let asset = release.assets.find((a) => a.name === assetName);
if (!asset) {
// Fallback: if only "codedb" exists in release, map to it
const bare = assetName.replace(/-darwin-arm64|-darwin-x86_64|-linux-arm64|-linux-x86_64/, "");
asset = release.assets.find((a) => a.name === bare);
}
const assetUrl = `https://github.com/${GITHUB_REPO}/releases/download/${tag}/${assetName}`;

if (!asset) {
return new Response(
`asset "${assetName}" not found in release ${tag}\navailable: ${release.assets.map((a) => a.name).join(", ")}`,
{ status: 404 }
);
}

// Proxy the binary from GitHub
const binaryResp = await fetch(asset.browser_download_url, {
headers: { "User-Agent": "codedb-worker" },
redirect: "follow",
});

if (!binaryResp.ok) {
return new Response("failed to download binary", { status: 502 });
}

return new Response(binaryResp.body, {
return new Response(null, {
status: 302,
headers: {
"Content-Type": "application/octet-stream",
"Content-Disposition": `attachment; filename="${assetName}"`,
"Cache-Control": "public, max-age=86400",
Location: assetUrl,
"Cache-Control": "public, max-age=300",
},
});
}
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
VERSION="${RELEASE_VERSION:-${1:-0.1.0}}"
CERT="Developer ID Application: Rachit Pradhan (WWP9DLJ27P)"
REPO="$(cd "$(dirname "$0")" && pwd)"
GITHUB_REPO="justrach/codedb2"
GITHUB_REPO="justrach/codedb"
DRY_RUN=false

# Platforms to build
Expand Down
47 changes: 47 additions & 0 deletions skills/codedb-install/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: codedb-install
description: Install codedb for Codex users and register it as an MCP server. Use when someone wants to install the hosted release build, build codedb from source, re-register a local codedb binary in Codex, or switch Codex to a different codedb executable.
---

# codedb Install

Use this skill when a Codex user wants `codedb` available as an MCP server.

Prefer the hosted installer for normal setup:

```bash
curl -fsSL https://codedb.codegraff.com/install.sh | sh
```

Use a source build when the user wants local changes, debug builds, or a branch that is not yet released:

```bash
git clone https://github.com/justrach/codedb.git
cd codedb
zig build -Doptimize=ReleaseFast
```

The built binary will usually be at `zig-out/bin/codedb`.

After either path, verify the binary starts:

```bash
/absolute/path/to/codedb --help
```

Then register that binary in Codex with the helper script:

```bash
./skills/codedb-install/scripts/register_codex_mcp.sh /absolute/path/to/codedb
```

The script appends this MCP entry only when it is not already present:

```toml
[mcp_servers.codedb]
command = "/absolute/path/to/codedb"
args = ["mcp"]
startup_timeout_sec = 30
```

If the user wants to replace an existing `codedb` entry with a different binary, edit `~/.codex/config.toml` directly after checking the current value.
4 changes: 4 additions & 0 deletions skills/codedb-install/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface:
display_name: "Install codedb"
short_description: "Install or build codedb and register it as a Codex MCP server."
default_prompt: "Use this skill to install the latest codedb release or build codedb from source, then register it in Codex MCP config."
42 changes: 42 additions & 0 deletions skills/codedb-install/scripts/register_codex_mcp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail

if [ "$#" -ne 1 ]; then
echo "usage: register_codex_mcp.sh /absolute/path/to/codedb" >&2
exit 1
fi

codedb_bin="$1"

case "$codedb_bin" in
/*) ;;
*)
echo "error: expected an absolute path" >&2
exit 1
;;
esac

if [ ! -x "$codedb_bin" ]; then
echo "error: binary is not executable: $codedb_bin" >&2
exit 1
fi

config_dir="${HOME}/.codex"
config="${config_dir}/config.toml"

mkdir -p "$config_dir"

if [ -f "$config" ] && grep -q '\[mcp_servers\.codedb\]' "$config" 2>/dev/null; then
echo "codedb already registered in $config"
exit 0
fi

{
[ -f "$config" ] && [ -s "$config" ] && echo ""
echo '[mcp_servers.codedb]'
echo "command = \"$codedb_bin\""
echo 'args = ["mcp"]'
echo 'startup_timeout_sec = 30'
} >> "$config"

echo "registered codedb in $config"
8 changes: 4 additions & 4 deletions website/app/benchmarks.zig
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const html =
\\ <div class="nav-links" id="nav-links">
\\ <a href="/benchmarks">Benchmarks</a>
\\ <a href="/quickstart">Install</a>
\\ <a href="https://github.com/justrach/codedb2">GitHub</a>
\\ <a href="https://github.com/justrach/codedb">GitHub</a>
\\ <a href="/quickstart" class="nav-cta">Get started</a>
\\ </div>
\\ </div>
Expand Down Expand Up @@ -338,17 +338,17 @@ const html =
\\ Apple M4 Pro, 48GB RAM. MCP = pre-indexed warm queries (20 iterations avg).<br>
\\ CLI and external tools include process startup (3 iterations avg).<br>
\\ Ground truth verified against Python reference implementation.<br><br>
\\ <a href="https://github.com/justrach/codedb2">View source on GitHub &rarr;</a>
\\ <a href="https://github.com/justrach/codedb">View source on GitHub &rarr;</a>
\\ </div>
\\ <div class="method-ctas">
\\ <a href="/quickstart" class="btn">Get started</a>
\\ <a href="https://github.com/justrach/codedb2" class="btn btn-ghost">GitHub</a>
\\ <a href="https://github.com/justrach/codedb" class="btn btn-ghost">GitHub</a>
\\ </div>
\\ </div>
\\</div>
\\
\\<footer class="layout-footer">
\\ codedb &mdash; code intelligence for AI agents &middot; <a href="https://github.com/justrach/codedb2">GitHub</a>
\\ codedb &mdash; code intelligence for AI agents &middot; <a href="https://github.com/justrach/codedb">GitHub</a>
\\</footer>
\\
\\<script>
Expand Down
8 changes: 4 additions & 4 deletions website/app/index.zig
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const html =
\\ <div class="nav-links" id="nav-links">
\\ <a href="/benchmarks">Benchmarks</a>
\\ <a href="/quickstart">Install</a>
\\ <a href="https://github.com/justrach/codedb2">GitHub</a>
\\ <a href="https://github.com/justrach/codedb">GitHub</a>
\\ <a href="/quickstart" class="nav-cta">Get started</a>
\\ </div>
\\ </div>
Expand All @@ -168,7 +168,7 @@ const html =
\\ </div>
\\ <div class="hero-actions">
\\ <a href="/quickstart" class="btn">Get started</a>
\\ <a href="https://github.com/justrach/codedb2" class="btn btn-outline">GitHub</a>
\\ <a href="https://github.com/justrach/codedb" class="btn btn-outline">GitHub</a>
\\ </div>
\\</div>
\\
Expand Down Expand Up @@ -354,14 +354,14 @@ const html =
\\ </div>
\\ <div style="display:flex;gap:12px;justify-content:center;flex-wrap:wrap;">
\\ <a href="/quickstart" class="btn">Quick start guide</a>
\\ <a href="https://github.com/justrach/codedb2" class="btn btn-outline">GitHub</a>
\\ <a href="https://github.com/justrach/codedb" class="btn btn-outline">GitHub</a>
\\ </div>
\\ </div>
\\</div>
\\
\\<!-- Footer -->
\\<div class="layout-footer">
\\ <p>codedb &mdash; code intelligence for AI agents &middot; <a href="https://github.com/justrach/codedb2">GitHub</a></p>
\\ <p>codedb &mdash; code intelligence for AI agents &middot; <a href="https://github.com/justrach/codedb">GitHub</a></p>
\\</div>
\\
\\<script>
Expand Down
4 changes: 2 additions & 2 deletions website/app/layout.zig
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub fn wrap(allocator: std.mem.Allocator, path: []const u8, body: []const u8, me
\\ <div class="nav-links" id="nav-links">
\\ <a href="/benchmarks">Benchmarks</a>
\\ <a href="/quickstart">Install</a>
\\ <a href="https://github.com/justrach/codedb2">GitHub</a>
\\ <a href="https://github.com/justrach/codedb">GitHub</a>
\\ <a href="/quickstart" class="nav-cta">Get started</a>
\\ </div>
\\ </div>
Expand All @@ -148,7 +148,7 @@ pub fn wrap(allocator: std.mem.Allocator, path: []const u8, body: []const u8, me
w.writeAll(
\\
\\ <footer class="layout-footer">
\\ <p>codedb &mdash; code intelligence for AI agents &middot; <a href="https://github.com/justrach/codedb2">GitHub</a></p>
\\ <p>codedb &mdash; code intelligence for AI agents &middot; <a href="https://github.com/justrach/codedb">GitHub</a></p>
\\ </footer>
\\</div>
\\<script>
Expand Down
6 changes: 3 additions & 3 deletions website/app/quickstart.zig
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ fn page() h.Node {
h.h2(.{}, "Building from source"),
h.p(.{}, "Requires Zig 0.15+:"),
h.pre(.{},
\\git clone https://github.com/justrach/codedb2.git
\\cd codedb2
\\git clone https://github.com/justrach/codedb.git
\\cd codedb
\\zig build # debug build
\\zig build -Doptimize=ReleaseFast # release build
\\zig build test # run tests
),

h.div(.{ .class = "hero-actions" }, .{
h.a(.{ .href = "/benchmarks", .class = "btn" }, "See benchmarks"),
h.a(.{ .href = "https://github.com/justrach/codedb2", .class = "btn btn-outline" }, "GitHub"),
h.a(.{ .href = "https://github.com/justrach/codedb", .class = "btn btn-outline" }, "GitHub"),
}),
});
}
Loading