Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions bin/arrowcode
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail

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

if command -v bun >/dev/null 2>&1; then
exec bun "$ROOT/src/index.ts" "$@"
Expand Down
Empty file modified install.sh
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ async function main() {
bootstrapUserHome();
const ok = await runSetupWizard();
if (!ok) process.exit(1);
if (!isConfigured()) {
process.exit(0);
}
}

// Runtime: packaged defaults work without home; seed if home already exists
Expand Down
21 changes: 19 additions & 2 deletions src/setup/wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,32 @@ export async function runSetupWizard(): Promise<boolean> {
console.log(` ${CONFIG_PATH}`);
console.log("");

const startAns = await ask(rl, " Would you like to configure your API key now? [Y/n] (default Y): ");
if (/^n(o)?$/i.test(startAns)) {
console.log("");
console.log(" No problem! You can configure ArrowCode later by running: arrowcode --setup");
console.log("");
return true;
}

console.log("");
console.log(" Provider:");
console.log(" 1) NVIDIA NIM (default — free keys at build.nvidia.com)");
console.log(" 2) OpenAI");
console.log(" 3) Anthropic");
console.log(" 4) Ollama (local, no key)");
console.log(" 5) Custom OpenAI-compatible base URL");
console.log(" 0) Cancel / Set up later");
console.log("");

const pAns = await ask(rl, " Choose [1-5] (default 1): ");
const pAns = await ask(rl, " Choose [0-5] (default 1): ");
if (pAns === "0" || pAns.toLowerCase() === "cancel") {
console.log("");
console.log(" No problem! You can configure ArrowCode later by running: arrowcode --setup");
console.log("");
return true;
}

const map: Record<string, ProviderId> = {
"": "nim",
"1": "nim",
Expand Down Expand Up @@ -133,7 +150,7 @@ export async function runSetupWizard(): Promise<boolean> {
console.log("");
console.log(" No API key entered. Setup cancelled.");
console.log(" Re-run: arrowcode --setup");
return false;
return true;
}

const yoloAns = await ask(
Expand Down
Loading