Skip to content

Add deepstudio/private-install-v2.ps1 and private-install-v2.sh with Azure CLI token auth, auto-install, Node.js management, and colorized UI#716

Draft
Copilot wants to merge 13 commits intomainfrom
copilot/improve-private-install-script
Draft

Add deepstudio/private-install-v2.ps1 and private-install-v2.sh with Azure CLI token auth, auto-install, Node.js management, and colorized UI#716
Copilot wants to merge 13 commits intomainfrom
copilot/improve-private-install-script

Conversation

Copy link

Copilot AI commented Feb 6, 2026

  • Revert private-install-v2.sh to 4f58b8b (colored version with ESC=$(printf '\033'))
  • Fix mktemp template: remove .npmrc extension so template ends with X characters (required by macOS mktemp)
  • This also fixes the cascading "No such file or directory" error on line 368 (caused by empty $TMP_NPMRC when mktemp failed)
  • PS1 script unchanged
  • Validate bash syntax (no errors)
Original prompt

under the deepstudio folder, create a new private install , call deepstudio/private-install-v2.ps1 and do what's in deepstudio/private-install.ps1, but improve it with:

  1. for the ado token input, if the user already have done az login command, use it to get the authenticate with the registery of https://microsoft.pkgs.visualstudio.com/OS/_packaging/DeepStudio/npm/registry/ directly and so we don't need user to provide the token any more. If possible we don't need to create a new ADO path token at all and we just get a temp token to access it.

And after the install, give the user a input to ask whether we should start the deepstudio-server directly, if user enter or hit y, we launch it.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 6, 2026 07:11
…d auto-launch prompt

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve deepstudio/private-install script for ADO token handling Add deepstudio/private-install-v2.ps1 with Azure CLI token auth and auto-launch Feb 6, 2026
Copilot AI requested a review from hydraxman February 6, 2026 07:13
@hydraxman
Copy link
Member

for this url, store it in base64 format please, don't want other to see or search it:
https://microsoft.pkgs.visualstudio.com/OS/_packaging/DeepStudio/npm/registry/
@copilot

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

for this url, store it in base64 format please, don't want other to see or search it:
https://microsoft.pkgs.visualstudio.com/OS/_packaging/DeepStudio/npm/registry/
@copilot

Done in 561c165. The registry URL is now stored as a base64 string ($DefaultRegistryB64) and decoded at runtime with [System.Convert]::FromBase64String(). The plaintext URL no longer appears anywhere in the file.

@hydraxman
Copy link
Member

@copilot this is great enough, 2 tips:
don't output the registery url on console or mask the most part of it
Improve the overall console ouput to make it beautiful and print a rainbow color DeepStuidio Installer banner, and improve the other interactive output to make it appealing and delightful

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot this is great enough, 2 tips:
don't output the registery url on console or mask the most part of it
Improve the overall console ouput to make it beautiful and print a rainbow color DeepStui...

Done in ec3bf6e. Changes:

  1. Registry URL masked — console now shows https://micr****t.com/**** instead of the full URL (via Mask-Url helper)
  2. Rainbow ASCII banner — 6-color gradient "DeepStudio Installer v2" banner at startup
  3. Colorized output — Info (cyan), Warn (yellow), Fail (red), Success (green), Dim (gray) with consistent indentation
  4. Styled box layouts — Unicode box-drawing characters for settings panel, PAT prompt, success/error banners
  5. Emojis — 📦 🔧 🧪 📝 🔍 🔑 📄 🎉 🚀 throughout the flow

Copilot AI changed the title Add deepstudio/private-install-v2.ps1 with Azure CLI token auth and auto-launch Add deepstudio/private-install-v2.ps1 with Azure CLI token auth, auto-launch, and colorized UI Feb 6, 2026
@hydraxman
Copy link
Member

@copilot if we find out the user has not install az cli, we pop up and ask whether want to install az cli, if user says no, we fall back to pat ask, but if user says yes, we help user install it via command (maybe winget?) and then ask user to do az login, and then we fetch token.

