From 60ee86c71da5c39eaf00839e07986f6084dfb1a4 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 13 Mar 2025 16:33:14 -0700 Subject: [PATCH] docs: updated docker + README to reflect new monorepo structure, removed husky --- .devcontainer/.bashrc | 13 +++++++----- .devcontainer/devcontainer.json | 1 + .devcontainer/docker-compose.yml | 1 + .devcontainer/post-create.sh | 19 ++++++++++-------- .husky/_/post-checkout | 3 --- .husky/_/post-commit | 3 --- .husky/_/post-merge | 3 --- .husky/_/pre-push | 3 --- CONTRIBUTING.md | 34 +++++++++++++++++--------------- Dockerfile | 8 ++++---- README.md | 7 ++++--- docker-compose.yml | 2 +- docs/app/layout.config.tsx | 31 ++++++++++++++++++++++++++--- 13 files changed, 76 insertions(+), 52 deletions(-) delete mode 100755 .husky/_/post-checkout delete mode 100755 .husky/_/post-commit delete mode 100755 .husky/_/post-merge delete mode 100755 .husky/_/pre-push diff --git a/.devcontainer/.bashrc b/.devcontainer/.bashrc index e28153226..4dec58022 100644 --- a/.devcontainer/.bashrc +++ b/.devcontainer/.bashrc @@ -18,11 +18,14 @@ alias pgc="PGPASSWORD=postgres psql -h db -U postgres -d postgres" alias check-db="PGPASSWORD=postgres psql -h db -U postgres -c '\l'" # Sim Studio specific aliases -alias logs="tail -f logs/*.log 2>/dev/null || echo 'No log files found'" -alias sim-start="npm run dev" -alias sim-migrate="npx drizzle-kit push" -alias sim-generate="npx drizzle-kit generate" -alias sim-rebuild="npm run build && npm start" +alias logs="cd /workspace/sim && tail -f logs/*.log 2>/dev/null || echo 'No log files found'" +alias sim-start="cd /workspace/sim && npm run dev" +alias sim-migrate="cd /workspace/sim && npx drizzle-kit push" +alias sim-generate="cd /workspace/sim && npx drizzle-kit generate" +alias sim-rebuild="cd /workspace/sim && npm run build && npm start" + +# Default to sim directory +cd /workspace/sim 2>/dev/null || true # Welcome message - only show once per session if [ -z "$SIM_WELCOME_SHOWN" ]; then diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e80c8e27c..4a8758e37 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,6 +3,7 @@ "dockerComposeFile": "docker-compose.yml", "service": "app", "workspaceFolder": "/workspace", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", "customizations": { "vscode": { diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 6b0404827..2e540c375 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -15,6 +15,7 @@ services: depends_on: - db network_mode: service:db + working_dir: /workspace/sim db: image: postgres:14 diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index d033433cc..08090e58e 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -5,9 +5,12 @@ set -e echo "🔧 Setting up Sim Studio development environment..." +# Change to the sim directory +cd /workspace/sim + # Setup .bashrc echo "📄 Setting up .bashrc with aliases..." -cp .devcontainer/.bashrc ~/.bashrc +cp /workspace/.devcontainer/.bashrc ~/.bashrc # Add to .profile to ensure .bashrc is sourced in non-interactive shells echo 'if [ -f ~/.bashrc ]; then . ~/.bashrc; fi' >> ~/.profile @@ -55,13 +58,13 @@ echo "Waiting for database to be ready..." cat << EOF >> ~/.bashrc # Additional Sim Studio Development Aliases -alias migrate="npx drizzle-kit push" -alias generate="npx drizzle-kit generate" -alias dev="npm run dev" -alias build="npm run build" -alias start="npm run start" -alias lint="npm run lint" -alias test="npm run test" +alias migrate="cd /workspace/sim && npx drizzle-kit push" +alias generate="cd /workspace/sim && npx drizzle-kit generate" +alias dev="cd /workspace/sim && npm run dev" +alias build="cd /workspace/sim && npm run build" +alias start="cd /workspace/sim && npm run start" +alias lint="cd /workspace/sim && npm run lint" +alias test="cd /workspace/sim && npm run test" EOF # Source the .bashrc to make aliases available immediately diff --git a/.husky/_/post-checkout b/.husky/_/post-checkout deleted file mode 100755 index ff87d89c0..000000000 --- a/.husky/_/post-checkout +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8d606e58cce98604696a4abcf3ae1ebde6f9f31ac72bb0d44e2444cc39f26030 -size 360 diff --git a/.husky/_/post-commit b/.husky/_/post-commit deleted file mode 100755 index 2c2e4c948..000000000 --- a/.husky/_/post-commit +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f3eb4d1f62924c09d481a0563a84b158c66eb2feb3431cfdb3e6760aab4d661d -size 356 diff --git a/.husky/_/post-merge b/.husky/_/post-merge deleted file mode 100755 index 0fda28283..000000000 --- a/.husky/_/post-merge +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cecb594e8fa65831654fc95e96db9f1249e09c52810c6fbb2b428280aac22158 -size 354 diff --git a/.husky/_/pre-push b/.husky/_/pre-push deleted file mode 100755 index 2bbf06e01..000000000 --- a/.husky/_/pre-push +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a52d0510d0f8c75e27852156ec6f7791f0d8ed65fc58fcc368dd1de0a60a1d74 -size 350 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad926d8c4..05e874fea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ Thank you for your interest in contributing to Sim Studio! Our goal is to provide developers with a powerful, user-friendly platform for building, testing, and optimizing agentic workflows. We welcome contributions in all forms—from bug fixes and design improvements to brand-new features. > **Project Overview:** -> Sim Studio is built with Next.js (app router), ReactFlow, Zustand, Shadcn, and Tailwind CSS. Please ensure your contributions follow our best practices for clarity, maintainability, and consistency. +> Sim Studio is a monorepo containing the main application (`sim/`) and documentation (`docs/`). The main application is built with Next.js (app router), ReactFlow, Zustand, Shadcn, and Tailwind CSS. Please ensure your contributions follow our best practices for clarity, maintainability, and consistency. --- @@ -189,6 +189,8 @@ Dev Containers provide a consistent and easy-to-use development environment: - Open the project in VS Code - When prompted, click "Reopen in Container" (or press F1 and select "Remote-Containers: Reopen in Container") - Wait for the container to build and initialize + - The development environment will be set up in the `sim/` directory + 3. **Start Developing:** - All dependencies and configurations are automatically set up @@ -206,7 +208,7 @@ If you prefer not to use Docker or Dev Containers: 1. **Clone the Repository:** ```bash git clone https://github.com//sim.git - cd sim + cd sim/sim ``` 2. **Install Dependencies:** @@ -251,26 +253,26 @@ Sim Studio is built in a modular fashion where blocks and tools extend the platf ### Where to Add Your Code -- **Blocks:** Create your new block file under the `/blocks/blocks` directory. -- **Tools:** Create your new tool file under the `/tools` directory. +- **Blocks:** Create your new block file under the `/sim/blocks/blocks` directory. +- **Tools:** Create your new tool file under the `/sim/tools` directory. In addition, you will need to update the registries: -- **Block Registry:** Update the blocks index (usually `/blocks/index.ts`) to include your new block. -- **Tool Registry:** Update the tools registry (`/tools/index.ts`) to add your new tool. +- **Block Registry:** Update the blocks index (usually `/sim/blocks/index.ts`) to include your new block. +- **Tool Registry:** Update the tools registry (`/sim/tools/index.ts`) to add your new tool. ### How to Create a New Block 1. **Create a New File:** - Create a file for your block (e.g., `newBlock.ts`) in the `/blocks/blocks` directory. + Create a file for your block (e.g., `newBlock.ts`) in the `/sim/blocks/blocks` directory. 2. **Create a New Icon:** - Create a new icon for your block in the `/components/icons.tsx` file. + Create a new icon for your block in the `/sim/components/icons.tsx` file. 3. **Define the Block Configuration:** Your block should export a constant of type `BlockConfig`. For example: - ```typescript:blocks/blocks/newBlock.ts + ```typescript:/sim/blocks/blocks/newBlock.ts import { SomeIcon } from '@/components/icons' import { BlockConfig } from '../types' @@ -322,9 +324,9 @@ In addition, you will need to update the registries: ``` 4. **Register Your Block:** - Import and add your block to the blocks registry (`blocks/index.ts`) in the appropriate index file so it appears in the workflow builder. + Import and add your block to the blocks registry (`/sim/blocks/index.ts`) in the appropriate index file so it appears in the workflow builder. - ```typescript:blocks/index.ts + ```typescript:/sim/blocks/index.ts import { NewBlock } from './blocks/newBlock' export const blocks = [ @@ -344,7 +346,7 @@ In addition, you will need to update the registries: ### How to Create a New Tool 1. **Create a New Directory:** - For tools with multiple related functions, create a directory under `/tools` (e.g., `/tools/newService`). + For tools with multiple related functions, create a directory under `/sim/tools` (e.g., `/sim/tools/newService`). 2. **Create Tool Files:** Create files for your tool functionality (e.g., `read.ts`, `write.ts`) in your tool directory. @@ -352,7 +354,7 @@ In addition, you will need to update the registries: 3. **Create an Index File:** Create an `index.ts` file in your tool directory that imports and exports all tools with appropriate prefixes: - ```typescript:tools/newService/index.ts + ```typescript:/sim/tools/newService/index.ts import { readTool } from './read' import { writeTool } from './write' @@ -363,7 +365,7 @@ In addition, you will need to update the registries: 4. **Define the Tool Configuration:** Your tool should export a constant of type `ToolConfig`. For example: - ```typescript:tools/newService/read.ts + ```typescript:/sim/tools/newService/read.ts import { ToolConfig, ToolResponse } from '../types' interface NewToolParams { @@ -422,9 +424,9 @@ In addition, you will need to update the registries: ``` 5. **Register Your Tool:** - Update the tools registry in `/tools/index.ts` to include your new tool. Import from your tool's index.ts file: + Update the tools registry in `/sim/tools/index.ts` to include your new tool. Import from your tool's index.ts file: - ```typescript:tools/index.ts + ```typescript:/sim/tools/index.ts import { newServiceReadTool, newServiceWriteTool } from './newService' // ... other imports diff --git a/Dockerfile b/Dockerfile index 5842a68b9..24aa30783 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,12 @@ FROM node:20-alpine WORKDIR /app -# Copy package files -COPY package.json package-lock.json ./ +# Copy package files from sim directory +COPY sim/package.json sim/package-lock.json ./ RUN npm ci -# Copy everything else (for build) -COPY . . +# Copy sim directory contents +COPY sim/ ./ EXPOSE 3000 diff --git a/README.md b/README.md index 31bdf94a4..a1c9a44ae 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ git clone https://github.com/YOUR_USERNAME/sim.git cd sim # Create environment file -cp .env.example .env +cp sim/.env.example sim/.env # Start the Docker environment docker compose up -d @@ -62,7 +62,8 @@ After running these commands: 2. Install the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) 3. Open the project in your editor 4. Click "Reopen in Container" when prompted -5. Run `npm run dev` in the terminal +5. The environment will automatically be set up in the `sim` directory +6. Run `npm run dev` in the terminal or use the `sim-start` alias ### Option 3: Manual Setup @@ -71,7 +72,7 @@ After running these commands: ```bash # Clone the repository git clone https://github.com/YOUR_USERNAME/sim.git -cd sim +cd sim/sim # Install dependencies npm install diff --git a/docker-compose.yml b/docker-compose.yml index 8c5e7c75b..98c2aa9c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: ports: - "3000:3000" volumes: - - .:/app + - ./sim:/app - /app/node_modules - /app/.next environment: diff --git a/docs/app/layout.config.tsx b/docs/app/layout.config.tsx index 18e7c93c1..9e4cb77b5 100644 --- a/docs/app/layout.config.tsx +++ b/docs/app/layout.config.tsx @@ -1,3 +1,28 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0c36ff1e237cbde797d005f6cb7d740f883efda7e5f724c2fbb60d9208f9c2e0 -size 412 +import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared' + +/** + * Shared layout configurations + * + * you can customise layouts individually from: + * Home Layout: app/(home)/layout.tsx + * Docs Layout: app/docs/layout.tsx + */ +export const baseOptions: BaseLayoutProps = { + nav: { + title: ( + <> + + + + My App + + ), + }, + links: [ + { + text: 'Documentation', + url: '/docs', + active: 'nested-url', + }, + ], +} \ No newline at end of file