Skip to content

Commit 5ab7209

Browse files
committed
Merge branch 'main' of github.com:emagedoc/CodeClash
2 parents 2d0c835 + 24c049d commit 5ab7209

36 files changed

Lines changed: 686 additions & 629 deletions

.cursor/rules/viewer.mdc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ The application has two main pages:
377377
- **game.log**: Game-specific logging
378378
- **everything.log**: Combined comprehensive logging
379379
- **players/p1/player.log, players/p2/player.log**: Individual player logs for each player
380-
- Each log foldout includes a "Copy path" button and has its own scroll container with max-height of 500px for large logs
380+
- Each log foldout includes "Copy path" and "Download" buttons and has its own scroll container with max-height of 500px for large logs
381381
- Logs are displayed in a dedicated section with proper styling and scrollbars
382382

383383
#### Analysis Section
@@ -482,6 +482,31 @@ The trajectory template displays:
482482

483483
**Content Preview**: Long message content (>5 lines) shows a preview with expand/collapse functionality to keep the interface manageable.
484484

485+
## Download Functionality
486+
487+
The trajectory viewer provides download capabilities for all files that have "Copy path" buttons (except the current folder path):
488+
489+
### Download Locations
490+
491+
* **Tournament and Game Logs**: All log files in the Overview section (tournament.log, game.log, everything.log, player logs)
492+
* **Metadata Files**: The metadata.json file in the Setup section
493+
* **Trajectory Files**: Individual trajectory files (.traj.json) in the Rounds section
494+
495+
### Implementation Details
496+
497+
* **Download Buttons**: Each "Copy path" button (except current folder) is accompanied by a "Download" button with a download icon
498+
* **Server Endpoint**: `GET /download-file?path=<file_path>` serves files with proper security checks
499+
* **Security**: Files must exist within the logs directory, be actual files (not directories), and be accessible
500+
* **File Naming**: Downloaded files retain their original names
501+
* **JavaScript**: Download functionality is handled by `downloadFile()` function in `clipboard.js`
502+
* **User Feedback**: Download buttons show success/error states similar to copy buttons
503+
504+
### Button Styling
505+
506+
* **Download buttons** use the same styling as copy buttons but with download icon (`bi-download`)
507+
* **Button classes**: `.download-btn` and `.download-btn-small` for consistent styling
508+
* **Placement**: Download buttons appear immediately after their corresponding copy path buttons
509+
485510
## Multi-Select Actions Specification
486511

487512
The game picker includes four batch operations for selected game folders, accessible via the action dropdown:

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Project specific
22

3+
.vscode/**
4+
*.ipynb
35
*.traj.json
6+
logs/**
47

58
# -------------
69

@@ -212,5 +215,5 @@ marimo/_static/
212215
marimo/_lsp/
213216
__marimo__/
214217

215-
# Custom
216-
logs/
218+
219+
# >>>>>>>>> CUSTOM THINGS ON TOP OF FILE <<<<<<<<<

aws/run_job.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,8 @@ def get_latest_job_definition_arn(self) -> str:
5858
def submit_job(self, command: list[str], job_name: str | None = None) -> str:
5959
"""Submit a job to AWS Batch."""
6060
if job_name is None:
61-
# Generate a job name based on command and timestamp
62-
cmd_name = command[0] if command else "job"
63-
cmd_name = "".join(letter.lower() for letter in cmd_name if letter.isalpha())
6461
timestamp = int(time.time())
65-
job_name = f"codeclash-{cmd_name}-{timestamp}"
62+
job_name = f"codeclash-{timestamp}"
6663

6764
# Get current git branch and prepend it to the command
6865
current_branch = get_current_git_branch()
@@ -148,7 +145,7 @@ def main():
148145
description="Submit jobs to AWS Batch",
149146
formatter_class=argparse.RawDescriptionHelpFormatter,
150147
)
151-
parser.add_argument("--job-name", help="Custom job name (auto-generated if not specified)")
148+
parser.add_argument("-n", "--job-name", help="Custom job name (auto-generated if not specified)")
152149
parser.add_argument(
153150
"--job-definition", default="codeclash-default-job", help="Job definition name (default: codeclash-default-job)"
154151
)

aws/setup/batch/environment.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
{
22
"computeEnvironmentName": "codeclash-batch",
33
"computeEnvironmentArn": "arn:aws:batch:us-east-1:039984708918:compute-environment/codeclash-batch",
4-
"ecsClusterArn": "arn:aws:ecs:us-east-1:039984708918:cluster/AWSBatch-codeclash-batch-1561352c-9234-3de1-999a-dcd1c9989b32",
4+
"ecsClusterArn": "arn:aws:ecs:us-east-1:039984708918:cluster/AWSBatch-codeclash-batch-a9d4e10e-95a6-327b-ad6e-67ea5235e964",
55
"tags": {
66
"project": "codeclash",
77
"author": "kilian"
88
},
99
"type": "MANAGED",
1010
"state": "ENABLED",
11-
"status": "VALID",
1211
"statusReason": "ComputeEnvironment Healthy",
1312
"computeResources": {
1413
"type": "EC2",
1514
"allocationStrategy": "BEST_FIT_PROGRESSIVE",
16-
"minvCpus": 2,
17-
"maxvCpus": 16,
18-
"desiredvCpus": 2,
15+
"minvCpus": 0,
16+
"maxvCpus": 32,
17+
"desiredvCpus": 0,
1918
"instanceTypes": [
2019
"optimal"
2120
],
@@ -31,9 +30,11 @@
3130
"sg-014723b4566a8214d"
3231
],
3332
"instanceRole": "arn:aws:iam::039984708918:instance-profile/kilian-codeclash-ecsInstanceRole",
33+
"tags": {},
3434
"launchTemplate": {
3535
"launchTemplateName": "kilian-codeclash-launch-template",
36-
"version": "$Latest"
36+
"version": "$Latest",
37+
"overrides": []
3738
},
3839
"ec2Configuration": [
3940
{
@@ -46,6 +47,5 @@
4647
"terminateJobsOnUpdate": false,
4748
"jobExecutionTimeoutMinutes": 30
4849
},
49-
"containerOrchestrationType": "ECS",
50-
"uuid": "f413880a-eecc-3dfd-b139-0e9143381b4d"
50+
"uuid": "5246d4a1-4dd8-397e-82c2-af986d0f7a87"
5151
}

aws/setup/batch/iam-ebs.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

aws/setup/batch/iam-environment-role.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
],
3232
"RoleLastUsed": {
33-
"LastUsedDate": "2025-09-25 19:28:45+00:00",
33+
"LastUsedDate": "2025-09-26 20:48:55+00:00",
3434
"Region": "us-east-1"
3535
}
3636
}

aws/setup/batch/iam-execution-role.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
],
3333
"RoleLastUsed": {
34-
"LastUsedDate": "2025-09-25 19:02:55+00:00",
34+
"LastUsedDate": "2025-09-26 20:51:10+00:00",
3535
"Region": "us-east-1"
3636
}
3737
}

aws/setup/batch/iam-job-role.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
],
3333
"RoleLastUsed": {
34-
"LastUsedDate": "2025-09-25 19:02:58+00:00",
34+
"LastUsedDate": "2025-09-26 20:49:00+00:00",
3535
"Region": "us-east-1"
3636
}
3737
}

aws/setup/batch/job_definition.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"jobDefinitionName": "codeclash-default-job",
3-
"jobDefinitionArn": "arn:aws:batch:us-east-1:039984708918:job-definition/codeclash-default-job:1",
4-
"revision": 1,
5-
"status": "ACTIVE",
63
"type": "container",
74
"parameters": {},
85
"containerProperties": {
@@ -31,11 +28,15 @@
3128
"secrets": [
3229
{
3330
"name": "GITHUB_TOKEN",
34-
"valueFrom": "arn:aws:secretsmanager:us-east-1:039984708918:secret:kilian-codeclash-github-key-LIkSby:GITHUB_KEY::"
31+
"valueFrom": "arn:aws:secretsmanager:us-east-1:039984708918:secret:kilian-codeclash-keys-CTX9UJ:GITHUB_TOKEN::"
3532
},
3633
{
37-
"name": "OPENAI_API_KEY",
38-
"valueFrom": "arn:aws:secretsmanager:us-east-1:039984708918:secret:kilian-codeclash-github-key-LIkSby:OPENAI_API_KEY::"
34+
"name": "PORTKEY_API_KEY",
35+
"valueFrom": "arn:aws:secretsmanager:us-east-1:039984708918:secret:kilian-codeclash-keys-CTX9UJ:PORTKEY_API_KEY::"
36+
},
37+
{
38+
"name": "ANTHROPIC_API_KEY",
39+
"valueFrom": "arn:aws:secretsmanager:us-east-1:039984708918:secret:kilian-codeclash-keys-CTX9UJ:ANTHROPIC_API_KEY::"
3940
}
4041
]
4142
},
@@ -45,6 +46,5 @@
4546
},
4647
"platformCapabilities": [
4748
"EC2"
48-
],
49-
"containerOrchestrationType": "ECS"
49+
]
5050
}

aws/setup/batch/job_queue.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"jobQueueName": "codeclash-queue",
33
"jobQueueArn": "arn:aws:batch:us-east-1:039984708918:job-queue/codeclash-queue",
44
"state": "ENABLED",
5-
"status": "VALID",
65
"statusReason": "JobQueue Healthy",
76
"priority": 1,
87
"computeEnvironmentOrder": [

0 commit comments

Comments
 (0)