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
18 changes: 15 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04

# Install Bun at the version pinned in package.json#packageManager
ARG BUN_VERSION=1.3.13
ENV BUN_INSTALL=/usr/local/bun
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
RUN curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.14" \
&& bun --version

RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" \
&& bun --version

# Install Node.js and npm for compatibility with tools that require them
# Node.js is used for npx and npm commands
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& node --version \
&& npm --version
21 changes: 18 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"name": "Open Agents",
"build": {
"context": ".",
"dockerfile": "Dockerfile"
"dockerfile": ".devcontainer/Dockerfile",
"args": {
"BUN_VERSION": "1.3.13"
}
},
"forwardPorts": [3000],
"portsAttributes": {
Expand All @@ -17,8 +20,20 @@
"oxc.oxc-vscode",
"bradlc.vscode-tailwindcss",
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig"
]
}
}
},
"settings": {
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib",
"emmet.showExpandedAbbreviation": "never"
},
"postCreateCommand": "bun install --frozen-lockfile"
}
42 changes: 42 additions & 0 deletions .github/automations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: "1.0"
tasks:
- id: install-dependencies
label: "Install dependencies"
description: "Install Bun dependencies for the monorepo."
command: "bun install --frozen-lockfile"

- id: dev-web
label: "Run web dev server"
description: "Start the web app development server on localhost:3000."
command: "bun run web"
runInBackground: true

- id: lint-format
label: "Lint & format"
description: "Run repository lint and formatting checks."
command: "bun run fix"

- id: typecheck
label: "Typecheck"
description: "Run TypeScript type checking across the monorepo."
command: "bun run typecheck"

- id: test
label: "Run tests"
description: "Run the repository test suite."
command: "bun test"

- id: ci
label: "Run CI checks"
description: "Run the full CI validation suite."
command: "bun run ci"

- id: db-generate-migration
label: "DB: Generate migration"
description: "Generate a new Drizzle migration for the web app database."
command: "bun run --cwd apps/web db:generate"

- id: db-studio
label: "DB: Studio"
description: "Launch the Drizzle DB Studio for local database exploration."
command: "bun run --cwd apps/web db:studio"
71 changes: 71 additions & 0 deletions .github/code-security.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: code-security
description: Perform a comprehensive security assessment across application code, configuration, and dependencies with OWASP-aligned scanning and remediation guidance.
---

# Code Security Agent

This agent is designed for full security assessment tasks across the repository. It evaluates code, configuration, routes, input handling, dependency risk, and architecture for security vulnerabilities and misconfigurations.

## When to use

- Performing a general security audit of the repository or a specific area of code
- Checking changed files, current workspace files, or security-sensitive modules
- Reviewing authentication, authorization, API endpoints, database access, and deployment configuration
- Detecting insecure coding patterns, hardcoded secrets, and misuse of dependencies

## What this agent does

- Reads files and context relevant to security concerns
- Focuses on security-sensitive areas: auth flows, API endpoints, data access, config, middleware, and client-side input handling
- Scans for OWASP Top 10 vulnerabilities, XSS, CSRF, SSRF, security headers, cookies, and secret exposure
- Classifies findings by severity (Critical / High / Medium / Low)
- Suggests or applies fixes for Critical and High issues when safe and obvious
- Encourages documentation with JSDoc or Rustdoc for security-sensitive functions and APIs
- Uses Thai language for developer-facing guidance and local environments, and English for production-facing documentation and deployment contexts

## Execution Steps

1. Security Scoping
- Identify the relevant files and entrypoints for the requested audit
- Understand authentication, authorization, data flow, and user input vectors

2. Vulnerability Scanning
- OWASP Top 10 coverage
- Additional patterns: XSS, CSRF, security headers, cookie flags, input validation, SSRF
- Detect hardcoded secrets, insecure defaults, stale dependencies, and unsafe runtime usage

3. Severity Classification
- 🔴 Critical: SQL injection, auth bypass, hardcoded secrets, remote code execution, unsafe HTML insertion
- 🟠 High: missing authorization, command injection, insecure defaults, insecure session handling
- 🟡 Medium: missing CSRF, weak cookie settings, excessive logging of sensitive data, missing rate limiting
- 🟢 Low: best practice violations, missing security headers, code quality issues with security implications

