-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Incorporate Baseplate Docs MCP and add dev extension #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Incorporate Baseplate Docs MCP and add dev extension #652
Conversation
|
WalkthroughAdds devcontainer initialization via a new setup-mounts script, introduces optional local mounts for a Baseplate extension and docs, updates devcontainer settings and README, tweaks shell keybindings, extends VS Code extensions, updates .env.example, augments .gitignore, adds a docs permissions entry, and expands CLAUDE.md. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer Host
participant VC as VS Code Devcontainer
participant Init as initializeCommand (setup-mounts.sh)
participant FS as .devcontainer/mounts
participant Cnt as Container
Dev->>VC: Open repo in Dev Container
VC->>Init: Run setup-mounts.sh
Init->>Init: Load .env (BASEPLATE_DEV_EXTENSION_PATH / BASEPLATE_DEV_DOCS_PATH)
Init->>FS: Ensure mounts dir
alt Extension path valid
Init->>FS: Symlink mounts/extension.vsix -> local path
else
Init->>FS: Create empty mounts/extension.vsix
end
alt Docs path valid
Init->>FS: Symlink mounts/docs -> local docs (…/docs)
else
Init->>FS: Create mounts/docs directory
end
Init-->>VC: "Mount setup completed successfully"
VC->>Cnt: Start container with bind mounts to /home/vscode/baseplate-*
VC->>Cnt: Install extensions (incl. Prisma, local VSIX)
Note over Cnt: Post-create commands proceed unchanged
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.devcontainer/README.md (1)
12-13: Fix volume docs to match actual mountsNode modules aren’t persisted anymore; update the bullet to avoid confusion.
Apply this diff:
-- **Persistent volumes** for pnpm cache, node_modules, and command history +- **Persistent volumes** for pnpm cache and command history
🧹 Nitpick comments (11)
.gitignore (1)
107-109: Make directory ignores explicitUse trailing slashes to signal directories. Functionally equivalent but clearer.
-# Dev Container files -.pnpm-store -/.devcontainer/mounts +# Dev Container files +.pnpm-store/ +/.devcontainer/mounts/.devcontainer/.zshrc (1)
19-21: Bind autosuggest in the intended keymapEnsure the binding targets the Emacs map regardless of future keymap changes.
-bindkey -e -bindkey '^E' autosuggest-accept +bindkey -e +bindkey -M emacs '^E' autosuggest-accept.env.example (1)
21-27: Clarify expected file types/locationsCall out that the extension path should point to a .vsix file; clarify that the docs path is the repo root.
-# Path to local Baseplate VS Code extension for development (optional) -# Uncomment and set to your local extension path to mount it in the dev container -# BASEPLATE_DEV_EXTENSION_PATH=/path/to/your/local/baseplate-extension +# Path to a local Baseplate VS Code extension package (.vsix) for development (optional) +# Uncomment and set to your local .vsix file to mount it in the dev container +# BASEPLATE_DEV_EXTENSION_PATH=/path/to/baseplate-extension.vsix @@ -# Path to local Baseplate documentation repository for development (optional) -# Uncomment and set to your local baseplate-docs repo path to mount it in the dev container -# BASEPLATE_DEV_DOCS_PATH=/path/to/your/local/baseplate-docs +# Path to local baseplate-docs repository root for development (optional) +# Uncomment and set to your local baseplate-docs repo path to mount it in the dev container +# BASEPLATE_DEV_DOCS_PATH=/path/to/your/local/baseplate-docs.devcontainer/setup-mounts.sh (2)
20-31: Use forceful, idempotent symlink creation; keep placeholder predictableln -sfn avoids leftover links. Keeping an empty file is fine for a stable mount source.
-# Handle BASEPLATE_DEV_EXTENSION_PATH -if [ -n "$BASEPLATE_DEV_EXTENSION_PATH" ] && [ -f "$BASEPLATE_DEV_EXTENSION_PATH" ]; then +# Handle BASEPLATE_DEV_EXTENSION_PATH +if [ -n "${BASEPLATE_DEV_EXTENSION_PATH:-}" ] && [ -f "$BASEPLATE_DEV_EXTENSION_PATH" ]; then echo "Linking extension from: $BASEPLATE_DEV_EXTENSION_PATH" - if [ -e "$MOUNTS_DIR/extension.vsix" ] || [ -L "$MOUNTS_DIR/extension.vsix" ]; then - rm -rf "$MOUNTS_DIR/extension.vsix" - fi - ln -s "$BASEPLATE_DEV_EXTENSION_PATH" "$MOUNTS_DIR/extension.vsix" + ln -sfn "$BASEPLATE_DEV_EXTENSION_PATH" "$MOUNTS_DIR/extension.vsix" echo "Extension linked to: $MOUNTS_DIR/extension.vsix" else echo "BASEPLATE_DEV_EXTENSION_PATH not set or file doesn't exist, creating empty extension.vsix" - touch "$MOUNTS_DIR/extension.vsix" + : > "$MOUNTS_DIR/extension.vsix" fi
33-44: Link the docs repo root, not a docs/ subfolderMounting the repo root is more flexible (tools can access configs, scripts, etc.). If you truly only need the docs subdir, feel free to ignore.
-# Handle BASEPLATE_DEV_DOCS_PATH -if [ -n "$BASEPLATE_DEV_DOCS_PATH" ] && [ -d "$BASEPLATE_DEV_DOCS_PATH" ]; then +# Handle BASEPLATE_DEV_DOCS_PATH +if [ -n "${BASEPLATE_DEV_DOCS_PATH:-}" ] && [ -d "$BASEPLATE_DEV_DOCS_PATH" ]; then echo "Linking docs from: $BASEPLATE_DEV_DOCS_PATH" - if [ -e "$MOUNTS_DIR/docs" ] || [ -L "$MOUNTS_DIR/docs" ]; then - rm -rf "$MOUNTS_DIR/docs" - fi - ln -s "$BASEPLATE_DEV_DOCS_PATH/docs" "$MOUNTS_DIR/docs" + ln -sfn "$BASEPLATE_DEV_DOCS_PATH" "$MOUNTS_DIR/docs" echo "Docs linked to: $MOUNTS_DIR/docs" else echo "BASEPLATE_DEV_DOCS_PATH not set or directory doesn't exist, creating empty docs directory" mkdir -p "$MOUNTS_DIR/docs" fiIf you adopt this, ensure devcontainer.json mounts
${localWorkspaceFolder}/.devcontainer/mounts/docsto/home/vscode/baseplate-docs(no trailing/docs). I can open a follow-up patch if helpful..devcontainer/README.md (1)
167-171: Shell continuation bug in exampleInline comments after a trailing backslash break the continuation. Move the comment to its own line.
Suggested edit:
for domain in \ "registry.npmjs.org" \ # Add your domain here "your-new-domain.com" \ # ... other domains.devcontainer/devcontainer.json (2)
23-26: Guard against invalid local VSIX installsIf
BASEPLATE_DEV_EXTENSION_PATHisn’t set,setup-mounts.shcreates an empty file. VS Code may error trying to install an empty VSIX.Please verify container startup with no
.envoverrides on macOS and Windows. If it fails, remove the static VSIX entry and install conditionally. Minimal change:- "Prisma.prisma", - "/home/vscode/baseplate-extension/extension.vsix" + "Prisma.prisma"Then document manual/local install steps in README (e.g., “Install from VSIX…”).
2-2: Name polish (optional)Consider a more descriptive devcontainer name, e.g., “Baseplate Dev”.
- "name": "Ubuntu", + "name": "Baseplate Dev",CLAUDE.md (3)
304-306: Tighten phrasingMinor wording improvement.
Apply this diff:
-If `~/baseplate-docs` is not accessible, use the baseplate-docs MCP server: +If `~/baseplate-docs` is inaccessible, use the baseplate-docs MCP server:
311-316: Normalize command list formattingUse code formatting for action names and add periods for consistency.
Apply this diff:
-**Document Retrieval:** +**Document Retrieval:** -- get-document - Retrieve full document content by URI (format: documents://collection-name/path/to/doc.md) -- get-document-by-id - Retrieve document by its Outline ID -- list-documents - List documents with optional filters +- `get-document` — Retrieve full document content by URI (format: `documents://collection-name/path/to/doc.md`). +- `get-document-by-id` — Retrieve document by its Outline ID. +- `list-documents` — List documents with optional filters.
317-333: Consistency for “Search Tools” and “Usage Examples”Same punctuation/formatting cleanup.
Apply this diff:
-**Search Tools:** +**Search Tools:** -- search-documents - Semantic search returning full documents -- search-rag-documents - RAG search returning specific document chunks +- `search-documents` — Semantic search returning full documents. +- `search-rag-documents` — RAG search returning specific document chunks. -**Usage Examples:** +**Usage Examples:** -- Find specific info: search-rag-documents with query "how to configure authentication" -- Browse content: list-documents with collection filter -- Read document: get-document with URI like "documents://design-docs/completed/auth-plugin-refactor.md" +- Find specific info: `search-rag-documents` with query “how to configure authentication.” +- Browse content: `list-documents` with collection filter. +- Read document: `get-document` with URI like `documents://design-docs/completed/auth-plugin-refactor.md`.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (8)
.claude/settings.json(1 hunks).devcontainer/.zshrc(1 hunks).devcontainer/README.md(2 hunks).devcontainer/devcontainer.json(2 hunks).devcontainer/setup-mounts.sh(1 hunks).env.example(1 hunks).gitignore(1 hunks)CLAUDE.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*
📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)
Use kebab-case for file names
Files:
CLAUDE.md
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: halfdomelabs/baseplate#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-03T17:01:46.369Z
Learning: Use the Baseplate Docs MCP for up-to-date project information; add descriptions when creating documents
📚 Learning: 2025-09-03T17:01:46.369Z
Learnt from: CR
PR: halfdomelabs/baseplate#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-03T17:01:46.369Z
Learning: Use the Baseplate Docs MCP for up-to-date project information; add descriptions when creating documents
Applied to files:
CLAUDE.md
🪛 LanguageTool
CLAUDE.md
[style] ~304-~304: Consider using “inaccessible” to avoid wordiness.
Context: ...CP (Fallback) If ~/baseplate-docs is not accessible, use the baseplate-docs MCP server: **...
(NOT_ABLE_PREMIUM)
[grammar] ~308-~308: There might be a mistake here.
Context: ...aseplate-docs**: Baseplate documentation - design-docs: Design documentation **D...
(QB_NEW_EN)
[grammar] ~313-~313: There might be a mistake here.
Context: ...uments://collection-name/path/to/doc.md) - get-document-by-id - Retrieve document b...
(QB_NEW_EN)
[grammar] ~314-~314: There might be a mistake here.
Context: ...id - Retrieve document by its Outline ID - list-documents - List documents with opt...
(QB_NEW_EN)
[grammar] ~319-~319: There might be a mistake here.
Context: ...Semantic search returning full documents - search-rag-documents - RAG search return...
(QB_NEW_EN)
[grammar] ~324-~324: There might be a mistake here.
Context: ...cument - Replace entire document content - inline-edit - Make specific edits within...
(QB_NEW_EN)
[grammar] ~325-~325: There might be a mistake here.
Context: ... - Make specific edits within a document - create-document - Create new document in...
(QB_NEW_EN)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Lint
🔇 Additional comments (4)
.devcontainer/setup-mounts.sh (1)
1-47: initializeCommand correctly set to execute setup-mounts.sh on host
devcontainer.json (line 59) uses"initializeCommand": "./.devcontainer/setup-mounts.sh", ensuring the mount script runs on the host as intended..devcontainer/devcontainer.json (1)
49-54: Confirm cross-platform bind behavior for initializeCommand + mounts
initializeCommandruns on the host. On Windows (non-WSL), running a Bash script and creating symlinks may fail and break the bind paths.Run a quick check on Windows:
- Ensure
setup-mounts.shexecutes (via Git Bash/WSL).- Confirm
.devcontainer/mounts/extension.vsixanddocsresolve correctly before container creation.- If not, gate the local mounts behind existence checks or provide a PowerShell variant.
CLAUDE.md (2)
274-301: LGTM: Local docs preferred, MCP as fallback matches team guidancePrioritizing
~/baseplate-docswith MCP fallback reflects the learning to use the Baseplate Docs MCP while encouraging local performance.
276-281: Path alignment checkDoc references
~/baseplate-docs, while the devcontainer mounts to/home/vscode/baseplate-docs(which expands from~in-container). This is consistent. Keep it that way; ensure README uses the same path.
| }, | ||
| "permissions": { | ||
| "additionalDirectories": ["~/baseplate-docs"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Prefer absolute path over ~ expansion
Some tools don’t expand ~ in JSON configs. Align with the devcontainer mount target.
- "permissions": {
- "additionalDirectories": ["~/baseplate-docs"]
- }
+ "permissions": {
+ "additionalDirectories": ["/home/vscode/baseplate-docs"]
+ }To confirm what paths are actually used, check devcontainer.json for the docs mount:
🏁 Script executed:
#!/bin/bash
rg -nC2 -g '.devcontainer/devcontainer.json' 'mounts|baseplate-docs|extension.vsix|initializeCommand'Length of output: 250
🏁 Script executed:
#!/bin/bash
# Locate any devcontainer.json and inspect for baseplate-docs mounts
find . -type f -name 'devcontainer.json' | while read file; do
echo "Checking $file"
rg -nC2 'mounts|baseplate-docs' "$file"
doneLength of output: 896
Use absolute path for baseplate-docs
In .claude/settings.json (around lines 16–19), replace "~/baseplate-docs" with "/home/vscode/baseplate-docs" to match the devcontainer bind mount:
"permissions": {
- "additionalDirectories": ["~/baseplate-docs"]
+ "additionalDirectories": ["/home/vscode/baseplate-docs"]
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| }, | |
| "permissions": { | |
| "additionalDirectories": ["~/baseplate-docs"] | |
| } | |
| }, | |
| "permissions": { | |
| "additionalDirectories": ["/home/vscode/baseplate-docs"] | |
| } |
🤖 Prompt for AI Agents
In .claude/settings.json around lines 16 to 19, the
permissions.additionalDirectories entry uses a tilde-based path which won’t
match the devcontainer bind mount; replace "~/baseplate-docs" with the absolute
path "/home/vscode/baseplate-docs" so the settings point to the
container-mounted directory.
| - `BASEPLATE_DEV_EXTENSION_PATH` - Optional path to the local Baseplate VS Code extension for development (mounted at `/baseplate-extension` in the container) | ||
| - `BASEPLATE_DEV_DOCS_PATH` - Optional path to the local Baseplate documentation repository for development (mounted at `/baseplate-docs` in the container) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Correct mount paths and clarify what BASEPLATE_DEV_ expects*
Paths should match devcontainer.json targets and the extension expects a VSIX file, not a directory.
Apply this diff:
-- `BASEPLATE_DEV_EXTENSION_PATH` - Optional path to the local Baseplate VS Code extension for development (mounted at `/baseplate-extension` in the container)
-`- `BASEPLATE_DEV_DOCS_PATH` - Optional path to the local Baseplate documentation repository for development (mounted at `/baseplate-docs` in the container)
+`BASEPLATE_DEV_EXTENSION_PATH` - Optional path to a local Baseplate VS Code extension VSIX (mounted at `/home/vscode/baseplate-extension/extension.vsix` in the container)
+`BASEPLATE_DEV_DOCS_PATH` - Optional path to a local Baseplate documentation repository (mounted at `/home/vscode/baseplate-docs` in the container)Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In .devcontainer/README.md around lines 76-77, the descriptions for
BASEPLATE_DEV_EXTENSION_PATH and BASEPLATE_DEV_DOCS_PATH are inaccurate: update
them to match the actual mount targets in devcontainer.json and clarify that
BASEPLATE_DEV_EXTENSION_PATH must point to a VSIX file (not a directory) which
will be mounted into the container at the extension target path defined in
devcontainer.json, and that BASEPLATE_DEV_DOCS_PATH should point to the local
docs repo directory mounted at the docs target path from devcontainer.json;
adjust the example values and wording accordingly so they exactly match the
devcontainer.json mount targets and explicitly state the VSIX requirement.
| ### Local Extension Development | ||
|
|
||
| To develop the Baseplate VS Code extension alongside the main project: | ||
|
|
||
| 1. Set the `BASEPLATE_DEV_EXTENSION_PATH` environment variable in your `.env` file at the repository root: | ||
|
|
||
| ```bash | ||
| BASEPLATE_DEV_EXTENSION_PATH=/path/to/your/local/baseplate-extension | ||
| ``` | ||
|
|
||
| 2. The extension directory will be mounted at `/baseplate-extension` in the container | ||
| 3. The dev container will automatically detect and use the local extension if present | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align “Local Extension Development” with actual behavior (VSIX vs directory + mount path)
The script mounts a VSIX at /home/vscode/baseplate-extension/extension.vsix; the README currently says a directory at /baseplate-extension.
Apply this diff:
-To develop the Baseplate VS Code extension alongside the main project:
+To develop the Baseplate VS Code extension alongside the main project:
-1. Set the `BASEPLATE_DEV_EXTENSION_PATH` environment variable in your `.env` file at the repository root:
+1. Set the `BASEPLATE_DEV_EXTENSION_PATH` environment variable in your `.env` file at the repository root (point it to a built `.vsix` file):
- BASEPLATE_DEV_EXTENSION_PATH=/path/to/your/local/baseplate-extension
+ BASEPLATE_DEV_EXTENSION_PATH=/path/to/your/local/baseplate-extension/extension.vsix
-2. The extension directory will be mounted at `/baseplate-extension` in the container
-3. The dev container will automatically detect and use the local extension if present
+2. The VSIX will be mounted at `/home/vscode/baseplate-extension/extension.vsix` in the container
+3. The dev container will attempt to install the local VSIX if present📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### Local Extension Development | |
| To develop the Baseplate VS Code extension alongside the main project: | |
| 1. Set the `BASEPLATE_DEV_EXTENSION_PATH` environment variable in your `.env` file at the repository root: | |
| ```bash | |
| BASEPLATE_DEV_EXTENSION_PATH=/path/to/your/local/baseplate-extension | |
| ``` | |
| 2. The extension directory will be mounted at `/baseplate-extension` in the container | |
| 3. The dev container will automatically detect and use the local extension if present | |
| ### Local Extension Development | |
| To develop the Baseplate VS Code extension alongside the main project: | |
| 1. Set the `BASEPLATE_DEV_EXTENSION_PATH` environment variable in your `.env` file at the repository root (point it to a built `.vsix` file): |
🤖 Prompt for AI Agents
In .devcontainer/README.md around lines 135 to 147, the "Local Extension
Development" section incorrectly instructs users to set
BASEPLATE_DEV_EXTENSION_PATH to a directory and claims the extension is mounted
at /baseplate-extension; update the text to say the dev workflow expects a VSIX
file, instruct users to set BASEPLATE_DEV_EXTENSION_PATH to the path of their
built VSIX (for example /path/to/baseplate-extension.vsix), and replace the line
about mounting a directory with the actual mount location used by the container
(/home/vscode/baseplate-extension/extension.vsix) and mention the container will
detect and install the VSIX if present.
| ### Local Documentation Development | ||
|
|
||
| To work with the Baseplate documentation repository alongside the main project: | ||
|
|
||
| 1. Set the `BASEPLATE_DEV_DOCS_PATH` environment variable in your `.env` file at the repository root: | ||
|
|
||
| ```bash | ||
| BASEPLATE_DEV_DOCS_PATH=/path/to/your/local/baseplate-docs | ||
| ``` | ||
|
|
||
| 2. The documentation directory will be mounted at `/baseplate-docs` in the container | ||
| 3. You can directly edit and access documentation files during development | ||
| 4. This provides better performance than using the MCP server for documentation access | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix docs mount path to match devcontainer.json
Use /home/vscode/baseplate-docs instead of /baseplate-docs.
Apply this diff:
-2. The documentation directory will be mounted at `/baseplate-docs` in the container
+2. The documentation directory will be mounted at `/home/vscode/baseplate-docs` in the container📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### Local Documentation Development | |
| To work with the Baseplate documentation repository alongside the main project: | |
| 1. Set the `BASEPLATE_DEV_DOCS_PATH` environment variable in your `.env` file at the repository root: | |
| ```bash | |
| BASEPLATE_DEV_DOCS_PATH=/path/to/your/local/baseplate-docs | |
| ``` | |
| 2. The documentation directory will be mounted at `/baseplate-docs` in the container | |
| 3. You can directly edit and access documentation files during development | |
| 4. This provides better performance than using the MCP server for documentation access | |
| ### Local Documentation Development | |
| To work with the Baseplate documentation repository alongside the main project: | |
| 1. Set the `BASEPLATE_DEV_DOCS_PATH` environment variable in your `.env` file at the repository root: |
🤖 Prompt for AI Agents
In .devcontainer/README.md around lines 148 to 161, the documentation says the
docs directory is mounted at /baseplate-docs but devcontainer.json mounts it at
/home/vscode/baseplate-docs; update the README to use
/home/vscode/baseplate-docs wherever /baseplate-docs is referenced (step 2 and
any related instructions) so the path documented matches devcontainer.json and
the BASEPLATE_DEV_DOCS_PATH guidance.
| #!/bin/bash | ||
|
|
||
| # Source environment variables from ../.env if it exists | ||
| if [ -f ".env" ]; then | ||
| echo "Sourcing environment variables from .env" | ||
| source ".env" | ||
| else | ||
| echo "No .env file found, using default values" | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Harden script execution and resolve paths relative to the repo
Add strict mode and resolve .env from the repo root based on the script location to avoid relying on $PWD. This also prevents silent success on errors.
-#!/bin/bash
+#!/bin/bash
+set -euo pipefail
+
+# Resolve repo root from this script's directory
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
+REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd -P)"
-# Source environment variables from ../.env if it exists
-if [ -f ".env" ]; then
- echo "Sourcing environment variables from .env"
- source ".env"
+# Source environment variables from .env at repo root if it exists
+ENV_FILE="${REPO_ROOT}/.env"
+if [ -f "${ENV_FILE}" ]; then
+ echo "Sourcing environment variables from ${ENV_FILE}"
+ set -a
+ # shellcheck disable=SC1090
+ source "${ENV_FILE}"
+ set +a
else
echo "No .env file found, using default values"
fi🤖 Prompt for AI Agents
In .devcontainer/setup-mounts.sh lines 1-9, enable strict mode and resolve .env
relative to the repository root using the script's directory so we don't depend
on $PWD; add at the top set -euo pipefail and ensure the script computes its dir
(via ${BASH_SOURCE[0]}) and uses that to locate ../.env (or the repo root)
before sourcing; if the .env is missing, print an error to stderr and exit
non-zero rather than silently continuing so failures are explicit.
| # Create mounts directory if it doesn't exist | ||
| MOUNTS_DIR="${PWD}/.devcontainer/mounts" | ||
| if [ ! -d "$MOUNTS_DIR" ]; then | ||
| echo "Creating mounts directory: $MOUNTS_DIR" | ||
| mkdir -p "$MOUNTS_DIR" | ||
| else | ||
| echo "Mounts directory already exists: $MOUNTS_DIR" | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid PWD dependency for mounts dir
Derive mounts directory from the resolved repo root for robustness.
-# Create mounts directory if it doesn't exist
-MOUNTS_DIR="${PWD}/.devcontainer/mounts"
+# Create mounts directory if it doesn't exist
+MOUNTS_DIR="${REPO_ROOT}/.devcontainer/mounts"
if [ ! -d "$MOUNTS_DIR" ]; then
echo "Creating mounts directory: $MOUNTS_DIR"
mkdir -p "$MOUNTS_DIR"
else
echo "Mounts directory already exists: $MOUNTS_DIR"
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Create mounts directory if it doesn't exist | |
| MOUNTS_DIR="${PWD}/.devcontainer/mounts" | |
| if [ ! -d "$MOUNTS_DIR" ]; then | |
| echo "Creating mounts directory: $MOUNTS_DIR" | |
| mkdir -p "$MOUNTS_DIR" | |
| else | |
| echo "Mounts directory already exists: $MOUNTS_DIR" | |
| fi | |
| # Create mounts directory if it doesn't exist | |
| MOUNTS_DIR="${REPO_ROOT}/.devcontainer/mounts" | |
| if [ ! -d "$MOUNTS_DIR" ]; then | |
| echo "Creating mounts directory: $MOUNTS_DIR" | |
| mkdir -p "$MOUNTS_DIR" | |
| else | |
| echo "Mounts directory already exists: $MOUNTS_DIR" | |
| fi |
🤖 Prompt for AI Agents
In .devcontainer/setup-mounts.sh around lines 11 to 18, the mounts directory is
derived from PWD which can be incorrect; change it to compute the repository
root (e.g., using git rev-parse --show-toplevel or resolving the script path)
and build MOUNTS_DIR from that resolved repo root, then use mkdir -p on the new
path and keep the same logging branches; ensure fallback behavior if git is
unavailable and do not rely on $PWD.
Summary by CodeRabbit
New Features
Documentation
Chores