Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

TAGS
.env
mise.local.toml
docker-compose.override.yml
docker-compose.env
.DS_Store

.byebug_history
Expand Down
37 changes: 27 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,47 @@ codebar planner is a Rails 8.1 application for managing [codebar.io](https://cod

**IMPORTANT**: Always use native installation with `bundle exec` commands. Never use Docker or `bin/d*` commands.

### Prerequisites

- **mise** — install via `brew install mise`, then enable `mise activate` in your shell profile (see [mise docs](https://mise.jdx.dev/getting-started.html)). Alternatively, use `mise exec` to run commands with project env vars without shell activation.
- PostgreSQL running locally (default port 5432, or configure via `DB_PORT`)

### Native Installation

- **Setup**: `bundle && rake db:create db:migrate db:seed`
```
cp mise.local.toml.example mise.local.toml
# Edit mise.local.toml with your GitHub OAuth credentials
# Optionally delete .env if it exists from a prior setup:
rm .env
bundle && rake db:create db:migrate db:seed
```

- **Server**: `bundle exec rails server`
- **Tests**: `make test` or `bundle exec parallel_rspec spec/ -n 3` - runs RSpec tests in parallel (3 processes is optimal)
- **Single test**: `bundle exec rspec spec/path/to/file_spec.rb:42`
- **Rails console**: `bundle exec rails console`
- **Run rake tasks**: `bundle exec rake [task]`
- **Linting**: `bundle exec rubocop`

### Docker Setup (Not Used)

Docker setup exists in this repository (`bin/d*` commands) but is **not used** for development work with Claude Code, OpenCode, etc.

### Environment Variables

Required in `.env` file:
```
GITHUB_KEY=<your_github_oauth_client_id>
GITHUB_SECRET=<your_github_oauth_client_secret>
```
Managed by `mise` via `mise.toml` (shared, committed) and `mise.local.toml` (secrets, gitignored). Automatically loaded when you enter the project directory (requires `mise activate`).

| Variable | Default | Description |
|----------|---------|-------------|
| `DB_HOST` | `localhost` | Postgres host |
| `DB_PORT` | `5432` | Postgres port |
| `DB_USER` | (empty) | Postgres user |
| `POSTGRES_PASSWORD` | (empty) | Postgres password |
| `GITHUB_KEY` | — | GitHub OAuth client ID (set in `mise.local.toml`) |
| `GITHUB_SECRET` | — | GitHub OAuth client secret (set in `mise.local.toml`) |

Create GitHub OAuth app at https://github.com/settings/applications/new with callback URL `http://localhost:3000/auth/github`.

### Docker Setup (Not Used)

Docker setup exists in this repository (`bin/d*` commands) but is **not used** for development work with Claude Code, OpenCode, etc.

## Architecture & Domain Model

### Core Domain Concepts
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ group :development do
end

group :development, :test do
gem 'dotenv-rails'
gem 'fabrication'
gem 'faker'
gem 'irb' # LOCKED: Added because of byebug
Expand Down
5 changes: 0 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ GEM
delayed_job (>= 3.0, < 5)
diff-lcs (1.6.2)
docile (1.4.0)
dotenv (3.2.0)
dotenv-rails (3.2.0)
dotenv (= 3.2.0)
railties (>= 6.1)
drb (2.2.3)
email_validator (2.2.4)
activemodel
Expand Down Expand Up @@ -634,7 +630,6 @@ DEPENDENCIES
database_cleaner
delayed_job
delayed_job_active_record
dotenv-rails
drb
email_validator
fabrication
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,26 @@ Visit [https://github.com/settings/applications/new](https://github.com/settings

#### Add your application details to your environment variables

##### Mac/Linux:
1. Run `touch .env` to create a file named `.env` in the root of the application folder.
2. Open this .env file in a text editor, and add the GitHub key (Client ID) and secret (Client Secret) like so:
**Native installation (recommended):** Copy `mise.local.toml.example` to `mise.local.toml`
and fill in your GitHub key and secret:

```
GITHUB_KEY=YOUR_KEY
GITHUB_SECRET=YOUR_SECRET
cp mise.local.toml.example mise.local.toml
# Edit mise.local.toml with your values
```

##### Windows:
Windows doesn't like creating a file named `.env`, so run the following
from a command prompt in your project folder:
Environment variables are managed by [mise](https://mise.jdx.dev). Install it
with `brew install mise` and enable `mise activate` in your shell profile.

**Docker installation:** Copy `docker-compose.override.yml.example` to
`docker-compose.override.yml` and fill in your GitHub key and secret:

```
echo GITHUB_KEY=YOUR_KEY >> .env
echo GITHUB_SECRET=YOUR_SECRET >> .env
cp docker-compose.override.yml.example docker-compose.override.yml
# Edit docker-compose.override.yml with your values
```

**Note:** If when starting the application with Docker you get the error `UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte` this may be because you created the `.env`-file using PowerShell. This can be solved by deleting that file and creating a new one using a bash shell (for example Git Bash).
Docker Compose automatically merges this file — no extra configuration needed.

### 3. Install and set up the environment using docker

Expand Down
1 change: 1 addition & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ development: &default
username: <%= ENV['DB_USER'] || '' %>
password: <%= ENV['POSTGRES_PASSWORD'] || '' %>
host: <%= (ENV['DB_HOST'] || 'localhost').to_json %>
port: <%= ENV['DB_PORT'] || 5432 %>

test:
<<: *default
Expand Down
3 changes: 0 additions & 3 deletions docker-compose.env

This file was deleted.

5 changes: 5 additions & 0 deletions docker-compose.override.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
web:
environment:
GITHUB_KEY: your_github_oauth_client_id
GITHUB_SECRET: your_github_oauth_client_secret
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ services:
environment:
POSTGRES_PASSWORD: password
web:
env_file:
- docker-compose.env
build: .
command: tail -f /dev/null
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- .:/planner
- gem_cache:/usr/local/bundle/gems
Expand Down
3 changes: 3 additions & 0 deletions mise.local.toml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[env]
GITHUB_KEY = "your_github_oauth_client_id"
GITHUB_SECRET = "your_github_oauth_client_secret"
3 changes: 3 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[env]
DB_HOST = "localhost"
DB_PORT = "5432"