Skip to content

fix(dev): prompt for credentials before image build + fix CLI execute bit#21

Merged
pallakatos merged 4 commits into
mainfrom
johsh/fix-dev-credentials-prompt
Apr 14, 2026
Merged

fix(dev): prompt for credentials before image build + fix CLI execute bit#21
pallakatos merged 4 commits into
mainfrom
johsh/fix-dev-credentials-prompt

Conversation

@johnsonshi

@johnsonshi johnsonshi commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Problem

When azureclaw dev --build is run for the first time (no ~/.azureclaw/config.json), the credential prompt doesn't work properly. Additionally, make install-cli results in a permission denied error when running azureclaw.

Root causes

  1. Wrong step order — Credentials were prompted at step 2, after the Docker image build (step 1), which can take 10-20 minutes for Rust compilation. Users should be asked for credentials first.

  2. Spinner hides interactive promptstepper.step("Loading credentials...") starts an ora spinner that's still animating when inquirer.prompt() tries to display the interactive endpoint/model/API-key inputs. The spinner overwrites the prompt text, making it invisible or unresponsive.

  3. Missing execute bit on dist/index.jstsc doesn't preserve the executable permission on output files, so after npm link, running azureclaw fails with EACCES: permission denied.

Changes

cli/src/commands/dev.ts

  • Move credential check to step 1 (before image resolution/build)
  • Stop the stepper spinner before calling promptAndSaveCredentials() so inquirer prompts display correctly
  • Import loadConfig + promptAndSaveCredentials directly instead of ensureCredentials for finer control

cli/package.json

  • Add chmod +x dist/index.js to the build script so the CLI entry point is always executable after tsc

New first-run flow

1/3 ✓ Credentials configured       ← prompts immediately
2/3 ● Building sandbox image...     ← long build happens after creds are saved
3/3 ✓ Sandbox running

Testing

  • tsc --noEmit passes
  • All 159 vitest tests pass
  • oxlint — 0 errors
  • make install-cliazureclaw --help works (no permission denied)

johnsonshi and others added 2 commits April 8, 2026 15:38
On first run of `azureclaw dev --build`, credentials were prompted only
after the Docker image build (which can take 10-20 min for Rust). Two
issues:

1. Wrong step order: credentials should be asked first so users aren't
   surprised by a prompt after a long build, and don't waste time if
   they lack valid credentials.

2. Spinner conflict: the ora spinner from stepper.step() was still
   active when inquirer.prompt() tried to display interactive input,
   causing the prompts to be invisible/overwritten.

Fix: move credential check to step 1 (before image resolution), and
stop the spinner before calling promptAndSaveCredentials() so inquirer
prompts display correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tsc doesn't preserve the executable permission on output files, causing
'permission denied' when running azureclaw after npm link.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@johnsonshi johnsonshi changed the title fix(dev): prompt for credentials before image build fix(dev): prompt for credentials before image build + fix CLI execute bit Apr 8, 2026
johnsonshi and others added 2 commits April 8, 2026 16:40
- Model: clarify it must already exist in the Azure OpenAI resource
- API key: clarify it's the resource-level key, not a per-model key

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…esource

- Help text: explain that an existing Azure OpenAI resource with a
  deployed model is required
- --model flag: clarify it's an existing deployment name
- First-run prompt: tell user they need an existing resource + deployment

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@johnsonshi

johnsonshi commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator Author

Test plan:

 # ── 1. Tear down running dev containers + AGT stack ──────────
 docker rm -f azureclaw-dev-agent azureclaw-agt-relay azureclaw-agt-registry azureclaw-agt-postgres 2>/dev/null
 docker network rm azureclaw-dev 2>/dev/null
 docker volume rm azureclaw-dev-agent-data 2>/dev/null
 
 # ── 2. Remove dev Docker images ──────────────────────────────
 docker rmi azureclaw-sandbox:dev azureclaw-inference-router:dev agentmesh-relay:dev agentmesh-registry:dev 2>/dev/null
 
 # ── 3. Delete saved credentials (forces first-run prompt) ────
 rm -rf ~/.azureclaw
 
 # ── 4. Clean + rebuild + install CLI ─────────────────────────
 cd /Users/johnsonshi/repos/azureclaw.git/branches/johsh/fix-dev-credentials-prompt
 make clean
 make install-cli
 
 # ── 5. Verify CLI is executable ──────────────────────────────
 azureclaw --help
 
 # ── 6. Run dev --build (should prompt for creds FIRST) ───────
 azureclaw dev --build
 # Expected: immediately prompts for endpoint, model, API key
 #           BEFORE any Docker build starts

What to verify:

 - Step 5: azureclaw --help runs without permission denied
 - Step 6: credential prompts appear immediately (not after image build), inputs are visible (no spinner overwriting), and after entering valid creds they're saved to ~/.azureclaw/config.json + ~/.azureclaw/secrets.json
image image image image

@pallakatos
pallakatos merged commit f5e9170 into main Apr 14, 2026
13 checks passed
pallakatos pushed a commit that referenced this pull request May 12, 2026
… bit (#21)

* fix(dev): prompt for credentials before image build

On first run of `azureclaw dev --build`, credentials were prompted only
after the Docker image build (which can take 10-20 min for Rust). Two
issues:

1. Wrong step order: credentials should be asked first so users aren't
   surprised by a prompt after a long build, and don't waste time if
   they lack valid credentials.

2. Spinner conflict: the ora spinner from stepper.step() was still
   active when inquirer.prompt() tried to display interactive input,
   causing the prompts to be invisible/overwritten.

Fix: move credential check to step 1 (before image resolution), and
stop the spinner before calling promptAndSaveCredentials() so inquirer
prompts display correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(cli): set execute bit on dist/index.js after build

tsc doesn't preserve the executable permission on output files, causing
'permission denied' when running azureclaw after npm link.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(cli): clarify credential prompt labels

- Model: clarify it must already exist in the Azure OpenAI resource
- API key: clarify it's the resource-level key, not a per-model key

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(dev): clarify help text and prompts about existing Azure OpenAI resource

- Help text: explain that an existing Azure OpenAI resource with a
  deployed model is required
- --model flag: clarify it's an existing deployment name
- First-run prompt: tell user they need an existing resource + deployment

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pallakatos
pallakatos deleted the johsh/fix-dev-credentials-prompt branch June 1, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants