From 4b1cacbfe70de043f6dc96eb4eaa6521bebfbd43 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Thu, 23 Oct 2025 06:26:11 +0100 Subject: [PATCH 01/16] fix: Improve codespace UX - README and terminal handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes two UX issues: 1. README not opening on codespace start - VS Code "Get Started" page appears instead of README - Added postStartCommand to open README.md - Duplicated in postAttachCommand for reconnects 2. Post-setup script opens confusing new terminal - Script was running in .bashrc, blocking first terminal - User had to manually switch terminals - Solution: Run post-create via postCreateCommand in background - Uses nohup to detach from terminal - Logs to /tmp/post-create.log instead of blocking Before: - First terminal blocked by post-create.sh output - User sees "Get Started" page - Must manually find and switch to correct terminal After: - Terminal immediately available with venv active - README.md opens automatically - Post-create runs silently in background ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .devcontainer/Dockerfile | 6 ------ .devcontainer/devcontainer.json | 10 +++++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6b93a6c..28a97b3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -49,12 +49,6 @@ RUN --mount=type=bind,target=/src \ curl -LsSf https://astral.sh/uv/install.sh | sh && \ echo 'export PATH="/home/user/.local/bin:$PATH"' >> ~/.bashrc && \ echo 'eval "$(pdm venv activate in-project 2>/dev/null || true)"' >> ~/.bashrc && \ - echo '' >> ~/.bashrc && \ - echo '# Run post-create setup once per codespace' >> ~/.bashrc && \ - echo 'if [ ! -f ~/.post-create-complete ] && [ -f /usr/local/share/post-create.sh ]; then' >> ~/.bashrc && \ - echo ' /usr/local/share/post-create.sh' >> ~/.bashrc && \ - echo ' touch ~/.post-create-complete' >> ~/.bashrc && \ - echo 'fi' >> ~/.bashrc && \ cp /src/pyproject.toml . && \ cp /src/pdm.lock . && \ pdm config use_uv true && \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7e7e04c..3d63f7b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -40,13 +40,13 @@ // Run during prebuild - installs Python dependencies (cached!) "onCreateCommand": "bash .devcontainer/install-deps.sh", - // Post-create logic runs via .bashrc to avoid race condition with user terminal - // See: https://code.visualstudio.com/remote/advancedcontainers/start-processes#_adding-startup-commands-to-the-docker-image-instead + // Run post-create setup asynchronously (runs in background, doesn't block terminal) + "postCreateCommand": "nohup bash /usr/local/share/post-create.sh > /tmp/post-create.log 2>&1 &", - // Use 'postStartCommand' to run commands after the container starts - "postStartCommand": "echo 'ChipFlow development environment is ready!'", + // Open README.md when container starts + "postStartCommand": "code README.md", - // Open README.md when user attaches to the codespace + // This is needed to ensure README opens on attach as well "postAttachCommand": "code README.md", // Container optimizations From 8de2e299eddbf315b03c70b90523034d4173a71b Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Fri, 24 Oct 2025 12:38:40 +0100 Subject: [PATCH 02/16] feat: Add PR comment workflow with configurator test link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatically comments on PRs with a link to test the devcontainer changes via the configurator's template_branch parameter. When a PR is opened, the workflow comments with: https://configurator.chipflow.io/?template_branch= This enables testing devcontainer changes in a real codespace before merging. Benefits: - Zero additional infrastructure needed - Real testing with actual codespaces - Fast iteration on PR changes - Integrated with configurator workflow ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/pr-comment-test-link.yml | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/pr-comment-test-link.yml diff --git a/.github/workflows/pr-comment-test-link.yml b/.github/workflows/pr-comment-test-link.yml new file mode 100644 index 0000000..8bd136c --- /dev/null +++ b/.github/workflows/pr-comment-test-link.yml @@ -0,0 +1,70 @@ +name: PR Comment - Test Link + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + comment-test-link: + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - name: Comment test link + uses: actions/github-script@v7 + with: + script: | + const branch = context.payload.pull_request.head.ref; + const prNumber = context.payload.pull_request.number; + const testUrl = `https://configurator.chipflow.io/?template_branch=${encodeURIComponent(branch)}`; + + const comment = `## ๐Ÿงช Test this PR in a Codespace + + Use the configurator with this PR's devcontainer changes: + + **[Open Configurator with branch: \`${branch}\`](${testUrl})** + + This will create a codespace using the devcontainer configuration from this PR branch. + + ### How to test: + 1. Click the link above + 2. Configure your chip design in the configurator + 3. Click "Generate & Simulate" + 4. Authenticate with GitHub if prompted + 5. A codespace will be created using the devcontainer from \`${branch}\` + 6. Verify the codespace UX and functionality + + --- + + ๐Ÿ’ก **Tip:** You can also manually append \`?template_branch=${encodeURIComponent(branch)}\` to any configurator URL to test this branch.`; + + // Check if we already commented + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + + const botComment = comments.find(comment => + comment.user?.type === 'Bot' && + comment.body?.includes('Test this PR in a Codespace') + ); + + if (botComment) { + // Update existing comment + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: comment + }); + } else { + // Create new comment + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: comment + }); + } From 357edf5df8ea2a1ce394a12624dadcf59ebdc135 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Fri, 24 Oct 2025 16:13:52 +0100 Subject: [PATCH 03/16] docs: Add comprehensive README for codespace users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add README.md with two-part structure: - Getting Started section for codespace users (top priority) - Developer documentation for reference Fixes the postStartCommand/postAttachCommand errors since README now exists when codespace opens. ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4fe17f9 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +# ChipFlow Project + +Welcome to your ChipFlow hardware design project! This repository was generated from the [ChipFlow Configurator](https://configurator.chipflow.io) and contains everything you need to simulate and verify your chip design. + +## Getting Started in Codespaces + +Your development environment is ready to use! Here's how to get started: + +### 1. Build Your Design + +```bash +chipflow sim build +``` + +This command: +- Generates Verilog from your chip configuration +- Compiles the simulation executable +- Prepares everything for running simulations + +### 2. Run Simulations + +```bash +chipflow sim run +``` + +This will execute your design simulation and show the results. + +### 3. View Results + +After simulation, you can explore the generated files: +- **Verilog sources**: Check the generated RTL code +- **Waveforms**: View signal traces (if waveform dumping is enabled) +- **Test results**: See simulation output and verification results + +### Need Help? + +- **ChipFlow Documentation**: [docs.chipflow.io](https://docs.chipflow.io) +- **Report Issues**: [github.com/ChipFlow/chipflow-template/issues](https://github.com/ChipFlow/chipflow-template/issues) +- **Configurator**: [configurator.chipflow.io](https://configurator.chipflow.io) + +--- + +## Developer Documentation + +### Project Structure + +``` +. +โ”œโ”€โ”€ .devcontainer/ # Codespace/devcontainer configuration +โ”œโ”€โ”€ designs/ # Generated chip designs (created after build) +โ”œโ”€โ”€ pyproject.toml # Python dependencies +โ”œโ”€โ”€ pdm.lock # Locked dependency versions +โ””โ”€โ”€ README.md # This file +``` + +### ChipFlow Commands + +| Command | Description | +|---------|-------------| +| `chipflow sim build` | Build the simulation from your design configuration | +| `chipflow sim run` | Run the compiled simulation | +| `chipflow pin lock` | Lock pin assignments for your design | + +### Development Workflow + +1. **Modify Design**: Update your chip configuration through the configurator or directly edit design files +2. **Build**: Run `chipflow sim build` to regenerate Verilog and compile +3. **Simulate**: Run `chipflow sim run` to test your changes +4. **Iterate**: Review results and repeat + +### Environment Details + +This devcontainer includes: +- **Python 3.x** with PDM package manager +- **ChipFlow toolchain** for hardware design +- **Yosys** (via yowasp-yosys) for synthesis +- **Zig** for compilation +- Pre-warmed caches for fast startup + +### Testing Locally + +If you want to test the devcontainer locally with VS Code or other Docker-compatible tools: + +```bash +# The devcontainer should work with any tool supporting the devcontainer spec +code . # Opens in VS Code with devcontainer support +``` + +### Contributing + +This is a template repository. If you find issues with the devcontainer setup or have suggestions: +1. Visit [ChipFlow/chipflow-template](https://github.com/ChipFlow/chipflow-template) +2. Open an issue or pull request + +--- + +**Generated with ChipFlow** - [configurator.chipflow.io](https://configurator.chipflow.io) From 1c9b65451665eda2d2e99acba6bee05b0c56e03e Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sat, 25 Oct 2025 19:47:06 +0100 Subject: [PATCH 04/16] feat: Add welcome page auto-open on codespace startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace README auto-opening with welcome page served from configurator. Changes: - Remove postStartCommand/postAttachCommand from devcontainer.json (was trying to run 'code README.md' which fails in codespace startup) - Update post-create.sh to display and auto-open welcome page URL - Show formatted message in terminal with welcome URL - Auto-open browser with 'gp preview' (Codespaces) or Python webbrowser - Keep README.md for reference (but don't auto-open) The welcome page provides personalized getting started info including design configuration, enabled blocks, and copy-paste commands. ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .devcontainer/devcontainer.json | 6 ------ .devcontainer/post-create.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3d63f7b..a3dcae1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -43,12 +43,6 @@ // Run post-create setup asynchronously (runs in background, doesn't block terminal) "postCreateCommand": "nohup bash /usr/local/share/post-create.sh > /tmp/post-create.log 2>&1 &", - // Open README.md when container starts - "postStartCommand": "code README.md", - - // This is needed to ensure README opens on attach as well - "postAttachCommand": "code README.md", - // Container optimizations "containerEnv": { "PYTHONUNBUFFERED": "1", diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index f5becc7..890be30 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -160,6 +160,36 @@ if [ -f ".venv/bin/activate" ]; then echo "โœ… PDM virtual environment is active" echo "" fi + +# Display welcome page URL if available +if [ -n "$CHIPFLOW_WELCOME_URL" ]; then + echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" + echo "๐Ÿ“– Getting Started Guide" + echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" + echo "" + echo "๐ŸŒ Opening welcome page in browser..." + echo " $CHIPFLOW_WELCOME_URL" + echo "" + echo " The page includes:" + echo " โ€ข Your design configuration" + echo " โ€ข Copy-paste commands to get started" + echo " โ€ข Links to documentation" + echo "" + + # Auto-open in browser (GitHub Codespaces command) + # This works in both web and desktop VS Code Codespaces + if command -v gp >/dev/null 2>&1; then + # Gitpod/Codespaces browser opener + gp preview "$CHIPFLOW_WELCOME_URL" >/dev/null 2>&1 & + elif command -v python3 >/dev/null 2>&1; then + # Fallback: use python webbrowser module + python3 -c "import webbrowser; webbrowser.open('$CHIPFLOW_WELCOME_URL')" >/dev/null 2>&1 & + fi + + echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" + echo "" +fi + echo "Quick commands:" echo " โ€ข F5 or Cmd/Ctrl+Shift+B - Build and run simulation" echo " โ€ข chipflow --help - ChipFlow CLI help" From afdf3927e79b35bfe5efcc93ee374f55f9b502e3 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sat, 25 Oct 2025 19:35:33 +0100 Subject: [PATCH 05/16] codespace: tidy up --- .devcontainer/Dockerfile | 1 + .devcontainer/first-run-notice.txt | 8 +------- .devcontainer/post-create.sh | 10 ++-------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 28a97b3..1fa7ea1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -48,6 +48,7 @@ RUN --mount=type=bind,target=/src \ curl -sSL https://pdm-project.org/install-pdm.py | python3 - && \ curl -LsSf https://astral.sh/uv/install.sh | sh && \ echo 'export PATH="/home/user/.local/bin:$PATH"' >> ~/.bashrc && \ + echo 'export PS1="\W\$"' >> ~/.bashrc && \ echo 'eval "$(pdm venv activate in-project 2>/dev/null || true)"' >> ~/.bashrc && \ cp /src/pyproject.toml . && \ cp /src/pdm.lock . && \ diff --git a/.devcontainer/first-run-notice.txt b/.devcontainer/first-run-notice.txt index a255f79..be3c260 100644 --- a/.devcontainer/first-run-notice.txt +++ b/.devcontainer/first-run-notice.txt @@ -1,7 +1 @@ -๐ŸŽ‰ ChipFlow codespace is ready! - -Quick commands: - โ€ข F5 or Cmd/Ctrl+Shift+B - Build and run simulation - โ€ข chipflow --help - ChipFlow CLI help - โ€ข pdm run --list - See all available commands - +๐ŸŽ‰ ChipFlow codespace is starting up, please wait!... diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 890be30..1852064 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -14,9 +14,6 @@ cat << EOF > ~/.vscode.settings } EOF -# simple prompt.. -export PS1="\W\$ " - # Ensure PDM is in PATH and venv auto-activation is configured export PATH="/home/user/.local/bin:$PATH" eval "$(pdm venv activate in-project 2>/dev/null || true)" @@ -55,20 +52,17 @@ if [ -n "$CODESPACE_NAME" ]; then # pdm config cache_dir ~/.cache/pdm # # Copy yowasp cache from Docker image - echo "๐Ÿ”ฅ Copying yowasp-yosys cache..." + echo "๐Ÿ”ฅ Synchronizing caches..." if [ -d /opt/chipflow-cache/yowasp ] && [ "$(ls -A /opt/chipflow-cache/yowasp)" ]; then - rm -rf ~/.cache/YoWASP mkdir -p ~/.cache/YoWASP - cp -r /opt/chipflow-cache/yowasp/* ~/.cache/YoWASP/ + rsync /opt/chipflow-cache/yowasp/* ~/.cache/YoWASP/ echo "โœ… yowasp-yosys cache copied" else echo "โš ๏ธ No yowasp cache found" fi # Copy zig cache from Docker image - echo "๐Ÿ”ฅ Copying zig cache..." if [ -d /opt/chipflow-cache/zig ] && [ "$(ls -A /opt/chipflow-cache/zig)" ]; then - rm -rf ~/.cache/zig mkdir -p ~/.cache/zig cp -r /opt/chipflow-cache/zig/* ~/.cache/zig/ echo "โœ… zig cache copied" From f90cc444c997918112b781ee285f7688c4188980 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 01:18:07 +0100 Subject: [PATCH 06/16] codespace: Reinstate calling post-create from dockerfile --- .devcontainer/Dockerfile | 6 ++++++ .devcontainer/devcontainer.json | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1fa7ea1..c9261ac 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -50,6 +50,12 @@ RUN --mount=type=bind,target=/src \ echo 'export PATH="/home/user/.local/bin:$PATH"' >> ~/.bashrc && \ echo 'export PS1="\W\$"' >> ~/.bashrc && \ echo 'eval "$(pdm venv activate in-project 2>/dev/null || true)"' >> ~/.bashrc && \ + echo '' >> ~/.bashrc && \ + echo '# Run post-create setup once per codespace' >> ~/.bashrc && \ + echo 'if [ ! -f ~/.post-create-complete ] && [ -f /usr/local/share/post-create.sh ]; then' >> ~/.bashrc && \ + echo ' /usr/local/share/post-create.sh' >> ~/.bashrc && \ + echo ' touch ~/.post-create-complete' >> ~/.bashrc && \ + echo 'fi' >> ~/.bashrc && \ cp /src/pyproject.toml . && \ cp /src/pdm.lock . && \ pdm config use_uv true && \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a3dcae1..08410d3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -40,9 +40,6 @@ // Run during prebuild - installs Python dependencies (cached!) "onCreateCommand": "bash .devcontainer/install-deps.sh", - // Run post-create setup asynchronously (runs in background, doesn't block terminal) - "postCreateCommand": "nohup bash /usr/local/share/post-create.sh > /tmp/post-create.log 2>&1 &", - // Container optimizations "containerEnv": { "PYTHONUNBUFFERED": "1", From c878cbef6cfd5626ba5ba1cac4400426a4083ea9 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 13:09:06 +0000 Subject: [PATCH 07/16] codespace: Don't show 'first startup' message in post-create --- .devcontainer/post-create.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 1852064..51567fd 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -192,4 +192,3 @@ echo "" echo "Entering venv:" pdm config check_update false eval $(pdm venv activate) -cat .devcontainer/first-run-notice.txt From 755212e7aba4641190492034e5ac9a122414472c Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 13:36:51 +0000 Subject: [PATCH 08/16] codespace: fix prompt --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c9261ac..004735b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -48,7 +48,7 @@ RUN --mount=type=bind,target=/src \ curl -sSL https://pdm-project.org/install-pdm.py | python3 - && \ curl -LsSf https://astral.sh/uv/install.sh | sh && \ echo 'export PATH="/home/user/.local/bin:$PATH"' >> ~/.bashrc && \ - echo 'export PS1="\W\$"' >> ~/.bashrc && \ + echo 'export PS1="\W\$ "' >> ~/.bashrc && \ echo 'eval "$(pdm venv activate in-project 2>/dev/null || true)"' >> ~/.bashrc && \ echo '' >> ~/.bashrc && \ echo '# Run post-create setup once per codespace' >> ~/.bashrc && \ From cbe6c17cfcd47d94a7350133bcd923ae0ec0bf6c Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 13:44:04 +0000 Subject: [PATCH 09/16] codespace: Save api and welcome env variables, use rsync -tr for cache sync --- .devcontainer/post-create.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 51567fd..14357b0 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -21,6 +21,9 @@ eval "$(pdm venv activate in-project 2>/dev/null || true)" # Configurator API base URL (can be overridden via environment) CONFIGURATOR_API="${CHIPFLOW_CONFIGURATOR_API:-https://configurator.chipflow.io}" +# save to bashrc +echo "export CHIPFLOW_CONFIGURATOR_API=\"$CHIPFLOW_CONFIGURTOR_API\"" >> ~/.bashrc && \ + # Check if we're in a codespace and can fetch design from configurator if [ -n "$CODESPACE_NAME" ]; then echo "๐Ÿ“ก Fetching design configuration for codespace: $CODESPACE_NAME" @@ -55,22 +58,19 @@ if [ -n "$CODESPACE_NAME" ]; then echo "๐Ÿ”ฅ Synchronizing caches..." if [ -d /opt/chipflow-cache/yowasp ] && [ "$(ls -A /opt/chipflow-cache/yowasp)" ]; then mkdir -p ~/.cache/YoWASP - rsync /opt/chipflow-cache/yowasp/* ~/.cache/YoWASP/ - echo "โœ… yowasp-yosys cache copied" + rsync -tr /opt/chipflow-cache/yowasp/* ~/.cache/YoWASP/ && echo " โœ… yowasp-yosys cache copied" else - echo "โš ๏ธ No yowasp cache found" + echo " โš ๏ธ No yowasp cache found" fi # Copy zig cache from Docker image if [ -d /opt/chipflow-cache/zig ] && [ "$(ls -A /opt/chipflow-cache/zig)" ]; then mkdir -p ~/.cache/zig - cp -r /opt/chipflow-cache/zig/* ~/.cache/zig/ - echo "โœ… zig cache copied" + rsync -tr /opt/chipflow-cache/zig/* ~/.cache/zig/ && echo " โœ… zig cache copied" else - echo "โš ๏ธ No zig cache found" + echo " โš ๏ธ No zig cache found" fi - echo "โœ… Fixing cache permissions" chmod -R u+w ~/.cache for attempt in $(seq 1 $MAX_RETRIES); do @@ -182,6 +182,9 @@ if [ -n "$CHIPFLOW_WELCOME_URL" ]; then echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" echo "" + + # save welcome url in bashrc + echo "export CHIPFLOW_WELCOME_URL=\"$CHIPFLOW_WELCOME_URL\"" >> ~/.bashrc && \ fi echo "Quick commands:" From f8e843c7fa5c03dd7503f96f18a5f47e0926b0dd Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 13:59:28 +0000 Subject: [PATCH 10/16] codespace: Don't bother chmoding cache --- .devcontainer/post-create.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 14357b0..8fa5f0d 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -71,7 +71,6 @@ if [ -n "$CODESPACE_NAME" ]; then echo " โš ๏ธ No zig cache found" fi - chmod -R u+w ~/.cache for attempt in $(seq 1 $MAX_RETRIES); do echo "Attempt $attempt/$MAX_RETRIES..." From f13e431f8c5c2d4950a52510c2d3b004d20e40fe Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 14:00:44 +0000 Subject: [PATCH 11/16] codespace: remove erronous line continuations --- .devcontainer/post-create.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 8fa5f0d..a412aaa 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -22,7 +22,7 @@ eval "$(pdm venv activate in-project 2>/dev/null || true)" CONFIGURATOR_API="${CHIPFLOW_CONFIGURATOR_API:-https://configurator.chipflow.io}" # save to bashrc -echo "export CHIPFLOW_CONFIGURATOR_API=\"$CHIPFLOW_CONFIGURTOR_API\"" >> ~/.bashrc && \ +echo "export CHIPFLOW_CONFIGURATOR_API=\"$CHIPFLOW_CONFIGURTOR_API\"" >> ~/.bashrc # Check if we're in a codespace and can fetch design from configurator if [ -n "$CODESPACE_NAME" ]; then @@ -183,7 +183,7 @@ if [ -n "$CHIPFLOW_WELCOME_URL" ]; then echo "" # save welcome url in bashrc - echo "export CHIPFLOW_WELCOME_URL=\"$CHIPFLOW_WELCOME_URL\"" >> ~/.bashrc && \ + echo "export CHIPFLOW_WELCOME_URL=\"$CHIPFLOW_WELCOME_URL\"" >> ~/.bashrc fi echo "Quick commands:" From 72c8419c86525c0bbf1cf4ad17e69ce311bf1661 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 17:15:01 +0000 Subject: [PATCH 12/16] codespace: Install GitHub extension, and disable making plugin recoomendations --- .devcontainer/devcontainer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 08410d3..79033f1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,11 +25,13 @@ "github.copilot.inlineSuggest.enable": false, "chat.commandCenter.enabled": false, "chat.agent.enabled": false, - "workbench.startupEditor": "readme" + "workbench.startupEditor": "readme", + "extensions.ignoreRecommendations": true }, "extensions": [ "ms-python.python", - "-github.copilot-chat" + "-github.copilot-chat", + "github.vscode-github-actions" ] } }, From 80f1c074baa0e0b41adcf3da63a9898c822386ef Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 18:09:01 +0000 Subject: [PATCH 13/16] codespace: disable git autofetch, and set chat.disableAIFeatures --- .devcontainer/devcontainer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 79033f1..5d5753c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,8 +25,10 @@ "github.copilot.inlineSuggest.enable": false, "chat.commandCenter.enabled": false, "chat.agent.enabled": false, + "chat.disableAIFeatures": true, "workbench.startupEditor": "readme", - "extensions.ignoreRecommendations": true + "extensions.ignoreRecommendations": true, + "git.autofetch": false }, "extensions": [ "ms-python.python", From bb90567dcfe1fa4059fb08147e0cf8ab785a4258 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 26 Oct 2025 22:26:33 +0000 Subject: [PATCH 14/16] fix: Extract config from design API instead of env vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub's codespace creation API doesn't support env_vars parameter, so we now pass configuration through the design API response instead. Changes: - Extract config (configuratorApi, welcomeUrl) from design API response - Use extracted values instead of environment variables - Save config to bashrc for future terminal sessions - Add fallback to production URL if config missing This ensures welcome URL and API URL are always available in codespaces. ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .devcontainer/post-create.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index a412aaa..8f2a690 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -18,12 +18,9 @@ EOF export PATH="/home/user/.local/bin:$PATH" eval "$(pdm venv activate in-project 2>/dev/null || true)" -# Configurator API base URL (can be overridden via environment) +# Configurator API base URL (will be set from design config if in codespace) CONFIGURATOR_API="${CHIPFLOW_CONFIGURATOR_API:-https://configurator.chipflow.io}" -# save to bashrc -echo "export CHIPFLOW_CONFIGURATOR_API=\"$CHIPFLOW_CONFIGURTOR_API\"" >> ~/.bashrc - # Check if we're in a codespace and can fetch design from configurator if [ -n "$CODESPACE_NAME" ]; then echo "๐Ÿ“ก Fetching design configuration for codespace: $CODESPACE_NAME" @@ -96,6 +93,19 @@ if [ -n "$CODESPACE_NAME" ]; then # Save design.json echo "$DESIGN_BODY" | jq -r '.designData' > design.json + # Extract config from response (contains configuratorApi and welcomeUrl) + CHIPFLOW_CONFIGURATOR_API=$(echo "$DESIGN_BODY" | jq -r '.config.configuratorApi // "https://configurator.chipflow.io"') + CHIPFLOW_WELCOME_URL=$(echo "$DESIGN_BODY" | jq -r '.config.welcomeUrl // empty') + + # Update CONFIGURATOR_API with value from config + CONFIGURATOR_API="$CHIPFLOW_CONFIGURATOR_API" + + # Save to bashrc for future terminal sessions + echo "export CHIPFLOW_CONFIGURATOR_API=\"$CHIPFLOW_CONFIGURATOR_API\"" >> ~/.bashrc + if [ -n "$CHIPFLOW_WELCOME_URL" ]; then + echo "export CHIPFLOW_WELCOME_URL=\"$CHIPFLOW_WELCOME_URL\"" >> ~/.bashrc + fi + # Fetch generated files from API echo "๐Ÿ”จ Generating design files..." FILES_RESPONSE=$(curl -s -X POST "${CONFIGURATOR_API}/api/design/generate" \ @@ -181,9 +191,6 @@ if [ -n "$CHIPFLOW_WELCOME_URL" ]; then echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”" echo "" - - # save welcome url in bashrc - echo "export CHIPFLOW_WELCOME_URL=\"$CHIPFLOW_WELCOME_URL\"" >> ~/.bashrc fi echo "Quick commands:" From 8aa0e2a0b48ec81da1d7dd2fc3a846ef25d64104 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Mon, 27 Oct 2025 00:02:40 +0000 Subject: [PATCH 15/16] fix: Export config env vars to current environment - Export CHIPFLOW_CONFIGURATOR_API and CHIPFLOW_WELCOME_URL to current environment - This ensures variables are available in post-create script and child processes - bashrc writes ensure future terminal sessions also have these variables --- .devcontainer/post-create.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 8f2a690..f1d3b25 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -97,6 +97,10 @@ if [ -n "$CODESPACE_NAME" ]; then CHIPFLOW_CONFIGURATOR_API=$(echo "$DESIGN_BODY" | jq -r '.config.configuratorApi // "https://configurator.chipflow.io"') CHIPFLOW_WELCOME_URL=$(echo "$DESIGN_BODY" | jq -r '.config.welcomeUrl // empty') + # Export to current environment + export CHIPFLOW_CONFIGURATOR_API + export CHIPFLOW_WELCOME_URL + # Update CONFIGURATOR_API with value from config CONFIGURATOR_API="$CHIPFLOW_CONFIGURATOR_API" From 30659be430a1747dbe618d8fc917bd8361ec20e2 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Mon, 27 Oct 2025 00:25:23 +0000 Subject: [PATCH 16/16] fix: Use .chipflow.env file for environment variables - Create ~/.chipflow.env with config values - Add source statement to ~/.bashrc if not present - Source immediately for current session - This ensures new terminals automatically have env vars available --- .devcontainer/post-create.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index f1d3b25..3106e3f 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -104,12 +104,22 @@ if [ -n "$CODESPACE_NAME" ]; then # Update CONFIGURATOR_API with value from config CONFIGURATOR_API="$CHIPFLOW_CONFIGURATOR_API" - # Save to bashrc for future terminal sessions - echo "export CHIPFLOW_CONFIGURATOR_API=\"$CHIPFLOW_CONFIGURATOR_API\"" >> ~/.bashrc - if [ -n "$CHIPFLOW_WELCOME_URL" ]; then - echo "export CHIPFLOW_WELCOME_URL=\"$CHIPFLOW_WELCOME_URL\"" >> ~/.bashrc + # Save to .env file for sourcing by new terminals + cat > ~/.chipflow.env << EOF +export CHIPFLOW_CONFIGURATOR_API="$CHIPFLOW_CONFIGURATOR_API" +export CHIPFLOW_WELCOME_URL="$CHIPFLOW_WELCOME_URL" +EOF + + # Source the env file from bashrc if not already done + if ! grep -q "source ~/.chipflow.env" ~/.bashrc 2>/dev/null; then + echo "" >> ~/.bashrc + echo "# ChipFlow configuration (auto-generated)" >> ~/.bashrc + echo "if [ -f ~/.chipflow.env ]; then source ~/.chipflow.env; fi" >> ~/.bashrc fi + # Source immediately for current session + source ~/.chipflow.env + # Fetch generated files from API echo "๐Ÿ”จ Generating design files..." FILES_RESPONSE=$(curl -s -X POST "${CONFIGURATOR_API}/api/design/generate" \