@deltrace/cli 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -69
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,83 +1,33 @@
1
- # compression-server
1
+ # @deltrace/cli
2
2
 
3
- The chunking engine, AI proxy, and user API for Deltrace. Parses source files with tree-sitter, stores semantic code chunks in RDS via S3, and injects compressed codebase context into every Claude or Codex request.
3
+ Deltrace compresses your codebase into a high-density context block and injects it into every Claude Code or Codex request automatically no manual file sharing, no wasted context.
4
4
 
5
- ---
5
+ ## Install
6
6
 
7
- ## How it works
8
-
9
- Before every prompt, a `UserPromptSubmit` hook runs `sync.ts`. It walks the current working directory, hashes each file, and POSTs changed files to the **chunker**. The chunker parses each file with tree-sitter into semantic `CodeChunk[]` objects and stores them in RDS (keyed by content hash — unchanged files are skipped). When a Claude Code or Codex request arrives at the **proxy**, it creates a job in the `jobs` table, pushes it to SQS, and a **Minions inference worker** (Qwen2.5-Coder-14B on a GPU box) pulls the message, runs the MinionS protocol against all workspace chunks, and writes a compressed codebase summary back. The proxy polls the row, injects the summary as `<codebase_context>` into the system prompt, and forwards to `api.anthropic.com` or `api.openai.com` with the user's own API key. If the worker doesn't finish in time, the proxy degrades gracefully and forwards without context.
10
-
11
- ---
12
-
13
- ## Processes
14
-
15
- Three PM2 processes, each on its own port. nginx terminates TLS on 443 and routes by path prefix — ports 3000/3001/3002 are never exposed to the internet.
16
-
17
- | Process | Port | Handles |
18
- |---|---|---|
19
- | `proxy` | 3000 | `/ws/:id/v1/*` — AI request forwarding, pure I/O |
20
- | `chunker` | 3001 | `/upload`, `/auth/activate` — file ingestion, tree-sitter |
21
- | `api` | 3002 | `/api/*` — user auth, API keys, repos, usage stats |
22
-
23
- ---
24
-
25
- ## Codebase structure
26
-
27
- ```
28
- src/
29
- ├── proxy.ts — Port 3000. AI proxy routes.
30
- ├── chunker-server.ts — Port 3001. File ingestion.
31
- ├── api-server.ts — Port 3002. User-facing API server.
32
- ├── userApi.ts — Route handlers for api-server (me, keys, repos, usage).
33
- ├── store.ts — All PostgreSQL access. Fetches DB credentials from AWS
34
- │ Secrets Manager at startup — no DATABASE_URL needed in env.
35
- ├── session.ts — Redis session store. Falls back to in-memory Map in dev.
36
- ├── s3.ts — Chunk blob storage helpers.
37
- ├── sqs.ts — SQS helpers for Minions job dispatch.
38
- ├── chunker.ts — AST-based semantic chunking via tree-sitter.
39
- ├── treeSitter.ts — WASM tree-sitter init and language loading.
40
- ├── languageMap.ts — File extension → language + WASM mapping.
41
- ├── tokenizer.ts — Token estimation and overlap splitting.
42
- ├── types.ts — Shared types (CodeChunk, CompressedChunk, etc.)
43
- ├── sync.ts — Pre-prompt hook: walks cwd, uploads changed files.
44
- ├── login.ts — OAuth setup for Claude Code.
45
- └── login-codex.ts — OAuth setup for Codex.
7
+ ```bash
8
+ npm install -g @deltrace/cli
46
9
  ```
47
10
 
48
- ---
11
+ ## Setup
49
12
 
50
- ## Infrastructure
13
+ **Claude Code:**
14
+ ```bash
15
+ deltrace-claude
16
+ ```
51
17
 
52
- | Component | Details |
53
- |---|---|
54
- | EC2 | t2.micro — upgrade to t3.medium recommended |
55
- | Database | RDS PostgreSQL — credentials auto-rotated every 7 days via Secrets Manager |
56
- | Credentials | EC2 IAM role (`compression-server-ec2-ssm-role`) — no API keys in env |
57
- | Session state | ElastiCache Redis (in-memory fallback for dev) |
58
- | Chunk storage | S3 `deltrace-chunks` bucket |
59
- | Job queue | SQS `compression-jobs-queue` |
60
- | TLS | nginx + Let's Encrypt |
61
- | Process manager | PM2 |
18
+ **Codex:**
19
+ ```bash
20
+ deltrace-codex
21
+ ```
62
22
 
63
- ---
23
+ Both commands open a browser, sign you in, and configure your agent automatically.
64
24
 
65
- ## Commands
25
+ ## Uninstall
66
26
 
67
27
  ```bash
68
- npm run dev # run with ts-node
69
- npm run build # compile TypeScript → dist/
70
- npm start # run compiled output
71
-
72
- npm run compressor:claude # OAuth setup for Claude Code
73
- npm run compressor:codex # OAuth setup for Codex
74
- npm run teardown:claude # undo Claude Code setup
75
- npm run teardown:codex # undo Codex setup
76
- npm run sync # manually upload cwd to server
28
+ deltrace-teardown
77
29
  ```
78
30
 
79
- ## Deploy (EC2)
31
+ ## How it works
80
32
 
81
- ```bash
82
- git pull && npm run build && pm2 restart all
83
- ```
33
+ A hook runs before every prompt. It walks your working directory, uploads changed files to the Deltrace service, and the proxy injects a compressed codebase summary into the system prompt before forwarding to Anthropic or OpenAI. Your API keys are forwarded directly and never stored.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deltrace/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Codebase context compression for AI coding agents",
5
5
  "files": [
6
6
  "dist/login.js",
@@ -10,7 +10,7 @@
10
10
  "dist/teardown-codex.js"
11
11
  ],
12
12
  "bin": {
13
- "deltrace": "dist/login.js",
13
+ "deltrace-claude": "dist/login.js",
14
14
  "deltrace-codex": "dist/login-codex.js",
15
15
  "deltrace-sync": "dist/sync.js",
16
16
  "deltrace-teardown": "dist/teardown.js"