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
5 changes: 5 additions & 0 deletions .changeset/proud-boats-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@calycode/cli": patch
---

fix: improve native host setup reliability
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bat text eol=crlf
104 changes: 78 additions & 26 deletions packages/cli/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,59 @@ This directory contains installation scripts for the CalyCode CLI and Chrome Nat

```
scripts/
├── installer/ # Production installers (for end-users)
│ ├── install.sh # Unix (macOS, Linux) installer
│ ├── install.ps1 # Windows PowerShell installer
│ └── install.bat # Windows batch wrapper (launches PowerShell)
├── dev/ # Development scripts (for CLI developers)
│ ├── install-unix.sh # Unix development setup
│ └── install-win.bat # Windows development setup
└── README.md # This file
├── installer/ # Production installers (for end-users)
│ ├── install.sh # Existing Unix installer (kept for compatibility)
│ ├── install-unix.sh # Explicit Unix/macOS entrypoint -> install.sh
│ ├── install.ps1 # Existing Windows PowerShell installer (kept)
│ ├── install-windows.ps1 # Explicit Windows PowerShell entrypoint -> install.ps1
│ ├── install.bat # Existing Windows CMD wrapper (kept)
│ └── install-windows.bat # Explicit Windows CMD entrypoint -> install.bat
├── dev/ # Development scripts (for CLI developers)
│ ├── install-unix.sh # Unix development setup
│ └── install-win.bat # Windows development setup
└── README.md # This file
```

## For End-Users

### One-liner Installation
### One-line Installation Commands (Recommended for Extension)

**macOS / Linux:**
Use these per detected user agent/shell.

**Unix/macOS (Bash):**

```bash
curl -fsSL https://get.calycode.com/install.sh | bash
curl -fsSL https://links.calycode.com/install-cli-unix | bash
```

**Unix/macOS (legacy URL kept):**

```bash
curl -fsSL https://links.calycode.com/install-cli | bash
```

**Windows (PowerShell):**

```powershell
irm https://get.calycode.com/install.ps1 | iex
irm https://links.calycode.com/install-cli-windows-ps1 | iex
```

**Windows (PowerShell, legacy URL kept):**

```powershell
irm https://links.calycode.com/install-cli.ps1 | iex
```

**Windows (CMD):**
Download and run `install.bat`, or:

```cmd
curl -fsSL https://get.calycode.com/install.bat -o install.bat && install.bat
curl -fsSL https://links.calycode.com/install-cli-windows-bat -o install-windows.bat && install-windows.bat
```

**Windows (CMD, legacy URL kept):**

```cmd
curl -fsSL https://links.calycode.com/install-cli.bat -o install.bat && install.bat
```

### What the Installer Does
Expand All @@ -48,30 +70,46 @@ curl -fsSL https://get.calycode.com/install.bat -o install.bat && install.bat

### Installation Options

**Unix (`install.sh`):**
**Unix (`install-unix.sh` or `install.sh`):**

```bash
# Install specific version
curl -fsSL https://get.calycode.com/install.sh | bash -s -- --version 1.2.3
curl -fsSL https://links.calycode.com/install-cli-unix | bash -s -- --version 1.2.3

# Skip native host configuration
curl -fsSL https://get.calycode.com/install.sh | bash -s -- --skip-native-host
curl -fsSL https://links.calycode.com/install-cli-unix | bash -s -- --skip-native-host

# Uninstall
curl -fsSL https://get.calycode.com/install.sh | bash -s -- --uninstall
curl -fsSL https://links.calycode.com/install-cli-unix | bash -s -- --uninstall
```

**Windows (`install.ps1`):**
**Windows PowerShell (`install-windows.ps1` or `install.ps1`):**

```powershell
# Install specific version
.\install.ps1 -Version 1.2.3
# Install latest
irm https://links.calycode.com/install-cli-windows-ps1 | iex

# Local script usage: install specific version
.\install-windows.ps1 -Version 1.2.3

# Skip native host configuration
.\install.ps1 -SkipNativeHost
.\install-windows.ps1 -SkipNativeHost

# Uninstall
.\install.ps1 -Uninstall
.\install-windows.ps1 -Uninstall
```

### Environment Variables (Unix)

`install.sh` / `install-unix.sh` supports:

- `CALYCODE_VERSION=1.2.3` - install a specific version
- `CALYCODE_SKIP_NATIVE_HOST=1` - skip `caly-xano opencode init`

Example:

```bash
curl -fsSL https://links.calycode.com/install-cli-unix | CALYCODE_VERSION=1.2.3 CALYCODE_SKIP_NATIVE_HOST=1 bash -s --
```
Comment on lines +111 to 113
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix env-var example so variables reach the installer process.

The current example sets CALYCODE_VERSION/CALYCODE_SKIP_NATIVE_HOST on curl, not on bash, so the installer won’t read them.