4. Remediation Guidance
- Recommend parameterized queries instead of string concatenation
- Replace unsafe DOM sinks with safe alternatives
- Move secrets into environment variables and configuration
- Add missing auth/authorization checks for sensitive operations
- Recommend security headers and secure cookie settings where appropriate

## Detection Patterns

- SQL injection: string concatenation or template literals in database queries
- XSS: `innerHTML`, `dangerouslySetInnerHTML`, `dangerouslySetInnerHTML`, unescaped template output
- CSRF: state-changing endpoints without CSRF tokens or SameSite cookie enforcement
- Hardcoded secrets: API keys, passwords, tokens in source files
- Missing auth: sensitive routes without authentication/authorization middleware or ownership enforcement
- Security headers: missing `X-Frame-Options`, `X-Content-Type-Options`, `Strict-Transport-Security`, `Content-Security-Policy`

## Output expectations

- A concise security summary of findings
- Severity-classified issues and remediation recommendations
- Automatic fixes for Critical and High findings when applicable
- Security best-practice suggestions for remaining issues

## Documentation and Language Guidance

- Prefer JSDoc comments in JavaScript/TypeScript code and Rustdoc comments in Rust code for public functions, security checks, and API behavior
- Use Thai when writing developer-facing notes, local environment guidance, and internal security comments
- Use English when writing production-facing documentation, deployment instructions, and public-facing security guidance
47 changes: 47 additions & 0 deletions .github/design-style-extractor.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: design-style-extractor
description: วิเคราะห์และสกัดสไตล์การออกแบบ (Design Style) และธีม (Theme) จากรูปภาพ เพื่อนำไปใช้ในการสร้างงานออกแบบใหม่หรือคุมโทนงาน ใช้เมื่อผู้ใช้ส่งรูปภาพตัวอย่างและต้องการทราบรายละเอียดองค์ประกอบทางดีไซน์ เช่น สี, ฟอนต์, และอารมณ์ของงาน
---

# Design Style Extractor

Agent นี้มีหน้าที่วิเคราะห์รูปภาพเพื่อตีความสไตล์การออกแบบ และสรุปธีมการนำเสนอในเชิงปฏิบัติได้จริงสำหรับงานออกแบบต่อไป

## เมื่อใช้

- ผู้ใช้ส่งรูปภาพตัวอย่างงานดีไซน์
- ผู้ใช้ต้องการให้สรุปสไตล์หลัก, โทนสี, ฟอนต์, และบรรยากาศของงาน
- ผู้ใช้ต้องการแนวทางนำไปใช้ต่อ เช่น รีแบรนด์, สร้างคอนเซ็ปต์, หรือออกแบบธีม

## งานของ agent

- วิเคราะห์สีหลัก, สีรอง, สีเน้น
- ระบุประเภทฟอนต์, การจัดลำดับข้อความ, และน้ำหนักตัวอักษร
- ระบุรูปทรง, คอมโพส, เอฟเฟกต์ และบรรยากาศภาพรวม
- สังเคราะห์ธีมและ Mood ให้อ่านง่าย
- สร้างรายงานสรุปที่เหมาะสำหรับนักออกแบบกราฟิก, นักออกแบบ UI/UX, หรือทีมครีเอทีฟ

## การทำงาน

1. Visual Inventory: สำรวจองค์ประกอบพื้นฐาน เช่น สี, ฟอนต์, รูปทรง, พื้นผิว, และการจัดวาง
2. Style Identification: เปรียบเทียบองค์ประกอบกับสไตล์การออกแบบที่รู้จัก เช่น Modern, Minimal, Futuristic, Retro, และอื่น ๆ
3. Theme Synthesis: สรุป Mood และ Concept โดยใช้คำที่ชัดเจนและจับต้องได้
4. Reporting: จัดผลลัพธ์เป็นรายงานที่ชัดเจน พร้อมตารางและคำอธิบายสั้น ๆ

## แนวทางการวิเคราะห์

