-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
229 lines (186 loc) · 5.76 KB
/
Copy pathmise.toml
File metadata and controls
229 lines (186 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
[tools]
python = "3.13"
node = "24"
bun = "1.3.5"
uv = "0.9.21"
terraform = "1.12"
[env]
_.file = ".env"
[tasks.up]
description = "Start all services"
run = "docker compose up -d"
[tasks.down]
description = "Stop all services"
run = "docker compose down"
[tasks.logs]
description = "View logs from all services"
run = "docker compose logs -f"
[tasks.logs-backend]
description = "View backend logs"
run = "docker compose logs -f backend"
[tasks.logs-bot]
description = "View bot logs"
run = "docker compose logs -f bot"
[tasks.logs-frontend]
description = "View frontend logs"
run = "docker compose logs -f frontend"
[tasks.build]
description = "Build all Docker images"
run = "docker compose build"
[tasks.clean]
description = "Remove all containers and volumes"
run = "docker compose down -v"
[tasks.restart]
description = "Restart all services"
run = "docker compose restart"
[tasks.ps]
description = "Show running services"
run = "docker compose ps"
[tasks.test-backend]
description = "Run backend tests"
dir = "backend"
run = "uv run pytest tests/test_file_extraction_units.py -v"
[tasks.migrate]
description = "Run database migrations (upgrade to latest)"
dir = "backend"
run = "uv run alembic upgrade head"
[tasks.migrate-down]
description = "Rollback last migration"
dir = "backend"
run = "uv run alembic downgrade -1"
[tasks.migrate-create]
description = "Create a new migration (requires DATABASE_URL)"
dir = "backend"
run = "uv run alembic revision --autogenerate -m \"$MIGRATION_MESSAGE\""
[tasks.migrate-history]
description = "Show migration history"
dir = "backend"
run = "uv run alembic history"
[tasks.migrate-current]
description = "Show current migration version"
dir = "backend"
run = "uv run alembic current"
[tasks.test-frontend]
description = "Run frontend tests"
dir = "frontend"
run = "echo 'No frontend tests yet' && exit 0"
[tasks.test]
description = "Run all tests"
depends = ["test-backend"]
[tasks.shell-backend]
description = "Open shell in backend container"
run = "docker compose exec backend /bin/sh"
[tasks.shell-db]
description = "Open PostgreSQL shell"
run = "docker compose exec postgres psql -U wingman -d wingman"
[tasks.init]
description = "Initialize project (copy .env.example to .env)"
run = """
cp .env.example .env
echo "✅ Created .env file. Please edit it with your credentials."
"""
[tasks.install-backend]
description = "Install backend dependencies locally"
dir = "backend"
run = "uv sync"
[tasks.install-frontend]
description = "Install frontend dependencies locally"
dir = "frontend"
run = "bun install"
[tasks.install]
description = "Install all dependencies locally"
depends = ["install-backend", "install-frontend"]
[tasks.dev-backend]
description = "Run backend in development mode"
dir = "backend"
run = "uv run uvicorn app.main:app --reload"
[tasks.dev-frontend]
description = "Run frontend in development mode"
dir = "frontend"
run = "bun run dev"
[tasks.dev-bot]
description = "Run bot in development mode"
dir = "backend"
run = "python run_bot.py"
[tasks.tf-init]
description = "Initialize Terraform"
dir = "terraform"
run = "terraform init"
[tasks.tf-plan]
description = "Plan Terraform changes"
dir = "terraform"
run = "terraform plan"
[tasks.tf-apply]
description = "Apply Terraform changes"
dir = "terraform"
run = "terraform apply -auto-approve"
[tasks.tf-destroy]
description = "Destroy Terraform resources"
dir = "terraform"
run = "terraform destroy"
[tasks.tf-output]
description = "Show Terraform outputs"
dir = "terraform"
run = "terraform output"
[tasks.tf-credentials]
description = "Show Slack app credentials (sensitive)"
dir = "terraform"
run = "terraform output -json app_credentials"
[tasks.tf-load-credentials]
description = "Load Slack signing secret from Terraform into .env (Note: Bot tokens must be obtained after installing the app)"
dir = "terraform"
run = """
echo "🔑 Loading Slack signing secret from Terraform..."
echo "⚠️ Note: Bot and app tokens are only available after you install the app to your workspace."
echo " Visit the OAuth URL shown in tf-output to install."
# Get credentials as JSON
CREDS=$(terraform output -json app_credentials 2>/dev/null)
if [ -z "$CREDS" ]; then
echo "❌ No credentials found. Run 'mise run tf-apply' first."
exit 1
fi
# Extract signing secret
SIGNING_SECRET=$(echo "$CREDS" | python3 -c "import sys, json; print(json.load(sys.stdin).get('signing_secret', ''))" 2>/dev/null)
# Update .env file (parent directory)
if [ -f ../.env ]; then
if grep -q "^SLACK_SIGNING_SECRET=" ../.env; then
sed -i.bak "s|^SLACK_SIGNING_SECRET=.*|SLACK_SIGNING_SECRET=$SIGNING_SECRET|" ../.env
else
echo "SLACK_SIGNING_SECRET=$SIGNING_SECRET" >> ../.env
fi
rm -f ../.env.bak
echo "✅ Signing secret loaded into .env"
echo ""
echo "Next steps:"
echo "1. Run 'mise run tf-output' to see the OAuth URL"
echo "2. Visit the OAuth URL to install the app"
echo "3. Copy the bot token (xoxb-...) and app token (xapp-...) to .env manually"
else
echo "❌ .env file not found. Run 'cp .env.example .env' first."
exit 1
fi
"""
[tasks.tf-sync-vars]
description = "Sync Slack tokens from .env to Terraform Cloud workspace"
dir = "scripts"
run = "uv run sync_tf_vars.py"
[tasks.tf-load-vars]
description = "Load environment variables from Terraform Cloud into .env"
dir = "scripts"
run = "uv run load_tf_vars.py"
[tasks.tf-oauth-url]
description = "Display OAuth URL and open in browser to install app to workspace"
dir = "terraform"
run = """
echo "🔗 Slack App OAuth Installation URL:"
echo ""
URL=$(terraform output -raw oauth_authorize_url 2>/dev/null)
if [ -z "$URL" ]; then
echo "❌ OAuth URL not found. Run 'mise run tf-apply' first."
exit 1
fi
echo "$URL"
echo ""
echo "Opening in browser..."
open "$URL" 2>/dev/null || xdg-open "$URL" 2>/dev/null || echo "Please open the URL above manually."
"""