Skip to content

installer: abort on declined ArmorIQ connect (mirrors armorcopilot pattern)#23

Merged
Pulkit7070 merged 1 commit into
mainfrom
installer/abort-on-decline
Jun 3, 2026
Merged

installer: abort on declined ArmorIQ connect (mirrors armorcopilot pattern)#23
Pulkit7070 merged 1 commit into
mainfrom
installer/abort-on-decline

Conversation

@Harihara04sudhan

Copy link
Copy Markdown
Contributor

Summary

Previously, pressing N at "Connect your ArmorIQ account now?" let the installer complete with a silent "no problem, run armoriq login anytime" message — leaving the plugin installed in a partial/offline state. Per CTO direction, ArmorCodex requires an ArmorIQ account; there is no documented offline path.

This PR adds an abort_install() function that:

  1. Strips the managed block from ~/.codex/config.toml
  2. Removes ~/.codex/hooks.json (only if it's ours)
  3. Removes ~/.armoriq/armorCodex plugin source dir
  4. Prints "ArmorCodex requires an ArmorIQ account. Install aborted." + link to https://armoriq.ai
  5. Exits 1 (non-zero)

When abort fires

  • No TTY available for interactive login (CI / scripted runs without ARMORIQ_API_KEY set)
  • User answers N at the connect prompt
  • armoriq CLI not found and no npx fallback runs
  • armoriq login returns non-zero or no credentials.json materializes after login attempt

When abort does NOT fire (happy paths)

  • Existing ~/.armoriq/credentials.json → installer skips the prompt entirely with "ArmorIQ credentials already present"
  • ARMORIQ_API_KEY env var set → same skip
  • User answers Y and login succeeds → continues normally

Skips the connect prompt entirely if credentials are already present — same logic as armorcopilot installer.

Cross-reference

Mirrors armoriq/armorCopilot#5 (already merged). After this PR merges, both products have identical install-or-abort semantics, and our docs / customer messaging can claim "no offline path" consistently.

Follow-up

After merge, the landing-repo copy at armoriq/armorIQ-landing/public/install_armorcodex.sh needs a sync PR so curl -fsSL https://armoriq.ai/install_armorcodex.sh | bash serves the new behavior.

Test plan

  • Fresh machine without credentials: run installer, press N → see "Install aborted." + non-zero exit + ~/.armoriq/armorCodex gone + ~/.codex/hooks.json gone + no [mcp_servers.armorcodex-policy] block in ~/.codex/config.toml.
  • Existing credentials present: run installer → "ArmorIQ credentials already present" → skips prompt → completes happy path.
  • Press Y at the prompt → device-flow login proceeds → success-finale prints normally.
  • Re-run on a machine with both plugin and credentials → falls into update mode (already in place per recent install_armorcodex.sh detect_mode) → no prompt fires.

🤖 Generated with Claude Code

…ttern)

Previously, pressing N at the "Connect your ArmorIQ account now?" prompt
let the install complete with a silent "no problem, run armoriq login
anytime" message — leaving the plugin installed in a partial/offline
state. Per CTO direction, ArmorCodex requires an ArmorIQ account; there
is no documented offline path.

This commit adds an abort_install() function that:
- Strips the managed block from ~/.codex/config.toml
- Removes ~/.codex/hooks.json (only if it's ours)
- Removes ~/.armoriq/armorCodex plugin source
- Prints "ArmorCodex requires an ArmorIQ account. Install aborted." +
  link to https://armoriq.ai
- Exits 1

abort_install fires when:
- No TTY is available for interactive login
- User answers N at the connect prompt
- armoriq CLI is not found and no fallback runs
- armoriq login returns non-zero or no credentials.json materializes

Skips the connect prompt entirely if credentials are already present
(same logic as armorcopilot installer). Also tries armoriq-dev first so
the dev SDK works in test environments.

Mirrors armoriq/armorCopilot#5 (already merged for armorcopilot).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 13:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the ArmorCodex installer to enforce mandatory ArmorIQ authentication by aborting (and rolling back) installation when the user can’t or won’t connect an ArmorIQ account, aligning behavior with the armorCopilot installer pattern.

Changes:

  • Added abort_install() to rollback Codex config/hook wiring and remove the plugin directory, then exit non-zero.
  • Updated connect_to_armoriq() to skip prompting when credentials/API key already exist, and to abort on non-interactive runs, declined prompts, missing CLI, or failed login.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install_armorcodex.sh
Comment on lines +477 to 480
if [[ -n "${ARMORIQ_API_KEY:-}" ]] || [[ -f "$HOME/.armoriq/credentials.json" ]]; then
ok "ArmorIQ credentials already present"
return 0
fi
Comment thread install_armorcodex.sh
Comment on lines +457 to +459
if [[ -f "${GLOBAL_HOOKS}" ]] && grep -q "ArmorCodex" "${GLOBAL_HOOKS}" 2>/dev/null; then
rm -f "${GLOBAL_HOOKS}" && info "removed ${GLOBAL_HOOKS}" || true
fi
Comment thread install_armorcodex.sh
Comment on lines +460 to +462
if [[ -d "${INSTALL_HOME}" ]]; then
rm -rf "${INSTALL_HOME}" && info "removed plugin source ${INSTALL_HOME}" || true
fi
@Pulkit7070 Pulkit7070 merged commit 5ea3bf4 into main Jun 3, 2026
1 check passed
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.

3 participants