workthin 1.0.0

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 (3) hide show
  1. package/README.md +146 -0
  2. package/dist/cli/index.js +293 -0
  3. package/package.json +118 -0
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # workthin
2
+
3
+ Knowledge vaccination for AI. Turn every solved problem into a reusable vaccine. One project's experience becomes everyone's immunity.
4
+
5
+ **[workthin.app](https://workthin.app)** | **[Docs](https://workthin.app/docs)** | **[Pricing](https://workthin.app/pricing)**
6
+
7
+ ## What is workthin?
8
+
9
+ workthin captures problem→solution knowledge from AI conversations and makes it searchable across your team. When an AI tool encounters a problem someone already solved, workthin provides the answer instantly — reducing token costs by up to 90%.
10
+
11
+ ### How it works
12
+
13
+ 1. **Capture** — AI work logs are structured into problem → environment → attempts → solution. Secrets are masked automatically.
14
+ 2. **Search** — Semantic vector search in milliseconds. Three detail levels: L1 (~100 tokens), L2 (~500), L3 (~2,000).
15
+ 3. **Immunize** — Each resolve strengthens the vaccine. Escalation rates drop weekly. Knowledge compounds.
16
+
17
+ ## Features
18
+
19
+ - **MCP Server** — Works with Claude Code, Claude Desktop, ChatGPT, Cursor, VS Code / GitHub Copilot, Codex CLI, GitHub Copilot CLI, Gemini CLI, and any MCP-compatible tool
20
+ - **CLI** — `wt search`, `wt create`, `wt init`, `wt hooks` for terminal-native workflows
21
+ - **Automatic Hooks** — `wt hooks` sets up SessionStart search and Stop/SessionEnd capture reminders for all major AI tools
22
+ - **REST API** — Full CRUD + semantic search via Bearer token auth
23
+ - **OAuth 2.1** — PKCE, dynamic client registration, JWT access tokens
24
+ - **3-Stage Secret Protection** — Regex patterns + Shannon entropy + AI classification
25
+ - **Scope System** — Personal, project, and global knowledge visibility
26
+ - **Knowledge Chains** — Link related solutions, fork and branch knowledge
27
+ - **Contributor Rewards** — Track who creates the most valuable vaccines
28
+
29
+ ## Quick Start
30
+
31
+ ```bash
32
+ npx workthin@latest init
33
+ ```
34
+
35
+ One command handles authentication, project detection, MCP configuration, hooks setup, and optional global CLI install.
36
+
37
+ ```bash
38
+ # Search existing knowledge
39
+ wt search "supabase timeout"
40
+
41
+ # Create new knowledge
42
+ wt create "Fix: Edge Functions timeout at 30s" \
43
+ --body "Set function timeout to 150s in supabase/config.toml"
44
+ ```
45
+
46
+ ## Tech Stack
47
+
48
+ | Category | Technology |
49
+ |----------|-----------|
50
+ | Framework | Next.js 16 (App Router, React 19, Turbopack) |
51
+ | Language | TypeScript 5.9 |
52
+ | UI | Tailwind CSS 4, DaisyUI 5 |
53
+ | API | Hono (Valibot validation) |
54
+ | Database | Supabase (PostgreSQL + pgvector + RLS) |
55
+ | Auth | Supabase Auth (Google OAuth, GitHub OAuth, Magic Link) |
56
+ | AI | OpenAI GPT-5-mini (structuring, tagging, classification) |
57
+ | Embeddings | text-embedding-3-small (1536 dimensions) |
58
+ | Payment | Stripe (subscriptions + webhook) |
59
+ | MCP | Model Context Protocol (HTTP transport, OAuth 2.1) |
60
+ | Rate Limiting | Upstash Redis |
61
+ | Error Tracking | Sentry |
62
+ | Analytics | PostHog, Vercel Analytics |
63
+ | Lint / Format | Biome |
64
+ | Test | Vitest (970 tests, 92% line coverage) |
65
+ | Docs | Fumadocs |
66
+
67
+ ## Architecture
68
+
69
+ ```
70
+ src/
71
+ ├── app/ # Next.js App Router
72
+ │ ├── (marketing)/ # Landing, pricing, legal pages
73
+ │ ├── (dashboard)/app/ # Dashboard (SSR + Client Components)
74
+ │ ├── (auth)/ # Sign in (Magic Link + OAuth)
75
+ │ ├── api/
76
+ │ │ ├── [[...route]]/ # Hono API catch-all
77
+ │ │ ├── routes/ # REST API (knowledge, search, auth, stripe)
78
+ │ │ └── mcp/ # MCP HTTP endpoint + tools
79
+ │ ├── oauth/ # OAuth 2.1 (authorize, token, register)
80
+ │ └── .well-known/ # OAuth discovery endpoints
81
+ ├── core/
82
+ │ ├── knowledge/ # CRUD, search, chain, check, resolve
83
+ │ ├── protection/ # 3-stage secret masking pipeline
84
+ │ ├── structuring/ # AI structuring, tagging, embedding
85
+ │ ├── oauth/ # JWT, tokens, codes, clients
86
+ │ └── auth/ # API keys, device code flow
87
+ ├── lib/
88
+ │ ├── supabase/ # Server/admin clients, queries, actions
89
+ │ ├── stripe/ # Subscription management
90
+ │ └── format.ts # Shared utilities
91
+ ├── cli/ # CLI commands (init, login, search, create, hooks)
92
+ └── components/ # UI components
93
+ ```
94
+
95
+ ## Development
96
+
97
+ ### Prerequisites
98
+
99
+ - [Bun](https://bun.sh/) (runtime + package manager)
100
+ - [Supabase CLI](https://supabase.com/docs/guides/cli) (local DB)
101
+
102
+ ### Setup
103
+
104
+ ```bash
105
+ bun install
106
+ cp .env.example .env # Fill in required values
107
+ bun run supabase:start
108
+ bun run supabase:reset
109
+ bun run dev # http://localhost:3001
110
+ ```
111
+
112
+ ### Commands
113
+
114
+ ```bash
115
+ bun run dev # Dev server (port 3001)
116
+ bun run build # Production build
117
+ bun run test # Vitest + coverage (85% threshold)
118
+ bun run lint # Biome check + format
119
+ bun run type-check # TypeScript strict check
120
+ ```
121
+
122
+ ### Environment Variables
123
+
124
+ See [`.env.example`](.env.example) for the full list. Required:
125
+
126
+ | Variable | Service |
127
+ |----------|---------|
128
+ | `NEXT_PUBLIC_SUPABASE_URL` | Supabase |
129
+ | `NEXT_PUBLIC_SUPABASE_PUBLIC_KEY` | Supabase |
130
+ | `SUPABASE_SECRET_KEY` | Supabase |
131
+ | `OPENAI_API_KEY` | OpenAI |
132
+ | `UPSTASH_REDIS_REST_URL` / `TOKEN` | Upstash |
133
+
134
+ ## Plans
135
+
136
+ | | Free | Pro |
137
+ |--|------|-----|
138
+ | Knowledge storage | Unlimited | Unlimited |
139
+ | Global reads | 30 / month | Unlimited |
140
+ | CLI + MCP | Yes | Yes |
141
+ | Secret protection | Yes | Yes |
142
+ | Custom security rules | — | Yes |
143
+
144
+ ## License
145
+
146
+ Proprietary. All rights reserved.