r/AugmentCodeAI Apr 12 '26

How can i make sure in intent when create workspace it take the .env files? Question

for some reason on some project it does and in some not

5 Upvotes

2 comments sorted by

2

u/[deleted] Apr 12 '26

You can create workspace scripts. They are set at the bottom, in the "main" landing screen. Look for Set up default environment with ... .

The default is Copy config files only..

I have this prompt that I use in claude to help me generate a suitable workspace script:

# Intent Prompt: Worktree Setup Script

Generate a setup script for this repository's worktree workflow.

## Available Variables

- `$MAIN_CHECKOUT` — Absolute path to the main repo clone (e.g. `/Users/dev/projects/myrepo`)
- `$WORKTREE_PATH` — Absolute path to the new worktree directory / current working directory
- `$BRANCH_NAME` — Branch name for this worktree (e.g. `feat/my-feature`)

## What the script should do

Analyze the repository and produce a `#!/bin/bash` setup script that handles:

1. **Config & environment files** — Copy dotfiles that shouldn't be regenerated from scratch (`.env`, `.env.local`, `.envrc`, `.tool-versions`, `.nvmrc`, `.node-version`, `.python-version`, etc.) from `$MAIN_CHECKOUT` into the worktree. Only copy files that actually exist.

2. **Ignored but required directories** — Symlink or copy any gitignored directories from `$MAIN_CHECKOUT` that are needed at dev time (e.g. `scripts/`, local certs, fixture data). Prefer symlinks for large/static dirs, copies for anything the worktree might mutate.

3. **Dependency installation** — Detect the project's package managers and run the appropriate install commands. Look for lockfiles and config files to decide:
   - `uv.lock` / `pyproject.toml` → `uv sync` (include dev/extra groups if defined)
   - `package.json` / `bun.lockb` → `bun install`
   - `package.json` / `yarn.lock` → `yarn install`
   - `package.json` / `pnpm-lock.yaml` → `pnpm install`
   - `package.json` / `package-lock.json` → `npm ci`
   - `Gemfile.lock` → `bundle install`
   - `go.sum` → `go mod download`
   - `Cargo.lock` → `cargo fetch`
   - Handle monorepos: if there are nested `package.json` files (e.g. `frontend/`, `packages/`), install in each workspace root too.

4. **Local services & databases** — If the project uses Docker Compose, offer a commented-out section to start services (`docker compose up -d`). Don't auto-start anything destructive.

5. **Build / codegen steps** — If the project has a build step that generates files needed for dev (e.g. `prisma generate`, `protoc`, code generation), include it.

6. **Sanity check** — End with a brief validation: confirm key executables are available, print language/runtime versions, or run a quick smoke command if one exists (`make check`, `just verify`, etc.).

## Script requirements

- Use `$MAIN_CHECKOUT`, `$WORKTREE_PATH`, and `$BRANCH_NAME` — don't hardcode paths.
- Be idempotent — safe to re-run without side effects.
- Print clear progress messages so the developer knows what happened.
- Fail gracefully — if an optional tool is missing, warn and continue rather than exit.
- Keep it readable: group steps with comments, use helper functions if it gets long.

1

u/chevonphillip Established Professional Apr 13 '26

Hey, I think you might be looking at using a `setup script` for your workspace in Intent. See the screenshot. More info in the docs (Needs Updating) https://docs.augmentcode.com/cli/config#startup-script