← All modules
development

Repository

Live

Code analysis and repository metadata tracking with feature extraction.

event.type === "repository" modules/repository
Overview

What Repository does

Repository indexes the git repos you point it at. The plugin polls each path on an interval (default 5 minutes), emits a `repository` event for every new commit, and keeps an `indexed_files` table populated with per-file metadata: SHA-256 checksum, line count, language, last-modified timestamp, git status. Workspaces (parent_id) and detected deploy markers (Dockerfile, fly.toml, vercel.json, *.tf) are first-class.

The result is a queryable index of your codebase that the dashboard, the search bar, and the agent layer all read from. Feature extraction (functions, classes, exports) is incremental — the plugin skips files whose `config_hash` hasn't changed since the last scan.

Wire payload

Same shape, three syntaxes

The wire protocol is plain HTTP, plain JSON, HMAC-SHA256. The TypeScript tab uses the SDK; the cURL tab is the raw HTTP equivalent; the Python tab shows the preview SDK shape.

import { createCuittyClient } from "@cuitty/sdk";
import { repositoryPlugin } from "@cuitty/sdk/plugins/repository";

const cuitty = createCuittyClient({
  portalUrl: "https://app.cuitty.com",
  projectId: process.env.CUITTY_PROJECT_ID!,
  apiKey: process.env.CUITTY_API_KEY!,
});
cuitty.use(repositoryPlugin());
cuitty.start();

cuitty.use(repositoryPlugin({
  paths: ["/Users/me/Code/cuitty", "/Users/me/Code/portal"],
  pollInterval: 300_000,
  trackUncommitted: true,
}));
SDK plugin

Drop-in plugin

@cuitty/sdk/plugins/repository
import { repositoryPlugin } from "@cuitty/sdk/plugins/repository";

cuitty.use(repositoryPlugin({
  paths: ["/Users/me/Code/cuitty"],
  pollInterval: 300_000,
}));
Storage

Database schema

Excerpt from modules/repository/schema.sql. One libSQL file per module — back it up with cp.

CREATE TABLE IF NOT EXISTS repositories (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  project_id TEXT,
  name TEXT NOT NULL,
  local_path TEXT NOT NULL UNIQUE,
  git_url TEXT,
  branch TEXT,
  last_scanned INTEGER,
  scan_status TEXT DEFAULT 'pending',
  is_deployable INTEGER NOT NULL DEFAULT 0,
  org TEXT,
  parent_id INTEGER REFERENCES repositories(id) ON DELETE SET NULL,
  markers TEXT,
  created_at INTEGER DEFAULT (unixepoch())
);

Related modules