And in the fetch token process, ask the user to enter the ADO org name, the default value is microsoft so user can put just enter to go with microsoft.

…efault

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot if we find out the user has not install az cli, we pop up and ask whether want to install az cli, if user says no, we fall back to pat ask, but if user says yes, we help user install it via c...

Done in 0598855. Changes:

  1. Azure CLI install prompt — When az is not found, shows a styled prompt asking Install Azure CLI now via winget? [Y/n]. If yes, runs winget install --id Microsoft.AzureCLI and refreshes PATH. If no or winget unavailable, falls back to PAT.
  2. Auto az login — If az is installed but no valid session exists, automatically prompts az login and retries token fetch after login.
  3. ADO org name input — Prompts Enter ADO org name [microsoft] with a default of "microsoft" (press Enter to accept). The registry URL is constructed from the org name.

Copilot AI changed the title Add deepstudio/private-install-v2.ps1 with Azure CLI token auth, auto-launch, and colorized UI Add deepstudio/private-install-v2.ps1 with Azure CLI token auth, auto-install, and colorized UI Feb 6, 2026
@hydraxman
Copy link
Member

@copilot before any nodejs script / command run, we check if node is installed and if not we try to use winget to install after confirming with user. if it's installed, we check the version, need to older than 22, we need to confirm with user and upgrade it with winget.

…rement

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot before any nodejs script / command run, we check if node is installed and if not we try to use winget to install after confirming with user. if it's installed, we check the version, need to o...

Done in 1faa019. The Require-Npm function has been replaced with Require-Node which:

  1. Checks if Node.js is installed — if not, prompts Install Node.js via winget? [Y/n] and runs winget install --id OpenJS.NodeJS.LTS
  2. Checks version >= 22 — if older, shows current vs required version in a styled box and prompts Upgrade Node.js to latest LTS via winget? [Y/n], then runs winget upgrade --id OpenJS.NodeJS.LTS
  3. Falls back gracefully — if user declines or winget is unavailable, shows the manual download link and exits
  4. Final npm check — verifies npm is available after install/upgrade (in case a terminal restart is needed)

…/Linux

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot for the power shell, I saw a issue, it prints below, so the upgrade logic is not working yet, and after get it fixed, add a shell in the same folder to run this in mac and linux with same log...

Done in 37ae4d2. Two fixes:

PowerShell fix:

  • The winget install "already installed" exit code (-1978335189 / APPINSTALLER_CLI_ERROR_PACKAGE_ALREADY_INSTALLED) is now treated as success instead of a failure
  • Extracted Install-NodeViaWinget and Upgrade-NodeViaWinget helpers for cleaner flow
  • Upgrade-NodeViaWinget has a fallback: if winget upgrade fails, it tries winget uninstall + winget install to force a clean reinstall

New shell script (private-install-v2.sh):

  • Same logic and colorized output as the PowerShell version
  • Auto-detects system package manager (brew, apt, dnf, yum, pacman)
  • Node.js install/upgrade, Azure CLI install, az login token auth, PAT fallback, ADO org prompt, post-install launch — all matching the PS1 flow
  • Rainbow banner, Unicode box-drawing, emojis, and colored output

Copilot AI changed the title Add deepstudio/private-install-v2.ps1 with Azure CLI token auth, auto-install, Node.js management, and colorized UI Add deepstudio/private-install-v2.ps1 and private-install-v2.sh with Azure CLI token auth, auto-install, Node.js management, and colorized UI Feb 6, 2026
@hydraxman
Copy link
Member

@copilot in the .sh version the output is very weird, please fix:

