|
9 | 9 | # 2. Prompts: clone directory |
10 | 10 | # 3. Clones git@github.com:flexion/opencode.git (flex branch) — skipped if already present |
11 | 11 | # 4. Installs dependencies and builds the native binary |
12 | | -# 5. Appends opencode-work() launcher function to ~/.zshrc or ~/.bashrc |
13 | 12 | # |
14 | 13 | # AWS credentials and opencode configuration are managed by flexcamp-ai: |
15 | 14 | # https://github.com/flexion/flexcamp-ai |
16 | | -# Run flexcamp-ai setup before or after this installer. |
| 15 | +# Use /get-openwork in Slack to get your API key, then run the OpenWork Setup |
| 16 | +# app to complete configuration. |
17 | 17 | # |
18 | 18 | # Existing files are never overwritten; each step is skipped with a warning |
19 | 19 | # if the output already exists. |
@@ -111,70 +111,19 @@ clone_and_build() { |
111 | 111 | success "Binary built" |
112 | 112 | } |
113 | 113 |
|
114 | | -# ── step 4: shell launcher function ────────────────────────────────────────── |
115 | | -write_shell_alias() { |
116 | | - local rc_file |
117 | | - case "$(basename "${SHELL:-bash}")" in |
118 | | - zsh) rc_file="$HOME/.zshrc" ;; |
119 | | - *) rc_file="$HOME/.bashrc" ;; |
120 | | - esac |
121 | | - |
122 | | - # Sentinel comment is the idempotency guard — more reliable than matching the |
123 | | - # function signature, which a user might remove while leaving a stale comment. |
124 | | - if grep -qF "── Flexion opencode launcher ──" "$rc_file" 2>/dev/null; then |
125 | | - warn "opencode-work() already defined in $rc_file — skipping" |
126 | | - return |
127 | | - fi |
128 | | - |
129 | | - info "Appending opencode-work() to $rc_file..." |
130 | | - |
131 | | - # Use printf %q to shell-quote the clone path at install time. |
132 | | - # This eliminates the previous Perl s|...|..| substitution which was vulnerable |
133 | | - # to injection if CLONE_DIR contained a | character. |
134 | | - local clone_dir_q |
135 | | - clone_dir_q=$(printf '%q' "$CLONE_DIR") |
136 | | - |
137 | | - # Double-quoted heredoc: $clone_dir_q expands now (install time); |
138 | | - # all other $ references are \-escaped so they expand at shell run time. |
139 | | - cat >>"$rc_file" <<SHELL_EOF |
140 | | -
|
141 | | -# ── Flexion opencode launcher ───────────────────────────────────────────────── |
142 | | -# AWS credentials are managed by flexcamp-ai (github.com/flexion/flexcamp-ai). |
143 | | -opencode-work() { |
144 | | - local clone_dir=$clone_dir_q |
145 | | - local arch os |
146 | | - case "\$(uname -m)" in arm64|aarch64) arch="arm64" ;; *) arch="x64" ;; esac |
147 | | - case "\$(uname -s)" in Darwin) os="darwin" ;; Linux) os="linux" ;; *) |
148 | | - echo "Unsupported OS: \$(uname -s)" && return 1 ;; esac |
149 | | - "\${clone_dir}/packages/opencode/dist/opencode-\${os}-\${arch}/bin/opencode" "\$@" |
150 | | -} |
151 | | -# ───────────────────────────────────────────────────────────────────────────── |
152 | | -SHELL_EOF |
153 | | - |
154 | | - success "opencode-work() added to $rc_file" |
155 | | -} |
156 | | - |
157 | 114 | # ── main ────────────────────────────────────────────────────────────────────── |
158 | 115 | main() { |
159 | 116 | check_prereqs |
160 | 117 | gather_inputs |
161 | 118 | clone_and_build |
162 | | - write_shell_alias |
163 | | - |
164 | | - local rc_file |
165 | | - case "$(basename "${SHELL:-bash}")" in |
166 | | - zsh) rc_file="$HOME/.zshrc" ;; |
167 | | - *) rc_file="$HOME/.bashrc" ;; |
168 | | - esac |
169 | 119 |
|
170 | 120 | printf '\n%s%sInstallation complete!%s\n' "$GREEN" "$BOLD" "$NC" |
171 | 121 | printf '────────────────────────────────────────────\n' |
172 | 122 | printf ' Binary: %s/packages/opencode/dist/opencode-*/bin/opencode\n' "$CLONE_DIR" |
173 | 123 | printf '\n Next steps:\n' |
174 | | - printf ' 1. Set up AWS credentials via flexcamp-ai:\n' |
175 | | - printf ' https://github.com/flexion/flexcamp-ai\n' |
176 | | - printf ' 2. source %s\n' "$rc_file" |
177 | | - printf ' 3. opencode-work\n\n' |
| 124 | + printf ' 1. Type /get-openwork in Slack to receive your Bedrock API key\n' |
| 125 | + printf ' 2. Download and run OpenWork Setup to complete configuration:\n' |
| 126 | + printf ' https://github.com/flexion/flexcamp-ai\n\n' |
178 | 127 | } |
179 | 128 |
|
180 | 129 | main |
0 commit comments