@cronicorn/mcp-server 1.5.8 → 1.6.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.
@@ -0,0 +1,29 @@
1
+ ---
2
+ id: developers-overview
3
+ title: Developer Overview
4
+ description: Documentation for developers contributing to Cronicorn
5
+ tags:
6
+ - developer
7
+ sidebar_position: 0
8
+ mcp:
9
+ uri: file:///docs/developers/overview.md
10
+ ---
11
+
12
+ # Developer Documentation
13
+
14
+ Documentation for developers contributing to Cronicorn's codebase or building AI agents that interact with Cronicorn.
15
+
16
+ ## Getting Started
17
+
18
+ - **[Quick Start](./quick-start.md)** - Set up your development environment in 4 steps
19
+ - **[Authentication](./authentication.md)** - Configure admin user or GitHub OAuth
20
+ - **[Workspace Structure](./workspace-structure.md)** - Monorepo organization (apps and packages)
21
+ - **[Quality Checks](./quality-checks.md)** - Required checks before committing and merging
22
+
23
+ ## Architecture & Design
24
+
25
+ - **[System Architecture](../technical/system-architecture.md)** - Core concepts and design patterns
26
+
27
+ ## Contributing
28
+
29
+ For contributors working on Cronicorn's codebase, additional technical guidelines are available in the repository's `.github/instructions/` directory.
@@ -0,0 +1,177 @@
1
+ ---
2
+ id: developer-authentication
3
+ title: Authentication Configuration
4
+ description: Configure authentication methods for your Cronicorn deployment
5
+ tags:
6
+ - developer
7
+ - configuration
8
+ sidebar_position: 2
9
+ mcp:
10
+ uri: file:///docs/developers/authentication.md
11
+ mimeType: text/markdown
12
+ priority: 0.8
13
+ ---
14
+
15
+ # Authentication Configuration
16
+
17
+ Cronicorn supports two authentication methods. At least one must be enabled.
18
+
19
+ ## Quick Reference
20
+
21
+ ```bash
22
+ # Admin User (local dev, CI/CD)
23
+ ADMIN_USER_EMAIL=admin@example.com
24
+ ADMIN_USER_PASSWORD=your-secure-password-min-8-chars
25
+
26
+ # GitHub OAuth (production)
27
+ GITHUB_CLIENT_ID=your_github_client_id
28
+ GITHUB_CLIENT_SECRET=your_github_client_secret
29
+ ```
30
+
31
+ **Choose based on your use case:**
32
+ - **Local Dev**: Admin user only (no OAuth setup needed)
33
+ - **Production**: GitHub OAuth (for multiple users)
34
+ - **Hybrid**: Both (admins use email, users use GitHub)
35
+
36
+ ## Admin User Setup
37
+
38
+ Perfect for development and self-hosting.
39
+
40
+ **1. Edit `.env`:**
41
+ ```bash
42
+ ADMIN_USER_EMAIL=admin@example.com
43
+ ADMIN_USER_PASSWORD=your-secure-password
44
+ ADMIN_USER_NAME=Admin # Optional
45
+ ```
46
+
47
+ **2. Restart the app** - admin user auto-created on startup
48
+
49
+ **3. Login** at `http://localhost:5173/login` with your email/password
50
+
51
+ **Benefits**: ✅ No OAuth app needed, ✅ Works offline, ✅ Perfect for CI/CD
52
+
53
+ ## GitHub OAuth Setup
54
+
55
+ Best for production with multiple users.
56
+
57
+ **1. [Create GitHub OAuth app](https://github.com/settings/developers)**
58
+
59
+ **2. Set callback URL:**
60
+ ```
61
+ ${BETTER_AUTH_URL}/api/auth/callback/github
62
+ ```
63
+ Example: `http://localhost:3333/api/auth/callback/github`
64
+
65
+ **3. Add to `.env`:**
66
+ ```bash
67
+ GITHUB_CLIENT_ID=your_client_id
68
+ GITHUB_CLIENT_SECRET=your_client_secret
69
+ ```
70
+
71
+ **4. Login** - click "Sign in with GitHub" button
72
+
73
+ ## Validation Rules
74
+
75
+ **At least one method required.** App validates on startup:
76
+
77
+ | Configuration | Status |
78
+ |---------------|--------|
79
+ | Admin user only | ✅ Works |
80
+ | GitHub OAuth only | ✅ Works |
81
+ | Both enabled | ✅ Works |
82
+ | Neither enabled | ❌ Fails |
83
+
84
+ ## Required Environment Variables
85
+
86
+ ### Base Config (Always Required)
87
+
88
+ ```bash
89
+ DATABASE_URL=postgresql://user:password@localhost:6666/db
90
+ BETTER_AUTH_SECRET=$(openssl rand -base64 32)
91
+ BETTER_AUTH_URL=http://localhost:3333
92
+ WEB_URL=http://localhost:5173
93
+ ```
94
+
95
+ ### Admin User (Optional*)
96
+
97
+ | Variable | Description |
98
+ |----------|-------------|
99
+ | `ADMIN_USER_EMAIL` | Valid email address |
100
+ | `ADMIN_USER_PASSWORD` | Minimum 8 characters |
101
+ | `ADMIN_USER_NAME` | Display name (optional) |
102
+
103
+ *Required if GitHub OAuth not configured
104
+
105
+ ### GitHub OAuth (Optional*)
106
+
107
+ | Variable | Description |
108
+ |----------|-------------|
109
+ | `GITHUB_CLIENT_ID` | From GitHub OAuth app |
110
+ | `GITHUB_CLIENT_SECRET` | From GitHub OAuth app |
111
+
112
+ *Required if admin user not configured
113
+
114
+ ## Common Issues
115
+
116
+ ### Admin user not created
117
+
118
+ 1. Check both `ADMIN_USER_EMAIL` and `ADMIN_USER_PASSWORD` are in `.env`
119
+ 2. Restart the application
120
+ 3. Check logs for "Admin user created successfully"
121
+
122
+ ### Login returns 404
123
+
124
+ 1. Restart API server after changing `.env`
125
+ 2. Verify: `curl http://localhost:3333/api/auth/config`
126
+
127
+ ### Wrong credentials
128
+
129
+ 1. Check email/password match `.env` exactly (case-sensitive)
130
+ 2. Password must be at least 8 characters
131
+ 3. Remove any extra whitespace
132
+
133
+ ## Production Configuration
134
+
135
+ **Admin for emergency access:**
136
+ ```bash
137
+ ADMIN_USER_EMAIL=admin@yourdomain.com
138
+ ADMIN_USER_PASSWORD=${SECRET_FROM_VAULT}
139
+ ```
140
+
141
+ **GitHub for regular users:**
142
+ ```bash
143
+ GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
144
+ GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
145
+ BETTER_AUTH_URL=https://api.yourdomain.com
146
+ WEB_URL=https://yourdomain.com
147
+ ```
148
+
149
+ **Security**: Use secrets manager, not plain `.env` files
150
+
151
+ ## Programmatic Access
152
+
153
+ ### Bearer Tokens (CLI/AI Agents)
154
+
155
+ ```bash
156
+ # 1. Initiate device flow
157
+ curl -X POST http://localhost:3333/api/auth/device/code
158
+
159
+ # 2. User authorizes in browser
160
+
161
+ # 3. Poll for token
162
+ curl -X POST http://localhost:3333/api/auth/device/token \
163
+ -d "device_code=DEVICE_CODE"
164
+
165
+ # 4. Use in API requests
166
+ curl -H "Authorization: Bearer TOKEN" \
167
+ http://localhost:3333/api/jobs
168
+ ```
169
+
170
+ ### API Keys
171
+
172
+ Generate in web UI at `/settings/api-keys`:
173
+
174
+ ```bash
175
+ curl -H "X-API-Key: your-api-key" \
176
+ http://localhost:3333/api/jobs
177
+ ```
@@ -0,0 +1,197 @@
1
+ ---
2
+ id: environment-configuration
3
+ title: Environment Configuration
4
+ description: Understanding Cronicorn's zero-config approach and environment variables
5
+ tags:
6
+ - developer
7
+ - configuration
8
+ - setup
9
+ sidebar_position: 2
10
+ ---
11
+
12
+ # Environment Configuration
13
+
14
+ ## Zero-Config Local Development
15
+
16
+ Cronicorn is designed for **zero-configuration local development**. All environment variables have sensible defaults, so you can run the entire stack without creating a `.env` file.
17
+
18
+ ```bash
19
+ # That's it - no .env file needed!
20
+ pnpm install
21
+ pnpm db
22
+ pnpm db:migrate
23
+ pnpm dev
24
+ ```
25
+
26
+ Login at http://localhost:5173 with:
27
+ - Email: `admin@example.com`
28
+ - Password: `devpassword`
29
+
30
+ ## How It Works
31
+
32
+ ### Centralized Defaults
33
+
34
+ All default values are maintained in a single package: `@cronicorn/config-defaults`
35
+
36
+ This ensures:
37
+ - **Consistency** - Same defaults across all apps (API, scheduler, ai-planner, web)
38
+ - **Maintainability** - One place to update defaults
39
+ - **Type safety** - TypeScript constants prevent typos
40
+ - **Security** - Production validation prevents using dev defaults
41
+
42
+ ### Development Defaults
43
+
44
+ | Category | Variable | Default Value |
45
+ |----------|----------|---------------|
46
+ | **Ports** | API_PORT | 3333 |
47
+ | | WEB_PORT | 5173 |
48
+ | | DB_PORT | 6666 |
49
+ | **Database** | DATABASE_URL | postgresql://user:password@localhost:6666/db |
50
+ | **Auth** | ADMIN_USER_EMAIL | admin@example.com |
51
+ | | ADMIN_USER_PASSWORD | devpassword |
52
+ | | BETTER_AUTH_SECRET | dev-secret-DO-NOT-USE-IN-PRODUCTION-min32chars |
53
+ | **URLs** | BETTER_AUTH_URL | http://localhost:3333 |
54
+ | | WEB_URL | http://localhost:5173 |
55
+ | | API_URL | http://localhost:3333 |
56
+ | **Stripe** | STRIPE_SECRET_KEY | sk_test_dummy_key_for_local_dev_only |
57
+ | | STRIPE_WEBHOOK_SECRET | whsec_test_dummy_secret_for_local_dev |
58
+
59
+ ⚠️ **Security Warning**: These are insecure defaults for local development only. Production deployments MUST override these values.
60
+
61
+ ## Customizing Configuration
62
+
63
+
64
+ ### Full Configuration (.env.example)
65
+
66
+ For production or advanced setup:
67
+
68
+ ```bash
69
+ # Copy the full example
70
+ cp .env.example .env
71
+
72
+ # Edit with your production values
73
+ vim .env
74
+ ```
75
+
76
+ See all available variables with descriptions in `.env.example`.
77
+
78
+ ## Production Deployment
79
+
80
+ ### Required Changes
81
+
82
+ Production deployments MUST set these variables:
83
+
84
+ ```bash
85
+ # 1. Secure auth secret (generate with: openssl rand -base64 32)
86
+ BETTER_AUTH_SECRET=your-secure-random-secret-min-32-chars
87
+
88
+ # 2. Choose authentication method:
89
+ # Option A: Admin User
90
+ ADMIN_USER_EMAIL=admin@yourcompany.com
91
+ ADMIN_USER_PASSWORD=strong-unique-password
92
+
93
+ # Option B: GitHub OAuth
94
+ GITHUB_CLIENT_ID=your_github_client_id
95
+ GITHUB_CLIENT_SECRET=your_github_client_secret
96
+
97
+ # 3. Real Stripe keys (if using payments)
98
+ STRIPE_SECRET_KEY=sk_live_your_production_key
99
+ STRIPE_WEBHOOK_SECRET=whsec_your_production_webhook_secret
100
+ STRIPE_PRICE_PRO=price_live_pro_monthly
101
+ STRIPE_PRICE_ENTERPRISE=price_live_enterprise_monthly
102
+
103
+ # 4. Production URLs
104
+ BASE_URL=https://your-production-domain.com
105
+ WEB_URL=https://your-production-domain.com
106
+ API_URL=https://api.your-production-domain.com
107
+ BETTER_AUTH_URL=https://api.your-production-domain.com
108
+ ```
109
+
110
+ ### Production Validation
111
+
112
+ The application automatically validates that dev defaults are not used in production:
113
+
114
+ ```typescript
115
+ // Automatically runs on startup in production
116
+ if (NODE_ENV === "production") {
117
+ // Checks BETTER_AUTH_SECRET, ADMIN_USER_PASSWORD, STRIPE_SECRET_KEY
118
+ // Exits with error if using dev defaults
119
+ }
120
+ ```
121
+
122
+ ## Configuration Architecture
123
+
124
+ ### Per-App Config Files
125
+
126
+ Each app has its own configuration file that imports shared defaults:
127
+
128
+ ```
129
+ apps/
130
+ api/src/lib/config.ts # API server config
131
+ scheduler/src/index.ts # Scheduler worker config
132
+ ai-planner/src/index.ts # AI planner config
133
+ web/src/config.ts # Web app config
134
+ ```
135
+
136
+ ### Shared Defaults Package
137
+
138
+ ```
139
+ packages/
140
+ config-defaults/
141
+ src/index.ts # Single source of truth
142
+ README.md # Usage documentation
143
+ ```
144
+
145
+ ## Best Practices
146
+
147
+ ### Local Development
148
+ - ✅ Use defaults (empty .env or .env.minimal)
149
+ - ✅ Override only what you need to test
150
+ - ✅ Keep .env out of git (already in .gitignore)
151
+
152
+ ### Production
153
+ - ✅ Set all required variables explicitly
154
+ - ✅ Use secure secrets (never dev defaults)
155
+ - ✅ Validate with `NODE_ENV=production` locally first
156
+ - ✅ Use environment-specific .env files (.env.production, .env.staging)
157
+
158
+ ### Team Development
159
+ - ✅ Document custom local overrides in team wiki (not in .env)
160
+ - ✅ Keep .env.example up to date
161
+ - ✅ Use the same default ports to avoid conflicts
162
+ - ✅ Update shared defaults in config-defaults package only
163
+
164
+ ## Troubleshooting
165
+
166
+ ### "Cannot find module @cronicorn/config-defaults"
167
+
168
+ Run `pnpm build:packages` to build the shared config package:
169
+
170
+ ```bash
171
+ pnpm build:packages
172
+ ```
173
+
174
+ ### "Environment variable validation failed"
175
+
176
+ Check the error message for which variable is invalid:
177
+
178
+ ```bash
179
+ # See current environment
180
+ pnpm exec dotenv -e .env -- env | grep -E "(DATABASE_URL|STRIPE|ADMIN|GITHUB)"
181
+ ```
182
+
183
+ ### "Auth not working in production"
184
+
185
+ Ensure you've overridden the dev defaults:
186
+
187
+ ```bash
188
+ # Never use these in production:
189
+ ADMIN_USER_PASSWORD=devpassword # ❌
190
+ BETTER_AUTH_SECRET=dev-secret-DO-NOT-USE-IN-PRODUCTION-min32chars # ❌
191
+ ```
192
+
193
+ ## Related
194
+
195
+ - **[Quick Start](./quick-start.md)** - Get started with development
196
+ - **[Quality Checks](./quality-checks.md)** - Testing and validation
197
+ - **[Workspace Structure](./workspace-structure.md)** - Project organization
@@ -0,0 +1,68 @@
1
+ ---
2
+ id: developer-quality-checks
3
+ title: Quality Checks
4
+ description: Required quality checks before committing and merging code
5
+ tags:
6
+ - developer
7
+ - quality
8
+ - testing
9
+ sidebar_position: 4
10
+ mcp:
11
+ uri: file:///docs/developers/quality-checks.md
12
+ mimeType: text/markdown
13
+ priority: 0.75
14
+ ---
15
+
16
+ # Quality Checks
17
+
18
+ ## Before Commit
19
+
20
+ ```bash
21
+ pnpm test # Unit & integration tests (excludes e2e)
22
+ pnpm lint # Check for errors
23
+ pnpm build:packages # Ensure types compile
24
+ ```
25
+
26
+ ## Before Merge
27
+
28
+ ```bash
29
+ pnpm test # Full test suite (excludes e2e)
30
+ pnpm lint:fix # Fix and verify (zero warnings)
31
+ pnpm build # Full build
32
+ pnpm test:e2e # E2E tests (separate command)
33
+ ```
34
+
35
+ ## What to Test
36
+
37
+ | Change | Test Type |
38
+ |--------|-----------|
39
+ | Domain logic | Unit tests (mocked ports) |
40
+ | Repositories | Integration tests (transaction-per-test) |
41
+ | API routes | API + integration tests |
42
+ | Bug fixes | Regression test |
43
+
44
+ **Coverage**: 80%+ for managers/services
45
+
46
+ ## Common Fixes
47
+
48
+ **Tests fail**: `pnpm db` (ensure database running)
49
+ **Module errors**: `pnpm build:packages`
50
+ **Lint errors**: `pnpm lint:fix` (auto-fix most issues)
51
+
52
+ ## Checklist
53
+
54
+ **Before Commit**
55
+ - [ ] Tests pass for changed packages
56
+ - [ ] No lint errors
57
+ - [ ] Packages build
58
+
59
+ **Before Merge**
60
+ - [ ] Full test suite passes
61
+ - [ ] Full build succeeds
62
+ - [ ] Zero lint warnings
63
+ - [ ] E2E tests pass (if applicable)
64
+ - [ ] ADR created (if architectural decision)
65
+
66
+ ## Related
67
+
68
+ - **[Quick Start](./quick-start.md)** - Dev environment setup
@@ -0,0 +1,84 @@
1
+ ---
2
+ id: developer-quick-start
3
+ title: Developer Quick Start
4
+ description: Set up your Cronicorn development environment in 4 steps
5
+ tags:
6
+ - developer
7
+ - essential
8
+ sidebar_position: 1
9
+ mcp:
10
+ uri: file:///docs/developers/quick-start.md
11
+ mimeType: text/markdown
12
+ priority: 0.9
13
+ ---
14
+
15
+ # Developer Quick Start
16
+
17
+ Get Cronicorn running locally in 4 steps.
18
+
19
+ ## Prerequisites
20
+
21
+ - Node.js 24+ and pnpm 10+
22
+ - Docker (for PostgreSQL)
23
+
24
+ ## Setup
25
+
26
+ ```bash
27
+ # 1. Clone and install
28
+ git clone https://github.com/weskerllc/cronicorn.git
29
+ cd cronicorn
30
+ pnpm install # Auto-builds packages
31
+
32
+ # 2. Configure authentication (optional - use defaults)
33
+ cp .env.example .env
34
+ # Edit .env and uncomment ADMIN_USER_EMAIL and ADMIN_USER_PASSWORD
35
+ # Or leave as-is to use GitHub OAuth (requires setup)
36
+
37
+ # 3. Start database
38
+ pnpm db
39
+
40
+ # 4. Run migrations
41
+ pnpm db:migrate
42
+
43
+ # 5. Start development
44
+ pnpm dev
45
+ ```
46
+
47
+ **Login**: Open http://localhost:5173
48
+
49
+ - **Admin User**: Use email/password from your `.env` file
50
+ - **GitHub OAuth**: Click "Sign in with GitHub" (if configured)
51
+
52
+ > 💡 **Tip**: For local dev, uncomment the admin user credentials in `.env` for instant login without OAuth setup.
53
+
54
+ > ⚠️ You'll see a warning about `OPENAI_API_KEY` - this is normal. AI features are optional.
55
+
56
+ ## Common Commands
57
+
58
+ | Command | Description |
59
+ |---------|-------------|
60
+ | `pnpm dev` | Start all services |
61
+ | `pnpm dev:api` | API server only |
62
+ | `pnpm dev:web` | Web app only |
63
+ | `pnpm db` | Start PostgreSQL |
64
+ | `pnpm db:migrate` | Run migrations |
65
+ | `pnpm db:reset` | Reset db |
66
+ | `pnpm db:generate` | Generate migrations when you make schema changes |
67
+ | `pnpm studio` | Database Browser |
68
+ | `pnpm build` | Production build |
69
+
70
+ ## Troubleshooting
71
+
72
+ **Can't login?**
73
+ → Check `.env` has either admin user credentials uncommented OR GitHub OAuth configured
74
+
75
+ **Module errors?**
76
+ → `pnpm build:packages`
77
+
78
+ **Database errors?**
79
+ → Ensure Docker is running, then `pnpm db`
80
+
81
+ ## Next Steps
82
+
83
+ - [Authentication](./authentication.md) - Configure authentication methods
84
+ - [Architecture](../technical/system-architecture.md) - System design