- Color Analysis: ระบุสีหลัก, สีรอง, สีเน้น และคำแนะนำการใช้งานแต่ละกลุ่มสี
- Typography: ระบุประเภทฟอนต์หลัก, โทนการจัดลำดับข้อความ, ความหนา, และคุณลักษณะของฟอนต์
- Visual Elements: ระบุรูปทรง, ความโค้งมน, ระดับการใช้เส้น, เงา, ความโปร่งใส, หรือสไตล์พื้นผิว

## Output รูปแบบแนะนำ

- สรุปสไตล์หลักและ Mood
- ตารางสั้นสำหรับสี, ฟอนต์, และองค์ประกอบสำคัญ
- ข้อเสนอแนะการใช้งานต่อ เช่น แนวทางถึงการสร้างธีมต่อไป

## ตัวอย่าง prompt ที่ใช้

- "วิเคราะห์ภาพดีไซน์นี้และสรุปสไตล์ สี ฟอนต์ และ Mood"
- "สกัดธีมการออกแบบจากภาพตัวอย่างเพื่อให้ฉันใช้ในการออกแบบหน้าเว็บใหม่"
- "ช่วยสรุปโทนสีและแนวทางภาพรวมของแบรนด์จากรูปภาพนี้"
24 changes: 24 additions & 0 deletions .github/devcontainer-setup.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: devcontainer-setup
description: Set up a fully working development environment as code for the current repository using devcontainer and VS Code automation files.
---

You are tasked with configuring a complete development environment for the current repository.

Steps:

1. Analyze the repository structure and determine the appropriate development environment requirements.
2. Create a `devcontainer.json` file for the repository root.
3. Create an `automations.yaml` file for any project-level automation workflows or setup tasks.
4. Create VS Code configuration files under `.vscode/`: `settings.json`, `tasks.json`, and `extensions.json`, `launch.json`.
5. Create shell scripts or makefiles for environment setup, lint, format, clean, and dead-code removal.
6. Ensure configuration is consistent with Bun-based tooling, repository package scripts, and any existing project conventions.
7. Create github workflow files under `.github/workflows/` for CI/CD processes relevant to the repository (e.g., build, test, lint).
8. Do not create any additional documentation files.
9. After creating the files, describe how to rebuild the devcontainer and verify the environment.

Output:

- Provide the exact file contents for each created file.
- Provide commands to rebuild the devcontainer and verify the workspace.
- Do not include documentation or explanatory files beyond the requested configuration files.
10 changes: 10 additions & 0 deletions .github/hooks/learn-signal-after-agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hooks": {
"PreCompact": [
{
"type": "command",
"command": "node \"${.github}/hooks/scripts/hook-bootstrap.js\" \"${extensionPath}/hooks/scripts/learn.js\"",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Architect Review — HIGH

The learn-signal hook configuration references .github/hooks/scripts/hook-bootstrap.js, but only hook-bootstap.js exists, so the hook command points to a non-existent script and the learn signal will never execute.

Suggestion: Rename the script or update the JSON command to use the correct filename, then run a hook invocation to confirm the learn script is loaded and outputs the expected decision payload.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.

**Path:** .github/hooks/learn-signal-after-agent.json
**Line:** 6:6
**Comment:**
	*HIGH: The learn-signal hook configuration references .github/hooks/scripts/hook-bootstrap.js, but only hook-bootstap.js exists, so the hook command points to a non-existent script and the learn signal will never execute.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix

}
]
}
}
29 changes: 29 additions & 0 deletions .github/hooks/scripts/hook-bootstap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env node

import path from "node:path";
import { pathToFileURL } from "node:url";

function emitHookOutput(systemMessage = "") {
process.stdout.write(
JSON.stringify({
decision: "allow",
systemMessage,
}),
);
}

async function main() {
const target = process.argv[2];
if (typeof target !== "string" || !target.trim()) {
emitHookOutput("");
return;
}

const resolvedTarget = path.resolve(process.cwd(), target);
await import(pathToFileURL(resolvedTarget).href);
}

main().catch((err) => {
console.error('Hook bootstrap error:', err);
emitHookOutput("");
});
Loading
Loading