diff --git a/bin/arrowcode b/bin/arrowcode old mode 100644 new mode 100755 index 3ca63e4..06c757f --- a/bin/arrowcode +++ b/bin/arrowcode @@ -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" "$@" diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 diff --git a/src/index.ts b/src/index.ts index eb83f63..c23fcf6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 diff --git a/src/setup/wizard.ts b/src/setup/wizard.ts index 5b17330..0c41664 100644 --- a/src/setup/wizard.ts +++ b/src/setup/wizard.ts @@ -61,15 +61,32 @@ export async function runSetupWizard(): Promise { 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 = { "": "nim", "1": "nim", @@ -133,7 +150,7 @@ export async function runSetupWizard(): Promise { console.log(""); console.log(" No API key entered. Setup cancelled."); console.log(" Re-run: arrowcode --setup"); - return false; + return true; } const yoloAns = await ask(