Skip to content

Commit 14f3e06

Browse files
committed
docs: update copilot instructions
1 parent 5b91b30 commit 14f3e06

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/copilot-instructions.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,41 @@ When providing assistance:
323323
- Provide clear explanations and documentation
324324
- Consider the migration to Hetzner infrastructure in suggestions
325325

326+
#### Command Execution Context
327+
328+
Be mindful of the execution context for different types of commands. The project uses several command-line tools that must be run from specific directories:
329+
330+
- **`make` commands**: (e.g., `make help`, `make status`) must be run from the project root directory.
331+
- **OpenTofu commands**: (e.g., `tofu init`, `tofu plan`, `tofu apply`) must be run from the `infrastructure/terraform/` directory.
332+
- **Docker Compose commands**: (e.g., `docker compose up -d`, `docker compose ps`) are intended to be run _inside the deployed virtual machine_, typically from the `/home/torrust/github/torrust/torrust-tracker-demo/application` directory.
333+
334+
**IMPORTANT**: Always be aware of the current working directory. The repository location `~/Documents/git/committer/me/github/torrust/torrust-tracker-demo` is used in documentation as an example, but contributors may have the project cloned elsewhere. Verify the current location before executing commands.
335+
336+
#### Working with Remote Terminals
337+
338+
When executing commands on the remote VM, be aware of limitations with interactive sessions.
339+
340+
- **Problem**: The VS Code integrated terminal may not correctly handle commands that initiate a new interactive shell, such as `ssh torrust@<VM_IP>` or `make ssh`. The connection may succeed, but subsequent commands sent to that shell may not execute as expected, and their output may not be captured.
341+
342+
- **Solution**: Prefer executing commands non-interactively whenever possible. Instead of opening a persistent SSH session, pass the command directly to `ssh`.
343+
344+
- **Don't do this**:
345+
346+
```bash
347+
# 1. Log in
348+
make ssh
349+
# 2. Run command (this might fail or output won't be seen)
350+
df -H
351+
```
352+
353+
- **Do this instead**:
354+
```bash
355+
# Execute the command directly via ssh
356+
ssh torrust@<VM_IP> 'df -H'
357+
```
358+
359+
This ensures that the command is executed and its output is returned to the primary terminal session.
360+
326361
#### Preferred Working Methodology
327362

328363
**Work in Small Steps:**

0 commit comments

Comments
 (0)