\033[0;31m ____ ____ _ _ _ \033[0m
\033[0;33m | _ \ ___ ___ _ __ / || | _ _ __| () ___ \033[0m
\033[0;32m | | | |/ _ / _ \ '
\___ | | | | |/ ` | |/ _ \ \033[0m
\033[0;36m | |
| | / / |) |) | || || | (| | | () |\033[0m
\033[0;34m |____/ _|_
| ./|/ _|_,|_,||_/ \033[0m
\033[0;35m |_| I n s t a l l e r v2 \033[0m

┌─────────────────────────────────────────┐
│ 📦 Package: deepstudio-server@latest │
│ 🔧 Verbose: OFF │
│ 🧪 DryRun: OFF │
│ 📝 LogFile: OFF │
└─────────────────────────────────────────┘

🏢 Using org: # Trim trailing slash
Registry: https://# Tr****.com/****

🔍 Azure CLI found. Checking login session...

✔ Obtained temporary access token from Azure CLI.
✔ Using temporary token from Azure CLI (no PAT creation needed).

Token (masked): eyJ****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************bzg

📄 Preparing isolated npm config...

📦 Installing deepstudio-server@latest ...

npm warn invalid config registry="https://# Trim trailing slash.pkgs.visualstudio.com/OS/_packaging/DeepStudio/npm/registry/" set in command line options
npm warn invalid config Must be full url with "http://"
npm warn Unknown user config "//". This will stop working in the next major version of npm.
npm error code ERR_INVALID_URL
npm error Invalid URL
npm error A complete log of this run can be found in: /Users/bsp/.npm/_logs/2026-02-06T16_55_31_703Z-debug-0.log

… for piped execution

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot in the .sh version the output is very weird, please fix:

...

Fixed in e69a3e9. Two root causes:

  1. Colors not rendering — The color variables used '\033[...' (single quotes) which stores literal backslash characters. Changed to $'\033[...' (ANSI-C quoting) so the variables contain real escape bytes that work with any printf/echo.

  2. Registry URL and org name broken — When the script is run via pipe (curl ... | bash), read reads from stdin (the pipe) instead of the terminal, so it picks up script lines as input. Fixed all read calls to use < /dev/tty to always read from the terminal.

@hydraxman
Copy link
Member

@copilot the sh version is still broken:
033[0;31m ____ ____ _ _ _ \033[0m
\033[0;33m | _ \ ___ ___ _ __ / || | _ _ __| () ___ \033[0m
\033[0;32m | | | |/ _ / _ \ '
\___ | | | | |/ ` | |/ _ \ \033[0m
\033[0;36m | |
| | / / |) |) | || || | (| | | () |\033[0m
\033[0;34m |____/ _|_
| ./|/ _|_,|_,||_/ \033[0m
\033[0;35m |_| I n s t a l l e r v2 \033[0m

┌─────────────────────────────────────────┐
│ 📦 Package: deepstudio-server@latest │
│ 🔧 Verbose: OFF │
│ 🧪 DryRun: OFF │
│ 📝 LogFile: OFF │
└─────────────────────────────────────────┘

🏢 Using org: # Trim trailing slash
Registry: https://# Tr****.com/****

🔍 Azure CLI found. Checking login session...
✔ Obtained temporary access token from Azure CLI.
✔ Using temporary token from Azure CLI (no PAT creation needed).

Token (masked): eyJ****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************bzg

📄 Preparing isolated npm config...

📦 Installing deepstudio-server@latest ...

npm warn invalid config registry="https://# Trim trailing slash.pkgs.visualstudio.com/OS/_packaging/DeepStudio/npm/registry/" set in command line options
npm warn invalid config Must be full url with "http://"
npm warn Unknown user config "//". This will stop working in the next major version of npm.
npm error code ERR_INVALID_URL
npm error Invalid URL
npm error A complete log of this run can be found in: /Users/bsp/.npm/_logs/2026-02-06T17_11_42_564Z-debug-0.log

✔ Cleanup complete.

…gs, fix b64_decode for macOS

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot the sh version is still broken:
033[0;31m ____ ____ _ _ _ \033[0m
\033[0;33m | _ \ ___ ___ _ __ / _|| | _ _ __| () ___ \033[0m
...

Fixed in 538b2c3. Three root causes:

  1. Colors — Changed from $'\033[...]' (ANSI-C quoting, not portable) to $(printf '\033[...]') which generates real ANSI escape bytes on all shells and platforms including macOS.

  2. Broken format arguments — The previous sed-based fix introduced %b format specifiers with incorrect argument ordering (color codes and text values were swapped). Reverted all box-drawing printf calls to use embedded ${VAR} in the format string, which works correctly since the variables now contain real escape bytes.

  3. b64_decode on macOS — Restructured to try base64 -D (macOS) first, then base64 -d (Linux), with proper set -e-safe error handling using local variables.

@hydraxman
Copy link
Member

@copilot 我发现目前 .sh 脚本存在的问题了:

  1. 我直接下载运行脚本是好的,但是直接从云端执行,就会出现乱码,可能原因是什么?是不是文件头或者编码不对?确保是utf-8,我运行的命令是: curl -fsSL https://aka.ms/deepstudio-install-linux | bash
  2. 在mac上npm install -g要更高的权限,需要用户sudo,如果安装出现相关失败,可以加一下elevate的脚本,提升权限再试。错误例子如下:
    npm error code EACCES
    npm error syscall mkdir
    npm error path /usr/local/lib/node_modules/deepstudio-server
    npm error errno -13
    npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/deepstudio-server'
    npm error at async mkdir (node:internal/fs/promises:858:10)
    npm error at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:572:20
    npm error at async Promise.allSettled (index 0)
    npm error at async #reifyPackages (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:309:11)
    npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:121:5)
    npm error at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
    npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:208:9)
    npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:67:5) {
    npm error errno: -13,

…EACCES on macOS

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 7, 2026

@copilot 我发现目前 .sh 脚本存在的问题了:

  1. 我直接下载运行脚本是好的,但是直接从云端执行,就会出现乱码,可能原因是什么?是不是文件头或者�...

Fixed in 4f58b8b.

Issue 1 (colors broken via curl | bash): Changed the color initialization to use a single ESC=$(printf '\033') call and then build all colors via string concatenation (RED="${ESC}[0;31m"). This minimizes command substitution during piped execution. Also confirmed the file is UTF-8 with no BOM and Unix line endings.

Issue 2 (EACCES on macOS): When npm install -g fails, the script now prompts Retry with sudo? [Y/n] and re-runs with sudo npm install -g .... This handles the macOS permission issue for /usr/local/lib/node_modules/.

@hydraxman
Copy link
Member

@copilot .sh脚本还是有问题,这样,我们排除一下,把目前的彩色打印的逻辑都从sh脚本中去掉吧 (ps1脚本不用改),先用一个黑白的版本

…utput

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 7, 2026

@copilot .sh脚本还是有问题,这样,我们排除一下,把目前的彩色打印的逻辑都从sh脚本中去掉吧 (ps1脚本不用改),先用一个黑白的版本

Done in 05f8fd4. Removed all ANSI escape codes and color logic from the .sh script. It now uses plain echo for all output — no escape sequences anywhere in the file. The PS1 script is unchanged. All emojis, box-drawing, banner, and logic (Node.js management, Azure CLI, sudo retry, /dev/tty reads) are preserved.

@hydraxman
Copy link
Member

@copilot 可否revert回到4f58b8b,我发现这个版本是好使的,同时,修复以下问题:
mktemp: mkstemp failed on /tmp/deepstudio-npmrc-XXXXXXXXXX.npmrc: File exists
📄 Preparing isolated npm config...
bash: line 368: : No such file or directory

…acOS

Co-authored-by: hydraxman <8344245+hydraxman@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 7, 2026

@copilot 可否revert回到4f58b8b,我发现这个版本是好使的,同时,修复以下问题:
mktemp: mkstemp failed on /tmp/deepstudio-npmrc-XXXXXXXXXX.npmrc: File exists
📄 Preparing...

Done in fcd6e0e. Reverted to the 4f58b8b colored version and fixed the mktemp error.

The root cause: macOS mktemp requires the template to end with X characters. The template /tmp/deepstudio-npmrc-XXXXXXXXXX.npmrc failed because .npmrc came after the Xs. Changed to /tmp/deepstudio-npmrc-XXXXXXXXXX (no extension). This also fixes the cascading "No such file or directory" error — that was caused by $TMP_NPMRC being empty after mktemp failed.

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