|
1 | 1 | #!/bin/bash |
2 | | -set -e |
3 | 2 |
|
4 | 3 | if [ -z "$CI" ] && [ -z "$GITHUB_ACTIONS" ]; then |
5 | 4 | # Fix permissions for local development where CARGO_HOME is root-owned by the base image |
6 | 5 | sudo chown -R vscode:vscode /usr/local/cargo |
7 | 6 |
|
8 | | - echo "Installing VSIX dependencies..." |
| 7 | + # Install Claude CLI as vscode user if not already installed |
| 8 | + if ! command -v claude >/dev/null 2>&1; then |
| 9 | + echo "[Devcontainer Setup] Installing Claude CLI..." |
| 10 | + curl -fsSL https://claude.ai/install.sh | bash |
| 11 | + |
| 12 | + # Add .local/bin to PATH for current session |
| 13 | + export PATH="$HOME/.local/bin:$PATH" |
| 14 | + |
| 15 | + # Add to shell configs for future sessions |
| 16 | + echo 'export PATH="$HOME/.local/bin:$PATH"' >> $HOME/.bashrc |
| 17 | + echo 'export PATH="$HOME/.local/bin:$PATH"' >> $HOME/.zshrc |
| 18 | + else |
| 19 | + echo "[Devcontainer Setup] Claude CLI already installed: $(claude --version)" |
| 20 | + fi |
| 21 | + |
| 22 | + echo "[Devcontainer Setup] Installing VSIX dependencies..." |
9 | 23 | npm install --prefix vsix |
| 24 | + |
| 25 | + echo "[Devcontainer Setup] Packaging VSIX..." |
10 | 26 | (cd vsix && npx vsce package -o ../docgraph.vsix) |
| 27 | + |
11 | 28 | if command -v code >/dev/null 2>&1 && code --version >/dev/null 2>&1; then |
12 | | - echo "Installing docgraph.vsix..." |
| 29 | + echo "[Devcontainer Setup] Installing docgraph.vsix..." |
13 | 30 | code --install-extension docgraph.vsix |
14 | 31 | else |
15 | | - echo "VS Code CLI (code) not found or not working, skipping extension installation." |
| 32 | + echo "[Devcontainer Setup] VS Code CLI (code) not found or not working, skipping extension installation." |
16 | 33 | fi |
17 | 34 |
|
18 | | - echo "Checking project..." |
| 35 | + echo "[Devcontainer Setup] Checking project..." |
19 | 36 | cargo check |
20 | 37 |
|
21 | | - echo "Installing docgraph..." |
| 38 | + echo "[Devcontainer Setup] Installing docgraph..." |
22 | 39 | cargo install --path . --force |
23 | 40 |
|
24 | | - echo "Configuring claude alias..." |
| 41 | + echo "[Devcontainer Setup] Configuring claude alias..." |
25 | 42 | echo 'alias claude="claude --plugin-dir /workspaces/docgraph/docgraph-plugin --allow-dangerously-skip-permissions"' >> $HOME/.bashrc |
26 | 43 | echo 'alias claude="claude --plugin-dir /workspaces/docgraph/docgraph-plugin --allow-dangerously-skip-permissions"' >> $HOME/.zshrc |
27 | 44 |
|
28 | | - echo "Authenticating claude..." |
| 45 | + echo "[Devcontainer Setup] Authenticating claude..." |
29 | 46 | if [ -n "$Z_AI_API_KEY" ]; then |
30 | | - npx -y @z_ai/coding-helper auth glm_coding_plan_global "$Z_AI_API_KEY" |
| 47 | + npx -y @z_ai/coding-helper auth glm_coding_plan_global "$Z_AI_API_KEY" |
31 | 48 | npx -y @z_ai/coding-helper auth reload claude |
32 | 49 | fi |
| 50 | + |
| 51 | + echo "[Devcontainer Setup] Complete!" |
33 | 52 | else |
34 | 53 | echo "Running in CI environment, skipping development setup..." |
35 | 54 | fi |
36 | | - |
|
0 commit comments