Suggested doc fix
-CALYCODE_VERSION=1.2.3 CALYCODE_SKIP_NATIVE_HOST=1 curl -fsSL https://links.calycode.com/install-cli-unix | bash
+curl -fsSL https://links.calycode.com/install-cli-unix | CALYCODE_VERSION=1.2.3 CALYCODE_SKIP_NATIVE_HOST=1 bash
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```bash
CALYCODE_VERSION=1.2.3 CALYCODE_SKIP_NATIVE_HOST=1 curl -fsSL https://links.calycode.com/install-cli-unix | bash
```
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/scripts/README.md` around lines 111 - 113, The example sets
CALYCODE_VERSION and CALYCODE_SKIP_NATIVE_HOST on the curl process so the
installer won't see them; change the command so the env vars are applied to the
bash installer process instead (e.g. export them before running, use bash -c
"$(curl -fsSL ...)", or pipe curl into bash with the env vars in front of bash
like `curl -fsSL https://links.calycode.com/install-cli-unix |
CALYCODE_VERSION=1.2.3 CALYCODE_SKIP_NATIVE_HOST=1 bash -s --`), update the
README example accordingly so the installer reads CALYCODE_VERSION and
CALYCODE_SKIP_NATIVE_HOST.


## For Developers
Expand Down Expand Up @@ -107,12 +145,26 @@ The `dev/` scripts are for developers working on the CLI itself. They assume:

The production installers are hosted at:

- `https://get.calycode.com/install.sh`
- `https://get.calycode.com/install.ps1`
- `https://get.calycode.com/install.bat`
- Legacy URLs (kept):
- `https://links.calycode.com/install-cli` (Unix)
- `https://links.calycode.com/install-cli.ps1` (Windows PowerShell)
- `https://links.calycode.com/install-cli.bat` (Windows CMD)
- Explicit OS URLs (recommended):
- `https://links.calycode.com/install-cli-unix` -> `installer/install-unix.sh`
- `https://links.calycode.com/install-cli-windows-ps1` -> `installer/install-windows.ps1`
- `https://links.calycode.com/install-cli-windows-bat` -> `installer/install-windows.bat`

These URLs should be configured as a GitHub Pages site or CDN pointing to the `scripts/installer/` directory.

## Extension Mapping (User Agent -> Command)

Suggested mapping for extension-side install prompts:

- `win32` + PowerShell available -> `irm https://links.calycode.com/install-cli-windows-ps1 | iex`
- `win32` fallback -> `curl -fsSL https://links.calycode.com/install-cli-windows-bat -o install-windows.bat && install-windows.bat`
- `darwin` -> `curl -fsSL https://links.calycode.com/install-cli-unix | bash`
- `linux` -> `curl -fsSL https://links.calycode.com/install-cli-unix | bash`

## Troubleshooting

### "caly-xano command not found" after installation
Expand Down
9 changes: 9 additions & 0 deletions packages/cli/scripts/installer/install-unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Unix/macOS installer entrypoint.
# Delegates to the existing shared installer implementation.

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

exec "${SCRIPT_DIR}/install.sh" "$@"
9 changes: 9 additions & 0 deletions packages/cli/scripts/installer/install-windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
REM Windows installer entrypoint.
REM Delegates to existing shared batch installer implementation.

setlocal
set "SCRIPT_DIR=%~dp0"

call "%SCRIPT_DIR%install.bat" %*
exit /b %ERRORLEVEL%
Comment on lines +1 to +9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use CRLF line endings for this batch entrypoint.

This file is committed with LF-only endings; .bat parsing can become unreliable in some Windows environments. Please convert it to CRLF before merge.

🧰 Tools
🪛 Blinter (1.0.112)

[error] 1-1: Unix line endings detected. Explanation: Batch file uses Unix line endings (LF-only) which can cause GOTO/CALL label parsing failures and script malfunction due to Windows batch parser 512-byte boundary bugs. Recommendation: Convert file to Windows line endings (CRLF). Use tools like dos2unix, notepad++, or configure git with 'git config core.autocrlf true'. Context: File uses Unix line endings (LF-only) - 9 LF sequences found

(E018)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/scripts/installer/install-windows.bat` around lines 1 - 9, The
file install-windows.bat currently uses LF-only endings which can break Windows
batch parsing; convert install-windows.bat to use CRLF line endings (ensure the
file uses CRLF for every line) and verify the script still contains the existing
lines (setlocal, set "SCRIPT_DIR=%~dp0", call "%SCRIPT_DIR%install.bat" %*, exit
/b %ERRORLEVEL%) so the batch entrypoint behavior is unchanged; update git
attributes or the commit so .bat files are saved with CRLF to prevent
regression.

22 changes: 22 additions & 0 deletions packages/cli/scripts/installer/install-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#Requires -Version 5.1
<#
.SYNOPSIS
Windows installer entrypoint.

.DESCRIPTION
Delegates to the existing shared PowerShell installer implementation (install.ps1).
#>

[CmdletBinding()]
param(
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$Args
)

$ErrorActionPreference = 'Stop'

$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$target = Join-Path $scriptDir 'install.ps1'

& $target @Args
exit $LASTEXITCODE
Loading