|
84 | 84 | source <(pnpm completion zsh) |
85 | 85 | insertafter: EOF |
86 | 86 |
|
| 87 | +- name: Add ~/.local/bin to PATH for Claude Code and other local binaries. |
| 88 | + blockinfile: |
| 89 | + path: ~/.zshrc |
| 90 | + marker: "# {mark} ANSIBLE MANAGED - local bin path" |
| 91 | + block: | |
| 92 | + # Add ~/.local/bin to PATH (for Claude Code native installation, etc.) |
| 93 | + export PATH="$HOME/.local/bin:$PATH" |
| 94 | + insertafter: EOF |
| 95 | + |
| 96 | +- name: Add asdf shims to PATH for npm/pnpm/npx availability. |
| 97 | + blockinfile: |
| 98 | + path: ~/.zshrc |
| 99 | + marker: "# {mark} ANSIBLE MANAGED - asdf shims" |
| 100 | + block: | |
| 101 | + # Ensure asdf shims are in PATH for npm, pnpm, npx, node |
| 102 | + export PATH="$HOME/.asdf/shims:$PATH" |
| 103 | + insertafter: EOF |
| 104 | + |
| 105 | +- name: Run claude install to configure Claude Code. |
| 106 | + shell: | |
| 107 | + export PATH="$HOME/.local/bin:/opt/homebrew/bin:$PATH" |
| 108 | + if command -v claude &> /dev/null; then |
| 109 | + claude install --yes 2>/dev/null || true |
| 110 | + fi |
| 111 | + args: |
| 112 | + executable: /bin/zsh |
| 113 | + changed_when: false |
| 114 | + ignore_errors: true |
| 115 | + |
87 | 116 | - name: Check if przm repo exists. |
88 | 117 | stat: |
89 | 118 | path: ~/Development/przm/.tool-versions |
|
108 | 137 | executable: /bin/zsh |
109 | 138 | when: przm_tool_versions.stat.exists |
110 | 139 |
|
| 140 | +- name: Get GitHub token from gh CLI for MCP server. |
| 141 | + command: gh auth token |
| 142 | + register: gh_token_result |
| 143 | + changed_when: false |
| 144 | + failed_when: false |
| 145 | + |
| 146 | +- name: Check if .env.local exists in przm repo. |
| 147 | + stat: |
| 148 | + path: ~/Development/przm/.env.local |
| 149 | + register: przm_env_local |
| 150 | + |
| 151 | +- name: Create .env.local with GitHub PAT if it doesn't exist. |
| 152 | + copy: |
| 153 | + dest: ~/Development/przm/.env.local |
| 154 | + content: | |
| 155 | + # GitHub Personal Access Token for MCP server |
| 156 | + GITHUB_PERSONAL_ACCESS_TOKEN={{ gh_token_result.stdout }} |
| 157 | + mode: "0600" |
| 158 | + when: |
| 159 | + - gh_token_result.rc == 0 |
| 160 | + - gh_token_result.stdout | length > 0 |
| 161 | + - not przm_env_local.stat.exists |
| 162 | + |
| 163 | +- name: Add GitHub PAT to existing .env.local if not present. |
| 164 | + lineinfile: |
| 165 | + path: ~/Development/przm/.env.local |
| 166 | + line: "GITHUB_PERSONAL_ACCESS_TOKEN={{ gh_token_result.stdout }}" |
| 167 | + regexp: "^GITHUB_PERSONAL_ACCESS_TOKEN=" |
| 168 | + state: present |
| 169 | + mode: "0600" |
| 170 | + when: |
| 171 | + - gh_token_result.rc == 0 |
| 172 | + - gh_token_result.stdout | length > 0 |
| 173 | + - przm_env_local.stat.exists |
| 174 | + |
111 | 175 | - name: Open VSCode with PRZM repository. |
112 | 176 | command: open -a "Visual Studio Code" ~/Development/przm |
113 | 177 | changed_when: false |
|
0 commit comments