Skip to content

Commit d9ca37d

Browse files
Merge pull request #1 from Chintanpatel24/fix-installation-and-symlink
Fix installation symlinks and support skipping API key setup
2 parents 95a6bcd + 6000ce1 commit d9ca37d

4 files changed

Lines changed: 31 additions & 4 deletions

File tree

bin/arrowcode

100644100755
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# Resolve package root (bin/ is next to package.json when linked or run from repo)
5-
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
4+
# Resolve symlinks to find the real script path and package root
5+
SOURCE="${BASH_SOURCE[0]}"
6+
while [ -h "$SOURCE" ]; do
7+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
8+
SOURCE="$(readlink "$SOURCE")"
9+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
10+
done
11+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
12+
ROOT="$(cd "$DIR/.." && pwd)"
613

714
if command -v bun >/dev/null 2>&1; then
815
exec bun "$ROOT/src/index.ts" "$@"

install.sh

100644100755
File mode changed.

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ async function main() {
144144
bootstrapUserHome();
145145
const ok = await runSetupWizard();
146146
if (!ok) process.exit(1);
147+
if (!isConfigured()) {
148+
process.exit(0);
149+
}
147150
}
148151

149152
// Runtime: packaged defaults work without home; seed if home already exists

src/setup/wizard.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,32 @@ export async function runSetupWizard(): Promise<boolean> {
6161
console.log(` ${CONFIG_PATH}`);
6262
console.log("");
6363

64+
const startAns = await ask(rl, " Would you like to configure your API key now? [Y/n] (default Y): ");
65+
if (/^n(o)?$/i.test(startAns)) {
66+
console.log("");
67+
console.log(" No problem! You can configure ArrowCode later by running: arrowcode --setup");
68+
console.log("");
69+
return true;
70+
}
71+
72+
console.log("");
6473
console.log(" Provider:");
6574
console.log(" 1) NVIDIA NIM (default — free keys at build.nvidia.com)");
6675
console.log(" 2) OpenAI");
6776
console.log(" 3) Anthropic");
6877
console.log(" 4) Ollama (local, no key)");
6978
console.log(" 5) Custom OpenAI-compatible base URL");
79+
console.log(" 0) Cancel / Set up later");
7080
console.log("");
7181

72-
const pAns = await ask(rl, " Choose [1-5] (default 1): ");
82+
const pAns = await ask(rl, " Choose [0-5] (default 1): ");
83+
if (pAns === "0" || pAns.toLowerCase() === "cancel") {
84+
console.log("");
85+
console.log(" No problem! You can configure ArrowCode later by running: arrowcode --setup");
86+
console.log("");
87+
return true;
88+
}
89+
7390
const map: Record<string, ProviderId> = {
7491
"": "nim",
7592
"1": "nim",
@@ -133,7 +150,7 @@ export async function runSetupWizard(): Promise<boolean> {
133150
console.log("");
134151
console.log(" No API key entered. Setup cancelled.");
135152
console.log(" Re-run: arrowcode --setup");
136-
return false;
153+
return true;
137154
}
138155

139156
const yoloAns = await ask(

0 commit comments

Comments
 (0)