openclacky 1.1.2 → 1.1.3
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.
- checksums.yaml +4 -4
- data/.clacky/skills/gem-release/SKILL.md +27 -31
- data/CHANGELOG.md +14 -0
- data/Dockerfile +28 -0
- data/docs/engineering-article.md +343 -0
- data/lib/clacky/agent/llm_caller.rb +1 -5
- data/lib/clacky/cli.rb +1 -1
- data/lib/clacky/message_format/anthropic.rb +17 -1
- data/lib/clacky/providers.rb +34 -0
- data/lib/clacky/server/channel/adapters/dingtalk/adapter.rb +142 -5
- data/lib/clacky/server/channel/adapters/dingtalk/api_client.rb +309 -0
- data/lib/clacky/ui2/ui_controller.rb +14 -0
- data/lib/clacky/ui_interface.rb +14 -0
- data/lib/clacky/utils/model_pricing.rb +96 -25
- data/lib/clacky/version.rb +1 -1
- data/lib/clacky/web/app.css +8 -0
- data/lib/clacky/web/index.html +1 -1
- data/lib/clacky/web/onboard.js +6 -0
- data/lib/clacky/web/settings.js +17 -5
- data/scripts/build/lib/apt.sh +30 -10
- data/scripts/build/lib/network.sh +3 -2
- data/scripts/install.sh +30 -9
- metadata +3 -16
- data/docs/HOW-TO-USE-CN.md +0 -96
- data/docs/HOW-TO-USE.md +0 -94
- data/docs/browser-cdp-native-design.md +0 -195
- data/docs/c-end-user-positioning.md +0 -64
- data/docs/config.example.yml +0 -27
- data/docs/deploy-architecture.md +0 -619
- data/docs/deploy_subagent_design.md +0 -540
- data/docs/install-script-simplification.md +0 -89
- data/docs/memory-architecture.md +0 -343
- data/docs/openclacky_cloud_api_reference.md +0 -584
- data/docs/security-design.md +0 -109
- data/docs/session-management-redesign.md +0 -202
- data/docs/system-skill-authoring-guide.md +0 -47
- data/docs/why-developer.md +0 -371
- data/docs/why-openclacky.md +0 -266
|
@@ -1,540 +0,0 @@
|
|
|
1
|
-
# Deploy Feature Design Document
|
|
2
|
-
|
|
3
|
-
## 1. Overview
|
|
4
|
-
|
|
5
|
-
This document describes the design of the deployment feature for OpenClacky that deploys user projects to Railway PaaS.
|
|
6
|
-
|
|
7
|
-
### 1.1 Dual-Mode Approach
|
|
8
|
-
|
|
9
|
-
The deployment feature uses **two distinct modes** to balance precision and flexibility:
|
|
10
|
-
|
|
11
|
-
1. **Rails Mode** (Priority)
|
|
12
|
-
- Fixed 8-step script execution
|
|
13
|
-
- No AI decision-making, pure automation
|
|
14
|
-
- Fast, predictable, and precise
|
|
15
|
-
- For standard Rails projects only
|
|
16
|
-
|
|
17
|
-
2. **Generic Mode**
|
|
18
|
-
- AI-guided subagent (DeployRole)
|
|
19
|
-
- Intelligent analysis and decision-making
|
|
20
|
-
- Flexible handling of edge cases
|
|
21
|
-
- For non-Rails or non-standard projects
|
|
22
|
-
|
|
23
|
-
**Design Philosophy**: Rails projects get precise, automated deployment; everything else gets intelligent, adaptive deployment.
|
|
24
|
-
|
|
25
|
-
### 1.2 Goals
|
|
26
|
-
|
|
27
|
-
- Port deployment functionality from clacky-ai-agent to OpenClacky (Ruby)
|
|
28
|
-
- Prioritize Rails project deployment (OpenClacky's primary focus)
|
|
29
|
-
- Maintain generality for other project types (Node.js, Python, etc.)
|
|
30
|
-
- Provide fast, reliable deployment experience
|
|
31
|
-
|
|
32
|
-
### 1.3 Reference Implementation
|
|
33
|
-
|
|
34
|
-
- Source project: `~/workspace/clacky-ai-agent`
|
|
35
|
-
- Key files:
|
|
36
|
-
- `heracles/agent_roles/deploy_role/` - DeployRole implementation
|
|
37
|
-
- `heracles/agent_workspace/tools/deploy.py` - Deployment tools
|
|
38
|
-
- `heracles/agent_workspace/deployment/deployment.py` - Deployment logic
|
|
39
|
-
|
|
40
|
-
## 2. Architecture Design
|
|
41
|
-
|
|
42
|
-
### 2.1 Overall Architecture
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
User: "Deploy my project"
|
|
46
|
-
↓
|
|
47
|
-
invoke_skill('deploy', task: 'Deploy project')
|
|
48
|
-
↓
|
|
49
|
-
Deploy Skill (SKILL.md) - Project Type Detection
|
|
50
|
-
↓
|
|
51
|
-
├─── Rails Project Detected
|
|
52
|
-
│ (Gemfile + config/database.yml exist)
|
|
53
|
-
│ ↓
|
|
54
|
-
│ Execute rails_deploy.rb Template
|
|
55
|
-
│ ├─ Step 1: List services
|
|
56
|
-
│ ├─ Step 2: Check first deployment
|
|
57
|
-
│ ├─ Step 3: Set Rails env vars
|
|
58
|
-
│ ├─ Step 4: Execute deployment
|
|
59
|
-
│ ├─ Step 5: Run db:migrate
|
|
60
|
-
│ ├─ Step 6: Run db:seed (if first)
|
|
61
|
-
│ ├─ Step 7: Health check
|
|
62
|
-
│ └─ Step 8: Report success
|
|
63
|
-
│ ↓
|
|
64
|
-
│ Return result (synchronous)
|
|
65
|
-
│
|
|
66
|
-
└─── Non-Rails Project
|
|
67
|
-
(Node.js / Python / Generic)
|
|
68
|
-
↓
|
|
69
|
-
Fork DeployRole Subagent
|
|
70
|
-
├─ Phase 1: Analyzing (AI analyzes)
|
|
71
|
-
├─ Phase 2: Deploying (AI deploys)
|
|
72
|
-
└─ Phase 3: Checking (AI verifies)
|
|
73
|
-
↓
|
|
74
|
-
Return result (synchronous)
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### 2.2 Component Structure
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
default_skills/deploy/
|
|
81
|
-
├── SKILL.md # Deploy skill entry point
|
|
82
|
-
│ # - Detects project type
|
|
83
|
-
│ # - Routes to Rails template or Generic subagent
|
|
84
|
-
│
|
|
85
|
-
├── templates/
|
|
86
|
-
│ └── rails_deploy.rb # Fixed 8-step Rails deployment script
|
|
87
|
-
│ # - No AI decision-making
|
|
88
|
-
│ # - Precise, automated execution
|
|
89
|
-
│
|
|
90
|
-
├── subagent/
|
|
91
|
-
│ └── DEPLOY_ROLE.md # Generic deployment subagent system prompt
|
|
92
|
-
│ # - 3-phase AI-guided workflow
|
|
93
|
-
│ # - Intelligent analysis and adaptation
|
|
94
|
-
│
|
|
95
|
-
└── tools/ # Deployment tools (used by both modes)
|
|
96
|
-
├── list_services.rb # List Railway services
|
|
97
|
-
├── report_deploy_status.rb # Report deployment status
|
|
98
|
-
├── execute_deployment.rb # Execute deployment
|
|
99
|
-
├── set_deploy_variables.rb # Set environment variables
|
|
100
|
-
├── fetch_runtime_logs.rb # Fetch runtime logs
|
|
101
|
-
└── check_health.rb # Health check
|
|
102
|
-
|
|
103
|
-
docs/
|
|
104
|
-
└── deploy_subagent_design.md # This document
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## 3. Project Type Detection
|
|
108
|
-
|
|
109
|
-
### 3.1 Detection Logic
|
|
110
|
-
|
|
111
|
-
The Deploy skill (SKILL.md) performs project type detection:
|
|
112
|
-
|
|
113
|
-
```ruby
|
|
114
|
-
# Pseudocode
|
|
115
|
-
def detect_project_type
|
|
116
|
-
if File.exist?('Gemfile') && File.exist?('config/database.yml')
|
|
117
|
-
:rails
|
|
118
|
-
elsif File.exist?('package.json')
|
|
119
|
-
:nodejs
|
|
120
|
-
else
|
|
121
|
-
:generic
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 3.2 Routing Decision
|
|
127
|
-
|
|
128
|
-
- **Rails detected** → Execute `templates/rails_deploy.rb`
|
|
129
|
-
- **Non-Rails detected** → Fork DeployRole subagent with `subagent/DEPLOY_ROLE.md`
|
|
130
|
-
|
|
131
|
-
## 4. Rails Mode Design
|
|
132
|
-
|
|
133
|
-
### 4.1 Rails Template Script
|
|
134
|
-
|
|
135
|
-
**File**: `default_skills/deploy/templates/rails_deploy.rb`
|
|
136
|
-
|
|
137
|
-
**Purpose**: Fixed, non-AI script that executes precise deployment steps.
|
|
138
|
-
|
|
139
|
-
**Characteristics**:
|
|
140
|
-
- No AI decision-making
|
|
141
|
-
- No deviation from script
|
|
142
|
-
- Fast execution
|
|
143
|
-
- Predictable results
|
|
144
|
-
|
|
145
|
-
### 4.2 Rails Deployment Steps
|
|
146
|
-
|
|
147
|
-
```ruby
|
|
148
|
-
# Step 1: List Services
|
|
149
|
-
services = call_tool('list_services')
|
|
150
|
-
main_service = services.find { |s| s['type'] == 'web' }
|
|
151
|
-
db_service = services.find { |s| s['type'] == 'postgres' || s['type'] == 'mysql' }
|
|
152
|
-
|
|
153
|
-
# Step 2: Check First Deployment
|
|
154
|
-
is_first_deployment = main_service['deployments'].empty?
|
|
155
|
-
|
|
156
|
-
# Step 3: Set Rails Environment Variables
|
|
157
|
-
variables = {
|
|
158
|
-
'RAILS_ENV' => 'production',
|
|
159
|
-
'SECRET_KEY_BASE' => get_or_prompt('SECRET_KEY_BASE'),
|
|
160
|
-
'RAILS_SERVE_STATIC_FILES' => 'true',
|
|
161
|
-
'RAILS_LOG_TO_STDOUT' => 'true'
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
# Add DATABASE_URL reference
|
|
165
|
-
ref_variables = {
|
|
166
|
-
'DATABASE_URL' => "#{db_service['name']}.DATABASE_URL"
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
call_tool('set_deploy_variables',
|
|
170
|
-
service: main_service['name'],
|
|
171
|
-
variables: variables,
|
|
172
|
-
ref_variables: ref_variables
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
# Step 4: Execute Deployment
|
|
176
|
-
call_tool('execute_deployment', service: main_service['name'])
|
|
177
|
-
|
|
178
|
-
# Step 5: Run Database Migrations
|
|
179
|
-
run_railway_command(service: main_service['name'],
|
|
180
|
-
command: 'rake db:migrate')
|
|
181
|
-
|
|
182
|
-
# Step 6: Run Database Seeds (first deployment only)
|
|
183
|
-
if is_first_deployment
|
|
184
|
-
run_railway_command(service: main_service['name'],
|
|
185
|
-
command: 'rake db:seed')
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
# Step 7: Health Check
|
|
189
|
-
public_url = main_service['public_url']
|
|
190
|
-
call_tool('check_health', url: public_url, path: '/')
|
|
191
|
-
|
|
192
|
-
# Step 8: Report Success
|
|
193
|
-
call_tool('report_deploy_status',
|
|
194
|
-
status: 'success',
|
|
195
|
-
message: "Rails app deployed successfully to #{public_url}"
|
|
196
|
-
)
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### 4.3 Rails-Specific Features
|
|
200
|
-
|
|
201
|
-
1. **Automatic database.yml parsing**
|
|
202
|
-
2. **Rails environment variables** (RAILS_ENV, SECRET_KEY_BASE, etc.)
|
|
203
|
-
3. **Database migrations** (db:migrate)
|
|
204
|
-
4. **Database seeding** (db:seed on first deploy)
|
|
205
|
-
5. **Asset precompilation** (if needed)
|
|
206
|
-
|
|
207
|
-
## 5. Generic Mode Design
|
|
208
|
-
|
|
209
|
-
### 5.1 DeployRole Subagent
|
|
210
|
-
|
|
211
|
-
**File**: `default_skills/deploy/subagent/DEPLOY_ROLE.md`
|
|
212
|
-
|
|
213
|
-
**Purpose**: AI-guided deployment for non-standard or non-Rails projects.
|
|
214
|
-
|
|
215
|
-
**Characteristics**:
|
|
216
|
-
- Full AI decision-making
|
|
217
|
-
- Adaptive to project structure
|
|
218
|
-
- Handles edge cases
|
|
219
|
-
- 3-phase workflow
|
|
220
|
-
|
|
221
|
-
### 5.2 System Prompt Structure
|
|
222
|
-
|
|
223
|
-
```markdown
|
|
224
|
-
You are DeployRole, a deployment specialist for Railway PaaS.
|
|
225
|
-
|
|
226
|
-
Your task is to deploy the user's project using a 3-phase workflow.
|
|
227
|
-
|
|
228
|
-
## Phase 1: Analyzing
|
|
229
|
-
|
|
230
|
-
1. Use list_services to see existing Railway services
|
|
231
|
-
2. Detect project type (Node.js, Python, etc.) by reading project files
|
|
232
|
-
3. Analyze environment variable requirements (.env, .env.example)
|
|
233
|
-
4. Use collect_user_input to gather missing credentials
|
|
234
|
-
5. Report status: report_deploy_status(status='analyzing', message='...')
|
|
235
|
-
|
|
236
|
-
## Phase 2: Deploying
|
|
237
|
-
|
|
238
|
-
1. Use set_deploy_variables to configure environment
|
|
239
|
-
2. Use execute_deployment to deploy the service
|
|
240
|
-
3. Monitor deployment progress
|
|
241
|
-
4. If deployment fails, use fetch_runtime_logs to diagnose
|
|
242
|
-
5. Report status: report_deploy_status(status='deploying', message='...')
|
|
243
|
-
|
|
244
|
-
## Phase 3: Checking
|
|
245
|
-
|
|
246
|
-
1. Wait for public URL to be available
|
|
247
|
-
2. Use check_health to verify application is responding
|
|
248
|
-
3. Verify critical functionality (if applicable)
|
|
249
|
-
4. Report final status: report_deploy_status(status='success'|'failed', message='...')
|
|
250
|
-
|
|
251
|
-
## Available Tools
|
|
252
|
-
|
|
253
|
-
- list_services
|
|
254
|
-
- report_deploy_status
|
|
255
|
-
- execute_deployment
|
|
256
|
-
- set_deploy_variables
|
|
257
|
-
- fetch_runtime_logs
|
|
258
|
-
- check_health
|
|
259
|
-
- read_file
|
|
260
|
-
- search_codebase
|
|
261
|
-
- safe_shell
|
|
262
|
-
- collect_user_input
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### 5.3 Generic Mode Workflow
|
|
266
|
-
|
|
267
|
-
Unlike Rails mode, the subagent:
|
|
268
|
-
- **Analyzes** the project structure intelligently
|
|
269
|
-
- **Adapts** to different frameworks and configurations
|
|
270
|
-
- **Decides** what commands to run based on context
|
|
271
|
-
- **Handles** errors with fallback strategies
|
|
272
|
-
|
|
273
|
-
## 6. Deployment Tools Design
|
|
274
|
-
|
|
275
|
-
All tools are **shared** between Rails and Generic modes.
|
|
276
|
-
|
|
277
|
-
### 6.1 list_services
|
|
278
|
-
|
|
279
|
-
**Purpose**: List all Railway services with environment variables.
|
|
280
|
-
|
|
281
|
-
**Parameters**: None
|
|
282
|
-
|
|
283
|
-
**Returns**: Array of service objects with masked sensitive data
|
|
284
|
-
|
|
285
|
-
**Implementation**: Wraps `clackycli service list --json`
|
|
286
|
-
|
|
287
|
-
### 6.2 report_deploy_status
|
|
288
|
-
|
|
289
|
-
**Purpose**: Report deployment status to user.
|
|
290
|
-
|
|
291
|
-
**Parameters**:
|
|
292
|
-
- `status`: analyzing | deploying | checking | success | failed
|
|
293
|
-
- `message`: Status message
|
|
294
|
-
|
|
295
|
-
**Implementation**: Outputs formatted status message
|
|
296
|
-
|
|
297
|
-
### 6.3 execute_deployment
|
|
298
|
-
|
|
299
|
-
**Purpose**: Execute deployment and monitor until completion.
|
|
300
|
-
|
|
301
|
-
**Parameters**:
|
|
302
|
-
- `service_name`: Service to deploy
|
|
303
|
-
|
|
304
|
-
**Implementation**:
|
|
305
|
-
- Runs `clackycli up -s SERVICE_NAME -d`
|
|
306
|
-
- Monitors deployment status
|
|
307
|
-
- Returns when complete or failed
|
|
308
|
-
|
|
309
|
-
### 6.4 set_deploy_variables
|
|
310
|
-
|
|
311
|
-
**Purpose**: Set environment variables for a service.
|
|
312
|
-
|
|
313
|
-
**Parameters**:
|
|
314
|
-
- `service_name`: Target service
|
|
315
|
-
- `variables`: Hash of KEY => VALUE (simple variables)
|
|
316
|
-
- `ref_variables`: Hash of KEY => SERVICE.VAR (reference variables)
|
|
317
|
-
|
|
318
|
-
**Implementation**: Runs `clackycli variables -s SERVICE --set KEY=VALUE`
|
|
319
|
-
|
|
320
|
-
**Security**: Masks sensitive variable names (PASSWORD, SECRET, API_KEY, TOKEN)
|
|
321
|
-
|
|
322
|
-
### 6.5 fetch_runtime_logs
|
|
323
|
-
|
|
324
|
-
**Purpose**: Fetch runtime logs from deployed service.
|
|
325
|
-
|
|
326
|
-
**Parameters**:
|
|
327
|
-
- `service_name`: Service to fetch logs from
|
|
328
|
-
- `lines`: Number of lines (default: 100)
|
|
329
|
-
|
|
330
|
-
**Implementation**: Runs `clackycli logs --lines N`
|
|
331
|
-
|
|
332
|
-
### 6.6 check_health
|
|
333
|
-
|
|
334
|
-
**Purpose**: Perform HTTP health check on deployed application.
|
|
335
|
-
|
|
336
|
-
**Parameters**:
|
|
337
|
-
- `url`: Optional, defaults to RAILWAY_PUBLIC_DOMAIN
|
|
338
|
-
- `path`: Health check path, default "/"
|
|
339
|
-
- `timeout`: Request timeout in seconds, default 30
|
|
340
|
-
|
|
341
|
-
**Implementation**: HTTP GET request with timeout
|
|
342
|
-
|
|
343
|
-
## 7. Implementation Plan
|
|
344
|
-
|
|
345
|
-
### Phase 1: Core Tools (Week 1)
|
|
346
|
-
|
|
347
|
-
- [ ] Create skill directory structure: `default_skills/deploy/`
|
|
348
|
-
- [ ] Implement `list_services` tool
|
|
349
|
-
- [ ] Implement `report_deploy_status` tool
|
|
350
|
-
- [ ] Implement `set_deploy_variables` tool
|
|
351
|
-
- [ ] Write RSpec tests for core tools
|
|
352
|
-
|
|
353
|
-
### Phase 2: Deployment Tools (Week 2)
|
|
354
|
-
|
|
355
|
-
- [ ] Implement `execute_deployment` tool
|
|
356
|
-
- [ ] Implement `fetch_runtime_logs` tool
|
|
357
|
-
- [ ] Implement `check_health` tool
|
|
358
|
-
- [ ] Write integration tests
|
|
359
|
-
- [ ] Test all tools with Railway CLI
|
|
360
|
-
|
|
361
|
-
### Phase 3: Rails Mode (Week 3)
|
|
362
|
-
|
|
363
|
-
- [ ] Create `templates/rails_deploy.rb` script
|
|
364
|
-
- [ ] Implement 8-step Rails deployment workflow
|
|
365
|
-
- [ ] Add Rails project detection logic
|
|
366
|
-
- [ ] Test with real Rails projects
|
|
367
|
-
- [ ] Handle edge cases (missing SECRET_KEY_BASE, etc.)
|
|
368
|
-
|
|
369
|
-
### Phase 4: Generic Mode (Week 4)
|
|
370
|
-
|
|
371
|
-
- [ ] Create `subagent/DEPLOY_ROLE.md` system prompt
|
|
372
|
-
- [ ] Write comprehensive 3-phase workflow instructions
|
|
373
|
-
- [ ] Configure tool access for subagent
|
|
374
|
-
- [ ] Test with Node.js projects
|
|
375
|
-
- [ ] Test with Python projects
|
|
376
|
-
|
|
377
|
-
### Phase 5: Integration & Entry Point (Week 5)
|
|
378
|
-
|
|
379
|
-
- [ ] Create `SKILL.md` entry point
|
|
380
|
-
- [ ] Implement project type detection
|
|
381
|
-
- [ ] Implement routing logic (Rails vs Generic)
|
|
382
|
-
- [ ] End-to-end testing for both modes
|
|
383
|
-
- [ ] Error handling improvements
|
|
384
|
-
|
|
385
|
-
### Phase 6: Documentation & Polish (Week 6)
|
|
386
|
-
|
|
387
|
-
- [ ] User guide with examples
|
|
388
|
-
- [ ] API documentation
|
|
389
|
-
- [ ] Troubleshooting guide
|
|
390
|
-
- [ ] Performance optimization
|
|
391
|
-
- [ ] Security audit
|
|
392
|
-
|
|
393
|
-
## 8. Technical Decisions
|
|
394
|
-
|
|
395
|
-
### 8.1 CLI Tool Dependency
|
|
396
|
-
|
|
397
|
-
We depend on `clackycli` command-line tool for Railway operations.
|
|
398
|
-
|
|
399
|
-
**Commands used**:
|
|
400
|
-
- `clackycli service list --json` - List services
|
|
401
|
-
- `clackycli up -s SERVICE_NAME -d` - Deploy service
|
|
402
|
-
- `clackycli variables -s SERVICE_NAME --set KEY=VALUE` - Set variables
|
|
403
|
-
- `clackycli run -s SERVICE_NAME COMMAND` - Run commands
|
|
404
|
-
- `clackycli logs --lines N` - Fetch logs
|
|
405
|
-
|
|
406
|
-
### 8.2 Synchronous Execution
|
|
407
|
-
|
|
408
|
-
Both modes execute **synchronously** (user waits for completion).
|
|
409
|
-
No background/async execution.
|
|
410
|
-
|
|
411
|
-
**Rationale**:
|
|
412
|
-
- Simpler implementation
|
|
413
|
-
- Better error handling
|
|
414
|
-
- Clear user feedback
|
|
415
|
-
- Easier debugging
|
|
416
|
-
|
|
417
|
-
### 8.3 Rails Priority
|
|
418
|
-
|
|
419
|
-
Rails mode is implemented first and optimized for performance.
|
|
420
|
-
Generic mode is secondary but fully functional.
|
|
421
|
-
|
|
422
|
-
### 8.4 Tool Reusability
|
|
423
|
-
|
|
424
|
-
All tools are generic and reusable between modes.
|
|
425
|
-
No mode-specific tool implementations.
|
|
426
|
-
|
|
427
|
-
### 8.5 Error Handling
|
|
428
|
-
|
|
429
|
-
**Rails Mode**: Fail-fast with clear error messages
|
|
430
|
-
**Generic Mode**: AI attempts recovery, then fails with diagnosis
|
|
431
|
-
|
|
432
|
-
## 9. Security Considerations
|
|
433
|
-
|
|
434
|
-
1. **Mask sensitive environment variables**
|
|
435
|
-
- PASSWORD, SECRET, API_KEY, TOKEN, etc.
|
|
436
|
-
- Show only KEY=****** in logs
|
|
437
|
-
|
|
438
|
-
2. **Never modify CLACKY_* variables**
|
|
439
|
-
- System variables are protected
|
|
440
|
-
- Deployment tools skip them
|
|
441
|
-
|
|
442
|
-
3. **Use collect_user_input for secrets**
|
|
443
|
-
- Prompt with password type
|
|
444
|
-
- Never log secret values
|
|
445
|
-
|
|
446
|
-
4. **Sanitize command inputs**
|
|
447
|
-
- Validate service names
|
|
448
|
-
- Escape shell arguments
|
|
449
|
-
|
|
450
|
-
5. **Validate Railway CLI output**
|
|
451
|
-
- Parse JSON safely
|
|
452
|
-
- Handle missing fields gracefully
|
|
453
|
-
|
|
454
|
-
## 10. Success Criteria
|
|
455
|
-
|
|
456
|
-
### Rails Mode
|
|
457
|
-
1. ✓ Successfully deploy standard Rails projects
|
|
458
|
-
2. ✓ Handle first-time and subsequent deployments
|
|
459
|
-
3. ✓ Automatic database migration execution
|
|
460
|
-
4. ✓ Fast execution (< 5 minutes for typical project)
|
|
461
|
-
5. ✓ Clear progress reporting
|
|
462
|
-
|
|
463
|
-
### Generic Mode
|
|
464
|
-
1. ✓ Successfully deploy Node.js projects
|
|
465
|
-
2. ✓ Successfully deploy Python projects
|
|
466
|
-
3. ✓ Intelligent error diagnosis
|
|
467
|
-
4. ✓ Adaptive to different project structures
|
|
468
|
-
5. ✓ Clear AI reasoning in logs
|
|
469
|
-
|
|
470
|
-
### Overall
|
|
471
|
-
1. ✓ All RSpec tests passing
|
|
472
|
-
2. ✓ Complete documentation
|
|
473
|
-
3. ✓ No security vulnerabilities
|
|
474
|
-
4. ✓ Graceful error handling
|
|
475
|
-
5. ✓ User-friendly output
|
|
476
|
-
|
|
477
|
-
## 11. Comparison: Rails vs Generic Mode
|
|
478
|
-
|
|
479
|
-
| Aspect | Rails Mode | Generic Mode |
|
|
480
|
-
|--------|-----------|--------------|
|
|
481
|
-
| **Execution** | Fixed script | AI subagent |
|
|
482
|
-
| **AI Involvement** | None (pure automation) | Full (analysis + decisions) |
|
|
483
|
-
| **Speed** | Fast (< 5 min) | Slower (varies) |
|
|
484
|
-
| **Predictability** | 100% predictable | Adaptive |
|
|
485
|
-
| **Error Handling** | Fail-fast | Attempt recovery |
|
|
486
|
-
| **Flexibility** | None | High |
|
|
487
|
-
| **Use Case** | Standard Rails apps | Non-Rails or edge cases |
|
|
488
|
-
| **Database Setup** | Automatic (migrate + seed) | AI-decided |
|
|
489
|
-
| **Env Variables** | Fixed list | AI-analyzed |
|
|
490
|
-
|
|
491
|
-
## 12. Future Enhancements
|
|
492
|
-
|
|
493
|
-
1. **Additional Templates**
|
|
494
|
-
- Node.js/Express template
|
|
495
|
-
- Next.js template
|
|
496
|
-
- Django template
|
|
497
|
-
|
|
498
|
-
2. **Multi-Platform Support**
|
|
499
|
-
- Heroku integration
|
|
500
|
-
- Render integration
|
|
501
|
-
- Fly.io integration
|
|
502
|
-
|
|
503
|
-
3. **Advanced Features**
|
|
504
|
-
- Rollback capabilities
|
|
505
|
-
- Blue-green deployment
|
|
506
|
-
- Deployment analytics
|
|
507
|
-
- Pre/post deployment hooks
|
|
508
|
-
|
|
509
|
-
4. **AI Enhancements**
|
|
510
|
-
- Cost estimation before deploy
|
|
511
|
-
- Performance recommendations
|
|
512
|
-
- Security scanning
|
|
513
|
-
|
|
514
|
-
5. **User Experience**
|
|
515
|
-
- Interactive deployment wizard
|
|
516
|
-
- Deployment history tracking
|
|
517
|
-
- One-click rollback
|
|
518
|
-
|
|
519
|
-
## 13. Testing Strategy
|
|
520
|
-
|
|
521
|
-
### Unit Tests
|
|
522
|
-
- Each tool in isolation
|
|
523
|
-
- Mock Railway CLI responses
|
|
524
|
-
- Test error conditions
|
|
525
|
-
|
|
526
|
-
### Integration Tests
|
|
527
|
-
- Rails mode end-to-end
|
|
528
|
-
- Generic mode end-to-end
|
|
529
|
-
- Tool interaction flows
|
|
530
|
-
|
|
531
|
-
### Manual Tests
|
|
532
|
-
- Real Railway project deployment
|
|
533
|
-
- Different project types
|
|
534
|
-
- Error scenarios
|
|
535
|
-
- Security validations
|
|
536
|
-
|
|
537
|
-
### Test Coverage Target
|
|
538
|
-
- Tools: 90%+
|
|
539
|
-
- Rails template: 85%+
|
|
540
|
-
- Overall: 80%+
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# Install Script Simplification Plan
|
|
2
|
-
|
|
3
|
-
## Background
|
|
4
|
-
|
|
5
|
-
We now support Ruby >= 2.6.0 (down from 3.1.0). This opens the door to significantly
|
|
6
|
-
simplifying the install script by leveraging the system Ruby that ships with older macOS versions.
|
|
7
|
-
|
|
8
|
-
## Current Flow (Heavy)
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
install.sh
|
|
12
|
-
→ detect_network_region
|
|
13
|
-
→ install_macos_dependencies
|
|
14
|
-
→ Homebrew (+ openssl@3, libyaml, gmp build deps)
|
|
15
|
-
→ mise (Ruby version manager)
|
|
16
|
-
→ Ruby 3 (via mise)
|
|
17
|
-
→ Node 22 (via mise, for chrome-devtools-mcp)
|
|
18
|
-
→ gem install openclacky
|
|
19
|
-
→ install_chrome_devtools_mcp (npm install -g)
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Target Flow (Simplified)
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
check_ruby >= 2.6?
|
|
26
|
-
├── YES → gem install openclacky ✅ (done, zero extra deps)
|
|
27
|
-
└── NO → check CLT exists (xcode-select -p)
|
|
28
|
-
├── YES → mise install ruby → gem install ✅
|
|
29
|
-
└── NO → print clear instructions, exit:
|
|
30
|
-
Option 1: xcode-select --install (then re-run installer)
|
|
31
|
-
Option 2: brew install ruby (if brew already exists)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Key Decisions
|
|
35
|
-
|
|
36
|
-
### Ruby version threshold: 3.1 → 2.6
|
|
37
|
-
- macOS 10.15 Catalina: Ruby 2.6.3 ✅
|
|
38
|
-
- macOS 11 Big Sur: Ruby 2.6.8 ✅
|
|
39
|
-
- macOS 12+ Monterey and above: no system Ruby (Apple removed it)
|
|
40
|
-
|
|
41
|
-
### Homebrew: removed from happy path
|
|
42
|
-
- Only Homebrew's build deps (openssl@3, libyaml, gmp) were needed to compile Ruby via mise
|
|
43
|
-
- If system Ruby exists, none of these are needed
|
|
44
|
-
- Homebrew itself is NOT installed by the script anymore
|
|
45
|
-
|
|
46
|
-
### mise: fallback only
|
|
47
|
-
- Only invoked when system Ruby is absent (macOS 12+)
|
|
48
|
-
- Requires Xcode CLT to be present first (for compiling Ruby)
|
|
49
|
-
- No longer used to install Node
|
|
50
|
-
|
|
51
|
-
### Node / chrome-devtools-mcp: removed from install.sh
|
|
52
|
-
- Browser automation is an optional feature
|
|
53
|
-
- Move Node installation guidance into the `browser-setup` skill
|
|
54
|
-
- `clacky browser setup` handles Node + chrome-devtools-mcp installation
|
|
55
|
-
|
|
56
|
-
## Xcode CLT Handling (Deferred)
|
|
57
|
-
|
|
58
|
-
Brew uses a clever trick to install CLT silently (no GUI popup):
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# Creates a placeholder file that triggers softwareupdate to list CLT
|
|
62
|
-
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
|
63
|
-
|
|
64
|
-
# Find the CLT package label
|
|
65
|
-
clt_label=$(softwareupdate -l | grep "Command Line Tools" | ...)
|
|
66
|
-
|
|
67
|
-
# Silent install — no GUI!
|
|
68
|
-
sudo softwareupdate -i "${clt_label}"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
However this still requires `sudo` (root password). Given that:
|
|
72
|
-
- macOS 12+ users who lack CLT are rare (any git/Xcode/Homebrew usage installs it)
|
|
73
|
-
- Silent CLT install downloads hundreds of MB
|
|
74
|
-
|
|
75
|
-
The current plan is to **not auto-install CLT**, and instead print clear instructions
|
|
76
|
-
asking the user to run `xcode-select --install` and re-run the installer.
|
|
77
|
-
|
|
78
|
-
We can revisit adopting Homebrew's `softwareupdate` approach in the future if
|
|
79
|
-
the "no CLT" case proves common enough.
|
|
80
|
-
|
|
81
|
-
## Files to Change
|
|
82
|
-
|
|
83
|
-
| File | Change |
|
|
84
|
-
|------|--------|
|
|
85
|
-
| `scripts/install.sh` | Ruby threshold 3.1 → 2.6; remove Homebrew install; remove Node/npm install; simplify macOS deps function |
|
|
86
|
-
| `README.md` | Ruby badge and requirements: >= 3.1.0 → >= 2.6.0 |
|
|
87
|
-
| `docs/HOW-TO-USE.md` | Requirements: Ruby >= 3.1 → >= 2.6 |
|
|
88
|
-
| `docs/HOW-TO-USE-CN.md` | Same as above |
|
|
89
|
-
| `homebrew/openclacky.rb` | `depends_on "ruby@3.3"` → remove or update |
|